clitrigger 0.2.31 → 0.2.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/README_KR.md +4 -4
- package/dist/client/assets/{AnalyticsPanel-Czz0NzEx.js → AnalyticsPanel-C_WpyKmO.js} +1 -1
- package/dist/client/assets/{FloatingComposerController-5A3GJtK4-DK-xP1F6.js → FloatingComposerController-5A3GJtK4-CE609Eac.js} +1 -1
- package/dist/client/assets/{PlannerPageEditor-CVxYfC2H.js → PlannerPageEditor-DxKNSTFQ.js} +3 -3
- package/dist/client/assets/{TaskGraph-B-Q6pcPi.js → TaskGraph-D_YqAb0g.js} +1 -1
- package/dist/client/assets/VaultLayout-BxQnUzVI.js +161 -0
- package/dist/client/assets/{index-Cq1WsJW9.css → index-BijN9qji.css} +1 -1
- package/dist/client/assets/{index-BqdsG4pD.js → index-DWdFgnxz.js} +6 -6
- package/dist/client/assets/{style-Cjmi7Hhm.js → style-Pq-_A6JI.js} +1 -1
- package/dist/client/assets/{with-selector-BL03OU_c.js → with-selector-DbJDF1yn.js} +1 -1
- package/dist/client/index.html +2 -2
- package/electron/main.cjs +27 -11
- package/package.json +1 -1
- package/dist/client/assets/VaultLayout-SpzEwN8C.js +0 -161
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TaskGraph-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TaskGraph-D_YqAb0g.js","assets/style-Pq-_A6JI.js","assets/value-BTdN53H7.js","assets/with-selector-DbJDF1yn.js","assets/style-BZV40eAE.css","assets/PlannerPageEditor-DxKNSTFQ.js","assets/index-Vcq4gwWv.js","assets/clsx-B-dksMZM.js","assets/PlannerPageEditor-1-XUcFw6.css","assets/AnalyticsPanel-C_WpyKmO.js","assets/VaultLayout-BxQnUzVI.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function sC(e,s){for(var i=0;i<s.length;i++){const a=s[i];if(typeof a!="string"&&!Array.isArray(a)){for(const h in a)if(h!=="default"&&!(h in e)){const m=Object.getOwnPropertyDescriptor(a,h);m&&Object.defineProperty(e,h,m.get?m:{enumerable:!0,get:()=>a[h]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const h of document.querySelectorAll('link[rel="modulepreload"]'))a(h);new MutationObserver(h=>{for(const m of h)if(m.type==="childList")for(const f of m.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&a(f)}).observe(document,{childList:!0,subtree:!0});function i(h){const m={};return h.integrity&&(m.integrity=h.integrity),h.referrerPolicy&&(m.referrerPolicy=h.referrerPolicy),h.crossOrigin==="use-credentials"?m.credentials="include":h.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function a(h){if(h.ep)return;h.ep=!0;const m=i(h);fetch(h.href,m)}})();var bB=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Gh={exports:{}},Ro={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -61,10 +61,10 @@ Error generating stack: `+g.message+`
|
|
|
61
61
|
Please change the parent <Route path="${y}"> to <Route path="${y==="/"?"*":`${y}/*`}">.`)}let p=Ps(),u;if(s){let y=typeof s=="string"?Ia(s):s;fn(c==="/"||((x=y.pathname)==null?void 0:x.startsWith(c)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${y.pathname}" was given in the \`location\` prop.`),u=y}else u=p;let v=u.pathname||"/",b=v;if(c!=="/"){let y=c.replace(/^\//,"").split("/");b="/"+v.replace(/^\//,"").split("/").slice(y.length).join("/")}let C=qy(e,{pathname:b});Bs(d||C!=null,`No routes matched location "${u.pathname}${u.search}${u.hash}" `),Bs(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${u.pathname}${u.search}${u.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=t2(C&&C.map(y=>Object.assign({},y,{params:Object.assign({},f,y.params),pathname:Ks([c,a.encodeLocation?a.encodeLocation(y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:Ks([c,a.encodeLocation?a.encodeLocation(y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),h,i);return s&&w?k.createElement(hl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...u},navigationType:"POP"}},w):w}function JC(){let e=a2(),s=PC(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),i=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",h={padding:"0.5rem",backgroundColor:a},m={padding:"2px 4px",backgroundColor:a},f=null;return console.error("Error handled by React Router default ErrorBoundary:",e),f=k.createElement(k.Fragment,null,k.createElement("p",null,"💿 Hey developer 👋"),k.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",k.createElement("code",{style:m},"ErrorBoundary")," or"," ",k.createElement("code",{style:m},"errorElement")," prop on your route.")),k.createElement(k.Fragment,null,k.createElement("h2",null,"Unexpected Application Error!"),k.createElement("h3",{style:{fontStyle:"italic"}},s),i?k.createElement("pre",{style:h},i):null,f)}var QC=k.createElement(JC,null),rw=class extends k.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,s){return s.location!==e.location||s.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:s.error,location:s.location,revalidation:e.revalidation||s.revalidation}}componentDidCatch(e,s){this.props.onError?this.props.onError(e,s):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const i=KC(e.digest);i&&(e=i)}let s=e!==void 0?k.createElement(Vs.Provider,{value:this.props.routeContext},k.createElement(Cm.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?k.createElement(ZC,{error:e},s):s}};rw.contextType=FC;var Qh=new WeakMap;function ZC({children:e,error:s}){let{basename:i}=k.useContext(Ls);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let a=qC(s.digest);if(a){let h=Qh.get(s);if(h)throw h;let m=Jy(a.location,i);if(Xy&&!Qh.get(s))if(m.isExternal||a.reloadDocument)window.location.href=m.absoluteURL||m.to;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(m.to,{replace:a.replace}));throw Qh.set(s,f),f}return k.createElement("meta",{httpEquiv:"refresh",content:`0;url=${m.absoluteURL||m.to}`})}}return e}function e2({routeContext:e,match:s,children:i}){let a=k.useContext(Ha);return a&&a.static&&a.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=s.route.id),k.createElement(Vs.Provider,{value:e},i)}function t2(e,s=[],i){let a=i==null?void 0:i.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(s.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let h=e,m=a==null?void 0:a.errors;if(m!=null){let p=h.findIndex(u=>u.route.id&&(m==null?void 0:m[u.route.id])!==void 0);fn(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(m).join(",")}`),h=h.slice(0,Math.min(h.length,p+1))}let f=!1,o=-1;if(i&&a){f=a.renderFallback;for(let p=0;p<h.length;p++){let u=h[p];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(o=p),u.route.id){let{loaderData:v,errors:b}=a,C=u.route.loader&&!v.hasOwnProperty(u.route.id)&&(!b||b[u.route.id]===void 0);if(u.route.lazy||C){i.isStatic&&(f=!0),o>=0?h=h.slice(0,o+1):h=[h[0]];break}}}}let c=i==null?void 0:i.onError,d=a&&c?(p,u)=>{var v,b;c(p,{location:a.location,params:((b=(v=a.matches)==null?void 0:v[0])==null?void 0:b.params)??{},unstable_pattern:IC(a.matches),errorInfo:u})}:void 0;return h.reduceRight((p,u,v)=>{let b,C=!1,w=null,x=null;a&&(b=m&&u.route.id?m[u.route.id]:void 0,w=u.route.errorElement||QC,f&&(o<0&&v===0?(iw("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,x=null):o===v&&(C=!0,x=u.route.hydrateFallbackElement||null)));let y=s.concat(h.slice(0,v+1)),_=()=>{let S;return b?S=w:C?S=x:u.route.Component?S=k.createElement(u.route.Component,null):u.route.element?S=u.route.element:S=p,k.createElement(e2,{match:u,routeContext:{outlet:p,matches:y,isDataRoute:a!=null},children:S})};return a&&(u.route.ErrorBoundary||u.route.errorElement||v===0)?k.createElement(rw,{location:a.location,revalidation:a.revalidation,component:w,error:b,children:_(),routeContext:{outlet:null,matches:y,isDataRoute:!0},onError:d}):_()},null)}function Nm(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function n2(e){let s=k.useContext(Ha);return fn(s,Nm(e)),s}function s2(e){let s=k.useContext(Cu);return fn(s,Nm(e)),s}function r2(e){let s=k.useContext(Vs);return fn(s,Nm(e)),s}function Em(e){let s=r2(e),i=s.matches[s.matches.length-1];return fn(i.route.id,`${e} can only be used on routes that contain a unique "id"`),i.route.id}function i2(){return Em("useRouteId")}function a2(){var a;let e=k.useContext(Cm),s=s2("useRouteError"),i=Em("useRouteError");return e!==void 0?e:(a=s.errors)==null?void 0:a[i]}function o2(){let{router:e}=n2("useNavigate"),s=Em("useNavigate"),i=k.useRef(!1);return nw(()=>{i.current=!0}),k.useCallback(async(h,m={})=>{Bs(i.current,tw),i.current&&(typeof h=="number"?await e.navigate(h):await e.navigate(h,{fromRouteId:s,...m}))},[e,s])}var mv={};function iw(e,s,i){!s&&!mv[e]&&(mv[e]=!0,Bs(!1,i))}k.memo(l2);function l2({routes:e,future:s,state:i,isStatic:a,onError:h}){return sw(e,void 0,{state:i,isStatic:a,onError:h})}function ti(e){fn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function c2({basename:e="/",children:s=null,location:i,navigationType:a="POP",navigator:h,static:m=!1,unstable_useTransitions:f}){fn(!fl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=e.replace(/^\/*/,"/"),c=k.useMemo(()=>({basename:o,navigator:h,static:m,unstable_useTransitions:f,future:{}}),[o,h,m,f]);typeof i=="string"&&(i=Ia(i));let{pathname:d="/",search:p="",hash:u="",state:v=null,key:b="default",unstable_mask:C}=i,w=k.useMemo(()=>{let x=yr(d,o);return x==null?null:{location:{pathname:x,search:p,hash:u,state:v,key:b,unstable_mask:C},navigationType:a}},[o,d,p,u,v,b,a,C]);return Bs(w!=null,`<Router basename="${o}"> is not able to match the URL "${d}${p}${u}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:k.createElement(Ls.Provider,{value:c},k.createElement(hl.Provider,{children:s,value:w}))}function pv({children:e,location:s}){return XC(Pf(e),s)}function Pf(e,s=[]){let i=[];return k.Children.forEach(e,(a,h)=>{if(!k.isValidElement(a))return;let m=[...s,h];if(a.type===k.Fragment){i.push.apply(i,Pf(a.props.children,m));return}fn(a.type===ti,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),fn(!a.props.index||!a.props.children,"An index route cannot have child routes.");let f={id:a.props.id||m.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(f.children=Pf(a.props.children,m)),i.push(f)}),i}var Jc="get",Qc="application/x-www-form-urlencoded";function ju(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function u2(e){return ju(e)&&e.tagName.toLowerCase()==="button"}function d2(e){return ju(e)&&e.tagName.toLowerCase()==="form"}function h2(e){return ju(e)&&e.tagName.toLowerCase()==="input"}function f2(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function m2(e,s){return e.button===0&&(!s||s==="_self")&&!f2(e)}function If(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((s,i)=>{let a=e[i];return s.concat(Array.isArray(a)?a.map(h=>[i,h]):[[i,a]])},[]))}function p2(e,s){let i=If(e);return s&&s.forEach((a,h)=>{i.has(h)||s.getAll(h).forEach(m=>{i.append(h,m)})}),i}var Rc=null;function g2(){if(Rc===null)try{new FormData(document.createElement("form"),0),Rc=!1}catch{Rc=!0}return Rc}var x2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Zh(e){return e!=null&&!x2.has(e)?(Bs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Qc}"`),null):e}function v2(e,s){let i,a,h,m,f;if(d2(e)){let o=e.getAttribute("action");a=o?yr(o,s):null,i=e.getAttribute("method")||Jc,h=Zh(e.getAttribute("enctype"))||Qc,m=new FormData(e)}else if(u2(e)||h2(e)&&(e.type==="submit"||e.type==="image")){let o=e.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||o.getAttribute("action");if(a=c?yr(c,s):null,i=e.getAttribute("formmethod")||o.getAttribute("method")||Jc,h=Zh(e.getAttribute("formenctype"))||Zh(o.getAttribute("enctype"))||Qc,m=new FormData(o,e),!g2()){let{name:d,type:p,value:u}=e;if(p==="image"){let v=d?`${d}.`:"";m.append(`${v}x`,"0"),m.append(`${v}y`,"0")}else d&&m.append(d,u)}}else{if(ju(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Jc,a=null,h=Qc,f=e}return m&&h==="text/plain"&&(f=m,m=void 0),{action:a,method:i.toLowerCase(),encType:h,formData:m,body:f}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Tm(e,s){if(e===!1||e===null||typeof e>"u")throw new Error(s)}function b2(e,s,i,a){let h=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return i?h.pathname.endsWith("/")?h.pathname=`${h.pathname}_.${a}`:h.pathname=`${h.pathname}.${a}`:h.pathname==="/"?h.pathname=`_root.${a}`:s&&yr(h.pathname,s)==="/"?h.pathname=`${s.replace(/\/$/,"")}/_root.${a}`:h.pathname=`${h.pathname.replace(/\/$/,"")}.${a}`,h}async function y2(e,s){if(e.id in s)return s[e.id];try{let i=await import(e.module);return s[e.id]=i,i}catch(i){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function w2(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function _2(e,s,i){let a=await Promise.all(e.map(async h=>{let m=s.routes[h.route.id];if(m){let f=await y2(m,i);return f.links?f.links():[]}return[]}));return j2(a.flat(1).filter(w2).filter(h=>h.rel==="stylesheet"||h.rel==="preload").map(h=>h.rel==="stylesheet"?{...h,rel:"prefetch",as:"style"}:{...h,rel:"prefetch"}))}function gv(e,s,i,a,h,m){let f=(c,d)=>i[d]?c.route.id!==i[d].route.id:!0,o=(c,d)=>{var p;return i[d].pathname!==c.pathname||((p=i[d].route.path)==null?void 0:p.endsWith("*"))&&i[d].params["*"]!==c.params["*"]};return m==="assets"?s.filter((c,d)=>f(c,d)||o(c,d)):m==="data"?s.filter((c,d)=>{var u;let p=a.routes[c.route.id];if(!p||!p.hasLoader)return!1;if(f(c,d)||o(c,d))return!0;if(c.route.shouldRevalidate){let v=c.route.shouldRevalidate({currentUrl:new URL(h.pathname+h.search+h.hash,window.origin),currentParams:((u=i[0])==null?void 0:u.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function S2(e,s,{includeHydrateFallback:i}={}){return k2(e.map(a=>{let h=s.routes[a.route.id];if(!h)return[];let m=[h.module];return h.clientActionModule&&(m=m.concat(h.clientActionModule)),h.clientLoaderModule&&(m=m.concat(h.clientLoaderModule)),i&&h.hydrateFallbackModule&&(m=m.concat(h.hydrateFallbackModule)),h.imports&&(m=m.concat(h.imports)),m}).flat(1))}function k2(e){return[...new Set(e)]}function C2(e){let s={},i=Object.keys(e).sort();for(let a of i)s[a]=e[a];return s}function j2(e,s){let i=new Set;return new Set(s),e.reduce((a,h)=>{let m=JSON.stringify(C2(h));return i.has(m)||(i.add(m),a.push({key:m,link:h})),a},[])}function aw(){let e=k.useContext(Ha);return Tm(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function N2(){let e=k.useContext(Cu);return Tm(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Lm=k.createContext(void 0);Lm.displayName="FrameworkContext";function ow(){let e=k.useContext(Lm);return Tm(e,"You must render this element inside a <HydratedRouter> element"),e}function E2(e,s){let i=k.useContext(Lm),[a,h]=k.useState(!1),[m,f]=k.useState(!1),{onFocus:o,onBlur:c,onMouseEnter:d,onMouseLeave:p,onTouchStart:u}=s,v=k.useRef(null);k.useEffect(()=>{if(e==="render"&&f(!0),e==="viewport"){let w=y=>{y.forEach(_=>{f(_.isIntersecting)})},x=new IntersectionObserver(w,{threshold:.5});return v.current&&x.observe(v.current),()=>{x.disconnect()}}},[e]),k.useEffect(()=>{if(a){let w=setTimeout(()=>{f(!0)},100);return()=>{clearTimeout(w)}}},[a]);let b=()=>{h(!0)},C=()=>{h(!1),f(!1)};return i?e!=="intent"?[m,v,{}]:[m,v,{onFocus:Ao(o,b),onBlur:Ao(c,C),onMouseEnter:Ao(d,b),onMouseLeave:Ao(p,C),onTouchStart:Ao(u,b)}]:[!1,v,{}]}function Ao(e,s){return i=>{e&&e(i),i.defaultPrevented||s(i)}}function T2({page:e,...s}){let{router:i}=aw(),a=k.useMemo(()=>qy(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?k.createElement(D2,{page:e,matches:a,...s}):null}function L2(e){let{manifest:s,routeModules:i}=ow(),[a,h]=k.useState([]);return k.useEffect(()=>{let m=!1;return _2(e,s,i).then(f=>{m||h(f)}),()=>{m=!0}},[e,s,i]),a}function D2({page:e,matches:s,...i}){let a=Ps(),{future:h,manifest:m,routeModules:f}=ow(),{basename:o}=aw(),{loaderData:c,matches:d}=N2(),p=k.useMemo(()=>gv(e,s,d,m,a,"data"),[e,s,d,m,a]),u=k.useMemo(()=>gv(e,s,d,m,a,"assets"),[e,s,d,m,a]),v=k.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let w=new Set,x=!1;if(s.forEach(_=>{var N;let S=m.routes[_.route.id];!S||!S.hasLoader||(!p.some(D=>D.route.id===_.route.id)&&_.route.id in c&&((N=f[_.route.id])!=null&&N.shouldRevalidate)||S.hasClientLoader?x=!0:w.add(_.route.id))}),w.size===0)return[];let y=b2(e,o,h.unstable_trailingSlashAwareDataRequests,"data");return x&&w.size>0&&y.searchParams.set("_routes",s.filter(_=>w.has(_.route.id)).map(_=>_.route.id).join(",")),[y.pathname+y.search]},[o,h.unstable_trailingSlashAwareDataRequests,c,a,m,p,s,e,f]),b=k.useMemo(()=>S2(u,m),[u,m]),C=L2(u);return k.createElement(k.Fragment,null,v.map(w=>k.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...i})),b.map(w=>k.createElement("link",{key:w,rel:"modulepreload",href:w,...i})),C.map(({key:w,link:x})=>k.createElement("link",{key:w,nonce:i.nonce,...x,crossOrigin:x.crossOrigin??i.crossOrigin})))}function R2(...e){return s=>{e.forEach(i=>{typeof i=="function"?i(s):i!=null&&(i.current=s)})}}var M2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{M2&&(window.__reactRouterVersion="7.13.2")}catch{}function A2({basename:e,children:s,unstable_useTransitions:i,window:a}){let h=k.useRef();h.current==null&&(h.current=mC({window:a,v5Compat:!0}));let m=h.current,[f,o]=k.useState({action:m.action,location:m.location}),c=k.useCallback(d=>{i===!1?o(d):k.startTransition(()=>o(d))},[i]);return k.useLayoutEffect(()=>m.listen(c),[m,c]),k.createElement(c2,{basename:e,children:s,location:f.location,navigationType:f.action,navigator:m,unstable_useTransitions:i})}var lw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,zn=k.forwardRef(function({onClick:s,discover:i="render",prefetch:a="none",relative:h,reloadDocument:m,replace:f,unstable_mask:o,state:c,target:d,to:p,preventScrollReset:u,viewTransition:v,unstable_defaultShouldRevalidate:b,...C},w){let{basename:x,navigator:y,unstable_useTransitions:_}=k.useContext(Ls),S=typeof p=="string"&&lw.test(p),N=Jy(p,x);p=N.to;let D=VC(p,{relative:h}),j=Ps(),R=null;if(o){let U=km(o,[],j.unstable_mask?j.unstable_mask.pathname:"/",!0);x!=="/"&&(U.pathname=U.pathname==="/"?x:Ks([x,U.pathname])),R=y.createHref(U)}let[L,T,A]=E2(a,C),z=P2(p,{replace:f,unstable_mask:o,state:c,target:d,preventScrollReset:u,relative:h,viewTransition:v,unstable_defaultShouldRevalidate:b,unstable_useTransitions:_});function O(U){s&&s(U),U.defaultPrevented||z(U)}let H=!(N.isExternal||m),F=k.createElement("a",{...C,...A,href:(H?R:void 0)||N.absoluteURL||D,onClick:H?O:s,ref:R2(w,T),target:d,"data-discover":!S&&i==="render"?"true":void 0});return L&&!S?k.createElement(k.Fragment,null,F,k.createElement(T2,{page:D})):F});zn.displayName="Link";var O2=k.forwardRef(function({"aria-current":s="page",caseSensitive:i=!1,className:a="",end:h=!1,style:m,to:f,viewTransition:o,children:c,...d},p){let u=ml(f,{relative:d.relative}),v=Ps(),b=k.useContext(Cu),{navigator:C,basename:w}=k.useContext(Ls),x=b!=null&&U2(u)&&o===!0,y=C.encodeLocation?C.encodeLocation(u).pathname:u.pathname,_=v.pathname,S=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;i||(_=_.toLowerCase(),S=S?S.toLowerCase():null,y=y.toLowerCase()),S&&w&&(S=yr(S,w)||S);const N=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let D=_===y||!h&&_.startsWith(y)&&_.charAt(N)==="/",j=S!=null&&(S===y||!h&&S.startsWith(y)&&S.charAt(y.length)==="/"),R={isActive:D,isPending:j,isTransitioning:x},L=D?s:void 0,T;typeof a=="function"?T=a(R):T=[a,D?"active":null,j?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let A=typeof m=="function"?m(R):m;return k.createElement(zn,{...d,"aria-current":L,className:T,ref:p,style:A,to:f,viewTransition:o},typeof c=="function"?c(R):c)});O2.displayName="NavLink";var z2=k.forwardRef(({discover:e="render",fetcherKey:s,navigate:i,reloadDocument:a,replace:h,state:m,method:f=Jc,action:o,onSubmit:c,relative:d,preventScrollReset:p,viewTransition:u,unstable_defaultShouldRevalidate:v,...b},C)=>{let{unstable_useTransitions:w}=k.useContext(Ls),x=F2(),y=$2(o,{relative:d}),_=f.toLowerCase()==="get"?"get":"post",S=typeof o=="string"&&lw.test(o),N=D=>{if(c&&c(D),D.defaultPrevented)return;D.preventDefault();let j=D.nativeEvent.submitter,R=(j==null?void 0:j.getAttribute("formmethod"))||f,L=()=>x(j||D.currentTarget,{fetcherKey:s,method:R,navigate:i,replace:h,state:m,relative:d,preventScrollReset:p,viewTransition:u,unstable_defaultShouldRevalidate:v});w&&i!==!1?k.startTransition(()=>L()):L()};return k.createElement("form",{ref:C,method:_,action:y,onSubmit:a?c:N,...b,"data-discover":!S&&e==="render"?"true":void 0})});z2.displayName="Form";function B2(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function cw(e){let s=k.useContext(Ha);return fn(s,B2(e)),s}function P2(e,{target:s,replace:i,unstable_mask:a,state:h,preventScrollReset:m,relative:f,viewTransition:o,unstable_defaultShouldRevalidate:c,unstable_useTransitions:d}={}){let p=Hi(),u=Ps(),v=ml(e,{relative:f});return k.useCallback(b=>{if(m2(b,s)){b.preventDefault();let C=i!==void 0?i:tl(u)===tl(v),w=()=>p(e,{replace:C,unstable_mask:a,state:h,preventScrollReset:m,relative:f,viewTransition:o,unstable_defaultShouldRevalidate:c});d?k.startTransition(()=>w()):w()}},[u,p,v,i,a,h,s,e,m,f,o,c,d])}function uw(e){Bs(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let s=k.useRef(If(e)),i=k.useRef(!1),a=Ps(),h=k.useMemo(()=>p2(a.search,i.current?null:s.current),[a.search]),m=Hi(),f=k.useCallback((o,c)=>{const d=If(typeof o=="function"?o(new URLSearchParams(h)):o);i.current=!0,m("?"+d,c)},[m,h]);return[h,f]}var I2=0,H2=()=>`__${String(++I2)}__`;function F2(){let{router:e}=cw("useSubmit"),{basename:s}=k.useContext(Ls),i=i2(),a=e.fetch,h=e.navigate;return k.useCallback(async(m,f={})=>{let{action:o,method:c,encType:d,formData:p,body:u}=v2(m,s);if(f.navigate===!1){let v=f.fetcherKey||H2();await a(v,i,f.action||o,{unstable_defaultShouldRevalidate:f.unstable_defaultShouldRevalidate,preventScrollReset:f.preventScrollReset,formData:p,body:u,formMethod:f.method||c,formEncType:f.encType||d,flushSync:f.flushSync})}else await h(f.action||o,{unstable_defaultShouldRevalidate:f.unstable_defaultShouldRevalidate,preventScrollReset:f.preventScrollReset,formData:p,body:u,formMethod:f.method||c,formEncType:f.encType||d,replace:f.replace,state:f.state,fromRouteId:i,flushSync:f.flushSync,viewTransition:f.viewTransition})},[a,h,s,i])}function $2(e,{relative:s}={}){let{basename:i}=k.useContext(Ls),a=k.useContext(Vs);fn(a,"useFormAction must be used inside a RouteContext");let[h]=a.matches.slice(-1),m={...ml(e||".",{relative:s})},f=Ps();if(e==null){m.search=f.search;let o=new URLSearchParams(m.search),c=o.getAll("index");if(c.some(p=>p==="")){o.delete("index"),c.filter(u=>u).forEach(u=>o.append("index",u));let p=o.toString();m.search=p?`?${p}`:""}}return(!e||e===".")&&h.route.index&&(m.search=m.search?m.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(m.pathname=m.pathname==="/"?i:Ks([i,m.pathname])),tl(m)}function U2(e,{relative:s}={}){let i=k.useContext(Zy);fn(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=cw("useViewTransitionState"),h=ml(e,{relative:s});if(!i.isTransitioning)return!1;let m=yr(i.currentLocation.pathname,a)||i.currentLocation.pathname,f=yr(i.nextLocation.pathname,a)||i.nextLocation.pathname;return iu(h.pathname,f)!=null||iu(h.pathname,m)!=null}var tn=Gy();const wB=dl(tn);class Hf extends Error{constructor(s,i){super(i),this.status=s}}async function Nu(e,s,i){const a={method:e,credentials:"include",headers:{"Content-Type":"application/json"}};i!==void 0&&(a.body=JSON.stringify(i));const h=await fetch(s,a);if(h.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Hf(401,"Unauthorized");if(!h.ok){const m=await h.text().catch(()=>h.statusText);let f=m;try{const o=JSON.parse(m);o.error&&(f=o.error)}catch{}throw new Hf(h.status,f)}if(h.status!==204)return h.json()}function ut(e){return Nu("GET",e)}function nt(e,s){return Nu("POST",e,s)}function nn(e,s){return Nu("PUT",e,s)}function Bn(e){return Nu("DELETE",e)}function W2(e,s=!1){return nt("/api/auth/login",{password:e,remember:s})}function G2(){return nt("/api/auth/logout")}function q2(){return ut("/api/auth/status")}function K2(e,s){return nt("/api/auth/setup",{password:e,confirmPassword:s})}function V2(e,s,i){return nn("/api/auth/password",{oldPassword:e,newPassword:s,confirmPassword:i})}function Y2(){const[e,s]=k.useState(!1),[i,a]=k.useState(!0),[h,m]=k.useState(!1),[f,o]=k.useState(!0);k.useEffect(()=>{q2().then(u=>{s(u.authenticated),a(u.authRequired),m(u.setupRequired)}).catch(()=>s(!1)).finally(()=>o(!1))},[]),k.useEffect(()=>{const u=()=>s(!1);return window.addEventListener("auth:unauthorized",u),()=>window.removeEventListener("auth:unauthorized",u)},[]);const c=k.useCallback(async(u,v)=>{await W2(u,v),s(!0)},[]),d=k.useCallback(async()=>{await G2(),s(!1)},[]),p=k.useCallback(async(u,v)=>{await K2(u,v),m(!1),s(!0)},[]);return{authenticated:e,authRequired:i,setupRequired:h,loading:f,login:c,logout:d,setup:p}}const X2=1;function J2(e){const[s,i]=k.useState(!1),a=k.useRef(null),h=k.useRef(new Set),m=k.useRef(new Map),f=k.useRef(void 0),o=k.useRef(0),c=k.useCallback(()=>{if(!e)return;const b=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`,C=new WebSocket(b);C.binaryType="arraybuffer",a.current=C,C.onopen=()=>{i(!0),o.current=0},C.onmessage=w=>{if(w.data instanceof ArrayBuffer){const x=new Uint8Array(w.data);if(x.length<2||x[0]!==X2)return;const y=x[1];if(x.length<2+y)return;const _=new TextDecoder("utf-8").decode(x.subarray(2,2+y)),S=x.subarray(2+y),N=m.current.get(_);if(N)for(const D of N)try{D(S)}catch{}return}try{const x=JSON.parse(w.data);h.current.forEach(y=>y(x))}catch{}},C.onclose=()=>{i(!1),a.current=null;const w=Math.min(1e3*2**o.current,3e4);o.current++,f.current=setTimeout(c,w)},C.onerror=()=>{C.close()}},[e]);k.useEffect(()=>(c(),()=>{f.current&&clearTimeout(f.current),a.current&&a.current.close()}),[c]);const d=k.useCallback(v=>(h.current.add(v),()=>{h.current.delete(v)}),[]),p=k.useCallback(v=>{a.current&&a.current.readyState===WebSocket.OPEN&&a.current.send(JSON.stringify(v))},[]),u=k.useCallback((v,b)=>{let C=m.current.get(v);return C||(C=new Set,m.current.set(v,C)),C.add(b),()=>{const w=m.current.get(v);w&&(w.delete(b),w.size===0&&m.current.delete(v))}},[]);return{connected:s,onEvent:d,sendMessage:p,subscribeBinary:u}}const Dm=new Map;function Oo(e){Dm.set(e.id,e)}function Ff(){return Array.from(Dm.values())}function xv(e){return Ff().filter(s=>s.hasTab&&s.isEnabled(e))}function Q2(){const e={},s={};for(const i of Dm.values())Object.assign(e,i.translations.en),Object.assign(s,i.translations.ko);return{en:e,ko:s}}const Z2={en:{"login.title":"CLITrigger","login.subtitle":"Authentication Required","login.password":"Enter password","login.rememberMe":"Keep me logged in","login.submit":"Sign In","login.loading":"Authenticating...","login.error":"Access denied. Please try again.","login.footer":"Secure Access","login.disclaimer":'This software is provided "as is" without any warranties. Users are solely responsible for all actions taken using this tool, including any costs incurred from AI CLI usage, data loss, or unintended code changes. The developers assume no liability for any direct, indirect, or consequential damages arising from use.',"setup.title":"Welcome to CLITrigger","setup.subtitle":"Set a password to secure this instance","setup.password":"New password","setup.confirm":"Confirm password","setup.submit":"Create password","setup.loading":"Saving…","setup.tooShort":"Password must be at least 8 characters.","setup.mismatch":"Passwords do not match.","setup.tunnelPaused":"External sharing (Cloudflare tunnel) is paused until setup completes.","setup.error":"Failed to save password.","sidebar.home":"Home","sidebar.review":"Review Queue","sidebar.agenda":"My Schedule","agenda.title":"My Schedule","agenda.subtitle":"Personal notes and agenda, plus routines across all projects","agenda.today":"Today","agenda.refresh":"Refresh","agenda.refreshHelp":"Re-fetches the current range — your memos, project routines/planner, and assigned Jira issues. The view also refreshes automatically when you change month/week/day or switch views; it does not auto-poll while idle.","agenda.view.month":"Month","agenda.view.week":"Week","agenda.view.day":"Day","agenda.view.table":"Table","agenda.addItem":"Add item","agenda.expand":"Expand","agenda.collapse":"Collapse","agenda.tags.all":"All","agenda.tags.placeholder":"Add tag…","agenda.resizePanel":"Drag to resize","agenda.resizeCalendar":"Drag to resize the calendar","agenda.untitled":"(untitled)","agenda.source.personal":"Memos","agenda.source.schedule":"Routines","agenda.source.planner":"Planner","agenda.source.jira":"Jira","agenda.jira.settings":"Jira connection","agenda.jira.subtitle":"See the Jira tasks assigned to you right here on your calendar.","agenda.jira.enable":"Show Jira issues assigned to me","agenda.jira.baseUrlLabel":"Jira site address","agenda.jira.baseUrlHint":"The address you use to open Jira — the part at the very start of your browser's address bar. e.g. https://yourcompany.atlassian.net","agenda.jira.emailLabel":"Login email","agenda.jira.emailHint":"The email you sign in to Jira (Atlassian) with.","agenda.jira.tokenLabel":"API token","agenda.jira.tokenPlaceholder":"Paste your API token","agenda.jira.tokenLink":"Create an API token","agenda.jira.tokenStep1":"1. Open the link above and sign in.","agenda.jira.tokenStep2":'2. Click "Create API token", give it any name.',"agenda.jira.tokenStep3":"3. Copy it and paste it into the box above. (Not your password — a separate token.)","agenda.jira.criteria":"Import criteria","agenda.jira.criteriaHint":"Choose which issues show up on the calendar and can be imported.","agenda.jira.assigneeMe":"Only issues assigned to me","agenda.jira.includeDone":"Include done issues","agenda.jira.projects":"Projects","agenda.jira.projectsHint":"Limit to these project keys (comma or space separated). Leave empty for all.","agenda.jira.statuses":"Statuses to import","agenda.jira.statusesHint":'Only issues in the checked statuses are imported. Leave all unchecked to use "Include done issues" above instead.',"agenda.jira.statusesLoad":"Load statuses","agenda.jira.statusesLoading":"Loading…","agenda.jira.statusesNeedConn":"Save & test the connection first to load statuses.","agenda.jira.statusesSearch":"Filter statuses…","agenda.jira.statusesEmpty":'No statuses loaded. Click "Load statuses".',"agenda.jira.dismiss":"Hide from my schedule","agenda.jira.dismissedTitle":"Hidden Jira issues","agenda.jira.restore":"Restore","agenda.jira.extraJql":"Advanced (JQL)","agenda.jira.extraJqlHint":"Extra JQL, AND-ed with the above. e.g. labels = urgent AND priority >= High","agenda.jira.test":"Test connection","agenda.jira.tokenSaved":"Token saved (leave blank to keep)","agenda.jira.hint":'Open issues assigned to you are pulled in. Due-dated ones land on the calendar; the rest are listed under "Jira (no due date)". Auth uses your email + API token.',"agenda.jira.import":"Add to my schedule","agenda.jira.noDue":"Jira (no due date)","agenda.jira.error":"Jira error","agenda.moveToPlanner":"Move to planner","agenda.importToPlanner":"Add to planner","agenda.pickProject":"Select a project","agenda.noProjects":"No projects","agenda.table.name":"Name","agenda.table.date":"Date","agenda.table.kind":"Type","agenda.table.status":"Status","agenda.kind.personal":"Memo","agenda.kind.schedule":"Routine","agenda.kind.planner":"Planner","agenda.kind.jira":"Jira","agenda.status.done":"Done","agenda.status.pending":"Pending","agenda.add":"Add","agenda.memo":"Memo","agenda.backlog":"No date","agenda.backlogEmpty":"No undated memos","agenda.dayEmpty":"Nothing on this day","agenda.fromSchedule":"Project routine","agenda.fromPlanner":"Project planner","agenda.toggleDone":"Toggle done","agenda.delete":"Delete","agenda.confirmDelete":"Delete this item?","agenda.addTitle":"New item","agenda.editTitle":"Edit item","agenda.titlePlaceholder":"Title","agenda.descPlaceholder":"Notes (optional)","agenda.dateHint":"Leave the date empty for an undated memo. Set a time for a timed item.","agenda.cancel":"Cancel","agenda.save":"Save","agenda.cleanup":"Clean up memos","agenda.cleanup.title":"Delete memos by date range","agenda.cleanup.subtitle":"Bulk-delete personal memos in a date range. This cannot be undone.","agenda.cleanup.from":"From","agenda.cleanup.to":"To","agenda.cleanup.doneOnly":"Only completed memos","agenda.cleanup.includeBacklog":"Also delete undated (backlog) memos","agenda.cleanup.previewLabel":"To delete","agenda.cleanup.unit":"memo(s)","agenda.cleanup.none":"No memos match these conditions","agenda.cleanup.confirm":"Delete","sidebar.workspaces":"Workspaces","sidebar.favorites":"Favorites","sidebar.collapse":"Collapse sidebar","sidebar.expand":"Expand sidebar","favorites.add":"Add favorite","favorites.edit":"Edit favorite","favorites.delete":"Delete","favorites.deleteConfirm":"Delete this favorite?","favorites.launchFailed":"Launch failed","favorites.empty":"No favorites yet.","favorites.form.title.create":"New Favorite","favorites.form.title.edit":"Edit Favorite","favorites.form.name":"Name","favorites.form.type":"Type","favorites.form.target":"Target","favorites.form.browse":"Browse…","favorites.form.targetHint.executable":"Absolute path to .exe / .bat / .sh","favorites.form.targetHint.command":"Shell command (runs as-is)","favorites.form.targetHint.url":"http:// or https:// URL","favorites.form.args":"Arguments (space-separated)","favorites.form.cwd":"Working directory (optional)","favorites.form.create":"Create","favorites.form.save":"Save","favorites.form.cancel":"Cancel","favorites.types.executable":"Executable","favorites.types.command":"Command","favorites.types.url":"URL","favorites.security.notice":"Favorites run on the server with your account. If tunneling is enabled, anyone with the password can launch them.","tunnel.title":"Tunnel Settings","tunnel.description":"Cloudflare tunnel configuration. Set a custom domain to avoid browser warnings on shared *.trycloudflare.com / *.cfargotunnel.com URLs.","tunnel.name.label":"Named tunnel","tunnel.name.placeholder":"my-app","tunnel.name.hint":"Empty = use a random Quick Tunnel (https://*.trycloudflare.com).","tunnel.hostname.label":"Custom domain (optional)","tunnel.hostname.placeholder":"app.your-domain.com","tunnel.hostname.hint":'You must run "cloudflared tunnel route dns" to point this domain at your tunnel first. Empty = fall back to *.cfargotunnel.com.',"tunnel.hostname.invalid":"Enter a valid public domain (e.g. app.your-domain.com).","tunnel.hostname.needsName":"Set a named tunnel first to use a custom domain.","tunnel.guide.toggle":"How to set up a custom domain","tunnel.guide.heading":"One-time setup with the cloudflared CLI:","tunnel.guide.step4":"Enter the tunnel name and domain above and save.","tunnel.guide.note":"Your domain must already be on a Cloudflare account (free plan is fine).","tunnel.status.stopped":"Stopped","tunnel.status.starting":"Starting…","tunnel.status.running":"Running","tunnel.status.error":"Error","tunnel.save":"Save","tunnel.saving":"Saving…","tunnel.saved":"Tunnel settings saved. Restart the tunnel to apply.","tunnel.saveFailed":"Failed to save tunnel settings.","tunnel.close":"Close","tunnel.restart":"Restart tunnel","tunnel.restarting":"Restarting…","tunnel.restarted":"Tunnel restarted.","tunnel.restartFailed":"Failed to restart tunnel.","tunnel.start":"Start tunnel","tunnel.starting":"Starting…","tunnel.urlCopied":"External URL copied to clipboard","settings.title":"Settings","settings.tabs.account":"Account","settings.tabs.session":"Terminals","settings.tabs.tunnel":"Tunnel","sessionSettings.title":"Terminal preferences","sessionSettings.description":"Default behavior for new terminals and reusable color tags.","sessionSettings.saved":"Saved","sessionSettings.worktree.title":"Worktree default","sessionSettings.worktree.label":"Use git worktree for new terminals","sessionSettings.worktree.hint":"When enabled, every new terminal is created on its own branch in .worktrees/. Only applies to git repos.","sessionSettings.fontSize.title":"Default font size","sessionSettings.fontSize.label":"Font size for new terminals (px)","sessionSettings.fontSize.hint":"Terminals you have not zoomed yet inherit this value live. Per-terminal zoom (Ctrl+wheel, A−/A+) overrides it.","sessionSettings.tags.title":"Tags","sessionSettings.tags.description":"Pick a name and color, then assign in the terminal form.","sessionSettings.tags.empty":"No tags yet — add one above.","sessionSettings.tags.namePlaceholder":"Tag name (e.g. exploring, deploy)","sessionSettings.tags.color":"Color","sessionSettings.tags.add":"Add","sessionSettings.tags.edit":"Edit","sessionSettings.tags.delete":"Delete","sessionSettings.tags.save":"Save","sessionSettings.tags.cancel":"Cancel","sessionSettings.tags.deleteConfirm":'Delete tag "{name}"? Terminals tagged with it will become untagged.',"session.tag.none":"No tag","account.title":"Change password","account.description":"Enter your current password, then choose a new one.","account.oldPassword":"Current password","account.newPassword":"New password","account.confirm":"Confirm new password","account.tooShort":"Password must be at least 8 characters.","account.mismatch":"Passwords do not match.","account.save":"Save","account.saving":"Saving…","account.saved":"Password updated. Other sessions will be signed out.","account.saveFailed":"Failed to update password.","account.close":"Close","review.title":"Review Queue","review.subtitle":"Triage overnight todos across all projects","review.refresh":"Refresh","review.empty":"Nothing to review in this window.","review.viewDetails":"View","review.approve":"Approve & Merge","review.requestChanges":"Request changes","review.discard":"Discard","review.cancel":"Cancel","review.send":"Send","review.continuePlaceholder":"Describe what to fix or change…","review.discardConfirm":"Discard this todo and clean up its worktree?","review.mergeFailed":"Merge failed","review.continueFailed":"Continue failed","review.discardFailed":"Discard failed","review.closeDetails":"Close details","review.justNow":"just now","review.minAgo":"m ago","review.hourAgo":"h ago","review.dayAgo":"d ago","review.files":"files","review.lines":"lines","review.rounds":"rounds","review.window.12h":"Last 12h","review.window.24h":"Last 24h","review.window.7d":"Last 7d","review.filter.all":"All","review.filter.risky":"Risky","review.filter.quickWins":"Quick wins","review.filter.failed":"Failed","review.risk.low":"Low risk","review.risk.medium":"Medium risk","review.risk.high":"High risk","review.tokens.total":"Total tokens","review.tokens.todos":"Todos","review.tokens.byCli":"By CLI tool","review.diff.empty":"No changes against the base branch.","review.diff.noBranch":"Diff unavailable — this todo has no branch (ran on the main branch).","review.diff.branchMissing":"Diff unavailable — branch was deleted.","review.diff.baseBranchMissing":"Diff unavailable — base branch not found in repo. Check the project's default_branch setting.","review.diff.notFound":"Todo not found.","projects.title":"All Projects","projects.subtitle":"Project Console","projects.new":"New Project","projects.logout":"Sign Out","projects.loading":"Loading projects...","projects.empty":"No projects yet","projects.emptyHint":"Create your first project to get started.","projects.tasks":"tasks","projects.active":"active","projects.done":"done","projects.search":"Search projects...","projects.delete":"Delete project","projects.deleteConfirm":"Are you sure you want to delete this project?","projects.pathMissing":"Path not found","projects.pathMissingConfirm":"The local folder for this project no longer exists. Delete it?","projects.noGit":"No Git","detail.back":"Projects","detail.loading":"Loading...","detail.notFound":"Project not found","detail.backToProjects":"Back to Projects","detail.live":"Connected","header.branch":"Branch","header.editName":"Click to rename project","header.openFolder":"Open folder","header.workers":"Workers","header.model":"Model","header.settings":"Settings","header.runAll":"Run All","header.stopAll":"Stop All","header.config":"Project Settings","header.execConfig":"Automation Settings","header.execConfigHint":"Applies to Tasks, Discussions, and Routines.","header.maxWorkers":"Max Workers","settings.defaultMaxTurns":"Default Max Turns","settings.defaultMaxTurnsHint":"Default turn limit per task. Tasks can override individually.","header.cliTool":"CLI Tool","header.cliFlags":"CLI Flags","header.cancel":"Cancel","header.save":"Save","header.saving":"Saving...","header.noGit":"No Git","header.noGitHint":'This project is not a git repository. Tasks will run directly without worktree isolation. Run "git init" in the project path, then re-check.',"header.recheckGit":"Re-check Git Status","header.fallbackChainTitle":"CLI Fallback Chain","header.fallbackChainHint":"When a CLI tool runs out of context, automatically switch to the next tool in the chain.","header.sandboxTitle":"Sandbox Mode","header.sandboxBadgeStrict":"Sandbox: Strict","header.sandboxBadgePermissive":"Sandbox: Permissive","header.sandboxStrict":"Strict (Recommended)","header.sandboxStrictDesc":"CLI tools can only access files within the worktree directory.","header.sandboxPermissive":"Permissive","header.sandboxPermissiveDesc":"CLI tools can access any file on the system.","header.sandboxWarning":"Warning: In permissive mode, CLI tools can access files outside the worktree. Use with caution.","header.worktreeTitle":"Worktree Isolation","header.worktreeEnabled":"Worktree (Recommended)","header.worktreeEnabledDesc":"Each task runs in its own branch. Safe for parallel tasks.","header.worktreeDisabled":"Direct (Main Branch)","header.worktreeDisabledDesc":"Tasks run on the main branch. Max workers forced to 1.","header.worktreeWarning":"Warning: Tasks will modify the main branch directly. Concurrent execution is disabled.","header.npmAutoInstallLabel":"Auto-run `npm install` on worktree creation","header.npmAutoInstallHint":"Lets agents run test/build inside the worktree immediately for npm projects. Disable for pnpm/yarn/bun or non-npm projects.","header.noWorktreeBadge":"No Worktree","header.debugBadge":"Debug Logs","header.showTokenUsageTitle":"Token Usage Display","header.showTokenUsageDesc":"Show token usage (input/output) after task completion.","header.showTokenUsageEnable":"Show token usage","header.debugLoggingTitle":"Debug Logging","header.debugLoggingDesc":"Save full CLI input/output to .debug-logs/ for each task execution.","header.debugLoggingEnable":"Enable debug log files","header.gstackTitle":"gstack Skills","header.gstackEnabled":"Enable gstack skill injection","header.gstackCredit":"Powered by gstack (MIT License, Garry Tan)","header.usageLimit":"Usage","header.cliNotInstalled":"{tool} is not installed","header.cliInstalled":"Installed","header.cliNotFound":"Not installed","header.cliInstallHint.claude":"npm install -g @anthropic-ai/claude-code","header.cliInstallHint.antigravity":"curl -fsSL https://antigravity.google/cli/install.sh | bash","header.cliInstallHint.codex":"npm install -g @openai/codex","header.cliRefresh":"Re-check","header.gstackClaudeOnly":"gstack skills are only available with Claude CLI.","header.jiraTitle":"Jira Integration","header.jiraBaseUrl":"Jira URL","header.jiraBaseUrlPlaceholder":"https://yoursite.atlassian.net","header.jiraEmail":"Email","header.jiraEmailPlaceholder":"your@email.com","header.jiraApiToken":"API Token","header.jiraApiTokenPlaceholder":"Atlassian API token","header.jiraProjectKey":"Project Key","header.jiraProjectKeyPlaceholder":"e.g. PROJ","header.jiraTestConnection":"Test Connection","header.jiraTesting":"Testing...","header.jiraConnected":"Connected","header.jiraFailed":"Connection failed","header.jiraTokenHint":"Generate at id.atlassian.com > Security > API tokens","form.newProject":"New Project","form.projectName":"Project Name","form.folderPath":"Folder Path","form.cancel":"Cancel","form.create":"Create","form.creating":"Creating...","form.createError":"Failed to create project","browse.title":"Browse Folder","browse.select":"Select","browse.loading":"Loading...","browse.error":"Failed to load directory","browse.empty":"No folders found","todos.title":"Tasks","todos.add":"Add Task","todos.empty":"No tasks yet","todos.emptyHint":"Add a task to begin.","todos.merge":"Merge","todos.filterAll":"All","todos.filterActive":"In Progress","todos.filterCompleted":"Completed","todos.filterCancelled":"Cancelled","todos.filterEmpty":"No tasks in this filter.","todos.stackModeOn":"Stack mode on — click ✕ to disable","todos.stackModeOff":"Enable stack mode (iOS-style collapse)","todos.collapseStack":"Collapse to stack","todos.expandStack":"Click to expand","todo.description":"Description","todo.noDescription":"No description provided.","todo.attachedImages":"Attached Images","todo.branch":"Branch","todo.path":"Path","todo.worktree":"Worktree","todo.result":"Result","todo.mergeFailed":"Merge failed","todo.diffError":"Diff error","todo.diffOutput":"Changes","todo.files":"files","todo.systemLog":"Activity Log","todo.start":"Start","todo.startHeadless":"Headless","todo.startHeadlessDesc":"Runs autonomously. All permissions auto-approved. No user input needed.","todo.startInteractive":"Interactive","todo.startInteractiveDesc":"Keeps stdin open so you can send messages during execution.","todo.startVerbose":"Verbose","todo.startVerboseDesc":"Auto-approved + full raw log output in real-time.","todo.sendPlaceholder":"Type a message...","todo.startWithDependency":"Start parent task first","todo.stop":"Stop","todo.viewDiff":"View Diff","todo.hideDiff":"Hide Diff","todo.viewDebugLog":"Debug Log","todo.merge":"Merge","todo.mergeChain":"Merge Chain","todo.mergeChainDesc":"Merge all tasks in this chain to main branch","todo.chainComplete":"Chain Complete","todo.chainTasks":"{count} tasks","todo.edit":"Edit","todo.delete":"Delete","todo.cleanup":"Clean up worktree","todo.cleanupFailed":"Cleanup failed","cleanup.confirmDeleteBranch":`Worktree will be removed. Also delete branch "{name}"?
|
|
62
62
|
|
|
63
63
|
OK = delete worktree + branch
|
|
64
|
-
Cancel = delete worktree only`,"todo.retry":"Retry","todo.retryDesc":"Cleans up previous worktree, clears logs, and re-runs from scratch.","todo.retryFailed":"Retry failed","todo.continue":"Continue","todo.continueDesc":"Run a follow-up prompt in the same worktree, preserving prior work.","todo.continuing":"Continuing...","todo.confirmContinue":"Run follow-up","todo.continuePromptLabel":"Follow-up prompt","todo.continuePromptPlaceholder":"Describe the next step or fix to apply in this worktree...","todo.continuePromptRequired":"Follow-up prompt is required.","todo.roundLabel":"round","todo.dependsOn":"Depends on","todo.mergedFrom":"Inherited from","todo.transferredTo":"Transferred to","todo.schedule":"Schedule","todo.scheduleDesc":"Convert this task into a one-time routine run.","todo.scheduleAt":"Run at","todo.scheduling":"Scheduling...","todo.confirmSchedule":"Schedule","todo.scheduleKeepOriginal":"Keep original task","todo.scheduleOnReset":"Run on Reset","todo.scheduleOnResetDesc":"Auto-run a new task when the rate limit resets.","todo.scheduleOnResetLabel":"Rate limit resets at","todo.resetPromptPlaceholder":"Enter the prompt to run after rate limit resets...","todo.confirmResetSchedule":"Schedule on Reset","todoForm.titlePlaceholder":"Task title...","todoForm.descPlaceholder":"Description (optional)...","todoForm.cliTool":"CLI Tool","todoForm.addImage":"Add Image","todoForm.pasteHint":"Ctrl+V to paste image","todoForm.images":"Images","todoForm.maxTurns":"Max Turns","todoForm.maxTurnsPlaceholder":"No limit","todoForm.maxTurnsHint":"Limit the number of agentic turns to prevent excessive token usage.","todoForm.dependsOn":"Depends On","todoForm.noDependency":"None (independent task)","todoForm.dependsOnHint":"This task will wait for the dependency to complete, then squash merge its changes into a new branch.","todoForm.worktreeMode":"Execution Branch","todoForm.worktreeInherit":"Follow project setting","todoForm.worktreeForceOn":"Use worktree (isolated branch)","todoForm.worktreeForceOff":"Run on main branch","todoForm.worktreeProjectDefaultOn":"Project default: worktree","todoForm.worktreeProjectDefaultOff":"Project default: main branch","todoForm.worktreeMainWarning":"Running on main branch blocks other todos from running concurrently.","todoForm.cancel":"Cancel","todoForm.save":"Save","dnd.dropHint":"Run after this task","dnd.removeDep":"Remove dependency","dnd.dropToRemoveDep":"Drop here to remove dependency","dnd.cyclicWarning":"Cannot link: circular dependency","graph.autoLayout":"Auto Layout","graph.listView":"List View","graph.graphView":"Graph View","status.pending":"Idle","status.running":"Running","status.completed":"Done","status.failed":"Failed","status.stopped":"Stopped","status.merged":"Merged","progress.complete":"complete","progress.done":"Done","progress.live":"Running","progress.idle":"Idle","progress.fail":"Failed","progress.stop":"Stopped","progress.merged":"Merged","failure.title":"Failure Reason","failure.exitCode":"Exit code","failure.fix":"Fix This: Creates a new task that analyzes the failure and attempts to fix the issue.","failure.fixPrefix":"[Fix] ","result.duration":"Duration","result.commits":"commits","result.filesChanged":"files changed","result.commitHistory":"Commit History","result.changedFiles":"Changed Files","result.tokenUsage":"Token Usage","result.inputTokens":"input","result.outputTokens":"output","result.totalCost":"Cost","result.cacheTokens":"cache","result.turns":"turns","result.contextUsed":"ctx","result.levelLight":"Light","result.levelModerate":"Moderate","result.levelHigh":"High","result.levelHeavy":"Heavy","log.awaiting":"Awaiting output...","log.waitingResponse":"Waiting for response...","log.noChanges":"No changes detected.","log.copy":"Copy","log.copied":"Copied!","log.viewChat":"Chat","log.viewRaw":"Raw","schedules.title":"Routines","schedules.add":"New Routine","schedules.empty":"No routines yet","schedules.emptyHint":"Create a routine to automate recurring tasks.","schedule.type":"Routine Type","schedule.recurring":"Recurring","schedule.once":"One-time","schedule.runAtLabel":"Run at","schedule.cronExpression":"Frequency","schedule.cronHint":"e.g. */30 * * * * (every 30min), 0 9 * * * (daily 9am), 0 9 * * 1-5 (weekdays 9am)","cron.everyMinutes":"Minutes","cron.hourly":"Hourly","cron.daily":"Daily","cron.weekly":"Weekly","cron.monthly":"Monthly","cron.custom":"Custom","cron.every":"Every","cron.minutesLabel":"minutes","cron.everyHourAt":"Every hour at","cron.minutesPast":"min past","cron.everyDayAt":"Every day at","cron.at":"at","cron.everyMonthOn":"Every month on day","cron.dayAt":"at","cron.expression":"Cron","cron.mon":"Mon","cron.tue":"Tue","cron.wed":"Wed","cron.thu":"Thu","cron.fri":"Fri","cron.sat":"Sat","cron.sun":"Sun","schedule.skipIfRunning":"Skip if previous run still active","schedule.active":"Active","schedule.paused":"Paused","schedule.lastRun":"Last run","schedule.never":"Never","schedule.trigger":"Run Now","schedule.activate":"Activate","schedule.pause":"Pause","schedule.edit":"Edit","schedule.delete":"Delete","schedule.runs":"Run History","schedule.runTriggered":"Triggered","schedule.runSkipped":"Skipped","schedule.runCompleted":"Completed","schedule.runFailed":"Failed","schedule.noRuns":"No runs yet","scheduleForm.titlePlaceholder":"Routine title...","scheduleForm.descPlaceholder":"Task description template...","scheduleForm.cliTool":"CLI Tool","scheduleForm.cancel":"Cancel","scheduleForm.save":"Save","jira.title":"Jira Issues","jira.search":"Search issues...","jira.allStatuses":"All Statuses","jira.refresh":"Refresh","jira.import":"Import as Task","jira.importing":"Importing...","jira.imported":"Imported!","jira.noIssues":"No issues found","jira.noIssuesHint":"Try changing the filter or search query.","jira.loadMore":"Load More","jira.total":"total","jira.transition":"Change Status","jira.comment":"Comment","jira.commentPlaceholder":"Add a comment...","jira.commentSend":"Send","jira.createIssue":"Create Issue","jira.createSummary":"Summary","jira.createDesc":"Description","jira.createType":"Issue Type","jira.creating":"Creating...","jira.notConfigured":"Jira is not configured. Enable it in project settings.","jira.assignee":"Assignee","jira.unassigned":"Unassigned","jira.updated":"Updated","notion.title":"Notion Pages","notion.search":"Search pages...","notion.refresh":"Refresh","notion.import":"Import as Task","notion.importing":"Importing...","notion.imported":"Imported!","notion.noPages":"No pages found","notion.noPagesHint":"Try changing the search query.","notion.loadMore":"Load More","notion.createPage":"Create Page","notion.pageTitle":"Title","notion.creating":"Creating...","notion.notConfigured":"Notion is not configured. Enable it in project settings.","notion.loadingContent":"Loading content...","notion.noContent":"No content","header.notionTitle":"Notion Integration","header.notionApiKey":"Integration Token","header.notionApiKeyPlaceholder":"ntn_...","header.notionDatabaseId":"Database ID","header.notionDatabaseIdPlaceholder":"e.g. abc123def456...","header.notionTestConnection":"Test Connection","header.notionTesting":"Testing...","header.notionConnected":"Connected","header.notionFailed":"Connection failed","header.notionTokenHint":"Create an integration at notion.so/my-integrations and share the database with it","github.title":"GitHub Issues","github.search":"Search issues...","github.refresh":"Refresh","github.import":"Import as Task","github.importing":"Importing...","github.imported":"Imported!","github.noIssues":"No issues found","github.noIssuesHint":"Try changing the filter or search query.","github.loadMore":"Load More","github.createIssue":"Create Issue","github.issueTitle":"Title","github.issueBody":"Description","github.creating":"Creating...","github.notConfigured":"GitHub is not configured. Enable it in project settings.","github.loadingComments":"Loading comments...","github.comments":"Comments","github.noBody":"No description provided.","github.open":"Open","github.closed":"Closed","github.all":"All","header.githubTitle":"GitHub Integration","header.githubToken":"Personal Access Token","header.githubTokenPlaceholder":"ghp_...","header.githubOwner":"Repository Owner","header.githubOwnerPlaceholder":"username or org","header.githubRepo":"Repository Name","header.githubRepoPlaceholder":"repo-name","header.githubTestConnection":"Test Connection","header.githubTesting":"Testing...","header.githubConnected":"Connected","header.githubFailed":"Connection failed","header.githubTokenHint":"Create a token at github.com/settings/tokens with repo scope","tabs.automation":"Automation","tabs.automation.help":"Tasks, Discussions, and Routines in one place.","tabs.tasks":"Auto Tasks","tabs.sessions":"Terminals","tabs.discussions":"Discussions","tabs.schedules":"Routines","tabs.jira":"Jira","tabs.notion":"Notion","tabs.github":"GitHub","tabs.git":"Git","tabs.svn":"SVN","tabs.files":"Documents","tabs.planner":"Planner","tabs.wiki":"Wiki","tabs.analytics":"Analytics","tabs.wiki.help":"Project knowledge graph. Curate nodes/edges and they get injected as a <long_term_memory> block into auto-task and discussion prompts so the LLM keeps context across runs.","tabs.planner.help":"Lightweight task notes with tags, priorities, and image attachments. Promote favorites into auto tasks or routines, or import/export as Markdown.","tabs.tasks.help":"Queue up TODOs and fire them off in bulk — each one runs automatically in its own isolated git worktree (Claude/Antigravity/Codex). Stack dozens ahead of time, hit Run when you're ready, and they execute in parallel up to your concurrency limit. Dependency chains, multi-round continue, and merge automation are all handled for you.","tabs.sessions.help":"Drive Claude/Antigravity/Codex interactively in a floating window. Unlike auto tasks (fire-and-forget), terminals stay live so you can type, observe, and steer the CLI in real time.","tabs.discussions.help":"Multi-agent AI discussions over rounds, then optional implementation. Extract action items into the planner when finished.","tabs.schedules.help":"Trigger auto tasks on cron or one-off routines. Supports auto-restart at rate-limit reset times.","tabs.git.help":"Built-in Fork/SourceTree-style Git client: file status, commit graph, branch management, and diff viewer.","tabs.svn.help":"Built-in SVN working-copy panel: file status, revision log, and diff viewer.","svn.fileStatus":"File Status","svn.history":"History","svn.unversioned":"Unversioned","svn.changed":"Changed","svn.groupByDir":"Group by directory","svn.viewFlat":"Flat list","svn.dirFileCount":"{d} dirs · {f} files","svn.fileCount":"{f} files","svn.workingCopyRev":"Working Copy Revision","svn.update":"Update","svn.refresh":"Refresh","svn.add":"Add","svn.revert":"Revert","svn.delete":"Delete","svn.resolve":"Resolve","svn.commitMessagePlaceholder":"Describe the change. Required.","svn.commit":"Commit","svn.committing":"Committing...","svn.commitSuccess":"Committed r{rev}","svn.updating":"Updating...","svn.updateSuccess":"Updated to r{rev}","svn.noChanges":"No local changes.","svn.selectFiles":"Select one or more files first.","svn.notSvn":"Not an SVN working copy.","svn.cliMissing":"svn CLI not found. Install Subversion to use this panel.","svn.repoUrl":"Repository URL","svn.relativePath":"Path","svn.viewsHeader":"Views","svn.actionsHeader":"Commands","svn.checkForModifications":"Check for modifications","svn.showLog":"Show log","svn.updateToRevision":"Update to revision…","svn.cleanup":"Clean up","svn.checkRepository":"Check repository","svn.remoteBadge":"remote","svn.remoteHint":"Contacts the SVN server","svn.loadLog":"Load log","svn.logEmptyHint":"The log is fetched from the SVN server. Nothing loads automatically.","svn.loadMore":"Load more","svn.revision":"Revision","svn.revisionPlaceholder":"e.g. 1234 or HEAD","svn.cleaningUp":"Cleaning up…","svn.cleanupSuccess":"Clean up complete","svn.checking":"Checking…","svn.behindCount":"{n} incoming change(s) on server","svn.upToDate":"Up to date with server","svn.resolveWorking":"Mark resolved (keep working copy)","svn.resolveMine":"Resolve using mine","svn.resolveTheirs":"Resolve using theirs","svn.resolveBase":"Resolve using base","svn.viewDiff":"View diff","svn.cancel":"Cancel","svn.properties":"Properties","svn.propertiesOf":"Properties: {target}","svn.workingCopyRoot":"Working copy root","svn.noProperties":"No properties on this item.","svn.editProperty":"Edit","svn.saveProperty":"Save","svn.close":"Close","svn.changelistDefault":"Changes","svn.changelistUnversioned":"Unversioned Files","svn.changelistMissing":"Locally Deleted Files","svn.moveToChangelist":"Move to Changelist","svn.newChangelist":"New Changelist…","svn.removeFromChangelist":"Remove from Changelist","svn.changelistNamePlaceholder":"Changelist name","header.svnTitle":"SVN (Subversion)","header.svnHint":"Off by default. When enabled, the project is checked for a .svn/ working copy and an SVN tab is shown when found.","header.svnEnable":"Enable SVN for this project","tabs.files.help":"Markdown document wiki — browse the file tree, preview/edit notes, and explore wikilinks between .md files through graph, backlinks, outline, tags, and search panels.","tabs.analytics.help":"Execution and cost analytics. Token usage by CLI, status distribution, and daily cost trends in interactive charts.","files.root":"Root","files.empty":"Empty folder","files.loading":"Loading…","files.refresh":"Refresh","files.graph":"Wiki graph — show wikilink connections between .md files","files.showHidden":"Show hidden files","files.hideHidden":"Hide hidden files","files.copyPath":"Copy path","files.sendToTerminal":"Send to terminal","files.newTerminal":"New terminal","files.includeLinks":"Include linked docs","files.sendToTask":"Create task from file","files.sentToTerminal":"Sent to terminal","files.noActiveSession":"No open session","files.taskCreated":"Task created","files.taskCreateFailed":"Failed to create task","files.hide":"Hide from Documents","files.unhide":"Show in Documents","files.openInOS":"Open in default app","files.revealInExplorer":"Reveal in file manager","files.openFolder":"Open folder in file manager","files.pin":"Pin to top","files.unpin":"Unpin","files.pinned":"Pinned","files.tooLarge":"File too large to preview (max 2 MB).","files.binaryNotPreviewable":"Binary file — preview not available.","files.download":"Download","files.preview.empty":"Select a file to preview.","files.html.sandboxNotice":"Safe preview — scripts and external resources are blocked.","files.editor.edit":"Edit","files.editor.save":"Save","files.editor.done":"Done","files.editor.saved":"Saved","files.editor.saveFailed":"Save failed","files.editor.conflict":"File changed on disk — reopen it to see the new content.","files.editor.discardConfirm":"Discard unsaved changes?","files.editor.dirty":"Modified","find.openFind":"Find","find.placeholder":"Find","find.replacePlaceholder":"Replace","find.case":"Match case","find.word":"Match whole word","find.regex":"Use regular expression","find.next":"Next match (Enter)","find.prev":"Previous match (Shift+Enter)","find.replace":"Replace","find.replaceAll":"Replace all","find.close":"Close (Esc)","find.toggleReplace":"Toggle replace","find.noMatches":"No results","annotate.start":"Start drawing","annotate.stop":"Stop drawing","annotate.select":"Select","annotate.pen":"Pen","annotate.highlighter":"Highlighter","annotate.eraser":"Eraser","annotate.undo":"Undo","annotate.redo":"Redo","annotate.clear":"Clear all","wiki.title":"Wiki","wiki.add":"New Entry","wiki.edit":"Edit","wiki.delete":"Delete","wiki.save":"Save","wiki.saving":"Saving...","wiki.cancel":"Cancel","wiki.empty":"No wiki entries yet","wiki.emptyHint":"Add notes, conventions, and lessons that the LLM should reference when running tasks.","wiki.viewList":"List","wiki.viewGraph":"Graph","wiki.viewHierarchical":"Hierarchy","wiki.viewNetwork":"Network","wiki.searchPlaceholder":"Search wiki...","wiki.backlinks":"Backlinks","wiki.addLink":"Add link to another entry","wiki.addLinkPlaceholder":"Search an entry to link…","wiki.connect.title":"How should these entries be connected?","wiki.connect.wikilink":"Reference (wikilink)","wiki.connect.wikilinkHint":"Inserts [[target title]] into the source body. Free-form mention, no semantic relation.","wiki.connect.edge":"Relation (typed edge)","wiki.connect.edgeHint":"Adds a typed relation (related/precedes/refines/...) you can label.","wiki.allTags":"All tags","wiki.countLabel":"{count} item(s)","wiki.deleteConfirm":"Delete this entry and all its connections?","wiki.noResults":"No results","wiki.noBody":"No content","wiki.connections":"Connections","wiki.outgoing":"Outgoing","wiki.incoming":"Incoming","wiki.autoLayout":"Auto Layout","wiki.form.newTitle":"New entry","wiki.form.editTitle":"Edit entry","wiki.form.title":"Title","wiki.form.titlePlaceholder":"Short, descriptive title","wiki.form.body":"Body (Markdown supported)","wiki.form.bodyPlaceholder":"Write the knowledge or convention you want the LLM to reference...","wiki.form.linkHint":"Type [[ or @ to link another wiki entry.","wiki.form.tags":"Tags","wiki.form.tagsPlaceholder":"Type tag and press Enter","wiki.form.pinned":"Pin to highlight","wiki.edge.editTitle":"Edit Connection","wiki.edge.relationType":"Relation","wiki.edge.label":"Label","wiki.edge.labelPlaceholder":'Optional note (e.g. "see section 3.2")',"wiki.edge.deleteConfirm":"Delete this connection?","wiki.edge.relations.related":"Related","wiki.edge.relations.precedes":"Precedes","wiki.edge.relations.example_of":"Example of","wiki.edge.relations.counter_example":"Counter-example","wiki.edge.relations.refines":"Refines","vault.title":"Documents","vault.empty":"No markdown files found","vault.noResults":"No matching files","vault.searchPlaceholder":"Search files...","vault.graph.addLink":"Add link from here","vault.graph.linkHint":"Click a target node to link · Esc to cancel","vault.graph.showLabels":"Show names","vault.graph.rightClickHint":"Right-click → add link","vault.newFile":"New File","vault.create":"Create","vault.save":"Save","vault.delete":"Delete","vault.unsaved":"unsaved","vault.confirmDelete":"Delete {path}?","vault.backlinks":"Backlinks","vault.filesCount":"files","vault.panel.fileExplorer":"Files","vault.panel.search":"Search","vault.panel.tags":"Tags","vault.panel.graph":"Graph","vault.panel.outline":"Outline","vault.panel.backlinks":"Backlinks","vault.panel.outgoing":"Outgoing Links","vault.outline.empty":"No headings in this note","vault.outgoing.empty":"No outgoing wikilinks","vault.backlinks.empty":"No backlinks","vault.tags.empty":"No tags in documents","vault.search.empty":"No matches","vault.search.prompt":"Search across .md notes","vault.activeFile.empty":"Select a file to preview or edit","vault.sidebar.collapse":"Collapse sidebar","vault.sidebar.expand":"Expand sidebar","vault.loadError":"Failed to load documents","vault.retry":"Retry","vault.allHidden":"All documents are hidden by .vaultignore — right-click a file in the explorer to show it","vault.ignoreHelp":".vaultignore guide","vaultInject.title":"Document Injection","vaultInject.modeNone":"Off","vaultInject.modeAuto":"Auto","vaultInject.modeAll":"Inject all","vaultInject.modeSelected":"Inject selected","vaultInject.autoHint":"Before each run, the LLM picks up to 10 relevant files from {count} file(s) using the task description as the query.","vaultInject.previewToggle":"Preview","vaultInject.previewChars":"{n} chars","vaultInject.previewTokens":"~{n} tokens","vaultInject.empty":"No .md or .html files in the project root.","vaultInject.injectedCount":"Will inject {count} file(s)","vaultInject.allCount":"Will inject all {count} file(s)","vaultInject.searchPlaceholder":"Filter by name...","vaultInject.loading":"Loading...","vaultInject.includeLinked":"Also pull in 1-hop linked files when I check one","vaultInject.linkedAdded":"+{n} linked","vaultInject.noResults":"No files match.","wiki.ingest":"Ingest","wiki.ingest.title":"Ingest Source Material","wiki.ingest.tabTask":"From Task","wiki.ingest.tabDiscussion":"From Discussion","wiki.ingest.tabText":"Paste Text","wiki.ingest.selectTask":"Select a completed task","wiki.ingest.selectDiscussion":"Select a completed discussion","wiki.ingest.noTasks":"No completed tasks found","wiki.ingest.noDiscussions":"No completed discussions found","wiki.ingest.textPlaceholder":"Paste any text — article, notes, chat transcript — to extract knowledge...","wiki.ingest.run":"Ingest","wiki.ingest.running":"Ingesting...","wiki.ingest.success":"Created {created}, updated {updated}, {edges} edge(s) added","wiki.ingest.parseFailed":"Could not parse the LLM response — nothing was changed.","wiki.ingest.modelEmpty":"The LLM returned no proposals — it judged the source had nothing new worth adding.","wiki.ingest.allSkipped":"All proposals were skipped — see breakdown below.","wiki.ingest.proposed":"Proposed: {c} create, {u} update, {e} edges","wiki.ingest.skipNote":"Skipped","wiki.ingest.skip.duplicate":"duplicate title (already exists)","wiki.ingest.skip.unique":"DB UNIQUE conflict on title","wiki.ingest.skip.empty":"empty title","wiki.ingest.skip.badId":"invalid update id","wiki.ingest.skip.badEdge":"edge endpoint not found","wiki.ingest.skip.selfEdge":"self-edge","wiki.ingest.skip.edgeUnique":"edge UNIQUE conflict","wiki.ingest.rawSnippet":"Show raw response snippet","wiki.ingest.toast.success":"Wiki updated from {source} — {created} created, {updated} updated, {edges} edges","wiki.ingest.toast.empty":"Wiki ingest from {source} — nothing new to add","wiki.ingest.toast.parseFailed":"Wiki ingest from {source} — could not parse LLM response","wiki.ingest.toast.failed":"Wiki auto-ingest failed","wiki.schemaSection":"Schema","wiki.schemaSectionHint":"Defines entry types and conventions used by Ingest. Edit to customize for this project.","wiki.schemaBannerTitle":"Wiki Schema","wiki.schemaBannerHint":"Edits here change how the LLM categorizes new entries on Ingest. Delete this entry to reset to defaults.","wiki.systemSection":"System","wiki.systemSectionHint":"Auto-maintained entries that drive Ingest behavior and quick navigation.","wiki.indexBannerTitle":"Wiki Index","wiki.indexBannerHint":"Auto-regenerated on every wiki change. Manual edits are overwritten — delete to remove (it will be recreated on the next change).","wiki.asset.uploading":"Uploading image…","wiki.asset.tooLarge":"Image too large (max 10MB)","wiki.diskDiff.button":"Disk diff","wiki.diskDiff.tooltip":"Compare exported wiki files against the database","wiki.diskDiff.title":"Wiki vs. .clitrigger/wiki/","wiki.diskDiff.intro":"Read-only — shows files on disk that differ from what the database would export. Edit the markdown files in Obsidian/etc. and these will surface here. Use Rebuild to overwrite disk with the current DB state.","wiki.diskDiff.running":"Comparing…","wiki.diskDiff.empty":"Disk and database are in sync.","wiki.diskDiff.refresh":"Re-check","wiki.diskDiff.close":"Close","wiki.diskDiff.section.modified":"Modified on disk ({n})","wiki.diskDiff.section.missing":"Missing on disk ({n})","wiki.diskDiff.section.untracked":"Untracked file on disk ({n})","wiki.diskDiff.rebuild":"Rebuild from DB","wiki.diskDiff.rebuildTooltip":"Overwrites all wiki/ files with the current database state. Disk-only edits will be lost.","wiki.diskDiff.rebuildConfirm":"Overwrite the wiki/ folder with the current database state? Any disk-only edits will be lost.","wiki.diskDiff.rebuildResult":"Rebuilt: {written} written, {removed} removed","wiki.lint":"Lint","wiki.lint.title":"Wiki Health Check","wiki.lint.running":"Checking...","wiki.lint.empty":"Wiki looks healthy — no issues found.","wiki.lint.close":"Close","wiki.lint.rerun":"Re-run","wiki.lint.mergeConfirm":'Merge "{absorb}" into "{keep}"? This combines bodies, unions tags, redirects edges and wikilinks, and deletes "{absorb}".',"wiki.lint.action.mergeKeep":'Keep "{keep}", merge "{absorb}"',"wiki.lint.action.delete":"Delete","wiki.lint.action.deleteTitle":'Delete "{title}"',"wiki.lint.action.link":"Link","wiki.lint.action.linkTo":"Link to…","wiki.sourceAutoLabel":"Auto","wiki.viewRaw":"View Raw Source","wiki.loading":"Loading...","wiki.close":"Close","wiki.subTab.wiki":"Wiki","wiki.subTab.sources":"Sources","wiki.subTab.activity":"Activity","wiki.activity.empty":"No activity yet","wiki.activity.emptyHint":"Ingest, lint, retrieve, and merge events show up here.","wiki.activity.refresh":"Refresh","wiki.activity.filter.all":"All","wiki.activity.filter.ingest":"Ingest","wiki.activity.filter.lint":"Lint","wiki.activity.filter.retrieve":"Retrieve","wiki.activity.filter.merge":"Merge","wiki.sources.empty":"Select a raw file from the sidebar to view its content.","wiki.sources.noFiles":"No raw files yet — run Ingest to create some.","wiki.rawFile.derivedTitle":"Derived Wiki Entries","wiki.rawFile.noDerived":"No wiki entries derived from this source","wiki.rawFile.openSiblings":"Show {n} entries from this source","wiki.rawFile.openExternal":"Open in default app","wiki.rawFile.revealInFolder":"Reveal in folder","wiki.rawFile.delete":"Delete raw file","wiki.rawFile.deleteConfirm":"Delete this raw source file? Wiki entries are kept.","wiki.rawFile.deleteConfirmDerived":"Delete this raw source file and unlink {n} derived wiki entr(y/ies)? The entries themselves are kept; only the source link is removed.","planner.title":"Planner","planner.add":"New Item","planner.empty":"No planner items yet","planner.emptyHint":"Add ideas, tasks, and plans to your planner.","planner.view.pages":"Pages","planner.view.all":"All items","planner.nav.calendar":"Calendar","planner.nav.list":"List","planner.block.tasklist":"Task list","planner.block.calendar":"Calendar","planner.block.addTask":"Add a task…","planner.pages.newTemplate":"New page — choose a template","planner.tpl.blank":"Blank","planner.tpl.blank.desc":"Start from an empty page","planner.tpl.meeting":"Meeting notes","planner.tpl.meeting.desc":"Date, attendees, agenda, action items","planner.tpl.project":"Project plan","planner.tpl.project.desc":"Overview, milestones, schedule","planner.tpl.weekly":"Weekly planner","planner.tpl.weekly.desc":"Weekly goals, tasks, calendar","planner.pages.new":"New Page","planner.pages.untitled":"Untitled","planner.pages.empty":"No pages yet","planner.pages.emptyHint":"Create a free-form page to write notes, docs, and checklists.","planner.pages.deleteConfirm":"Delete this page? This cannot be undone.","planner.pages.saving":"Saving…","planner.pages.saved":"Saved","planner.filterTag":"All Tags","planner.filterStatus":"All Statuses","planner.col.title":"Title","planner.col.tags":"Tags","planner.col.dueDate":"Due Date","planner.col.status":"Status","planner.col.actions":"","planner.edit":"Edit","planner.delete":"Delete","planner.deleteConfirm":"Delete this planner item?","planner.convertToTask":"Convert to Task","planner.convertToSchedule":"Convert to Routine","planner.convertToTerminal":"Send to Terminal","planner.movedToTodo":"Moved to Tasks","planner.movedToSchedule":"Moved to Routines","planner.movedToSession":"Moved to Terminal","planner.fromDiscussion":"From Discussion","planner.noDueDate":"—","planner.export":"Export","planner.exportTooltip":"Export planner items to a Markdown file","planner.exportError":"Export failed","planner.import":"Import","planner.importTooltip":"Import planner items from a Markdown file","planner.importSuccess":"Imported {items} item(s) and {tags} tag(s).","planner.importError":"Import failed","planner.importInvalidMarkdown":"File is empty or not valid Markdown","planner.importNoImages":"Note: images are not included in exported files.","planner.dropHint":"Drop a Markdown file to import","planner.dropHintSub":".md or .markdown","planner.dropInvalidFile":"Only Markdown files (.md / .markdown) can be imported","plannerForm.titlePlaceholder":"Planner item title...","plannerForm.descPlaceholder":"Description or details...","plannerForm.tags":"Tags","plannerForm.tagsPlaceholder":"Type and press Enter","plannerForm.dueDate":"Due Date","plannerForm.priority":"Priority","plannerForm.priorityLow":"Low","plannerForm.priorityNormal":"Normal","plannerForm.priorityHigh":"High","plannerForm.priorityCritical":"Critical","plannerForm.status":"Status","plannerForm.addImage":"Add Image","plannerForm.pasteHint":"Ctrl+V to paste image","plannerForm.images":"Images","plannerForm.cancel":"Cancel","plannerForm.save":"Save","plannerStatus.pending":"Pending","plannerStatus.in_progress":"In Progress","plannerStatus.done":"Done","plannerStatus.moved":"Moved","plannerConvert.toTask":"Convert to Task","plannerConvert.toSchedule":"Convert to Routine","plannerConvert.toTerminal":"Send to Terminal","plannerConvert.useWorktree":"Use git worktree","plannerConvert.cliTool":"CLI Tool","plannerConvert.maxTurns":"Max Turns","plannerConvert.scheduleType":"Routine Type","plannerConvert.recurring":"Recurring","plannerConvert.once":"One-time","plannerConvert.cronExpression":"Cron Expression","plannerConvert.runAt":"Run At","plannerConvert.cancel":"Cancel","plannerConvert.convert":"Convert","plannerTag.selectOrCreate":"Select or create","plannerTag.delete":"Delete","plannerTag.deleteConfirm":"Remove this tag from all items?","plannerTag.color":"Color","plannerTag.rename":"Rename","plannerTag.color.default":"Default","plannerTag.color.gray":"Gray","plannerTag.color.brown":"Brown","plannerTag.color.orange":"Orange","plannerTag.color.yellow":"Yellow","plannerTag.color.green":"Green","plannerTag.color.blue":"Blue","plannerTag.color.purple":"Purple","plannerTag.color.pink":"Pink","plannerTag.color.red":"Red","session.new":"New Terminal","session.windowState.floating":"Open","session.windowState.minimized":"Minimized","session.windowState.popped":"Separate window","session.recallToMain":"Bring to main window","session.restoreWindow":"Restore window","session.focusWindow":"Go to window","session.openWindow":"Open terminal","session.dock.poppedHint":"Separate window — click to bring it to front","session.title":"Terminal Title","session.description":"Initial Prompt (Optional)","session.start":"Start","session.stop":"Stop","session.resume":"Resume","session.resumeHint":"Continue the last Claude conversation in this worktree","session.delete":"Delete","session.edit":"Edit","session.editDisabledRunning":"Cannot edit while running","session.save":"Save","session.saving":"saving…","session.empty":"No terminals yet","session.emptyHint":"Start an interactive AI conversation.","session.create":"Create Terminal","session.cliTool":"CLI Tool","session.cliNotInstalled":" (not installed)","session.worktree":"Use worktree (isolated branch)","session.cleanup":"Clean up worktree","session.startInWindow":"Start","session.starting":"starting…","session.starting.typeAhead":"type-ahead is captured and replayed once ready","session.stopping":"stopping…","session.startFailed":"Failed to start","session.confirmStop":"End this terminal? The running task will be terminated.","session.minimize":"Minimize","session.fontDecrease":"Decrease font size","session.fontIncrease":"Increase font size","session.refresh":"Refresh rendering","session.refresh.hint":"Rebuild the terminal view (PTY stays running)","session.initialPrompt.ready":"Initial prompt ready to send","session.initialPrompt.preview":"Preview","session.initialPrompt.hidePreview":"Hide","session.initialPrompt.send":"Send","session.initialPrompt.skip":"Skip","session.initialPrompt.loading":"loading…","session.initialPrompt.blocked":"Press Send or Skip before typing — keystrokes are ignored until then.","group.closeTab":"Close tab","group.newTab":"New shell tab","analytics.title":"Execution Analytics","analytics.loading":"Loading analytics...","analytics.noData":"No data available","analytics.totalTasks":"Total Tasks","analytics.successRate":"Success Rate","analytics.totalCost":"Total Cost","analytics.totalTokens":"Total Tokens","analytics.avgPerTask":"Avg / Task","analytics.byStatus":"By Status","analytics.byCliTool":"By CLI Tool","analytics.dailyActivity":"Daily Activity","analytics.dailyCost":"Daily Cost","analytics.costBreakdown":"Cost Summary","analytics.tasks":"tasks","analytics.period.7d":"7D","analytics.period.30d":"30D","analytics.period.90d":"90D","analytics.period.all":"All","discussions.title":"Discussions","discussions.add":"New Discussion","discussions.empty":"No discussions yet","discussions.emptyHint":"Create a discussion to have agents collaborate on a feature.","discussions.round":"Round","discussions.maxRounds":"Max Rounds","discussions.agents":"Agents","discussions.speaking":"Speaking...","discussions.inject":"Send Message","discussions.skipTurn":"Skip Turn","discussions.implement":"Start Implementation","discussions.implementHint":"Select an agent to implement the discussed feature.","discussions.selectAgent":"Select Implementer","discussions.toPlanner":"Send to Planner","discussions.extractTitle":"Extract Action Items","discussions.extractHint":"AI proposed these planner items from the discussion. Edit, deselect, or adjust priority before saving.","discussions.extractLoading":"Extracting action items from the discussion…","discussions.extractLoadingHint":"This may take up to two minutes. The dialog will stay open until extraction finishes.","discussions.extractEmpty":"No actionable items found. Try a different discussion or add more agreement.","discussions.extractConfirm":"Save to Planner","discussions.extractSaving":"Saving…","discussions.priorityLow":"Low","discussions.priorityMedium":"Medium","discussions.priorityHigh":"High","discussions.priorityUrgent":"Urgent","discussions.notFound":"Discussion not found","discussions.back":"Back to Discussions","discussions.userMessage":"Your message...","discussions.implementation":"Implementation","discussions.resume":"Resume","discussions.retry":"Retry","discussions.failureTitle":"Discussion Failed","discussions.noErrorLogs":"No error details available","discussions.pause":"Pause","discussions.waiting":"Waiting...","discussions.roundExplain":"One round = each agent speaks once.","discussions.autoImplement":"Auto-implement after discussion","discussions.autoImplementHint":"Automatically start implementation when all rounds complete.","discussions.collapse":"Collapse","discussions.expand":"Expand","discussions.collapseAll":"Collapse All","discussions.expandAll":"Expand All","status.skipped":"Skipped","status.paused":"Paused","agents.title":"Agent Personas","agents.add":"Add Agent","agents.name":"Name","agents.role":"Role","agents.systemPrompt":"System Prompt","agents.cliTool":"CLI Tool","agents.color":"Color","agents.empty":"No agents yet. Create agent personas to start a discussion.","agents.manage":"Manage Agents","agents.presets":"Preset Templates","agents.roles.architect":"Architect","agents.roles.developer":"Developer","agents.roles.reviewer":"Reviewer","agents.roles.pm":"Product Manager","agents.roles.tester":"Tester","agents.roles.custom":"Custom","agents.canImplement":"Implement during discussion","agents.canImplementHelp":"When it is this agent's turn, they can write code and commit to the discussion branch — not just talk. Useful for developer-style agents that should demonstrate ideas mid-discussion.","agents.canImplementBadge":"Implementer","git.ahead":"ahead","git.behind":"behind","git.staged":"Staged","git.unstaged":"Unstaged","git.noChanges":"Working tree clean","git.refresh":"Refresh","git.files":"files","git.commitHistory":"Commit History","git.branches":"Branches","git.remotes":"Remotes","git.tags":"Tags","git.stashes":"Stashes","git.noCommits":"No commits yet","git.loadMore":"Loading more...","git.author":"Author","git.hash":"Hash","git.graph":"Graph","git.description":"Description","git.date":"Date","git.commit":"Commit","git.pull":"Pull","git.push":"Push","git.pushDialog.targetRemote":"Push to","git.pushDialog.branchesHeader":"Branches to push","git.pushDialog.colPush":"Push?","git.pushDialog.colLocal":"Local branch","git.pushDialog.colRemote":"Remote branch","git.pushDialog.colTracking":"Track?","git.pushDialog.selectAll":"Select all","git.pushDialog.allTags":"Push all tags","git.pushDialog.force":"Force push","git.pushDialog.forceHint":"Uses --force-with-lease (rejects if remote moved since your last fetch).","git.pushDialog.submit":"Push","git.pushDialog.cancel":"Cancel","git.pushDialog.pushing":"Pushing…","git.pushDialog.loading":"Loading…","git.pushDialog.errorRequireBranch":"Select at least one branch to push.","git.pushDialog.noLocalBranches":"No local branches.","git.pushDialog.newBranch":"new","git.pushDialog.customRemote":"Enter name…","git.fetch":"Fetch","git.branch":"Branch","git.merge":"Merge","git.stash":"Stash","git.discard":"Discard","git.tag":"Tag","git.untracked":"Untracked","git.fileStatus":"File Status","git.stageAll":"Stage All","git.unstageAll":"Unstage All","git.stage":"Stage","git.unstage":"Unstage","git.commitMessage":"Commit message...","git.branchName":"Branch name...","git.tagName":"Tag name...","git.tagMessage":"Tag message (optional)...","git.stashMessage":"Stash message (optional)...","git.selectBranch":"Select branch...","git.discardAll":"Discard All","git.confirmDiscard":"Discard all changes? This cannot be undone.","git.confirmDiscardFile":"Discard changes to this file?","git.newBranch":"New Branch","git.deleteBranch":"Delete Branch","git.stashPop":"Pop","git.noStashes":"No stashes","git.actions":"Actions","git.close":"Close","git.create":"Create","git.delete":"Delete","git.modified":"Modified","git.added":"Added","git.deleted":"Deleted","git.renamed":"Renamed","git.copied":"Copied","git.checkout":"Checkout","git.mergeInto":"Merge into current branch","git.rebaseOnto":"Rebase current onto","git.renameBranch":"Rename branch","git.confirmDelete":"Delete branch {name}?","git.newBranchName":"New branch name...","git.rename":"Rename","git.checkoutRemote":"Checkout as local branch","git.commitDetail":"Commit Detail","git.changedFiles":"Changed Files","git.selectFileToViewDiff":"Select a file to view diff","git.noFilesChanged":"No files changed","git.loadingFiles":"Loading files...","git.loadingDiff":"Loading diff...","git.worktrees":"Worktrees","git.cleanupWorktree":"Cleanup","git.confirmCleanupWorktree":"Remove worktree and branch {name}?","git.deleteWorktreeAndBranch":"Delete branch + worktree","git.confirmDeleteWorktreeAndBranch":"Delete branch {name} and its worktree?","git.confirmForceDelete":"Branch {name} is not fully merged. Force delete anyway? Unmerged commits will be lost.","git.workspace":"WORKSPACE","git.viewFileStatus":"File Status","git.viewHistory":"History","git.search":"Search","git.searchPlaceholder":"Search","git.stagedFiles":"Staged files","git.unstagedFiles":"Unstaged files","git.untrackedFiles":"Untracked files","git.unstageAllShort":"Unstage all","git.unstageSelectedShort":"Unstage selected","git.stageAllShort":"Stage all","git.stageSelectedShort":"Stage selected","git.commitOptions":"Commit options","git.pushImmediately":"Push to {remote} after commit","git.amendLastCommit":"Amend last commit","git.commitButton":"Commit","git.selectFileForDiff":"Select a file to view the diff","git.binaryFile":"Binary file (no diff preview)","git.untrackedNewFile":"(new file)","git.workingTreeClean":"Working tree is clean — nothing to commit","lang.toggle":"KO","theme.light":"Light","theme.dark":"Dark","notification.taskCompleted":"Task Completed","notification.taskFailed":"Task Failed","notification.discussionCompleted":"Discussion Completed","notification.discussionFailed":"Discussion Failed","notification.toggle":"Toggle notifications","notification.blocked":"Notifications blocked by browser"},ko:{"login.title":"CLITrigger","login.subtitle":"인증이 필요합니다","login.password":"비밀번호 입력","login.rememberMe":"로그인 상태 유지","login.submit":"로그인","login.loading":"인증 중...","login.error":"접근이 거부되었습니다. 다시 시도해주세요.","login.footer":"보안 접속","login.disclaimer":'This software is provided "as is" without any warranties. Users are solely responsible for all actions taken using this tool, including any costs incurred from AI CLI usage, data loss, or unintended code changes. The developers assume no liability for any direct, indirect, or consequential damages arising from use.',"setup.title":"CLITrigger에 오신 것을 환영합니다","setup.subtitle":"이 인스턴스를 보호할 비밀번호를 설정하세요","setup.password":"새 비밀번호","setup.confirm":"비밀번호 확인","setup.submit":"비밀번호 만들기","setup.loading":"저장 중…","setup.tooShort":"비밀번호는 8자 이상이어야 합니다.","setup.mismatch":"비밀번호가 일치하지 않습니다.","setup.tunnelPaused":"셋업이 끝날 때까지 외부 공유(Cloudflare 터널)는 자동 시작되지 않습니다.","setup.error":"비밀번호 저장에 실패했습니다.","sidebar.home":"홈","sidebar.review":"리뷰 큐","sidebar.agenda":"내 일정","agenda.title":"내 일정","agenda.subtitle":"개인 메모·일정과 전 프로젝트 루틴을 한곳에서","agenda.today":"오늘","agenda.refresh":"새로고침","agenda.refreshHelp":"현재 보이는 기간을 다시 불러옵니다 — 내 메모, 프로젝트 루틴/플래너, 할당된 Jira 이슈. 달/주/일 이동이나 뷰 전환 시에도 자동으로 갱신되며, 가만히 있을 때는 자동 폴링하지 않습니다.","agenda.view.month":"월","agenda.view.week":"주","agenda.view.day":"일","agenda.view.table":"표","agenda.addItem":"항목 추가","agenda.expand":"크게 보기","agenda.collapse":"작게 보기","agenda.tags.all":"전체","agenda.tags.placeholder":"태그 추가…","agenda.resizePanel":"드래그하여 크기 조절","agenda.resizeCalendar":"드래그하여 달력 크기 조절","agenda.untitled":"(제목 없음)","agenda.source.personal":"메모","agenda.source.schedule":"루틴","agenda.source.planner":"플래너","agenda.source.jira":"Jira","agenda.jira.settings":"Jira 연결","agenda.jira.subtitle":"내게 할당된 Jira 작업을 이 캘린더에서 함께 봅니다.","agenda.jira.enable":"내게 할당된 Jira 이슈 표시","agenda.jira.baseUrlLabel":"Jira 사이트 주소","agenda.jira.baseUrlHint":"Jira를 열 때 쓰는 주소예요. 브라우저 주소창 맨 앞부분. 예: https://회사이름.atlassian.net","agenda.jira.emailLabel":"로그인 이메일","agenda.jira.emailHint":"Jira(Atlassian)에 로그인할 때 쓰는 이메일이에요.","agenda.jira.tokenLabel":"API 토큰","agenda.jira.tokenPlaceholder":"발급받은 API 토큰을 붙여넣으세요","agenda.jira.tokenLink":"API 토큰 발급받기","agenda.jira.tokenStep1":"1. 위 링크를 열고 로그인하세요.","agenda.jira.tokenStep2":'2. "API 토큰 만들기"를 누르고 아무 이름이나 지어주세요.',"agenda.jira.tokenStep3":"3. 만들어진 토큰을 복사해 위 칸에 붙여넣으세요. (비밀번호가 아니라 별도 토큰이에요.)","agenda.jira.criteria":"가져오기 기준","agenda.jira.criteriaHint":"캘린더에 표시하고 가져올 수 있는 이슈의 조건을 정합니다.","agenda.jira.assigneeMe":"나에게 할당된 이슈만","agenda.jira.includeDone":"완료된 이슈도 포함","agenda.jira.projects":"프로젝트","agenda.jira.projectsHint":"이 프로젝트 키만 가져옵니다(쉼표 또는 공백으로 구분). 비우면 전체.","agenda.jira.statuses":"가져올 상태","agenda.jira.statusesHint":'체크한 상태의 이슈만 가져옵니다. 모두 체크 해제하면 위 "완료된 이슈도 포함" 설정을 따릅니다.',"agenda.jira.statusesLoad":"상태 불러오기","agenda.jira.statusesLoading":"불러오는 중…","agenda.jira.statusesNeedConn":"상태를 불러오려면 먼저 연결을 저장하고 테스트하세요.","agenda.jira.statusesSearch":"상태 검색…","agenda.jira.statusesEmpty":'불러온 상태가 없습니다. "상태 불러오기"를 누르세요.',"agenda.jira.dismiss":"내 일정에서 숨기기","agenda.jira.dismissedTitle":"숨긴 JIRA 이슈","agenda.jira.restore":"복원","agenda.jira.extraJql":"고급 (JQL)","agenda.jira.extraJqlHint":"위 조건에 AND로 합쳐지는 추가 JQL. 예: labels = urgent AND priority >= High","agenda.jira.test":"연결 테스트","agenda.jira.tokenSaved":"토큰 저장됨 (비우면 유지)","agenda.jira.hint":'내게 할당된 열린 이슈를 가져옵니다. 기한 있는 것은 캘린더에, 나머지는 "Jira (마감일 없음)" 목록에 표시됩니다. 인증은 이메일 + API 토큰.',"agenda.jira.import":"내 일정에 추가","agenda.jira.noDue":"Jira (마감일 없음)","agenda.jira.error":"Jira 오류","agenda.moveToPlanner":"플래너로 이동","agenda.importToPlanner":"플래너에 추가","agenda.pickProject":"프로젝트 선택","agenda.noProjects":"프로젝트 없음","agenda.table.name":"제목","agenda.table.date":"날짜","agenda.table.kind":"종류","agenda.table.status":"상태","agenda.kind.personal":"메모","agenda.kind.schedule":"루틴","agenda.kind.planner":"플래너","agenda.kind.jira":"Jira","agenda.status.done":"완료","agenda.status.pending":"대기","agenda.add":"추가","agenda.memo":"메모","agenda.backlog":"날짜 없음","agenda.backlogEmpty":"날짜 없는 메모가 없습니다","agenda.dayEmpty":"이 날짜에 일정이 없습니다","agenda.fromSchedule":"프로젝트 루틴","agenda.fromPlanner":"프로젝트 플래너","agenda.toggleDone":"완료 토글","agenda.delete":"삭제","agenda.confirmDelete":"이 항목을 삭제할까요?","agenda.addTitle":"새 항목","agenda.editTitle":"항목 편집","agenda.titlePlaceholder":"제목","agenda.descPlaceholder":"메모 (선택)","agenda.dateHint":"날짜를 비우면 날짜 없는 메모로 저장됩니다. 시간을 지정하면 시간 일정이 됩니다.","agenda.cancel":"취소","agenda.save":"저장","agenda.cleanup":"메모 정리","agenda.cleanup.title":"기간으로 메모 삭제","agenda.cleanup.subtitle":"선택한 기간의 개인 메모를 한 번에 삭제합니다. 되돌릴 수 없습니다.","agenda.cleanup.from":"시작","agenda.cleanup.to":"종료","agenda.cleanup.doneOnly":"완료된 메모만","agenda.cleanup.includeBacklog":"날짜 없는 백로그 메모도 삭제","agenda.cleanup.previewLabel":"삭제 대상","agenda.cleanup.unit":"개","agenda.cleanup.none":"조건에 해당하는 메모가 없습니다","agenda.cleanup.confirm":"삭제","sidebar.workspaces":"워크스페이스","sidebar.favorites":"즐겨찾기","sidebar.collapse":"사이드바 접기","sidebar.expand":"사이드바 펼치기","favorites.add":"즐겨찾기 추가","favorites.edit":"즐겨찾기 편집","favorites.delete":"삭제","favorites.deleteConfirm":"이 즐겨찾기를 삭제할까요?","favorites.launchFailed":"실행 실패","favorites.empty":"등록된 즐겨찾기가 없습니다.","favorites.form.title.create":"새 즐겨찾기","favorites.form.title.edit":"즐겨찾기 편집","favorites.form.name":"이름","favorites.form.type":"종류","favorites.form.target":"대상","favorites.form.browse":"찾아보기…","favorites.form.targetHint.executable":".exe / .bat / .sh 절대 경로","favorites.form.targetHint.command":"셸 명령어 (그대로 실행됨)","favorites.form.targetHint.url":"http:// 또는 https:// URL","favorites.form.args":"인자 (공백으로 구분)","favorites.form.cwd":"작업 디렉토리 (선택)","favorites.form.create":"생성","favorites.form.save":"저장","favorites.form.cancel":"취소","favorites.types.executable":"실행 파일","favorites.types.command":"명령어","favorites.types.url":"URL","favorites.security.notice":"즐겨찾기는 서버 계정으로 실행됩니다. 터널 공유가 켜져 있다면 비밀번호를 아는 사람이 누구나 실행할 수 있습니다.","tunnel.title":"터널 설정","tunnel.description":"Cloudflare 터널 설정. 공유 도메인(*.trycloudflare.com / *.cfargotunnel.com)에서 뜨는 브라우저 위험 경고를 피하려면 본인 도메인을 지정하세요.","tunnel.name.label":"Named tunnel 이름","tunnel.name.placeholder":"my-app","tunnel.name.hint":"비워두면 무작위 Quick Tunnel(https://*.trycloudflare.com)을 사용합니다.","tunnel.hostname.label":"커스텀 도메인 (선택)","tunnel.hostname.placeholder":"app.your-domain.com","tunnel.hostname.hint":'미리 "cloudflared tunnel route dns" 명령으로 이 도메인을 터널에 연결해 두어야 합니다. 비우면 *.cfargotunnel.com으로 폴백.',"tunnel.hostname.invalid":"유효한 공인 도메인을 입력하세요 (예: app.your-domain.com).","tunnel.hostname.needsName":"커스텀 도메인을 사용하려면 먼저 named tunnel 이름을 지정하세요.","tunnel.guide.toggle":"커스텀 도메인 셋업 방법","tunnel.guide.heading":"cloudflared CLI로 1회 셋업:","tunnel.guide.step4":"위 입력란에 터널 이름과 도메인을 적고 저장하세요.","tunnel.guide.note":"도메인은 Cloudflare 계정에 등록되어 있어야 합니다 (무료 플랜으로 충분).","tunnel.status.stopped":"중지됨","tunnel.status.starting":"시작 중…","tunnel.status.running":"실행 중","tunnel.status.error":"오류","tunnel.save":"저장","tunnel.saving":"저장 중…","tunnel.saved":"터널 설정을 저장했습니다. 터널을 재시작하면 적용됩니다.","tunnel.saveFailed":"터널 설정 저장에 실패했습니다.","tunnel.close":"닫기","tunnel.restart":"터널 재시작","tunnel.restarting":"재시작 중…","tunnel.restarted":"터널을 재시작했습니다.","tunnel.restartFailed":"터널 재시작에 실패했습니다.","tunnel.start":"터널 시작","tunnel.starting":"시작 중…","tunnel.urlCopied":"외부 URL을 클립보드에 복사했습니다.","settings.title":"설정","settings.tabs.account":"계정","settings.tabs.session":"터미널","settings.tabs.tunnel":"터널","sessionSettings.title":"터미널 환경설정","sessionSettings.description":"새 터미널의 기본 동작과 재사용할 색상 태그를 관리합니다.","sessionSettings.saved":"저장되었습니다.","sessionSettings.worktree.title":"Worktree 기본값","sessionSettings.worktree.label":"새 터미널에 git worktree 사용","sessionSettings.worktree.hint":"켜두면 새 터미널이 .worktrees/ 안의 별도 브랜치에서 생성됩니다. git 저장소에만 적용됩니다.","sessionSettings.fontSize.title":"기본 폰트 크기","sessionSettings.fontSize.label":"새 터미널의 폰트 크기 (px)","sessionSettings.fontSize.hint":"아직 줌을 만지지 않은 터미널은 이 값을 즉시 따라갑니다. 터미널별 줌(Ctrl+휠, A−/A+)이 적용된 터미널은 영향받지 않습니다.","sessionSettings.tags.title":"태그","sessionSettings.tags.description":"이름과 색을 정해두면 터미널 생성 폼에서 골라 붙일 수 있습니다.","sessionSettings.tags.empty":"아직 태그가 없습니다 — 위에서 하나 추가하세요.","sessionSettings.tags.namePlaceholder":"태그 이름 (예: 탐색, 배포)","sessionSettings.tags.color":"색","sessionSettings.tags.add":"추가","sessionSettings.tags.edit":"수정","sessionSettings.tags.delete":"삭제","sessionSettings.tags.save":"저장","sessionSettings.tags.cancel":"취소","sessionSettings.tags.deleteConfirm":'"{name}" 태그를 삭제할까요? 이 태그를 쓰던 터미널은 태그가 비워집니다.',"session.tag.none":"태그 없음","account.title":"비밀번호 변경","account.description":"현재 비밀번호를 입력한 후 새 비밀번호를 선택하세요.","account.oldPassword":"현재 비밀번호","account.newPassword":"새 비밀번호","account.confirm":"새 비밀번호 확인","account.tooShort":"비밀번호는 8자 이상이어야 합니다.","account.mismatch":"비밀번호가 일치하지 않습니다.","account.save":"저장","account.saving":"저장 중…","account.saved":"비밀번호가 변경되었습니다. 다른 세션은 모두 로그아웃됩니다.","account.saveFailed":"비밀번호 변경에 실패했습니다.","account.close":"닫기","review.title":"리뷰 큐","review.subtitle":"모든 프로젝트의 밤샘 결과를 한 화면에서 정리","review.refresh":"새로고침","review.empty":"이 기간에 리뷰할 항목이 없습니다.","review.viewDetails":"자세히","review.approve":"승인 · 머지","review.requestChanges":"수정 요청","review.discard":"폐기","review.cancel":"취소","review.send":"전송","review.continuePlaceholder":"무엇을 고치거나 바꿔야 하는지 설명…","review.discardConfirm":"이 todo를 폐기하고 워크트리를 정리할까요?","review.mergeFailed":"머지 실패","review.continueFailed":"이어가기 실패","review.discardFailed":"폐기 실패","review.closeDetails":"닫기","review.justNow":"방금","review.minAgo":"분 전","review.hourAgo":"시간 전","review.dayAgo":"일 전","review.files":"파일","review.lines":"줄","review.rounds":"라운드","review.window.12h":"12시간","review.window.24h":"24시간","review.window.7d":"7일","review.filter.all":"전체","review.filter.risky":"위험","review.filter.quickWins":"Quick wins","review.filter.failed":"실패","review.risk.low":"낮은 위험","review.risk.medium":"중간 위험","review.risk.high":"높은 위험","review.tokens.total":"총 토큰","review.tokens.todos":"Todo 수","review.tokens.byCli":"CLI별","review.diff.empty":"베이스 브랜치 대비 변경 사항이 없습니다.","review.diff.noBranch":"브랜치 없이 메인 브랜치에서 실행된 todo라 diff를 표시할 수 없습니다.","review.diff.branchMissing":"브랜치가 삭제되어 diff를 표시할 수 없습니다.","review.diff.baseBranchMissing":"베이스 브랜치를 repo에서 찾을 수 없어 diff를 표시할 수 없습니다. 프로젝트 default_branch 설정을 확인하세요.","review.diff.notFound":"Todo를 찾을 수 없습니다.","projects.title":"전체 프로젝트","projects.subtitle":"프로젝트 콘솔","projects.new":"새 프로젝트","projects.logout":"로그아웃","projects.loading":"프로젝트 로딩 중...","projects.empty":"프로젝트가 없습니다","projects.emptyHint":"첫 번째 프로젝트를 만들어보세요.","projects.tasks":"작업","projects.active":"실행 중","projects.done":"완료","projects.search":"프로젝트 검색...","projects.delete":"프로젝트 삭제","projects.deleteConfirm":"이 프로젝트를 삭제하시겠습니까?","projects.pathMissing":"경로 없음","projects.pathMissingConfirm":"이 프로젝트의 로컬 폴더가 존재하지 않습니다. 삭제하시겠습니까?","projects.noGit":"Git 없음","detail.back":"프로젝트","detail.loading":"로딩 중...","detail.notFound":"프로젝트를 찾을 수 없습니다","detail.backToProjects":"프로젝트 목록으로","detail.live":"연결됨","header.branch":"브랜치","header.editName":"클릭하여 프로젝트 이름 변경","header.openFolder":"폴더 열기","header.workers":"워커","header.model":"모델","header.settings":"설정","header.runAll":"전체 실행","header.stopAll":"전체 중지","header.config":"프로젝트 설정","header.execConfig":"자동화 설정","header.execConfigHint":"자동 작업·토론·루틴 실행에 적용됩니다.","header.maxWorkers":"최대 워커 수","settings.defaultMaxTurns":"기본 턴 제한","settings.defaultMaxTurnsHint":"작업별 기본 턴 제한. 개별 작업에서 재설정 가능.","header.cliTool":"CLI 도구","header.cliFlags":"CLI 플래그","header.cancel":"취소","header.save":"저장","header.saving":"저장 중...","header.noGit":"Git 없음","header.noGitHint":'이 프로젝트는 Git 저장소가 아닙니다. 작업은 워크트리 격리 없이 직접 실행됩니다. 프로젝트 경로에서 "git init" 실행 후 재확인하세요.',"header.recheckGit":"Git 상태 재확인","header.fallbackChainTitle":"CLI 폴백 체인","header.fallbackChainHint":"CLI 도구의 컨텍스트가 소진되면 체인의 다음 도구로 자동 전환합니다.","header.sandboxTitle":"샌드박스 모드","header.sandboxBadgeStrict":"샌드박스: 엄격","header.sandboxBadgePermissive":"샌드박스: 허용","header.sandboxStrict":"엄격 (권장)","header.sandboxStrictDesc":"CLI 도구가 워크트리 디렉토리 내 파일만 접근할 수 있습니다.","header.sandboxPermissive":"허용","header.sandboxPermissiveDesc":"CLI 도구가 시스템의 모든 파일에 접근할 수 있습니다.","header.sandboxWarning":"경고: 허용 모드에서는 CLI 도구가 워크트리 밖 파일에도 접근할 수 있습니다. 주의해서 사용하세요.","header.worktreeTitle":"워크트리 격리","header.worktreeEnabled":"워크트리 (권장)","header.worktreeEnabledDesc":"각 작업이 독립 브랜치에서 실행됩니다. 병렬 작업에 안전합니다.","header.worktreeDisabled":"직접 실행 (메인 브랜치)","header.worktreeDisabledDesc":"메인 브랜치에서 직접 실행합니다. 최대 워커 1개로 제한됩니다.","header.worktreeWarning":"경고: 메인 브랜치를 직접 수정합니다. 동시 실행이 비활성화됩니다.","header.npmAutoInstallLabel":"워크트리 생성 시 `npm install` 자동 실행","header.npmAutoInstallHint":"npm 프로젝트에서 에이전트가 워크트리 안에서 test/build를 바로 돌릴 수 있게 합니다. pnpm/yarn/bun이나 npm이 아닌 프로젝트에서는 꺼두세요.","header.noWorktreeBadge":"워크트리 없음","header.debugBadge":"디버그 로그","header.showTokenUsageTitle":"토큰 사용량 표시","header.showTokenUsageDesc":"작업 완료 후 토큰 사용량(입력/출력)을 표시합니다.","header.showTokenUsageEnable":"토큰 사용량 표시","header.debugLoggingTitle":"디버그 로깅","header.debugLoggingDesc":"각 태스크 실행 시 CLI 입출력 전체를 .debug-logs/ 파일로 저장합니다.","header.debugLoggingEnable":"디버그 로그 파일 활성화","header.gstackTitle":"gstack 스킬","header.gstackEnabled":"gstack 스킬 주입 활성화","header.gstackCredit":"gstack 기반 (MIT 라이선스, Garry Tan)","header.usageLimit":"사용량","header.cliNotInstalled":"{tool}이(가) 설치되지 않았습니다","header.cliInstalled":"설치됨","header.cliNotFound":"미설치","header.cliInstallHint.claude":"npm install -g @anthropic-ai/claude-code","header.cliInstallHint.antigravity":"curl -fsSL https://antigravity.google/cli/install.sh | bash","header.cliInstallHint.codex":"npm install -g @openai/codex","header.cliRefresh":"재확인","header.gstackClaudeOnly":"gstack 스킬은 Claude CLI에서만 사용 가능합니다.","header.jiraTitle":"Jira 연동","header.jiraBaseUrl":"Jira URL","header.jiraBaseUrlPlaceholder":"https://yoursite.atlassian.net","header.jiraEmail":"이메일","header.jiraEmailPlaceholder":"your@email.com","header.jiraApiToken":"API 토큰","header.jiraApiTokenPlaceholder":"Atlassian API 토큰","header.jiraProjectKey":"프로젝트 키","header.jiraProjectKeyPlaceholder":"예: PROJ","header.jiraTestConnection":"연결 테스트","header.jiraTesting":"테스트 중...","header.jiraConnected":"연결 성공","header.jiraFailed":"연결 실패","header.jiraTokenHint":"id.atlassian.com > 보안 > API 토큰에서 생성","form.newProject":"새 프로젝트","form.projectName":"프로젝트 이름","form.folderPath":"폴더 경로","form.cancel":"취소","form.create":"생성","form.creating":"생성 중...","form.createError":"프로젝트 생성 실패","browse.title":"폴더 찾아보기","browse.select":"선택","browse.loading":"불러오는 중...","browse.error":"디렉토리를 불러올 수 없습니다","browse.empty":"폴더가 없습니다","todos.title":"작업 목록","todos.add":"작업 추가","todos.empty":"작업이 없습니다","todos.emptyHint":"작업을 추가해보세요.","todos.filterAll":"전체","todos.filterActive":"작업중","todos.filterCompleted":"완료","todos.filterCancelled":"취소","todos.filterEmpty":"해당 상태의 작업이 없습니다.","todos.stackModeOn":"스택 모드 켜짐 — 다시 누르면 해제","todos.stackModeOff":"스택 모드 켜기 (iOS 알림 스타일)","todos.collapseStack":"스택으로 접기","todos.expandStack":"클릭하면 펼쳐집니다","todos.merge":"병합","todo.description":"설명","todo.noDescription":"설명이 없습니다.","todo.attachedImages":"첨부 이미지","todo.branch":"브랜치","todo.path":"경로","todo.worktree":"워크트리","todo.result":"실행 결과","todo.mergeFailed":"병합 실패","todo.diffError":"Diff 오류","todo.diffOutput":"변경사항","todo.files":"파일","todo.systemLog":"활동 로그","todo.start":"시작","todo.startHeadless":"Headless","todo.startHeadlessDesc":"자율 실행. 모든 권한 자동 승인.","todo.startInteractive":"Interactive","todo.startInteractiveDesc":"stdin을 열어두고 실행 중 메시지 전송 가능.","todo.startVerbose":"Verbose","todo.startVerboseDesc":"자동 승인 + 모든 로그 실시간 출력.","todo.sendPlaceholder":"메시지 입력...","todo.startWithDependency":"선행 작업 먼저 시작","todo.stop":"중지","todo.viewDiff":"Diff 보기","todo.hideDiff":"Diff 접기","todo.viewDebugLog":"디버그 로그","todo.merge":"병합","todo.mergeChain":"체인 병합","todo.mergeChainDesc":"이 체인의 모든 작업을 메인 브랜치에 병합","todo.chainComplete":"체인 완료","todo.chainTasks":"{count}개 작업","todo.edit":"편집","todo.delete":"삭제","todo.cleanup":"워크트리 삭제","todo.cleanupFailed":"정리 실패","cleanup.confirmDeleteBranch":`워크트리를 삭제합니다. 브랜치 "{name}"도 함께 삭제할까요?
|
|
64
|
+
Cancel = delete worktree only`,"todo.retry":"Retry","todo.retryDesc":"Cleans up previous worktree, clears logs, and re-runs from scratch.","todo.retryFailed":"Retry failed","todo.continue":"Continue","todo.continueDesc":"Run a follow-up prompt in the same worktree, preserving prior work.","todo.continuing":"Continuing...","todo.confirmContinue":"Run follow-up","todo.continuePromptLabel":"Follow-up prompt","todo.continuePromptPlaceholder":"Describe the next step or fix to apply in this worktree...","todo.continuePromptRequired":"Follow-up prompt is required.","todo.roundLabel":"round","todo.dependsOn":"Depends on","todo.mergedFrom":"Inherited from","todo.transferredTo":"Transferred to","todo.schedule":"Schedule","todo.scheduleDesc":"Convert this task into a one-time routine run.","todo.scheduleAt":"Run at","todo.scheduling":"Scheduling...","todo.confirmSchedule":"Schedule","todo.scheduleKeepOriginal":"Keep original task","todo.scheduleOnReset":"Run on Reset","todo.scheduleOnResetDesc":"Auto-run a new task when the rate limit resets.","todo.scheduleOnResetLabel":"Rate limit resets at","todo.resetPromptPlaceholder":"Enter the prompt to run after rate limit resets...","todo.confirmResetSchedule":"Schedule on Reset","todoForm.titlePlaceholder":"Task title...","todoForm.descPlaceholder":"Description (optional)...","todoForm.cliTool":"CLI Tool","todoForm.addImage":"Add Image","todoForm.pasteHint":"Ctrl+V to paste image","todoForm.images":"Images","todoForm.maxTurns":"Max Turns","todoForm.maxTurnsPlaceholder":"No limit","todoForm.maxTurnsHint":"Limit the number of agentic turns to prevent excessive token usage.","todoForm.dependsOn":"Depends On","todoForm.noDependency":"None (independent task)","todoForm.dependsOnHint":"This task will wait for the dependency to complete, then squash merge its changes into a new branch.","todoForm.worktreeMode":"Execution Branch","todoForm.worktreeInherit":"Follow project setting","todoForm.worktreeForceOn":"Use worktree (isolated branch)","todoForm.worktreeForceOff":"Run on main branch","todoForm.worktreeProjectDefaultOn":"Project default: worktree","todoForm.worktreeProjectDefaultOff":"Project default: main branch","todoForm.worktreeMainWarning":"Running on main branch blocks other todos from running concurrently.","todoForm.cancel":"Cancel","todoForm.save":"Save","dnd.dropHint":"Run after this task","dnd.removeDep":"Remove dependency","dnd.dropToRemoveDep":"Drop here to remove dependency","dnd.cyclicWarning":"Cannot link: circular dependency","graph.autoLayout":"Auto Layout","graph.listView":"List View","graph.graphView":"Graph View","status.pending":"Idle","status.running":"Running","status.completed":"Done","status.failed":"Failed","status.stopped":"Stopped","status.merged":"Merged","progress.complete":"complete","progress.done":"Done","progress.live":"Running","progress.idle":"Idle","progress.fail":"Failed","progress.stop":"Stopped","progress.merged":"Merged","failure.title":"Failure Reason","failure.exitCode":"Exit code","failure.fix":"Fix This: Creates a new task that analyzes the failure and attempts to fix the issue.","failure.fixPrefix":"[Fix] ","result.duration":"Duration","result.commits":"commits","result.filesChanged":"files changed","result.commitHistory":"Commit History","result.changedFiles":"Changed Files","result.tokenUsage":"Token Usage","result.inputTokens":"input","result.outputTokens":"output","result.totalCost":"Cost","result.cacheTokens":"cache","result.turns":"turns","result.contextUsed":"ctx","result.levelLight":"Light","result.levelModerate":"Moderate","result.levelHigh":"High","result.levelHeavy":"Heavy","log.awaiting":"Awaiting output...","log.waitingResponse":"Waiting for response...","log.noChanges":"No changes detected.","log.copy":"Copy","log.copied":"Copied!","log.viewChat":"Chat","log.viewRaw":"Raw","schedules.title":"Routines","schedules.add":"New Routine","schedules.empty":"No routines yet","schedules.emptyHint":"Create a routine to automate recurring tasks.","schedule.type":"Routine Type","schedule.recurring":"Recurring","schedule.once":"One-time","schedule.runAtLabel":"Run at","schedule.cronExpression":"Frequency","schedule.cronHint":"e.g. */30 * * * * (every 30min), 0 9 * * * (daily 9am), 0 9 * * 1-5 (weekdays 9am)","cron.everyMinutes":"Minutes","cron.hourly":"Hourly","cron.daily":"Daily","cron.weekly":"Weekly","cron.monthly":"Monthly","cron.custom":"Custom","cron.every":"Every","cron.minutesLabel":"minutes","cron.everyHourAt":"Every hour at","cron.minutesPast":"min past","cron.everyDayAt":"Every day at","cron.at":"at","cron.everyMonthOn":"Every month on day","cron.dayAt":"at","cron.expression":"Cron","cron.mon":"Mon","cron.tue":"Tue","cron.wed":"Wed","cron.thu":"Thu","cron.fri":"Fri","cron.sat":"Sat","cron.sun":"Sun","schedule.skipIfRunning":"Skip if previous run still active","schedule.active":"Active","schedule.paused":"Paused","schedule.lastRun":"Last run","schedule.never":"Never","schedule.trigger":"Run Now","schedule.activate":"Activate","schedule.pause":"Pause","schedule.edit":"Edit","schedule.delete":"Delete","schedule.runs":"Run History","schedule.runTriggered":"Triggered","schedule.runSkipped":"Skipped","schedule.runCompleted":"Completed","schedule.runFailed":"Failed","schedule.noRuns":"No runs yet","scheduleForm.titlePlaceholder":"Routine title...","scheduleForm.descPlaceholder":"Task description template...","scheduleForm.cliTool":"CLI Tool","scheduleForm.cancel":"Cancel","scheduleForm.save":"Save","jira.title":"Jira Issues","jira.search":"Search issues...","jira.allStatuses":"All Statuses","jira.refresh":"Refresh","jira.import":"Import as Task","jira.importing":"Importing...","jira.imported":"Imported!","jira.noIssues":"No issues found","jira.noIssuesHint":"Try changing the filter or search query.","jira.loadMore":"Load More","jira.total":"total","jira.transition":"Change Status","jira.comment":"Comment","jira.commentPlaceholder":"Add a comment...","jira.commentSend":"Send","jira.createIssue":"Create Issue","jira.createSummary":"Summary","jira.createDesc":"Description","jira.createType":"Issue Type","jira.creating":"Creating...","jira.notConfigured":"Jira is not configured. Enable it in project settings.","jira.assignee":"Assignee","jira.unassigned":"Unassigned","jira.updated":"Updated","notion.title":"Notion Pages","notion.search":"Search pages...","notion.refresh":"Refresh","notion.import":"Import as Task","notion.importing":"Importing...","notion.imported":"Imported!","notion.noPages":"No pages found","notion.noPagesHint":"Try changing the search query.","notion.loadMore":"Load More","notion.createPage":"Create Page","notion.pageTitle":"Title","notion.creating":"Creating...","notion.notConfigured":"Notion is not configured. Enable it in project settings.","notion.loadingContent":"Loading content...","notion.noContent":"No content","header.notionTitle":"Notion Integration","header.notionApiKey":"Integration Token","header.notionApiKeyPlaceholder":"ntn_...","header.notionDatabaseId":"Database ID","header.notionDatabaseIdPlaceholder":"e.g. abc123def456...","header.notionTestConnection":"Test Connection","header.notionTesting":"Testing...","header.notionConnected":"Connected","header.notionFailed":"Connection failed","header.notionTokenHint":"Create an integration at notion.so/my-integrations and share the database with it","github.title":"GitHub Issues","github.search":"Search issues...","github.refresh":"Refresh","github.import":"Import as Task","github.importing":"Importing...","github.imported":"Imported!","github.noIssues":"No issues found","github.noIssuesHint":"Try changing the filter or search query.","github.loadMore":"Load More","github.createIssue":"Create Issue","github.issueTitle":"Title","github.issueBody":"Description","github.creating":"Creating...","github.notConfigured":"GitHub is not configured. Enable it in project settings.","github.loadingComments":"Loading comments...","github.comments":"Comments","github.noBody":"No description provided.","github.open":"Open","github.closed":"Closed","github.all":"All","header.githubTitle":"GitHub Integration","header.githubToken":"Personal Access Token","header.githubTokenPlaceholder":"ghp_...","header.githubOwner":"Repository Owner","header.githubOwnerPlaceholder":"username or org","header.githubRepo":"Repository Name","header.githubRepoPlaceholder":"repo-name","header.githubTestConnection":"Test Connection","header.githubTesting":"Testing...","header.githubConnected":"Connected","header.githubFailed":"Connection failed","header.githubTokenHint":"Create a token at github.com/settings/tokens with repo scope","tabs.automation":"Automation","tabs.automation.help":"Tasks, Discussions, and Routines in one place.","tabs.tasks":"Auto Tasks","tabs.sessions":"Terminals","tabs.discussions":"Discussions","tabs.schedules":"Routines","tabs.jira":"Jira","tabs.notion":"Notion","tabs.github":"GitHub","tabs.git":"Git","tabs.svn":"SVN","tabs.files":"Documents","tabs.planner":"Planner","tabs.wiki":"Wiki","tabs.analytics":"Analytics","tabs.wiki.help":"Project knowledge graph. Curate nodes/edges and they get injected as a <long_term_memory> block into auto-task and discussion prompts so the LLM keeps context across runs.","tabs.planner.help":"Lightweight task notes with tags, priorities, and image attachments. Promote favorites into auto tasks or routines, or import/export as Markdown.","tabs.tasks.help":"Queue up TODOs and fire them off in bulk — each one runs automatically in its own isolated git worktree (Claude/Antigravity/Codex). Stack dozens ahead of time, hit Run when you're ready, and they execute in parallel up to your concurrency limit. Dependency chains, multi-round continue, and merge automation are all handled for you.","tabs.sessions.help":"Drive Claude/Antigravity/Codex interactively in a floating window. Unlike auto tasks (fire-and-forget), terminals stay live so you can type, observe, and steer the CLI in real time.","tabs.discussions.help":"Multi-agent AI discussions over rounds, then optional implementation. Extract action items into the planner when finished.","tabs.schedules.help":"Trigger auto tasks on cron or one-off routines. Supports auto-restart at rate-limit reset times.","tabs.git.help":"Built-in Fork/SourceTree-style Git client: file status, commit graph, branch management, and diff viewer.","tabs.svn.help":"Built-in SVN working-copy panel: file status, revision log, and diff viewer.","svn.fileStatus":"File Status","svn.history":"History","svn.unversioned":"Unversioned","svn.changed":"Changed","svn.groupByDir":"Group by directory","svn.viewFlat":"Flat list","svn.dirFileCount":"{d} dirs · {f} files","svn.fileCount":"{f} files","svn.workingCopyRev":"Working Copy Revision","svn.update":"Update","svn.refresh":"Refresh","svn.add":"Add","svn.revert":"Revert","svn.delete":"Delete","svn.resolve":"Resolve","svn.commitMessagePlaceholder":"Describe the change. Required.","svn.commit":"Commit","svn.committing":"Committing...","svn.commitSuccess":"Committed r{rev}","svn.updating":"Updating...","svn.updateSuccess":"Updated to r{rev}","svn.noChanges":"No local changes.","svn.selectFiles":"Select one or more files first.","svn.notSvn":"Not an SVN working copy.","svn.cliMissing":"svn CLI not found. Install Subversion to use this panel.","svn.repoUrl":"Repository URL","svn.relativePath":"Path","svn.viewsHeader":"Views","svn.actionsHeader":"Commands","svn.checkForModifications":"Check for modifications","svn.showLog":"Show log","svn.updateToRevision":"Update to revision…","svn.cleanup":"Clean up","svn.checkRepository":"Check repository","svn.remoteBadge":"remote","svn.remoteHint":"Contacts the SVN server","svn.loadLog":"Load log","svn.logEmptyHint":"The log is fetched from the SVN server. Nothing loads automatically.","svn.loadMore":"Load more","svn.revision":"Revision","svn.revisionPlaceholder":"e.g. 1234 or HEAD","svn.cleaningUp":"Cleaning up…","svn.cleanupSuccess":"Clean up complete","svn.checking":"Checking…","svn.behindCount":"{n} incoming change(s) on server","svn.upToDate":"Up to date with server","svn.resolveWorking":"Mark resolved (keep working copy)","svn.resolveMine":"Resolve using mine","svn.resolveTheirs":"Resolve using theirs","svn.resolveBase":"Resolve using base","svn.viewDiff":"View diff","svn.cancel":"Cancel","svn.properties":"Properties","svn.propertiesOf":"Properties: {target}","svn.workingCopyRoot":"Working copy root","svn.noProperties":"No properties on this item.","svn.editProperty":"Edit","svn.saveProperty":"Save","svn.close":"Close","svn.changelistDefault":"Changes","svn.changelistUnversioned":"Unversioned Files","svn.changelistMissing":"Locally Deleted Files","svn.moveToChangelist":"Move to Changelist","svn.newChangelist":"New Changelist…","svn.removeFromChangelist":"Remove from Changelist","svn.changelistNamePlaceholder":"Changelist name","header.svnTitle":"SVN (Subversion)","header.svnHint":"Off by default. When enabled, the project is checked for a .svn/ working copy and an SVN tab is shown when found.","header.svnEnable":"Enable SVN for this project","tabs.files.help":"Markdown document wiki — browse the file tree, preview/edit notes, and explore wikilinks between .md files through graph, backlinks, outline, tags, and search panels.","tabs.analytics.help":"Execution and cost analytics. Token usage by CLI, status distribution, and daily cost trends in interactive charts.","files.root":"Root","files.empty":"Empty folder","files.loading":"Loading…","files.refresh":"Refresh","files.graph":"Wiki graph — show wikilink connections between .md files","files.showHidden":"Show hidden files","files.hideHidden":"Hide hidden files","files.copyPath":"Copy path","files.sendToTerminal":"Send to terminal","files.newTerminal":"New terminal","files.includeLinks":"Include linked docs","files.sendToTask":"Create task from file","files.sentToTerminal":"Sent to terminal","files.noActiveSession":"No open session","files.taskCreated":"Task created","files.taskCreateFailed":"Failed to create task","files.hide":"Hide from Documents","files.unhide":"Show in Documents","files.openInOS":"Open in default app","files.revealInExplorer":"Reveal in file manager","files.openFolder":"Open folder in file manager","files.pin":"Pin to top","files.unpin":"Unpin","files.pinned":"Pinned","files.tooLarge":"File too large to preview (max 2 MB).","files.binaryNotPreviewable":"Binary file — preview not available.","files.download":"Download","files.preview.empty":"Select a file to preview.","files.html.sandboxNotice":"Safe preview — scripts and external resources are blocked.","files.editor.edit":"Edit","files.editor.save":"Save","files.editor.done":"Done","files.editor.saved":"Saved","files.editor.saveFailed":"Save failed","files.editor.conflict":"File changed on disk — reopen it to see the new content.","files.editor.discardConfirm":"Discard unsaved changes?","files.editor.dirty":"Modified","files.editor.draftRestored":"Recovered unsaved edits","find.openFind":"Find","find.placeholder":"Find","find.replacePlaceholder":"Replace","find.case":"Match case","find.word":"Match whole word","find.regex":"Use regular expression","find.next":"Next match (Enter)","find.prev":"Previous match (Shift+Enter)","find.replace":"Replace","find.replaceAll":"Replace all","find.close":"Close (Esc)","find.toggleReplace":"Toggle replace","find.noMatches":"No results","annotate.start":"Start drawing","annotate.stop":"Stop drawing","annotate.select":"Select","annotate.pen":"Pen","annotate.highlighter":"Highlighter","annotate.eraser":"Eraser","annotate.color":"Color","annotate.undo":"Undo","annotate.redo":"Redo","annotate.clear":"Clear all","wiki.title":"Wiki","wiki.add":"New Entry","wiki.edit":"Edit","wiki.delete":"Delete","wiki.save":"Save","wiki.saving":"Saving...","wiki.cancel":"Cancel","wiki.empty":"No wiki entries yet","wiki.emptyHint":"Add notes, conventions, and lessons that the LLM should reference when running tasks.","wiki.viewList":"List","wiki.viewGraph":"Graph","wiki.viewHierarchical":"Hierarchy","wiki.viewNetwork":"Network","wiki.searchPlaceholder":"Search wiki...","wiki.backlinks":"Backlinks","wiki.addLink":"Add link to another entry","wiki.addLinkPlaceholder":"Search an entry to link…","wiki.connect.title":"How should these entries be connected?","wiki.connect.wikilink":"Reference (wikilink)","wiki.connect.wikilinkHint":"Inserts [[target title]] into the source body. Free-form mention, no semantic relation.","wiki.connect.edge":"Relation (typed edge)","wiki.connect.edgeHint":"Adds a typed relation (related/precedes/refines/...) you can label.","wiki.allTags":"All tags","wiki.countLabel":"{count} item(s)","wiki.deleteConfirm":"Delete this entry and all its connections?","wiki.noResults":"No results","wiki.noBody":"No content","wiki.connections":"Connections","wiki.outgoing":"Outgoing","wiki.incoming":"Incoming","wiki.autoLayout":"Auto Layout","wiki.form.newTitle":"New entry","wiki.form.editTitle":"Edit entry","wiki.form.title":"Title","wiki.form.titlePlaceholder":"Short, descriptive title","wiki.form.body":"Body (Markdown supported)","wiki.form.bodyPlaceholder":"Write the knowledge or convention you want the LLM to reference...","wiki.form.linkHint":"Type [[ or @ to link another wiki entry.","wiki.form.tags":"Tags","wiki.form.tagsPlaceholder":"Type tag and press Enter","wiki.form.pinned":"Pin to highlight","wiki.edge.editTitle":"Edit Connection","wiki.edge.relationType":"Relation","wiki.edge.label":"Label","wiki.edge.labelPlaceholder":'Optional note (e.g. "see section 3.2")',"wiki.edge.deleteConfirm":"Delete this connection?","wiki.edge.relations.related":"Related","wiki.edge.relations.precedes":"Precedes","wiki.edge.relations.example_of":"Example of","wiki.edge.relations.counter_example":"Counter-example","wiki.edge.relations.refines":"Refines","vault.title":"Documents","vault.empty":"No markdown files found","vault.noResults":"No matching files","vault.searchPlaceholder":"Search files...","vault.graph.addLink":"Add link from here","vault.graph.linkHint":"Click a target node to link · Esc to cancel","vault.graph.showLabels":"Show names","vault.graph.rightClickHint":"Right-click → add link","vault.newFile":"New File","vault.create":"Create","vault.save":"Save","vault.delete":"Delete","vault.unsaved":"unsaved","vault.confirmDelete":"Delete {path}?","vault.backlinks":"Backlinks","vault.filesCount":"files","vault.panel.fileExplorer":"Files","vault.panel.search":"Search","vault.panel.tags":"Tags","vault.panel.graph":"Graph","vault.panel.outline":"Outline","vault.panel.backlinks":"Backlinks","vault.panel.outgoing":"Outgoing Links","vault.panel.preview":"Preview","vault.outline.empty":"No headings in this note","vault.outgoing.empty":"No outgoing wikilinks","vault.backlinks.empty":"No backlinks","vault.tags.empty":"No tags in documents","vault.search.empty":"No matches","vault.search.prompt":"Search across .md notes","vault.activeFile.empty":"Select a file to preview or edit","vault.sidebar.collapse":"Collapse sidebar","vault.sidebar.expand":"Expand sidebar","vault.loadError":"Failed to load documents","vault.retry":"Retry","vault.allHidden":"All documents are hidden by .vaultignore — right-click a file in the explorer to show it","vault.ignoreHelp":".vaultignore guide","vaultInject.title":"Document Injection","vaultInject.modeNone":"Off","vaultInject.modeAuto":"Auto","vaultInject.modeAll":"Inject all","vaultInject.modeSelected":"Inject selected","vaultInject.autoHint":"Before each run, the LLM picks up to 10 relevant files from {count} file(s) using the task description as the query.","vaultInject.previewToggle":"Preview","vaultInject.previewChars":"{n} chars","vaultInject.previewTokens":"~{n} tokens","vaultInject.empty":"No .md or .html files in the project root.","vaultInject.injectedCount":"Will inject {count} file(s)","vaultInject.allCount":"Will inject all {count} file(s)","vaultInject.searchPlaceholder":"Filter by name...","vaultInject.loading":"Loading...","vaultInject.includeLinked":"Also pull in 1-hop linked files when I check one","vaultInject.linkedAdded":"+{n} linked","vaultInject.noResults":"No files match.","wiki.ingest":"Ingest","wiki.ingest.title":"Ingest Source Material","wiki.ingest.tabTask":"From Task","wiki.ingest.tabDiscussion":"From Discussion","wiki.ingest.tabText":"Paste Text","wiki.ingest.selectTask":"Select a completed task","wiki.ingest.selectDiscussion":"Select a completed discussion","wiki.ingest.noTasks":"No completed tasks found","wiki.ingest.noDiscussions":"No completed discussions found","wiki.ingest.textPlaceholder":"Paste any text — article, notes, chat transcript — to extract knowledge...","wiki.ingest.run":"Ingest","wiki.ingest.running":"Ingesting...","wiki.ingest.success":"Created {created}, updated {updated}, {edges} edge(s) added","wiki.ingest.parseFailed":"Could not parse the LLM response — nothing was changed.","wiki.ingest.modelEmpty":"The LLM returned no proposals — it judged the source had nothing new worth adding.","wiki.ingest.allSkipped":"All proposals were skipped — see breakdown below.","wiki.ingest.proposed":"Proposed: {c} create, {u} update, {e} edges","wiki.ingest.skipNote":"Skipped","wiki.ingest.skip.duplicate":"duplicate title (already exists)","wiki.ingest.skip.unique":"DB UNIQUE conflict on title","wiki.ingest.skip.empty":"empty title","wiki.ingest.skip.badId":"invalid update id","wiki.ingest.skip.badEdge":"edge endpoint not found","wiki.ingest.skip.selfEdge":"self-edge","wiki.ingest.skip.edgeUnique":"edge UNIQUE conflict","wiki.ingest.rawSnippet":"Show raw response snippet","wiki.ingest.toast.success":"Wiki updated from {source} — {created} created, {updated} updated, {edges} edges","wiki.ingest.toast.empty":"Wiki ingest from {source} — nothing new to add","wiki.ingest.toast.parseFailed":"Wiki ingest from {source} — could not parse LLM response","wiki.ingest.toast.failed":"Wiki auto-ingest failed","wiki.schemaSection":"Schema","wiki.schemaSectionHint":"Defines entry types and conventions used by Ingest. Edit to customize for this project.","wiki.schemaBannerTitle":"Wiki Schema","wiki.schemaBannerHint":"Edits here change how the LLM categorizes new entries on Ingest. Delete this entry to reset to defaults.","wiki.systemSection":"System","wiki.systemSectionHint":"Auto-maintained entries that drive Ingest behavior and quick navigation.","wiki.indexBannerTitle":"Wiki Index","wiki.indexBannerHint":"Auto-regenerated on every wiki change. Manual edits are overwritten — delete to remove (it will be recreated on the next change).","wiki.asset.uploading":"Uploading image…","wiki.asset.tooLarge":"Image too large (max 10MB)","wiki.diskDiff.button":"Disk diff","wiki.diskDiff.tooltip":"Compare exported wiki files against the database","wiki.diskDiff.title":"Wiki vs. .clitrigger/wiki/","wiki.diskDiff.intro":"Read-only — shows files on disk that differ from what the database would export. Edit the markdown files in Obsidian/etc. and these will surface here. Use Rebuild to overwrite disk with the current DB state.","wiki.diskDiff.running":"Comparing…","wiki.diskDiff.empty":"Disk and database are in sync.","wiki.diskDiff.refresh":"Re-check","wiki.diskDiff.close":"Close","wiki.diskDiff.section.modified":"Modified on disk ({n})","wiki.diskDiff.section.missing":"Missing on disk ({n})","wiki.diskDiff.section.untracked":"Untracked file on disk ({n})","wiki.diskDiff.rebuild":"Rebuild from DB","wiki.diskDiff.rebuildTooltip":"Overwrites all wiki/ files with the current database state. Disk-only edits will be lost.","wiki.diskDiff.rebuildConfirm":"Overwrite the wiki/ folder with the current database state? Any disk-only edits will be lost.","wiki.diskDiff.rebuildResult":"Rebuilt: {written} written, {removed} removed","wiki.lint":"Lint","wiki.lint.title":"Wiki Health Check","wiki.lint.running":"Checking...","wiki.lint.empty":"Wiki looks healthy — no issues found.","wiki.lint.close":"Close","wiki.lint.rerun":"Re-run","wiki.lint.mergeConfirm":'Merge "{absorb}" into "{keep}"? This combines bodies, unions tags, redirects edges and wikilinks, and deletes "{absorb}".',"wiki.lint.action.mergeKeep":'Keep "{keep}", merge "{absorb}"',"wiki.lint.action.delete":"Delete","wiki.lint.action.deleteTitle":'Delete "{title}"',"wiki.lint.action.link":"Link","wiki.lint.action.linkTo":"Link to…","wiki.sourceAutoLabel":"Auto","wiki.viewRaw":"View Raw Source","wiki.loading":"Loading...","wiki.close":"Close","wiki.subTab.wiki":"Wiki","wiki.subTab.sources":"Sources","wiki.subTab.activity":"Activity","wiki.activity.empty":"No activity yet","wiki.activity.emptyHint":"Ingest, lint, retrieve, and merge events show up here.","wiki.activity.refresh":"Refresh","wiki.activity.filter.all":"All","wiki.activity.filter.ingest":"Ingest","wiki.activity.filter.lint":"Lint","wiki.activity.filter.retrieve":"Retrieve","wiki.activity.filter.merge":"Merge","wiki.sources.empty":"Select a raw file from the sidebar to view its content.","wiki.sources.noFiles":"No raw files yet — run Ingest to create some.","wiki.rawFile.derivedTitle":"Derived Wiki Entries","wiki.rawFile.noDerived":"No wiki entries derived from this source","wiki.rawFile.openSiblings":"Show {n} entries from this source","wiki.rawFile.openExternal":"Open in default app","wiki.rawFile.revealInFolder":"Reveal in folder","wiki.rawFile.delete":"Delete raw file","wiki.rawFile.deleteConfirm":"Delete this raw source file? Wiki entries are kept.","wiki.rawFile.deleteConfirmDerived":"Delete this raw source file and unlink {n} derived wiki entr(y/ies)? The entries themselves are kept; only the source link is removed.","planner.title":"Planner","planner.add":"New Item","planner.empty":"No planner items yet","planner.emptyHint":"Add ideas, tasks, and plans to your planner.","planner.view.pages":"Pages","planner.view.all":"All items","planner.nav.calendar":"Calendar","planner.nav.list":"List","planner.block.tasklist":"Task list","planner.block.calendar":"Calendar","planner.block.addTask":"Add a task…","planner.pages.newTemplate":"New page — choose a template","planner.tpl.blank":"Blank","planner.tpl.blank.desc":"Start from an empty page","planner.tpl.meeting":"Meeting notes","planner.tpl.meeting.desc":"Date, attendees, agenda, action items","planner.tpl.project":"Project plan","planner.tpl.project.desc":"Overview, milestones, schedule","planner.tpl.weekly":"Weekly planner","planner.tpl.weekly.desc":"Weekly goals, tasks, calendar","planner.pages.new":"New Page","planner.pages.untitled":"Untitled","planner.pages.empty":"No pages yet","planner.pages.emptyHint":"Create a free-form page to write notes, docs, and checklists.","planner.pages.deleteConfirm":"Delete this page? This cannot be undone.","planner.pages.saving":"Saving…","planner.pages.saved":"Saved","planner.filterTag":"All Tags","planner.filterStatus":"All Statuses","planner.col.title":"Title","planner.col.tags":"Tags","planner.col.dueDate":"Due Date","planner.col.status":"Status","planner.col.actions":"","planner.edit":"Edit","planner.delete":"Delete","planner.deleteConfirm":"Delete this planner item?","planner.convertToTask":"Convert to Task","planner.convertToSchedule":"Convert to Routine","planner.convertToTerminal":"Send to Terminal","planner.movedToTodo":"Moved to Tasks","planner.movedToSchedule":"Moved to Routines","planner.movedToSession":"Moved to Terminal","planner.fromDiscussion":"From Discussion","planner.noDueDate":"—","planner.export":"Export","planner.exportTooltip":"Export planner items to a Markdown file","planner.exportError":"Export failed","planner.import":"Import","planner.importTooltip":"Import planner items from a Markdown file","planner.importSuccess":"Imported {items} item(s) and {tags} tag(s).","planner.importError":"Import failed","planner.importInvalidMarkdown":"File is empty or not valid Markdown","planner.importNoImages":"Note: images are not included in exported files.","planner.dropHint":"Drop a Markdown file to import","planner.dropHintSub":".md or .markdown","planner.dropInvalidFile":"Only Markdown files (.md / .markdown) can be imported","plannerForm.titlePlaceholder":"Planner item title...","plannerForm.descPlaceholder":"Description or details...","plannerForm.tags":"Tags","plannerForm.tagsPlaceholder":"Type and press Enter","plannerForm.dueDate":"Due Date","plannerForm.priority":"Priority","plannerForm.priorityLow":"Low","plannerForm.priorityNormal":"Normal","plannerForm.priorityHigh":"High","plannerForm.priorityCritical":"Critical","plannerForm.status":"Status","plannerForm.addImage":"Add Image","plannerForm.pasteHint":"Ctrl+V to paste image","plannerForm.images":"Images","plannerForm.cancel":"Cancel","plannerForm.save":"Save","plannerStatus.pending":"Pending","plannerStatus.in_progress":"In Progress","plannerStatus.done":"Done","plannerStatus.moved":"Moved","plannerConvert.toTask":"Convert to Task","plannerConvert.toSchedule":"Convert to Routine","plannerConvert.toTerminal":"Send to Terminal","plannerConvert.useWorktree":"Use git worktree","plannerConvert.cliTool":"CLI Tool","plannerConvert.maxTurns":"Max Turns","plannerConvert.scheduleType":"Routine Type","plannerConvert.recurring":"Recurring","plannerConvert.once":"One-time","plannerConvert.cronExpression":"Cron Expression","plannerConvert.runAt":"Run At","plannerConvert.cancel":"Cancel","plannerConvert.convert":"Convert","plannerTag.selectOrCreate":"Select or create","plannerTag.delete":"Delete","plannerTag.deleteConfirm":"Remove this tag from all items?","plannerTag.color":"Color","plannerTag.rename":"Rename","plannerTag.color.default":"Default","plannerTag.color.gray":"Gray","plannerTag.color.brown":"Brown","plannerTag.color.orange":"Orange","plannerTag.color.yellow":"Yellow","plannerTag.color.green":"Green","plannerTag.color.blue":"Blue","plannerTag.color.purple":"Purple","plannerTag.color.pink":"Pink","plannerTag.color.red":"Red","session.new":"New Terminal","session.windowState.floating":"Open","session.windowState.minimized":"Minimized","session.windowState.popped":"Separate window","session.recallToMain":"Bring to main window","session.restoreWindow":"Restore window","session.focusWindow":"Go to window","session.openWindow":"Open terminal","session.dock.poppedHint":"Separate window — click to bring it to front","session.title":"Terminal Title","session.description":"Initial Prompt (Optional)","session.start":"Start","session.stop":"Stop","session.resume":"Resume","session.resumeHint":"Continue the last Claude conversation in this worktree","session.delete":"Delete","session.edit":"Edit","session.editDisabledRunning":"Cannot edit while running","session.save":"Save","session.saving":"saving…","session.empty":"No terminals yet","session.emptyHint":"Start an interactive AI conversation.","session.create":"Create Terminal","session.cliTool":"CLI Tool","session.cliNotInstalled":" (not installed)","session.worktree":"Use worktree (isolated branch)","session.cleanup":"Clean up worktree","session.startInWindow":"Start","session.starting":"starting…","session.starting.typeAhead":"type-ahead is captured and replayed once ready","session.stopping":"stopping…","session.startFailed":"Failed to start","session.confirmStop":"End this terminal? The running task will be terminated.","session.minimize":"Minimize","session.fontDecrease":"Decrease font size","session.fontIncrease":"Increase font size","session.refresh":"Refresh rendering","session.refresh.hint":"Rebuild the terminal view (PTY stays running)","session.initialPrompt.ready":"Initial prompt ready to send","session.initialPrompt.preview":"Preview","session.initialPrompt.hidePreview":"Hide","session.initialPrompt.send":"Send","session.initialPrompt.skip":"Skip","session.initialPrompt.loading":"loading…","session.initialPrompt.blocked":"Press Send or Skip before typing — keystrokes are ignored until then.","group.closeTab":"Close tab","group.newTab":"New shell tab","analytics.title":"Execution Analytics","analytics.loading":"Loading analytics...","analytics.noData":"No data available","analytics.totalTasks":"Total Tasks","analytics.successRate":"Success Rate","analytics.totalCost":"Total Cost","analytics.totalTokens":"Total Tokens","analytics.avgPerTask":"Avg / Task","analytics.byStatus":"By Status","analytics.byCliTool":"By CLI Tool","analytics.dailyActivity":"Daily Activity","analytics.dailyCost":"Daily Cost","analytics.costBreakdown":"Cost Summary","analytics.tasks":"tasks","analytics.period.7d":"7D","analytics.period.30d":"30D","analytics.period.90d":"90D","analytics.period.all":"All","discussions.title":"Discussions","discussions.add":"New Discussion","discussions.empty":"No discussions yet","discussions.emptyHint":"Create a discussion to have agents collaborate on a feature.","discussions.round":"Round","discussions.maxRounds":"Max Rounds","discussions.agents":"Agents","discussions.speaking":"Speaking...","discussions.inject":"Send Message","discussions.skipTurn":"Skip Turn","discussions.implement":"Start Implementation","discussions.implementHint":"Select an agent to implement the discussed feature.","discussions.selectAgent":"Select Implementer","discussions.toPlanner":"Send to Planner","discussions.extractTitle":"Extract Action Items","discussions.extractHint":"AI proposed these planner items from the discussion. Edit, deselect, or adjust priority before saving.","discussions.extractLoading":"Extracting action items from the discussion…","discussions.extractLoadingHint":"This may take up to two minutes. The dialog will stay open until extraction finishes.","discussions.extractEmpty":"No actionable items found. Try a different discussion or add more agreement.","discussions.extractConfirm":"Save to Planner","discussions.extractSaving":"Saving…","discussions.priorityLow":"Low","discussions.priorityMedium":"Medium","discussions.priorityHigh":"High","discussions.priorityUrgent":"Urgent","discussions.notFound":"Discussion not found","discussions.back":"Back to Discussions","discussions.userMessage":"Your message...","discussions.implementation":"Implementation","discussions.resume":"Resume","discussions.retry":"Retry","discussions.failureTitle":"Discussion Failed","discussions.noErrorLogs":"No error details available","discussions.pause":"Pause","discussions.waiting":"Waiting...","discussions.roundExplain":"One round = each agent speaks once.","discussions.autoImplement":"Auto-implement after discussion","discussions.autoImplementHint":"Automatically start implementation when all rounds complete.","discussions.collapse":"Collapse","discussions.expand":"Expand","discussions.collapseAll":"Collapse All","discussions.expandAll":"Expand All","status.skipped":"Skipped","status.paused":"Paused","agents.title":"Agent Personas","agents.add":"Add Agent","agents.name":"Name","agents.role":"Role","agents.systemPrompt":"System Prompt","agents.cliTool":"CLI Tool","agents.color":"Color","agents.empty":"No agents yet. Create agent personas to start a discussion.","agents.manage":"Manage Agents","agents.presets":"Preset Templates","agents.roles.architect":"Architect","agents.roles.developer":"Developer","agents.roles.reviewer":"Reviewer","agents.roles.pm":"Product Manager","agents.roles.tester":"Tester","agents.roles.custom":"Custom","agents.canImplement":"Implement during discussion","agents.canImplementHelp":"When it is this agent's turn, they can write code and commit to the discussion branch — not just talk. Useful for developer-style agents that should demonstrate ideas mid-discussion.","agents.canImplementBadge":"Implementer","git.ahead":"ahead","git.behind":"behind","git.staged":"Staged","git.unstaged":"Unstaged","git.noChanges":"Working tree clean","git.refresh":"Refresh","git.files":"files","git.commitHistory":"Commit History","git.branches":"Branches","git.remotes":"Remotes","git.tags":"Tags","git.stashes":"Stashes","git.noCommits":"No commits yet","git.loadMore":"Loading more...","git.author":"Author","git.hash":"Hash","git.graph":"Graph","git.description":"Description","git.date":"Date","git.commit":"Commit","git.pull":"Pull","git.push":"Push","git.pushDialog.targetRemote":"Push to","git.pushDialog.branchesHeader":"Branches to push","git.pushDialog.colPush":"Push?","git.pushDialog.colLocal":"Local branch","git.pushDialog.colRemote":"Remote branch","git.pushDialog.colTracking":"Track?","git.pushDialog.selectAll":"Select all","git.pushDialog.allTags":"Push all tags","git.pushDialog.force":"Force push","git.pushDialog.forceHint":"Uses --force-with-lease (rejects if remote moved since your last fetch).","git.pushDialog.submit":"Push","git.pushDialog.cancel":"Cancel","git.pushDialog.pushing":"Pushing…","git.pushDialog.loading":"Loading…","git.pushDialog.errorRequireBranch":"Select at least one branch to push.","git.pushDialog.noLocalBranches":"No local branches.","git.pushDialog.newBranch":"new","git.pushDialog.customRemote":"Enter name…","git.fetch":"Fetch","git.branch":"Branch","git.merge":"Merge","git.stash":"Stash","git.discard":"Discard","git.tag":"Tag","git.untracked":"Untracked","git.fileStatus":"File Status","git.stageAll":"Stage All","git.unstageAll":"Unstage All","git.stage":"Stage","git.unstage":"Unstage","git.commitMessage":"Commit message...","git.branchName":"Branch name...","git.tagName":"Tag name...","git.tagMessage":"Tag message (optional)...","git.stashMessage":"Stash message (optional)...","git.selectBranch":"Select branch...","git.discardAll":"Discard All","git.confirmDiscard":"Discard all changes? This cannot be undone.","git.confirmDiscardFile":"Discard changes to this file?","git.newBranch":"New Branch","git.deleteBranch":"Delete Branch","git.stashPop":"Pop","git.noStashes":"No stashes","git.actions":"Actions","git.close":"Close","git.create":"Create","git.delete":"Delete","git.modified":"Modified","git.added":"Added","git.deleted":"Deleted","git.renamed":"Renamed","git.copied":"Copied","git.checkout":"Checkout","git.mergeInto":"Merge into current branch","git.rebaseOnto":"Rebase current onto","git.renameBranch":"Rename branch","git.confirmDelete":"Delete branch {name}?","git.newBranchName":"New branch name...","git.rename":"Rename","git.checkoutRemote":"Checkout as local branch","git.commitDetail":"Commit Detail","git.changedFiles":"Changed Files","git.selectFileToViewDiff":"Select a file to view diff","git.noFilesChanged":"No files changed","git.loadingFiles":"Loading files...","git.loadingDiff":"Loading diff...","git.worktrees":"Worktrees","git.cleanupWorktree":"Cleanup","git.confirmCleanupWorktree":"Remove worktree and branch {name}?","git.deleteWorktreeAndBranch":"Delete branch + worktree","git.confirmDeleteWorktreeAndBranch":"Delete branch {name} and its worktree?","git.confirmForceDelete":"Branch {name} is not fully merged. Force delete anyway? Unmerged commits will be lost.","git.workspace":"WORKSPACE","git.viewFileStatus":"File Status","git.viewHistory":"History","git.search":"Search","git.searchPlaceholder":"Search","git.stagedFiles":"Staged files","git.unstagedFiles":"Unstaged files","git.untrackedFiles":"Untracked files","git.unstageAllShort":"Unstage all","git.unstageSelectedShort":"Unstage selected","git.stageAllShort":"Stage all","git.stageSelectedShort":"Stage selected","git.commitOptions":"Commit options","git.pushImmediately":"Push to {remote} after commit","git.amendLastCommit":"Amend last commit","git.commitButton":"Commit","git.selectFileForDiff":"Select a file to view the diff","git.binaryFile":"Binary file (no diff preview)","git.untrackedNewFile":"(new file)","git.workingTreeClean":"Working tree is clean — nothing to commit","lang.toggle":"KO","theme.light":"Light","theme.dark":"Dark","notification.taskCompleted":"Task Completed","notification.taskFailed":"Task Failed","notification.discussionCompleted":"Discussion Completed","notification.discussionFailed":"Discussion Failed","notification.toggle":"Toggle notifications","notification.blocked":"Notifications blocked by browser"},ko:{"login.title":"CLITrigger","login.subtitle":"인증이 필요합니다","login.password":"비밀번호 입력","login.rememberMe":"로그인 상태 유지","login.submit":"로그인","login.loading":"인증 중...","login.error":"접근이 거부되었습니다. 다시 시도해주세요.","login.footer":"보안 접속","login.disclaimer":'This software is provided "as is" without any warranties. Users are solely responsible for all actions taken using this tool, including any costs incurred from AI CLI usage, data loss, or unintended code changes. The developers assume no liability for any direct, indirect, or consequential damages arising from use.',"setup.title":"CLITrigger에 오신 것을 환영합니다","setup.subtitle":"이 인스턴스를 보호할 비밀번호를 설정하세요","setup.password":"새 비밀번호","setup.confirm":"비밀번호 확인","setup.submit":"비밀번호 만들기","setup.loading":"저장 중…","setup.tooShort":"비밀번호는 8자 이상이어야 합니다.","setup.mismatch":"비밀번호가 일치하지 않습니다.","setup.tunnelPaused":"셋업이 끝날 때까지 외부 공유(Cloudflare 터널)는 자동 시작되지 않습니다.","setup.error":"비밀번호 저장에 실패했습니다.","sidebar.home":"홈","sidebar.review":"리뷰 큐","sidebar.agenda":"내 일정","agenda.title":"내 일정","agenda.subtitle":"개인 메모·일정과 전 프로젝트 루틴을 한곳에서","agenda.today":"오늘","agenda.refresh":"새로고침","agenda.refreshHelp":"현재 보이는 기간을 다시 불러옵니다 — 내 메모, 프로젝트 루틴/플래너, 할당된 Jira 이슈. 달/주/일 이동이나 뷰 전환 시에도 자동으로 갱신되며, 가만히 있을 때는 자동 폴링하지 않습니다.","agenda.view.month":"월","agenda.view.week":"주","agenda.view.day":"일","agenda.view.table":"표","agenda.addItem":"항목 추가","agenda.expand":"크게 보기","agenda.collapse":"작게 보기","agenda.tags.all":"전체","agenda.tags.placeholder":"태그 추가…","agenda.resizePanel":"드래그하여 크기 조절","agenda.resizeCalendar":"드래그하여 달력 크기 조절","agenda.untitled":"(제목 없음)","agenda.source.personal":"메모","agenda.source.schedule":"루틴","agenda.source.planner":"플래너","agenda.source.jira":"Jira","agenda.jira.settings":"Jira 연결","agenda.jira.subtitle":"내게 할당된 Jira 작업을 이 캘린더에서 함께 봅니다.","agenda.jira.enable":"내게 할당된 Jira 이슈 표시","agenda.jira.baseUrlLabel":"Jira 사이트 주소","agenda.jira.baseUrlHint":"Jira를 열 때 쓰는 주소예요. 브라우저 주소창 맨 앞부분. 예: https://회사이름.atlassian.net","agenda.jira.emailLabel":"로그인 이메일","agenda.jira.emailHint":"Jira(Atlassian)에 로그인할 때 쓰는 이메일이에요.","agenda.jira.tokenLabel":"API 토큰","agenda.jira.tokenPlaceholder":"발급받은 API 토큰을 붙여넣으세요","agenda.jira.tokenLink":"API 토큰 발급받기","agenda.jira.tokenStep1":"1. 위 링크를 열고 로그인하세요.","agenda.jira.tokenStep2":'2. "API 토큰 만들기"를 누르고 아무 이름이나 지어주세요.',"agenda.jira.tokenStep3":"3. 만들어진 토큰을 복사해 위 칸에 붙여넣으세요. (비밀번호가 아니라 별도 토큰이에요.)","agenda.jira.criteria":"가져오기 기준","agenda.jira.criteriaHint":"캘린더에 표시하고 가져올 수 있는 이슈의 조건을 정합니다.","agenda.jira.assigneeMe":"나에게 할당된 이슈만","agenda.jira.includeDone":"완료된 이슈도 포함","agenda.jira.projects":"프로젝트","agenda.jira.projectsHint":"이 프로젝트 키만 가져옵니다(쉼표 또는 공백으로 구분). 비우면 전체.","agenda.jira.statuses":"가져올 상태","agenda.jira.statusesHint":'체크한 상태의 이슈만 가져옵니다. 모두 체크 해제하면 위 "완료된 이슈도 포함" 설정을 따릅니다.',"agenda.jira.statusesLoad":"상태 불러오기","agenda.jira.statusesLoading":"불러오는 중…","agenda.jira.statusesNeedConn":"상태를 불러오려면 먼저 연결을 저장하고 테스트하세요.","agenda.jira.statusesSearch":"상태 검색…","agenda.jira.statusesEmpty":'불러온 상태가 없습니다. "상태 불러오기"를 누르세요.',"agenda.jira.dismiss":"내 일정에서 숨기기","agenda.jira.dismissedTitle":"숨긴 JIRA 이슈","agenda.jira.restore":"복원","agenda.jira.extraJql":"고급 (JQL)","agenda.jira.extraJqlHint":"위 조건에 AND로 합쳐지는 추가 JQL. 예: labels = urgent AND priority >= High","agenda.jira.test":"연결 테스트","agenda.jira.tokenSaved":"토큰 저장됨 (비우면 유지)","agenda.jira.hint":'내게 할당된 열린 이슈를 가져옵니다. 기한 있는 것은 캘린더에, 나머지는 "Jira (마감일 없음)" 목록에 표시됩니다. 인증은 이메일 + API 토큰.',"agenda.jira.import":"내 일정에 추가","agenda.jira.noDue":"Jira (마감일 없음)","agenda.jira.error":"Jira 오류","agenda.moveToPlanner":"플래너로 이동","agenda.importToPlanner":"플래너에 추가","agenda.pickProject":"프로젝트 선택","agenda.noProjects":"프로젝트 없음","agenda.table.name":"제목","agenda.table.date":"날짜","agenda.table.kind":"종류","agenda.table.status":"상태","agenda.kind.personal":"메모","agenda.kind.schedule":"루틴","agenda.kind.planner":"플래너","agenda.kind.jira":"Jira","agenda.status.done":"완료","agenda.status.pending":"대기","agenda.add":"추가","agenda.memo":"메모","agenda.backlog":"날짜 없음","agenda.backlogEmpty":"날짜 없는 메모가 없습니다","agenda.dayEmpty":"이 날짜에 일정이 없습니다","agenda.fromSchedule":"프로젝트 루틴","agenda.fromPlanner":"프로젝트 플래너","agenda.toggleDone":"완료 토글","agenda.delete":"삭제","agenda.confirmDelete":"이 항목을 삭제할까요?","agenda.addTitle":"새 항목","agenda.editTitle":"항목 편집","agenda.titlePlaceholder":"제목","agenda.descPlaceholder":"메모 (선택)","agenda.dateHint":"날짜를 비우면 날짜 없는 메모로 저장됩니다. 시간을 지정하면 시간 일정이 됩니다.","agenda.cancel":"취소","agenda.save":"저장","agenda.cleanup":"메모 정리","agenda.cleanup.title":"기간으로 메모 삭제","agenda.cleanup.subtitle":"선택한 기간의 개인 메모를 한 번에 삭제합니다. 되돌릴 수 없습니다.","agenda.cleanup.from":"시작","agenda.cleanup.to":"종료","agenda.cleanup.doneOnly":"완료된 메모만","agenda.cleanup.includeBacklog":"날짜 없는 백로그 메모도 삭제","agenda.cleanup.previewLabel":"삭제 대상","agenda.cleanup.unit":"개","agenda.cleanup.none":"조건에 해당하는 메모가 없습니다","agenda.cleanup.confirm":"삭제","sidebar.workspaces":"워크스페이스","sidebar.favorites":"즐겨찾기","sidebar.collapse":"사이드바 접기","sidebar.expand":"사이드바 펼치기","favorites.add":"즐겨찾기 추가","favorites.edit":"즐겨찾기 편집","favorites.delete":"삭제","favorites.deleteConfirm":"이 즐겨찾기를 삭제할까요?","favorites.launchFailed":"실행 실패","favorites.empty":"등록된 즐겨찾기가 없습니다.","favorites.form.title.create":"새 즐겨찾기","favorites.form.title.edit":"즐겨찾기 편집","favorites.form.name":"이름","favorites.form.type":"종류","favorites.form.target":"대상","favorites.form.browse":"찾아보기…","favorites.form.targetHint.executable":".exe / .bat / .sh 절대 경로","favorites.form.targetHint.command":"셸 명령어 (그대로 실행됨)","favorites.form.targetHint.url":"http:// 또는 https:// URL","favorites.form.args":"인자 (공백으로 구분)","favorites.form.cwd":"작업 디렉토리 (선택)","favorites.form.create":"생성","favorites.form.save":"저장","favorites.form.cancel":"취소","favorites.types.executable":"실행 파일","favorites.types.command":"명령어","favorites.types.url":"URL","favorites.security.notice":"즐겨찾기는 서버 계정으로 실행됩니다. 터널 공유가 켜져 있다면 비밀번호를 아는 사람이 누구나 실행할 수 있습니다.","tunnel.title":"터널 설정","tunnel.description":"Cloudflare 터널 설정. 공유 도메인(*.trycloudflare.com / *.cfargotunnel.com)에서 뜨는 브라우저 위험 경고를 피하려면 본인 도메인을 지정하세요.","tunnel.name.label":"Named tunnel 이름","tunnel.name.placeholder":"my-app","tunnel.name.hint":"비워두면 무작위 Quick Tunnel(https://*.trycloudflare.com)을 사용합니다.","tunnel.hostname.label":"커스텀 도메인 (선택)","tunnel.hostname.placeholder":"app.your-domain.com","tunnel.hostname.hint":'미리 "cloudflared tunnel route dns" 명령으로 이 도메인을 터널에 연결해 두어야 합니다. 비우면 *.cfargotunnel.com으로 폴백.',"tunnel.hostname.invalid":"유효한 공인 도메인을 입력하세요 (예: app.your-domain.com).","tunnel.hostname.needsName":"커스텀 도메인을 사용하려면 먼저 named tunnel 이름을 지정하세요.","tunnel.guide.toggle":"커스텀 도메인 셋업 방법","tunnel.guide.heading":"cloudflared CLI로 1회 셋업:","tunnel.guide.step4":"위 입력란에 터널 이름과 도메인을 적고 저장하세요.","tunnel.guide.note":"도메인은 Cloudflare 계정에 등록되어 있어야 합니다 (무료 플랜으로 충분).","tunnel.status.stopped":"중지됨","tunnel.status.starting":"시작 중…","tunnel.status.running":"실행 중","tunnel.status.error":"오류","tunnel.save":"저장","tunnel.saving":"저장 중…","tunnel.saved":"터널 설정을 저장했습니다. 터널을 재시작하면 적용됩니다.","tunnel.saveFailed":"터널 설정 저장에 실패했습니다.","tunnel.close":"닫기","tunnel.restart":"터널 재시작","tunnel.restarting":"재시작 중…","tunnel.restarted":"터널을 재시작했습니다.","tunnel.restartFailed":"터널 재시작에 실패했습니다.","tunnel.start":"터널 시작","tunnel.starting":"시작 중…","tunnel.urlCopied":"외부 URL을 클립보드에 복사했습니다.","settings.title":"설정","settings.tabs.account":"계정","settings.tabs.session":"터미널","settings.tabs.tunnel":"터널","sessionSettings.title":"터미널 환경설정","sessionSettings.description":"새 터미널의 기본 동작과 재사용할 색상 태그를 관리합니다.","sessionSettings.saved":"저장되었습니다.","sessionSettings.worktree.title":"Worktree 기본값","sessionSettings.worktree.label":"새 터미널에 git worktree 사용","sessionSettings.worktree.hint":"켜두면 새 터미널이 .worktrees/ 안의 별도 브랜치에서 생성됩니다. git 저장소에만 적용됩니다.","sessionSettings.fontSize.title":"기본 폰트 크기","sessionSettings.fontSize.label":"새 터미널의 폰트 크기 (px)","sessionSettings.fontSize.hint":"아직 줌을 만지지 않은 터미널은 이 값을 즉시 따라갑니다. 터미널별 줌(Ctrl+휠, A−/A+)이 적용된 터미널은 영향받지 않습니다.","sessionSettings.tags.title":"태그","sessionSettings.tags.description":"이름과 색을 정해두면 터미널 생성 폼에서 골라 붙일 수 있습니다.","sessionSettings.tags.empty":"아직 태그가 없습니다 — 위에서 하나 추가하세요.","sessionSettings.tags.namePlaceholder":"태그 이름 (예: 탐색, 배포)","sessionSettings.tags.color":"색","sessionSettings.tags.add":"추가","sessionSettings.tags.edit":"수정","sessionSettings.tags.delete":"삭제","sessionSettings.tags.save":"저장","sessionSettings.tags.cancel":"취소","sessionSettings.tags.deleteConfirm":'"{name}" 태그를 삭제할까요? 이 태그를 쓰던 터미널은 태그가 비워집니다.',"session.tag.none":"태그 없음","account.title":"비밀번호 변경","account.description":"현재 비밀번호를 입력한 후 새 비밀번호를 선택하세요.","account.oldPassword":"현재 비밀번호","account.newPassword":"새 비밀번호","account.confirm":"새 비밀번호 확인","account.tooShort":"비밀번호는 8자 이상이어야 합니다.","account.mismatch":"비밀번호가 일치하지 않습니다.","account.save":"저장","account.saving":"저장 중…","account.saved":"비밀번호가 변경되었습니다. 다른 세션은 모두 로그아웃됩니다.","account.saveFailed":"비밀번호 변경에 실패했습니다.","account.close":"닫기","review.title":"리뷰 큐","review.subtitle":"모든 프로젝트의 밤샘 결과를 한 화면에서 정리","review.refresh":"새로고침","review.empty":"이 기간에 리뷰할 항목이 없습니다.","review.viewDetails":"자세히","review.approve":"승인 · 머지","review.requestChanges":"수정 요청","review.discard":"폐기","review.cancel":"취소","review.send":"전송","review.continuePlaceholder":"무엇을 고치거나 바꿔야 하는지 설명…","review.discardConfirm":"이 todo를 폐기하고 워크트리를 정리할까요?","review.mergeFailed":"머지 실패","review.continueFailed":"이어가기 실패","review.discardFailed":"폐기 실패","review.closeDetails":"닫기","review.justNow":"방금","review.minAgo":"분 전","review.hourAgo":"시간 전","review.dayAgo":"일 전","review.files":"파일","review.lines":"줄","review.rounds":"라운드","review.window.12h":"12시간","review.window.24h":"24시간","review.window.7d":"7일","review.filter.all":"전체","review.filter.risky":"위험","review.filter.quickWins":"Quick wins","review.filter.failed":"실패","review.risk.low":"낮은 위험","review.risk.medium":"중간 위험","review.risk.high":"높은 위험","review.tokens.total":"총 토큰","review.tokens.todos":"Todo 수","review.tokens.byCli":"CLI별","review.diff.empty":"베이스 브랜치 대비 변경 사항이 없습니다.","review.diff.noBranch":"브랜치 없이 메인 브랜치에서 실행된 todo라 diff를 표시할 수 없습니다.","review.diff.branchMissing":"브랜치가 삭제되어 diff를 표시할 수 없습니다.","review.diff.baseBranchMissing":"베이스 브랜치를 repo에서 찾을 수 없어 diff를 표시할 수 없습니다. 프로젝트 default_branch 설정을 확인하세요.","review.diff.notFound":"Todo를 찾을 수 없습니다.","projects.title":"전체 프로젝트","projects.subtitle":"프로젝트 콘솔","projects.new":"새 프로젝트","projects.logout":"로그아웃","projects.loading":"프로젝트 로딩 중...","projects.empty":"프로젝트가 없습니다","projects.emptyHint":"첫 번째 프로젝트를 만들어보세요.","projects.tasks":"작업","projects.active":"실행 중","projects.done":"완료","projects.search":"프로젝트 검색...","projects.delete":"프로젝트 삭제","projects.deleteConfirm":"이 프로젝트를 삭제하시겠습니까?","projects.pathMissing":"경로 없음","projects.pathMissingConfirm":"이 프로젝트의 로컬 폴더가 존재하지 않습니다. 삭제하시겠습니까?","projects.noGit":"Git 없음","detail.back":"프로젝트","detail.loading":"로딩 중...","detail.notFound":"프로젝트를 찾을 수 없습니다","detail.backToProjects":"프로젝트 목록으로","detail.live":"연결됨","header.branch":"브랜치","header.editName":"클릭하여 프로젝트 이름 변경","header.openFolder":"폴더 열기","header.workers":"워커","header.model":"모델","header.settings":"설정","header.runAll":"전체 실행","header.stopAll":"전체 중지","header.config":"프로젝트 설정","header.execConfig":"자동화 설정","header.execConfigHint":"자동 작업·토론·루틴 실행에 적용됩니다.","header.maxWorkers":"최대 워커 수","settings.defaultMaxTurns":"기본 턴 제한","settings.defaultMaxTurnsHint":"작업별 기본 턴 제한. 개별 작업에서 재설정 가능.","header.cliTool":"CLI 도구","header.cliFlags":"CLI 플래그","header.cancel":"취소","header.save":"저장","header.saving":"저장 중...","header.noGit":"Git 없음","header.noGitHint":'이 프로젝트는 Git 저장소가 아닙니다. 작업은 워크트리 격리 없이 직접 실행됩니다. 프로젝트 경로에서 "git init" 실행 후 재확인하세요.',"header.recheckGit":"Git 상태 재확인","header.fallbackChainTitle":"CLI 폴백 체인","header.fallbackChainHint":"CLI 도구의 컨텍스트가 소진되면 체인의 다음 도구로 자동 전환합니다.","header.sandboxTitle":"샌드박스 모드","header.sandboxBadgeStrict":"샌드박스: 엄격","header.sandboxBadgePermissive":"샌드박스: 허용","header.sandboxStrict":"엄격 (권장)","header.sandboxStrictDesc":"CLI 도구가 워크트리 디렉토리 내 파일만 접근할 수 있습니다.","header.sandboxPermissive":"허용","header.sandboxPermissiveDesc":"CLI 도구가 시스템의 모든 파일에 접근할 수 있습니다.","header.sandboxWarning":"경고: 허용 모드에서는 CLI 도구가 워크트리 밖 파일에도 접근할 수 있습니다. 주의해서 사용하세요.","header.worktreeTitle":"워크트리 격리","header.worktreeEnabled":"워크트리 (권장)","header.worktreeEnabledDesc":"각 작업이 독립 브랜치에서 실행됩니다. 병렬 작업에 안전합니다.","header.worktreeDisabled":"직접 실행 (메인 브랜치)","header.worktreeDisabledDesc":"메인 브랜치에서 직접 실행합니다. 최대 워커 1개로 제한됩니다.","header.worktreeWarning":"경고: 메인 브랜치를 직접 수정합니다. 동시 실행이 비활성화됩니다.","header.npmAutoInstallLabel":"워크트리 생성 시 `npm install` 자동 실행","header.npmAutoInstallHint":"npm 프로젝트에서 에이전트가 워크트리 안에서 test/build를 바로 돌릴 수 있게 합니다. pnpm/yarn/bun이나 npm이 아닌 프로젝트에서는 꺼두세요.","header.noWorktreeBadge":"워크트리 없음","header.debugBadge":"디버그 로그","header.showTokenUsageTitle":"토큰 사용량 표시","header.showTokenUsageDesc":"작업 완료 후 토큰 사용량(입력/출력)을 표시합니다.","header.showTokenUsageEnable":"토큰 사용량 표시","header.debugLoggingTitle":"디버그 로깅","header.debugLoggingDesc":"각 태스크 실행 시 CLI 입출력 전체를 .debug-logs/ 파일로 저장합니다.","header.debugLoggingEnable":"디버그 로그 파일 활성화","header.gstackTitle":"gstack 스킬","header.gstackEnabled":"gstack 스킬 주입 활성화","header.gstackCredit":"gstack 기반 (MIT 라이선스, Garry Tan)","header.usageLimit":"사용량","header.cliNotInstalled":"{tool}이(가) 설치되지 않았습니다","header.cliInstalled":"설치됨","header.cliNotFound":"미설치","header.cliInstallHint.claude":"npm install -g @anthropic-ai/claude-code","header.cliInstallHint.antigravity":"curl -fsSL https://antigravity.google/cli/install.sh | bash","header.cliInstallHint.codex":"npm install -g @openai/codex","header.cliRefresh":"재확인","header.gstackClaudeOnly":"gstack 스킬은 Claude CLI에서만 사용 가능합니다.","header.jiraTitle":"Jira 연동","header.jiraBaseUrl":"Jira URL","header.jiraBaseUrlPlaceholder":"https://yoursite.atlassian.net","header.jiraEmail":"이메일","header.jiraEmailPlaceholder":"your@email.com","header.jiraApiToken":"API 토큰","header.jiraApiTokenPlaceholder":"Atlassian API 토큰","header.jiraProjectKey":"프로젝트 키","header.jiraProjectKeyPlaceholder":"예: PROJ","header.jiraTestConnection":"연결 테스트","header.jiraTesting":"테스트 중...","header.jiraConnected":"연결 성공","header.jiraFailed":"연결 실패","header.jiraTokenHint":"id.atlassian.com > 보안 > API 토큰에서 생성","form.newProject":"새 프로젝트","form.projectName":"프로젝트 이름","form.folderPath":"폴더 경로","form.cancel":"취소","form.create":"생성","form.creating":"생성 중...","form.createError":"프로젝트 생성 실패","browse.title":"폴더 찾아보기","browse.select":"선택","browse.loading":"불러오는 중...","browse.error":"디렉토리를 불러올 수 없습니다","browse.empty":"폴더가 없습니다","todos.title":"작업 목록","todos.add":"작업 추가","todos.empty":"작업이 없습니다","todos.emptyHint":"작업을 추가해보세요.","todos.filterAll":"전체","todos.filterActive":"작업중","todos.filterCompleted":"완료","todos.filterCancelled":"취소","todos.filterEmpty":"해당 상태의 작업이 없습니다.","todos.stackModeOn":"스택 모드 켜짐 — 다시 누르면 해제","todos.stackModeOff":"스택 모드 켜기 (iOS 알림 스타일)","todos.collapseStack":"스택으로 접기","todos.expandStack":"클릭하면 펼쳐집니다","todos.merge":"병합","todo.description":"설명","todo.noDescription":"설명이 없습니다.","todo.attachedImages":"첨부 이미지","todo.branch":"브랜치","todo.path":"경로","todo.worktree":"워크트리","todo.result":"실행 결과","todo.mergeFailed":"병합 실패","todo.diffError":"Diff 오류","todo.diffOutput":"변경사항","todo.files":"파일","todo.systemLog":"활동 로그","todo.start":"시작","todo.startHeadless":"Headless","todo.startHeadlessDesc":"자율 실행. 모든 권한 자동 승인.","todo.startInteractive":"Interactive","todo.startInteractiveDesc":"stdin을 열어두고 실행 중 메시지 전송 가능.","todo.startVerbose":"Verbose","todo.startVerboseDesc":"자동 승인 + 모든 로그 실시간 출력.","todo.sendPlaceholder":"메시지 입력...","todo.startWithDependency":"선행 작업 먼저 시작","todo.stop":"중지","todo.viewDiff":"Diff 보기","todo.hideDiff":"Diff 접기","todo.viewDebugLog":"디버그 로그","todo.merge":"병합","todo.mergeChain":"체인 병합","todo.mergeChainDesc":"이 체인의 모든 작업을 메인 브랜치에 병합","todo.chainComplete":"체인 완료","todo.chainTasks":"{count}개 작업","todo.edit":"편집","todo.delete":"삭제","todo.cleanup":"워크트리 삭제","todo.cleanupFailed":"정리 실패","cleanup.confirmDeleteBranch":`워크트리를 삭제합니다. 브랜치 "{name}"도 함께 삭제할까요?
|
|
65
65
|
|
|
66
66
|
확인 = 워크트리 + 브랜치 삭제
|
|
67
|
-
취소 = 워크트리만 삭제`,"todo.retry":"재시도","todo.retryDesc":"이전 워크트리를 정리하고 처음부터 다시 실행합니다.","todo.retryFailed":"재시도 실패","todo.continue":"이어서","todo.continueDesc":"같은 워크트리에서 후속 프롬프트를 실행합니다.","todo.continuing":"이어가는 중...","todo.confirmContinue":"이어서 실행","todo.continuePromptLabel":"후속 프롬프트","todo.continuePromptPlaceholder":"이 워크트리에 적용할 다음 지시사항을 입력하세요...","todo.continuePromptRequired":"후속 프롬프트를 입력해주세요.","todo.roundLabel":"라운드","todo.dependsOn":"선행 작업","todo.mergedFrom":"이전 작업에서 병합","todo.transferredTo":"작업 이전됨","todo.schedule":"예약","todo.scheduleDesc":"특정 시간에 1회 실행되도록 루틴으로 변환합니다.","todo.scheduleAt":"실행 시각","todo.scheduling":"예약 중...","todo.confirmSchedule":"예약","todo.scheduleKeepOriginal":"원본 작업 유지","todo.scheduleOnReset":"리셋 시 실행","todo.scheduleOnResetDesc":"토큰 한도 리셋 시 자동으로 새 작업을 실행합니다.","todo.scheduleOnResetLabel":"리셋 시각","todo.resetPromptPlaceholder":"리셋 후 실행할 프롬프트를 입력하세요...","todo.confirmResetSchedule":"리셋 시 실행 예약","todoForm.titlePlaceholder":"작업 제목...","todoForm.descPlaceholder":"설명 (선택사항)...","todoForm.cliTool":"CLI 도구","todoForm.addImage":"이미지 추가","todoForm.pasteHint":"Ctrl+V로 이미지 붙여넣기","todoForm.images":"이미지","todoForm.maxTurns":"최대 턴 수","todoForm.maxTurnsPlaceholder":"제한 없음","todoForm.maxTurnsHint":"에이전트 턴 수를 제한하여 과도한 토큰 사용을 방지합니다.","todoForm.dependsOn":"선행 작업","todoForm.noDependency":"없음 (독립 작업)","todoForm.dependsOnHint":"선행 작업이 완료되면 변경사항을 스쿼시 머지하고 새 브랜치에서 실행됩니다.","todoForm.worktreeMode":"실행 브랜치","todoForm.worktreeInherit":"프로젝트 설정 따름","todoForm.worktreeForceOn":"워크트리 사용 (격리 브랜치)","todoForm.worktreeForceOff":"메인 브랜치에서 실행","todoForm.worktreeProjectDefaultOn":"프로젝트 기본: 워크트리","todoForm.worktreeProjectDefaultOff":"프로젝트 기본: 메인 브랜치","todoForm.worktreeMainWarning":"메인 브랜치에서 실행 시 다른 작업의 동시 실행이 차단됩니다.","todoForm.cancel":"취소","todoForm.save":"저장","dnd.dropHint":"이 작업 이후에 실행","dnd.removeDep":"의존성 제거","dnd.dropToRemoveDep":"여기에 놓으면 의존성 제거","dnd.cyclicWarning":"순환 의존성으로 연결할 수 없습니다","graph.autoLayout":"자동 정렬","graph.listView":"리스트 보기","graph.graphView":"그래프 보기","status.pending":"대기","status.running":"실행 중","status.completed":"완료","status.failed":"실패","status.stopped":"중지","status.merged":"병합됨","progress.complete":"완료","progress.done":"완료","progress.live":"실행 중","progress.idle":"대기","progress.fail":"실패","progress.stop":"중지","progress.merged":"병합됨","failure.title":"실패 원인","failure.exitCode":"종료 코드","failure.fix":"수정하기: 실패 원인을 분석하고 문제를 수정하는 새 작업을 생성합니다.","failure.fixPrefix":"[수정] ","result.duration":"소요 시간","result.commits":"커밋","result.filesChanged":"파일 변경","result.commitHistory":"커밋 이력","result.changedFiles":"변경된 파일","result.tokenUsage":"토큰 사용량","result.inputTokens":"입력","result.outputTokens":"출력","result.totalCost":"비용","result.cacheTokens":"캐시","result.turns":"턴","result.contextUsed":"사용","result.levelLight":"가벼움","result.levelModerate":"보통","result.levelHigh":"많음","result.levelHeavy":"과다","log.awaiting":"출력 대기 중...","log.waitingResponse":"응답 대기 중...","log.noChanges":"변경사항이 없습니다.","log.copy":"복사","log.copied":"복사됨!","log.viewChat":"대화","log.viewRaw":"원시","schedules.title":"루틴","schedules.add":"새 루틴","schedules.empty":"루틴이 없습니다","schedules.emptyHint":"반복 작업을 자동화할 루틴을 만들어보세요.","schedule.type":"루틴 유형","schedule.recurring":"반복","schedule.once":"1회","schedule.runAtLabel":"실행 시각","schedule.cronExpression":"실행 주기","schedule.cronHint":"예: */30 * * * * (30분마다), 0 9 * * * (매일 9시), 0 9 * * 1-5 (평일 9시)","cron.everyMinutes":"분 간격","cron.hourly":"매시간","cron.daily":"매일","cron.weekly":"매주","cron.monthly":"매월","cron.custom":"직접 입력","cron.every":"매","cron.minutesLabel":"분마다","cron.everyHourAt":"매시간","cron.minutesPast":"분에","cron.everyDayAt":"매일","cron.at":"시간","cron.everyMonthOn":"매월","cron.dayAt":"일","cron.expression":"Cron","cron.mon":"월","cron.tue":"화","cron.wed":"수","cron.thu":"목","cron.fri":"금","cron.sat":"토","cron.sun":"일","schedule.skipIfRunning":"이전 실행이 진행 중이면 건너뛰기","schedule.active":"활성","schedule.paused":"일시정지","schedule.lastRun":"마지막 실행","schedule.never":"없음","schedule.trigger":"즉시 실행","schedule.activate":"활성화","schedule.pause":"일시정지","schedule.edit":"편집","schedule.delete":"삭제","schedule.runs":"실행 이력","schedule.runTriggered":"실행됨","schedule.runSkipped":"건너뜀","schedule.runCompleted":"완료","schedule.runFailed":"실패","schedule.noRuns":"실행 이력이 없습니다","scheduleForm.titlePlaceholder":"루틴 제목...","scheduleForm.descPlaceholder":"작업 설명 템플릿...","scheduleForm.cliTool":"CLI 도구","scheduleForm.cancel":"취소","scheduleForm.save":"저장","jira.title":"Jira 이슈","jira.search":"이슈 검색...","jira.allStatuses":"모든 상태","jira.refresh":"새로고침","jira.import":"작업으로 가져오기","jira.importing":"가져오는 중...","jira.imported":"가져옴!","jira.noIssues":"이슈가 없습니다","jira.noIssuesHint":"필터나 검색어를 변경해보세요.","jira.loadMore":"더 보기","jira.total":"건","jira.transition":"상태 변경","jira.comment":"댓글","jira.commentPlaceholder":"댓글 입력...","jira.commentSend":"전송","jira.createIssue":"이슈 생성","jira.createSummary":"제목","jira.createDesc":"설명","jira.createType":"이슈 유형","jira.creating":"생성 중...","jira.notConfigured":"Jira가 설정되지 않았습니다. 프로젝트 설정에서 활성화하세요.","jira.assignee":"담당자","jira.unassigned":"미배정","jira.updated":"업데이트","notion.title":"Notion 페이지","notion.search":"페이지 검색...","notion.refresh":"새로고침","notion.import":"작업으로 가져오기","notion.importing":"가져오는 중...","notion.imported":"가져옴!","notion.noPages":"페이지가 없습니다","notion.noPagesHint":"검색어를 변경해보세요.","notion.loadMore":"더 보기","notion.createPage":"페이지 생성","notion.pageTitle":"제목","notion.creating":"생성 중...","notion.notConfigured":"Notion이 설정되지 않았습니다. 프로젝트 설정에서 활성화하세요.","notion.loadingContent":"콘텐츠 로딩 중...","notion.noContent":"콘텐츠 없음","header.notionTitle":"Notion 연동","header.notionApiKey":"통합 토큰","header.notionApiKeyPlaceholder":"ntn_...","header.notionDatabaseId":"데이터베이스 ID","header.notionDatabaseIdPlaceholder":"예: abc123def456...","header.notionTestConnection":"연결 테스트","header.notionTesting":"테스트 중...","header.notionConnected":"연결 성공","header.notionFailed":"연결 실패","header.notionTokenHint":"notion.so/my-integrations에서 통합을 생성하고 데이터베이스를 공유하세요","github.title":"GitHub 이슈","github.search":"이슈 검색...","github.refresh":"새로고침","github.import":"작업으로 가져오기","github.importing":"가져오는 중...","github.imported":"가져옴!","github.noIssues":"이슈가 없습니다","github.noIssuesHint":"필터나 검색어를 변경해보세요.","github.loadMore":"더 보기","github.createIssue":"이슈 생성","github.issueTitle":"제목","github.issueBody":"설명","github.creating":"생성 중...","github.notConfigured":"GitHub이 설정되지 않았습니다. 프로젝트 설정에서 활성화하세요.","github.loadingComments":"댓글 로딩 중...","github.comments":"댓글","github.noBody":"설명이 없습니다.","github.open":"열림","github.closed":"닫힘","github.all":"전체","header.githubTitle":"GitHub 연동","header.githubToken":"개인 액세스 토큰","header.githubTokenPlaceholder":"ghp_...","header.githubOwner":"저장소 소유자","header.githubOwnerPlaceholder":"사용자명 또는 조직","header.githubRepo":"저장소 이름","header.githubRepoPlaceholder":"repo-name","header.githubTestConnection":"연결 테스트","header.githubTesting":"테스트 중...","header.githubConnected":"연결 성공","header.githubFailed":"연결 실패","header.githubTokenHint":"github.com/settings/tokens에서 repo 권한으로 토큰을 생성하세요","tabs.automation":"자동화","tabs.automation.help":"자동 작업·토론·루틴을 한곳에서 관리합니다.","tabs.tasks":"자동 작업","tabs.sessions":"터미널","tabs.discussions":"토론","tabs.schedules":"루틴","tabs.jira":"Jira","tabs.notion":"Notion","tabs.github":"GitHub","tabs.git":"Git","tabs.svn":"SVN","tabs.files":"문서","tabs.planner":"플래너","tabs.wiki":"위키","tabs.analytics":"통계","tabs.wiki.help":"프로젝트 지식 그래프. 노드/엣지를 만들어 두면 자동 작업·토론 프롬프트에 <long_term_memory> 블록으로 주입돼서 LLM이 실행 간에도 맥락을 유지합니다.","tabs.planner.help":"가벼운 작업 메모. 태그·우선순위·이미지 첨부가 가능하고, 마음에 드는 항목은 자동 작업이나 루틴으로 변환하거나 Markdown으로 내보내기/가져오기 할 수 있습니다.","tabs.tasks.help":"할 일을 미리 쌓아두고 원할 때 한번에 돌릴 수 있는 작업 큐입니다. TODO를 여러 개 적어두면 각각 독립된 git worktree에서 Claude/Antigravity/Codex가 자동으로 실행하고, 동시 실행 한도까지 병렬로 처리합니다. 의존성 체이닝, 멀티 라운드 continue, 머지 자동화도 함께 처리됩니다.","tabs.sessions.help":"Claude/Antigravity/Codex를 플로팅 창에서 직접 조작하는 대화형 모드입니다. 자동 작업(fire-and-forget)과 달리 터미널은 계속 살아 있어서 실시간으로 입력하고 결과를 보면서 CLI를 직접 컨트롤할 수 있습니다.","tabs.discussions.help":"여러 AI 에이전트가 라운드별로 토론한 뒤 합의를 코드로 구현. 결과를 플래너 항목으로 추출할 수도 있습니다.","tabs.schedules.help":"cron 또는 일회성 예약으로 자동 작업을 트리거. 레이트 리밋 리셋 시점 자동 재시작도 지원합니다.","tabs.git.help":"워크스페이스 내장 Git 클라이언트. 파일 상태/커밋 그래프/브랜치 관리/diff 뷰어를 Fork·SourceTree 스타일 레이아웃으로 제공합니다.","tabs.svn.help":"내장 SVN 워킹카피 패널. 파일 상태/리비전 로그/diff 뷰어를 제공합니다.","svn.fileStatus":"파일 상태","svn.history":"히스토리","svn.unversioned":"버전 미관리","svn.changed":"변경됨","svn.groupByDir":"디렉터리로 그룹화","svn.viewFlat":"목록으로 보기","svn.dirFileCount":"{d}개 디렉터리 · {f}개 파일","svn.fileCount":"{f}개 파일","svn.workingCopyRev":"워킹카피 리비전","svn.update":"업데이트","svn.refresh":"새로고침","svn.add":"추가","svn.revert":"되돌리기","svn.delete":"삭제","svn.resolve":"충돌 해결","svn.commitMessagePlaceholder":"커밋 메시지를 입력하세요. 필수.","svn.commit":"커밋","svn.committing":"커밋 중...","svn.commitSuccess":"r{rev} 커밋 완료","svn.updating":"업데이트 중...","svn.updateSuccess":"r{rev}로 업데이트 완료","svn.noChanges":"로컬 변경사항 없음.","svn.selectFiles":"먼저 파일을 한 개 이상 선택하세요.","svn.notSvn":"SVN 워킹카피가 아닙니다.","svn.cliMissing":"svn CLI를 찾을 수 없습니다. 이 패널을 사용하려면 Subversion을 설치하세요.","svn.repoUrl":"저장소 URL","svn.relativePath":"경로","svn.viewsHeader":"보기","svn.actionsHeader":"명령","svn.checkForModifications":"로컬 변경 확인","svn.showLog":"로그 보기","svn.updateToRevision":"특정 리비전으로 업데이트…","svn.cleanup":"정리(Cleanup)","svn.checkRepository":"원격 변경 확인","svn.remoteBadge":"원격","svn.remoteHint":"SVN 서버에 접속합니다","svn.loadLog":"로그 불러오기","svn.logEmptyHint":"로그는 SVN 서버에서 가져옵니다. 자동으로 불러오지 않습니다.","svn.loadMore":"더 보기","svn.revision":"리비전","svn.revisionPlaceholder":"예: 1234 또는 HEAD","svn.cleaningUp":"정리 중…","svn.cleanupSuccess":"정리 완료","svn.checking":"확인 중…","svn.behindCount":"서버에 들어올 변경 {n}건","svn.upToDate":"서버와 동일","svn.resolveWorking":"해결 표시 (워킹카피 유지)","svn.resolveMine":"내 변경으로 해결","svn.resolveTheirs":"서버 변경으로 해결","svn.resolveBase":"기준본으로 해결","svn.viewDiff":"Diff 보기","svn.cancel":"취소","svn.properties":"속성(Properties)","svn.propertiesOf":"속성: {target}","svn.workingCopyRoot":"워킹카피 루트","svn.noProperties":"이 항목에 속성이 없습니다.","svn.editProperty":"수정","svn.saveProperty":"저장","svn.close":"닫기","svn.changelistDefault":"변경","svn.changelistUnversioned":"버전이 없는 파일","svn.changelistMissing":"로컬에서 삭제된 파일","svn.moveToChangelist":"변경 목록으로 이동","svn.newChangelist":"새 변경 목록…","svn.removeFromChangelist":"변경 목록에서 제거","svn.changelistNamePlaceholder":"변경 목록 이름","header.svnTitle":"SVN (Subversion)","header.svnHint":"기본값 OFF. 켜면 프로젝트에 .svn/ 워킹카피가 있는지 검사하고, 발견 시 SVN 탭이 표시됩니다.","header.svnEnable":"이 프로젝트에서 SVN 활성화","tabs.files.help":"마크다운 문서 위키 — 파일 트리 탐색, 노트 미리보기/편집, 그래프·백링크·개요·태그·검색 패널로 .md 파일 간 위키링크 탐색.","tabs.analytics.help":"실행 통계와 비용 분석. CLI별 토큰 사용량, 상태 분포, 일별 비용 추이를 차트로 시각화합니다.","files.root":"루트","files.empty":"빈 폴더","files.loading":"불러오는 중...","files.refresh":"새로고침","files.graph":"위키 그래프 — .md 파일 간 위키링크 연결 표시","files.showHidden":"숨김 파일 보기","files.hideHidden":"숨김 파일 숨기기","files.copyPath":"경로 복사","files.sendToTerminal":"터미널로 보내기","files.newTerminal":"새 터미널","files.includeLinks":"링크된 문서 포함","files.sendToTask":"작업으로 보내기","files.sentToTerminal":"터미널로 전송됨","files.noActiveSession":"열린 세션이 없습니다","files.taskCreated":"작업이 생성됨","files.taskCreateFailed":"작업 생성 실패","files.hide":"문서에서 숨기기","files.unhide":"문서에 다시 보이기","files.openInOS":"기본 앱으로 열기","files.revealInExplorer":"탐색기에서 보기","files.openFolder":"탐색기에서 폴더 열기","files.pin":"상단에 고정","files.unpin":"고정 해제","files.pinned":"고정됨","files.tooLarge":"미리보기를 표시하기엔 파일이 너무 큽니다 (최대 2MB).","files.binaryNotPreviewable":"바이너리 파일 — 미리보기 불가.","files.download":"다운로드","files.preview.empty":"파일을 선택해 미리보기를 확인하세요.","files.html.sandboxNotice":"안전 미리보기 — 스크립트와 외부 리소스가 차단되었습니다.","files.editor.edit":"편집","files.editor.save":"저장","files.editor.done":"완료","files.editor.saved":"저장됨","files.editor.saveFailed":"저장 실패","files.editor.conflict":"파일이 디스크에서 변경되었습니다 — 다시 열어주세요.","files.editor.discardConfirm":"변경사항을 폐기하시겠습니까?","files.editor.dirty":"변경됨","find.openFind":"찾기","find.placeholder":"찾을 내용","find.replacePlaceholder":"바꿀 내용","find.case":"대소문자 구분","find.word":"전체 단어 일치","find.regex":"정규식 사용","find.next":"다음 결과 (Enter)","find.prev":"이전 결과 (Shift+Enter)","find.replace":"바꾸기","find.replaceAll":"모두 바꾸기","find.close":"닫기 (Esc)","find.toggleReplace":"바꾸기 토글","find.noMatches":"결과 없음","annotate.start":"낙서 시작","annotate.stop":"낙서 종료","annotate.select":"선택","annotate.pen":"펜","annotate.highlighter":"형광펜","annotate.eraser":"지우개","annotate.undo":"되돌리기","annotate.redo":"다시 실행","annotate.clear":"모두 지우기","wiki.title":"위키","wiki.add":"새 항목","wiki.edit":"편집","wiki.delete":"삭제","wiki.save":"저장","wiki.saving":"저장 중...","wiki.cancel":"취소","wiki.empty":"아직 위키 항목이 없습니다","wiki.emptyHint":"LLM이 작업할 때 참고해야 할 노트, 컨벤션, 교훈을 추가하세요.","wiki.viewList":"목록","wiki.viewGraph":"그래프","wiki.viewHierarchical":"계층","wiki.viewNetwork":"네트워크","wiki.searchPlaceholder":"위키 검색...","wiki.backlinks":"백링크","wiki.addLink":"다른 항목 링크 추가","wiki.addLinkPlaceholder":"연결할 항목 검색…","wiki.connect.title":"어떻게 연결할까요?","wiki.connect.wikilink":"참조 (wikilink)","wiki.connect.wikilinkHint":"소스 본문에 [[대상 제목]]을 추가합니다. 자유로운 언급, 의미 관계 없음.","wiki.connect.edge":"관계 (타입드 엣지)","wiki.connect.edgeHint":"관계 타입(관련/선행/구체화 등)을 가진 엣지를 추가합니다.","wiki.allTags":"모든 태그","wiki.countLabel":"{count}개","wiki.deleteConfirm":"이 항목과 연결된 모든 관계를 삭제할까요?","wiki.noResults":"검색 결과 없음","wiki.noBody":"본문 없음","wiki.connections":"연결","wiki.outgoing":"나가는 연결","wiki.incoming":"들어오는 연결","wiki.autoLayout":"자동 정렬","wiki.form.newTitle":"새 항목","wiki.form.editTitle":"항목 편집","wiki.form.title":"제목","wiki.form.titlePlaceholder":"간결하고 명확한 제목","wiki.form.body":"본문 (Markdown 지원)","wiki.form.bodyPlaceholder":"LLM이 참고해야 할 지식이나 컨벤션을 작성하세요...","wiki.form.linkHint":"[[ 또는 @ 입력으로 다른 위키 항목을 링크하세요.","wiki.form.tags":"태그","wiki.form.tagsPlaceholder":"태그 입력 후 Enter","wiki.form.pinned":"고정 (강조 표시)","wiki.edge.editTitle":"연결 편집","wiki.edge.relationType":"관계 종류","wiki.edge.label":"라벨","wiki.edge.labelPlaceholder":'선택 메모 (예: "3.2절 참조")',"wiki.edge.deleteConfirm":"이 연결을 삭제할까요?","wiki.edge.relations.related":"관련","wiki.edge.relations.precedes":"선행","wiki.edge.relations.example_of":"예시","wiki.edge.relations.counter_example":"반례","wiki.edge.relations.refines":"구체화","vault.title":"문서","vault.empty":"마크다운 파일이 없습니다","vault.noResults":"일치하는 파일 없음","vault.searchPlaceholder":"파일 검색...","vault.graph.addLink":"여기서 링크 추가","vault.graph.linkHint":"연결할 대상 노드를 클릭하세요 · Esc 취소","vault.graph.showLabels":"이름 표시","vault.graph.rightClickHint":"우클릭 → 링크 추가","vault.newFile":"새 파일","vault.create":"만들기","vault.save":"저장","vault.delete":"삭제","vault.unsaved":"미저장","vault.confirmDelete":"{path} 파일을 삭제할까요?","vault.backlinks":"백링크","vault.filesCount":"개 파일","vault.panel.fileExplorer":"파일","vault.panel.search":"검색","vault.panel.tags":"태그","vault.panel.graph":"그래프","vault.panel.outline":"개요","vault.panel.backlinks":"백링크","vault.panel.outgoing":"아웃고잉 링크","vault.outline.empty":"이 노트에 헤딩이 없습니다","vault.outgoing.empty":"아웃고잉 위키링크 없음","vault.backlinks.empty":"백링크 없음","vault.tags.empty":"문서에 태그 없음","vault.search.empty":"결과 없음","vault.search.prompt":".md 노트 검색","vault.activeFile.empty":"파일을 선택해 미리보기/편집하세요","vault.sidebar.collapse":"사이드바 접기","vault.sidebar.expand":"사이드바 펼치기","vault.loadError":"문서 목록을 불러오지 못했습니다","vault.retry":"다시 시도","vault.allHidden":'모든 문서가 .vaultignore로 숨김 상태입니다 — 파일 탐색기에서 우클릭 → "문서에 다시 보이기"로 해제하세요',"vault.ignoreHelp":".vaultignore 사용법","vaultInject.title":"문서 주입","vaultInject.modeNone":"사용 안 함","vaultInject.modeAuto":"자동","vaultInject.modeAll":"전체 주입","vaultInject.modeSelected":"선택 주입","vaultInject.autoHint":"실행 직전 LLM이 작업 설명을 기준으로 {count}개 파일 중 최대 10개를 골라 주입합니다.","vaultInject.previewToggle":"미리보기","vaultInject.previewChars":"{n}자","vaultInject.previewTokens":"약 {n} 토큰","vaultInject.empty":"프로젝트 루트에 .md/.html 파일이 없습니다.","vaultInject.injectedCount":"{count}개 파일 주입","vaultInject.allCount":"전체 {count}개 파일 주입","vaultInject.searchPlaceholder":"이름으로 필터...","vaultInject.loading":"불러오는 중...","vaultInject.includeLinked":"체크 시 1-hop 연결된 파일도 함께 선택","vaultInject.linkedAdded":"+{n}개 연결","vaultInject.noResults":"일치하는 파일 없음","wiki.ingest":"Ingest","wiki.ingest.title":"소스 자료 인제스트","wiki.ingest.tabTask":"태스크에서","wiki.ingest.tabDiscussion":"디스커션에서","wiki.ingest.tabText":"텍스트 붙여넣기","wiki.ingest.selectTask":"완료된 태스크 선택","wiki.ingest.selectDiscussion":"완료된 디스커션 선택","wiki.ingest.noTasks":"완료된 태스크가 없습니다","wiki.ingest.noDiscussions":"완료된 디스커션이 없습니다","wiki.ingest.textPlaceholder":"텍스트 붙여넣기 — 아티클, 노트, 채팅 기록 등에서 지식을 추출합니다...","wiki.ingest.run":"인제스트","wiki.ingest.running":"인제스트 중...","wiki.ingest.success":"{created}개 생성, {updated}개 갱신, 엣지 {edges}개 추가","wiki.ingest.parseFailed":"LLM 응답을 JSON 으로 해석하지 못했습니다 — 변경 사항 없음.","wiki.ingest.modelEmpty":"LLM 이 추가할 만한 새 내용이 없다고 판단했습니다 — 제안 0건.","wiki.ingest.allSkipped":"제안된 항목이 모두 스킵되었습니다 — 아래 사유를 확인하세요.","wiki.ingest.proposed":"LLM 제안: 생성 {c}, 갱신 {u}, 엣지 {e}","wiki.ingest.skipNote":"스킵됨","wiki.ingest.skip.duplicate":"이미 존재하는 제목","wiki.ingest.skip.unique":"DB UNIQUE 충돌","wiki.ingest.skip.empty":"제목 없음","wiki.ingest.skip.badId":"갱신 대상 id 가 유효하지 않음","wiki.ingest.skip.badEdge":"엣지 양 끝 노드를 찾을 수 없음","wiki.ingest.skip.selfEdge":"자기 자신을 가리키는 엣지","wiki.ingest.skip.edgeUnique":"엣지 UNIQUE 충돌","wiki.ingest.rawSnippet":"원본 응답 일부 보기","wiki.ingest.toast.success":"{source} → 위키 업데이트: {created}개 생성, {updated}개 갱신, 엣지 {edges}개","wiki.ingest.toast.empty":"{source} → 위키 인제스트: 추가할 새 내용 없음","wiki.ingest.toast.parseFailed":"{source} → 위키 인제스트: LLM 응답 파싱 실패","wiki.ingest.toast.failed":"위키 자동 인제스트 실패","wiki.schemaSection":"스키마","wiki.schemaSectionHint":"Ingest가 사용하는 항목 종류와 규칙을 정의합니다. 프로젝트에 맞게 편집하세요.","wiki.schemaBannerTitle":"위키 스키마","wiki.schemaBannerHint":"여기를 편집하면 Ingest 시 LLM이 새 항목을 분류하는 방식이 바뀝니다. 삭제하면 기본값으로 재생성됩니다.","wiki.systemSection":"시스템","wiki.systemSectionHint":"Ingest 동작과 빠른 탐색을 지원하는 자동 유지 항목들입니다.","wiki.indexBannerTitle":"위키 인덱스","wiki.indexBannerHint":"위키 변경 시마다 자동 재생성됩니다. 수동 편집은 덮어써집니다 — 삭제 시 다음 변경 때 재생성됩니다.","wiki.asset.uploading":"이미지 업로드 중…","wiki.asset.tooLarge":"이미지가 너무 큽니다 (최대 10MB)","wiki.diskDiff.button":"디스크 비교","wiki.diskDiff.tooltip":"내보낸 위키 파일과 DB 비교","wiki.diskDiff.title":"위키 vs .clitrigger/wiki/","wiki.diskDiff.intro":"읽기 전용 — DB가 export할 내용과 디스크 파일이 다른 것만 보여줍니다. Obsidian 등에서 편집한 내용이 여기 나타납니다. Rebuild는 디스크를 현재 DB 상태로 덮어씁니다.","wiki.diskDiff.running":"비교 중…","wiki.diskDiff.empty":"디스크와 DB가 일치합니다.","wiki.diskDiff.refresh":"다시 비교","wiki.diskDiff.close":"닫기","wiki.diskDiff.section.modified":"디스크에서 수정됨 ({n})","wiki.diskDiff.section.missing":"디스크에 없음 ({n})","wiki.diskDiff.section.untracked":"추적되지 않는 디스크 파일 ({n})","wiki.diskDiff.rebuild":"DB 기준으로 재생성","wiki.diskDiff.rebuildTooltip":"현재 DB 상태로 wiki/ 폴더를 덮어씁니다. 디스크의 편집 내용은 사라집니다.","wiki.diskDiff.rebuildConfirm":"wiki/ 폴더를 현재 DB 상태로 덮어쓸까요? 디스크의 편집 내용은 사라집니다.","wiki.diskDiff.rebuildResult":"재생성됨: {written}개 작성, {removed}개 삭제","wiki.lint":"Lint","wiki.lint.title":"위키 건강 검사","wiki.lint.running":"검사 중...","wiki.lint.empty":"위키가 건강합니다 — 이슈 없음.","wiki.lint.close":"닫기","wiki.lint.rerun":"다시 검사","wiki.lint.mergeConfirm":'"{absorb}"을(를) "{keep}"에 병합할까요? 본문 결합, 태그 합집합, 엣지/위키링크 재배선 후 "{absorb}"이 삭제됩니다.',"wiki.lint.action.mergeKeep":'"{keep}" 유지, "{absorb}" 병합',"wiki.lint.action.delete":"삭제","wiki.lint.action.deleteTitle":'"{title}" 삭제',"wiki.lint.action.link":"연결","wiki.lint.action.linkTo":"연결 대상…","wiki.sourceAutoLabel":"자동","wiki.viewRaw":"Raw 원본 보기","wiki.loading":"불러오는 중...","wiki.close":"닫기","wiki.subTab.wiki":"위키","wiki.subTab.sources":"원본","wiki.subTab.activity":"활동","wiki.activity.empty":"아직 활동 없음","wiki.activity.emptyHint":"Ingest, Lint, Retrieve, Merge 이벤트가 여기 기록됩니다.","wiki.activity.refresh":"새로고침","wiki.activity.filter.all":"전체","wiki.activity.filter.ingest":"인제스트","wiki.activity.filter.lint":"Lint","wiki.activity.filter.retrieve":"검색","wiki.activity.filter.merge":"병합","wiki.sources.empty":"사이드바에서 raw 파일을 선택하세요.","wiki.sources.noFiles":"아직 raw 파일이 없습니다 — Ingest를 실행하세요.","wiki.rawFile.derivedTitle":"이 원본에서 파생된 항목","wiki.rawFile.noDerived":"이 원본에서 파생된 항목 없음","wiki.rawFile.openSiblings":"이 원본에서 파생된 {n}개 항목 보기","wiki.rawFile.openExternal":"기본 앱으로 열기","wiki.rawFile.revealInFolder":"폴더에서 보기","wiki.rawFile.delete":"원본 삭제","wiki.rawFile.deleteConfirm":"이 원본 파일을 삭제할까요? 위키 노드는 유지됩니다.","wiki.rawFile.deleteConfirmDerived":"이 원본 파일을 삭제하고 파생된 {n}개 위키 노드의 source 링크를 끊을까요? 노드 자체는 유지됩니다.","planner.title":"플래너","planner.add":"새 항목","planner.view.pages":"페이지","planner.view.all":"전체 보기","planner.nav.calendar":"달력","planner.nav.list":"목록","planner.block.tasklist":"할일 목록","planner.block.calendar":"캘린더","planner.block.addTask":"작업 추가…","planner.pages.newTemplate":"새 페이지 — 템플릿 선택","planner.tpl.blank":"빈 페이지","planner.tpl.blank.desc":"빈 페이지에서 시작","planner.tpl.meeting":"회의 노트","planner.tpl.meeting.desc":"날짜·참석자·안건·액션 아이템","planner.tpl.project":"프로젝트 플랜","planner.tpl.project.desc":"개요·마일스톤·일정","planner.tpl.weekly":"위클리 플래너","planner.tpl.weekly.desc":"주간 목표·할 일·캘린더","planner.pages.new":"새 페이지","planner.pages.untitled":"제목 없음","planner.pages.empty":"페이지가 없습니다","planner.pages.emptyHint":"메모·문서·체크리스트를 자유롭게 작성할 페이지를 만드세요.","planner.pages.deleteConfirm":"이 페이지를 삭제할까요? 되돌릴 수 없습니다.","planner.pages.saving":"저장 중…","planner.pages.saved":"저장됨","planner.empty":"플래너 항목이 없습니다","planner.emptyHint":"아이디어, 작업, 계획을 플래너에 추가하세요.","planner.filterTag":"모든 태그","planner.filterStatus":"모든 상태","planner.col.title":"제목","planner.col.tags":"태그","planner.col.dueDate":"마감일","planner.col.status":"상태","planner.col.actions":"","planner.edit":"수정","planner.delete":"삭제","planner.deleteConfirm":"이 플래너 항목을 삭제하시겠습니까?","planner.convertToTask":"작업으로 변환","planner.convertToSchedule":"루틴으로 변환","planner.convertToTerminal":"터미널로 보내기","planner.movedToTodo":"작업으로 이동됨","planner.movedToSchedule":"루틴으로 이동됨","planner.movedToSession":"터미널로 이동됨","planner.fromDiscussion":"토론에서","planner.noDueDate":"—","planner.export":"내보내기","planner.exportTooltip":"플래너 항목을 Markdown 파일로 내보내기","planner.exportError":"내보내기 실패","planner.import":"가져오기","planner.importTooltip":"Markdown 파일에서 플래너 항목 가져오기","planner.importSuccess":"{items}개 항목과 {tags}개 태그를 가져왔습니다.","planner.importError":"가져오기 실패","planner.importInvalidMarkdown":"파일이 비어 있거나 유효한 Markdown이 아닙니다","planner.importNoImages":"참고: 이미지는 내보낸 파일에 포함되지 않습니다.","planner.dropHint":"여기에 Markdown 파일을 놓아 가져오기","planner.dropHintSub":".md 또는 .markdown","planner.dropInvalidFile":"Markdown 파일(.md / .markdown)만 가져올 수 있습니다","plannerForm.titlePlaceholder":"플래너 항목 제목...","plannerForm.descPlaceholder":"설명 또는 세부 사항...","plannerForm.tags":"태그","plannerForm.tagsPlaceholder":"태그를 입력하고 Enter를 누르세요","plannerForm.dueDate":"마감일","plannerForm.priority":"우선순위","plannerForm.priorityLow":"낮음","plannerForm.priorityNormal":"보통","plannerForm.priorityHigh":"높음","plannerForm.priorityCritical":"긴급","plannerForm.status":"상태","plannerForm.addImage":"이미지 추가","plannerForm.pasteHint":"Ctrl+V로 이미지 붙여넣기","plannerForm.images":"이미지","plannerForm.cancel":"취소","plannerForm.save":"저장","plannerStatus.pending":"대기","plannerStatus.in_progress":"진행 중","plannerStatus.done":"완료","plannerStatus.moved":"이동됨","plannerConvert.toTask":"작업으로 변환","plannerConvert.toSchedule":"루틴으로 변환","plannerConvert.toTerminal":"터미널로 보내기","plannerConvert.useWorktree":"git worktree 사용","plannerConvert.cliTool":"CLI 도구","plannerConvert.maxTurns":"최대 턴","plannerConvert.scheduleType":"루틴 유형","plannerConvert.recurring":"반복","plannerConvert.once":"일회성","plannerConvert.cronExpression":"Cron 표현식","plannerConvert.runAt":"실행 시각","plannerConvert.cancel":"취소","plannerConvert.convert":"변환","plannerTag.selectOrCreate":"옵션 선택 또는 생성","plannerTag.delete":"삭제","plannerTag.deleteConfirm":"이 태그를 모든 항목에서 제거하시겠습니까?","plannerTag.color":"색","plannerTag.rename":"이름 변경","plannerTag.color.default":"기본","plannerTag.color.gray":"회색","plannerTag.color.brown":"갈색","plannerTag.color.orange":"주황색","plannerTag.color.yellow":"노란색","plannerTag.color.green":"초록색","plannerTag.color.blue":"파란색","plannerTag.color.purple":"보라색","plannerTag.color.pink":"분홍색","plannerTag.color.red":"빨간색","session.new":"새 터미널","session.windowState.floating":"열림","session.windowState.minimized":"최소화","session.windowState.popped":"별도 창","session.recallToMain":"중앙으로 불러오기","session.restoreWindow":"창 복원","session.focusWindow":"창으로 이동","session.openWindow":"터미널 열기","session.dock.poppedHint":"별도 창 — 클릭하면 창을 앞으로 가져옵니다","session.title":"터미널 제목","session.description":"초기 프롬프트 (선택)","session.start":"시작","session.stop":"중지","session.resume":"이어서 시작","session.resumeHint":"이 워크트리의 직전 Claude 대화에 이어서 시작합니다","session.delete":"삭제","session.edit":"편집","session.editDisabledRunning":"실행 중에는 편집할 수 없습니다","session.save":"저장","session.saving":"저장 중…","session.empty":"터미널이 없습니다","session.emptyHint":"대화형 AI 터미널을 시작하세요.","session.create":"터미널 생성","session.cliTool":"CLI 도구","session.cliNotInstalled":" (설치 안 됨)","session.worktree":"워크트리 사용 (격리된 브랜치)","session.cleanup":"워크트리 삭제","session.startInWindow":"시작","session.starting":"시작하는 중…","session.starting.typeAhead":"미리 입력한 내용은 터미널 준비가 끝나면 그대로 전송됩니다","session.stopping":"중지하는 중…","session.startFailed":"시작 실패","session.confirmStop":"이 터미널을 종료할까요? 진행 중인 작업이 종료됩니다.","session.minimize":"최소화","session.fontDecrease":"글자 작게","session.refresh":"새로고침","session.refresh.hint":"터미널 화면만 다시 그립니다 (PTY는 그대로 유지)","session.initialPrompt.ready":"보낼 준비된 초기 프롬프트","session.initialPrompt.preview":"미리보기","session.initialPrompt.hidePreview":"숨기기","session.initialPrompt.send":"보내기","session.initialPrompt.skip":"건너뛰기","session.initialPrompt.loading":"불러오는 중…","session.initialPrompt.blocked":"타이핑하려면 보내기 또는 건너뛰기를 먼저 눌러주세요. 그 전엔 입력이 무시됩니다.","session.fontIncrease":"글자 크게","group.closeTab":"탭 닫기","group.newTab":"쉘 탭 새로 열기","analytics.title":"실행 통계","analytics.loading":"통계 로딩 중...","analytics.noData":"데이터 없음","analytics.totalTasks":"총 작업","analytics.successRate":"성공률","analytics.totalCost":"총 비용","analytics.totalTokens":"총 토큰","analytics.avgPerTask":"작업당 평균","analytics.byStatus":"상태별","analytics.byCliTool":"CLI 도구별","analytics.dailyActivity":"일별 활동","analytics.dailyCost":"일별 비용","analytics.costBreakdown":"비용 요약","analytics.tasks":"작업","analytics.period.7d":"7일","analytics.period.30d":"30일","analytics.period.90d":"90일","analytics.period.all":"전체","discussions.title":"에이전트 토론","discussions.add":"새 토론","discussions.empty":"아직 토론이 없습니다","discussions.emptyHint":"에이전트들이 피쳐를 함께 토론하도록 새 토론을 만드세요.","discussions.round":"라운드","discussions.maxRounds":"최대 라운드","discussions.agents":"에이전트","discussions.speaking":"발언 중...","discussions.inject":"메시지 전송","discussions.skipTurn":"턴 건너뛰기","discussions.implement":"구현 시작","discussions.implementHint":"토론된 기능을 구현할 에이전트를 선택하세요.","discussions.selectAgent":"구현 에이전트 선택","discussions.toPlanner":"Planner로 보내기","discussions.extractTitle":"액션 아이템 추출","discussions.extractHint":"AI가 토론에서 추출한 Planner 항목입니다. 저장 전에 편집하거나 제외하거나 우선순위를 조정하세요.","discussions.extractLoading":"토론에서 액션 아이템을 추출하는 중…","discussions.extractLoadingHint":"최대 2분 정도 걸릴 수 있어요. 추출이 끝날 때까지 창이 닫히지 않습니다.","discussions.extractEmpty":"추출할 액션 아이템이 없습니다. 다른 토론을 시도하거나 합의된 내용을 보강해 보세요.","discussions.extractConfirm":"Planner에 저장","discussions.extractSaving":"저장 중…","discussions.priorityLow":"낮음","discussions.priorityMedium":"보통","discussions.priorityHigh":"높음","discussions.priorityUrgent":"긴급","discussions.notFound":"토론을 찾을 수 없습니다","discussions.back":"토론 목록으로","discussions.userMessage":"메시지를 입력하세요...","discussions.implementation":"구현","discussions.resume":"재개","discussions.retry":"다시 실행","discussions.failureTitle":"토론 실패","discussions.noErrorLogs":"에러 상세 정보가 없습니다","discussions.pause":"일시 중지","discussions.waiting":"대기 중...","discussions.roundExplain":"에이전트 전원이 한 번씩 발언하는 단위입니다.","discussions.autoImplement":"토론 후 자동 구현","discussions.autoImplementHint":"모든 라운드 완료 후 자동으로 구현을 시작합니다.","discussions.collapse":"접기","discussions.expand":"펼치기","discussions.collapseAll":"전체 접기","discussions.expandAll":"전체 펼치기","status.skipped":"건너뜀","status.paused":"일시 중지","agents.title":"에이전트 페르소나","agents.add":"에이전트 추가","agents.name":"이름","agents.role":"역할","agents.systemPrompt":"시스템 프롬프트","agents.cliTool":"CLI 도구","agents.color":"색상","agents.empty":"에이전트가 없습니다. 토론을 시작하려면 에이전트 페르소나를 만드세요.","agents.manage":"에이전트 관리","agents.presets":"프리셋 템플릿","agents.roles.architect":"아키텍트","agents.roles.developer":"개발자","agents.roles.reviewer":"리뷰어","agents.roles.pm":"PM","agents.roles.tester":"테스터","agents.roles.custom":"사용자 정의","agents.canImplement":"토론 중 구현 수행","agents.canImplementHelp":"이 에이전트의 턴에서 발언뿐 아니라 실제 코드 작성·커밋까지 수행합니다. 개발자 역할 에이전트가 아이디어를 즉석에서 시연하도록 할 때 유용합니다.","agents.canImplementBadge":"구현자","git.ahead":"앞섬","git.behind":"뒤처짐","git.staged":"스테이징","git.unstaged":"변경됨","git.noChanges":"작업 트리 깨끗","git.refresh":"새로고침","git.files":"파일","git.commitHistory":"커밋 히스토리","git.branches":"브랜치","git.remotes":"원격","git.tags":"태그","git.stashes":"스태시","git.noCommits":"아직 커밋이 없습니다","git.loadMore":"더 불러오는 중...","git.author":"작성자","git.hash":"해시","git.graph":"그래프","git.description":"설명","git.date":"날짜","git.commit":"커밋","git.pull":"Pull","git.push":"Push","git.pushDialog.targetRemote":"다음 저장소에 푸시","git.pushDialog.branchesHeader":"푸시할 브랜치","git.pushDialog.colPush":"푸시?","git.pushDialog.colLocal":"로컬 브랜치","git.pushDialog.colRemote":"리모트 브랜치","git.pushDialog.colTracking":"추적?","git.pushDialog.selectAll":"모두 선택","git.pushDialog.allTags":"모든 태그 푸시","git.pushDialog.force":"강제 푸시","git.pushDialog.forceHint":"--force-with-lease 사용 (마지막 fetch 이후 원격이 진행되었으면 거부).","git.pushDialog.submit":"Push","git.pushDialog.cancel":"취소","git.pushDialog.pushing":"푸시 중…","git.pushDialog.loading":"불러오는 중…","git.pushDialog.errorRequireBranch":"푸시할 브랜치를 하나 이상 선택하세요.","git.pushDialog.noLocalBranches":"로컬 브랜치가 없습니다.","git.pushDialog.newBranch":"신규","git.pushDialog.customRemote":"직접 입력…","git.fetch":"패치","git.branch":"브랜치","git.merge":"병합","git.stash":"스태시","git.discard":"폐기","git.tag":"태그","git.untracked":"추적 안 됨","git.fileStatus":"파일 상태","git.stageAll":"모두 스테이지","git.unstageAll":"모두 언스테이지","git.stage":"스테이지","git.unstage":"언스테이지","git.commitMessage":"커밋 메시지...","git.branchName":"브랜치 이름...","git.tagName":"태그 이름...","git.tagMessage":"태그 메시지 (선택)...","git.stashMessage":"스태시 메시지 (선택)...","git.selectBranch":"브랜치 선택...","git.discardAll":"모두 폐기","git.confirmDiscard":"모든 변경 사항을 폐기하시겠습니까? 되돌릴 수 없습니다.","git.confirmDiscardFile":"이 파일의 변경 사항을 폐기하시겠습니까?","git.newBranch":"새 브랜치","git.deleteBranch":"브랜치 삭제","git.stashPop":"꺼내기","git.noStashes":"스태시 없음","git.actions":"작업","git.close":"닫기","git.create":"생성","git.delete":"삭제","git.modified":"수정됨","git.added":"추가됨","git.deleted":"삭제됨","git.renamed":"이름변경","git.copied":"복사됨","git.checkout":"체크아웃","git.mergeInto":"현재 브랜치로 병합","git.rebaseOnto":"현재 변경사항을 재배치","git.renameBranch":"브랜치 이름 변경","git.confirmDelete":"브랜치 {name}을(를) 삭제하시겠습니까?","git.newBranchName":"새 브랜치 이름...","git.rename":"이름 변경","git.checkoutRemote":"로컬 브랜치로 체크아웃","git.commitDetail":"커밋 상세","git.changedFiles":"변경된 파일","git.selectFileToViewDiff":"파일을 선택하면 차이를 볼 수 있습니다","git.noFilesChanged":"변경된 파일 없음","git.loadingFiles":"파일 불러오는 중...","git.loadingDiff":"차이 불러오는 중...","git.worktrees":"워크트리","git.cleanupWorktree":"정리","git.confirmCleanupWorktree":"워크트리와 브랜치 {name}을(를) 삭제하시겠습니까?","git.deleteWorktreeAndBranch":"브랜치 + 워크트리 삭제","git.confirmDeleteWorktreeAndBranch":"브랜치 {name}과(와) 연결된 워크트리를 함께 삭제할까요?","git.confirmForceDelete":"브랜치 {name}은(는) 어디에도 머지되지 않았습니다. 그래도 강제로 삭제할까요? 머지되지 않은 커밋은 사라집니다.","git.workspace":"워크스페이스","git.viewFileStatus":"파일 상태","git.viewHistory":"History","git.search":"Search","git.searchPlaceholder":"검색","git.stagedFiles":"스테이지에 올라간 파일","git.unstagedFiles":"스테이지에 올라가지 않은 파일","git.untrackedFiles":"추적 안 되는 파일","git.unstageAllShort":"모두 스테이지에서 내리기","git.unstageSelectedShort":"선택 내용 스테이지에서 내리기","git.stageAllShort":"모두 스테이지에 올리기","git.stageSelectedShort":"선택 내용 스테이지에 올리기","git.commitOptions":"커밋 옵션","git.pushImmediately":"커밋 후 {remote}에 즉시 푸시","git.amendLastCommit":"마지막 커밋 정정","git.commitButton":"커밋","git.selectFileForDiff":"파일을 선택하면 차이를 볼 수 있습니다","git.binaryFile":"바이너리 파일 (미리보기 불가)","git.untrackedNewFile":"(새 파일)","git.workingTreeClean":"작업 트리가 깨끗합니다 — 커밋할 변경사항이 없습니다","lang.toggle":"EN","theme.light":"라이트","theme.dark":"다크","notification.taskCompleted":"작업 완료","notification.taskFailed":"작업 실패","notification.discussionCompleted":"토론 완료","notification.discussionFailed":"토론 실패","notification.toggle":"알림 토글","notification.blocked":"브라우저에서 알림이 차단되었습니다"}},dw=k.createContext(null);function ej({children:e}){const[s,i]=k.useState(()=>{const f=localStorage.getItem("clitrigger-lang");return f==="ko"||f==="en"?f:"ko"}),a=k.useCallback(()=>{i(f=>{const o=f==="en"?"ko":"en";return localStorage.setItem("clitrigger-lang",o),o})},[]),h=k.useMemo(()=>Q2(),[]),m=k.useCallback(f=>Z2[s][f]??h[s][f]??f,[s,h]);return t.jsx(dw.Provider,{value:{lang:s,toggleLang:a,t:m},children:e})}function it(){const e=k.useContext(dw);if(!e)throw new Error("useI18n must be used within I18nProvider");return e}const gt=({className:e="",variant:s="text",width:i,height:a,count:h=1})=>{const m="animate-pulse bg-warm-200",f={text:"rounded h-3 mb-2 last:mb-0",circular:"rounded-full",rectangular:"rounded-none",rounded:"rounded-xl"},o={width:i,height:a},c=Array.from({length:h});return t.jsx(t.Fragment,{children:c.map((d,p)=>t.jsx("div",{className:`${m} ${f[s]} ${e}`,style:o},p))})};/**
|
|
67
|
+
취소 = 워크트리만 삭제`,"todo.retry":"재시도","todo.retryDesc":"이전 워크트리를 정리하고 처음부터 다시 실행합니다.","todo.retryFailed":"재시도 실패","todo.continue":"이어서","todo.continueDesc":"같은 워크트리에서 후속 프롬프트를 실행합니다.","todo.continuing":"이어가는 중...","todo.confirmContinue":"이어서 실행","todo.continuePromptLabel":"후속 프롬프트","todo.continuePromptPlaceholder":"이 워크트리에 적용할 다음 지시사항을 입력하세요...","todo.continuePromptRequired":"후속 프롬프트를 입력해주세요.","todo.roundLabel":"라운드","todo.dependsOn":"선행 작업","todo.mergedFrom":"이전 작업에서 병합","todo.transferredTo":"작업 이전됨","todo.schedule":"예약","todo.scheduleDesc":"특정 시간에 1회 실행되도록 루틴으로 변환합니다.","todo.scheduleAt":"실행 시각","todo.scheduling":"예약 중...","todo.confirmSchedule":"예약","todo.scheduleKeepOriginal":"원본 작업 유지","todo.scheduleOnReset":"리셋 시 실행","todo.scheduleOnResetDesc":"토큰 한도 리셋 시 자동으로 새 작업을 실행합니다.","todo.scheduleOnResetLabel":"리셋 시각","todo.resetPromptPlaceholder":"리셋 후 실행할 프롬프트를 입력하세요...","todo.confirmResetSchedule":"리셋 시 실행 예약","todoForm.titlePlaceholder":"작업 제목...","todoForm.descPlaceholder":"설명 (선택사항)...","todoForm.cliTool":"CLI 도구","todoForm.addImage":"이미지 추가","todoForm.pasteHint":"Ctrl+V로 이미지 붙여넣기","todoForm.images":"이미지","todoForm.maxTurns":"최대 턴 수","todoForm.maxTurnsPlaceholder":"제한 없음","todoForm.maxTurnsHint":"에이전트 턴 수를 제한하여 과도한 토큰 사용을 방지합니다.","todoForm.dependsOn":"선행 작업","todoForm.noDependency":"없음 (독립 작업)","todoForm.dependsOnHint":"선행 작업이 완료되면 변경사항을 스쿼시 머지하고 새 브랜치에서 실행됩니다.","todoForm.worktreeMode":"실행 브랜치","todoForm.worktreeInherit":"프로젝트 설정 따름","todoForm.worktreeForceOn":"워크트리 사용 (격리 브랜치)","todoForm.worktreeForceOff":"메인 브랜치에서 실행","todoForm.worktreeProjectDefaultOn":"프로젝트 기본: 워크트리","todoForm.worktreeProjectDefaultOff":"프로젝트 기본: 메인 브랜치","todoForm.worktreeMainWarning":"메인 브랜치에서 실행 시 다른 작업의 동시 실행이 차단됩니다.","todoForm.cancel":"취소","todoForm.save":"저장","dnd.dropHint":"이 작업 이후에 실행","dnd.removeDep":"의존성 제거","dnd.dropToRemoveDep":"여기에 놓으면 의존성 제거","dnd.cyclicWarning":"순환 의존성으로 연결할 수 없습니다","graph.autoLayout":"자동 정렬","graph.listView":"리스트 보기","graph.graphView":"그래프 보기","status.pending":"대기","status.running":"실행 중","status.completed":"완료","status.failed":"실패","status.stopped":"중지","status.merged":"병합됨","progress.complete":"완료","progress.done":"완료","progress.live":"실행 중","progress.idle":"대기","progress.fail":"실패","progress.stop":"중지","progress.merged":"병합됨","failure.title":"실패 원인","failure.exitCode":"종료 코드","failure.fix":"수정하기: 실패 원인을 분석하고 문제를 수정하는 새 작업을 생성합니다.","failure.fixPrefix":"[수정] ","result.duration":"소요 시간","result.commits":"커밋","result.filesChanged":"파일 변경","result.commitHistory":"커밋 이력","result.changedFiles":"변경된 파일","result.tokenUsage":"토큰 사용량","result.inputTokens":"입력","result.outputTokens":"출력","result.totalCost":"비용","result.cacheTokens":"캐시","result.turns":"턴","result.contextUsed":"사용","result.levelLight":"가벼움","result.levelModerate":"보통","result.levelHigh":"많음","result.levelHeavy":"과다","log.awaiting":"출력 대기 중...","log.waitingResponse":"응답 대기 중...","log.noChanges":"변경사항이 없습니다.","log.copy":"복사","log.copied":"복사됨!","log.viewChat":"대화","log.viewRaw":"원시","schedules.title":"루틴","schedules.add":"새 루틴","schedules.empty":"루틴이 없습니다","schedules.emptyHint":"반복 작업을 자동화할 루틴을 만들어보세요.","schedule.type":"루틴 유형","schedule.recurring":"반복","schedule.once":"1회","schedule.runAtLabel":"실행 시각","schedule.cronExpression":"실행 주기","schedule.cronHint":"예: */30 * * * * (30분마다), 0 9 * * * (매일 9시), 0 9 * * 1-5 (평일 9시)","cron.everyMinutes":"분 간격","cron.hourly":"매시간","cron.daily":"매일","cron.weekly":"매주","cron.monthly":"매월","cron.custom":"직접 입력","cron.every":"매","cron.minutesLabel":"분마다","cron.everyHourAt":"매시간","cron.minutesPast":"분에","cron.everyDayAt":"매일","cron.at":"시간","cron.everyMonthOn":"매월","cron.dayAt":"일","cron.expression":"Cron","cron.mon":"월","cron.tue":"화","cron.wed":"수","cron.thu":"목","cron.fri":"금","cron.sat":"토","cron.sun":"일","schedule.skipIfRunning":"이전 실행이 진행 중이면 건너뛰기","schedule.active":"활성","schedule.paused":"일시정지","schedule.lastRun":"마지막 실행","schedule.never":"없음","schedule.trigger":"즉시 실행","schedule.activate":"활성화","schedule.pause":"일시정지","schedule.edit":"편집","schedule.delete":"삭제","schedule.runs":"실행 이력","schedule.runTriggered":"실행됨","schedule.runSkipped":"건너뜀","schedule.runCompleted":"완료","schedule.runFailed":"실패","schedule.noRuns":"실행 이력이 없습니다","scheduleForm.titlePlaceholder":"루틴 제목...","scheduleForm.descPlaceholder":"작업 설명 템플릿...","scheduleForm.cliTool":"CLI 도구","scheduleForm.cancel":"취소","scheduleForm.save":"저장","jira.title":"Jira 이슈","jira.search":"이슈 검색...","jira.allStatuses":"모든 상태","jira.refresh":"새로고침","jira.import":"작업으로 가져오기","jira.importing":"가져오는 중...","jira.imported":"가져옴!","jira.noIssues":"이슈가 없습니다","jira.noIssuesHint":"필터나 검색어를 변경해보세요.","jira.loadMore":"더 보기","jira.total":"건","jira.transition":"상태 변경","jira.comment":"댓글","jira.commentPlaceholder":"댓글 입력...","jira.commentSend":"전송","jira.createIssue":"이슈 생성","jira.createSummary":"제목","jira.createDesc":"설명","jira.createType":"이슈 유형","jira.creating":"생성 중...","jira.notConfigured":"Jira가 설정되지 않았습니다. 프로젝트 설정에서 활성화하세요.","jira.assignee":"담당자","jira.unassigned":"미배정","jira.updated":"업데이트","notion.title":"Notion 페이지","notion.search":"페이지 검색...","notion.refresh":"새로고침","notion.import":"작업으로 가져오기","notion.importing":"가져오는 중...","notion.imported":"가져옴!","notion.noPages":"페이지가 없습니다","notion.noPagesHint":"검색어를 변경해보세요.","notion.loadMore":"더 보기","notion.createPage":"페이지 생성","notion.pageTitle":"제목","notion.creating":"생성 중...","notion.notConfigured":"Notion이 설정되지 않았습니다. 프로젝트 설정에서 활성화하세요.","notion.loadingContent":"콘텐츠 로딩 중...","notion.noContent":"콘텐츠 없음","header.notionTitle":"Notion 연동","header.notionApiKey":"통합 토큰","header.notionApiKeyPlaceholder":"ntn_...","header.notionDatabaseId":"데이터베이스 ID","header.notionDatabaseIdPlaceholder":"예: abc123def456...","header.notionTestConnection":"연결 테스트","header.notionTesting":"테스트 중...","header.notionConnected":"연결 성공","header.notionFailed":"연결 실패","header.notionTokenHint":"notion.so/my-integrations에서 통합을 생성하고 데이터베이스를 공유하세요","github.title":"GitHub 이슈","github.search":"이슈 검색...","github.refresh":"새로고침","github.import":"작업으로 가져오기","github.importing":"가져오는 중...","github.imported":"가져옴!","github.noIssues":"이슈가 없습니다","github.noIssuesHint":"필터나 검색어를 변경해보세요.","github.loadMore":"더 보기","github.createIssue":"이슈 생성","github.issueTitle":"제목","github.issueBody":"설명","github.creating":"생성 중...","github.notConfigured":"GitHub이 설정되지 않았습니다. 프로젝트 설정에서 활성화하세요.","github.loadingComments":"댓글 로딩 중...","github.comments":"댓글","github.noBody":"설명이 없습니다.","github.open":"열림","github.closed":"닫힘","github.all":"전체","header.githubTitle":"GitHub 연동","header.githubToken":"개인 액세스 토큰","header.githubTokenPlaceholder":"ghp_...","header.githubOwner":"저장소 소유자","header.githubOwnerPlaceholder":"사용자명 또는 조직","header.githubRepo":"저장소 이름","header.githubRepoPlaceholder":"repo-name","header.githubTestConnection":"연결 테스트","header.githubTesting":"테스트 중...","header.githubConnected":"연결 성공","header.githubFailed":"연결 실패","header.githubTokenHint":"github.com/settings/tokens에서 repo 권한으로 토큰을 생성하세요","tabs.automation":"자동화","tabs.automation.help":"자동 작업·토론·루틴을 한곳에서 관리합니다.","tabs.tasks":"자동 작업","tabs.sessions":"터미널","tabs.discussions":"토론","tabs.schedules":"루틴","tabs.jira":"Jira","tabs.notion":"Notion","tabs.github":"GitHub","tabs.git":"Git","tabs.svn":"SVN","tabs.files":"문서","tabs.planner":"플래너","tabs.wiki":"위키","tabs.analytics":"통계","tabs.wiki.help":"프로젝트 지식 그래프. 노드/엣지를 만들어 두면 자동 작업·토론 프롬프트에 <long_term_memory> 블록으로 주입돼서 LLM이 실행 간에도 맥락을 유지합니다.","tabs.planner.help":"가벼운 작업 메모. 태그·우선순위·이미지 첨부가 가능하고, 마음에 드는 항목은 자동 작업이나 루틴으로 변환하거나 Markdown으로 내보내기/가져오기 할 수 있습니다.","tabs.tasks.help":"할 일을 미리 쌓아두고 원할 때 한번에 돌릴 수 있는 작업 큐입니다. TODO를 여러 개 적어두면 각각 독립된 git worktree에서 Claude/Antigravity/Codex가 자동으로 실행하고, 동시 실행 한도까지 병렬로 처리합니다. 의존성 체이닝, 멀티 라운드 continue, 머지 자동화도 함께 처리됩니다.","tabs.sessions.help":"Claude/Antigravity/Codex를 플로팅 창에서 직접 조작하는 대화형 모드입니다. 자동 작업(fire-and-forget)과 달리 터미널은 계속 살아 있어서 실시간으로 입력하고 결과를 보면서 CLI를 직접 컨트롤할 수 있습니다.","tabs.discussions.help":"여러 AI 에이전트가 라운드별로 토론한 뒤 합의를 코드로 구현. 결과를 플래너 항목으로 추출할 수도 있습니다.","tabs.schedules.help":"cron 또는 일회성 예약으로 자동 작업을 트리거. 레이트 리밋 리셋 시점 자동 재시작도 지원합니다.","tabs.git.help":"워크스페이스 내장 Git 클라이언트. 파일 상태/커밋 그래프/브랜치 관리/diff 뷰어를 Fork·SourceTree 스타일 레이아웃으로 제공합니다.","tabs.svn.help":"내장 SVN 워킹카피 패널. 파일 상태/리비전 로그/diff 뷰어를 제공합니다.","svn.fileStatus":"파일 상태","svn.history":"히스토리","svn.unversioned":"버전 미관리","svn.changed":"변경됨","svn.groupByDir":"디렉터리로 그룹화","svn.viewFlat":"목록으로 보기","svn.dirFileCount":"{d}개 디렉터리 · {f}개 파일","svn.fileCount":"{f}개 파일","svn.workingCopyRev":"워킹카피 리비전","svn.update":"업데이트","svn.refresh":"새로고침","svn.add":"추가","svn.revert":"되돌리기","svn.delete":"삭제","svn.resolve":"충돌 해결","svn.commitMessagePlaceholder":"커밋 메시지를 입력하세요. 필수.","svn.commit":"커밋","svn.committing":"커밋 중...","svn.commitSuccess":"r{rev} 커밋 완료","svn.updating":"업데이트 중...","svn.updateSuccess":"r{rev}로 업데이트 완료","svn.noChanges":"로컬 변경사항 없음.","svn.selectFiles":"먼저 파일을 한 개 이상 선택하세요.","svn.notSvn":"SVN 워킹카피가 아닙니다.","svn.cliMissing":"svn CLI를 찾을 수 없습니다. 이 패널을 사용하려면 Subversion을 설치하세요.","svn.repoUrl":"저장소 URL","svn.relativePath":"경로","svn.viewsHeader":"보기","svn.actionsHeader":"명령","svn.checkForModifications":"로컬 변경 확인","svn.showLog":"로그 보기","svn.updateToRevision":"특정 리비전으로 업데이트…","svn.cleanup":"정리(Cleanup)","svn.checkRepository":"원격 변경 확인","svn.remoteBadge":"원격","svn.remoteHint":"SVN 서버에 접속합니다","svn.loadLog":"로그 불러오기","svn.logEmptyHint":"로그는 SVN 서버에서 가져옵니다. 자동으로 불러오지 않습니다.","svn.loadMore":"더 보기","svn.revision":"리비전","svn.revisionPlaceholder":"예: 1234 또는 HEAD","svn.cleaningUp":"정리 중…","svn.cleanupSuccess":"정리 완료","svn.checking":"확인 중…","svn.behindCount":"서버에 들어올 변경 {n}건","svn.upToDate":"서버와 동일","svn.resolveWorking":"해결 표시 (워킹카피 유지)","svn.resolveMine":"내 변경으로 해결","svn.resolveTheirs":"서버 변경으로 해결","svn.resolveBase":"기준본으로 해결","svn.viewDiff":"Diff 보기","svn.cancel":"취소","svn.properties":"속성(Properties)","svn.propertiesOf":"속성: {target}","svn.workingCopyRoot":"워킹카피 루트","svn.noProperties":"이 항목에 속성이 없습니다.","svn.editProperty":"수정","svn.saveProperty":"저장","svn.close":"닫기","svn.changelistDefault":"변경","svn.changelistUnversioned":"버전이 없는 파일","svn.changelistMissing":"로컬에서 삭제된 파일","svn.moveToChangelist":"변경 목록으로 이동","svn.newChangelist":"새 변경 목록…","svn.removeFromChangelist":"변경 목록에서 제거","svn.changelistNamePlaceholder":"변경 목록 이름","header.svnTitle":"SVN (Subversion)","header.svnHint":"기본값 OFF. 켜면 프로젝트에 .svn/ 워킹카피가 있는지 검사하고, 발견 시 SVN 탭이 표시됩니다.","header.svnEnable":"이 프로젝트에서 SVN 활성화","tabs.files.help":"마크다운 문서 위키 — 파일 트리 탐색, 노트 미리보기/편집, 그래프·백링크·개요·태그·검색 패널로 .md 파일 간 위키링크 탐색.","tabs.analytics.help":"실행 통계와 비용 분석. CLI별 토큰 사용량, 상태 분포, 일별 비용 추이를 차트로 시각화합니다.","files.root":"루트","files.empty":"빈 폴더","files.loading":"불러오는 중...","files.refresh":"새로고침","files.graph":"위키 그래프 — .md 파일 간 위키링크 연결 표시","files.showHidden":"숨김 파일 보기","files.hideHidden":"숨김 파일 숨기기","files.copyPath":"경로 복사","files.sendToTerminal":"터미널로 보내기","files.newTerminal":"새 터미널","files.includeLinks":"링크된 문서 포함","files.sendToTask":"작업으로 보내기","files.sentToTerminal":"터미널로 전송됨","files.noActiveSession":"열린 세션이 없습니다","files.taskCreated":"작업이 생성됨","files.taskCreateFailed":"작업 생성 실패","files.hide":"문서에서 숨기기","files.unhide":"문서에 다시 보이기","files.openInOS":"기본 앱으로 열기","files.revealInExplorer":"탐색기에서 보기","files.openFolder":"탐색기에서 폴더 열기","files.pin":"상단에 고정","files.unpin":"고정 해제","files.pinned":"고정됨","files.tooLarge":"미리보기를 표시하기엔 파일이 너무 큽니다 (최대 2MB).","files.binaryNotPreviewable":"바이너리 파일 — 미리보기 불가.","files.download":"다운로드","files.preview.empty":"파일을 선택해 미리보기를 확인하세요.","files.html.sandboxNotice":"안전 미리보기 — 스크립트와 외부 리소스가 차단되었습니다.","files.editor.edit":"편집","files.editor.save":"저장","files.editor.done":"완료","files.editor.saved":"저장됨","files.editor.saveFailed":"저장 실패","files.editor.conflict":"파일이 디스크에서 변경되었습니다 — 다시 열어주세요.","files.editor.discardConfirm":"변경사항을 폐기하시겠습니까?","files.editor.dirty":"변경됨","files.editor.draftRestored":"저장 안 된 편집 내용 복구됨","find.openFind":"찾기","find.placeholder":"찾을 내용","find.replacePlaceholder":"바꿀 내용","find.case":"대소문자 구분","find.word":"전체 단어 일치","find.regex":"정규식 사용","find.next":"다음 결과 (Enter)","find.prev":"이전 결과 (Shift+Enter)","find.replace":"바꾸기","find.replaceAll":"모두 바꾸기","find.close":"닫기 (Esc)","find.toggleReplace":"바꾸기 토글","find.noMatches":"결과 없음","annotate.start":"낙서 시작","annotate.stop":"낙서 종료","annotate.select":"선택","annotate.pen":"펜","annotate.highlighter":"형광펜","annotate.eraser":"지우개","annotate.color":"색상","annotate.undo":"되돌리기","annotate.redo":"다시 실행","annotate.clear":"모두 지우기","wiki.title":"위키","wiki.add":"새 항목","wiki.edit":"편집","wiki.delete":"삭제","wiki.save":"저장","wiki.saving":"저장 중...","wiki.cancel":"취소","wiki.empty":"아직 위키 항목이 없습니다","wiki.emptyHint":"LLM이 작업할 때 참고해야 할 노트, 컨벤션, 교훈을 추가하세요.","wiki.viewList":"목록","wiki.viewGraph":"그래프","wiki.viewHierarchical":"계층","wiki.viewNetwork":"네트워크","wiki.searchPlaceholder":"위키 검색...","wiki.backlinks":"백링크","wiki.addLink":"다른 항목 링크 추가","wiki.addLinkPlaceholder":"연결할 항목 검색…","wiki.connect.title":"어떻게 연결할까요?","wiki.connect.wikilink":"참조 (wikilink)","wiki.connect.wikilinkHint":"소스 본문에 [[대상 제목]]을 추가합니다. 자유로운 언급, 의미 관계 없음.","wiki.connect.edge":"관계 (타입드 엣지)","wiki.connect.edgeHint":"관계 타입(관련/선행/구체화 등)을 가진 엣지를 추가합니다.","wiki.allTags":"모든 태그","wiki.countLabel":"{count}개","wiki.deleteConfirm":"이 항목과 연결된 모든 관계를 삭제할까요?","wiki.noResults":"검색 결과 없음","wiki.noBody":"본문 없음","wiki.connections":"연결","wiki.outgoing":"나가는 연결","wiki.incoming":"들어오는 연결","wiki.autoLayout":"자동 정렬","wiki.form.newTitle":"새 항목","wiki.form.editTitle":"항목 편집","wiki.form.title":"제목","wiki.form.titlePlaceholder":"간결하고 명확한 제목","wiki.form.body":"본문 (Markdown 지원)","wiki.form.bodyPlaceholder":"LLM이 참고해야 할 지식이나 컨벤션을 작성하세요...","wiki.form.linkHint":"[[ 또는 @ 입력으로 다른 위키 항목을 링크하세요.","wiki.form.tags":"태그","wiki.form.tagsPlaceholder":"태그 입력 후 Enter","wiki.form.pinned":"고정 (강조 표시)","wiki.edge.editTitle":"연결 편집","wiki.edge.relationType":"관계 종류","wiki.edge.label":"라벨","wiki.edge.labelPlaceholder":'선택 메모 (예: "3.2절 참조")',"wiki.edge.deleteConfirm":"이 연결을 삭제할까요?","wiki.edge.relations.related":"관련","wiki.edge.relations.precedes":"선행","wiki.edge.relations.example_of":"예시","wiki.edge.relations.counter_example":"반례","wiki.edge.relations.refines":"구체화","vault.title":"문서","vault.empty":"마크다운 파일이 없습니다","vault.noResults":"일치하는 파일 없음","vault.searchPlaceholder":"파일 검색...","vault.graph.addLink":"여기서 링크 추가","vault.graph.linkHint":"연결할 대상 노드를 클릭하세요 · Esc 취소","vault.graph.showLabels":"이름 표시","vault.graph.rightClickHint":"우클릭 → 링크 추가","vault.newFile":"새 파일","vault.create":"만들기","vault.save":"저장","vault.delete":"삭제","vault.unsaved":"미저장","vault.confirmDelete":"{path} 파일을 삭제할까요?","vault.backlinks":"백링크","vault.filesCount":"개 파일","vault.panel.fileExplorer":"파일","vault.panel.search":"검색","vault.panel.tags":"태그","vault.panel.graph":"그래프","vault.panel.outline":"개요","vault.panel.backlinks":"백링크","vault.panel.outgoing":"아웃고잉 링크","vault.panel.preview":"미리보기","vault.outline.empty":"이 노트에 헤딩이 없습니다","vault.outgoing.empty":"아웃고잉 위키링크 없음","vault.backlinks.empty":"백링크 없음","vault.tags.empty":"문서에 태그 없음","vault.search.empty":"결과 없음","vault.search.prompt":".md 노트 검색","vault.activeFile.empty":"파일을 선택해 미리보기/편집하세요","vault.sidebar.collapse":"사이드바 접기","vault.sidebar.expand":"사이드바 펼치기","vault.loadError":"문서 목록을 불러오지 못했습니다","vault.retry":"다시 시도","vault.allHidden":'모든 문서가 .vaultignore로 숨김 상태입니다 — 파일 탐색기에서 우클릭 → "문서에 다시 보이기"로 해제하세요',"vault.ignoreHelp":".vaultignore 사용법","vaultInject.title":"문서 주입","vaultInject.modeNone":"사용 안 함","vaultInject.modeAuto":"자동","vaultInject.modeAll":"전체 주입","vaultInject.modeSelected":"선택 주입","vaultInject.autoHint":"실행 직전 LLM이 작업 설명을 기준으로 {count}개 파일 중 최대 10개를 골라 주입합니다.","vaultInject.previewToggle":"미리보기","vaultInject.previewChars":"{n}자","vaultInject.previewTokens":"약 {n} 토큰","vaultInject.empty":"프로젝트 루트에 .md/.html 파일이 없습니다.","vaultInject.injectedCount":"{count}개 파일 주입","vaultInject.allCount":"전체 {count}개 파일 주입","vaultInject.searchPlaceholder":"이름으로 필터...","vaultInject.loading":"불러오는 중...","vaultInject.includeLinked":"체크 시 1-hop 연결된 파일도 함께 선택","vaultInject.linkedAdded":"+{n}개 연결","vaultInject.noResults":"일치하는 파일 없음","wiki.ingest":"Ingest","wiki.ingest.title":"소스 자료 인제스트","wiki.ingest.tabTask":"태스크에서","wiki.ingest.tabDiscussion":"디스커션에서","wiki.ingest.tabText":"텍스트 붙여넣기","wiki.ingest.selectTask":"완료된 태스크 선택","wiki.ingest.selectDiscussion":"완료된 디스커션 선택","wiki.ingest.noTasks":"완료된 태스크가 없습니다","wiki.ingest.noDiscussions":"완료된 디스커션이 없습니다","wiki.ingest.textPlaceholder":"텍스트 붙여넣기 — 아티클, 노트, 채팅 기록 등에서 지식을 추출합니다...","wiki.ingest.run":"인제스트","wiki.ingest.running":"인제스트 중...","wiki.ingest.success":"{created}개 생성, {updated}개 갱신, 엣지 {edges}개 추가","wiki.ingest.parseFailed":"LLM 응답을 JSON 으로 해석하지 못했습니다 — 변경 사항 없음.","wiki.ingest.modelEmpty":"LLM 이 추가할 만한 새 내용이 없다고 판단했습니다 — 제안 0건.","wiki.ingest.allSkipped":"제안된 항목이 모두 스킵되었습니다 — 아래 사유를 확인하세요.","wiki.ingest.proposed":"LLM 제안: 생성 {c}, 갱신 {u}, 엣지 {e}","wiki.ingest.skipNote":"스킵됨","wiki.ingest.skip.duplicate":"이미 존재하는 제목","wiki.ingest.skip.unique":"DB UNIQUE 충돌","wiki.ingest.skip.empty":"제목 없음","wiki.ingest.skip.badId":"갱신 대상 id 가 유효하지 않음","wiki.ingest.skip.badEdge":"엣지 양 끝 노드를 찾을 수 없음","wiki.ingest.skip.selfEdge":"자기 자신을 가리키는 엣지","wiki.ingest.skip.edgeUnique":"엣지 UNIQUE 충돌","wiki.ingest.rawSnippet":"원본 응답 일부 보기","wiki.ingest.toast.success":"{source} → 위키 업데이트: {created}개 생성, {updated}개 갱신, 엣지 {edges}개","wiki.ingest.toast.empty":"{source} → 위키 인제스트: 추가할 새 내용 없음","wiki.ingest.toast.parseFailed":"{source} → 위키 인제스트: LLM 응답 파싱 실패","wiki.ingest.toast.failed":"위키 자동 인제스트 실패","wiki.schemaSection":"스키마","wiki.schemaSectionHint":"Ingest가 사용하는 항목 종류와 규칙을 정의합니다. 프로젝트에 맞게 편집하세요.","wiki.schemaBannerTitle":"위키 스키마","wiki.schemaBannerHint":"여기를 편집하면 Ingest 시 LLM이 새 항목을 분류하는 방식이 바뀝니다. 삭제하면 기본값으로 재생성됩니다.","wiki.systemSection":"시스템","wiki.systemSectionHint":"Ingest 동작과 빠른 탐색을 지원하는 자동 유지 항목들입니다.","wiki.indexBannerTitle":"위키 인덱스","wiki.indexBannerHint":"위키 변경 시마다 자동 재생성됩니다. 수동 편집은 덮어써집니다 — 삭제 시 다음 변경 때 재생성됩니다.","wiki.asset.uploading":"이미지 업로드 중…","wiki.asset.tooLarge":"이미지가 너무 큽니다 (최대 10MB)","wiki.diskDiff.button":"디스크 비교","wiki.diskDiff.tooltip":"내보낸 위키 파일과 DB 비교","wiki.diskDiff.title":"위키 vs .clitrigger/wiki/","wiki.diskDiff.intro":"읽기 전용 — DB가 export할 내용과 디스크 파일이 다른 것만 보여줍니다. Obsidian 등에서 편집한 내용이 여기 나타납니다. Rebuild는 디스크를 현재 DB 상태로 덮어씁니다.","wiki.diskDiff.running":"비교 중…","wiki.diskDiff.empty":"디스크와 DB가 일치합니다.","wiki.diskDiff.refresh":"다시 비교","wiki.diskDiff.close":"닫기","wiki.diskDiff.section.modified":"디스크에서 수정됨 ({n})","wiki.diskDiff.section.missing":"디스크에 없음 ({n})","wiki.diskDiff.section.untracked":"추적되지 않는 디스크 파일 ({n})","wiki.diskDiff.rebuild":"DB 기준으로 재생성","wiki.diskDiff.rebuildTooltip":"현재 DB 상태로 wiki/ 폴더를 덮어씁니다. 디스크의 편집 내용은 사라집니다.","wiki.diskDiff.rebuildConfirm":"wiki/ 폴더를 현재 DB 상태로 덮어쓸까요? 디스크의 편집 내용은 사라집니다.","wiki.diskDiff.rebuildResult":"재생성됨: {written}개 작성, {removed}개 삭제","wiki.lint":"Lint","wiki.lint.title":"위키 건강 검사","wiki.lint.running":"검사 중...","wiki.lint.empty":"위키가 건강합니다 — 이슈 없음.","wiki.lint.close":"닫기","wiki.lint.rerun":"다시 검사","wiki.lint.mergeConfirm":'"{absorb}"을(를) "{keep}"에 병합할까요? 본문 결합, 태그 합집합, 엣지/위키링크 재배선 후 "{absorb}"이 삭제됩니다.',"wiki.lint.action.mergeKeep":'"{keep}" 유지, "{absorb}" 병합',"wiki.lint.action.delete":"삭제","wiki.lint.action.deleteTitle":'"{title}" 삭제',"wiki.lint.action.link":"연결","wiki.lint.action.linkTo":"연결 대상…","wiki.sourceAutoLabel":"자동","wiki.viewRaw":"Raw 원본 보기","wiki.loading":"불러오는 중...","wiki.close":"닫기","wiki.subTab.wiki":"위키","wiki.subTab.sources":"원본","wiki.subTab.activity":"활동","wiki.activity.empty":"아직 활동 없음","wiki.activity.emptyHint":"Ingest, Lint, Retrieve, Merge 이벤트가 여기 기록됩니다.","wiki.activity.refresh":"새로고침","wiki.activity.filter.all":"전체","wiki.activity.filter.ingest":"인제스트","wiki.activity.filter.lint":"Lint","wiki.activity.filter.retrieve":"검색","wiki.activity.filter.merge":"병합","wiki.sources.empty":"사이드바에서 raw 파일을 선택하세요.","wiki.sources.noFiles":"아직 raw 파일이 없습니다 — Ingest를 실행하세요.","wiki.rawFile.derivedTitle":"이 원본에서 파생된 항목","wiki.rawFile.noDerived":"이 원본에서 파생된 항목 없음","wiki.rawFile.openSiblings":"이 원본에서 파생된 {n}개 항목 보기","wiki.rawFile.openExternal":"기본 앱으로 열기","wiki.rawFile.revealInFolder":"폴더에서 보기","wiki.rawFile.delete":"원본 삭제","wiki.rawFile.deleteConfirm":"이 원본 파일을 삭제할까요? 위키 노드는 유지됩니다.","wiki.rawFile.deleteConfirmDerived":"이 원본 파일을 삭제하고 파생된 {n}개 위키 노드의 source 링크를 끊을까요? 노드 자체는 유지됩니다.","planner.title":"플래너","planner.add":"새 항목","planner.view.pages":"페이지","planner.view.all":"전체 보기","planner.nav.calendar":"달력","planner.nav.list":"목록","planner.block.tasklist":"할일 목록","planner.block.calendar":"캘린더","planner.block.addTask":"작업 추가…","planner.pages.newTemplate":"새 페이지 — 템플릿 선택","planner.tpl.blank":"빈 페이지","planner.tpl.blank.desc":"빈 페이지에서 시작","planner.tpl.meeting":"회의 노트","planner.tpl.meeting.desc":"날짜·참석자·안건·액션 아이템","planner.tpl.project":"프로젝트 플랜","planner.tpl.project.desc":"개요·마일스톤·일정","planner.tpl.weekly":"위클리 플래너","planner.tpl.weekly.desc":"주간 목표·할 일·캘린더","planner.pages.new":"새 페이지","planner.pages.untitled":"제목 없음","planner.pages.empty":"페이지가 없습니다","planner.pages.emptyHint":"메모·문서·체크리스트를 자유롭게 작성할 페이지를 만드세요.","planner.pages.deleteConfirm":"이 페이지를 삭제할까요? 되돌릴 수 없습니다.","planner.pages.saving":"저장 중…","planner.pages.saved":"저장됨","planner.empty":"플래너 항목이 없습니다","planner.emptyHint":"아이디어, 작업, 계획을 플래너에 추가하세요.","planner.filterTag":"모든 태그","planner.filterStatus":"모든 상태","planner.col.title":"제목","planner.col.tags":"태그","planner.col.dueDate":"마감일","planner.col.status":"상태","planner.col.actions":"","planner.edit":"수정","planner.delete":"삭제","planner.deleteConfirm":"이 플래너 항목을 삭제하시겠습니까?","planner.convertToTask":"작업으로 변환","planner.convertToSchedule":"루틴으로 변환","planner.convertToTerminal":"터미널로 보내기","planner.movedToTodo":"작업으로 이동됨","planner.movedToSchedule":"루틴으로 이동됨","planner.movedToSession":"터미널로 이동됨","planner.fromDiscussion":"토론에서","planner.noDueDate":"—","planner.export":"내보내기","planner.exportTooltip":"플래너 항목을 Markdown 파일로 내보내기","planner.exportError":"내보내기 실패","planner.import":"가져오기","planner.importTooltip":"Markdown 파일에서 플래너 항목 가져오기","planner.importSuccess":"{items}개 항목과 {tags}개 태그를 가져왔습니다.","planner.importError":"가져오기 실패","planner.importInvalidMarkdown":"파일이 비어 있거나 유효한 Markdown이 아닙니다","planner.importNoImages":"참고: 이미지는 내보낸 파일에 포함되지 않습니다.","planner.dropHint":"여기에 Markdown 파일을 놓아 가져오기","planner.dropHintSub":".md 또는 .markdown","planner.dropInvalidFile":"Markdown 파일(.md / .markdown)만 가져올 수 있습니다","plannerForm.titlePlaceholder":"플래너 항목 제목...","plannerForm.descPlaceholder":"설명 또는 세부 사항...","plannerForm.tags":"태그","plannerForm.tagsPlaceholder":"태그를 입력하고 Enter를 누르세요","plannerForm.dueDate":"마감일","plannerForm.priority":"우선순위","plannerForm.priorityLow":"낮음","plannerForm.priorityNormal":"보통","plannerForm.priorityHigh":"높음","plannerForm.priorityCritical":"긴급","plannerForm.status":"상태","plannerForm.addImage":"이미지 추가","plannerForm.pasteHint":"Ctrl+V로 이미지 붙여넣기","plannerForm.images":"이미지","plannerForm.cancel":"취소","plannerForm.save":"저장","plannerStatus.pending":"대기","plannerStatus.in_progress":"진행 중","plannerStatus.done":"완료","plannerStatus.moved":"이동됨","plannerConvert.toTask":"작업으로 변환","plannerConvert.toSchedule":"루틴으로 변환","plannerConvert.toTerminal":"터미널로 보내기","plannerConvert.useWorktree":"git worktree 사용","plannerConvert.cliTool":"CLI 도구","plannerConvert.maxTurns":"최대 턴","plannerConvert.scheduleType":"루틴 유형","plannerConvert.recurring":"반복","plannerConvert.once":"일회성","plannerConvert.cronExpression":"Cron 표현식","plannerConvert.runAt":"실행 시각","plannerConvert.cancel":"취소","plannerConvert.convert":"변환","plannerTag.selectOrCreate":"옵션 선택 또는 생성","plannerTag.delete":"삭제","plannerTag.deleteConfirm":"이 태그를 모든 항목에서 제거하시겠습니까?","plannerTag.color":"색","plannerTag.rename":"이름 변경","plannerTag.color.default":"기본","plannerTag.color.gray":"회색","plannerTag.color.brown":"갈색","plannerTag.color.orange":"주황색","plannerTag.color.yellow":"노란색","plannerTag.color.green":"초록색","plannerTag.color.blue":"파란색","plannerTag.color.purple":"보라색","plannerTag.color.pink":"분홍색","plannerTag.color.red":"빨간색","session.new":"새 터미널","session.windowState.floating":"열림","session.windowState.minimized":"최소화","session.windowState.popped":"별도 창","session.recallToMain":"중앙으로 불러오기","session.restoreWindow":"창 복원","session.focusWindow":"창으로 이동","session.openWindow":"터미널 열기","session.dock.poppedHint":"별도 창 — 클릭하면 창을 앞으로 가져옵니다","session.title":"터미널 제목","session.description":"초기 프롬프트 (선택)","session.start":"시작","session.stop":"중지","session.resume":"이어서 시작","session.resumeHint":"이 워크트리의 직전 Claude 대화에 이어서 시작합니다","session.delete":"삭제","session.edit":"편집","session.editDisabledRunning":"실행 중에는 편집할 수 없습니다","session.save":"저장","session.saving":"저장 중…","session.empty":"터미널이 없습니다","session.emptyHint":"대화형 AI 터미널을 시작하세요.","session.create":"터미널 생성","session.cliTool":"CLI 도구","session.cliNotInstalled":" (설치 안 됨)","session.worktree":"워크트리 사용 (격리된 브랜치)","session.cleanup":"워크트리 삭제","session.startInWindow":"시작","session.starting":"시작하는 중…","session.starting.typeAhead":"미리 입력한 내용은 터미널 준비가 끝나면 그대로 전송됩니다","session.stopping":"중지하는 중…","session.startFailed":"시작 실패","session.confirmStop":"이 터미널을 종료할까요? 진행 중인 작업이 종료됩니다.","session.minimize":"최소화","session.fontDecrease":"글자 작게","session.refresh":"새로고침","session.refresh.hint":"터미널 화면만 다시 그립니다 (PTY는 그대로 유지)","session.initialPrompt.ready":"보낼 준비된 초기 프롬프트","session.initialPrompt.preview":"미리보기","session.initialPrompt.hidePreview":"숨기기","session.initialPrompt.send":"보내기","session.initialPrompt.skip":"건너뛰기","session.initialPrompt.loading":"불러오는 중…","session.initialPrompt.blocked":"타이핑하려면 보내기 또는 건너뛰기를 먼저 눌러주세요. 그 전엔 입력이 무시됩니다.","session.fontIncrease":"글자 크게","group.closeTab":"탭 닫기","group.newTab":"쉘 탭 새로 열기","analytics.title":"실행 통계","analytics.loading":"통계 로딩 중...","analytics.noData":"데이터 없음","analytics.totalTasks":"총 작업","analytics.successRate":"성공률","analytics.totalCost":"총 비용","analytics.totalTokens":"총 토큰","analytics.avgPerTask":"작업당 평균","analytics.byStatus":"상태별","analytics.byCliTool":"CLI 도구별","analytics.dailyActivity":"일별 활동","analytics.dailyCost":"일별 비용","analytics.costBreakdown":"비용 요약","analytics.tasks":"작업","analytics.period.7d":"7일","analytics.period.30d":"30일","analytics.period.90d":"90일","analytics.period.all":"전체","discussions.title":"에이전트 토론","discussions.add":"새 토론","discussions.empty":"아직 토론이 없습니다","discussions.emptyHint":"에이전트들이 피쳐를 함께 토론하도록 새 토론을 만드세요.","discussions.round":"라운드","discussions.maxRounds":"최대 라운드","discussions.agents":"에이전트","discussions.speaking":"발언 중...","discussions.inject":"메시지 전송","discussions.skipTurn":"턴 건너뛰기","discussions.implement":"구현 시작","discussions.implementHint":"토론된 기능을 구현할 에이전트를 선택하세요.","discussions.selectAgent":"구현 에이전트 선택","discussions.toPlanner":"Planner로 보내기","discussions.extractTitle":"액션 아이템 추출","discussions.extractHint":"AI가 토론에서 추출한 Planner 항목입니다. 저장 전에 편집하거나 제외하거나 우선순위를 조정하세요.","discussions.extractLoading":"토론에서 액션 아이템을 추출하는 중…","discussions.extractLoadingHint":"최대 2분 정도 걸릴 수 있어요. 추출이 끝날 때까지 창이 닫히지 않습니다.","discussions.extractEmpty":"추출할 액션 아이템이 없습니다. 다른 토론을 시도하거나 합의된 내용을 보강해 보세요.","discussions.extractConfirm":"Planner에 저장","discussions.extractSaving":"저장 중…","discussions.priorityLow":"낮음","discussions.priorityMedium":"보통","discussions.priorityHigh":"높음","discussions.priorityUrgent":"긴급","discussions.notFound":"토론을 찾을 수 없습니다","discussions.back":"토론 목록으로","discussions.userMessage":"메시지를 입력하세요...","discussions.implementation":"구현","discussions.resume":"재개","discussions.retry":"다시 실행","discussions.failureTitle":"토론 실패","discussions.noErrorLogs":"에러 상세 정보가 없습니다","discussions.pause":"일시 중지","discussions.waiting":"대기 중...","discussions.roundExplain":"에이전트 전원이 한 번씩 발언하는 단위입니다.","discussions.autoImplement":"토론 후 자동 구현","discussions.autoImplementHint":"모든 라운드 완료 후 자동으로 구현을 시작합니다.","discussions.collapse":"접기","discussions.expand":"펼치기","discussions.collapseAll":"전체 접기","discussions.expandAll":"전체 펼치기","status.skipped":"건너뜀","status.paused":"일시 중지","agents.title":"에이전트 페르소나","agents.add":"에이전트 추가","agents.name":"이름","agents.role":"역할","agents.systemPrompt":"시스템 프롬프트","agents.cliTool":"CLI 도구","agents.color":"색상","agents.empty":"에이전트가 없습니다. 토론을 시작하려면 에이전트 페르소나를 만드세요.","agents.manage":"에이전트 관리","agents.presets":"프리셋 템플릿","agents.roles.architect":"아키텍트","agents.roles.developer":"개발자","agents.roles.reviewer":"리뷰어","agents.roles.pm":"PM","agents.roles.tester":"테스터","agents.roles.custom":"사용자 정의","agents.canImplement":"토론 중 구현 수행","agents.canImplementHelp":"이 에이전트의 턴에서 발언뿐 아니라 실제 코드 작성·커밋까지 수행합니다. 개발자 역할 에이전트가 아이디어를 즉석에서 시연하도록 할 때 유용합니다.","agents.canImplementBadge":"구현자","git.ahead":"앞섬","git.behind":"뒤처짐","git.staged":"스테이징","git.unstaged":"변경됨","git.noChanges":"작업 트리 깨끗","git.refresh":"새로고침","git.files":"파일","git.commitHistory":"커밋 히스토리","git.branches":"브랜치","git.remotes":"원격","git.tags":"태그","git.stashes":"스태시","git.noCommits":"아직 커밋이 없습니다","git.loadMore":"더 불러오는 중...","git.author":"작성자","git.hash":"해시","git.graph":"그래프","git.description":"설명","git.date":"날짜","git.commit":"커밋","git.pull":"Pull","git.push":"Push","git.pushDialog.targetRemote":"다음 저장소에 푸시","git.pushDialog.branchesHeader":"푸시할 브랜치","git.pushDialog.colPush":"푸시?","git.pushDialog.colLocal":"로컬 브랜치","git.pushDialog.colRemote":"리모트 브랜치","git.pushDialog.colTracking":"추적?","git.pushDialog.selectAll":"모두 선택","git.pushDialog.allTags":"모든 태그 푸시","git.pushDialog.force":"강제 푸시","git.pushDialog.forceHint":"--force-with-lease 사용 (마지막 fetch 이후 원격이 진행되었으면 거부).","git.pushDialog.submit":"Push","git.pushDialog.cancel":"취소","git.pushDialog.pushing":"푸시 중…","git.pushDialog.loading":"불러오는 중…","git.pushDialog.errorRequireBranch":"푸시할 브랜치를 하나 이상 선택하세요.","git.pushDialog.noLocalBranches":"로컬 브랜치가 없습니다.","git.pushDialog.newBranch":"신규","git.pushDialog.customRemote":"직접 입력…","git.fetch":"패치","git.branch":"브랜치","git.merge":"병합","git.stash":"스태시","git.discard":"폐기","git.tag":"태그","git.untracked":"추적 안 됨","git.fileStatus":"파일 상태","git.stageAll":"모두 스테이지","git.unstageAll":"모두 언스테이지","git.stage":"스테이지","git.unstage":"언스테이지","git.commitMessage":"커밋 메시지...","git.branchName":"브랜치 이름...","git.tagName":"태그 이름...","git.tagMessage":"태그 메시지 (선택)...","git.stashMessage":"스태시 메시지 (선택)...","git.selectBranch":"브랜치 선택...","git.discardAll":"모두 폐기","git.confirmDiscard":"모든 변경 사항을 폐기하시겠습니까? 되돌릴 수 없습니다.","git.confirmDiscardFile":"이 파일의 변경 사항을 폐기하시겠습니까?","git.newBranch":"새 브랜치","git.deleteBranch":"브랜치 삭제","git.stashPop":"꺼내기","git.noStashes":"스태시 없음","git.actions":"작업","git.close":"닫기","git.create":"생성","git.delete":"삭제","git.modified":"수정됨","git.added":"추가됨","git.deleted":"삭제됨","git.renamed":"이름변경","git.copied":"복사됨","git.checkout":"체크아웃","git.mergeInto":"현재 브랜치로 병합","git.rebaseOnto":"현재 변경사항을 재배치","git.renameBranch":"브랜치 이름 변경","git.confirmDelete":"브랜치 {name}을(를) 삭제하시겠습니까?","git.newBranchName":"새 브랜치 이름...","git.rename":"이름 변경","git.checkoutRemote":"로컬 브랜치로 체크아웃","git.commitDetail":"커밋 상세","git.changedFiles":"변경된 파일","git.selectFileToViewDiff":"파일을 선택하면 차이를 볼 수 있습니다","git.noFilesChanged":"변경된 파일 없음","git.loadingFiles":"파일 불러오는 중...","git.loadingDiff":"차이 불러오는 중...","git.worktrees":"워크트리","git.cleanupWorktree":"정리","git.confirmCleanupWorktree":"워크트리와 브랜치 {name}을(를) 삭제하시겠습니까?","git.deleteWorktreeAndBranch":"브랜치 + 워크트리 삭제","git.confirmDeleteWorktreeAndBranch":"브랜치 {name}과(와) 연결된 워크트리를 함께 삭제할까요?","git.confirmForceDelete":"브랜치 {name}은(는) 어디에도 머지되지 않았습니다. 그래도 강제로 삭제할까요? 머지되지 않은 커밋은 사라집니다.","git.workspace":"워크스페이스","git.viewFileStatus":"파일 상태","git.viewHistory":"History","git.search":"Search","git.searchPlaceholder":"검색","git.stagedFiles":"스테이지에 올라간 파일","git.unstagedFiles":"스테이지에 올라가지 않은 파일","git.untrackedFiles":"추적 안 되는 파일","git.unstageAllShort":"모두 스테이지에서 내리기","git.unstageSelectedShort":"선택 내용 스테이지에서 내리기","git.stageAllShort":"모두 스테이지에 올리기","git.stageSelectedShort":"선택 내용 스테이지에 올리기","git.commitOptions":"커밋 옵션","git.pushImmediately":"커밋 후 {remote}에 즉시 푸시","git.amendLastCommit":"마지막 커밋 정정","git.commitButton":"커밋","git.selectFileForDiff":"파일을 선택하면 차이를 볼 수 있습니다","git.binaryFile":"바이너리 파일 (미리보기 불가)","git.untrackedNewFile":"(새 파일)","git.workingTreeClean":"작업 트리가 깨끗합니다 — 커밋할 변경사항이 없습니다","lang.toggle":"EN","theme.light":"라이트","theme.dark":"다크","notification.taskCompleted":"작업 완료","notification.taskFailed":"작업 실패","notification.discussionCompleted":"토론 완료","notification.discussionFailed":"토론 실패","notification.toggle":"알림 토글","notification.blocked":"브라우저에서 알림이 차단되었습니다"}},dw=k.createContext(null);function ej({children:e}){const[s,i]=k.useState(()=>{const f=localStorage.getItem("clitrigger-lang");return f==="ko"||f==="en"?f:"ko"}),a=k.useCallback(()=>{i(f=>{const o=f==="en"?"ko":"en";return localStorage.setItem("clitrigger-lang",o),o})},[]),h=k.useMemo(()=>Q2(),[]),m=k.useCallback(f=>Z2[s][f]??h[s][f]??f,[s,h]);return t.jsx(dw.Provider,{value:{lang:s,toggleLang:a,t:m},children:e})}function it(){const e=k.useContext(dw);if(!e)throw new Error("useI18n must be used within I18nProvider");return e}const gt=({className:e="",variant:s="text",width:i,height:a,count:h=1})=>{const m="animate-pulse bg-warm-200",f={text:"rounded h-3 mb-2 last:mb-0",circular:"rounded-full",rectangular:"rounded-none",rounded:"rounded-xl"},o={width:i,height:a},c=Array.from({length:h});return t.jsx(t.Fragment,{children:c.map((d,p)=>t.jsx("div",{className:`${m} ${f[s]} ${e}`,style:o},p))})};/**
|
|
68
68
|
* @license lucide-react v1.8.0 - ISC
|
|
69
69
|
*
|
|
70
70
|
* This source code is licensed under the ISC license.
|
|
@@ -584,7 +584,7 @@ Cancel = delete worktree only`,"todo.retry":"Retry","todo.retryDesc":"Cleans up
|
|
|
584
584
|
*
|
|
585
585
|
* This source code is licensed under the ISC license.
|
|
586
586
|
* See the LICENSE file in the root directory of this source tree.
|
|
587
|
-
*/const ON=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],zN=st("zoom-out",ON);function BN({onLogin:e}){const[s,i]=k.useState(""),[a,h]=k.useState(!1),[m,f]=k.useState(""),[o,c]=k.useState(!1),{t:d,toggleLang:p}=it(),u=async v=>{if(v.preventDefault(),!!s){f(""),c(!0);try{await e(s,a)}catch{f(d("login.error"))}finally{c(!1)}}};return t.jsxs("div",{className:"min-h-screen bg-theme-bg flex items-center justify-center px-4 relative",children:[t.jsx("button",{onClick:p,className:"lang-toggle absolute top-6 right-6",children:d("lang.toggle")}),t.jsxs("div",{className:"w-full max-w-sm animate-fade-in",children:[t.jsxs("div",{className:"text-center mb-10",children:[t.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-accent/10 mb-5",children:t.jsx(rl,{size:32,className:"text-accent",strokeWidth:1.5})}),t.jsx("h1",{className:"text-2xl font-semibold text-theme-text",children:d("login.title")}),t.jsx("p",{className:"text-theme-muted text-sm mt-2",children:d("login.subtitle")})]}),t.jsx("form",{onSubmit:u,children:t.jsxs("div",{className:"card p-8",children:[t.jsx("label",{className:"block text-sm font-medium text-theme-text-secondary mb-2",children:d("login.password")}),t.jsx("input",{type:"password",value:s,onChange:v=>i(v.target.value),placeholder:"*************",className:"input-field text-base",autoFocus:!0}),m&&t.jsx("div",{className:"mt-4 py-2.5 px-4 bg-status-error/5 border border-status-error/20 rounded-xl text-sm text-status-error",children:m}),t.jsxs("label",{className:"flex items-center gap-2 mt-5 text-sm text-theme-text-secondary cursor-pointer select-none",children:[t.jsx("input",{type:"checkbox",checked:a,onChange:v=>h(v.target.checked),className:"accent-accent w-4 h-4"}),d("login.rememberMe")]}),t.jsx("button",{type:"submit",disabled:!s||o,className:"btn-primary w-full mt-6 py-3",children:d(o?"login.loading":"login.submit")})]})}),t.jsx("div",{className:"mt-6 text-center text-xs text-theme-text-tertiary",children:d("login.footer")}),t.jsx("div",{className:"mt-4 px-2 py-3 rounded-xl text-xs text-theme-text-tertiary border leading-relaxed text-center",children:d("login.disclaimer")})]})]})}const Nv=8;function PN({onSetup:e}){const[s,i]=k.useState(""),[a,h]=k.useState(""),[m,f]=k.useState(""),[o,c]=k.useState(!1),{t:d,toggleLang:p}=it(),u=s.length>0&&s.length<Nv,v=a.length>0&&s!==a,b=s.length>=Nv&&s===a&&!o,C=async w=>{if(w.preventDefault(),!!b){f(""),c(!0);try{await e(s,a)}catch(x){f(x instanceof Error&&x.message?x.message:d("setup.error"))}finally{c(!1)}}};return t.jsxs("div",{className:"min-h-screen bg-theme-bg flex items-center justify-center px-4 relative",children:[t.jsx("button",{onClick:p,className:"lang-toggle absolute top-6 right-6",children:d("lang.toggle")}),t.jsxs("div",{className:"w-full max-w-sm animate-fade-in",children:[t.jsxs("div",{className:"text-center mb-10",children:[t.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-accent/10 mb-5",children:t.jsx(rl,{size:32,className:"text-accent",strokeWidth:1.5})}),t.jsx("h1",{className:"text-2xl font-semibold text-theme-text",children:d("setup.title")}),t.jsx("p",{className:"text-theme-muted text-sm mt-2",children:d("setup.subtitle")})]}),t.jsx("form",{onSubmit:C,children:t.jsxs("div",{className:"card p-8",children:[t.jsx("label",{className:"block text-sm font-medium text-theme-text-secondary mb-2",children:d("setup.password")}),t.jsx("input",{type:"password",value:s,onChange:w=>i(w.target.value),placeholder:"*************",className:"input-field text-base",autoFocus:!0}),u&&t.jsx("p",{className:"mt-1 text-2xs text-status-error",children:d("setup.tooShort")}),t.jsx("label",{className:"block text-sm font-medium text-theme-text-secondary mb-2 mt-5",children:d("setup.confirm")}),t.jsx("input",{type:"password",value:a,onChange:w=>h(w.target.value),placeholder:"*************",className:"input-field text-base"}),v&&t.jsx("p",{className:"mt-1 text-2xs text-status-error",children:d("setup.mismatch")}),m&&t.jsx("div",{className:"mt-4 py-2.5 px-4 bg-status-error/5 border border-status-error/20 rounded-xl text-sm text-status-error",children:m}),t.jsx("button",{type:"submit",disabled:!b,className:"btn-primary w-full mt-6 py-3",children:d(o?"setup.loading":"setup.submit")})]})}),t.jsx("div",{className:"mt-4 px-4 py-3 rounded-xl text-xs text-theme-text-tertiary border leading-relaxed text-center",children:d("setup.tunnelPaused")})]})]})}function IN(e){return nt("/api/projects/browse",{initialPath:e})}function HN(e){return nt("/api/projects/open-folder",{path:e})}function Lu(){return ut("/api/projects")}function FN(e){return ut(`/api/projects/${e}`)}function Sw(e){return nt("/api/projects",e)}function $N(e){return ut(`/api/projects/${e}/svn-detect`)}function Kf(e,s){return nn(`/api/projects/${e}`,s)}function UN(e,s){const i=s?`?todoId=${encodeURIComponent(s)}`:"";return ut(`/api/projects/${e}/debug-logs${i}`)}function kw(e){return Bn(`/api/projects/${e}`)}function WN(e){return nt("/api/projects/reorder",{ids:e})}function GN(e){return nt(`/api/projects/${e}/start`)}function qN(e){return nt(`/api/projects/${e}/stop`)}function Cw(e){return ut(`/api/projects/${e}/status`)}function KN(e){return nt(`/api/projects/${e}/check-git`)}function jw(e,s){return ut(`/api/projects/${e}/git-status`)}function VN(e,s=0,i=50,a){const h=new URLSearchParams({skip:String(s),limit:String(i)});return ut(`/api/projects/${e}/git-log?${h}`)}function Vf(e,s){return ut(`/api/projects/${e}/git-refs`)}function YN(e,s){return nt(`/api/projects/${e}/git-stage`,{files:s})}function XN(e,s){return nt(`/api/projects/${e}/git-unstage`,{files:s})}function Nw(e,s){return nt(`/api/projects/${e}/git-commit`,{message:s})}function Ew(e,s,i){return nt(`/api/projects/${e}/git-pull`,{remote:s,branch:i})}function Pm(e,s){return nt(`/api/projects/${e}/git-push`,s||{})}function JN(e){return ut(`/api/projects/${e}/git-remotes`)}function Tw(e,s,i){return nt(`/api/projects/${e}/git-fetch`,{remote:s,prune:i})}function QN(e,s,i){return nt(`/api/projects/${e}/git-branch`,{name:s,startPoint:i})}function Yf(e,s,i){return nt(`/api/projects/${e}/git-branch-delete`,{name:s,force:i})}function Xf(e,s){return nt(`/api/projects/${e}/git-checkout`,{branch:s})}function Lw(e,s){return nt(`/api/projects/${e}/git-merge`,{branch:s})}function ZN(e,s){return nt(`/api/projects/${e}/git-stash`,{message:s})}function eE(e,s){return nt(`/api/projects/${e}/git-stash-pop`,{index:s})}function tE(e){return ut(`/api/projects/${e}/git-stash-list`)}function nE(e,s,i){return nt(`/api/projects/${e}/git-discard`,{files:s,all:i})}function sE(e,s,i,a){return nt(`/api/projects/${e}/git-tag`,{name:s,message:i,commit:a})}function Ev(e,s,i){return nt(`/api/projects/${e}/git-branch-rename`,{oldName:s,newName:i})}function rE(e,s){return nt(`/api/projects/${e}/git-rebase`,{onto:s})}function iE(e,s,i){const a=new URLSearchParams;return s&&a.set("file",s),i&&a.set("staged","true"),ut(`/api/projects/${e}/git-diff?${a}`)}function aE(e,s){const i=new URLSearchParams({hash:s});return ut(`/api/projects/${e}/git-commit-files?${i}`)}function Tv(e,s,i){const a=new URLSearchParams({hash:s});return i&&a.set("file",i),ut(`/api/projects/${e}/git-commit-diff?${a}`)}function Lv(e){return ut(`/api/projects/${e}/worktrees`)}function Dv(e,s,i){return nt(`/api/projects/${e}/worktree-cleanup`,{worktreePath:s,branchName:i})}function Dw(e){const s=new URLSearchParams;e.hours!==void 0&&s.set("hours",String(e.hours)),e.statuses&&e.statuses.length>0&&s.set("statuses",e.statuses.join(","));const i=s.toString();return i?`?${i}`:""}function oE(e={}){return ut(`/api/review/queue${Dw(e)}`)}function Rw(e={}){return ut(`/api/review/summary${Dw(e)}`)}function lE(e){return ut(`/api/review/diff/${encodeURIComponent(e)}`)}function cE(e,s){return ut(`/api/review/diff/${encodeURIComponent(e)}/file?path=${encodeURIComponent(s)}`)}function uE(){return ut("/api/favorites")}function dE(e){return nt("/api/favorites",e)}function hE(e,s){return nn(`/api/favorites/${e}`,s)}function fE(e){return Bn(`/api/favorites/${e}`)}function mE(e){return nt(`/api/favorites/${e}/launch`)}function pE(e){return nt("/api/favorites/browse-file",{initialPath:e})}function Jf(){return ut("/api/tunnel/status")}function gE(){return ut("/api/tunnel/config")}function xE(e){return nn("/api/tunnel/config",e)}function Mw(e){return nt("/api/tunnel/start",{})}function vE(){return nt("/api/tunnel/stop")}const Aw=k.createContext({theme:"light",toggleTheme:()=>{}});function bE(){const[e,s]=k.useState(()=>{const a=localStorage.getItem("theme");return a==="light"||a==="dark"?a:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"});k.useEffect(()=>{document.documentElement.setAttribute("data-theme",e),localStorage.setItem("theme",e)},[e]);const i=k.useCallback(()=>{s(a=>a==="light"?"dark":"light")},[]);return{theme:e,toggleTheme:i}}function yE(){return k.useContext(Aw)}const Ow=k.createContext({enabled:!1,supported:!1,toggleNotification:()=>{},sendNotification:()=>{}});function wE(){const e="Notification"in window,[s,i]=k.useState(()=>e?localStorage.getItem("clitrigger-notifications")==="on"&&Notification.permission==="granted":!1),a=k.useRef(s);k.useEffect(()=>{a.current=s},[s]);const h=k.useCallback(async()=>{if(e)if(a.current)localStorage.setItem("clitrigger-notifications","off"),i(!1);else{if(Notification.permission==="denied"||Notification.permission==="default"&&await Notification.requestPermission()!=="granted")return;localStorage.setItem("clitrigger-notifications","on"),i(!0)}},[e]),m=k.useCallback((f,o)=>{if(!a.current)return;const c=new Notification(f,{body:o});c.onclick=()=>{window.focus(),c.close()}},[]);return{enabled:s,supported:e,toggleNotification:h,sendNotification:m}}function Im(){return k.useContext(Ow)}let _E=0;function gl(){const[e,s]=k.useState([]),i=k.useRef(new Map),a=k.useCallback(d=>{s(u=>u.filter(v=>v.id!==d));const p=i.current.get(d);p&&(clearTimeout(p),i.current.delete(d))},[]),h=k.useCallback((d,p="info",u=3500)=>{const v=`toast-${++_E}`;s(C=>[...C,{id:v,message:d,type:p,duration:u}]);const b=setTimeout(()=>a(v),u);return i.current.set(v,b),v},[a]),m=k.useCallback((d,p)=>h(d,"success",p),[h]),f=k.useCallback((d,p)=>h(d,"error",p),[h]),o=k.useCallback((d,p)=>h(d,"info",p),[h]),c=k.useCallback((d,p)=>h(d,"warning",p),[h]);return{toasts:e,show:h,success:m,error:f,info:o,warning:c,dismiss:a}}function vr(...e){return e.filter(Boolean).join(" ")}const SE={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl"},kE={scale:"animate-scale-in","slide-up":"animate-slide-up"};function Fn({open:e,onClose:s,size:i="md",position:a="center",animation:h="scale",disableEscClose:m=!1,disableBackdropClose:f=!1,children:o}){const c=k.useRef(null);return k.useEffect(()=>{if(!e||m)return;const d=p=>{p.key==="Escape"&&s()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,m,s]),e?tn.createPortal(t.jsx("div",{ref:c,className:vr("fixed inset-0 bg-black/50 backdrop-blur-sm z-modal flex",a==="center"?"items-center justify-center p-4":"items-start justify-center px-4 pt-[20vh]"),onClick:d=>{!f&&d.target===c.current&&s()},children:t.jsx("div",{className:vr("w-full",SE[i],kE[h]),children:o})}),document.body):null}function zw({onSubmit:e,onCancel:s}){const[i,a]=k.useState(""),[h,m]=k.useState(""),[f,o]=k.useState(!1),[c,d]=k.useState(!1),[p,u]=k.useState(""),{t:v}=it(),b=async w=>{if(w.preventDefault(),!(!i.trim()||!h.trim())){u(""),d(!0);try{await e(i.trim(),h.trim())}catch(x){const y=x instanceof Error?x.message:String(x);u(y||v("form.createError"))}finally{d(!1)}}},C=async()=>{o(!0);try{const w=await IN(h||void 0);w.path&&m(w.path)}catch{}o(!1)};return t.jsx(Fn,{open:!0,onClose:s,size:"md",children:t.jsxs("div",{className:"card p-8 shadow-2xl rounded-2xl",children:[t.jsx("h2",{className:"text-lg font-semibold text-warm-800 mb-6",children:v("form.newProject")}),t.jsxs("form",{onSubmit:b,children:[t.jsxs("div",{className:"mb-5",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:v("form.projectName")}),t.jsx("input",{type:"text",placeholder:"my-project",value:i,onChange:w=>a(w.target.value),className:"input-field",autoFocus:!0})]}),t.jsxs("div",{className:"mb-8",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:v("form.folderPath")}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{type:"text",placeholder:"C:/Projects/my-project",value:h,onChange:w=>m(w.target.value),className:"input-field text-sm flex-1"}),t.jsx("button",{type:"button",onClick:C,disabled:f,className:"btn-ghost text-sm px-3 shrink-0",title:v("browse.title"),children:f?t.jsx(Pi,{size:16,className:"animate-spin"}):t.jsx(Eu,{size:16})})]})]}),p&&t.jsx("p",{className:"text-sm mb-4",style:{color:"var(--color-danger, #ef4444)"},children:p}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsx("button",{type:"button",onClick:s,className:"btn-ghost text-sm",children:v("form.cancel")}),t.jsx("button",{type:"submit",disabled:!i.trim()||!h.trim()||c,className:"btn-primary text-sm",children:v(c?"form.creating":"form.create")})]})]})]})})}const CE=[{value:"executable",icon:Om},{value:"command",icon:Ba},{value:"url",icon:za}];function jE(e){const s=[],i=/"([^"]*)"|(\S+)/g;let a;for(;(a=i.exec(e))!==null;)s.push(a[1]!==void 0?a[1]:a[2]);return s}function Rv(e){if(!e)return"";try{const s=JSON.parse(e);if(Array.isArray(s))return s.map(i=>typeof i=="string"&&/\s/.test(i)?`"${i}"`:String(i)).join(" ")}catch{}return""}function NE({initial:e,onSubmit:s,onCancel:i}){const{t:a}=it(),[h,m]=k.useState((e==null?void 0:e.name)??""),[f,o]=k.useState((e==null?void 0:e.type)??"executable"),[c,d]=k.useState((e==null?void 0:e.target)??""),[p,u]=k.useState(Rv((e==null?void 0:e.args)??null)),[v,b]=k.useState((e==null?void 0:e.cwd)??""),[C,w]=k.useState(!1);k.useEffect(()=>{m((e==null?void 0:e.name)??""),o((e==null?void 0:e.type)??"executable"),d((e==null?void 0:e.target)??""),u(Rv((e==null?void 0:e.args)??null)),b((e==null?void 0:e.cwd)??"")},[e]);const[x,y]=k.useState(!1),_=f==="executable",S=async()=>{y(!0);try{const{path:z}=await pE(c||void 0);if(!z)return;if(d(z),!h.trim()){const O=z.replace(/\\/g,"/").split("/").pop()||"";m(O.replace(/\.[^.]+$/,""))}}catch{}finally{y(!1)}},N=!!e,D=h.trim(),j=c.trim(),R=f!=="url"||/^https?:\/\//i.test(j),L=!!D&&!!j&&R&&!C,T=async z=>{if(z.preventDefault(),!!L){w(!0);try{const O={name:D,type:f,target:j,args:f==="executable"&&p.trim()?jE(p.trim()):null,cwd:f!=="url"&&v.trim()?v.trim():null};await s(O)}finally{w(!1)}}},A=a(f==="executable"?"favorites.form.targetHint.executable":f==="command"?"favorites.form.targetHint.command":"favorites.form.targetHint.url");return t.jsx(Fn,{open:!0,onClose:i,size:"md",children:t.jsxs("div",{className:"card p-8 shadow-2xl rounded-2xl",children:[t.jsx("h2",{className:"text-lg font-semibold text-warm-800 mb-6",children:a(N?"favorites.form.title.edit":"favorites.form.title.create")}),t.jsxs("form",{onSubmit:T,children:[t.jsxs("div",{className:"mb-5",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:a("favorites.form.type")}),t.jsx("div",{className:"grid grid-cols-3 gap-2",children:CE.map(({value:z,icon:O})=>t.jsxs("button",{type:"button",onClick:()=>o(z),className:"flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-xs font-medium transition-all border",style:f===z?{backgroundColor:"var(--color-accent)",color:"white",borderColor:"var(--color-accent)"}:{color:"var(--color-text-tertiary)",borderColor:"var(--color-border)"},children:[t.jsx(O,{size:14}),a(`favorites.types.${z}`)]},z))})]}),t.jsxs("div",{className:"mb-5",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:a("favorites.form.name")}),t.jsx("input",{type:"text",value:h,onChange:z=>m(z.target.value),className:"input-field",autoFocus:!0})]}),t.jsxs("div",{className:"mb-5",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:a("favorites.form.target")}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{type:"text",value:c,onChange:z=>d(z.target.value),className:"input-field text-sm font-mono flex-1",placeholder:A}),_&&t.jsxs("button",{type:"button",onClick:S,disabled:x,className:"btn-ghost text-sm whitespace-nowrap flex items-center gap-1.5 disabled:opacity-50",children:[t.jsx(Eu,{size:14}),a("favorites.form.browse")]})]}),t.jsx("p",{className:"mt-1 text-2xs",style:{color:"var(--color-text-muted)"},children:A})]}),f==="executable"&&t.jsxs("div",{className:"mb-5",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:a("favorites.form.args")}),t.jsx("input",{type:"text",value:p,onChange:z=>u(z.target.value),className:"input-field text-sm font-mono",placeholder:'--flag value "with spaces"'})]}),f!=="url"&&t.jsxs("div",{className:"mb-5",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:a("favorites.form.cwd")}),t.jsx("input",{type:"text",value:v,onChange:z=>b(z.target.value),className:"input-field text-sm font-mono",placeholder:"C:/Projects/my-project"})]}),t.jsx("p",{className:"mb-6 text-2xs leading-snug",style:{color:"var(--color-text-muted)"},children:a("favorites.security.notice")}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsx("button",{type:"button",onClick:i,className:"btn-ghost text-sm",children:a("favorites.form.cancel")}),t.jsx("button",{type:"submit",disabled:!L,className:"btn-primary text-sm",children:a(N?"favorites.form.save":"favorites.form.create")})]})]})]})})}const EE=/^([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,}$/i;function TE({onClose:e}){const{t:s}=it(),{error:i,success:a}=gl(),[h,m]=k.useState(""),[f,o]=k.useState(""),[c,d]=k.useState(""),[p,u]=k.useState(""),[v,b]=k.useState(!1),[C,w]=k.useState(!1),[x,y]=k.useState(!1),[_,S]=k.useState(null);k.useEffect(()=>{let O=!1;return Promise.all([gE(),Jf()]).then(([H,F])=>{O||(m(H.tunnelName),o(H.customHostname),d(H.tunnelName),u(H.customHostname),S(F))}).catch(()=>{}),()=>{O=!0}},[]);const N=h.trim(),D=f.trim(),j=N!==c.trim()||D!==p.trim(),R=!!D&&(!EE.test(D)||D.toLowerCase()==="localhost"||D.toLowerCase()==="127.0.0.1"),L=!!D&&!N,T=j&&!C&&!R&&!L,A=async()=>{if(T){w(!0);try{const O=await xE({tunnelName:N,customHostname:D});d(O.tunnelName),u(O.customHostname),m(O.tunnelName),o(O.customHostname),a(s("tunnel.saved"))}catch(O){i(O instanceof Error?O.message:s("tunnel.saveFailed"))}finally{w(!1)}}},z=async()=>{y(!0);try{try{await vE()}catch{}const O=await Mw();S({status:"running",url:O.url}),a(s("tunnel.restarted"))}catch(O){i(O instanceof Error?O.message:s("tunnel.restartFailed"))}finally{y(!1)}};return t.jsxs("div",{className:"p-8",children:[t.jsx("h2",{className:"text-lg font-semibold text-warm-800 mb-1",children:s("tunnel.title")}),t.jsx("p",{className:"text-xs text-warm-400 mb-6",children:s("tunnel.description")}),_&&t.jsxs("div",{className:"mb-5 p-3 rounded-lg text-xs flex items-center gap-2",style:{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-tertiary)"},children:[t.jsx("span",{className:`w-2 h-2 rounded-full ${_.status==="running"?"bg-status-success":_.status==="error"?"bg-status-error":"bg-status-pending"}`}),t.jsx("span",{className:"font-medium",children:s(`tunnel.status.${_.status}`)}),_.url&&t.jsx("a",{href:_.url,target:"_blank",rel:"noreferrer",className:"ml-auto font-mono truncate hover:underline",style:{color:"var(--color-accent)"},children:_.url})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:s("tunnel.name.label")}),t.jsx("input",{type:"text",value:h,onChange:O=>m(O.target.value),placeholder:s("tunnel.name.placeholder"),className:"input-field text-sm font-mono"}),t.jsx("p",{className:"mt-1 text-2xs",style:{color:"var(--color-text-muted)"},children:s("tunnel.name.hint")})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:s("tunnel.hostname.label")}),t.jsx("input",{type:"text",value:f,onChange:O=>o(O.target.value),placeholder:s("tunnel.hostname.placeholder"),className:"input-field text-sm font-mono"}),t.jsx("p",{className:"mt-1 text-2xs",style:{color:"var(--color-text-muted)"},children:s("tunnel.hostname.hint")}),R&&t.jsx("p",{className:"mt-1 text-2xs text-status-error",children:s("tunnel.hostname.invalid")}),L&&t.jsx("p",{className:"mt-1 text-2xs text-status-error",children:s("tunnel.hostname.needsName")})]}),t.jsxs("div",{className:"mb-5",children:[t.jsxs("button",{type:"button",onClick:()=>b(!v),className:"flex items-center gap-1 text-xs text-accent-dark hover:text-accent transition-colors",children:[t.jsx("span",{className:`inline-block transition-transform ${v?"rotate-90":""}`,children:"▶"}),s("tunnel.guide.toggle")]}),v&&t.jsxs("div",{className:"mt-3 p-3 bg-warm-50 border border-warm-150 rounded-lg text-xs text-warm-600 space-y-2",children:[t.jsx("p",{className:"font-semibold text-warm-700 mb-1",children:s("tunnel.guide.heading")}),t.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-1",children:[t.jsx("li",{children:t.jsx("code",{className:"font-mono",children:"cloudflared tunnel login"})}),t.jsx("li",{children:t.jsx("code",{className:"font-mono",children:"cloudflared tunnel create my-app"})}),t.jsx("li",{children:t.jsx("code",{className:"font-mono",children:"cloudflared tunnel route dns my-app app.your-domain.com"})}),t.jsx("li",{children:s("tunnel.guide.step4")})]}),t.jsx("p",{className:"text-2xs text-warm-400 pt-1",children:s("tunnel.guide.note")})]})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("button",{type:"button",onClick:z,disabled:x,className:"btn-ghost text-sm disabled:opacity-50",children:x?(_==null?void 0:_.status)==="running"?s("tunnel.restarting"):s("tunnel.starting"):(_==null?void 0:_.status)==="running"?s("tunnel.restart"):s("tunnel.start")}),t.jsxs("div",{className:"flex gap-3",children:[e&&t.jsx("button",{type:"button",onClick:e,className:"btn-ghost text-sm",children:s("tunnel.close")}),t.jsx("button",{type:"button",onClick:A,disabled:!T,className:"btn-primary text-sm",children:s(C?"tunnel.saving":"tunnel.save")})]})]})]})}const Mv=8;function LE({onClose:e}){const{t:s}=it(),{error:i,success:a}=gl(),[h,m]=k.useState(""),[f,o]=k.useState(""),[c,d]=k.useState(""),[p,u]=k.useState(!1),v=f.length>0&&f.length<Mv,b=c.length>0&&f!==c,C=!!h&&f.length>=Mv&&f===c&&!p,w=()=>{m(""),o(""),d("")},x=async()=>{if(C){u(!0);try{await V2(h,f,c),a(s("account.saved")),w()}catch(y){i(y instanceof Error&&y.message?y.message:s("account.saveFailed"))}finally{u(!1)}}};return t.jsxs("div",{className:"p-8",children:[t.jsx("h2",{className:"text-lg font-semibold text-warm-800 mb-1",children:s("account.title")}),t.jsx("p",{className:"text-xs text-warm-400 mb-6",children:s("account.description")}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:s("account.oldPassword")}),t.jsx("input",{type:"password",value:h,onChange:y=>m(y.target.value),className:"input-field text-sm",autoComplete:"current-password"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:s("account.newPassword")}),t.jsx("input",{type:"password",value:f,onChange:y=>o(y.target.value),className:"input-field text-sm",autoComplete:"new-password"}),v&&t.jsx("p",{className:"mt-1 text-2xs text-status-error",children:s("account.tooShort")})]}),t.jsxs("div",{className:"mb-6",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:s("account.confirm")}),t.jsx("input",{type:"password",value:c,onChange:y=>d(y.target.value),className:"input-field text-sm",autoComplete:"new-password"}),b&&t.jsx("p",{className:"mt-1 text-2xs text-status-error",children:s("account.mismatch")})]}),t.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e&&t.jsx("button",{type:"button",onClick:e,className:"btn-ghost text-sm",children:s("account.close")}),t.jsx("button",{type:"button",onClick:x,disabled:!C,className:"btn-primary text-sm",children:s(p?"account.saving":"account.save")})]})]})}function Hm(){return ut("/api/session-tags")}function DE(e){return nt("/api/session-tags",e)}function RE(e,s){return nn(`/api/session-tags/${e}`,s)}function ME(e){return Bn(`/api/session-tags/${e}`)}function Bw(){return ut("/api/session-aliases")}function Pw(e){return nt("/api/session-aliases",e)}function AE(e,s){return nn(`/api/session-aliases/${e}`,s)}function OE(e){return Bn(`/api/session-aliases/${e}`)}function Fm(){return ut("/api/session-settings")}function tf(e){return nn("/api/session-settings",e)}const Ge={titleBg:"#2d2d2d",titleText:"#999",bg:"#0c0c0c",text:"#cccccc",dim:"#666666",bright:"#f2f2f2",prompt:"#16c60c",error:"#f14c4c",warning:"#cca700",info:"#569cd6",separator:"#333333"},Mt="'Cascadia Code', 'Cascadia Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Courier New', monospace",$m=13,Ko=8,Vo=28,al=new Map,Da=new Map;let uu=$m;function Um(e){return`sessionFontSize:${e}`}function Qf(e){return Number.isFinite(e)?Math.max(Ko,Math.min(Vo,Math.round(e))):uu}function zE(e){if(al.has(e))return!0;try{return localStorage.getItem(Um(e))!==null}catch{return!1}}function Zc(e){const s=al.get(e);if(s!==void 0)return s;let i=null;try{const a=localStorage.getItem(Um(e));if(a!==null){const h=parseInt(a,10);Number.isFinite(h)&&(i=Qf(h))}}catch{}return i===null?Qf(uu):(al.set(e,i),i)}function Zf(e,s){const i=Qf(s);if(al.get(e)===i)return;al.set(e,i);try{localStorage.setItem(Um(e),String(i))}catch{}const a=Da.get(e);a&&a.forEach(h=>h(i))}function zo(e,s){Zf(e,Zc(e)+s)}function eu(e){const s=Math.max(Ko,Math.min(Vo,Math.round(e)));Number.isFinite(s)&&s!==uu&&(uu=s,Da.forEach((i,a)=>{zE(a)||i.forEach(h=>h(s))}))}function Iw(e){const[s,i]=k.useState(()=>Zc(e));k.useEffect(()=>{i(Zc(e));let m=Da.get(e);return m||(m=new Set,Da.set(e,m)),m.add(i),()=>{const f=Da.get(e);f&&(f.delete(i),f.size===0&&Da.delete(e))}},[e]);const a=k.useCallback(m=>Zf(e,m),[e]),h=k.useCallback(m=>Zf(e,Zc(e)+m),[e]);return[s,a,h]}const Yo=["#A78BFA","#F472B6","#FB923C","#FBBF24","#34D399","#60A5FA","#F87171","#94A3B8"];function Av(e){for(const s of Yo)if(!e.some(i=>i.color.toLowerCase()===s.toLowerCase()))return s;return Yo[e.length%Yo.length]}function BE({onClose:e}){const{t:s}=it(),{error:i,success:a}=gl(),[h,m]=k.useState([]),[f,o]=k.useState(!1),[c,d]=k.useState($m),[p,u]=k.useState(!1),[v,b]=k.useState(!1),[C,w]=k.useState(!1),[x,y]=k.useState(!1),_=k.useRef(null),[S,N]=k.useState(""),[D,j]=k.useState(Yo[0]),[R,L]=k.useState(!1),[T,A]=k.useState(null),[z,O]=k.useState(""),[H,F]=k.useState(Yo[0]),[U,W]=k.useState(!1),[X,J]=k.useState([]),[P,B]=k.useState(""),[I,V]=k.useState(""),[$,se]=k.useState(!1),[ue,ae]=k.useState(null),[ee,Y]=k.useState(""),[he,de]=k.useState(""),[ke,re]=k.useState(!1);k.useEffect(()=>{let te=!1;return Promise.all([Hm(),Fm(),Bw()]).then(([le,xe,Pe])=>{te||(m(le),o(xe.defaultUseWorktree),d(xe.defaultFontSize),eu(xe.defaultFontSize),u(xe.imeDebug),j(Av(le)),J(Pe),b(!0))}).catch(le=>{te||i(le instanceof Error?le.message:"Failed to load")}),()=>{te=!0}},[i]);const Fe=S.trim(),Ne=!!Fe&&!R,Te=k.useMemo(()=>[...h].sort((te,le)=>te.sort_order-le.sort_order||te.name.localeCompare(le.name)),[h]);k.useEffect(()=>()=>{_.current&&clearTimeout(_.current)},[]);const be=te=>{if(!Number.isFinite(te))return;const le=Math.max(Ko,Math.min(Vo,Math.round(te)));d(le),eu(le),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{tf({defaultFontSize:le}).then(xe=>{d(xe.defaultFontSize),eu(xe.defaultFontSize)}).catch(xe=>i(xe instanceof Error?xe.message:"Save failed"))},350)},pe=async te=>{w(!0);try{const le=await tf({defaultUseWorktree:te});o(le.defaultUseWorktree),a(s("sessionSettings.saved"))}catch(le){i(le instanceof Error?le.message:"Save failed")}finally{w(!1)}},Je=async te=>{var le,xe;y(!0);try{const Pe=await tf({imeDebug:te});u(Pe.imeDebug),(xe=(le=window.electronAPI)==null?void 0:le.imeSetDebug)==null||xe.call(le,Pe.imeDebug),a(s("sessionSettings.saved"))}catch(Pe){i(Pe instanceof Error?Pe.message:"Save failed")}finally{y(!1)}},Ye=async()=>{if(Ne){L(!0);try{const te=await DE({name:Fe,color:D});m(le=>[...le,te]),N(""),j(Av([...h,te]))}catch(te){i(te instanceof Error?te.message:"Create failed")}finally{L(!1)}}},ge=te=>{A(te.id),O(te.name),F(te.color)},Ce=()=>{A(null),O("")},Ke=async()=>{if(!T)return;const te=z.trim();if(te){W(!0);try{const le=await RE(T,{name:te,color:H});m(xe=>xe.map(Pe=>Pe.id===le.id?le:Pe)),Ce()}catch(le){i(le instanceof Error?le.message:"Save failed")}finally{W(!1)}}},qe=async te=>{if(confirm(s("sessionSettings.tags.deleteConfirm").replace("{name}",te.name)))try{await ME(te.id),m(le=>le.filter(xe=>xe.id!==te.id))}catch(le){i(le instanceof Error?le.message:"Delete failed")}},tt=P.trim(),Oe=I.trim(),fe=!!tt&&!!Oe&&!$,je=k.useMemo(()=>[...X].sort((te,le)=>te.sort_order-le.sort_order||te.name.localeCompare(le.name)),[X]),oe=async()=>{if(fe){se(!0);try{const te=await Pw({name:tt,command_template:Oe});J(le=>[...le,te]),B(""),V("")}catch(te){i(te instanceof Error?te.message:"Create failed")}finally{se(!1)}}},q=te=>{ae(te.id),Y(te.name),de(te.command_template)},K=()=>{ae(null),Y(""),de("")},Q=async()=>{if(!ue)return;const te=ee.trim(),le=he.trim();if(!(!te||!le)){re(!0);try{const xe=await AE(ue,{name:te,command_template:le});J(Pe=>Pe.map(Re=>Re.id===xe.id?xe:Re)),K()}catch(xe){i(xe instanceof Error?xe.message:"Save failed")}finally{re(!1)}}},ie=async te=>{if(confirm(`Delete alias "${te.name}"? Sessions using it will fall back to OS default shell.`))try{await OE(te.id),J(le=>le.filter(xe=>xe.id!==te.id))}catch(le){i(le instanceof Error?le.message:"Delete failed")}};return t.jsxs("div",{className:"p-8",children:[t.jsx("h2",{className:"text-lg font-semibold text-warm-800 mb-1",children:s("sessionSettings.title")}),t.jsx("p",{className:"text-xs text-warm-400 mb-6",children:s("sessionSettings.description")}),t.jsxs("section",{className:"mb-7",children:[t.jsxs("h3",{className:"text-sm font-semibold text-warm-700 mb-2 flex items-center gap-1.5",children:[t.jsx(Fa,{size:14}),s("sessionSettings.worktree.title")]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[t.jsx("input",{type:"checkbox",checked:f,disabled:C||!v,onChange:te=>pe(te.target.checked),className:"rounded border-warm-300"}),t.jsx("span",{className:"text-sm text-warm-600",children:s("sessionSettings.worktree.label")})]}),t.jsx("p",{className:"mt-1 text-2xs ml-6",style:{color:"var(--color-text-muted)"},children:s("sessionSettings.worktree.hint")})]}),t.jsxs("section",{className:"mb-7",children:[t.jsxs("h3",{className:"text-sm font-semibold text-warm-700 mb-2 flex items-center gap-1.5",children:[t.jsx(jN,{size:14}),s("sessionSettings.fontSize.title")]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"range",min:Ko,max:Vo,step:1,value:c,disabled:!v,onChange:te=>be(parseInt(te.target.value,10)),className:"flex-1 max-w-xs","aria-label":s("sessionSettings.fontSize.label")}),t.jsx("input",{type:"number",min:Ko,max:Vo,step:1,value:c,disabled:!v,onChange:te=>be(parseInt(te.target.value,10)),className:"input text-sm w-20"}),t.jsx("span",{className:"text-xs text-warm-400",children:"px"})]}),t.jsx("p",{className:"mt-1 text-2xs",style:{color:"var(--color-text-muted)"},children:s("sessionSettings.fontSize.hint")})]}),t.jsxs("section",{children:[t.jsx("h3",{className:"text-sm font-semibold text-warm-700 mb-2",children:s("sessionSettings.tags.title")}),t.jsx("p",{className:"text-xs text-warm-400 mb-3",children:s("sessionSettings.tags.description")}),t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx("input",{type:"color",value:D,onChange:te=>j(te.target.value),className:"w-9 h-9 rounded cursor-pointer border border-warm-200",title:s("sessionSettings.tags.color")}),t.jsx("input",{type:"text",value:S,onChange:te=>N(te.target.value),onKeyDown:te=>{te.key==="Enter"&&(te.preventDefault(),Ye())},placeholder:s("sessionSettings.tags.namePlaceholder"),className:"input text-sm flex-1",maxLength:32}),t.jsxs("button",{type:"button",onClick:Ye,disabled:!Ne,className:"btn-primary text-sm py-1.5 px-3 inline-flex items-center gap-1",children:[t.jsx(mn,{size:14}),s("sessionSettings.tags.add")]})]}),Te.length===0?t.jsx("p",{className:"text-xs text-warm-400 italic py-3",children:s("sessionSettings.tags.empty")}):t.jsx("ul",{className:"space-y-1.5",children:Te.map(te=>{const le=T===te.id;return t.jsx("li",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border",style:{borderColor:"var(--color-border)"},children:le?t.jsxs(t.Fragment,{children:[t.jsx("input",{type:"color",value:H,onChange:xe=>F(xe.target.value),className:"w-7 h-7 rounded cursor-pointer border border-warm-200"}),t.jsx("input",{type:"text",value:z,onChange:xe=>O(xe.target.value),onKeyDown:xe=>{xe.key==="Enter"&&(xe.preventDefault(),Ke()),xe.key==="Escape"&&Ce()},autoFocus:!0,className:"input text-sm flex-1",maxLength:32}),t.jsx("button",{type:"button",onClick:Ke,disabled:U||!z.trim(),className:"p-1.5 text-status-success hover:bg-status-success/10 rounded",title:s("sessionSettings.tags.save"),children:t.jsx(si,{size:14})}),t.jsx("button",{type:"button",onClick:Ce,className:"p-1.5 text-warm-400 hover:bg-warm-100 rounded",title:s("sessionSettings.tags.cancel"),children:t.jsx(Xt,{size:14})})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"w-4 h-4 rounded-full shrink-0 border",style:{backgroundColor:te.color,borderColor:"rgba(0,0,0,0.08)"}}),t.jsx("span",{className:"text-sm text-warm-700 flex-1 truncate",children:te.name}),t.jsx("button",{type:"button",onClick:()=>ge(te),className:"p-1.5 text-warm-400 hover:text-warm-700 hover:bg-warm-100 rounded",title:s("sessionSettings.tags.edit"),children:t.jsx(ai,{size:14})}),t.jsx("button",{type:"button",onClick:()=>qe(te),className:"p-1.5 text-warm-400 hover:text-status-error hover:bg-warm-100 rounded",title:s("sessionSettings.tags.delete"),children:t.jsx(Nn,{size:14})})]})},te.id)})})]}),t.jsxs("section",{className:"mt-7",children:[t.jsx("h3",{className:"text-sm font-semibold text-warm-700 mb-2",children:"Terminal aliases"}),t.jsx("p",{className:"text-xs text-warm-400 mb-3",children:"Saved command snippets. Click the ⌘ icon in any terminal window's titlebar to insert one as input — Enter is yours to press."}),t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx("input",{type:"text",value:P,onChange:te=>B(te.target.value),placeholder:"Name (e.g. WSL Ubuntu)",className:"input text-sm w-44",maxLength:64}),t.jsx("input",{type:"text",value:I,onChange:te=>V(te.target.value),onKeyDown:te=>{te.key==="Enter"&&(te.preventDefault(),oe())},placeholder:"Command (e.g. wsl -d Ubuntu)",className:"input text-sm flex-1 font-mono",maxLength:1024}),t.jsxs("button",{type:"button",onClick:oe,disabled:!fe,className:"btn-primary text-sm py-1.5 px-3 inline-flex items-center gap-1",children:[t.jsx(mn,{size:14}),"Add"]})]}),je.length===0?t.jsx("p",{className:"text-xs text-warm-400 italic py-3",children:"No aliases yet."}):t.jsx("ul",{className:"space-y-1.5",children:je.map(te=>{const le=ue===te.id;return t.jsx("li",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border",style:{borderColor:"var(--color-border)"},children:le?t.jsxs(t.Fragment,{children:[t.jsx("input",{type:"text",value:ee,onChange:xe=>Y(xe.target.value),className:"input text-sm w-44",maxLength:64}),t.jsx("input",{type:"text",value:he,onChange:xe=>de(xe.target.value),onKeyDown:xe=>{xe.key==="Enter"&&(xe.preventDefault(),Q()),xe.key==="Escape"&&K()},autoFocus:!0,className:"input text-sm flex-1 font-mono",maxLength:1024}),t.jsx("button",{type:"button",onClick:Q,disabled:ke||!ee.trim()||!he.trim(),className:"p-1.5 text-status-success hover:bg-status-success/10 rounded",title:"Save",children:t.jsx(si,{size:14})}),t.jsx("button",{type:"button",onClick:K,className:"p-1.5 text-warm-400 hover:bg-warm-100 rounded",title:"Cancel",children:t.jsx(Xt,{size:14})})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-sm text-warm-700 w-44 truncate",children:te.name}),t.jsx("code",{className:"text-xs text-warm-500 flex-1 truncate font-mono",children:te.command_template}),t.jsx("button",{type:"button",onClick:()=>q(te),className:"p-1.5 text-warm-400 hover:text-warm-700 hover:bg-warm-100 rounded",title:"Edit",children:t.jsx(ai,{size:14})}),t.jsx("button",{type:"button",onClick:()=>ie(te),className:"p-1.5 text-warm-400 hover:text-status-error hover:bg-warm-100 rounded",title:"Delete",children:t.jsx(Nn,{size:14})})]})},te.id)})})]}),t.jsxs("section",{className:"mt-7",children:[t.jsxs("h3",{className:"text-sm font-semibold text-warm-700 mb-2 flex items-center gap-1.5",children:[t.jsx(_j,{size:14}),"IME 디버그 로그"]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[t.jsx("input",{type:"checkbox",checked:p,disabled:x||!v,onChange:te=>Je(te.target.checked),className:"rounded border-warm-300"}),t.jsx("span",{className:"text-sm text-warm-600",children:"한글 입력(IME) 진단 로그 기록"})]}),t.jsx("p",{className:"mt-1 text-2xs ml-6",style:{color:"var(--color-text-muted)"},children:"조합 창이 화면 좌상단에 뜨는 문제를 진단하기 위해 입력 시점 상태를 기록합니다. 데스크톱 앱에서만 동작하며, 로그는 앱 데이터 폴더의 ime-debug.log에 저장됩니다."})]}),e&&t.jsx("div",{className:"flex justify-end gap-3 mt-7",children:t.jsx("button",{type:"button",onClick:e,className:"btn-ghost text-sm",children:s("tunnel.close")})})]})}function Ov({open:e,onClose:s}){const{t:i}=it(),[a,h]=k.useState("account");if(!e)return null;const m=[{id:"account",label:i("settings.tabs.account"),icon:L5},{id:"session",label:i("settings.tabs.session"),icon:rl},{id:"tunnel",label:i("settings.tabs.tunnel"),icon:vw}];return t.jsx(Fn,{open:e,onClose:s,size:"xl",children:t.jsx("div",{className:"card shadow-2xl rounded-2xl overflow-hidden",children:t.jsxs("div",{className:"flex",style:{minHeight:460},children:[t.jsxs("aside",{className:"w-44 shrink-0 border-r flex flex-col",style:{borderColor:"var(--color-border)",backgroundColor:"var(--color-bg-hover)"},children:[t.jsx("div",{className:"px-4 pt-5 pb-3 text-xs font-semibold uppercase tracking-wider",style:{color:"var(--color-text-muted)"},children:i("settings.title")}),t.jsx("nav",{className:"flex flex-col",children:m.map(({id:f,label:o,icon:c})=>{const d=a===f;return t.jsxs("button",{type:"button",onClick:()=>h(f),className:"flex items-center gap-2 px-4 py-2.5 text-sm transition-colors text-left",style:{color:d?"var(--color-accent)":"var(--color-text-secondary)",backgroundColor:d?"var(--color-bg-primary)":"transparent",fontWeight:d?600:400},children:[t.jsx(c,{size:14}),t.jsx("span",{children:o})]},f)})}),t.jsxs("div",{className:"px-4 py-3 mt-auto text-[11px] tracking-wide",style:{color:"var(--color-text-muted)"},children:["v","0.2.31"]})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[a==="account"&&t.jsx(LE,{onClose:s}),a==="session"&&t.jsx(BE,{onClose:s}),a==="tunnel"&&t.jsx(TE,{onClose:s})]})]})})})}const PE={success:pw,error:Mm,warning:mw,info:E5},IE={success:"text-status-success",error:"text-status-error",warning:"text-status-warning",info:"text-accent"},HE={success:"bg-status-success",error:"bg-status-error",warning:"bg-status-warning",info:"bg-accent"};function FE({toast:e,onDismiss:s}){const[i,a]=k.useState(!1),h=PE[e.type],m=e.duration??3500;return k.useEffect(()=>{const f=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(f)},[]),t.jsxs("div",{className:vr("relative flex items-start gap-3 px-4 py-3 rounded-xl shadow-elevated overflow-hidden","bg-theme-card border border-theme-border min-w-[280px] max-w-sm","transition-all duration-300",i?"animate-slide-in-right opacity-100":"opacity-0 translate-x-8"),children:[t.jsx(h,{size:16,className:vr("mt-0.5 flex-shrink-0",IE[e.type])}),t.jsx("p",{className:"text-xs text-theme-text flex-1 leading-snug",children:e.message}),t.jsx("button",{onClick:()=>s(e.id),className:"p-0.5 rounded text-theme-muted hover:text-theme-text transition-colors flex-shrink-0",children:t.jsx(Xt,{size:12})}),t.jsx("div",{className:vr("absolute bottom-0 left-0 h-0.5",HE[e.type]),style:{animation:`toastProgress ${m}ms linear forwards`}})]})}function em({toasts:e,onDismiss:s}){return e.length===0?null:tn.createPortal(t.jsx("div",{className:"fixed bottom-6 right-6 z-toast flex flex-col gap-2 items-end",children:e.map(i=>t.jsx(FE,{toast:i,onDismiss:s},i.id))}),document.body)}const tm=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#06b6d4","#84cc16"];function $E(e,s){let i=0;for(let a=0;a<e.length;a++)i=(i<<5)-i+e.charCodeAt(a)|0;return Math.abs(i)%s}function ol(e){return e.color&&/^#[0-9a-f]{6}$/i.test(e.color)?e.color:tm[$E(e.id,tm.length)]}const zv=192,UE=88,Mc=8;function WE({project:e,anchorX:s,anchorY:i,onPick:a,onClose:h}){const m=k.useRef(null),[f,o]=k.useState({left:s,top:i}),c=ol(e);return k.useLayoutEffect(()=>{const d=Math.min(Math.max(s,Mc),window.innerWidth-zv-Mc),p=Math.min(Math.max(i,Mc),window.innerHeight-UE-Mc);o({left:d,top:p})},[s,i]),k.useEffect(()=>{const d=u=>{var v;(v=m.current)!=null&&v.contains(u.target)||h()},p=u=>{u.key==="Escape"&&h()};return window.addEventListener("mousedown",d),window.addEventListener("keydown",p),()=>{window.removeEventListener("mousedown",d),window.removeEventListener("keydown",p)}},[h]),tn.createPortal(t.jsxs("div",{ref:m,role:"menu",className:"z-tooltip",style:{position:"fixed",left:f.left,top:f.top,width:zv,background:"var(--color-bg-elevated, #1f1f23)",border:"1px solid var(--color-border)",borderRadius:10,padding:10,boxShadow:"0 12px 32px rgba(0,0,0,0.45)"},children:[t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginBottom:8},children:tm.map(d=>{const p=e.color?d.toLowerCase()===e.color.toLowerCase():d===c&&!e.color;return t.jsx("button",{onClick:()=>a(d),"aria-label":d,style:{width:20,height:20,borderRadius:6,background:d,border:p?"2px solid var(--color-text-primary)":"2px solid transparent",cursor:"pointer",padding:0}},d)})}),t.jsx("button",{onClick:()=>a(null),style:{width:"100%",background:"transparent",border:"1px solid var(--color-border)",color:"var(--color-text-tertiary)",padding:"4px 8px",borderRadius:6,fontSize:11,cursor:"pointer"},children:"자동 색 (기본값)"})]}),document.body)}function GE(e){return e==="executable"?Om:e==="command"?Ba:za}function qE({onLogout:e,authRequired:s,connected:i,onEvent:a,onClose:h,collapsed:m=!1,onToggleCollapsed:f}){var oe;const[o,c]=k.useState([]),[d,p]=k.useState({}),[u,v]=k.useState(null),[b,C]=k.useState(!1),[w,x]=k.useState(null),[y,_]=k.useState([]),[S,N]=k.useState(!1),[D,j]=k.useState(null),[R,L]=k.useState(!1),[T,A]=k.useState(null),[z,O]=k.useState(!1),[H,F]=k.useState(null),[U,W]=k.useState(null),X=Ps(),J=Hi(),{t:P,toggleLang:B}=it(),{theme:I,toggleTheme:V}=yE(),{enabled:$,supported:se,toggleNotification:ue}=Im(),{toasts:ae,error:ee,success:Y,info:he,warning:de,dismiss:ke}=gl(),re=((oe=X.pathname.match(/^\/projects\/([^/]+)/))==null?void 0:oe[1])||null;k.useEffect(()=>{ge(),Ne(),Jf().then(A).catch(()=>{})},[]);async function Fe(){if(!z){O(!0);try{const q=await Jf();if(A(q),q.status==="running"&&q.url){await navigator.clipboard.writeText(q.url),Y(P("tunnel.urlCopied"));return}const K=await Mw(),Q={status:"running",url:K.url};A(Q);try{await navigator.clipboard.writeText(K.url),Y(P("tunnel.urlCopied"))}catch{Y(K.url)}}catch(q){ee(q instanceof Error?q.message:P("tunnel.restartFailed"))}finally{O(!1)}}}function Ne(){uE().then(_).catch(()=>{})}const Te=async q=>{try{D?await hE(D.id,q):await dE(q),N(!1),j(null),Ne()}catch(K){ee(K instanceof Error?K.message:"Failed to save favorite")}},be=async q=>{try{await mE(q)}catch(K){const Q=K instanceof Error?K.message:P("favorites.launchFailed");ee(`${P("favorites.launchFailed")}: ${Q}`)}},pe=async(q,K)=>{if(K.preventDefault(),K.stopPropagation(),!!confirm(P("favorites.deleteConfirm")))try{await fE(q),_(Q=>Q.filter(ie=>ie.id!==q))}catch(Q){ee(Q instanceof Error?Q.message:"Failed to delete favorite")}},Je=(q,K)=>{K.preventDefault(),K.stopPropagation(),j(q),N(!0)};k.useEffect(()=>{const q=()=>ge();return window.addEventListener("projects:changed",q),()=>window.removeEventListener("projects:changed",q)},[]),k.useEffect(()=>{const q=()=>Ye();return window.addEventListener("review:changed",q),()=>window.removeEventListener("review:changed",q)},[]),k.useEffect(()=>a(q=>{var K;if(q.type==="project:status-changed"&&q.projectId&&p(Q=>({...Q,[q.projectId]:{running:q.running??0,completed:q.completed??0,total:q.total??0,running_sessions:q.running_sessions??0,running_discussions:q.running_discussions??0}})),q.type==="todo:status-changed"&&Ye(),q.type==="memory:ingest-finished"){const Q=o.find($e=>$e.id===q.projectId),ie=(Q==null?void 0:Q.name)??"",te=q.sourceTitle?`“${q.sourceTitle}”`:q.sourceType??"",le=ie?`[${ie}] `:"";if(q.error){ee(`${le}${P("wiki.ingest.toast.failed")}: ${q.error}`,6e3);return}const xe=q.created??0,Pe=q.updated??0,Re=q.edgesAdded??0;if(xe+Pe+Re>0){const $e=P("wiki.ingest.toast.success").replace("{source}",te).replace("{created}",String(xe)).replace("{updated}",String(Pe)).replace("{edges}",String(Re));Y(`${le}${$e}`)}else(K=q.skipped)!=null&&K.parseFailed?de(`${le}${P("wiki.ingest.toast.parseFailed").replace("{source}",te)}`,5e3):he(`${le}${P("wiki.ingest.toast.empty").replace("{source}",te)}`,4e3)}}),[a,o,P,ee,he,Y,de]),k.useEffect(()=>{Ye()},[]);function Ye(){Rw({hours:24}).then(q=>v(q.total_todos)).catch(()=>{})}function ge(){Lu().then(q=>{c(q),q.forEach(K=>{Cw(K.id).then(Q=>{p(ie=>({...ie,[K.id]:Q}))}).catch(()=>{})})}).catch(()=>{})}const Ce=()=>{h==null||h()},Ke=async(q,K)=>{await Sw({name:q,path:K}),C(!1),window.dispatchEvent(new Event("projects:changed"))},qe=k.useCallback(async(q,K)=>{const Q=o.map($e=>$e.id),ie=Q.indexOf(q);if(ie<0)return;const te=Q.filter($e=>$e!==q),le=K>ie?K-1:K;if(le===ie)return;const xe=[...te.slice(0,le),q,...te.slice(le)],Pe=o,Re=new Map(o.map($e=>[$e.id,$e])),ve=xe.map($e=>Re.get($e)).filter(Boolean);c(ve);try{await WN(xe)}catch($e){c(Pe),ee($e instanceof Error?$e.message:"Failed to reorder projects")}},[o,ee]),tt=k.useRef(!1),Oe=k.useCallback((q,K)=>{if(K.button!==0||K.target.closest("button"))return;K.preventDefault();const ie=K.clientX,te=K.clientY,le=6;let xe=!1,Pe=null;const Re=Be=>{const Ze=document.querySelectorAll("[data-workspace-item]");if(Ze.length===0)return null;const lt=Ze[0].getBoundingClientRect();if(Be<lt.top)return 0;const Ie=Ze[Ze.length-1].getBoundingClientRect();if(Be>Ie.bottom)return Ze.length;for(let Ee=0;Ee<Ze.length;Ee++){const ot=Ze[Ee].getBoundingClientRect();if(Be>=ot.top&&Be<=ot.bottom){const ht=ot.top+ot.height/2;return Be<ht?Ee:Ee+1}}return null},ve=Be=>{if(!xe){if(Math.hypot(Be.clientX-ie,Be.clientY-te)<le)return;xe=!0,F(q)}const Ze=Re(Be.clientY);Ze!==Pe&&(Pe=Ze,W(Ze))},$e=()=>{window.removeEventListener("mousemove",ve),window.removeEventListener("mouseup",et),window.removeEventListener("keydown",dt)},et=()=>{if($e(),!xe)return;tt.current=!0,requestAnimationFrame(()=>{tt.current=!1});const Be=Pe;F(null),W(null),Be!==null&&qe(q,Be)},dt=Be=>{Be.key==="Escape"&&($e(),F(null),W(null),xe&&(tt.current=!0,requestAnimationFrame(()=>{tt.current=!1})))};window.addEventListener("mousemove",ve),window.addEventListener("mouseup",et),window.addEventListener("keydown",dt)},[qe]),fe=async(q,K)=>{if(K.preventDefault(),K.stopPropagation(),!!confirm(P("projects.deleteConfirm")))try{await kw(q),c(Q=>Q.filter(ie=>ie.id!==q)),window.dispatchEvent(new Event("projects:changed")),re===String(q)&&J("/")}catch{}},je=q=>t.jsx("div",{className:"pointer-events-none absolute left-2 right-2 h-0.5 rounded-full",style:{backgroundColor:"var(--color-accent)",zIndex:10,...q==="above"?{top:-1}:{bottom:-1}}});if(m){const q=t.jsx("div",{className:"w-7 border-t my-1.5",style:{borderColor:"var(--color-border)"}});return t.jsxs("div",{className:"flex flex-col items-center h-full glass border-none py-3",children:[t.jsx("button",{onClick:f,className:"flex items-center justify-center w-9 h-9 rounded-lg transition-colors hover:bg-theme-hover",style:{color:"var(--color-text-tertiary)"},title:P("sidebar.expand"),children:t.jsx(sN,{size:18})}),q,t.jsx(zn,{to:"/",onClick:Ce,className:"relative flex items-center justify-center w-9 h-9 rounded-lg transition-colors hover:bg-theme-hover",style:X.pathname==="/"?{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-primary)"}:{color:"var(--color-text-tertiary)"},title:P("sidebar.home"),children:t.jsx(wv,{size:18})}),t.jsxs(zn,{to:"/review",onClick:Ce,className:"relative flex items-center justify-center w-9 h-9 rounded-lg transition-colors hover:bg-theme-hover mt-0.5",style:X.pathname==="/review"?{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-primary)"}:{color:"var(--color-text-tertiary)"},title:P("sidebar.review"),children:[t.jsx(ou,{size:18}),u!==null&&u>0&&t.jsx("span",{className:"absolute top-1 right-1 w-1.5 h-1.5 rounded-full",style:{backgroundColor:"var(--color-accent)"}})]}),t.jsx(zn,{to:"/agenda",onClick:Ce,className:"relative flex items-center justify-center w-9 h-9 rounded-lg transition-colors hover:bg-theme-hover mt-0.5",style:X.pathname==="/agenda"?{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-primary)"}:{color:"var(--color-text-tertiary)"},title:P("sidebar.agenda"),children:t.jsx($f,{size:18})}),q,t.jsx("div",{className:"flex-1 overflow-y-auto w-full flex flex-col items-center gap-1 py-1",children:o.map(K=>{const Q=d[K.id],ie=re===String(K.id),te=Q?Q.running+Q.running_sessions+Q.running_discussions:0,le=te>0,xe=ol(K);return t.jsxs(zn,{to:`/projects/${K.id}`,onClick:Ce,className:"relative flex items-center justify-center w-9 h-9 rounded-lg transition-colors hover:bg-theme-hover",style:ie?{backgroundColor:"var(--color-bg-hover)"}:void 0,title:le?`${K.name} · ${te} ${P("detail.live")}`:K.name,children:[ie&&t.jsx("span",{className:"absolute left-0 top-1/4 bottom-1/4 w-[3px] rounded-r-full",style:{backgroundColor:xe}}),t.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${le?"workspace-dot-pulse":""}`,style:{backgroundColor:xe,opacity:ie||le?1:.55}})]},K.id)})}),q,t.jsx("span",{className:`w-1.5 h-1.5 rounded-full my-1 ${i?"bg-status-success":"bg-status-error"}`,title:i?P("detail.live"):"Disconnected"}),t.jsx("button",{onClick:V,className:"flex items-center justify-center w-9 h-9 rounded-lg transition-colors hover:bg-theme-hover",style:{color:"var(--color-text-tertiary)"},title:P(I==="light"?"theme.dark":"theme.light"),children:I==="light"?t.jsx(Sv,{size:16}):t.jsx(Cv,{size:16})}),t.jsx("button",{onClick:()=>L(!0),className:"flex items-center justify-center w-9 h-9 rounded-lg transition-colors hover:bg-theme-hover",style:{color:"var(--color-text-tertiary)"},title:P("settings.title"),children:t.jsx(cu,{size:16})}),t.jsx(Ov,{open:R,onClose:()=>L(!1)}),t.jsx(em,{toasts:ae,onDismiss:ke})]})}return t.jsxs("div",{className:"flex flex-col h-full glass border-none",onDragStart:q=>q.preventDefault(),children:[t.jsxs("div",{className:"px-4 pt-5 pb-3 flex items-center justify-between",children:[t.jsx(zn,{to:"/",onClick:Ce,className:"block",children:t.jsxs("svg",{viewBox:"0 0 200 32",fill:"none",className:"h-6 w-auto",children:[t.jsxs("text",{x:"0",y:"24",fontFamily:"'JetBrains Mono', monospace",fontSize:"22",fontWeight:"500",fill:"var(--color-accent)",opacity:"0.5",children:[">","_"]}),t.jsx("text",{x:"38",y:"24",fontFamily:"'JetBrains Mono', monospace",fontSize:"22",fontWeight:"700",fill:"var(--color-accent)",children:"CLI"}),t.jsx("text",{x:"96",y:"24",fontFamily:"'JetBrains Mono', monospace",fontSize:"22",fontWeight:"500",fill:"var(--color-text-primary)",children:"Trigger"})]})}),t.jsx("button",{onClick:f,className:"hidden md:flex items-center justify-center w-7 h-7 rounded-md transition-colors hover:bg-theme-hover flex-shrink-0",style:{color:"var(--color-text-tertiary)"},title:P("sidebar.collapse"),children:t.jsx(tN,{size:16})})]}),t.jsxs("nav",{className:"px-3 mb-2 space-y-0.5",children:[t.jsxs(zn,{to:"/",onClick:Ce,className:`relative flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-all duration-200 active:scale-95 ${X.pathname==="/"?"font-medium":""}`,style:X.pathname==="/"?{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-primary)",boxShadow:"var(--shadow-soft)"}:{color:"var(--color-text-tertiary)"},children:[X.pathname==="/"&&t.jsx("span",{className:"absolute left-0 top-1/4 bottom-1/4 w-[3px] rounded-r-full",style:{backgroundColor:"var(--color-accent)"}}),t.jsx(wv,{size:16}),P("sidebar.home")]}),t.jsxs(zn,{to:"/review",onClick:Ce,className:`relative flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-all duration-200 active:scale-95 ${X.pathname==="/review"?"font-medium":""}`,style:X.pathname==="/review"?{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-primary)",boxShadow:"var(--shadow-soft)"}:{color:"var(--color-text-tertiary)"},children:[X.pathname==="/review"&&t.jsx("span",{className:"absolute left-0 top-1/4 bottom-1/4 w-[3px] rounded-r-full",style:{backgroundColor:"var(--color-accent)"}}),t.jsx(ou,{size:16}),t.jsx("span",{className:"flex-1",children:P("sidebar.review")}),u!==null&&u>0&&t.jsx("span",{className:"text-2xs px-1.5 py-0.5 rounded-full font-medium",style:{backgroundColor:"var(--color-accent)",color:"white"},children:u})]}),t.jsxs(zn,{to:"/agenda",onClick:Ce,className:`relative flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-all duration-200 active:scale-95 ${X.pathname==="/agenda"?"font-medium":""}`,style:X.pathname==="/agenda"?{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-primary)",boxShadow:"var(--shadow-soft)"}:{color:"var(--color-text-tertiary)"},children:[X.pathname==="/agenda"&&t.jsx("span",{className:"absolute left-0 top-1/4 bottom-1/4 w-[3px] rounded-r-full",style:{backgroundColor:"var(--color-accent)"}}),t.jsx($f,{size:16}),P("sidebar.agenda")]})]}),t.jsx("div",{className:"mx-4 border-t",style:{borderColor:"var(--color-border)"}}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-3 pt-3",children:[t.jsxs("div",{className:"px-3 mb-2 flex items-center justify-between",children:[t.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider",style:{color:"var(--color-text-muted)"},children:P("sidebar.workspaces")}),t.jsx("button",{onClick:()=>C(!0),className:"flex items-center justify-center w-5 h-5 rounded-md transition-colors hover:bg-theme-hover",style:{color:"var(--color-text-tertiary)"},title:P("projects.new"),children:t.jsx(mn,{size:14,strokeWidth:2})})]}),t.jsx("div",{className:"space-y-0.5",children:o.map((q,K)=>{const Q=d[q.id],ie=re===String(q.id),te=Q?Q.running+Q.running_sessions+Q.running_discussions:0,le=te>0,xe=ol(q),Pe=H===q.id,Re=H!==null&&U===K,ve=H!==null&&K===o.length-1&&U===o.length;return t.jsxs("div",{className:"relative","data-workspace-item":!0,children:[Re&&je("above"),t.jsxs(zn,{to:`/projects/${q.id}`,draggable:!1,onDragStart:$e=>$e.preventDefault(),onClick:$e=>{if(tt.current){$e.preventDefault();return}Ce()},onMouseDown:$e=>Oe(q.id,$e),onContextMenu:$e=>{$e.preventDefault(),x({project:q,x:$e.clientX,y:$e.clientY})},className:`relative flex items-center gap-2.5 px-3 py-1.5 rounded-lg text-sm transition-all duration-200 hover:bg-theme-hover active:scale-95 group ${ie?"font-medium":""} ${Pe?"opacity-50":""}`,style:ie?{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-primary)",boxShadow:"var(--shadow-soft)",cursor:H?"grabbing":"pointer",userSelect:"none"}:{color:"var(--color-text-tertiary)",cursor:H?"grabbing":"pointer",userSelect:"none"},children:[ie&&t.jsx("span",{className:"absolute left-0 top-1/4 bottom-1/4 w-[3px] rounded-r-full",style:{backgroundColor:xe}}),t.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${le?"workspace-dot-pulse":""}`,style:{backgroundColor:xe,opacity:ie||le?1:.55},title:le?`${P("sidebar.workspaces")} · ${te} ${P("detail.live")}`:q.name}),t.jsx("span",{className:"truncate flex-1",children:q.name}),t.jsx("button",{onClick:$e=>fe(q.id,$e),className:"flex-shrink-0 p-0.5 rounded opacity-0 group-hover:opacity-100 transition-all hover:bg-status-error/10",style:{color:"var(--color-text-muted)"},title:P("projects.delete"),children:t.jsx(Xt,{size:12,strokeWidth:2})})]}),ve&&je("below")]},q.id)})})]}),b&&t.jsx(zw,{onSubmit:(q,K)=>Ke(q,K),onCancel:()=>C(!1)}),t.jsxs("div",{className:"px-3 pt-3 pb-2 border-t",style:{borderColor:"var(--color-border)"},children:[t.jsxs("div",{className:"px-3 mb-2 flex items-center justify-between",children:[t.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider",style:{color:"var(--color-text-muted)"},children:P("sidebar.favorites")}),t.jsx("button",{onClick:()=>{j(null),N(!0)},className:"flex items-center justify-center w-5 h-5 rounded-md transition-colors hover:bg-theme-hover",style:{color:"var(--color-text-tertiary)"},title:P("favorites.add"),children:t.jsx(mn,{size:14,strokeWidth:2})})]}),t.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:y.map(q=>{const K=GE(q.type);return t.jsxs("button",{onClick:()=>be(q.id),className:"w-full relative flex items-center gap-2.5 px-3 py-1.5 rounded-lg text-sm transition-all duration-200 hover:bg-theme-hover active:scale-95 group",style:{color:"var(--color-text-tertiary)"},title:q.target,children:[t.jsx(K,{size:14,className:"flex-shrink-0"}),t.jsx("span",{className:"truncate flex-1 text-left",children:q.name}),t.jsx("span",{onClick:Q=>Je(q,Q),className:"flex-shrink-0 p-0.5 rounded opacity-0 group-hover:opacity-100 transition-all hover:bg-theme-hover cursor-pointer",style:{color:"var(--color-text-muted)"},title:P("favorites.edit"),children:t.jsx(qf,{size:11,strokeWidth:2})}),t.jsx("span",{onClick:Q=>pe(q.id,Q),className:"flex-shrink-0 p-0.5 rounded opacity-0 group-hover:opacity-100 transition-all hover:bg-status-error/10 cursor-pointer",style:{color:"var(--color-text-muted)"},title:P("favorites.delete"),children:t.jsx(Xt,{size:12,strokeWidth:2})})]},q.id)})})]}),S&&t.jsx(NE,{initial:D??void 0,onSubmit:Te,onCancel:()=>{N(!1),j(null)}}),w&&t.jsx(WE,{project:w.project,anchorX:w.x,anchorY:w.y,onPick:async q=>{try{const K=await Kf(w.project.id,{color:q});c(Q=>Q.map(ie=>ie.id===K.id?{...ie,color:K.color}:ie)),window.dispatchEvent(new Event("projects:changed"))}catch(K){ee(K instanceof Error?K.message:"Failed to update color")}x(null)},onClose:()=>x(null)}),t.jsx(Ov,{open:R,onClose:()=>L(!1)}),t.jsx(em,{toasts:ae,onDismiss:ke}),t.jsx("div",{className:"px-3 pb-4 pt-2",style:{borderTop:"1px solid var(--color-border)"},children:t.jsxs("div",{className:"flex items-center gap-1 px-1",children:[t.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 mr-1 ${i?"bg-status-success":"bg-status-error"}`,title:i?P("detail.live"):"Disconnected"}),t.jsx("button",{onClick:V,className:"flex items-center justify-center w-8 h-8 rounded-lg transition-colors",style:{color:"var(--color-text-tertiary)"},title:P(I==="light"?"theme.dark":"theme.light"),children:I==="light"?t.jsx(Sv,{size:16}):t.jsx(Cv,{size:16})}),t.jsx("button",{onClick:B,className:"flex items-center justify-center w-8 h-8 rounded-lg transition-colors text-xs font-medium",style:{color:"var(--color-text-tertiary)"},children:P("lang.toggle")}),se&&t.jsx("button",{onClick:ue,className:"flex items-center justify-center w-8 h-8 rounded-lg transition-colors",style:{color:$?"var(--color-accent)":"var(--color-text-tertiary)"},title:"Notification"in window&&Notification.permission==="denied"?P("notification.blocked"):P("notification.toggle"),children:$?t.jsx(yj,{size:16}):t.jsx(vj,{size:16})}),t.jsx("button",{onClick:Fe,disabled:z,className:"flex items-center justify-center w-8 h-8 rounded-lg transition-colors disabled:opacity-50",style:{color:(T==null?void 0:T.status)==="running"?"var(--color-accent)":"var(--color-text-tertiary)"},title:(T==null?void 0:T.status)==="running"&&T.url?`${T.url} — ${P("tunnel.urlCopied")}`:P(z?"tunnel.starting":"tunnel.start"),children:t.jsx(vw,{size:16})}),t.jsx("button",{onClick:()=>L(!0),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-colors",style:{color:"var(--color-text-tertiary)"},title:P("settings.title"),children:t.jsx(cu,{size:16})}),s&&t.jsx("button",{onClick:e,className:"flex items-center justify-center w-8 h-8 rounded-lg transition-colors ml-auto",style:{color:"var(--color-text-tertiary)"},title:P("projects.logout"),children:t.jsx(F5,{size:16})})]})})]})}const KE=80,Bv=120,mr=180,Pv=.03,Iv=8;function VE(){const e=k.useRef(null),s=k.useRef({x:-1e3,y:-1e3}),i=k.useRef([]),a=k.useRef(0);return k.useEffect(()=>{const h=e.current;if(!h)return;const m=h.getContext("2d");if(!m)return;let f=0,o=0;function c(){const b=h.parentElement;b&&(f=b.clientWidth,o=b.clientHeight,h.width=f*window.devicePixelRatio,h.height=o*window.devicePixelRatio,h.style.width=`${f}px`,h.style.height=`${o}px`,m.setTransform(window.devicePixelRatio,0,0,window.devicePixelRatio,0,0),d())}function d(){i.current=[];for(let b=0;b<KE;b++){const C=Math.random()*f,w=Math.random()*o;i.current.push({x:C,y:w,baseX:C,baseY:w,vx:(Math.random()-.5)*.3,vy:(Math.random()-.5)*.3,size:Math.random()*1.5+.5,alpha:Math.random()*.4+.1})}}function p(b){const C=h.getBoundingClientRect();s.current.x=b.clientX-C.left,s.current.y=b.clientY-C.top}function u(){s.current.x=-1e3,s.current.y=-1e3}function v(){if(!m)return;m.clearRect(0,0,f,o);const b=i.current,C=s.current;for(const w of b){const x=w.x-C.x,y=w.y-C.y,_=Math.sqrt(x*x+y*y);if(_<mr&&_>0){const S=(mr-_)/mr,N=Math.atan2(y,x);w.vx+=Math.cos(N)*S*Iv*.05,w.vy+=Math.sin(N)*S*Iv*.05}w.vx+=(w.baseX-w.x)*Pv,w.vy+=(w.baseY-w.y)*Pv,w.baseX+=(Math.random()-.5)*.1,w.baseY+=(Math.random()-.5)*.1,w.baseX<0&&(w.baseX=0),w.baseX>f&&(w.baseX=f),w.baseY<0&&(w.baseY=0),w.baseY>o&&(w.baseY=o),w.vx*=.92,w.vy*=.92,w.x+=w.vx,w.y+=w.vy}for(let w=0;w<b.length;w++){for(let S=w+1;S<b.length;S++){const N=b[w].x-b[S].x,D=b[w].y-b[S].y,j=Math.sqrt(N*N+D*D);if(j<Bv){const R=(1-j/Bv)*.15;m.beginPath(),m.strokeStyle=`rgba(75, 141, 255, ${R})`,m.lineWidth=.5,m.moveTo(b[w].x,b[w].y),m.lineTo(b[S].x,b[S].y),m.stroke()}}const x=b[w].x-C.x,y=b[w].y-C.y,_=Math.sqrt(x*x+y*y);if(_<mr){const S=(1-_/mr)*.3;m.beginPath(),m.strokeStyle=`rgba(75, 141, 255, ${S})`,m.lineWidth=.8,m.moveTo(b[w].x,b[w].y),m.lineTo(C.x,C.y),m.stroke()}}for(const w of b){const x=w.x-C.x,y=w.y-C.y,_=Math.sqrt(x*x+y*y),S=_<mr?w.alpha+(1-_/mr)*.5:w.alpha;m.beginPath(),m.arc(w.x,w.y,w.size,0,Math.PI*2),m.fillStyle=`rgba(75, 141, 255, ${S})`,m.fill(),_<mr&&(m.beginPath(),m.arc(w.x,w.y,w.size*3,0,Math.PI*2),m.fillStyle=`rgba(75, 141, 255, ${(1-_/mr)*.08})`,m.fill())}a.current=requestAnimationFrame(v)}return c(),h.addEventListener("mousemove",p),h.addEventListener("mouseleave",u),window.addEventListener("resize",c),a.current=requestAnimationFrame(v),()=>{cancelAnimationFrame(a.current),h.removeEventListener("mousemove",p),h.removeEventListener("mouseleave",u),window.removeEventListener("resize",c)}},[]),t.jsx("canvas",{ref:e,className:"absolute inset-0 pointer-events-auto",style:{zIndex:0}})}function YE({children:e,onLogout:s,authRequired:i,connected:a,onEvent:h}){const[m,f]=k.useState(!1),[o,c]=k.useState(()=>localStorage.getItem("sidebarCollapsed")==="1"),d=()=>{c(p=>{const u=!p;return localStorage.setItem("sidebarCollapsed",u?"1":"0"),u})};return t.jsxs("div",{className:"flex h-screen bg-theme-bg",children:[t.jsx("aside",{className:`
|
|
587
|
+
*/const ON=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],zN=st("zoom-out",ON);function BN({onLogin:e}){const[s,i]=k.useState(""),[a,h]=k.useState(!1),[m,f]=k.useState(""),[o,c]=k.useState(!1),{t:d,toggleLang:p}=it(),u=async v=>{if(v.preventDefault(),!!s){f(""),c(!0);try{await e(s,a)}catch{f(d("login.error"))}finally{c(!1)}}};return t.jsxs("div",{className:"min-h-screen bg-theme-bg flex items-center justify-center px-4 relative",children:[t.jsx("button",{onClick:p,className:"lang-toggle absolute top-6 right-6",children:d("lang.toggle")}),t.jsxs("div",{className:"w-full max-w-sm animate-fade-in",children:[t.jsxs("div",{className:"text-center mb-10",children:[t.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-accent/10 mb-5",children:t.jsx(rl,{size:32,className:"text-accent",strokeWidth:1.5})}),t.jsx("h1",{className:"text-2xl font-semibold text-theme-text",children:d("login.title")}),t.jsx("p",{className:"text-theme-muted text-sm mt-2",children:d("login.subtitle")})]}),t.jsx("form",{onSubmit:u,children:t.jsxs("div",{className:"card p-8",children:[t.jsx("label",{className:"block text-sm font-medium text-theme-text-secondary mb-2",children:d("login.password")}),t.jsx("input",{type:"password",value:s,onChange:v=>i(v.target.value),placeholder:"*************",className:"input-field text-base",autoFocus:!0}),m&&t.jsx("div",{className:"mt-4 py-2.5 px-4 bg-status-error/5 border border-status-error/20 rounded-xl text-sm text-status-error",children:m}),t.jsxs("label",{className:"flex items-center gap-2 mt-5 text-sm text-theme-text-secondary cursor-pointer select-none",children:[t.jsx("input",{type:"checkbox",checked:a,onChange:v=>h(v.target.checked),className:"accent-accent w-4 h-4"}),d("login.rememberMe")]}),t.jsx("button",{type:"submit",disabled:!s||o,className:"btn-primary w-full mt-6 py-3",children:d(o?"login.loading":"login.submit")})]})}),t.jsx("div",{className:"mt-6 text-center text-xs text-theme-text-tertiary",children:d("login.footer")}),t.jsx("div",{className:"mt-4 px-2 py-3 rounded-xl text-xs text-theme-text-tertiary border leading-relaxed text-center",children:d("login.disclaimer")})]})]})}const Nv=8;function PN({onSetup:e}){const[s,i]=k.useState(""),[a,h]=k.useState(""),[m,f]=k.useState(""),[o,c]=k.useState(!1),{t:d,toggleLang:p}=it(),u=s.length>0&&s.length<Nv,v=a.length>0&&s!==a,b=s.length>=Nv&&s===a&&!o,C=async w=>{if(w.preventDefault(),!!b){f(""),c(!0);try{await e(s,a)}catch(x){f(x instanceof Error&&x.message?x.message:d("setup.error"))}finally{c(!1)}}};return t.jsxs("div",{className:"min-h-screen bg-theme-bg flex items-center justify-center px-4 relative",children:[t.jsx("button",{onClick:p,className:"lang-toggle absolute top-6 right-6",children:d("lang.toggle")}),t.jsxs("div",{className:"w-full max-w-sm animate-fade-in",children:[t.jsxs("div",{className:"text-center mb-10",children:[t.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-accent/10 mb-5",children:t.jsx(rl,{size:32,className:"text-accent",strokeWidth:1.5})}),t.jsx("h1",{className:"text-2xl font-semibold text-theme-text",children:d("setup.title")}),t.jsx("p",{className:"text-theme-muted text-sm mt-2",children:d("setup.subtitle")})]}),t.jsx("form",{onSubmit:C,children:t.jsxs("div",{className:"card p-8",children:[t.jsx("label",{className:"block text-sm font-medium text-theme-text-secondary mb-2",children:d("setup.password")}),t.jsx("input",{type:"password",value:s,onChange:w=>i(w.target.value),placeholder:"*************",className:"input-field text-base",autoFocus:!0}),u&&t.jsx("p",{className:"mt-1 text-2xs text-status-error",children:d("setup.tooShort")}),t.jsx("label",{className:"block text-sm font-medium text-theme-text-secondary mb-2 mt-5",children:d("setup.confirm")}),t.jsx("input",{type:"password",value:a,onChange:w=>h(w.target.value),placeholder:"*************",className:"input-field text-base"}),v&&t.jsx("p",{className:"mt-1 text-2xs text-status-error",children:d("setup.mismatch")}),m&&t.jsx("div",{className:"mt-4 py-2.5 px-4 bg-status-error/5 border border-status-error/20 rounded-xl text-sm text-status-error",children:m}),t.jsx("button",{type:"submit",disabled:!b,className:"btn-primary w-full mt-6 py-3",children:d(o?"setup.loading":"setup.submit")})]})}),t.jsx("div",{className:"mt-4 px-4 py-3 rounded-xl text-xs text-theme-text-tertiary border leading-relaxed text-center",children:d("setup.tunnelPaused")})]})]})}function IN(e){return nt("/api/projects/browse",{initialPath:e})}function HN(e){return nt("/api/projects/open-folder",{path:e})}function Lu(){return ut("/api/projects")}function FN(e){return ut(`/api/projects/${e}`)}function Sw(e){return nt("/api/projects",e)}function $N(e){return ut(`/api/projects/${e}/svn-detect`)}function Kf(e,s){return nn(`/api/projects/${e}`,s)}function UN(e,s){const i=s?`?todoId=${encodeURIComponent(s)}`:"";return ut(`/api/projects/${e}/debug-logs${i}`)}function kw(e){return Bn(`/api/projects/${e}`)}function WN(e){return nt("/api/projects/reorder",{ids:e})}function GN(e){return nt(`/api/projects/${e}/start`)}function qN(e){return nt(`/api/projects/${e}/stop`)}function Cw(e){return ut(`/api/projects/${e}/status`)}function KN(e){return nt(`/api/projects/${e}/check-git`)}function jw(e,s){return ut(`/api/projects/${e}/git-status`)}function VN(e,s=0,i=50,a){const h=new URLSearchParams({skip:String(s),limit:String(i)});return ut(`/api/projects/${e}/git-log?${h}`)}function Vf(e,s){return ut(`/api/projects/${e}/git-refs`)}function YN(e,s){return nt(`/api/projects/${e}/git-stage`,{files:s})}function XN(e,s){return nt(`/api/projects/${e}/git-unstage`,{files:s})}function Nw(e,s){return nt(`/api/projects/${e}/git-commit`,{message:s})}function Ew(e,s,i){return nt(`/api/projects/${e}/git-pull`,{remote:s,branch:i})}function Pm(e,s){return nt(`/api/projects/${e}/git-push`,s||{})}function JN(e){return ut(`/api/projects/${e}/git-remotes`)}function Tw(e,s,i){return nt(`/api/projects/${e}/git-fetch`,{remote:s,prune:i})}function QN(e,s,i){return nt(`/api/projects/${e}/git-branch`,{name:s,startPoint:i})}function Yf(e,s,i){return nt(`/api/projects/${e}/git-branch-delete`,{name:s,force:i})}function Xf(e,s){return nt(`/api/projects/${e}/git-checkout`,{branch:s})}function Lw(e,s){return nt(`/api/projects/${e}/git-merge`,{branch:s})}function ZN(e,s){return nt(`/api/projects/${e}/git-stash`,{message:s})}function eE(e,s){return nt(`/api/projects/${e}/git-stash-pop`,{index:s})}function tE(e){return ut(`/api/projects/${e}/git-stash-list`)}function nE(e,s,i){return nt(`/api/projects/${e}/git-discard`,{files:s,all:i})}function sE(e,s,i,a){return nt(`/api/projects/${e}/git-tag`,{name:s,message:i,commit:a})}function Ev(e,s,i){return nt(`/api/projects/${e}/git-branch-rename`,{oldName:s,newName:i})}function rE(e,s){return nt(`/api/projects/${e}/git-rebase`,{onto:s})}function iE(e,s,i){const a=new URLSearchParams;return s&&a.set("file",s),i&&a.set("staged","true"),ut(`/api/projects/${e}/git-diff?${a}`)}function aE(e,s){const i=new URLSearchParams({hash:s});return ut(`/api/projects/${e}/git-commit-files?${i}`)}function Tv(e,s,i){const a=new URLSearchParams({hash:s});return i&&a.set("file",i),ut(`/api/projects/${e}/git-commit-diff?${a}`)}function Lv(e){return ut(`/api/projects/${e}/worktrees`)}function Dv(e,s,i){return nt(`/api/projects/${e}/worktree-cleanup`,{worktreePath:s,branchName:i})}function Dw(e){const s=new URLSearchParams;e.hours!==void 0&&s.set("hours",String(e.hours)),e.statuses&&e.statuses.length>0&&s.set("statuses",e.statuses.join(","));const i=s.toString();return i?`?${i}`:""}function oE(e={}){return ut(`/api/review/queue${Dw(e)}`)}function Rw(e={}){return ut(`/api/review/summary${Dw(e)}`)}function lE(e){return ut(`/api/review/diff/${encodeURIComponent(e)}`)}function cE(e,s){return ut(`/api/review/diff/${encodeURIComponent(e)}/file?path=${encodeURIComponent(s)}`)}function uE(){return ut("/api/favorites")}function dE(e){return nt("/api/favorites",e)}function hE(e,s){return nn(`/api/favorites/${e}`,s)}function fE(e){return Bn(`/api/favorites/${e}`)}function mE(e){return nt(`/api/favorites/${e}/launch`)}function pE(e){return nt("/api/favorites/browse-file",{initialPath:e})}function Jf(){return ut("/api/tunnel/status")}function gE(){return ut("/api/tunnel/config")}function xE(e){return nn("/api/tunnel/config",e)}function Mw(e){return nt("/api/tunnel/start",{})}function vE(){return nt("/api/tunnel/stop")}const Aw=k.createContext({theme:"light",toggleTheme:()=>{}});function bE(){const[e,s]=k.useState(()=>{const a=localStorage.getItem("theme");return a==="light"||a==="dark"?a:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"});k.useEffect(()=>{document.documentElement.setAttribute("data-theme",e),localStorage.setItem("theme",e)},[e]);const i=k.useCallback(()=>{s(a=>a==="light"?"dark":"light")},[]);return{theme:e,toggleTheme:i}}function yE(){return k.useContext(Aw)}const Ow=k.createContext({enabled:!1,supported:!1,toggleNotification:()=>{},sendNotification:()=>{}});function wE(){const e="Notification"in window,[s,i]=k.useState(()=>e?localStorage.getItem("clitrigger-notifications")==="on"&&Notification.permission==="granted":!1),a=k.useRef(s);k.useEffect(()=>{a.current=s},[s]);const h=k.useCallback(async()=>{if(e)if(a.current)localStorage.setItem("clitrigger-notifications","off"),i(!1);else{if(Notification.permission==="denied"||Notification.permission==="default"&&await Notification.requestPermission()!=="granted")return;localStorage.setItem("clitrigger-notifications","on"),i(!0)}},[e]),m=k.useCallback((f,o)=>{if(!a.current)return;const c=new Notification(f,{body:o});c.onclick=()=>{window.focus(),c.close()}},[]);return{enabled:s,supported:e,toggleNotification:h,sendNotification:m}}function Im(){return k.useContext(Ow)}let _E=0;function gl(){const[e,s]=k.useState([]),i=k.useRef(new Map),a=k.useCallback(d=>{s(u=>u.filter(v=>v.id!==d));const p=i.current.get(d);p&&(clearTimeout(p),i.current.delete(d))},[]),h=k.useCallback((d,p="info",u=3500)=>{const v=`toast-${++_E}`;s(C=>[...C,{id:v,message:d,type:p,duration:u}]);const b=setTimeout(()=>a(v),u);return i.current.set(v,b),v},[a]),m=k.useCallback((d,p)=>h(d,"success",p),[h]),f=k.useCallback((d,p)=>h(d,"error",p),[h]),o=k.useCallback((d,p)=>h(d,"info",p),[h]),c=k.useCallback((d,p)=>h(d,"warning",p),[h]);return{toasts:e,show:h,success:m,error:f,info:o,warning:c,dismiss:a}}function vr(...e){return e.filter(Boolean).join(" ")}const SE={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl"},kE={scale:"animate-scale-in","slide-up":"animate-slide-up"};function Fn({open:e,onClose:s,size:i="md",position:a="center",animation:h="scale",disableEscClose:m=!1,disableBackdropClose:f=!1,children:o}){const c=k.useRef(null);return k.useEffect(()=>{if(!e||m)return;const d=p=>{p.key==="Escape"&&s()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,m,s]),e?tn.createPortal(t.jsx("div",{ref:c,className:vr("fixed inset-0 bg-black/50 backdrop-blur-sm z-modal flex",a==="center"?"items-center justify-center p-4":"items-start justify-center px-4 pt-[20vh]"),onClick:d=>{!f&&d.target===c.current&&s()},children:t.jsx("div",{className:vr("w-full",SE[i],kE[h]),children:o})}),document.body):null}function zw({onSubmit:e,onCancel:s}){const[i,a]=k.useState(""),[h,m]=k.useState(""),[f,o]=k.useState(!1),[c,d]=k.useState(!1),[p,u]=k.useState(""),{t:v}=it(),b=async w=>{if(w.preventDefault(),!(!i.trim()||!h.trim())){u(""),d(!0);try{await e(i.trim(),h.trim())}catch(x){const y=x instanceof Error?x.message:String(x);u(y||v("form.createError"))}finally{d(!1)}}},C=async()=>{o(!0);try{const w=await IN(h||void 0);w.path&&m(w.path)}catch{}o(!1)};return t.jsx(Fn,{open:!0,onClose:s,size:"md",children:t.jsxs("div",{className:"card p-8 shadow-2xl rounded-2xl",children:[t.jsx("h2",{className:"text-lg font-semibold text-warm-800 mb-6",children:v("form.newProject")}),t.jsxs("form",{onSubmit:b,children:[t.jsxs("div",{className:"mb-5",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:v("form.projectName")}),t.jsx("input",{type:"text",placeholder:"my-project",value:i,onChange:w=>a(w.target.value),className:"input-field",autoFocus:!0})]}),t.jsxs("div",{className:"mb-8",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:v("form.folderPath")}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{type:"text",placeholder:"C:/Projects/my-project",value:h,onChange:w=>m(w.target.value),className:"input-field text-sm flex-1"}),t.jsx("button",{type:"button",onClick:C,disabled:f,className:"btn-ghost text-sm px-3 shrink-0",title:v("browse.title"),children:f?t.jsx(Pi,{size:16,className:"animate-spin"}):t.jsx(Eu,{size:16})})]})]}),p&&t.jsx("p",{className:"text-sm mb-4",style:{color:"var(--color-danger, #ef4444)"},children:p}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsx("button",{type:"button",onClick:s,className:"btn-ghost text-sm",children:v("form.cancel")}),t.jsx("button",{type:"submit",disabled:!i.trim()||!h.trim()||c,className:"btn-primary text-sm",children:v(c?"form.creating":"form.create")})]})]})]})})}const CE=[{value:"executable",icon:Om},{value:"command",icon:Ba},{value:"url",icon:za}];function jE(e){const s=[],i=/"([^"]*)"|(\S+)/g;let a;for(;(a=i.exec(e))!==null;)s.push(a[1]!==void 0?a[1]:a[2]);return s}function Rv(e){if(!e)return"";try{const s=JSON.parse(e);if(Array.isArray(s))return s.map(i=>typeof i=="string"&&/\s/.test(i)?`"${i}"`:String(i)).join(" ")}catch{}return""}function NE({initial:e,onSubmit:s,onCancel:i}){const{t:a}=it(),[h,m]=k.useState((e==null?void 0:e.name)??""),[f,o]=k.useState((e==null?void 0:e.type)??"executable"),[c,d]=k.useState((e==null?void 0:e.target)??""),[p,u]=k.useState(Rv((e==null?void 0:e.args)??null)),[v,b]=k.useState((e==null?void 0:e.cwd)??""),[C,w]=k.useState(!1);k.useEffect(()=>{m((e==null?void 0:e.name)??""),o((e==null?void 0:e.type)??"executable"),d((e==null?void 0:e.target)??""),u(Rv((e==null?void 0:e.args)??null)),b((e==null?void 0:e.cwd)??"")},[e]);const[x,y]=k.useState(!1),_=f==="executable",S=async()=>{y(!0);try{const{path:z}=await pE(c||void 0);if(!z)return;if(d(z),!h.trim()){const O=z.replace(/\\/g,"/").split("/").pop()||"";m(O.replace(/\.[^.]+$/,""))}}catch{}finally{y(!1)}},N=!!e,D=h.trim(),j=c.trim(),R=f!=="url"||/^https?:\/\//i.test(j),L=!!D&&!!j&&R&&!C,T=async z=>{if(z.preventDefault(),!!L){w(!0);try{const O={name:D,type:f,target:j,args:f==="executable"&&p.trim()?jE(p.trim()):null,cwd:f!=="url"&&v.trim()?v.trim():null};await s(O)}finally{w(!1)}}},A=a(f==="executable"?"favorites.form.targetHint.executable":f==="command"?"favorites.form.targetHint.command":"favorites.form.targetHint.url");return t.jsx(Fn,{open:!0,onClose:i,size:"md",children:t.jsxs("div",{className:"card p-8 shadow-2xl rounded-2xl",children:[t.jsx("h2",{className:"text-lg font-semibold text-warm-800 mb-6",children:a(N?"favorites.form.title.edit":"favorites.form.title.create")}),t.jsxs("form",{onSubmit:T,children:[t.jsxs("div",{className:"mb-5",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:a("favorites.form.type")}),t.jsx("div",{className:"grid grid-cols-3 gap-2",children:CE.map(({value:z,icon:O})=>t.jsxs("button",{type:"button",onClick:()=>o(z),className:"flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-xs font-medium transition-all border",style:f===z?{backgroundColor:"var(--color-accent)",color:"white",borderColor:"var(--color-accent)"}:{color:"var(--color-text-tertiary)",borderColor:"var(--color-border)"},children:[t.jsx(O,{size:14}),a(`favorites.types.${z}`)]},z))})]}),t.jsxs("div",{className:"mb-5",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:a("favorites.form.name")}),t.jsx("input",{type:"text",value:h,onChange:z=>m(z.target.value),className:"input-field",autoFocus:!0})]}),t.jsxs("div",{className:"mb-5",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:a("favorites.form.target")}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{type:"text",value:c,onChange:z=>d(z.target.value),className:"input-field text-sm font-mono flex-1",placeholder:A}),_&&t.jsxs("button",{type:"button",onClick:S,disabled:x,className:"btn-ghost text-sm whitespace-nowrap flex items-center gap-1.5 disabled:opacity-50",children:[t.jsx(Eu,{size:14}),a("favorites.form.browse")]})]}),t.jsx("p",{className:"mt-1 text-2xs",style:{color:"var(--color-text-muted)"},children:A})]}),f==="executable"&&t.jsxs("div",{className:"mb-5",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:a("favorites.form.args")}),t.jsx("input",{type:"text",value:p,onChange:z=>u(z.target.value),className:"input-field text-sm font-mono",placeholder:'--flag value "with spaces"'})]}),f!=="url"&&t.jsxs("div",{className:"mb-5",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:a("favorites.form.cwd")}),t.jsx("input",{type:"text",value:v,onChange:z=>b(z.target.value),className:"input-field text-sm font-mono",placeholder:"C:/Projects/my-project"})]}),t.jsx("p",{className:"mb-6 text-2xs leading-snug",style:{color:"var(--color-text-muted)"},children:a("favorites.security.notice")}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsx("button",{type:"button",onClick:i,className:"btn-ghost text-sm",children:a("favorites.form.cancel")}),t.jsx("button",{type:"submit",disabled:!L,className:"btn-primary text-sm",children:a(N?"favorites.form.save":"favorites.form.create")})]})]})]})})}const EE=/^([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,}$/i;function TE({onClose:e}){const{t:s}=it(),{error:i,success:a}=gl(),[h,m]=k.useState(""),[f,o]=k.useState(""),[c,d]=k.useState(""),[p,u]=k.useState(""),[v,b]=k.useState(!1),[C,w]=k.useState(!1),[x,y]=k.useState(!1),[_,S]=k.useState(null);k.useEffect(()=>{let O=!1;return Promise.all([gE(),Jf()]).then(([H,F])=>{O||(m(H.tunnelName),o(H.customHostname),d(H.tunnelName),u(H.customHostname),S(F))}).catch(()=>{}),()=>{O=!0}},[]);const N=h.trim(),D=f.trim(),j=N!==c.trim()||D!==p.trim(),R=!!D&&(!EE.test(D)||D.toLowerCase()==="localhost"||D.toLowerCase()==="127.0.0.1"),L=!!D&&!N,T=j&&!C&&!R&&!L,A=async()=>{if(T){w(!0);try{const O=await xE({tunnelName:N,customHostname:D});d(O.tunnelName),u(O.customHostname),m(O.tunnelName),o(O.customHostname),a(s("tunnel.saved"))}catch(O){i(O instanceof Error?O.message:s("tunnel.saveFailed"))}finally{w(!1)}}},z=async()=>{y(!0);try{try{await vE()}catch{}const O=await Mw();S({status:"running",url:O.url}),a(s("tunnel.restarted"))}catch(O){i(O instanceof Error?O.message:s("tunnel.restartFailed"))}finally{y(!1)}};return t.jsxs("div",{className:"p-8",children:[t.jsx("h2",{className:"text-lg font-semibold text-warm-800 mb-1",children:s("tunnel.title")}),t.jsx("p",{className:"text-xs text-warm-400 mb-6",children:s("tunnel.description")}),_&&t.jsxs("div",{className:"mb-5 p-3 rounded-lg text-xs flex items-center gap-2",style:{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-tertiary)"},children:[t.jsx("span",{className:`w-2 h-2 rounded-full ${_.status==="running"?"bg-status-success":_.status==="error"?"bg-status-error":"bg-status-pending"}`}),t.jsx("span",{className:"font-medium",children:s(`tunnel.status.${_.status}`)}),_.url&&t.jsx("a",{href:_.url,target:"_blank",rel:"noreferrer",className:"ml-auto font-mono truncate hover:underline",style:{color:"var(--color-accent)"},children:_.url})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:s("tunnel.name.label")}),t.jsx("input",{type:"text",value:h,onChange:O=>m(O.target.value),placeholder:s("tunnel.name.placeholder"),className:"input-field text-sm font-mono"}),t.jsx("p",{className:"mt-1 text-2xs",style:{color:"var(--color-text-muted)"},children:s("tunnel.name.hint")})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:s("tunnel.hostname.label")}),t.jsx("input",{type:"text",value:f,onChange:O=>o(O.target.value),placeholder:s("tunnel.hostname.placeholder"),className:"input-field text-sm font-mono"}),t.jsx("p",{className:"mt-1 text-2xs",style:{color:"var(--color-text-muted)"},children:s("tunnel.hostname.hint")}),R&&t.jsx("p",{className:"mt-1 text-2xs text-status-error",children:s("tunnel.hostname.invalid")}),L&&t.jsx("p",{className:"mt-1 text-2xs text-status-error",children:s("tunnel.hostname.needsName")})]}),t.jsxs("div",{className:"mb-5",children:[t.jsxs("button",{type:"button",onClick:()=>b(!v),className:"flex items-center gap-1 text-xs text-accent-dark hover:text-accent transition-colors",children:[t.jsx("span",{className:`inline-block transition-transform ${v?"rotate-90":""}`,children:"▶"}),s("tunnel.guide.toggle")]}),v&&t.jsxs("div",{className:"mt-3 p-3 bg-warm-50 border border-warm-150 rounded-lg text-xs text-warm-600 space-y-2",children:[t.jsx("p",{className:"font-semibold text-warm-700 mb-1",children:s("tunnel.guide.heading")}),t.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-1",children:[t.jsx("li",{children:t.jsx("code",{className:"font-mono",children:"cloudflared tunnel login"})}),t.jsx("li",{children:t.jsx("code",{className:"font-mono",children:"cloudflared tunnel create my-app"})}),t.jsx("li",{children:t.jsx("code",{className:"font-mono",children:"cloudflared tunnel route dns my-app app.your-domain.com"})}),t.jsx("li",{children:s("tunnel.guide.step4")})]}),t.jsx("p",{className:"text-2xs text-warm-400 pt-1",children:s("tunnel.guide.note")})]})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("button",{type:"button",onClick:z,disabled:x,className:"btn-ghost text-sm disabled:opacity-50",children:x?(_==null?void 0:_.status)==="running"?s("tunnel.restarting"):s("tunnel.starting"):(_==null?void 0:_.status)==="running"?s("tunnel.restart"):s("tunnel.start")}),t.jsxs("div",{className:"flex gap-3",children:[e&&t.jsx("button",{type:"button",onClick:e,className:"btn-ghost text-sm",children:s("tunnel.close")}),t.jsx("button",{type:"button",onClick:A,disabled:!T,className:"btn-primary text-sm",children:s(C?"tunnel.saving":"tunnel.save")})]})]})]})}const Mv=8;function LE({onClose:e}){const{t:s}=it(),{error:i,success:a}=gl(),[h,m]=k.useState(""),[f,o]=k.useState(""),[c,d]=k.useState(""),[p,u]=k.useState(!1),v=f.length>0&&f.length<Mv,b=c.length>0&&f!==c,C=!!h&&f.length>=Mv&&f===c&&!p,w=()=>{m(""),o(""),d("")},x=async()=>{if(C){u(!0);try{await V2(h,f,c),a(s("account.saved")),w()}catch(y){i(y instanceof Error&&y.message?y.message:s("account.saveFailed"))}finally{u(!1)}}};return t.jsxs("div",{className:"p-8",children:[t.jsx("h2",{className:"text-lg font-semibold text-warm-800 mb-1",children:s("account.title")}),t.jsx("p",{className:"text-xs text-warm-400 mb-6",children:s("account.description")}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:s("account.oldPassword")}),t.jsx("input",{type:"password",value:h,onChange:y=>m(y.target.value),className:"input-field text-sm",autoComplete:"current-password"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:s("account.newPassword")}),t.jsx("input",{type:"password",value:f,onChange:y=>o(y.target.value),className:"input-field text-sm",autoComplete:"new-password"}),v&&t.jsx("p",{className:"mt-1 text-2xs text-status-error",children:s("account.tooShort")})]}),t.jsxs("div",{className:"mb-6",children:[t.jsx("label",{className:"block text-sm font-medium text-warm-600 mb-2",children:s("account.confirm")}),t.jsx("input",{type:"password",value:c,onChange:y=>d(y.target.value),className:"input-field text-sm",autoComplete:"new-password"}),b&&t.jsx("p",{className:"mt-1 text-2xs text-status-error",children:s("account.mismatch")})]}),t.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e&&t.jsx("button",{type:"button",onClick:e,className:"btn-ghost text-sm",children:s("account.close")}),t.jsx("button",{type:"button",onClick:x,disabled:!C,className:"btn-primary text-sm",children:s(p?"account.saving":"account.save")})]})]})}function Hm(){return ut("/api/session-tags")}function DE(e){return nt("/api/session-tags",e)}function RE(e,s){return nn(`/api/session-tags/${e}`,s)}function ME(e){return Bn(`/api/session-tags/${e}`)}function Bw(){return ut("/api/session-aliases")}function Pw(e){return nt("/api/session-aliases",e)}function AE(e,s){return nn(`/api/session-aliases/${e}`,s)}function OE(e){return Bn(`/api/session-aliases/${e}`)}function Fm(){return ut("/api/session-settings")}function tf(e){return nn("/api/session-settings",e)}const Ge={titleBg:"#2d2d2d",titleText:"#999",bg:"#0c0c0c",text:"#cccccc",dim:"#666666",bright:"#f2f2f2",prompt:"#16c60c",error:"#f14c4c",warning:"#cca700",info:"#569cd6",separator:"#333333"},Mt="'Cascadia Code', 'Cascadia Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Courier New', monospace",$m=13,Ko=8,Vo=28,al=new Map,Da=new Map;let uu=$m;function Um(e){return`sessionFontSize:${e}`}function Qf(e){return Number.isFinite(e)?Math.max(Ko,Math.min(Vo,Math.round(e))):uu}function zE(e){if(al.has(e))return!0;try{return localStorage.getItem(Um(e))!==null}catch{return!1}}function Zc(e){const s=al.get(e);if(s!==void 0)return s;let i=null;try{const a=localStorage.getItem(Um(e));if(a!==null){const h=parseInt(a,10);Number.isFinite(h)&&(i=Qf(h))}}catch{}return i===null?Qf(uu):(al.set(e,i),i)}function Zf(e,s){const i=Qf(s);if(al.get(e)===i)return;al.set(e,i);try{localStorage.setItem(Um(e),String(i))}catch{}const a=Da.get(e);a&&a.forEach(h=>h(i))}function zo(e,s){Zf(e,Zc(e)+s)}function eu(e){const s=Math.max(Ko,Math.min(Vo,Math.round(e)));Number.isFinite(s)&&s!==uu&&(uu=s,Da.forEach((i,a)=>{zE(a)||i.forEach(h=>h(s))}))}function Iw(e){const[s,i]=k.useState(()=>Zc(e));k.useEffect(()=>{i(Zc(e));let m=Da.get(e);return m||(m=new Set,Da.set(e,m)),m.add(i),()=>{const f=Da.get(e);f&&(f.delete(i),f.size===0&&Da.delete(e))}},[e]);const a=k.useCallback(m=>Zf(e,m),[e]),h=k.useCallback(m=>Zf(e,Zc(e)+m),[e]);return[s,a,h]}const Yo=["#A78BFA","#F472B6","#FB923C","#FBBF24","#34D399","#60A5FA","#F87171","#94A3B8"];function Av(e){for(const s of Yo)if(!e.some(i=>i.color.toLowerCase()===s.toLowerCase()))return s;return Yo[e.length%Yo.length]}function BE({onClose:e}){const{t:s}=it(),{error:i,success:a}=gl(),[h,m]=k.useState([]),[f,o]=k.useState(!1),[c,d]=k.useState($m),[p,u]=k.useState(!1),[v,b]=k.useState(!1),[C,w]=k.useState(!1),[x,y]=k.useState(!1),_=k.useRef(null),[S,N]=k.useState(""),[D,j]=k.useState(Yo[0]),[R,L]=k.useState(!1),[T,A]=k.useState(null),[z,O]=k.useState(""),[H,F]=k.useState(Yo[0]),[U,W]=k.useState(!1),[X,J]=k.useState([]),[P,B]=k.useState(""),[I,V]=k.useState(""),[$,se]=k.useState(!1),[ue,ae]=k.useState(null),[ee,Y]=k.useState(""),[he,de]=k.useState(""),[ke,re]=k.useState(!1);k.useEffect(()=>{let te=!1;return Promise.all([Hm(),Fm(),Bw()]).then(([le,xe,Pe])=>{te||(m(le),o(xe.defaultUseWorktree),d(xe.defaultFontSize),eu(xe.defaultFontSize),u(xe.imeDebug),j(Av(le)),J(Pe),b(!0))}).catch(le=>{te||i(le instanceof Error?le.message:"Failed to load")}),()=>{te=!0}},[i]);const Fe=S.trim(),Ne=!!Fe&&!R,Te=k.useMemo(()=>[...h].sort((te,le)=>te.sort_order-le.sort_order||te.name.localeCompare(le.name)),[h]);k.useEffect(()=>()=>{_.current&&clearTimeout(_.current)},[]);const be=te=>{if(!Number.isFinite(te))return;const le=Math.max(Ko,Math.min(Vo,Math.round(te)));d(le),eu(le),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{tf({defaultFontSize:le}).then(xe=>{d(xe.defaultFontSize),eu(xe.defaultFontSize)}).catch(xe=>i(xe instanceof Error?xe.message:"Save failed"))},350)},pe=async te=>{w(!0);try{const le=await tf({defaultUseWorktree:te});o(le.defaultUseWorktree),a(s("sessionSettings.saved"))}catch(le){i(le instanceof Error?le.message:"Save failed")}finally{w(!1)}},Je=async te=>{var le,xe;y(!0);try{const Pe=await tf({imeDebug:te});u(Pe.imeDebug),(xe=(le=window.electronAPI)==null?void 0:le.imeSetDebug)==null||xe.call(le,Pe.imeDebug),a(s("sessionSettings.saved"))}catch(Pe){i(Pe instanceof Error?Pe.message:"Save failed")}finally{y(!1)}},Ye=async()=>{if(Ne){L(!0);try{const te=await DE({name:Fe,color:D});m(le=>[...le,te]),N(""),j(Av([...h,te]))}catch(te){i(te instanceof Error?te.message:"Create failed")}finally{L(!1)}}},ge=te=>{A(te.id),O(te.name),F(te.color)},Ce=()=>{A(null),O("")},Ke=async()=>{if(!T)return;const te=z.trim();if(te){W(!0);try{const le=await RE(T,{name:te,color:H});m(xe=>xe.map(Pe=>Pe.id===le.id?le:Pe)),Ce()}catch(le){i(le instanceof Error?le.message:"Save failed")}finally{W(!1)}}},qe=async te=>{if(confirm(s("sessionSettings.tags.deleteConfirm").replace("{name}",te.name)))try{await ME(te.id),m(le=>le.filter(xe=>xe.id!==te.id))}catch(le){i(le instanceof Error?le.message:"Delete failed")}},tt=P.trim(),Oe=I.trim(),fe=!!tt&&!!Oe&&!$,je=k.useMemo(()=>[...X].sort((te,le)=>te.sort_order-le.sort_order||te.name.localeCompare(le.name)),[X]),oe=async()=>{if(fe){se(!0);try{const te=await Pw({name:tt,command_template:Oe});J(le=>[...le,te]),B(""),V("")}catch(te){i(te instanceof Error?te.message:"Create failed")}finally{se(!1)}}},q=te=>{ae(te.id),Y(te.name),de(te.command_template)},K=()=>{ae(null),Y(""),de("")},Q=async()=>{if(!ue)return;const te=ee.trim(),le=he.trim();if(!(!te||!le)){re(!0);try{const xe=await AE(ue,{name:te,command_template:le});J(Pe=>Pe.map(Re=>Re.id===xe.id?xe:Re)),K()}catch(xe){i(xe instanceof Error?xe.message:"Save failed")}finally{re(!1)}}},ie=async te=>{if(confirm(`Delete alias "${te.name}"? Sessions using it will fall back to OS default shell.`))try{await OE(te.id),J(le=>le.filter(xe=>xe.id!==te.id))}catch(le){i(le instanceof Error?le.message:"Delete failed")}};return t.jsxs("div",{className:"p-8",children:[t.jsx("h2",{className:"text-lg font-semibold text-warm-800 mb-1",children:s("sessionSettings.title")}),t.jsx("p",{className:"text-xs text-warm-400 mb-6",children:s("sessionSettings.description")}),t.jsxs("section",{className:"mb-7",children:[t.jsxs("h3",{className:"text-sm font-semibold text-warm-700 mb-2 flex items-center gap-1.5",children:[t.jsx(Fa,{size:14}),s("sessionSettings.worktree.title")]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[t.jsx("input",{type:"checkbox",checked:f,disabled:C||!v,onChange:te=>pe(te.target.checked),className:"rounded border-warm-300"}),t.jsx("span",{className:"text-sm text-warm-600",children:s("sessionSettings.worktree.label")})]}),t.jsx("p",{className:"mt-1 text-2xs ml-6",style:{color:"var(--color-text-muted)"},children:s("sessionSettings.worktree.hint")})]}),t.jsxs("section",{className:"mb-7",children:[t.jsxs("h3",{className:"text-sm font-semibold text-warm-700 mb-2 flex items-center gap-1.5",children:[t.jsx(jN,{size:14}),s("sessionSettings.fontSize.title")]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"range",min:Ko,max:Vo,step:1,value:c,disabled:!v,onChange:te=>be(parseInt(te.target.value,10)),className:"flex-1 max-w-xs","aria-label":s("sessionSettings.fontSize.label")}),t.jsx("input",{type:"number",min:Ko,max:Vo,step:1,value:c,disabled:!v,onChange:te=>be(parseInt(te.target.value,10)),className:"input text-sm w-20"}),t.jsx("span",{className:"text-xs text-warm-400",children:"px"})]}),t.jsx("p",{className:"mt-1 text-2xs",style:{color:"var(--color-text-muted)"},children:s("sessionSettings.fontSize.hint")})]}),t.jsxs("section",{children:[t.jsx("h3",{className:"text-sm font-semibold text-warm-700 mb-2",children:s("sessionSettings.tags.title")}),t.jsx("p",{className:"text-xs text-warm-400 mb-3",children:s("sessionSettings.tags.description")}),t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx("input",{type:"color",value:D,onChange:te=>j(te.target.value),className:"w-9 h-9 rounded cursor-pointer border border-warm-200",title:s("sessionSettings.tags.color")}),t.jsx("input",{type:"text",value:S,onChange:te=>N(te.target.value),onKeyDown:te=>{te.key==="Enter"&&(te.preventDefault(),Ye())},placeholder:s("sessionSettings.tags.namePlaceholder"),className:"input text-sm flex-1",maxLength:32}),t.jsxs("button",{type:"button",onClick:Ye,disabled:!Ne,className:"btn-primary text-sm py-1.5 px-3 inline-flex items-center gap-1",children:[t.jsx(mn,{size:14}),s("sessionSettings.tags.add")]})]}),Te.length===0?t.jsx("p",{className:"text-xs text-warm-400 italic py-3",children:s("sessionSettings.tags.empty")}):t.jsx("ul",{className:"space-y-1.5",children:Te.map(te=>{const le=T===te.id;return t.jsx("li",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border",style:{borderColor:"var(--color-border)"},children:le?t.jsxs(t.Fragment,{children:[t.jsx("input",{type:"color",value:H,onChange:xe=>F(xe.target.value),className:"w-7 h-7 rounded cursor-pointer border border-warm-200"}),t.jsx("input",{type:"text",value:z,onChange:xe=>O(xe.target.value),onKeyDown:xe=>{xe.key==="Enter"&&(xe.preventDefault(),Ke()),xe.key==="Escape"&&Ce()},autoFocus:!0,className:"input text-sm flex-1",maxLength:32}),t.jsx("button",{type:"button",onClick:Ke,disabled:U||!z.trim(),className:"p-1.5 text-status-success hover:bg-status-success/10 rounded",title:s("sessionSettings.tags.save"),children:t.jsx(si,{size:14})}),t.jsx("button",{type:"button",onClick:Ce,className:"p-1.5 text-warm-400 hover:bg-warm-100 rounded",title:s("sessionSettings.tags.cancel"),children:t.jsx(Xt,{size:14})})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"w-4 h-4 rounded-full shrink-0 border",style:{backgroundColor:te.color,borderColor:"rgba(0,0,0,0.08)"}}),t.jsx("span",{className:"text-sm text-warm-700 flex-1 truncate",children:te.name}),t.jsx("button",{type:"button",onClick:()=>ge(te),className:"p-1.5 text-warm-400 hover:text-warm-700 hover:bg-warm-100 rounded",title:s("sessionSettings.tags.edit"),children:t.jsx(ai,{size:14})}),t.jsx("button",{type:"button",onClick:()=>qe(te),className:"p-1.5 text-warm-400 hover:text-status-error hover:bg-warm-100 rounded",title:s("sessionSettings.tags.delete"),children:t.jsx(Nn,{size:14})})]})},te.id)})})]}),t.jsxs("section",{className:"mt-7",children:[t.jsx("h3",{className:"text-sm font-semibold text-warm-700 mb-2",children:"Terminal aliases"}),t.jsx("p",{className:"text-xs text-warm-400 mb-3",children:"Saved command snippets. Click the ⌘ icon in any terminal window's titlebar to insert one as input — Enter is yours to press."}),t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx("input",{type:"text",value:P,onChange:te=>B(te.target.value),placeholder:"Name (e.g. WSL Ubuntu)",className:"input text-sm w-44",maxLength:64}),t.jsx("input",{type:"text",value:I,onChange:te=>V(te.target.value),onKeyDown:te=>{te.key==="Enter"&&(te.preventDefault(),oe())},placeholder:"Command (e.g. wsl -d Ubuntu)",className:"input text-sm flex-1 font-mono",maxLength:1024}),t.jsxs("button",{type:"button",onClick:oe,disabled:!fe,className:"btn-primary text-sm py-1.5 px-3 inline-flex items-center gap-1",children:[t.jsx(mn,{size:14}),"Add"]})]}),je.length===0?t.jsx("p",{className:"text-xs text-warm-400 italic py-3",children:"No aliases yet."}):t.jsx("ul",{className:"space-y-1.5",children:je.map(te=>{const le=ue===te.id;return t.jsx("li",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border",style:{borderColor:"var(--color-border)"},children:le?t.jsxs(t.Fragment,{children:[t.jsx("input",{type:"text",value:ee,onChange:xe=>Y(xe.target.value),className:"input text-sm w-44",maxLength:64}),t.jsx("input",{type:"text",value:he,onChange:xe=>de(xe.target.value),onKeyDown:xe=>{xe.key==="Enter"&&(xe.preventDefault(),Q()),xe.key==="Escape"&&K()},autoFocus:!0,className:"input text-sm flex-1 font-mono",maxLength:1024}),t.jsx("button",{type:"button",onClick:Q,disabled:ke||!ee.trim()||!he.trim(),className:"p-1.5 text-status-success hover:bg-status-success/10 rounded",title:"Save",children:t.jsx(si,{size:14})}),t.jsx("button",{type:"button",onClick:K,className:"p-1.5 text-warm-400 hover:bg-warm-100 rounded",title:"Cancel",children:t.jsx(Xt,{size:14})})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-sm text-warm-700 w-44 truncate",children:te.name}),t.jsx("code",{className:"text-xs text-warm-500 flex-1 truncate font-mono",children:te.command_template}),t.jsx("button",{type:"button",onClick:()=>q(te),className:"p-1.5 text-warm-400 hover:text-warm-700 hover:bg-warm-100 rounded",title:"Edit",children:t.jsx(ai,{size:14})}),t.jsx("button",{type:"button",onClick:()=>ie(te),className:"p-1.5 text-warm-400 hover:text-status-error hover:bg-warm-100 rounded",title:"Delete",children:t.jsx(Nn,{size:14})})]})},te.id)})})]}),t.jsxs("section",{className:"mt-7",children:[t.jsxs("h3",{className:"text-sm font-semibold text-warm-700 mb-2 flex items-center gap-1.5",children:[t.jsx(_j,{size:14}),"IME 디버그 로그"]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[t.jsx("input",{type:"checkbox",checked:p,disabled:x||!v,onChange:te=>Je(te.target.checked),className:"rounded border-warm-300"}),t.jsx("span",{className:"text-sm text-warm-600",children:"한글 입력(IME) 진단 로그 기록"})]}),t.jsx("p",{className:"mt-1 text-2xs ml-6",style:{color:"var(--color-text-muted)"},children:"조합 창이 화면 좌상단에 뜨는 문제를 진단하기 위해 입력 시점 상태를 기록합니다. 데스크톱 앱에서만 동작하며, 로그는 앱 데이터 폴더의 ime-debug.log에 저장됩니다."})]}),e&&t.jsx("div",{className:"flex justify-end gap-3 mt-7",children:t.jsx("button",{type:"button",onClick:e,className:"btn-ghost text-sm",children:s("tunnel.close")})})]})}function Ov({open:e,onClose:s}){const{t:i}=it(),[a,h]=k.useState("account");if(!e)return null;const m=[{id:"account",label:i("settings.tabs.account"),icon:L5},{id:"session",label:i("settings.tabs.session"),icon:rl},{id:"tunnel",label:i("settings.tabs.tunnel"),icon:vw}];return t.jsx(Fn,{open:e,onClose:s,size:"xl",children:t.jsx("div",{className:"card shadow-2xl rounded-2xl overflow-hidden",children:t.jsxs("div",{className:"flex",style:{minHeight:460},children:[t.jsxs("aside",{className:"w-44 shrink-0 border-r flex flex-col",style:{borderColor:"var(--color-border)",backgroundColor:"var(--color-bg-hover)"},children:[t.jsx("div",{className:"px-4 pt-5 pb-3 text-xs font-semibold uppercase tracking-wider",style:{color:"var(--color-text-muted)"},children:i("settings.title")}),t.jsx("nav",{className:"flex flex-col",children:m.map(({id:f,label:o,icon:c})=>{const d=a===f;return t.jsxs("button",{type:"button",onClick:()=>h(f),className:"flex items-center gap-2 px-4 py-2.5 text-sm transition-colors text-left",style:{color:d?"var(--color-accent)":"var(--color-text-secondary)",backgroundColor:d?"var(--color-bg-primary)":"transparent",fontWeight:d?600:400},children:[t.jsx(c,{size:14}),t.jsx("span",{children:o})]},f)})}),t.jsxs("div",{className:"px-4 py-3 mt-auto text-[11px] tracking-wide",style:{color:"var(--color-text-muted)"},children:["v","0.2.32"]})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[a==="account"&&t.jsx(LE,{onClose:s}),a==="session"&&t.jsx(BE,{onClose:s}),a==="tunnel"&&t.jsx(TE,{onClose:s})]})]})})})}const PE={success:pw,error:Mm,warning:mw,info:E5},IE={success:"text-status-success",error:"text-status-error",warning:"text-status-warning",info:"text-accent"},HE={success:"bg-status-success",error:"bg-status-error",warning:"bg-status-warning",info:"bg-accent"};function FE({toast:e,onDismiss:s}){const[i,a]=k.useState(!1),h=PE[e.type],m=e.duration??3500;return k.useEffect(()=>{const f=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(f)},[]),t.jsxs("div",{className:vr("relative flex items-start gap-3 px-4 py-3 rounded-xl shadow-elevated overflow-hidden","bg-theme-card border border-theme-border min-w-[280px] max-w-sm","transition-all duration-300",i?"animate-slide-in-right opacity-100":"opacity-0 translate-x-8"),children:[t.jsx(h,{size:16,className:vr("mt-0.5 flex-shrink-0",IE[e.type])}),t.jsx("p",{className:"text-xs text-theme-text flex-1 leading-snug",children:e.message}),t.jsx("button",{onClick:()=>s(e.id),className:"p-0.5 rounded text-theme-muted hover:text-theme-text transition-colors flex-shrink-0",children:t.jsx(Xt,{size:12})}),t.jsx("div",{className:vr("absolute bottom-0 left-0 h-0.5",HE[e.type]),style:{animation:`toastProgress ${m}ms linear forwards`}})]})}function em({toasts:e,onDismiss:s}){return e.length===0?null:tn.createPortal(t.jsx("div",{className:"fixed bottom-6 right-6 z-toast flex flex-col gap-2 items-end",children:e.map(i=>t.jsx(FE,{toast:i,onDismiss:s},i.id))}),document.body)}const tm=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#06b6d4","#84cc16"];function $E(e,s){let i=0;for(let a=0;a<e.length;a++)i=(i<<5)-i+e.charCodeAt(a)|0;return Math.abs(i)%s}function ol(e){return e.color&&/^#[0-9a-f]{6}$/i.test(e.color)?e.color:tm[$E(e.id,tm.length)]}const zv=192,UE=88,Mc=8;function WE({project:e,anchorX:s,anchorY:i,onPick:a,onClose:h}){const m=k.useRef(null),[f,o]=k.useState({left:s,top:i}),c=ol(e);return k.useLayoutEffect(()=>{const d=Math.min(Math.max(s,Mc),window.innerWidth-zv-Mc),p=Math.min(Math.max(i,Mc),window.innerHeight-UE-Mc);o({left:d,top:p})},[s,i]),k.useEffect(()=>{const d=u=>{var v;(v=m.current)!=null&&v.contains(u.target)||h()},p=u=>{u.key==="Escape"&&h()};return window.addEventListener("mousedown",d),window.addEventListener("keydown",p),()=>{window.removeEventListener("mousedown",d),window.removeEventListener("keydown",p)}},[h]),tn.createPortal(t.jsxs("div",{ref:m,role:"menu",className:"z-tooltip",style:{position:"fixed",left:f.left,top:f.top,width:zv,background:"var(--color-bg-elevated, #1f1f23)",border:"1px solid var(--color-border)",borderRadius:10,padding:10,boxShadow:"0 12px 32px rgba(0,0,0,0.45)"},children:[t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginBottom:8},children:tm.map(d=>{const p=e.color?d.toLowerCase()===e.color.toLowerCase():d===c&&!e.color;return t.jsx("button",{onClick:()=>a(d),"aria-label":d,style:{width:20,height:20,borderRadius:6,background:d,border:p?"2px solid var(--color-text-primary)":"2px solid transparent",cursor:"pointer",padding:0}},d)})}),t.jsx("button",{onClick:()=>a(null),style:{width:"100%",background:"transparent",border:"1px solid var(--color-border)",color:"var(--color-text-tertiary)",padding:"4px 8px",borderRadius:6,fontSize:11,cursor:"pointer"},children:"자동 색 (기본값)"})]}),document.body)}function GE(e){return e==="executable"?Om:e==="command"?Ba:za}function qE({onLogout:e,authRequired:s,connected:i,onEvent:a,onClose:h,collapsed:m=!1,onToggleCollapsed:f}){var oe;const[o,c]=k.useState([]),[d,p]=k.useState({}),[u,v]=k.useState(null),[b,C]=k.useState(!1),[w,x]=k.useState(null),[y,_]=k.useState([]),[S,N]=k.useState(!1),[D,j]=k.useState(null),[R,L]=k.useState(!1),[T,A]=k.useState(null),[z,O]=k.useState(!1),[H,F]=k.useState(null),[U,W]=k.useState(null),X=Ps(),J=Hi(),{t:P,toggleLang:B}=it(),{theme:I,toggleTheme:V}=yE(),{enabled:$,supported:se,toggleNotification:ue}=Im(),{toasts:ae,error:ee,success:Y,info:he,warning:de,dismiss:ke}=gl(),re=((oe=X.pathname.match(/^\/projects\/([^/]+)/))==null?void 0:oe[1])||null;k.useEffect(()=>{ge(),Ne(),Jf().then(A).catch(()=>{})},[]);async function Fe(){if(!z){O(!0);try{const q=await Jf();if(A(q),q.status==="running"&&q.url){await navigator.clipboard.writeText(q.url),Y(P("tunnel.urlCopied"));return}const K=await Mw(),Q={status:"running",url:K.url};A(Q);try{await navigator.clipboard.writeText(K.url),Y(P("tunnel.urlCopied"))}catch{Y(K.url)}}catch(q){ee(q instanceof Error?q.message:P("tunnel.restartFailed"))}finally{O(!1)}}}function Ne(){uE().then(_).catch(()=>{})}const Te=async q=>{try{D?await hE(D.id,q):await dE(q),N(!1),j(null),Ne()}catch(K){ee(K instanceof Error?K.message:"Failed to save favorite")}},be=async q=>{try{await mE(q)}catch(K){const Q=K instanceof Error?K.message:P("favorites.launchFailed");ee(`${P("favorites.launchFailed")}: ${Q}`)}},pe=async(q,K)=>{if(K.preventDefault(),K.stopPropagation(),!!confirm(P("favorites.deleteConfirm")))try{await fE(q),_(Q=>Q.filter(ie=>ie.id!==q))}catch(Q){ee(Q instanceof Error?Q.message:"Failed to delete favorite")}},Je=(q,K)=>{K.preventDefault(),K.stopPropagation(),j(q),N(!0)};k.useEffect(()=>{const q=()=>ge();return window.addEventListener("projects:changed",q),()=>window.removeEventListener("projects:changed",q)},[]),k.useEffect(()=>{const q=()=>Ye();return window.addEventListener("review:changed",q),()=>window.removeEventListener("review:changed",q)},[]),k.useEffect(()=>a(q=>{var K;if(q.type==="project:status-changed"&&q.projectId&&p(Q=>({...Q,[q.projectId]:{running:q.running??0,completed:q.completed??0,total:q.total??0,running_sessions:q.running_sessions??0,running_discussions:q.running_discussions??0}})),q.type==="todo:status-changed"&&Ye(),q.type==="memory:ingest-finished"){const Q=o.find($e=>$e.id===q.projectId),ie=(Q==null?void 0:Q.name)??"",te=q.sourceTitle?`“${q.sourceTitle}”`:q.sourceType??"",le=ie?`[${ie}] `:"";if(q.error){ee(`${le}${P("wiki.ingest.toast.failed")}: ${q.error}`,6e3);return}const xe=q.created??0,Pe=q.updated??0,Re=q.edgesAdded??0;if(xe+Pe+Re>0){const $e=P("wiki.ingest.toast.success").replace("{source}",te).replace("{created}",String(xe)).replace("{updated}",String(Pe)).replace("{edges}",String(Re));Y(`${le}${$e}`)}else(K=q.skipped)!=null&&K.parseFailed?de(`${le}${P("wiki.ingest.toast.parseFailed").replace("{source}",te)}`,5e3):he(`${le}${P("wiki.ingest.toast.empty").replace("{source}",te)}`,4e3)}}),[a,o,P,ee,he,Y,de]),k.useEffect(()=>{Ye()},[]);function Ye(){Rw({hours:24}).then(q=>v(q.total_todos)).catch(()=>{})}function ge(){Lu().then(q=>{c(q),q.forEach(K=>{Cw(K.id).then(Q=>{p(ie=>({...ie,[K.id]:Q}))}).catch(()=>{})})}).catch(()=>{})}const Ce=()=>{h==null||h()},Ke=async(q,K)=>{await Sw({name:q,path:K}),C(!1),window.dispatchEvent(new Event("projects:changed"))},qe=k.useCallback(async(q,K)=>{const Q=o.map($e=>$e.id),ie=Q.indexOf(q);if(ie<0)return;const te=Q.filter($e=>$e!==q),le=K>ie?K-1:K;if(le===ie)return;const xe=[...te.slice(0,le),q,...te.slice(le)],Pe=o,Re=new Map(o.map($e=>[$e.id,$e])),ve=xe.map($e=>Re.get($e)).filter(Boolean);c(ve);try{await WN(xe)}catch($e){c(Pe),ee($e instanceof Error?$e.message:"Failed to reorder projects")}},[o,ee]),tt=k.useRef(!1),Oe=k.useCallback((q,K)=>{if(K.button!==0||K.target.closest("button"))return;K.preventDefault();const ie=K.clientX,te=K.clientY,le=6;let xe=!1,Pe=null;const Re=Be=>{const Ze=document.querySelectorAll("[data-workspace-item]");if(Ze.length===0)return null;const lt=Ze[0].getBoundingClientRect();if(Be<lt.top)return 0;const Ie=Ze[Ze.length-1].getBoundingClientRect();if(Be>Ie.bottom)return Ze.length;for(let Ee=0;Ee<Ze.length;Ee++){const ot=Ze[Ee].getBoundingClientRect();if(Be>=ot.top&&Be<=ot.bottom){const ht=ot.top+ot.height/2;return Be<ht?Ee:Ee+1}}return null},ve=Be=>{if(!xe){if(Math.hypot(Be.clientX-ie,Be.clientY-te)<le)return;xe=!0,F(q)}const Ze=Re(Be.clientY);Ze!==Pe&&(Pe=Ze,W(Ze))},$e=()=>{window.removeEventListener("mousemove",ve),window.removeEventListener("mouseup",et),window.removeEventListener("keydown",dt)},et=()=>{if($e(),!xe)return;tt.current=!0,requestAnimationFrame(()=>{tt.current=!1});const Be=Pe;F(null),W(null),Be!==null&&qe(q,Be)},dt=Be=>{Be.key==="Escape"&&($e(),F(null),W(null),xe&&(tt.current=!0,requestAnimationFrame(()=>{tt.current=!1})))};window.addEventListener("mousemove",ve),window.addEventListener("mouseup",et),window.addEventListener("keydown",dt)},[qe]),fe=async(q,K)=>{if(K.preventDefault(),K.stopPropagation(),!!confirm(P("projects.deleteConfirm")))try{await kw(q),c(Q=>Q.filter(ie=>ie.id!==q)),window.dispatchEvent(new Event("projects:changed")),re===String(q)&&J("/")}catch{}},je=q=>t.jsx("div",{className:"pointer-events-none absolute left-2 right-2 h-0.5 rounded-full",style:{backgroundColor:"var(--color-accent)",zIndex:10,...q==="above"?{top:-1}:{bottom:-1}}});if(m){const q=t.jsx("div",{className:"w-7 border-t my-1.5",style:{borderColor:"var(--color-border)"}});return t.jsxs("div",{className:"flex flex-col items-center h-full glass border-none py-3",children:[t.jsx("button",{onClick:f,className:"flex items-center justify-center w-9 h-9 rounded-lg transition-colors hover:bg-theme-hover",style:{color:"var(--color-text-tertiary)"},title:P("sidebar.expand"),children:t.jsx(sN,{size:18})}),q,t.jsx(zn,{to:"/",onClick:Ce,className:"relative flex items-center justify-center w-9 h-9 rounded-lg transition-colors hover:bg-theme-hover",style:X.pathname==="/"?{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-primary)"}:{color:"var(--color-text-tertiary)"},title:P("sidebar.home"),children:t.jsx(wv,{size:18})}),t.jsxs(zn,{to:"/review",onClick:Ce,className:"relative flex items-center justify-center w-9 h-9 rounded-lg transition-colors hover:bg-theme-hover mt-0.5",style:X.pathname==="/review"?{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-primary)"}:{color:"var(--color-text-tertiary)"},title:P("sidebar.review"),children:[t.jsx(ou,{size:18}),u!==null&&u>0&&t.jsx("span",{className:"absolute top-1 right-1 w-1.5 h-1.5 rounded-full",style:{backgroundColor:"var(--color-accent)"}})]}),t.jsx(zn,{to:"/agenda",onClick:Ce,className:"relative flex items-center justify-center w-9 h-9 rounded-lg transition-colors hover:bg-theme-hover mt-0.5",style:X.pathname==="/agenda"?{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-primary)"}:{color:"var(--color-text-tertiary)"},title:P("sidebar.agenda"),children:t.jsx($f,{size:18})}),q,t.jsx("div",{className:"flex-1 overflow-y-auto w-full flex flex-col items-center gap-1 py-1",children:o.map(K=>{const Q=d[K.id],ie=re===String(K.id),te=Q?Q.running+Q.running_sessions+Q.running_discussions:0,le=te>0,xe=ol(K);return t.jsxs(zn,{to:`/projects/${K.id}`,onClick:Ce,className:"relative flex items-center justify-center w-9 h-9 rounded-lg transition-colors hover:bg-theme-hover",style:ie?{backgroundColor:"var(--color-bg-hover)"}:void 0,title:le?`${K.name} · ${te} ${P("detail.live")}`:K.name,children:[ie&&t.jsx("span",{className:"absolute left-0 top-1/4 bottom-1/4 w-[3px] rounded-r-full",style:{backgroundColor:xe}}),t.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${le?"workspace-dot-pulse":""}`,style:{backgroundColor:xe,opacity:ie||le?1:.55}})]},K.id)})}),q,t.jsx("span",{className:`w-1.5 h-1.5 rounded-full my-1 ${i?"bg-status-success":"bg-status-error"}`,title:i?P("detail.live"):"Disconnected"}),t.jsx("button",{onClick:V,className:"flex items-center justify-center w-9 h-9 rounded-lg transition-colors hover:bg-theme-hover",style:{color:"var(--color-text-tertiary)"},title:P(I==="light"?"theme.dark":"theme.light"),children:I==="light"?t.jsx(Sv,{size:16}):t.jsx(Cv,{size:16})}),t.jsx("button",{onClick:()=>L(!0),className:"flex items-center justify-center w-9 h-9 rounded-lg transition-colors hover:bg-theme-hover",style:{color:"var(--color-text-tertiary)"},title:P("settings.title"),children:t.jsx(cu,{size:16})}),t.jsx(Ov,{open:R,onClose:()=>L(!1)}),t.jsx(em,{toasts:ae,onDismiss:ke})]})}return t.jsxs("div",{className:"flex flex-col h-full glass border-none",onDragStart:q=>q.preventDefault(),children:[t.jsxs("div",{className:"px-4 pt-5 pb-3 flex items-center justify-between",children:[t.jsx(zn,{to:"/",onClick:Ce,className:"block",children:t.jsxs("svg",{viewBox:"0 0 200 32",fill:"none",className:"h-6 w-auto",children:[t.jsxs("text",{x:"0",y:"24",fontFamily:"'JetBrains Mono', monospace",fontSize:"22",fontWeight:"500",fill:"var(--color-accent)",opacity:"0.5",children:[">","_"]}),t.jsx("text",{x:"38",y:"24",fontFamily:"'JetBrains Mono', monospace",fontSize:"22",fontWeight:"700",fill:"var(--color-accent)",children:"CLI"}),t.jsx("text",{x:"96",y:"24",fontFamily:"'JetBrains Mono', monospace",fontSize:"22",fontWeight:"500",fill:"var(--color-text-primary)",children:"Trigger"})]})}),t.jsx("button",{onClick:f,className:"hidden md:flex items-center justify-center w-7 h-7 rounded-md transition-colors hover:bg-theme-hover flex-shrink-0",style:{color:"var(--color-text-tertiary)"},title:P("sidebar.collapse"),children:t.jsx(tN,{size:16})})]}),t.jsxs("nav",{className:"px-3 mb-2 space-y-0.5",children:[t.jsxs(zn,{to:"/",onClick:Ce,className:`relative flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-all duration-200 active:scale-95 ${X.pathname==="/"?"font-medium":""}`,style:X.pathname==="/"?{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-primary)",boxShadow:"var(--shadow-soft)"}:{color:"var(--color-text-tertiary)"},children:[X.pathname==="/"&&t.jsx("span",{className:"absolute left-0 top-1/4 bottom-1/4 w-[3px] rounded-r-full",style:{backgroundColor:"var(--color-accent)"}}),t.jsx(wv,{size:16}),P("sidebar.home")]}),t.jsxs(zn,{to:"/review",onClick:Ce,className:`relative flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-all duration-200 active:scale-95 ${X.pathname==="/review"?"font-medium":""}`,style:X.pathname==="/review"?{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-primary)",boxShadow:"var(--shadow-soft)"}:{color:"var(--color-text-tertiary)"},children:[X.pathname==="/review"&&t.jsx("span",{className:"absolute left-0 top-1/4 bottom-1/4 w-[3px] rounded-r-full",style:{backgroundColor:"var(--color-accent)"}}),t.jsx(ou,{size:16}),t.jsx("span",{className:"flex-1",children:P("sidebar.review")}),u!==null&&u>0&&t.jsx("span",{className:"text-2xs px-1.5 py-0.5 rounded-full font-medium",style:{backgroundColor:"var(--color-accent)",color:"white"},children:u})]}),t.jsxs(zn,{to:"/agenda",onClick:Ce,className:`relative flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-all duration-200 active:scale-95 ${X.pathname==="/agenda"?"font-medium":""}`,style:X.pathname==="/agenda"?{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-primary)",boxShadow:"var(--shadow-soft)"}:{color:"var(--color-text-tertiary)"},children:[X.pathname==="/agenda"&&t.jsx("span",{className:"absolute left-0 top-1/4 bottom-1/4 w-[3px] rounded-r-full",style:{backgroundColor:"var(--color-accent)"}}),t.jsx($f,{size:16}),P("sidebar.agenda")]})]}),t.jsx("div",{className:"mx-4 border-t",style:{borderColor:"var(--color-border)"}}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-3 pt-3",children:[t.jsxs("div",{className:"px-3 mb-2 flex items-center justify-between",children:[t.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider",style:{color:"var(--color-text-muted)"},children:P("sidebar.workspaces")}),t.jsx("button",{onClick:()=>C(!0),className:"flex items-center justify-center w-5 h-5 rounded-md transition-colors hover:bg-theme-hover",style:{color:"var(--color-text-tertiary)"},title:P("projects.new"),children:t.jsx(mn,{size:14,strokeWidth:2})})]}),t.jsx("div",{className:"space-y-0.5",children:o.map((q,K)=>{const Q=d[q.id],ie=re===String(q.id),te=Q?Q.running+Q.running_sessions+Q.running_discussions:0,le=te>0,xe=ol(q),Pe=H===q.id,Re=H!==null&&U===K,ve=H!==null&&K===o.length-1&&U===o.length;return t.jsxs("div",{className:"relative","data-workspace-item":!0,children:[Re&&je("above"),t.jsxs(zn,{to:`/projects/${q.id}`,draggable:!1,onDragStart:$e=>$e.preventDefault(),onClick:$e=>{if(tt.current){$e.preventDefault();return}Ce()},onMouseDown:$e=>Oe(q.id,$e),onContextMenu:$e=>{$e.preventDefault(),x({project:q,x:$e.clientX,y:$e.clientY})},className:`relative flex items-center gap-2.5 px-3 py-1.5 rounded-lg text-sm transition-all duration-200 hover:bg-theme-hover active:scale-95 group ${ie?"font-medium":""} ${Pe?"opacity-50":""}`,style:ie?{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-primary)",boxShadow:"var(--shadow-soft)",cursor:H?"grabbing":"pointer",userSelect:"none"}:{color:"var(--color-text-tertiary)",cursor:H?"grabbing":"pointer",userSelect:"none"},children:[ie&&t.jsx("span",{className:"absolute left-0 top-1/4 bottom-1/4 w-[3px] rounded-r-full",style:{backgroundColor:xe}}),t.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${le?"workspace-dot-pulse":""}`,style:{backgroundColor:xe,opacity:ie||le?1:.55},title:le?`${P("sidebar.workspaces")} · ${te} ${P("detail.live")}`:q.name}),t.jsx("span",{className:"truncate flex-1",children:q.name}),t.jsx("button",{onClick:$e=>fe(q.id,$e),className:"flex-shrink-0 p-0.5 rounded opacity-0 group-hover:opacity-100 transition-all hover:bg-status-error/10",style:{color:"var(--color-text-muted)"},title:P("projects.delete"),children:t.jsx(Xt,{size:12,strokeWidth:2})})]}),ve&&je("below")]},q.id)})})]}),b&&t.jsx(zw,{onSubmit:(q,K)=>Ke(q,K),onCancel:()=>C(!1)}),t.jsxs("div",{className:"px-3 pt-3 pb-2 border-t",style:{borderColor:"var(--color-border)"},children:[t.jsxs("div",{className:"px-3 mb-2 flex items-center justify-between",children:[t.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider",style:{color:"var(--color-text-muted)"},children:P("sidebar.favorites")}),t.jsx("button",{onClick:()=>{j(null),N(!0)},className:"flex items-center justify-center w-5 h-5 rounded-md transition-colors hover:bg-theme-hover",style:{color:"var(--color-text-tertiary)"},title:P("favorites.add"),children:t.jsx(mn,{size:14,strokeWidth:2})})]}),t.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:y.map(q=>{const K=GE(q.type);return t.jsxs("button",{onClick:()=>be(q.id),className:"w-full relative flex items-center gap-2.5 px-3 py-1.5 rounded-lg text-sm transition-all duration-200 hover:bg-theme-hover active:scale-95 group",style:{color:"var(--color-text-tertiary)"},title:q.target,children:[t.jsx(K,{size:14,className:"flex-shrink-0"}),t.jsx("span",{className:"truncate flex-1 text-left",children:q.name}),t.jsx("span",{onClick:Q=>Je(q,Q),className:"flex-shrink-0 p-0.5 rounded opacity-0 group-hover:opacity-100 transition-all hover:bg-theme-hover cursor-pointer",style:{color:"var(--color-text-muted)"},title:P("favorites.edit"),children:t.jsx(qf,{size:11,strokeWidth:2})}),t.jsx("span",{onClick:Q=>pe(q.id,Q),className:"flex-shrink-0 p-0.5 rounded opacity-0 group-hover:opacity-100 transition-all hover:bg-status-error/10 cursor-pointer",style:{color:"var(--color-text-muted)"},title:P("favorites.delete"),children:t.jsx(Xt,{size:12,strokeWidth:2})})]},q.id)})})]}),S&&t.jsx(NE,{initial:D??void 0,onSubmit:Te,onCancel:()=>{N(!1),j(null)}}),w&&t.jsx(WE,{project:w.project,anchorX:w.x,anchorY:w.y,onPick:async q=>{try{const K=await Kf(w.project.id,{color:q});c(Q=>Q.map(ie=>ie.id===K.id?{...ie,color:K.color}:ie)),window.dispatchEvent(new Event("projects:changed"))}catch(K){ee(K instanceof Error?K.message:"Failed to update color")}x(null)},onClose:()=>x(null)}),t.jsx(Ov,{open:R,onClose:()=>L(!1)}),t.jsx(em,{toasts:ae,onDismiss:ke}),t.jsx("div",{className:"px-3 pb-4 pt-2",style:{borderTop:"1px solid var(--color-border)"},children:t.jsxs("div",{className:"flex items-center gap-1 px-1",children:[t.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 mr-1 ${i?"bg-status-success":"bg-status-error"}`,title:i?P("detail.live"):"Disconnected"}),t.jsx("button",{onClick:V,className:"flex items-center justify-center w-8 h-8 rounded-lg transition-colors",style:{color:"var(--color-text-tertiary)"},title:P(I==="light"?"theme.dark":"theme.light"),children:I==="light"?t.jsx(Sv,{size:16}):t.jsx(Cv,{size:16})}),t.jsx("button",{onClick:B,className:"flex items-center justify-center w-8 h-8 rounded-lg transition-colors text-xs font-medium",style:{color:"var(--color-text-tertiary)"},children:P("lang.toggle")}),se&&t.jsx("button",{onClick:ue,className:"flex items-center justify-center w-8 h-8 rounded-lg transition-colors",style:{color:$?"var(--color-accent)":"var(--color-text-tertiary)"},title:"Notification"in window&&Notification.permission==="denied"?P("notification.blocked"):P("notification.toggle"),children:$?t.jsx(yj,{size:16}):t.jsx(vj,{size:16})}),t.jsx("button",{onClick:Fe,disabled:z,className:"flex items-center justify-center w-8 h-8 rounded-lg transition-colors disabled:opacity-50",style:{color:(T==null?void 0:T.status)==="running"?"var(--color-accent)":"var(--color-text-tertiary)"},title:(T==null?void 0:T.status)==="running"&&T.url?`${T.url} — ${P("tunnel.urlCopied")}`:P(z?"tunnel.starting":"tunnel.start"),children:t.jsx(vw,{size:16})}),t.jsx("button",{onClick:()=>L(!0),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-colors",style:{color:"var(--color-text-tertiary)"},title:P("settings.title"),children:t.jsx(cu,{size:16})}),s&&t.jsx("button",{onClick:e,className:"flex items-center justify-center w-8 h-8 rounded-lg transition-colors ml-auto",style:{color:"var(--color-text-tertiary)"},title:P("projects.logout"),children:t.jsx(F5,{size:16})})]})})]})}const KE=80,Bv=120,mr=180,Pv=.03,Iv=8;function VE(){const e=k.useRef(null),s=k.useRef({x:-1e3,y:-1e3}),i=k.useRef([]),a=k.useRef(0);return k.useEffect(()=>{const h=e.current;if(!h)return;const m=h.getContext("2d");if(!m)return;let f=0,o=0;function c(){const b=h.parentElement;b&&(f=b.clientWidth,o=b.clientHeight,h.width=f*window.devicePixelRatio,h.height=o*window.devicePixelRatio,h.style.width=`${f}px`,h.style.height=`${o}px`,m.setTransform(window.devicePixelRatio,0,0,window.devicePixelRatio,0,0),d())}function d(){i.current=[];for(let b=0;b<KE;b++){const C=Math.random()*f,w=Math.random()*o;i.current.push({x:C,y:w,baseX:C,baseY:w,vx:(Math.random()-.5)*.3,vy:(Math.random()-.5)*.3,size:Math.random()*1.5+.5,alpha:Math.random()*.4+.1})}}function p(b){const C=h.getBoundingClientRect();s.current.x=b.clientX-C.left,s.current.y=b.clientY-C.top}function u(){s.current.x=-1e3,s.current.y=-1e3}function v(){if(!m)return;m.clearRect(0,0,f,o);const b=i.current,C=s.current;for(const w of b){const x=w.x-C.x,y=w.y-C.y,_=Math.sqrt(x*x+y*y);if(_<mr&&_>0){const S=(mr-_)/mr,N=Math.atan2(y,x);w.vx+=Math.cos(N)*S*Iv*.05,w.vy+=Math.sin(N)*S*Iv*.05}w.vx+=(w.baseX-w.x)*Pv,w.vy+=(w.baseY-w.y)*Pv,w.baseX+=(Math.random()-.5)*.1,w.baseY+=(Math.random()-.5)*.1,w.baseX<0&&(w.baseX=0),w.baseX>f&&(w.baseX=f),w.baseY<0&&(w.baseY=0),w.baseY>o&&(w.baseY=o),w.vx*=.92,w.vy*=.92,w.x+=w.vx,w.y+=w.vy}for(let w=0;w<b.length;w++){for(let S=w+1;S<b.length;S++){const N=b[w].x-b[S].x,D=b[w].y-b[S].y,j=Math.sqrt(N*N+D*D);if(j<Bv){const R=(1-j/Bv)*.15;m.beginPath(),m.strokeStyle=`rgba(75, 141, 255, ${R})`,m.lineWidth=.5,m.moveTo(b[w].x,b[w].y),m.lineTo(b[S].x,b[S].y),m.stroke()}}const x=b[w].x-C.x,y=b[w].y-C.y,_=Math.sqrt(x*x+y*y);if(_<mr){const S=(1-_/mr)*.3;m.beginPath(),m.strokeStyle=`rgba(75, 141, 255, ${S})`,m.lineWidth=.8,m.moveTo(b[w].x,b[w].y),m.lineTo(C.x,C.y),m.stroke()}}for(const w of b){const x=w.x-C.x,y=w.y-C.y,_=Math.sqrt(x*x+y*y),S=_<mr?w.alpha+(1-_/mr)*.5:w.alpha;m.beginPath(),m.arc(w.x,w.y,w.size,0,Math.PI*2),m.fillStyle=`rgba(75, 141, 255, ${S})`,m.fill(),_<mr&&(m.beginPath(),m.arc(w.x,w.y,w.size*3,0,Math.PI*2),m.fillStyle=`rgba(75, 141, 255, ${(1-_/mr)*.08})`,m.fill())}a.current=requestAnimationFrame(v)}return c(),h.addEventListener("mousemove",p),h.addEventListener("mouseleave",u),window.addEventListener("resize",c),a.current=requestAnimationFrame(v),()=>{cancelAnimationFrame(a.current),h.removeEventListener("mousemove",p),h.removeEventListener("mouseleave",u),window.removeEventListener("resize",c)}},[]),t.jsx("canvas",{ref:e,className:"absolute inset-0 pointer-events-auto",style:{zIndex:0}})}function YE({children:e,onLogout:s,authRequired:i,connected:a,onEvent:h}){const[m,f]=k.useState(!1),[o,c]=k.useState(()=>localStorage.getItem("sidebarCollapsed")==="1"),d=()=>{c(p=>{const u=!p;return localStorage.setItem("sidebarCollapsed",u?"1":"0"),u})};return t.jsxs("div",{className:"flex h-screen bg-theme-bg",children:[t.jsx("aside",{className:`
|
|
588
588
|
fixed inset-y-0 left-0 z-40 flex-shrink-0
|
|
589
589
|
transition-[transform,width] duration-200 ease-in-out
|
|
590
590
|
md:translate-x-0 md:static md:z-auto
|
|
@@ -631,7 +631,7 @@ ${A.message}
|
|
|
631
631
|
`)?"":`
|
|
632
632
|
`;await t6(e,a+f+h+`
|
|
633
633
|
`)}async function NB(e,s,i){await nt(`/api/projects/${e}/vault/ignore/unhide`,{path:s,isDir:i})}function n6(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(2)}MB`}function s6(e){const s=new Map,i=new Map;for(const h of e){const m=h.stem.toLowerCase(),f=h.title.toLowerCase(),o=s.get(m)??[];o.push(h.relativePath),s.set(m,o);const c=i.get(f)??[];c.push(h.relativePath),i.set(f,c)}const a=new Map;for(const h of e){const m=h.relativePath.includes("/")?h.relativePath.slice(0,h.relativePath.lastIndexOf("/")+1):"",f=[];for(const o of h.wikilinks){const c=o.toLowerCase(),d=s.get(c)??i.get(c)??[];if(d.length===0)continue;const p=d.length===1?d[0]:d.find(u=>u.startsWith(m))??d[0];p&&p!==h.relativePath&&!f.includes(p)&&f.push(p)}a.set(h.relativePath,f)}return a}function cp({projectId:e,mode:s,selectedPaths:i,includeLinked:a,onChange:h}){const{t:m}=it(),[f,o]=k.useState([]),[c,d]=k.useState(!1),[p,u]=k.useState(!1),[v,b]=k.useState(""),[C,w]=k.useState(!1),[x,y]=k.useState("");k.useEffect(()=>{let R=!1;return QA(e).then(L=>{R||(o(L.files),d(!0))}).catch(L=>{console.error("Load vault files failed",L),d(!0)}),()=>{R=!0}},[e]);const _=k.useMemo(()=>{const R=x.toLowerCase(),L=R?f.filter(A=>A.stem.toLowerCase().includes(R)||A.title.toLowerCase().includes(R)||A.relativePath.toLowerCase().includes(R)):f,T={};for(const A of L){const z=A.relativePath.includes("/")?A.relativePath.split("/").slice(0,-1).join("/"):".";T[z]||(T[z]=[]),T[z].push(A)}return T},[f,x]),S=k.useMemo(()=>s6(f),[f]),N=R=>{const L=new Set(i);if(L.has(R))L.delete(R);else if(L.add(R),a){const T=S.get(R)??[];for(const A of T)L.add(A)}h("selected",Array.from(L),a)},D=async()=>{w(!0);try{const L=await ZA(e,s==="auto"?"all":s,i);b(L.block||m("vault.empty"))}catch(R){b(R instanceof Error?R.message:"Preview failed")}finally{w(!1)}},j=s!=="none"&&s!=="auto";return k.useEffect(()=>{p&&j&&D()},[p,s,i]),t.jsxs("div",{className:"rounded-lg border border-warm-200 bg-warm-50 p-3",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("div",{className:"text-sm font-medium text-warm-800",children:m("vaultInject.title")}),j&&t.jsxs("button",{type:"button",onClick:()=>u(R=>!R),className:"inline-flex items-center gap-1 text-xs text-warm-600 hover:text-warm-800",children:[p?t.jsx(i5,{size:12}):t.jsx(Gf,{size:12}),m("vaultInject.previewToggle")]})]}),t.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:["none","auto","all","selected"].map(R=>t.jsx("button",{type:"button",onClick:()=>h(R,R==="selected"?i:[],a),className:`px-3 py-1.5 rounded-md text-xs ${s===R?"bg-warm-700 text-warm-50":"bg-warm-100 text-warm-700 hover:bg-warm-200"}`,children:m(`vaultInject.mode${R.charAt(0).toUpperCase()+R.slice(1)}`)},R))}),s==="auto"&&t.jsx("div",{className:"text-xs text-warm-500 mt-1 leading-snug",children:m("vaultInject.autoHint").replace("{count}",String(f.length))}),s==="selected"&&t.jsx("div",{className:"mt-2",children:c?f.length===0?t.jsx("div",{className:"text-xs text-warm-500 italic",children:m("vaultInject.empty")}):t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"flex items-center gap-2 text-xs text-warm-600 mb-2 cursor-pointer select-none",children:[t.jsx("input",{type:"checkbox",checked:a,onChange:R=>h(s,i,R.target.checked)}),m("vaultInject.includeLinked")]}),t.jsx("input",{value:x,onChange:R=>y(R.target.value),placeholder:m("vaultInject.searchPlaceholder"),className:"w-full px-2 py-1.5 rounded-md border border-warm-200 bg-warm-0 text-sm focus:outline-none focus:ring-2 focus:ring-warm-400 mb-2"}),t.jsx("div",{className:"max-h-56 overflow-y-auto border border-warm-200 rounded-md",children:Object.keys(_).length===0?t.jsx("div",{className:"text-xs text-warm-500 italic px-2 py-2",children:m("vaultInject.noResults")}):Object.entries(_).sort(([R],[L])=>R.localeCompare(L)).map(([R,L])=>t.jsxs("div",{children:[t.jsx("div",{className:"text-[10px] uppercase tracking-wide text-warm-500 px-2 py-1 bg-warm-100 sticky top-0 font-mono",children:R}),t.jsx("div",{className:"divide-y divide-warm-100",children:L.map(T=>{const A=(S.get(T.relativePath)??[]).length;return t.jsxs("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-warm-100 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:i.includes(T.relativePath),onChange:()=>N(T.relativePath)}),T.kind==="html"?t.jsx(Om,{size:12,className:"text-warm-500 shrink-0"}):t.jsx(Bi,{size:12,className:"text-warm-500 shrink-0"}),t.jsx("span",{className:"text-sm text-warm-800 truncate flex-1",title:T.relativePath,children:T.title||T.stem}),a&&A>0&&t.jsx("span",{className:"text-[10px] text-warm-600 bg-warm-200 px-1.5 py-0.5 rounded shrink-0",title:T.wikilinks.join(", "),children:m("vaultInject.linkedAdded").replace("{n}",String(A))}),t.jsx("span",{className:"text-[10px] text-warm-500 font-mono shrink-0",children:n6(T.size)})]},T.relativePath)})})]},R))}),t.jsx("div",{className:"text-xs text-warm-500 mt-1.5",children:m("vaultInject.injectedCount").replace("{count}",String(i.length))})]}):t.jsx("div",{className:"text-xs text-warm-500",children:m("vaultInject.loading")})}),s==="all"&&f.length>0&&t.jsx("div",{className:"text-xs text-warm-500 mt-1",children:m("vaultInject.allCount").replace("{count}",String(f.length))}),p&&j&&t.jsxs("div",{className:"mt-3",children:[t.jsx("textarea",{readOnly:!0,value:C?"...":v,rows:8,className:"w-full px-2 py-1.5 rounded-md border border-warm-200 bg-warm-100 text-xs font-mono resize-y"}),!C&&v&&t.jsxs("div",{className:"mt-1 flex items-center justify-end gap-3 text-[10px] text-warm-500 font-mono",children:[t.jsx("span",{children:m("vaultInject.previewChars").replace("{n}",v.length.toLocaleString())}),t.jsx("span",{children:m("vaultInject.previewTokens").replace("{n}",Math.ceil(v.length/4).toLocaleString())})]})]})]})}function r6(e){if(!e)return[];try{const s=JSON.parse(e);return Array.isArray(s)?s.map(String).filter(Boolean):[]}catch{return[]}}let i6=0;function c_({onSave:e,onCancel:s,initialTitle:i="",initialDescription:a="",initialCliTool:h,initialDependsOn:m,initialMaxTurns:f,initialUseWorktree:o=null,initialMemoryInjectMode:c="none",initialMemoryRawFilePaths:d=null,projectId:p,projectCliTool:u="claude",projectIsGitRepo:v=!1,projectUseWorktree:b=!0,existingImages:C=[],todoId:w,onDeleteImage:x,availableTodos:y=[]}){const[_,S]=k.useState(i),[N,D]=k.useState(a),[j,R]=k.useState(h||u||"claude"),[L,T]=k.useState(m??""),[A,z]=k.useState((f==null?void 0:f.toString())??""),[O,H]=k.useState(o===1?"force-on":o===0?"force-off":"inherit"),[F,U]=k.useState(c),[W,X]=k.useState(r6(d)),[J,P]=k.useState(!1),[B,I]=k.useState([]),[V,$]=k.useState(C),se=k.useRef(null),ue=k.useRef(null),{t:ae}=it(),ee=k.useCallback(Te=>{const be=Array.from(Te).filter(pe=>pe.type.startsWith("image/"));for(const pe of be){const Je=new FileReader;Je.onload=()=>{const Ye=Je.result,ge=`pending-${++i6}`;I(Ce=>[...Ce,{id:ge,name:pe.name,data:Ye,preview:Ye}])},Je.readAsDataURL(pe)}},[]),Y=k.useCallback(Te=>{var Ye;const be=(Ye=Te.clipboardData)==null?void 0:Ye.items;if(!be)return;const pe=[];for(let ge=0;ge<be.length;ge++)be[ge].type.startsWith("image/")&&pe.push(be[ge]);if(pe.length===0)return;Te.preventDefault();const Je=[];for(const ge of pe){const Ce=ge.getAsFile();Ce&&Je.push(Ce)}ee(Je)},[ee]),he=k.useCallback(Te=>{var be;Te.preventDefault(),Te.stopPropagation(),(be=Te.dataTransfer)!=null&&be.files&&ee(Te.dataTransfer.files)},[ee]),de=k.useCallback(Te=>{Te.preventDefault(),Te.stopPropagation()},[]),ke=Te=>{I(be=>be.filter(pe=>pe.id!==Te))},re=Te=>{x&&x(Te),$(be=>be.filter(pe=>pe.id!==Te))},Fe=Te=>{if(Te.preventDefault(),!_.trim())return;const be=A?parseInt(A,10):void 0,pe=O==="force-on"?1:O==="force-off"?0:null;e(_.trim(),N.trim(),j,B.length>0?B:void 0,L||void 0,be||void 0,pe,F,[],W)},Ne=V.length+B.length;return t.jsxs("form",{onSubmit:Fe,className:"card p-5 border-accent/30",children:[t.jsx("div",{className:"mb-3",children:t.jsx("input",{type:"text",placeholder:ae("todoForm.titlePlaceholder"),value:_,onChange:Te=>S(Te.target.value),className:"input-field",autoFocus:!0})}),t.jsxs("div",{className:"mb-4",children:[t.jsx("textarea",{ref:se,placeholder:ae("todoForm.descPlaceholder"),value:N,onChange:Te=>D(Te.target.value),onPaste:Y,onDrop:he,onDragOver:de,rows:3,className:"input-field min-h-[76px] max-h-[320px] resize-y [field-sizing:content]"}),t.jsxs("div",{className:"flex items-center gap-2 mt-1.5",children:[t.jsxs("button",{type:"button",onClick:()=>{var Te;return(Te=ue.current)==null?void 0:Te.click()},className:"inline-flex items-center gap-1 px-2 py-1 rounded text-2xs font-medium text-warm-400 hover:text-warm-600 hover:bg-warm-100 transition-colors",children:[t.jsx(Oa,{size:14}),ae("todoForm.addImage")]}),t.jsx("span",{className:"text-2xs text-warm-300",children:ae("todoForm.pasteHint")})]}),t.jsx("input",{ref:ue,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:Te=>{Te.target.files&&ee(Te.target.files),Te.target.value=""}})]}),Ne>0&&t.jsxs("div",{className:"mb-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx("h4",{className:"text-xs font-semibold text-warm-500 uppercase tracking-wider",children:ae("todoForm.images")}),t.jsxs("span",{className:"text-2xs text-warm-400",children:["(",Ne,")"]})]}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[V.map(Te=>t.jsxs("div",{className:"relative group",children:[t.jsx("img",{src:w?sm(w,Te.id):"",alt:Te.originalName,className:"h-20 w-20 object-cover rounded-lg border border-warm-200"}),t.jsx("button",{type:"button",onClick:()=>re(Te.id),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-status-error text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(Xt,{size:12,strokeWidth:3})}),t.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/50 rounded-b-lg px-1 py-0.5",children:t.jsx("span",{className:"text-[8px] text-white truncate block",children:Te.originalName})})]},Te.id)),B.map(Te=>t.jsxs("div",{className:"relative group",children:[t.jsx("img",{src:Te.preview,alt:Te.name,className:"h-20 w-20 object-cover rounded-lg border border-accent/30"}),t.jsx("button",{type:"button",onClick:()=>ke(Te.id),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-status-error text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(Xt,{size:12,strokeWidth:3})}),t.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/50 rounded-b-lg px-1 py-0.5",children:t.jsx("span",{className:"text-[8px] text-white truncate block",children:Te.name})})]},Te.id))]})]}),t.jsx("div",{className:"mb-4 grid grid-cols-2 gap-3",children:t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-warm-500 mb-1.5",children:ae("todoForm.cliTool")}),t.jsx("select",{value:j,onChange:Te=>R(Te.target.value),className:"input-field text-sm",children:br.map(Te=>t.jsx("option",{value:Te.value,children:Te.label},Te.value))})]})}),j==="claude"&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-xs font-medium text-warm-500 mb-1.5",children:ae("todoForm.maxTurns")}),t.jsx("input",{type:"number",min:"1",max:"500",placeholder:ae("todoForm.maxTurnsPlaceholder"),value:A,onChange:Te=>z(Te.target.value),className:"input-field text-sm w-32"}),t.jsx("p",{className:"text-2xs text-warm-400 mt-1",children:ae("todoForm.maxTurnsHint")})]}),v&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-xs font-medium text-warm-500 mb-1.5",children:ae("todoForm.worktreeMode")}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-sm",children:[t.jsx("input",{type:"radio",name:"useWorktreeMode",checked:O==="inherit",onChange:()=>H("inherit")}),t.jsxs("span",{children:[ae("todoForm.worktreeInherit"),t.jsxs("span",{className:"text-2xs text-warm-400 ml-1",children:["(",ae(b?"todoForm.worktreeProjectDefaultOn":"todoForm.worktreeProjectDefaultOff"),")"]})]})]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-sm",children:[t.jsx("input",{type:"radio",name:"useWorktreeMode",checked:O==="force-on",onChange:()=>H("force-on")}),t.jsx("span",{children:ae("todoForm.worktreeForceOn")})]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-sm",children:[t.jsx("input",{type:"radio",name:"useWorktreeMode",checked:O==="force-off",onChange:()=>H("force-off")}),t.jsx("span",{children:ae("todoForm.worktreeForceOff")})]})]}),(O==="force-off"||O==="inherit"&&!b)&&t.jsx("p",{className:"text-2xs text-status-warning mt-1.5",children:ae("todoForm.worktreeMainWarning")})]}),y.length>0&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-xs font-medium text-warm-500 mb-1.5",children:ae("todoForm.dependsOn")}),t.jsxs("select",{value:L,onChange:Te=>T(Te.target.value),className:"input-field text-sm",children:[t.jsx("option",{value:"",children:ae("todoForm.noDependency")}),y.map(Te=>t.jsxs("option",{value:Te.id,children:[Te.title," (",ae(`status.${Te.status}`),")"]},Te.id))]}),L&&t.jsx("p",{className:"text-2xs text-warm-400 mt-1",children:ae("todoForm.dependsOnHint")})]}),p&&t.jsx("div",{className:"mb-4",children:t.jsx(cp,{projectId:p,mode:F,selectedPaths:W,includeLinked:J,onChange:(Te,be,pe)=>{U(Te),X(be),P(pe)}})}),t.jsxs("div",{className:"flex gap-3 justify-end",children:[t.jsx("button",{type:"button",onClick:s,className:"btn-ghost text-sm",children:ae("todoForm.cancel")}),t.jsx("button",{type:"submit",disabled:!_.trim(),className:"btn-primary text-sm",children:ae("todoForm.save")})]})]})}const en="flex items-center gap-2 w-full px-3 py-1.5 text-xs text-warm-600 hover:bg-theme-hover rounded-md transition-colors text-left disabled:opacity-30 disabled:cursor-not-allowed",up="flex items-center gap-2 w-full px-3 py-1.5 text-xs text-status-error hover:bg-status-error/10 rounded-md transition-colors text-left disabled:opacity-30 disabled:cursor-not-allowed";function u_(){return t.jsx("div",{className:"my-1 border-t border-warm-200"})}function li(e){var i;const s=e.target;return!!((i=s==null?void 0:s.closest)!=null&&i.call(s,'input, textarea, select, [contenteditable="true"], .xterm'))}function _r({x:e,y:s,onClose:i,children:a}){const h=k.useRef(null),[m,f]=k.useState({top:s,left:e,visible:!1});return k.useLayoutEffect(()=>{const o=h.current;if(!o)return;const c=window.innerWidth,d=window.innerHeight;let p=e,u=s;p+o.offsetWidth>c-8&&(p=Math.max(8,c-8-o.offsetWidth)),u+o.offsetHeight>d-8&&(u=Math.max(8,d-8-o.offsetHeight)),p<8&&(p=8),u<8&&(u=8),f({top:u,left:p,visible:!0})},[e,s]),k.useEffect(()=>{const o=p=>{var u;(u=h.current)!=null&&u.contains(p.target)||i()},c=p=>{p.key==="Escape"&&i()},d=()=>i();return document.addEventListener("mousedown",o),document.addEventListener("keydown",c),window.addEventListener("scroll",d,!0),window.addEventListener("resize",i),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",c),window.removeEventListener("scroll",d,!0),window.removeEventListener("resize",i)}},[i]),tn.createPortal(t.jsx("div",{ref:h,className:"fixed z-tooltip min-w-[180px] rounded-xl py-1 shadow-elevated",style:{top:m.top,left:m.left,opacity:m.visible?1:0,backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)"},onClick:i,onContextMenu:o=>o.preventDefault(),children:a}),document.body)}function a6({children:e}){const[s,i]=k.useState(!1),[a,h]=k.useState(!1),m=k.useRef(null),f=k.useRef(null),[o,c]=k.useState({top:0,left:0}),d=k.useCallback(()=>{if(!m.current)return;const u=m.current.getBoundingClientRect(),v=window.innerWidth,b=window.innerHeight;let C=u.bottom+4;const w=f.current;if(w){const x=w.offsetWidth,y=w.offsetHeight;let _=u.right-x;_<8&&(_=8),_+x>v-8&&(_=v-8-x),C+y>b-8&&(C=u.top-y-4),c({top:C,left:_}),h(!0)}else c({top:C,left:Math.max(8,u.right-180)})},[]);k.useEffect(()=>{if(!s){h(!1);return}d();const u=requestAnimationFrame(d),v=b=>{var w,x;const C=b.target;(w=m.current)!=null&&w.contains(C)||(x=f.current)!=null&&x.contains(C)||i(!1)};return document.addEventListener("mousedown",v),window.addEventListener("scroll",d,!0),window.addEventListener("resize",d),()=>{cancelAnimationFrame(u),document.removeEventListener("mousedown",v),window.removeEventListener("scroll",d,!0),window.removeEventListener("resize",d)}},[s,d]);const p=(Array.isArray(e)?e:[e]).filter(Boolean);return p.length===0?null:t.jsxs(t.Fragment,{children:[t.jsx("button",{ref:m,onClick:()=>i(!s),className:"p-1.5 text-warm-400 hover:text-warm-600 hover:bg-theme-hover rounded-lg transition-colors",title:"More",children:t.jsx(Am,{size:14})}),s&&tn.createPortal(t.jsx("div",{ref:f,className:`fixed z-tooltip min-w-[160px] rounded-xl py-1 shadow-elevated${a?" animate-scale-in":""}`,style:{top:o.top,left:o.left,opacity:a?1:0,backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)"},onClick:()=>i(!1),children:p}),document.body)]})}function o6({todo:e,allTodos:s=[],projectCliTool:i,projectIsGitRepo:a,projectUseWorktree:h,onStart:m,onStop:f,onDelete:o,onEdit:c,onMerge:d,onCleanup:p,onRetry:u,onContinue:v,onFix:b,onSchedule:C,onScheduleOnReset:w,resetsAt:x,onEvent:y,isInteractive:_,onSendInput:S,isDragSource:N,isDragging:D,isDragOver:j,isValidDropTarget:R,onDragStart:L,onDragEnd:T,onDragOverTarget:A,onDragLeaveTarget:z,onDropTarget:O,onRemoveDependency:H,debugLogging:F,showTokenUsage:U,isChainMember:W}){const[X,J]=k.useState(!1),[P,B]=k.useState(!1),[I,V]=k.useState([]),[$,se]=k.useState(!1),[ue,ae]=k.useState(!1),[ee,Y]=k.useState(null),[he,de]=k.useState(!1),[ke,re]=k.useState(null),[Fe,Ne]=k.useState(!1),[Te,be]=k.useState(null),[pe,Je]=k.useState(!1),[Ye,ge]=k.useState(null),[Ce,Ke]=k.useState(!1),[qe,tt]=k.useState(null),[Oe,fe]=k.useState(!1),[je,oe]=k.useState(""),[q,K]=k.useState(!1),[Q,ie]=k.useState(null),[te,le]=k.useState(!1),[xe,Pe]=k.useState(""),[Re,ve]=k.useState(!1),[$e,et]=k.useState(null),[dt,Be]=k.useState(null),[Ze,lt]=k.useState(!1),[Ie,Ee]=k.useState(!1),[ot,ht]=k.useState(!1),[_t,Ht]=k.useState(()=>{const _e=new Date;_e.setHours(_e.getHours()+1),_e.setMinutes(0,0,0);const bt=_e.getFullYear(),kt=String(_e.getMonth()+1).padStart(2,"0"),ln=String(_e.getDate()).padStart(2,"0"),un=String(_e.getHours()).padStart(2,"0"),di=String(_e.getMinutes()).padStart(2,"0");return`${bt}-${kt}-${ln}T${un}:${di}`}),[sn,ce]=k.useState(!1),[Le,De]=k.useState(null),{t:ye}=it(),rt=e.status==="pending"||e.status==="failed"||e.status==="stopped",vt=(e.status==="pending"||e.status==="failed"||e.status==="stopped")&&!!C,St=(e.status==="pending"||e.status==="completed"||e.status==="failed"||e.status==="stopped")&&!!w&&!!x&&x>Math.floor(Date.now()/1e3),jt=e.status==="running",Nt=e.status==="completed"||e.status==="stopped"||e.status==="merged",rn=e.status==="completed"&&!W&&!!e.branch_name,Dn=e.status==="completed"||e.status==="failed"||e.status==="stopped",Pn=!!v&&e.status==="completed"&&!!e.worktree_path,yn=e.status!=="running"&&e.status!=="pending"&&!!e.worktree_path&&!W,Is=e.status==="completed"||e.status==="failed"||e.status==="stopped"||e.status==="merged";k.useEffect(()=>{_&&e.status==="running"&&!X&&J(!0)},[_,e.status]),k.useEffect(()=>{X&&!$&&Fw(e.id).then(_e=>{V(_e),se(!0)}).catch(()=>{})},[X,$,e.id]),k.useEffect(()=>{X&&Is&&!Ze&&n3(e.id).then(_e=>{Be(_e),lt(!0)}).catch(()=>{lt(!0)})},[X,Is,Ze,e.id]),k.useEffect(()=>y(_e=>{if(_e.type==="todo:log"&&_e.todoId===e.id&&_e.message){const bt={id:`ws-${Date.now()}-${Math.random()}`,todo_id:e.id,log_type:_e.logType||"output",message:_e.message,created_at:new Date().toISOString()};V(kt=>[...kt,bt])}if(_e.type==="todo:commit"&&_e.todoId===e.id&&_e.message){const bt={id:`ws-commit-${Date.now()}-${Math.random()}`,todo_id:e.id,log_type:"commit",message:`${_e.commitHash?`[${_e.commitHash}] `:""}${_e.message}`,created_at:new Date().toISOString()};V(kt=>[...kt,bt])}}),[y,e.id]);const ns=async()=>{try{const{files:_e}=await UN(e.project_id,e.id);_e.length>0&&window.open(`/api/projects/${e.project_id}/debug-logs/${encodeURIComponent(_e[0].name)}`,"_blank")}catch{}},ss=async()=>{if(ue){ae(!1);return}de(!0),re(null);try{const _e=await t3(e.id);Y(_e),ae(!0),J(!0)}catch(_e){re(_e instanceof Error?_e.message:"Failed to load diff"),J(!0)}finally{de(!1)}},gs=async()=>{Ne(!0),be(null);try{await d(e.id)}catch(_e){be(_e instanceof Error?_e.message:"Merge failed")}finally{Ne(!1)}},xs=async()=>{const _e=e.branch_name?confirm(ye("cleanup.confirmDeleteBranch").replace("{name}",e.branch_name)):!1;Je(!0),ge(null);try{await p(e.id,_e)}catch(bt){ge(bt instanceof Error?bt.message:"Cleanup failed")}finally{Je(!1)}},rs=async(_e="headless")=>{Ke(!0),tt(null),V([]),se(!1),Y(null),ae(!1),Be(null),lt(!1);try{await u(e.id,_e)}catch(bt){tt(bt instanceof Error?bt.message:"Retry failed")}finally{Ke(!1)}},qn=async(_e="headless")=>{if(!v)return;const bt=je.trim();if(!bt){ie(ye("todo.continuePromptRequired"));return}K(!0),ie(null);try{await v(e.id,bt,_e),fe(!1),oe(""),V([]),se(!1)}catch(kt){ie(kt instanceof Error?kt.message:"Continue failed")}finally{K(!1)}},pn=async()=>{if(!(!w||!xe.trim())){ve(!0),et(null);try{await w(e.id,xe.trim()),le(!1),Pe("")}catch(_e){et(_e instanceof Error?_e.message:"Failed")}finally{ve(!1)}}},Ui=async()=>{if(!(!C||!_t)){ce(!0);try{await C(e.id,new Date(_t).toISOString(),ot),Ee(!1)}catch{}finally{ce(!1)}}},Wi=_e=>{if(_e<60)return`${_e}s`;const bt=Math.floor(_e/60),kt=_e%60;if(bt<60)return kt>0?`${bt}m ${kt}s`:`${bt}m`;const ln=Math.floor(bt/60),un=bt%60;return un>0?`${ln}h ${un}m`:`${ln}h`},vs=_e=>_e>=1e6?`${(_e/1e6).toFixed(1)}M`:_e>=1e3?`${(_e/1e3).toFixed(1)}k`:String(_e),Un=e.images?JSON.parse(e.images):[],is=e.depends_on?s.find(_e=>_e.id===e.depends_on):null,Ds=s.find(_e=>_e.depends_on===e.id&&_e.merged_from_branch),ui=e.cli_tool||i||"claude",Xs=im(ui).supportsInteractive;if(P)return t.jsx(c_,{initialTitle:e.title,initialDescription:e.description??void 0,initialCliTool:e.cli_tool??void 0,initialDependsOn:e.depends_on??void 0,initialMaxTurns:e.max_turns??void 0,initialUseWorktree:e.use_worktree??null,initialMemoryInjectMode:e.memory_inject_mode??"none",initialMemoryRawFilePaths:e.memory_raw_file_paths??null,projectId:e.project_id,projectIsGitRepo:a,projectUseWorktree:h,existingImages:Un,todoId:e.id,availableTodos:s.filter(_e=>_e.id!==e.id),onDeleteImage:async _e=>{await i3(e.id,_e)},onSave:async(_e,bt,kt,ln,un,di,Cr,yl,wl,jr)=>{await c(e.id,_e,bt,kt,un,di,Cr,yl,wl,jr),ln&&ln.length>0&&await Gw(e.id,ln.map(_l=>({name:_l.name,data:_l.data}))),B(!1)},onCancel:()=>B(!1)});const bs={pending:"border-l-warm-300",running:"border-l-status-running",completed:"border-l-status-success",failed:"border-l-status-error",stopped:"border-l-status-warning",merged:"border-l-status-merged"}[e.status],kr=_e=>{_e.dataTransfer.setData("text/plain",e.id),_e.dataTransfer.effectAllowed="link",L==null||L(e.id)},Kn=()=>{T==null||T()},ne=_e=>{!D||N||(_e.preventDefault(),_e.dataTransfer.dropEffect=R?"link":"none",A==null||A(e.id))},Ue=()=>{z==null||z(e.id)},ct=_e=>{_e.preventDefault(),!(!D||N||!R)&&(O==null||O(e.id))},We=D&&!N&&j&&R,mt=D&&!N&&j&&!R;return t.jsxs("div",{className:`relative transition-opacity duration-200 ${N?"opacity-40":""}`,onDragOver:ne,onDragLeave:Ue,onDrop:ct,onContextMenu:_e=>{li(_e)||(_e.preventDefault(),_e.stopPropagation(),De({x:_e.clientX,y:_e.clientY}))},children:[t.jsxs("div",{className:`card border-l-4 ${bs} overflow-hidden transition-all duration-200 ${We?"ring-2 ring-cyan-400 ring-offset-1":""} ${mt?"ring-2 ring-red-300 ring-offset-1":""}`,children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap md:gap-3 px-3 md:px-4 py-3 md:py-3.5 cursor-pointer hover:bg-warm-50 transition-colors",onClick:()=>J(!X),children:[t.jsx("div",{draggable:!0,onDragStart:kr,onDragEnd:Kn,onClick:_e=>_e.stopPropagation(),className:"flex-shrink-0 cursor-grab active:cursor-grabbing text-warm-300 hover:text-warm-500 transition-colors p-0.5 -ml-1",title:ye("dnd.dropHint"),children:t.jsx(yw,{size:16})}),t.jsx("button",{className:"text-warm-400 hover:text-accent flex-shrink-0 transition-colors",children:t.jsx(Ts,{size:14,className:`transition-transform duration-200 ${X?"rotate-90":""}`})}),t.jsxs("span",{className:"text-2xs font-mono text-warm-400 w-6 flex-shrink-0",children:["#",e.priority]}),t.jsx("span",{className:"flex-1 basis-[calc(100%-100px)] md:basis-auto min-w-0 text-sm text-warm-800 font-medium truncate order-none",children:e.title}),Un.length>0&&t.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full text-2xs font-mono text-warm-400 bg-warm-100 flex-shrink-0",children:[t.jsx(Oa,{size:12}),Un.length]}),is&&t.jsxs("span",{className:"hidden md:inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-2xs font-mono font-medium bg-cyan-500/10 text-cyan-600 flex-shrink-0 group/dep",title:`${ye("todo.dependsOn")}: ${is.title}`,children:[t.jsx(za,{size:12}),is.title.length>20?is.title.slice(0,20)+"...":is.title,H&&t.jsx("button",{onClick:_e=>{_e.stopPropagation(),H(e.id)},className:"ml-0.5 h-3.5 w-3.5 rounded-full hover:bg-cyan-500/20 inline-flex items-center justify-center opacity-0 group-hover/dep:opacity-100 transition-opacity",title:ye("dnd.removeDep"),children:t.jsx(Xt,{size:10})})]}),e.cli_tool&&t.jsx("span",{className:"hidden md:inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-2xs font-mono font-medium bg-status-merged/10 text-status-merged flex-shrink-0",children:im(e.cli_tool||"claude").label}),t.jsx(k4,{status:e.status}),t.jsxs("div",{className:"flex items-center gap-0.5 ml-auto md:ml-2 flex-shrink-0",onClick:_e=>_e.stopPropagation(),children:[rt&&t.jsx("button",{onClick:()=>m(e.id,"headless"),className:"p-1.5 text-status-success/60 hover:text-status-success hover:bg-status-success/10 rounded-lg transition-colors",title:ye("todo.startHeadless"),children:t.jsx(wr,{size:14})}),jt&&t.jsx("button",{onClick:()=>f(e.id),className:"p-1.5 text-status-error/60 hover:text-status-error hover:bg-status-error/10 rounded-lg transition-colors",title:ye("todo.stop"),children:t.jsx(il,{size:14})}),rn&&t.jsx("button",{onClick:gs,disabled:Fe,className:"p-1.5 text-status-merged/60 hover:text-status-merged hover:bg-status-merged/10 rounded-lg transition-colors disabled:opacity-30",title:ye("todo.merge"),children:t.jsx(nl,{size:14})}),Pn&&t.jsx("button",{onClick:()=>{fe(_e=>!_e),ie(null)},disabled:q,className:"p-1.5 text-status-success/60 hover:text-status-success hover:bg-status-success/10 rounded-lg transition-colors disabled:opacity-30",title:ye("todo.continue"),children:t.jsx(bv,{size:14})}),Dn&&t.jsx("button",{onClick:()=>rs("headless"),disabled:Ce,className:"p-1.5 text-accent/60 hover:text-accent hover:bg-accent/10 rounded-lg transition-colors disabled:opacity-30",title:ye("todo.retry"),children:t.jsx(oi,{size:14})}),t.jsxs(a6,{children:[rt&&Xs&&t.jsxs("button",{onClick:()=>m(e.id,"interactive"),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-warm-600 hover:bg-theme-hover rounded-md transition-colors text-left",title:ye("todo.startInteractiveDesc"),children:[t.jsx(Ba,{size:14}),ye("todo.startInteractive")]}),rt&&t.jsxs("button",{onClick:()=>m(e.id,"verbose"),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-warm-600 hover:bg-theme-hover rounded-md transition-colors text-left",title:ye("todo.startVerboseDesc"),children:[t.jsx(Gf,{size:14}),ye("todo.startVerbose")]}),vt&&t.jsxs("button",{onClick:()=>Ee(!Ie),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-warm-600 hover:bg-theme-hover rounded-md transition-colors text-left",title:ye("todo.scheduleDesc"),children:[t.jsx(Uf,{size:14}),ye("todo.schedule")]}),St&&t.jsxs("button",{onClick:()=>{le(_e=>!_e),et(null)},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-warm-600 hover:bg-theme-hover rounded-md transition-colors text-left",title:ye("todo.scheduleOnResetDesc"),children:[t.jsx(ri,{size:14}),ye("todo.scheduleOnReset")]}),Nt&&t.jsxs("button",{onClick:ss,disabled:he,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-warm-600 hover:bg-theme-hover rounded-md transition-colors text-left disabled:opacity-30",children:[t.jsx(Bi,{size:14}),ye("todo.viewDiff")]}),F&&Is&&t.jsxs("button",{onClick:ns,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-warm-600 hover:bg-theme-hover rounded-md transition-colors text-left",children:[t.jsx(kv,{size:14}),ye("todo.viewDebugLog")]}),yn&&t.jsxs("button",{onClick:xs,disabled:pe,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-warm-600 hover:bg-theme-hover rounded-md transition-colors text-left disabled:opacity-30",children:[t.jsx(au,{size:14}),ye("todo.cleanup")]}),t.jsxs("button",{onClick:()=>B(!0),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-warm-600 hover:bg-theme-hover rounded-md transition-colors text-left",children:[t.jsx(ai,{size:14}),ye("todo.edit")]}),t.jsxs("button",{onClick:()=>o(e.id),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-status-error hover:bg-status-error/10 rounded-md transition-colors text-left",children:[t.jsx(Nn,{size:14}),ye("todo.delete")]})]})]})]}),Ie&&t.jsx("div",{className:"border-t border-accent/20 px-5 py-3 bg-accent/5 animate-fade-in",children:t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx("label",{className:"text-xs font-medium text-accent",children:ye("todo.scheduleAt")}),t.jsx("input",{type:"datetime-local",value:_t,onChange:_e=>Ht(_e.target.value),className:"bg-theme-card border border-accent/20 rounded-lg px-2 py-1.5 text-sm font-mono text-warm-800 focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20",min:new Date().toISOString().slice(0,16)}),t.jsx("button",{onClick:Ui,disabled:sn||!_t,className:"btn-primary text-xs py-1.5 disabled:opacity-30",children:ye(sn?"todo.scheduling":"todo.confirmSchedule")}),t.jsx("button",{onClick:()=>Ee(!1),className:"btn-ghost text-xs py-1.5",children:ye("scheduleForm.cancel")}),t.jsxs("label",{className:"flex items-center gap-2 text-xs text-accent",children:[t.jsx("input",{type:"checkbox",checked:ot,onChange:_e=>ht(_e.target.checked),className:"rounded border-accent/40 text-accent focus:ring-accent"}),ye("todo.scheduleKeepOriginal")]})]})}),Oe&&t.jsx("div",{className:"border-t border-emerald-200 px-5 py-3 bg-emerald-50/50 animate-fade-in",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("label",{className:"text-xs font-medium text-emerald-600",children:[ye("todo.continuePromptLabel"),(e.round_count??1)>1&&t.jsxs("span",{className:"ml-2 text-emerald-500/70",children:["(",ye("todo.roundLabel")," ",e.round_count,")"]})]}),t.jsx("textarea",{value:je,onChange:_e=>oe(_e.target.value),placeholder:ye("todo.continuePromptPlaceholder"),rows:3,className:"w-full bg-theme-card border border-emerald-200 rounded-lg px-3 py-2 text-sm text-warm-800 focus:border-emerald-400 focus:outline-none focus:ring-2 focus:ring-emerald-400/20 resize-y",disabled:q}),Q&&t.jsx("p",{className:"text-xs text-status-error",children:Q}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>qn("headless"),disabled:q||!je.trim(),className:"btn-primary text-xs py-1.5 !bg-emerald-500 hover:!bg-emerald-600 disabled:opacity-30",children:ye(q?"todo.continuing":"todo.confirmContinue")}),t.jsx("button",{onClick:()=>{fe(!1),ie(null)},disabled:q,className:"btn-ghost text-xs py-1.5",children:ye("scheduleForm.cancel")})]})]})}),te&&x&&t.jsx("div",{className:"border-t border-amber-200 px-5 py-3 bg-amber-50/50 animate-fade-in",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("label",{className:"text-xs font-medium text-amber-600",children:ye("todo.scheduleOnResetLabel")}),t.jsx("span",{className:"text-xs text-amber-500/80 font-mono",children:new Date(x*1e3).toLocaleString()})]}),t.jsx("textarea",{value:xe,onChange:_e=>Pe(_e.target.value),placeholder:ye("todo.resetPromptPlaceholder"),rows:3,className:"w-full bg-theme-card border border-amber-200 rounded-lg px-3 py-2 text-sm text-warm-800 focus:border-amber-400 focus:outline-none focus:ring-2 focus:ring-amber-400/20 resize-y",disabled:Re}),$e&&t.jsx("p",{className:"text-xs text-status-error",children:$e}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:pn,disabled:Re||!xe.trim(),className:"btn-primary text-xs py-1.5 !bg-amber-500 hover:!bg-amber-600 disabled:opacity-30",children:ye(Re?"todo.scheduling":"todo.confirmResetSchedule")}),t.jsx("button",{onClick:()=>{le(!1),et(null)},disabled:Re,className:"btn-ghost text-xs py-1.5",children:ye("scheduleForm.cancel")})]})]})}),X&&t.jsx("div",{className:"animate-fade-in overflow-hidden border-t border-theme-border",children:t.jsxs("div",{className:"px-4 py-3 space-y-3",children:[t.jsxs("section",{children:[t.jsx("h4",{className:"text-2xs font-semibold text-warm-500 uppercase tracking-wider mb-1.5",children:ye("todo.description")}),t.jsx("div",{className:"rounded-lg border border-theme-border bg-theme-card/50 px-3 py-2",children:e.description?t.jsx("p",{className:"text-sm text-warm-700 whitespace-pre-wrap",children:e.description}):t.jsx("p",{className:"text-sm text-warm-400 italic",children:ye("todo.noDescription")})})]}),Un.length>0&&t.jsxs("section",{children:[t.jsxs("h4",{className:"text-2xs font-semibold text-warm-500 uppercase tracking-wider mb-1.5",children:[ye("todo.attachedImages")," ",t.jsxs("span",{className:"text-warm-400 normal-case",children:["(",Un.length,")"]})]}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:Un.map(_e=>t.jsx("a",{href:sm(e.id,_e.id),target:"_blank",rel:"noopener noreferrer",children:t.jsx("img",{src:sm(e.id,_e.id),alt:_e.originalName,className:"h-16 w-16 object-cover rounded-md border border-theme-border"})},_e.id))})]}),(is||e.branch_name||Ds)&&t.jsxs("section",{children:[t.jsx("h4",{className:"text-2xs font-semibold text-warm-500 uppercase tracking-wider mb-1.5",children:ye("todo.branch")}),t.jsxs("div",{className:"rounded-lg border border-theme-border bg-theme-card/50 px-3 py-2 space-y-1.5",children:[is&&t.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[t.jsx("span",{className:"text-warm-400 w-24 flex-shrink-0 pt-0.5",children:ye("todo.dependsOn")}),t.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded bg-accent/10 text-accent text-2xs font-medium",children:is.title})]}),e.branch_name&&t.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.jsx("span",{className:"text-warm-400 w-24 flex-shrink-0",children:ye("todo.branch")}),t.jsx(Fa,{size:12,className:"text-status-success flex-shrink-0"}),t.jsx("code",{className:"font-mono text-xs text-warm-700 break-all",children:e.branch_name})]}),e.worktree_path&&t.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[t.jsx("span",{className:"text-warm-400 w-24 flex-shrink-0 pt-0.5",children:ye("todo.worktree")}),t.jsx("code",{className:"font-mono text-2xs text-warm-500 break-all",children:e.worktree_path})]}),e.merged_from_branch&&t.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.jsx("span",{className:"text-warm-400 w-24 flex-shrink-0",children:ye("todo.mergedFrom")}),t.jsx("code",{className:"font-mono text-xs text-status-merged break-all",children:e.merged_from_branch})]}),!e.worktree_path&&Ds&&t.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.jsx("span",{className:"text-warm-400 w-24 flex-shrink-0",children:ye("todo.transferredTo")}),t.jsx("span",{className:"text-warm-700 truncate",children:Ds.title.length>30?Ds.title.slice(0,27)+"...":Ds.title})]})]})]}),e.status==="failed"&&I.length>0&&(()=>{var ln;const _e=I.filter(un=>un.log_type==="error");if(_e.length===0)return null;const bt=_e.find(un=>/exited with code (\d+)/.test(un.message)),kt=bt?(ln=bt.message.match(/exited with code (\d+)/))==null?void 0:ln[1]:null;return t.jsxs("div",{style:{background:Ge.bg,fontFamily:Mt,fontSize:12,lineHeight:"1.5",padding:"10px 12px",borderRadius:8,border:`1px solid ${Ge.separator}`,color:Ge.text},children:[t.jsxs("div",{children:[t.jsx("span",{style:{color:Ge.error},children:">"})," ",t.jsx("span",{style:{color:Ge.error,fontWeight:700},children:"FAILED"}),kt&&t.jsxs("span",{style:{color:Ge.dim},children:[" (exit code: ",kt,")"]}),b&&t.jsx("button",{onClick:()=>b(e,_e),style:{marginLeft:12,color:Ge.warning,background:"none",border:`1px solid ${Ge.warning}`,padding:"1px 8px",borderRadius:2,cursor:"pointer",fontSize:11,fontFamily:Mt},children:ye("failure.fix")})]}),t.jsx("div",{style:{maxHeight:192,overflowY:"auto",marginTop:4},children:_e.map(un=>t.jsxs("div",{children:[t.jsx("span",{style:{color:Ge.dim},children:new Date(un.created_at).toLocaleTimeString()})," ",t.jsx("span",{style:{color:Ge.error},children:un.message})]},un.id))})]})})(),Is&&dt&&t.jsxs("section",{children:[t.jsx("h4",{className:"text-2xs font-semibold text-warm-500 uppercase tracking-wider mb-1.5",children:ye("todo.result")}),t.jsxs("div",{className:"rounded-lg border border-theme-border bg-theme-card/50 px-3 py-2 space-y-2.5",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs",children:[dt.duration_seconds!==null&&t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx(ri,{size:12,className:"text-warm-400"}),t.jsx("span",{className:"text-warm-400",children:ye("result.duration")}),t.jsx("span",{className:"text-warm-700 font-medium",children:Wi(dt.duration_seconds)})]}),dt.commits.length>0&&t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx(v5,{size:12,className:"text-status-success"}),t.jsx("span",{className:"text-status-success font-medium",children:dt.commits.length}),t.jsx("span",{className:"text-warm-400",children:ye("result.commits")})]}),dt.diff_stats.files_changed>0&&t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx(Bi,{size:12,className:"text-warm-400"}),t.jsx("span",{className:"text-warm-700 font-medium",children:dt.diff_stats.files_changed}),t.jsx("span",{className:"text-warm-400",children:ye("result.filesChanged")}),t.jsxs("span",{className:"text-status-success font-mono",children:["+",dt.diff_stats.insertions]}),t.jsxs("span",{className:"text-status-error font-mono",children:["-",dt.diff_stats.deletions]})]}),U&&dt.token_usage&&(()=>{const _e=dt.token_usage,bt=(_e.input_tokens??0)+(_e.cache_read_input_tokens??0)+(_e.cache_creation_input_tokens??0),kt=bt+(_e.output_tokens??0);let ln,un;return kt>=5e5?(ln=ye("result.levelHeavy"),un="text-status-error"):kt>=3e5?(ln=ye("result.levelHigh"),un="text-orange-500"):kt>=1e5?(ln=ye("result.levelModerate"),un="text-status-warning"):(ln=ye("result.levelLight"),un="text-status-info"),t.jsxs("span",{className:"inline-flex items-center gap-1",children:[bt>0&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-warm-400",children:ye("result.inputTokens")}),t.jsx("span",{className:"text-warm-700 font-medium",children:vs(bt)})]}),bt>0&&_e.output_tokens!==null&&t.jsx("span",{className:"text-warm-400",children:"·"}),_e.output_tokens!==null&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-warm-400",children:ye("result.outputTokens")}),t.jsx("span",{className:"text-warm-700 font-medium",children:vs(_e.output_tokens)})]}),_e.num_turns!=null&&_e.num_turns>1&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-warm-400",children:"·"}),t.jsxs("span",{className:"text-warm-700",children:[_e.num_turns,ye("result.turns")]})]}),t.jsx("span",{className:"text-warm-400",children:"·"}),t.jsx("span",{className:`font-medium ${un}`,children:ln})]})})()]}),dt.commits.length>0&&t.jsxs("div",{children:[t.jsx("h5",{className:"text-2xs font-semibold text-warm-400 uppercase tracking-wider mb-1",children:ye("result.commitHistory")}),t.jsx("div",{className:"space-y-0.5",children:dt.commits.map((_e,bt)=>t.jsxs("div",{className:"flex items-center gap-2 px-1.5 py-1 text-xs rounded hover:bg-theme-hover",children:[t.jsx("code",{className:"font-mono text-accent flex-shrink-0",children:_e.hash.slice(0,7)||"-------"}),t.jsx("span",{className:"text-warm-700 truncate flex-1",children:_e.message}),t.jsx("span",{className:"text-2xs text-warm-400 flex-shrink-0",children:new Date(_e.date).toLocaleTimeString()})]},bt))})]}),dt.changed_files.length>0&&t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("h5",{className:"text-2xs font-semibold text-warm-400 uppercase tracking-wider",children:ye("result.changedFiles")}),Nt&&t.jsxs("button",{onClick:ss,disabled:he,className:"flex items-center gap-1 text-2xs text-warm-500 hover:text-accent transition-colors disabled:opacity-30",children:[t.jsx(Ts,{size:10,className:`transition-transform ${ue?"rotate-90":""}`}),t.jsx("span",{children:ye(ue?"todo.hideDiff":"todo.viewDiff")})]})]}),t.jsx("div",{className:"space-y-0.5",children:dt.changed_files.map((_e,bt)=>{const kt=_e.status==="A"?"bg-status-success/15 text-status-success":_e.status==="D"?"bg-status-error/15 text-status-error":_e.status==="M"?"bg-status-warning/15 text-status-warning":"bg-warm-200 text-warm-600";return t.jsxs("div",{className:"flex items-center gap-2 px-1.5 py-0.5 text-xs",children:[t.jsx("span",{className:`inline-flex items-center justify-center w-5 h-4 rounded text-[10px] font-bold ${kt}`,children:_e.status}),t.jsx("span",{className:"text-warm-700 font-mono text-2xs break-all flex-1",children:_e.file}),_e.renamedFrom&&t.jsxs("span",{className:"text-warm-400 text-2xs flex-shrink-0",children:["← ",_e.renamedFrom]})]},bt)})})]})]})]}),Te&&t.jsxs("div",{className:"rounded-md bg-status-error/10 text-status-error text-xs px-3 py-2",children:[ye("todo.mergeFailed"),": ",Te]}),Ye&&t.jsxs("div",{className:"rounded-md bg-status-error/10 text-status-error text-xs px-3 py-2",children:[ye("todo.cleanupFailed"),": ",Ye]}),qe&&t.jsxs("div",{className:"rounded-md bg-status-error/10 text-status-error text-xs px-3 py-2",children:[ye("todo.retryFailed"),": ",qe]}),ke&&t.jsxs("div",{className:"rounded-md bg-status-error/10 text-status-error text-xs px-3 py-2",children:[ye("todo.diffError"),": ",ke]}),ue&&ee&&t.jsxs("section",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[t.jsx("h4",{className:"text-2xs font-semibold text-warm-500 uppercase tracking-wider",children:ye("todo.diffOutput")}),t.jsxs("div",{className:"flex items-center gap-1.5 text-2xs",children:[t.jsxs("span",{className:"text-warm-500",children:[ee.stats.files_changed," ",ye("todo.files")]}),t.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded bg-status-success/10 text-status-success font-mono",children:["+",ee.stats.insertions]}),t.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded bg-status-error/10 text-status-error font-mono",children:["-",ee.stats.deletions]})]})]}),t.jsx("div",{className:"max-h-80 overflow-y-auto rounded-lg border border-theme-border bg-theme-card/50 px-3 py-2 font-mono text-xs leading-tight",children:ee.diff?ee.diff.split(`
|
|
634
|
-
`).map((_e,bt)=>{let kt="text-theme-text",ln="";return _e.startsWith("+")&&!_e.startsWith("+++")?kt="text-theme-text bg-status-success/15":_e.startsWith("-")&&!_e.startsWith("---")?kt="text-theme-text bg-status-error/15":_e.startsWith("@@")?kt="text-accent":_e.startsWith("diff ")&&(kt="text-warm-700",ln="font-semibold"),t.jsx("div",{className:`whitespace-pre ${kt} ${ln}`,children:_e},bt)}):t.jsx("span",{className:"text-warm-400 italic",children:ye("log.noChanges")})})]}),t.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:Ge.bg,fontFamily:Mt,border:`1px solid ${Ge.separator}`},children:[t.jsxs("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${Ge.separator}`,fontSize:12,color:Ge.text},children:[t.jsx("span",{style:{color:Ge.prompt},children:"$"})," ",t.jsx("span",{style:{color:Ge.bright},children:"tail"})," ",t.jsx("span",{style:{color:Ge.dim},children:"-f task.log"})]}),t.jsx(l_,{logs:I,interactive:_&&e.status==="running",todoId:e.id,onSendInput:S,embedded:!0})]})]})})]}),We&&t.jsxs("div",{className:"mt-1.5 flex items-center gap-2 px-4 py-2 rounded-lg border-2 border-dashed border-cyan-400 bg-cyan-50/50 animate-fade-in",children:[t.jsx(za,{size:14,className:"text-cyan-500 flex-shrink-0"}),t.jsx("span",{className:"text-xs font-medium text-cyan-600",children:ye("dnd.dropHint")})]}),mt&&t.jsxs("div",{className:"mt-1.5 flex items-center gap-2 px-4 py-2 rounded-lg border-2 border-dashed border-red-300 bg-red-50/50 animate-fade-in",children:[t.jsx(gj,{size:14,className:"text-red-400 flex-shrink-0"}),t.jsx("span",{className:"text-xs font-medium text-red-400",children:ye("dnd.cyclicWarning")})]}),Le&&t.jsxs(_r,{x:Le.x,y:Le.y,onClose:()=>De(null),children:[rt&&t.jsxs("button",{onClick:()=>m(e.id,"headless"),className:en,title:ye("todo.startHeadless"),children:[t.jsx(wr,{size:14}),ye("todo.start")]}),rt&&Xs&&t.jsxs("button",{onClick:()=>m(e.id,"interactive"),className:en,title:ye("todo.startInteractiveDesc"),children:[t.jsx(Ba,{size:14}),ye("todo.startInteractive")]}),rt&&t.jsxs("button",{onClick:()=>m(e.id,"verbose"),className:en,title:ye("todo.startVerboseDesc"),children:[t.jsx(Gf,{size:14}),ye("todo.startVerbose")]}),jt&&t.jsxs("button",{onClick:()=>f(e.id),className:en,children:[t.jsx(il,{size:14}),ye("todo.stop")]}),rn&&t.jsxs("button",{onClick:gs,disabled:Fe,className:en,children:[t.jsx(nl,{size:14}),ye("todo.merge")]}),Pn&&t.jsxs("button",{onClick:()=>{fe(!0),ie(null)},disabled:q,className:en,children:[t.jsx(bv,{size:14}),ye("todo.continue")]}),Dn&&t.jsxs("button",{onClick:()=>rs("headless"),disabled:Ce,className:en,children:[t.jsx(oi,{size:14}),ye("todo.retry")]}),vt&&t.jsxs("button",{onClick:()=>Ee(!0),className:en,title:ye("todo.scheduleDesc"),children:[t.jsx(Uf,{size:14}),ye("todo.schedule")]}),St&&t.jsxs("button",{onClick:()=>{le(!0),et(null)},className:en,title:ye("todo.scheduleOnResetDesc"),children:[t.jsx(ri,{size:14}),ye("todo.scheduleOnReset")]}),Nt&&t.jsxs("button",{onClick:ss,disabled:he,className:en,children:[t.jsx(Bi,{size:14}),ye("todo.viewDiff")]}),F&&Is&&t.jsxs("button",{onClick:ns,className:en,children:[t.jsx(kv,{size:14}),ye("todo.viewDebugLog")]}),yn&&t.jsxs("button",{onClick:xs,disabled:pe,className:en,children:[t.jsx(au,{size:14}),ye("todo.cleanup")]}),t.jsx(u_,{}),t.jsxs("button",{onClick:()=>B(!0),className:en,children:[t.jsx(ai,{size:14}),ye("todo.edit")]}),t.jsxs("button",{onClick:()=>o(e.id),className:up,children:[t.jsx(Nn,{size:14}),ye("todo.delete")]})]})]})}const l6=k.lazy(()=>Du(()=>import("./TaskGraph-B-Q6pcPi.js"),__vite__mapDeps([0,1,2,3,4]))),Fc={all:null,active:["pending","running"],completed:["completed","merged"],cancelled:["stopped","failed"]};function Hb(e,s,i){let a=i;const h=new Set;for(;a;){if(a===s)return!0;if(h.has(a))return!1;h.add(a);const m=e.find(f=>f.id===a);a=(m==null?void 0:m.depends_on)??null}return!1}function c6({todos:e,projectId:s,projectCliTool:i,projectIsGitRepo:a,projectUseWorktree:h,onAddTodo:m,onStartAll:f,onStopAll:o,onStartTodo:c,onStopTodo:d,onDeleteTodo:p,onEditTodo:u,onMergeTodo:v,onMergeChain:b,onCleanupTodo:C,onRetryTodo:w,onContinueTodo:x,onFixTodo:y,onScheduleTodo:_,onScheduleOnResetTodo:S,resetsAt:N,onUpdateDependency:D,onUpdatePosition:j,onReorderTodos:R,onEvent:L,onSendInput:T,interactiveTodos:A,debugLogging:z,showTokenUsage:O}){var dt;const[H,F]=k.useState(!1),[U,W]=k.useState(null),[X,J]=k.useState(null),[P,B]=k.useState(null),[I,V]=k.useState(null),[$,se]=k.useState(()=>{try{return localStorage.getItem("todoViewMode")||"list"}catch{return"list"}}),[ue,ae]=k.useState(()=>{try{return localStorage.getItem("todoStatusFilter")||"all"}catch{return"all"}}),[ee,Y]=k.useState(()=>{try{return localStorage.getItem("todoStackModeEnabled")==="true"}catch{return!1}}),[he,de]=k.useState(()=>{try{return localStorage.getItem("todoStackCollapsed")==="true"}catch{return!1}}),{t:ke}=it(),re=k.useCallback(Be=>{se(Be);try{localStorage.setItem("todoViewMode",Be)}catch{}},[]),Fe=k.useCallback(Be=>{ae(Be);try{localStorage.setItem("todoStatusFilter",Be)}catch{}},[]),Ne=k.useCallback(()=>{Y(Be=>{const Ze=!Be;try{localStorage.setItem("todoStackModeEnabled",String(Ze))}catch{}if(!Ze){de(!1);try{localStorage.setItem("todoStackCollapsed","false")}catch{}}return Ze})},[]),Te=k.useCallback(()=>{de(Be=>{const Ze=!Be;try{localStorage.setItem("todoStackCollapsed",String(Ze))}catch{}return Ze})},[]),be=ee&&he&&$==="list",pe=k.useMemo(()=>({all:e.length,active:e.filter(Be=>Fc.active.includes(Be.status)).length,completed:e.filter(Be=>Fc.completed.includes(Be.status)).length,cancelled:e.filter(Be=>Fc.cancelled.includes(Be.status)).length}),[e]),Je=k.useMemo(()=>{const Be=Fc[ue];return Be?e.filter(Ze=>Be.includes(Ze.status)):e},[e,ue]),Ye=(()=>{const Be=[...Je].sort((ht,_t)=>ht.priority-_t.priority);if(ue!=="all"||be)return Be.map(ht=>({todo:ht,depth:0}));const Ze=new Map,lt=[];for(const ht of Be)if(ht.depends_on){const _t=Ze.get(ht.depends_on)||[];_t.push(ht),Ze.set(ht.depends_on,_t)}else lt.push(ht);const Ie=[],Ee=new Set,ot=(ht,_t)=>{if(Ee.has(ht.id))return;Ee.add(ht.id),Ie.push({todo:ht,depth:_t});const Ht=Ze.get(ht.id);if(Ht)for(const sn of Ht)ot(sn,_t+1)};for(const ht of lt)ot(ht,0);for(const ht of Be)Ee.has(ht.id)||Ie.push({todo:ht,depth:0});return Ie})(),{completedChainRoots:ge,completedChainMembers:Ce}=k.useMemo(()=>{const Be=new Map;for(const Ee of e)if(Ee.depends_on){const ot=Be.get(Ee.depends_on)||[];ot.push(Ee.id),Be.set(Ee.depends_on,ot)}const Ze=e.filter(Ee=>!Ee.depends_on&&Be.has(Ee.id)),lt=new Map,Ie=new Set;for(const Ee of Ze){const ot=[],ht=_t=>{if(!e.find(ce=>ce.id===_t))return;ot.push(_t);const sn=Be.get(_t)||[];for(const ce of sn)ht(ce)};if(ht(Ee.id),ot.length>=2&&ot.every(_t=>{const Ht=e.find(sn=>sn.id===_t);return(Ht==null?void 0:Ht.status)==="completed"||(Ht==null?void 0:Ht.status)==="merged"})){lt.set(Ee.id,ot.length);for(const _t of ot)Ie.add(_t)}}return{completedChainRoots:lt,completedChainMembers:Ie}},[e]),[Ke,qe]=k.useState(null),[tt,Oe]=k.useState(null),fe=k.useCallback(async Be=>{if(b){qe(Be),Oe(null);try{await b(Be)}catch(Ze){Oe(Ze instanceof Error?Ze.message:"Merge failed")}finally{qe(null)}}},[b]),je=k.useRef(!1),oe=k.useCallback(Be=>{je.current=!1,J(Be)},[]),q=k.useCallback(async()=>{if(!je.current&&X&&D){const Be=e.find(Ze=>Ze.id===X);Be!=null&&Be.depends_on&&await D(X,null)}J(null),B(null),V(null)},[X,e,D]),K=k.useCallback(Be=>{B(Be),V(null)},[]),Q=k.useCallback(Be=>{B(Ze=>Ze===Be?null:Ze)},[]),ie=k.useCallback(async Be=>{!X||!D||X!==Be&&(Hb(e,X,Be)||(je.current=!0,await D(X,Be),J(null),B(null),V(null)))},[X,e,D]),te=k.useCallback(async Be=>{D&&await D(Be,null)},[D]),le=k.useCallback(Be=>!X||X===Be?!1:!Hb(e,X,Be),[X,e]),xe=k.useCallback(Be=>{V(Be),B(null)},[]),Pe=k.useCallback(Be=>{V(Ze=>Ze===Be?null:Ze)},[]),Re=k.useCallback(async(Be,Ze)=>{if(!X||!R)return;const lt=Ze.indexOf(X);if(lt<0)return;const Ie=Ze.filter(ht=>ht!==X),Ee=Be>lt?Be-1:Be;if(Ee===lt){V(null);return}const ot=[...Ie.slice(0,Ee),X,...Ie.slice(Ee)];je.current=!0,await R(ot),J(null),V(null),B(null)},[X,R]),ve=e.some(Be=>Be.status==="pending"||Be.status==="failed"||Be.status==="stopped"),$e=e.some(Be=>Be.status==="running"),et=t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:f,disabled:!ve,className:"btn-ghost text-sm",children:[t.jsx(wr,{size:14}),ke("header.runAll")]}),t.jsxs("button",{onClick:o,disabled:!$e,className:"btn-ghost text-sm",children:[t.jsx(il,{size:14}),ke("header.stopAll")]})]});return $==="graph"?t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-5",children:[t.jsx("h2",{className:"text-sm font-semibold text-warm-600 uppercase tracking-wider",children:ke("todos.title")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex items-center bg-warm-100 rounded-lg p-0.5",children:[t.jsx("button",{onClick:()=>re("list"),className:"p-1.5 rounded-md transition-colors text-warm-400 hover:text-warm-600",title:ke("graph.listView"),children:t.jsx(lu,{size:14})}),t.jsx("button",{onClick:()=>re("graph"),className:"p-1.5 rounded-md transition-colors bg-theme-card shadow-sm text-accent",title:ke("graph.graphView"),children:t.jsx(_v,{size:14})})]}),et]})]}),t.jsx(k.Suspense,{fallback:null,children:t.jsx(l6,{todos:e,projectId:s,projectCliTool:i,projectIsGitRepo:a,projectUseWorktree:h,onAddTodo:m,onStartTodo:c,onStopTodo:d,onDeleteTodo:p,onEditTodo:u,onMergeTodo:v,onCleanupTodo:C,onRetryTodo:w,onContinueTodo:x,onFixTodo:y,onUpdateDependency:D,onUpdatePosition:j,onEvent:L,onSendInput:T,interactiveTodos:A,debugLogging:z,showTokenUsage:O})})]}):t.jsxs("div",{className:"min-h-[50vh]",onContextMenu:Be=>{li(Be)||(Be.preventDefault(),W({x:Be.clientX,y:Be.clientY}))},children:[t.jsxs("div",{className:"flex items-center justify-between mb-5",children:[t.jsx("h2",{className:"text-sm font-semibold text-warm-600 uppercase tracking-wider",children:ke("todos.title")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex items-center bg-warm-100 rounded-lg p-0.5",children:[t.jsx("button",{onClick:()=>re("list"),className:"p-1.5 rounded-md transition-colors bg-theme-card shadow-sm text-accent",title:ke("graph.listView"),children:t.jsx(lu,{size:14})}),t.jsx("button",{onClick:()=>re("graph"),className:"p-1.5 rounded-md transition-colors text-warm-400 hover:text-warm-600",title:ke("graph.graphView"),children:t.jsx(_v,{size:14})})]}),t.jsx("button",{onClick:Ne,className:`p-1.5 rounded-md transition-colors ${ee?"bg-accent/10 text-accent":"text-warm-400 hover:text-warm-600 hover:bg-warm-100"}`,title:ke(ee?"todos.stackModeOn":"todos.stackModeOff"),children:t.jsx(R5,{size:14})}),ee&&!he&&$==="list"&&Ye.length>0&&t.jsx("button",{onClick:Te,className:"p-1.5 rounded-md transition-colors text-warm-400 hover:text-warm-600 hover:bg-warm-100",title:ke("todos.collapseStack"),children:t.jsx(Bj,{size:14})}),et,!H&&t.jsxs("button",{onClick:()=>F(!0),className:"btn-primary text-xs py-2",children:[t.jsx(mn,{size:14}),ke("todos.add")]})]})]}),H&&t.jsx("div",{className:"mb-5 animate-slide-up",children:t.jsx(c_,{projectId:s,projectCliTool:i,projectIsGitRepo:a,projectUseWorktree:h,availableTodos:e,onSave:async(Be,Ze,lt,Ie,Ee,ot,ht,_t,Ht,sn)=>{await m(Be,Ze,lt,Ie,Ee,ot,ht,_t,Ht,sn),F(!1)},onCancel:()=>F(!1)})}),t.jsx("div",{className:"flex items-center gap-1 mb-4 bg-warm-100 rounded-lg p-0.5 w-fit",children:["all","active","completed","cancelled"].map(Be=>{const Ze=ue===Be,lt=Be==="all"?"todos.filterAll":Be==="active"?"todos.filterActive":Be==="completed"?"todos.filterCompleted":"todos.filterCancelled";return t.jsxs("button",{onClick:()=>Fe(Be),className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${Ze?"bg-theme-card shadow-sm text-accent":"text-warm-500 hover:text-warm-700"}`,children:[t.jsx("span",{children:ke(lt)}),t.jsx("span",{className:`text-2xs font-mono ${Ze?"text-accent/70":"text-warm-400"}`,children:pe[Be]})]},Be)})}),t.jsx("div",{className:be?"relative cursor-pointer":"space-y-3",onClick:be?Te:void 0,title:be?ke("todos.expandStack"):void 0,style:be?{height:76+Math.max(Ye.length-1,0)*6}:void 0,children:Ye.length===0?t.jsx("div",{className:"card",children:t.jsx(Fi,{icon:xw,title:ke(ue==="all"?"todos.empty":"todos.filterEmpty"),description:ue==="all"?ke("todos.emptyHint"):void 0})}):(()=>{const Be=Ye.map(({todo:lt})=>lt.id),Ze=lt=>{if(be||!R)return null;const Ie=X!==null&&I===lt;return t.jsx("div",{onDragEnter:Ee=>{Ee.preventDefault(),xe(lt)},onDragOver:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),Ee.dataTransfer.dropEffect="link",xe(lt)},onDragLeave:()=>Pe(lt),onDrop:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),Re(lt,Be)},className:"relative",style:{height:16,marginTop:-8,marginBottom:-8},children:Ie&&t.jsx("div",{className:"absolute inset-x-0 top-1/2 -translate-y-1/2 h-0.5 bg-accent rounded-full shadow-[0_0_6px_rgba(0,0,0,0.15)]"})},`gap-${lt}`)};return t.jsxs(t.Fragment,{children:[Ze(0),Ye.map(({todo:lt,depth:Ie},Ee)=>{const ot=ge.has(lt.id),ht=Ce.has(lt.id),_t=6,Ht="top 400ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 300ms ease",sn=be?{position:"absolute",top:Ee*_t,left:0,right:0,zIndex:Ye.length+10-Ee,opacity:Ee===0?1:.9,pointerEvents:Ee===0?"auto":"none",transition:Ht}:{transition:Ht};return t.jsxs("div",{className:be?"":"animate-fade-in",style:be?sn:{animationDelay:`${Ee*30}ms`,...sn},children:[!be&&ot&&t.jsxs("div",{className:"flex items-center gap-2 mb-2 px-3 py-2 rounded-lg bg-status-merged/5 border border-status-merged/20 animate-slide-up",style:{animationDelay:`${Ee*30}ms`},children:[t.jsx(za,{size:16,className:"text-status-merged flex-shrink-0"}),t.jsx("span",{className:"text-xs font-semibold text-status-merged",children:ke("todo.chainComplete")}),t.jsx("span",{className:"text-2xs font-mono text-warm-400",children:ke("todo.chainTasks").replace("{count}",String(ge.get(lt.id)))}),t.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[tt&&Ke===null&&t.jsx("span",{className:"text-2xs text-status-error",children:tt}),t.jsxs("button",{onClick:()=>fe(lt.id),disabled:Ke===lt.id,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-status-merged/15 text-status-merged hover:bg-status-merged/25 border border-status-merged/30 transition-colors disabled:opacity-50",title:ke("todo.mergeChainDesc"),children:[t.jsx(dj,{size:14}),Ke===lt.id?"...":ke("todo.mergeChain")]})]})]}),t.jsxs("div",{className:"relative animate-fade-in",style:{animationDelay:`${Ee*30}ms`,marginLeft:Ie>0?`${Ie*24}px`:void 0},children:[Ie>0&&t.jsx("div",{className:"absolute top-0 bottom-0 w-px",style:{left:"-13px",backgroundColor:"var(--color-border)"}}),t.jsx(o6,{todo:lt,allTodos:e,projectCliTool:i,projectIsGitRepo:a,projectUseWorktree:h,onStart:c,onStop:d,onDelete:p,onEdit:u,onMerge:v,onCleanup:C,onRetry:w,onContinue:x,onFix:y,onSchedule:_,onScheduleOnReset:S,resetsAt:N,onEvent:L,isInteractive:A.has(lt.id),onSendInput:T,isDragSource:X===lt.id,isDragging:X!==null,isDragOver:P===lt.id,isValidDropTarget:le(lt.id),onDragStart:oe,onDragEnd:q,onDragOverTarget:K,onDragLeaveTarget:Q,onDropTarget:ie,onRemoveDependency:D?te:void 0,debugLogging:z,showTokenUsage:O,isChainMember:ht})]}),Ze(Ee+1)]},lt.id)})]})})()}),!be&&X&&((dt=e.find(Be=>Be.id===X))==null?void 0:dt.depends_on)&&t.jsxs("div",{className:"mt-3 border-2 border-dashed border-red-300 rounded-lg p-4 text-center text-sm text-red-400 transition-colors hover:border-red-400 hover:text-red-500 hover:bg-red-50",onDragOver:Be=>{Be.preventDefault(),Be.dataTransfer.dropEffect="move"},onDrop:Be=>{Be.preventDefault(),X&&D&&(je.current=!0,D(X,null))},children:[t.jsx(EN,{size:20,className:"mx-auto mb-1"}),ke("dnd.dropToRemoveDep")]}),U&&t.jsx(_r,{x:U.x,y:U.y,onClose:()=>W(null),children:t.jsxs("button",{onClick:()=>F(!0),className:en,children:[t.jsx(mn,{size:14}),ke("todos.add")]})})]})}const u6=[{value:1,labelKey:"cron.mon"},{value:2,labelKey:"cron.tue"},{value:3,labelKey:"cron.wed"},{value:4,labelKey:"cron.thu"},{value:5,labelKey:"cron.fri"},{value:6,labelKey:"cron.sat"},{value:0,labelKey:"cron.sun"}];function d6(e){const s={mode:"daily",everyMinutes:30,hourlyMinute:0,dailyHour:9,dailyMinute:0,weeklyDays:[1,2,3,4,5],weeklyHour:9,weeklyMinute:0,monthlyDay:1,monthlyHour:9,monthlyMinute:0};if(!e)return s;const i=e.trim().split(/\s+/);if(i.length!==5)return{...s,mode:"custom"};const[a,h,m,,f]=i,o=a.match(/^\*\/(\d+)$/);if(o&&h==="*"&&m==="*"&&f==="*")return{...s,mode:"minutes",everyMinutes:parseInt(o[1])};if(/^\d+$/.test(a)&&h==="*"&&m==="*"&&f==="*")return{...s,mode:"hourly",hourlyMinute:parseInt(a)};const c=/^\d+$/.test(a)?parseInt(a):-1,d=/^\d+$/.test(h)?parseInt(h):-1;if(c<0||d<0)return{...s,mode:"custom"};if(m==="*"&&f!=="*"){const p=f.split(",").map(u=>{const v=parseInt(u);return isNaN(v)?-1:v}).filter(u=>u>=0);if(p.length>0)return{...s,mode:"weekly",weeklyDays:p,weeklyHour:d,weeklyMinute:c}}return/^\d+$/.test(m)&&f==="*"?{...s,mode:"monthly",monthlyDay:parseInt(m),monthlyHour:d,monthlyMinute:c}:m==="*"&&f==="*"?{...s,mode:"daily",dailyHour:d,dailyMinute:c}:{...s,mode:"custom"}}function Fb(e){switch(e.mode){case"minutes":return`*/${e.everyMinutes} * * * *`;case"hourly":return`${e.hourlyMinute} * * * *`;case"daily":return`${e.dailyMinute} ${e.dailyHour} * * *`;case"weekly":return`${e.weeklyMinute} ${e.weeklyHour} * * ${e.weeklyDays.sort((s,i)=>s-i).join(",")}`;case"monthly":return`${e.monthlyMinute} ${e.monthlyHour} ${e.monthlyDay} * *`;default:return""}}function h6({value:e,onChange:s}){const{t:i}=it(),[a,h]=k.useState(()=>d6(e)),[m,f]=k.useState(e);k.useEffect(()=>{if(a.mode==="custom")s(m);else{const b=Fb(a);s(b)}},[a,m]);const o=b=>{h(C=>({...C,...b}))},c=b=>{h(C=>{const w=C.weeklyDays.includes(b)?C.weeklyDays.filter(x=>x!==b):[...C.weeklyDays,b];return{...C,weeklyDays:w.length>0?w:C.weeklyDays}})},d=[{value:"minutes",labelKey:"cron.everyMinutes"},{value:"hourly",labelKey:"cron.hourly"},{value:"daily",labelKey:"cron.daily"},{value:"weekly",labelKey:"cron.weekly"},{value:"monthly",labelKey:"cron.monthly"},{value:"custom",labelKey:"cron.custom"}],p="bg-warm-50 border border-warm-300 rounded-lg px-2 py-1.5 text-sm text-warm-800 font-mono text-center transition-all duration-200 focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20",u=(b,C,w,x)=>t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("select",{value:b,onChange:y=>w(parseInt(y.target.value)),className:`${p} w-16`,children:Array.from({length:24},(y,_)=>t.jsx("option",{value:_,children:String(_).padStart(2,"0")},_))}),t.jsx("span",{className:"text-warm-500 font-mono",children:":"}),t.jsx("select",{value:C,onChange:y=>x(parseInt(y.target.value)),className:`${p} w-16`,children:Array.from({length:12},(y,_)=>_*5).map(y=>t.jsx("option",{value:y,children:String(y).padStart(2,"0")},y))})]}),v=a.mode==="custom"?m:Fb(a);return t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"flex flex-wrap gap-1.5",children:d.map(b=>t.jsx("button",{type:"button",onClick:()=>o({mode:b.value}),className:`px-2.5 py-1 rounded-md text-xs font-medium transition-colors ${a.mode===b.value?"bg-amber-500 text-white":"bg-warm-100 text-warm-500 hover:bg-warm-200"}`,children:i(b.labelKey)},b.value))}),t.jsxs("div",{className:"bg-warm-50 rounded-lg p-3",children:[a.mode==="minutes"&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.every")}),t.jsx("select",{value:a.everyMinutes,onChange:b=>o({everyMinutes:parseInt(b.target.value)}),className:`${p} w-20`,children:[5,10,15,20,30].map(b=>t.jsx("option",{value:b,children:b},b))}),t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.minutesLabel")})]}),a.mode==="hourly"&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.everyHourAt")}),t.jsx("select",{value:a.hourlyMinute,onChange:b=>o({hourlyMinute:parseInt(b.target.value)}),className:`${p} w-16`,children:Array.from({length:12},(b,C)=>C*5).map(b=>t.jsx("option",{value:b,children:String(b).padStart(2,"0")},b))}),t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.minutesPast")})]}),a.mode==="daily"&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.everyDayAt")}),u(a.dailyHour,a.dailyMinute,b=>o({dailyHour:b}),b=>o({dailyMinute:b}))]}),a.mode==="weekly"&&t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"flex flex-wrap gap-1.5",children:u6.map(b=>t.jsx("button",{type:"button",onClick:()=>c(b.value),className:`w-9 h-9 rounded-lg text-xs font-medium transition-colors ${a.weeklyDays.includes(b.value)?"bg-amber-500 text-white":"bg-theme-card text-warm-500 border border-warm-200 hover:border-amber-300"}`,children:i(b.labelKey)},b.value))}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.at")}),u(a.weeklyHour,a.weeklyMinute,b=>o({weeklyHour:b}),b=>o({weeklyMinute:b}))]})]}),a.mode==="monthly"&&t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.everyMonthOn")}),t.jsx("select",{value:a.monthlyDay,onChange:b=>o({monthlyDay:parseInt(b.target.value)}),className:`${p} w-16`,children:Array.from({length:28},(b,C)=>C+1).map(b=>t.jsx("option",{value:b,children:b},b))}),t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.dayAt")}),u(a.monthlyHour,a.monthlyMinute,b=>o({monthlyHour:b}),b=>o({monthlyMinute:b}))]}),a.mode==="custom"&&t.jsxs("div",{children:[t.jsx("input",{type:"text",placeholder:"*/30 * * * *",value:m,onChange:b=>f(b.target.value),className:"bg-warm-50 border border-warm-300 rounded-lg px-3 py-1.5 w-full text-sm text-warm-800 font-mono transition-all duration-200 focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20"}),t.jsx("p",{className:"text-2xs text-warm-400 mt-1",children:i("schedule.cronHint")})]})]}),a.mode!=="custom"&&v&&t.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[t.jsxs("span",{className:"text-warm-400",children:[i("cron.expression"),":"]}),t.jsx("code",{className:"px-2 py-0.5 rounded bg-warm-100 text-warm-600 font-mono",children:v})]})]})}function f6(){const e=new Date;e.setHours(e.getHours()+1),e.setMinutes(0,0,0);const s=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0"),h=String(e.getHours()).padStart(2,"0"),m=String(e.getMinutes()).padStart(2,"0");return`${s}-${i}-${a}T${h}:${m}`}function m6(e){const s=new Date(e),i=s.getFullYear(),a=String(s.getMonth()+1).padStart(2,"0"),h=String(s.getDate()).padStart(2,"0"),m=String(s.getHours()).padStart(2,"0"),f=String(s.getMinutes()).padStart(2,"0");return`${i}-${a}-${h}T${m}:${f}`}function d_({onSave:e,onCancel:s,initialTitle:i="",initialDescription:a="",initialCronExpression:h="",initialCliTool:m,initialSkipIfRunning:f=!0,initialScheduleType:o="recurring",initialRunAt:c,projectCliTool:d="claude"}){const[p,u]=k.useState(i),[v,b]=k.useState(a),[C,w]=k.useState(h),[x,y]=k.useState(m||d||"claude"),[_,S]=k.useState(f),[N,D]=k.useState(o),[j,R]=k.useState(c?m6(c):f6()),{t:L}=it(),T=N==="once",A=p.trim()&&(T?!!j:!!C.trim()),z=O=>{O.preventDefault(),A&&e({title:p.trim(),description:v.trim(),cronExpression:T?"":C.trim(),cliTool:x,skipIfRunning:_,scheduleType:N,runAt:T?new Date(j).toISOString():void 0})};return t.jsxs("form",{onSubmit:z,className:"card p-5 border-amber-500/30",children:[t.jsx("div",{className:"mb-3",children:t.jsx("input",{type:"text",placeholder:L("scheduleForm.titlePlaceholder"),value:p,onChange:O=>u(O.target.value),className:"input-field",autoFocus:!0})}),t.jsx("div",{className:"mb-3",children:t.jsx("textarea",{placeholder:L("scheduleForm.descPlaceholder"),value:v,onChange:O=>b(O.target.value),rows:3,className:"prompt-field min-h-[76px] max-h-[320px] resize-y [field-sizing:content]"})}),t.jsxs("div",{className:"mb-3",children:[t.jsx("label",{className:"block text-xs font-medium text-warm-500 mb-1.5",children:L("schedule.type")}),t.jsxs("div",{className:"flex gap-1.5",children:[t.jsx("button",{type:"button",onClick:()=>D("recurring"),className:`px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${N==="recurring"?"bg-amber-500 text-white":"bg-warm-100 text-warm-500 hover:bg-warm-200"}`,children:L("schedule.recurring")}),t.jsx("button",{type:"button",onClick:()=>D("once"),className:`px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${N==="once"?"bg-amber-500 text-white":"bg-warm-100 text-warm-500 hover:bg-warm-200"}`,children:L("schedule.once")})]})]}),T?t.jsxs("div",{className:"mb-3",children:[t.jsx("label",{className:"block text-xs font-medium text-warm-500 mb-1.5",children:L("schedule.runAtLabel")}),t.jsx("input",{type:"datetime-local",value:j,onChange:O=>R(O.target.value),className:"input-field text-sm font-mono",min:new Date().toISOString().slice(0,16)})]}):t.jsxs("div",{className:"mb-3",children:[t.jsx("label",{className:"block text-xs font-medium text-warm-500 mb-1.5",children:L("schedule.cronExpression")}),t.jsx(h6,{value:C,onChange:w})]}),t.jsx("div",{className:"mb-3 grid grid-cols-2 gap-3",children:t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-warm-500 mb-1.5",children:L("scheduleForm.cliTool")}),t.jsx("select",{value:x,onChange:O=>y(O.target.value),className:"input-field text-sm !py-2",children:br.map(O=>t.jsx("option",{value:O.value,children:O.label},O.value))})]})}),!T&&t.jsx("div",{className:"mb-4",children:t.jsxs("label",{className:"flex items-center gap-2 text-sm text-warm-600 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:_,onChange:O=>S(O.target.checked),className:"rounded border-warm-300 text-amber-500 focus:ring-amber-500"}),L("schedule.skipIfRunning")]})}),t.jsxs("div",{className:"flex gap-3 justify-end",children:[t.jsx("button",{type:"button",onClick:s,className:"btn-ghost text-sm",children:L("scheduleForm.cancel")}),t.jsx("button",{type:"submit",disabled:!A,className:"btn-primary text-sm",children:L("scheduleForm.save")})]})]})}function p6({schedule:e,onToggle:s,onDelete:i,onEdit:a,onTrigger:h,onMergeRun:m,onCleanupRun:f}){const[o,c]=k.useState(!1),[d,p]=k.useState(!1),[u,v]=k.useState([]),[b,C]=k.useState(!1),[w,x]=k.useState(!1),[y,_]=k.useState(null),{t:S}=it(),N=async()=>{try{const U=await rf(e.id);v(U)}catch{}},D=async U=>{if(!(!U.todo_id||!m)){_(U.id);try{await m(U.todo_id),await N()}finally{_(null)}}},j=async U=>{if(!(!U.todo_id||!f)){_(U.id);try{await f(U.todo_id),await N()}finally{_(null)}}},R=e.schedule_type==="once",L=async()=>{if(!b)try{const U=await rf(e.id);v(U),C(!0)}catch{}},T=()=>{const U=!o;c(U),U&&L()},A=async()=>{x(!0);try{await h(e.id);const U=await rf(e.id);v(U),C(!0)}finally{x(!1)}};if(d)return t.jsx(d_,{initialTitle:e.title,initialDescription:e.description??"",initialCronExpression:R?"":e.cron_expression,initialCliTool:e.cli_tool??void 0,initialSkipIfRunning:!!e.skip_if_running,initialScheduleType:e.schedule_type,initialRunAt:e.run_at??void 0,onSave:async U=>{await a(e.id,{title:U.title,description:U.description,cron_expression:U.cronExpression||void 0,cli_tool:U.cliTool,skip_if_running:U.skipIfRunning,schedule_type:U.scheduleType,run_at:U.runAt}),p(!1)},onCancel:()=>p(!1)});const z=e.is_active?"border-l-amber-500":"border-l-warm-300",O={triggered:"text-status-running",skipped:"text-status-warning",completed:"text-status-success",failed:"text-status-error"},H={triggered:S("schedule.runTriggered"),skipped:S("schedule.runSkipped"),completed:S("schedule.runCompleted"),failed:S("schedule.runFailed")},F=U=>U?new Date(U).toLocaleString():"";return t.jsxs("div",{className:`card border-l-4 ${z} overflow-hidden`,children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3.5 cursor-pointer hover:bg-warm-50 transition-colors",onClick:T,children:[t.jsx("button",{className:"text-warm-400 hover:text-amber-500 flex-shrink-0 transition-colors",children:t.jsx(Ts,{size:14,className:`transition-transform duration-200 ${o?"rotate-90":""}`})}),t.jsx("span",{className:"flex-1 text-sm text-warm-800 font-medium truncate",children:e.title}),R?t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-2xs font-mono font-medium bg-blue-500/10 text-blue-600 flex-shrink-0",children:[t.jsx(ri,{size:12}),F(e.run_at)]}):t.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-2xs font-mono font-medium bg-amber-500/10 text-amber-600 flex-shrink-0",children:e.cron_expression}),t.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-2xs font-semibold ${R?"bg-blue-500/10 text-blue-600":"bg-amber-500/10 text-amber-600"}`,children:S(R?"schedule.once":"schedule.recurring")}),t.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-2xs font-semibold ${e.is_active?"bg-status-success/10 text-status-success":"bg-warm-200 text-warm-500"}`,children:e.is_active?S("schedule.active"):S("schedule.paused")}),t.jsxs("div",{className:"flex items-center gap-0.5 ml-2",onClick:U=>U.stopPropagation(),children:[t.jsx("button",{onClick:A,disabled:w,className:"p-1.5 text-amber-500/60 hover:text-amber-500 hover:bg-amber-500/10 rounded-lg transition-colors disabled:opacity-30",title:S("schedule.trigger"),children:t.jsx(wr,{size:14})}),t.jsx("button",{onClick:()=>s(e.id,!e.is_active),className:`p-1.5 rounded-lg transition-colors ${e.is_active?"text-status-warning/60 hover:text-status-warning hover:bg-status-warning/10":"text-status-success/60 hover:text-status-success hover:bg-status-success/10"}`,title:e.is_active?S("schedule.pause"):S("schedule.activate"),children:e.is_active?t.jsx(zm,{size:14}):t.jsx(si,{size:14})}),t.jsx("button",{onClick:()=>p(!0),className:"p-1.5 text-warm-400 hover:text-accent hover:bg-accent/10 rounded-lg transition-colors",title:S("schedule.edit"),children:t.jsx(ai,{size:14})}),t.jsx("button",{onClick:()=>i(e.id),className:"p-1.5 text-warm-400 hover:text-status-error hover:bg-status-error/10 rounded-lg transition-colors",title:S("schedule.delete"),children:t.jsx(Nn,{size:14})})]})]}),o&&t.jsxs("div",{className:"border-t border-warm-200 px-5 py-5 space-y-4 animate-fade-in bg-warm-50/50",children:[e.description&&t.jsx("div",{children:t.jsx("p",{className:"text-sm text-warm-600 whitespace-pre-wrap leading-relaxed",children:e.description})}),t.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[R?t.jsxs("span",{className:"badge bg-blue-500/10 text-blue-600 font-mono",children:[S("schedule.runAtLabel"),": ",F(e.run_at)]}):t.jsx("span",{className:"badge bg-amber-500/10 text-amber-600 font-mono",children:e.cron_expression}),!R&&e.skip_if_running?t.jsx("span",{className:"badge bg-status-info/10 text-status-info",children:S("schedule.skipIfRunning")}):null,t.jsxs("span",{className:"badge bg-warm-200 text-warm-600",children:[S("schedule.lastRun"),": ",e.last_run_at?new Date(e.last_run_at).toLocaleString():S("schedule.never")]})]}),t.jsxs("div",{children:[t.jsx("h4",{className:"text-xs font-semibold text-warm-500 uppercase tracking-wider mb-2",children:S("schedule.runs")}),u.length===0?t.jsx("p",{className:"text-xs text-warm-400 italic",children:S("schedule.noRuns")}):t.jsx("div",{className:"max-h-48 overflow-auto space-y-1",children:u.map(U=>{const W=U.todo_id&&U.todo_status==="completed"&&!!U.todo_branch_name,X=U.todo_id&&U.todo_status!=="running"&&U.todo_status!=="pending"&&(U.todo_worktree_path||U.todo_branch_name),J=y===U.id;return t.jsxs("div",{className:"flex items-center gap-3 text-xs py-1.5 px-3 rounded-lg bg-theme-hover",children:[t.jsx("span",{className:`font-medium ${O[U.status]||"text-warm-500"}`,children:H[U.status]||U.status}),U.skipped_reason&&t.jsxs("span",{className:"text-warm-400",children:["(",U.skipped_reason,")"]}),t.jsxs("div",{className:"flex items-center gap-0.5 ml-auto",children:[W&&m&&t.jsx("button",{onClick:()=>D(U),disabled:J,className:"p-1 text-status-merged/60 hover:text-status-merged hover:bg-status-merged/10 rounded transition-colors disabled:opacity-30",title:S("todo.merge"),children:t.jsx(nl,{size:12})}),X&&f&&t.jsx("button",{onClick:()=>j(U),disabled:J,className:"p-1 text-status-warning/60 hover:text-status-warning hover:bg-status-warning/10 rounded transition-colors disabled:opacity-30",title:S("todo.cleanup"),children:t.jsx(Nn,{size:12})})]}),t.jsx("span",{className:"text-warm-400 font-mono flex-shrink-0",children:new Date(U.started_at).toLocaleString()})]},U.id)})})]})]})]})}function g6({schedules:e,projectCliTool:s,onAddSchedule:i,onToggleSchedule:a,onDeleteSchedule:h,onEditSchedule:m,onTriggerSchedule:f,onMergeRun:o,onCleanupRun:c}){const[d,p]=k.useState(!1),[u,v]=k.useState(null),{t:b}=it();return t.jsxs("div",{className:"min-h-[50vh]",onContextMenu:C=>{li(C)||(C.preventDefault(),v({x:C.clientX,y:C.clientY}))},children:[t.jsxs("div",{className:"flex items-center justify-between mb-5",children:[t.jsx("h2",{className:"text-sm font-semibold text-warm-600 uppercase tracking-wider",children:b("schedules.title")}),!d&&t.jsxs("button",{onClick:()=>p(!0),className:"btn-primary btn-sm",children:[t.jsx(mn,{size:14}),b("schedules.add")]})]}),d&&t.jsx("div",{className:"mb-5 animate-slide-up",children:t.jsx(d_,{projectCliTool:s,onSave:async C=>{await i(C),p(!1)},onCancel:()=>p(!1)})}),t.jsx("div",{className:"space-y-3",children:e.length===0?t.jsx("div",{className:"card",children:t.jsx(Fi,{icon:kj,title:b("schedules.empty"),description:b("schedules.emptyHint")})}):e.map((C,w)=>t.jsx("div",{className:"animate-slide-up",style:{animationDelay:`${w*30}ms`},children:t.jsx(p6,{schedule:C,onToggle:a,onDelete:h,onEdit:m,onTrigger:f,onMergeRun:o,onCleanupRun:c})},C.id))}),u&&t.jsx(_r,{x:u.x,y:u.y,onClose:()=>v(null),children:t.jsxs("button",{type:"button",className:en,onClick:()=>p(!0),children:[t.jsx(mn,{size:14}),b("schedules.add")]})})]})}function h_(e){const[s,i]=k.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return k.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const a=window.matchMedia(e),h=m=>i(m.matches);return i(a.matches),a.addEventListener("change",h),()=>a.removeEventListener("change",h)},[e]),s}const $b="__custom__";function x6({open:e,onClose:s,projectId:i,projectName:a,onPushed:h}){const{t:m}=it(),[f,o]=k.useState(!1),[c,d]=k.useState(!1),[p,u]=k.useState(null),[v,b]=k.useState([]),[C,w]=k.useState("origin"),[x,y]=k.useState([]),[_,S]=k.useState([]),[N,D]=k.useState(!0),[j,R]=k.useState(!1);k.useEffect(()=>{if(!e)return;let U=!1;return o(!0),u(null),Promise.all([JN(i),Vf(i)]).then(([W,X])=>{var ue,ae;if(U)return;const J=W.remotes||[];b(J);const P=((ue=J.find(ee=>ee.name==="origin"))==null?void 0:ue.name)||((ae=J[0])==null?void 0:ae.name)||"origin";w(P);const B=X.branches||[],I=B.filter(ee=>!ee.remote),V=`remotes/${P}/`,$=B.filter(ee=>ee.remote&&ee.name.startsWith(V)).map(ee=>ee.name.slice(V.length)).filter(ee=>ee&&ee!=="HEAD");S($);const se=new Set($);y(I.map(ee=>{const Y=se.has(ee.name);return{local:ee.name,current:ee.current,remote:ee.name,customRemote:!1,setUpstream:!Y,checked:ee.current}}))}).catch(W=>{U||u(W instanceof Error?W.message:"Failed to load remotes")}).finally(()=>{U||o(!1)}),()=>{U=!0}},[e,i]),k.useEffect(()=>{if(!e||!C)return;let U=!1;return Vf(i).then(W=>{if(U)return;const X=`remotes/${C}/`,J=(W.branches||[]).filter(P=>P.remote&&P.name.startsWith(X)).map(P=>P.name.slice(X.length)).filter(P=>P&&P!=="HEAD");S(J)}).catch(()=>{}),()=>{U=!0}},[C,i,e]);const L=x.length>0&&x.every(U=>U.checked),T=x.some(U=>U.checked),A=x.filter(U=>U.checked).length,z=k.useMemo(()=>{var U;return((U=v.find(W=>W.name===C))==null?void 0:U.url)||""},[v,C]),O=(U,W)=>{y(X=>X.map(J=>J.local===U?{...J,...W}:J))},H=()=>{const U=!L;y(W=>W.map(X=>({...X,checked:U})))},F=async()=>{u(null);const U=x.filter(X=>X.checked);if(U.length===0){u(m("git.pushDialog.errorRequireBranch"));return}const W=U.map(X=>({local:X.local,remote:(X.remote||"").trim()||X.local,setUpstream:X.setUpstream}));d(!0);try{await Pm(i,{remote:C,branches:W,pushAllTags:N,force:j}),h==null||h(),s()}catch(X){u(X instanceof Error?X.message:"Push failed")}finally{d(!1)}};return t.jsx(Fn,{open:e,onClose:c?()=>{}:s,size:"2xl",disableBackdropClose:!0,disableEscClose:c,children:t.jsxs("div",{className:"card p-5 space-y-4",children:[t.jsxs("h3",{className:"text-base font-semibold",style:{color:"var(--color-text-primary)"},children:["Push : ",a]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 whitespace-nowrap",children:m("git.pushDialog.targetRemote")}),t.jsxs("select",{value:C,onChange:U=>w(U.target.value),className:"input-field text-xs py-1.5 px-3 w-auto",disabled:f||c||v.length===0,children:[v.length===0&&t.jsx("option",{value:"origin",children:"origin"}),v.map(U=>t.jsx("option",{value:U.name,children:U.name},U.name))]}),t.jsx("input",{readOnly:!0,value:z,className:"input-field text-xs font-mono py-1.5 px-3 flex-1 cursor-default"})]}),t.jsxs("div",{children:[t.jsx("div",{className:"section-label mb-2",children:m("git.pushDialog.branchesHeader")}),t.jsx("div",{className:"rounded-xl border border-theme-border-strong overflow-hidden",children:t.jsx("div",{className:"overflow-auto max-h-[50vh]",children:t.jsxs("table",{className:"w-full text-sm border-collapse",children:[t.jsx("thead",{className:"sticky top-0 bg-warm-100 z-10",children:t.jsxs("tr",{children:[t.jsx("th",{className:"text-left text-2xs font-semibold uppercase tracking-wider text-warm-500 py-2 px-3 w-12",children:m("git.pushDialog.colPush")}),t.jsx("th",{className:"text-left text-2xs font-semibold uppercase tracking-wider text-warm-500 py-2 px-3",children:m("git.pushDialog.colLocal")}),t.jsx("th",{className:"text-left text-2xs font-semibold uppercase tracking-wider text-warm-500 py-2 px-3",children:m("git.pushDialog.colRemote")}),t.jsx("th",{className:"text-left text-2xs font-semibold uppercase tracking-wider text-warm-500 py-2 px-3 w-16",children:m("git.pushDialog.colTracking")})]})}),t.jsxs("tbody",{children:[f&&t.jsx("tr",{children:t.jsx("td",{colSpan:4,className:"py-6 text-center text-xs text-warm-500",children:m("git.pushDialog.loading")})}),!f&&x.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:4,className:"py-6 text-center text-xs text-warm-500",children:m("git.pushDialog.noLocalBranches")})}),x.map(U=>t.jsxs("tr",{className:"border-t border-theme-border/50 hover:bg-theme-hover/40 transition-colors",children:[t.jsx("td",{className:"py-2 px-3",children:t.jsx("input",{type:"checkbox",checked:U.checked,onChange:W=>O(U.local,{checked:W.target.checked}),disabled:c,className:"cursor-pointer"})}),t.jsxs("td",{className:"py-2 px-3 font-mono text-xs",style:{color:"var(--color-text-primary)"},children:[U.local,U.current&&t.jsx("span",{className:"ml-1.5 text-[10px] text-status-warning",children:"●"})]}),t.jsx("td",{className:"py-2 px-3",children:U.customRemote?t.jsx("input",{type:"text",value:U.remote,onChange:W=>O(U.local,{remote:W.target.value}),placeholder:U.local,className:"input-field text-xs font-mono py-1 px-2 w-full",disabled:c}):t.jsxs("select",{value:_.includes(U.remote)||U.remote?U.remote:"",onChange:W=>{const X=W.target.value;X===$b?O(U.local,{customRemote:!0}):O(U.local,{remote:X})},className:"input-field text-xs font-mono py-1 px-2 w-full",disabled:c,children:[!_.includes(U.remote)&&U.remote&&t.jsxs("option",{value:U.remote,children:[U.remote," (",m("git.pushDialog.newBranch"),")"]}),_.map(W=>t.jsx("option",{value:W,children:W},W)),t.jsx("option",{value:$b,children:m("git.pushDialog.customRemote")})]})}),t.jsx("td",{className:"py-2 px-3",children:t.jsx("input",{type:"checkbox",checked:U.setUpstream,onChange:W=>O(U.local,{setUpstream:W.target.checked}),disabled:c,className:"cursor-pointer"})})]},U.local))]})]})})})]}),t.jsxs("div",{className:"flex items-center gap-5 text-xs text-warm-700",children:[t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:L,ref:U=>{U&&(U.indeterminate=!L&&T)},onChange:H,disabled:c||x.length===0,className:"cursor-pointer"}),m("git.pushDialog.selectAll")]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:N,onChange:U=>D(U.target.checked),disabled:c,className:"cursor-pointer"}),m("git.pushDialog.allTags")]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:j,onChange:U=>R(U.target.checked),disabled:c,className:"cursor-pointer"}),t.jsx("span",{title:m("git.pushDialog.forceHint"),children:m("git.pushDialog.force")})]})]}),p&&t.jsx("div",{className:"text-xs text-status-error font-medium",children:p}),t.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[t.jsx("button",{type:"button",onClick:s,disabled:c,className:"btn-secondary btn-md",children:m("git.pushDialog.cancel")}),t.jsx("button",{type:"button",onClick:F,disabled:c||f||A===0,className:"btn-primary btn-md",children:m(c?"git.pushDialog.pushing":"git.pushDialog.submit")})]})]})})}function v6(e){switch(e){case"A":return{label:"A",color:"text-status-success"};case"D":return{label:"D",color:"text-status-error"};case"R":return{label:"R",color:"text-purple-500"};case"C":return{label:"C",color:"text-blue-500"};default:return{label:"M",color:"text-accent"}}}function dp({files:e,loading:s,selectedFile:i,onFileClick:a,commitHash:h}){const{t:m}=it();return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"px-3 py-2 border-b border-warm-100 flex items-center justify-between shrink-0",children:[t.jsx("span",{className:"text-[11px] font-semibold text-warm-500 uppercase tracking-wider",children:m("git.changedFiles")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"text-2xs text-warm-400",children:[e.length," ",m("git.files")]}),h&&t.jsx("span",{className:"text-2xs font-mono text-warm-400",children:h.substring(0,7)})]})]}),s?t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("span",{className:"text-xs text-warm-400",children:m("git.loadingFiles")})}):e.length===0?t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("span",{className:"text-xs text-warm-400",children:m("git.noFilesChanged")})}):t.jsx("div",{className:"flex-1 overflow-y-auto",children:e.map(f=>{const o=v6(f.status),c=i===f.path;return t.jsxs("div",{onClick:()=>a(f.path),className:`flex items-center gap-2 px-3 py-1.5 cursor-pointer text-xs hover:bg-warm-50/50 transition-colors ${c?"bg-accent/10 border-l-2 border-accent":""}`,children:[t.jsx("span",{className:`font-mono font-bold text-2xs w-3 shrink-0 ${o.color}`,children:o.label}),t.jsxs("span",{className:"truncate flex-1 text-warm-600",title:f.path,children:[f.path.split("/").pop(),t.jsx("span",{className:"text-warm-400 ml-1 text-2xs",children:f.path.includes("/")?f.path.substring(0,f.path.lastIndexOf("/")):""})]}),t.jsxs("span",{className:"shrink-0 text-2xs text-status-success",children:["+",f.additions]}),t.jsxs("span",{className:"shrink-0 text-2xs text-status-error",children:["-",f.deletions]})]},f.path)})})]})}function Bu({diff:e,loading:s,selectedFile:i}){const{t:a}=it();return i?s?t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsx("span",{className:"text-xs text-warm-400",children:a("git.loadingDiff")})}):t.jsxs("div",{className:"h-full flex flex-col bg-[#1A1A1A]",children:[t.jsx("div",{className:"px-3 py-2 border-b border-gray-700 shrink-0",children:t.jsx("span",{className:"text-xs font-mono text-gray-100",children:i})}),t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx("pre",{className:"p-3 font-mono text-xs leading-relaxed",children:e?e.split(`
|
|
634
|
+
`).map((_e,bt)=>{let kt="text-theme-text",ln="";return _e.startsWith("+")&&!_e.startsWith("+++")?kt="text-theme-text bg-status-success/15":_e.startsWith("-")&&!_e.startsWith("---")?kt="text-theme-text bg-status-error/15":_e.startsWith("@@")?kt="text-accent":_e.startsWith("diff ")&&(kt="text-warm-700",ln="font-semibold"),t.jsx("div",{className:`whitespace-pre ${kt} ${ln}`,children:_e},bt)}):t.jsx("span",{className:"text-warm-400 italic",children:ye("log.noChanges")})})]}),t.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:Ge.bg,fontFamily:Mt,border:`1px solid ${Ge.separator}`},children:[t.jsxs("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${Ge.separator}`,fontSize:12,color:Ge.text},children:[t.jsx("span",{style:{color:Ge.prompt},children:"$"})," ",t.jsx("span",{style:{color:Ge.bright},children:"tail"})," ",t.jsx("span",{style:{color:Ge.dim},children:"-f task.log"})]}),t.jsx(l_,{logs:I,interactive:_&&e.status==="running",todoId:e.id,onSendInput:S,embedded:!0})]})]})})]}),We&&t.jsxs("div",{className:"mt-1.5 flex items-center gap-2 px-4 py-2 rounded-lg border-2 border-dashed border-cyan-400 bg-cyan-50/50 animate-fade-in",children:[t.jsx(za,{size:14,className:"text-cyan-500 flex-shrink-0"}),t.jsx("span",{className:"text-xs font-medium text-cyan-600",children:ye("dnd.dropHint")})]}),mt&&t.jsxs("div",{className:"mt-1.5 flex items-center gap-2 px-4 py-2 rounded-lg border-2 border-dashed border-red-300 bg-red-50/50 animate-fade-in",children:[t.jsx(gj,{size:14,className:"text-red-400 flex-shrink-0"}),t.jsx("span",{className:"text-xs font-medium text-red-400",children:ye("dnd.cyclicWarning")})]}),Le&&t.jsxs(_r,{x:Le.x,y:Le.y,onClose:()=>De(null),children:[rt&&t.jsxs("button",{onClick:()=>m(e.id,"headless"),className:en,title:ye("todo.startHeadless"),children:[t.jsx(wr,{size:14}),ye("todo.start")]}),rt&&Xs&&t.jsxs("button",{onClick:()=>m(e.id,"interactive"),className:en,title:ye("todo.startInteractiveDesc"),children:[t.jsx(Ba,{size:14}),ye("todo.startInteractive")]}),rt&&t.jsxs("button",{onClick:()=>m(e.id,"verbose"),className:en,title:ye("todo.startVerboseDesc"),children:[t.jsx(Gf,{size:14}),ye("todo.startVerbose")]}),jt&&t.jsxs("button",{onClick:()=>f(e.id),className:en,children:[t.jsx(il,{size:14}),ye("todo.stop")]}),rn&&t.jsxs("button",{onClick:gs,disabled:Fe,className:en,children:[t.jsx(nl,{size:14}),ye("todo.merge")]}),Pn&&t.jsxs("button",{onClick:()=>{fe(!0),ie(null)},disabled:q,className:en,children:[t.jsx(bv,{size:14}),ye("todo.continue")]}),Dn&&t.jsxs("button",{onClick:()=>rs("headless"),disabled:Ce,className:en,children:[t.jsx(oi,{size:14}),ye("todo.retry")]}),vt&&t.jsxs("button",{onClick:()=>Ee(!0),className:en,title:ye("todo.scheduleDesc"),children:[t.jsx(Uf,{size:14}),ye("todo.schedule")]}),St&&t.jsxs("button",{onClick:()=>{le(!0),et(null)},className:en,title:ye("todo.scheduleOnResetDesc"),children:[t.jsx(ri,{size:14}),ye("todo.scheduleOnReset")]}),Nt&&t.jsxs("button",{onClick:ss,disabled:he,className:en,children:[t.jsx(Bi,{size:14}),ye("todo.viewDiff")]}),F&&Is&&t.jsxs("button",{onClick:ns,className:en,children:[t.jsx(kv,{size:14}),ye("todo.viewDebugLog")]}),yn&&t.jsxs("button",{onClick:xs,disabled:pe,className:en,children:[t.jsx(au,{size:14}),ye("todo.cleanup")]}),t.jsx(u_,{}),t.jsxs("button",{onClick:()=>B(!0),className:en,children:[t.jsx(ai,{size:14}),ye("todo.edit")]}),t.jsxs("button",{onClick:()=>o(e.id),className:up,children:[t.jsx(Nn,{size:14}),ye("todo.delete")]})]})]})}const l6=k.lazy(()=>Du(()=>import("./TaskGraph-D_YqAb0g.js"),__vite__mapDeps([0,1,2,3,4]))),Fc={all:null,active:["pending","running"],completed:["completed","merged"],cancelled:["stopped","failed"]};function Hb(e,s,i){let a=i;const h=new Set;for(;a;){if(a===s)return!0;if(h.has(a))return!1;h.add(a);const m=e.find(f=>f.id===a);a=(m==null?void 0:m.depends_on)??null}return!1}function c6({todos:e,projectId:s,projectCliTool:i,projectIsGitRepo:a,projectUseWorktree:h,onAddTodo:m,onStartAll:f,onStopAll:o,onStartTodo:c,onStopTodo:d,onDeleteTodo:p,onEditTodo:u,onMergeTodo:v,onMergeChain:b,onCleanupTodo:C,onRetryTodo:w,onContinueTodo:x,onFixTodo:y,onScheduleTodo:_,onScheduleOnResetTodo:S,resetsAt:N,onUpdateDependency:D,onUpdatePosition:j,onReorderTodos:R,onEvent:L,onSendInput:T,interactiveTodos:A,debugLogging:z,showTokenUsage:O}){var dt;const[H,F]=k.useState(!1),[U,W]=k.useState(null),[X,J]=k.useState(null),[P,B]=k.useState(null),[I,V]=k.useState(null),[$,se]=k.useState(()=>{try{return localStorage.getItem("todoViewMode")||"list"}catch{return"list"}}),[ue,ae]=k.useState(()=>{try{return localStorage.getItem("todoStatusFilter")||"all"}catch{return"all"}}),[ee,Y]=k.useState(()=>{try{return localStorage.getItem("todoStackModeEnabled")==="true"}catch{return!1}}),[he,de]=k.useState(()=>{try{return localStorage.getItem("todoStackCollapsed")==="true"}catch{return!1}}),{t:ke}=it(),re=k.useCallback(Be=>{se(Be);try{localStorage.setItem("todoViewMode",Be)}catch{}},[]),Fe=k.useCallback(Be=>{ae(Be);try{localStorage.setItem("todoStatusFilter",Be)}catch{}},[]),Ne=k.useCallback(()=>{Y(Be=>{const Ze=!Be;try{localStorage.setItem("todoStackModeEnabled",String(Ze))}catch{}if(!Ze){de(!1);try{localStorage.setItem("todoStackCollapsed","false")}catch{}}return Ze})},[]),Te=k.useCallback(()=>{de(Be=>{const Ze=!Be;try{localStorage.setItem("todoStackCollapsed",String(Ze))}catch{}return Ze})},[]),be=ee&&he&&$==="list",pe=k.useMemo(()=>({all:e.length,active:e.filter(Be=>Fc.active.includes(Be.status)).length,completed:e.filter(Be=>Fc.completed.includes(Be.status)).length,cancelled:e.filter(Be=>Fc.cancelled.includes(Be.status)).length}),[e]),Je=k.useMemo(()=>{const Be=Fc[ue];return Be?e.filter(Ze=>Be.includes(Ze.status)):e},[e,ue]),Ye=(()=>{const Be=[...Je].sort((ht,_t)=>ht.priority-_t.priority);if(ue!=="all"||be)return Be.map(ht=>({todo:ht,depth:0}));const Ze=new Map,lt=[];for(const ht of Be)if(ht.depends_on){const _t=Ze.get(ht.depends_on)||[];_t.push(ht),Ze.set(ht.depends_on,_t)}else lt.push(ht);const Ie=[],Ee=new Set,ot=(ht,_t)=>{if(Ee.has(ht.id))return;Ee.add(ht.id),Ie.push({todo:ht,depth:_t});const Ht=Ze.get(ht.id);if(Ht)for(const sn of Ht)ot(sn,_t+1)};for(const ht of lt)ot(ht,0);for(const ht of Be)Ee.has(ht.id)||Ie.push({todo:ht,depth:0});return Ie})(),{completedChainRoots:ge,completedChainMembers:Ce}=k.useMemo(()=>{const Be=new Map;for(const Ee of e)if(Ee.depends_on){const ot=Be.get(Ee.depends_on)||[];ot.push(Ee.id),Be.set(Ee.depends_on,ot)}const Ze=e.filter(Ee=>!Ee.depends_on&&Be.has(Ee.id)),lt=new Map,Ie=new Set;for(const Ee of Ze){const ot=[],ht=_t=>{if(!e.find(ce=>ce.id===_t))return;ot.push(_t);const sn=Be.get(_t)||[];for(const ce of sn)ht(ce)};if(ht(Ee.id),ot.length>=2&&ot.every(_t=>{const Ht=e.find(sn=>sn.id===_t);return(Ht==null?void 0:Ht.status)==="completed"||(Ht==null?void 0:Ht.status)==="merged"})){lt.set(Ee.id,ot.length);for(const _t of ot)Ie.add(_t)}}return{completedChainRoots:lt,completedChainMembers:Ie}},[e]),[Ke,qe]=k.useState(null),[tt,Oe]=k.useState(null),fe=k.useCallback(async Be=>{if(b){qe(Be),Oe(null);try{await b(Be)}catch(Ze){Oe(Ze instanceof Error?Ze.message:"Merge failed")}finally{qe(null)}}},[b]),je=k.useRef(!1),oe=k.useCallback(Be=>{je.current=!1,J(Be)},[]),q=k.useCallback(async()=>{if(!je.current&&X&&D){const Be=e.find(Ze=>Ze.id===X);Be!=null&&Be.depends_on&&await D(X,null)}J(null),B(null),V(null)},[X,e,D]),K=k.useCallback(Be=>{B(Be),V(null)},[]),Q=k.useCallback(Be=>{B(Ze=>Ze===Be?null:Ze)},[]),ie=k.useCallback(async Be=>{!X||!D||X!==Be&&(Hb(e,X,Be)||(je.current=!0,await D(X,Be),J(null),B(null),V(null)))},[X,e,D]),te=k.useCallback(async Be=>{D&&await D(Be,null)},[D]),le=k.useCallback(Be=>!X||X===Be?!1:!Hb(e,X,Be),[X,e]),xe=k.useCallback(Be=>{V(Be),B(null)},[]),Pe=k.useCallback(Be=>{V(Ze=>Ze===Be?null:Ze)},[]),Re=k.useCallback(async(Be,Ze)=>{if(!X||!R)return;const lt=Ze.indexOf(X);if(lt<0)return;const Ie=Ze.filter(ht=>ht!==X),Ee=Be>lt?Be-1:Be;if(Ee===lt){V(null);return}const ot=[...Ie.slice(0,Ee),X,...Ie.slice(Ee)];je.current=!0,await R(ot),J(null),V(null),B(null)},[X,R]),ve=e.some(Be=>Be.status==="pending"||Be.status==="failed"||Be.status==="stopped"),$e=e.some(Be=>Be.status==="running"),et=t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:f,disabled:!ve,className:"btn-ghost text-sm",children:[t.jsx(wr,{size:14}),ke("header.runAll")]}),t.jsxs("button",{onClick:o,disabled:!$e,className:"btn-ghost text-sm",children:[t.jsx(il,{size:14}),ke("header.stopAll")]})]});return $==="graph"?t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-5",children:[t.jsx("h2",{className:"text-sm font-semibold text-warm-600 uppercase tracking-wider",children:ke("todos.title")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex items-center bg-warm-100 rounded-lg p-0.5",children:[t.jsx("button",{onClick:()=>re("list"),className:"p-1.5 rounded-md transition-colors text-warm-400 hover:text-warm-600",title:ke("graph.listView"),children:t.jsx(lu,{size:14})}),t.jsx("button",{onClick:()=>re("graph"),className:"p-1.5 rounded-md transition-colors bg-theme-card shadow-sm text-accent",title:ke("graph.graphView"),children:t.jsx(_v,{size:14})})]}),et]})]}),t.jsx(k.Suspense,{fallback:null,children:t.jsx(l6,{todos:e,projectId:s,projectCliTool:i,projectIsGitRepo:a,projectUseWorktree:h,onAddTodo:m,onStartTodo:c,onStopTodo:d,onDeleteTodo:p,onEditTodo:u,onMergeTodo:v,onCleanupTodo:C,onRetryTodo:w,onContinueTodo:x,onFixTodo:y,onUpdateDependency:D,onUpdatePosition:j,onEvent:L,onSendInput:T,interactiveTodos:A,debugLogging:z,showTokenUsage:O})})]}):t.jsxs("div",{className:"min-h-[50vh]",onContextMenu:Be=>{li(Be)||(Be.preventDefault(),W({x:Be.clientX,y:Be.clientY}))},children:[t.jsxs("div",{className:"flex items-center justify-between mb-5",children:[t.jsx("h2",{className:"text-sm font-semibold text-warm-600 uppercase tracking-wider",children:ke("todos.title")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex items-center bg-warm-100 rounded-lg p-0.5",children:[t.jsx("button",{onClick:()=>re("list"),className:"p-1.5 rounded-md transition-colors bg-theme-card shadow-sm text-accent",title:ke("graph.listView"),children:t.jsx(lu,{size:14})}),t.jsx("button",{onClick:()=>re("graph"),className:"p-1.5 rounded-md transition-colors text-warm-400 hover:text-warm-600",title:ke("graph.graphView"),children:t.jsx(_v,{size:14})})]}),t.jsx("button",{onClick:Ne,className:`p-1.5 rounded-md transition-colors ${ee?"bg-accent/10 text-accent":"text-warm-400 hover:text-warm-600 hover:bg-warm-100"}`,title:ke(ee?"todos.stackModeOn":"todos.stackModeOff"),children:t.jsx(R5,{size:14})}),ee&&!he&&$==="list"&&Ye.length>0&&t.jsx("button",{onClick:Te,className:"p-1.5 rounded-md transition-colors text-warm-400 hover:text-warm-600 hover:bg-warm-100",title:ke("todos.collapseStack"),children:t.jsx(Bj,{size:14})}),et,!H&&t.jsxs("button",{onClick:()=>F(!0),className:"btn-primary text-xs py-2",children:[t.jsx(mn,{size:14}),ke("todos.add")]})]})]}),H&&t.jsx("div",{className:"mb-5 animate-slide-up",children:t.jsx(c_,{projectId:s,projectCliTool:i,projectIsGitRepo:a,projectUseWorktree:h,availableTodos:e,onSave:async(Be,Ze,lt,Ie,Ee,ot,ht,_t,Ht,sn)=>{await m(Be,Ze,lt,Ie,Ee,ot,ht,_t,Ht,sn),F(!1)},onCancel:()=>F(!1)})}),t.jsx("div",{className:"flex items-center gap-1 mb-4 bg-warm-100 rounded-lg p-0.5 w-fit",children:["all","active","completed","cancelled"].map(Be=>{const Ze=ue===Be,lt=Be==="all"?"todos.filterAll":Be==="active"?"todos.filterActive":Be==="completed"?"todos.filterCompleted":"todos.filterCancelled";return t.jsxs("button",{onClick:()=>Fe(Be),className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${Ze?"bg-theme-card shadow-sm text-accent":"text-warm-500 hover:text-warm-700"}`,children:[t.jsx("span",{children:ke(lt)}),t.jsx("span",{className:`text-2xs font-mono ${Ze?"text-accent/70":"text-warm-400"}`,children:pe[Be]})]},Be)})}),t.jsx("div",{className:be?"relative cursor-pointer":"space-y-3",onClick:be?Te:void 0,title:be?ke("todos.expandStack"):void 0,style:be?{height:76+Math.max(Ye.length-1,0)*6}:void 0,children:Ye.length===0?t.jsx("div",{className:"card",children:t.jsx(Fi,{icon:xw,title:ke(ue==="all"?"todos.empty":"todos.filterEmpty"),description:ue==="all"?ke("todos.emptyHint"):void 0})}):(()=>{const Be=Ye.map(({todo:lt})=>lt.id),Ze=lt=>{if(be||!R)return null;const Ie=X!==null&&I===lt;return t.jsx("div",{onDragEnter:Ee=>{Ee.preventDefault(),xe(lt)},onDragOver:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),Ee.dataTransfer.dropEffect="link",xe(lt)},onDragLeave:()=>Pe(lt),onDrop:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),Re(lt,Be)},className:"relative",style:{height:16,marginTop:-8,marginBottom:-8},children:Ie&&t.jsx("div",{className:"absolute inset-x-0 top-1/2 -translate-y-1/2 h-0.5 bg-accent rounded-full shadow-[0_0_6px_rgba(0,0,0,0.15)]"})},`gap-${lt}`)};return t.jsxs(t.Fragment,{children:[Ze(0),Ye.map(({todo:lt,depth:Ie},Ee)=>{const ot=ge.has(lt.id),ht=Ce.has(lt.id),_t=6,Ht="top 400ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 300ms ease",sn=be?{position:"absolute",top:Ee*_t,left:0,right:0,zIndex:Ye.length+10-Ee,opacity:Ee===0?1:.9,pointerEvents:Ee===0?"auto":"none",transition:Ht}:{transition:Ht};return t.jsxs("div",{className:be?"":"animate-fade-in",style:be?sn:{animationDelay:`${Ee*30}ms`,...sn},children:[!be&&ot&&t.jsxs("div",{className:"flex items-center gap-2 mb-2 px-3 py-2 rounded-lg bg-status-merged/5 border border-status-merged/20 animate-slide-up",style:{animationDelay:`${Ee*30}ms`},children:[t.jsx(za,{size:16,className:"text-status-merged flex-shrink-0"}),t.jsx("span",{className:"text-xs font-semibold text-status-merged",children:ke("todo.chainComplete")}),t.jsx("span",{className:"text-2xs font-mono text-warm-400",children:ke("todo.chainTasks").replace("{count}",String(ge.get(lt.id)))}),t.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[tt&&Ke===null&&t.jsx("span",{className:"text-2xs text-status-error",children:tt}),t.jsxs("button",{onClick:()=>fe(lt.id),disabled:Ke===lt.id,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-status-merged/15 text-status-merged hover:bg-status-merged/25 border border-status-merged/30 transition-colors disabled:opacity-50",title:ke("todo.mergeChainDesc"),children:[t.jsx(dj,{size:14}),Ke===lt.id?"...":ke("todo.mergeChain")]})]})]}),t.jsxs("div",{className:"relative animate-fade-in",style:{animationDelay:`${Ee*30}ms`,marginLeft:Ie>0?`${Ie*24}px`:void 0},children:[Ie>0&&t.jsx("div",{className:"absolute top-0 bottom-0 w-px",style:{left:"-13px",backgroundColor:"var(--color-border)"}}),t.jsx(o6,{todo:lt,allTodos:e,projectCliTool:i,projectIsGitRepo:a,projectUseWorktree:h,onStart:c,onStop:d,onDelete:p,onEdit:u,onMerge:v,onCleanup:C,onRetry:w,onContinue:x,onFix:y,onSchedule:_,onScheduleOnReset:S,resetsAt:N,onEvent:L,isInteractive:A.has(lt.id),onSendInput:T,isDragSource:X===lt.id,isDragging:X!==null,isDragOver:P===lt.id,isValidDropTarget:le(lt.id),onDragStart:oe,onDragEnd:q,onDragOverTarget:K,onDragLeaveTarget:Q,onDropTarget:ie,onRemoveDependency:D?te:void 0,debugLogging:z,showTokenUsage:O,isChainMember:ht})]}),Ze(Ee+1)]},lt.id)})]})})()}),!be&&X&&((dt=e.find(Be=>Be.id===X))==null?void 0:dt.depends_on)&&t.jsxs("div",{className:"mt-3 border-2 border-dashed border-red-300 rounded-lg p-4 text-center text-sm text-red-400 transition-colors hover:border-red-400 hover:text-red-500 hover:bg-red-50",onDragOver:Be=>{Be.preventDefault(),Be.dataTransfer.dropEffect="move"},onDrop:Be=>{Be.preventDefault(),X&&D&&(je.current=!0,D(X,null))},children:[t.jsx(EN,{size:20,className:"mx-auto mb-1"}),ke("dnd.dropToRemoveDep")]}),U&&t.jsx(_r,{x:U.x,y:U.y,onClose:()=>W(null),children:t.jsxs("button",{onClick:()=>F(!0),className:en,children:[t.jsx(mn,{size:14}),ke("todos.add")]})})]})}const u6=[{value:1,labelKey:"cron.mon"},{value:2,labelKey:"cron.tue"},{value:3,labelKey:"cron.wed"},{value:4,labelKey:"cron.thu"},{value:5,labelKey:"cron.fri"},{value:6,labelKey:"cron.sat"},{value:0,labelKey:"cron.sun"}];function d6(e){const s={mode:"daily",everyMinutes:30,hourlyMinute:0,dailyHour:9,dailyMinute:0,weeklyDays:[1,2,3,4,5],weeklyHour:9,weeklyMinute:0,monthlyDay:1,monthlyHour:9,monthlyMinute:0};if(!e)return s;const i=e.trim().split(/\s+/);if(i.length!==5)return{...s,mode:"custom"};const[a,h,m,,f]=i,o=a.match(/^\*\/(\d+)$/);if(o&&h==="*"&&m==="*"&&f==="*")return{...s,mode:"minutes",everyMinutes:parseInt(o[1])};if(/^\d+$/.test(a)&&h==="*"&&m==="*"&&f==="*")return{...s,mode:"hourly",hourlyMinute:parseInt(a)};const c=/^\d+$/.test(a)?parseInt(a):-1,d=/^\d+$/.test(h)?parseInt(h):-1;if(c<0||d<0)return{...s,mode:"custom"};if(m==="*"&&f!=="*"){const p=f.split(",").map(u=>{const v=parseInt(u);return isNaN(v)?-1:v}).filter(u=>u>=0);if(p.length>0)return{...s,mode:"weekly",weeklyDays:p,weeklyHour:d,weeklyMinute:c}}return/^\d+$/.test(m)&&f==="*"?{...s,mode:"monthly",monthlyDay:parseInt(m),monthlyHour:d,monthlyMinute:c}:m==="*"&&f==="*"?{...s,mode:"daily",dailyHour:d,dailyMinute:c}:{...s,mode:"custom"}}function Fb(e){switch(e.mode){case"minutes":return`*/${e.everyMinutes} * * * *`;case"hourly":return`${e.hourlyMinute} * * * *`;case"daily":return`${e.dailyMinute} ${e.dailyHour} * * *`;case"weekly":return`${e.weeklyMinute} ${e.weeklyHour} * * ${e.weeklyDays.sort((s,i)=>s-i).join(",")}`;case"monthly":return`${e.monthlyMinute} ${e.monthlyHour} ${e.monthlyDay} * *`;default:return""}}function h6({value:e,onChange:s}){const{t:i}=it(),[a,h]=k.useState(()=>d6(e)),[m,f]=k.useState(e);k.useEffect(()=>{if(a.mode==="custom")s(m);else{const b=Fb(a);s(b)}},[a,m]);const o=b=>{h(C=>({...C,...b}))},c=b=>{h(C=>{const w=C.weeklyDays.includes(b)?C.weeklyDays.filter(x=>x!==b):[...C.weeklyDays,b];return{...C,weeklyDays:w.length>0?w:C.weeklyDays}})},d=[{value:"minutes",labelKey:"cron.everyMinutes"},{value:"hourly",labelKey:"cron.hourly"},{value:"daily",labelKey:"cron.daily"},{value:"weekly",labelKey:"cron.weekly"},{value:"monthly",labelKey:"cron.monthly"},{value:"custom",labelKey:"cron.custom"}],p="bg-warm-50 border border-warm-300 rounded-lg px-2 py-1.5 text-sm text-warm-800 font-mono text-center transition-all duration-200 focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20",u=(b,C,w,x)=>t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("select",{value:b,onChange:y=>w(parseInt(y.target.value)),className:`${p} w-16`,children:Array.from({length:24},(y,_)=>t.jsx("option",{value:_,children:String(_).padStart(2,"0")},_))}),t.jsx("span",{className:"text-warm-500 font-mono",children:":"}),t.jsx("select",{value:C,onChange:y=>x(parseInt(y.target.value)),className:`${p} w-16`,children:Array.from({length:12},(y,_)=>_*5).map(y=>t.jsx("option",{value:y,children:String(y).padStart(2,"0")},y))})]}),v=a.mode==="custom"?m:Fb(a);return t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"flex flex-wrap gap-1.5",children:d.map(b=>t.jsx("button",{type:"button",onClick:()=>o({mode:b.value}),className:`px-2.5 py-1 rounded-md text-xs font-medium transition-colors ${a.mode===b.value?"bg-amber-500 text-white":"bg-warm-100 text-warm-500 hover:bg-warm-200"}`,children:i(b.labelKey)},b.value))}),t.jsxs("div",{className:"bg-warm-50 rounded-lg p-3",children:[a.mode==="minutes"&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.every")}),t.jsx("select",{value:a.everyMinutes,onChange:b=>o({everyMinutes:parseInt(b.target.value)}),className:`${p} w-20`,children:[5,10,15,20,30].map(b=>t.jsx("option",{value:b,children:b},b))}),t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.minutesLabel")})]}),a.mode==="hourly"&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.everyHourAt")}),t.jsx("select",{value:a.hourlyMinute,onChange:b=>o({hourlyMinute:parseInt(b.target.value)}),className:`${p} w-16`,children:Array.from({length:12},(b,C)=>C*5).map(b=>t.jsx("option",{value:b,children:String(b).padStart(2,"0")},b))}),t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.minutesPast")})]}),a.mode==="daily"&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.everyDayAt")}),u(a.dailyHour,a.dailyMinute,b=>o({dailyHour:b}),b=>o({dailyMinute:b}))]}),a.mode==="weekly"&&t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"flex flex-wrap gap-1.5",children:u6.map(b=>t.jsx("button",{type:"button",onClick:()=>c(b.value),className:`w-9 h-9 rounded-lg text-xs font-medium transition-colors ${a.weeklyDays.includes(b.value)?"bg-amber-500 text-white":"bg-theme-card text-warm-500 border border-warm-200 hover:border-amber-300"}`,children:i(b.labelKey)},b.value))}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.at")}),u(a.weeklyHour,a.weeklyMinute,b=>o({weeklyHour:b}),b=>o({weeklyMinute:b}))]})]}),a.mode==="monthly"&&t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.everyMonthOn")}),t.jsx("select",{value:a.monthlyDay,onChange:b=>o({monthlyDay:parseInt(b.target.value)}),className:`${p} w-16`,children:Array.from({length:28},(b,C)=>C+1).map(b=>t.jsx("option",{value:b,children:b},b))}),t.jsx("span",{className:"text-sm text-warm-600",children:i("cron.dayAt")}),u(a.monthlyHour,a.monthlyMinute,b=>o({monthlyHour:b}),b=>o({monthlyMinute:b}))]}),a.mode==="custom"&&t.jsxs("div",{children:[t.jsx("input",{type:"text",placeholder:"*/30 * * * *",value:m,onChange:b=>f(b.target.value),className:"bg-warm-50 border border-warm-300 rounded-lg px-3 py-1.5 w-full text-sm text-warm-800 font-mono transition-all duration-200 focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20"}),t.jsx("p",{className:"text-2xs text-warm-400 mt-1",children:i("schedule.cronHint")})]})]}),a.mode!=="custom"&&v&&t.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[t.jsxs("span",{className:"text-warm-400",children:[i("cron.expression"),":"]}),t.jsx("code",{className:"px-2 py-0.5 rounded bg-warm-100 text-warm-600 font-mono",children:v})]})]})}function f6(){const e=new Date;e.setHours(e.getHours()+1),e.setMinutes(0,0,0);const s=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0"),h=String(e.getHours()).padStart(2,"0"),m=String(e.getMinutes()).padStart(2,"0");return`${s}-${i}-${a}T${h}:${m}`}function m6(e){const s=new Date(e),i=s.getFullYear(),a=String(s.getMonth()+1).padStart(2,"0"),h=String(s.getDate()).padStart(2,"0"),m=String(s.getHours()).padStart(2,"0"),f=String(s.getMinutes()).padStart(2,"0");return`${i}-${a}-${h}T${m}:${f}`}function d_({onSave:e,onCancel:s,initialTitle:i="",initialDescription:a="",initialCronExpression:h="",initialCliTool:m,initialSkipIfRunning:f=!0,initialScheduleType:o="recurring",initialRunAt:c,projectCliTool:d="claude"}){const[p,u]=k.useState(i),[v,b]=k.useState(a),[C,w]=k.useState(h),[x,y]=k.useState(m||d||"claude"),[_,S]=k.useState(f),[N,D]=k.useState(o),[j,R]=k.useState(c?m6(c):f6()),{t:L}=it(),T=N==="once",A=p.trim()&&(T?!!j:!!C.trim()),z=O=>{O.preventDefault(),A&&e({title:p.trim(),description:v.trim(),cronExpression:T?"":C.trim(),cliTool:x,skipIfRunning:_,scheduleType:N,runAt:T?new Date(j).toISOString():void 0})};return t.jsxs("form",{onSubmit:z,className:"card p-5 border-amber-500/30",children:[t.jsx("div",{className:"mb-3",children:t.jsx("input",{type:"text",placeholder:L("scheduleForm.titlePlaceholder"),value:p,onChange:O=>u(O.target.value),className:"input-field",autoFocus:!0})}),t.jsx("div",{className:"mb-3",children:t.jsx("textarea",{placeholder:L("scheduleForm.descPlaceholder"),value:v,onChange:O=>b(O.target.value),rows:3,className:"prompt-field min-h-[76px] max-h-[320px] resize-y [field-sizing:content]"})}),t.jsxs("div",{className:"mb-3",children:[t.jsx("label",{className:"block text-xs font-medium text-warm-500 mb-1.5",children:L("schedule.type")}),t.jsxs("div",{className:"flex gap-1.5",children:[t.jsx("button",{type:"button",onClick:()=>D("recurring"),className:`px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${N==="recurring"?"bg-amber-500 text-white":"bg-warm-100 text-warm-500 hover:bg-warm-200"}`,children:L("schedule.recurring")}),t.jsx("button",{type:"button",onClick:()=>D("once"),className:`px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${N==="once"?"bg-amber-500 text-white":"bg-warm-100 text-warm-500 hover:bg-warm-200"}`,children:L("schedule.once")})]})]}),T?t.jsxs("div",{className:"mb-3",children:[t.jsx("label",{className:"block text-xs font-medium text-warm-500 mb-1.5",children:L("schedule.runAtLabel")}),t.jsx("input",{type:"datetime-local",value:j,onChange:O=>R(O.target.value),className:"input-field text-sm font-mono",min:new Date().toISOString().slice(0,16)})]}):t.jsxs("div",{className:"mb-3",children:[t.jsx("label",{className:"block text-xs font-medium text-warm-500 mb-1.5",children:L("schedule.cronExpression")}),t.jsx(h6,{value:C,onChange:w})]}),t.jsx("div",{className:"mb-3 grid grid-cols-2 gap-3",children:t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-warm-500 mb-1.5",children:L("scheduleForm.cliTool")}),t.jsx("select",{value:x,onChange:O=>y(O.target.value),className:"input-field text-sm !py-2",children:br.map(O=>t.jsx("option",{value:O.value,children:O.label},O.value))})]})}),!T&&t.jsx("div",{className:"mb-4",children:t.jsxs("label",{className:"flex items-center gap-2 text-sm text-warm-600 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:_,onChange:O=>S(O.target.checked),className:"rounded border-warm-300 text-amber-500 focus:ring-amber-500"}),L("schedule.skipIfRunning")]})}),t.jsxs("div",{className:"flex gap-3 justify-end",children:[t.jsx("button",{type:"button",onClick:s,className:"btn-ghost text-sm",children:L("scheduleForm.cancel")}),t.jsx("button",{type:"submit",disabled:!A,className:"btn-primary text-sm",children:L("scheduleForm.save")})]})]})}function p6({schedule:e,onToggle:s,onDelete:i,onEdit:a,onTrigger:h,onMergeRun:m,onCleanupRun:f}){const[o,c]=k.useState(!1),[d,p]=k.useState(!1),[u,v]=k.useState([]),[b,C]=k.useState(!1),[w,x]=k.useState(!1),[y,_]=k.useState(null),{t:S}=it(),N=async()=>{try{const U=await rf(e.id);v(U)}catch{}},D=async U=>{if(!(!U.todo_id||!m)){_(U.id);try{await m(U.todo_id),await N()}finally{_(null)}}},j=async U=>{if(!(!U.todo_id||!f)){_(U.id);try{await f(U.todo_id),await N()}finally{_(null)}}},R=e.schedule_type==="once",L=async()=>{if(!b)try{const U=await rf(e.id);v(U),C(!0)}catch{}},T=()=>{const U=!o;c(U),U&&L()},A=async()=>{x(!0);try{await h(e.id);const U=await rf(e.id);v(U),C(!0)}finally{x(!1)}};if(d)return t.jsx(d_,{initialTitle:e.title,initialDescription:e.description??"",initialCronExpression:R?"":e.cron_expression,initialCliTool:e.cli_tool??void 0,initialSkipIfRunning:!!e.skip_if_running,initialScheduleType:e.schedule_type,initialRunAt:e.run_at??void 0,onSave:async U=>{await a(e.id,{title:U.title,description:U.description,cron_expression:U.cronExpression||void 0,cli_tool:U.cliTool,skip_if_running:U.skipIfRunning,schedule_type:U.scheduleType,run_at:U.runAt}),p(!1)},onCancel:()=>p(!1)});const z=e.is_active?"border-l-amber-500":"border-l-warm-300",O={triggered:"text-status-running",skipped:"text-status-warning",completed:"text-status-success",failed:"text-status-error"},H={triggered:S("schedule.runTriggered"),skipped:S("schedule.runSkipped"),completed:S("schedule.runCompleted"),failed:S("schedule.runFailed")},F=U=>U?new Date(U).toLocaleString():"";return t.jsxs("div",{className:`card border-l-4 ${z} overflow-hidden`,children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3.5 cursor-pointer hover:bg-warm-50 transition-colors",onClick:T,children:[t.jsx("button",{className:"text-warm-400 hover:text-amber-500 flex-shrink-0 transition-colors",children:t.jsx(Ts,{size:14,className:`transition-transform duration-200 ${o?"rotate-90":""}`})}),t.jsx("span",{className:"flex-1 text-sm text-warm-800 font-medium truncate",children:e.title}),R?t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-2xs font-mono font-medium bg-blue-500/10 text-blue-600 flex-shrink-0",children:[t.jsx(ri,{size:12}),F(e.run_at)]}):t.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-2xs font-mono font-medium bg-amber-500/10 text-amber-600 flex-shrink-0",children:e.cron_expression}),t.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-2xs font-semibold ${R?"bg-blue-500/10 text-blue-600":"bg-amber-500/10 text-amber-600"}`,children:S(R?"schedule.once":"schedule.recurring")}),t.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-2xs font-semibold ${e.is_active?"bg-status-success/10 text-status-success":"bg-warm-200 text-warm-500"}`,children:e.is_active?S("schedule.active"):S("schedule.paused")}),t.jsxs("div",{className:"flex items-center gap-0.5 ml-2",onClick:U=>U.stopPropagation(),children:[t.jsx("button",{onClick:A,disabled:w,className:"p-1.5 text-amber-500/60 hover:text-amber-500 hover:bg-amber-500/10 rounded-lg transition-colors disabled:opacity-30",title:S("schedule.trigger"),children:t.jsx(wr,{size:14})}),t.jsx("button",{onClick:()=>s(e.id,!e.is_active),className:`p-1.5 rounded-lg transition-colors ${e.is_active?"text-status-warning/60 hover:text-status-warning hover:bg-status-warning/10":"text-status-success/60 hover:text-status-success hover:bg-status-success/10"}`,title:e.is_active?S("schedule.pause"):S("schedule.activate"),children:e.is_active?t.jsx(zm,{size:14}):t.jsx(si,{size:14})}),t.jsx("button",{onClick:()=>p(!0),className:"p-1.5 text-warm-400 hover:text-accent hover:bg-accent/10 rounded-lg transition-colors",title:S("schedule.edit"),children:t.jsx(ai,{size:14})}),t.jsx("button",{onClick:()=>i(e.id),className:"p-1.5 text-warm-400 hover:text-status-error hover:bg-status-error/10 rounded-lg transition-colors",title:S("schedule.delete"),children:t.jsx(Nn,{size:14})})]})]}),o&&t.jsxs("div",{className:"border-t border-warm-200 px-5 py-5 space-y-4 animate-fade-in bg-warm-50/50",children:[e.description&&t.jsx("div",{children:t.jsx("p",{className:"text-sm text-warm-600 whitespace-pre-wrap leading-relaxed",children:e.description})}),t.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[R?t.jsxs("span",{className:"badge bg-blue-500/10 text-blue-600 font-mono",children:[S("schedule.runAtLabel"),": ",F(e.run_at)]}):t.jsx("span",{className:"badge bg-amber-500/10 text-amber-600 font-mono",children:e.cron_expression}),!R&&e.skip_if_running?t.jsx("span",{className:"badge bg-status-info/10 text-status-info",children:S("schedule.skipIfRunning")}):null,t.jsxs("span",{className:"badge bg-warm-200 text-warm-600",children:[S("schedule.lastRun"),": ",e.last_run_at?new Date(e.last_run_at).toLocaleString():S("schedule.never")]})]}),t.jsxs("div",{children:[t.jsx("h4",{className:"text-xs font-semibold text-warm-500 uppercase tracking-wider mb-2",children:S("schedule.runs")}),u.length===0?t.jsx("p",{className:"text-xs text-warm-400 italic",children:S("schedule.noRuns")}):t.jsx("div",{className:"max-h-48 overflow-auto space-y-1",children:u.map(U=>{const W=U.todo_id&&U.todo_status==="completed"&&!!U.todo_branch_name,X=U.todo_id&&U.todo_status!=="running"&&U.todo_status!=="pending"&&(U.todo_worktree_path||U.todo_branch_name),J=y===U.id;return t.jsxs("div",{className:"flex items-center gap-3 text-xs py-1.5 px-3 rounded-lg bg-theme-hover",children:[t.jsx("span",{className:`font-medium ${O[U.status]||"text-warm-500"}`,children:H[U.status]||U.status}),U.skipped_reason&&t.jsxs("span",{className:"text-warm-400",children:["(",U.skipped_reason,")"]}),t.jsxs("div",{className:"flex items-center gap-0.5 ml-auto",children:[W&&m&&t.jsx("button",{onClick:()=>D(U),disabled:J,className:"p-1 text-status-merged/60 hover:text-status-merged hover:bg-status-merged/10 rounded transition-colors disabled:opacity-30",title:S("todo.merge"),children:t.jsx(nl,{size:12})}),X&&f&&t.jsx("button",{onClick:()=>j(U),disabled:J,className:"p-1 text-status-warning/60 hover:text-status-warning hover:bg-status-warning/10 rounded transition-colors disabled:opacity-30",title:S("todo.cleanup"),children:t.jsx(Nn,{size:12})})]}),t.jsx("span",{className:"text-warm-400 font-mono flex-shrink-0",children:new Date(U.started_at).toLocaleString()})]},U.id)})})]})]})]})}function g6({schedules:e,projectCliTool:s,onAddSchedule:i,onToggleSchedule:a,onDeleteSchedule:h,onEditSchedule:m,onTriggerSchedule:f,onMergeRun:o,onCleanupRun:c}){const[d,p]=k.useState(!1),[u,v]=k.useState(null),{t:b}=it();return t.jsxs("div",{className:"min-h-[50vh]",onContextMenu:C=>{li(C)||(C.preventDefault(),v({x:C.clientX,y:C.clientY}))},children:[t.jsxs("div",{className:"flex items-center justify-between mb-5",children:[t.jsx("h2",{className:"text-sm font-semibold text-warm-600 uppercase tracking-wider",children:b("schedules.title")}),!d&&t.jsxs("button",{onClick:()=>p(!0),className:"btn-primary btn-sm",children:[t.jsx(mn,{size:14}),b("schedules.add")]})]}),d&&t.jsx("div",{className:"mb-5 animate-slide-up",children:t.jsx(d_,{projectCliTool:s,onSave:async C=>{await i(C),p(!1)},onCancel:()=>p(!1)})}),t.jsx("div",{className:"space-y-3",children:e.length===0?t.jsx("div",{className:"card",children:t.jsx(Fi,{icon:kj,title:b("schedules.empty"),description:b("schedules.emptyHint")})}):e.map((C,w)=>t.jsx("div",{className:"animate-slide-up",style:{animationDelay:`${w*30}ms`},children:t.jsx(p6,{schedule:C,onToggle:a,onDelete:h,onEdit:m,onTrigger:f,onMergeRun:o,onCleanupRun:c})},C.id))}),u&&t.jsx(_r,{x:u.x,y:u.y,onClose:()=>v(null),children:t.jsxs("button",{type:"button",className:en,onClick:()=>p(!0),children:[t.jsx(mn,{size:14}),b("schedules.add")]})})]})}function h_(e){const[s,i]=k.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return k.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const a=window.matchMedia(e),h=m=>i(m.matches);return i(a.matches),a.addEventListener("change",h),()=>a.removeEventListener("change",h)},[e]),s}const $b="__custom__";function x6({open:e,onClose:s,projectId:i,projectName:a,onPushed:h}){const{t:m}=it(),[f,o]=k.useState(!1),[c,d]=k.useState(!1),[p,u]=k.useState(null),[v,b]=k.useState([]),[C,w]=k.useState("origin"),[x,y]=k.useState([]),[_,S]=k.useState([]),[N,D]=k.useState(!0),[j,R]=k.useState(!1);k.useEffect(()=>{if(!e)return;let U=!1;return o(!0),u(null),Promise.all([JN(i),Vf(i)]).then(([W,X])=>{var ue,ae;if(U)return;const J=W.remotes||[];b(J);const P=((ue=J.find(ee=>ee.name==="origin"))==null?void 0:ue.name)||((ae=J[0])==null?void 0:ae.name)||"origin";w(P);const B=X.branches||[],I=B.filter(ee=>!ee.remote),V=`remotes/${P}/`,$=B.filter(ee=>ee.remote&&ee.name.startsWith(V)).map(ee=>ee.name.slice(V.length)).filter(ee=>ee&&ee!=="HEAD");S($);const se=new Set($);y(I.map(ee=>{const Y=se.has(ee.name);return{local:ee.name,current:ee.current,remote:ee.name,customRemote:!1,setUpstream:!Y,checked:ee.current}}))}).catch(W=>{U||u(W instanceof Error?W.message:"Failed to load remotes")}).finally(()=>{U||o(!1)}),()=>{U=!0}},[e,i]),k.useEffect(()=>{if(!e||!C)return;let U=!1;return Vf(i).then(W=>{if(U)return;const X=`remotes/${C}/`,J=(W.branches||[]).filter(P=>P.remote&&P.name.startsWith(X)).map(P=>P.name.slice(X.length)).filter(P=>P&&P!=="HEAD");S(J)}).catch(()=>{}),()=>{U=!0}},[C,i,e]);const L=x.length>0&&x.every(U=>U.checked),T=x.some(U=>U.checked),A=x.filter(U=>U.checked).length,z=k.useMemo(()=>{var U;return((U=v.find(W=>W.name===C))==null?void 0:U.url)||""},[v,C]),O=(U,W)=>{y(X=>X.map(J=>J.local===U?{...J,...W}:J))},H=()=>{const U=!L;y(W=>W.map(X=>({...X,checked:U})))},F=async()=>{u(null);const U=x.filter(X=>X.checked);if(U.length===0){u(m("git.pushDialog.errorRequireBranch"));return}const W=U.map(X=>({local:X.local,remote:(X.remote||"").trim()||X.local,setUpstream:X.setUpstream}));d(!0);try{await Pm(i,{remote:C,branches:W,pushAllTags:N,force:j}),h==null||h(),s()}catch(X){u(X instanceof Error?X.message:"Push failed")}finally{d(!1)}};return t.jsx(Fn,{open:e,onClose:c?()=>{}:s,size:"2xl",disableBackdropClose:!0,disableEscClose:c,children:t.jsxs("div",{className:"card p-5 space-y-4",children:[t.jsxs("h3",{className:"text-base font-semibold",style:{color:"var(--color-text-primary)"},children:["Push : ",a]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 whitespace-nowrap",children:m("git.pushDialog.targetRemote")}),t.jsxs("select",{value:C,onChange:U=>w(U.target.value),className:"input-field text-xs py-1.5 px-3 w-auto",disabled:f||c||v.length===0,children:[v.length===0&&t.jsx("option",{value:"origin",children:"origin"}),v.map(U=>t.jsx("option",{value:U.name,children:U.name},U.name))]}),t.jsx("input",{readOnly:!0,value:z,className:"input-field text-xs font-mono py-1.5 px-3 flex-1 cursor-default"})]}),t.jsxs("div",{children:[t.jsx("div",{className:"section-label mb-2",children:m("git.pushDialog.branchesHeader")}),t.jsx("div",{className:"rounded-xl border border-theme-border-strong overflow-hidden",children:t.jsx("div",{className:"overflow-auto max-h-[50vh]",children:t.jsxs("table",{className:"w-full text-sm border-collapse",children:[t.jsx("thead",{className:"sticky top-0 bg-warm-100 z-10",children:t.jsxs("tr",{children:[t.jsx("th",{className:"text-left text-2xs font-semibold uppercase tracking-wider text-warm-500 py-2 px-3 w-12",children:m("git.pushDialog.colPush")}),t.jsx("th",{className:"text-left text-2xs font-semibold uppercase tracking-wider text-warm-500 py-2 px-3",children:m("git.pushDialog.colLocal")}),t.jsx("th",{className:"text-left text-2xs font-semibold uppercase tracking-wider text-warm-500 py-2 px-3",children:m("git.pushDialog.colRemote")}),t.jsx("th",{className:"text-left text-2xs font-semibold uppercase tracking-wider text-warm-500 py-2 px-3 w-16",children:m("git.pushDialog.colTracking")})]})}),t.jsxs("tbody",{children:[f&&t.jsx("tr",{children:t.jsx("td",{colSpan:4,className:"py-6 text-center text-xs text-warm-500",children:m("git.pushDialog.loading")})}),!f&&x.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:4,className:"py-6 text-center text-xs text-warm-500",children:m("git.pushDialog.noLocalBranches")})}),x.map(U=>t.jsxs("tr",{className:"border-t border-theme-border/50 hover:bg-theme-hover/40 transition-colors",children:[t.jsx("td",{className:"py-2 px-3",children:t.jsx("input",{type:"checkbox",checked:U.checked,onChange:W=>O(U.local,{checked:W.target.checked}),disabled:c,className:"cursor-pointer"})}),t.jsxs("td",{className:"py-2 px-3 font-mono text-xs",style:{color:"var(--color-text-primary)"},children:[U.local,U.current&&t.jsx("span",{className:"ml-1.5 text-[10px] text-status-warning",children:"●"})]}),t.jsx("td",{className:"py-2 px-3",children:U.customRemote?t.jsx("input",{type:"text",value:U.remote,onChange:W=>O(U.local,{remote:W.target.value}),placeholder:U.local,className:"input-field text-xs font-mono py-1 px-2 w-full",disabled:c}):t.jsxs("select",{value:_.includes(U.remote)||U.remote?U.remote:"",onChange:W=>{const X=W.target.value;X===$b?O(U.local,{customRemote:!0}):O(U.local,{remote:X})},className:"input-field text-xs font-mono py-1 px-2 w-full",disabled:c,children:[!_.includes(U.remote)&&U.remote&&t.jsxs("option",{value:U.remote,children:[U.remote," (",m("git.pushDialog.newBranch"),")"]}),_.map(W=>t.jsx("option",{value:W,children:W},W)),t.jsx("option",{value:$b,children:m("git.pushDialog.customRemote")})]})}),t.jsx("td",{className:"py-2 px-3",children:t.jsx("input",{type:"checkbox",checked:U.setUpstream,onChange:W=>O(U.local,{setUpstream:W.target.checked}),disabled:c,className:"cursor-pointer"})})]},U.local))]})]})})})]}),t.jsxs("div",{className:"flex items-center gap-5 text-xs text-warm-700",children:[t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:L,ref:U=>{U&&(U.indeterminate=!L&&T)},onChange:H,disabled:c||x.length===0,className:"cursor-pointer"}),m("git.pushDialog.selectAll")]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:N,onChange:U=>D(U.target.checked),disabled:c,className:"cursor-pointer"}),m("git.pushDialog.allTags")]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:j,onChange:U=>R(U.target.checked),disabled:c,className:"cursor-pointer"}),t.jsx("span",{title:m("git.pushDialog.forceHint"),children:m("git.pushDialog.force")})]})]}),p&&t.jsx("div",{className:"text-xs text-status-error font-medium",children:p}),t.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[t.jsx("button",{type:"button",onClick:s,disabled:c,className:"btn-secondary btn-md",children:m("git.pushDialog.cancel")}),t.jsx("button",{type:"button",onClick:F,disabled:c||f||A===0,className:"btn-primary btn-md",children:m(c?"git.pushDialog.pushing":"git.pushDialog.submit")})]})]})})}function v6(e){switch(e){case"A":return{label:"A",color:"text-status-success"};case"D":return{label:"D",color:"text-status-error"};case"R":return{label:"R",color:"text-purple-500"};case"C":return{label:"C",color:"text-blue-500"};default:return{label:"M",color:"text-accent"}}}function dp({files:e,loading:s,selectedFile:i,onFileClick:a,commitHash:h}){const{t:m}=it();return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"px-3 py-2 border-b border-warm-100 flex items-center justify-between shrink-0",children:[t.jsx("span",{className:"text-[11px] font-semibold text-warm-500 uppercase tracking-wider",children:m("git.changedFiles")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"text-2xs text-warm-400",children:[e.length," ",m("git.files")]}),h&&t.jsx("span",{className:"text-2xs font-mono text-warm-400",children:h.substring(0,7)})]})]}),s?t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("span",{className:"text-xs text-warm-400",children:m("git.loadingFiles")})}):e.length===0?t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("span",{className:"text-xs text-warm-400",children:m("git.noFilesChanged")})}):t.jsx("div",{className:"flex-1 overflow-y-auto",children:e.map(f=>{const o=v6(f.status),c=i===f.path;return t.jsxs("div",{onClick:()=>a(f.path),className:`flex items-center gap-2 px-3 py-1.5 cursor-pointer text-xs hover:bg-warm-50/50 transition-colors ${c?"bg-accent/10 border-l-2 border-accent":""}`,children:[t.jsx("span",{className:`font-mono font-bold text-2xs w-3 shrink-0 ${o.color}`,children:o.label}),t.jsxs("span",{className:"truncate flex-1 text-warm-600",title:f.path,children:[f.path.split("/").pop(),t.jsx("span",{className:"text-warm-400 ml-1 text-2xs",children:f.path.includes("/")?f.path.substring(0,f.path.lastIndexOf("/")):""})]}),t.jsxs("span",{className:"shrink-0 text-2xs text-status-success",children:["+",f.additions]}),t.jsxs("span",{className:"shrink-0 text-2xs text-status-error",children:["-",f.deletions]})]},f.path)})})]})}function Bu({diff:e,loading:s,selectedFile:i}){const{t:a}=it();return i?s?t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsx("span",{className:"text-xs text-warm-400",children:a("git.loadingDiff")})}):t.jsxs("div",{className:"h-full flex flex-col bg-[#1A1A1A]",children:[t.jsx("div",{className:"px-3 py-2 border-b border-gray-700 shrink-0",children:t.jsx("span",{className:"text-xs font-mono text-gray-100",children:i})}),t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx("pre",{className:"p-3 font-mono text-xs leading-relaxed",children:e?e.split(`
|
|
635
635
|
`).map((h,m)=>{let f="text-gray-200";return h.startsWith("+")&&!h.startsWith("+++")?f="text-gray-100 bg-green-500/20":h.startsWith("-")&&!h.startsWith("---")?f="text-gray-100 bg-red-500/20":h.startsWith("@@")?f="text-blue-400":h.startsWith("diff ")&&(f="text-amber-300 font-bold"),t.jsx("div",{className:f,children:h||" "},m)}):t.jsx("span",{className:"text-gray-400 italic",children:"No changes"})})})]}):t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsx("span",{className:"text-sm text-warm-400",children:a("git.selectFileToViewDiff")})})}const Ca=["#D4A843","#2196F3","#4CAF50","#E53935","#9C27B0","#FF9800","#00BCD4","#795548"];function b6(e){const s=new Map;e.forEach((h,m)=>s.set(h.hash,m));const i=[],a=[];for(let h=0;h<e.length;h++){const m=e[h];let f=i.indexOf(m.hash);f===-1&&(f=i.indexOf(null),f===-1&&(f=i.length,i.push(null))),i[f]=null;const o=Ca[f%Ca.length],c=[];for(let d=0;d<m.parentHashes.length;d++){const p=m.parentHashes[d],u=s.get(p);if(u===void 0)continue;let v=i.indexOf(p);if(v!==-1)c.push({fromLane:f,toLane:v,toRow:u,color:Ca[v%Ca.length]});else if(d===0)i[f]=p,c.push({fromLane:f,toLane:f,toRow:u,color:o});else{let b=i.indexOf(null);b===-1&&(b=i.length,i.push(null)),i[b]=p,c.push({fromLane:f,toLane:b,toRow:u,color:Ca[b%Ca.length]})}}a.push({lane:f,color:o,connections:c})}return a}function y6({refStr:e}){const s=e.startsWith("HEAD"),i=e.startsWith("origin/")||e.includes("remotes/"),a=e.startsWith("tag: ");let h=e,m="";return a?(h=e.replace("tag: ",""),m="bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-300"):s?(h=e.replace("HEAD -> ",""),m="bg-status-success/15 text-status-success font-semibold"):i?m="bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":m="bg-accent/15 text-accent",t.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded text-2xs font-medium whitespace-nowrap ${m}`,children:h})}const ni=32,Li=16,w6=4,_6=10;function S6({graphNodes:e,totalRows:s}){const a=(Math.min(_6,e.reduce((h,m)=>{const f=m.connections.reduce((o,c)=>Math.max(o,c.fromLane,c.toLane),0);return Math.max(h,m.lane,f)},0)+1)+1)*Li+8;return t.jsxs("svg",{width:a,height:s*ni,className:"shrink-0",style:{minWidth:a},children:[e.map((h,m)=>h.connections.map((f,o)=>{const c=f.fromLane*Li+Li/2+4,d=m*ni+ni/2,p=f.toLane*Li+Li/2+4,u=f.toRow*ni+ni/2;if(c===p)return t.jsx("line",{x1:c,y1:d,x2:p,y2:u,stroke:f.color,strokeWidth:2,strokeOpacity:.7},`${m}-${o}`);{const v=(d+u)/2;return t.jsx("path",{d:`M${c},${d} C${c},${v} ${p},${v} ${p},${u}`,fill:"none",stroke:f.color,strokeWidth:2,strokeOpacity:.7},`${m}-${o}`)}})),e.map((h,m)=>{const f=h.lane*Li+Li/2+4,o=m*ni+ni/2;return t.jsx("circle",{cx:f,cy:o,r:w6,fill:h.color,stroke:"white",strokeWidth:1.5},`dot-${m}`)})]})}function k6({projectId:e,projectName:s,onRefresh:i,busy:a,setBusy:h,branches:m,statusFiles:f}){const{t:o}=it(),[c,d]=k.useState(null),[p,u]=k.useState(""),[v,b]=k.useState(""),[C,w]=k.useState(null),x=()=>{d(null),u(""),b(""),w(null)},y=async A=>{h(!0),w(null);try{await A(),x(),i()}catch(z){w(z instanceof Error?z.message:"Error")}finally{h(!1)}},_=f.some(A=>A.index!==" "&&A.index!=="?"),S=({label:A,onClick:z,icon:O,badge:H})=>t.jsxs("button",{onClick:z,disabled:a,className:"flex flex-col items-center gap-0.5 px-2.5 py-1.5 rounded hover:bg-warm-50 transition-colors disabled:opacity-50 relative",title:A,children:[t.jsx("div",{className:"h-5 w-5 flex items-center justify-center text-warm-500",children:O}),t.jsx("span",{className:"text-2xs text-warm-600 whitespace-nowrap",children:A}),H!==void 0&&H>0&&t.jsx("span",{className:"absolute -top-0.5 -right-0.5 bg-accent text-white text-[9px] font-bold rounded-full h-3.5 min-w-[14px] flex items-center justify-center px-0.5",children:H})]}),N=({title:A,children:z})=>t.jsx(Fn,{open:!0,onClose:x,size:"sm",children:t.jsxs("div",{className:"bg-theme-card rounded-lg shadow-xl w-80 max-w-[90vw]",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-warm-100",children:[t.jsx("span",{className:"text-sm font-semibold text-warm-700",children:A}),t.jsx("button",{onClick:x,className:"text-warm-400 hover:text-warm-600",children:t.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),t.jsxs("div",{className:"p-4 space-y-3",children:[C&&t.jsx("p",{className:"text-status-error text-xs",children:C}),z]})]})}),D=m.filter(A=>!A.remote),j=m.find(A=>!A.remote&&A.current),R=f.length,L=(j==null?void 0:j.behind)??0,T=(j==null?void 0:j.ahead)??0;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-warm-100 overflow-x-auto",children:[t.jsx(S,{label:o("git.commit"),onClick:()=>d("commit"),icon:t.jsx("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,className:"h-5 w-5",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),badge:R}),t.jsx(S,{label:o("git.pull"),onClick:()=>y(()=>Ew(e)),icon:t.jsx("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,className:"h-5 w-5",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),badge:L}),t.jsx(S,{label:o("git.push"),onClick:()=>d("push"),icon:t.jsx("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,className:"h-5 w-5",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})}),badge:T}),t.jsx(S,{label:o("git.fetch"),onClick:()=>y(()=>Tw(e)),icon:t.jsx("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,className:"h-5 w-5",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 7.5h-.75A2.25 2.25 0 004.5 9.75v7.5a2.25 2.25 0 002.25 2.25h7.5a2.25 2.25 0 002.25-2.25v-7.5a2.25 2.25 0 00-2.25-2.25h-.75m-6 3.75l3 3m0 0l3-3m-3 3V1.5"})})}),t.jsx("div",{className:"w-px h-8 bg-warm-200 mx-1"}),t.jsx(S,{label:o("git.branch"),onClick:()=>d("branch"),icon:t.jsx("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,className:"h-5 w-5",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 3v12m0 0a3 3 0 103 3H15a3 3 0 100-3m-9 0h9m-9 0a3 3 0 01-3-3V6a3 3 0 013-3h0"})})}),t.jsx(S,{label:o("git.merge"),onClick:()=>d("merge"),icon:t.jsx("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,className:"h-5 w-5",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"})})}),t.jsx(S,{label:o("git.stash"),onClick:()=>d("stash"),icon:t.jsx("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,className:"h-5 w-5",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z"})})}),t.jsx(S,{label:o("git.discard"),onClick:()=>{f.length!==0&&confirm(o("git.confirmDiscard"))&&y(()=>nE(e,void 0,!0))},icon:t.jsx("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,className:"h-5 w-5",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182"})})}),t.jsx(S,{label:o("git.tag"),onClick:()=>d("tag"),icon:t.jsxs("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,className:"h-5 w-5",children:[t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.568 3H5.25A2.25 2.25 0 003 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 005.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 009.568 3z"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6h.008v.008H6V6z"})]})})]}),t.jsx(x6,{open:c==="push",onClose:x,projectId:e,projectName:s,onPushed:i}),c==="commit"&&t.jsxs(N,{title:o("git.commit"),children:[t.jsx("textarea",{className:"w-full border border-warm-200 rounded px-3 py-2 text-sm resize-none focus:outline-none focus:ring-1 focus:ring-accent",rows:3,placeholder:o("git.commitMessage"),value:p,onChange:A=>u(A.target.value),autoFocus:!0}),t.jsxs("button",{className:"w-full btn-primary text-sm py-2",disabled:a||!p.trim()||!_,onClick:()=>y(()=>Nw(e,p.trim())),children:[o("git.commit")," ",!_&&t.jsxs("span",{className:"text-xs opacity-70 ml-1",children:["(",o("git.staged"),": 0)"]})]})]}),c==="branch"&&t.jsxs(N,{title:o("git.newBranch"),children:[t.jsx("input",{className:"w-full border border-warm-200 rounded px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-accent",placeholder:o("git.branchName"),value:p,onChange:A=>u(A.target.value),autoFocus:!0}),t.jsx("div",{className:"flex gap-2",children:t.jsx("button",{className:"flex-1 btn-primary text-sm py-2",disabled:a||!p.trim(),onClick:()=>y(()=>QN(e,p.trim())),children:o("git.create")})}),D.length>0&&t.jsxs("div",{className:"border-t border-warm-100 pt-2 mt-1",children:[t.jsx("p",{className:"text-2xs text-warm-400 uppercase tracking-wider mb-1",children:o("git.selectBranch")}),t.jsx("div",{className:"max-h-32 overflow-y-auto space-y-px",children:D.filter(A=>!A.current).map(A=>t.jsxs("div",{className:"flex items-center justify-between px-2 py-1 text-xs hover:bg-warm-50 rounded group",children:[t.jsx("button",{className:"truncate text-warm-600 hover:text-accent",onClick:()=>y(()=>Xf(e,A.name)),children:A.name}),t.jsx("button",{className:"text-warm-300 hover:text-status-error opacity-0 group-hover:opacity-100 transition-opacity text-2xs",onClick:()=>{confirm(`Delete branch ${A.name}?`)&&y(()=>Yf(e,A.name))},children:o("git.delete")})]},A.name))})]})]}),c==="merge"&&t.jsxs(N,{title:o("git.merge"),children:[t.jsx("p",{className:"text-xs text-warm-500",children:o("git.selectBranch")}),t.jsx("div",{className:"max-h-48 overflow-y-auto space-y-px",children:D.filter(A=>!A.current).map(A=>t.jsx("button",{className:"w-full text-left px-3 py-2 text-sm hover:bg-warm-50 rounded text-warm-600 truncate",disabled:a,onClick:()=>y(()=>Lw(e,A.name)),children:A.name},A.name))})]}),c==="stash"&&t.jsx(C6,{projectId:e,busy:a,exec:y,inputValue:p,setInputValue:u}),c==="tag"&&t.jsxs(N,{title:o("git.tag"),children:[t.jsx("input",{className:"w-full border border-warm-200 rounded px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-accent",placeholder:o("git.tagName"),value:p,onChange:A=>u(A.target.value),autoFocus:!0}),t.jsx("input",{className:"w-full border border-warm-200 rounded px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-accent",placeholder:o("git.tagMessage"),value:v,onChange:A=>b(A.target.value)}),t.jsx("button",{className:"w-full btn-primary text-sm py-2",disabled:a||!p.trim(),onClick:()=>y(()=>sE(e,p.trim(),v.trim()||void 0)),children:o("git.create")})]})]})}function C6({projectId:e,busy:s,exec:i,inputValue:a,setInputValue:h}){const{t:m}=it(),[f,o]=k.useState([]);return k.useEffect(()=>{tE(e).then(o).catch(()=>{})},[e]),t.jsx(Fn,{open:!0,onClose:()=>h(""),size:"sm",children:t.jsxs("div",{className:"bg-theme-card rounded-lg shadow-xl w-80 max-w-[90vw]",children:[t.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-warm-100",children:t.jsx("span",{className:"text-sm font-semibold text-warm-700",children:m("git.stash")})}),t.jsxs("div",{className:"p-4 space-y-3",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{className:"flex-1 border border-warm-200 rounded px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-accent",placeholder:m("git.stashMessage"),value:a,onChange:c=>h(c.target.value),autoFocus:!0}),t.jsx("button",{className:"btn-primary text-sm px-3 py-2",disabled:s,onClick:()=>i(()=>ZN(e,a.trim()||void 0)),children:m("git.stash")})]}),f.length>0?t.jsx("div",{className:"space-y-px max-h-40 overflow-y-auto",children:f.map(c=>t.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 text-xs hover:bg-warm-50 rounded",children:[t.jsx("span",{className:"text-warm-600 truncate flex-1",children:c.message||`stash@{${c.index}}`}),t.jsx("button",{className:"text-accent hover:underline text-[11px] ml-2 shrink-0",disabled:s,onClick:()=>i(()=>eE(e,c.index)),children:m("git.stashPop")})]},c.index))}):t.jsx("p",{className:"text-xs text-warm-400 text-center",children:m("git.noStashes")})]})]})})}function Ub(e,s){if(e==="?"&&s==="?")return{label:"U",color:"text-warm-400",type:"untracked"};const a=e!==" "&&e!=="?",h=a?e:s;let m="text-accent",f=h;return h==="A"?m="text-status-success":h==="D"?m="text-status-error":h==="R"?m="text-purple-500":h==="C"?m="text-blue-500":(m="text-accent",f="M"),{label:f,color:m,type:a?"staged":"unstaged"}}function Wb({file:e,pane:s,selected:i,checked:a,onClick:h,onToggleCheck:m}){const f=s==="staged"?Ub(e.index," "):Ub(" ",e.working_dir==="?"?"?":e.working_dir),o=s==="unstaged"&&e.index==="?"&&e.working_dir==="?"?{label:"U",color:"text-warm-400"}:f;return t.jsxs("div",{onClick:h,className:`flex items-center gap-2 px-3 py-1 cursor-pointer text-xs select-none transition-colors ${i?"bg-accent/15 text-accent":"hover:bg-warm-50 text-warm-700"}`,children:[t.jsx("input",{type:"checkbox",checked:a,onChange:m,onClick:c=>c.stopPropagation(),className:"h-3 w-3 shrink-0 cursor-pointer","aria-label":e.path}),t.jsx("span",{className:`shrink-0 w-4 h-4 flex items-center justify-center rounded text-[10px] font-mono font-bold ${s==="staged"?"bg-status-success/15":"bg-warm-200"} ${o.color}`,children:s==="staged"||o.label==="U"?"+":"−"}),t.jsx("span",{className:"truncate flex-1",title:e.path,children:e.path})]})}function j6({diff:e,loading:s,file:i}){const{t:a}=it();if(!i)return t.jsx("div",{className:"h-full flex items-center justify-center bg-[#1A1A1A] text-gray-400",children:t.jsx("span",{className:"text-sm",children:a("git.selectFileForDiff")})});if(s)return t.jsx("div",{className:"h-full flex items-center justify-center bg-[#1A1A1A] text-gray-400",children:t.jsx("span",{className:"text-xs",children:a("git.loadingDiff")})});const h=i.index==="?"&&i.working_dir==="?";return t.jsxs("div",{className:"h-full flex flex-col bg-[#1A1A1A]",children:[t.jsxs("div",{className:"px-3 py-2 border-b border-gray-700 shrink-0 flex items-center gap-2",children:[t.jsx("span",{className:"text-xs font-mono text-gray-100 truncate",title:i.path,children:i.path}),h&&t.jsx("span",{className:"text-2xs text-gray-400 italic",children:a("git.untrackedNewFile")})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:e?t.jsx("pre",{className:"p-3 font-mono text-xs leading-relaxed",children:e.split(`
|
|
636
636
|
`).map((m,f)=>{let o="text-gray-200";return m.startsWith("+")&&!m.startsWith("+++")?o="text-gray-100 bg-green-500/20":m.startsWith("-")&&!m.startsWith("---")?o="text-gray-100 bg-red-500/20":m.startsWith("@@")?o="text-blue-400":m.startsWith("diff ")&&(o="text-amber-300 font-bold"),t.jsx("div",{className:o,children:m||" "},f)})}):t.jsx("div",{className:"p-6 text-center text-xs text-gray-400 italic",children:a(h?"git.untrackedNewFile":"git.noFilesChanged")})})]})}function N6({projectId:e,branchName:s,files:i,busy:a,setBusy:h,onRefresh:m,onError:f,isMobile:o=!1}){const{t:c}=it(),d=k.useMemo(()=>i.filter(I=>I.index!==" "&&I.index!=="?"),[i]),p=k.useMemo(()=>i.filter(I=>I.working_dir!==" "&&I.working_dir!=="?"||I.index==="?"&&I.working_dir==="?").filter(I=>!(I.index!==" "&&I.index!=="?"&&I.working_dir===" ")),[i]),[u,v]=k.useState(null),[b,C]=k.useState(()=>new Set),[w,x]=k.useState(()=>new Set),[y,_]=k.useState(""),[S,N]=k.useState(!1),[D,j]=k.useState(""),[R,L]=k.useState(!1),[T,A]=k.useState(!1);k.useEffect(()=>{C(I=>{const V=new Set(d.map(ue=>ue.path));let $=!1;const se=new Set;return I.forEach(ue=>{V.has(ue)?se.add(ue):$=!0}),$?se:I})},[d]),k.useEffect(()=>{x(I=>{const V=new Set(p.map(ue=>ue.path));let $=!1;const se=new Set;return I.forEach(ue=>{V.has(ue)?se.add(ue):$=!0}),$?se:I})},[p]);const z=k.useCallback(I=>{C(V=>{const $=new Set(V);return $.has(I)?$.delete(I):$.add(I),$})},[]),O=k.useCallback(I=>{x(V=>{const $=new Set(V);return $.has(I)?$.delete(I):$.add(I),$})},[]),H=k.useRef(null),[F,U]=k.useState(()=>{if(typeof window>"u")return .55;const I=window.localStorage.getItem("clitrigger:git:working-pct"),V=I?parseFloat(I):NaN;return isNaN(V)?.55:Math.max(.3,Math.min(.8,V))});k.useEffect(()=>{localStorage.setItem("clitrigger:git:working-pct",String(F))},[F]);const W=k.useCallback(I=>{if(!H.current)return;const V=H.current.getBoundingClientRect(),$=(I-V.left)/V.width;U(Math.max(.3,Math.min(.8,$)))},[]),X=k.useMemo(()=>{if(!u)return null;const[I,V]=u.split("::");return I==="staged"?d.find($=>$.path===V)||null:p.find($=>$.path===V)||null},[u,d,p]),J=u?u.split("::")[0]:null;k.useEffect(()=>{u||(d.length>0?v(`staged::${d[0].path}`):p.length>0&&v(`unstaged::${p[0].path}`))},[u,d,p]),k.useEffect(()=>{if(!u)return;const[I,V]=u.split("::");(I==="staged"?d:p).some(se=>se.path===V)||v(null)},[u,d,p]),k.useEffect(()=>{if(!X||!J){_("");return}let I=!1;return N(!0),iE(e,X.path,J==="staged").then(V=>{I||_(V.diff)}).catch(()=>{I||_("")}).finally(()=>{I||N(!1)}),()=>{I=!0}},[e,X,J]);const P=async I=>{h(!0),f(null);try{await I(),m()}catch(V){f(V instanceof Error?V.message:"Operation failed")}finally{h(!1)}},B=async()=>{if(!(!D.trim()||d.length===0)){A(!0),h(!0),f(null);try{if(await Nw(e,D.trim()),R)try{await Pm(e)}catch(I){f(I instanceof Error?`Commit OK, push failed: ${I.message}`:"Push failed")}j(""),m()}catch(I){f(I instanceof Error?I.message:"Commit failed")}finally{A(!1),h(!1)}}};return i.length===0?t.jsx("div",{className:"h-full flex items-center justify-center bg-theme-bg",children:t.jsx("span",{className:"text-sm text-warm-400",children:c("git.workingTreeClean")})}):t.jsxs("div",{ref:H,className:`h-full flex min-h-0 ${o?"flex-col":""}`,children:[t.jsxs("div",{style:o?void 0:{width:`${F*100}%`,minWidth:360},className:`shrink-0 flex flex-col min-h-0 ${o?"h-1/2":""}`,children:[t.jsxs("div",{className:"flex flex-col min-h-0",style:{flex:"1 1 0"},children:[t.jsxs("div",{className:"px-3 py-2 border-b border-warm-200 flex items-center justify-between shrink-0 bg-warm-50",children:[t.jsxs("span",{className:"text-xs font-semibold text-warm-700",children:[c("git.stagedFiles")," ",t.jsxs("span",{className:"text-warm-400 font-normal",children:["(",d.length,")"]})]}),t.jsx("button",{className:"text-2xs text-warm-500 hover:text-warm-700 disabled:opacity-40",disabled:a||d.length===0,onClick:()=>{const I=b.size>0?d.filter(V=>b.has(V.path)).map(V=>V.path):d.map(V=>V.path);I.length!==0&&P(()=>XN(e,I))},children:b.size>0?`${c("git.unstageSelectedShort")} (${b.size})`:c("git.unstageAllShort")})]}),t.jsx("div",{className:"flex-1 overflow-y-auto",children:d.length===0?t.jsx("div",{className:"p-3 text-2xs text-warm-400 italic",children:"—"}):d.map(I=>t.jsx(Wb,{file:I,pane:"staged",selected:u===`staged::${I.path}`,checked:b.has(I.path),onClick:()=>v(`staged::${I.path}`),onToggleCheck:()=>z(I.path)},`s-${I.path}`))})]}),t.jsxs("div",{className:"flex flex-col min-h-0 border-t border-warm-200",style:{flex:"1 1 0"},children:[t.jsxs("div",{className:"px-3 py-2 border-b border-warm-200 flex items-center justify-between shrink-0 bg-warm-50",children:[t.jsxs("span",{className:"text-xs font-semibold text-warm-700",children:[c("git.unstagedFiles")," ",t.jsxs("span",{className:"text-warm-400 font-normal",children:["(",p.length,")"]})]}),t.jsx("button",{className:"text-2xs text-warm-500 hover:text-warm-700 disabled:opacity-40",disabled:a||p.length===0,onClick:()=>{const I=w.size>0?p.filter(V=>w.has(V.path)).map(V=>V.path):p.map(V=>V.path);I.length!==0&&P(()=>YN(e,I))},children:w.size>0?`${c("git.stageSelectedShort")} (${w.size})`:c("git.stageAllShort")})]}),t.jsx("div",{className:"flex-1 overflow-y-auto",children:p.length===0?t.jsx("div",{className:"p-3 text-2xs text-warm-400 italic",children:"—"}):p.map(I=>t.jsx(Wb,{file:I,pane:"unstaged",selected:u===`unstaged::${I.path}`,checked:w.has(I.path),onClick:()=>v(`unstaged::${I.path}`),onToggleCheck:()=>O(I.path)},`u-${I.path}`))})]}),t.jsxs("div",{className:"border-t border-warm-200 shrink-0 bg-theme-bg",children:[t.jsx("div",{className:"p-2",children:t.jsx("textarea",{className:"w-full px-3 py-2 text-sm rounded-md border resize-none focus:outline-none focus:ring-1 focus:ring-accent placeholder:text-warm-400",style:{backgroundColor:"var(--color-bg-card)",borderColor:"var(--color-border)",color:"var(--color-text-primary)"},rows:3,placeholder:c("git.commitMessage"),value:D,onChange:I=>j(I.target.value),onKeyDown:I=>{(I.metaKey||I.ctrlKey)&&I.key==="Enter"&&B()},disabled:T})}),t.jsxs("div",{className:"px-3 py-2 border-t border-warm-200 flex items-center gap-3",children:[t.jsxs("label",{className:"flex items-center gap-1.5 text-2xs text-warm-600 cursor-pointer select-none",children:[t.jsx("input",{type:"checkbox",checked:R,onChange:I=>L(I.target.checked),className:"h-3 w-3",disabled:T}),c("git.pushImmediately").replace("{remote}",`origin/${s||"main"}`)]}),t.jsx("button",{className:"ml-auto btn-primary text-xs px-3 py-1.5 disabled:opacity-50",onClick:B,disabled:T||a||!D.trim()||d.length===0,children:T?"...":c("git.commitButton")})]})]})]}),!o&&t.jsx(nu,{axis:"x",onResize:W}),t.jsx("div",{className:`flex-1 ${o?"min-h-0 border-t border-warm-200":"min-w-0"}`,children:t.jsx(j6,{diff:y,loading:S,file:X})})]})}function E6({branches:e,tags:s,stashCount:i,projectId:a,busy:h,setBusy:m,onRefresh:f,onError:o}){const{t:c}=it(),[d,p]=k.useState(new Set(["local","remote"])),[u,v]=k.useState(null),[b,C]=k.useState(null),[w,x]=k.useState(""),y=k.useRef(null),[_,S]=k.useState([]),[N,D]=k.useState(null);k.useEffect(()=>{Lv(a).then(F=>S(F.worktrees)).catch(()=>{})},[a]);const j=k.useCallback(()=>{Lv(a).then(F=>S(F.worktrees)).catch(()=>{})},[a]);k.useEffect(()=>{j()},[e,j]),k.useEffect(()=>{if(!u)return;const F=W=>{y.current&&!y.current.contains(W.target)&&v(null)},U=()=>v(null);return document.addEventListener("mousedown",F),document.addEventListener("scroll",U,!0),()=>{document.removeEventListener("mousedown",F),document.removeEventListener("scroll",U,!0)}},[u]),k.useEffect(()=>{if(!u||!y.current)return;const F=y.current.getBoundingClientRect();let{x:U,y:W}=u;U+F.width>window.innerWidth&&(U=window.innerWidth-F.width-8),W+F.height>window.innerHeight&&(W=window.innerHeight-F.height-8),(U!==u.x||W!==u.y)&&v({...u,x:U,y:W})},[u]);const R=async(F,U)=>{m(!0),o(null),v(null);try{await F(),f(),U&&U()}catch(W){o(W instanceof Error?W.message:"Error")}finally{m(!1)}},L=(F,U,W,X)=>{F.preventDefault(),F.stopPropagation(),v({branch:U,isRemote:W,isCurrent:X,x:F.clientX,y:F.clientY})},T=F=>{p(U=>{const W=new Set(U);return W.has(F)?W.delete(F):W.add(F),W})},A=e.filter(F=>!F.remote),z=e.filter(F=>F.remote),O=({id:F,label:U,count:W})=>t.jsxs("button",{onClick:()=>T(F),className:"w-full flex items-center gap-1.5 py-1.5 text-[11px] font-semibold text-warm-500 uppercase tracking-wider hover:text-warm-700 transition-colors",children:[t.jsx("svg",{className:`h-3 w-3 transition-transform ${d.has(F)?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),U,t.jsx("span",{className:"text-warm-400 font-normal ml-auto",children:W})]}),H=({label:F,onClick:U,danger:W})=>t.jsx("button",{className:`w-full text-left px-3 py-1.5 hover:bg-theme-hover transition-colors ${W?"text-status-error":"text-theme-text"}`,disabled:h,onClick:U,children:F});return t.jsxs("div",{className:"space-y-1",children:[t.jsx(O,{id:"local",label:c("git.branches"),count:A.length}),d.has("local")&&t.jsx("div",{className:"pl-1 space-y-px",children:A.map(F=>t.jsxs("div",{className:`flex items-center gap-1.5 px-2 py-1 rounded text-xs truncate cursor-context-menu select-none ${F.current?"text-accent font-semibold bg-accent/10":"text-warm-600 hover:bg-warm-50"}`,onContextMenu:U=>L(U,F.name,!1,!!F.current),children:[F.current&&t.jsx("svg",{className:"h-3 w-3 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),t.jsx("span",{className:"truncate",children:F.name}),(!!F.ahead||!!F.behind)&&t.jsxs("span",{className:"ml-auto shrink-0 flex items-center gap-1 px-1.5 rounded-full border border-warm-300 dark:border-warm-600 text-[10px] font-semibold leading-tight",children:[!!F.ahead&&t.jsxs("span",{className:"text-emerald-500",title:`${F.ahead} ${c("git.ahead")}`,children:[F.ahead,"↑"]}),!!F.behind&&t.jsxs("span",{className:"text-amber-500",title:`${F.behind} ${c("git.behind")}`,children:[F.behind,"↓"]})]})]},F.name))}),z.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(O,{id:"remote",label:c("git.remotes"),count:z.length}),d.has("remote")&&t.jsx("div",{className:"pl-1 space-y-px",children:z.map(F=>t.jsx("div",{className:"px-2 py-1 text-xs text-warm-500 truncate hover:bg-warm-50 rounded cursor-context-menu select-none",onContextMenu:U=>L(U,F.name,!0,!1),children:F.name.replace("remotes/","")},F.name))})]}),s.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(O,{id:"tags",label:c("git.tags"),count:s.length}),d.has("tags")&&t.jsx("div",{className:"pl-1 space-y-px",children:s.map(F=>t.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-warm-500 truncate hover:bg-warm-50 rounded",children:[t.jsxs("svg",{className:"h-3 w-3 text-purple-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.568 3H5.25A2.25 2.25 0 003 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 005.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 009.568 3z"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6h.008v.008H6V6z"})]}),F]},F))})]}),_.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(O,{id:"worktrees",label:c("git.worktrees"),count:_.length}),d.has("worktrees")&&t.jsx("div",{className:"pl-1 space-y-px",children:_.map(F=>t.jsxs("div",{className:"group flex items-center gap-1.5 px-2 py-1 text-xs text-warm-600 hover:bg-warm-50 dark:hover:bg-warm-800/50 rounded",children:[t.jsx("svg",{className:"h-3 w-3 text-amber-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),t.jsx("span",{className:"truncate flex-1",title:F.path,children:F.branch}),t.jsx("button",{className:"opacity-0 group-hover:opacity-100 shrink-0 p-0.5 text-warm-400 hover:text-status-error transition-all",disabled:h||N===F.path,title:c("git.cleanupWorktree"),onClick:()=>{confirm(c("git.confirmCleanupWorktree").replace("{name}",F.branch))&&(D(F.path),m(!0),o(null),Dv(a,F.path,F.branch).then(()=>{S(U=>U.filter(W=>W.path!==F.path)),f()}).catch(U=>o(U instanceof Error?U.message:"Error")).finally(()=>{D(null),m(!1)}))},children:N===F.path?t.jsx("svg",{className:"h-3 w-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}):t.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]},F.path))})]}),i>0&&t.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 text-[11px] font-semibold text-warm-500 uppercase tracking-wider",children:[c("git.stashes"),t.jsx("span",{className:"text-warm-400 font-normal ml-auto",children:i})]}),u&&tn.createPortal(t.jsxs("div",{ref:y,className:"fixed z-tooltip bg-theme-card border border-warm-200 dark:border-warm-700 rounded-lg shadow-elevated py-1 min-w-[220px] text-xs",style:{left:u.x,top:u.y},children:[!u.isCurrent&&!u.isRemote&&t.jsx(H,{label:`${c("git.checkout")} ${u.branch}`,onClick:()=>R(()=>Xf(a,u.branch))}),!u.isCurrent&&u.isRemote&&t.jsx(H,{label:`${c("git.checkoutRemote")} ${u.branch.replace(/^(remotes\/)?origin\//,"")}`,onClick:()=>{const F=u.branch.replace(/^(remotes\/)?origin\//,"");R(()=>Xf(a,F))}}),!u.isCurrent&&t.jsx(H,{label:`${c("git.mergeInto")} ${u.branch}`,onClick:()=>R(()=>Lw(a,u.branch))}),!u.isCurrent&&!u.isRemote&&t.jsx(H,{label:`${c("git.rebaseOnto")} ${u.branch}`,onClick:()=>R(()=>rE(a,u.branch))}),t.jsx("div",{className:"border-t border-warm-100 dark:border-warm-700 my-1"}),t.jsx(H,{label:`${c("git.fetch")}`,onClick:()=>R(()=>Tw(a))}),!u.isRemote&&t.jsxs(t.Fragment,{children:[t.jsx(H,{label:`${c("git.pull")}`,onClick:()=>R(()=>Ew(a))}),t.jsx(H,{label:`${c("git.push")}`,onClick:()=>R(()=>Pm(a))})]}),!u.isRemote&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"border-t border-warm-100 dark:border-warm-700 my-1"}),t.jsx(H,{label:`${c("git.renameBranch")} ${u.branch}...`,onClick:()=>{C(u.branch),x(u.branch),v(null)}}),!u.isCurrent&&(()=>{const F=_.find(W=>W.branch===u.branch);if(F)return t.jsx(H,{danger:!0,label:`${c("git.deleteWorktreeAndBranch")} ${u.branch}`,onClick:()=>{confirm(c("git.confirmDeleteWorktreeAndBranch").replace("{name}",u.branch))?R(()=>Dv(a,F.path,u.branch)):v(null)}});const U=u.branch;return t.jsx(H,{danger:!0,label:`${c("git.delete")} ${U}`,onClick:()=>{if(!confirm(c("git.confirmDelete").replace("{name}",U))){v(null);return}R(async()=>{try{await Yf(a,U)}catch(W){const X=W instanceof Error?W.message:"";if(/not fully merged/i.test(X)&&confirm(c("git.confirmForceDelete").replace("{name}",U))){await Yf(a,U,!0);return}throw W}})}})})()]})]}),document.body),b&&t.jsx(Fn,{open:!0,onClose:()=>C(null),size:"sm",children:t.jsxs("div",{className:"bg-theme-card rounded-lg shadow-xl w-80 max-w-[90vw]",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-warm-100",children:[t.jsx("span",{className:"text-sm font-semibold text-warm-700",children:c("git.renameBranch")}),t.jsx("button",{onClick:()=>C(null),className:"text-warm-400 hover:text-warm-600",children:t.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),t.jsxs("div",{className:"p-4 space-y-3",children:[t.jsxs("p",{className:"text-xs text-warm-500",children:[b," →"]}),t.jsx("input",{className:"w-full border border-warm-200 rounded px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-accent bg-transparent",placeholder:c("git.newBranchName"),value:w,onChange:F=>x(F.target.value),onKeyDown:F=>{if(F.key==="Enter"&&w.trim()&&w.trim()!==b){const U=b;R(()=>Ev(a,U,w.trim()),()=>C(null))}},autoFocus:!0}),t.jsx("button",{className:"w-full btn-primary text-sm py-2",disabled:h||!w.trim()||w.trim()===b,onClick:()=>{const F=b;R(()=>Ev(a,F,w.trim()),()=>C(null))},children:c("git.rename")})]})]})})]})}function T6(e){const s=new Date(e);if(isNaN(s.getTime()))return"";const i=String(s.getFullYear()).slice(2),a=String(s.getMonth()+1).padStart(2,"0"),h=String(s.getDate()).padStart(2,"0"),m=String(s.getHours()).padStart(2,"0"),f=String(s.getMinutes()).padStart(2,"0");return`${i}-${a}-${h} ${m}:${f}`}function Gb({view:e,onChange:s,fileChangeCount:i,orientation:a="vertical"}){const{t:h}=it(),m=a==="horizontal",f=({id:o,label:c,badge:d})=>{const p=e===o;return t.jsxs("button",{onClick:()=>s(o),className:`flex items-center gap-2 px-3 py-2 text-xs font-medium rounded transition-colors ${m?"flex-1 justify-center":"w-full"} ${p?"bg-accent text-white":"text-warm-600 hover:bg-warm-200/60"}`,children:[t.jsx("span",{className:`${m?"":"flex-1 text-left"} truncate`,children:c}),d!==void 0&&d>0&&t.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full ${p?"bg-white/20 text-white":"bg-warm-200 text-warm-600"}`,children:d})]})};return m?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(f,{id:"fileStatus",label:h("git.viewFileStatus"),badge:i}),t.jsx(f,{id:"history",label:h("git.viewHistory")})]}):t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"px-2 text-[10px] font-bold text-warm-400 uppercase tracking-widest flex items-center gap-2",children:[t.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),h("git.workspace")]}),t.jsxs("div",{className:"space-y-0.5",children:[t.jsx(f,{id:"fileStatus",label:h("git.viewFileStatus"),badge:i}),t.jsx(f,{id:"history",label:h("git.viewHistory")})]})]})}function nu({axis:e,onResize:s}){return t.jsx("div",{onMouseDown:i=>{i.preventDefault(),document.body.style.cursor=e==="x"?"col-resize":"row-resize",document.body.style.userSelect="none";const a=m=>s(m.clientX,m.clientY),h=()=>{document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",a),window.removeEventListener("mouseup",h)};window.addEventListener("mousemove",a),window.addEventListener("mouseup",h)},role:"separator","aria-orientation":e==="x"?"vertical":"horizontal",className:e==="x"?"w-1 mx-1 shrink-0 cursor-col-resize bg-warm-200/60 hover:bg-accent transition-colors rounded":"h-1 my-0.5 shrink-0 cursor-row-resize bg-warm-200/60 hover:bg-accent transition-colors"})}function L6({x:e,y:s,message:i,onDismiss:a}){const h=k.useRef(null),[m,f]=k.useState(null);return k.useEffect(()=>{if(!h.current)return;const o=h.current.getBoundingClientRect(),c=o.width,d=o.height,p=window.innerWidth,u=window.innerHeight;let v=s-d-12;v<8&&(v=s+12),v+d>u-8&&(v=u-d-8);let b=e-c/2;b<8&&(b=8),b+c>p-8&&(b=p-c-8),f({top:v,left:b})},[e,s]),tn.createPortal(t.jsx("div",{onClick:a,onTouchStart:a,className:"fixed inset-0 z-tooltip",children:t.jsx("div",{ref:h,className:"absolute bg-warm-800 dark:bg-warm-900 text-white text-xs px-3 py-2 rounded-lg shadow-elevated max-w-[80vw] whitespace-pre-wrap break-words pointer-events-none",style:m?{top:m.top,left:m.left,opacity:1}:{top:0,left:0,opacity:0},children:i})}),document.body)}function su(e,s,i){return Math.max(s,Math.min(i,e))}function kf(e,s,i,a){if(typeof window>"u")return s;const h=window.localStorage.getItem(e);if(!h)return s;const m=parseFloat(h);return isNaN(m)?s:su(m,i,a)}function D6({project:e,refreshTrigger:s}){const{t:i}=it(),a=h_("(max-width: 767px)"),[h,m]=k.useState(!1),[f,o]=k.useState(null),c=k.useRef({timer:null,startX:0,startY:0,fired:!1}),[d,p]=k.useState(()=>{if(typeof window>"u")return"history";const Re=window.localStorage.getItem(`git-view:${e.id}`);return Re==="fileStatus"||Re==="history"?Re:"history"});k.useEffect(()=>{typeof window<"u"&&window.localStorage.setItem(`git-view:${e.id}`,d)},[d,e.id]);const[u,v]=k.useState([]),[b,C]=k.useState(!0),[w,x]=k.useState(!1),[y,_]=k.useState(!0),[S,N]=k.useState(null),[D,j]=k.useState([]),[R,L]=k.useState([]),[T,A]=k.useState(0),[z,O]=k.useState([]),[H,F]=k.useState(""),[U,W]=k.useState(!1),[X,J]=k.useState(null),[P,B]=k.useState(null),[I,V]=k.useState([]),[$,se]=k.useState(!1),[ue,ae]=k.useState(null),[ee,Y]=k.useState(""),[he,de]=k.useState(!1),ke=k.useRef(null),re=k.useRef(null),Fe=k.useRef(!1),Ne=k.useRef(null),Te=k.useRef(null),be=k.useRef(null),[pe,Je]=k.useState(()=>kf("clitrigger:git:sidebar-w",224,180,480)),[Ye,ge]=k.useState(()=>kf("clitrigger:git:detail-h-pct",.5,.2,.8)),[Ce,Ke]=k.useState(()=>kf("clitrigger:git:detail-fl-w",240,160,500));k.useEffect(()=>{localStorage.setItem("clitrigger:git:sidebar-w",String(pe))},[pe]),k.useEffect(()=>{localStorage.setItem("clitrigger:git:detail-h-pct",String(Ye))},[Ye]),k.useEffect(()=>{localStorage.setItem("clitrigger:git:detail-fl-w",String(Ce))},[Ce]);const qe=k.useCallback(Re=>{if(!Ne.current)return;const ve=Ne.current.getBoundingClientRect();Je(su(Re-ve.left,180,480))},[]),tt=k.useCallback((Re,ve)=>{if(!Te.current)return;const $e=Te.current.getBoundingClientRect();ge(su(($e.bottom-ve)/$e.height,.2,.8))},[]),Oe=k.useCallback(Re=>{if(!be.current)return;const ve=be.current.getBoundingClientRect();Ke(su(Re-ve.left,160,500))},[]),fe=k.useCallback(async()=>{try{const Re=await Vf(e.id);j(Re.branches),L(Re.tags),A(Re.stashCount)}catch{}},[e.id]),je=k.useCallback(async()=>{try{const Re=await jw(e.id);O(Re.files),F(Re.branch||"")}catch{}},[e.id]),oe=k.useCallback(async(Re,ve=!1)=>{if(!Fe.current){Fe.current=!0,x(!0),N(null);try{const $e=await VN(e.id,Re,50);v(et=>ve?$e.commits:[...et,...$e.commits]),C($e.hasMore)}catch($e){N($e instanceof Error?$e.message:"Failed to fetch git log")}finally{x(!1),_(!1),Fe.current=!1}}},[e.id]),q=k.useCallback(()=>{v([]),C(!0),_(!0),B(null),V([]),ae(null),Y(""),oe(0,!0),fe(),je()},[oe,fe,je]),K=k.useCallback(async Re=>{if((P==null?void 0:P.hash)===Re.hash){B(null),V([]),ae(null),Y("");return}B(Re),ae(null),Y(""),se(!0);try{const ve=await aE(e.id,Re.hash);if(V(ve.files),ve.files.length>0){const $e=ve.files[0].path;ae($e),de(!0);try{const et=await Tv(e.id,Re.hash,$e);Y(et.diff)}catch{Y("")}finally{de(!1)}}}catch{V([])}finally{se(!1)}},[e.id,P==null?void 0:P.hash]),Q=k.useCallback(async Re=>{if(P){ae(Re),de(!0);try{const ve=await Tv(e.id,P.hash,Re);Y(ve.diff)}catch{Y("")}finally{de(!1)}}},[e.id,P]),ie=k.useCallback(()=>{c.current.timer!==null&&(window.clearTimeout(c.current.timer),c.current.timer=null)},[]),te=k.useCallback((Re,ve)=>{a&&(ie(),c.current.startX=Re.clientX,c.current.startY=Re.clientY,c.current.fired=!1,c.current.timer=window.setTimeout(()=>{if(c.current.fired=!0,c.current.timer=null,o({message:ve,x:c.current.startX,y:c.current.startY}),typeof navigator<"u"&&typeof navigator.vibrate=="function")try{navigator.vibrate(10)}catch{}},500))},[a,ie]),le=k.useCallback(Re=>{if(!a||c.current.timer===null)return;const ve=Re.clientX-c.current.startX,$e=Re.clientY-c.current.startY;ve*ve+$e*$e>64&&ie()},[a,ie]),xe=k.useCallback(()=>{a&&ie()},[a,ie]);k.useEffect(()=>{if(!f)return;const Re=()=>o(null);return window.addEventListener("scroll",Re,!0),window.addEventListener("resize",Re),()=>{window.removeEventListener("scroll",Re,!0),window.removeEventListener("resize",Re)}},[f]),k.useEffect(()=>{a||o(null)},[a]),k.useEffect(()=>{oe(0,!0),fe(),je()},[oe,fe,je]),k.useEffect(()=>{s&&s>0&&q()},[s]),k.useEffect(()=>{const Re=ke.current;if(!Re)return;const ve=new IntersectionObserver($e=>{$e[0].isIntersecting&&b&&!Fe.current&&u.length>0&&oe(u.length)},{rootMargin:"200px"});return ve.observe(Re),()=>ve.disconnect()},[b,u.length,oe]);const Pe=k.useMemo(()=>b6(u),[u]);return t.jsxs("div",{className:"animate-fade-in flex flex-col",style:{height:"calc(100vh - 260px)",minHeight:"400px"},children:[t.jsx("div",{className:"card mb-2 overflow-hidden",children:t.jsx(k6,{projectId:e.id,projectName:e.name,onRefresh:q,busy:U,setBusy:W,branches:D,statusFiles:z})}),X&&t.jsxs("div",{className:"mb-2 px-3 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-xs flex items-center justify-between rounded border border-red-200 dark:border-red-800",children:[t.jsx("span",{children:X}),t.jsx("button",{onClick:()=>J(null),className:"ml-2 shrink-0 hover:text-red-800 dark:hover:text-red-300",children:"×"})]}),t.jsxs("div",{ref:Ne,className:`flex flex-1 min-h-0 ${a?"flex-col gap-2":""}`,children:[t.jsxs("div",{style:a?void 0:{width:pe},className:`shrink-0 flex flex-col gap-2 ${a?"":"min-h-0"}`,children:[a?t.jsxs("div",{className:"card p-2 flex items-center gap-2",children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(Gb,{view:d,onChange:p,fileChangeCount:z.length,orientation:"horizontal"})}),t.jsxs("button",{onClick:()=>m(Re=>!Re),className:"btn-ghost text-xs flex items-center gap-1 shrink-0 px-3 py-2","aria-expanded":h,children:[t.jsx("svg",{className:`h-3 w-3 transition-transform ${h?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})}),i("git.branches")]})]}):t.jsx("div",{className:"card p-3 shrink-0",children:t.jsx(Gb,{view:d,onChange:p,fileChangeCount:z.length})}),(!a||h)&&t.jsx("div",{className:`card overflow-y-auto p-3 ${a?"":"flex-1 min-h-0"}`,style:a?{maxHeight:"40vh"}:void 0,children:t.jsx(E6,{branches:D,tags:R,stashCount:T,projectId:e.id,busy:U,setBusy:W,onRefresh:q,onError:J})})]}),!a&&t.jsx(nu,{axis:"x",onResize:qe}),t.jsx("div",{className:"card flex-1 overflow-hidden flex flex-col min-h-0",children:d==="fileStatus"?t.jsx(N6,{projectId:e.id,branchName:H,files:z,busy:U,setBusy:W,onRefresh:q,onError:J,isMobile:a}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-warm-100",children:[t.jsx("span",{className:"text-sm font-semibold text-warm-700",children:i("git.commitHistory")}),t.jsxs("button",{onClick:q,disabled:w,className:"btn-ghost text-xs flex items-center gap-1.5",children:[t.jsx("svg",{className:`h-3.5 w-3.5 ${w?"animate-spin":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182"})}),i("git.refresh")]})]}),t.jsxs("div",{className:`flex items-center py-1.5 border-b border-warm-50 text-2xs text-warm-400 uppercase tracking-wider ${a?"px-3":"px-4"}`,children:[!a&&t.jsx("div",{className:"w-24 shrink-0",children:i("git.graph")}),t.jsx("div",{className:"flex-1 min-w-0",children:i("git.description")}),t.jsx("div",{className:"w-14 text-right shrink-0",children:i("git.date")}),!a&&t.jsx("div",{className:"shrink-0 ml-2",children:i("git.author")}),t.jsx("div",{className:"w-16 text-right shrink-0",children:i("git.hash")})]}),S&&t.jsx("div",{className:"p-6 text-center",children:t.jsx("p",{className:"text-status-error text-sm",children:S})}),y&&!S&&t.jsx("div",{className:"p-6 text-center",children:t.jsx("p",{className:"text-warm-500 text-sm",children:i("detail.loading")})}),!y&&!S&&u.length===0&&t.jsx("div",{className:"p-6 text-center",children:t.jsx("p",{className:"text-warm-500 text-sm",children:i("git.noCommits")})}),u.length>0&&t.jsxs("div",{ref:Te,className:"flex-1 flex flex-col min-h-0",children:[t.jsxs("div",{className:"overflow-y-auto",ref:re,style:P?{flex:`${(1-Ye)*100} 1 0`,minHeight:0}:{flex:"1 1 0",minHeight:0},children:[t.jsxs("div",{className:"relative flex",children:[!a&&t.jsx("div",{className:"shrink-0 sticky left-0",children:t.jsx(S6,{graphNodes:Pe,totalRows:u.length})}),t.jsx("div",{className:"flex-1 min-w-0",children:u.map(Re=>{const ve=(P==null?void 0:P.hash)===Re.hash;return t.jsxs("div",{onClick:$e=>{if(c.current.fired){$e.stopPropagation(),c.current.fired=!1;return}K(Re)},onPointerDown:$e=>te($e,Re.message),onPointerMove:le,onPointerUp:xe,onPointerCancel:xe,onContextMenu:a?$e=>$e.preventDefault():void 0,className:`flex items-center px-3 cursor-pointer transition-colors border-b border-warm-50/20 ${ve?"bg-accent/10 border-l-2 border-l-accent":"hover:bg-warm-50/50"}`,style:{height:ni,...a?{touchAction:"pan-y",WebkitTouchCallout:"none",userSelect:"none"}:null},children:[t.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1.5",children:[Re.refs.length>0&&t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:Re.refs.map(($e,et)=>t.jsx(y6,{refStr:$e},et))}),t.jsx("span",{className:"text-xs text-warm-700 truncate",title:Re.message,children:Re.message})]}),t.jsx("div",{className:"w-28 text-right shrink-0",children:t.jsx("span",{className:"text-[11px] font-mono text-warm-600",title:Re.date,children:T6(Re.date)})}),!a&&t.jsx("div",{className:"shrink-0 ml-2",children:t.jsx("span",{className:"text-[11px] text-warm-600",children:Re.author})}),t.jsx("div",{className:"w-16 text-right shrink-0",children:t.jsx("span",{className:"text-[11px] font-mono text-warm-600 cursor-pointer hover:text-accent transition-colors",title:Re.hash,onClick:$e=>{$e.stopPropagation(),navigator.clipboard.writeText(Re.hash)},children:Re.hash.substring(0,7)})})]},Re.hash)})})]}),t.jsx("div",{ref:ke,className:"h-8 flex items-center justify-center",children:w&&t.jsx("span",{className:"text-xs text-warm-400",children:i("git.loadMore")})})]}),P&&t.jsxs(t.Fragment,{children:[t.jsx(nu,{axis:"y",onResize:tt}),t.jsxs("div",{ref:be,className:`flex min-h-0 ${a?"flex-col":""}`,style:{flex:`${Ye*100} 1 0`,minHeight:0},children:[t.jsx("div",{style:a?void 0:{width:Ce},className:`shrink-0 overflow-hidden ${a?"h-1/2":""}`,children:t.jsx(dp,{files:I,loading:$,selectedFile:ue,onFileClick:Q,commitHash:P.hash})}),!a&&t.jsx(nu,{axis:"x",onResize:Oe}),t.jsx("div",{className:`flex-1 overflow-hidden bg-warm-900 ${a?"min-h-0 border-t border-warm-200":"min-w-0"}`,children:t.jsx(Bu,{diff:ee,loading:he,selectedFile:ue})})]})]})]})]})})]}),f&&t.jsx(L6,{x:f.x,y:f.y,message:f.message,onDismiss:()=>o(null)})]})}function qb(e,s=!1){return ut(`/api/projects/${e}/svn-status${s?"?showUpdates=true":""}`)}function R6(e,s=0,i=50){const a=new URLSearchParams({skip:String(s),limit:String(i)});return ut(`/api/projects/${e}/svn-log?${a}`)}function M6(e,s){return ut(`/api/projects/${e}/svn-commit-files?revision=${encodeURIComponent(s)}`)}function A6(e,s,i,a){const h=new URLSearchParams({revision:s});return i&&h.set("file",i),a&&h.set("status",a),ut(`/api/projects/${e}/svn-commit-diff?${h}`)}function O6(e,s){const i=new URLSearchParams;s&&i.set("file",s);const a=i.toString();return ut(`/api/projects/${e}/svn-diff${a?`?${a}`:""}`)}function z6(e,s){const i=new URLSearchParams;s&&i.set("file",s);const a=i.toString();return ut(`/api/projects/${e}/svn-properties${a?`?${a}`:""}`)}function B6(e,s,i,a){return nt(`/api/projects/${e}/svn-propset`,{name:s,value:i,file:a})}function P6(e,s){return nt(`/api/projects/${e}/svn-add`,{files:s})}function I6(e,s){return nt(`/api/projects/${e}/svn-revert`,{files:s})}function H6(e,s,i=!1){return nt(`/api/projects/${e}/svn-delete`,{files:s,keepLocal:i})}function F6(e,s,i="working"){return nt(`/api/projects/${e}/svn-resolve`,{files:s,accept:i})}function $6(e,s,i){return nt(`/api/projects/${e}/svn-changelist`,{name:s,files:i})}function U6(e,s,i){return nt(`/api/projects/${e}/svn-commit`,{message:s,files:i})}function Kb(e,s){return nt(`/api/projects/${e}/svn-update`,{revision:s})}function W6(e){return nt(`/api/projects/${e}/svn-cleanup`,{})}const Cf=new Map,pr=e=>e.working_dir.trim()||"?",G6=e=>e==="A"?"text-status-success":e==="D"?"text-status-error":e==="M"?"text-accent":e==="C"?"text-status-error":e==="?"?"text-warm-400":"text-amber-500";function q6({project:e,refreshTrigger:s}){const{t:i}=it(),[a,h]=k.useState("modifications"),[m,f]=k.useState(null),[o,c]=k.useState(null),[d,p]=k.useState(null);k.useEffect(()=>{let Ie=!1;return Wm().then(Ee=>{if(Ie)return;const ot=Ee.find(ht=>ht.tool==="svn");p(ot?ot.installed:null)}).catch(()=>{}),()=>{Ie=!0}},[]);const[u,v]=k.useState(()=>Cf.get(e.id)??null),[b,C]=k.useState(!1),[w,x]=k.useState(!1),[y,_]=k.useState(new Set),[S,N]=k.useState(null),[D,j]=k.useState(""),[R,L]=k.useState(!1),[T,A]=k.useState(""),[z,O]=k.useState(!1),H=k.useCallback(Ie=>{Cf.set(e.id,Ie),v(Ie),_(Ee=>{const ot=new Set(Ie.files.map(_t=>_t.path)),ht=new Set;return Ee.forEach(_t=>ot.has(_t)&&ht.add(_t)),ht}),N(Ee=>Ee&&!Ie.files.some(ot=>ot.path===Ee)?null:Ee)},[e.id]),F=k.useCallback(async()=>{const Ie=Cf.has(e.id);Ie||C(!0),f(null);try{H(await qb(e.id))}catch(Ee){f(Ee instanceof Error?Ee.message:"Failed to load SVN status")}finally{Ie||C(!1)}},[e.id,H]);k.useEffect(()=>{F()},[F,s]);const U=k.useCallback(async()=>{x(!0),f(null),c(null);try{const Ie=await qb(e.id,!0);H(Ie),c(Ie.behind>0?i("svn.behindCount").replace("{n}",String(Ie.behind)):i("svn.upToDate"))}catch(Ie){f(Ie instanceof Error?Ie.message:"Failed to contact server")}finally{x(!1)}},[e.id,H,i]);k.useEffect(()=>{if(!S){j("");return}let Ie=!1;return L(!0),O6(e.id,S).then(Ee=>{Ie||j(Ee.diff)}).catch(Ee=>{Ie||f(Ee instanceof Error?Ee.message:"Diff failed")}).finally(()=>{Ie||L(!1)}),()=>{Ie=!0}},[e.id,S]);const W=Ie=>{_(Ee=>{const ot=new Set(Ee);return ot.has(Ie)?ot.delete(Ie):ot.add(Ie),ot})},X=(Ie,Ee)=>{_(ot=>{const ht=new Set(ot);return Ie.forEach(_t=>{Ee?ht.add(_t):ht.delete(_t)}),ht})},J=async(Ie,Ee)=>{O(!0),f(null),c(null);try{await Ie(),Ee&&c(Ee),await F()}catch(ot){f(ot instanceof Error?ot.message:"Action failed")}finally{O(!1)}},P=Ie=>J(()=>P6(e.id,Ie)),B=Ie=>J(()=>I6(e.id,Ie)),I=Ie=>J(()=>H6(e.id,Ie)),V=(Ie,Ee)=>J(()=>F6(e.id,Ie,Ee)),$=(Ie,Ee)=>J(()=>$6(e.id,Ie,Ee)),se=()=>J(async()=>{const Ie=await Kb(e.id);c(Ie.revision?i("svn.updateSuccess").replace("{rev}",Ie.revision):i("svn.update"))}),[ue,ae]=k.useState(!1),[ee,Y]=k.useState(""),he=()=>{const Ie=ee.trim();Ie&&(ae(!1),J(async()=>{const Ee=await Kb(e.id,Ie);c(Ee.revision?i("svn.updateSuccess").replace("{rev}",Ee.revision):i("svn.update")),Y("")}))},de=()=>J(()=>W6(e.id),i("svn.cleanupSuccess")),[ke,re]=k.useState(null),[Fe,Ne]=k.useState(""),Te=()=>{const Ie=Fe.trim();if(!Ie||!ke)return;const Ee=ke;re(null),Ne(""),$(Ie,Ee)},be=()=>{if(!T.trim()){f(i("svn.commitMessagePlaceholder"));return}const Ie=y.size>0?Array.from(y):void 0;J(async()=>{const Ee=await U6(e.id,T.trim(),Ie);A(""),Ee.revision&&c(i("svn.commitSuccess").replace("{rev}",Ee.revision))})},[pe,Je]=k.useState([]),[Ye,ge]=k.useState(!1),[Ce,Ke]=k.useState(!1),[qe,tt]=k.useState(null),[Oe,fe]=k.useState([]),[je,oe]=k.useState(!1),[q,K]=k.useState(null),[Q,ie]=k.useState(""),[te,le]=k.useState(!1),xe=k.useCallback(async(Ie=0)=>{ge(!0),f(null);try{const Ee=await R6(e.id,Ie,50);Je(ot=>Ie===0?Ee.commits:[...ot,...Ee.commits]),Ke(Ee.hasMore)}catch(Ee){f(Ee instanceof Error?Ee.message:"Log failed")}finally{ge(!1)}},[e.id]),Pe=k.useCallback(async Ie=>{tt(Ie),K(null),ie(""),oe(!0);try{const Ee=await M6(e.id,Ie);fe(Ee.files)}catch(Ee){f(Ee instanceof Error?Ee.message:"Failed to load revision files")}finally{oe(!1)}},[e.id]);k.useEffect(()=>{var ot;if(!qe||!q){ie("");return}let Ie=!1;le(!0);const Ee=(ot=Oe.find(ht=>ht.path===q))==null?void 0:ot.status;return A6(e.id,qe,q,Ee).then(ht=>{Ie||ie(ht.diff)}).catch(ht=>{Ie||f(ht instanceof Error?ht.message:"Diff failed")}).finally(()=>{Ie||le(!1)}),()=>{Ie=!0}},[e.id,qe,q,Oe]);const[Re,ve]=k.useState(null),[$e,et]=k.useState(null),dt=(Ie,Ee)=>{Ie.preventDefault(),Ie.stopPropagation(),ve({x:Ie.clientX,y:Ie.clientY,file:Ee})},Be=k.useMemo(()=>Array.from(new Set(((u==null?void 0:u.files)??[]).map(Ie=>Ie.changelist).filter(Ie=>!!Ie))).sort(),[u]),Ze=k.useMemo(()=>{if(!u)return null;const Ie=[];return u.branch&&Ie.push(u.branch),u.revision&&Ie.push(`r${u.revision}`),Ie.join(" · ")},[u]),lt=z||b||w;return t.jsxs("div",{className:"animate-fade-in flex flex-col",style:{height:"calc(100vh - 260px)",minHeight:"400px"},children:[d===!1&&t.jsx("div",{className:"card mb-2 px-3 py-2 bg-status-warning/10 border border-status-warning/30 text-2xs text-status-warning",children:i("svn.cliMissing")}),t.jsxs("div",{className:"flex flex-1 min-h-0 gap-2",children:[t.jsxs("div",{className:"card w-52 shrink-0 flex flex-col overflow-y-auto",children:[t.jsxs("div",{className:"px-3 py-3 border-b border-warm-100",children:[t.jsx("div",{className:"text-[11px] font-semibold text-warm-500 uppercase tracking-wider",children:"SVN"}),Ze&&t.jsx("div",{className:"mt-1 text-2xs text-warm-400 truncate",title:(u==null?void 0:u.tracking)??void 0,children:Ze})]}),t.jsx(Vb,{label:i("svn.viewsHeader")}),t.jsx(ja,{label:i("svn.checkForModifications"),active:a==="modifications",onClick:()=>h("modifications")}),t.jsx(ja,{label:i("svn.showLog"),remote:!0,active:a==="log",onClick:()=>h("log")}),t.jsx(Vb,{label:i("svn.actionsHeader")}),t.jsx(ja,{label:i("svn.update"),remote:!0,disabled:lt,onClick:se}),t.jsx(ja,{label:i("svn.updateToRevision"),remote:!0,disabled:lt,onClick:()=>ae(!0)}),t.jsx(ja,{label:i("svn.cleanup"),disabled:lt,onClick:de}),t.jsx(ja,{label:i("svn.properties"),onClick:()=>et({file:null})}),t.jsx("div",{className:"flex-1"})]}),t.jsx("div",{className:"card flex-1 overflow-hidden flex flex-col min-w-0 min-h-0",children:a==="modifications"?t.jsx(X6,{statusFiles:(u==null?void 0:u.files)??[],statusLoading:b,remoteChecking:w,onRefresh:F,onCheckRepository:U,selectedFiles:y,onToggle:W,onSelectMany:X,activeFile:S,onActivate:N,onContextMenu:dt,onChangelist:$,onResolve:(Ie,Ee)=>V([Ie],Ee),workingDiff:D,workingDiffLoading:R,commitMessage:T,onCommitMessageChange:A,onCommit:be,busy:lt,actionFlash:o,error:m}):t.jsx(J6,{loaded:pe.length>0,entries:pe,loading:Ye,hasMore:Ce,onLoad:()=>xe(0),onLoadMore:()=>xe(pe.length),selectedRev:qe,onSelectRev:Pe,revFiles:Oe,revFilesLoading:je,selectedFile:q,onSelectFile:K,revDiff:Q,revDiffLoading:te,error:m})})]}),t.jsx(Fn,{open:ue,onClose:()=>ae(!1),size:"sm",children:t.jsxs("div",{className:"bg-theme-card rounded-lg shadow-xl w-80 max-w-[90vw]",children:[t.jsxs("div",{className:"px-4 py-3 border-b border-warm-100 flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-semibold text-warm-700",children:i("svn.updateToRevision")}),t.jsx("span",{className:"text-[9px] uppercase tracking-wide px-1 py-0.5 rounded bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",children:i("svn.remoteBadge")})]}),t.jsxs("div",{className:"p-4 space-y-3",children:[t.jsx("input",{autoFocus:!0,value:ee,onChange:Ie=>Y(Ie.target.value),onKeyDown:Ie=>{Ie.key==="Enter"&&he()},placeholder:i("svn.revisionPlaceholder"),className:"w-full border border-warm-200 rounded px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-accent"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{className:"flex-1 px-3 py-2 text-sm rounded border border-warm-200 hover:bg-warm-50",onClick:()=>ae(!1),children:i("svn.cancel")}),t.jsx("button",{className:"flex-1 px-3 py-2 text-sm font-semibold rounded bg-accent text-white hover:bg-accent/90 disabled:opacity-40",disabled:!ee.trim()||lt,onClick:he,children:i("svn.update")})]})]})]})}),t.jsx(Fn,{open:ke!==null,onClose:()=>re(null),size:"sm",children:t.jsxs("div",{className:"bg-theme-card rounded-lg shadow-xl w-80 max-w-[90vw]",children:[t.jsx("div",{className:"px-4 py-3 border-b border-warm-100",children:t.jsx("span",{className:"text-sm font-semibold text-warm-700",children:i("svn.newChangelist")})}),t.jsxs("div",{className:"p-4 space-y-3",children:[t.jsx("input",{autoFocus:!0,value:Fe,onChange:Ie=>Ne(Ie.target.value),onKeyDown:Ie=>{Ie.key==="Enter"&&Te()},placeholder:i("svn.changelistNamePlaceholder"),className:"w-full border border-warm-200 rounded px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-accent"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{className:"flex-1 px-3 py-2 text-sm rounded border border-warm-200 hover:bg-warm-50",onClick:()=>re(null),children:i("svn.cancel")}),t.jsx("button",{className:"flex-1 px-3 py-2 text-sm font-semibold rounded bg-accent text-white hover:bg-accent/90 disabled:opacity-40",disabled:!Fe.trim()||lt,onClick:Te,children:i("svn.moveToChangelist")})]})]})]})}),Re&&t.jsx(Q6,{x:Re.x,y:Re.y,file:Re.file,allFiles:(u==null?void 0:u.files)??[],selected:y,onClose:()=>ve(null),onAdd:P,onRevert:B,onDelete:I,onResolve:V,changelists:Be,onChangelist:$,onNewChangelist:Ie=>re(Ie),onViewDiff:Ie=>{N(Ie),ve(null)},onProperties:Ie=>{et({file:Ie}),ve(null)}}),$e&&t.jsx(Z6,{projectId:e.id,file:$e.file,onClose:()=>et(null)})]})}function Vb({label:e}){return t.jsx("div",{className:"px-3 pt-3 pb-1 text-[10px] font-semibold text-warm-400 uppercase tracking-wider",children:e})}function ja({label:e,active:s,remote:i,disabled:a,onClick:h}){const{t:m}=it();return t.jsxs("button",{onClick:h,disabled:a,className:`text-left px-3 py-2 text-xs flex items-center gap-2 transition-colors disabled:opacity-40 ${s?"bg-accent/10 text-accent font-semibold border-l-2 border-accent":"text-warm-600 hover:bg-warm-50"}`,children:[t.jsx("span",{className:"truncate flex-1",children:e}),i&&t.jsx("span",{title:m("svn.remoteHint"),className:"shrink-0 text-[9px] uppercase tracking-wide px-1 py-0.5 rounded bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",children:m("svn.remoteBadge")})]})}function K6(e){const s={name:"",path:"",dirs:[],files:[]};for(const i of e){const a=i.path.split("/");a.pop();let h=s,m="";for(const f of a){m=m?`${m}/${f}`:f;let o=h.dirs.find(c=>c.name===f);o||(o={name:f,path:m,dirs:[],files:[]},h.dirs.push(o)),h=o}h.files.push(i)}return f_(s),m_(s),s}function f_(e){e.dirs=e.dirs.map(s=>{let i=s;for(;i.dirs.length===1&&i.files.length===0;){const a=i.dirs[0];i={name:`${i.name}/${a.name}`,path:a.path,dirs:a.dirs,files:a.files}}return i}),e.dirs.forEach(f_)}function m_(e){e.dirs.sort((s,i)=>s.name.localeCompare(i.name)),e.files.sort((s,i)=>s.path.localeCompare(i.path)),e.dirs.forEach(m_)}function p_(e){let s=e.dirs.length,i=e.files.length;for(const a of e.dirs){const h=p_(a);s+=h.dirs,i+=h.files}return{dirs:s,files:i}}function V6({onResolve:e}){const{t:s}=it(),i=k.useRef(null),[a,h]=k.useState(null);k.useEffect(()=>{if(!a)return;const o=()=>h(null);return document.addEventListener("mousedown",o),document.addEventListener("scroll",o,!0),window.addEventListener("resize",o),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("scroll",o,!0),window.removeEventListener("resize",o)}},[a]);const m=o=>{var u;o.stopPropagation();const c=(u=i.current)==null?void 0:u.getBoundingClientRect();if(!c)return;const d=Math.min(c.left,window.innerWidth-188),p=Math.min(c.bottom+2,window.innerHeight-118);h({x:Math.max(8,d),y:Math.max(8,p)})},f=o=>c=>{c.stopPropagation(),h(null),e(o)};return t.jsxs(t.Fragment,{children:[t.jsxs("button",{ref:i,draggable:!1,onClick:m,className:"shrink-0 text-2xs px-1.5 py-0.5 rounded bg-status-error/15 text-status-error hover:bg-status-error/25 font-medium",children:[s("svn.resolve")," ▾"]}),a&&tn.createPortal(t.jsxs("div",{className:"fixed z-tooltip bg-theme-card border border-warm-200 dark:border-warm-700 rounded-lg shadow-elevated py-1 min-w-[180px]",style:{left:a.x,top:a.y},onMouseDown:o=>o.stopPropagation(),children:[t.jsx("button",{className:"w-full text-left px-3 py-1.5 text-xs text-theme-text hover:bg-theme-hover transition-colors",onClick:f("working"),children:s("svn.resolveWorking")}),t.jsx("button",{className:"w-full text-left px-3 py-1.5 text-xs text-theme-text hover:bg-theme-hover transition-colors",onClick:f("theirs-full"),children:s("svn.resolveTheirs")}),t.jsx("button",{className:"w-full text-left px-3 py-1.5 text-xs text-theme-text hover:bg-theme-hover transition-colors",onClick:f("mine-full"),children:s("svn.resolveMine")})]}),document.body)]})}function xm({file:e,indent:s,showDir:i,shared:a}){const{t:h}=it(),m=pr(e),f=a.activeFile===e.path;return t.jsxs("div",{draggable:!0,onDragStart:o=>a.onDragStart(o,e),onClick:()=>a.onActivate(e.path),onContextMenu:o=>a.onContextMenu(o,e),style:{paddingLeft:12+s*14},className:`group flex items-center gap-2 pr-3 py-1.5 cursor-pointer text-xs hover:bg-warm-50/50 ${f?"bg-accent/10 border-l-2 border-accent":""}`,children:[t.jsx("input",{type:"checkbox",checked:a.selectedFiles.has(e.path),onChange:o=>{o.stopPropagation(),a.onToggle(e.path)},onClick:o=>o.stopPropagation(),className:"shrink-0"}),t.jsx("span",{className:`font-mono font-bold text-2xs w-3 shrink-0 ${G6(m)}`,children:m}),t.jsxs("span",{className:`truncate flex-1 ${m==="C"?"text-status-error font-medium":"text-warm-600"}`,title:e.path,children:[e.path.split("/").pop(),i&&e.path.includes("/")&&t.jsx("span",{className:"text-warm-400 ml-1 text-2xs",children:e.path.substring(0,e.path.lastIndexOf("/"))})]}),m==="C"&&t.jsx(V6,{onResolve:o=>a.onResolve(e.path,o)}),t.jsx("button",{onClick:o=>a.onContextMenu(o,e),className:"shrink-0 opacity-0 group-hover:opacity-100 text-warm-400 hover:text-warm-700 px-1 transition-opacity",title:h("svn.fileStatus"),children:"⋯"})]})}function g_({node:e,depth:s,collapsed:i,onToggleCollapse:a,fileProps:h}){const{t:m}=it(),f=i.has(e.path),o=p_(e),c=o.dirs>0?m("svn.dirFileCount").replace("{d}",String(o.dirs)).replace("{f}",String(o.files)):m("svn.fileCount").replace("{f}",String(o.files));return t.jsxs(t.Fragment,{children:[t.jsxs("div",{onClick:()=>a(e.path),style:{paddingLeft:12+s*14},className:"flex items-center gap-1 pr-3 py-1.5 cursor-pointer text-xs hover:bg-warm-50/50 select-none",children:[f?t.jsx(Ts,{className:"w-3.5 h-3.5 shrink-0 text-warm-400"}):t.jsx(pl,{className:"w-3.5 h-3.5 shrink-0 text-warm-400"}),t.jsx(g5,{className:"w-3.5 h-3.5 shrink-0 text-amber-500"}),t.jsx("span",{className:"truncate text-warm-700 font-medium",title:e.path,children:e.name}),t.jsx("span",{className:"text-warm-400 text-2xs ml-1 shrink-0",children:c})]}),!f&&t.jsxs(t.Fragment,{children:[e.dirs.map(d=>t.jsx(g_,{node:d,depth:s+1,collapsed:i,onToggleCollapse:a,fileProps:h},d.path)),e.files.map(d=>t.jsx(xm,{file:d,indent:s+1,shared:h},d.path))]})]})}function Y6(e,s){const i=new Map,a=[],h=[],m=[];for(const o of e){const c=pr(o);if(o.changelist){const d=i.get(o.changelist);d?d.push(o):i.set(o.changelist,[o])}else c==="?"?h.push(o):c==="!"?m.push(o):a.push(o)}const f=Array.from(i.keys()).sort().map(o=>({key:`cl:${o}`,label:o,files:i.get(o)}));return a.length&&f.push({key:"default",label:s("svn.changelistDefault"),files:a}),h.length&&f.push({key:"unversioned",label:s("svn.changelistUnversioned"),files:h}),m.length&&f.push({key:"missing",label:s("svn.changelistMissing"),files:m}),f}function X6(e){const{t:s}=it(),[i,a]=k.useState(()=>{try{return localStorage.getItem("svn.groupByDir")!=="false"}catch{return!0}}),[h,m]=k.useState(new Set),[f,o]=k.useState(null),c=k.useMemo(()=>Y6(e.statusFiles,s),[e.statusFiles,s]),d=()=>a(C=>{const w=!C;try{localStorage.setItem("svn.groupByDir",String(w))}catch{}return w}),p=C=>m(w=>{const x=new Set(w);return x.has(C)?x.delete(C):x.add(C),x}),u={selectedFiles:e.selectedFiles,activeFile:e.activeFile,onActivate:e.onActivate,onToggle:e.onToggle,onContextMenu:e.onContextMenu,onDragStart:(C,w)=>{const x=e.selectedFiles.size>0&&e.selectedFiles.has(w.path)?e.statusFiles.filter(y=>e.selectedFiles.has(y.path)).map(y=>y.path):[w.path];C.dataTransfer.setData("text/plain",JSON.stringify(x)),C.dataTransfer.effectAllowed="move"},onResolve:e.onResolve},v=(C,w)=>{if(C.preventDefault(),o(null),w.key==="unversioned"||w.key==="missing")return;let x;try{x=JSON.parse(C.dataTransfer.getData("text/plain"))}catch{return}const y=x.filter(_=>{const S=e.statusFiles.find(N=>N.path===_);return S&&pr(S)!=="?"});y.length&&e.onChangelist(w.key.startsWith("cl:")?w.label:null,y)},b=C=>{(C.metaKey||C.ctrlKey)&&C.key==="Enter"&&(C.preventDefault(),e.onCommit())};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"px-3 py-2 border-b border-warm-100 flex items-center gap-2 shrink-0 flex-wrap",children:[t.jsx("button",{onClick:e.onRefresh,disabled:e.busy,className:"px-2 py-1 text-xs rounded border border-warm-200 hover:bg-warm-50 disabled:opacity-40",children:e.statusLoading?s("svn.checking"):s("svn.refresh")}),t.jsxs("button",{onClick:e.onCheckRepository,disabled:e.busy,className:"px-2 py-1 text-xs rounded border border-warm-200 hover:bg-warm-50 disabled:opacity-40 flex items-center gap-1",children:[e.remoteChecking?s("svn.checking"):s("svn.checkRepository"),t.jsx("span",{className:"text-[9px] uppercase tracking-wide px-1 rounded bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",children:s("svn.remoteBadge")})]}),e.actionFlash&&t.jsx("span",{className:"text-2xs text-status-success ml-1",children:e.actionFlash}),e.error&&t.jsx("span",{className:"text-2xs text-status-error ml-1",children:e.error})]}),t.jsxs("div",{className:"flex-1 grid grid-cols-2 min-h-0",children:[t.jsxs("div",{className:"border-r border-warm-100 flex flex-col min-h-0",children:[t.jsxs("div",{className:"px-3 py-2 border-b border-warm-100 flex items-center justify-between shrink-0",children:[t.jsx("span",{className:"text-[11px] font-semibold text-warm-500 uppercase tracking-wider",children:s("svn.changed")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:d,title:s(i?"svn.viewFlat":"svn.groupByDir"),className:"text-warm-400 hover:text-warm-700 p-0.5 rounded hover:bg-warm-100",children:i?t.jsx(lu,{className:"w-3.5 h-3.5"}):t.jsx(m5,{className:"w-3.5 h-3.5"})}),t.jsx("span",{className:"text-2xs text-warm-400",children:e.statusFiles.length})]})]}),t.jsx("div",{className:"flex-1 overflow-y-auto",children:e.statusLoading?t.jsx("div",{className:"p-6 text-center text-xs text-warm-400",children:s("git.loadingFiles")}):e.statusFiles.length===0?t.jsx("div",{className:"p-6 text-center text-xs text-warm-400",children:s("svn.noChanges")}):c.map(C=>{const w=`§${C.key}`,x=h.has(w),y=C.files.reduce((j,R)=>j+(e.selectedFiles.has(R.path)?1:0),0),_=y===C.files.length,S=i?K6(C.files):null,N=C.key!=="unversioned"&&C.key!=="missing",D=f===C.key;return t.jsxs("div",{children:[t.jsxs("div",{onClick:()=>p(w),onDragOver:N?j=>{j.preventDefault(),j.dataTransfer.dropEffect="move",f!==C.key&&o(C.key)}:void 0,onDragLeave:N?()=>o(j=>j===C.key?null:j):void 0,onDrop:N?j=>v(j,C):void 0,className:`flex items-center gap-1.5 px-3 py-1.5 cursor-pointer text-xs select-none border-y border-warm-200/70 ${D?"bg-accent/20 ring-1 ring-inset ring-accent":"bg-warm-100 hover:bg-warm-200/60"}`,children:[x?t.jsx(Ts,{className:"w-3.5 h-3.5 shrink-0 text-warm-400"}):t.jsx(pl,{className:"w-3.5 h-3.5 shrink-0 text-warm-400"}),t.jsx("input",{type:"checkbox",checked:_,ref:j=>{j&&(j.indeterminate=y>0&&!_)},onChange:j=>{j.stopPropagation(),e.onSelectMany(C.files.map(R=>R.path),!_)},onClick:j=>j.stopPropagation(),className:"shrink-0"}),t.jsx("span",{className:"truncate text-warm-800 font-bold",children:C.label}),t.jsx("span",{className:"text-warm-400 text-2xs ml-1 shrink-0",children:C.files.length})]}),!x&&(S?t.jsxs(t.Fragment,{children:[S.dirs.map(j=>t.jsx(g_,{node:j,depth:1,collapsed:h,onToggleCollapse:p,fileProps:u},j.path)),S.files.map(j=>t.jsx(xm,{file:j,indent:1,shared:u},j.path))]}):C.files.map(j=>t.jsx(xm,{file:j,indent:1,showDir:!0,shared:u},j.path)))]},C.key)})}),t.jsxs("div",{className:"border-t border-warm-100 p-2 shrink-0",children:[t.jsx("textarea",{value:e.commitMessage,onChange:C=>e.onCommitMessageChange(C.target.value),onKeyDown:b,placeholder:s("svn.commitMessagePlaceholder"),className:"w-full text-xs p-2 border border-warm-200 rounded resize-y min-h-[60px] focus:border-accent focus:ring-1 focus:ring-accent/30 outline-none",rows:3}),t.jsx("button",{onClick:e.onCommit,disabled:e.busy||!e.commitMessage.trim(),className:"mt-2 w-full px-3 py-1.5 text-xs font-semibold rounded bg-accent text-white hover:bg-accent/90 disabled:opacity-40",children:e.busy?s("svn.committing"):s("svn.commit")})]})]}),t.jsx("div",{className:"min-w-0",children:t.jsx(Bu,{diff:e.workingDiff,loading:e.workingDiffLoading,selectedFile:e.activeFile})})]})]})}function J6(e){const{t:s}=it();return e.loaded?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"px-3 py-2 border-b border-warm-100 flex items-center gap-2 shrink-0",children:[t.jsx("button",{onClick:e.onLoad,disabled:e.loading,className:"px-2 py-1 text-xs rounded border border-warm-200 hover:bg-warm-50 disabled:opacity-40",children:e.loading?s("svn.checking"):s("svn.refresh")}),e.error&&t.jsx("span",{className:"text-2xs text-status-error ml-1",children:e.error})]}),t.jsxs("div",{className:"flex-1 grid grid-cols-[1fr_1fr] min-h-0",children:[t.jsxs("div",{className:"border-r border-warm-100 flex flex-col min-h-0",children:[t.jsx("div",{className:"px-3 py-2 border-b border-warm-100 shrink-0",children:t.jsx("span",{className:"text-[11px] font-semibold text-warm-500 uppercase tracking-wider",children:s("svn.history")})}),t.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.entries.map(i=>t.jsxs("div",{onClick:()=>e.onSelectRev(i.hash),className:`px-3 py-2 cursor-pointer text-xs border-b border-warm-50 hover:bg-warm-50/50 ${e.selectedRev===i.hash?"bg-accent/10 border-l-2 border-accent":""}`,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"font-mono text-2xs text-warm-400 shrink-0",children:["r",i.hash]}),t.jsx("span",{className:"truncate flex-1 text-warm-700",title:i.message,children:i.message.split(`
|
|
637
637
|
`)[0]})]}),t.jsxs("div",{className:"mt-0.5 text-2xs text-warm-400 truncate",children:[i.author,i.date&&t.jsxs("span",{children:[" · ",new Date(i.date).toLocaleString()]})]})]},i.hash)),e.hasMore&&!e.loading&&t.jsxs("button",{onClick:e.onLoadMore,className:"w-full py-2 text-2xs text-warm-500 hover:bg-warm-50",children:["+ ",s("svn.loadMore")]})]})]}),t.jsxs("div",{className:"grid grid-rows-[1fr_2fr] min-h-0",children:[t.jsx("div",{className:"border-b border-warm-100 min-h-0",children:t.jsx(dp,{files:e.revFiles,loading:e.revFilesLoading,selectedFile:e.selectedFile,onFileClick:e.onSelectFile,commitHash:e.selectedRev??void 0})}),t.jsx("div",{className:"min-h-0",children:t.jsx(Bu,{diff:e.revDiff,loading:e.revDiffLoading,selectedFile:e.selectedFile})})]})]})]}):t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 p-6 text-center",children:[t.jsx("p",{className:"text-xs text-warm-400 max-w-xs",children:s("svn.logEmptyHint")}),t.jsxs("button",{onClick:e.onLoad,disabled:e.loading,className:"px-4 py-2 text-xs font-semibold rounded bg-accent text-white hover:bg-accent/90 disabled:opacity-40 flex items-center gap-2",children:[e.loading?s("svn.checking"):s("svn.loadLog"),t.jsx("span",{className:"text-[9px] uppercase tracking-wide px-1 rounded bg-white/20",children:s("svn.remoteBadge")})]}),e.error&&t.jsx("span",{className:"text-2xs text-status-error",children:e.error})]})}function Q6(e){const{t:s}=it(),i=k.useRef(null),[a,h]=k.useState({x:e.x,y:e.y}),m=k.useMemo(()=>e.selected.size>0&&e.selected.has(e.file.path)?e.allFiles.filter(w=>e.selected.has(w.path)):[e.file],[e.selected,e.allFiles,e.file]),f=m.filter(w=>pr(w)==="?").map(w=>w.path),o=m.filter(w=>pr(w)!=="?").map(w=>w.path),c=m.filter(w=>!["?","D"].includes(pr(w))).map(w=>w.path),d=m.filter(w=>pr(w)==="C").map(w=>w.path),p=m.filter(w=>pr(w)!=="?").map(w=>w.path),u=m.filter(w=>w.changelist).map(w=>w.path);k.useEffect(()=>{const w=y=>{i.current&&!i.current.contains(y.target)&&e.onClose()},x=()=>e.onClose();return document.addEventListener("mousedown",w),document.addEventListener("scroll",x,!0),()=>{document.removeEventListener("mousedown",w),document.removeEventListener("scroll",x,!0)}},[e]),k.useEffect(()=>{if(!i.current)return;const w=i.current.getBoundingClientRect();let{x,y}={x:e.x,y:e.y};x+w.width>window.innerWidth&&(x=window.innerWidth-w.width-8),y+w.height>window.innerHeight&&(y=window.innerHeight-w.height-8),h({x,y})},[e.x,e.y]);const v=m.length,b=v>1?` (${v})`:"",C=({label:w,onClick:x,danger:y})=>t.jsx("button",{className:`w-full text-left px-3 py-1.5 text-xs hover:bg-theme-hover transition-colors ${y?"text-status-error":"text-theme-text"}`,onClick:()=>{x(),e.onClose()},children:w});return tn.createPortal(t.jsxs("div",{ref:i,className:"fixed z-tooltip bg-theme-card border border-warm-200 dark:border-warm-700 rounded-lg shadow-elevated py-1 min-w-[200px]",style:{left:a.x,top:a.y},children:[t.jsx(C,{label:s("svn.viewDiff"),onClick:()=>e.onViewDiff(e.file.path)}),pr(e.file)!=="?"&&t.jsx(C,{label:s("svn.properties"),onClick:()=>e.onProperties(e.file.path)}),f.length>0&&t.jsx(C,{label:`${s("svn.add")}${b}`,onClick:()=>e.onAdd(f)}),o.length>0&&t.jsx(C,{label:`${s("svn.revert")}${b}`,onClick:()=>e.onRevert(o)}),c.length>0&&t.jsx(C,{label:`${s("svn.delete")}${b}`,danger:!0,onClick:()=>e.onDelete(c)}),d.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"border-t border-warm-100 dark:border-warm-700 my-1"}),t.jsx("div",{className:"px-3 py-1 text-[10px] font-semibold text-warm-400 uppercase tracking-wider",children:s("svn.resolve")}),t.jsx(C,{label:s("svn.resolveWorking"),onClick:()=>e.onResolve(d,"working")}),t.jsx(C,{label:s("svn.resolveMine"),onClick:()=>e.onResolve(d,"mine-full")}),t.jsx(C,{label:s("svn.resolveTheirs"),onClick:()=>e.onResolve(d,"theirs-full")}),t.jsx(C,{label:s("svn.resolveBase"),onClick:()=>e.onResolve(d,"base")})]}),p.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"border-t border-warm-100 dark:border-warm-700 my-1"}),t.jsx("div",{className:"px-3 py-1 text-[10px] font-semibold text-warm-400 uppercase tracking-wider",children:s("svn.moveToChangelist")}),e.changelists.map(w=>t.jsx(C,{label:`${w}${b}`,onClick:()=>e.onChangelist(w,p)},w)),t.jsx(C,{label:s("svn.newChangelist"),onClick:()=>e.onNewChangelist(p)}),u.length>0&&t.jsx(C,{label:`${s("svn.removeFromChangelist")}${b}`,onClick:()=>e.onChangelist(null,u)})]})]}),document.body)}function Z6({projectId:e,file:s,onClose:i}){const{t:a}=it(),[h,m]=k.useState(null),[f,o]=k.useState(null),[c,d]=k.useState(null),[p,u]=k.useState(""),[v,b]=k.useState(!1),[C,w]=k.useState(0);k.useEffect(()=>{let _=!1;return m(null),o(null),z6(e,s??void 0).then(S=>{_||m(S.properties)}).catch(S=>{_||o(S instanceof Error?S.message:"Failed to load properties")}),()=>{_=!0}},[e,s,C]);const x=async _=>{b(!0),o(null);try{await B6(e,_,p,s??void 0),d(null),w(S=>S+1)}catch(S){o(S instanceof Error?S.message:"Failed to save property")}finally{b(!1)}},y=s??a("svn.workingCopyRoot");return t.jsx(Fn,{open:!0,onClose:i,size:"2xl",children:t.jsxs("div",{className:"bg-theme-card rounded-lg shadow-xl w-full max-h-[80vh] flex flex-col",children:[t.jsxs("div",{className:"px-4 py-3 border-b border-warm-100 flex items-center justify-between shrink-0",children:[t.jsx("span",{className:"text-sm font-semibold text-warm-700 truncate",title:y,children:a("svn.propertiesOf").replace("{target}",y)}),t.jsx("button",{onClick:i,className:"text-warm-400 hover:text-warm-600 shrink-0 ml-2",children:"✕"})]}),t.jsxs("div",{className:"p-4 overflow-y-auto",children:[f&&t.jsx("p",{className:"text-status-error text-xs mb-2 whitespace-pre-wrap break-all",children:f}),h===null?!f&&t.jsx("p",{className:"text-warm-400 text-xs",children:a("git.loadingFiles")}):h.length===0?t.jsx("p",{className:"text-warm-400 text-xs",children:a("svn.noProperties")}):t.jsx("div",{className:"space-y-3",children:h.map(_=>t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("div",{className:"text-xs font-mono font-semibold text-accent break-all",children:_.name}),c!==_.name&&t.jsx("button",{onClick:()=>{d(_.name),u(_.value)},className:"text-2xs text-warm-400 hover:text-accent shrink-0",children:a("svn.editProperty")})]}),c===_.name?t.jsxs(t.Fragment,{children:[t.jsx("textarea",{value:p,onChange:S=>u(S.target.value),rows:Math.min(12,Math.max(3,p.split(`
|
|
@@ -646,7 +646,7 @@ WARNING: This link could potentially be dangerous`)){const y=window.open();if(y)
|
|
|
646
646
|
`,_)}paste(y){this._core.paste(y)}refresh(y,_){this._verifyIntegers(y,_),this._core.refresh(y,_)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(y){this._addonManager.loadAddon(this,y)}static get strings(){return o}_verifyIntegers(...y){for(const _ of y)if(_===1/0||isNaN(_)||_%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...y){for(const _ of y)if(_&&(_===1/0||isNaN(_)||_%1!=0||_<0))throw new Error("This API only accepts positive integers")}}f.Terminal=w})(),m})()))})(jf)),jf.exports}var l8=o8(),Nf={exports:{}},Jb;function c8(){return Jb||(Jb=1,(function(e,s){(function(i,a){e.exports=a()})(self,(()=>(()=>{var i={};return(()=>{var a=i;Object.defineProperty(a,"__esModule",{value:!0}),a.FitAddon=void 0,a.FitAddon=class{activate(h){this._terminal=h}dispose(){}fit(){const h=this.proposeDimensions();if(!h||!this._terminal||isNaN(h.cols)||isNaN(h.rows))return;const m=this._terminal._core;this._terminal.rows===h.rows&&this._terminal.cols===h.cols||(m._renderService.clear(),this._terminal.resize(h.cols,h.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const h=this._terminal._core,m=h._renderService.dimensions;if(m.css.cell.width===0||m.css.cell.height===0)return;const f=this._terminal.options.scrollback===0?0:h.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),c=parseInt(o.getPropertyValue("height")),d=Math.max(0,parseInt(o.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),u=c-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),v=d-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-f;return{cols:Math.max(2,Math.floor(v/m.css.cell.width)),rows:Math.max(1,Math.floor(u/m.css.cell.height))}}}})(),i})()))})(Nf)),Nf.exports}var u8=c8(),Ef={exports:{}},Qb;function d8(){return Qb||(Qb=1,(function(e,s){(function(i,a){e.exports=a()})(self,(()=>(()=>{var i={903:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BaseRenderLayer=void 0;const d=c(274),p=c(627),u=c(237),v=c(860),b=c(374),C=c(296),w=c(345),x=c(859),y=c(399),_=c(855);class S extends x.Disposable{get canvas(){return this._canvas}get cacheCanvas(){var j;return(j=this._charAtlas)==null?void 0:j.pages[0].canvas}constructor(j,R,L,T,A,z,O,H,F,U){super(),this._terminal=j,this._container=R,this._alpha=A,this._themeService=z,this._bufferService=O,this._optionsService=H,this._decorationService=F,this._coreBrowserService=U,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._selectionModel=(0,C.createSelectionRenderModel)(),this._bitmapGenerator=[],this._charAtlasDisposable=this.register(new x.MutableDisposable),this._onAddTextureAtlasCanvas=this.register(new w.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._cellColorResolver=new d.CellColorResolver(this._terminal,this._optionsService,this._selectionModel,this._decorationService,this._coreBrowserService,this._themeService),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${L}-layer`),this._canvas.style.zIndex=T.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._refreshCharAtlas(this._themeService.colors),this.register(this._themeService.onChangeColors((W=>{this._refreshCharAtlas(W),this.reset(),this.handleSelectionChanged(this._selectionModel.selectionStart,this._selectionModel.selectionEnd,this._selectionModel.columnSelectMode)}))),this.register((0,x.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,b.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(){}handleFocus(){}handleCursorMove(){}handleGridChanged(j,R){}handleSelectionChanged(j,R,L=!1){this._selectionModel.update(this._terminal._core,j,R,L)}_setTransparency(j){if(j===this._alpha)return;const R=this._canvas;this._alpha=j,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,R),this._refreshCharAtlas(this._themeService.colors),this.handleGridChanged(0,this._bufferService.rows-1)}_refreshCharAtlas(j){if(!(this._deviceCharWidth<=0&&this._deviceCharHeight<=0)){this._charAtlas=(0,p.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,j,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlasDisposable.value=(0,w.forwardEvent)(this._charAtlas.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),this._charAtlas.warmUp();for(let R=0;R<this._charAtlas.pages.length;R++)this._bitmapGenerator[R]=new N(this._charAtlas.pages[R].canvas)}}resize(j){this._deviceCellWidth=j.device.cell.width,this._deviceCellHeight=j.device.cell.height,this._deviceCharWidth=j.device.char.width,this._deviceCharHeight=j.device.char.height,this._deviceCharLeft=j.device.char.left,this._deviceCharTop=j.device.char.top,this._canvas.width=j.device.canvas.width,this._canvas.height=j.device.canvas.height,this._canvas.style.width=`${j.css.canvas.width}px`,this._canvas.style.height=`${j.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(this._themeService.colors)}clearTextureAtlas(){var j;(j=this._charAtlas)==null||j.clearTexture()}_fillCells(j,R,L,T){this._ctx.fillRect(j*this._deviceCellWidth,R*this._deviceCellHeight,L*this._deviceCellWidth,T*this._deviceCellHeight)}_fillMiddleLineAtCells(j,R,L=1){const T=Math.ceil(.5*this._deviceCellHeight);this._ctx.fillRect(j*this._deviceCellWidth,(R+1)*this._deviceCellHeight-T-this._coreBrowserService.dpr,L*this._deviceCellWidth,this._coreBrowserService.dpr)}_fillBottomLineAtCells(j,R,L=1,T=0){this._ctx.fillRect(j*this._deviceCellWidth,(R+1)*this._deviceCellHeight+T-this._coreBrowserService.dpr-1,L*this._deviceCellWidth,this._coreBrowserService.dpr)}_curlyUnderlineAtCell(j,R,L=1){this._ctx.save(),this._ctx.beginPath(),this._ctx.strokeStyle=this._ctx.fillStyle;const T=this._coreBrowserService.dpr;this._ctx.lineWidth=T;for(let A=0;A<L;A++){const z=(j+A)*this._deviceCellWidth,O=(j+A+.5)*this._deviceCellWidth,H=(j+A+1)*this._deviceCellWidth,F=(R+1)*this._deviceCellHeight-T-1,U=F-T,W=F+T;this._ctx.moveTo(z,F),this._ctx.bezierCurveTo(z,U,O,U,O,F),this._ctx.bezierCurveTo(O,W,H,W,H,F)}this._ctx.stroke(),this._ctx.restore()}_dottedUnderlineAtCell(j,R,L=1){this._ctx.save(),this._ctx.beginPath(),this._ctx.strokeStyle=this._ctx.fillStyle;const T=this._coreBrowserService.dpr;this._ctx.lineWidth=T,this._ctx.setLineDash([2*T,T]);const A=j*this._deviceCellWidth,z=(R+1)*this._deviceCellHeight-T-1;this._ctx.moveTo(A,z);for(let O=0;O<L;O++){const H=(j+L+O)*this._deviceCellWidth;this._ctx.lineTo(H,z)}this._ctx.stroke(),this._ctx.closePath(),this._ctx.restore()}_dashedUnderlineAtCell(j,R,L=1){this._ctx.save(),this._ctx.beginPath(),this._ctx.strokeStyle=this._ctx.fillStyle;const T=this._coreBrowserService.dpr;this._ctx.lineWidth=T,this._ctx.setLineDash([4*T,3*T]);const A=j*this._deviceCellWidth,z=(j+L)*this._deviceCellWidth,O=(R+1)*this._deviceCellHeight-T-1;this._ctx.moveTo(A,O),this._ctx.lineTo(z,O),this._ctx.stroke(),this._ctx.closePath(),this._ctx.restore()}_fillLeftLineAtCell(j,R,L){this._ctx.fillRect(j*this._deviceCellWidth,R*this._deviceCellHeight,this._coreBrowserService.dpr*L,this._deviceCellHeight)}_strokeRectAtCell(j,R,L,T){const A=this._coreBrowserService.dpr;this._ctx.lineWidth=A,this._ctx.strokeRect(j*this._deviceCellWidth+A/2,R*this._deviceCellHeight+A/2,L*this._deviceCellWidth-A,T*this._deviceCellHeight-A)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(j,R,L,T){this._alpha?this._ctx.clearRect(j*this._deviceCellWidth,R*this._deviceCellHeight,L*this._deviceCellWidth,T*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(j*this._deviceCellWidth,R*this._deviceCellHeight,L*this._deviceCellWidth,T*this._deviceCellHeight))}_fillCharTrueColor(j,R,L){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline=u.TEXT_BASELINE,this._clipRow(L);let T=!1;this._optionsService.rawOptions.customGlyphs!==!1&&(T=(0,v.tryDrawCustomChar)(this._ctx,j.getChars(),R*this._deviceCellWidth,L*this._deviceCellHeight,this._deviceCellWidth,this._deviceCellHeight,this._optionsService.rawOptions.fontSize,this._coreBrowserService.dpr)),T||this._ctx.fillText(j.getChars(),R*this._deviceCellWidth+this._deviceCharLeft,L*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_drawChars(j,R,L){var F,U,W,X;const T=j.getChars(),A=j.getCode(),z=j.getWidth();if(this._cellColorResolver.resolve(j,R,this._bufferService.buffer.ydisp+L,this._deviceCellWidth),!this._charAtlas)return;let O;if(O=T&&T.length>1?this._charAtlas.getRasterizedGlyphCombinedChar(T,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,!0):this._charAtlas.getRasterizedGlyph(j.getCode()||_.WHITESPACE_CELL_CODE,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,!0),!O.size.x||!O.size.y)return;this._ctx.save(),this._clipRow(L),this._bitmapGenerator[O.texturePage]&&this._charAtlas.pages[O.texturePage].canvas!==this._bitmapGenerator[O.texturePage].canvas&&((U=(F=this._bitmapGenerator[O.texturePage])==null?void 0:F.bitmap)==null||U.close(),delete this._bitmapGenerator[O.texturePage]),this._charAtlas.pages[O.texturePage].version!==((W=this._bitmapGenerator[O.texturePage])==null?void 0:W.version)&&(this._bitmapGenerator[O.texturePage]||(this._bitmapGenerator[O.texturePage]=new N(this._charAtlas.pages[O.texturePage].canvas)),this._bitmapGenerator[O.texturePage].refresh(),this._bitmapGenerator[O.texturePage].version=this._charAtlas.pages[O.texturePage].version);let H=O.size.x;this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,b.allowRescaling)(A,z,O.size.x,this._deviceCellWidth)&&(H=this._deviceCellWidth-1),this._ctx.drawImage(((X=this._bitmapGenerator[O.texturePage])==null?void 0:X.bitmap)||this._charAtlas.pages[O.texturePage].canvas,O.texturePosition.x,O.texturePosition.y,O.size.x,O.size.y,R*this._deviceCellWidth+this._deviceCharLeft-O.offset.x,L*this._deviceCellHeight+this._deviceCharTop-O.offset.y,H,O.size.y),this._ctx.restore()}_clipRow(j){this._ctx.beginPath(),this._ctx.rect(0,j*this._deviceCellHeight,this._bufferService.cols*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(j,R){return`${R?"italic":""} ${j?this._optionsService.rawOptions.fontWeightBold:this._optionsService.rawOptions.fontWeight} ${this._optionsService.rawOptions.fontSize*this._coreBrowserService.dpr}px ${this._optionsService.rawOptions.fontFamily}`}}o.BaseRenderLayer=S;class N{get bitmap(){return this._bitmap}constructor(j){this.canvas=j,this._state=0,this._commitTimeout=void 0,this._bitmap=void 0,this.version=-1}refresh(){var j;(j=this._bitmap)==null||j.close(),this._bitmap=void 0,y.isSafari||(this._commitTimeout===void 0&&(this._commitTimeout=window.setTimeout((()=>this._generate()),100)),this._state===1&&(this._state=2))}_generate(){var j;this._state===0&&((j=this._bitmap)==null||j.close(),this._bitmap=void 0,this._state=1,window.createImageBitmap(this.canvas).then((R=>{this._state===2?this.refresh():this._bitmap=R,this._state=0})),this._commitTimeout&&(this._commitTimeout=void 0))}}},949:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CanvasRenderer=void 0;const d=c(627),p=c(56),u=c(374),v=c(345),b=c(859),C=c(873),w=c(43),x=c(630),y=c(744);class _ extends b.Disposable{constructor(N,D,j,R,L,T,A,z,O,H,F){super(),this._terminal=N,this._screenElement=D,this._bufferService=R,this._charSizeService=L,this._optionsService=T,this._coreBrowserService=O,this._themeService=F,this._observerDisposable=this.register(new b.MutableDisposable),this._onRequestRedraw=this.register(new v.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onChangeTextureAtlas=this.register(new v.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new v.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;const U=this._optionsService.rawOptions.allowTransparency;this._renderLayers=[new y.TextRenderLayer(this._terminal,this._screenElement,0,U,this._bufferService,this._optionsService,A,H,this._coreBrowserService,F),new x.SelectionRenderLayer(this._terminal,this._screenElement,1,this._bufferService,this._coreBrowserService,H,this._optionsService,F),new w.LinkRenderLayer(this._terminal,this._screenElement,2,j,this._bufferService,this._optionsService,H,this._coreBrowserService,F),new C.CursorRenderLayer(this._terminal,this._screenElement,3,this._onRequestRedraw,this._bufferService,this._optionsService,z,this._coreBrowserService,H,F)];for(const W of this._renderLayers)(0,v.forwardEvent)(W.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas);this.dimensions=(0,u.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._observerDisposable.value=(0,p.observeDevicePixelDimensions)(this._renderLayers[0].canvas,this._coreBrowserService.window,((W,X)=>this._setCanvasDevicePixelDimensions(W,X))),this.register(this._coreBrowserService.onWindowChange((W=>{this._observerDisposable.value=(0,p.observeDevicePixelDimensions)(this._renderLayers[0].canvas,W,((X,J)=>this._setCanvasDevicePixelDimensions(X,J)))}))),this.register((0,b.toDisposable)((()=>{for(const W of this._renderLayers)W.dispose();(0,d.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){return this._renderLayers[0].cacheCanvas}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._bufferService.cols,this._bufferService.rows))}handleResize(N,D){this._updateDimensions();for(const j of this._renderLayers)j.resize(this.dimensions);this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}handleCharSizeChanged(){this.handleResize(this._bufferService.cols,this._bufferService.rows)}handleBlur(){this._runOperation((N=>N.handleBlur()))}handleFocus(){this._runOperation((N=>N.handleFocus()))}handleSelectionChanged(N,D,j=!1){this._runOperation((R=>R.handleSelectionChanged(N,D,j))),this._themeService.colors.selectionForeground&&this._onRequestRedraw.fire({start:0,end:this._bufferService.rows-1})}handleCursorMove(){this._runOperation((N=>N.handleCursorMove()))}clear(){this._runOperation((N=>N.reset()))}_runOperation(N){for(const D of this._renderLayers)N(D)}renderRows(N,D){for(const j of this._renderLayers)j.handleGridChanged(N,D)}clearTextureAtlas(){for(const N of this._renderLayers)N.clearTextureAtlas()}_updateDimensions(){if(!this._charSizeService.hasValidSize)return;const N=this._coreBrowserService.dpr;this.dimensions.device.char.width=Math.floor(this._charSizeService.width*N),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*N),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._bufferService.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._bufferService.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/N),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/N),this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows,this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols}_setCanvasDevicePixelDimensions(N,D){this.dimensions.device.canvas.height=D,this.dimensions.device.canvas.width=N;for(const j of this._renderLayers)j.resize(this.dimensions);this._requestRedrawViewport()}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._bufferService.rows-1})}}o.CanvasRenderer=_},873:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CursorRenderLayer=void 0;const d=c(457),p=c(859),u=c(399),v=c(782),b=c(903);class C extends b.BaseRenderLayer{constructor(x,y,_,S,N,D,j,R,L,T){super(x,y,"cursor",_,!0,T,N,D,L,R),this._onRequestRedraw=S,this._coreService=j,this._cursorBlinkStateManager=this.register(new p.MutableDisposable),this._cell=new v.CellData,this._state={x:0,y:0,isFocused:!1,style:"",width:0},this._cursorRenderers={bar:this._renderBarCursor.bind(this),block:this._renderBlockCursor.bind(this),underline:this._renderUnderlineCursor.bind(this),outline:this._renderOutlineCursor.bind(this)},this.register(D.onOptionChange((()=>this._handleOptionsChanged()))),this._handleOptionsChanged()}resize(x){super.resize(x),this._state={x:0,y:0,isFocused:!1,style:"",width:0}}reset(){var x;this._clearCursor(),(x=this._cursorBlinkStateManager.value)==null||x.restartBlinkAnimation(),this._handleOptionsChanged()}handleBlur(){var x;(x=this._cursorBlinkStateManager.value)==null||x.pause(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})}handleFocus(){var x;(x=this._cursorBlinkStateManager.value)==null||x.resume(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})}_handleOptionsChanged(){this._optionsService.rawOptions.cursorBlink?this._cursorBlinkStateManager.value||(this._cursorBlinkStateManager.value=new d.CursorBlinkStateManager((()=>this._render(!0)),this._coreBrowserService)):this._cursorBlinkStateManager.clear(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})}handleCursorMove(){var x;(x=this._cursorBlinkStateManager.value)==null||x.restartBlinkAnimation()}handleGridChanged(x,y){!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isPaused?this._render(!1):this._cursorBlinkStateManager.value.restartBlinkAnimation()}_render(x){if(!this._coreService.isCursorInitialized||this._coreService.isCursorHidden)return void this._clearCursor();const y=this._bufferService.buffer.ybase+this._bufferService.buffer.y,_=y-this._bufferService.buffer.ydisp;if(_<0||_>=this._bufferService.rows)return void this._clearCursor();const S=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(y).loadCell(S,this._cell),this._cell.content!==void 0){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._themeService.colors.cursor.css;const N=this._optionsService.rawOptions.cursorStyle,D=this._optionsService.rawOptions.cursorInactiveStyle;return D&&D!=="none"&&this._cursorRenderers[D](S,_,this._cell),this._ctx.restore(),this._state.x=S,this._state.y=_,this._state.isFocused=!1,this._state.style=N,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible){if(this._state){if(this._state.x===S&&this._state.y===_&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.rawOptions.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[this._optionsService.rawOptions.cursorStyle||"block"](S,_,this._cell),this._ctx.restore(),this._state.x=S,this._state.y=_,this._state.isFocused=!1,this._state.style=this._optionsService.rawOptions.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}_clearCursor(){this._state&&(u.isFirefox||this._coreBrowserService.dpr<1?this._clearAll():this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})}_renderBarCursor(x,y,_){this._ctx.save(),this._ctx.fillStyle=this._themeService.colors.cursor.css,this._fillLeftLineAtCell(x,y,this._optionsService.rawOptions.cursorWidth),this._ctx.restore()}_renderBlockCursor(x,y,_){this._ctx.save(),this._ctx.fillStyle=this._themeService.colors.cursor.css,this._fillCells(x,y,_.getWidth(),1),this._ctx.fillStyle=this._themeService.colors.cursorAccent.css,this._fillCharTrueColor(_,x,y),this._ctx.restore()}_renderUnderlineCursor(x,y,_){this._ctx.save(),this._ctx.fillStyle=this._themeService.colors.cursor.css,this._fillBottomLineAtCells(x,y),this._ctx.restore()}_renderOutlineCursor(x,y,_){this._ctx.save(),this._ctx.strokeStyle=this._themeService.colors.cursor.css,this._strokeRectAtCell(x,y,_.getWidth(),1),this._ctx.restore()}}o.CursorRenderLayer=C},574:(f,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.GridCache=void 0,o.GridCache=class{constructor(){this.cache=[]}resize(c,d){for(let p=0;p<c;p++){this.cache.length<=p&&this.cache.push([]);for(let u=this.cache[p].length;u<d;u++)this.cache[p].push(void 0);this.cache[p].length=d}this.cache.length=c}clear(){for(let c=0;c<this.cache.length;c++)for(let d=0;d<this.cache[c].length;d++)this.cache[c][d]=void 0}}},43:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkRenderLayer=void 0;const d=c(197),p=c(237),u=c(903);class v extends u.BaseRenderLayer{constructor(C,w,x,y,_,S,N,D,j){super(C,w,"link",x,!0,j,_,S,N,D),this.register(y.onShowLinkUnderline((R=>this._handleShowLinkUnderline(R)))),this.register(y.onHideLinkUnderline((R=>this._handleHideLinkUnderline(R))))}resize(C){super.resize(C),this._state=void 0}reset(){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const C=this._state.y2-this._state.y1-1;C>0&&this._clearCells(0,this._state.y1+1,this._state.cols,C),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(C){if(C.fg===p.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:C.fg&&(0,d.is256Color)(C.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[C.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,C.y1===C.y2)this._fillBottomLineAtCells(C.x1,C.y1,C.x2-C.x1);else{this._fillBottomLineAtCells(C.x1,C.y1,C.cols-C.x1);for(let w=C.y1+1;w<C.y2;w++)this._fillBottomLineAtCells(0,w,C.cols);this._fillBottomLineAtCells(0,C.y2,C.x2)}this._state=C}_handleHideLinkUnderline(C){this._clearCurrentLink()}}o.LinkRenderLayer=v},630:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionRenderLayer=void 0;const d=c(903);class p extends d.BaseRenderLayer{constructor(v,b,C,w,x,y,_,S){super(v,b,"selection",C,!0,S,w,_,y,x),this._clearState()}_clearState(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}}resize(v){super.resize(v),this._selectionModel.selectionStart&&this._selectionModel.selectionEnd&&(this._clearState(),this._redrawSelection(this._selectionModel.selectionStart,this._selectionModel.selectionEnd,this._selectionModel.columnSelectMode))}reset(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())}handleBlur(){this.reset(),this._redrawSelection(this._selectionModel.selectionStart,this._selectionModel.selectionEnd,this._selectionModel.columnSelectMode)}handleFocus(){this.reset(),this._redrawSelection(this._selectionModel.selectionStart,this._selectionModel.selectionEnd,this._selectionModel.columnSelectMode)}handleSelectionChanged(v,b,C){super.handleSelectionChanged(v,b,C),this._redrawSelection(v,b,C)}_redrawSelection(v,b,C){if(!this._didStateChange(v,b,C,this._bufferService.buffer.ydisp))return;if(this._clearAll(),!v||!b)return void this._clearState();const w=v[1]-this._bufferService.buffer.ydisp,x=b[1]-this._bufferService.buffer.ydisp,y=Math.max(w,0),_=Math.min(x,this._bufferService.rows-1);if(y>=this._bufferService.rows||_<0)this._state.ydisp=this._bufferService.buffer.ydisp;else{if(this._ctx.fillStyle=(this._coreBrowserService.isFocused?this._themeService.colors.selectionBackgroundTransparent:this._themeService.colors.selectionInactiveBackgroundTransparent).css,C){const S=v[0],N=b[0]-S,D=_-y+1;this._fillCells(S,y,N,D)}else{const S=w===y?v[0]:0,N=y===x?b[0]:this._bufferService.cols;this._fillCells(S,y,N-S,1);const D=Math.max(_-y-1,0);if(this._fillCells(0,y+1,this._bufferService.cols,D),y!==_){const j=x===_?b[0]:this._bufferService.cols;this._fillCells(0,_,j,1)}}this._state.start=[v[0],v[1]],this._state.end=[b[0],b[1]],this._state.columnSelectMode=C,this._state.ydisp=this._bufferService.buffer.ydisp}}_didStateChange(v,b,C,w){return!this._areCoordinatesEqual(v,this._state.start)||!this._areCoordinatesEqual(b,this._state.end)||C!==this._state.columnSelectMode||w!==this._state.ydisp}_areCoordinatesEqual(v,b){return!(!v||!b)&&v[0]===b[0]&&v[1]===b[1]}}o.SelectionRenderLayer=p},744:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TextRenderLayer=void 0;const d=c(577),p=c(147),u=c(782),v=c(855),b=c(903),C=c(574);class w extends b.BaseRenderLayer{constructor(y,_,S,N,D,j,R,L,T,A){super(y,_,"text",S,N,A,D,j,L,T),this._characterJoinerService=R,this._characterWidth=0,this._characterFont="",this._characterOverlapCache={},this._workCell=new u.CellData,this._state=new C.GridCache,this.register(j.onSpecificOptionChange("allowTransparency",(z=>this._setTransparency(z))))}resize(y){super.resize(y);const _=this._getFont(!1,!1);this._characterWidth===y.device.char.width&&this._characterFont===_||(this._characterWidth=y.device.char.width,this._characterFont=_,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)}reset(){this._state.clear(),this._clearAll()}_forEachCell(y,_,S){for(let N=y;N<=_;N++){const D=N+this._bufferService.buffer.ydisp,j=this._bufferService.buffer.lines.get(D),R=this._characterJoinerService.getJoinedCharacters(D);for(let L=0;L<this._bufferService.cols;L++){j.loadCell(L,this._workCell);let T=this._workCell,A=!1,z=L;if(T.getWidth()!==0){if(R.length>0&&L===R[0][0]){A=!0;const O=R.shift();T=new d.JoinedCellData(this._workCell,j.translateToString(!0,O[0],O[1]),O[1]-O[0]),z=O[1]-1}!A&&this._isOverlapping(T)&&z<j.length-1&&j.getCodePoint(z+1)===v.NULL_CELL_CODE&&(T.content&=-12582913,T.content|=8388608),S(T,L,N),L=z}}}}_drawBackground(y,_){const S=this._ctx,N=this._bufferService.cols;let D=0,j=0,R=null;S.save(),this._forEachCell(y,_,((L,T,A)=>{let z=null;L.isInverse()?z=L.isFgDefault()?this._themeService.colors.foreground.css:L.isFgRGB()?`rgb(${p.AttributeData.toColorRGB(L.getFgColor()).join(",")})`:this._themeService.colors.ansi[L.getFgColor()].css:L.isBgRGB()?z=`rgb(${p.AttributeData.toColorRGB(L.getBgColor()).join(",")})`:L.isBgPalette()&&(z=this._themeService.colors.ansi[L.getBgColor()].css);let O=!1;this._decorationService.forEachDecorationAtCell(T,this._bufferService.buffer.ydisp+A,void 0,(H=>{H.options.layer!=="top"&&O||(H.backgroundColorRGB&&(z=H.backgroundColorRGB.css),O=H.options.layer==="top")})),R===null&&(D=T,j=A),A!==j?(S.fillStyle=R||"",this._fillCells(D,j,N-D,1),D=T,j=A):R!==z&&(S.fillStyle=R||"",this._fillCells(D,j,T-D,1),D=T,j=A),R=z})),R!==null&&(S.fillStyle=R,this._fillCells(D,j,N-D,1)),S.restore()}_drawForeground(y,_){this._forEachCell(y,_,((S,N,D)=>this._drawChars(S,N,D)))}handleGridChanged(y,_){this._state.cache.length!==0&&(this._charAtlas&&this._charAtlas.beginFrame(),this._clearCells(0,y,this._bufferService.cols,_-y+1),this._drawBackground(y,_),this._drawForeground(y,_))}_isOverlapping(y){if(y.getWidth()!==1||y.getCode()<256)return!1;const _=y.getChars();if(this._characterOverlapCache.hasOwnProperty(_))return this._characterOverlapCache[_];this._ctx.save(),this._ctx.font=this._characterFont;const S=Math.floor(this._ctx.measureText(_).width)>this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[_]=S,S}}o.TextRenderLayer=w},274:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellColorResolver=void 0;const d=c(855),p=c(160),u=c(374);let v,b=0,C=0,w=!1,x=!1,y=!1,_=0;o.CellColorResolver=class{constructor(S,N,D,j,R,L){this._terminal=S,this._optionService=N,this._selectionRenderModel=D,this._decorationService=j,this._coreBrowserService=R,this._themeService=L,this.result={fg:0,bg:0,ext:0}}resolve(S,N,D,j){if(this.result.bg=S.bg,this.result.fg=S.fg,this.result.ext=268435456&S.bg?S.extended.ext:0,C=0,b=0,x=!1,w=!1,y=!1,v=this._themeService.colors,_=0,S.getCode()!==d.NULL_CELL_CODE&&S.extended.underlineStyle===4){const R=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));_=N*j%(2*Math.round(R))}if(this._decorationService.forEachDecorationAtCell(N,D,"bottom",(R=>{R.backgroundColorRGB&&(C=R.backgroundColorRGB.rgba>>8&16777215,x=!0),R.foregroundColorRGB&&(b=R.foregroundColorRGB.rgba>>8&16777215,w=!0)})),y=this._selectionRenderModel.isCellSelected(this._terminal,N,D),y){if(67108864&this.result.fg||(50331648&this.result.bg)!=0){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:C=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:C=(16777215&this.result.fg)<<8|255;break;default:C=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:C=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:C=(16777215&this.result.bg)<<8|255}C=p.rgba.blend(C,4294967040&(this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else C=(this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(x=!0,v.selectionForeground&&(b=v.selectionForeground.rgba>>8&16777215,w=!0),(0,u.treatGlyphAsBackgroundColor)(S.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)b=(this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:b=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:b=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:b=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:b=(16777215&this.result.fg)<<8|255;break;default:b=this._themeService.colors.foreground.rgba}b=p.rgba.blend(b,4294967040&(this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}w=!0}}this._decorationService.forEachDecorationAtCell(N,D,"top",(R=>{R.backgroundColorRGB&&(C=R.backgroundColorRGB.rgba>>8&16777215,x=!0),R.foregroundColorRGB&&(b=R.foregroundColorRGB.rgba>>8&16777215,w=!0)})),x&&(C=y?-16777216&S.bg&-134217729|C|50331648:-16777216&S.bg|C|50331648),w&&(b=-16777216&S.fg&-67108865|b|50331648),67108864&this.result.fg&&(x&&!w&&(b=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&v.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,w=!0),!x&&w&&(C=(50331648&this.result.fg)==0?-67108864&this.result.bg|16777215&v.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,x=!0)),v=void 0,this.result.bg=x?C:this.result.bg,this.result.fg=w?b:this.result.fg,this.result.ext&=536870911,this.result.ext|=_<<29&3758096384}}},627:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.removeTerminalFromCache=o.acquireTextureAtlas=void 0;const d=c(509),p=c(197),u=[];o.acquireTextureAtlas=function(v,b,C,w,x,y,_,S){const N=(0,p.generateConfig)(w,x,y,_,b,C,S);for(let R=0;R<u.length;R++){const L=u[R],T=L.ownedBy.indexOf(v);if(T>=0){if((0,p.configEquals)(L.config,N))return L.atlas;L.ownedBy.length===1?(L.atlas.dispose(),u.splice(R,1)):L.ownedBy.splice(T,1);break}}for(let R=0;R<u.length;R++){const L=u[R];if((0,p.configEquals)(L.config,N))return L.ownedBy.push(v),L.atlas}const D=v._core,j={atlas:new d.TextureAtlas(document,N,D.unicodeService),config:N,ownedBy:[v]};return u.push(j),j.atlas},o.removeTerminalFromCache=function(v){for(let b=0;b<u.length;b++){const C=u[b].ownedBy.indexOf(v);if(C!==-1){u[b].ownedBy.length===1?(u[b].atlas.dispose(),u.splice(b,1)):u[b].ownedBy.splice(C,1);break}}}},197:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.is256Color=o.configEquals=o.generateConfig=void 0;const d=c(160);o.generateConfig=function(p,u,v,b,C,w,x){const y={foreground:w.foreground,background:w.background,cursor:d.NULL_COLOR,cursorAccent:d.NULL_COLOR,selectionForeground:d.NULL_COLOR,selectionBackgroundTransparent:d.NULL_COLOR,selectionBackgroundOpaque:d.NULL_COLOR,selectionInactiveBackgroundTransparent:d.NULL_COLOR,selectionInactiveBackgroundOpaque:d.NULL_COLOR,ansi:w.ansi.slice(),contrastCache:w.contrastCache,halfContrastCache:w.halfContrastCache};return{customGlyphs:C.customGlyphs,devicePixelRatio:x,letterSpacing:C.letterSpacing,lineHeight:C.lineHeight,deviceCellWidth:p,deviceCellHeight:u,deviceCharWidth:v,deviceCharHeight:b,fontFamily:C.fontFamily,fontSize:C.fontSize,fontWeight:C.fontWeight,fontWeightBold:C.fontWeightBold,allowTransparency:C.allowTransparency,drawBoldTextInBrightColors:C.drawBoldTextInBrightColors,minimumContrastRatio:C.minimumContrastRatio,colors:y}},o.configEquals=function(p,u){for(let v=0;v<p.colors.ansi.length;v++)if(p.colors.ansi[v].rgba!==u.colors.ansi[v].rgba)return!1;return p.devicePixelRatio===u.devicePixelRatio&&p.customGlyphs===u.customGlyphs&&p.lineHeight===u.lineHeight&&p.letterSpacing===u.letterSpacing&&p.fontFamily===u.fontFamily&&p.fontSize===u.fontSize&&p.fontWeight===u.fontWeight&&p.fontWeightBold===u.fontWeightBold&&p.allowTransparency===u.allowTransparency&&p.deviceCharWidth===u.deviceCharWidth&&p.deviceCharHeight===u.deviceCharHeight&&p.drawBoldTextInBrightColors===u.drawBoldTextInBrightColors&&p.minimumContrastRatio===u.minimumContrastRatio&&p.colors.foreground.rgba===u.colors.foreground.rgba&&p.colors.background.rgba===u.colors.background.rgba},o.is256Color=function(p){return(50331648&p)==16777216||(50331648&p)==33554432}},237:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const d=c(399);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=d.isFirefox||d.isLegacyEdge?"bottom":"ideographic"},457:(f,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CursorBlinkStateManager=void 0,o.CursorBlinkStateManager=class{constructor(c,d){this._renderCallback=c,this._coreBrowserService=d,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))))}_restartInterval(c=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){const d=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,d>0)return void this._restartInterval(d)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){const d=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(d)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),c)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tryDrawCustomChar=o.powerlineDefinitions=o.boxDrawingDefinitions=o.blockElementDefinitions=void 0;const d=c(374);o.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const p={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};o.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(w,x)=>`M0,${.5-x} L1,${.5-x} M0,${.5+x} L1,${.5+x}`},"║":{1:(w,x)=>`M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1`},"╒":{1:(w,x)=>`M.5,1 L.5,${.5-x} L1,${.5-x} M.5,${.5+x} L1,${.5+x}`},"╓":{1:(w,x)=>`M${.5-w},1 L${.5-w},.5 L1,.5 M${.5+w},.5 L${.5+w},1`},"╔":{1:(w,x)=>`M1,${.5-x} L${.5-w},${.5-x} L${.5-w},1 M1,${.5+x} L${.5+w},${.5+x} L${.5+w},1`},"╕":{1:(w,x)=>`M0,${.5-x} L.5,${.5-x} L.5,1 M0,${.5+x} L.5,${.5+x}`},"╖":{1:(w,x)=>`M${.5+w},1 L${.5+w},.5 L0,.5 M${.5-w},.5 L${.5-w},1`},"╗":{1:(w,x)=>`M0,${.5+x} L${.5-w},${.5+x} L${.5-w},1 M0,${.5-x} L${.5+w},${.5-x} L${.5+w},1`},"╘":{1:(w,x)=>`M.5,0 L.5,${.5+x} L1,${.5+x} M.5,${.5-x} L1,${.5-x}`},"╙":{1:(w,x)=>`M1,.5 L${.5-w},.5 L${.5-w},0 M${.5+w},.5 L${.5+w},0`},"╚":{1:(w,x)=>`M1,${.5-x} L${.5+w},${.5-x} L${.5+w},0 M1,${.5+x} L${.5-w},${.5+x} L${.5-w},0`},"╛":{1:(w,x)=>`M0,${.5+x} L.5,${.5+x} L.5,0 M0,${.5-x} L.5,${.5-x}`},"╜":{1:(w,x)=>`M0,.5 L${.5+w},.5 L${.5+w},0 M${.5-w},.5 L${.5-w},0`},"╝":{1:(w,x)=>`M0,${.5-x} L${.5-w},${.5-x} L${.5-w},0 M0,${.5+x} L${.5+w},${.5+x} L${.5+w},0`},"╞":{1:(w,x)=>`M.5,0 L.5,1 M.5,${.5-x} L1,${.5-x} M.5,${.5+x} L1,${.5+x}`},"╟":{1:(w,x)=>`M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1 M${.5+w},.5 L1,.5`},"╠":{1:(w,x)=>`M${.5-w},0 L${.5-w},1 M1,${.5+x} L${.5+w},${.5+x} L${.5+w},1 M1,${.5-x} L${.5+w},${.5-x} L${.5+w},0`},"╡":{1:(w,x)=>`M.5,0 L.5,1 M0,${.5-x} L.5,${.5-x} M0,${.5+x} L.5,${.5+x}`},"╢":{1:(w,x)=>`M0,.5 L${.5-w},.5 M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1`},"╣":{1:(w,x)=>`M${.5+w},0 L${.5+w},1 M0,${.5+x} L${.5-w},${.5+x} L${.5-w},1 M0,${.5-x} L${.5-w},${.5-x} L${.5-w},0`},"╤":{1:(w,x)=>`M0,${.5-x} L1,${.5-x} M0,${.5+x} L1,${.5+x} M.5,${.5+x} L.5,1`},"╥":{1:(w,x)=>`M0,.5 L1,.5 M${.5-w},.5 L${.5-w},1 M${.5+w},.5 L${.5+w},1`},"╦":{1:(w,x)=>`M0,${.5-x} L1,${.5-x} M0,${.5+x} L${.5-w},${.5+x} L${.5-w},1 M1,${.5+x} L${.5+w},${.5+x} L${.5+w},1`},"╧":{1:(w,x)=>`M.5,0 L.5,${.5-x} M0,${.5-x} L1,${.5-x} M0,${.5+x} L1,${.5+x}`},"╨":{1:(w,x)=>`M0,.5 L1,.5 M${.5-w},.5 L${.5-w},0 M${.5+w},.5 L${.5+w},0`},"╩":{1:(w,x)=>`M0,${.5+x} L1,${.5+x} M0,${.5-x} L${.5-w},${.5-x} L${.5-w},0 M1,${.5-x} L${.5+w},${.5-x} L${.5+w},0`},"╪":{1:(w,x)=>`M.5,0 L.5,1 M0,${.5-x} L1,${.5-x} M0,${.5+x} L1,${.5+x}`},"╫":{1:(w,x)=>`M0,.5 L1,.5 M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1`},"╬":{1:(w,x)=>`M0,${.5+x} L${.5-w},${.5+x} L${.5-w},1 M1,${.5+x} L${.5+w},${.5+x} L${.5+w},1 M0,${.5-x} L${.5-w},${.5-x} L${.5-w},0 M1,${.5-x} L${.5+w},${.5-x} L${.5+w},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(w,x)=>`M.5,1 L.5,${.5+x/.15*.5} C.5,${.5+x/.15*.5},.5,.5,1,.5`},"╮":{1:(w,x)=>`M.5,1 L.5,${.5+x/.15*.5} C.5,${.5+x/.15*.5},.5,.5,0,.5`},"╯":{1:(w,x)=>`M.5,0 L.5,${.5-x/.15*.5} C.5,${.5-x/.15*.5},.5,.5,0,.5`},"╰":{1:(w,x)=>`M.5,0 L.5,${.5-x/.15*.5} C.5,${.5-x/.15*.5},.5,.5,1,.5`}},o.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},o.powerlineDefinitions[""]=o.powerlineDefinitions[""],o.powerlineDefinitions[""]=o.powerlineDefinitions[""],o.tryDrawCustomChar=function(w,x,y,_,S,N,D,j){const R=o.blockElementDefinitions[x];if(R)return(function(z,O,H,F,U,W){for(let X=0;X<O.length;X++){const J=O[X],P=U/8,B=W/8;z.fillRect(H+J.x*P,F+J.y*B,J.w*P,J.h*B)}})(w,R,y,_,S,N),!0;const L=p[x];if(L)return(function(z,O,H,F,U,W){let X=u.get(O);X||(X=new Map,u.set(O,X));const J=z.fillStyle;if(typeof J!="string")throw new Error(`Unexpected fillStyle type "${J}"`);let P=X.get(J);if(!P){const B=O[0].length,I=O.length,V=z.canvas.ownerDocument.createElement("canvas");V.width=B,V.height=I;const $=(0,d.throwIfFalsy)(V.getContext("2d")),se=new ImageData(B,I);let ue,ae,ee,Y;if(J.startsWith("#"))ue=parseInt(J.slice(1,3),16),ae=parseInt(J.slice(3,5),16),ee=parseInt(J.slice(5,7),16),Y=J.length>7&&parseInt(J.slice(7,9),16)||1;else{if(!J.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${J}" when drawing pattern glyph`);[ue,ae,ee,Y]=J.substring(5,J.length-1).split(",").map((he=>parseFloat(he)))}for(let he=0;he<I;he++)for(let de=0;de<B;de++)se.data[4*(he*B+de)]=ue,se.data[4*(he*B+de)+1]=ae,se.data[4*(he*B+de)+2]=ee,se.data[4*(he*B+de)+3]=O[he][de]*(255*Y);$.putImageData(se,0,0),P=(0,d.throwIfFalsy)(z.createPattern(V,null)),X.set(J,P)}z.fillStyle=P,z.fillRect(H,F,U,W)})(w,L,y,_,S,N),!0;const T=o.boxDrawingDefinitions[x];if(T)return(function(z,O,H,F,U,W,X){z.strokeStyle=z.fillStyle;for(const[J,P]of Object.entries(O)){let B;z.beginPath(),z.lineWidth=X*Number.parseInt(J),B=typeof P=="function"?P(.15,.15/W*U):P;for(const I of B.split(" ")){const V=I[0],$=b[V];if(!$){console.error(`Could not find drawing instructions for "${V}"`);continue}const se=I.substring(1).split(",");se[0]&&se[1]&&$(z,C(se,U,W,H,F,!0,X))}z.stroke(),z.closePath()}})(w,T,y,_,S,N,j),!0;const A=o.powerlineDefinitions[x];return!!A&&((function(z,O,H,F,U,W,X,J){const P=new Path2D;P.rect(H,F,U,W),z.clip(P),z.beginPath();const B=X/12;z.lineWidth=J*B;for(const I of O.d.split(" ")){const V=I[0],$=b[V];if(!$){console.error(`Could not find drawing instructions for "${V}"`);continue}const se=I.substring(1).split(",");se[0]&&se[1]&&$(z,C(se,U,W,H,F,!1,J,(O.leftPadding??0)*(B/2),(O.rightPadding??0)*(B/2)))}O.type===1?(z.strokeStyle=z.fillStyle,z.stroke()):z.fill(),z.closePath()})(w,A,y,_,S,N,D,j),!0)};const u=new Map;function v(w,x,y=0){return Math.max(Math.min(w,x),y)}const b={C:(w,x)=>w.bezierCurveTo(x[0],x[1],x[2],x[3],x[4],x[5]),L:(w,x)=>w.lineTo(x[0],x[1]),M:(w,x)=>w.moveTo(x[0],x[1])};function C(w,x,y,_,S,N,D,j=0,R=0){const L=w.map((T=>parseFloat(T)||parseInt(T)));if(L.length<2)throw new Error("Too few arguments for instruction");for(let T=0;T<L.length;T+=2)L[T]*=x-j*D-R*D,N&&L[T]!==0&&(L[T]=v(Math.round(L[T]+.5)-.5,x,0)),L[T]+=_+j*D;for(let T=1;T<L.length;T+=2)L[T]*=y,N&&L[T]!==0&&(L[T]=v(Math.round(L[T]+.5)-.5,y,0)),L[T]+=S;return L}},56:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.observeDevicePixelDimensions=void 0;const d=c(859);o.observeDevicePixelDimensions=function(p,u,v){let b=new u.ResizeObserver((C=>{const w=C.find((_=>_.target===p));if(!w)return;if(!("devicePixelContentBoxSize"in w))return b==null||b.disconnect(),void(b=void 0);const x=w.devicePixelContentBoxSize[0].inlineSize,y=w.devicePixelContentBoxSize[0].blockSize;x>0&&y>0&&v(x,y)}));try{b.observe(p,{box:["device-pixel-content-box"]})}catch{b.disconnect(),b=void 0}return(0,d.toDisposable)((()=>b==null?void 0:b.disconnect()))}},374:(f,o)=>{function c(p){return 57508<=p&&p<=57558}function d(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},o.isPowerlineGlyph=c,o.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},o.isEmoji=d,o.allowRescaling=function(p,u,v,b){return u===1&&v>Math.ceil(1.5*b)&&p!==void 0&&p>255&&!d(p)&&!c(p)&&!(function(C){return 57344<=C&&C<=63743})(p)},o.treatGlyphAsBackgroundColor=function(p){return c(p)||(function(u){return 9472<=u&&u<=9631})(p)},o.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},o.computeNextVariantOffset=function(p,u,v=0){return(p-(2*Math.round(u)-v))%(2*Math.round(u))}},296:(f,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createSelectionRenderModel=void 0;class c{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(p,u,v,b=!1){if(this.selectionStart=u,this.selectionEnd=v,!u||!v||u[0]===v[0]&&u[1]===v[1])return void this.clear();const C=p.buffers.active.ydisp,w=u[1]-C,x=v[1]-C,y=Math.max(w,0),_=Math.min(x,p.rows-1);y>=p.rows||_<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=b,this.viewportStartRow=w,this.viewportEndRow=x,this.viewportCappedStartRow=y,this.viewportCappedEndRow=_,this.startCol=u[0],this.endCol=v[0])}isCellSelected(p,u,v){return!!this.hasSelection&&(v-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&v>=this.viewportCappedStartRow&&u<this.endCol&&v<=this.viewportCappedEndRow:u<this.startCol&&v>=this.viewportCappedStartRow&&u>=this.endCol&&v<=this.viewportCappedEndRow:v>this.viewportStartRow&&v<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&v===this.viewportStartRow&&u>=this.startCol&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportEndRow&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportStartRow&&u>=this.startCol)}}o.createSelectionRenderModel=function(){return new c}},509:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TextureAtlas=void 0;const d=c(237),p=c(860),u=c(374),v=c(160),b=c(345),C=c(485),w=c(385),x=c(147),y=c(855),_={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let S;class N{get pages(){return this._pages}constructor(T,A,z){this._document=T,this._config=A,this._unicodeService=z,this._didWarmUp=!1,this._cacheMap=new C.FourKeyMap,this._cacheMapCombined=new C.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new x.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new b.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new b.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=R(T,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,u.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const T of this.pages)T.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const T=new w.IdleTaskQueue;for(let A=33;A<126;A++)T.enqueue((()=>{if(!this._cacheMap.get(A,y.DEFAULT_COLOR,y.DEFAULT_COLOR,y.DEFAULT_EXT)){const z=this._drawToCache(A,y.DEFAULT_COLOR,y.DEFAULT_COLOR,y.DEFAULT_EXT);this._cacheMap.set(A,y.DEFAULT_COLOR,y.DEFAULT_COLOR,y.DEFAULT_EXT,z)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const T of this._pages)T.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(N.maxAtlasPages&&this._pages.length>=Math.max(4,N.maxAtlasPages)){const A=this._pages.filter((X=>2*X.canvas.width<=(N.maxTextureSize||4096))).sort(((X,J)=>J.canvas.width!==X.canvas.width?J.canvas.width-X.canvas.width:J.percentageUsed-X.percentageUsed));let z=-1,O=0;for(let X=0;X<A.length;X++)if(A[X].canvas.width!==O)z=X,O=A[X].canvas.width;else if(X-z==3)break;const H=A.slice(z,z+4),F=H.map((X=>X.glyphs[0].texturePage)).sort(((X,J)=>X>J?1:-1)),U=this.pages.length-H.length,W=this._mergePages(H,U);W.version++;for(let X=F.length-1;X>=0;X--)this._deletePage(F[X]);this.pages.push(W),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(W.canvas)}const T=new D(this._document,this._textureSize);return this._pages.push(T),this._activePages.push(T),this._onAddTextureAtlasCanvas.fire(T.canvas),T}_mergePages(T,A){const z=2*T[0].canvas.width,O=new D(this._document,z,T);for(const[H,F]of T.entries()){const U=H*F.canvas.width%z,W=Math.floor(H/2)*F.canvas.height;O.ctx.drawImage(F.canvas,U,W);for(const J of F.glyphs)J.texturePage=A,J.sizeClipSpace.x=J.size.x/z,J.sizeClipSpace.y=J.size.y/z,J.texturePosition.x+=U,J.texturePosition.y+=W,J.texturePositionClipSpace.x=J.texturePosition.x/z,J.texturePositionClipSpace.y=J.texturePosition.y/z;this._onRemoveTextureAtlasCanvas.fire(F.canvas);const X=this._activePages.indexOf(F);X!==-1&&this._activePages.splice(X,1)}return O}_deletePage(T){this._pages.splice(T,1);for(let A=T;A<this._pages.length;A++){const z=this._pages[A];for(const O of z.glyphs)O.texturePage--;z.version++}}getRasterizedGlyphCombinedChar(T,A,z,O,H){return this._getFromCacheMap(this._cacheMapCombined,T,A,z,O,H)}getRasterizedGlyph(T,A,z,O,H){return this._getFromCacheMap(this._cacheMap,T,A,z,O,H)}_getFromCacheMap(T,A,z,O,H,F=!1){return S=T.get(A,z,O,H),S||(S=this._drawToCache(A,z,O,H,F),T.set(A,z,O,H,S)),S}_getColorFromAnsiIndex(T){if(T>=this._config.colors.ansi.length)throw new Error("No color found for idx "+T);return this._config.colors.ansi[T]}_getBackgroundColor(T,A,z,O){if(this._config.allowTransparency)return v.NULL_COLOR;let H;switch(T){case 16777216:case 33554432:H=this._getColorFromAnsiIndex(A);break;case 50331648:const F=x.AttributeData.toColorRGB(A);H=v.channels.toColor(F[0],F[1],F[2]);break;default:H=z?v.color.opaque(this._config.colors.foreground):this._config.colors.background}return H}_getForegroundColor(T,A,z,O,H,F,U,W,X,J){const P=this._getMinimumContrastColor(T,A,z,O,H,F,U,X,W,J);if(P)return P;let B;switch(H){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&X&&F<8&&(F+=8),B=this._getColorFromAnsiIndex(F);break;case 50331648:const I=x.AttributeData.toColorRGB(F);B=v.channels.toColor(I[0],I[1],I[2]);break;default:B=U?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(B=v.color.opaque(B)),W&&(B=v.color.multiplyOpacity(B,d.DIM_OPACITY)),B}_resolveBackgroundRgba(T,A,z){switch(T){case 16777216:case 33554432:return this._getColorFromAnsiIndex(A).rgba;case 50331648:return A<<8;default:return z?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(T,A,z,O){switch(T){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&O&&A<8&&(A+=8),this._getColorFromAnsiIndex(A).rgba;case 50331648:return A<<8;default:return z?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(T,A,z,O,H,F,U,W,X,J){if(this._config.minimumContrastRatio===1||J)return;const P=this._getContrastCache(X),B=P.getColor(T,O);if(B!==void 0)return B||void 0;const I=this._resolveBackgroundRgba(A,z,U),V=this._resolveForegroundRgba(H,F,U,W),$=v.rgba.ensureContrastRatio(I,V,this._config.minimumContrastRatio/(X?2:1));if(!$)return void P.setColor(T,O,null);const se=v.channels.toColor($>>24&255,$>>16&255,$>>8&255);return P.setColor(T,O,se),se}_getContrastCache(T){return T?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(T,A,z,O,H=!1){const F=typeof T=="number"?String.fromCharCode(T):T,U=Math.min(this._config.deviceCellWidth*Math.max(F.length,2)+4,this._textureSize);this._tmpCanvas.width<U&&(this._tmpCanvas.width=U);const W=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<W&&(this._tmpCanvas.height=W),this._tmpCtx.save(),this._workAttributeData.fg=z,this._workAttributeData.bg=A,this._workAttributeData.extended.ext=O,this._workAttributeData.isInvisible())return _;const X=!!this._workAttributeData.isBold(),J=!!this._workAttributeData.isInverse(),P=!!this._workAttributeData.isDim(),B=!!this._workAttributeData.isItalic(),I=!!this._workAttributeData.isUnderline(),V=!!this._workAttributeData.isStrikethrough(),$=!!this._workAttributeData.isOverline();let se=this._workAttributeData.getFgColor(),ue=this._workAttributeData.getFgColorMode(),ae=this._workAttributeData.getBgColor(),ee=this._workAttributeData.getBgColorMode();if(J){const qe=se;se=ae,ae=qe;const tt=ue;ue=ee,ee=tt}const Y=this._getBackgroundColor(ee,ae,J,P);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=Y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const he=X?this._config.fontWeightBold:this._config.fontWeight,de=B?"italic":"";this._tmpCtx.font=`${de} ${he} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=d.TEXT_BASELINE;const ke=F.length===1&&(0,u.isPowerlineGlyph)(F.charCodeAt(0)),re=F.length===1&&(0,u.isRestrictedPowerlineGlyph)(F.charCodeAt(0)),Fe=this._getForegroundColor(A,ee,ae,z,ue,se,J,P,X,(0,u.treatGlyphAsBackgroundColor)(F.charCodeAt(0)));this._tmpCtx.fillStyle=Fe.css;const Ne=re?0:4;let Te=!1;this._config.customGlyphs!==!1&&(Te=(0,p.tryDrawCustomChar)(this._tmpCtx,F,Ne,Ne,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let be,pe=!ke;if(be=typeof T=="number"?this._unicodeService.wcwidth(T):this._unicodeService.getStringCellWidth(T),I){this._tmpCtx.save();const qe=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),tt=qe%2==1?.5:0;if(this._tmpCtx.lineWidth=qe,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())pe=!1,this._tmpCtx.strokeStyle=`rgb(${x.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{pe=!1;let K=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&K<8&&(K+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(K).css}this._tmpCtx.beginPath();const Oe=Ne,fe=Math.ceil(Ne+this._config.deviceCharHeight)-tt-(H?2*qe:0),je=fe+qe,oe=fe+2*qe;let q=this._workAttributeData.getUnderlineVariantOffset();for(let K=0;K<be;K++){this._tmpCtx.save();const Q=Oe+K*this._config.deviceCellWidth,ie=Oe+(K+1)*this._config.deviceCellWidth,te=Q+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Q,fe),this._tmpCtx.lineTo(ie,fe),this._tmpCtx.moveTo(Q,oe),this._tmpCtx.lineTo(ie,oe);break;case 3:const le=qe<=1?oe:Math.ceil(Ne+this._config.deviceCharHeight-qe/2)-tt,xe=qe<=1?fe:Math.ceil(Ne+this._config.deviceCharHeight+qe/2)-tt,Pe=new Path2D;Pe.rect(Q,fe,this._config.deviceCellWidth,oe-fe),this._tmpCtx.clip(Pe),this._tmpCtx.moveTo(Q-this._config.deviceCellWidth/2,je),this._tmpCtx.bezierCurveTo(Q-this._config.deviceCellWidth/2,xe,Q,xe,Q,je),this._tmpCtx.bezierCurveTo(Q,le,te,le,te,je),this._tmpCtx.bezierCurveTo(te,xe,ie,xe,ie,je),this._tmpCtx.bezierCurveTo(ie,le,ie+this._config.deviceCellWidth/2,le,ie+this._config.deviceCellWidth/2,je);break;case 4:const Re=q===0?0:q>=qe?2*qe-q:qe-q;q>=qe||Re===0?(this._tmpCtx.setLineDash([Math.round(qe),Math.round(qe)]),this._tmpCtx.moveTo(Q+Re,fe),this._tmpCtx.lineTo(ie,fe)):(this._tmpCtx.setLineDash([Math.round(qe),Math.round(qe)]),this._tmpCtx.moveTo(Q,fe),this._tmpCtx.lineTo(Q+Re,fe),this._tmpCtx.moveTo(Q+Re+qe,fe),this._tmpCtx.lineTo(ie,fe)),q=(0,u.computeNextVariantOffset)(ie-Q,qe,q);break;case 5:const ve=.6,$e=.3,et=ie-Q,dt=Math.floor(ve*et),Be=Math.floor($e*et),Ze=et-dt-Be;this._tmpCtx.setLineDash([dt,Be,Ze]),this._tmpCtx.moveTo(Q,fe),this._tmpCtx.lineTo(ie,fe);break;default:this._tmpCtx.moveTo(Q,fe),this._tmpCtx.lineTo(ie,fe)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Te&&this._config.fontSize>=12&&!this._config.allowTransparency&&F!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const K=this._tmpCtx.measureText(F);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in K&&K.actualBoundingBoxDescent>0){this._tmpCtx.save();const Q=new Path2D;Q.rect(Oe,fe-Math.ceil(qe/2),this._config.deviceCellWidth*be,oe-fe+Math.ceil(qe/2)),this._tmpCtx.clip(Q),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=Y.css,this._tmpCtx.strokeText(F,Ne,Ne+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if($){const qe=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),tt=qe%2==1?.5:0;this._tmpCtx.lineWidth=qe,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Ne,Ne+tt),this._tmpCtx.lineTo(Ne+this._config.deviceCharWidth*be,Ne+tt),this._tmpCtx.stroke()}if(Te||this._tmpCtx.fillText(F,Ne,Ne+this._config.deviceCharHeight),F==="_"&&!this._config.allowTransparency){let qe=j(this._tmpCtx.getImageData(Ne,Ne,this._config.deviceCellWidth,this._config.deviceCellHeight),Y,Fe,pe);if(qe)for(let tt=1;tt<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=Y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(F,Ne,Ne+this._config.deviceCharHeight-tt),qe=j(this._tmpCtx.getImageData(Ne,Ne,this._config.deviceCellWidth,this._config.deviceCellHeight),Y,Fe,pe),qe);tt++);}if(V){const qe=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),tt=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=qe,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Ne,Ne+Math.floor(this._config.deviceCharHeight/2)-tt),this._tmpCtx.lineTo(Ne+this._config.deviceCharWidth*be,Ne+Math.floor(this._config.deviceCharHeight/2)-tt),this._tmpCtx.stroke()}this._tmpCtx.restore();const Je=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Ye;if(Ye=this._config.allowTransparency?(function(qe){for(let tt=0;tt<qe.data.length;tt+=4)if(qe.data[tt+3]>0)return!1;return!0})(Je):j(Je,Y,Fe,pe),Ye)return _;const ge=this._findGlyphBoundingBox(Je,this._workBoundingBox,U,re,Te,Ne);let Ce,Ke;for(;;){if(this._activePages.length===0){const qe=this._createNewPage();Ce=qe,Ke=qe.currentRow,Ke.height=ge.size.y;break}Ce=this._activePages[this._activePages.length-1],Ke=Ce.currentRow;for(const qe of this._activePages)ge.size.y<=qe.currentRow.height&&(Ce=qe,Ke=qe.currentRow);for(let qe=this._activePages.length-1;qe>=0;qe--)for(const tt of this._activePages[qe].fixedRows)tt.height<=Ke.height&&ge.size.y<=tt.height&&(Ce=this._activePages[qe],Ke=tt);if(Ke.y+ge.size.y>=Ce.canvas.height||Ke.height>ge.size.y+2){let qe=!1;if(Ce.currentRow.y+Ce.currentRow.height+ge.size.y>=Ce.canvas.height){let tt;for(const Oe of this._activePages)if(Oe.currentRow.y+Oe.currentRow.height+ge.size.y<Oe.canvas.height){tt=Oe;break}if(tt)Ce=tt;else if(N.maxAtlasPages&&this._pages.length>=N.maxAtlasPages&&Ke.y+ge.size.y<=Ce.canvas.height&&Ke.height>=ge.size.y&&Ke.x+ge.size.x<=Ce.canvas.width)qe=!0;else{const Oe=this._createNewPage();Ce=Oe,Ke=Oe.currentRow,Ke.height=ge.size.y,qe=!0}}qe||(Ce.currentRow.height>0&&Ce.fixedRows.push(Ce.currentRow),Ke={x:0,y:Ce.currentRow.y+Ce.currentRow.height,height:ge.size.y},Ce.fixedRows.push(Ke),Ce.currentRow={x:0,y:Ke.y+Ke.height,height:0})}if(Ke.x+ge.size.x<=Ce.canvas.width)break;Ke===Ce.currentRow?(Ke.x=0,Ke.y+=Ke.height,Ke.height=0):Ce.fixedRows.splice(Ce.fixedRows.indexOf(Ke),1)}return ge.texturePage=this._pages.indexOf(Ce),ge.texturePosition.x=Ke.x,ge.texturePosition.y=Ke.y,ge.texturePositionClipSpace.x=Ke.x/Ce.canvas.width,ge.texturePositionClipSpace.y=Ke.y/Ce.canvas.height,ge.sizeClipSpace.x/=Ce.canvas.width,ge.sizeClipSpace.y/=Ce.canvas.height,Ke.height=Math.max(Ke.height,ge.size.y),Ke.x+=ge.size.x,Ce.ctx.putImageData(Je,ge.texturePosition.x-this._workBoundingBox.left,ge.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ge.size.x,ge.size.y),Ce.addGlyph(ge),Ce.version++,ge}_findGlyphBoundingBox(T,A,z,O,H,F){A.top=0;const U=O?this._config.deviceCellHeight:this._tmpCanvas.height,W=O?this._config.deviceCellWidth:z;let X=!1;for(let J=0;J<U;J++){for(let P=0;P<W;P++){const B=J*this._tmpCanvas.width*4+4*P+3;if(T.data[B]!==0){A.top=J,X=!0;break}}if(X)break}A.left=0,X=!1;for(let J=0;J<F+W;J++){for(let P=0;P<U;P++){const B=P*this._tmpCanvas.width*4+4*J+3;if(T.data[B]!==0){A.left=J,X=!0;break}}if(X)break}A.right=W,X=!1;for(let J=F+W-1;J>=F;J--){for(let P=0;P<U;P++){const B=P*this._tmpCanvas.width*4+4*J+3;if(T.data[B]!==0){A.right=J,X=!0;break}}if(X)break}A.bottom=U,X=!1;for(let J=U-1;J>=0;J--){for(let P=0;P<W;P++){const B=J*this._tmpCanvas.width*4+4*P+3;if(T.data[B]!==0){A.bottom=J,X=!0;break}}if(X)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:A.right-A.left+1,y:A.bottom-A.top+1},sizeClipSpace:{x:A.right-A.left+1,y:A.bottom-A.top+1},offset:{x:-A.left+F+(O||H?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-A.top+F+(O||H?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}o.TextureAtlas=N;class D{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(T){this._glyphs.push(T),this._usedPixels+=T.size.x*T.size.y}constructor(T,A,z){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],z)for(const O of z)this._glyphs.push(...O.glyphs),this._usedPixels+=O._usedPixels;this.canvas=R(T,A,A),this.ctx=(0,u.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function j(L,T,A,z){const O=T.rgba>>>24,H=T.rgba>>>16&255,F=T.rgba>>>8&255,U=A.rgba>>>24,W=A.rgba>>>16&255,X=A.rgba>>>8&255,J=Math.floor((Math.abs(O-U)+Math.abs(H-W)+Math.abs(F-X))/12);let P=!0;for(let B=0;B<L.data.length;B+=4)L.data[B]===O&&L.data[B+1]===H&&L.data[B+2]===F||z&&Math.abs(L.data[B]-O)+Math.abs(L.data[B+1]-H)+Math.abs(L.data[B+2]-F)<J?L.data[B+3]=0:P=!1;return P}function R(L,T,A){const z=L.createElement("canvas");return z.width=T,z.height=A,z}},577:function(f,o,c){var d=this&&this.__decorate||function(y,_,S,N){var D,j=arguments.length,R=j<3?_:N===null?N=Object.getOwnPropertyDescriptor(_,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,_,S,N);else for(var L=y.length-1;L>=0;L--)(D=y[L])&&(R=(j<3?D(R):j>3?D(_,S,R):D(_,S))||R);return j>3&&R&&Object.defineProperty(_,S,R),R},p=this&&this.__param||function(y,_){return function(S,N){_(S,N,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const u=c(147),v=c(855),b=c(782),C=c(97);class w extends u.AttributeData{constructor(_,S,N){super(),this.content=0,this.combinedData="",this.fg=_.fg,this.bg=_.bg,this.combinedData=S,this._width=N}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(_){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.JoinedCellData=w;let x=o.CharacterJoinerService=class b_{constructor(_){this._bufferService=_,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new b.CellData}register(_){const S={id:this._nextCharacterJoinerId++,handler:_};return this._characterJoiners.push(S),S.id}deregister(_){for(let S=0;S<this._characterJoiners.length;S++)if(this._characterJoiners[S].id===_)return this._characterJoiners.splice(S,1),!0;return!1}getJoinedCharacters(_){if(this._characterJoiners.length===0)return[];const S=this._bufferService.buffer.lines.get(_);if(!S||S.length===0)return[];const N=[],D=S.translateToString(!0);let j=0,R=0,L=0,T=S.getFg(0),A=S.getBg(0);for(let z=0;z<S.getTrimmedLength();z++)if(S.loadCell(z,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==T||this._workCell.bg!==A){if(z-j>1){const O=this._getJoinedRanges(D,L,R,S,j);for(let H=0;H<O.length;H++)N.push(O[H])}j=z,L=R,T=this._workCell.fg,A=this._workCell.bg}R+=this._workCell.getChars().length||v.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-j>1){const z=this._getJoinedRanges(D,L,R,S,j);for(let O=0;O<z.length;O++)N.push(z[O])}return N}_getJoinedRanges(_,S,N,D,j){const R=_.substring(S,N);let L=[];try{L=this._characterJoiners[0].handler(R)}catch(T){console.error(T)}for(let T=1;T<this._characterJoiners.length;T++)try{const A=this._characterJoiners[T].handler(R);for(let z=0;z<A.length;z++)b_._mergeRanges(L,A[z])}catch(A){console.error(A)}return this._stringRangesToCellRanges(L,D,j),L}_stringRangesToCellRanges(_,S,N){let D=0,j=!1,R=0,L=_[D];if(L){for(let T=N;T<this._bufferService.cols;T++){const A=S.getWidth(T),z=S.getString(T).length||v.WHITESPACE_CELL_CHAR.length;if(A!==0){if(!j&&L[0]<=R&&(L[0]=T,j=!0),L[1]<=R){if(L[1]=T,L=_[++D],!L)break;L[0]<=R?(L[0]=T,j=!0):j=!1}R+=z}}L&&(L[1]=this._bufferService.cols)}}static _mergeRanges(_,S){let N=!1;for(let D=0;D<_.length;D++){const j=_[D];if(N){if(S[1]<=j[0])return _[D-1][1]=S[1],_;if(S[1]<=j[1])return _[D-1][1]=Math.max(S[1],j[1]),_.splice(D,1),_;_.splice(D,1),D--}else{if(S[1]<=j[0])return _.splice(D,0,S),_;if(S[1]<=j[1])return j[0]=Math.min(S[0],j[0]),_;S[0]<j[1]&&(j[0]=Math.min(S[0],j[0]),N=!0)}}return N?_[_.length-1][1]=S[1]:_.push(S),_}};o.CharacterJoinerService=x=d([p(0,C.IBufferService)],x)},160:(f,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let c=0,d=0,p=0,u=0;var v,b,C,w,x;function y(S){const N=S.toString(16);return N.length<2?"0"+N:N}function _(S,N){return S<N?(N+.05)/(S+.05):(S+.05)/(N+.05)}o.NULL_COLOR={css:"#00000000",rgba:0},(function(S){S.toCss=function(N,D,j,R){return R!==void 0?`#${y(N)}${y(D)}${y(j)}${y(R)}`:`#${y(N)}${y(D)}${y(j)}`},S.toRgba=function(N,D,j,R=255){return(N<<24|D<<16|j<<8|R)>>>0},S.toColor=function(N,D,j,R){return{css:S.toCss(N,D,j,R),rgba:S.toRgba(N,D,j,R)}}})(v||(o.channels=v={})),(function(S){function N(D,j){return u=Math.round(255*j),[c,d,p]=x.toChannels(D.rgba),{css:v.toCss(c,d,p,u),rgba:v.toRgba(c,d,p,u)}}S.blend=function(D,j){if(u=(255&j.rgba)/255,u===1)return{css:j.css,rgba:j.rgba};const R=j.rgba>>24&255,L=j.rgba>>16&255,T=j.rgba>>8&255,A=D.rgba>>24&255,z=D.rgba>>16&255,O=D.rgba>>8&255;return c=A+Math.round((R-A)*u),d=z+Math.round((L-z)*u),p=O+Math.round((T-O)*u),{css:v.toCss(c,d,p),rgba:v.toRgba(c,d,p)}},S.isOpaque=function(D){return(255&D.rgba)==255},S.ensureContrastRatio=function(D,j,R){const L=x.ensureContrastRatio(D.rgba,j.rgba,R);if(L)return v.toColor(L>>24&255,L>>16&255,L>>8&255)},S.opaque=function(D){const j=(255|D.rgba)>>>0;return[c,d,p]=x.toChannels(j),{css:v.toCss(c,d,p),rgba:j}},S.opacity=N,S.multiplyOpacity=function(D,j){return u=255&D.rgba,N(D,u*j/255)},S.toColorRGB=function(D){return[D.rgba>>24&255,D.rgba>>16&255,D.rgba>>8&255]}})(b||(o.color=b={})),(function(S){let N,D;try{const j=document.createElement("canvas");j.width=1,j.height=1;const R=j.getContext("2d",{willReadFrequently:!0});R&&(N=R,N.globalCompositeOperation="copy",D=N.createLinearGradient(0,0,1,1))}catch{}S.toColor=function(j){if(j.match(/#[\da-f]{3,8}/i))switch(j.length){case 4:return c=parseInt(j.slice(1,2).repeat(2),16),d=parseInt(j.slice(2,3).repeat(2),16),p=parseInt(j.slice(3,4).repeat(2),16),v.toColor(c,d,p);case 5:return c=parseInt(j.slice(1,2).repeat(2),16),d=parseInt(j.slice(2,3).repeat(2),16),p=parseInt(j.slice(3,4).repeat(2),16),u=parseInt(j.slice(4,5).repeat(2),16),v.toColor(c,d,p,u);case 7:return{css:j,rgba:(parseInt(j.slice(1),16)<<8|255)>>>0};case 9:return{css:j,rgba:parseInt(j.slice(1),16)>>>0}}const R=j.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(R)return c=parseInt(R[1]),d=parseInt(R[2]),p=parseInt(R[3]),u=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),v.toColor(c,d,p,u);if(!N||!D)throw new Error("css.toColor: Unsupported css format");if(N.fillStyle=D,N.fillStyle=j,typeof N.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(N.fillRect(0,0,1,1),[c,d,p,u]=N.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:v.toRgba(c,d,p,u),css:j}}})(C||(o.css=C={})),(function(S){function N(D,j,R){const L=D/255,T=j/255,A=R/255;return .2126*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.7152*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.0722*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))}S.relativeLuminance=function(D){return N(D>>16&255,D>>8&255,255&D)},S.relativeLuminance2=N})(w||(o.rgb=w={})),(function(S){function N(j,R,L){const T=j>>24&255,A=j>>16&255,z=j>>8&255;let O=R>>24&255,H=R>>16&255,F=R>>8&255,U=_(w.relativeLuminance2(O,H,F),w.relativeLuminance2(T,A,z));for(;U<L&&(O>0||H>0||F>0);)O-=Math.max(0,Math.ceil(.1*O)),H-=Math.max(0,Math.ceil(.1*H)),F-=Math.max(0,Math.ceil(.1*F)),U=_(w.relativeLuminance2(O,H,F),w.relativeLuminance2(T,A,z));return(O<<24|H<<16|F<<8|255)>>>0}function D(j,R,L){const T=j>>24&255,A=j>>16&255,z=j>>8&255;let O=R>>24&255,H=R>>16&255,F=R>>8&255,U=_(w.relativeLuminance2(O,H,F),w.relativeLuminance2(T,A,z));for(;U<L&&(O<255||H<255||F<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),H=Math.min(255,H+Math.ceil(.1*(255-H))),F=Math.min(255,F+Math.ceil(.1*(255-F))),U=_(w.relativeLuminance2(O,H,F),w.relativeLuminance2(T,A,z));return(O<<24|H<<16|F<<8|255)>>>0}S.blend=function(j,R){if(u=(255&R)/255,u===1)return R;const L=R>>24&255,T=R>>16&255,A=R>>8&255,z=j>>24&255,O=j>>16&255,H=j>>8&255;return c=z+Math.round((L-z)*u),d=O+Math.round((T-O)*u),p=H+Math.round((A-H)*u),v.toRgba(c,d,p)},S.ensureContrastRatio=function(j,R,L){const T=w.relativeLuminance(j>>8),A=w.relativeLuminance(R>>8);if(_(T,A)<L){if(A<T){const H=N(j,R,L),F=_(T,w.relativeLuminance(H>>8));if(F<L){const U=D(j,R,L);return F>_(T,w.relativeLuminance(U>>8))?H:U}return H}const z=D(j,R,L),O=_(T,w.relativeLuminance(z>>8));if(O<L){const H=N(j,R,L);return O>_(T,w.relativeLuminance(H>>8))?z:H}return z}},S.reduceLuminance=N,S.increaseLuminance=D,S.toChannels=function(j){return[j>>24&255,j>>16&255,j>>8&255,255&j]}})(x||(o.rgba=x={})),o.toPaddedHex=y,o.contrastRatio=_},345:(f,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let d=0;d<this._listeners.length;d++)if(this._listeners[d]===c)return void this._listeners.splice(d,1)}}})),this._event}fire(c,d){const p=[];for(let u=0;u<this._listeners.length;u++)p.push(this._listeners[u]);for(let u=0;u<p.length;u++)p[u].call(void 0,c,d)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},o.forwardEvent=function(c,d){return c((p=>d.fire(p)))},o.runAndSubscribe=function(c,d){return d(void 0),c((p=>d(p)))}},859:(f,o)=>{function c(d){for(const p of d)p.dispose();d.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const d of this._disposables)d.dispose();this._disposables.length=0}register(d){return this._disposables.push(d),d}unregister(d){const p=this._disposables.indexOf(d);p!==-1&&this._disposables.splice(p,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(d){var p;this._isDisposed||d===this._value||((p=this._value)==null||p.dispose(),this._value=d)}clear(){this.value=void 0}dispose(){var d;this._isDisposed=!0,(d=this._value)==null||d.dispose(),this._value=void 0}},o.toDisposable=function(d){return{dispose:d}},o.disposeArray=c,o.getDisposeArrayDisposable=function(d){return{dispose:()=>c(d)}}},485:(f,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class c{constructor(){this._data={}}set(p,u,v){this._data[p]||(this._data[p]={}),this._data[p][u]=v}get(p,u){return this._data[p]?this._data[p][u]:void 0}clear(){this._data={}}}o.TwoKeyMap=c,o.FourKeyMap=class{constructor(){this._data=new c}set(d,p,u,v,b){this._data.get(d,p)||this._data.set(d,p,new c),this._data.get(d,p).set(u,v,b)}get(d,p,u,v){var b;return(b=this._data.get(d,p))==null?void 0:b.get(u,v)}clear(){this._data.clear()}}},399:(f,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const c=o.isNode?"node":navigator.userAgent,d=o.isNode?"node":navigator.platform;o.isFirefox=c.includes("Firefox"),o.isLegacyEdge=c.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(c),o.getSafariVersion=function(){if(!o.isSafari)return 0;const p=c.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(d),o.isIpad=d==="iPad",o.isIphone=d==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(d),o.isLinux=d.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(c)},385:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const d=c(399);class p{constructor(){this._tasks=[],this._i=0}enqueue(b){this._tasks.push(b),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(b){this._idleCallback=void 0;let C=0,w=0,x=b.timeRemaining(),y=0;for(;this._i<this._tasks.length;){if(C=Date.now(),this._tasks[this._i]()||this._i++,C=Math.max(1,Date.now()-C),w=Math.max(C,w),y=b.timeRemaining(),1.5*w>y)return x-C<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(x-C))}ms`),void this._start();x=y}this.clear()}}class u extends p{_requestCallback(b){return setTimeout((()=>b(this._createDeadline(16))))}_cancelCallback(b){clearTimeout(b)}_createDeadline(b){const C=Date.now()+b;return{timeRemaining:()=>Math.max(0,C-Date.now())}}}o.PriorityTaskQueue=u,o.IdleTaskQueue=!d.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(v){return requestIdleCallback(v)}_cancelCallback(v){cancelIdleCallback(v)}}:u,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(v){this._queue.clear(),this._queue.enqueue(v)}flush(){this._queue.flush()}}},147:(f,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new d}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){const u=new c;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}o.AttributeData=c;class d{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){const u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,v=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=v}clone(){return new d(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=d},782:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const d=c(133),p=c(855),u=c(147);class v extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(C){const w=new v;return w.setFromCharData(C),w}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,d.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(C){this.fg=C[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(C[p.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(C[p.CHAR_DATA_CHAR_INDEX].length===2){const x=C[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=x&&x<=56319){const y=C[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=y&&y<=57343?this.content=1024*(x-55296)+y-56320+65536|C[p.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=C[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|C[p.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=C[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|C[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=v},855:(f,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},133:(f,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},o.utf32ToString=function(c,d=0,p=c.length){let u="";for(let v=d;v<p;++v){let b=c[v];b>65535?(b-=65536,u+=String.fromCharCode(55296+(b>>10))+String.fromCharCode(b%1024+56320)):u+=String.fromCharCode(b)}return u},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,d){const p=c.length;if(!p)return 0;let u=0,v=0;if(this._interim){const b=c.charCodeAt(v++);56320<=b&&b<=57343?d[u++]=1024*(this._interim-55296)+b-56320+65536:(d[u++]=this._interim,d[u++]=b),this._interim=0}for(let b=v;b<p;++b){const C=c.charCodeAt(b);if(55296<=C&&C<=56319){if(++b>=p)return this._interim=C,u;const w=c.charCodeAt(b);56320<=w&&w<=57343?d[u++]=1024*(C-55296)+w-56320+65536:(d[u++]=C,d[u++]=w)}else C!==65279&&(d[u++]=C)}return u}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,d){const p=c.length;if(!p)return 0;let u,v,b,C,w=0,x=0,y=0;if(this.interim[0]){let N=!1,D=this.interim[0];D&=(224&D)==192?31:(240&D)==224?15:7;let j,R=0;for(;(j=63&this.interim[++R])&&R<4;)D<<=6,D|=j;const L=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,T=L-R;for(;y<T;){if(y>=p)return 0;if(j=c[y++],(192&j)!=128){y--,N=!0;break}this.interim[R++]=j,D<<=6,D|=63&j}N||(L===2?D<128?y--:d[w++]=D:L===3?D<2048||D>=55296&&D<=57343||D===65279||(d[w++]=D):D<65536||D>1114111||(d[w++]=D)),this.interim.fill(0)}const _=p-4;let S=y;for(;S<p;){for(;!(!(S<_)||128&(u=c[S])||128&(v=c[S+1])||128&(b=c[S+2])||128&(C=c[S+3]));)d[w++]=u,d[w++]=v,d[w++]=b,d[w++]=C,S+=4;if(u=c[S++],u<128)d[w++]=u;else if((224&u)==192){if(S>=p)return this.interim[0]=u,w;if(v=c[S++],(192&v)!=128){S--;continue}if(x=(31&u)<<6|63&v,x<128){S--;continue}d[w++]=x}else if((240&u)==224){if(S>=p)return this.interim[0]=u,w;if(v=c[S++],(192&v)!=128){S--;continue}if(S>=p)return this.interim[0]=u,this.interim[1]=v,w;if(b=c[S++],(192&b)!=128){S--;continue}if(x=(15&u)<<12|(63&v)<<6|63&b,x<2048||x>=55296&&x<=57343||x===65279)continue;d[w++]=x}else if((248&u)==240){if(S>=p)return this.interim[0]=u,w;if(v=c[S++],(192&v)!=128){S--;continue}if(S>=p)return this.interim[0]=u,this.interim[1]=v,w;if(b=c[S++],(192&b)!=128){S--;continue}if(S>=p)return this.interim[0]=u,this.interim[1]=v,this.interim[2]=b,w;if(C=c[S++],(192&C)!=128){S--;continue}if(x=(7&u)<<18|(63&v)<<12|(63&b)<<6|63&C,x<65536||x>1114111)continue;d[w++]=x}}return w}}},776:function(f,o,c){var d=this&&this.__decorate||function(x,y,_,S){var N,D=arguments.length,j=D<3?y:S===null?S=Object.getOwnPropertyDescriptor(y,_):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(x,y,_,S);else for(var R=x.length-1;R>=0;R--)(N=x[R])&&(j=(D<3?N(j):D>3?N(y,_,j):N(y,_))||j);return D>3&&j&&Object.defineProperty(y,_,j),j},p=this&&this.__param||function(x,y){return function(_,S){y(_,S,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const u=c(859),v=c(97),b={trace:v.LogLevelEnum.TRACE,debug:v.LogLevelEnum.DEBUG,info:v.LogLevelEnum.INFO,warn:v.LogLevelEnum.WARN,error:v.LogLevelEnum.ERROR,off:v.LogLevelEnum.OFF};let C,w=o.LogService=class extends u.Disposable{get logLevel(){return this._logLevel}constructor(x){super(),this._optionsService=x,this._logLevel=v.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),C=this}_updateLogLevel(){this._logLevel=b[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(x){for(let y=0;y<x.length;y++)typeof x[y]=="function"&&(x[y]=x[y]())}_log(x,y,_){this._evalLazyOptionalParams(_),x.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+y,..._)}trace(x,...y){var _;this._logLevel<=v.LogLevelEnum.TRACE&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.trace.bind(this._optionsService.options.logger))??console.log,x,y)}debug(x,...y){var _;this._logLevel<=v.LogLevelEnum.DEBUG&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.debug.bind(this._optionsService.options.logger))??console.log,x,y)}info(x,...y){var _;this._logLevel<=v.LogLevelEnum.INFO&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.info.bind(this._optionsService.options.logger))??console.info,x,y)}warn(x,...y){var _;this._logLevel<=v.LogLevelEnum.WARN&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.warn.bind(this._optionsService.options.logger))??console.warn,x,y)}error(x,...y){var _;this._logLevel<=v.LogLevelEnum.ERROR&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.error.bind(this._optionsService.options.logger))??console.error,x,y)}};o.LogService=w=d([p(0,v.IOptionsService)],w),o.setTraceLogger=function(x){C=x},o.traceCall=function(x,y,_){if(typeof _.value!="function")throw new Error("not supported");const S=_.value;_.value=function(...N){if(C.logLevel!==v.LogLevelEnum.TRACE)return S.apply(this,N);C.trace(`GlyphRenderer#${S.name}(${N.map((j=>JSON.stringify(j))).join(", ")})`);const D=S.apply(this,N);return C.trace(`GlyphRenderer#${S.name} return`,D),D}}},726:(f,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const c="di$target",d="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(p){return p[d]||[]},o.createDecorator=function(p){if(o.serviceRegistry.has(p))return o.serviceRegistry.get(p);const u=function(v,b,C){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,x,y){x[c]===x?x[d].push({id:w,index:y}):(x[d]=[{id:w,index:y}],x[c]=x)})(u,v,C)};return u.toString=()=>p,o.serviceRegistry.set(p,u),u}},97:(f,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const d=c(726);var p;o.IBufferService=(0,d.createDecorator)("BufferService"),o.ICoreMouseService=(0,d.createDecorator)("CoreMouseService"),o.ICoreService=(0,d.createDecorator)("CoreService"),o.ICharsetService=(0,d.createDecorator)("CharsetService"),o.IInstantiationService=(0,d.createDecorator)("InstantiationService"),(function(u){u[u.TRACE=0]="TRACE",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARN=3]="WARN",u[u.ERROR=4]="ERROR",u[u.OFF=5]="OFF"})(p||(o.LogLevelEnum=p={})),o.ILogService=(0,d.createDecorator)("LogService"),o.IOptionsService=(0,d.createDecorator)("OptionsService"),o.IOscLinkService=(0,d.createDecorator)("OscLinkService"),o.IUnicodeService=(0,d.createDecorator)("UnicodeService"),o.IDecorationService=(0,d.createDecorator)("DecorationService")}},a={};function h(f){var o=a[f];if(o!==void 0)return o.exports;var c=a[f]={exports:{}};return i[f].call(c.exports,c,c.exports,h),c.exports}var m={};return(()=>{var f=m;Object.defineProperty(f,"__esModule",{value:!0}),f.CanvasAddon=void 0;const o=h(345),c=h(859),d=h(776),p=h(949);class u extends c.Disposable{constructor(){super(...arguments),this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event}get textureAtlas(){var b;return(b=this._renderer)==null?void 0:b.textureAtlas}activate(b){const C=b._core;if(!b.element)return void this.register(C.onWillOpen((()=>this.activate(b))));this._terminal=b;const w=C.coreService,x=C.optionsService,y=C.screenElement,_=C.linkifier,S=C,N=S._bufferService,D=S._renderService,j=S._characterJoinerService,R=S._charSizeService,L=S._coreBrowserService,T=S._decorationService,A=S._logService,z=S._themeService;(0,d.setTraceLogger)(A),this._renderer=new p.CanvasRenderer(b,y,_,N,R,x,j,w,L,T,z),this.register((0,o.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,o.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),D.setRenderer(this._renderer),D.handleResize(N.cols,N.rows),this.register((0,c.toDisposable)((()=>{var O;D.setRenderer(this._terminal._core._createRenderer()),D.handleResize(b.cols,b.rows),(O=this._renderer)==null||O.dispose(),this._renderer=void 0})))}clearTextureAtlas(){var b;(b=this._renderer)==null||b.clearTextureAtlas()}}f.CanvasAddon=u})(),m})()))})(Ef)),Ef.exports}var Zb=d8();const h8={background:"#0c0c0c",foreground:"#cccccc",cursor:"#f2f2f2",cursorAccent:"#0c0c0c",selectionBackground:"#264f78",black:"#0c0c0c",red:"#f14c4c",green:"#16c60c",yellow:"#cca700",blue:"#3b78ff",magenta:"#b4009e",cyan:"#61d6d6",white:"#cccccc",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#16c60c",brightYellow:"#f9f1a5",brightBlue:"#569cd6",brightMagenta:"#b4009e",brightCyan:"#9cdcfe",brightWhite:"#f2f2f2"},Tn={default:{id:"default",name:"Default",accent:"#cccccc",theme:h8},claude:{id:"claude",name:"Claude",accent:"#d97757",theme:{background:"#1a1614",foreground:"#ebe5dc",cursor:"#d97757",cursorAccent:"#1a1614",selectionBackground:"#3a2a20",black:"#1a1614",red:"#e36049",green:"#a8b545",yellow:"#d9a657",blue:"#7ea5d4",magenta:"#c688be",cyan:"#82b3a3",white:"#d6cfc4",brightBlack:"#7a6e63",brightRed:"#ed7c5e",brightGreen:"#bdc869",brightYellow:"#e8b76e",brightBlue:"#d97757",brightMagenta:"#dba5d4",brightCyan:"#9bc8b8",brightWhite:"#f5ede0"}},vercel:{id:"vercel",name:"Vercel",accent:"#ffffff",theme:{background:"#000000",foreground:"#ededed",cursor:"#ffffff",cursorAccent:"#000000",selectionBackground:"#333333",black:"#000000",red:"#ff6363",green:"#7eb38a",yellow:"#f0ce6e",blue:"#52a9ff",magenta:"#f771b9",cyan:"#79ffe1",white:"#a1a1a1",brightBlack:"#666666",brightRed:"#ff8888",brightGreen:"#a3d4ad",brightYellow:"#ffe27a",brightBlue:"#79c8ff",brightMagenta:"#ff97cf",brightCyan:"#79ffe1",brightWhite:"#ffffff"}},supabase:{id:"supabase",name:"Supabase",accent:"#3ecf8e",theme:{background:"#1c1c1c",foreground:"#ededed",cursor:"#3ecf8e",cursorAccent:"#1c1c1c",selectionBackground:"#1f4738",black:"#1c1c1c",red:"#ed7777",green:"#3ecf8e",yellow:"#e0c367",blue:"#5a9bf2",magenta:"#bd80de",cyan:"#8edbe1",white:"#cfcfcf",brightBlack:"#525252",brightRed:"#f49191",brightGreen:"#65e0a3",brightYellow:"#f0d480",brightBlue:"#82b6f7",brightMagenta:"#d2a3e8",brightCyan:"#a8e8ed",brightWhite:"#ffffff"}},stripe:{id:"stripe",name:"Stripe",accent:"#635bff",theme:{background:"#0a2540",foreground:"#f6f9fc",cursor:"#635bff",cursorAccent:"#0a2540",selectionBackground:"#2c3e60",black:"#0a2540",red:"#ff5c8a",green:"#5ad6a4",yellow:"#f9c46b",blue:"#7a73ff",magenta:"#a87dff",cyan:"#5fbed9",white:"#cfd7e3",brightBlack:"#425466",brightRed:"#ff7ca6",brightGreen:"#7ee0b6",brightYellow:"#ffd58a",brightBlue:"#9b94ff",brightMagenta:"#c5a4ff",brightCyan:"#88d3e8",brightWhite:"#ffffff"}},spotify:{id:"spotify",name:"Spotify",accent:"#1db954",theme:{background:"#121212",foreground:"#ffffff",cursor:"#1db954",cursorAccent:"#121212",selectionBackground:"#1d4d2e",black:"#121212",red:"#e07a7a",green:"#1db954",yellow:"#d4b35a",blue:"#5099d6",magenta:"#b58fd0",cyan:"#7dccd9",white:"#b3b3b3",brightBlack:"#535353",brightRed:"#f08e8e",brightGreen:"#1ed760",brightYellow:"#e8c977",brightBlue:"#74b1e3",brightMagenta:"#caaae0",brightCyan:"#9adde6",brightWhite:"#ffffff"}},ferrari:{id:"ferrari",name:"Ferrari",accent:"#ff2800",theme:{background:"#0d0d0d",foreground:"#f5f5f5",cursor:"#ff2800",cursorAccent:"#0d0d0d",selectionBackground:"#4a1410",black:"#0d0d0d",red:"#ff2800",green:"#a5b65f",yellow:"#e0c14a",blue:"#4d8fc9",magenta:"#c772a8",cyan:"#6cbac7",white:"#cfcfcf",brightBlack:"#5e5e5e",brightRed:"#ff5a3d",brightGreen:"#bdcc7d",brightYellow:"#f0d56b",brightBlue:"#6ea8db",brightMagenta:"#dc92be",brightCyan:"#8ad0db",brightWhite:"#ffffff"}},nvidia:{id:"nvidia",name:"NVIDIA",accent:"#76b900",theme:{background:"#000000",foreground:"#ffffff",cursor:"#76b900",cursorAccent:"#000000",selectionBackground:"#2d3d10",black:"#000000",red:"#e26060",green:"#76b900",yellow:"#d4b03e",blue:"#5097cc",magenta:"#b87aac",cyan:"#6ec3c5",white:"#bdbdbd",brightBlack:"#4a4a4a",brightRed:"#f08080",brightGreen:"#94d624",brightYellow:"#e6c861",brightBlue:"#6fb0e0",brightMagenta:"#d29ac8",brightCyan:"#90dde0",brightWhite:"#ffffff"}},apple:{id:"apple",name:"Apple",accent:"#0071e3",light:!0,theme:{background:"#ffffff",foreground:"#1d1d1f",cursor:"#0071e3",cursorAccent:"#ffffff",selectionBackground:"#b3d7ff",black:"#1d1d1f",red:"#d70015",green:"#248a3d",yellow:"#9a6b00",blue:"#0071e3",magenta:"#8944ab",cyan:"#008575",white:"#86868b",brightBlack:"#6e6e73",brightRed:"#ff3b30",brightGreen:"#2fa04c",brightYellow:"#bf8700",brightBlue:"#2b8fff",brightMagenta:"#af52de",brightCyan:"#00a3b4",brightWhite:"#f5f5f7"}},notion:{id:"notion",name:"Notion",accent:"#eb5757",light:!0,theme:{background:"#f7f6f3",foreground:"#37352f",cursor:"#37352f",cursorAccent:"#f7f6f3",selectionBackground:"#d3e5ef",black:"#37352f",red:"#d44c47",green:"#448361",yellow:"#cb912f",blue:"#337ea9",magenta:"#9065b0",cyan:"#0f7b6c",white:"#9b9a97",brightBlack:"#787774",brightRed:"#eb5757",brightGreen:"#4f9768",brightYellow:"#d9730d",brightBlue:"#4a94bf",brightMagenta:"#a97cc9",brightCyan:"#339588",brightWhite:"#ffffff"}},starbucks:{id:"starbucks",name:"Starbucks",accent:"#00754a",light:!0,theme:{background:"#f2f0eb",foreground:"#1e3932",cursor:"#00754a",cursorAccent:"#f2f0eb",selectionBackground:"#d4e9e2",black:"#1e3932",red:"#b3423a",green:"#00754a",yellow:"#a1721c",blue:"#3a6c8c",magenta:"#7d4a78",cyan:"#1f7a70",white:"#8a857c",brightBlack:"#5c5a54",brightRed:"#d05b4c",brightGreen:"#008248",brightYellow:"#bf8b2e",brightBlue:"#4d86a8",brightMagenta:"#9a6394",brightCyan:"#349b8f",brightWhite:"#fbf9f4"}}},ey=["default","claude","vercel","supabase","stripe","spotify","ferrari","nvidia","apple","notion","starbucks"],y_="default";function ty(e){return Tn[e]??Tn.default}const $c=Tn.default.theme;function ny(e){const s=/^#([0-9a-f]{6})$/i.exec(e.background??"");if(!s)return 1;const i=parseInt(s[1],16);return .299*(i>>16)+.587*(i>>8&255)+.114*(i&255)>128?4.5:1}function w_(e){return e.includes(`
|
|
647
647
|
`)?`\x1B[200~${e}\x1B[201~`:e}function f8(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function m8({sessionId:e,isRunning:s,subscribed:i,onFitted:a,sendMessage:h,subscribeBinary:m,onEvent:f,height:o="100%",fontSize:c=$m,theme:d,inputBlocked:p=!1,autoFocusOnMount:u=!1,onRequestRefresh:v,disableImagePaste:b=!1,onCycleTab:C}){const w=k.useRef(d);w.current=d;const x=k.useRef(p);x.current=p;const y=k.useRef(b);y.current=b;const _=k.useRef(C);_.current=C;const S=k.useRef(v);S.current=v;const N=k.useRef(null),D=k.useRef(null),j=k.useRef(null),R=k.useRef(null),L=k.useRef({cols:0,rows:0}),T=k.useRef(null),A=k.useRef(null),z=k.useRef(!1),O=k.useRef(a);O.current=a;const H=k.useRef(null),[F,U]=k.useState(!0),[W,X]=k.useState(""),J=k.useRef(X);J.current=X;const[P,B]=k.useState(null),I=k.useRef(0),V=(re,Fe,Ne)=>{const Te=++I.current,be=Date.now();B({dataUrl:re,bytes:Fe});const pe=()=>{const Je=Math.max(0,600-(Date.now()-be));setTimeout(()=>{I.current===Te&&B(null)},Je)};Ne.then(pe,pe)},$=k.useRef(V);$.current=V;const{toasts:se,warning:ue,dismiss:ae}=gl(),ee=k.useRef(ue);ee.current=ue;const[Y,he]=k.useState(null),de=k.useRef(()=>{});k.useEffect(()=>{if(!Y)return;const re=()=>he(null),Fe=Ne=>{Ne.key==="Escape"&&re()};return window.addEventListener("keydown",Fe,!0),window.addEventListener("resize",re),window.addEventListener("scroll",re,!0),()=>{window.removeEventListener("keydown",Fe,!0),window.removeEventListener("resize",re),window.removeEventListener("scroll",re,!0)}},[Y]),k.useEffect(()=>{var Re;const re=N.current;if(!re)return;const Fe=ve=>{const $e=ve.type;x.current&&$e==="session:terminal-input"||h(ve)},Ne=new l8.Terminal({fontFamily:Mt,fontSize:c,lineHeight:1,cursorBlink:s,convertEol:!1,scrollback:5e3,theme:w.current??$c,minimumContrastRatio:ny(w.current??$c),allowProposedApi:!0,macOptionIsMeta:!0}),Te=/Mac|iPhone|iPad|iPod/.test(navigator.platform);let be=0;const pe=async()=>{var $e;if(x.current){console.debug("[paste] inputBlocked → ignored");return}if(!window.isSecureContext)return;if(be=Date.now(),!y.current)try{const et=await navigator.clipboard.read();for(const dt of et){const Be=dt.types.find(Ze=>Ze.startsWith("image/"));if(Be){const Ze=await dt.getType(Be),lt=new FileReader;lt.onload=()=>{const Ie=lt.result;console.debug("[paste] image via clipboard.read(), bytes=",Ze.size);const Ee=Qw(e,Ie);Ee.catch(ot=>console.warn("[paste] pasteImage failed:",ot)),$.current(Ie,Ze.size,Ee)},lt.readAsDataURL(Ze);return}}}catch(et){console.debug("[paste] clipboard.read() rejected, falling through:",et)}let ve=null;try{ve=await navigator.clipboard.readText()}catch(et){console.warn("[paste] clipboard.readText() failed:",et)}if(ve){const et=ve.includes(`
|
|
648
648
|
`);console.debug("[paste] sending text, len=",ve.length,"multiline=",et),Fe({type:"session:terminal-input",sessionId:e,input:w_(ve)});return}try{const et=await z3(e);if(et.path){console.debug("[paste] empty browser clipboard, using OS file path:",et.path),Fe({type:"session:terminal-input",sessionId:e,input:et.path});return}}catch(et){console.debug("[paste] getClipboardImagePath failed:",et)}console.warn("[paste] no content available (text empty, no image, no file path)"),($e=ee.current)==null||$e.call(ee,"붙여넣을 내용을 클립보드에서 읽지 못했습니다. 우클릭 → 붙여넣기를 시도해 보세요.")};Ne.attachCustomKeyEventHandler(ve=>{var lt;if(ve.type!=="keydown")return!0;const $e=Te?ve.metaKey:ve.ctrlKey,et=Te?ve.ctrlKey:ve.metaKey,dt=$e&&!et&&!ve.altKey&&!ve.shiftKey,Be=$e&&!et&&!ve.altKey&&ve.shiftKey,Ze=ve.key.toLowerCase();if(Ze==="tab"&&(dt||Be)&&_.current)return ve.preventDefault(),_.current(Be?"prev":"next"),!1;if(Ze==="t"&&dt||Ze==="r"&&Be||Ze==="f5"&&!ve.ctrlKey&&!ve.metaKey&&!ve.altKey&&!ve.shiftKey)return ve.preventDefault(),!1;if(dt&&Ze==="c"){const Ie=Ne.getSelection();return Ie?(ve.preventDefault(),(lt=navigator.clipboard)==null||lt.writeText(Ie).catch(()=>{}),Ne.clearSelection(),!1):!Te}if(dt&&Ze==="v"||ve.altKey&&!ve.ctrlKey&&!ve.metaKey&&!ve.shiftKey&&Ze==="v")return ve.preventDefault(),pe(),!1;if((ve.ctrlKey||ve.metaKey)&&!ve.altKey){if(ve.key==="+"||ve.key==="=")return ve.preventDefault(),zo(e,1),!1;if(ve.key==="-"||ve.key==="_")return ve.preventDefault(),zo(e,-1),!1}return!0});const Je=new u8.FitAddon;Ne.loadAddon(Je),Ne.open(re),D.current=Ne,j.current=Je;try{const ve=new Zb.CanvasAddon;Ne.loadAddon(ve),R.current=ve}catch{R.current=null}Ne.attachCustomWheelEventHandler(ve=>!ve.ctrlKey&&!ve.metaKey?!0:(ve.preventDefault(),ve.__zoomHandled=!0,ve.deltaY!==0&&zo(e,ve.deltaY<0?1:-1),!1));const Ye=ve=>{if(ve.ctrlKey||ve.metaKey){if(ve.preventDefault(),ve.stopPropagation(),ve.deltaY===0||ve.__zoomHandled)return;zo(e,ve.deltaY<0?1:-1);return}ve.stopPropagation()};re.addEventListener("wheel",Ye,{passive:!1});const ge=window.electronAPI,Ce=(Re=ge==null?void 0:ge.onTerminalZoom)==null?void 0:Re.call(ge,ve=>{var Be;const $e=re.matches(":hover"),et=document.querySelector("[data-term-container]:hover")!==null,dt=!!Ne.textarea&&document.activeElement===Ne.textarea;(Be=ge.imeLog)==null||Be.call(ge,{reason:"zoom:recv",dir:ve,hovered:$e,anyTermHovered:et,focused:dt,path:window.location.pathname}),($e||!et&&dt)&&zo(e,ve==="in"?1:-1)});de.current=()=>{pe()};const Ke=ve=>{ve.preventDefault(),he({x:ve.clientX,y:ve.clientY,hasSelection:Ne.hasSelection()})};re.addEventListener("contextmenu",Ke);try{Je.fit()}catch{}if(u){const ve=document.activeElement;if(!(!!ve&&(ve.tagName==="INPUT"||ve.tagName==="TEXTAREA"||ve.tagName==="SELECT"||ve.isContentEditable))&&(ve===null||ve===document.body))try{Ne.focus()}catch{}}const qe=()=>{const ve=Ne.cols,$e=Ne.rows;ve===L.current.cols&&$e===L.current.rows||(L.current={cols:ve,rows:$e},h({type:"session:resize",sessionId:e,cols:ve,rows:$e}))};H.current=qe;const tt=m(e,ve=>{try{Ne.write(ve)}catch{}}),Oe=f(ve=>{ve.type==="session:replay-end"&&ve.sessionId===e&&U(!1)}),fe=()=>Date.now()-be<300,je=()=>y.current,oe=ve=>J.current(ve),q=(ve,$e,et)=>$.current(ve,$e,et),K=p8()?_8({container:re,term:Ne,sessionId:e,sendMessage:Fe}):w8({container:re,term:Ne,sessionId:e,sendMessage:Fe,isPasteAlreadyHandled:fe,isImagePasteDisabled:je,onComposingChange:oe,onImagePasted:q}),Q=100;let ie=null,te=0,le=!1;const xe={cols:Ne.cols,rows:Ne.rows},Pe=new ResizeObserver(()=>{if(ie!==null)return;const ve=Math.max(0,Q-(performance.now()-te));ie=setTimeout(()=>{ie=null,requestAnimationFrame(()=>{var et;te=performance.now();const $e=re.getBoundingClientRect();if(!($e.width===0||$e.height===0)){try{Je.fit(),(Ne.cols!==xe.cols||Ne.rows!==xe.rows)&&(xe.cols=Ne.cols,xe.rows=Ne.rows,Ne.refresh(0,Ne.rows-1))}catch{}!le&&Ne.cols>=20&&Ne.rows>=5&&(le=!0,(et=O.current)==null||et.call(O,Ne.cols,Ne.rows)),T.current&&clearTimeout(T.current),T.current=setTimeout(qe,150)}})},ve)});return Pe.observe(re),()=>{var ve;Pe.disconnect(),ie!==null&&clearTimeout(ie),T.current&&clearTimeout(T.current),A.current&&clearTimeout(A.current),re.removeEventListener("wheel",Ye),Ce==null||Ce(),re.removeEventListener("contextmenu",Ke),he(null),K(),tt(),Oe();try{h({type:"session:unsubscribe",sessionId:e})}catch{}(ve=R.current)==null||ve.dispose(),R.current=null,Ne.dispose(),D.current=null,j.current=null,H.current=null,z.current=!1}},[e]),k.useEffect(()=>{if(!i||z.current)return;z.current=!0;const re=D.current;re&&re.cols>0&&re.rows>0&&(L.current={cols:0,rows:0},h({type:"session:resize",sessionId:e,cols:re.cols,rows:re.rows})),h({type:"session:subscribe",sessionId:e})},[i,e,h]),k.useEffect(()=>{D.current&&(D.current.options.cursorBlink=s)},[s]),k.useEffect(()=>{const re=D.current,Fe=j.current;if(!re||!Fe||re.options.fontSize===c)return;if(re.options.fontSize=c,R.current){try{R.current.dispose()}catch{}R.current=null;try{const Te=new Zb.CanvasAddon;re.loadAddon(Te),R.current=Te}catch{}}if(re.buffer.active.type==="alternate"){A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{var Te;(Te=S.current)==null||Te.call(S)},500);return}try{Fe.fit(),re.refresh(0,re.rows-1)}catch{}re.cols===L.current.cols&&re.rows===L.current.rows||(A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{var Te;(Te=H.current)==null||Te.call(H)},300))},[c,e]),k.useEffect(()=>{const re=D.current;if(re){re.options.theme=d??$c,re.options.minimumContrastRatio=ny(d??$c);try{re.refresh(0,re.rows-1)}catch{}}},[d]);const ke=(d==null?void 0:d.background)??Ge.bg;return t.jsxs("div",{style:{position:"relative",background:ke,padding:12,height:o,width:"100%",boxSizing:"border-box",overflow:"hidden"},children:[F&&i&&t.jsx("div",{style:{position:"absolute",top:8,right:12,fontFamily:Mt,fontSize:11,color:Ge.dim,zIndex:1,pointerEvents:"none"},children:"loading history…"}),t.jsx("div",{ref:N,"data-term-container":!0,style:{height:"100%",width:"100%"}}),(W||P)&&t.jsxs("div",{style:{position:"absolute",right:12,bottom:12,maxWidth:"calc(100% - 24px)",display:"flex",flexDirection:"column",alignItems:"flex-end",gap:6,zIndex:2,pointerEvents:"none"},children:[P&&t.jsxs("div",{style:{padding:4,background:"rgba(0,0,0,0.72)",border:`1px solid ${Ge.separator}`,borderRadius:4,maxWidth:"100%"},children:[t.jsx("img",{src:P.dataUrl,alt:"",style:{display:"block",maxWidth:220,maxHeight:140,borderRadius:2}}),t.jsxs("div",{style:{fontFamily:Mt,fontSize:11,color:Ge.dim,marginTop:3},children:["이미지 붙여넣음 · ",f8(P.bytes)]})]}),W&&t.jsx("div",{style:{maxWidth:"100%",padding:"3px 8px",background:"rgba(0,0,0,0.72)",border:`1px solid ${Ge.separator}`,borderRadius:4,fontFamily:Mt,fontSize:Math.max(12,c),color:Ge.bright,lineHeight:1.3,whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis"},children:W})]}),t.jsx(em,{toasts:se,onDismiss:ae}),Y&&tn.createPortal((()=>{const Ne=Math.max(8,Math.min(Y.x,window.innerWidth-184-8)),Te=Math.max(8,Math.min(Y.y,window.innerHeight-116-8)),be=()=>he(null),pe=()=>{var Ce,Ke;const ge=((Ce=D.current)==null?void 0:Ce.getSelection())??"";ge&&((Ke=navigator.clipboard)==null||Ke.writeText(ge).catch(()=>{})),be()},Je=()=>{de.current(),be()},Ye=()=>{var ge;(ge=D.current)==null||ge.selectAll(),be()};return t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{position:"fixed",inset:0,zIndex:2147483646},onMouseDown:be,onContextMenu:ge=>{ge.preventDefault(),be()}}),t.jsxs("div",{role:"menu",style:{position:"fixed",left:Ne,top:Te,zIndex:2147483647,minWidth:168,background:Ge.bg,border:`1px solid ${Ge.separator}`,borderRadius:6,padding:4,fontFamily:Mt,fontSize:13,boxShadow:"0 8px 24px rgba(0,0,0,0.5)"},children:[t.jsx("button",{type:"button",disabled:!Y.hasSelection,onClick:pe,className:"w-full text-left px-3 py-1.5 rounded hover:bg-white/10 disabled:opacity-40 disabled:cursor-not-allowed",style:{color:Ge.bright},children:"복사"}),t.jsx("button",{type:"button",onClick:Je,className:"w-full text-left px-3 py-1.5 rounded hover:bg-white/10",style:{color:Ge.bright},children:"붙여넣기"}),t.jsx("button",{type:"button",onClick:Ye,className:"w-full text-left px-3 py-1.5 rounded hover:bg-white/10",style:{color:Ge.bright},children:"전체 선택"})]})]})})(),document.body)]})}function p8(){if(typeof navigator>"u")return!1;const e=navigator.userAgent;return/iPad|iPhone|iPod/.test(e)||/Mac/.test(e)&&navigator.maxTouchPoints>1||/Android/i.test(e)}const ru=[12593,12594,12596,12599,12600,12601,12609,12610,12611,12613,12614,12615,12616,12617,12618,12619,12620,12621,12622],__=[12623,12624,12625,12626,12627,12628,12629,12630,12631,12632,12633,12634,12635,12636,12637,12638,12639,12640,12641,12642,12643],sy=[0,12593,12594,12595,12596,12597,12598,12599,12601,12602,12603,12604,12605,12606,12607,12608,12609,12610,12612,12613,12614,12615,12616,12618,12619,12620,12621,12622];function S_(e){return e>=12593&&e<=12622}function k_(e){return e>=12623&&e<=12643}function g8(e){return S_(e)||k_(e)}function x8(e){return e>=44032&&e<=55203}function v8(){return{cho:-1,jung:-1,jong:0}}function hp(e){return e.cho<0&&e.jung<0&&e.jong===0}function gr(e){return hp(e)?"":e.cho>=0&&e.jung>=0?String.fromCharCode(44032+(e.cho*21+e.jung)*28+e.jong):e.cho>=0?String.fromCharCode(ru[e.cho]):e.jung>=0?String.fromCharCode(__[e.jung]):""}function ry(e){const s=gr(e);return e.cho=-1,e.jung=-1,e.jong=0,s}function b8(e,s){if(k_(s)){const i=__.indexOf(s);if(i<0)return"";if(e.cho<0&&e.jung<0||e.cho>=0&&e.jung<0)return e.jung=i,"";if(e.cho<0&&e.jung>=0){const f=gr(e);return e.jung=i,f}if(e.jong===0){const f=gr(e);return e.cho=-1,e.jung=i,e.jong=0,f}const a=sy[e.jong],h=ru.indexOf(a);e.jong=0;const m=gr(e);return h>=0?(e.cho=h,e.jung=i,e.jong=0):(e.cho=-1,e.jung=i,e.jong=0),m}if(S_(s)){const i=ru.indexOf(s),a=sy.indexOf(s);if(e.cho<0&&e.jung<0)return i>=0?(e.cho=i,""):String.fromCharCode(s);if(e.cho>=0&&e.jung<0){const m=String.fromCharCode(ru[e.cho]);return i>=0?(e.cho=i,m):(e.cho=-1,m+String.fromCharCode(s))}if(e.cho<0&&e.jung>=0){const m=gr(e);return e.jung=-1,i>=0?(e.cho=i,m):m+String.fromCharCode(s)}if(e.jong===0){if(a>0)return e.jong=a,"";const m=gr(e);return e.cho=i>=0?i:-1,e.jung=-1,e.jong=0,m}const h=gr(e);return e.cho=i>=0?i:-1,e.jung=-1,e.jong=0,i<0?h+String.fromCharCode(s):h}return""}function y8(e,s){const i=gr(e),a=s-44032;return e.cho=Math.floor(a/588),e.jung=Math.floor(a/28)%21,e.jong=a%28,i}function iy(e){return hp(e)?!1:(e.cho=-1,e.jung=-1,e.jong=0,!0)}function w8({container:e,term:s,sessionId:i,sendMessage:a,isPasteAlreadyHandled:h,isImagePasteDisabled:m,onComposingChange:f,onImagePasted:o}){let c=!1;const d=D=>{try{f==null||f(D)}catch{}};let p=null;const u=(D,j={})=>{var R,L;try{(L=(R=window.electronAPI)==null?void 0:R.imeLog)==null||L.call(R,{reason:D,path:window.location.pathname,...j})}catch{}},v=(D=!1)=>{try{const j=e.querySelector(".xterm-helper-textarea"),R=e.querySelector(".xterm-screen");if(!j||!R){D||u("pos:no-dom",{hasHelper:!!j,hasScreen:!!R});return}const L=s.cols,T=s.rows;if(L<=0||T<=0){D||u("pos:no-grid",{cols:L,rows:T});return}const A=R.getBoundingClientRect();if(A.width===0||A.height===0){D||u("pos:zero-screen",{w:A.width,h:A.height});return}const z=A.width/L,O=A.height/T,H=s.buffer.active,F=Math.min(H.cursorX,L-1),U=Math.max(0,Math.min(H.cursorY,T-1));j.style.left=`${F*z}px`,j.style.top=`${U*O}px`,j.style.width=`${Math.max(z,1)}px`,j.style.height=`${Math.max(O,1)}px`,D||u("pos:applied",{cursorX:F,cursorY:U,left:F*z,top:U*O})}catch{}};v();let b=0;const C=()=>{b||(b=requestAnimationFrame(()=>{b=0,v(!0)}))},w=s.onCursorMove(C),x=()=>{var D;c=!0,v(),d("");try{const j=document.activeElement,R=e.querySelector(".xterm-helper-textarea"),L=R==null?void 0:R.getBoundingClientRect();u("compositionstart",{activeTag:j==null?void 0:j.tagName,activeClass:j==null?void 0:j.className,activeIsHelper:!!j&&((D=j.classList)==null?void 0:D.contains("xterm-helper-textarea")),helperStyleLeft:R==null?void 0:R.style.left,helperStyleTop:R==null?void 0:R.style.top,helperRectLeft:L==null?void 0:L.left,helperRectTop:L==null?void 0:L.top,visibility:document.visibilityState,hasFocus:document.hasFocus(),cols:s.cols,rows:s.rows})}catch{}},y=D=>{d(D.data??""),u("compositionupdate",{data:D.data??""})},_=D=>{c=!1,d("");const j=D.data;u("compositionend",{data:j??"",sent:!!j}),j&&(p=j,a({type:"session:terminal-input",sessionId:i,input:j}))},S=D=>{var L,T;if(h()){D.preventDefault();return}const j=(L=D.clipboardData)==null?void 0:L.items;if(j&&!(m!=null&&m())){for(let A=0;A<j.length;A++)if(j[A].type.startsWith("image/")){D.preventDefault();const z=j[A].getAsFile();if(!z)return;const O=new FileReader;O.onload=()=>{const H=O.result;console.debug("[paste-fallback] image via paste event, bytes=",z.size);const F=Qw(i,H,z.name);F.catch(U=>console.warn("[paste-fallback] pasteImage failed:",U)),o==null||o(H,z.size,F)},O.readAsDataURL(z);return}}const R=(T=D.clipboardData)==null?void 0:T.getData("text/plain");if(R){D.preventDefault();const A=R.includes(`
|
|
649
|
-
`);console.debug("[paste-fallback] sending text, len=",R.length,"multiline=",A),a({type:"session:terminal-input",sessionId:i,input:w_(R)})}else console.debug("[paste-fallback] paste event had no usable text/image")};e.addEventListener("compositionstart",x,!0),e.addEventListener("compositionupdate",y,!0),e.addEventListener("compositionend",_,!0),e.addEventListener("paste",S,!0);const N=s.onData(D=>{if(!c){if(p!==null&&D===p){p=null;return}p=null,a({type:"session:terminal-input",sessionId:i,input:D})}});return()=>{N.dispose(),w.dispose(),b&&cancelAnimationFrame(b),e.removeEventListener("compositionstart",x,!0),e.removeEventListener("compositionupdate",y,!0),e.removeEventListener("compositionend",_,!0),e.removeEventListener("paste",S,!0),d("")}}function _8({container:e,term:s,sessionId:i,sendMessage:a}){const h=e.querySelector(".xterm-helper-textarea");let m="",f=0;h&&(m=h.style.display,f=h.tabIndex,h.style.display="none",h.tabIndex=-1),getComputedStyle(e).position==="static"&&(e.style.position="relative");const o=document.createElement("textarea");o.setAttribute("autocomplete","off"),o.setAttribute("lang","ko"),o.setAttribute("inputmode","text"),o.rows=1,Object.assign(o.style,{position:"absolute",background:"transparent",border:"none",outline:"none",padding:"0",margin:"0",fontFamily:Mt,fontSize:"16px",lineHeight:"1.2",resize:"none",overflow:"hidden",whiteSpace:"pre",caretColor:"rgba(255,255,255,0.001)",zIndex:"5"});const c=()=>{Object.assign(o.style,{inset:"0",left:"auto",top:"auto",width:"100%",height:"100%",color:"transparent"})},d=()=>{const j=e.querySelector(".xterm-screen");if(!j)return;const R=s.cols,L=s.rows;if(R<=0||L<=0)return;const T=j.clientWidth/R,A=j.clientHeight/L,z=s.buffer.active.cursorX,O=s.buffer.active.cursorY,H=j.getBoundingClientRect(),F=e.getBoundingClientRect();Object.assign(o.style,{inset:"auto",left:`${H.left-F.left+z*T}px`,top:`${H.top-F.top+O*A}px`,width:`${Math.max(T*30,240)}px`,height:`${Math.max(A,20)}px`,color:Ge.text})};c(),e.appendChild(o);let p=!1;const u=v8();let v=null;const b=()=>{v&&(clearTimeout(v),v=null)},C=j=>{j&&a({type:"session:terminal-input",sessionId:i,input:j})},w=()=>{const j=ry(u);j&&C(j)},x=()=>{const j=gr(u);o.value=j,j?d():c()},y=()=>{b(),v=setTimeout(()=>{v=null,w(),o.value="",c()},600)},_=()=>{p=!0,b(),w(),d()},S=j=>{p=!1,j.data&&C(j.data),o.value="",c()};o.addEventListener("compositionstart",_),o.addEventListener("compositionend",S);const N=j=>{if(p)return;const R=j;switch(R.inputType){case"insertCompositionText":case"insertFromComposition":return;case"deleteContentBackward":b(),iy(u)?x():(C(""),o.value="",c());return;case"insertLineBreak":case"insertParagraph":b(),w(),C("\r"),o.value="",c();return;default:if(!R.data){x();return}b();let L="";for(const T of R.data){const A=T.codePointAt(0);g8(A)?L+=b8(u,A):x8(A)?L+=y8(u,A):(L+=ry(u),L+=T)}C(L),x(),hp(u)||y()}};o.addEventListener("input",N);const D=j=>{if(p||j.isComposing)return;let R=null;switch(j.key){case"Enter":R="\r";break;case"Backspace":R="";break;case"Tab":R=" ";break;case"Escape":R="\x1B";break;case"ArrowUp":R="\x1B[A";break;case"ArrowDown":R="\x1B[B";break;case"ArrowRight":R="\x1B[C";break;case"ArrowLeft":R="\x1B[D";break;case"Home":R="\x1B[H";break;case"End":R="\x1B[F";break}if(R){if(j.preventDefault(),b(),j.key==="Backspace"){if(iy(u)){x();return}}else w();C(R),o.value="",c();return}if(j.ctrlKey&&!j.metaKey&&!j.altKey&&j.key.length===1){const L=j.key.toUpperCase().charCodeAt(0);L>=64&&L<=95&&(j.preventDefault(),b(),w(),C(String.fromCharCode(L-64)),o.value="",c())}};return o.addEventListener("keydown",D),()=>{b(),w(),o.remove(),h&&(h.style.display=m,h.tabIndex=f)}}const S8={presetId:y_},xu=new Map,qo=new Map;function C_(e){return`sessionTheme:${e}`}function k8(e){return typeof e!="string"?!1:e==="custom"||e in Tn}function ay(e){const s=xu.get(e);if(s!==void 0)return s;let i=S8;try{const a=localStorage.getItem(C_(e));if(a!==null){const h=JSON.parse(a);h&&k8(h.presetId)&&(i={presetId:h.presetId,custom:h.custom&&typeof h.custom=="object"?h.custom:void 0})}}catch{}return xu.set(e,i),i}function C8(e,s){const i=xu.get(e);if(i&&i.presetId===s.presetId&&j8(i.custom,s.custom))return;xu.set(e,s);try{localStorage.setItem(C_(e),JSON.stringify(s))}catch{}const a=qo.get(e);a&&a.forEach(h=>h(s))}function j8(e,s){return e===s?!0:!e||!s?!1:e.background===s.background&&e.foreground===s.foreground&&e.cursor===s.cursor&&e.selectionBackground===s.selectionBackground&&e.accent===s.accent}function N8(e){if(e.presetId!=="custom")return ty(e.presetId).theme;const s=ty(y_).theme,i=e.custom??{},a=i.cursor??i.accent??s.cursor;return{...s,background:i.background??s.background,foreground:i.foreground??s.foreground,cursor:a,cursorAccent:i.background??s.cursorAccent,selectionBackground:i.selectionBackground??s.selectionBackground,brightBlue:i.accent??s.brightBlue,blue:i.accent??s.blue}}function j_(e){const[s,i]=k.useState(()=>ay(e));k.useEffect(()=>{i(ay(e));let m=qo.get(e);return m||(m=new Set,qo.set(e,m)),m.add(i),()=>{const f=qo.get(e);f&&(f.delete(i),f.size===0&&qo.delete(e))}},[e]);const a=k.useCallback(m=>C8(e,m),[e]),h=k.useMemo(()=>N8(s),[s]);return[s,h,a]}function N_({session:e,visible:s,intent:i,intentNonce:a,onClose:h,sendMessage:m,subscribeBinary:f,onEvent:o,onCycleTab:c,remountKey:d=0}){const{t:p}=it(),u=e.status==="running"||i==="start"||i==="resume"?"pendingFit":"replay-only",[v,b]=k.useState(u),[C,w]=k.useState(null),[x,y]=k.useState(0),_=k.useCallback(()=>y(Y=>Y+1),[]),S=k.useRef(null),N=k.useRef(!1),D=k.useRef(a),[j,R]=k.useState(null),[L,T]=k.useState(null),[A,z]=k.useState(!1),[O,H]=k.useState(null),[F,U]=k.useState(null),W=k.useRef(e.status==="running");k.useEffect(()=>{e.status==="running"&&v!=="subscribed"&&v!=="starting"&&v!=="pendingFit"&&(W.current=!0,b("subscribed"))},[e.status,v]),k.useEffect(()=>{if(e.status==="running"||!W.current||v!=="subscribed"&&v!=="stopping")return;const Y=setTimeout(()=>h(),300);return()=>clearTimeout(Y)},[e.status,v,h]);const X=k.useCallback(async()=>{const Y=S.current;if(Y&&!N.current){N.current=!0,b("starting"),w(null),U(null);try{const he=await D3(e.id,Y,i==="resume"?{continueSession:!0}:void 0);b("subscribed"),he.pendingInitialPrompt?(R(he.pendingInitialPromptLength??0),T(null),z(!1)):(R(null),T(null))}catch(he){const de=he instanceof Error?he.message:String(he);w(de),b("error")}finally{N.current=!1}}},[e.id,i]),J=k.useCallback(async()=>{if(A){z(!1);return}if(z(!0),L===null)try{const Y=await R3(e.id);T(Y.prompt??"")}catch(Y){U(Y instanceof Error?Y.message:String(Y))}},[A,L,e.id]),P=k.useCallback(async()=>{if(!O){H("send"),U(null);try{await M3(e.id),R(null),T(null),z(!1)}catch(Y){U(Y instanceof Error?Y.message:String(Y))}finally{H(null)}}},[O,e.id]),B=k.useCallback(async()=>{if(!O){H("skip"),U(null);try{await A3(e.id),R(null),T(null),z(!1)}catch(Y){U(Y instanceof Error?Y.message:String(Y))}finally{H(null)}}},[O,e.id]);k.useEffect(()=>{if(a===D.current)return;D.current=a,(i==="start"||i==="resume")&&v==="replay-only"&&e.status!=="running"&&(S.current?X():b("pendingFit"))},[a,i,v,e.status,X]);const I=k.useCallback(()=>{S.current?X():b("pendingFit")},[X]),V=k.useCallback((Y,he)=>{S.current={cols:Y,rows:he},v==="pendingFit"&&(e.status==="running"?(W.current=!0,b("subscribed")):X())},[v,X,e.status]),$=e.status==="running",se=v==="subscribed",[ue]=Iw(e.id),[,ae]=j_(e.id),ee=v==="starting"||v==="pendingFit"?t.jsxs("div",{style:{...Uc,pointerEvents:"none"},children:[t.jsx("span",{style:{color:Ge.dim,fontFamily:Mt,fontSize:12},children:p("session.starting")||"starting…"}),t.jsx("span",{style:{color:Ge.dim,fontFamily:Mt,fontSize:10,marginTop:6},children:p("session.starting.typeAhead")||"type-ahead is captured and replayed once ready"})]}):v==="stopping"?t.jsx("div",{style:{...Uc,pointerEvents:"none"},children:t.jsx("span",{style:{color:Ge.dim,fontFamily:Mt,fontSize:12},children:p("session.stopping")||"stopping…"})}):v==="replay-only"?t.jsx("div",{style:Uc,children:t.jsxs("button",{onClick:I,style:{display:"flex",alignItems:"center",gap:8,fontFamily:Mt,fontSize:14,color:Ge.bright,background:"transparent",border:`1px solid ${Ge.separator}`,padding:"10px 22px",borderRadius:6,cursor:"pointer"},children:[t.jsx(wr,{size:16})," ",p("session.startInWindow")||"Start"]})}):v==="error"?t.jsxs("div",{style:Uc,children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:Ge.error,fontFamily:Mt,fontSize:12,marginBottom:8},children:[t.jsx(mw,{size:14})," ",p("session.startFailed")||"failed to start"]}),C&&t.jsx("div",{style:{color:Ge.dim,fontFamily:Mt,fontSize:11,marginBottom:8,maxWidth:360,textAlign:"center",wordBreak:"break-word"},children:C}),t.jsx("button",{onClick:()=>{X()},style:{fontFamily:Mt,fontSize:12,color:Ge.bright,background:"transparent",border:`1px solid ${Ge.separator}`,padding:"4px 12px",borderRadius:4,cursor:"pointer"},children:p("common.retry")||"Retry"})]}):null;return t.jsxs("div",{style:{display:s?"block":"none",position:"absolute",inset:0,background:Ge.bg},children:[t.jsx(m8,{sessionId:e.id,isRunning:$,subscribed:se,onFitted:V,sendMessage:m,subscribeBinary:f,onEvent:o,fontSize:ue,theme:ae,inputBlocked:j!==null,autoFocusOnMount:s,onRequestRefresh:_,disableImagePaste:e.cli_tool==="raw-shell",onCycleTab:c},`${d}:${x}`),ee,j!==null&&t.jsxs("div",{style:E8,children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx("span",{"aria-hidden":!0,style:{color:Ge.info,fontSize:14},children:"📋"}),t.jsxs("span",{style:{flex:1},children:[p("session.initialPrompt.ready")||"Initial prompt ready",t.jsxs("span",{style:{color:Ge.dim,marginLeft:8},children:[j.toLocaleString()," chars"]}),t.jsx("div",{style:{color:Ge.warning,fontSize:10,marginTop:2},children:p("session.initialPrompt.blocked")||"Press Send or Skip before typing — keystrokes are ignored until then."})]}),t.jsxs("button",{onClick:J,style:Tf("neutral"),title:A?p("session.initialPrompt.hidePreview")||"Hide preview":p("session.initialPrompt.preview")||"Preview",children:[A?t.jsx(Aj,{size:11}):t.jsx(pl,{size:11}),A?p("session.initialPrompt.hidePreview")||"Hide":p("session.initialPrompt.preview")||"Preview"]}),t.jsxs("button",{onClick:P,disabled:O!==null,style:Tf("primary"),children:[O==="send"?t.jsx(Pi,{size:11,style:{animation:"spin 1s linear infinite"}}):t.jsx(gN,{size:11}),p("session.initialPrompt.send")||"Send"]}),t.jsx("button",{onClick:B,disabled:O!==null,style:Tf("danger"),children:p("session.initialPrompt.skip")||"Skip"})]}),F&&t.jsx("div",{style:{color:Ge.error,fontSize:10,marginTop:4},children:F}),A&&t.jsx("pre",{style:{margin:0,marginTop:6,maxHeight:240,overflow:"auto",background:"rgba(0,0,0,0.4)",padding:8,fontFamily:Mt,fontSize:10,color:Ge.bright,whiteSpace:"pre-wrap",wordBreak:"break-word",border:`1px solid ${Ge.separator}`,borderRadius:4},children:L===null?p("session.initialPrompt.loading")||"loading…":L})]})]})}const E8={position:"absolute",top:0,left:0,right:0,background:"rgba(28,28,38,0.96)",borderBottom:`1px solid ${Ge.separator}`,borderLeft:`3px solid ${Ge.warning}`,padding:"8px 10px",color:Ge.bright,fontFamily:Mt,fontSize:11,zIndex:3,display:"flex",flexDirection:"column"};function Tf(e){const s={display:"inline-flex",alignItems:"center",gap:4,fontFamily:Mt,fontSize:10,padding:"3px 8px",borderRadius:4,cursor:"pointer",border:`1px solid ${Ge.separator}`,background:"transparent"};return e==="primary"?{...s,color:Ge.bright,borderColor:Ge.info,background:`${Ge.info}22`}:e==="danger"?{...s,color:Ge.dim}:{...s,color:Ge.bright}}const Uc={position:"absolute",inset:0,background:"rgba(12,12,12,0.85)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:1e3},oy=340;function T8({sessionId:e}){var C,w,x,y,_,S;const[s,,i]=j_(e),[a,h]=k.useState(!1),[m,f]=k.useState(!1),[o,c]=k.useState({top:0,left:0}),d=k.useRef(null),p=k.useRef(null),u=k.useCallback(()=>{if(!d.current)return;const N=d.current.getBoundingClientRect(),D=window.innerWidth,j=window.innerHeight,R=p.current;let L=N.bottom+4,T=N.right-oy;if(R){const A=R.offsetHeight,z=R.offsetWidth;T=N.right-z,T<8&&(T=8),T+z>D-8&&(T=D-8-z),L+A>j-8&&(L=Math.max(8,N.top-A-4))}else T<8&&(T=8);c({top:L,left:T}),f(!0)},[]);k.useEffect(()=>{if(!a){f(!1);return}u();const N=requestAnimationFrame(u),D=R=>{var T,A;const L=R.target;(T=d.current)!=null&&T.contains(L)||(A=p.current)!=null&&A.contains(L)||h(!1)},j=R=>{R.key==="Escape"&&h(!1)};return document.addEventListener("mousedown",D),document.addEventListener("keydown",j),window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{cancelAnimationFrame(N),document.removeEventListener("mousedown",D),document.removeEventListener("keydown",j),window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[a,u]);const v=N=>{if(N==="custom"){const D=s.custom??{background:Tn.default.theme.background,foreground:Tn.default.theme.foreground,cursor:Tn.default.theme.cursor,selectionBackground:Tn.default.theme.selectionBackground,accent:Tn.default.theme.brightBlue};i({presetId:"custom",custom:D})}else i({presetId:N,custom:s.custom})},b=N=>{const D={...s.custom??{},...N};i({presetId:"custom",custom:D})};return t.jsxs(t.Fragment,{children:[t.jsx("button",{ref:d,"data-no-drag":!0,onMouseDown:N=>N.stopPropagation(),onClick:()=>h(N=>!N),"aria-label":"terminal-theme",title:"Terminal theme",style:{background:"transparent",border:"none",color:Ge.titleText,cursor:"pointer",padding:"0 6px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,flexShrink:0,height:"100%"},children:t.jsx(Z5,{size:13})}),a&&tn.createPortal(t.jsxs("div",{ref:p,className:"z-tooltip",style:{position:"fixed",top:o.top,left:o.left,width:oy,background:"#1e1e1e",border:`1px solid ${Ge.separator}`,borderRadius:6,padding:10,fontFamily:Mt,color:Ge.text,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",opacity:m?1:0,transition:"opacity 80ms"},onMouseDown:N=>N.stopPropagation(),children:[t.jsx("div",{style:{fontSize:10,color:Ge.dim,marginBottom:6,letterSpacing:.5},children:"DARK"}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:6,marginBottom:10},children:ey.filter(N=>!Tn[N].light).map(N=>t.jsx(ly,{preset:Tn[N],selected:s.presetId===N,onClick:()=>v(N)},N))}),t.jsx("div",{style:{fontSize:10,color:Ge.dim,marginBottom:6,letterSpacing:.5},children:"LIGHT"}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:6,marginBottom:10},children:[ey.filter(N=>Tn[N].light).map(N=>t.jsx(ly,{preset:Tn[N],selected:s.presetId===N,onClick:()=>v(N)},N)),t.jsx(L8,{selected:s.presetId==="custom",accent:((C=s.custom)==null?void 0:C.accent)??Tn.default.theme.brightBlue??"#569cd6",onClick:()=>v("custom")})]}),s.presetId==="custom"&&t.jsxs("div",{style:{borderTop:`1px solid ${Ge.separator}`,paddingTop:8},children:[t.jsx("div",{style:{fontSize:10,color:Ge.dim,marginBottom:6,letterSpacing:.5},children:"CUSTOM COLORS"}),t.jsx(Fo,{label:"Background",value:((w=s.custom)==null?void 0:w.background)??Tn.default.theme.background??"#0c0c0c",onChange:N=>b({background:N})}),t.jsx(Fo,{label:"Foreground",value:((x=s.custom)==null?void 0:x.foreground)??Tn.default.theme.foreground??"#cccccc",onChange:N=>b({foreground:N})}),t.jsx(Fo,{label:"Cursor",value:((y=s.custom)==null?void 0:y.cursor)??Tn.default.theme.cursor??"#f2f2f2",onChange:N=>b({cursor:N})}),t.jsx(Fo,{label:"Selection",value:((_=s.custom)==null?void 0:_.selectionBackground)??Tn.default.theme.selectionBackground??"#264f78",onChange:N=>b({selectionBackground:N})}),t.jsx(Fo,{label:"Accent",value:((S=s.custom)==null?void 0:S.accent)??Tn.default.theme.brightBlue??"#569cd6",onChange:N=>b({accent:N})})]})]}),document.body)]})}function ly({preset:e,selected:s,onClick:i}){return t.jsxs("button",{onClick:i,style:{position:"relative",background:e.theme.background,border:`1px solid ${s?e.accent:Ge.separator}`,outline:s?`1px solid ${e.accent}`:"none",outlineOffset:-2,borderRadius:4,padding:"6px 8px",cursor:"pointer",fontFamily:Mt,fontSize:10,color:e.theme.foreground,textAlign:"left",height:52,display:"flex",flexDirection:"column",justifyContent:"space-between",overflow:"hidden"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[t.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:e.accent,flexShrink:0}}),t.jsx("span",{style:{fontWeight:600,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),s&&t.jsx(si,{size:10,style:{marginLeft:"auto",flexShrink:0}})]}),t.jsxs("div",{style:{fontSize:9,opacity:.85,fontFamily:Mt},children:[t.jsx("span",{style:{color:e.theme.green},children:"$"})," ",t.jsx("span",{style:{color:e.theme.brightBlue},children:"ls"})]})]})}function L8({selected:e,accent:s,onClick:i}){return t.jsxs("button",{onClick:i,style:{position:"relative",background:"#0c0c0c",border:`1px dashed ${e?s:Ge.separator}`,outline:e?`1px solid ${s}`:"none",outlineOffset:-2,borderRadius:4,padding:"6px 8px",cursor:"pointer",fontFamily:Mt,fontSize:10,color:Ge.text,textAlign:"left",height:52,display:"flex",flexDirection:"column",justifyContent:"space-between",overflow:"hidden"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[t.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:s,flexShrink:0}}),t.jsx("span",{style:{fontWeight:600,fontSize:11},children:"Custom"}),e&&t.jsx(si,{size:10,style:{marginLeft:"auto",flexShrink:0}})]}),t.jsx("div",{style:{fontSize:9,opacity:.7},children:"edit colors"})]})}function Fo({label:e,value:s,onChange:i}){const[a,h]=k.useState(s);k.useEffect(()=>{h(s)},[s]);const m=f=>{h(f);const o=f.startsWith("#")?f:`#${f}`;(/^#[0-9a-fA-F]{6}$/.test(o)||/^#[0-9a-fA-F]{3}$/.test(o))&&i(cy(o))};return t.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 0",fontSize:11,color:Ge.text},children:[t.jsx("span",{style:{flex:1},children:e}),t.jsx("input",{type:"text",value:a,onChange:f=>m(f.target.value),onBlur:()=>h(s),spellCheck:!1,style:{width:64,padding:"2px 4px",fontSize:10,fontFamily:Mt,color:Ge.text,background:"transparent",border:`1px solid ${Ge.separator}`,borderRadius:3}}),t.jsx("input",{type:"color",value:cy(s),onChange:f=>i(f.target.value),style:{width:28,height:22,padding:0,border:`1px solid ${Ge.separator}`,borderRadius:3,background:"transparent",cursor:"pointer"}})]})}function cy(e){return/^#[0-9a-fA-F]{6}$/.test(e)?e.toLowerCase():/^#[0-9a-fA-F]{3}$/.test(e)?("#"+e.slice(1).split("").map(s=>s+s).join("")).toLowerCase():"#000000"}const uy=360;function D8({sessionId:e,sendMessage:s}){const[i,a]=k.useState(!1),[h,m]=k.useState(!1),[f,o]=k.useState({top:0,left:0}),[c,d]=k.useState(null),[p,u]=k.useState(""),[v,b]=k.useState(!1),[C,w]=k.useState(""),[x,y]=k.useState(""),[_,S]=k.useState(!1),[N,D]=k.useState(null),j=k.useRef(null),R=k.useRef(null),L=k.useRef(null),T=k.useCallback(()=>{if(!j.current)return;const U=j.current.getBoundingClientRect(),W=window.innerWidth,X=window.innerHeight,J=R.current;let P=U.bottom+4,B=U.right-uy;if(J){const I=J.offsetHeight,V=J.offsetWidth;B=U.right-V,B<8&&(B=8),B+V>W-8&&(B=W-8-V),P+I>X-8&&(P=Math.max(8,U.top-I-4))}else B<8&&(B=8);o({top:P,left:B}),m(!0)},[]);k.useEffect(()=>{if(!i)return;let U=!1;return Bw().then(W=>{U||d(W)}).catch(W=>{U||D(W instanceof Error?W.message:"Failed to load")}),()=>{U=!0}},[i]),k.useEffect(()=>{if(!i){m(!1);return}T();const U=requestAnimationFrame(T),W=requestAnimationFrame(()=>{requestAnimationFrame(()=>{var P;return(P=L.current)==null?void 0:P.focus()})}),X=P=>{var I,V;const B=P.target;(I=j.current)!=null&&I.contains(B)||(V=R.current)!=null&&V.contains(B)||a(!1)},J=P=>{P.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",X),document.addEventListener("keydown",J),window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{cancelAnimationFrame(U),cancelAnimationFrame(W),document.removeEventListener("mousedown",X),document.removeEventListener("keydown",J),window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[i,T]),k.useEffect(()=>{i||(u(""),b(!1),w(""),y(""),D(null))},[i]);const A=k.useMemo(()=>{if(!c)return[];const U=p.trim().toLowerCase();return U?c.filter(W=>W.name.toLowerCase().includes(U)||W.command_template.toLowerCase().includes(U)):c},[c,p]),z=U=>{s({type:"session:terminal-input",sessionId:e,input:U.command_template}),a(!1)},O=U=>{U.key==="Enter"&&A.length>0&&(U.preventDefault(),z(A[0]))},H=!!C.trim()&&!!x.trim()&&!_,F=async()=>{if(H){S(!0),D(null);try{const U=await Pw({name:C.trim(),command_template:x.trim()});d(W=>W?[U,...W]:[U]),w(""),y(""),b(!1)}catch(U){D(U instanceof Error?U.message:"Failed")}finally{S(!1)}}};return t.jsxs(t.Fragment,{children:[t.jsx("button",{ref:j,"data-no-drag":!0,onMouseDown:U=>U.stopPropagation(),onClick:()=>a(U=>!U),"aria-label":"alias-inserter",title:"Insert saved command (alias)",style:R8,children:t.jsx(e5,{size:13})}),i&&tn.createPortal(t.jsxs("div",{ref:R,className:"z-tooltip",style:{position:"fixed",top:f.top,left:f.left,width:uy,background:"#1e1e1e",border:`1px solid ${Ge.separator}`,borderRadius:6,padding:10,fontFamily:Mt,color:Ge.text,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",opacity:h?1:0,transition:"opacity 80ms"},onMouseDown:U=>U.stopPropagation(),children:[t.jsx("input",{ref:L,type:"text",value:p,onChange:U=>u(U.target.value),onKeyDown:O,placeholder:"Filter aliases… (Enter inserts first match)",style:{width:"100%",boxSizing:"border-box",background:"#0c0c0c",border:`1px solid ${Ge.separator}`,borderRadius:4,color:Ge.bright,fontFamily:Mt,fontSize:11,padding:"6px 8px",outline:"none"}}),t.jsx("div",{style:{marginTop:8,maxHeight:280,overflowY:"auto"},children:c===null?t.jsx("div",{style:dy,children:"Loading…"}):A.length===0?t.jsx("div",{style:dy,children:c.length===0?"No aliases yet — add one below.":"No matches."}):A.map(U=>t.jsxs("button",{onClick:()=>z(U),style:M8,onMouseEnter:W=>W.currentTarget.style.background="rgba(255,255,255,0.06)",onMouseLeave:W=>W.currentTarget.style.background="transparent",title:`Insert: ${U.command_template}`,children:[t.jsx("span",{style:{fontSize:11,color:Ge.bright,fontWeight:600},children:U.name}),t.jsx("code",{style:{fontSize:10,color:Ge.dim,marginLeft:8,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U.command_template})]},U.id))}),t.jsx("div",{style:{borderTop:`1px solid ${Ge.separator}`,marginTop:8,paddingTop:8},children:v?t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[t.jsx("input",{type:"text",value:C,onChange:U=>w(U.target.value),placeholder:"Name (e.g. git status)",maxLength:64,style:hy}),t.jsx("input",{type:"text",value:x,onChange:U=>y(U.target.value),onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),F())},placeholder:"Command (e.g. git status -sb)",maxLength:1024,style:{...hy,fontFamily:Mt}}),N&&t.jsx("div",{style:{fontSize:10,color:"#f87171"},children:N}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:6},children:[t.jsxs("button",{type:"button",onClick:()=>{b(!1),D(null)},style:E_,children:[t.jsx(Xt,{size:10})," Cancel"]}),t.jsx("button",{type:"button",onClick:F,disabled:!H,style:{...A8,opacity:H?1:.5},children:"Save"})]})]}):t.jsxs("button",{type:"button",onClick:()=>{b(!0),D(null)},style:O8,children:[t.jsx(mn,{size:12})," New alias"]})})]}),document.body)]})}const R8={background:"transparent",border:"none",color:Ge.titleText,cursor:"pointer",padding:"0 6px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,flexShrink:0,height:"100%"},dy={fontSize:11,color:Ge.dim,padding:"12px 4px",textAlign:"center"},M8={display:"flex",alignItems:"center",width:"100%",background:"transparent",border:"none",padding:"6px 8px",cursor:"pointer",textAlign:"left",borderRadius:3,transition:"background 80ms"},hy={width:"100%",boxSizing:"border-box",background:"#0c0c0c",border:`1px solid ${Ge.separator}`,borderRadius:4,color:Ge.bright,fontSize:11,padding:"5px 7px",outline:"none"},E_={display:"inline-flex",alignItems:"center",gap:3,background:"transparent",border:`1px solid ${Ge.separator}`,color:Ge.dim,fontFamily:Mt,fontSize:10,padding:"3px 8px",borderRadius:4,cursor:"pointer"},A8={...E_,background:"rgba(86,156,214,0.13)",border:"1px solid #569cd6",color:Ge.bright},O8={display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:Ge.dim,fontFamily:Mt,fontSize:11,padding:"4px 0",cursor:"pointer"},z8=26;function fp({stack:e,path:s,groupId:i,sessionsById:a,colors:h,intents:m,onTabClick:f,onTabClose:o,onTabMouseDown:c,onPaneAutoClose:d,registerRect:p,sendMessage:u,subscribeBinary:v,onEvent:b,groupActions:C}){const{t:w}=it(),[x,,y]=Iw(e.activeTab),[_,S]=k.useState({}),N=()=>{const T=e.activeTab;T&&S(A=>({...A,[T]:(A[T]||0)+1}))},D=nO(),j=T=>{T.button===0&&e.activeTab&&(D==null||D.focus(e.activeTab)),T.stopPropagation()},R=e.tabs.length>1?T=>{const A=e.tabs.indexOf(e.activeTab);if(A<0)return;const z=e.tabs.length,O=T==="next"?(A+1)%z:(A-1+z)%z;f(e.tabs[O])}:void 0,L=T=>{const A=/Mac|iPhone|iPad|iPod/.test(navigator.platform),z=A?T.metaKey:T.ctrlKey,O=A?T.ctrlKey:T.metaKey,H=T.key==="F5"&&!T.ctrlKey&&!T.metaKey&&!T.altKey&&!T.shiftKey,F=z&&!O&&!T.altKey&&T.shiftKey&&T.key.toLowerCase()==="r";!H&&!F||(T.preventDefault(),N())};return t.jsxs("div",{onKeyDown:L,style:{flex:1,display:"flex",flexDirection:"column",background:Ge.bg,minWidth:0,minHeight:0,position:"relative",overflow:"hidden"},children:[t.jsxs("div",{style:{display:"flex",height:z8,background:Ge.titleBg,borderBottom:`1px solid ${Ge.separator}`,flexShrink:0,overflowX:"auto",overflowY:"hidden"},children:[e.tabs.map(T=>{const A=a.get(T),z=T===e.activeTab,O=h[T]||Ge.titleText;return t.jsxs("div",{onMouseDown:H=>{if(H.button===0){if(C){f(T);return}H.stopPropagation(),f(T),c(T,s,H)}},style:{display:"flex",alignItems:"center",gap:6,padding:"0 6px 0 10px",fontFamily:Mt,fontSize:11,color:z?Ge.bright:Ge.titleText,background:z?Ge.bg:"transparent",borderRight:`1px solid ${Ge.separator}`,cursor:"pointer",userSelect:"none",whiteSpace:"nowrap",maxWidth:200,position:"relative"},title:(A==null?void 0:A.title)||T,children:[t.jsx("span",{"aria-hidden":!0,style:{flexShrink:0,fontFamily:Mt,fontSize:11,fontWeight:700,letterSpacing:-.5,lineHeight:1,color:O,width:16,textAlign:"center"},children:">_"}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",flex:1},children:(A==null?void 0:A.title)||T}),t.jsx("button",{"data-no-drag":!0,onMouseDown:H=>H.stopPropagation(),onClick:H=>{H.stopPropagation(),o(T)},"aria-label":"close-tab",title:w("group.closeTab")||"Close tab",style:{background:"transparent",border:"none",color:Ge.titleText,cursor:"pointer",padding:1,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:3,flexShrink:0},children:t.jsx(Xt,{size:11})})]},T)}),D&&t.jsx("button",{"data-no-drag":!0,onMouseDown:T=>T.stopPropagation(),onClick:()=>{D.createRawShellTab(i,s).catch(()=>{})},"aria-label":"new-tab",title:`${w("group.newTab")||"New shell tab"} (Ctrl+T)`,style:{background:"transparent",border:"none",borderRight:`1px solid ${Ge.separator}`,color:Ge.titleText,cursor:"pointer",padding:"0 8px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,height:"100%"},children:t.jsx(mn,{size:13})}),t.jsx("div",{style:{flex:1,minWidth:8}}),t.jsx(D8,{sessionId:e.activeTab,sendMessage:u}),t.jsx("button",{"data-no-drag":!0,onMouseDown:T=>T.stopPropagation(),onClick:N,"aria-label":"refresh-terminal",title:`${w("session.refresh")||"Refresh rendering"} (F5 · Ctrl+Shift+R) — ${w("session.refresh.hint")||"Rebuild the terminal view (PTY stays running)"}`,style:Na,children:t.jsx(fN,{size:12})}),t.jsx("button",{"data-no-drag":!0,onMouseDown:T=>T.stopPropagation(),onClick:()=>y(-1),"aria-label":"decrease-font",title:`${w("session.fontDecrease")||"Decrease font size"} (${x}px) · Ctrl+wheel`,style:Na,children:t.jsx(zN,{size:13})}),t.jsx("button",{"data-no-drag":!0,onMouseDown:T=>T.stopPropagation(),onClick:()=>y(1),"aria-label":"increase-font",title:`${w("session.fontIncrease")||"Increase font size"} (${x}px) · Ctrl+wheel`,style:Na,children:t.jsx(AN,{size:13})}),t.jsx(T8,{sessionId:e.activeTab}),C&&t.jsxs(t.Fragment,{children:[C.onPopOutGroup&&t.jsx("button",{"data-no-drag":!0,onMouseDown:T=>T.stopPropagation(),onClick:C.onPopOutGroup,"aria-label":"pop-out",title:w("session.popOut")||"Pop out to separate window",style:Na,children:t.jsx(ii,{size:13})}),t.jsx("button",{"data-no-drag":!0,onMouseDown:T=>T.stopPropagation(),onClick:C.onMinimizeGroup,"aria-label":"minimize",title:w("session.minimize")||"Minimize",style:Na,children:t.jsx(_w,{size:13})}),t.jsx("button",{"data-no-drag":!0,onMouseDown:T=>T.stopPropagation(),onClick:C.onCloseGroup,"aria-label":"close",style:Na,children:t.jsx(Xt,{size:13})})]})]}),t.jsx("div",{"data-group-id":i,"data-stack-path":s.join("."),ref:T=>{if(!T){p(s,null);return}const A=T.getBoundingClientRect();p(s,{x:A.left,y:A.top,w:A.width,h:A.height})},onMouseDown:j,style:{flex:1,position:"relative",minHeight:0,minWidth:0},children:e.tabs.map(T=>{const A=a.get(T);if(!A)return null;const z=m[T]||{intent:"open",nonce:0};return t.jsx(N_,{session:A,visible:T===e.activeTab,intent:z.intent,intentNonce:z.nonce,onClose:()=>d(T),sendMessage:u,subscribeBinary:v,onEvent:b,onCycleTab:R,remountKey:_[T]||0},T)})})]})}const Na={background:"transparent",border:"none",color:Ge.titleText,cursor:"pointer",padding:"0 6px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,flexShrink:0,height:"100%"};function B8({orientation:e,onDragStart:s,onDrag:i,onDragEnd:a}){const h=k.useCallback(f=>{if(f.button!==0)return;f.preventDefault(),f.stopPropagation();const o=f.clientX,c=f.clientY;s();let d=!1;const p=()=>{d||(d=!0,window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",w),window.removeEventListener("blur",u),window.removeEventListener("keydown",v),document.removeEventListener("visibilitychange",b))},u=()=>{p(),a()},v=x=>{x.key==="Escape"&&u()},b=()=>{document.hidden&&u()},C=x=>{const y=e==="horizontal"?x.clientX-o:x.clientY-c;i(y)},w=()=>{p(),a()};window.addEventListener("mousemove",C),window.addEventListener("mouseup",w),window.addEventListener("blur",u),window.addEventListener("keydown",v),document.addEventListener("visibilitychange",b)},[e,s,i,a]),m=e==="horizontal";return t.jsx("div",{onMouseDown:h,style:{flex:"0 0 4px",background:Ge.separator,cursor:m?"col-resize":"row-resize",position:"relative",zIndex:1}})}function mp(e){const{node:s,path:i,onSplitSizes:a,...h}=e;return s.kind==="stack"?t.jsx(fp,{stack:s,path:i,...h}):t.jsx(P8,{split:s,path:i,onSplitSizes:a,stackProps:h})}const fy=80;function P8({split:e,path:s,onSplitSizes:i,stackProps:a}){const h=e.orientation==="horizontal",m=k.useRef(null),f=k.useRef([]),o=k.useRef(null);return t.jsx("div",{ref:m,style:{display:"flex",flexDirection:h?"row":"column",flex:1,minWidth:0,minHeight:0},children:e.children.map((c,d)=>t.jsxs(k.Fragment,{children:[t.jsx("div",{ref:p=>{f.current[d]=p},style:{flex:`0 0 ${e.sizes[d]}%`,display:"flex",flexDirection:"column",minWidth:0,minHeight:0,overflow:"hidden"},children:t.jsx(mp,{node:c,path:[...s,d],onSplitSizes:i,...a})}),d<e.children.length-1&&t.jsx(B8,{orientation:e.orientation,onDragStart:()=>{const p=m.current;if(!p)return;const u=e.sizes.slice();o.current={i:d,initialSizes:u,finalSizes:u.slice(),total:h?p.clientWidth:p.clientHeight}},onDrag:p=>{const u=o.current;if(!u||u.total<=0)return;const v=u.initialSizes[u.i]/100*u.total,b=u.initialSizes[u.i+1]/100*u.total,C=v+b,w=Math.max(fy,Math.min(C-fy,v+p)),x=C-w,y=w/u.total*100,_=x/u.total*100,S=f.current[u.i],N=f.current[u.i+1];S&&(S.style.flexBasis=`${y}%`),N&&(N.style.flexBasis=`${_}%`);const D=u.initialSizes.slice();D[u.i]=y,D[u.i+1]=_,u.finalSizes=D},onDragEnd:()=>{const p=o.current;p&&i(s,p.finalSizes),o.current=null}})]},d))})}const Zt=28,ms=68;function Pu(e,s,i){const a=e-i.x,h=s-i.y;if(a<0||h<0||a>i.w||h>i.h)return null;const m=a-i.w/2,f=h-i.h/2;return Math.abs(m)<=Zt&&Math.abs(f)<=Zt?"center":m>=-ms-Zt&&m<=-ms+Zt&&Math.abs(f)<=Zt?"left":m>=ms-Zt&&m<=ms+Zt&&Math.abs(f)<=Zt?"right":f>=-ms-Zt&&f<=-ms+Zt&&Math.abs(m)<=Zt?"top":f>=ms-Zt&&f<=ms+Zt&&Math.abs(m)<=Zt?"bottom":null}function vu(e,s){const i=document.elementsFromPoint(e,s);for(const a of i){const h=a.closest("[data-group-id][data-stack-path]");if(!h)continue;const m=h.dataset.stackPath||"",f=m===""?[]:m.split(".").map(Number),o=h.getBoundingClientRect(),c={x:o.left,y:o.top,w:o.width,h:o.height};return{groupId:h.dataset.groupId||"",path:f,rect:c,zone:Pu(e,s,c)}}return null}function I8(e,s){const i=e.w/2,a=e.h/2;switch(s){case"center":return e;case"left":return{x:e.x,y:e.y,w:i,h:e.h};case"right":return{x:e.x+i,y:e.y,w:i,h:e.h};case"top":return{x:e.x,y:e.y,w:e.w,h:a};case"bottom":return{x:e.x,y:e.y+a,w:e.w,h:a}}}function ul({targetRect:e,activeZone:s}){const i=e.x+e.w/2,a=e.y+e.h/2,h=s?I8(e,s):null;return tn.createPortal(t.jsxs(t.Fragment,{children:[h&&t.jsx("div",{style:{position:"fixed",left:h.x,top:h.y,width:h.w,height:h.h,background:`${Ge.info}33`,border:`2px dashed ${Ge.info}`,borderRadius:4,pointerEvents:"none",zIndex:2400,boxSizing:"border-box"}}),(()=>{const m=ms+Zt;return t.jsxs("div",{style:{position:"fixed",left:i-m,top:a-m,width:m*2,height:m*2,pointerEvents:"none",zIndex:2500},children:[t.jsx($o,{offsetX:m-Zt,offsetY:m-Zt,active:s==="center",kind:"center"}),t.jsx($o,{offsetX:m-ms-Zt,offsetY:m-Zt,active:s==="left",kind:"left"}),t.jsx($o,{offsetX:m+ms-Zt,offsetY:m-Zt,active:s==="right",kind:"right"}),t.jsx($o,{offsetX:m-Zt,offsetY:m-ms-Zt,active:s==="top",kind:"top"}),t.jsx($o,{offsetX:m-Zt,offsetY:m+ms-Zt,active:s==="bottom",kind:"bottom"})]})})()]}),document.body)}function $o({offsetX:e,offsetY:s,active:i,kind:a}){const h=Zt*2,m=i?Ge.info:"#3a3a3a",f=i?Ge.bright:Ge.separator;return t.jsx("div",{style:{position:"absolute",left:e,top:s,width:h,height:h,background:"#1a1a1a",border:`1px solid ${f}`,borderRadius:4,boxShadow:i?`0 0 8px ${Ge.info}`:"0 1px 3px rgba(0,0,0,0.4)",boxSizing:"border-box",overflow:"hidden"},children:t.jsx(H8,{kind:a,fill:m})})}function H8({kind:e,fill:s}){const i={position:"absolute",background:s};switch(e){case"center":return t.jsx("div",{style:{...i,inset:4}});case"left":return t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{...i,left:4,top:4,bottom:4,width:"calc(50% - 4px)"}}),t.jsx("div",{style:{position:"absolute",right:4,top:4,bottom:4,width:"calc(50% - 4px)",border:`1px dashed ${s}`,boxSizing:"border-box"}})]});case"right":return t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{position:"absolute",left:4,top:4,bottom:4,width:"calc(50% - 4px)",border:`1px dashed ${s}`,boxSizing:"border-box"}}),t.jsx("div",{style:{...i,right:4,top:4,bottom:4,width:"calc(50% - 4px)"}})]});case"top":return t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{...i,top:4,left:4,right:4,height:"calc(50% - 4px)"}}),t.jsx("div",{style:{position:"absolute",bottom:4,left:4,right:4,height:"calc(50% - 4px)",border:`1px dashed ${s}`,boxSizing:"border-box"}})]});case"bottom":return t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{position:"absolute",top:4,left:4,right:4,height:"calc(50% - 4px)",border:`1px dashed ${s}`,boxSizing:"border-box"}}),t.jsx("div",{style:{...i,bottom:4,left:4,right:4,height:"calc(50% - 4px)"}})]})}}function Ai(e,s){return{kind:"stack",tabs:e.slice(),activeTab:s??e[0]}}function Zo(e,s){let i=e;for(const a of s){if(i.kind!=="split"||a<0||a>=i.children.length)return null;i=i.children[a]}return i}function Iu(e,s){if(e.kind==="stack")return e.tabs.includes(s)?[]:null;for(let i=0;i<e.children.length;i++){const a=Iu(e.children[i],s);if(a)return[i,...a]}return null}function dn(e){return e.kind==="stack"?e.tabs.slice():e.children.flatMap(dn)}function T_(e){return e.kind==="stack"?[e.activeTab]:e.children.flatMap(T_)}function zi(e,s){return L_(e,s)}function L_(e,s){if(e.kind==="stack"){if(!e.tabs.includes(s))return e;const m=e.tabs.filter(o=>o!==s);if(m.length===0)return null;const f=e.activeTab===s?m[0]:e.activeTab;return{kind:"stack",tabs:m,activeTab:f}}const i=[],a=[];for(let m=0;m<e.children.length;m++){const f=L_(e.children[m],s);f!==null&&(i.push(f),a.push(e.sizes[m]))}if(i.length===0)return null;if(i.length===1)return i[0];const h=a.reduce((m,f)=>m+f,0)||1;return{kind:"split",orientation:e.orientation,children:i,sizes:a.map(m=>m/h*100)}}function Oi(e,s,i){return Hu(e,s,a=>{if(a.kind!=="stack")throw new Error("insertIntoStack: target must be a stack");return a.tabs.includes(i)?{...a,activeTab:i}:{kind:"stack",tabs:[...a.tabs,i],activeTab:i}})}function Ra(e,s,i,a){const h=i==="left"||i==="right"?"horizontal":"vertical",m=i==="left"||i==="top";return Hu(e,s,f=>({kind:"split",orientation:h,children:m?[a,f]:[f,a],sizes:[50,50]}))}function Hu(e,s,i){if(s.length===0)return bu(i(e));if(e.kind!=="split")throw new Error("replaceAt: path traverses non-split");const[a,...h]=s;if(a<0||a>=e.children.length)throw new Error("replaceAt: bad path");const m=e.children.map((f,o)=>o===a?Hu(f,h,i):f);return bu({...e,children:m})}function bu(e){if(e.kind==="stack")return e;const s=e.children.map(bu),i=[],a=[];for(let m=0;m<s.length;m++){const f=s[m],o=e.sizes[m]??100/s.length;if(f.kind==="split"&&f.orientation===e.orientation){const c=f.sizes.reduce((d,p)=>d+p,0)||1;for(let d=0;d<f.children.length;d++)i.push(f.children[d]),a.push(f.sizes[d]/c*o)}else i.push(f),a.push(o)}if(i.length===1)return i[0];const h=a.reduce((m,f)=>m+f,0)||1;return{kind:"split",orientation:e.orientation,children:i,sizes:a.map(m=>m/h*100)}}function Os(e,s){return e.kind==="stack"?e.tabs.includes(s)?{...e,activeTab:s}:e:{...e,children:e.children.map(i=>Os(i,s))}}function D_(e,s,i){if(e.kind==="stack"){if(!e.tabs.includes(s))return e;const a=e.tabs.indexOf(s),h=Math.max(0,Math.min(i,e.tabs.length-1));if(h===a)return e;const m=e.tabs.slice();return m.splice(a,1),m.splice(h,0,s),{...e,tabs:m}}return{...e,children:e.children.map(a=>D_(a,s,i))}}function R_(e,s,i){return Hu(e,s,a=>{if(a.kind!=="split")throw new Error("setSplitSizes: target must be a split");if(a.children.length!==i.length)throw new Error("setSplitSizes: size count mismatch");return{...a,sizes:i}})}function F8(e,s,i,a){const h=Zo(e,i);if(!h||h.kind!=="stack"||a==="center"&&h.tabs.includes(s))return null;const m=h.tabs.find(d=>d!==s);if(!m)return null;const f=zi(e,s);if(!f)return null;const o=Iu(f,m);if(!o)return null;const c=a==="center"?Oi(f,o,s):Ra(f,o,a,Ai([s]));return Os(c,s)}function $8(e,s){const i=dn(e);let a=e;for(const h of i){if(!a)break;s.has(h)||(a=zi(a,h))}return a}const Lf=320,Df=200,Wc=80,Gc=22,U8=4,my=8,Jr=10,qc=60;function Qr(e,s,i){return Math.max(s,Math.min(i,e))}function W8(e,s,i,a){const h=e<=my,m=e>=i-my;if(!h&&!m)return null;const f=a/3,o=a*2/3;return h?s<f?"top-left":s>o?"bottom-left":"left":s<f?"top-right":s>o?"bottom-right":"right"}function py(e,s,i){const a=Math.round(s/2),h=Math.round(i/2);switch(e){case"left":return{x:0,y:0,w:a,h:i};case"right":return{x:s-a,y:0,w:a,h:i};case"top-left":return{x:0,y:0,w:a,h};case"top-right":return{x:s-a,y:0,w:a,h};case"bottom-left":return{x:0,y:i-h,w:a,h};case"bottom-right":return{x:s-a,y:i-h,w:a,h}}}function G8(e,s,i,a,h){let m=e,f=s;const o=m,c=m+i,d=f,p=f+a;for(const u of h){const v=u.x,b=u.x+u.w,C=u.y,w=u.y+u.h;d<w&&p>C&&(Math.abs(o-b)<=Jr?m=b:Math.abs(c-v)<=Jr?m=v-i:Math.abs(o-v)<=Jr?m=v:Math.abs(c-b)<=Jr&&(m=b-i)),o<b&&c>v&&(Math.abs(d-w)<=Jr?f=w:Math.abs(p-C)<=Jr?f=C-a:Math.abs(d-C)<=Jr?f=C:Math.abs(p-w)<=Jr&&(f=w-a))}return{x:m,y:f}}function q8({group:e,sessionsById:s,neighbors:i,isTopmost:a,zIndex:h,sendMessage:m,subscribeBinary:f,onEvent:o}){const{t:c}=it(),d=h_("(max-width: 767px)"),p=B_(),u=k.useRef(null),v=k.useRef({x:e.x,y:e.y,w:e.w,h:e.h});v.current={x:e.x,y:e.y,w:e.w,h:e.h};const[b,C]=k.useState(null),w=k.useRef(null),x=k.useRef(i);x.current=i;const[y,_]=k.useState(null),S=k.useRef(null),N=k.useCallback((P,B)=>{if(d||P.button!==0||P.target.closest("[data-no-drag]"))return;P.preventDefault(),p.focus(dn(e.root)[0]||"");const V=P.clientX,$=P.clientY,se={...v.current},ue=u.current,ae=window.innerWidth,ee=window.innerHeight;let Y="";B&&ue&&(Y=ue.style.pointerEvents,ue.style.pointerEvents="none");let he=!1;const de=()=>{he||(he=!0,window.removeEventListener("mousemove",Te),window.removeEventListener("mouseup",be),window.removeEventListener("blur",ke),window.removeEventListener("keydown",re),document.removeEventListener("visibilitychange",Fe),B&&ue&&(ue.style.pointerEvents=Y))},ke=()=>{de(),S.current=null,_(null),w.current=null,C(null),p.setGroupGeometry(e.id,{...v.current})},re=pe=>{pe.key==="Escape"&&ke()},Fe=()=>{document.hidden&&ke()};let Ne=!1;const Te=pe=>{if(Ne)return;{const Oe=window.screenX,fe=window.screenY,je=Oe+window.outerWidth,oe=fe+window.outerHeight;if(pe.screenX<Oe-qc||pe.screenX>je+qc||pe.screenY<fe-qc||pe.screenY>oe+qc){Ne=!0,de(),S.current=null,_(null),w.current=null,C(null),p.setGroupGeometry(e.id,{...v.current}),p.popOutGroup(e.id,{atScreenX:pe.screenX,atScreenY:pe.screenY});return}}const Je=pe.clientX-V,Ye=pe.clientY-$;let ge=Qr(se.x+Je,-(se.w-Wc),ae-Wc),Ce=Qr(se.y+Ye,0,ee-Gc);const Ke=x.current;if(Ke.length>0){const Oe=G8(ge,Ce,se.w,se.h,Ke);ge=Oe.x,Ce=Oe.y}if(ue&&(ue.style.left=`${ge}px`,ue.style.top=`${Ce}px`),v.current.x=ge,v.current.y=Ce,B){let Oe=null;const fe=document.elementFromPoint(pe.clientX,pe.clientY),je=fe==null?void 0:fe.closest("[data-group-id][data-stack-path]");if(je){const oe=je.dataset.groupId||"";if(oe!==e.id){const q=je.dataset.stackPath||"",K=q===""?[]:q.split(".").map(Number),Q=je.getBoundingClientRect(),ie={x:Q.left,y:Q.top,w:Q.width,h:Q.height};Oe={groupId:oe,path:K,rect:ie,zone:Pu(pe.clientX,pe.clientY,ie)}}}S.current=Oe,_(Oe?{rect:Oe.rect,zone:Oe.zone}:null)}const tt=B&&S.current&&S.current.zone?null:W8(pe.clientX,pe.clientY,ae,ee);tt!==w.current&&(w.current=tt,C(tt))},be=()=>{if(de(),B&&S.current&&S.current.zone){const pe=S.current;p.dockGroup(e.id,pe.groupId,pe.path,pe.zone),S.current=null,_(null),w.current=null,C(null);return}if(w.current){const pe=py(w.current,ae,ee);ue&&(ue.style.left=`${pe.x}px`,ue.style.top=`${pe.y}px`,ue.style.width=`${pe.w}px`,ue.style.height=`${pe.h}px`),v.current=pe,w.current=null,C(null)}S.current=null,_(null),p.setGroupGeometry(e.id,{...v.current})};window.addEventListener("mousemove",Te),window.addEventListener("mouseup",be),window.addEventListener("blur",ke),window.addEventListener("keydown",re),document.addEventListener("visibilitychange",Fe)},[d,p,e.id,e.root]),D=k.useCallback(P=>N(P,!1),[N]),j=k.useCallback(P=>N(P,!0),[N]),R=k.useCallback(P=>B=>{if(d||B.button!==0)return;B.preventDefault(),B.stopPropagation();const I=B.clientX,V=B.clientY,$={...v.current},se=u.current,ue=window.innerWidth,ae=window.innerHeight,ee=Ne=>{const Te=Ne.clientX-I,be=Ne.clientY-V;let pe=$.x,Je=$.y,Ye=$.w,ge=$.h;P.includes("e")?Ye=Qr($.w+Te,Lf,Math.max(Lf,ue-$.x)):P.includes("w")&&(pe=Qr($.x+Te,0,$.x+$.w-Lf),Ye=$.x+$.w-pe),P.includes("s")?ge=Qr($.h+be,Df,Math.max(Df,ae-$.y)):P.includes("n")&&(Je=Qr($.y+be,0,$.y+$.h-Df),ge=$.y+$.h-Je),se&&(se.style.left=`${pe}px`,se.style.top=`${Je}px`,se.style.width=`${Ye}px`,se.style.height=`${ge}px`),v.current={x:pe,y:Je,w:Ye,h:ge}};let Y=!1;const he=()=>{Y||(Y=!0,window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",Fe),window.removeEventListener("blur",de),window.removeEventListener("keydown",ke),document.removeEventListener("visibilitychange",re))},de=()=>{he(),p.setGroupGeometry(e.id,{...v.current})},ke=Ne=>{Ne.key==="Escape"&&de()},re=()=>{document.hidden&&de()},Fe=()=>{he(),p.setGroupGeometry(e.id,{...v.current})};window.addEventListener("mousemove",ee),window.addEventListener("mouseup",Fe),window.addEventListener("blur",de),window.addEventListener("keydown",ke),document.addEventListener("visibilitychange",re)},[d,p,e.id]);k.useEffect(()=>{if(d)return;const P=()=>{const B=window.innerWidth,I=window.innerHeight,V=v.current,$=Qr(V.x,-(V.w-Wc),B-Wc),se=Qr(V.y,0,I-Gc);($!==V.x||se!==V.y)&&p.setGroupGeometry(e.id,{...V,x:$,y:se})};return window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[d,p,e.id]);const L=k.useCallback(P=>{p.setActiveTab(e.id,P)},[p,e.id]),T=k.useCallback(P=>{p.close(P)},[p]),A=k.useCallback((P,B,I)=>{p.beginTabDrag(e.id,P,B,I)},[p,e.id]),z=k.useCallback(P=>{p.close(P)},[p]),O=k.useCallback((P,B)=>{p.setSplitSizes(e.id,P,B)},[p,e.id]),H=T_(e.root),F=dn(e.root);if(d){const P=H[0],B=P?s.get(P):null;if(!B)return null;const I=e.intents[P]??{intent:"open",nonce:0};return tn.createPortal(t.jsxs("div",{style:{position:"fixed",inset:0,background:Ge.bg,display:"flex",flexDirection:"column",zIndex:110},children:[t.jsxs("div",{style:{background:Ge.titleBg,height:Gc,display:"flex",alignItems:"center",borderBottom:`1px solid ${Ge.separator}`},children:[t.jsx("span",{style:{flex:1,color:Ge.titleText,fontFamily:Mt,fontSize:12,paddingLeft:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:B.title}),t.jsx("button",{"data-no-drag":!0,onClick:()=>p.closeGroup(e.id),style:Kc,"aria-label":"close",children:t.jsx(Xt,{size:14})})]}),t.jsx("div",{style:{flex:1,position:"relative",minHeight:0},children:t.jsx(N_,{session:B,visible:!0,intent:I.intent,intentNonce:I.nonce,onClose:()=>p.close(P),sendMessage:m,subscribeBinary:f,onEvent:o})})]}),document.body)}const U=b?(()=>{const P=window.innerWidth,B=window.innerHeight,I=py(b,P,B);return tn.createPortal(t.jsx("div",{style:{position:"fixed",left:I.x,top:I.y,width:I.w,height:I.h,background:`${Ge.info}33`,border:`2px dashed ${Ge.info}`,borderRadius:8,pointerEvents:"none",zIndex:2e3,transition:"left 80ms ease-out, top 80ms ease-out, width 80ms ease-out, height 80ms ease-out",boxSizing:"border-box"}}),document.body)})():null,W=(()=>{var B;if(F.length===0)return"";const P=((B=s.get(F[0]))==null?void 0:B.title)||F[0];return F.length===1?P:`${P} +${F.length-1}`})(),X=e.root.kind==="split",J=tn.createPortal(t.jsxs("div",{ref:u,onMouseDown:X?()=>p.focus(F[0]||""):j,style:{position:"fixed",left:e.x,top:e.y,width:e.w,height:e.h,zIndex:h,background:Ge.bg,border:`1px solid ${a?Ge.info:Ge.separator}`,borderRadius:8,boxShadow:a?`0 10px 40px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.3), 0 0 0 1px ${Ge.info}66, 0 0 18px ${Ge.info}33`:"0 10px 40px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.3)",display:"flex",flexDirection:"column",overflow:"hidden",transition:"box-shadow 120ms ease-out, border-color 120ms ease-out"},children:[X&&t.jsxs("div",{onMouseDown:D,style:{height:Gc,flexShrink:0,display:"flex",flexDirection:"column",background:Ge.titleBg,borderBottom:`1px solid ${Ge.separator}`,userSelect:"none",cursor:"move"},children:[t.jsx("div",{style:{display:"flex",height:U8,flexShrink:0},children:H.map((P,B)=>t.jsx("div",{style:{flex:1,background:e.colors[P]||Ge.titleText}},B))}),t.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",padding:"0 4px 0 8px",color:Ge.titleText,fontFamily:Mt,fontSize:11},children:[t.jsx("span",{style:{color:Ge.info,fontWeight:600,letterSpacing:1,marginRight:8},"aria-hidden":!0,children:">_"}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W}),t.jsx("button",{"data-no-drag":!0,onMouseDown:P=>P.stopPropagation(),onClick:()=>p.popOutGroup(e.id),style:Kc,"aria-label":"pop-out",title:c("session.popOut")||"Pop out to separate window",children:t.jsx(ii,{size:14})}),t.jsx("button",{"data-no-drag":!0,onClick:()=>p.minimizeGroup(e.id),style:Kc,"aria-label":"minimize",title:c("session.minimize")||"Minimize",children:t.jsx(_w,{size:14})}),t.jsx("button",{"data-no-drag":!0,onClick:()=>p.closeGroup(e.id),style:Kc,"aria-label":"close",children:t.jsx(Xt,{size:14})})]})]}),t.jsx("div",{style:{flex:1,display:"flex",minHeight:0,minWidth:0},children:e.root.kind==="split"?t.jsx(mp,{node:e.root,path:[],groupId:e.id,sessionsById:s,colors:e.colors,intents:e.intents,onTabClick:L,onTabClose:T,onTabMouseDown:A,onPaneAutoClose:z,registerRect:()=>{},onSplitSizes:O,sendMessage:m,subscribeBinary:f,onEvent:o}):t.jsx(fp,{stack:e.root,path:[],groupId:e.id,sessionsById:s,colors:e.colors,intents:e.intents,onTabClick:L,onTabClose:T,onTabMouseDown:A,onPaneAutoClose:z,registerRect:()=>{},sendMessage:m,subscribeBinary:f,onEvent:o,groupActions:{onMinimizeGroup:()=>p.minimizeGroup(e.id),onCloseGroup:()=>p.closeGroup(e.id),onPopOutGroup:()=>p.popOutGroup(e.id)}})}),t.jsx("div",{onMouseDown:R("n"),style:{position:"absolute",top:0,left:6,right:6,height:4,cursor:"ns-resize",zIndex:3}}),t.jsx("div",{onMouseDown:R("s"),style:{position:"absolute",bottom:0,left:6,right:6,height:4,cursor:"ns-resize",zIndex:3}}),t.jsx("div",{onMouseDown:R("w"),style:{position:"absolute",top:6,bottom:6,left:0,width:4,cursor:"ew-resize",zIndex:3}}),t.jsx("div",{onMouseDown:R("e"),style:{position:"absolute",top:6,bottom:6,right:0,width:4,cursor:"ew-resize",zIndex:3}}),t.jsx("div",{onMouseDown:R("nw"),style:{position:"absolute",top:0,left:0,width:10,height:10,cursor:"nwse-resize",zIndex:4}}),t.jsx("div",{onMouseDown:R("ne"),style:{position:"absolute",top:0,right:0,width:10,height:10,cursor:"nesw-resize",zIndex:4}}),t.jsx("div",{onMouseDown:R("sw"),style:{position:"absolute",bottom:0,left:0,width:10,height:10,cursor:"nesw-resize",zIndex:4}}),t.jsx("div",{onMouseDown:R("se"),title:"resize",style:{position:"absolute",right:0,bottom:0,width:14,height:14,cursor:"nwse-resize",background:"linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.2) 50%)",zIndex:4}})]}),document.body);return t.jsxs(t.Fragment,{children:[J,U,y&&t.jsx(ul,{targetRect:y.rect,activeZone:y.zone})]})}const Kc={background:"transparent",border:"none",color:Ge.titleText,cursor:"pointer",padding:4,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:4},Rf=["#3b82f6","#22c55e","#eab308","#ef4444","#a855f7","#06b6d4","#f97316","#ec4899"];function Mi(e){for(const s of Rf)if(!e.includes(s))return s;return Rf[e.length%Rf.length]}const K8="clitrigger:session-windows:global";function pp(){if(typeof BroadcastChannel>"u")return{post:()=>{},subscribe:()=>()=>{},close:()=>{}};const e=new BroadcastChannel(K8),s=new Set;return e.onmessage=i=>{const a=i.data;for(const h of s)try{h(a)}catch{}},{post:i=>{e.postMessage(i)},subscribe:i=>(s.add(i),()=>{s.delete(i)}),close:()=>{s.clear(),e.close()}}}const Bt="main",vm=new Map;function V8(e,s){vm.set(e,s)}function Y8(e){const s=vm.get(e);if(!s||s.closed)return vm.delete(e),!1;try{return s.focus(),!0}catch{return!1}}function X8(){return`popout_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}const M_=5e3,J8=15e3;let La=null;function A_(){if(typeof window>"u")return()=>{};const e=s=>{La={sx:s.screenX,sy:s.screenY,cx:s.clientX,cy:s.clientY}};return window.addEventListener("mousemove",e,{passive:!0}),()=>window.removeEventListener("mousemove",e)}function yu(e,s){if(La)return{x:La.cx+(e-La.sx),y:La.cy+(s-La.sy)};const i=Math.max(0,(window.outerWidth-window.innerWidth)/2),a=Math.max(0,window.outerHeight-window.innerHeight-i);return{x:e-window.screenX-i,y:s-window.screenY-a}}function wu(e){return e.x>=0&&e.y>=0&&e.x<=window.innerWidth&&e.y<=window.innerHeight}const bm="clitrigger:popout-alive:";function Q8(e){return`${bm}${e}`}function O_(){return typeof navigator<"u"&&!!navigator.locks&&typeof navigator.locks.query=="function"}function Z8(e){if(!O_())return()=>{};let s=()=>{};return navigator.locks.request(Q8(e),()=>new Promise(i=>{s=i})).catch(()=>{}),()=>s()}async function eO(){var e;if(!O_())return new Set;try{const s=await navigator.locks.query(),i=new Set;for(const a of s.held??[])(e=a.name)!=null&&e.startsWith(bm)&&i.add(a.name.slice(bm.length));return i}catch{return new Set}}const gp=k.createContext(null),z_=k.createContext({});function B_(){const e=k.useContext(gp);if(!e)throw new Error("useSessionWindows must be used within SessionWindowsHost");return e}function tO(){return k.useContext(z_)}function nO(){return k.useContext(gp)}const _u=720,xp=460,sO=320,rO=200,gy=30,P_=80,I_=80,el=80,ym=28;function iO(e){const s=typeof window<"u"?window.innerWidth:1280,i=typeof window<"u"?window.innerHeight:800;let a=Number.isFinite(e.w)&&e.w>=sO?e.w:_u,h=Number.isFinite(e.h)&&e.h>=rO?e.h:xp;a=Math.min(a,s),h=Math.min(h,i);let m=Number.isFinite(e.x)?e.x:P_,f=Number.isFinite(e.y)?e.y:I_;return m=Math.max(Math.min(m,s-el),-(a-el)),f=Math.max(Math.min(f,i-ym),0),{x:m,y:f,w:a,h}}const aO=12,Vc=60;function H_(e){return`sessionGroups:${e}`}function F_(e){try{const s=localStorage.getItem(H_(e));if(!s)return null;const i=JSON.parse(s);if(Array.isArray(i==null?void 0:i.groups)&&typeof(i==null?void 0:i.zCounter)=="number")return i}catch{}return null}function wm(e,s){try{localStorage.setItem(H_(e),JSON.stringify(s))}catch{}}function oO(e,s){const i=F_(e);!i||!i.groups.some(a=>a.id===s)||(wm(e,{...i,groups:i.groups.filter(a=>a.id!==s)}),window.dispatchEvent(new CustomEvent("session-windows:changed")))}function lO(e){const s=e%8;return{x:P_+s*gy,y:I_+s*gy,w:_u,h:xp}}function Yc(e,s,i){return Math.max(s,Math.min(i,e))}function xy(){return`g_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Zr(e,s){for(const i of e)if(Iu(i.root,s))return i;return null}function cO({projectId:e,sessions:s,sendMessage:i,subscribeBinary:a,onEvent:h,onAddSession:m,children:f}){const{t:o}=it(),[c]=k.useState(()=>{const oe=F_(e);if(!oe)return{groups:[],zCounter:0};const q=oe.groups.map(K=>{const Q=dn(K.root),ie=new Set(Q),te={};for(const Re of Object.keys(K.colors||{}))ie.has(Re)&&(te[Re]=K.colors[Re]);const le={};for(const Re of Q)le[Re]={intent:"open",nonce:0},te[Re]||(te[Re]=Mi(Object.values(te)));const xe=iO({x:K.x,y:K.y,w:K.w,h:K.h}),Pe=K.ownerWindowId||Bt;return{...K,...xe,colors:te,intents:le,minimized:!!K.minimized,ownerWindowId:Pe}});return{groups:q,zCounter:oe.zCounter||q.length}}),[d,p]=k.useState(c.groups),u=k.useRef(c.zCounter),v=k.useRef(d);v.current=d;const b=k.useRef(s);b.current=s;const[C,w]=k.useState(null),x=k.useRef(null);x.current=C,k.useEffect(()=>{var q,K;const oe={};for(const Q of d)for(const ie of dn(Q.root)){const te=((q=s.find(le=>le.id===ie))==null?void 0:q.title)||((K=S.current[ie])==null?void 0:K.title);te&&(oe[ie]=te)}wm(e,{groups:d,zCounter:u.current,titles:oe}),window.dispatchEvent(new CustomEvent("session-windows:changed"))},[e,d,s]),k.useEffect(()=>()=>{var ie,te;const oe=v.current;if(oe.length===0)return;let q=!1;const K=oe.map(le=>(le.ownerWindowId||Bt)!==Bt||le.minimized?le:(q=!0,{...le,minimized:!0}));if(!q)return;const Q={};for(const le of K)for(const xe of dn(le.root)){const Pe=((ie=b.current.find(Re=>Re.id===xe))==null?void 0:ie.title)||((te=S.current[xe])==null?void 0:te.title);Pe&&(Q[xe]=Pe)}wm(e,{groups:K,zCounter:u.current,titles:Q}),window.dispatchEvent(new CustomEvent("session-windows:changed"))},[e]);const[y,_]=k.useState({}),S=k.useRef(y);S.current=y;const[N,D]=k.useState(()=>new Set),j=k.useRef(new Set);k.useEffect(()=>{if(s.length===0)return;const oe=s.filter(K=>K.project_id===e);if(oe.length===0)return;const q=new Set(oe.map(K=>K.id));for(const K of d)for(const Q of dn(K.root))q.has(Q)||y[Q]||N.has(Q)||j.current.has(Q)||(j.current.add(Q),Xw(Q).then(ie=>_(te=>({...te,[Q]:ie}))).catch(ie=>{ie instanceof Hf&&ie.status===404&&D(te=>new Set(te).add(Q))}).finally(()=>j.current.delete(Q)))},[d,s,e,y,N]),k.useEffect(()=>h(q=>{q.type!=="session:status-changed"||!q.sessionId||_(K=>{const Q=K[q.sessionId];if(!Q)return K;const ie={status:q.status};return q.worktree_path!==void 0&&(ie.worktree_path=q.worktree_path),q.branch_name!==void 0&&(ie.branch_name=q.branch_name),{...K,[Q.id]:{...Q,...ie}}})}),[h]),k.useEffect(()=>{N.size!==0&&p(oe=>{let q=!1;const K=[];for(const Q of oe){const ie=dn(Q.root);if(!ie.some(ve=>N.has(ve))){K.push(Q);continue}q=!0;const te=new Set(ie.filter(ve=>!N.has(ve))),le=$8(Q.root,te);if(!le)continue;const xe=new Set(dn(le)),Pe={};for(const ve of Object.keys(Q.colors))xe.has(ve)&&(Pe[ve]=Q.colors[ve]);const Re={};for(const ve of Object.keys(Q.intents))xe.has(ve)&&(Re[ve]=Q.intents[ve]);K.push({...Q,root:le,colors:Pe,intents:Re})}return q?K:oe})},[N]);const R=k.useCallback((oe,q)=>{const K=v.current.length,Q=lO(K);u.current+=1;const ie=u.current;return{id:xy(),...Q,z:ie,minimized:!1,root:Ai([oe],oe),colors:{[oe]:Mi([])},intents:{[oe]:{intent:q,nonce:0}},ownerWindowId:Bt}},[]),L=k.useCallback((oe,q="open")=>{p(K=>{const Q=Zr(K,oe);u.current+=1;const ie=u.current;return Q?K.map(te=>{var ve,$e,et;if(te.id!==Q.id)return te;const le=((ve=te.intents[oe])==null?void 0:ve.intent)??"open",xe=q==="start"||q==="resume",Pe=xe?q:le,Re=Pe!==le||xe;return{...te,z:ie,minimized:!1,root:Os(te.root,oe),intents:{...te.intents,[oe]:{intent:Pe,nonce:Re?((($e=te.intents[oe])==null?void 0:$e.nonce)??0)+1:((et=te.intents[oe])==null?void 0:et.nonce)??0}}}}):[...K,R(oe,q)]})},[R]),T=k.useCallback(oe=>{p(q=>{const K=Zr(q,oe);if(!K)return q;const Q=q.reduce((te,le)=>le.z>te?le.z:te,0);if(K.z===Q&&!K.minimized)return q;u.current+=1;const ie=u.current;return q.map(te=>te.id===K.id?{...te,z:ie,minimized:!1}:te)})},[]),A=k.useCallback(oe=>{const q=oe.map(K=>b.current.find(Q=>Q.id===K)||S.current[K]).filter(K=>!!K&&K.status==="running");if(q.length===0)return!0;if(!window.confirm(o("session.confirmStop")))return!1;for(const K of q)du(K.id).catch(()=>{});return!0},[o]),z=k.useCallback(oe=>{A([oe])&&p(q=>{const K=Zr(q,oe);if(!K)return q;const Q=zi(K.root,oe);if(!Q)return q.filter(le=>le.id!==K.id);new Set(dn(Q));const ie={...K.colors};delete ie[oe];const te={...K.intents};return delete te[oe],q.map(le=>le.id===K.id?{...le,root:Q,colors:ie,intents:te}:le)})},[A]),O=k.useCallback(oe=>{p(q=>{const K=Zr(q,oe);return K?q.map(Q=>Q.id===K.id?{...Q,minimized:!0}:Q):q})},[]),H=k.useCallback(oe=>{p(q=>{const K=Zr(q,oe);if(!K)return q;u.current+=1;const Q=u.current;return q.map(ie=>ie.id===K.id?{...ie,minimized:!1,z:Q}:ie)})},[]),F=k.useCallback(oe=>!!Zr(v.current,oe),[]),U=k.useCallback(oe=>{const q=v.current.find(K=>K.id===oe);q&&!A(dn(q.root))||p(K=>K.filter(Q=>Q.id!==oe))},[A]),W=k.useCallback(oe=>{p(q=>q.map(K=>K.id===oe?{...K,minimized:!0}:K))},[]);k.useEffect(()=>{const oe=K=>{const Q=K.detail;!(Q!=null&&Q.projectId)||!Q.groupId||Q.projectId===e&&p(ie=>{if(!ie.find(xe=>xe.id===Q.groupId))return ie;u.current+=1;const le=u.current;return ie.map(xe=>xe.id===Q.groupId?{...xe,minimized:!1,z:le}:xe)})},q=K=>{var le;const Q=K.detail;if(!(Q!=null&&Q.projectId)||!Q.groupId||Q.projectId!==e)return;const ie=v.current.find(xe=>xe.id===Q.groupId);if(ie&&!A(dn(ie.root)))return;const te=(ie==null?void 0:ie.ownerWindowId)||Bt;te!==Bt&&(ae.current.delete(te),re.current.delete(Q.groupId),(le=ue.current)==null||le.post({t:"group-reclaimed",popoutId:te,groupIds:[Q.groupId],reason:"late-return"})),p(xe=>xe.filter(Pe=>Pe.id!==Q.groupId))};return window.addEventListener("session-windows:restore",oe),window.addEventListener("session-windows:close",q),()=>{window.removeEventListener("session-windows:restore",oe),window.removeEventListener("session-windows:close",q)}},[e,A]),k.useEffect(()=>{const oe=sessionStorage.getItem("pendingSessionRestore");if(oe)try{const q=JSON.parse(oe);if(q.projectId!==e||!q.groupId)return;sessionStorage.removeItem("pendingSessionRestore"),p(K=>{if(!K.find(te=>te.id===q.groupId))return K;u.current+=1;const ie=u.current;return K.map(te=>te.id===q.groupId?{...te,minimized:!1,z:ie}:te)})}catch{}},[e]);const X=k.useCallback(oe=>{p(q=>{if(!q.find(ie=>ie.id===oe))return q;u.current+=1;const Q=u.current;return q.map(ie=>ie.id===oe?{...ie,minimized:!1,z:Q}:ie)})},[]),J=k.useCallback((oe,q)=>{p(K=>K.map(Q=>Q.id===oe?{...Q,...q}:Q))},[]),P=k.useCallback((oe,q,K)=>{p(Q=>Q.map(ie=>ie.id===oe?{...ie,root:R_(ie.root,q,K)}:ie))},[]),B=k.useCallback((oe,q)=>{p(K=>K.map(Q=>Q.id===oe?{...Q,root:Os(Q.root,q)}:Q))},[]),I=k.useCallback((oe,q,K)=>{p(Q=>Q.map(ie=>ie.id===oe?{...ie,root:D_(ie.root,q,K)}:ie))},[]),V=k.useCallback((oe,q,K,Q)=>{if(Q.button!==0||!v.current.find(Ee=>Ee.id===oe))return;Q.preventDefault();const te=Q.clientX,le=Q.clientY;let xe=null;w({groupId:oe,sessionId:q,fromPath:K,startX:te,startY:le,mouseX:te,mouseY:le,hoveredGroupId:null,hoveredPath:null,hoveredRect:null,zone:null});const Pe=(Ee,ot)=>{const ht=xy();xe=ht;const _t=window.innerWidth,Ht=window.innerHeight,sn={x:Yc(Ee-60,-_u+el,_t-el),y:Yc(ot-12,0,Ht-ym),w:_u,h:xp};p(ce=>{const Le=ce.find(Nt=>Nt.id===oe);if(!Le)return ce;const De=zi(Le.root,q),ye=Le.colors[q]||Mi([]),rt=Le.intents[q]??{intent:"open",nonce:0};u.current+=1;const vt=u.current,St={id:ht,...sn,z:vt,minimized:!1,root:Ai([q],q),colors:{[q]:ye},intents:{[q]:rt},ownerWindowId:Bt},jt=[];for(const Nt of ce)if(Nt.id===oe){if(De){const rn=new Set(dn(De)),Dn={};for(const yn of Object.keys(Nt.colors))rn.has(yn)&&(Dn[yn]=Nt.colors[yn]);const Pn={};for(const yn of Object.keys(Nt.intents))rn.has(yn)&&(Pn[yn]=Nt.intents[yn]);jt.push({...Nt,root:bu(De),colors:Dn,intents:Pn})}}else jt.push(Nt);return jt.push(St),jt})};let Re=!1;const ve=Ee=>{const ot=window.screenX,ht=window.screenY,_t=ot+window.outerWidth,Ht=ht+window.outerHeight;return Ee.screenX<ot-Vc||Ee.screenX>_t+Vc||Ee.screenY<ht-Vc||Ee.screenY>Ht+Vc},$e=Ee=>{if(Re)return;const ot=x.current;if(!ot)return;if(!xe)Math.hypot(Ee.clientX-te,Ee.clientY-le)>=aO&&Pe(Ee.clientX,Ee.clientY);else{const Le=window.innerWidth,De=window.innerHeight,ye=Yc(Ee.clientX-60,-640,Le-el),rt=Yc(Ee.clientY-12,0,De-ym);p(vt=>vt.map(St=>St.id===xe?{...St,x:ye,y:rt}:St))}if(xe&&ve(Ee)&&v.current.some(Le=>Le.id===xe)){const Le=Fe.current;if(Le){Re=!0;const De=xe;dt(),w(null),Le(De,{atScreenX:Ee.screenX,atScreenY:Ee.screenY});return}}let ht=null,_t=null,Ht=null,sn=null;const ce=document.elementsFromPoint(Ee.clientX,Ee.clientY);for(const Le of ce){const De=Le.closest("[data-group-id][data-stack-path]");if(!De)continue;const ye=De.dataset.groupId||"",rt=De.dataset.stackPath||"";if(xe?ye===xe:ye===ot.groupId&&rt===ot.fromPath.join("."))continue;const St=rt===""?[]:rt.split(".").map(Number),jt=De.getBoundingClientRect();ht=ye,_t=St,Ht={x:jt.left,y:jt.top,w:jt.width,h:jt.height},sn=Pu(Ee.clientX,Ee.clientY,Ht);break}w({...ot,mouseX:Ee.clientX,mouseY:Ee.clientY,hoveredGroupId:ht,hoveredPath:_t,hoveredRect:Ht,zone:sn})};let et=!1;const dt=()=>{et||(et=!0,window.removeEventListener("mousemove",$e),window.removeEventListener("mouseup",Ie),window.removeEventListener("blur",Be),window.removeEventListener("keydown",Ze),document.removeEventListener("visibilitychange",lt))},Be=()=>{dt(),w(null)},Ze=Ee=>{Ee.key==="Escape"&&Be()},lt=()=>{document.hidden&&Be()},Ie=()=>{dt();const Ee=x.current;if(w(null),!!Ee&&Ee.hoveredGroupId&&Ee.hoveredPath&&Ee.zone){const ot=xe||Ee.groupId;$(ot,Ee.sessionId,Ee.hoveredGroupId,Ee.hoveredPath,Ee.zone);return}};window.addEventListener("mousemove",$e),window.addEventListener("mouseup",Ie),window.addEventListener("blur",Be),window.addEventListener("keydown",Ze),document.addEventListener("visibilitychange",lt)},[]),$=k.useCallback((oe,q,K,Q,ie)=>{p(te=>{const le=te.find(Ze=>Ze.id===oe),xe=te.find(Ze=>Ze.id===K);if(!le||!xe)return te;if(oe===K){const Ze=Zo(le.root,Q);if(!Ze||Ze.kind!=="stack")return te;const lt=Ze.tabs.find(ht=>ht!==q);if(!lt)return te;const Ie=zi(le.root,q);if(!Ie)return te;const Ee=Iu(Ie,lt);if(!Ee)return te;let ot;return ie==="center"?ot=Oi(Ie,Ee,q):ot=Ra(Ie,Ee,ie,Ai([q])),ot=Os(ot,q),te.map(ht=>ht.id!==oe?ht:(u.current+=1,{...ht,root:ot,z:u.current,minimized:!1}))}const Pe=zi(le.root,q),Re=le.colors[q],ve=le.intents[q]??{intent:"open",nonce:0};let $e;if(ie==="center")$e=Oi(xe.root,Q,q);else{const Ze=Ai([q]);$e=Ra(xe.root,Q,ie,Ze)}$e=Os($e,q);const et={...xe.colors};et[q]||(et[q]=Re||Mi(Object.values(et)));const dt={...xe.intents,[q]:ve},Be=[];for(const Ze of te)if(Ze.id===oe){if(Pe){const lt=new Set(dn(Pe)),Ie={};for(const ot of Object.keys(Ze.colors))lt.has(ot)&&(Ie[ot]=Ze.colors[ot]);const Ee={};for(const ot of Object.keys(Ze.intents))lt.has(ot)&&(Ee[ot]=Ze.intents[ot]);Be.push({...Ze,root:Pe,colors:Ie,intents:Ee})}}else Ze.id===K?(u.current+=1,Be.push({...Ze,root:$e,colors:et,intents:dt,z:u.current,minimized:!1})):Be.push(Ze);return Be})},[]),se=k.useCallback((oe,q,K,Q)=>{p(ie=>{if(oe===q)return ie;const te=ie.find(et=>et.id===oe),le=ie.find(et=>et.id===q);if(!te||!le||te.root.kind!=="stack")return ie;const xe=te.root;let Pe;Q==="center"?Pe=xe.tabs.reduce((et,dt)=>Oi(et,K,dt),le.root):Pe=Ra(le.root,K,Q,xe),Pe=Os(Pe,xe.activeTab);const Re={...le.colors,...te.colors},ve={...le.intents,...te.intents},$e=[];for(const et of ie)et.id!==oe&&(et.id===q?(u.current+=1,$e.push({...et,root:Pe,colors:Re,intents:ve,z:u.current,minimized:!1})):$e.push(et));return $e})},[]),ue=k.useRef(null),ae=k.useRef(new Map),[ee,Y]=k.useState(null),he=k.useRef(ee);he.current=ee;const de=k.useRef(null),ke=k.useRef(typeof document<"u"&&document.hasFocus()?Date.now():0);k.useEffect(()=>{const oe=()=>{ke.current=Date.now()};window.addEventListener("focus",oe);const q=A_();return()=>{window.removeEventListener("focus",oe),q(),de.current&&clearTimeout(de.current)}},[]);const re=k.useRef(new Map),Fe=k.useRef(null),Ne=k.useCallback((oe,q)=>{var $e;const K=v.current.find(et=>et.id===oe);if(!K)return;const Q=X8(),ie={...K,ownerWindowId:Q};re.current.set(oe,ie),ae.current.set(Q,Date.now()),p(et=>et.map(dt=>dt.id===oe?{...dt,ownerWindowId:Q}:dt)),($e=ue.current)==null||$e.post({t:"group-handoff",to:Q,groupId:oe,group:ie});const te=q&&(typeof q.atScreenX=="number"||typeof q.atScreenY=="number"),le=te?Math.max(0,((q==null?void 0:q.atScreenX)??window.screenX+K.x)-40):Math.max(0,window.screenX+K.x),xe=te?Math.max(0,((q==null?void 0:q.atScreenY)??window.screenY+K.y)-12):Math.max(0,window.screenY+K.y),Pe=["popup",`width=${Math.max(400,K.w)}`,`height=${Math.max(300,K.h+40)}`,`left=${le}`,`top=${xe}`].join(","),Re=`/popout/${encodeURIComponent(e)}/${encodeURIComponent(oe)}?wid=${encodeURIComponent(Q)}`,ve=window.open(Re,"_blank",Pe);if(!ve){re.current.delete(oe),ae.current.delete(Q),p(et=>et.map(dt=>dt.id===oe?{...dt,ownerWindowId:Bt}:dt)),window.alert(o("session.popout.blocked")||"Popup blocked. Allow popups for this site to use Pop Out.");return}V8(Q,ve)},[e,o]);Fe.current=Ne;const Te=k.useCallback(oe=>{var Q;const q=v.current.find(ie=>ie.id===oe);if(!q)return;const K=q.ownerWindowId||Bt;if(K===Bt){X(oe);return}(Q=ue.current)==null||Q.post({t:"group-recall",popoutId:K,groupId:oe}),setTimeout(()=>{var le;const ie=v.current.find(xe=>xe.id===oe);if(!ie||(ie.ownerWindowId||Bt)===Bt)return;ae.current.delete(K),re.current.delete(oe),(le=ue.current)==null||le.post({t:"group-reclaimed",popoutId:K,groupIds:[oe],reason:"late-return"}),u.current+=1;const te=u.current;p(xe=>xe.map(Pe=>Pe.id===oe?{...Pe,ownerWindowId:Bt,minimized:!1,z:te}:Pe))},1500)},[X]),be=k.useCallback(oe=>{const q=Zr(v.current,oe);q&&Te(q.id)},[Te]);k.useEffect(()=>{const oe=q=>{const K=q.detail;!(K!=null&&K.projectId)||!K.groupId||K.projectId!==e||Te(K.groupId)};return window.addEventListener("session-windows:recall",oe),()=>window.removeEventListener("session-windows:recall",oe)},[e,Te]),k.useEffect(()=>{const oe=sessionStorage.getItem("pendingSessionRecall");if(oe)try{const q=JSON.parse(oe);if(q.projectId!==e||!q.groupId)return;sessionStorage.removeItem("pendingSessionRecall");const K=q.groupId;setTimeout(()=>Te(K),0)}catch{}},[e,Te]);const pe=k.useCallback(oe=>oe.kind==="stack"?[]:[0,...pe(oe.children[0])],[]),Je=k.useCallback(async(oe,q)=>{const K=new Date,Q=String(K.getHours()).padStart(2,"0"),ie=String(K.getMinutes()).padStart(2,"0"),te=String(K.getSeconds()).padStart(2,"0"),le=await Jw(e,{title:`Shell ${Q}:${ie}:${te}`,cli_tool:"raw-shell",use_worktree:!1,memory_inject_mode:"none"});m==null||m(le);const xe=oe?v.current.find($e=>$e.id===oe):null,Pe=xe&&(xe.ownerWindowId||Bt)===Bt;if(!xe||!Pe)return L(le.id,"start"),le.id;const Re=(()=>{if(q){const $e=Zo(xe.root,q);if($e&&$e.kind==="stack")return q}return pe(xe.root)})();u.current+=1;const ve=u.current;return p($e=>$e.map(et=>{if(et.id!==xe.id)return et;const dt=Os(Oi(et.root,Re,le.id),le.id);return{...et,root:dt,z:ve,minimized:!1,colors:{...et.colors,[le.id]:Mi(Object.values(et.colors))},intents:{...et.intents,[le.id]:{intent:"start",nonce:0}}}})),le.id},[e,m,L,pe]);k.useEffect(()=>{const oe=pp();ue.current=oe;const q=Q=>{var ie;if(Q.t==="hello"){const te=re.current.get(Q.groupId);if(te&&te.ownerWindowId===Q.from)oe.post({t:"group-handoff",to:Q.from,groupId:Q.groupId,group:te});else{const le=v.current.find(xe=>xe.id===Q.groupId);le&&le.ownerWindowId===Q.from&&oe.post({t:"group-handoff",to:Q.from,groupId:Q.groupId,group:le})}}else if(Q.t==="group-return"||Q.t==="bye")if(Q.t==="group-return"){const te=Q.group;te&&te.id===Q.groupId&&(re.current.delete(Q.groupId),ae.current.delete(Q.from),Q.projectId&&Q.projectId!==e&&oO(Q.projectId,Q.groupId),p(le=>{const xe=le.find(Re=>Re.id===Q.groupId),Pe={...te,ownerWindowId:Bt};return xe?le.map(Re=>Re.id===Q.groupId?Pe:Re):[...le,Pe]}))}else ae.current.delete(Q.from),p(te=>te.map(le=>le.ownerWindowId===Q.from?{...le,ownerWindowId:Bt}:le));else if(Q.t==="group-close")re.current.delete(Q.groupId),p(te=>te.filter(le=>le.id!==Q.groupId));else if(Q.t==="heartbeat")ae.current.set(Q.from,Date.now());else if(Q.t==="group-update"){const te=Q.patch;p(le=>le.map(xe=>xe.id===Q.groupId?{...xe,...te}:xe))}else if(Q.t==="dock-probe"){if(document.visibilityState!=="visible")return;const te=yu(Q.x,Q.y),le=wu(te)?vu(te.x,te.y):null;if(le){const xe=he.current;(!xe||xe.zone!==le.zone||xe.groupId!==le.groupId||xe.path.join(".")!==le.path.join("."))&&Y({rect:le.rect,zone:le.zone,path:le.path,groupId:le.groupId}),de.current&&clearTimeout(de.current),de.current=setTimeout(()=>Y(null),800),oe.post({t:"dock-probe-result",from:Bt,to:Q.from,hit:!0,focusAt:ke.current})}else he.current&&Y(null),oe.post({t:"dock-probe-result",from:Bt,to:Q.from,hit:!1,focusAt:ke.current})}else if(Q.t==="dock-end")Y(null);else if(Q.t==="dock-commit"&&Q.to===Bt){const te=yu(Q.x,Q.y),le=wu(te)?vu(te.x,te.y):null,xe=le&&le.zone?le:(ie=he.current)!=null&&ie.zone?he.current:null;let Pe=!1;const Re=v.current.filter(ve=>(ve.ownerWindowId||Bt)===Bt);if(xe&&xe.zone&&!Zr(Re,Q.sessionId)){const ve=v.current.find(et=>et.id===xe.groupId),$e=ve?Zo(ve.root,xe.path):null;if(ve&&$e&&$e.kind==="stack"){Pe=!0;const et=xe.zone,dt=xe.path;u.current+=1;const Be=u.current;p(Ze=>Ze.map(lt=>{if(lt.id!==ve.id)return lt;const Ie=et==="center"?Oi(lt.root,dt,Q.sessionId):Ra(lt.root,dt,et,Ai([Q.sessionId])),Ee=Os(Ie,Q.sessionId),ot={...lt.colors};ot[Q.sessionId]||(ot[Q.sessionId]=Q.color||Mi(Object.values(ot)));const ht={...lt.intents,[Q.sessionId]:Q.intentInfo??{intent:"open",nonce:0}};return{...lt,root:Ee,colors:ot,intents:ht,z:Be,minimized:!1}}))}}Y(null),oe.post({t:"dock-commit-ack",from:Bt,to:Q.from,sessionId:Q.sessionId,accepted:Pe})}},K=oe.subscribe(q);return()=>{K(),oe.close(),ue.current=null}},[e]),k.useEffect(()=>{const oe=Date.now();for(const q of c.groups)q.ownerWindowId&&q.ownerWindowId!==Bt&&ae.current.set(q.ownerWindowId,oe)},[]),k.useEffect(()=>{const oe=async()=>{var xe;const K=Date.now(),Q=[];for(const[Pe,Re]of ae.current.entries())K-Re>J8&&Q.push(Pe);if(Q.length===0)return;const ie=await eO(),te=Q.filter(Pe=>ie.has(Pe)?(ae.current.set(Pe,K),!1):!0);if(te.length===0)return;for(const Pe of te)ae.current.delete(Pe);const le=new Set(te);for(const Pe of v.current)Pe.ownerWindowId&&le.has(Pe.ownerWindowId)&&re.current.delete(Pe.id);for(const Pe of te){const Re=v.current.filter(ve=>ve.ownerWindowId===Pe).map(ve=>ve.id);Re.length>0&&((xe=ue.current)==null||xe.post({t:"group-reclaimed",popoutId:Pe,groupIds:Re,reason:"heartbeat-timeout"}))}p(Pe=>Pe.map(Re=>Re.ownerWindowId&&te.includes(Re.ownerWindowId)?{...Re,ownerWindowId:Bt}:Re))},q=setInterval(()=>{oe()},M_);return()=>clearInterval(q)},[]);const Ye=k.useCallback((oe,q)=>{i({type:"session:terminal-input",sessionId:oe,input:q})},[i]),ge=k.useCallback(()=>{var K,Q;const oe=v.current.filter(ie=>(ie.ownerWindowId||Bt)===Bt).slice().sort((ie,te)=>te.z-ie.z),q=[];for(const ie of oe)for(const te of dn(ie.root)){const le=((K=b.current.find(xe=>xe.id===te))==null?void 0:K.title)||((Q=S.current[te])==null?void 0:Q.title)||te;q.push({sessionId:te,label:le})}return q},[]),Ce=k.useRef(new Map),Ke=k.useCallback(async oe=>{const K=v.current.filter(ie=>!ie.minimized&&(ie.ownerWindowId||Bt)===Bt).reduce((ie,te)=>ie&&ie.z>=te.z?ie:te,null),Q=await Je((K==null?void 0:K.id)??null);Ce.current.set(Q,oe)},[Je]),qe=k.useMemo(()=>({openOrFocus:L,close:z,focus:T,minimize:O,restore:H,isOpen:F,recallPopout:be,closeGroup:U,minimizeGroup:W,restoreGroup:X,setGroupGeometry:J,setSplitSizes:P,setActiveTab:B,reorderTab:I,beginTabDrag:V,dockGroup:se,popOutGroup:Ne,createRawShellTab:Je,sendToSession:Ye,listOpenTerminals:ge,sendToNewTerminal:Ke}),[L,z,T,O,H,F,be,U,W,X,J,P,B,I,V,se,Ne,Je,Ye,ge,Ke]);k.useEffect(()=>{if(Ce.current.size!==0)for(const[oe,q]of Ce.current){const K=s.find(Q=>Q.id===oe)||y[oe];K&&(K.status==="running"?(i({type:"session:terminal-input",sessionId:oe,input:q}),Ce.current.delete(oe)):(K.status==="failed"||K.status==="stopped")&&Ce.current.delete(oe))}},[s,y,i]);const tt=k.useMemo(()=>{const oe={};for(const q of d){const Q=(q.ownerWindowId||Bt)!==Bt?"popped":q.minimized?"minimized":"floating";for(const ie of dn(q.root))oe[ie]=Q}return oe},[d]);k.useEffect(()=>{const oe=q=>{const K=/Mac|iPhone|iPad|iPod/.test(navigator.platform),Q=K?q.metaKey:q.ctrlKey,ie=K?q.ctrlKey:q.metaKey;if(!Q||ie||q.altKey||q.shiftKey||q.key.toLowerCase()!=="t")return;q.preventDefault();const le=v.current.filter(xe=>!xe.minimized&&(xe.ownerWindowId||Bt)===Bt).reduce((xe,Pe)=>xe&&xe.z>=Pe.z?xe:Pe,null);Je((le==null?void 0:le.id)??null).catch(()=>{})};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[Je]);const Oe=k.useMemo(()=>{const oe=new Map;for(const q of Object.values(y))oe.set(q.id,q);for(const q of s)oe.set(q.id,q);return oe},[s,y]),fe=d.filter(oe=>!oe.minimized&&(oe.ownerWindowId||Bt)===Bt),je=fe.reduce((oe,q)=>q.z>oe.z?{id:q.id,z:q.z}:oe,{id:null,z:-1/0}).id;return t.jsx(gp.Provider,{value:qe,children:t.jsxs(z_.Provider,{value:tt,children:[f,(()=>{const oe=new Map(fe.slice().sort((q,K)=>q.z-K.z).map((q,K)=>[q.id,K+1]));return fe.map(q=>{const K=fe.filter(Q=>Q.id!==q.id).map(({x:Q,y:ie,w:te,h:le})=>({x:Q,y:ie,w:te,h:le}));return t.jsx(q8,{group:q,sessionsById:Oe,neighbors:K,isTopmost:q.id===je,zIndex:oe.get(q.id)??1,sendMessage:i,subscribeBinary:a,onEvent:h},q.id)})})(),C&&C.hoveredRect&&t.jsx(ul,{targetRect:C.hoveredRect,activeZone:C.zone}),ee&&t.jsx(ul,{targetRect:ee.rect,activeZone:ee.zone})]})})}function uO(e){if(!e)return[];try{const s=JSON.parse(e);return Array.isArray(s)?s.map(String).filter(Boolean):[]}catch{return[]}}const dO={pending:"bg-warm-200 text-warm-600",running:"bg-status-success/10 text-status-success",completed:"bg-accent/10 text-accent",failed:"bg-status-error/10 text-status-error",stopped:"bg-amber-100 text-amber-700"},hO={floating:"bg-accent/10 text-accent",minimized:"bg-warm-200 text-warm-600",popped:"bg-violet-500/15 text-violet-500"};function fO({projectId:e,sessions:s,projectCliTool:i,isGitRepo:a,projectUseWorktree:h,projectDefaultBranch:m,onAddSession:f,onUpdateSession:o,onStopSession:c,onDeleteSession:d,onCleanupSession:p}){const{t:u}=it(),{openOrFocus:v,recallPopout:b}=B_(),C=tO(),[w,x]=k.useState(!1),[y,_]=k.useState(!1),[S,N]=k.useState(null),[D,j]=k.useState(!1),[R,L]=k.useState(null),[T,A]=k.useState([]),[z,O]=k.useState(""),[H,F]=k.useState(null);k.useEffect(()=>{let $=!1;return Hm().then(se=>{$||A(se)}).catch(()=>{}),()=>{$=!0}},[]),k.useEffect(()=>{if(!a)return;let $=!1;return jw(e).then(se=>{$||O(se.branch||"")}).catch(()=>{}),()=>{$=!0}},[e,a]);const U=k.useMemo(()=>{const $=new Map;for(const se of T)$.set(se.id,se);return $},[T]),W=k.useMemo(()=>S?s.find($=>$.id===S)??null:null,[S,s]),X=k.useMemo(()=>{if(W)return{title:W.title,description:W.description??"",cliTool:W.cli_tool??"",useWorktree:W.use_worktree===1,memoryInjectMode:W.memory_inject_mode??"none",memoryNodeIds:a8(W.memory_node_ids??null),memoryRawFilePaths:uO(W.memory_raw_file_paths??null),tagId:W.tag_id??null}},[W]),J=k.useCallback(()=>{N(null),L(null),x($=>!$)},[]),P=k.useCallback($=>{x(!1),L(null),N($)},[]),B=k.useCallback(()=>{x(!1),N(null),L(null)},[]),I=k.useCallback(async($,se,ue,ae,ee,Y,he,de)=>{_(!0);try{const ke=await Jw(e,{title:$,description:se||void 0,cli_tool:ue,use_worktree:ae,memory_inject_mode:ee,memory_node_ids:Y,memory_raw_file_paths:he,tag_id:de??null});f(ke),x(!1)}finally{_(!1)}},[e,f]),V=k.useCallback(async($,se,ue,ae,ee,Y,he,de)=>{if(S){j(!0),L(null);try{const ke=await T3(S,{title:$,description:se||void 0,cli_tool:ue,use_worktree:ae,memory_inject_mode:ee,memory_node_ids:Y,memory_raw_file_paths:he,tag_id:de??null});o(ke),N(null)}catch(ke){L(ke instanceof Error?ke.message:String(ke))}finally{j(!1)}}},[S,o]);return t.jsxs("div",{className:"space-y-4 animate-fade-in min-h-[50vh]",onContextMenu:$=>{li($)||($.preventDefault(),F({x:$.clientX,y:$.clientY,sessionId:null}))},children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-sm font-semibold text-warm-700 tracking-wide uppercase",children:u("tabs.sessions")}),t.jsxs("button",{onClick:J,className:"btn-primary text-xs py-2",disabled:y,children:["+ ",u("session.new")]})]}),w&&t.jsx(Yb,{projectId:e,onSave:I,onCancel:B,projectCliTool:i,isGitRepo:a,projectUseWorktree:h}),X&&S&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Yb,{projectId:e,initial:X,onSave:V,onCancel:B,projectCliTool:i,isGitRepo:a},S),(D||R)&&t.jsxs("div",{className:"text-xs px-1",children:[D&&t.jsx("span",{className:"text-warm-500",children:u("session.saving")||"saving…"}),R&&t.jsx("span",{className:"text-status-error",children:R})]})]}),s.length===0&&!w?t.jsx("div",{className:"card",children:t.jsx(Fi,{icon:rl,title:u("session.empty"),description:u("session.emptyHint")})}):t.jsx("div",{className:"space-y-3",children:s.map(($,se)=>{const ue=["pending","failed","stopped","completed"].includes($.status),ae=$.status==="running",ee=$.status!=="running",Y=["stopped","failed","completed"].includes($.status)&&($.cli_tool??"claude")==="claude"&&!!$.worktree_path,he=S===$.id,de=C[$.id]??"closed",ke=de==="popped";return t.jsx("div",{className:`card overflow-hidden animate-slide-up ${he?"border-l-4 border-accent bg-warm-100/30":""}`,style:{animationDelay:`${se*50}ms`},onContextMenu:re=>{li(re)||(re.preventDefault(),re.stopPropagation(),F({x:re.clientX,y:re.clientY,sessionId:$.id}))},children:t.jsx("div",{className:"p-4 cursor-pointer hover:bg-warm-50/50 transition-colors",onClick:()=>ke?b($.id):v($.id,"open"),children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[$.tag_id&&U.get($.tag_id)&&t.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-2xs font-medium",style:{backgroundColor:`${U.get($.tag_id).color}22`,color:U.get($.tag_id).color},children:[t.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:U.get($.tag_id).color}}),U.get($.tag_id).name]}),t.jsx("h3",{className:"text-sm font-semibold text-warm-700 truncate",children:$.title}),t.jsx("span",{className:`px-1.5 py-0.5 rounded text-2xs font-semibold uppercase ${dO[$.status]||""}`,children:u(`status.${$.status}`)||$.status}),de!=="closed"&&t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-2xs font-medium ${hO[de]}`,title:ke?u("session.dock.poppedHint"):void 0,children:[ke&&t.jsx(ii,{size:10}),u(`session.windowState.${de}`)]})]}),$.description&&t.jsx("p",{className:"text-xs text-warm-400 mt-1 line-clamp-1",children:$.description}),t.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[t.jsx("span",{className:"text-2xs text-warm-300",children:$.cli_tool||"claude"}),($.branch_name||a&&(z||m))&&t.jsxs("span",{className:"text-2xs text-accent/70 flex items-center gap-0.5",children:[t.jsx(Fa,{size:12}),$.branch_name||z||m]})]})]}),t.jsxs("div",{className:"flex gap-1",onClick:re=>re.stopPropagation(),children:[ke&&t.jsx("button",{onClick:()=>b($.id),className:"p-1.5 text-violet-500 hover:bg-violet-500/10 rounded transition-colors",title:u("session.recallToMain"),children:t.jsx(sl,{size:16})}),ue&&t.jsx("button",{onClick:()=>v($.id,"start"),className:"p-1.5 text-status-success hover:bg-status-success/10 rounded transition-colors",title:u("session.start"),children:t.jsx(wr,{size:16})}),Y&&t.jsx("button",{onClick:()=>v($.id,"resume"),className:"p-1.5 text-accent hover:bg-accent/10 rounded transition-colors",title:u("session.resumeHint")||u("session.resume"),children:t.jsx(oi,{size:16})}),t.jsx("button",{onClick:()=>P($.id),disabled:!ee,className:"p-1.5 text-warm-500 hover:text-warm-800 hover:bg-warm-100 rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-warm-500",title:u(ee?"session.edit":"session.editDisabledRunning"),children:t.jsx(qf,{size:16})}),ae&&t.jsx("button",{onClick:()=>c($.id),className:"p-1.5 text-amber-600 hover:bg-amber-50 rounded transition-colors",title:u("session.stop"),children:t.jsx(il,{size:16})}),$.status!=="running"&&(!!$.worktree_path||!!$.branch_name)&&t.jsx("button",{onClick:()=>{const re=$.branch_name?confirm(u("cleanup.confirmDeleteBranch").replace("{name}",$.branch_name)):!1;p($.id,re)},className:"p-1.5 text-warm-400 hover:text-amber-600 rounded transition-colors",title:u("session.cleanup"),children:t.jsx(au,{size:16})}),t.jsx("button",{onClick:()=>d($.id),className:"p-1.5 text-warm-400 hover:text-status-error rounded transition-colors",title:u("session.delete"),children:t.jsx(Nn,{size:16})})]})]})})},$.id)})}),H&&(()=>{const $=()=>F(null),se=H.sessionId?s.find(Fe=>Fe.id===H.sessionId):void 0;if(!se)return t.jsx(_r,{x:H.x,y:H.y,onClose:$,children:t.jsxs("button",{type:"button",onClick:()=>{N(null),L(null),x(!0)},className:en,children:[t.jsx(mn,{size:14}),u("session.new")]})});const ue=["pending","failed","stopped","completed"].includes(se.status),ae=se.status==="running",ee=se.status!=="running",Y=["stopped","failed","completed"].includes(se.status)&&(se.cli_tool??"claude")==="claude"&&!!se.worktree_path,he=se.status!=="running"&&(!!se.worktree_path||!!se.branch_name),de=C[se.id]??"closed",ke=de==="popped",re=u(ke?"session.recallToMain":de==="minimized"?"session.restoreWindow":de==="floating"?"session.focusWindow":"session.openWindow");return t.jsxs(_r,{x:H.x,y:H.y,onClose:$,children:[t.jsxs("button",{type:"button",onClick:()=>ke?b(se.id):v(se.id,"open"),className:en,children:[ke?t.jsx(sl,{size:14}):t.jsx(rl,{size:14}),re]}),ue&&t.jsxs("button",{type:"button",onClick:()=>v(se.id,"start"),className:en,children:[t.jsx(wr,{size:14}),u("session.start")]}),Y&&t.jsxs("button",{type:"button",onClick:()=>v(se.id,"resume"),className:en,title:u("session.resumeHint")||u("session.resume"),children:[t.jsx(oi,{size:14}),u("session.resume")]}),ee&&t.jsxs("button",{type:"button",onClick:()=>P(se.id),className:en,children:[t.jsx(qf,{size:14}),u("session.edit")]}),ae&&t.jsxs("button",{type:"button",onClick:()=>c(se.id),className:en,children:[t.jsx(il,{size:14}),u("session.stop")]}),he&&t.jsxs("button",{type:"button",onClick:()=>{const Fe=se.branch_name?confirm(u("cleanup.confirmDeleteBranch").replace("{name}",se.branch_name)):!1;p(se.id,Fe)},className:en,children:[t.jsx(au,{size:14}),u("session.cleanup")]}),t.jsx(u_,{}),t.jsxs("button",{type:"button",onClick:()=>d(se.id),className:up,children:[t.jsx(Nn,{size:14}),u("session.delete")]})]})})()]})}const Su={default:{bg:"bg-warm-200/50",text:"text-warm-500",swatch:"bg-warm-300"},gray:{bg:"bg-gray-500/20",text:"text-gray-400",swatch:"bg-gray-400"},brown:{bg:"bg-amber-800/20",text:"text-amber-600",swatch:"bg-amber-700"},orange:{bg:"bg-orange-500/20",text:"text-orange-400",swatch:"bg-orange-500"},yellow:{bg:"bg-yellow-500/20",text:"text-yellow-400",swatch:"bg-yellow-500"},green:{bg:"bg-emerald-500/20",text:"text-emerald-400",swatch:"bg-emerald-500"},blue:{bg:"bg-blue-500/20",text:"text-blue-400",swatch:"bg-blue-500"},purple:{bg:"bg-purple-500/20",text:"text-purple-400",swatch:"bg-purple-500"},pink:{bg:"bg-pink-500/20",text:"text-pink-400",swatch:"bg-pink-500"},red:{bg:"bg-red-500/20",text:"text-red-400",swatch:"bg-red-500"}},mO=Object.keys(Su);function Aa(e){const s=Su[e]||Su.default;return`${s.bg} ${s.text}`}function vp({src:e,alt:s,onClose:i}){return k.useEffect(()=>{const a=h=>{h.key==="Escape"&&i()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[i]),tn.createPortal(t.jsxs("div",{className:"fixed inset-0 z-tooltip flex items-center justify-center p-6",style:{backgroundColor:"rgba(0,0,0,0.85)"},onClick:i,children:[t.jsx("button",{type:"button",onClick:i,className:"absolute top-4 right-4 h-9 w-9 rounded-full bg-white/10 text-white flex items-center justify-center hover:bg-white/20 transition-colors","aria-label":"close",children:t.jsx(Xt,{size:18})}),t.jsx("img",{src:e,alt:s,className:"max-w-full max-h-full object-contain rounded-lg",onClick:a=>a.stopPropagation()})]}),document.body)}function _m({anchorRef:e,width:s,onClose:i,className:a,style:h,children:m}){const f=k.useRef(null),[o,c]=k.useState(null);return k.useLayoutEffect(()=>{const d=e.current;if(!d)return;const p=d.getBoundingClientRect();let u=p.left;u+s>window.innerWidth-8&&(u=Math.max(8,window.innerWidth-8-s)),u<8&&(u=8),c({top:p.bottom+4,left:u})},[e,s]),k.useEffect(()=>{const d=u=>{var b,C;const v=u.target;(b=f.current)!=null&&b.contains(v)||(C=e.current)!=null&&C.contains(v)||i()},p=()=>i();return document.addEventListener("mousedown",d),window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{document.removeEventListener("mousedown",d),window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[i,e]),o?tn.createPortal(t.jsx("div",{ref:f,className:a,style:{position:"fixed",top:o.top,left:o.left,width:s,...h},children:m}),document.body):null}const vy={pending:"bg-warm-200 text-warm-500",in_progress:"bg-blue-500/10 text-blue-600",done:"bg-emerald-500/10 text-emerald-600",moved:"bg-purple-500/10 text-purple-600"},by={0:{label:"—",style:"text-warm-300"},1:{label:"●",style:"text-warm-500"},2:{label:"●●",style:"text-amber-500"},3:{label:"●●●",style:"text-red-500"}};function pO({item:e,tagColors:s,existingTags:i,onSave:a,onDelete:h,onConvertToTodo:m,onConvertToSchedule:f,onConvertToSession:o,onUpdateTag:c}){var je,oe;const{t:d}=it(),[p,u]=k.useState(!1),[v,b]=k.useState(!1),[C,w]=k.useState(!1),x=k.useRef(null),y=k.useRef(null),[_,S]=k.useState({top:0,left:0}),[N,D]=k.useState(e.title),[j,R]=k.useState(e.description??""),[L,T]=k.useState(e.priority),[A,z]=k.useState(e.due_date??""),[O,H]=k.useState(e.status),[F,U]=k.useState(()=>{try{return e.tags?JSON.parse(e.tags):[]}catch{return[]}}),[W,X]=k.useState(""),[J,P]=k.useState(!1),[B,I]=k.useState(null),[V,$]=k.useState(null),se=k.useRef(null),ue=k.useRef(null),[ae,ee]=k.useState(()=>{try{return e.images?JSON.parse(e.images):[]}catch{return[]}}),Y=k.useRef(null);k.useEffect(()=>{D(e.title),R(e.description??""),T(e.priority),z(e.due_date??""),H(e.status);try{U(e.tags?JSON.parse(e.tags):[])}catch{U([])}try{ee(e.images?JSON.parse(e.images):[])}catch{ee([])}},[e]);const he=F,de=e.status==="moved",ke=e.due_date&&new Date(e.due_date)<new Date&&!de&&e.status!=="done",re=k.useCallback(q=>{a(e.id,q)},[e.id,a]),Fe=()=>{const q=N.trim();q&&q!==e.title?re({title:q}):D(e.title)},Ne=()=>{const q=j.trim();q!==(e.description??"")&&re({description:q||void 0})},Te=q=>{T(q),q!==e.priority&&re({priority:q})},be=q=>{z(q),q!==(e.due_date??"")&&re({due_date:q||void 0})},pe=q=>{const K=q;H(K),K!==e.status&&re({status:K})},Je=q=>{U(q);const K=(()=>{try{return e.tags?JSON.parse(e.tags):[]}catch{return[]}})();JSON.stringify(q)!==JSON.stringify(K)&&re({tags:q.length>0?JSON.stringify(q):void 0})},Ye=q=>{var Q;const K=q.trim();if(K&&!F.includes(K)&&(Je([...F,K]),!s.has(K)&&c)){const ie=["blue","green","orange","purple","pink","red","yellow","brown"],te=ie[s.size%ie.length];c(K,{color:te})}X(""),(Q=se.current)==null||Q.focus()},ge=q=>Je(F.filter(K=>K!==q)),Ce=i.filter(q=>!F.includes(q)&&(!W||q.toLowerCase().includes(W.toLowerCase()))),Ke=k.useCallback(q=>{const K=Array.from(q).filter(te=>te.type.startsWith("image/")),Q=[];let ie=0;for(const te of K){const le=new FileReader;le.onload=()=>{Q.push({name:te.name,data:le.result}),ie++,ie===K.length&&Zw(e.id,Q).then(xe=>ee(xe.images))},le.readAsDataURL(te)}},[e.id]),qe=k.useCallback(q=>{var ie;const K=(ie=q.clipboardData)==null?void 0:ie.items;if(!K)return;const Q=[];for(let te=0;te<K.length;te++)if(K[te].type.startsWith("image/")){const le=K[te].getAsFile();le&&Q.push(le)}Q.length!==0&&(q.preventDefault(),Ke(Q))},[Ke]),tt=k.useCallback(q=>{var K;q.preventDefault(),q.stopPropagation(),(K=q.dataTransfer)!=null&&K.files&&Ke(q.dataTransfer.files)},[Ke]),Oe=k.useCallback(q=>{e1(e.id,q).then(()=>{ee(K=>K.filter(Q=>Q.id!==q))})},[e.id]),fe=k.useCallback(()=>{if(!x.current)return;const q=x.current.getBoundingClientRect(),K=window.innerWidth,Q=window.innerHeight;let ie=q.bottom+4;const te=y.current;if(te){const le=te.offsetWidth,xe=te.offsetHeight;let Pe=q.right-le;Pe<8&&(Pe=8),Pe+le>K-8&&(Pe=K-8-le),ie+xe>Q-8&&(ie=q.top-xe-4),S({top:ie,left:Pe}),w(!0)}else S({top:ie,left:Math.max(8,q.right-180)})},[]);return k.useEffect(()=>{if(!p){w(!1);return}fe();const q=requestAnimationFrame(fe),K=Q=>{var te,le;const ie=Q.target;(te=x.current)!=null&&te.contains(ie)||(le=y.current)!=null&&le.contains(ie)||u(!1)};return document.addEventListener("mousedown",K),window.addEventListener("scroll",fe,!0),window.addEventListener("resize",fe),()=>{cancelAnimationFrame(q),document.removeEventListener("mousedown",K),window.removeEventListener("scroll",fe,!0),window.removeEventListener("resize",fe)}},[p,fe]),t.jsxs("div",{className:`${de?"opacity-50":""}`,style:{borderBottom:"1px solid var(--color-border-muted)"},children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 rounded-lg transition-colors hover:bg-warm-50 cursor-pointer",onDoubleClick:()=>b(!v),children:[t.jsx(Ts,{size:14,className:`text-warm-400 transition-transform duration-200 flex-shrink-0 ${v?"rotate-90":""}`,onClick:q=>{q.stopPropagation(),b(!v)}}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:"text-sm font-medium truncate block",style:{color:"var(--color-text-primary)"},children:e.title}),de&&e.converted_type&&t.jsxs("span",{className:"text-2xs text-purple-500",children:["→ ",e.converted_type==="todo"?d("planner.movedToTodo"):e.converted_type==="session"?d("planner.movedToSession"):d("planner.movedToSchedule")]}),e.source_discussion_id&&t.jsxs(zn,{to:`/projects/${e.project_id}/discussions/${e.source_discussion_id}`,onClick:q=>q.stopPropagation(),className:"inline-flex items-center gap-1 text-2xs text-accent hover:underline mt-0.5",title:d("planner.fromDiscussion"),children:[t.jsx(V5,{size:11}),d("planner.fromDiscussion")]})]}),t.jsxs("div",{className:"hidden sm:flex items-center gap-1 w-[160px] flex-shrink-0 overflow-hidden",children:[ae.length>0&&t.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-medium bg-warm-100 text-warm-500 whitespace-nowrap",children:[t.jsx(Oa,{size:10}),ae.length]}),he.map(q=>t.jsx("span",{className:`px-2 py-0.5 rounded text-2xs font-medium whitespace-nowrap ${Aa(s.get(q)||"default")}`,children:q},q))]}),t.jsx("div",{className:"hidden sm:block w-12 text-center flex-shrink-0",children:t.jsx("span",{className:`text-xs font-medium ${((je=by[e.priority])==null?void 0:je.style)??"text-warm-300"}`,children:((oe=by[e.priority])==null?void 0:oe.label)??"—"})}),t.jsx("div",{className:"hidden md:block w-20 text-right flex-shrink-0",children:e.due_date?t.jsx("span",{className:`text-xs ${ke?"text-red-500 font-medium":"text-warm-500"}`,children:new Date(e.due_date).toLocaleDateString(void 0,{month:"numeric",day:"numeric"})}):t.jsx("span",{className:"text-xs text-warm-300",children:d("planner.noDueDate")})}),t.jsx("div",{className:"w-16 flex-shrink-0",children:t.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-2xs font-semibold ${vy[e.status]||vy.pending}`,children:d(`plannerStatus.${e.status}`)})}),t.jsxs("div",{className:"w-8 flex-shrink-0",children:[t.jsx("button",{ref:x,onClick:q=>{q.stopPropagation(),u(!p)},className:"p-1.5 text-warm-400 hover:text-warm-600 hover:bg-warm-100/50 rounded-lg transition-colors",children:t.jsx(Am,{size:14})}),p&&tn.createPortal(t.jsxs("div",{ref:y,className:`fixed z-tooltip min-w-[160px] rounded-xl py-1 shadow-elevated${C?" animate-scale-in":""}`,style:{top:_.top,left:_.left,opacity:C?1:0,backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)"},onClick:()=>u(!1),children:[!de&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:m,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-warm-100 rounded-md transition-colors text-left",style:{color:"var(--color-text-primary)"},children:[t.jsx(fw,{size:12})," ",d("planner.convertToTask")]}),t.jsxs("button",{onClick:f,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-warm-100 rounded-md transition-colors text-left",style:{color:"var(--color-text-primary)"},children:[t.jsx(ri,{size:12})," ",d("planner.convertToSchedule")]}),t.jsxs("button",{onClick:o,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-warm-100 rounded-md transition-colors text-left",style:{color:"var(--color-text-primary)"},children:[t.jsx(Ba,{size:12})," ",d("planner.convertToTerminal")]})]}),t.jsxs("button",{onClick:()=>{confirm(d("planner.deleteConfirm"))&&h()},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-red-500 hover:bg-red-50 rounded-md transition-colors text-left",children:[t.jsx(Nn,{size:12})," ",d("planner.delete")]})]}),document.body)]})]}),v&&t.jsx("div",{className:"px-4 pb-3 pt-1 ml-8 animate-fade-in",children:t.jsxs("div",{className:"rounded-lg px-4 py-3 space-y-3",style:{backgroundColor:"var(--color-bg-tertiary)"},children:[t.jsx("input",{className:"bg-transparent text-sm font-medium w-full outline-none border-b border-transparent focus:border-warm-300 pb-0.5 transition-colors",style:{color:"var(--color-text-primary)"},value:N,onChange:q=>D(q.target.value),onBlur:Fe,onKeyDown:q=>{q.key==="Enter"&&(q.preventDefault(),Fe(),q.target.blur())}}),t.jsx("textarea",{className:"bg-transparent text-sm w-full outline-none border border-transparent focus:border-warm-300 rounded-md p-1 transition-colors min-h-[76px] max-h-[320px] resize-y [field-sizing:content]",style:{color:"var(--color-text-secondary)"},rows:3,placeholder:d("plannerForm.descPlaceholder"),value:j,onChange:q=>R(q.target.value),onPaste:qe,onDrop:tt,onDragOver:q=>{q.preventDefault(),q.stopPropagation()},onBlur:Ne}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[t.jsxs("button",{type:"button",onClick:()=>{var q;return(q=Y.current)==null?void 0:q.click()},className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-medium text-warm-400 hover:text-warm-600 hover:bg-warm-100 transition-colors",children:[t.jsx(Oa,{size:12}),d("plannerForm.addImage")]}),t.jsx("span",{className:"text-[10px] text-warm-300",children:d("plannerForm.pasteHint")})]}),t.jsx("input",{ref:Y,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:q=>{q.target.files&&Ke(q.target.files),q.target.value=""}}),ae.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2",children:ae.map(q=>t.jsxs("div",{className:"relative group",children:[t.jsx("img",{src:hu(e.id,q.id),alt:q.originalName,onClick:()=>$(hu(e.id,q.id)),className:"h-20 w-20 object-cover rounded-lg border border-warm-200 cursor-zoom-in"}),t.jsx("button",{type:"button",onClick:()=>Oe(q.id),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-red-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(Xt,{size:12,strokeWidth:3})}),t.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/50 rounded-b-lg px-1 py-0.5",children:t.jsx("span",{className:"text-[8px] text-white truncate block",children:q.originalName})})]},q.id))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-2xs text-warm-400 mb-1 block",children:d("plannerForm.tags")}),t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[F.map(q=>t.jsxs("div",{className:"relative",children:[t.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-2xs font-medium cursor-pointer hover:ring-1 hover:ring-warm-400 transition-all ${Aa(s.get(q)||"default")}`,onClick:K=>{ue.current=K.currentTarget,I(B===q?null:q)},children:[q,t.jsx("button",{onClick:K=>{K.stopPropagation(),ge(q)},className:"opacity-60 hover:opacity-100",children:t.jsx(Xt,{size:9})})]}),B===q&&t.jsxs(_m,{anchorRef:ue,width:180,onClose:()=>I(null),className:"p-2 rounded-lg shadow-elevated z-tooltip",style:{backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)"},children:[t.jsx("div",{className:"text-2xs text-warm-400 mb-1.5",children:d("plannerTag.color")}),t.jsx("div",{className:"grid grid-cols-5 gap-1.5",children:mO.map(K=>t.jsx("button",{onClick:async()=>{c&&await c(q,{color:K}),I(null)},className:`aspect-square rounded-md flex items-center justify-center transition-all ${s.get(q)===K?"ring-2 ring-accent ring-offset-1":"hover:scale-110"}`,title:d(`plannerTag.color.${K}`),children:t.jsx("div",{className:`w-5 h-5 rounded ${Su[K].swatch}`})},K))})]})]},q)),t.jsxs("div",{className:"relative",children:[t.jsx("input",{ref:se,className:"bg-transparent text-xs outline-none w-24",style:{color:"var(--color-text-primary)"},placeholder:"+",value:W,onChange:q=>{X(q.target.value),P(!0)},onKeyDown:q=>{(q.key==="Enter"||q.key===",")&&W.trim()&&(q.preventDefault(),Ye(W.replace(",",""))),q.key==="Backspace"&&!W&&F.length>0&&ge(F[F.length-1])},onFocus:()=>P(!0),onBlur:()=>setTimeout(()=>P(!1),150)}),J&&Ce.length>0&&t.jsx(_m,{anchorRef:se,width:160,onClose:()=>P(!1),className:"rounded-lg shadow-elevated z-tooltip py-1 max-h-32 overflow-y-auto",style:{backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)"},children:Ce.slice(0,8).map(q=>t.jsx("button",{className:"flex items-center w-full px-2 py-1 hover:bg-warm-100/50 transition-colors text-left",onMouseDown:()=>Ye(q),children:t.jsx("span",{className:`px-2 py-0.5 rounded text-2xs font-medium ${Aa(s.get(q)||"default")}`,children:q})},q))})]})]})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-2xs text-warm-400 mb-1 block",children:d("plannerForm.priority")}),t.jsxs("select",{className:"input-field text-xs w-full py-1",value:L,onChange:q=>Te(Number(q.target.value)),children:[t.jsx("option",{value:0,children:d("plannerForm.priorityLow")}),t.jsx("option",{value:1,children:d("plannerForm.priorityNormal")}),t.jsx("option",{value:2,children:d("plannerForm.priorityHigh")}),t.jsx("option",{value:3,children:d("plannerForm.priorityCritical")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-2xs text-warm-400 mb-1 block",children:d("plannerForm.dueDate")}),t.jsx("input",{type:"date",className:"input-field text-xs w-full py-1",value:A,onChange:q=>be(q.target.value)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-2xs text-warm-400 mb-1 block",children:d("plannerForm.status")}),t.jsxs("select",{className:"input-field text-xs w-full py-1",value:O,onChange:q=>pe(q.target.value),children:[t.jsx("option",{value:"pending",children:d("plannerStatus.pending")}),t.jsx("option",{value:"in_progress",children:d("plannerStatus.in_progress")}),t.jsx("option",{value:"done",children:d("plannerStatus.done")})]})]})]})]})}),V&&t.jsx(vp,{src:V,onClose:()=>$(null)})]})}let gO=0;function xO({existingTags:e,editItem:s,initialDueDate:i,onSave:a,onCancel:h,onUpdateTag:m}){const{t:f}=it(),[o,c]=k.useState(""),[d,p]=k.useState(""),[u,v]=k.useState([]),[b,C]=k.useState(""),[w,x]=k.useState(i??""),[y,_]=k.useState(0),[S,N]=k.useState("pending"),[D,j]=k.useState(!1),[R,L]=k.useState(!1),[T,A]=k.useState([]),[z,O]=k.useState([]),[H,F]=k.useState(null),U=k.useRef(null),W=k.useRef(null),X=k.useRef(null),[J,P]=k.useState(new Map),B=new Map([...e.map(re=>[re.name,re.color]),...J]),I=["blue","green","orange","purple","pink","red","yellow","brown"];k.useEffect(()=>{var re;if(s){c(s.title),p(s.description??""),v(s.tags?JSON.parse(s.tags):[]),x(s.due_date??""),_(s.priority),N(s.status);try{O(s.images?JSON.parse(s.images):[])}catch{O([])}}(re=U.current)==null||re.focus()},[s]);const V=e.filter(re=>!u.includes(re.name)&&(!b||re.name.toLowerCase().includes(b.toLowerCase()))),$=re=>{var Ne;const Fe=re.trim();Fe&&!u.includes(Fe)&&v(Te=>{const be=[...Te,Fe];if(!B.has(Fe)){const pe=I[B.size%I.length];P(Je=>new Map([...Je,[Fe,pe]]))}return be}),C(""),L(!0),(Ne=W.current)==null||Ne.focus()},se=re=>v(u.filter(Fe=>Fe!==re)),ue=k.useCallback(re=>{const Fe=Array.from(re).filter(Ne=>Ne.type.startsWith("image/"));for(const Ne of Fe){const Te=new FileReader;Te.onload=()=>{const be=Te.result,pe=`pending-${++gO}`;A(Je=>[...Je,{id:pe,name:Ne.name,data:be,preview:be}])},Te.readAsDataURL(Ne)}},[]),ae=k.useCallback(re=>{var Te;const Fe=(Te=re.clipboardData)==null?void 0:Te.items;if(!Fe)return;const Ne=[];for(let be=0;be<Fe.length;be++)if(Fe[be].type.startsWith("image/")){const pe=Fe[be].getAsFile();pe&&Ne.push(pe)}Ne.length!==0&&(re.preventDefault(),ue(Ne))},[ue]),ee=k.useCallback(re=>{var Fe;re.preventDefault(),re.stopPropagation(),(Fe=re.dataTransfer)!=null&&Fe.files&&ue(re.dataTransfer.files)},[ue]),Y=re=>A(Fe=>Fe.filter(Ne=>Ne.id!==re)),he=re=>{s&&e1(s.id,re),O(Fe=>Fe.filter(Ne=>Ne.id!==re))},de=z.length+T.length,ke=async()=>{if(o.trim()){j(!0);try{const re=await a({title:o.trim(),description:d.trim()||void 0,tags:u.length>0?JSON.stringify(u):void 0,due_date:w||void 0,priority:y,...s?{status:S}:{}});if(m&&J.size>0&&await Promise.all([...J.entries()].map(([Fe,Ne])=>m(Fe,{color:Ne}))),T.length>0){const Fe=(s==null?void 0:s.id)??(re==null?void 0:re.id);Fe&&await Zw(Fe,T.map(Ne=>({name:Ne.name,data:Ne.data})))}}finally{j(!1)}}};return t.jsxs("div",{className:"card p-5 animate-slide-up",style:{borderColor:"var(--color-accent)",borderWidth:"1px"},children:[t.jsx("input",{ref:U,className:"input-field text-sm w-full mb-3",placeholder:f("plannerForm.titlePlaceholder"),value:o,onChange:re=>c(re.target.value),onKeyDown:re=>{re.key==="Enter"&&re.preventDefault()}}),t.jsx("textarea",{className:"prompt-field text-sm w-full mb-3 min-h-[76px] max-h-[320px] resize-y [field-sizing:content]",rows:3,placeholder:f("plannerForm.descPlaceholder"),value:d,onChange:re=>p(re.target.value),onPaste:ae,onDrop:ee,onDragOver:re=>{re.preventDefault(),re.stopPropagation()}}),t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsxs("button",{type:"button",onClick:()=>{var re;return(re=X.current)==null?void 0:re.click()},className:"inline-flex items-center gap-1 px-2 py-1 rounded text-[10px] font-medium text-warm-400 hover:text-warm-600 hover:bg-warm-100 transition-colors",children:[t.jsx(Oa,{size:14}),f("plannerForm.addImage")]}),t.jsx("span",{className:"text-[10px] text-warm-300",children:f("plannerForm.pasteHint")})]}),t.jsx("input",{ref:X,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:re=>{re.target.files&&ue(re.target.files),re.target.value=""}}),de>0&&t.jsxs("div",{className:"mb-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx("h4",{className:"text-xs font-semibold text-warm-500 uppercase tracking-wider",children:f("plannerForm.images")}),t.jsxs("span",{className:"text-[10px] text-warm-400",children:["(",de,")"]})]}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[z.map(re=>t.jsxs("div",{className:"relative group",children:[t.jsx("img",{src:s?hu(s.id,re.id):"",alt:re.originalName,onClick:()=>s&&F(hu(s.id,re.id)),className:"h-20 w-20 object-cover rounded-lg border border-warm-200 cursor-zoom-in"}),t.jsx("button",{type:"button",onClick:()=>he(re.id),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-red-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(Xt,{size:12,strokeWidth:3})}),t.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/50 rounded-b-lg px-1 py-0.5",children:t.jsx("span",{className:"text-[8px] text-white truncate block",children:re.originalName})})]},re.id)),T.map(re=>t.jsxs("div",{className:"relative group",children:[t.jsx("img",{src:re.preview,alt:re.name,onClick:()=>F(re.preview),className:"h-20 w-20 object-cover rounded-lg border border-blue-300/30 cursor-zoom-in"}),t.jsx("button",{type:"button",onClick:()=>Y(re.id),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-red-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(Xt,{size:12,strokeWidth:3})}),t.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/50 rounded-b-lg px-1 py-0.5",children:t.jsx("span",{className:"text-[8px] text-white truncate block",children:re.name})})]},re.id))]})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:f("plannerForm.tags")}),t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-2 rounded-xl",style:{backgroundColor:"var(--color-bg-input)",border:"1px solid var(--color-border-strong)"},children:[u.map(re=>t.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-[11px] font-medium ${Aa(B.get(re)||"default")}`,children:[re,t.jsx("button",{onClick:()=>se(re),className:"opacity-60 hover:opacity-100",children:t.jsx(Xt,{size:10})})]},re)),t.jsxs("div",{className:"relative flex-1 min-w-[120px]",children:[t.jsx("input",{ref:W,className:"bg-transparent text-sm outline-none w-full",style:{color:"var(--color-text-primary)"},placeholder:u.length===0?f("plannerForm.tagsPlaceholder"):"",value:b,onChange:re=>{C(re.target.value),L(!0)},onKeyDown:re=>{(re.key==="Enter"||re.key===",")&&b.trim()&&(re.preventDefault(),$(b.replace(",",""))),re.key==="Backspace"&&!b&&u.length>0&&se(u[u.length-1])},onFocus:()=>L(!0),onBlur:()=>setTimeout(()=>L(!1),150)}),R&&(V.length>0||b.trim())&&t.jsxs(_m,{anchorRef:W,width:208,onClose:()=>L(!1),className:"rounded-lg shadow-elevated z-tooltip py-1.5 max-h-48 overflow-y-auto",style:{backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)"},children:[V.slice(0,10).map(re=>t.jsx("button",{className:"flex items-center w-full px-2.5 py-1 hover:bg-warm-100/50 transition-colors text-left",onMouseDown:()=>$(re.name),children:t.jsx("span",{className:`px-2 py-0.5 rounded text-[11px] font-medium ${Aa(re.color)}`,children:re.name})},re.name)),b.trim()&&!e.some(re=>re.name===b.trim())&&t.jsx("button",{className:"flex items-center w-full px-2.5 py-1 hover:bg-warm-100/50 transition-colors text-left",onMouseDown:()=>$(b),children:t.jsxs("span",{className:"text-xs text-warm-500",children:['+ "',b.trim(),'"']})})]})]})]})]}),t.jsxs("div",{className:`grid gap-3 mb-4 ${s?"grid-cols-3":"grid-cols-2"}`,children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:f("plannerForm.dueDate")}),t.jsx("input",{type:"date",className:"input-field text-xs w-full",value:w,onChange:re=>x(re.target.value)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:f("plannerForm.priority")}),t.jsxs("select",{className:"input-field text-xs w-full",value:y,onChange:re=>_(Number(re.target.value)),children:[t.jsx("option",{value:0,children:f("plannerForm.priorityLow")}),t.jsx("option",{value:1,children:f("plannerForm.priorityNormal")}),t.jsx("option",{value:2,children:f("plannerForm.priorityHigh")}),t.jsx("option",{value:3,children:f("plannerForm.priorityCritical")})]})]}),s&&t.jsxs("div",{children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:f("plannerForm.status")}),t.jsxs("select",{className:"input-field text-xs w-full",value:S,onChange:re=>N(re.target.value),children:[t.jsx("option",{value:"pending",children:f("plannerStatus.pending")}),t.jsx("option",{value:"in_progress",children:f("plannerStatus.in_progress")}),t.jsx("option",{value:"done",children:f("plannerStatus.done")})]})]})]}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsx("button",{className:"btn-ghost text-xs",onClick:h,children:f("plannerForm.cancel")}),t.jsx("button",{className:"btn-primary text-xs py-2",onClick:ke,disabled:!o.trim()||D,children:f("plannerForm.save")})]}),H&&t.jsx(vp,{src:H,onClose:()=>F(null)})]})}function $_({item:e,mode:s,projectCliTool:i,onConvert:a,onClose:h}){const{t:m}=it(),[f,o]=k.useState(i||"claude"),[c,d]=k.useState(""),[p,u]=k.useState(!1),[v,b]=k.useState("once"),[C,w]=k.useState("0 0 * * *"),[x,y]=k.useState(""),[_,S]=k.useState(!1),N=async()=>{S(!0);try{s==="todo"?await a({cli_tool:f,max_turns:c?Number(c):void 0}):s==="session"?await a({cli_tool:f,use_worktree:p}):await a({cli_tool:f,schedule_type:v,cron_expression:v==="recurring"?C:void 0,run_at:v==="once"?x:void 0})}finally{S(!1)}};return t.jsx(Fn,{open:!0,onClose:h,size:"md",position:"top",animation:"slide-up",children:t.jsxs("div",{className:"card p-6",children:[t.jsx("h3",{className:"text-sm font-semibold mb-4",style:{color:"var(--color-text-primary)"},children:m(s==="todo"?"plannerConvert.toTask":s==="session"?"plannerConvert.toTerminal":"plannerConvert.toSchedule")}),t.jsxs("p",{className:"text-xs text-warm-500 mb-4 truncate",children:['"',e.title,'"']}),t.jsxs("div",{className:"mb-3",children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:m("plannerConvert.cliTool")}),t.jsxs("select",{className:"input-field text-xs w-full",value:f,onChange:D=>o(D.target.value),children:[t.jsx("option",{value:"claude",children:"Claude"}),t.jsx("option",{value:"antigravity",children:"Antigravity"}),t.jsx("option",{value:"codex",children:"Codex"})]})]}),s==="todo"&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:m("plannerConvert.maxTurns")}),t.jsx("input",{type:"number",min:"1",className:"input-field text-xs w-full",placeholder:"—",value:c,onChange:D=>d(D.target.value)})]}),s==="session"&&t.jsxs("label",{className:"flex items-center gap-2 mb-4 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:p,onChange:D=>u(D.target.checked)}),t.jsx("span",{className:"text-xs font-medium text-warm-500",children:m("plannerConvert.useWorktree")})]}),s==="schedule"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-3",children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:m("plannerConvert.scheduleType")}),t.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{backgroundColor:"var(--color-bg-tertiary)"},children:[t.jsx("button",{className:`flex-1 px-3 py-1.5 rounded-md text-xs font-medium transition-all ${v==="once"?"bg-amber-500 text-white":"text-warm-500"}`,onClick:()=>b("once"),children:m("plannerConvert.once")}),t.jsx("button",{className:`flex-1 px-3 py-1.5 rounded-md text-xs font-medium transition-all ${v==="recurring"?"bg-amber-500 text-white":"text-warm-500"}`,onClick:()=>b("recurring"),children:m("plannerConvert.recurring")})]})]}),v==="once"?t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:m("plannerConvert.runAt")}),t.jsx("input",{type:"datetime-local",className:"input-field text-xs w-full",value:x,onChange:D=>y(D.target.value)})]}):t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:m("plannerConvert.cronExpression")}),t.jsx("input",{className:"input-field text-xs w-full font-mono",value:C,onChange:D=>w(D.target.value),placeholder:"0 0 * * *"})]})]}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsx("button",{className:"btn-ghost text-xs",onClick:h,children:m("plannerConvert.cancel")}),t.jsx("button",{className:"btn-primary btn-sm",onClick:N,disabled:_||s==="schedule"&&v==="once"&&!x,children:m("plannerConvert.convert")})]})]})})}function hn(e){const s=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${s}-${i}-${a}`}function yy(e){return hn(new Date(e))}function wy(e){return new Date(e.getFullYear(),e.getMonth(),1)}function U_(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function xr(e,s){const i=U_(e);return i.setDate(i.getDate()+s),i}function W_(e){return xr(e,-e.getDay())}function vO(e,s){if(e==="day"){const m=U_(s);return{rangeStart:hn(m),rangeEnd:hn(xr(m,1)),gridDays:[m],cols:1,dimOutOfMonth:!1}}if(e==="week"){const m=W_(s),f=Array.from({length:7},(o,c)=>xr(m,c));return{rangeStart:hn(m),rangeEnd:hn(xr(m,7)),gridDays:f,cols:7,dimOutOfMonth:!1}}if(e==="table"){const m=wy(s),f=new Date(s.getFullYear(),s.getMonth()+1,1);return{rangeStart:hn(m),rangeEnd:hn(f),gridDays:[],cols:7,dimOutOfMonth:!1}}const i=wy(s),a=xr(i,-i.getDay()),h=Array.from({length:42},(m,f)=>xr(a,f));return{rangeStart:hn(a),rangeEnd:hn(xr(a,42)),gridDays:h,cols:7,dimOutOfMonth:!0}}function G_(e,s){return k.useMemo(()=>vO(e,s),[e,s])}function q_(e,s,i){const a=new Date(e);return s==="month"||s==="table"?a.setMonth(a.getMonth()+i):s==="week"?a.setDate(a.getDate()+7*i):a.setDate(a.getDate()+i),a}function K_(e,s){if(s==="month"||s==="table")return e.toLocaleDateString(void 0,{year:"numeric",month:"long"});if(s==="week"){const i=W_(e);return`${i.toLocaleDateString(void 0,{month:"short",day:"numeric"})} – ${xr(i,6).toLocaleDateString(void 0,{month:"short",day:"numeric"})}`}return e.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric",weekday:"short"})}function V_(){return k.useMemo(()=>{const e=new Date(2024,5,2);return Array.from({length:7},(s,i)=>xr(e,i).toLocaleDateString(void 0,{weekday:"short"}))},[])}const bO=420,yO=140,wO=220,_O=26,Mf=16,_y=2;function SO(e,s){if(!s.length)return{placed:[],laneCount:0};const i=hn(e[0]),a=hn(e[e.length-1]),h=s.filter(o=>o.startKey<=a&&o.endKey>=i).map(o=>{const c=o.startKey<i?i:o.startKey,d=o.endKey>a?a:o.endKey;return{bar:o,startCol:e.findIndex(p=>hn(p)===c),endCol:e.findIndex(p=>hn(p)===d),contStart:o.startKey<i,contEnd:o.endKey>a}}).filter(o=>o.startCol>=0&&o.endCol>=0).sort((o,c)=>o.startCol-c.startCol||c.endCol-c.startCol-(o.endCol-o.startCol)),m=[];return{placed:h.map(o=>{let c=0;for(;c<m.length&&m[c]>=o.startCol;)c++;return m[c]=o.endCol,{...o,lane:c}}),laneCount:m.length}}function Y_({view:e,gridDays:s,cols:i,dimOutOfMonth:a,monthIdx:h,todayKey:m,selectedDate:f,chipsByDay:o,maxChips:c,weekdayLabels:d,addItemLabel:p,bars:u,onBarClick:v,onSelectDate:b,onQuickAdd:C,onChipClick:w,onCellContextMenu:x,onChipContextMenu:y,onBarContextMenu:_,monthCellHeight:S=92}){const[N,D]=k.useState(null),[j,R]=k.useState(!1),L=k.useRef(null),T=k.useRef(null),A=()=>{T.current&&(clearTimeout(T.current),T.current=null)},z=(W,X)=>{A(),L.current&&clearTimeout(L.current);const J=X.getBoundingClientRect();L.current=window.setTimeout(()=>D({key:W,rect:J}),bO)},O=()=>{L.current&&(clearTimeout(L.current),L.current=null),T.current=window.setTimeout(()=>D(null),yO)};k.useEffect(()=>{if(!N){R(!1);return}const W=requestAnimationFrame(()=>R(!0));return()=>cancelAnimationFrame(W)},[N]),k.useEffect(()=>()=>{L.current&&clearTimeout(L.current),T.current&&clearTimeout(T.current)},[]),k.useEffect(()=>{if(!N)return;const W=()=>D(null);return window.addEventListener("scroll",W,!0),window.addEventListener("resize",W),()=>{window.removeEventListener("scroll",W,!0),window.removeEventListener("resize",W)}},[N]);const H=N?o.get(N.key)??[]:[],F=(W,X)=>{const J=hn(W),P=o.get(J)??[],B=!a||W.getMonth()===h,I=J===m,V=J===f,$=e==="week"?"min-h-[360px]":e==="day"?"min-h-[480px]":"",se=e==="month"&&P.length>c;return t.jsxs("div",{onClick:()=>b(J),onContextMenu:x?ue=>x(J,ue):void 0,onMouseEnter:se?ue=>z(J,ue.currentTarget):void 0,onMouseLeave:se?O:void 0,className:`group relative ${$} text-left p-1.5 flex flex-col gap-1 transition-colors cursor-pointer`,style:{minHeight:e==="month"?S+X:void 0,backgroundColor:V?"var(--color-bg-hover)":"var(--color-bg-card)",opacity:B?1:.45},children:[t.jsxs("span",{className:"flex items-center gap-1.5",children:[e!=="month"&&t.jsx("span",{className:"text-2xs uppercase",style:{color:"var(--color-text-muted)"},children:W.toLocaleDateString(void 0,{weekday:"short"})}),t.jsx("span",{className:"text-xs font-medium w-5 h-5 flex items-center justify-center rounded-full",style:I?{backgroundColor:"var(--color-accent)",color:"#fff"}:{color:"var(--color-text-secondary)"},children:W.getDate()})]}),t.jsx("button",{onClick:ue=>{ue.stopPropagation(),C(J)},className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity rounded-md w-5 h-5 flex items-center justify-center hover:bg-theme-hover",title:p,style:{backgroundColor:"var(--color-bg-secondary)",color:"var(--color-text-secondary)",border:"1px solid var(--color-border)"},children:t.jsx(mn,{size:13})}),t.jsxs("div",{className:"flex flex-col gap-0.5 overflow-hidden",style:{marginTop:X||void 0},children:[P.slice(0,c).map(ue=>t.jsxs("span",{onClick:ae=>{ae.stopPropagation(),w(ue)},onContextMenu:y?ae=>y(ue,ae):void 0,className:"text-2xs truncate px-1 py-0.5 rounded cursor-pointer hover:opacity-80 transition-opacity",style:{backgroundColor:ue.bg,color:ue.fg,textDecoration:ue.done?"line-through":"none"},title:ue.title,children:[ue.prefix??"",ue.time?`${ue.time} `:"",ue.title]},ue.key)),P.length>c&&t.jsxs("span",{className:"text-2xs px-1",style:{color:"var(--color-text-muted)"},children:["+",P.length-c]})]})]},J)},U=[];if(e==="month")for(let W=0;W<s.length;W+=i)U.push(s.slice(W,W+i));return t.jsxs(t.Fragment,{children:[(e==="month"||e==="week")&&t.jsx("div",{className:"grid gap-px text-2xs uppercase tracking-wider mb-1",style:{gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`,color:"var(--color-text-muted)"},children:d.map(W=>t.jsx("div",{className:"px-2 py-1",children:W},W))}),e==="month"?t.jsx("div",{className:"flex flex-col gap-px rounded-xl overflow-hidden",style:{backgroundColor:"var(--color-border)"},children:U.map((W,X)=>{const{placed:J,laneCount:P}=SO(W,u??[]),B=P*(Mf+_y);return t.jsxs("div",{className:"relative grid gap-px",style:{gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`,backgroundColor:"var(--color-border)"},children:[W.map(I=>F(I,B)),J.map(({bar:I,startCol:V,endCol:$,lane:se,contStart:ue,contEnd:ae})=>t.jsxs("div",{onClick:ee=>{ee.stopPropagation(),v==null||v(I)},onContextMenu:_?ee=>_(I,ee):void 0,className:"absolute text-2xs truncate px-1.5 cursor-pointer hover:opacity-80 transition-opacity flex items-center",style:{left:`calc(${V} / ${i} * 100% + 2px)`,width:`calc(${$-V+1} / ${i} * 100% - 4px)`,top:_O+se*(Mf+_y),height:Mf,backgroundColor:I.bg,color:I.fg,textDecoration:I.done?"line-through":"none",borderRadius:4,borderTopLeftRadius:ue?0:4,borderBottomLeftRadius:ue?0:4,borderTopRightRadius:ae?0:4,borderBottomRightRadius:ae?0:4},title:I.title,children:[ue?"◀ ":"",I.title,ae?" ▶":""]},I.key))]},X)})}):t.jsx("div",{className:"grid gap-px rounded-xl overflow-hidden",style:{gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`,backgroundColor:"var(--color-border)"},children:s.map(W=>F(W,0))}),N&&(()=>{const W=Math.max(N.rect.width,wO),X=Math.min(Math.max(8,N.rect.left),window.innerWidth-W-8),J=Math.max(8,Math.min(N.rect.top,window.innerHeight-120)),P=window.innerHeight-J-16,B=Number(N.key.slice(8,10));return tn.createPortal(t.jsxs("div",{className:"z-tooltip rounded-lg shadow-elevated",onMouseEnter:A,onMouseLeave:()=>D(null),style:{position:"fixed",left:X,top:J,width:W,maxHeight:P,overflowY:"auto",backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)",padding:6,transformOrigin:"top left",transform:j?"scale(1)":"scale(0.96)",opacity:j?1:0,transition:"transform 140ms ease, opacity 140ms ease"},children:[t.jsx("div",{className:"text-xs font-semibold px-1 pb-1",style:{color:"var(--color-text-secondary)"},children:B}),t.jsx("div",{className:"flex flex-col gap-0.5",children:H.map(I=>t.jsxs("span",{onClick:V=>{V.stopPropagation(),w(I),D(null)},onContextMenu:y?V=>y(I,V):void 0,className:"text-2xs truncate px-1 py-0.5 rounded cursor-pointer hover:opacity-80 transition-opacity",style:{backgroundColor:I.bg,color:I.fg,textDecoration:I.done?"line-through":"none"},title:I.title,children:[I.prefix??"",I.time?`${I.time} `:"",I.title]},I.key))})]}),document.body)})()]})}const Sy={pending:"bg-warm-200 text-warm-500",in_progress:"bg-blue-500/10 text-blue-600",done:"bg-emerald-500/10 text-emerald-600",moved:"bg-purple-500/10 text-purple-600"};function kO(e){if(!e)return[];try{const s=JSON.parse(e);return Array.isArray(s)?s.filter(i=>typeof i=="string"):[]}catch{return[]}}function CO({view:e,items:s,tagColors:i,onQuickAdd:a,onEditItem:h,onConvert:m,onDeleteItem:f}){const{t:o}=it(),[c,d]=k.useState(()=>new Date),[p,u]=k.useState(()=>hn(new Date)),[v,b]=k.useState(null),C=V_(),{gridDays:w,cols:x,dimOutOfMonth:y}=G_(e,c),_=hn(new Date),S=c.getMonth(),N=e==="month"?3:99,D=X=>d(J=>q_(J,e,X)),j=()=>{d(new Date),u(hn(new Date))},R=K_(c,e);k.useEffect(()=>{e==="day"&&u(hn(c))},[e,c]);const L=260,T=760,A=k.useRef(null),[z,O]=k.useState(()=>{const X=parseInt(localStorage.getItem("plannerCalendarPanelWidth")||"",10);return Number.isFinite(X)&&X>=L&&X<=T?X:320});k.useEffect(()=>{try{localStorage.setItem("plannerCalendarPanelWidth",String(z))}catch{}},[z]);const H=X=>{X.preventDefault();const J=B=>{var V;const I=(V=A.current)==null?void 0:V.getBoundingClientRect();I&&O(Math.min(T,Math.max(L,I.right-B.clientX)))},P=()=>{window.removeEventListener("pointermove",J),window.removeEventListener("pointerup",P),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",J),window.addEventListener("pointerup",P)},F=k.useMemo(()=>{const X=new Map;for(const J of s){if(!J.due_date)continue;const P=J.due_date.slice(0,10),B=J.status==="done",I=X.get(P)??[];I.push({key:J.id,title:J.title,bg:"var(--color-bg-secondary)",fg:B?"var(--color-text-muted)":"var(--color-text-secondary)",done:B,payload:J}),X.set(P,I)}return X},[s]),U=k.useMemo(()=>s.filter(X=>X.due_date&&X.due_date.slice(0,10)===p),[s,p]),W=k.useMemo(()=>s.filter(X=>!X.due_date),[s]);return t.jsxs("div",{ref:A,className:"card flex overflow-hidden",style:{minHeight:520},children:[t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[t.jsxs("div",{className:"px-4 pt-3 pb-2 flex items-center gap-2",children:[t.jsx("button",{onClick:()=>D(-1),className:"btn-ghost p-1.5","aria-label":"prev",children:t.jsx(Rm,{size:16})}),t.jsx("div",{className:"text-sm font-semibold min-w-[8rem] text-center",style:{color:"var(--color-text-primary)"},children:R}),t.jsx("button",{onClick:()=>D(1),className:"btn-ghost p-1.5","aria-label":"next",children:t.jsx(Ts,{size:16})}),t.jsx("button",{onClick:j,className:"btn-ghost text-xs px-2.5 py-1.5",children:o("agenda.today")})]}),t.jsx("div",{className:"flex-1 overflow-auto px-4 pb-4",children:t.jsx(Y_,{view:e,gridDays:w,cols:x,dimOutOfMonth:y,monthIdx:S,todayKey:_,selectedDate:p,chipsByDay:F,maxChips:N,weekdayLabels:C,addItemLabel:o("agenda.addItem"),onSelectDate:u,onQuickAdd:a,onChipClick:X=>h(X.payload),onCellContextMenu:(X,J)=>{J.preventDefault(),b({x:J.clientX,y:J.clientY,dateKey:X})}})})]}),t.jsx("div",{onPointerDown:H,className:"w-1.5 flex-shrink-0 cursor-col-resize hover:bg-accent/40 transition-colors",style:{backgroundColor:"var(--color-border)"},title:o("agenda.resizePanel")}),t.jsxs("div",{className:"flex-shrink-0 flex flex-col overflow-hidden",style:{width:z},children:[t.jsxs("div",{className:"px-4 pt-3 pb-2 flex items-center justify-between",children:[t.jsx("h3",{className:"text-sm font-semibold",style:{color:"var(--color-text-primary)"},children:new Date(p+"T00:00").toLocaleDateString(void 0,{month:"long",day:"numeric",weekday:"short"})}),t.jsxs("button",{onClick:()=>a(p),className:"btn-ghost text-xs px-2 py-1 flex items-center gap-1",children:[t.jsx(mn,{size:13}),o("agenda.add")]})]}),t.jsxs("div",{className:"flex-1 overflow-auto px-4 pb-4 flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[U.length===0&&t.jsx("p",{className:"text-xs py-2",style:{color:"var(--color-text-muted)"},children:o("agenda.dayEmpty")}),U.map(X=>t.jsx(ky,{item:X,tagColors:i,onEdit:h,onConvert:m,onDelete:f},X.id))]}),t.jsxs("div",{children:[t.jsx("h4",{className:"text-2xs uppercase tracking-wider mb-1.5",style:{color:"var(--color-text-muted)"},children:o("agenda.backlog")}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[W.length===0&&t.jsx("p",{className:"text-xs py-1",style:{color:"var(--color-text-muted)"},children:o("agenda.backlogEmpty")}),W.map(X=>t.jsx(ky,{item:X,tagColors:i,onEdit:h,onConvert:m,onDelete:f},X.id))]})]})]})]}),v&&t.jsx(_r,{x:v.x,y:v.y,onClose:()=>b(null),children:t.jsxs("button",{type:"button",className:en,onClick:()=>a(v.dateKey),children:[t.jsx(mn,{size:14}),o("planner.add")]})})]})}function ky({item:e,tagColors:s,onEdit:i,onConvert:a,onDelete:h}){const{t:m}=it(),[f,o]=k.useState(!1),[c,d]=k.useState(!1),[p,u]=k.useState({top:0,left:0}),v=k.useRef(null),b=k.useRef(null),C=kO(e.tags),w=e.status==="moved",x=k.useCallback(()=>{if(!v.current)return;const y=v.current.getBoundingClientRect(),_=window.innerWidth,S=window.innerHeight;let N=y.bottom+4;const D=b.current;if(D){const j=D.offsetWidth,R=D.offsetHeight;let L=y.right-j;L<8&&(L=8),L+j>_-8&&(L=_-8-j),N+R>S-8&&(N=y.top-R-4),u({top:N,left:L}),d(!0)}else u({top:N,left:Math.max(8,y.right-180)})},[]);return k.useEffect(()=>{if(!f){d(!1);return}x();const y=requestAnimationFrame(x),_=S=>{var D,j;const N=S.target;(D=v.current)!=null&&D.contains(N)||(j=b.current)!=null&&j.contains(N)||o(!1)};return document.addEventListener("mousedown",_),window.addEventListener("scroll",x,!0),window.addEventListener("resize",x),()=>{cancelAnimationFrame(y),document.removeEventListener("mousedown",_),window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x)}},[f,x]),t.jsxs("div",{className:`group flex items-start gap-2 rounded-lg px-2.5 py-2 ${w?"opacity-50":""}`,style:{backgroundColor:"var(--color-bg-secondary)"},children:[t.jsxs("button",{onClick:()=>i(e),className:"flex-1 text-left min-w-0",children:[t.jsx("div",{className:"text-sm truncate",style:{color:"var(--color-text-primary)",textDecoration:e.status==="done"?"line-through":"none"},children:e.title}),e.description&&t.jsx("div",{className:"text-2xs truncate",style:{color:"var(--color-text-muted)"},children:e.description}),t.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[t.jsx("span",{className:`px-1.5 py-0.5 rounded-full text-2xs font-medium ${Sy[e.status]||Sy.pending}`,children:m(`plannerStatus.${e.status}`)}),C.map(y=>t.jsx("span",{className:`px-1.5 py-0.5 rounded text-2xs font-medium ${Aa(s.get(y)||"default")}`,children:y},y))]})]}),t.jsxs("div",{className:"flex-shrink-0",children:[t.jsx("button",{ref:v,onClick:y=>{y.stopPropagation(),o(!f)},className:"p-1 text-warm-400 hover:text-warm-600 hover:bg-warm-100/50 rounded-lg transition-colors opacity-0 group-hover:opacity-100",children:t.jsx(Am,{size:14})}),f&&tn.createPortal(t.jsxs("div",{ref:b,className:`fixed z-tooltip min-w-[160px] rounded-xl py-1 shadow-elevated${c?" animate-scale-in":""}`,style:{top:p.top,left:p.left,opacity:c?1:0,backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)"},onClick:()=>o(!1),children:[!w&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:()=>a(e,"todo"),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-warm-100 rounded-md transition-colors text-left",style:{color:"var(--color-text-primary)"},children:[t.jsx(fw,{size:12})," ",m("planner.convertToTask")]}),t.jsxs("button",{onClick:()=>a(e,"schedule"),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-warm-100 rounded-md transition-colors text-left",style:{color:"var(--color-text-primary)"},children:[t.jsx(ri,{size:12})," ",m("planner.convertToSchedule")]}),t.jsxs("button",{onClick:()=>a(e,"session"),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-warm-100 rounded-md transition-colors text-left",style:{color:"var(--color-text-primary)"},children:[t.jsx(Ba,{size:12})," ",m("planner.convertToTerminal")]})]}),t.jsxs("button",{onClick:()=>{confirm(m("planner.deleteConfirm"))&&h(e.id)},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-red-500 hover:bg-red-50 rounded-md transition-colors text-left",children:[t.jsx(Nn,{size:12})," ",m("planner.delete")]})]}),document.body)]})]})}const Cy={pending:0,in_progress:1,done:2,moved:3};function jO({plannerItems:e,existingTags:s,projectCliTool:i,onAddItem:a,onEditItem:h,onDeleteItem:m,onConvertToTodo:f,onConvertToSchedule:o,onConvertToSession:c,onUpdateTag:d,onDeleteTag:p,onExport:u,onImport:v,view:b,onChangeView:C}){const{t:w}=it(),[x,y]=k.useState(!1),[_,S]=k.useState(null),[N,D]=k.useState(void 0),[j,R]=k.useState(""),[L,T]=k.useState(""),[A,z]=k.useState("created_at"),[O,H]=k.useState("desc"),[F,U]=k.useState(null),[W,X]=k.useState("todo"),[J,P]=k.useState(!1),[B,I]=k.useState(!1),[V,$]=k.useState(null),se=k.useRef(null),ue=k.useRef(0),ae=async()=>{if(!(!u||J)){P(!0);try{await u()}finally{P(!1)}}},ee=()=>{var ge;!v||J||(ge=se.current)==null||ge.click()},Y=async ge=>{var Ke;const Ce=(Ke=ge.target.files)==null?void 0:Ke[0];if(ge.target.value="",!(!Ce||!v)){P(!0);try{await v(Ce)}finally{P(!1)}}},he=ge=>!!(/\.(md|markdown)$/i.test(ge.name)||ge.type==="text/markdown"),de=ge=>Array.from(ge.dataTransfer.types).includes("Files"),ke=ge=>{!v||J||de(ge)&&(ge.preventDefault(),ue.current++,I(!0))},re=ge=>{!v||J||de(ge)&&(ge.preventDefault(),ge.dataTransfer.dropEffect="copy")},Fe=ge=>{v&&(ge.preventDefault(),ue.current=Math.max(0,ue.current-1),ue.current===0&&I(!1))},Ne=async ge=>{var Ke;if(!v||(ge.preventDefault(),ue.current=0,I(!1),J))return;const Ce=(Ke=ge.dataTransfer.files)==null?void 0:Ke[0];if(Ce){if(!he(Ce)){window.alert(w("planner.dropInvalidFile"));return}P(!0);try{await v(Ce)}finally{P(!1)}}},Te=k.useMemo(()=>s.map(ge=>ge.name),[s]),be=k.useMemo(()=>new Map(s.map(ge=>[ge.name,ge.color])),[s]),pe=k.useMemo(()=>{let ge=e.filter(Ce=>!(L&&Ce.status!==L||j&&!(Ce.tags?(()=>{try{return JSON.parse(Ce.tags)}catch{return[]}})():[]).includes(j)));return ge=[...ge].sort((Ce,Ke)=>{let qe=0;switch(A){case"title":qe=Ce.title.localeCompare(Ke.title);break;case"tags":{const tt=Ce.tags?(()=>{try{return JSON.parse(Ce.tags).join(",")}catch{return""}})():"",Oe=Ke.tags?(()=>{try{return JSON.parse(Ke.tags).join(",")}catch{return""}})():"";qe=(tt||"zzz").localeCompare(Oe||"zzz");break}case"priority":qe=Ce.priority-Ke.priority;break;case"due_date":{const tt=Ce.due_date||"9999",Oe=Ke.due_date||"9999";qe=tt.localeCompare(Oe);break}case"status":qe=(Cy[Ce.status]??9)-(Cy[Ke.status]??9);break;case"created_at":qe=Ce.created_at.localeCompare(Ke.created_at);break}return O==="asc"?qe:-qe}),ge},[e,j,L,A,O]),Je=ge=>{A===ge?H(Ce=>Ce==="asc"?"desc":"asc"):(z(ge),H(ge==="priority"?"desc":"asc"))},Ye=({field:ge})=>A!==ge?null:O==="asc"?t.jsx(mj,{size:10,className:"inline ml-0.5"}):t.jsx(cj,{size:10,className:"inline ml-0.5"});return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-5 gap-3 flex-wrap",children:[t.jsxs("h2",{className:"text-sm font-semibold text-warm-600 uppercase tracking-wider",children:[w("planner.title"),t.jsx("span",{className:"ml-1 text-warm-400",children:e.length})]}),t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b!=="table"&&t.jsx("div",{className:"flex gap-0.5 p-0.5 rounded-lg shrink-0",style:{backgroundColor:"var(--color-bg-tertiary)"},children:["month","week","day"].map(ge=>t.jsx("button",{onClick:()=>C(ge),className:"px-2.5 py-1 text-xs rounded-md transition-all",style:b===ge?{backgroundColor:"var(--color-bg-card)",color:"var(--color-text-primary)",fontWeight:600}:{color:"var(--color-text-tertiary)"},children:w(`agenda.view.${ge}`)},ge))}),t.jsxs("select",{className:"input-field text-xs py-1.5 px-2 w-auto max-w-[10rem] shrink",value:j,onChange:ge=>R(ge.target.value),children:[t.jsx("option",{value:"",children:w("planner.filterTag")}),Te.map(ge=>t.jsx("option",{value:ge,children:ge},ge))]}),t.jsxs("select",{className:"input-field text-xs py-1.5 px-2 w-auto max-w-[10rem] shrink",value:L,onChange:ge=>T(ge.target.value),children:[t.jsx("option",{value:"",children:w("planner.filterStatus")}),t.jsx("option",{value:"pending",children:w("plannerStatus.pending")}),t.jsx("option",{value:"in_progress",children:w("plannerStatus.in_progress")}),t.jsx("option",{value:"done",children:w("plannerStatus.done")}),t.jsx("option",{value:"moved",children:w("plannerStatus.moved")})]}),u&&t.jsxs("button",{onClick:ae,disabled:J||e.length===0,className:"btn-secondary text-xs py-2 whitespace-nowrap shrink-0 disabled:opacity-50",title:w("planner.exportTooltip"),children:[t.jsx(Wf,{size:14,className:"inline-block shrink-0"}),w("planner.export")]}),v&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:ee,disabled:J,className:"btn-secondary text-xs py-2 whitespace-nowrap shrink-0 disabled:opacity-50",title:w("planner.importTooltip"),children:[t.jsx(jv,{size:14,className:"inline-block shrink-0"}),w("planner.import")]}),t.jsx("input",{ref:se,type:"file",accept:".md,.markdown,text/markdown",className:"hidden",onChange:Y})]}),!x&&!_&&t.jsxs("button",{onClick:()=>y(!0),className:"btn-primary text-xs py-2 whitespace-nowrap shrink-0",children:[t.jsx(mn,{size:14,className:"inline-block shrink-0"}),w("planner.add")]})]})]}),(x||_)&&t.jsx("div",{className:"mb-5",children:t.jsx(xO,{existingTags:s,editItem:_,initialDueDate:N,onSave:async ge=>{if(_){await h(_.id,ge),S(null);return}else{const Ce=await a(ge);return y(!1),D(void 0),Ce}},onCancel:()=>{y(!1),S(null),D(void 0)},onUpdateTag:d})}),b==="table"?t.jsxs("div",{className:"card relative",onDragEnter:v?ke:void 0,onDragOver:v?re:void 0,onDragLeave:v?Fe:void 0,onDrop:v?Ne:void 0,onContextMenu:ge=>{li(ge)||(ge.preventDefault(),$({x:ge.clientX,y:ge.clientY}))},children:[B&&t.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center pointer-events-none rounded-xl border-2 border-dashed",style:{borderColor:"var(--color-accent, #3b82f6)",backgroundColor:"var(--color-bg-secondary, rgba(59, 130, 246, 0.08))",backdropFilter:"blur(2px)"},children:t.jsxs("div",{className:"text-center",children:[t.jsx(jv,{size:32,className:"inline-block mb-2",style:{color:"var(--color-accent, #3b82f6)"}}),t.jsx("div",{className:"text-sm font-semibold",children:w("planner.dropHint")}),t.jsx("div",{className:"text-xs text-warm-500 mt-1",children:w("planner.dropHintSub")})]})}),t.jsxs("div",{className:"hidden sm:flex items-center gap-3 px-4 py-2 rounded-t-xl select-none",style:{backgroundColor:"var(--color-bg-tertiary)",borderBottom:"1px solid var(--color-border-muted)"},children:[t.jsx("div",{className:"w-[14px] flex-shrink-0"}),t.jsxs("div",{className:"flex-1 text-2xs font-semibold text-warm-500 uppercase tracking-wider cursor-pointer hover:text-warm-700 transition-colors",onClick:()=>Je("title"),children:[w("planner.col.title"),t.jsx(Ye,{field:"title"})]}),t.jsxs("div",{className:"w-[160px] text-2xs font-semibold text-warm-500 uppercase tracking-wider cursor-pointer hover:text-warm-700 transition-colors",onClick:()=>Je("tags"),children:[w("planner.col.tags"),t.jsx(Ye,{field:"tags"})]}),t.jsxs("div",{className:"w-12 text-center text-2xs font-semibold text-warm-500 uppercase tracking-wider cursor-pointer hover:text-warm-700 transition-colors",onClick:()=>Je("priority"),children:[w("plannerForm.priority"),t.jsx(Ye,{field:"priority"})]}),t.jsxs("div",{className:"hidden md:block w-20 text-right text-2xs font-semibold text-warm-500 uppercase tracking-wider cursor-pointer hover:text-warm-700 transition-colors",onClick:()=>Je("due_date"),children:[w("planner.col.dueDate"),t.jsx(Ye,{field:"due_date"})]}),t.jsxs("div",{className:"w-16 text-2xs font-semibold text-warm-500 uppercase tracking-wider cursor-pointer hover:text-warm-700 transition-colors",onClick:()=>Je("status"),children:[w("planner.col.status"),t.jsx(Ye,{field:"status"})]}),t.jsx("div",{className:"w-8"})]}),pe.length===0?t.jsx(Fi,{icon:z5,title:w("planner.empty"),description:w("planner.emptyHint")}):pe.map((ge,Ce)=>t.jsx("div",{className:"animate-slide-up",style:{animationDelay:`${Ce*20}ms`},children:t.jsx(pO,{item:ge,tagColors:be,existingTags:Te,onSave:async(Ke,qe)=>{await h(Ke,qe)},onDelete:()=>m(ge.id),onConvertToTodo:()=>{U(ge),X("todo")},onConvertToSchedule:()=>{U(ge),X("schedule")},onConvertToSession:()=>{U(ge),X("session")},onUpdateTag:d})},ge.id))]}):t.jsx(CO,{view:b,items:pe,tagColors:be,onQuickAdd:ge=>{S(null),D(ge),y(!0)},onEditItem:ge=>{y(!1),S(ge)},onConvert:(ge,Ce)=>{U(ge),X(Ce)},onDeleteItem:m}),F&&t.jsx($_,{item:F,mode:W,projectCliTool:i,onConvert:async ge=>{W==="todo"?await f(F.id,ge):W==="session"?await c(F.id,ge):await o(F.id,ge),U(null)},onClose:()=>U(null)}),V&&t.jsx(_r,{x:V.x,y:V.y,onClose:()=>$(null),children:t.jsxs("button",{type:"button",className:en,onClick:()=>{S(null),D(void 0),y(!0)},children:[t.jsx(mn,{size:14}),w("planner.add")]})})]})}const X_=k.createContext(null),NO=X_.Provider;function EB(){const e=k.useContext(X_);if(!e)throw new Error("usePlannerPage must be used within a PlannerPageProvider");return e}const EO=k.lazy(()=>Du(()=>import("./PlannerPageEditor-CVxYfC2H.js").then(e=>e.a),__vite__mapDeps([5,3,6,7,8]))),TO=800;function LO({pageId:e,projectId:s,projectCliTool:i,existingTags:a,onTitleChange:h,onConvertToTodo:m,onConvertToSchedule:f,onConvertToSession:o}){const{t:c}=it(),[d,p]=k.useState(null),[u,v]=k.useState("idle"),[b,C]=k.useState(null),w=k.useRef({title:"",content:null}),x=k.useRef(null);k.useEffect(()=>{let j=!1;return W3(e).then(R=>{j||(p(R),w.current={title:R.title,content:R.content??null})}),()=>{j=!0}},[e]);const y=k.useCallback(()=>{x.current&&(clearTimeout(x.current),x.current=null);const{title:j,content:R}=w.current;return v("saving"),G3(e,{title:j,content:R??void 0}).then(()=>v("saved"))},[e]);k.useEffect(()=>()=>{x.current&&y()},[y]);const _=k.useCallback(()=>{x.current&&clearTimeout(x.current),v("saving"),x.current=setTimeout(()=>{y()},TO)},[y]),S=j=>{w.current.title=j,p(R=>R&&{...R,title:j}),h(e,j),_()},N=j=>{w.current.content=j,_()},D=k.useCallback((j,R,L)=>{C({item:j,mode:R,onDone:L})},[]);return d?t.jsxs(NO,{value:{projectId:s,pageId:e,projectCliTool:i,existingTags:a,openConvert:D},children:[t.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[t.jsxs("div",{className:"flex items-center gap-3 px-6 pt-5 pb-2",children:[t.jsx("input",{value:d.title,onChange:j=>S(j.target.value),placeholder:c("planner.pages.untitled"),className:"flex-1 bg-transparent text-2xl font-bold outline-none",style:{color:"var(--color-text-primary)"}}),t.jsx("span",{className:"text-2xs text-warm-400 flex-shrink-0",children:u==="saving"?c("planner.pages.saving"):u==="saved"?c("planner.pages.saved"):""})]}),t.jsx("div",{className:"flex-1 overflow-y-auto pb-6",children:t.jsx(k.Suspense,{fallback:null,children:t.jsx(EO,{initialContent:d.content??null,onChange:N})})})]}),b&&t.jsx($_,{item:b.item,mode:b.mode,projectCliTool:i,onConvert:async j=>{const{item:R,mode:L,onDone:T}=b;L==="todo"?await m(R.id,j):L==="session"?await o(R.id,j):await f(R.id,j),T==null||T(),C(null)},onClose:()=>C(null)})]}):null}const Cn=(e,s)=>({type:"heading",props:{level:e},content:s}),Uo=e=>e?{type:"paragraph",content:e}:{type:"paragraph"},jy=e=>({type:"bulletListItem"}),Ri=e=>({type:"checkListItem"}),Ny=()=>({type:"tasklist"}),Ey=()=>({type:"calendar"}),DO=[{id:"blank",labelKey:"planner.tpl.blank",descKey:"planner.tpl.blank.desc",title:"",blocks:null},{id:"meeting",labelKey:"planner.tpl.meeting",descKey:"planner.tpl.meeting.desc",title:"회의 노트",blocks:[Cn(1,"회의 노트"),Uo("📅 날짜: "),Uo("👥 참석자: "),Cn(2,"안건"),jy(),Cn(2,"논의"),Uo(),Cn(2,"액션 아이템"),Ny()]},{id:"project",labelKey:"planner.tpl.project",descKey:"planner.tpl.project.desc",title:"프로젝트 플랜",blocks:[Cn(1,"프로젝트 플랜"),Cn(2,"개요"),Uo(),Cn(2,"마일스톤"),Ny(),Cn(2,"일정"),Ey(),Cn(2,"리스크 / 메모"),Uo()]},{id:"weekly",labelKey:"planner.tpl.weekly",descKey:"planner.tpl.weekly.desc",title:"위클리 플래너",blocks:[Cn(1,"위클리 플래너"),Cn(2,"이번 주 목표"),jy(),Cn(2,"요일별 할 일"),Cn(3,"월요일"),Ri(),Cn(3,"화요일"),Ri(),Cn(3,"수요일"),Ri(),Cn(3,"목요일"),Ri(),Cn(3,"금요일"),Ri(),Cn(3,"토요일"),Ri(),Cn(3,"일요일"),Ri(),Cn(2,"주간 일정"),Ey()]}];function RO({onResize:e}){return t.jsx("div",{role:"separator","aria-orientation":"vertical",onPointerDown:s=>{s.preventDefault();const i=s.currentTarget;i.setPointerCapture(s.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none";const a=m=>e(m.clientX),h=()=>{document.body.style.cursor="",document.body.style.userSelect="",i.removeEventListener("pointermove",a),i.removeEventListener("pointerup",h),i.removeEventListener("pointercancel",h)};i.addEventListener("pointermove",a),i.addEventListener("pointerup",h),i.addEventListener("pointercancel",h)},className:"w-1.5 shrink-0 cursor-col-resize bg-warm-300 hover:bg-accent active:bg-accent transition-colors"})}const Ty=160,Ly=480,Dy="plannerSidebarWidth";function MO({projectId:e,...s}){const{t:i}=it(),[a,h]=k.useState([]),[m,f]=k.useState({kind:"work"}),[o,c]=k.useState("table"),[d,p]=k.useState(!1),[u,v]=k.useState({top:0,left:0}),b=k.useRef(null),C=k.useRef(null),w=k.useRef(!1),[x,y]=k.useState(()=>{const F=Number(localStorage.getItem(Dy));return F>=Ty&&F<=Ly?F:208}),_=k.useCallback(F=>{var X;const U=((X=C.current)==null?void 0:X.getBoundingClientRect().left)??0,W=Math.round(Math.max(Ty,Math.min(Ly,F-U)));y(W),localStorage.setItem(Dy,String(W))},[]),S=240,N=()=>{var U;const F=(U=b.current)==null?void 0:U.getBoundingClientRect();if(F){const W=Math.min(F.left,window.innerWidth-S-8);v({top:F.bottom+4,left:Math.max(8,W)})}p(!0)};k.useEffect(()=>{if(!d)return;const F=()=>p(!1),U=W=>{var X;(X=b.current)!=null&&X.contains(W.target)||W.target.closest("[data-template-picker]")||p(!1)};return document.addEventListener("mousedown",U),window.addEventListener("scroll",F,!0),window.addEventListener("resize",F),()=>{document.removeEventListener("mousedown",U),window.removeEventListener("scroll",F,!0),window.removeEventListener("resize",F)}},[d]),k.useEffect(()=>{$3(e).then(F=>{h(F),w.current||(w.current=!0,F.length>0&&f({kind:"page",id:F[0].id}))})},[e]);const D=async F=>{p(!1);const U=await U3(e,F.title||i("planner.pages.untitled"),F.blocks?JSON.stringify(F.blocks):void 0);h(W=>[...W,U]),f({kind:"page",id:U.id})},j=async F=>{confirm(i("planner.pages.deleteConfirm"))&&(await q3(F),h(U=>U.filter(W=>W.id!==F)),f(U=>U.kind==="page"&&U.id===F?{kind:"work"}:U))},R=k.useCallback((F,U)=>{h(W=>W.map(X=>X.id===F?{...X,title:U}:X))},[]),L=()=>{f({kind:"work"}),c(F=>F==="table"?"month":F)},T=()=>{f({kind:"work"}),c("table")},A=m.kind==="work",z=A&&o!=="table",O=A&&o==="table",H=(F,U,W,X,J)=>t.jsxs("div",{onClick:U,className:`group flex items-center gap-2 px-2.5 py-1.5 rounded-lg cursor-pointer transition-colors ${F?"":"hover:bg-warm-50"}`,style:F?{backgroundColor:"var(--color-bg-tertiary)"}:void 0,children:[W,t.jsx("span",{className:"flex-1 text-sm truncate",style:{color:"var(--color-text-primary)"},children:X}),J]});return t.jsxs("div",{className:"flex gap-4",style:{minHeight:"70vh"},children:[t.jsxs("div",{ref:C,className:"flex-shrink-0 flex flex-col card p-2 overflow-y-auto",style:{width:x},children:[t.jsxs("div",{className:"flex items-center justify-between px-2.5 pt-1 pb-1",children:[t.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-warm-400",children:i("planner.view.pages")}),t.jsx("button",{ref:b,onClick:()=>d?p(!1):N(),className:"text-warm-400 hover:text-warm-600 transition-colors",title:i("planner.pages.new"),children:t.jsx(mn,{size:14})})]}),a.map(F=>H(m.kind==="page"&&m.id===F.id,()=>f({kind:"page",id:F.id}),t.jsx(Bi,{size:13,className:"text-warm-400 flex-shrink-0"}),F.title||i("planner.pages.untitled"),t.jsx("button",{onClick:U=>{U.stopPropagation(),j(F.id)},className:"opacity-0 group-hover:opacity-100 text-warm-400 hover:text-red-500 transition-all flex-shrink-0",children:t.jsx(Nn,{size:13})}))),t.jsx("div",{className:"px-2.5 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-warm-400",children:i("planner.view.all")}),H(z,L,t.jsx(Uf,{size:14,className:"text-warm-400 flex-shrink-0"}),i("planner.nav.calendar")),H(O,T,t.jsx(lu,{size:14,className:"text-warm-400 flex-shrink-0"}),i("planner.nav.list"))]}),t.jsx(RO,{onResize:_}),t.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:m.kind==="page"?t.jsx("div",{className:"card flex flex-col flex-1",children:t.jsx(LO,{pageId:m.id,projectId:e,projectCliTool:s.projectCliTool,existingTags:s.existingTags,onTitleChange:R,onConvertToTodo:s.onConvertToTodo,onConvertToSchedule:s.onConvertToSchedule,onConvertToSession:s.onConvertToSession},m.id)}):t.jsx(jO,{...s,view:o,onChangeView:c})}),d&&tn.createPortal(t.jsx("div",{"data-template-picker":!0,className:"fixed z-tooltip rounded-xl py-1 shadow-elevated animate-scale-in",style:{top:u.top,left:u.left,width:S,backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)"},children:DO.map(F=>t.jsxs("button",{onClick:()=>D(F),className:"w-full text-left px-3 py-2 hover:bg-warm-100 transition-colors",children:[t.jsx("div",{className:"text-sm font-medium",style:{color:"var(--color-text-primary)"},children:i(F.labelKey)}),t.jsx("div",{className:"text-2xs text-warm-400 mt-0.5",children:i(F.descKey)})]},F.id))}),document.body)]})}const AO=k.lazy(()=>Du(()=>import("./AnalyticsPanel-Czz0NzEx.js"),__vite__mapDeps([9,7,3,2]))),OO=k.lazy(()=>Du(()=>import("./VaultLayout-SpzEwN8C.js"),__vite__mapDeps([10,6,1,2,3,4])));function zO({onEvent:e,connected:s,sendMessage:i,subscribeBinary:a}){const{id:h}=jm(),[m,f]=k.useState(null),[o,c]=k.useState([]),[d,p]=k.useState([]),[u,v]=k.useState(null),[b,C]=k.useState([]),[w,x]=k.useState([]),[y,_]=k.useState([]),[S,N]=k.useState([]),[D,j]=uw(),R=["tasks","discussions","schedules","analytics"],L=D.get("tab")||"tasks",[T,A]=k.useState(R.includes(L)?"automation":L),[z,O]=k.useState(R.includes(L)?L:"tasks"),H=k.useCallback(ce=>{if(ce==="automation"){A("automation"),j(z==="tasks"?{}:{tab:z},{replace:!0});return}A(ce),j(ce==="tasks"?{}:{tab:ce},{replace:!0})},[j,z]),F=k.useCallback(ce=>{A("automation"),O(ce),j(ce==="tasks"?{}:{tab:ce},{replace:!0})},[j]),[U,W]=k.useState(!0),[X,J]=k.useState(!1),[P,B]=k.useState(new Set),[I,V]=k.useState(0),{t:$}=it(),{sendNotification:se}=Im(),ue=k.useRef([]);k.useEffect(()=>{ue.current=b},[b]),k.useEffect(()=>{h&&Promise.all([FN(h),nf(h),$v(h),Uv(h),f3(),Yw(h),Oc(h),zc(h)]).then(([ce,Le,De,ye,rt,vt,St,jt])=>{f(ce),c(Le),p(De),C(ye),x(vt),_(St),N(jt),rt.resetsAt&&v(rt.resetsAt);const Nt=Le.filter(rn=>rn.status==="running"&&rn.execution_mode==="interactive").map(rn=>rn.id);Nt.length>0&&B(new Set(Nt))}).catch(()=>J(!0)).finally(()=>W(!1))},[h]);const ae=k.useRef(o);ae.current=o,k.useEffect(()=>{if(!h)return;const ce=setInterval(()=>{ae.current.some(De=>De.status==="running")&&nf(h).then(De=>{c(ye=>ye.map(rt=>{const vt=De.find(St=>St.id===rt.id);return vt&&vt.status!==rt.status?vt:rt}))}).catch(()=>{})},5e3);return()=>clearInterval(ce)},[h]);const ee=k.useRef(s);k.useEffect(()=>{s&&!ee.current&&h&&Promise.all([nf(h),$v(h),Uv(h)]).then(([ce,Le,De])=>{c(ce),p(Le),C(De)}).catch(()=>{}),ee.current=s},[s,h]),k.useEffect(()=>e(ce=>{if(ce.type==="todo:status-changed"&&ce.todoId&&ce.status){if(c(Le=>Le.map(De=>{if(De.id!==ce.todoId)return De;const ye={status:ce.status,updated_at:new Date().toISOString()};return ce.worktree_path!==void 0&&(ye.worktree_path=ce.worktree_path??null),ce.branch_name!==void 0&&(ye.branch_name=ce.branch_name??null),{...De,...ye}})),(ce.status==="completed"||ce.status==="merged"||ce.status==="failed")&&V(Le=>Le+1),ce.status==="completed"||ce.status==="failed"){const Le=ae.current.find(De=>De.id===ce.todoId);Le&&se(ce.status==="completed"?$("notification.taskCompleted"):$("notification.taskFailed"),Le.title)}ce.status==="running"&&ce.mode==="interactive"?B(Le=>new Set(Le).add(ce.todoId)):ce.status!=="running"&&B(Le=>{const De=new Set(Le);return De.delete(ce.todoId),De})}if(ce.type==="schedule:status-changed"&&ce.scheduleId&&p(Le=>Le.map(De=>De.id===ce.scheduleId?{...De,is_active:ce.isActive?1:0,updated_at:new Date().toISOString()}:De)),ce.type==="rate-limit:updated"&&ce.resetsAt&&v(ce.resetsAt),ce.type==="discussion:status-changed"&&ce.discussionId&&(C(Le=>Le.map(De=>De.id===ce.discussionId?{...De,status:ce.status,current_round:ce.currentRound??De.current_round,updated_at:new Date().toISOString()}:De)),ce.status==="completed"||ce.status==="failed")){const Le=ue.current.find(De=>De.id===ce.discussionId);Le&&se(ce.status==="completed"?$("notification.discussionCompleted"):$("notification.discussionFailed"),Le.title)}ce.type==="session:status-changed"&&ce.sessionId&&x(Le=>Le.map(De=>{if(De.id!==ce.sessionId)return De;const ye={status:ce.status,updated_at:new Date().toISOString()};return ce.worktree_path!==void 0&&(ye.worktree_path=ce.worktree_path),ce.branch_name!==void 0&&(ye.branch_name=ce.branch_name),{...De,...ye}}))}),[e,se,$]);const Y=k.useCallback(async(ce,Le,De,ye,rt,vt,St,jt,Nt,rn)=>{if(!h)return;const Dn=await sf(h,{title:ce,description:Le,cli_tool:De,depends_on:rt,max_turns:vt??null,use_worktree:St??null,...jt?{memory_inject_mode:jt}:{},...Nt?{memory_node_ids:Nt}:{},...rn?{memory_raw_file_paths:rn}:{}});if(ye&&ye.length>0){const Pn=await Gw(Dn.id,ye.map(yn=>({name:yn.name,data:yn.data})));Dn.images=JSON.stringify(Pn.images)}c(Pn=>[...Pn,Dn])},[h]),he=k.useCallback((ce,Le=[])=>{const De=ce.split("/").filter(Boolean).pop()??ce,ye=[ce,...Le].map(rt=>`@${rt}`).join(`
|
|
649
|
+
`);console.debug("[paste-fallback] sending text, len=",R.length,"multiline=",A),a({type:"session:terminal-input",sessionId:i,input:w_(R)})}else console.debug("[paste-fallback] paste event had no usable text/image")};e.addEventListener("compositionstart",x,!0),e.addEventListener("compositionupdate",y,!0),e.addEventListener("compositionend",_,!0),e.addEventListener("paste",S,!0);const N=s.onData(D=>{if(!c){if(p!==null&&D===p){p=null;return}p=null,a({type:"session:terminal-input",sessionId:i,input:D})}});return()=>{N.dispose(),w.dispose(),b&&cancelAnimationFrame(b),e.removeEventListener("compositionstart",x,!0),e.removeEventListener("compositionupdate",y,!0),e.removeEventListener("compositionend",_,!0),e.removeEventListener("paste",S,!0),d("")}}function _8({container:e,term:s,sessionId:i,sendMessage:a}){const h=e.querySelector(".xterm-helper-textarea");let m="",f=0;h&&(m=h.style.display,f=h.tabIndex,h.style.display="none",h.tabIndex=-1),getComputedStyle(e).position==="static"&&(e.style.position="relative");const o=document.createElement("textarea");o.setAttribute("autocomplete","off"),o.setAttribute("lang","ko"),o.setAttribute("inputmode","text"),o.rows=1,Object.assign(o.style,{position:"absolute",background:"transparent",border:"none",outline:"none",padding:"0",margin:"0",fontFamily:Mt,fontSize:"16px",lineHeight:"1.2",resize:"none",overflow:"hidden",whiteSpace:"pre",caretColor:"rgba(255,255,255,0.001)",zIndex:"5"});const c=()=>{Object.assign(o.style,{inset:"0",left:"auto",top:"auto",width:"100%",height:"100%",color:"transparent"})},d=()=>{const j=e.querySelector(".xterm-screen");if(!j)return;const R=s.cols,L=s.rows;if(R<=0||L<=0)return;const T=j.clientWidth/R,A=j.clientHeight/L,z=s.buffer.active.cursorX,O=s.buffer.active.cursorY,H=j.getBoundingClientRect(),F=e.getBoundingClientRect();Object.assign(o.style,{inset:"auto",left:`${H.left-F.left+z*T}px`,top:`${H.top-F.top+O*A}px`,width:`${Math.max(T*30,240)}px`,height:`${Math.max(A,20)}px`,color:Ge.text})};c(),e.appendChild(o);let p=!1;const u=v8();let v=null;const b=()=>{v&&(clearTimeout(v),v=null)},C=j=>{j&&a({type:"session:terminal-input",sessionId:i,input:j})},w=()=>{const j=ry(u);j&&C(j)},x=()=>{const j=gr(u);o.value=j,j?d():c()},y=()=>{b(),v=setTimeout(()=>{v=null,w(),o.value="",c()},600)},_=()=>{p=!0,b(),w(),d()},S=j=>{p=!1,j.data&&C(j.data),o.value="",c()};o.addEventListener("compositionstart",_),o.addEventListener("compositionend",S);const N=j=>{if(p)return;const R=j;switch(R.inputType){case"insertCompositionText":case"insertFromComposition":return;case"deleteContentBackward":b(),iy(u)?x():(C(""),o.value="",c());return;case"insertLineBreak":case"insertParagraph":b(),w(),C("\r"),o.value="",c();return;default:if(!R.data){x();return}b();let L="";for(const T of R.data){const A=T.codePointAt(0);g8(A)?L+=b8(u,A):x8(A)?L+=y8(u,A):(L+=ry(u),L+=T)}C(L),x(),hp(u)||y()}};o.addEventListener("input",N);const D=j=>{if(p||j.isComposing)return;let R=null;switch(j.key){case"Enter":R="\r";break;case"Backspace":R="";break;case"Tab":R=" ";break;case"Escape":R="\x1B";break;case"ArrowUp":R="\x1B[A";break;case"ArrowDown":R="\x1B[B";break;case"ArrowRight":R="\x1B[C";break;case"ArrowLeft":R="\x1B[D";break;case"Home":R="\x1B[H";break;case"End":R="\x1B[F";break}if(R){if(j.preventDefault(),b(),j.key==="Backspace"){if(iy(u)){x();return}}else w();C(R),o.value="",c();return}if(j.ctrlKey&&!j.metaKey&&!j.altKey&&j.key.length===1){const L=j.key.toUpperCase().charCodeAt(0);L>=64&&L<=95&&(j.preventDefault(),b(),w(),C(String.fromCharCode(L-64)),o.value="",c())}};return o.addEventListener("keydown",D),()=>{b(),w(),o.remove(),h&&(h.style.display=m,h.tabIndex=f)}}const S8={presetId:y_},xu=new Map,qo=new Map;function C_(e){return`sessionTheme:${e}`}function k8(e){return typeof e!="string"?!1:e==="custom"||e in Tn}function ay(e){const s=xu.get(e);if(s!==void 0)return s;let i=S8;try{const a=localStorage.getItem(C_(e));if(a!==null){const h=JSON.parse(a);h&&k8(h.presetId)&&(i={presetId:h.presetId,custom:h.custom&&typeof h.custom=="object"?h.custom:void 0})}}catch{}return xu.set(e,i),i}function C8(e,s){const i=xu.get(e);if(i&&i.presetId===s.presetId&&j8(i.custom,s.custom))return;xu.set(e,s);try{localStorage.setItem(C_(e),JSON.stringify(s))}catch{}const a=qo.get(e);a&&a.forEach(h=>h(s))}function j8(e,s){return e===s?!0:!e||!s?!1:e.background===s.background&&e.foreground===s.foreground&&e.cursor===s.cursor&&e.selectionBackground===s.selectionBackground&&e.accent===s.accent}function N8(e){if(e.presetId!=="custom")return ty(e.presetId).theme;const s=ty(y_).theme,i=e.custom??{},a=i.cursor??i.accent??s.cursor;return{...s,background:i.background??s.background,foreground:i.foreground??s.foreground,cursor:a,cursorAccent:i.background??s.cursorAccent,selectionBackground:i.selectionBackground??s.selectionBackground,brightBlue:i.accent??s.brightBlue,blue:i.accent??s.blue}}function j_(e){const[s,i]=k.useState(()=>ay(e));k.useEffect(()=>{i(ay(e));let m=qo.get(e);return m||(m=new Set,qo.set(e,m)),m.add(i),()=>{const f=qo.get(e);f&&(f.delete(i),f.size===0&&qo.delete(e))}},[e]);const a=k.useCallback(m=>C8(e,m),[e]),h=k.useMemo(()=>N8(s),[s]);return[s,h,a]}function N_({session:e,visible:s,intent:i,intentNonce:a,onClose:h,sendMessage:m,subscribeBinary:f,onEvent:o,onCycleTab:c,remountKey:d=0}){const{t:p}=it(),u=e.status==="running"||i==="start"||i==="resume"?"pendingFit":"replay-only",[v,b]=k.useState(u),[C,w]=k.useState(null),[x,y]=k.useState(0),_=k.useCallback(()=>y(Y=>Y+1),[]),S=k.useRef(null),N=k.useRef(!1),D=k.useRef(a),[j,R]=k.useState(null),[L,T]=k.useState(null),[A,z]=k.useState(!1),[O,H]=k.useState(null),[F,U]=k.useState(null),W=k.useRef(e.status==="running");k.useEffect(()=>{e.status==="running"&&v!=="subscribed"&&v!=="starting"&&v!=="pendingFit"&&(W.current=!0,b("subscribed"))},[e.status,v]),k.useEffect(()=>{if(e.status==="running"||!W.current||v!=="subscribed"&&v!=="stopping")return;const Y=setTimeout(()=>h(),300);return()=>clearTimeout(Y)},[e.status,v,h]);const X=k.useCallback(async()=>{const Y=S.current;if(Y&&!N.current){N.current=!0,b("starting"),w(null),U(null);try{const he=await D3(e.id,Y,i==="resume"?{continueSession:!0}:void 0);b("subscribed"),he.pendingInitialPrompt?(R(he.pendingInitialPromptLength??0),T(null),z(!1)):(R(null),T(null))}catch(he){const de=he instanceof Error?he.message:String(he);w(de),b("error")}finally{N.current=!1}}},[e.id,i]),J=k.useCallback(async()=>{if(A){z(!1);return}if(z(!0),L===null)try{const Y=await R3(e.id);T(Y.prompt??"")}catch(Y){U(Y instanceof Error?Y.message:String(Y))}},[A,L,e.id]),P=k.useCallback(async()=>{if(!O){H("send"),U(null);try{await M3(e.id),R(null),T(null),z(!1)}catch(Y){U(Y instanceof Error?Y.message:String(Y))}finally{H(null)}}},[O,e.id]),B=k.useCallback(async()=>{if(!O){H("skip"),U(null);try{await A3(e.id),R(null),T(null),z(!1)}catch(Y){U(Y instanceof Error?Y.message:String(Y))}finally{H(null)}}},[O,e.id]);k.useEffect(()=>{if(a===D.current)return;D.current=a,(i==="start"||i==="resume")&&v==="replay-only"&&e.status!=="running"&&(S.current?X():b("pendingFit"))},[a,i,v,e.status,X]);const I=k.useCallback(()=>{S.current?X():b("pendingFit")},[X]),V=k.useCallback((Y,he)=>{S.current={cols:Y,rows:he},v==="pendingFit"&&(e.status==="running"?(W.current=!0,b("subscribed")):X())},[v,X,e.status]),$=e.status==="running",se=v==="subscribed",[ue]=Iw(e.id),[,ae]=j_(e.id),ee=v==="starting"||v==="pendingFit"?t.jsxs("div",{style:{...Uc,pointerEvents:"none"},children:[t.jsx("span",{style:{color:Ge.dim,fontFamily:Mt,fontSize:12},children:p("session.starting")||"starting…"}),t.jsx("span",{style:{color:Ge.dim,fontFamily:Mt,fontSize:10,marginTop:6},children:p("session.starting.typeAhead")||"type-ahead is captured and replayed once ready"})]}):v==="stopping"?t.jsx("div",{style:{...Uc,pointerEvents:"none"},children:t.jsx("span",{style:{color:Ge.dim,fontFamily:Mt,fontSize:12},children:p("session.stopping")||"stopping…"})}):v==="replay-only"?t.jsx("div",{style:Uc,children:t.jsxs("button",{onClick:I,style:{display:"flex",alignItems:"center",gap:8,fontFamily:Mt,fontSize:14,color:Ge.bright,background:"transparent",border:`1px solid ${Ge.separator}`,padding:"10px 22px",borderRadius:6,cursor:"pointer"},children:[t.jsx(wr,{size:16})," ",p("session.startInWindow")||"Start"]})}):v==="error"?t.jsxs("div",{style:Uc,children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:Ge.error,fontFamily:Mt,fontSize:12,marginBottom:8},children:[t.jsx(mw,{size:14})," ",p("session.startFailed")||"failed to start"]}),C&&t.jsx("div",{style:{color:Ge.dim,fontFamily:Mt,fontSize:11,marginBottom:8,maxWidth:360,textAlign:"center",wordBreak:"break-word"},children:C}),t.jsx("button",{onClick:()=>{X()},style:{fontFamily:Mt,fontSize:12,color:Ge.bright,background:"transparent",border:`1px solid ${Ge.separator}`,padding:"4px 12px",borderRadius:4,cursor:"pointer"},children:p("common.retry")||"Retry"})]}):null;return t.jsxs("div",{style:{display:s?"block":"none",position:"absolute",inset:0,background:Ge.bg},children:[t.jsx(m8,{sessionId:e.id,isRunning:$,subscribed:se,onFitted:V,sendMessage:m,subscribeBinary:f,onEvent:o,fontSize:ue,theme:ae,inputBlocked:j!==null,autoFocusOnMount:s,onRequestRefresh:_,disableImagePaste:e.cli_tool==="raw-shell",onCycleTab:c},`${d}:${x}`),ee,j!==null&&t.jsxs("div",{style:E8,children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx("span",{"aria-hidden":!0,style:{color:Ge.info,fontSize:14},children:"📋"}),t.jsxs("span",{style:{flex:1},children:[p("session.initialPrompt.ready")||"Initial prompt ready",t.jsxs("span",{style:{color:Ge.dim,marginLeft:8},children:[j.toLocaleString()," chars"]}),t.jsx("div",{style:{color:Ge.warning,fontSize:10,marginTop:2},children:p("session.initialPrompt.blocked")||"Press Send or Skip before typing — keystrokes are ignored until then."})]}),t.jsxs("button",{onClick:J,style:Tf("neutral"),title:A?p("session.initialPrompt.hidePreview")||"Hide preview":p("session.initialPrompt.preview")||"Preview",children:[A?t.jsx(Aj,{size:11}):t.jsx(pl,{size:11}),A?p("session.initialPrompt.hidePreview")||"Hide":p("session.initialPrompt.preview")||"Preview"]}),t.jsxs("button",{onClick:P,disabled:O!==null,style:Tf("primary"),children:[O==="send"?t.jsx(Pi,{size:11,style:{animation:"spin 1s linear infinite"}}):t.jsx(gN,{size:11}),p("session.initialPrompt.send")||"Send"]}),t.jsx("button",{onClick:B,disabled:O!==null,style:Tf("danger"),children:p("session.initialPrompt.skip")||"Skip"})]}),F&&t.jsx("div",{style:{color:Ge.error,fontSize:10,marginTop:4},children:F}),A&&t.jsx("pre",{style:{margin:0,marginTop:6,maxHeight:240,overflow:"auto",background:"rgba(0,0,0,0.4)",padding:8,fontFamily:Mt,fontSize:10,color:Ge.bright,whiteSpace:"pre-wrap",wordBreak:"break-word",border:`1px solid ${Ge.separator}`,borderRadius:4},children:L===null?p("session.initialPrompt.loading")||"loading…":L})]})]})}const E8={position:"absolute",top:0,left:0,right:0,background:"rgba(28,28,38,0.96)",borderBottom:`1px solid ${Ge.separator}`,borderLeft:`3px solid ${Ge.warning}`,padding:"8px 10px",color:Ge.bright,fontFamily:Mt,fontSize:11,zIndex:3,display:"flex",flexDirection:"column"};function Tf(e){const s={display:"inline-flex",alignItems:"center",gap:4,fontFamily:Mt,fontSize:10,padding:"3px 8px",borderRadius:4,cursor:"pointer",border:`1px solid ${Ge.separator}`,background:"transparent"};return e==="primary"?{...s,color:Ge.bright,borderColor:Ge.info,background:`${Ge.info}22`}:e==="danger"?{...s,color:Ge.dim}:{...s,color:Ge.bright}}const Uc={position:"absolute",inset:0,background:"rgba(12,12,12,0.85)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:1e3},oy=340;function T8({sessionId:e}){var C,w,x,y,_,S;const[s,,i]=j_(e),[a,h]=k.useState(!1),[m,f]=k.useState(!1),[o,c]=k.useState({top:0,left:0}),d=k.useRef(null),p=k.useRef(null),u=k.useCallback(()=>{if(!d.current)return;const N=d.current.getBoundingClientRect(),D=window.innerWidth,j=window.innerHeight,R=p.current;let L=N.bottom+4,T=N.right-oy;if(R){const A=R.offsetHeight,z=R.offsetWidth;T=N.right-z,T<8&&(T=8),T+z>D-8&&(T=D-8-z),L+A>j-8&&(L=Math.max(8,N.top-A-4))}else T<8&&(T=8);c({top:L,left:T}),f(!0)},[]);k.useEffect(()=>{if(!a){f(!1);return}u();const N=requestAnimationFrame(u),D=R=>{var T,A;const L=R.target;(T=d.current)!=null&&T.contains(L)||(A=p.current)!=null&&A.contains(L)||h(!1)},j=R=>{R.key==="Escape"&&h(!1)};return document.addEventListener("mousedown",D),document.addEventListener("keydown",j),window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{cancelAnimationFrame(N),document.removeEventListener("mousedown",D),document.removeEventListener("keydown",j),window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[a,u]);const v=N=>{if(N==="custom"){const D=s.custom??{background:Tn.default.theme.background,foreground:Tn.default.theme.foreground,cursor:Tn.default.theme.cursor,selectionBackground:Tn.default.theme.selectionBackground,accent:Tn.default.theme.brightBlue};i({presetId:"custom",custom:D})}else i({presetId:N,custom:s.custom})},b=N=>{const D={...s.custom??{},...N};i({presetId:"custom",custom:D})};return t.jsxs(t.Fragment,{children:[t.jsx("button",{ref:d,"data-no-drag":!0,onMouseDown:N=>N.stopPropagation(),onClick:()=>h(N=>!N),"aria-label":"terminal-theme",title:"Terminal theme",style:{background:"transparent",border:"none",color:Ge.titleText,cursor:"pointer",padding:"0 6px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,flexShrink:0,height:"100%"},children:t.jsx(Z5,{size:13})}),a&&tn.createPortal(t.jsxs("div",{ref:p,className:"z-tooltip",style:{position:"fixed",top:o.top,left:o.left,width:oy,background:"#1e1e1e",border:`1px solid ${Ge.separator}`,borderRadius:6,padding:10,fontFamily:Mt,color:Ge.text,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",opacity:m?1:0,transition:"opacity 80ms"},onMouseDown:N=>N.stopPropagation(),children:[t.jsx("div",{style:{fontSize:10,color:Ge.dim,marginBottom:6,letterSpacing:.5},children:"DARK"}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:6,marginBottom:10},children:ey.filter(N=>!Tn[N].light).map(N=>t.jsx(ly,{preset:Tn[N],selected:s.presetId===N,onClick:()=>v(N)},N))}),t.jsx("div",{style:{fontSize:10,color:Ge.dim,marginBottom:6,letterSpacing:.5},children:"LIGHT"}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:6,marginBottom:10},children:[ey.filter(N=>Tn[N].light).map(N=>t.jsx(ly,{preset:Tn[N],selected:s.presetId===N,onClick:()=>v(N)},N)),t.jsx(L8,{selected:s.presetId==="custom",accent:((C=s.custom)==null?void 0:C.accent)??Tn.default.theme.brightBlue??"#569cd6",onClick:()=>v("custom")})]}),s.presetId==="custom"&&t.jsxs("div",{style:{borderTop:`1px solid ${Ge.separator}`,paddingTop:8},children:[t.jsx("div",{style:{fontSize:10,color:Ge.dim,marginBottom:6,letterSpacing:.5},children:"CUSTOM COLORS"}),t.jsx(Fo,{label:"Background",value:((w=s.custom)==null?void 0:w.background)??Tn.default.theme.background??"#0c0c0c",onChange:N=>b({background:N})}),t.jsx(Fo,{label:"Foreground",value:((x=s.custom)==null?void 0:x.foreground)??Tn.default.theme.foreground??"#cccccc",onChange:N=>b({foreground:N})}),t.jsx(Fo,{label:"Cursor",value:((y=s.custom)==null?void 0:y.cursor)??Tn.default.theme.cursor??"#f2f2f2",onChange:N=>b({cursor:N})}),t.jsx(Fo,{label:"Selection",value:((_=s.custom)==null?void 0:_.selectionBackground)??Tn.default.theme.selectionBackground??"#264f78",onChange:N=>b({selectionBackground:N})}),t.jsx(Fo,{label:"Accent",value:((S=s.custom)==null?void 0:S.accent)??Tn.default.theme.brightBlue??"#569cd6",onChange:N=>b({accent:N})})]})]}),document.body)]})}function ly({preset:e,selected:s,onClick:i}){return t.jsxs("button",{onClick:i,style:{position:"relative",background:e.theme.background,border:`1px solid ${s?e.accent:Ge.separator}`,outline:s?`1px solid ${e.accent}`:"none",outlineOffset:-2,borderRadius:4,padding:"6px 8px",cursor:"pointer",fontFamily:Mt,fontSize:10,color:e.theme.foreground,textAlign:"left",height:52,display:"flex",flexDirection:"column",justifyContent:"space-between",overflow:"hidden"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[t.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:e.accent,flexShrink:0}}),t.jsx("span",{style:{fontWeight:600,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),s&&t.jsx(si,{size:10,style:{marginLeft:"auto",flexShrink:0}})]}),t.jsxs("div",{style:{fontSize:9,opacity:.85,fontFamily:Mt},children:[t.jsx("span",{style:{color:e.theme.green},children:"$"})," ",t.jsx("span",{style:{color:e.theme.brightBlue},children:"ls"})]})]})}function L8({selected:e,accent:s,onClick:i}){return t.jsxs("button",{onClick:i,style:{position:"relative",background:"#0c0c0c",border:`1px dashed ${e?s:Ge.separator}`,outline:e?`1px solid ${s}`:"none",outlineOffset:-2,borderRadius:4,padding:"6px 8px",cursor:"pointer",fontFamily:Mt,fontSize:10,color:Ge.text,textAlign:"left",height:52,display:"flex",flexDirection:"column",justifyContent:"space-between",overflow:"hidden"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[t.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:s,flexShrink:0}}),t.jsx("span",{style:{fontWeight:600,fontSize:11},children:"Custom"}),e&&t.jsx(si,{size:10,style:{marginLeft:"auto",flexShrink:0}})]}),t.jsx("div",{style:{fontSize:9,opacity:.7},children:"edit colors"})]})}function Fo({label:e,value:s,onChange:i}){const[a,h]=k.useState(s);k.useEffect(()=>{h(s)},[s]);const m=f=>{h(f);const o=f.startsWith("#")?f:`#${f}`;(/^#[0-9a-fA-F]{6}$/.test(o)||/^#[0-9a-fA-F]{3}$/.test(o))&&i(cy(o))};return t.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 0",fontSize:11,color:Ge.text},children:[t.jsx("span",{style:{flex:1},children:e}),t.jsx("input",{type:"text",value:a,onChange:f=>m(f.target.value),onBlur:()=>h(s),spellCheck:!1,style:{width:64,padding:"2px 4px",fontSize:10,fontFamily:Mt,color:Ge.text,background:"transparent",border:`1px solid ${Ge.separator}`,borderRadius:3}}),t.jsx("input",{type:"color",value:cy(s),onChange:f=>i(f.target.value),style:{width:28,height:22,padding:0,border:`1px solid ${Ge.separator}`,borderRadius:3,background:"transparent",cursor:"pointer"}})]})}function cy(e){return/^#[0-9a-fA-F]{6}$/.test(e)?e.toLowerCase():/^#[0-9a-fA-F]{3}$/.test(e)?("#"+e.slice(1).split("").map(s=>s+s).join("")).toLowerCase():"#000000"}const uy=360;function D8({sessionId:e,sendMessage:s}){const[i,a]=k.useState(!1),[h,m]=k.useState(!1),[f,o]=k.useState({top:0,left:0}),[c,d]=k.useState(null),[p,u]=k.useState(""),[v,b]=k.useState(!1),[C,w]=k.useState(""),[x,y]=k.useState(""),[_,S]=k.useState(!1),[N,D]=k.useState(null),j=k.useRef(null),R=k.useRef(null),L=k.useRef(null),T=k.useCallback(()=>{if(!j.current)return;const U=j.current.getBoundingClientRect(),W=window.innerWidth,X=window.innerHeight,J=R.current;let P=U.bottom+4,B=U.right-uy;if(J){const I=J.offsetHeight,V=J.offsetWidth;B=U.right-V,B<8&&(B=8),B+V>W-8&&(B=W-8-V),P+I>X-8&&(P=Math.max(8,U.top-I-4))}else B<8&&(B=8);o({top:P,left:B}),m(!0)},[]);k.useEffect(()=>{if(!i)return;let U=!1;return Bw().then(W=>{U||d(W)}).catch(W=>{U||D(W instanceof Error?W.message:"Failed to load")}),()=>{U=!0}},[i]),k.useEffect(()=>{if(!i){m(!1);return}T();const U=requestAnimationFrame(T),W=requestAnimationFrame(()=>{requestAnimationFrame(()=>{var P;return(P=L.current)==null?void 0:P.focus()})}),X=P=>{var I,V;const B=P.target;(I=j.current)!=null&&I.contains(B)||(V=R.current)!=null&&V.contains(B)||a(!1)},J=P=>{P.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",X),document.addEventListener("keydown",J),window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{cancelAnimationFrame(U),cancelAnimationFrame(W),document.removeEventListener("mousedown",X),document.removeEventListener("keydown",J),window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[i,T]),k.useEffect(()=>{i||(u(""),b(!1),w(""),y(""),D(null))},[i]);const A=k.useMemo(()=>{if(!c)return[];const U=p.trim().toLowerCase();return U?c.filter(W=>W.name.toLowerCase().includes(U)||W.command_template.toLowerCase().includes(U)):c},[c,p]),z=U=>{s({type:"session:terminal-input",sessionId:e,input:U.command_template}),a(!1)},O=U=>{U.key==="Enter"&&A.length>0&&(U.preventDefault(),z(A[0]))},H=!!C.trim()&&!!x.trim()&&!_,F=async()=>{if(H){S(!0),D(null);try{const U=await Pw({name:C.trim(),command_template:x.trim()});d(W=>W?[U,...W]:[U]),w(""),y(""),b(!1)}catch(U){D(U instanceof Error?U.message:"Failed")}finally{S(!1)}}};return t.jsxs(t.Fragment,{children:[t.jsx("button",{ref:j,"data-no-drag":!0,onMouseDown:U=>U.stopPropagation(),onClick:()=>a(U=>!U),"aria-label":"alias-inserter",title:"Insert saved command (alias)",style:R8,children:t.jsx(e5,{size:13})}),i&&tn.createPortal(t.jsxs("div",{ref:R,className:"z-tooltip",style:{position:"fixed",top:f.top,left:f.left,width:uy,background:"#1e1e1e",border:`1px solid ${Ge.separator}`,borderRadius:6,padding:10,fontFamily:Mt,color:Ge.text,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",opacity:h?1:0,transition:"opacity 80ms"},onMouseDown:U=>U.stopPropagation(),children:[t.jsx("input",{ref:L,type:"text",value:p,onChange:U=>u(U.target.value),onKeyDown:O,placeholder:"Filter aliases… (Enter inserts first match)",style:{width:"100%",boxSizing:"border-box",background:"#0c0c0c",border:`1px solid ${Ge.separator}`,borderRadius:4,color:Ge.bright,fontFamily:Mt,fontSize:11,padding:"6px 8px",outline:"none"}}),t.jsx("div",{style:{marginTop:8,maxHeight:280,overflowY:"auto"},children:c===null?t.jsx("div",{style:dy,children:"Loading…"}):A.length===0?t.jsx("div",{style:dy,children:c.length===0?"No aliases yet — add one below.":"No matches."}):A.map(U=>t.jsxs("button",{onClick:()=>z(U),style:M8,onMouseEnter:W=>W.currentTarget.style.background="rgba(255,255,255,0.06)",onMouseLeave:W=>W.currentTarget.style.background="transparent",title:`Insert: ${U.command_template}`,children:[t.jsx("span",{style:{fontSize:11,color:Ge.bright,fontWeight:600},children:U.name}),t.jsx("code",{style:{fontSize:10,color:Ge.dim,marginLeft:8,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U.command_template})]},U.id))}),t.jsx("div",{style:{borderTop:`1px solid ${Ge.separator}`,marginTop:8,paddingTop:8},children:v?t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[t.jsx("input",{type:"text",value:C,onChange:U=>w(U.target.value),placeholder:"Name (e.g. git status)",maxLength:64,style:hy}),t.jsx("input",{type:"text",value:x,onChange:U=>y(U.target.value),onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),F())},placeholder:"Command (e.g. git status -sb)",maxLength:1024,style:{...hy,fontFamily:Mt}}),N&&t.jsx("div",{style:{fontSize:10,color:"#f87171"},children:N}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:6},children:[t.jsxs("button",{type:"button",onClick:()=>{b(!1),D(null)},style:E_,children:[t.jsx(Xt,{size:10})," Cancel"]}),t.jsx("button",{type:"button",onClick:F,disabled:!H,style:{...A8,opacity:H?1:.5},children:"Save"})]})]}):t.jsxs("button",{type:"button",onClick:()=>{b(!0),D(null)},style:O8,children:[t.jsx(mn,{size:12})," New alias"]})})]}),document.body)]})}const R8={background:"transparent",border:"none",color:Ge.titleText,cursor:"pointer",padding:"0 6px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,flexShrink:0,height:"100%"},dy={fontSize:11,color:Ge.dim,padding:"12px 4px",textAlign:"center"},M8={display:"flex",alignItems:"center",width:"100%",background:"transparent",border:"none",padding:"6px 8px",cursor:"pointer",textAlign:"left",borderRadius:3,transition:"background 80ms"},hy={width:"100%",boxSizing:"border-box",background:"#0c0c0c",border:`1px solid ${Ge.separator}`,borderRadius:4,color:Ge.bright,fontSize:11,padding:"5px 7px",outline:"none"},E_={display:"inline-flex",alignItems:"center",gap:3,background:"transparent",border:`1px solid ${Ge.separator}`,color:Ge.dim,fontFamily:Mt,fontSize:10,padding:"3px 8px",borderRadius:4,cursor:"pointer"},A8={...E_,background:"rgba(86,156,214,0.13)",border:"1px solid #569cd6",color:Ge.bright},O8={display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:Ge.dim,fontFamily:Mt,fontSize:11,padding:"4px 0",cursor:"pointer"},z8=26;function fp({stack:e,path:s,groupId:i,sessionsById:a,colors:h,intents:m,onTabClick:f,onTabClose:o,onTabMouseDown:c,onPaneAutoClose:d,registerRect:p,sendMessage:u,subscribeBinary:v,onEvent:b,groupActions:C}){const{t:w}=it(),[x,,y]=Iw(e.activeTab),[_,S]=k.useState({}),N=()=>{const T=e.activeTab;T&&S(A=>({...A,[T]:(A[T]||0)+1}))},D=nO(),j=T=>{T.button===0&&e.activeTab&&(D==null||D.focus(e.activeTab)),T.stopPropagation()},R=e.tabs.length>1?T=>{const A=e.tabs.indexOf(e.activeTab);if(A<0)return;const z=e.tabs.length,O=T==="next"?(A+1)%z:(A-1+z)%z;f(e.tabs[O])}:void 0,L=T=>{const A=/Mac|iPhone|iPad|iPod/.test(navigator.platform),z=A?T.metaKey:T.ctrlKey,O=A?T.ctrlKey:T.metaKey,H=T.key==="F5"&&!T.ctrlKey&&!T.metaKey&&!T.altKey&&!T.shiftKey,F=z&&!O&&!T.altKey&&T.shiftKey&&T.key.toLowerCase()==="r";!H&&!F||(T.preventDefault(),N())};return t.jsxs("div",{onKeyDown:L,style:{flex:1,display:"flex",flexDirection:"column",background:Ge.bg,minWidth:0,minHeight:0,position:"relative",overflow:"hidden"},children:[t.jsxs("div",{style:{display:"flex",height:z8,background:Ge.titleBg,borderBottom:`1px solid ${Ge.separator}`,flexShrink:0,overflowX:"auto",overflowY:"hidden"},children:[e.tabs.map(T=>{const A=a.get(T),z=T===e.activeTab,O=h[T]||Ge.titleText;return t.jsxs("div",{onMouseDown:H=>{if(H.button===0){if(C){f(T);return}H.stopPropagation(),f(T),c(T,s,H)}},style:{display:"flex",alignItems:"center",gap:6,padding:"0 6px 0 10px",fontFamily:Mt,fontSize:11,color:z?Ge.bright:Ge.titleText,background:z?Ge.bg:"transparent",borderRight:`1px solid ${Ge.separator}`,cursor:"pointer",userSelect:"none",whiteSpace:"nowrap",maxWidth:200,position:"relative"},title:(A==null?void 0:A.title)||T,children:[t.jsx("span",{"aria-hidden":!0,style:{flexShrink:0,fontFamily:Mt,fontSize:11,fontWeight:700,letterSpacing:-.5,lineHeight:1,color:O,width:16,textAlign:"center"},children:">_"}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",flex:1},children:(A==null?void 0:A.title)||T}),t.jsx("button",{"data-no-drag":!0,onMouseDown:H=>H.stopPropagation(),onClick:H=>{H.stopPropagation(),o(T)},"aria-label":"close-tab",title:w("group.closeTab")||"Close tab",style:{background:"transparent",border:"none",color:Ge.titleText,cursor:"pointer",padding:1,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:3,flexShrink:0},children:t.jsx(Xt,{size:11})})]},T)}),D&&t.jsx("button",{"data-no-drag":!0,onMouseDown:T=>T.stopPropagation(),onClick:()=>{D.createRawShellTab(i,s).catch(()=>{})},"aria-label":"new-tab",title:`${w("group.newTab")||"New shell tab"} (Ctrl+T)`,style:{background:"transparent",border:"none",borderRight:`1px solid ${Ge.separator}`,color:Ge.titleText,cursor:"pointer",padding:"0 8px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,height:"100%"},children:t.jsx(mn,{size:13})}),t.jsx("div",{style:{flex:1,minWidth:8}}),t.jsx(D8,{sessionId:e.activeTab,sendMessage:u}),t.jsx("button",{"data-no-drag":!0,onMouseDown:T=>T.stopPropagation(),onClick:N,"aria-label":"refresh-terminal",title:`${w("session.refresh")||"Refresh rendering"} (F5 · Ctrl+Shift+R) — ${w("session.refresh.hint")||"Rebuild the terminal view (PTY stays running)"}`,style:Na,children:t.jsx(fN,{size:12})}),t.jsx("button",{"data-no-drag":!0,onMouseDown:T=>T.stopPropagation(),onClick:()=>y(-1),"aria-label":"decrease-font",title:`${w("session.fontDecrease")||"Decrease font size"} (${x}px) · Ctrl+wheel`,style:Na,children:t.jsx(zN,{size:13})}),t.jsx("button",{"data-no-drag":!0,onMouseDown:T=>T.stopPropagation(),onClick:()=>y(1),"aria-label":"increase-font",title:`${w("session.fontIncrease")||"Increase font size"} (${x}px) · Ctrl+wheel`,style:Na,children:t.jsx(AN,{size:13})}),t.jsx(T8,{sessionId:e.activeTab}),C&&t.jsxs(t.Fragment,{children:[C.onPopOutGroup&&t.jsx("button",{"data-no-drag":!0,onMouseDown:T=>T.stopPropagation(),onClick:C.onPopOutGroup,"aria-label":"pop-out",title:w("session.popOut")||"Pop out to separate window",style:Na,children:t.jsx(ii,{size:13})}),t.jsx("button",{"data-no-drag":!0,onMouseDown:T=>T.stopPropagation(),onClick:C.onMinimizeGroup,"aria-label":"minimize",title:w("session.minimize")||"Minimize",style:Na,children:t.jsx(_w,{size:13})}),t.jsx("button",{"data-no-drag":!0,onMouseDown:T=>T.stopPropagation(),onClick:C.onCloseGroup,"aria-label":"close",style:Na,children:t.jsx(Xt,{size:13})})]})]}),t.jsx("div",{"data-group-id":i,"data-stack-path":s.join("."),ref:T=>{if(!T){p(s,null);return}const A=T.getBoundingClientRect();p(s,{x:A.left,y:A.top,w:A.width,h:A.height})},onMouseDown:j,style:{flex:1,position:"relative",minHeight:0,minWidth:0},children:e.tabs.map(T=>{const A=a.get(T);if(!A)return null;const z=m[T]||{intent:"open",nonce:0};return t.jsx(N_,{session:A,visible:T===e.activeTab,intent:z.intent,intentNonce:z.nonce,onClose:()=>d(T),sendMessage:u,subscribeBinary:v,onEvent:b,onCycleTab:R,remountKey:_[T]||0},T)})})]})}const Na={background:"transparent",border:"none",color:Ge.titleText,cursor:"pointer",padding:"0 6px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,flexShrink:0,height:"100%"};function B8({orientation:e,onDragStart:s,onDrag:i,onDragEnd:a}){const h=k.useCallback(f=>{if(f.button!==0)return;f.preventDefault(),f.stopPropagation();const o=f.clientX,c=f.clientY;s();let d=!1;const p=()=>{d||(d=!0,window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",w),window.removeEventListener("blur",u),window.removeEventListener("keydown",v),document.removeEventListener("visibilitychange",b))},u=()=>{p(),a()},v=x=>{x.key==="Escape"&&u()},b=()=>{document.hidden&&u()},C=x=>{const y=e==="horizontal"?x.clientX-o:x.clientY-c;i(y)},w=()=>{p(),a()};window.addEventListener("mousemove",C),window.addEventListener("mouseup",w),window.addEventListener("blur",u),window.addEventListener("keydown",v),document.addEventListener("visibilitychange",b)},[e,s,i,a]),m=e==="horizontal";return t.jsx("div",{onMouseDown:h,style:{flex:"0 0 4px",background:Ge.separator,cursor:m?"col-resize":"row-resize",position:"relative",zIndex:1}})}function mp(e){const{node:s,path:i,onSplitSizes:a,...h}=e;return s.kind==="stack"?t.jsx(fp,{stack:s,path:i,...h}):t.jsx(P8,{split:s,path:i,onSplitSizes:a,stackProps:h})}const fy=80;function P8({split:e,path:s,onSplitSizes:i,stackProps:a}){const h=e.orientation==="horizontal",m=k.useRef(null),f=k.useRef([]),o=k.useRef(null);return t.jsx("div",{ref:m,style:{display:"flex",flexDirection:h?"row":"column",flex:1,minWidth:0,minHeight:0},children:e.children.map((c,d)=>t.jsxs(k.Fragment,{children:[t.jsx("div",{ref:p=>{f.current[d]=p},style:{flex:`0 0 ${e.sizes[d]}%`,display:"flex",flexDirection:"column",minWidth:0,minHeight:0,overflow:"hidden"},children:t.jsx(mp,{node:c,path:[...s,d],onSplitSizes:i,...a})}),d<e.children.length-1&&t.jsx(B8,{orientation:e.orientation,onDragStart:()=>{const p=m.current;if(!p)return;const u=e.sizes.slice();o.current={i:d,initialSizes:u,finalSizes:u.slice(),total:h?p.clientWidth:p.clientHeight}},onDrag:p=>{const u=o.current;if(!u||u.total<=0)return;const v=u.initialSizes[u.i]/100*u.total,b=u.initialSizes[u.i+1]/100*u.total,C=v+b,w=Math.max(fy,Math.min(C-fy,v+p)),x=C-w,y=w/u.total*100,_=x/u.total*100,S=f.current[u.i],N=f.current[u.i+1];S&&(S.style.flexBasis=`${y}%`),N&&(N.style.flexBasis=`${_}%`);const D=u.initialSizes.slice();D[u.i]=y,D[u.i+1]=_,u.finalSizes=D},onDragEnd:()=>{const p=o.current;p&&i(s,p.finalSizes),o.current=null}})]},d))})}const Zt=28,ms=68;function Pu(e,s,i){const a=e-i.x,h=s-i.y;if(a<0||h<0||a>i.w||h>i.h)return null;const m=a-i.w/2,f=h-i.h/2;return Math.abs(m)<=Zt&&Math.abs(f)<=Zt?"center":m>=-ms-Zt&&m<=-ms+Zt&&Math.abs(f)<=Zt?"left":m>=ms-Zt&&m<=ms+Zt&&Math.abs(f)<=Zt?"right":f>=-ms-Zt&&f<=-ms+Zt&&Math.abs(m)<=Zt?"top":f>=ms-Zt&&f<=ms+Zt&&Math.abs(m)<=Zt?"bottom":null}function vu(e,s){const i=document.elementsFromPoint(e,s);for(const a of i){const h=a.closest("[data-group-id][data-stack-path]");if(!h)continue;const m=h.dataset.stackPath||"",f=m===""?[]:m.split(".").map(Number),o=h.getBoundingClientRect(),c={x:o.left,y:o.top,w:o.width,h:o.height};return{groupId:h.dataset.groupId||"",path:f,rect:c,zone:Pu(e,s,c)}}return null}function I8(e,s){const i=e.w/2,a=e.h/2;switch(s){case"center":return e;case"left":return{x:e.x,y:e.y,w:i,h:e.h};case"right":return{x:e.x+i,y:e.y,w:i,h:e.h};case"top":return{x:e.x,y:e.y,w:e.w,h:a};case"bottom":return{x:e.x,y:e.y+a,w:e.w,h:a}}}function ul({targetRect:e,activeZone:s}){const i=e.x+e.w/2,a=e.y+e.h/2,h=s?I8(e,s):null;return tn.createPortal(t.jsxs(t.Fragment,{children:[h&&t.jsx("div",{style:{position:"fixed",left:h.x,top:h.y,width:h.w,height:h.h,background:`${Ge.info}33`,border:`2px dashed ${Ge.info}`,borderRadius:4,pointerEvents:"none",zIndex:2400,boxSizing:"border-box"}}),(()=>{const m=ms+Zt;return t.jsxs("div",{style:{position:"fixed",left:i-m,top:a-m,width:m*2,height:m*2,pointerEvents:"none",zIndex:2500},children:[t.jsx($o,{offsetX:m-Zt,offsetY:m-Zt,active:s==="center",kind:"center"}),t.jsx($o,{offsetX:m-ms-Zt,offsetY:m-Zt,active:s==="left",kind:"left"}),t.jsx($o,{offsetX:m+ms-Zt,offsetY:m-Zt,active:s==="right",kind:"right"}),t.jsx($o,{offsetX:m-Zt,offsetY:m-ms-Zt,active:s==="top",kind:"top"}),t.jsx($o,{offsetX:m-Zt,offsetY:m+ms-Zt,active:s==="bottom",kind:"bottom"})]})})()]}),document.body)}function $o({offsetX:e,offsetY:s,active:i,kind:a}){const h=Zt*2,m=i?Ge.info:"#3a3a3a",f=i?Ge.bright:Ge.separator;return t.jsx("div",{style:{position:"absolute",left:e,top:s,width:h,height:h,background:"#1a1a1a",border:`1px solid ${f}`,borderRadius:4,boxShadow:i?`0 0 8px ${Ge.info}`:"0 1px 3px rgba(0,0,0,0.4)",boxSizing:"border-box",overflow:"hidden"},children:t.jsx(H8,{kind:a,fill:m})})}function H8({kind:e,fill:s}){const i={position:"absolute",background:s};switch(e){case"center":return t.jsx("div",{style:{...i,inset:4}});case"left":return t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{...i,left:4,top:4,bottom:4,width:"calc(50% - 4px)"}}),t.jsx("div",{style:{position:"absolute",right:4,top:4,bottom:4,width:"calc(50% - 4px)",border:`1px dashed ${s}`,boxSizing:"border-box"}})]});case"right":return t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{position:"absolute",left:4,top:4,bottom:4,width:"calc(50% - 4px)",border:`1px dashed ${s}`,boxSizing:"border-box"}}),t.jsx("div",{style:{...i,right:4,top:4,bottom:4,width:"calc(50% - 4px)"}})]});case"top":return t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{...i,top:4,left:4,right:4,height:"calc(50% - 4px)"}}),t.jsx("div",{style:{position:"absolute",bottom:4,left:4,right:4,height:"calc(50% - 4px)",border:`1px dashed ${s}`,boxSizing:"border-box"}})]});case"bottom":return t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{position:"absolute",top:4,left:4,right:4,height:"calc(50% - 4px)",border:`1px dashed ${s}`,boxSizing:"border-box"}}),t.jsx("div",{style:{...i,bottom:4,left:4,right:4,height:"calc(50% - 4px)"}})]})}}function Ai(e,s){return{kind:"stack",tabs:e.slice(),activeTab:s??e[0]}}function Zo(e,s){let i=e;for(const a of s){if(i.kind!=="split"||a<0||a>=i.children.length)return null;i=i.children[a]}return i}function Iu(e,s){if(e.kind==="stack")return e.tabs.includes(s)?[]:null;for(let i=0;i<e.children.length;i++){const a=Iu(e.children[i],s);if(a)return[i,...a]}return null}function dn(e){return e.kind==="stack"?e.tabs.slice():e.children.flatMap(dn)}function T_(e){return e.kind==="stack"?[e.activeTab]:e.children.flatMap(T_)}function zi(e,s){return L_(e,s)}function L_(e,s){if(e.kind==="stack"){if(!e.tabs.includes(s))return e;const m=e.tabs.filter(o=>o!==s);if(m.length===0)return null;const f=e.activeTab===s?m[0]:e.activeTab;return{kind:"stack",tabs:m,activeTab:f}}const i=[],a=[];for(let m=0;m<e.children.length;m++){const f=L_(e.children[m],s);f!==null&&(i.push(f),a.push(e.sizes[m]))}if(i.length===0)return null;if(i.length===1)return i[0];const h=a.reduce((m,f)=>m+f,0)||1;return{kind:"split",orientation:e.orientation,children:i,sizes:a.map(m=>m/h*100)}}function Oi(e,s,i){return Hu(e,s,a=>{if(a.kind!=="stack")throw new Error("insertIntoStack: target must be a stack");return a.tabs.includes(i)?{...a,activeTab:i}:{kind:"stack",tabs:[...a.tabs,i],activeTab:i}})}function Ra(e,s,i,a){const h=i==="left"||i==="right"?"horizontal":"vertical",m=i==="left"||i==="top";return Hu(e,s,f=>({kind:"split",orientation:h,children:m?[a,f]:[f,a],sizes:[50,50]}))}function Hu(e,s,i){if(s.length===0)return bu(i(e));if(e.kind!=="split")throw new Error("replaceAt: path traverses non-split");const[a,...h]=s;if(a<0||a>=e.children.length)throw new Error("replaceAt: bad path");const m=e.children.map((f,o)=>o===a?Hu(f,h,i):f);return bu({...e,children:m})}function bu(e){if(e.kind==="stack")return e;const s=e.children.map(bu),i=[],a=[];for(let m=0;m<s.length;m++){const f=s[m],o=e.sizes[m]??100/s.length;if(f.kind==="split"&&f.orientation===e.orientation){const c=f.sizes.reduce((d,p)=>d+p,0)||1;for(let d=0;d<f.children.length;d++)i.push(f.children[d]),a.push(f.sizes[d]/c*o)}else i.push(f),a.push(o)}if(i.length===1)return i[0];const h=a.reduce((m,f)=>m+f,0)||1;return{kind:"split",orientation:e.orientation,children:i,sizes:a.map(m=>m/h*100)}}function Os(e,s){return e.kind==="stack"?e.tabs.includes(s)?{...e,activeTab:s}:e:{...e,children:e.children.map(i=>Os(i,s))}}function D_(e,s,i){if(e.kind==="stack"){if(!e.tabs.includes(s))return e;const a=e.tabs.indexOf(s),h=Math.max(0,Math.min(i,e.tabs.length-1));if(h===a)return e;const m=e.tabs.slice();return m.splice(a,1),m.splice(h,0,s),{...e,tabs:m}}return{...e,children:e.children.map(a=>D_(a,s,i))}}function R_(e,s,i){return Hu(e,s,a=>{if(a.kind!=="split")throw new Error("setSplitSizes: target must be a split");if(a.children.length!==i.length)throw new Error("setSplitSizes: size count mismatch");return{...a,sizes:i}})}function F8(e,s,i,a){const h=Zo(e,i);if(!h||h.kind!=="stack"||a==="center"&&h.tabs.includes(s))return null;const m=h.tabs.find(d=>d!==s);if(!m)return null;const f=zi(e,s);if(!f)return null;const o=Iu(f,m);if(!o)return null;const c=a==="center"?Oi(f,o,s):Ra(f,o,a,Ai([s]));return Os(c,s)}function $8(e,s){const i=dn(e);let a=e;for(const h of i){if(!a)break;s.has(h)||(a=zi(a,h))}return a}const Lf=320,Df=200,Wc=80,Gc=22,U8=4,my=8,Jr=10,qc=60;function Qr(e,s,i){return Math.max(s,Math.min(i,e))}function W8(e,s,i,a){const h=e<=my,m=e>=i-my;if(!h&&!m)return null;const f=a/3,o=a*2/3;return h?s<f?"top-left":s>o?"bottom-left":"left":s<f?"top-right":s>o?"bottom-right":"right"}function py(e,s,i){const a=Math.round(s/2),h=Math.round(i/2);switch(e){case"left":return{x:0,y:0,w:a,h:i};case"right":return{x:s-a,y:0,w:a,h:i};case"top-left":return{x:0,y:0,w:a,h};case"top-right":return{x:s-a,y:0,w:a,h};case"bottom-left":return{x:0,y:i-h,w:a,h};case"bottom-right":return{x:s-a,y:i-h,w:a,h}}}function G8(e,s,i,a,h){let m=e,f=s;const o=m,c=m+i,d=f,p=f+a;for(const u of h){const v=u.x,b=u.x+u.w,C=u.y,w=u.y+u.h;d<w&&p>C&&(Math.abs(o-b)<=Jr?m=b:Math.abs(c-v)<=Jr?m=v-i:Math.abs(o-v)<=Jr?m=v:Math.abs(c-b)<=Jr&&(m=b-i)),o<b&&c>v&&(Math.abs(d-w)<=Jr?f=w:Math.abs(p-C)<=Jr?f=C-a:Math.abs(d-C)<=Jr?f=C:Math.abs(p-w)<=Jr&&(f=w-a))}return{x:m,y:f}}function q8({group:e,sessionsById:s,neighbors:i,isTopmost:a,zIndex:h,sendMessage:m,subscribeBinary:f,onEvent:o}){const{t:c}=it(),d=h_("(max-width: 767px)"),p=B_(),u=k.useRef(null),v=k.useRef({x:e.x,y:e.y,w:e.w,h:e.h});v.current={x:e.x,y:e.y,w:e.w,h:e.h};const[b,C]=k.useState(null),w=k.useRef(null),x=k.useRef(i);x.current=i;const[y,_]=k.useState(null),S=k.useRef(null),N=k.useCallback((P,B)=>{if(d||P.button!==0||P.target.closest("[data-no-drag]"))return;P.preventDefault(),p.focus(dn(e.root)[0]||"");const V=P.clientX,$=P.clientY,se={...v.current},ue=u.current,ae=window.innerWidth,ee=window.innerHeight;let Y="";B&&ue&&(Y=ue.style.pointerEvents,ue.style.pointerEvents="none");let he=!1;const de=()=>{he||(he=!0,window.removeEventListener("mousemove",Te),window.removeEventListener("mouseup",be),window.removeEventListener("blur",ke),window.removeEventListener("keydown",re),document.removeEventListener("visibilitychange",Fe),B&&ue&&(ue.style.pointerEvents=Y))},ke=()=>{de(),S.current=null,_(null),w.current=null,C(null),p.setGroupGeometry(e.id,{...v.current})},re=pe=>{pe.key==="Escape"&&ke()},Fe=()=>{document.hidden&&ke()};let Ne=!1;const Te=pe=>{if(Ne)return;{const Oe=window.screenX,fe=window.screenY,je=Oe+window.outerWidth,oe=fe+window.outerHeight;if(pe.screenX<Oe-qc||pe.screenX>je+qc||pe.screenY<fe-qc||pe.screenY>oe+qc){Ne=!0,de(),S.current=null,_(null),w.current=null,C(null),p.setGroupGeometry(e.id,{...v.current}),p.popOutGroup(e.id,{atScreenX:pe.screenX,atScreenY:pe.screenY});return}}const Je=pe.clientX-V,Ye=pe.clientY-$;let ge=Qr(se.x+Je,-(se.w-Wc),ae-Wc),Ce=Qr(se.y+Ye,0,ee-Gc);const Ke=x.current;if(Ke.length>0){const Oe=G8(ge,Ce,se.w,se.h,Ke);ge=Oe.x,Ce=Oe.y}if(ue&&(ue.style.left=`${ge}px`,ue.style.top=`${Ce}px`),v.current.x=ge,v.current.y=Ce,B){let Oe=null;const fe=document.elementFromPoint(pe.clientX,pe.clientY),je=fe==null?void 0:fe.closest("[data-group-id][data-stack-path]");if(je){const oe=je.dataset.groupId||"";if(oe!==e.id){const q=je.dataset.stackPath||"",K=q===""?[]:q.split(".").map(Number),Q=je.getBoundingClientRect(),ie={x:Q.left,y:Q.top,w:Q.width,h:Q.height};Oe={groupId:oe,path:K,rect:ie,zone:Pu(pe.clientX,pe.clientY,ie)}}}S.current=Oe,_(Oe?{rect:Oe.rect,zone:Oe.zone}:null)}const tt=B&&S.current&&S.current.zone?null:W8(pe.clientX,pe.clientY,ae,ee);tt!==w.current&&(w.current=tt,C(tt))},be=()=>{if(de(),B&&S.current&&S.current.zone){const pe=S.current;p.dockGroup(e.id,pe.groupId,pe.path,pe.zone),S.current=null,_(null),w.current=null,C(null);return}if(w.current){const pe=py(w.current,ae,ee);ue&&(ue.style.left=`${pe.x}px`,ue.style.top=`${pe.y}px`,ue.style.width=`${pe.w}px`,ue.style.height=`${pe.h}px`),v.current=pe,w.current=null,C(null)}S.current=null,_(null),p.setGroupGeometry(e.id,{...v.current})};window.addEventListener("mousemove",Te),window.addEventListener("mouseup",be),window.addEventListener("blur",ke),window.addEventListener("keydown",re),document.addEventListener("visibilitychange",Fe)},[d,p,e.id,e.root]),D=k.useCallback(P=>N(P,!1),[N]),j=k.useCallback(P=>N(P,!0),[N]),R=k.useCallback(P=>B=>{if(d||B.button!==0)return;B.preventDefault(),B.stopPropagation();const I=B.clientX,V=B.clientY,$={...v.current},se=u.current,ue=window.innerWidth,ae=window.innerHeight,ee=Ne=>{const Te=Ne.clientX-I,be=Ne.clientY-V;let pe=$.x,Je=$.y,Ye=$.w,ge=$.h;P.includes("e")?Ye=Qr($.w+Te,Lf,Math.max(Lf,ue-$.x)):P.includes("w")&&(pe=Qr($.x+Te,0,$.x+$.w-Lf),Ye=$.x+$.w-pe),P.includes("s")?ge=Qr($.h+be,Df,Math.max(Df,ae-$.y)):P.includes("n")&&(Je=Qr($.y+be,0,$.y+$.h-Df),ge=$.y+$.h-Je),se&&(se.style.left=`${pe}px`,se.style.top=`${Je}px`,se.style.width=`${Ye}px`,se.style.height=`${ge}px`),v.current={x:pe,y:Je,w:Ye,h:ge}};let Y=!1;const he=()=>{Y||(Y=!0,window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",Fe),window.removeEventListener("blur",de),window.removeEventListener("keydown",ke),document.removeEventListener("visibilitychange",re))},de=()=>{he(),p.setGroupGeometry(e.id,{...v.current})},ke=Ne=>{Ne.key==="Escape"&&de()},re=()=>{document.hidden&&de()},Fe=()=>{he(),p.setGroupGeometry(e.id,{...v.current})};window.addEventListener("mousemove",ee),window.addEventListener("mouseup",Fe),window.addEventListener("blur",de),window.addEventListener("keydown",ke),document.addEventListener("visibilitychange",re)},[d,p,e.id]);k.useEffect(()=>{if(d)return;const P=()=>{const B=window.innerWidth,I=window.innerHeight,V=v.current,$=Qr(V.x,-(V.w-Wc),B-Wc),se=Qr(V.y,0,I-Gc);($!==V.x||se!==V.y)&&p.setGroupGeometry(e.id,{...V,x:$,y:se})};return window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[d,p,e.id]);const L=k.useCallback(P=>{p.setActiveTab(e.id,P)},[p,e.id]),T=k.useCallback(P=>{p.close(P)},[p]),A=k.useCallback((P,B,I)=>{p.beginTabDrag(e.id,P,B,I)},[p,e.id]),z=k.useCallback(P=>{p.close(P)},[p]),O=k.useCallback((P,B)=>{p.setSplitSizes(e.id,P,B)},[p,e.id]),H=T_(e.root),F=dn(e.root);if(d){const P=H[0],B=P?s.get(P):null;if(!B)return null;const I=e.intents[P]??{intent:"open",nonce:0};return tn.createPortal(t.jsxs("div",{style:{position:"fixed",inset:0,background:Ge.bg,display:"flex",flexDirection:"column",zIndex:110},children:[t.jsxs("div",{style:{background:Ge.titleBg,height:Gc,display:"flex",alignItems:"center",borderBottom:`1px solid ${Ge.separator}`},children:[t.jsx("span",{style:{flex:1,color:Ge.titleText,fontFamily:Mt,fontSize:12,paddingLeft:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:B.title}),t.jsx("button",{"data-no-drag":!0,onClick:()=>p.closeGroup(e.id),style:Kc,"aria-label":"close",children:t.jsx(Xt,{size:14})})]}),t.jsx("div",{style:{flex:1,position:"relative",minHeight:0},children:t.jsx(N_,{session:B,visible:!0,intent:I.intent,intentNonce:I.nonce,onClose:()=>p.close(P),sendMessage:m,subscribeBinary:f,onEvent:o})})]}),document.body)}const U=b?(()=>{const P=window.innerWidth,B=window.innerHeight,I=py(b,P,B);return tn.createPortal(t.jsx("div",{style:{position:"fixed",left:I.x,top:I.y,width:I.w,height:I.h,background:`${Ge.info}33`,border:`2px dashed ${Ge.info}`,borderRadius:8,pointerEvents:"none",zIndex:2e3,transition:"left 80ms ease-out, top 80ms ease-out, width 80ms ease-out, height 80ms ease-out",boxSizing:"border-box"}}),document.body)})():null,W=(()=>{var B;if(F.length===0)return"";const P=((B=s.get(F[0]))==null?void 0:B.title)||F[0];return F.length===1?P:`${P} +${F.length-1}`})(),X=e.root.kind==="split",J=tn.createPortal(t.jsxs("div",{ref:u,onMouseDown:X?()=>p.focus(F[0]||""):j,style:{position:"fixed",left:e.x,top:e.y,width:e.w,height:e.h,zIndex:h,background:Ge.bg,border:`1px solid ${a?Ge.info:Ge.separator}`,borderRadius:8,boxShadow:a?`0 10px 40px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.3), 0 0 0 1px ${Ge.info}66, 0 0 18px ${Ge.info}33`:"0 10px 40px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.3)",display:"flex",flexDirection:"column",overflow:"hidden",transition:"box-shadow 120ms ease-out, border-color 120ms ease-out"},children:[X&&t.jsxs("div",{onMouseDown:D,style:{height:Gc,flexShrink:0,display:"flex",flexDirection:"column",background:Ge.titleBg,borderBottom:`1px solid ${Ge.separator}`,userSelect:"none",cursor:"move"},children:[t.jsx("div",{style:{display:"flex",height:U8,flexShrink:0},children:H.map((P,B)=>t.jsx("div",{style:{flex:1,background:e.colors[P]||Ge.titleText}},B))}),t.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",padding:"0 4px 0 8px",color:Ge.titleText,fontFamily:Mt,fontSize:11},children:[t.jsx("span",{style:{color:Ge.info,fontWeight:600,letterSpacing:1,marginRight:8},"aria-hidden":!0,children:">_"}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W}),t.jsx("button",{"data-no-drag":!0,onMouseDown:P=>P.stopPropagation(),onClick:()=>p.popOutGroup(e.id),style:Kc,"aria-label":"pop-out",title:c("session.popOut")||"Pop out to separate window",children:t.jsx(ii,{size:14})}),t.jsx("button",{"data-no-drag":!0,onClick:()=>p.minimizeGroup(e.id),style:Kc,"aria-label":"minimize",title:c("session.minimize")||"Minimize",children:t.jsx(_w,{size:14})}),t.jsx("button",{"data-no-drag":!0,onClick:()=>p.closeGroup(e.id),style:Kc,"aria-label":"close",children:t.jsx(Xt,{size:14})})]})]}),t.jsx("div",{style:{flex:1,display:"flex",minHeight:0,minWidth:0},children:e.root.kind==="split"?t.jsx(mp,{node:e.root,path:[],groupId:e.id,sessionsById:s,colors:e.colors,intents:e.intents,onTabClick:L,onTabClose:T,onTabMouseDown:A,onPaneAutoClose:z,registerRect:()=>{},onSplitSizes:O,sendMessage:m,subscribeBinary:f,onEvent:o}):t.jsx(fp,{stack:e.root,path:[],groupId:e.id,sessionsById:s,colors:e.colors,intents:e.intents,onTabClick:L,onTabClose:T,onTabMouseDown:A,onPaneAutoClose:z,registerRect:()=>{},sendMessage:m,subscribeBinary:f,onEvent:o,groupActions:{onMinimizeGroup:()=>p.minimizeGroup(e.id),onCloseGroup:()=>p.closeGroup(e.id),onPopOutGroup:()=>p.popOutGroup(e.id)}})}),t.jsx("div",{onMouseDown:R("n"),style:{position:"absolute",top:0,left:6,right:6,height:4,cursor:"ns-resize",zIndex:3}}),t.jsx("div",{onMouseDown:R("s"),style:{position:"absolute",bottom:0,left:6,right:6,height:4,cursor:"ns-resize",zIndex:3}}),t.jsx("div",{onMouseDown:R("w"),style:{position:"absolute",top:6,bottom:6,left:0,width:4,cursor:"ew-resize",zIndex:3}}),t.jsx("div",{onMouseDown:R("e"),style:{position:"absolute",top:6,bottom:6,right:0,width:4,cursor:"ew-resize",zIndex:3}}),t.jsx("div",{onMouseDown:R("nw"),style:{position:"absolute",top:0,left:0,width:10,height:10,cursor:"nwse-resize",zIndex:4}}),t.jsx("div",{onMouseDown:R("ne"),style:{position:"absolute",top:0,right:0,width:10,height:10,cursor:"nesw-resize",zIndex:4}}),t.jsx("div",{onMouseDown:R("sw"),style:{position:"absolute",bottom:0,left:0,width:10,height:10,cursor:"nesw-resize",zIndex:4}}),t.jsx("div",{onMouseDown:R("se"),title:"resize",style:{position:"absolute",right:0,bottom:0,width:14,height:14,cursor:"nwse-resize",background:"linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.2) 50%)",zIndex:4}})]}),document.body);return t.jsxs(t.Fragment,{children:[J,U,y&&t.jsx(ul,{targetRect:y.rect,activeZone:y.zone})]})}const Kc={background:"transparent",border:"none",color:Ge.titleText,cursor:"pointer",padding:4,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:4},Rf=["#3b82f6","#22c55e","#eab308","#ef4444","#a855f7","#06b6d4","#f97316","#ec4899"];function Mi(e){for(const s of Rf)if(!e.includes(s))return s;return Rf[e.length%Rf.length]}const K8="clitrigger:session-windows:global";function pp(){if(typeof BroadcastChannel>"u")return{post:()=>{},subscribe:()=>()=>{},close:()=>{}};const e=new BroadcastChannel(K8),s=new Set;return e.onmessage=i=>{const a=i.data;for(const h of s)try{h(a)}catch{}},{post:i=>{e.postMessage(i)},subscribe:i=>(s.add(i),()=>{s.delete(i)}),close:()=>{s.clear(),e.close()}}}const Bt="main",vm=new Map;function V8(e,s){vm.set(e,s)}function Y8(e){const s=vm.get(e);if(!s||s.closed)return vm.delete(e),!1;try{return s.focus(),!0}catch{return!1}}function X8(){return`popout_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}const M_=5e3,J8=15e3;let La=null;function A_(){if(typeof window>"u")return()=>{};const e=s=>{La={sx:s.screenX,sy:s.screenY,cx:s.clientX,cy:s.clientY}};return window.addEventListener("mousemove",e,{passive:!0}),()=>window.removeEventListener("mousemove",e)}function yu(e,s){if(La)return{x:La.cx+(e-La.sx),y:La.cy+(s-La.sy)};const i=Math.max(0,(window.outerWidth-window.innerWidth)/2),a=Math.max(0,window.outerHeight-window.innerHeight-i);return{x:e-window.screenX-i,y:s-window.screenY-a}}function wu(e){return e.x>=0&&e.y>=0&&e.x<=window.innerWidth&&e.y<=window.innerHeight}const bm="clitrigger:popout-alive:";function Q8(e){return`${bm}${e}`}function O_(){return typeof navigator<"u"&&!!navigator.locks&&typeof navigator.locks.query=="function"}function Z8(e){if(!O_())return()=>{};let s=()=>{};return navigator.locks.request(Q8(e),()=>new Promise(i=>{s=i})).catch(()=>{}),()=>s()}async function eO(){var e;if(!O_())return new Set;try{const s=await navigator.locks.query(),i=new Set;for(const a of s.held??[])(e=a.name)!=null&&e.startsWith(bm)&&i.add(a.name.slice(bm.length));return i}catch{return new Set}}const gp=k.createContext(null),z_=k.createContext({});function B_(){const e=k.useContext(gp);if(!e)throw new Error("useSessionWindows must be used within SessionWindowsHost");return e}function tO(){return k.useContext(z_)}function nO(){return k.useContext(gp)}const _u=720,xp=460,sO=320,rO=200,gy=30,P_=80,I_=80,el=80,ym=28;function iO(e){const s=typeof window<"u"?window.innerWidth:1280,i=typeof window<"u"?window.innerHeight:800;let a=Number.isFinite(e.w)&&e.w>=sO?e.w:_u,h=Number.isFinite(e.h)&&e.h>=rO?e.h:xp;a=Math.min(a,s),h=Math.min(h,i);let m=Number.isFinite(e.x)?e.x:P_,f=Number.isFinite(e.y)?e.y:I_;return m=Math.max(Math.min(m,s-el),-(a-el)),f=Math.max(Math.min(f,i-ym),0),{x:m,y:f,w:a,h}}const aO=12,Vc=60;function H_(e){return`sessionGroups:${e}`}function F_(e){try{const s=localStorage.getItem(H_(e));if(!s)return null;const i=JSON.parse(s);if(Array.isArray(i==null?void 0:i.groups)&&typeof(i==null?void 0:i.zCounter)=="number")return i}catch{}return null}function wm(e,s){try{localStorage.setItem(H_(e),JSON.stringify(s))}catch{}}function oO(e,s){const i=F_(e);!i||!i.groups.some(a=>a.id===s)||(wm(e,{...i,groups:i.groups.filter(a=>a.id!==s)}),window.dispatchEvent(new CustomEvent("session-windows:changed")))}function lO(e){const s=e%8;return{x:P_+s*gy,y:I_+s*gy,w:_u,h:xp}}function Yc(e,s,i){return Math.max(s,Math.min(i,e))}function xy(){return`g_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Zr(e,s){for(const i of e)if(Iu(i.root,s))return i;return null}function cO({projectId:e,sessions:s,sendMessage:i,subscribeBinary:a,onEvent:h,onAddSession:m,children:f}){const{t:o}=it(),[c]=k.useState(()=>{const oe=F_(e);if(!oe)return{groups:[],zCounter:0};const q=oe.groups.map(K=>{const Q=dn(K.root),ie=new Set(Q),te={};for(const Re of Object.keys(K.colors||{}))ie.has(Re)&&(te[Re]=K.colors[Re]);const le={};for(const Re of Q)le[Re]={intent:"open",nonce:0},te[Re]||(te[Re]=Mi(Object.values(te)));const xe=iO({x:K.x,y:K.y,w:K.w,h:K.h}),Pe=K.ownerWindowId||Bt;return{...K,...xe,colors:te,intents:le,minimized:!!K.minimized,ownerWindowId:Pe}});return{groups:q,zCounter:oe.zCounter||q.length}}),[d,p]=k.useState(c.groups),u=k.useRef(c.zCounter),v=k.useRef(d);v.current=d;const b=k.useRef(s);b.current=s;const[C,w]=k.useState(null),x=k.useRef(null);x.current=C,k.useEffect(()=>{var q,K;const oe={};for(const Q of d)for(const ie of dn(Q.root)){const te=((q=s.find(le=>le.id===ie))==null?void 0:q.title)||((K=S.current[ie])==null?void 0:K.title);te&&(oe[ie]=te)}wm(e,{groups:d,zCounter:u.current,titles:oe}),window.dispatchEvent(new CustomEvent("session-windows:changed"))},[e,d,s]),k.useEffect(()=>()=>{var ie,te;const oe=v.current;if(oe.length===0)return;let q=!1;const K=oe.map(le=>(le.ownerWindowId||Bt)!==Bt||le.minimized?le:(q=!0,{...le,minimized:!0}));if(!q)return;const Q={};for(const le of K)for(const xe of dn(le.root)){const Pe=((ie=b.current.find(Re=>Re.id===xe))==null?void 0:ie.title)||((te=S.current[xe])==null?void 0:te.title);Pe&&(Q[xe]=Pe)}wm(e,{groups:K,zCounter:u.current,titles:Q}),window.dispatchEvent(new CustomEvent("session-windows:changed"))},[e]);const[y,_]=k.useState({}),S=k.useRef(y);S.current=y;const[N,D]=k.useState(()=>new Set),j=k.useRef(new Set);k.useEffect(()=>{if(s.length===0)return;const oe=s.filter(K=>K.project_id===e);if(oe.length===0)return;const q=new Set(oe.map(K=>K.id));for(const K of d)for(const Q of dn(K.root))q.has(Q)||y[Q]||N.has(Q)||j.current.has(Q)||(j.current.add(Q),Xw(Q).then(ie=>_(te=>({...te,[Q]:ie}))).catch(ie=>{ie instanceof Hf&&ie.status===404&&D(te=>new Set(te).add(Q))}).finally(()=>j.current.delete(Q)))},[d,s,e,y,N]),k.useEffect(()=>h(q=>{q.type!=="session:status-changed"||!q.sessionId||_(K=>{const Q=K[q.sessionId];if(!Q)return K;const ie={status:q.status};return q.worktree_path!==void 0&&(ie.worktree_path=q.worktree_path),q.branch_name!==void 0&&(ie.branch_name=q.branch_name),{...K,[Q.id]:{...Q,...ie}}})}),[h]),k.useEffect(()=>{N.size!==0&&p(oe=>{let q=!1;const K=[];for(const Q of oe){const ie=dn(Q.root);if(!ie.some(ve=>N.has(ve))){K.push(Q);continue}q=!0;const te=new Set(ie.filter(ve=>!N.has(ve))),le=$8(Q.root,te);if(!le)continue;const xe=new Set(dn(le)),Pe={};for(const ve of Object.keys(Q.colors))xe.has(ve)&&(Pe[ve]=Q.colors[ve]);const Re={};for(const ve of Object.keys(Q.intents))xe.has(ve)&&(Re[ve]=Q.intents[ve]);K.push({...Q,root:le,colors:Pe,intents:Re})}return q?K:oe})},[N]);const R=k.useCallback((oe,q)=>{const K=v.current.length,Q=lO(K);u.current+=1;const ie=u.current;return{id:xy(),...Q,z:ie,minimized:!1,root:Ai([oe],oe),colors:{[oe]:Mi([])},intents:{[oe]:{intent:q,nonce:0}},ownerWindowId:Bt}},[]),L=k.useCallback((oe,q="open")=>{p(K=>{const Q=Zr(K,oe);u.current+=1;const ie=u.current;return Q?K.map(te=>{var ve,$e,et;if(te.id!==Q.id)return te;const le=((ve=te.intents[oe])==null?void 0:ve.intent)??"open",xe=q==="start"||q==="resume",Pe=xe?q:le,Re=Pe!==le||xe;return{...te,z:ie,minimized:!1,root:Os(te.root,oe),intents:{...te.intents,[oe]:{intent:Pe,nonce:Re?((($e=te.intents[oe])==null?void 0:$e.nonce)??0)+1:((et=te.intents[oe])==null?void 0:et.nonce)??0}}}}):[...K,R(oe,q)]})},[R]),T=k.useCallback(oe=>{p(q=>{const K=Zr(q,oe);if(!K)return q;const Q=q.reduce((te,le)=>le.z>te?le.z:te,0);if(K.z===Q&&!K.minimized)return q;u.current+=1;const ie=u.current;return q.map(te=>te.id===K.id?{...te,z:ie,minimized:!1}:te)})},[]),A=k.useCallback(oe=>{const q=oe.map(K=>b.current.find(Q=>Q.id===K)||S.current[K]).filter(K=>!!K&&K.status==="running");if(q.length===0)return!0;if(!window.confirm(o("session.confirmStop")))return!1;for(const K of q)du(K.id).catch(()=>{});return!0},[o]),z=k.useCallback(oe=>{A([oe])&&p(q=>{const K=Zr(q,oe);if(!K)return q;const Q=zi(K.root,oe);if(!Q)return q.filter(le=>le.id!==K.id);new Set(dn(Q));const ie={...K.colors};delete ie[oe];const te={...K.intents};return delete te[oe],q.map(le=>le.id===K.id?{...le,root:Q,colors:ie,intents:te}:le)})},[A]),O=k.useCallback(oe=>{p(q=>{const K=Zr(q,oe);return K?q.map(Q=>Q.id===K.id?{...Q,minimized:!0}:Q):q})},[]),H=k.useCallback(oe=>{p(q=>{const K=Zr(q,oe);if(!K)return q;u.current+=1;const Q=u.current;return q.map(ie=>ie.id===K.id?{...ie,minimized:!1,z:Q}:ie)})},[]),F=k.useCallback(oe=>!!Zr(v.current,oe),[]),U=k.useCallback(oe=>{const q=v.current.find(K=>K.id===oe);q&&!A(dn(q.root))||p(K=>K.filter(Q=>Q.id!==oe))},[A]),W=k.useCallback(oe=>{p(q=>q.map(K=>K.id===oe?{...K,minimized:!0}:K))},[]);k.useEffect(()=>{const oe=K=>{const Q=K.detail;!(Q!=null&&Q.projectId)||!Q.groupId||Q.projectId===e&&p(ie=>{if(!ie.find(xe=>xe.id===Q.groupId))return ie;u.current+=1;const le=u.current;return ie.map(xe=>xe.id===Q.groupId?{...xe,minimized:!1,z:le}:xe)})},q=K=>{var le;const Q=K.detail;if(!(Q!=null&&Q.projectId)||!Q.groupId||Q.projectId!==e)return;const ie=v.current.find(xe=>xe.id===Q.groupId);if(ie&&!A(dn(ie.root)))return;const te=(ie==null?void 0:ie.ownerWindowId)||Bt;te!==Bt&&(ae.current.delete(te),re.current.delete(Q.groupId),(le=ue.current)==null||le.post({t:"group-reclaimed",popoutId:te,groupIds:[Q.groupId],reason:"late-return"})),p(xe=>xe.filter(Pe=>Pe.id!==Q.groupId))};return window.addEventListener("session-windows:restore",oe),window.addEventListener("session-windows:close",q),()=>{window.removeEventListener("session-windows:restore",oe),window.removeEventListener("session-windows:close",q)}},[e,A]),k.useEffect(()=>{const oe=sessionStorage.getItem("pendingSessionRestore");if(oe)try{const q=JSON.parse(oe);if(q.projectId!==e||!q.groupId)return;sessionStorage.removeItem("pendingSessionRestore"),p(K=>{if(!K.find(te=>te.id===q.groupId))return K;u.current+=1;const ie=u.current;return K.map(te=>te.id===q.groupId?{...te,minimized:!1,z:ie}:te)})}catch{}},[e]);const X=k.useCallback(oe=>{p(q=>{if(!q.find(ie=>ie.id===oe))return q;u.current+=1;const Q=u.current;return q.map(ie=>ie.id===oe?{...ie,minimized:!1,z:Q}:ie)})},[]),J=k.useCallback((oe,q)=>{p(K=>K.map(Q=>Q.id===oe?{...Q,...q}:Q))},[]),P=k.useCallback((oe,q,K)=>{p(Q=>Q.map(ie=>ie.id===oe?{...ie,root:R_(ie.root,q,K)}:ie))},[]),B=k.useCallback((oe,q)=>{p(K=>K.map(Q=>Q.id===oe?{...Q,root:Os(Q.root,q)}:Q))},[]),I=k.useCallback((oe,q,K)=>{p(Q=>Q.map(ie=>ie.id===oe?{...ie,root:D_(ie.root,q,K)}:ie))},[]),V=k.useCallback((oe,q,K,Q)=>{if(Q.button!==0||!v.current.find(Ee=>Ee.id===oe))return;Q.preventDefault();const te=Q.clientX,le=Q.clientY;let xe=null;w({groupId:oe,sessionId:q,fromPath:K,startX:te,startY:le,mouseX:te,mouseY:le,hoveredGroupId:null,hoveredPath:null,hoveredRect:null,zone:null});const Pe=(Ee,ot)=>{const ht=xy();xe=ht;const _t=window.innerWidth,Ht=window.innerHeight,sn={x:Yc(Ee-60,-_u+el,_t-el),y:Yc(ot-12,0,Ht-ym),w:_u,h:xp};p(ce=>{const Le=ce.find(Nt=>Nt.id===oe);if(!Le)return ce;const De=zi(Le.root,q),ye=Le.colors[q]||Mi([]),rt=Le.intents[q]??{intent:"open",nonce:0};u.current+=1;const vt=u.current,St={id:ht,...sn,z:vt,minimized:!1,root:Ai([q],q),colors:{[q]:ye},intents:{[q]:rt},ownerWindowId:Bt},jt=[];for(const Nt of ce)if(Nt.id===oe){if(De){const rn=new Set(dn(De)),Dn={};for(const yn of Object.keys(Nt.colors))rn.has(yn)&&(Dn[yn]=Nt.colors[yn]);const Pn={};for(const yn of Object.keys(Nt.intents))rn.has(yn)&&(Pn[yn]=Nt.intents[yn]);jt.push({...Nt,root:bu(De),colors:Dn,intents:Pn})}}else jt.push(Nt);return jt.push(St),jt})};let Re=!1;const ve=Ee=>{const ot=window.screenX,ht=window.screenY,_t=ot+window.outerWidth,Ht=ht+window.outerHeight;return Ee.screenX<ot-Vc||Ee.screenX>_t+Vc||Ee.screenY<ht-Vc||Ee.screenY>Ht+Vc},$e=Ee=>{if(Re)return;const ot=x.current;if(!ot)return;if(!xe)Math.hypot(Ee.clientX-te,Ee.clientY-le)>=aO&&Pe(Ee.clientX,Ee.clientY);else{const Le=window.innerWidth,De=window.innerHeight,ye=Yc(Ee.clientX-60,-640,Le-el),rt=Yc(Ee.clientY-12,0,De-ym);p(vt=>vt.map(St=>St.id===xe?{...St,x:ye,y:rt}:St))}if(xe&&ve(Ee)&&v.current.some(Le=>Le.id===xe)){const Le=Fe.current;if(Le){Re=!0;const De=xe;dt(),w(null),Le(De,{atScreenX:Ee.screenX,atScreenY:Ee.screenY});return}}let ht=null,_t=null,Ht=null,sn=null;const ce=document.elementsFromPoint(Ee.clientX,Ee.clientY);for(const Le of ce){const De=Le.closest("[data-group-id][data-stack-path]");if(!De)continue;const ye=De.dataset.groupId||"",rt=De.dataset.stackPath||"";if(xe?ye===xe:ye===ot.groupId&&rt===ot.fromPath.join("."))continue;const St=rt===""?[]:rt.split(".").map(Number),jt=De.getBoundingClientRect();ht=ye,_t=St,Ht={x:jt.left,y:jt.top,w:jt.width,h:jt.height},sn=Pu(Ee.clientX,Ee.clientY,Ht);break}w({...ot,mouseX:Ee.clientX,mouseY:Ee.clientY,hoveredGroupId:ht,hoveredPath:_t,hoveredRect:Ht,zone:sn})};let et=!1;const dt=()=>{et||(et=!0,window.removeEventListener("mousemove",$e),window.removeEventListener("mouseup",Ie),window.removeEventListener("blur",Be),window.removeEventListener("keydown",Ze),document.removeEventListener("visibilitychange",lt))},Be=()=>{dt(),w(null)},Ze=Ee=>{Ee.key==="Escape"&&Be()},lt=()=>{document.hidden&&Be()},Ie=()=>{dt();const Ee=x.current;if(w(null),!!Ee&&Ee.hoveredGroupId&&Ee.hoveredPath&&Ee.zone){const ot=xe||Ee.groupId;$(ot,Ee.sessionId,Ee.hoveredGroupId,Ee.hoveredPath,Ee.zone);return}};window.addEventListener("mousemove",$e),window.addEventListener("mouseup",Ie),window.addEventListener("blur",Be),window.addEventListener("keydown",Ze),document.addEventListener("visibilitychange",lt)},[]),$=k.useCallback((oe,q,K,Q,ie)=>{p(te=>{const le=te.find(Ze=>Ze.id===oe),xe=te.find(Ze=>Ze.id===K);if(!le||!xe)return te;if(oe===K){const Ze=Zo(le.root,Q);if(!Ze||Ze.kind!=="stack")return te;const lt=Ze.tabs.find(ht=>ht!==q);if(!lt)return te;const Ie=zi(le.root,q);if(!Ie)return te;const Ee=Iu(Ie,lt);if(!Ee)return te;let ot;return ie==="center"?ot=Oi(Ie,Ee,q):ot=Ra(Ie,Ee,ie,Ai([q])),ot=Os(ot,q),te.map(ht=>ht.id!==oe?ht:(u.current+=1,{...ht,root:ot,z:u.current,minimized:!1}))}const Pe=zi(le.root,q),Re=le.colors[q],ve=le.intents[q]??{intent:"open",nonce:0};let $e;if(ie==="center")$e=Oi(xe.root,Q,q);else{const Ze=Ai([q]);$e=Ra(xe.root,Q,ie,Ze)}$e=Os($e,q);const et={...xe.colors};et[q]||(et[q]=Re||Mi(Object.values(et)));const dt={...xe.intents,[q]:ve},Be=[];for(const Ze of te)if(Ze.id===oe){if(Pe){const lt=new Set(dn(Pe)),Ie={};for(const ot of Object.keys(Ze.colors))lt.has(ot)&&(Ie[ot]=Ze.colors[ot]);const Ee={};for(const ot of Object.keys(Ze.intents))lt.has(ot)&&(Ee[ot]=Ze.intents[ot]);Be.push({...Ze,root:Pe,colors:Ie,intents:Ee})}}else Ze.id===K?(u.current+=1,Be.push({...Ze,root:$e,colors:et,intents:dt,z:u.current,minimized:!1})):Be.push(Ze);return Be})},[]),se=k.useCallback((oe,q,K,Q)=>{p(ie=>{if(oe===q)return ie;const te=ie.find(et=>et.id===oe),le=ie.find(et=>et.id===q);if(!te||!le||te.root.kind!=="stack")return ie;const xe=te.root;let Pe;Q==="center"?Pe=xe.tabs.reduce((et,dt)=>Oi(et,K,dt),le.root):Pe=Ra(le.root,K,Q,xe),Pe=Os(Pe,xe.activeTab);const Re={...le.colors,...te.colors},ve={...le.intents,...te.intents},$e=[];for(const et of ie)et.id!==oe&&(et.id===q?(u.current+=1,$e.push({...et,root:Pe,colors:Re,intents:ve,z:u.current,minimized:!1})):$e.push(et));return $e})},[]),ue=k.useRef(null),ae=k.useRef(new Map),[ee,Y]=k.useState(null),he=k.useRef(ee);he.current=ee;const de=k.useRef(null),ke=k.useRef(typeof document<"u"&&document.hasFocus()?Date.now():0);k.useEffect(()=>{const oe=()=>{ke.current=Date.now()};window.addEventListener("focus",oe);const q=A_();return()=>{window.removeEventListener("focus",oe),q(),de.current&&clearTimeout(de.current)}},[]);const re=k.useRef(new Map),Fe=k.useRef(null),Ne=k.useCallback((oe,q)=>{var $e;const K=v.current.find(et=>et.id===oe);if(!K)return;const Q=X8(),ie={...K,ownerWindowId:Q};re.current.set(oe,ie),ae.current.set(Q,Date.now()),p(et=>et.map(dt=>dt.id===oe?{...dt,ownerWindowId:Q}:dt)),($e=ue.current)==null||$e.post({t:"group-handoff",to:Q,groupId:oe,group:ie});const te=q&&(typeof q.atScreenX=="number"||typeof q.atScreenY=="number"),le=te?Math.max(0,((q==null?void 0:q.atScreenX)??window.screenX+K.x)-40):Math.max(0,window.screenX+K.x),xe=te?Math.max(0,((q==null?void 0:q.atScreenY)??window.screenY+K.y)-12):Math.max(0,window.screenY+K.y),Pe=["popup",`width=${Math.max(400,K.w)}`,`height=${Math.max(300,K.h+40)}`,`left=${le}`,`top=${xe}`].join(","),Re=`/popout/${encodeURIComponent(e)}/${encodeURIComponent(oe)}?wid=${encodeURIComponent(Q)}`,ve=window.open(Re,"_blank",Pe);if(!ve){re.current.delete(oe),ae.current.delete(Q),p(et=>et.map(dt=>dt.id===oe?{...dt,ownerWindowId:Bt}:dt)),window.alert(o("session.popout.blocked")||"Popup blocked. Allow popups for this site to use Pop Out.");return}V8(Q,ve)},[e,o]);Fe.current=Ne;const Te=k.useCallback(oe=>{var Q;const q=v.current.find(ie=>ie.id===oe);if(!q)return;const K=q.ownerWindowId||Bt;if(K===Bt){X(oe);return}(Q=ue.current)==null||Q.post({t:"group-recall",popoutId:K,groupId:oe}),setTimeout(()=>{var le;const ie=v.current.find(xe=>xe.id===oe);if(!ie||(ie.ownerWindowId||Bt)===Bt)return;ae.current.delete(K),re.current.delete(oe),(le=ue.current)==null||le.post({t:"group-reclaimed",popoutId:K,groupIds:[oe],reason:"late-return"}),u.current+=1;const te=u.current;p(xe=>xe.map(Pe=>Pe.id===oe?{...Pe,ownerWindowId:Bt,minimized:!1,z:te}:Pe))},1500)},[X]),be=k.useCallback(oe=>{const q=Zr(v.current,oe);q&&Te(q.id)},[Te]);k.useEffect(()=>{const oe=q=>{const K=q.detail;!(K!=null&&K.projectId)||!K.groupId||K.projectId!==e||Te(K.groupId)};return window.addEventListener("session-windows:recall",oe),()=>window.removeEventListener("session-windows:recall",oe)},[e,Te]),k.useEffect(()=>{const oe=sessionStorage.getItem("pendingSessionRecall");if(oe)try{const q=JSON.parse(oe);if(q.projectId!==e||!q.groupId)return;sessionStorage.removeItem("pendingSessionRecall");const K=q.groupId;setTimeout(()=>Te(K),0)}catch{}},[e,Te]);const pe=k.useCallback(oe=>oe.kind==="stack"?[]:[0,...pe(oe.children[0])],[]),Je=k.useCallback(async(oe,q)=>{const K=new Date,Q=String(K.getHours()).padStart(2,"0"),ie=String(K.getMinutes()).padStart(2,"0"),te=String(K.getSeconds()).padStart(2,"0"),le=await Jw(e,{title:`Shell ${Q}:${ie}:${te}`,cli_tool:"raw-shell",use_worktree:!1,memory_inject_mode:"none"});m==null||m(le);const xe=oe?v.current.find($e=>$e.id===oe):null,Pe=xe&&(xe.ownerWindowId||Bt)===Bt;if(!xe||!Pe)return L(le.id,"start"),le.id;const Re=(()=>{if(q){const $e=Zo(xe.root,q);if($e&&$e.kind==="stack")return q}return pe(xe.root)})();u.current+=1;const ve=u.current;return p($e=>$e.map(et=>{if(et.id!==xe.id)return et;const dt=Os(Oi(et.root,Re,le.id),le.id);return{...et,root:dt,z:ve,minimized:!1,colors:{...et.colors,[le.id]:Mi(Object.values(et.colors))},intents:{...et.intents,[le.id]:{intent:"start",nonce:0}}}})),le.id},[e,m,L,pe]);k.useEffect(()=>{const oe=pp();ue.current=oe;const q=Q=>{var ie;if(Q.t==="hello"){const te=re.current.get(Q.groupId);if(te&&te.ownerWindowId===Q.from)oe.post({t:"group-handoff",to:Q.from,groupId:Q.groupId,group:te});else{const le=v.current.find(xe=>xe.id===Q.groupId);le&&le.ownerWindowId===Q.from&&oe.post({t:"group-handoff",to:Q.from,groupId:Q.groupId,group:le})}}else if(Q.t==="group-return"||Q.t==="bye")if(Q.t==="group-return"){const te=Q.group;te&&te.id===Q.groupId&&(re.current.delete(Q.groupId),ae.current.delete(Q.from),Q.projectId&&Q.projectId!==e&&oO(Q.projectId,Q.groupId),p(le=>{const xe=le.find(Re=>Re.id===Q.groupId),Pe={...te,ownerWindowId:Bt};return xe?le.map(Re=>Re.id===Q.groupId?Pe:Re):[...le,Pe]}))}else ae.current.delete(Q.from),p(te=>te.map(le=>le.ownerWindowId===Q.from?{...le,ownerWindowId:Bt}:le));else if(Q.t==="group-close")re.current.delete(Q.groupId),p(te=>te.filter(le=>le.id!==Q.groupId));else if(Q.t==="heartbeat")ae.current.set(Q.from,Date.now());else if(Q.t==="group-update"){const te=Q.patch;p(le=>le.map(xe=>xe.id===Q.groupId?{...xe,...te}:xe))}else if(Q.t==="dock-probe"){if(document.visibilityState!=="visible")return;const te=yu(Q.x,Q.y),le=wu(te)?vu(te.x,te.y):null;if(le){const xe=he.current;(!xe||xe.zone!==le.zone||xe.groupId!==le.groupId||xe.path.join(".")!==le.path.join("."))&&Y({rect:le.rect,zone:le.zone,path:le.path,groupId:le.groupId}),de.current&&clearTimeout(de.current),de.current=setTimeout(()=>Y(null),800),oe.post({t:"dock-probe-result",from:Bt,to:Q.from,hit:!0,focusAt:ke.current})}else he.current&&Y(null),oe.post({t:"dock-probe-result",from:Bt,to:Q.from,hit:!1,focusAt:ke.current})}else if(Q.t==="dock-end")Y(null);else if(Q.t==="dock-commit"&&Q.to===Bt){const te=yu(Q.x,Q.y),le=wu(te)?vu(te.x,te.y):null,xe=le&&le.zone?le:(ie=he.current)!=null&&ie.zone?he.current:null;let Pe=!1;const Re=v.current.filter(ve=>(ve.ownerWindowId||Bt)===Bt);if(xe&&xe.zone&&!Zr(Re,Q.sessionId)){const ve=v.current.find(et=>et.id===xe.groupId),$e=ve?Zo(ve.root,xe.path):null;if(ve&&$e&&$e.kind==="stack"){Pe=!0;const et=xe.zone,dt=xe.path;u.current+=1;const Be=u.current;p(Ze=>Ze.map(lt=>{if(lt.id!==ve.id)return lt;const Ie=et==="center"?Oi(lt.root,dt,Q.sessionId):Ra(lt.root,dt,et,Ai([Q.sessionId])),Ee=Os(Ie,Q.sessionId),ot={...lt.colors};ot[Q.sessionId]||(ot[Q.sessionId]=Q.color||Mi(Object.values(ot)));const ht={...lt.intents,[Q.sessionId]:Q.intentInfo??{intent:"open",nonce:0}};return{...lt,root:Ee,colors:ot,intents:ht,z:Be,minimized:!1}}))}}Y(null),oe.post({t:"dock-commit-ack",from:Bt,to:Q.from,sessionId:Q.sessionId,accepted:Pe})}},K=oe.subscribe(q);return()=>{K(),oe.close(),ue.current=null}},[e]),k.useEffect(()=>{const oe=Date.now();for(const q of c.groups)q.ownerWindowId&&q.ownerWindowId!==Bt&&ae.current.set(q.ownerWindowId,oe)},[]),k.useEffect(()=>{const oe=async()=>{var xe;const K=Date.now(),Q=[];for(const[Pe,Re]of ae.current.entries())K-Re>J8&&Q.push(Pe);if(Q.length===0)return;const ie=await eO(),te=Q.filter(Pe=>ie.has(Pe)?(ae.current.set(Pe,K),!1):!0);if(te.length===0)return;for(const Pe of te)ae.current.delete(Pe);const le=new Set(te);for(const Pe of v.current)Pe.ownerWindowId&&le.has(Pe.ownerWindowId)&&re.current.delete(Pe.id);for(const Pe of te){const Re=v.current.filter(ve=>ve.ownerWindowId===Pe).map(ve=>ve.id);Re.length>0&&((xe=ue.current)==null||xe.post({t:"group-reclaimed",popoutId:Pe,groupIds:Re,reason:"heartbeat-timeout"}))}p(Pe=>Pe.map(Re=>Re.ownerWindowId&&te.includes(Re.ownerWindowId)?{...Re,ownerWindowId:Bt}:Re))},q=setInterval(()=>{oe()},M_);return()=>clearInterval(q)},[]);const Ye=k.useCallback((oe,q)=>{i({type:"session:terminal-input",sessionId:oe,input:q})},[i]),ge=k.useCallback(()=>{var K,Q;const oe=v.current.filter(ie=>(ie.ownerWindowId||Bt)===Bt).slice().sort((ie,te)=>te.z-ie.z),q=[];for(const ie of oe)for(const te of dn(ie.root)){const le=((K=b.current.find(xe=>xe.id===te))==null?void 0:K.title)||((Q=S.current[te])==null?void 0:Q.title)||te;q.push({sessionId:te,label:le})}return q},[]),Ce=k.useRef(new Map),Ke=k.useCallback(async oe=>{const K=v.current.filter(ie=>!ie.minimized&&(ie.ownerWindowId||Bt)===Bt).reduce((ie,te)=>ie&&ie.z>=te.z?ie:te,null),Q=await Je((K==null?void 0:K.id)??null);Ce.current.set(Q,oe)},[Je]),qe=k.useMemo(()=>({openOrFocus:L,close:z,focus:T,minimize:O,restore:H,isOpen:F,recallPopout:be,closeGroup:U,minimizeGroup:W,restoreGroup:X,setGroupGeometry:J,setSplitSizes:P,setActiveTab:B,reorderTab:I,beginTabDrag:V,dockGroup:se,popOutGroup:Ne,createRawShellTab:Je,sendToSession:Ye,listOpenTerminals:ge,sendToNewTerminal:Ke}),[L,z,T,O,H,F,be,U,W,X,J,P,B,I,V,se,Ne,Je,Ye,ge,Ke]);k.useEffect(()=>{if(Ce.current.size!==0)for(const[oe,q]of Ce.current){const K=s.find(Q=>Q.id===oe)||y[oe];K&&(K.status==="running"?(i({type:"session:terminal-input",sessionId:oe,input:q}),Ce.current.delete(oe)):(K.status==="failed"||K.status==="stopped")&&Ce.current.delete(oe))}},[s,y,i]);const tt=k.useMemo(()=>{const oe={};for(const q of d){const Q=(q.ownerWindowId||Bt)!==Bt?"popped":q.minimized?"minimized":"floating";for(const ie of dn(q.root))oe[ie]=Q}return oe},[d]);k.useEffect(()=>{const oe=q=>{const K=/Mac|iPhone|iPad|iPod/.test(navigator.platform),Q=K?q.metaKey:q.ctrlKey,ie=K?q.ctrlKey:q.metaKey;if(!Q||ie||q.altKey||q.shiftKey||q.key.toLowerCase()!=="t")return;q.preventDefault();const le=v.current.filter(xe=>!xe.minimized&&(xe.ownerWindowId||Bt)===Bt).reduce((xe,Pe)=>xe&&xe.z>=Pe.z?xe:Pe,null);Je((le==null?void 0:le.id)??null).catch(()=>{})};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[Je]);const Oe=k.useMemo(()=>{const oe=new Map;for(const q of Object.values(y))oe.set(q.id,q);for(const q of s)oe.set(q.id,q);return oe},[s,y]),fe=d.filter(oe=>!oe.minimized&&(oe.ownerWindowId||Bt)===Bt),je=fe.reduce((oe,q)=>q.z>oe.z?{id:q.id,z:q.z}:oe,{id:null,z:-1/0}).id;return t.jsx(gp.Provider,{value:qe,children:t.jsxs(z_.Provider,{value:tt,children:[f,(()=>{const oe=new Map(fe.slice().sort((q,K)=>q.z-K.z).map((q,K)=>[q.id,K+1]));return fe.map(q=>{const K=fe.filter(Q=>Q.id!==q.id).map(({x:Q,y:ie,w:te,h:le})=>({x:Q,y:ie,w:te,h:le}));return t.jsx(q8,{group:q,sessionsById:Oe,neighbors:K,isTopmost:q.id===je,zIndex:oe.get(q.id)??1,sendMessage:i,subscribeBinary:a,onEvent:h},q.id)})})(),C&&C.hoveredRect&&t.jsx(ul,{targetRect:C.hoveredRect,activeZone:C.zone}),ee&&t.jsx(ul,{targetRect:ee.rect,activeZone:ee.zone})]})})}function uO(e){if(!e)return[];try{const s=JSON.parse(e);return Array.isArray(s)?s.map(String).filter(Boolean):[]}catch{return[]}}const dO={pending:"bg-warm-200 text-warm-600",running:"bg-status-success/10 text-status-success",completed:"bg-accent/10 text-accent",failed:"bg-status-error/10 text-status-error",stopped:"bg-amber-100 text-amber-700"},hO={floating:"bg-accent/10 text-accent",minimized:"bg-warm-200 text-warm-600",popped:"bg-violet-500/15 text-violet-500"};function fO({projectId:e,sessions:s,projectCliTool:i,isGitRepo:a,projectUseWorktree:h,projectDefaultBranch:m,onAddSession:f,onUpdateSession:o,onStopSession:c,onDeleteSession:d,onCleanupSession:p}){const{t:u}=it(),{openOrFocus:v,recallPopout:b}=B_(),C=tO(),[w,x]=k.useState(!1),[y,_]=k.useState(!1),[S,N]=k.useState(null),[D,j]=k.useState(!1),[R,L]=k.useState(null),[T,A]=k.useState([]),[z,O]=k.useState(""),[H,F]=k.useState(null);k.useEffect(()=>{let $=!1;return Hm().then(se=>{$||A(se)}).catch(()=>{}),()=>{$=!0}},[]),k.useEffect(()=>{if(!a)return;let $=!1;return jw(e).then(se=>{$||O(se.branch||"")}).catch(()=>{}),()=>{$=!0}},[e,a]);const U=k.useMemo(()=>{const $=new Map;for(const se of T)$.set(se.id,se);return $},[T]),W=k.useMemo(()=>S?s.find($=>$.id===S)??null:null,[S,s]),X=k.useMemo(()=>{if(W)return{title:W.title,description:W.description??"",cliTool:W.cli_tool??"",useWorktree:W.use_worktree===1,memoryInjectMode:W.memory_inject_mode??"none",memoryNodeIds:a8(W.memory_node_ids??null),memoryRawFilePaths:uO(W.memory_raw_file_paths??null),tagId:W.tag_id??null}},[W]),J=k.useCallback(()=>{N(null),L(null),x($=>!$)},[]),P=k.useCallback($=>{x(!1),L(null),N($)},[]),B=k.useCallback(()=>{x(!1),N(null),L(null)},[]),I=k.useCallback(async($,se,ue,ae,ee,Y,he,de)=>{_(!0);try{const ke=await Jw(e,{title:$,description:se||void 0,cli_tool:ue,use_worktree:ae,memory_inject_mode:ee,memory_node_ids:Y,memory_raw_file_paths:he,tag_id:de??null});f(ke),x(!1)}finally{_(!1)}},[e,f]),V=k.useCallback(async($,se,ue,ae,ee,Y,he,de)=>{if(S){j(!0),L(null);try{const ke=await T3(S,{title:$,description:se||void 0,cli_tool:ue,use_worktree:ae,memory_inject_mode:ee,memory_node_ids:Y,memory_raw_file_paths:he,tag_id:de??null});o(ke),N(null)}catch(ke){L(ke instanceof Error?ke.message:String(ke))}finally{j(!1)}}},[S,o]);return t.jsxs("div",{className:"space-y-4 animate-fade-in min-h-[50vh]",onContextMenu:$=>{li($)||($.preventDefault(),F({x:$.clientX,y:$.clientY,sessionId:null}))},children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-sm font-semibold text-warm-700 tracking-wide uppercase",children:u("tabs.sessions")}),t.jsxs("button",{onClick:J,className:"btn-primary text-xs py-2",disabled:y,children:["+ ",u("session.new")]})]}),w&&t.jsx(Yb,{projectId:e,onSave:I,onCancel:B,projectCliTool:i,isGitRepo:a,projectUseWorktree:h}),X&&S&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Yb,{projectId:e,initial:X,onSave:V,onCancel:B,projectCliTool:i,isGitRepo:a},S),(D||R)&&t.jsxs("div",{className:"text-xs px-1",children:[D&&t.jsx("span",{className:"text-warm-500",children:u("session.saving")||"saving…"}),R&&t.jsx("span",{className:"text-status-error",children:R})]})]}),s.length===0&&!w?t.jsx("div",{className:"card",children:t.jsx(Fi,{icon:rl,title:u("session.empty"),description:u("session.emptyHint")})}):t.jsx("div",{className:"space-y-3",children:s.map(($,se)=>{const ue=["pending","failed","stopped","completed"].includes($.status),ae=$.status==="running",ee=$.status!=="running",Y=["stopped","failed","completed"].includes($.status)&&($.cli_tool??"claude")==="claude"&&!!$.worktree_path,he=S===$.id,de=C[$.id]??"closed",ke=de==="popped";return t.jsx("div",{className:`card overflow-hidden animate-slide-up ${he?"border-l-4 border-accent bg-warm-100/30":""}`,style:{animationDelay:`${se*50}ms`},onContextMenu:re=>{li(re)||(re.preventDefault(),re.stopPropagation(),F({x:re.clientX,y:re.clientY,sessionId:$.id}))},children:t.jsx("div",{className:"p-4 cursor-pointer hover:bg-warm-50/50 transition-colors",onClick:()=>ke?b($.id):v($.id,"open"),children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[$.tag_id&&U.get($.tag_id)&&t.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-2xs font-medium",style:{backgroundColor:`${U.get($.tag_id).color}22`,color:U.get($.tag_id).color},children:[t.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:U.get($.tag_id).color}}),U.get($.tag_id).name]}),t.jsx("h3",{className:"text-sm font-semibold text-warm-700 truncate",children:$.title}),t.jsx("span",{className:`px-1.5 py-0.5 rounded text-2xs font-semibold uppercase ${dO[$.status]||""}`,children:u(`status.${$.status}`)||$.status}),de!=="closed"&&t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-2xs font-medium ${hO[de]}`,title:ke?u("session.dock.poppedHint"):void 0,children:[ke&&t.jsx(ii,{size:10}),u(`session.windowState.${de}`)]})]}),$.description&&t.jsx("p",{className:"text-xs text-warm-400 mt-1 line-clamp-1",children:$.description}),t.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[t.jsx("span",{className:"text-2xs text-warm-300",children:$.cli_tool||"claude"}),($.branch_name||a&&(z||m))&&t.jsxs("span",{className:"text-2xs text-accent/70 flex items-center gap-0.5",children:[t.jsx(Fa,{size:12}),$.branch_name||z||m]})]})]}),t.jsxs("div",{className:"flex gap-1",onClick:re=>re.stopPropagation(),children:[ke&&t.jsx("button",{onClick:()=>b($.id),className:"p-1.5 text-violet-500 hover:bg-violet-500/10 rounded transition-colors",title:u("session.recallToMain"),children:t.jsx(sl,{size:16})}),ue&&t.jsx("button",{onClick:()=>v($.id,"start"),className:"p-1.5 text-status-success hover:bg-status-success/10 rounded transition-colors",title:u("session.start"),children:t.jsx(wr,{size:16})}),Y&&t.jsx("button",{onClick:()=>v($.id,"resume"),className:"p-1.5 text-accent hover:bg-accent/10 rounded transition-colors",title:u("session.resumeHint")||u("session.resume"),children:t.jsx(oi,{size:16})}),t.jsx("button",{onClick:()=>P($.id),disabled:!ee,className:"p-1.5 text-warm-500 hover:text-warm-800 hover:bg-warm-100 rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-warm-500",title:u(ee?"session.edit":"session.editDisabledRunning"),children:t.jsx(qf,{size:16})}),ae&&t.jsx("button",{onClick:()=>c($.id),className:"p-1.5 text-amber-600 hover:bg-amber-50 rounded transition-colors",title:u("session.stop"),children:t.jsx(il,{size:16})}),$.status!=="running"&&(!!$.worktree_path||!!$.branch_name)&&t.jsx("button",{onClick:()=>{const re=$.branch_name?confirm(u("cleanup.confirmDeleteBranch").replace("{name}",$.branch_name)):!1;p($.id,re)},className:"p-1.5 text-warm-400 hover:text-amber-600 rounded transition-colors",title:u("session.cleanup"),children:t.jsx(au,{size:16})}),t.jsx("button",{onClick:()=>d($.id),className:"p-1.5 text-warm-400 hover:text-status-error rounded transition-colors",title:u("session.delete"),children:t.jsx(Nn,{size:16})})]})]})})},$.id)})}),H&&(()=>{const $=()=>F(null),se=H.sessionId?s.find(Fe=>Fe.id===H.sessionId):void 0;if(!se)return t.jsx(_r,{x:H.x,y:H.y,onClose:$,children:t.jsxs("button",{type:"button",onClick:()=>{N(null),L(null),x(!0)},className:en,children:[t.jsx(mn,{size:14}),u("session.new")]})});const ue=["pending","failed","stopped","completed"].includes(se.status),ae=se.status==="running",ee=se.status!=="running",Y=["stopped","failed","completed"].includes(se.status)&&(se.cli_tool??"claude")==="claude"&&!!se.worktree_path,he=se.status!=="running"&&(!!se.worktree_path||!!se.branch_name),de=C[se.id]??"closed",ke=de==="popped",re=u(ke?"session.recallToMain":de==="minimized"?"session.restoreWindow":de==="floating"?"session.focusWindow":"session.openWindow");return t.jsxs(_r,{x:H.x,y:H.y,onClose:$,children:[t.jsxs("button",{type:"button",onClick:()=>ke?b(se.id):v(se.id,"open"),className:en,children:[ke?t.jsx(sl,{size:14}):t.jsx(rl,{size:14}),re]}),ue&&t.jsxs("button",{type:"button",onClick:()=>v(se.id,"start"),className:en,children:[t.jsx(wr,{size:14}),u("session.start")]}),Y&&t.jsxs("button",{type:"button",onClick:()=>v(se.id,"resume"),className:en,title:u("session.resumeHint")||u("session.resume"),children:[t.jsx(oi,{size:14}),u("session.resume")]}),ee&&t.jsxs("button",{type:"button",onClick:()=>P(se.id),className:en,children:[t.jsx(qf,{size:14}),u("session.edit")]}),ae&&t.jsxs("button",{type:"button",onClick:()=>c(se.id),className:en,children:[t.jsx(il,{size:14}),u("session.stop")]}),he&&t.jsxs("button",{type:"button",onClick:()=>{const Fe=se.branch_name?confirm(u("cleanup.confirmDeleteBranch").replace("{name}",se.branch_name)):!1;p(se.id,Fe)},className:en,children:[t.jsx(au,{size:14}),u("session.cleanup")]}),t.jsx(u_,{}),t.jsxs("button",{type:"button",onClick:()=>d(se.id),className:up,children:[t.jsx(Nn,{size:14}),u("session.delete")]})]})})()]})}const Su={default:{bg:"bg-warm-200/50",text:"text-warm-500",swatch:"bg-warm-300"},gray:{bg:"bg-gray-500/20",text:"text-gray-400",swatch:"bg-gray-400"},brown:{bg:"bg-amber-800/20",text:"text-amber-600",swatch:"bg-amber-700"},orange:{bg:"bg-orange-500/20",text:"text-orange-400",swatch:"bg-orange-500"},yellow:{bg:"bg-yellow-500/20",text:"text-yellow-400",swatch:"bg-yellow-500"},green:{bg:"bg-emerald-500/20",text:"text-emerald-400",swatch:"bg-emerald-500"},blue:{bg:"bg-blue-500/20",text:"text-blue-400",swatch:"bg-blue-500"},purple:{bg:"bg-purple-500/20",text:"text-purple-400",swatch:"bg-purple-500"},pink:{bg:"bg-pink-500/20",text:"text-pink-400",swatch:"bg-pink-500"},red:{bg:"bg-red-500/20",text:"text-red-400",swatch:"bg-red-500"}},mO=Object.keys(Su);function Aa(e){const s=Su[e]||Su.default;return`${s.bg} ${s.text}`}function vp({src:e,alt:s,onClose:i}){return k.useEffect(()=>{const a=h=>{h.key==="Escape"&&i()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[i]),tn.createPortal(t.jsxs("div",{className:"fixed inset-0 z-tooltip flex items-center justify-center p-6",style:{backgroundColor:"rgba(0,0,0,0.85)"},onClick:i,children:[t.jsx("button",{type:"button",onClick:i,className:"absolute top-4 right-4 h-9 w-9 rounded-full bg-white/10 text-white flex items-center justify-center hover:bg-white/20 transition-colors","aria-label":"close",children:t.jsx(Xt,{size:18})}),t.jsx("img",{src:e,alt:s,className:"max-w-full max-h-full object-contain rounded-lg",onClick:a=>a.stopPropagation()})]}),document.body)}function _m({anchorRef:e,width:s,onClose:i,className:a,style:h,children:m}){const f=k.useRef(null),[o,c]=k.useState(null);return k.useLayoutEffect(()=>{const d=e.current;if(!d)return;const p=d.getBoundingClientRect();let u=p.left;u+s>window.innerWidth-8&&(u=Math.max(8,window.innerWidth-8-s)),u<8&&(u=8),c({top:p.bottom+4,left:u})},[e,s]),k.useEffect(()=>{const d=u=>{var b,C;const v=u.target;(b=f.current)!=null&&b.contains(v)||(C=e.current)!=null&&C.contains(v)||i()},p=()=>i();return document.addEventListener("mousedown",d),window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{document.removeEventListener("mousedown",d),window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[i,e]),o?tn.createPortal(t.jsx("div",{ref:f,className:a,style:{position:"fixed",top:o.top,left:o.left,width:s,...h},children:m}),document.body):null}const vy={pending:"bg-warm-200 text-warm-500",in_progress:"bg-blue-500/10 text-blue-600",done:"bg-emerald-500/10 text-emerald-600",moved:"bg-purple-500/10 text-purple-600"},by={0:{label:"—",style:"text-warm-300"},1:{label:"●",style:"text-warm-500"},2:{label:"●●",style:"text-amber-500"},3:{label:"●●●",style:"text-red-500"}};function pO({item:e,tagColors:s,existingTags:i,onSave:a,onDelete:h,onConvertToTodo:m,onConvertToSchedule:f,onConvertToSession:o,onUpdateTag:c}){var je,oe;const{t:d}=it(),[p,u]=k.useState(!1),[v,b]=k.useState(!1),[C,w]=k.useState(!1),x=k.useRef(null),y=k.useRef(null),[_,S]=k.useState({top:0,left:0}),[N,D]=k.useState(e.title),[j,R]=k.useState(e.description??""),[L,T]=k.useState(e.priority),[A,z]=k.useState(e.due_date??""),[O,H]=k.useState(e.status),[F,U]=k.useState(()=>{try{return e.tags?JSON.parse(e.tags):[]}catch{return[]}}),[W,X]=k.useState(""),[J,P]=k.useState(!1),[B,I]=k.useState(null),[V,$]=k.useState(null),se=k.useRef(null),ue=k.useRef(null),[ae,ee]=k.useState(()=>{try{return e.images?JSON.parse(e.images):[]}catch{return[]}}),Y=k.useRef(null);k.useEffect(()=>{D(e.title),R(e.description??""),T(e.priority),z(e.due_date??""),H(e.status);try{U(e.tags?JSON.parse(e.tags):[])}catch{U([])}try{ee(e.images?JSON.parse(e.images):[])}catch{ee([])}},[e]);const he=F,de=e.status==="moved",ke=e.due_date&&new Date(e.due_date)<new Date&&!de&&e.status!=="done",re=k.useCallback(q=>{a(e.id,q)},[e.id,a]),Fe=()=>{const q=N.trim();q&&q!==e.title?re({title:q}):D(e.title)},Ne=()=>{const q=j.trim();q!==(e.description??"")&&re({description:q||void 0})},Te=q=>{T(q),q!==e.priority&&re({priority:q})},be=q=>{z(q),q!==(e.due_date??"")&&re({due_date:q||void 0})},pe=q=>{const K=q;H(K),K!==e.status&&re({status:K})},Je=q=>{U(q);const K=(()=>{try{return e.tags?JSON.parse(e.tags):[]}catch{return[]}})();JSON.stringify(q)!==JSON.stringify(K)&&re({tags:q.length>0?JSON.stringify(q):void 0})},Ye=q=>{var Q;const K=q.trim();if(K&&!F.includes(K)&&(Je([...F,K]),!s.has(K)&&c)){const ie=["blue","green","orange","purple","pink","red","yellow","brown"],te=ie[s.size%ie.length];c(K,{color:te})}X(""),(Q=se.current)==null||Q.focus()},ge=q=>Je(F.filter(K=>K!==q)),Ce=i.filter(q=>!F.includes(q)&&(!W||q.toLowerCase().includes(W.toLowerCase()))),Ke=k.useCallback(q=>{const K=Array.from(q).filter(te=>te.type.startsWith("image/")),Q=[];let ie=0;for(const te of K){const le=new FileReader;le.onload=()=>{Q.push({name:te.name,data:le.result}),ie++,ie===K.length&&Zw(e.id,Q).then(xe=>ee(xe.images))},le.readAsDataURL(te)}},[e.id]),qe=k.useCallback(q=>{var ie;const K=(ie=q.clipboardData)==null?void 0:ie.items;if(!K)return;const Q=[];for(let te=0;te<K.length;te++)if(K[te].type.startsWith("image/")){const le=K[te].getAsFile();le&&Q.push(le)}Q.length!==0&&(q.preventDefault(),Ke(Q))},[Ke]),tt=k.useCallback(q=>{var K;q.preventDefault(),q.stopPropagation(),(K=q.dataTransfer)!=null&&K.files&&Ke(q.dataTransfer.files)},[Ke]),Oe=k.useCallback(q=>{e1(e.id,q).then(()=>{ee(K=>K.filter(Q=>Q.id!==q))})},[e.id]),fe=k.useCallback(()=>{if(!x.current)return;const q=x.current.getBoundingClientRect(),K=window.innerWidth,Q=window.innerHeight;let ie=q.bottom+4;const te=y.current;if(te){const le=te.offsetWidth,xe=te.offsetHeight;let Pe=q.right-le;Pe<8&&(Pe=8),Pe+le>K-8&&(Pe=K-8-le),ie+xe>Q-8&&(ie=q.top-xe-4),S({top:ie,left:Pe}),w(!0)}else S({top:ie,left:Math.max(8,q.right-180)})},[]);return k.useEffect(()=>{if(!p){w(!1);return}fe();const q=requestAnimationFrame(fe),K=Q=>{var te,le;const ie=Q.target;(te=x.current)!=null&&te.contains(ie)||(le=y.current)!=null&&le.contains(ie)||u(!1)};return document.addEventListener("mousedown",K),window.addEventListener("scroll",fe,!0),window.addEventListener("resize",fe),()=>{cancelAnimationFrame(q),document.removeEventListener("mousedown",K),window.removeEventListener("scroll",fe,!0),window.removeEventListener("resize",fe)}},[p,fe]),t.jsxs("div",{className:`${de?"opacity-50":""}`,style:{borderBottom:"1px solid var(--color-border-muted)"},children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 rounded-lg transition-colors hover:bg-warm-50 cursor-pointer",onDoubleClick:()=>b(!v),children:[t.jsx(Ts,{size:14,className:`text-warm-400 transition-transform duration-200 flex-shrink-0 ${v?"rotate-90":""}`,onClick:q=>{q.stopPropagation(),b(!v)}}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:"text-sm font-medium truncate block",style:{color:"var(--color-text-primary)"},children:e.title}),de&&e.converted_type&&t.jsxs("span",{className:"text-2xs text-purple-500",children:["→ ",e.converted_type==="todo"?d("planner.movedToTodo"):e.converted_type==="session"?d("planner.movedToSession"):d("planner.movedToSchedule")]}),e.source_discussion_id&&t.jsxs(zn,{to:`/projects/${e.project_id}/discussions/${e.source_discussion_id}`,onClick:q=>q.stopPropagation(),className:"inline-flex items-center gap-1 text-2xs text-accent hover:underline mt-0.5",title:d("planner.fromDiscussion"),children:[t.jsx(V5,{size:11}),d("planner.fromDiscussion")]})]}),t.jsxs("div",{className:"hidden sm:flex items-center gap-1 w-[160px] flex-shrink-0 overflow-hidden",children:[ae.length>0&&t.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-medium bg-warm-100 text-warm-500 whitespace-nowrap",children:[t.jsx(Oa,{size:10}),ae.length]}),he.map(q=>t.jsx("span",{className:`px-2 py-0.5 rounded text-2xs font-medium whitespace-nowrap ${Aa(s.get(q)||"default")}`,children:q},q))]}),t.jsx("div",{className:"hidden sm:block w-12 text-center flex-shrink-0",children:t.jsx("span",{className:`text-xs font-medium ${((je=by[e.priority])==null?void 0:je.style)??"text-warm-300"}`,children:((oe=by[e.priority])==null?void 0:oe.label)??"—"})}),t.jsx("div",{className:"hidden md:block w-20 text-right flex-shrink-0",children:e.due_date?t.jsx("span",{className:`text-xs ${ke?"text-red-500 font-medium":"text-warm-500"}`,children:new Date(e.due_date).toLocaleDateString(void 0,{month:"numeric",day:"numeric"})}):t.jsx("span",{className:"text-xs text-warm-300",children:d("planner.noDueDate")})}),t.jsx("div",{className:"w-16 flex-shrink-0",children:t.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-2xs font-semibold ${vy[e.status]||vy.pending}`,children:d(`plannerStatus.${e.status}`)})}),t.jsxs("div",{className:"w-8 flex-shrink-0",children:[t.jsx("button",{ref:x,onClick:q=>{q.stopPropagation(),u(!p)},className:"p-1.5 text-warm-400 hover:text-warm-600 hover:bg-warm-100/50 rounded-lg transition-colors",children:t.jsx(Am,{size:14})}),p&&tn.createPortal(t.jsxs("div",{ref:y,className:`fixed z-tooltip min-w-[160px] rounded-xl py-1 shadow-elevated${C?" animate-scale-in":""}`,style:{top:_.top,left:_.left,opacity:C?1:0,backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)"},onClick:()=>u(!1),children:[!de&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:m,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-warm-100 rounded-md transition-colors text-left",style:{color:"var(--color-text-primary)"},children:[t.jsx(fw,{size:12})," ",d("planner.convertToTask")]}),t.jsxs("button",{onClick:f,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-warm-100 rounded-md transition-colors text-left",style:{color:"var(--color-text-primary)"},children:[t.jsx(ri,{size:12})," ",d("planner.convertToSchedule")]}),t.jsxs("button",{onClick:o,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-warm-100 rounded-md transition-colors text-left",style:{color:"var(--color-text-primary)"},children:[t.jsx(Ba,{size:12})," ",d("planner.convertToTerminal")]})]}),t.jsxs("button",{onClick:()=>{confirm(d("planner.deleteConfirm"))&&h()},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-red-500 hover:bg-red-50 rounded-md transition-colors text-left",children:[t.jsx(Nn,{size:12})," ",d("planner.delete")]})]}),document.body)]})]}),v&&t.jsx("div",{className:"px-4 pb-3 pt-1 ml-8 animate-fade-in",children:t.jsxs("div",{className:"rounded-lg px-4 py-3 space-y-3",style:{backgroundColor:"var(--color-bg-tertiary)"},children:[t.jsx("input",{className:"bg-transparent text-sm font-medium w-full outline-none border-b border-transparent focus:border-warm-300 pb-0.5 transition-colors",style:{color:"var(--color-text-primary)"},value:N,onChange:q=>D(q.target.value),onBlur:Fe,onKeyDown:q=>{q.key==="Enter"&&(q.preventDefault(),Fe(),q.target.blur())}}),t.jsx("textarea",{className:"bg-transparent text-sm w-full outline-none border border-transparent focus:border-warm-300 rounded-md p-1 transition-colors min-h-[76px] max-h-[320px] resize-y [field-sizing:content]",style:{color:"var(--color-text-secondary)"},rows:3,placeholder:d("plannerForm.descPlaceholder"),value:j,onChange:q=>R(q.target.value),onPaste:qe,onDrop:tt,onDragOver:q=>{q.preventDefault(),q.stopPropagation()},onBlur:Ne}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[t.jsxs("button",{type:"button",onClick:()=>{var q;return(q=Y.current)==null?void 0:q.click()},className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-medium text-warm-400 hover:text-warm-600 hover:bg-warm-100 transition-colors",children:[t.jsx(Oa,{size:12}),d("plannerForm.addImage")]}),t.jsx("span",{className:"text-[10px] text-warm-300",children:d("plannerForm.pasteHint")})]}),t.jsx("input",{ref:Y,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:q=>{q.target.files&&Ke(q.target.files),q.target.value=""}}),ae.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2",children:ae.map(q=>t.jsxs("div",{className:"relative group",children:[t.jsx("img",{src:hu(e.id,q.id),alt:q.originalName,onClick:()=>$(hu(e.id,q.id)),className:"h-20 w-20 object-cover rounded-lg border border-warm-200 cursor-zoom-in"}),t.jsx("button",{type:"button",onClick:()=>Oe(q.id),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-red-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(Xt,{size:12,strokeWidth:3})}),t.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/50 rounded-b-lg px-1 py-0.5",children:t.jsx("span",{className:"text-[8px] text-white truncate block",children:q.originalName})})]},q.id))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-2xs text-warm-400 mb-1 block",children:d("plannerForm.tags")}),t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[F.map(q=>t.jsxs("div",{className:"relative",children:[t.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-2xs font-medium cursor-pointer hover:ring-1 hover:ring-warm-400 transition-all ${Aa(s.get(q)||"default")}`,onClick:K=>{ue.current=K.currentTarget,I(B===q?null:q)},children:[q,t.jsx("button",{onClick:K=>{K.stopPropagation(),ge(q)},className:"opacity-60 hover:opacity-100",children:t.jsx(Xt,{size:9})})]}),B===q&&t.jsxs(_m,{anchorRef:ue,width:180,onClose:()=>I(null),className:"p-2 rounded-lg shadow-elevated z-tooltip",style:{backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)"},children:[t.jsx("div",{className:"text-2xs text-warm-400 mb-1.5",children:d("plannerTag.color")}),t.jsx("div",{className:"grid grid-cols-5 gap-1.5",children:mO.map(K=>t.jsx("button",{onClick:async()=>{c&&await c(q,{color:K}),I(null)},className:`aspect-square rounded-md flex items-center justify-center transition-all ${s.get(q)===K?"ring-2 ring-accent ring-offset-1":"hover:scale-110"}`,title:d(`plannerTag.color.${K}`),children:t.jsx("div",{className:`w-5 h-5 rounded ${Su[K].swatch}`})},K))})]})]},q)),t.jsxs("div",{className:"relative",children:[t.jsx("input",{ref:se,className:"bg-transparent text-xs outline-none w-24",style:{color:"var(--color-text-primary)"},placeholder:"+",value:W,onChange:q=>{X(q.target.value),P(!0)},onKeyDown:q=>{(q.key==="Enter"||q.key===",")&&W.trim()&&(q.preventDefault(),Ye(W.replace(",",""))),q.key==="Backspace"&&!W&&F.length>0&&ge(F[F.length-1])},onFocus:()=>P(!0),onBlur:()=>setTimeout(()=>P(!1),150)}),J&&Ce.length>0&&t.jsx(_m,{anchorRef:se,width:160,onClose:()=>P(!1),className:"rounded-lg shadow-elevated z-tooltip py-1 max-h-32 overflow-y-auto",style:{backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)"},children:Ce.slice(0,8).map(q=>t.jsx("button",{className:"flex items-center w-full px-2 py-1 hover:bg-warm-100/50 transition-colors text-left",onMouseDown:()=>Ye(q),children:t.jsx("span",{className:`px-2 py-0.5 rounded text-2xs font-medium ${Aa(s.get(q)||"default")}`,children:q})},q))})]})]})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-2xs text-warm-400 mb-1 block",children:d("plannerForm.priority")}),t.jsxs("select",{className:"input-field text-xs w-full py-1",value:L,onChange:q=>Te(Number(q.target.value)),children:[t.jsx("option",{value:0,children:d("plannerForm.priorityLow")}),t.jsx("option",{value:1,children:d("plannerForm.priorityNormal")}),t.jsx("option",{value:2,children:d("plannerForm.priorityHigh")}),t.jsx("option",{value:3,children:d("plannerForm.priorityCritical")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-2xs text-warm-400 mb-1 block",children:d("plannerForm.dueDate")}),t.jsx("input",{type:"date",className:"input-field text-xs w-full py-1",value:A,onChange:q=>be(q.target.value)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-2xs text-warm-400 mb-1 block",children:d("plannerForm.status")}),t.jsxs("select",{className:"input-field text-xs w-full py-1",value:O,onChange:q=>pe(q.target.value),children:[t.jsx("option",{value:"pending",children:d("plannerStatus.pending")}),t.jsx("option",{value:"in_progress",children:d("plannerStatus.in_progress")}),t.jsx("option",{value:"done",children:d("plannerStatus.done")})]})]})]})]})}),V&&t.jsx(vp,{src:V,onClose:()=>$(null)})]})}let gO=0;function xO({existingTags:e,editItem:s,initialDueDate:i,onSave:a,onCancel:h,onUpdateTag:m}){const{t:f}=it(),[o,c]=k.useState(""),[d,p]=k.useState(""),[u,v]=k.useState([]),[b,C]=k.useState(""),[w,x]=k.useState(i??""),[y,_]=k.useState(0),[S,N]=k.useState("pending"),[D,j]=k.useState(!1),[R,L]=k.useState(!1),[T,A]=k.useState([]),[z,O]=k.useState([]),[H,F]=k.useState(null),U=k.useRef(null),W=k.useRef(null),X=k.useRef(null),[J,P]=k.useState(new Map),B=new Map([...e.map(re=>[re.name,re.color]),...J]),I=["blue","green","orange","purple","pink","red","yellow","brown"];k.useEffect(()=>{var re;if(s){c(s.title),p(s.description??""),v(s.tags?JSON.parse(s.tags):[]),x(s.due_date??""),_(s.priority),N(s.status);try{O(s.images?JSON.parse(s.images):[])}catch{O([])}}(re=U.current)==null||re.focus()},[s]);const V=e.filter(re=>!u.includes(re.name)&&(!b||re.name.toLowerCase().includes(b.toLowerCase()))),$=re=>{var Ne;const Fe=re.trim();Fe&&!u.includes(Fe)&&v(Te=>{const be=[...Te,Fe];if(!B.has(Fe)){const pe=I[B.size%I.length];P(Je=>new Map([...Je,[Fe,pe]]))}return be}),C(""),L(!0),(Ne=W.current)==null||Ne.focus()},se=re=>v(u.filter(Fe=>Fe!==re)),ue=k.useCallback(re=>{const Fe=Array.from(re).filter(Ne=>Ne.type.startsWith("image/"));for(const Ne of Fe){const Te=new FileReader;Te.onload=()=>{const be=Te.result,pe=`pending-${++gO}`;A(Je=>[...Je,{id:pe,name:Ne.name,data:be,preview:be}])},Te.readAsDataURL(Ne)}},[]),ae=k.useCallback(re=>{var Te;const Fe=(Te=re.clipboardData)==null?void 0:Te.items;if(!Fe)return;const Ne=[];for(let be=0;be<Fe.length;be++)if(Fe[be].type.startsWith("image/")){const pe=Fe[be].getAsFile();pe&&Ne.push(pe)}Ne.length!==0&&(re.preventDefault(),ue(Ne))},[ue]),ee=k.useCallback(re=>{var Fe;re.preventDefault(),re.stopPropagation(),(Fe=re.dataTransfer)!=null&&Fe.files&&ue(re.dataTransfer.files)},[ue]),Y=re=>A(Fe=>Fe.filter(Ne=>Ne.id!==re)),he=re=>{s&&e1(s.id,re),O(Fe=>Fe.filter(Ne=>Ne.id!==re))},de=z.length+T.length,ke=async()=>{if(o.trim()){j(!0);try{const re=await a({title:o.trim(),description:d.trim()||void 0,tags:u.length>0?JSON.stringify(u):void 0,due_date:w||void 0,priority:y,...s?{status:S}:{}});if(m&&J.size>0&&await Promise.all([...J.entries()].map(([Fe,Ne])=>m(Fe,{color:Ne}))),T.length>0){const Fe=(s==null?void 0:s.id)??(re==null?void 0:re.id);Fe&&await Zw(Fe,T.map(Ne=>({name:Ne.name,data:Ne.data})))}}finally{j(!1)}}};return t.jsxs("div",{className:"card p-5 animate-slide-up",style:{borderColor:"var(--color-accent)",borderWidth:"1px"},children:[t.jsx("input",{ref:U,className:"input-field text-sm w-full mb-3",placeholder:f("plannerForm.titlePlaceholder"),value:o,onChange:re=>c(re.target.value),onKeyDown:re=>{re.key==="Enter"&&re.preventDefault()}}),t.jsx("textarea",{className:"prompt-field text-sm w-full mb-3 min-h-[76px] max-h-[320px] resize-y [field-sizing:content]",rows:3,placeholder:f("plannerForm.descPlaceholder"),value:d,onChange:re=>p(re.target.value),onPaste:ae,onDrop:ee,onDragOver:re=>{re.preventDefault(),re.stopPropagation()}}),t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsxs("button",{type:"button",onClick:()=>{var re;return(re=X.current)==null?void 0:re.click()},className:"inline-flex items-center gap-1 px-2 py-1 rounded text-[10px] font-medium text-warm-400 hover:text-warm-600 hover:bg-warm-100 transition-colors",children:[t.jsx(Oa,{size:14}),f("plannerForm.addImage")]}),t.jsx("span",{className:"text-[10px] text-warm-300",children:f("plannerForm.pasteHint")})]}),t.jsx("input",{ref:X,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:re=>{re.target.files&&ue(re.target.files),re.target.value=""}}),de>0&&t.jsxs("div",{className:"mb-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx("h4",{className:"text-xs font-semibold text-warm-500 uppercase tracking-wider",children:f("plannerForm.images")}),t.jsxs("span",{className:"text-[10px] text-warm-400",children:["(",de,")"]})]}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[z.map(re=>t.jsxs("div",{className:"relative group",children:[t.jsx("img",{src:s?hu(s.id,re.id):"",alt:re.originalName,onClick:()=>s&&F(hu(s.id,re.id)),className:"h-20 w-20 object-cover rounded-lg border border-warm-200 cursor-zoom-in"}),t.jsx("button",{type:"button",onClick:()=>he(re.id),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-red-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(Xt,{size:12,strokeWidth:3})}),t.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/50 rounded-b-lg px-1 py-0.5",children:t.jsx("span",{className:"text-[8px] text-white truncate block",children:re.originalName})})]},re.id)),T.map(re=>t.jsxs("div",{className:"relative group",children:[t.jsx("img",{src:re.preview,alt:re.name,onClick:()=>F(re.preview),className:"h-20 w-20 object-cover rounded-lg border border-blue-300/30 cursor-zoom-in"}),t.jsx("button",{type:"button",onClick:()=>Y(re.id),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-red-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(Xt,{size:12,strokeWidth:3})}),t.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/50 rounded-b-lg px-1 py-0.5",children:t.jsx("span",{className:"text-[8px] text-white truncate block",children:re.name})})]},re.id))]})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:f("plannerForm.tags")}),t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-2 rounded-xl",style:{backgroundColor:"var(--color-bg-input)",border:"1px solid var(--color-border-strong)"},children:[u.map(re=>t.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-[11px] font-medium ${Aa(B.get(re)||"default")}`,children:[re,t.jsx("button",{onClick:()=>se(re),className:"opacity-60 hover:opacity-100",children:t.jsx(Xt,{size:10})})]},re)),t.jsxs("div",{className:"relative flex-1 min-w-[120px]",children:[t.jsx("input",{ref:W,className:"bg-transparent text-sm outline-none w-full",style:{color:"var(--color-text-primary)"},placeholder:u.length===0?f("plannerForm.tagsPlaceholder"):"",value:b,onChange:re=>{C(re.target.value),L(!0)},onKeyDown:re=>{(re.key==="Enter"||re.key===",")&&b.trim()&&(re.preventDefault(),$(b.replace(",",""))),re.key==="Backspace"&&!b&&u.length>0&&se(u[u.length-1])},onFocus:()=>L(!0),onBlur:()=>setTimeout(()=>L(!1),150)}),R&&(V.length>0||b.trim())&&t.jsxs(_m,{anchorRef:W,width:208,onClose:()=>L(!1),className:"rounded-lg shadow-elevated z-tooltip py-1.5 max-h-48 overflow-y-auto",style:{backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)"},children:[V.slice(0,10).map(re=>t.jsx("button",{className:"flex items-center w-full px-2.5 py-1 hover:bg-warm-100/50 transition-colors text-left",onMouseDown:()=>$(re.name),children:t.jsx("span",{className:`px-2 py-0.5 rounded text-[11px] font-medium ${Aa(re.color)}`,children:re.name})},re.name)),b.trim()&&!e.some(re=>re.name===b.trim())&&t.jsx("button",{className:"flex items-center w-full px-2.5 py-1 hover:bg-warm-100/50 transition-colors text-left",onMouseDown:()=>$(b),children:t.jsxs("span",{className:"text-xs text-warm-500",children:['+ "',b.trim(),'"']})})]})]})]})]}),t.jsxs("div",{className:`grid gap-3 mb-4 ${s?"grid-cols-3":"grid-cols-2"}`,children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:f("plannerForm.dueDate")}),t.jsx("input",{type:"date",className:"input-field text-xs w-full",value:w,onChange:re=>x(re.target.value)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:f("plannerForm.priority")}),t.jsxs("select",{className:"input-field text-xs w-full",value:y,onChange:re=>_(Number(re.target.value)),children:[t.jsx("option",{value:0,children:f("plannerForm.priorityLow")}),t.jsx("option",{value:1,children:f("plannerForm.priorityNormal")}),t.jsx("option",{value:2,children:f("plannerForm.priorityHigh")}),t.jsx("option",{value:3,children:f("plannerForm.priorityCritical")})]})]}),s&&t.jsxs("div",{children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:f("plannerForm.status")}),t.jsxs("select",{className:"input-field text-xs w-full",value:S,onChange:re=>N(re.target.value),children:[t.jsx("option",{value:"pending",children:f("plannerStatus.pending")}),t.jsx("option",{value:"in_progress",children:f("plannerStatus.in_progress")}),t.jsx("option",{value:"done",children:f("plannerStatus.done")})]})]})]}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsx("button",{className:"btn-ghost text-xs",onClick:h,children:f("plannerForm.cancel")}),t.jsx("button",{className:"btn-primary text-xs py-2",onClick:ke,disabled:!o.trim()||D,children:f("plannerForm.save")})]}),H&&t.jsx(vp,{src:H,onClose:()=>F(null)})]})}function $_({item:e,mode:s,projectCliTool:i,onConvert:a,onClose:h}){const{t:m}=it(),[f,o]=k.useState(i||"claude"),[c,d]=k.useState(""),[p,u]=k.useState(!1),[v,b]=k.useState("once"),[C,w]=k.useState("0 0 * * *"),[x,y]=k.useState(""),[_,S]=k.useState(!1),N=async()=>{S(!0);try{s==="todo"?await a({cli_tool:f,max_turns:c?Number(c):void 0}):s==="session"?await a({cli_tool:f,use_worktree:p}):await a({cli_tool:f,schedule_type:v,cron_expression:v==="recurring"?C:void 0,run_at:v==="once"?x:void 0})}finally{S(!1)}};return t.jsx(Fn,{open:!0,onClose:h,size:"md",position:"top",animation:"slide-up",children:t.jsxs("div",{className:"card p-6",children:[t.jsx("h3",{className:"text-sm font-semibold mb-4",style:{color:"var(--color-text-primary)"},children:m(s==="todo"?"plannerConvert.toTask":s==="session"?"plannerConvert.toTerminal":"plannerConvert.toSchedule")}),t.jsxs("p",{className:"text-xs text-warm-500 mb-4 truncate",children:['"',e.title,'"']}),t.jsxs("div",{className:"mb-3",children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:m("plannerConvert.cliTool")}),t.jsxs("select",{className:"input-field text-xs w-full",value:f,onChange:D=>o(D.target.value),children:[t.jsx("option",{value:"claude",children:"Claude"}),t.jsx("option",{value:"antigravity",children:"Antigravity"}),t.jsx("option",{value:"codex",children:"Codex"})]})]}),s==="todo"&&t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:m("plannerConvert.maxTurns")}),t.jsx("input",{type:"number",min:"1",className:"input-field text-xs w-full",placeholder:"—",value:c,onChange:D=>d(D.target.value)})]}),s==="session"&&t.jsxs("label",{className:"flex items-center gap-2 mb-4 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:p,onChange:D=>u(D.target.checked)}),t.jsx("span",{className:"text-xs font-medium text-warm-500",children:m("plannerConvert.useWorktree")})]}),s==="schedule"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-3",children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:m("plannerConvert.scheduleType")}),t.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{backgroundColor:"var(--color-bg-tertiary)"},children:[t.jsx("button",{className:`flex-1 px-3 py-1.5 rounded-md text-xs font-medium transition-all ${v==="once"?"bg-amber-500 text-white":"text-warm-500"}`,onClick:()=>b("once"),children:m("plannerConvert.once")}),t.jsx("button",{className:`flex-1 px-3 py-1.5 rounded-md text-xs font-medium transition-all ${v==="recurring"?"bg-amber-500 text-white":"text-warm-500"}`,onClick:()=>b("recurring"),children:m("plannerConvert.recurring")})]})]}),v==="once"?t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:m("plannerConvert.runAt")}),t.jsx("input",{type:"datetime-local",className:"input-field text-xs w-full",value:x,onChange:D=>y(D.target.value)})]}):t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"text-xs font-medium text-warm-500 mb-1.5 block",children:m("plannerConvert.cronExpression")}),t.jsx("input",{className:"input-field text-xs w-full font-mono",value:C,onChange:D=>w(D.target.value),placeholder:"0 0 * * *"})]})]}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsx("button",{className:"btn-ghost text-xs",onClick:h,children:m("plannerConvert.cancel")}),t.jsx("button",{className:"btn-primary btn-sm",onClick:N,disabled:_||s==="schedule"&&v==="once"&&!x,children:m("plannerConvert.convert")})]})]})})}function hn(e){const s=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${s}-${i}-${a}`}function yy(e){return hn(new Date(e))}function wy(e){return new Date(e.getFullYear(),e.getMonth(),1)}function U_(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function xr(e,s){const i=U_(e);return i.setDate(i.getDate()+s),i}function W_(e){return xr(e,-e.getDay())}function vO(e,s){if(e==="day"){const m=U_(s);return{rangeStart:hn(m),rangeEnd:hn(xr(m,1)),gridDays:[m],cols:1,dimOutOfMonth:!1}}if(e==="week"){const m=W_(s),f=Array.from({length:7},(o,c)=>xr(m,c));return{rangeStart:hn(m),rangeEnd:hn(xr(m,7)),gridDays:f,cols:7,dimOutOfMonth:!1}}if(e==="table"){const m=wy(s),f=new Date(s.getFullYear(),s.getMonth()+1,1);return{rangeStart:hn(m),rangeEnd:hn(f),gridDays:[],cols:7,dimOutOfMonth:!1}}const i=wy(s),a=xr(i,-i.getDay()),h=Array.from({length:42},(m,f)=>xr(a,f));return{rangeStart:hn(a),rangeEnd:hn(xr(a,42)),gridDays:h,cols:7,dimOutOfMonth:!0}}function G_(e,s){return k.useMemo(()=>vO(e,s),[e,s])}function q_(e,s,i){const a=new Date(e);return s==="month"||s==="table"?a.setMonth(a.getMonth()+i):s==="week"?a.setDate(a.getDate()+7*i):a.setDate(a.getDate()+i),a}function K_(e,s){if(s==="month"||s==="table")return e.toLocaleDateString(void 0,{year:"numeric",month:"long"});if(s==="week"){const i=W_(e);return`${i.toLocaleDateString(void 0,{month:"short",day:"numeric"})} – ${xr(i,6).toLocaleDateString(void 0,{month:"short",day:"numeric"})}`}return e.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric",weekday:"short"})}function V_(){return k.useMemo(()=>{const e=new Date(2024,5,2);return Array.from({length:7},(s,i)=>xr(e,i).toLocaleDateString(void 0,{weekday:"short"}))},[])}const bO=420,yO=140,wO=220,_O=26,Mf=16,_y=2;function SO(e,s){if(!s.length)return{placed:[],laneCount:0};const i=hn(e[0]),a=hn(e[e.length-1]),h=s.filter(o=>o.startKey<=a&&o.endKey>=i).map(o=>{const c=o.startKey<i?i:o.startKey,d=o.endKey>a?a:o.endKey;return{bar:o,startCol:e.findIndex(p=>hn(p)===c),endCol:e.findIndex(p=>hn(p)===d),contStart:o.startKey<i,contEnd:o.endKey>a}}).filter(o=>o.startCol>=0&&o.endCol>=0).sort((o,c)=>o.startCol-c.startCol||c.endCol-c.startCol-(o.endCol-o.startCol)),m=[];return{placed:h.map(o=>{let c=0;for(;c<m.length&&m[c]>=o.startCol;)c++;return m[c]=o.endCol,{...o,lane:c}}),laneCount:m.length}}function Y_({view:e,gridDays:s,cols:i,dimOutOfMonth:a,monthIdx:h,todayKey:m,selectedDate:f,chipsByDay:o,maxChips:c,weekdayLabels:d,addItemLabel:p,bars:u,onBarClick:v,onSelectDate:b,onQuickAdd:C,onChipClick:w,onCellContextMenu:x,onChipContextMenu:y,onBarContextMenu:_,monthCellHeight:S=92}){const[N,D]=k.useState(null),[j,R]=k.useState(!1),L=k.useRef(null),T=k.useRef(null),A=()=>{T.current&&(clearTimeout(T.current),T.current=null)},z=(W,X)=>{A(),L.current&&clearTimeout(L.current);const J=X.getBoundingClientRect();L.current=window.setTimeout(()=>D({key:W,rect:J}),bO)},O=()=>{L.current&&(clearTimeout(L.current),L.current=null),T.current=window.setTimeout(()=>D(null),yO)};k.useEffect(()=>{if(!N){R(!1);return}const W=requestAnimationFrame(()=>R(!0));return()=>cancelAnimationFrame(W)},[N]),k.useEffect(()=>()=>{L.current&&clearTimeout(L.current),T.current&&clearTimeout(T.current)},[]),k.useEffect(()=>{if(!N)return;const W=()=>D(null);return window.addEventListener("scroll",W,!0),window.addEventListener("resize",W),()=>{window.removeEventListener("scroll",W,!0),window.removeEventListener("resize",W)}},[N]);const H=N?o.get(N.key)??[]:[],F=(W,X)=>{const J=hn(W),P=o.get(J)??[],B=!a||W.getMonth()===h,I=J===m,V=J===f,$=e==="week"?"min-h-[360px]":e==="day"?"min-h-[480px]":"",se=e==="month"&&P.length>c;return t.jsxs("div",{onClick:()=>b(J),onContextMenu:x?ue=>x(J,ue):void 0,onMouseEnter:se?ue=>z(J,ue.currentTarget):void 0,onMouseLeave:se?O:void 0,className:`group relative ${$} text-left p-1.5 flex flex-col gap-1 transition-colors cursor-pointer`,style:{minHeight:e==="month"?S+X:void 0,backgroundColor:V?"var(--color-bg-hover)":"var(--color-bg-card)",opacity:B?1:.45},children:[t.jsxs("span",{className:"flex items-center gap-1.5",children:[e!=="month"&&t.jsx("span",{className:"text-2xs uppercase",style:{color:"var(--color-text-muted)"},children:W.toLocaleDateString(void 0,{weekday:"short"})}),t.jsx("span",{className:"text-xs font-medium w-5 h-5 flex items-center justify-center rounded-full",style:I?{backgroundColor:"var(--color-accent)",color:"#fff"}:{color:"var(--color-text-secondary)"},children:W.getDate()})]}),t.jsx("button",{onClick:ue=>{ue.stopPropagation(),C(J)},className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity rounded-md w-5 h-5 flex items-center justify-center hover:bg-theme-hover",title:p,style:{backgroundColor:"var(--color-bg-secondary)",color:"var(--color-text-secondary)",border:"1px solid var(--color-border)"},children:t.jsx(mn,{size:13})}),t.jsxs("div",{className:"flex flex-col gap-0.5 overflow-hidden",style:{marginTop:X||void 0},children:[P.slice(0,c).map(ue=>t.jsxs("span",{onClick:ae=>{ae.stopPropagation(),w(ue)},onContextMenu:y?ae=>y(ue,ae):void 0,className:"text-2xs truncate px-1 py-0.5 rounded cursor-pointer hover:opacity-80 transition-opacity",style:{backgroundColor:ue.bg,color:ue.fg,textDecoration:ue.done?"line-through":"none"},title:ue.title,children:[ue.prefix??"",ue.time?`${ue.time} `:"",ue.title]},ue.key)),P.length>c&&t.jsxs("span",{className:"text-2xs px-1",style:{color:"var(--color-text-muted)"},children:["+",P.length-c]})]})]},J)},U=[];if(e==="month")for(let W=0;W<s.length;W+=i)U.push(s.slice(W,W+i));return t.jsxs(t.Fragment,{children:[(e==="month"||e==="week")&&t.jsx("div",{className:"grid gap-px text-2xs uppercase tracking-wider mb-1",style:{gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`,color:"var(--color-text-muted)"},children:d.map(W=>t.jsx("div",{className:"px-2 py-1",children:W},W))}),e==="month"?t.jsx("div",{className:"flex flex-col gap-px rounded-xl overflow-hidden",style:{backgroundColor:"var(--color-border)"},children:U.map((W,X)=>{const{placed:J,laneCount:P}=SO(W,u??[]),B=P*(Mf+_y);return t.jsxs("div",{className:"relative grid gap-px",style:{gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`,backgroundColor:"var(--color-border)"},children:[W.map(I=>F(I,B)),J.map(({bar:I,startCol:V,endCol:$,lane:se,contStart:ue,contEnd:ae})=>t.jsxs("div",{onClick:ee=>{ee.stopPropagation(),v==null||v(I)},onContextMenu:_?ee=>_(I,ee):void 0,className:"absolute text-2xs truncate px-1.5 cursor-pointer hover:opacity-80 transition-opacity flex items-center",style:{left:`calc(${V} / ${i} * 100% + 2px)`,width:`calc(${$-V+1} / ${i} * 100% - 4px)`,top:_O+se*(Mf+_y),height:Mf,backgroundColor:I.bg,color:I.fg,textDecoration:I.done?"line-through":"none",borderRadius:4,borderTopLeftRadius:ue?0:4,borderBottomLeftRadius:ue?0:4,borderTopRightRadius:ae?0:4,borderBottomRightRadius:ae?0:4},title:I.title,children:[ue?"◀ ":"",I.title,ae?" ▶":""]},I.key))]},X)})}):t.jsx("div",{className:"grid gap-px rounded-xl overflow-hidden",style:{gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`,backgroundColor:"var(--color-border)"},children:s.map(W=>F(W,0))}),N&&(()=>{const W=Math.max(N.rect.width,wO),X=Math.min(Math.max(8,N.rect.left),window.innerWidth-W-8),J=Math.max(8,Math.min(N.rect.top,window.innerHeight-120)),P=window.innerHeight-J-16,B=Number(N.key.slice(8,10));return tn.createPortal(t.jsxs("div",{className:"z-tooltip rounded-lg shadow-elevated",onMouseEnter:A,onMouseLeave:()=>D(null),style:{position:"fixed",left:X,top:J,width:W,maxHeight:P,overflowY:"auto",backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)",padding:6,transformOrigin:"top left",transform:j?"scale(1)":"scale(0.96)",opacity:j?1:0,transition:"transform 140ms ease, opacity 140ms ease"},children:[t.jsx("div",{className:"text-xs font-semibold px-1 pb-1",style:{color:"var(--color-text-secondary)"},children:B}),t.jsx("div",{className:"flex flex-col gap-0.5",children:H.map(I=>t.jsxs("span",{onClick:V=>{V.stopPropagation(),w(I),D(null)},onContextMenu:y?V=>y(I,V):void 0,className:"text-2xs truncate px-1 py-0.5 rounded cursor-pointer hover:opacity-80 transition-opacity",style:{backgroundColor:I.bg,color:I.fg,textDecoration:I.done?"line-through":"none"},title:I.title,children:[I.prefix??"",I.time?`${I.time} `:"",I.title]},I.key))})]}),document.body)})()]})}const Sy={pending:"bg-warm-200 text-warm-500",in_progress:"bg-blue-500/10 text-blue-600",done:"bg-emerald-500/10 text-emerald-600",moved:"bg-purple-500/10 text-purple-600"};function kO(e){if(!e)return[];try{const s=JSON.parse(e);return Array.isArray(s)?s.filter(i=>typeof i=="string"):[]}catch{return[]}}function CO({view:e,items:s,tagColors:i,onQuickAdd:a,onEditItem:h,onConvert:m,onDeleteItem:f}){const{t:o}=it(),[c,d]=k.useState(()=>new Date),[p,u]=k.useState(()=>hn(new Date)),[v,b]=k.useState(null),C=V_(),{gridDays:w,cols:x,dimOutOfMonth:y}=G_(e,c),_=hn(new Date),S=c.getMonth(),N=e==="month"?3:99,D=X=>d(J=>q_(J,e,X)),j=()=>{d(new Date),u(hn(new Date))},R=K_(c,e);k.useEffect(()=>{e==="day"&&u(hn(c))},[e,c]);const L=260,T=760,A=k.useRef(null),[z,O]=k.useState(()=>{const X=parseInt(localStorage.getItem("plannerCalendarPanelWidth")||"",10);return Number.isFinite(X)&&X>=L&&X<=T?X:320});k.useEffect(()=>{try{localStorage.setItem("plannerCalendarPanelWidth",String(z))}catch{}},[z]);const H=X=>{X.preventDefault();const J=B=>{var V;const I=(V=A.current)==null?void 0:V.getBoundingClientRect();I&&O(Math.min(T,Math.max(L,I.right-B.clientX)))},P=()=>{window.removeEventListener("pointermove",J),window.removeEventListener("pointerup",P),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",J),window.addEventListener("pointerup",P)},F=k.useMemo(()=>{const X=new Map;for(const J of s){if(!J.due_date)continue;const P=J.due_date.slice(0,10),B=J.status==="done",I=X.get(P)??[];I.push({key:J.id,title:J.title,bg:"var(--color-bg-secondary)",fg:B?"var(--color-text-muted)":"var(--color-text-secondary)",done:B,payload:J}),X.set(P,I)}return X},[s]),U=k.useMemo(()=>s.filter(X=>X.due_date&&X.due_date.slice(0,10)===p),[s,p]),W=k.useMemo(()=>s.filter(X=>!X.due_date),[s]);return t.jsxs("div",{ref:A,className:"card flex overflow-hidden",style:{minHeight:520},children:[t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[t.jsxs("div",{className:"px-4 pt-3 pb-2 flex items-center gap-2",children:[t.jsx("button",{onClick:()=>D(-1),className:"btn-ghost p-1.5","aria-label":"prev",children:t.jsx(Rm,{size:16})}),t.jsx("div",{className:"text-sm font-semibold min-w-[8rem] text-center",style:{color:"var(--color-text-primary)"},children:R}),t.jsx("button",{onClick:()=>D(1),className:"btn-ghost p-1.5","aria-label":"next",children:t.jsx(Ts,{size:16})}),t.jsx("button",{onClick:j,className:"btn-ghost text-xs px-2.5 py-1.5",children:o("agenda.today")})]}),t.jsx("div",{className:"flex-1 overflow-auto px-4 pb-4",children:t.jsx(Y_,{view:e,gridDays:w,cols:x,dimOutOfMonth:y,monthIdx:S,todayKey:_,selectedDate:p,chipsByDay:F,maxChips:N,weekdayLabels:C,addItemLabel:o("agenda.addItem"),onSelectDate:u,onQuickAdd:a,onChipClick:X=>h(X.payload),onCellContextMenu:(X,J)=>{J.preventDefault(),b({x:J.clientX,y:J.clientY,dateKey:X})}})})]}),t.jsx("div",{onPointerDown:H,className:"w-1.5 flex-shrink-0 cursor-col-resize hover:bg-accent/40 transition-colors",style:{backgroundColor:"var(--color-border)"},title:o("agenda.resizePanel")}),t.jsxs("div",{className:"flex-shrink-0 flex flex-col overflow-hidden",style:{width:z},children:[t.jsxs("div",{className:"px-4 pt-3 pb-2 flex items-center justify-between",children:[t.jsx("h3",{className:"text-sm font-semibold",style:{color:"var(--color-text-primary)"},children:new Date(p+"T00:00").toLocaleDateString(void 0,{month:"long",day:"numeric",weekday:"short"})}),t.jsxs("button",{onClick:()=>a(p),className:"btn-ghost text-xs px-2 py-1 flex items-center gap-1",children:[t.jsx(mn,{size:13}),o("agenda.add")]})]}),t.jsxs("div",{className:"flex-1 overflow-auto px-4 pb-4 flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[U.length===0&&t.jsx("p",{className:"text-xs py-2",style:{color:"var(--color-text-muted)"},children:o("agenda.dayEmpty")}),U.map(X=>t.jsx(ky,{item:X,tagColors:i,onEdit:h,onConvert:m,onDelete:f},X.id))]}),t.jsxs("div",{children:[t.jsx("h4",{className:"text-2xs uppercase tracking-wider mb-1.5",style:{color:"var(--color-text-muted)"},children:o("agenda.backlog")}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[W.length===0&&t.jsx("p",{className:"text-xs py-1",style:{color:"var(--color-text-muted)"},children:o("agenda.backlogEmpty")}),W.map(X=>t.jsx(ky,{item:X,tagColors:i,onEdit:h,onConvert:m,onDelete:f},X.id))]})]})]})]}),v&&t.jsx(_r,{x:v.x,y:v.y,onClose:()=>b(null),children:t.jsxs("button",{type:"button",className:en,onClick:()=>a(v.dateKey),children:[t.jsx(mn,{size:14}),o("planner.add")]})})]})}function ky({item:e,tagColors:s,onEdit:i,onConvert:a,onDelete:h}){const{t:m}=it(),[f,o]=k.useState(!1),[c,d]=k.useState(!1),[p,u]=k.useState({top:0,left:0}),v=k.useRef(null),b=k.useRef(null),C=kO(e.tags),w=e.status==="moved",x=k.useCallback(()=>{if(!v.current)return;const y=v.current.getBoundingClientRect(),_=window.innerWidth,S=window.innerHeight;let N=y.bottom+4;const D=b.current;if(D){const j=D.offsetWidth,R=D.offsetHeight;let L=y.right-j;L<8&&(L=8),L+j>_-8&&(L=_-8-j),N+R>S-8&&(N=y.top-R-4),u({top:N,left:L}),d(!0)}else u({top:N,left:Math.max(8,y.right-180)})},[]);return k.useEffect(()=>{if(!f){d(!1);return}x();const y=requestAnimationFrame(x),_=S=>{var D,j;const N=S.target;(D=v.current)!=null&&D.contains(N)||(j=b.current)!=null&&j.contains(N)||o(!1)};return document.addEventListener("mousedown",_),window.addEventListener("scroll",x,!0),window.addEventListener("resize",x),()=>{cancelAnimationFrame(y),document.removeEventListener("mousedown",_),window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x)}},[f,x]),t.jsxs("div",{className:`group flex items-start gap-2 rounded-lg px-2.5 py-2 ${w?"opacity-50":""}`,style:{backgroundColor:"var(--color-bg-secondary)"},children:[t.jsxs("button",{onClick:()=>i(e),className:"flex-1 text-left min-w-0",children:[t.jsx("div",{className:"text-sm truncate",style:{color:"var(--color-text-primary)",textDecoration:e.status==="done"?"line-through":"none"},children:e.title}),e.description&&t.jsx("div",{className:"text-2xs truncate",style:{color:"var(--color-text-muted)"},children:e.description}),t.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[t.jsx("span",{className:`px-1.5 py-0.5 rounded-full text-2xs font-medium ${Sy[e.status]||Sy.pending}`,children:m(`plannerStatus.${e.status}`)}),C.map(y=>t.jsx("span",{className:`px-1.5 py-0.5 rounded text-2xs font-medium ${Aa(s.get(y)||"default")}`,children:y},y))]})]}),t.jsxs("div",{className:"flex-shrink-0",children:[t.jsx("button",{ref:v,onClick:y=>{y.stopPropagation(),o(!f)},className:"p-1 text-warm-400 hover:text-warm-600 hover:bg-warm-100/50 rounded-lg transition-colors opacity-0 group-hover:opacity-100",children:t.jsx(Am,{size:14})}),f&&tn.createPortal(t.jsxs("div",{ref:b,className:`fixed z-tooltip min-w-[160px] rounded-xl py-1 shadow-elevated${c?" animate-scale-in":""}`,style:{top:p.top,left:p.left,opacity:c?1:0,backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)"},onClick:()=>o(!1),children:[!w&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:()=>a(e,"todo"),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-warm-100 rounded-md transition-colors text-left",style:{color:"var(--color-text-primary)"},children:[t.jsx(fw,{size:12})," ",m("planner.convertToTask")]}),t.jsxs("button",{onClick:()=>a(e,"schedule"),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-warm-100 rounded-md transition-colors text-left",style:{color:"var(--color-text-primary)"},children:[t.jsx(ri,{size:12})," ",m("planner.convertToSchedule")]}),t.jsxs("button",{onClick:()=>a(e,"session"),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-warm-100 rounded-md transition-colors text-left",style:{color:"var(--color-text-primary)"},children:[t.jsx(Ba,{size:12})," ",m("planner.convertToTerminal")]})]}),t.jsxs("button",{onClick:()=>{confirm(m("planner.deleteConfirm"))&&h(e.id)},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-red-500 hover:bg-red-50 rounded-md transition-colors text-left",children:[t.jsx(Nn,{size:12})," ",m("planner.delete")]})]}),document.body)]})]})}const Cy={pending:0,in_progress:1,done:2,moved:3};function jO({plannerItems:e,existingTags:s,projectCliTool:i,onAddItem:a,onEditItem:h,onDeleteItem:m,onConvertToTodo:f,onConvertToSchedule:o,onConvertToSession:c,onUpdateTag:d,onDeleteTag:p,onExport:u,onImport:v,view:b,onChangeView:C}){const{t:w}=it(),[x,y]=k.useState(!1),[_,S]=k.useState(null),[N,D]=k.useState(void 0),[j,R]=k.useState(""),[L,T]=k.useState(""),[A,z]=k.useState("created_at"),[O,H]=k.useState("desc"),[F,U]=k.useState(null),[W,X]=k.useState("todo"),[J,P]=k.useState(!1),[B,I]=k.useState(!1),[V,$]=k.useState(null),se=k.useRef(null),ue=k.useRef(0),ae=async()=>{if(!(!u||J)){P(!0);try{await u()}finally{P(!1)}}},ee=()=>{var ge;!v||J||(ge=se.current)==null||ge.click()},Y=async ge=>{var Ke;const Ce=(Ke=ge.target.files)==null?void 0:Ke[0];if(ge.target.value="",!(!Ce||!v)){P(!0);try{await v(Ce)}finally{P(!1)}}},he=ge=>!!(/\.(md|markdown)$/i.test(ge.name)||ge.type==="text/markdown"),de=ge=>Array.from(ge.dataTransfer.types).includes("Files"),ke=ge=>{!v||J||de(ge)&&(ge.preventDefault(),ue.current++,I(!0))},re=ge=>{!v||J||de(ge)&&(ge.preventDefault(),ge.dataTransfer.dropEffect="copy")},Fe=ge=>{v&&(ge.preventDefault(),ue.current=Math.max(0,ue.current-1),ue.current===0&&I(!1))},Ne=async ge=>{var Ke;if(!v||(ge.preventDefault(),ue.current=0,I(!1),J))return;const Ce=(Ke=ge.dataTransfer.files)==null?void 0:Ke[0];if(Ce){if(!he(Ce)){window.alert(w("planner.dropInvalidFile"));return}P(!0);try{await v(Ce)}finally{P(!1)}}},Te=k.useMemo(()=>s.map(ge=>ge.name),[s]),be=k.useMemo(()=>new Map(s.map(ge=>[ge.name,ge.color])),[s]),pe=k.useMemo(()=>{let ge=e.filter(Ce=>!(L&&Ce.status!==L||j&&!(Ce.tags?(()=>{try{return JSON.parse(Ce.tags)}catch{return[]}})():[]).includes(j)));return ge=[...ge].sort((Ce,Ke)=>{let qe=0;switch(A){case"title":qe=Ce.title.localeCompare(Ke.title);break;case"tags":{const tt=Ce.tags?(()=>{try{return JSON.parse(Ce.tags).join(",")}catch{return""}})():"",Oe=Ke.tags?(()=>{try{return JSON.parse(Ke.tags).join(",")}catch{return""}})():"";qe=(tt||"zzz").localeCompare(Oe||"zzz");break}case"priority":qe=Ce.priority-Ke.priority;break;case"due_date":{const tt=Ce.due_date||"9999",Oe=Ke.due_date||"9999";qe=tt.localeCompare(Oe);break}case"status":qe=(Cy[Ce.status]??9)-(Cy[Ke.status]??9);break;case"created_at":qe=Ce.created_at.localeCompare(Ke.created_at);break}return O==="asc"?qe:-qe}),ge},[e,j,L,A,O]),Je=ge=>{A===ge?H(Ce=>Ce==="asc"?"desc":"asc"):(z(ge),H(ge==="priority"?"desc":"asc"))},Ye=({field:ge})=>A!==ge?null:O==="asc"?t.jsx(mj,{size:10,className:"inline ml-0.5"}):t.jsx(cj,{size:10,className:"inline ml-0.5"});return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-5 gap-3 flex-wrap",children:[t.jsxs("h2",{className:"text-sm font-semibold text-warm-600 uppercase tracking-wider",children:[w("planner.title"),t.jsx("span",{className:"ml-1 text-warm-400",children:e.length})]}),t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b!=="table"&&t.jsx("div",{className:"flex gap-0.5 p-0.5 rounded-lg shrink-0",style:{backgroundColor:"var(--color-bg-tertiary)"},children:["month","week","day"].map(ge=>t.jsx("button",{onClick:()=>C(ge),className:"px-2.5 py-1 text-xs rounded-md transition-all",style:b===ge?{backgroundColor:"var(--color-bg-card)",color:"var(--color-text-primary)",fontWeight:600}:{color:"var(--color-text-tertiary)"},children:w(`agenda.view.${ge}`)},ge))}),t.jsxs("select",{className:"input-field text-xs py-1.5 px-2 w-auto max-w-[10rem] shrink",value:j,onChange:ge=>R(ge.target.value),children:[t.jsx("option",{value:"",children:w("planner.filterTag")}),Te.map(ge=>t.jsx("option",{value:ge,children:ge},ge))]}),t.jsxs("select",{className:"input-field text-xs py-1.5 px-2 w-auto max-w-[10rem] shrink",value:L,onChange:ge=>T(ge.target.value),children:[t.jsx("option",{value:"",children:w("planner.filterStatus")}),t.jsx("option",{value:"pending",children:w("plannerStatus.pending")}),t.jsx("option",{value:"in_progress",children:w("plannerStatus.in_progress")}),t.jsx("option",{value:"done",children:w("plannerStatus.done")}),t.jsx("option",{value:"moved",children:w("plannerStatus.moved")})]}),u&&t.jsxs("button",{onClick:ae,disabled:J||e.length===0,className:"btn-secondary text-xs py-2 whitespace-nowrap shrink-0 disabled:opacity-50",title:w("planner.exportTooltip"),children:[t.jsx(Wf,{size:14,className:"inline-block shrink-0"}),w("planner.export")]}),v&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:ee,disabled:J,className:"btn-secondary text-xs py-2 whitespace-nowrap shrink-0 disabled:opacity-50",title:w("planner.importTooltip"),children:[t.jsx(jv,{size:14,className:"inline-block shrink-0"}),w("planner.import")]}),t.jsx("input",{ref:se,type:"file",accept:".md,.markdown,text/markdown",className:"hidden",onChange:Y})]}),!x&&!_&&t.jsxs("button",{onClick:()=>y(!0),className:"btn-primary text-xs py-2 whitespace-nowrap shrink-0",children:[t.jsx(mn,{size:14,className:"inline-block shrink-0"}),w("planner.add")]})]})]}),(x||_)&&t.jsx("div",{className:"mb-5",children:t.jsx(xO,{existingTags:s,editItem:_,initialDueDate:N,onSave:async ge=>{if(_){await h(_.id,ge),S(null);return}else{const Ce=await a(ge);return y(!1),D(void 0),Ce}},onCancel:()=>{y(!1),S(null),D(void 0)},onUpdateTag:d})}),b==="table"?t.jsxs("div",{className:"card relative",onDragEnter:v?ke:void 0,onDragOver:v?re:void 0,onDragLeave:v?Fe:void 0,onDrop:v?Ne:void 0,onContextMenu:ge=>{li(ge)||(ge.preventDefault(),$({x:ge.clientX,y:ge.clientY}))},children:[B&&t.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center pointer-events-none rounded-xl border-2 border-dashed",style:{borderColor:"var(--color-accent, #3b82f6)",backgroundColor:"var(--color-bg-secondary, rgba(59, 130, 246, 0.08))",backdropFilter:"blur(2px)"},children:t.jsxs("div",{className:"text-center",children:[t.jsx(jv,{size:32,className:"inline-block mb-2",style:{color:"var(--color-accent, #3b82f6)"}}),t.jsx("div",{className:"text-sm font-semibold",children:w("planner.dropHint")}),t.jsx("div",{className:"text-xs text-warm-500 mt-1",children:w("planner.dropHintSub")})]})}),t.jsxs("div",{className:"hidden sm:flex items-center gap-3 px-4 py-2 rounded-t-xl select-none",style:{backgroundColor:"var(--color-bg-tertiary)",borderBottom:"1px solid var(--color-border-muted)"},children:[t.jsx("div",{className:"w-[14px] flex-shrink-0"}),t.jsxs("div",{className:"flex-1 text-2xs font-semibold text-warm-500 uppercase tracking-wider cursor-pointer hover:text-warm-700 transition-colors",onClick:()=>Je("title"),children:[w("planner.col.title"),t.jsx(Ye,{field:"title"})]}),t.jsxs("div",{className:"w-[160px] text-2xs font-semibold text-warm-500 uppercase tracking-wider cursor-pointer hover:text-warm-700 transition-colors",onClick:()=>Je("tags"),children:[w("planner.col.tags"),t.jsx(Ye,{field:"tags"})]}),t.jsxs("div",{className:"w-12 text-center text-2xs font-semibold text-warm-500 uppercase tracking-wider cursor-pointer hover:text-warm-700 transition-colors",onClick:()=>Je("priority"),children:[w("plannerForm.priority"),t.jsx(Ye,{field:"priority"})]}),t.jsxs("div",{className:"hidden md:block w-20 text-right text-2xs font-semibold text-warm-500 uppercase tracking-wider cursor-pointer hover:text-warm-700 transition-colors",onClick:()=>Je("due_date"),children:[w("planner.col.dueDate"),t.jsx(Ye,{field:"due_date"})]}),t.jsxs("div",{className:"w-16 text-2xs font-semibold text-warm-500 uppercase tracking-wider cursor-pointer hover:text-warm-700 transition-colors",onClick:()=>Je("status"),children:[w("planner.col.status"),t.jsx(Ye,{field:"status"})]}),t.jsx("div",{className:"w-8"})]}),pe.length===0?t.jsx(Fi,{icon:z5,title:w("planner.empty"),description:w("planner.emptyHint")}):pe.map((ge,Ce)=>t.jsx("div",{className:"animate-slide-up",style:{animationDelay:`${Ce*20}ms`},children:t.jsx(pO,{item:ge,tagColors:be,existingTags:Te,onSave:async(Ke,qe)=>{await h(Ke,qe)},onDelete:()=>m(ge.id),onConvertToTodo:()=>{U(ge),X("todo")},onConvertToSchedule:()=>{U(ge),X("schedule")},onConvertToSession:()=>{U(ge),X("session")},onUpdateTag:d})},ge.id))]}):t.jsx(CO,{view:b,items:pe,tagColors:be,onQuickAdd:ge=>{S(null),D(ge),y(!0)},onEditItem:ge=>{y(!1),S(ge)},onConvert:(ge,Ce)=>{U(ge),X(Ce)},onDeleteItem:m}),F&&t.jsx($_,{item:F,mode:W,projectCliTool:i,onConvert:async ge=>{W==="todo"?await f(F.id,ge):W==="session"?await c(F.id,ge):await o(F.id,ge),U(null)},onClose:()=>U(null)}),V&&t.jsx(_r,{x:V.x,y:V.y,onClose:()=>$(null),children:t.jsxs("button",{type:"button",className:en,onClick:()=>{S(null),D(void 0),y(!0)},children:[t.jsx(mn,{size:14}),w("planner.add")]})})]})}const X_=k.createContext(null),NO=X_.Provider;function EB(){const e=k.useContext(X_);if(!e)throw new Error("usePlannerPage must be used within a PlannerPageProvider");return e}const EO=k.lazy(()=>Du(()=>import("./PlannerPageEditor-DxKNSTFQ.js").then(e=>e.a),__vite__mapDeps([5,3,6,7,8]))),TO=800;function LO({pageId:e,projectId:s,projectCliTool:i,existingTags:a,onTitleChange:h,onConvertToTodo:m,onConvertToSchedule:f,onConvertToSession:o}){const{t:c}=it(),[d,p]=k.useState(null),[u,v]=k.useState("idle"),[b,C]=k.useState(null),w=k.useRef({title:"",content:null}),x=k.useRef(null);k.useEffect(()=>{let j=!1;return W3(e).then(R=>{j||(p(R),w.current={title:R.title,content:R.content??null})}),()=>{j=!0}},[e]);const y=k.useCallback(()=>{x.current&&(clearTimeout(x.current),x.current=null);const{title:j,content:R}=w.current;return v("saving"),G3(e,{title:j,content:R??void 0}).then(()=>v("saved"))},[e]);k.useEffect(()=>()=>{x.current&&y()},[y]);const _=k.useCallback(()=>{x.current&&clearTimeout(x.current),v("saving"),x.current=setTimeout(()=>{y()},TO)},[y]),S=j=>{w.current.title=j,p(R=>R&&{...R,title:j}),h(e,j),_()},N=j=>{w.current.content=j,_()},D=k.useCallback((j,R,L)=>{C({item:j,mode:R,onDone:L})},[]);return d?t.jsxs(NO,{value:{projectId:s,pageId:e,projectCliTool:i,existingTags:a,openConvert:D},children:[t.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[t.jsxs("div",{className:"flex items-center gap-3 px-6 pt-5 pb-2",children:[t.jsx("input",{value:d.title,onChange:j=>S(j.target.value),placeholder:c("planner.pages.untitled"),className:"flex-1 bg-transparent text-2xl font-bold outline-none",style:{color:"var(--color-text-primary)"}}),t.jsx("span",{className:"text-2xs text-warm-400 flex-shrink-0",children:u==="saving"?c("planner.pages.saving"):u==="saved"?c("planner.pages.saved"):""})]}),t.jsx("div",{className:"flex-1 overflow-y-auto pb-6",children:t.jsx(k.Suspense,{fallback:null,children:t.jsx(EO,{initialContent:d.content??null,onChange:N})})})]}),b&&t.jsx($_,{item:b.item,mode:b.mode,projectCliTool:i,onConvert:async j=>{const{item:R,mode:L,onDone:T}=b;L==="todo"?await m(R.id,j):L==="session"?await o(R.id,j):await f(R.id,j),T==null||T(),C(null)},onClose:()=>C(null)})]}):null}const Cn=(e,s)=>({type:"heading",props:{level:e},content:s}),Uo=e=>e?{type:"paragraph",content:e}:{type:"paragraph"},jy=e=>({type:"bulletListItem"}),Ri=e=>({type:"checkListItem"}),Ny=()=>({type:"tasklist"}),Ey=()=>({type:"calendar"}),DO=[{id:"blank",labelKey:"planner.tpl.blank",descKey:"planner.tpl.blank.desc",title:"",blocks:null},{id:"meeting",labelKey:"planner.tpl.meeting",descKey:"planner.tpl.meeting.desc",title:"회의 노트",blocks:[Cn(1,"회의 노트"),Uo("📅 날짜: "),Uo("👥 참석자: "),Cn(2,"안건"),jy(),Cn(2,"논의"),Uo(),Cn(2,"액션 아이템"),Ny()]},{id:"project",labelKey:"planner.tpl.project",descKey:"planner.tpl.project.desc",title:"프로젝트 플랜",blocks:[Cn(1,"프로젝트 플랜"),Cn(2,"개요"),Uo(),Cn(2,"마일스톤"),Ny(),Cn(2,"일정"),Ey(),Cn(2,"리스크 / 메모"),Uo()]},{id:"weekly",labelKey:"planner.tpl.weekly",descKey:"planner.tpl.weekly.desc",title:"위클리 플래너",blocks:[Cn(1,"위클리 플래너"),Cn(2,"이번 주 목표"),jy(),Cn(2,"요일별 할 일"),Cn(3,"월요일"),Ri(),Cn(3,"화요일"),Ri(),Cn(3,"수요일"),Ri(),Cn(3,"목요일"),Ri(),Cn(3,"금요일"),Ri(),Cn(3,"토요일"),Ri(),Cn(3,"일요일"),Ri(),Cn(2,"주간 일정"),Ey()]}];function RO({onResize:e}){return t.jsx("div",{role:"separator","aria-orientation":"vertical",onPointerDown:s=>{s.preventDefault();const i=s.currentTarget;i.setPointerCapture(s.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none";const a=m=>e(m.clientX),h=()=>{document.body.style.cursor="",document.body.style.userSelect="",i.removeEventListener("pointermove",a),i.removeEventListener("pointerup",h),i.removeEventListener("pointercancel",h)};i.addEventListener("pointermove",a),i.addEventListener("pointerup",h),i.addEventListener("pointercancel",h)},className:"w-1.5 shrink-0 cursor-col-resize bg-warm-300 hover:bg-accent active:bg-accent transition-colors"})}const Ty=160,Ly=480,Dy="plannerSidebarWidth";function MO({projectId:e,...s}){const{t:i}=it(),[a,h]=k.useState([]),[m,f]=k.useState({kind:"work"}),[o,c]=k.useState("table"),[d,p]=k.useState(!1),[u,v]=k.useState({top:0,left:0}),b=k.useRef(null),C=k.useRef(null),w=k.useRef(!1),[x,y]=k.useState(()=>{const F=Number(localStorage.getItem(Dy));return F>=Ty&&F<=Ly?F:208}),_=k.useCallback(F=>{var X;const U=((X=C.current)==null?void 0:X.getBoundingClientRect().left)??0,W=Math.round(Math.max(Ty,Math.min(Ly,F-U)));y(W),localStorage.setItem(Dy,String(W))},[]),S=240,N=()=>{var U;const F=(U=b.current)==null?void 0:U.getBoundingClientRect();if(F){const W=Math.min(F.left,window.innerWidth-S-8);v({top:F.bottom+4,left:Math.max(8,W)})}p(!0)};k.useEffect(()=>{if(!d)return;const F=()=>p(!1),U=W=>{var X;(X=b.current)!=null&&X.contains(W.target)||W.target.closest("[data-template-picker]")||p(!1)};return document.addEventListener("mousedown",U),window.addEventListener("scroll",F,!0),window.addEventListener("resize",F),()=>{document.removeEventListener("mousedown",U),window.removeEventListener("scroll",F,!0),window.removeEventListener("resize",F)}},[d]),k.useEffect(()=>{$3(e).then(F=>{h(F),w.current||(w.current=!0,F.length>0&&f({kind:"page",id:F[0].id}))})},[e]);const D=async F=>{p(!1);const U=await U3(e,F.title||i("planner.pages.untitled"),F.blocks?JSON.stringify(F.blocks):void 0);h(W=>[...W,U]),f({kind:"page",id:U.id})},j=async F=>{confirm(i("planner.pages.deleteConfirm"))&&(await q3(F),h(U=>U.filter(W=>W.id!==F)),f(U=>U.kind==="page"&&U.id===F?{kind:"work"}:U))},R=k.useCallback((F,U)=>{h(W=>W.map(X=>X.id===F?{...X,title:U}:X))},[]),L=()=>{f({kind:"work"}),c(F=>F==="table"?"month":F)},T=()=>{f({kind:"work"}),c("table")},A=m.kind==="work",z=A&&o!=="table",O=A&&o==="table",H=(F,U,W,X,J)=>t.jsxs("div",{onClick:U,className:`group flex items-center gap-2 px-2.5 py-1.5 rounded-lg cursor-pointer transition-colors ${F?"":"hover:bg-warm-50"}`,style:F?{backgroundColor:"var(--color-bg-tertiary)"}:void 0,children:[W,t.jsx("span",{className:"flex-1 text-sm truncate",style:{color:"var(--color-text-primary)"},children:X}),J]});return t.jsxs("div",{className:"flex gap-4",style:{minHeight:"70vh"},children:[t.jsxs("div",{ref:C,className:"flex-shrink-0 flex flex-col card p-2 overflow-y-auto",style:{width:x},children:[t.jsxs("div",{className:"flex items-center justify-between px-2.5 pt-1 pb-1",children:[t.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-warm-400",children:i("planner.view.pages")}),t.jsx("button",{ref:b,onClick:()=>d?p(!1):N(),className:"text-warm-400 hover:text-warm-600 transition-colors",title:i("planner.pages.new"),children:t.jsx(mn,{size:14})})]}),a.map(F=>H(m.kind==="page"&&m.id===F.id,()=>f({kind:"page",id:F.id}),t.jsx(Bi,{size:13,className:"text-warm-400 flex-shrink-0"}),F.title||i("planner.pages.untitled"),t.jsx("button",{onClick:U=>{U.stopPropagation(),j(F.id)},className:"opacity-0 group-hover:opacity-100 text-warm-400 hover:text-red-500 transition-all flex-shrink-0",children:t.jsx(Nn,{size:13})}))),t.jsx("div",{className:"px-2.5 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-warm-400",children:i("planner.view.all")}),H(z,L,t.jsx(Uf,{size:14,className:"text-warm-400 flex-shrink-0"}),i("planner.nav.calendar")),H(O,T,t.jsx(lu,{size:14,className:"text-warm-400 flex-shrink-0"}),i("planner.nav.list"))]}),t.jsx(RO,{onResize:_}),t.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:m.kind==="page"?t.jsx("div",{className:"card flex flex-col flex-1",children:t.jsx(LO,{pageId:m.id,projectId:e,projectCliTool:s.projectCliTool,existingTags:s.existingTags,onTitleChange:R,onConvertToTodo:s.onConvertToTodo,onConvertToSchedule:s.onConvertToSchedule,onConvertToSession:s.onConvertToSession},m.id)}):t.jsx(jO,{...s,view:o,onChangeView:c})}),d&&tn.createPortal(t.jsx("div",{"data-template-picker":!0,className:"fixed z-tooltip rounded-xl py-1 shadow-elevated animate-scale-in",style:{top:u.top,left:u.left,width:S,backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)"},children:DO.map(F=>t.jsxs("button",{onClick:()=>D(F),className:"w-full text-left px-3 py-2 hover:bg-warm-100 transition-colors",children:[t.jsx("div",{className:"text-sm font-medium",style:{color:"var(--color-text-primary)"},children:i(F.labelKey)}),t.jsx("div",{className:"text-2xs text-warm-400 mt-0.5",children:i(F.descKey)})]},F.id))}),document.body)]})}const AO=k.lazy(()=>Du(()=>import("./AnalyticsPanel-C_WpyKmO.js"),__vite__mapDeps([9,7,3,2]))),OO=k.lazy(()=>Du(()=>import("./VaultLayout-BxQnUzVI.js"),__vite__mapDeps([10,6,1,2,3,4])));function zO({onEvent:e,connected:s,sendMessage:i,subscribeBinary:a}){const{id:h}=jm(),[m,f]=k.useState(null),[o,c]=k.useState([]),[d,p]=k.useState([]),[u,v]=k.useState(null),[b,C]=k.useState([]),[w,x]=k.useState([]),[y,_]=k.useState([]),[S,N]=k.useState([]),[D,j]=uw(),R=["tasks","discussions","schedules","analytics"],L=D.get("tab")||"tasks",[T,A]=k.useState(R.includes(L)?"automation":L),[z,O]=k.useState(R.includes(L)?L:"tasks"),H=k.useCallback(ce=>{if(ce==="automation"){A("automation"),j(z==="tasks"?{}:{tab:z},{replace:!0});return}A(ce),j(ce==="tasks"?{}:{tab:ce},{replace:!0})},[j,z]),F=k.useCallback(ce=>{A("automation"),O(ce),j(ce==="tasks"?{}:{tab:ce},{replace:!0})},[j]),[U,W]=k.useState(!0),[X,J]=k.useState(!1),[P,B]=k.useState(new Set),[I,V]=k.useState(0),{t:$}=it(),{sendNotification:se}=Im(),ue=k.useRef([]);k.useEffect(()=>{ue.current=b},[b]),k.useEffect(()=>{h&&Promise.all([FN(h),nf(h),$v(h),Uv(h),f3(),Yw(h),Oc(h),zc(h)]).then(([ce,Le,De,ye,rt,vt,St,jt])=>{f(ce),c(Le),p(De),C(ye),x(vt),_(St),N(jt),rt.resetsAt&&v(rt.resetsAt);const Nt=Le.filter(rn=>rn.status==="running"&&rn.execution_mode==="interactive").map(rn=>rn.id);Nt.length>0&&B(new Set(Nt))}).catch(()=>J(!0)).finally(()=>W(!1))},[h]);const ae=k.useRef(o);ae.current=o,k.useEffect(()=>{if(!h)return;const ce=setInterval(()=>{ae.current.some(De=>De.status==="running")&&nf(h).then(De=>{c(ye=>ye.map(rt=>{const vt=De.find(St=>St.id===rt.id);return vt&&vt.status!==rt.status?vt:rt}))}).catch(()=>{})},5e3);return()=>clearInterval(ce)},[h]);const ee=k.useRef(s);k.useEffect(()=>{s&&!ee.current&&h&&Promise.all([nf(h),$v(h),Uv(h)]).then(([ce,Le,De])=>{c(ce),p(Le),C(De)}).catch(()=>{}),ee.current=s},[s,h]),k.useEffect(()=>e(ce=>{if(ce.type==="todo:status-changed"&&ce.todoId&&ce.status){if(c(Le=>Le.map(De=>{if(De.id!==ce.todoId)return De;const ye={status:ce.status,updated_at:new Date().toISOString()};return ce.worktree_path!==void 0&&(ye.worktree_path=ce.worktree_path??null),ce.branch_name!==void 0&&(ye.branch_name=ce.branch_name??null),{...De,...ye}})),(ce.status==="completed"||ce.status==="merged"||ce.status==="failed")&&V(Le=>Le+1),ce.status==="completed"||ce.status==="failed"){const Le=ae.current.find(De=>De.id===ce.todoId);Le&&se(ce.status==="completed"?$("notification.taskCompleted"):$("notification.taskFailed"),Le.title)}ce.status==="running"&&ce.mode==="interactive"?B(Le=>new Set(Le).add(ce.todoId)):ce.status!=="running"&&B(Le=>{const De=new Set(Le);return De.delete(ce.todoId),De})}if(ce.type==="schedule:status-changed"&&ce.scheduleId&&p(Le=>Le.map(De=>De.id===ce.scheduleId?{...De,is_active:ce.isActive?1:0,updated_at:new Date().toISOString()}:De)),ce.type==="rate-limit:updated"&&ce.resetsAt&&v(ce.resetsAt),ce.type==="discussion:status-changed"&&ce.discussionId&&(C(Le=>Le.map(De=>De.id===ce.discussionId?{...De,status:ce.status,current_round:ce.currentRound??De.current_round,updated_at:new Date().toISOString()}:De)),ce.status==="completed"||ce.status==="failed")){const Le=ue.current.find(De=>De.id===ce.discussionId);Le&&se(ce.status==="completed"?$("notification.discussionCompleted"):$("notification.discussionFailed"),Le.title)}ce.type==="session:status-changed"&&ce.sessionId&&x(Le=>Le.map(De=>{if(De.id!==ce.sessionId)return De;const ye={status:ce.status,updated_at:new Date().toISOString()};return ce.worktree_path!==void 0&&(ye.worktree_path=ce.worktree_path),ce.branch_name!==void 0&&(ye.branch_name=ce.branch_name),{...De,...ye}}))}),[e,se,$]);const Y=k.useCallback(async(ce,Le,De,ye,rt,vt,St,jt,Nt,rn)=>{if(!h)return;const Dn=await sf(h,{title:ce,description:Le,cli_tool:De,depends_on:rt,max_turns:vt??null,use_worktree:St??null,...jt?{memory_inject_mode:jt}:{},...Nt?{memory_node_ids:Nt}:{},...rn?{memory_raw_file_paths:rn}:{}});if(ye&&ye.length>0){const Pn=await Gw(Dn.id,ye.map(yn=>({name:yn.name,data:yn.data})));Dn.images=JSON.stringify(Pn.images)}c(Pn=>[...Pn,Dn])},[h]),he=k.useCallback((ce,Le=[])=>{const De=ce.split("/").filter(Boolean).pop()??ce,ye=[ce,...Le].map(rt=>`@${rt}`).join(`
|
|
650
650
|
`);return Y(De,`다음 파일을 참고하세요:
|
|
651
651
|
${ye}`)},[Y]),de=k.useCallback(async(ce,Le)=>{const De=Le==="interactive";De&&B(ye=>new Set(ye).add(ce));try{const ye=await Fv(ce,Le);c(rt=>rt.map(vt=>vt.id===ce?ye:vt))}catch(ye){throw De&&B(rt=>{const vt=new Set(rt);return vt.delete(ce),vt}),ye}},[]),ke=k.useCallback(async ce=>{const Le=await e3(ce);c(De=>De.map(ye=>ye.id===ce?Le:ye))},[]),re=k.useCallback(async ce=>{await Hw(ce),c(Le=>Le.filter(De=>De.id!==ce))},[]),Fe=k.useCallback(async(ce,Le,De,ye,rt,vt,St,jt,Nt,rn)=>{const Dn=await Ac(ce,{title:Le,description:De,cli_tool:ye,depends_on:rt??null,max_turns:vt??null,use_worktree:St===void 0?null:St,...jt?{memory_inject_mode:jt}:{},...Nt?{memory_node_ids:Nt}:{},...rn?{memory_raw_file_paths:rn}:{}});c(Pn=>Pn.map(yn=>yn.id===ce?Dn:yn))},[]),Ne=k.useCallback(async ce=>{await $w(ce),c(Le=>Le.map(De=>De.id===ce?{...De,status:"merged",worktree_path:null,branch_name:null,updated_at:new Date().toISOString()}:De))},[]),Te=k.useCallback(async ce=>{const Le=await s3(ce),De=new Set(Le.mergedIds);c(ye=>ye.map(rt=>De.has(rt.id)?{...rt,status:"merged",worktree_path:null,branch_name:null,updated_at:new Date().toISOString()}:rt))},[]),be=k.useCallback(async(ce,Le=!1)=>{await Uw(ce,Le),c(De=>De.map(ye=>ye.id===ce?{...ye,worktree_path:null,...Le?{branch_name:null}:{},updated_at:new Date().toISOString()}:ye))},[]),pe=k.useCallback(async(ce,Le)=>{const De=Le==="interactive";De&&B(ye=>new Set(ye).add(ce));try{const ye=await r3(ce,Le);c(rt=>rt.map(vt=>vt.id===ce?ye:vt))}catch(ye){throw De&&B(rt=>{const vt=new Set(rt);return vt.delete(ce),vt}),ye}},[]),Je=k.useCallback(async(ce,Le,De)=>{const ye=De==="interactive";ye&&B(rt=>new Set(rt).add(ce));try{const rt=await Ww(ce,Le,De);c(vt=>vt.map(St=>St.id===ce?rt:St))}catch(rt){throw ye&&B(vt=>{const St=new Set(vt);return St.delete(ce),St}),rt}},[]),Ye=k.useCallback(async(ce,Le,De)=>{const ye=await l3(ce,Le,De);ye.original_deleted&&c(rt=>rt.filter(vt=>vt.id!==ce)),p(rt=>[ye.schedule,...rt])},[]),ge=k.useCallback(async(ce,Le)=>{const De=await m3(ce,Le);p(ye=>[De.schedule,...ye])},[]),Ce=k.useCallback((ce,Le)=>{i({type:"todo:stdin",todoId:ce,input:Le})},[i]),Ke=k.useCallback(async(ce,Le)=>{const De=await Ac(ce,{depends_on:Le});c(ye=>ye.map(rt=>rt.id===ce?De:rt))},[]),qe=k.useCallback(async ce=>{const Le=ce.map((De,ye)=>({id:De,priority:ye}));c(De=>De.map(ye=>{const rt=Le.find(vt=>vt.id===ye.id);return rt?{...ye,priority:rt.priority}:ye})),await Promise.all(Le.map(De=>Ac(De.id,{priority:De.priority})))},[]),tt=k.useCallback(async(ce,Le,De)=>{await Ac(ce,{position_x:Le,position_y:De}),c(ye=>ye.map(rt=>rt.id===ce?{...rt,position_x:Le,position_y:De}:rt))},[]),Oe=k.useCallback(async(ce,Le)=>{if(!h)return;const De=Le.map(St=>St.message).join(`
|
|
652
652
|
`),ye=`The previous task "${ce.title}" failed with the following errors:
|