tmux-tui 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,6 +15,17 @@ Interactive terminal UI for managing tmux sessions. Browse, create, rename, deta
15
15
  - **Works everywhere** — runs inside or outside tmux (auto-detects and uses `switch-client` or `attach-session`)
16
16
  - **`init` command** — register the current directory as a new tmux session in one step
17
17
 
18
+ ## Session persistence
19
+
20
+ tmux sessions live in the `tmux server` process memory. **Rebooting your machine kills the server and wipes every session** — this is a tmux behavior, not something tmuxtui can fix on its own (tmuxtui only persists your favorites list at `~/.config/tmuxtui/favorites.json`).
21
+
22
+ If you want sessions, windows, panes, and even some running programs to survive reboots, install the community-standard pair:
23
+
24
+ - [tmux-resurrect](https://github.com/tmux-plugins/tmux-resurrect) — manual save/restore of the full session tree
25
+ - [tmux-continuum](https://github.com/tmux-plugins/tmux-continuum) — automatic periodic save and auto-restore on tmux start
26
+
27
+ tmuxtui works seamlessly alongside both — they snapshot tmux's state to disk; tmuxtui reads whatever state the server currently has.
28
+
18
29
  ## Requirements
19
30
 
20
31
  - Node.js >= 18
package/dist/tmuxtui.js CHANGED
@@ -288,7 +288,7 @@ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#isr
288
288
  `)E.name="enter";else if(n===" ")E.name="tab";else if(n==="\b"||n==="\x1B\b")E.name="backspace",E.meta=n.charAt(0)==="\x1B";else if(n==="\x7F"||n==="\x1B\x7F")E.name="delete",E.meta=n.charAt(0)==="\x1B";else if(n==="\x1B"||n==="\x1B\x1B")E.name="escape",E.meta=n.length===2;else if(n===" "||n==="\x1B ")E.name="space",E.meta=n.length===2;else if(n.length===1&&n<="")E.name=String.fromCharCode(n.charCodeAt(0)+97-1),E.ctrl=!0;else if(n.length===1&&n>="0"&&n<="9")E.name="number";else if(n.length===1&&n>="a"&&n<="z")E.name=n;else if(n.length===1&&n>="A"&&n<="Z")E.name=n.toLowerCase(),E.shift=!0;else if(u=S_.exec(n))E.meta=!0,E.shift=/^[A-Z]$/.test(u[1]);else if(u=v_.exec(n)){let p=[...n];p[0]==="\x1B"&&p[1]==="\x1B"&&(E.option=!0);let I=[u[1],u[2],u[4],u[6]].filter(Boolean).join(""),S=(u[3]||u[5]||1)-1;E.ctrl=!!(S&4),E.meta=!!(S&10),E.shift=!!(S&1),E.code=I,E.name=c2[I],E.shift=R_(I)||E.shift,E.ctrl=N_(I)||E.ctrl}return E},B2=b_;var d2=ae(tA(),1);var M_=()=>(0,d2.useContext)(Rm),Hm=M_;var H_=(n,u={})=>{let{stdin:s,setRawMode:f,internal_exitOnCtrlC:E,internal_eventEmitter:p}=Hm();(0,Wh.useEffect)(()=>{if(u.isActive!==!1)return f(!0),()=>{f(!1)}},[u.isActive,f]),(0,Wh.useEffect)(()=>{if(u.isActive===!1)return;let I=S=>{let v=B2(S),T={upArrow:v.name==="up",downArrow:v.name==="down",leftArrow:v.name==="left",rightArrow:v.name==="right",pageDown:v.name==="pagedown",pageUp:v.name==="pageup",home:v.name==="home",end:v.name==="end",return:v.name==="return",escape:v.name==="escape",ctrl:v.ctrl,shift:v.shift,tab:v.name==="tab",backspace:v.name==="backspace",delete:v.name==="delete",meta:v.meta||v.name==="escape"||v.option,super:v.super??!1,hyper:v.hyper??!1,capsLock:v.capsLock??!1,numLock:v.numLock??!1,eventType:v.eventType},G;v.isKittyProtocol?v.isPrintable?G=v.text??v.name:v.ctrl&&v.name.length===1?G=v.name:G="":v.ctrl?G=v.name:G=v.sequence,!v.isKittyProtocol&&r2.includes(v.name)&&(G=""),G.startsWith("\x1B")&&(G=G.slice(1)),G.length===1&&typeof G[0]=="string"&&/[A-Z]/.test(G[0])&&(T.shift=!0),(!(G==="c"&&T.ctrl)||!E)&&du.batchedUpdates(()=>{n(G,T)})};return p?.on("input",I),()=>{p?.removeListener("input",I)}},[u.isActive,s,E,n])},Ph=H_;var p2=ae(tA(),1);var O_=()=>(0,p2.useContext)(vm),$h=O_;var G_=ae(tA(),1);var w_=ae(tA(),1);var tQ=ae(tA(),1);var L_=ae(tA(),1);var z_=ae(tA(),1);var Om=ae(tA(),1);import{execSync as uQ}from"child_process";import{basename as G2}from"path";var cn=ae(tA(),1);import{execSync as Ml}from"child_process";function pr(){let n="#{session_name} #{session_windows} #{session_created} #{session_attached} #{session_id} #{session_path} #{session_last_attached}";try{let u=Ml(`tmux list-sessions -F '${n}'`,{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();return u?u.split(`
289
289
  `).map(f=>{let[E,p,I,S,v,T,G]=f.split(" ");return{name:E,windows:parseInt(p,10),created:parseInt(I,10),attached:S==="1",sessionId:v,path:T||"",lastAttached:parseInt(G,10)||0}}).sort((f,E)=>f.attached!==E.attached?f.attached?-1:1:E.lastAttached-f.lastAttached):[]}catch{return[]}}function eQ(n,u){let s=n.replace(/'/g,"'\\''"),f=u.replace(/'/g,"'\\''"),E=u?`tmux new-session -d -s '${s}' -c '${f}'`:`tmux new-session -d -s '${s}'`;Ml(E,{stdio:"pipe"})}function m2(n){let u=n.replace(/'/g,"'\\''");Ml(`tmux kill-session -t '${u}'`,{stdio:"pipe"})}function I2(n,u){let s=n.replace(/'/g,"'\\''"),f=u.replace(/'/g,"'\\''");Ml(`tmux rename-session -t '${s}' '${f}'`,{stdio:"pipe"})}function h2(n){let u=n.replace(/'/g,"'\\''");Ml(`tmux detach-client -s '${u}'`,{stdio:"pipe"})}function Gm(n){let u="#{window_name} #{window_index} #{window_panes} #{window_active}",s=n.replace(/'/g,"'\\''");try{let f=Ml(`tmux list-windows -t '${s}' -F '${u}'`,{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();return f?f.split(`
290
290
  `).map(E=>{let[p,I,S,v]=E.split(" ");return{name:p,index:parseInt(I,10),panes:parseInt(S,10),active:v==="1"}}):[]}catch{return[]}}function Q2(n,u,s){let f=n.replace(/'/g,"'\\''"),E=u.replace(/'/g,"'\\''"),p=s?s.replace(/'/g,"'\\''"):"",I=p?`tmux new-window -d -t '${f}' -n '${E}' -c '${p}'`:`tmux new-window -d -t '${f}' -n '${E}'`;Ml(I,{stdio:"pipe"})}function D2(n,u,s){let f=n.replace(/'/g,"'\\''"),E=s.replace(/'/g,"'\\''");Ml(`tmux rename-window -t '${f}':${u} '${E}'`,{stdio:"pipe"})}function y2(n,u){let s=n.replace(/'/g,"'\\''");Ml(`tmux kill-window -t '${s}':${u}`,{stdio:"pipe"})}var Os=[{id:1,name:"Single",panes:1,preview:["\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502 1 \u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"],splits:[]},{id:2,name:"H-Split",panes:2,preview:["\u250C\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2510","\u2502 1 \u2502 2 \u2502","\u2514\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2518"],splits:[{pane:0,horizontal:!0,percentage:50}]},{id:3,name:"V-Split",panes:2,preview:["\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502 1 \u2502","\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524","\u2502 2 \u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"],splits:[{pane:0,horizontal:!1,percentage:50}]},{id:4,name:"IDE",panes:2,preview:["\u250C\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2510","\u25021 \u2502 2 \u2502","\u2514\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2518"],splits:[{pane:0,horizontal:!0,percentage:75}]},{id:5,name:"IDE+Term",panes:3,preview:["\u250C\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2510","\u2502 \u2502 2 \u2502","\u25021 \u251C\u2500\u2500\u2500\u2500\u2524","\u2502 \u2502 3 \u2502","\u2514\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2518"],splits:[{pane:0,horizontal:!0,percentage:75},{pane:1,horizontal:!1,percentage:50}]},{id:6,name:"Triple",panes:3,preview:["\u250C\u2500\u2500\u252C\u2500\u2500\u252C\u2500\u2500\u2510","\u25021 \u25022 \u25023 \u2502","\u2514\u2500\u2500\u2534\u2500\u2500\u2534\u2500\u2500\u2518"],splits:[{pane:0,horizontal:!0,percentage:66},{pane:1,horizontal:!0,percentage:50}]},{id:7,name:"IDE+Side",panes:3,preview:["\u250C\u2500\u252C\u2500\u2500\u252C\u2500\u2510","\u25021\u25022 \u25023\u2502","\u2514\u2500\u2534\u2500\u2500\u2534\u2500\u2518"],splits:[{pane:0,horizontal:!0,percentage:80},{pane:1,horizontal:!0,percentage:25}]},{id:8,name:"Quad",panes:4,preview:["\u250C\u2500\u2500\u252C\u2500\u2500\u2510","\u25021 \u25022 \u2502","\u251C\u2500\u2500\u253C\u2500\u2500\u2524","\u25023 \u25024 \u2502","\u2514\u2500\u2500\u2534\u2500\u2500\u2518"],splits:[{pane:0,horizontal:!0,percentage:50},{pane:0,horizontal:!1,percentage:50},{pane:1,horizontal:!1,percentage:50}]},{id:9,name:"IDE Pro",panes:4,preview:["\u250C\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2510","\u2502 \u2502 2 \u2502","\u25021 \u251C\u2500\u2500\u252C\u2500\u2500\u2524","\u2502 \u2502 3\u25024 \u2502","\u2514\u2500\u2500\u2534\u2500\u2500\u2534\u2500\u2500\u2518"],splits:[{pane:0,horizontal:!0,percentage:75},{pane:1,horizontal:!1,percentage:40},{pane:2,horizontal:!0,percentage:50}]}];function S2(n,u,s,f){let E=Os.find(T=>T.id===s);if(!E||E.splits.length===0)return;let I=`'${n.replace(/'/g,"'\\''")}':${u}`,S=f?` -c '${f.replace(/'/g,"'\\''")}'`:"",v=0;try{let T=Ml("tmux show-option -g pane-base-index",{encoding:"utf-8"}).trim();v=parseInt(T.split(" ").pop()||"0",10)}catch{}for(let T of E.splits){let G=T.horizontal?"-h":"-v",j=`${I}.${v+T.pane}`;Ml(`tmux split-window -t ${j} ${G} -p ${T.percentage}${S}`,{stdio:"pipe"})}}function J_(n,u){let s="#{pane_index} #{pane_title} #{pane_current_command} #{pane_current_path} #{pane_active}",f=n.replace(/'/g,"'\\''");try{let E=Ml(`tmux list-panes -t '${f}':${u} -F '${s}'`,{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();return E?E.split(`
291
- `).map(p=>{let[I,S,v,T,G]=p.split(" ");return{index:parseInt(I,10),title:S,currentCommand:v,currentPath:T,active:G==="1"}}):[]}catch{return[]}}function v2(n){return Gm(n).map(s=>({...s,paneList:J_(n,s.index)}))}function R2(n,u,s){let f=n.replace(/'/g,"'\\''"),E=s.replace(/'/g,"'\\''");Ml(`tmux move-window -s '${f}':${u} -t '${E}':`,{stdio:"pipe"})}function AQ(n){if(!n)return"\u2014";let u=new Date(n*1e3),s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],f=u.getHours().toString().padStart(2,"0"),E=u.getMinutes().toString().padStart(2,"0");return`${s[u.getMonth()]} ${u.getDate()} ${f}:${E}`}import{readFileSync as Y_,writeFileSync as K_,mkdirSync as q_}from"fs";import{join as N2}from"path";import{homedir as j_}from"os";var x2=N2(j_(),".config","tmuxtui"),T2=N2(x2,"favorites.json");function _2(){try{let n=JSON.parse(Y_(T2,"utf-8"));return new Set(n.favorites||[])}catch{return new Set}}function X_(n){q_(x2,{recursive:!0}),K_(T2,JSON.stringify({favorites:[...n]},null,2))}function F2(n,u){let s=new Set(u);return s.has(n)?s.delete(n):s.add(n),X_(s),s}var R=ae(aQ(),1);function k_({interactive:n,favoritesOnly:u,onSelect:s,onCreate:f,onKill:E,onRename:p,onDetach:I}){let{exit:S}=$h();function v(gt,at){let st=gt.toLowerCase(),Qt=at.toLowerCase(),pA=0;for(let ha=0;ha<Qt.length&&pA<st.length;ha++)Qt[ha]===st[pA]&&pA++;return pA===st.length}let[T,G]=(0,cn.useState)(pr),[j,x]=(0,cn.useState)(0),[L,Z]=(0,cn.useState)("list"),[q,J]=(0,cn.useState)(""),[yt,ee]=(0,cn.useState)(""),[zt,Jt]=(0,cn.useState)("name"),[kt,Tt]=(0,cn.useState)(""),[Kt,Gt]=(0,cn.useState)(null),[ft,jt]=(0,cn.useState)([]),[Ae,Ut]=(0,cn.useState)(0),[Ke,le]=(0,cn.useState)("list"),[Ct,_t]=(0,cn.useState)(0),[bt,Mt]=(0,cn.useState)(""),[ce,fA]=(0,cn.useState)(null),[At,Ht]=(0,cn.useState)([]),[Ce,de]=(0,cn.useState)(0),[be,KA]=(0,cn.useState)([]),[Se,Me]=(0,cn.useState)(0),[Wt,ve]=(0,cn.useState)(_2),[Rt,re]=(0,cn.useState)(u??!1),[ne,wt]=(0,cn.useState)(new Set),fe=()=>{let gt=pr();G(gt),x(at=>Math.min(at,Math.max(0,gt.length-1)))},Pt=Rt?T.filter(gt=>Wt.has(gt.name)):T,gA=()=>{if(!Kt)return;let gt=Gm(Kt.name);jt(gt),Ut(at=>Math.min(at,Math.max(0,gt.length-1)))};if(n&&Ph((gt,at)=>{if(L==="new"){if(at.escape){Z("list"),J(""),ee(""),Tt("");return}if(at.tab){Jt(st=>st==="name"?"path":"name");return}if(at.return){if(!q.trim()){Tt("Session name is required");return}let st=(yt||process.cwd()).replace(/^~/,process.env.HOME||"~");f?.(q.trim(),st),S();return}if(at.backspace||at.delete){zt==="name"?J(st=>st.slice(0,-1)):ee(st=>st.slice(0,-1)),Tt("");return}gt&&!at.ctrl&&!at.meta&&(zt==="name"?J(st=>st+gt):ee(st=>st+gt),Tt(""));return}if(L==="rename"){if(at.escape){Z("list"),J(""),Tt("");return}if(at.return){if(!q.trim()){Tt("Name cannot be empty");return}p?.(T[j].name,q.trim()),fe(),Z("list"),J(""),Tt("");return}if(at.backspace||at.delete){J(st=>st.slice(0,-1)),Tt("");return}gt&&!at.ctrl&&!at.meta&&(J(st=>st+gt),Tt(""));return}if(L==="confirm-kill"){if(at.escape||gt==="n"){Z("list");return}(gt==="y"||at.return)&&(E?.(Pt[j].name),fe(),Z("list"));return}if(L==="confirm-batch-kill"){if(at.escape||gt==="n"){Z("list");return}if(gt==="y"||at.return){for(let st of ne)E?.(st);wt(new Set),fe(),Z("list")}return}if(L==="search"){if(at.escape){Z("list"),Mt("");return}if(at.return){let st=T.filter(Qt=>v(bt,Qt.name));st.length>0&&(s?.(st[j]),S());return}if(at.backspace||at.delete){Mt(st=>st.slice(0,-1));return}if(at.upArrow||at.downArrow){let st=T.filter(Qt=>v(bt,Qt.name));at.upArrow?x(Qt=>(Qt-1+st.length)%st.length):x(Qt=>(Qt+1)%st.length);return}gt&&!at.ctrl&&!at.meta&&(Mt(st=>st+gt),x(0));return}if(L==="detail"){if(at.escape){Z("list"),fA(null),Ht([]);return}at.upArrow?de(st=>(st-1+At.length)%At.length):at.downArrow&&de(st=>(st+1)%At.length);return}if(L==="help"){if(at.escape||gt==="q"||gt==="h"){Z("list");return}return}if(L==="config"){if(Ke==="new"){if(at.escape){le("list"),J(""),Tt("");return}if(at.return){if(!q.trim()){Tt("Window name is required");return}try{Q2(Kt.name,q.trim(),Kt.path)}catch(Qt){Tt(Qt.message);return}gA(),le("list"),J(""),Tt("");return}if(at.backspace||at.delete){J(Qt=>Qt.slice(0,-1)),Tt("");return}gt&&!at.ctrl&&!at.meta&&(J(Qt=>Qt+gt),Tt(""));return}if(Ke==="rename"){if(at.escape){le("list"),J(""),Tt("");return}if(at.return){if(!q.trim()){Tt("Name cannot be empty");return}try{D2(Kt.name,ft[Ae].index,q.trim())}catch(Qt){Tt(Qt.message);return}gA(),le("list"),J(""),Tt("");return}if(at.backspace||at.delete){J(Qt=>Qt.slice(0,-1)),Tt("");return}gt&&!at.ctrl&&!at.meta&&(J(Qt=>Qt+gt),Tt(""));return}if(Ke==="confirm-delete"){if(at.escape||gt==="n"){le("list");return}if(gt==="y"||at.return){try{y2(Kt.name,ft[Ae].index)}catch(Qt){Tt(Qt.message),le("list");return}gA(),le("list")}return}if(Ke==="init-panes"){if(at.escape){le("list"),Tt("");return}if(at.return){try{S2(Kt.name,ft[Ae].index,Os[Ct].id,Kt.path)}catch(Qt){Tt(Qt.message);return}gA(),le("list");return}at.upArrow?_t(Qt=>(Qt-1+Os.length)%Os.length):at.downArrow&&_t(Qt=>(Qt+1)%Os.length);return}if(Ke==="move"){if(at.escape){le("list"),KA([]);return}if(at.return&&be.length>0){try{R2(Kt.name,ft[Ae].index,be[Se].name)}catch(Qt){Tt(Qt.message),le("list"),KA([]);return}gA(),le("list"),KA([]);return}at.upArrow?Me(Qt=>(Qt-1+be.length)%be.length):at.downArrow&&Me(Qt=>(Qt+1)%be.length);return}if(at.escape){fe(),Z("list"),Gt(null);return}if(gt==="n"){le("new"),J(""),Tt("");return}if(gt==="r"&&ft.length>0){le("rename"),J(ft[Ae].name),Tt("");return}if(gt==="d"&&ft.length>0){le("confirm-delete");return}let st=ft.length>0&&ft[Ae].panes===1;if(gt==="i"&&st){_t(0),le("init-panes"),Tt("");return}if(gt==="m"&&ft.length>0){let Qt=pr().filter(pA=>pA.name!==Kt.name);if(Qt.length===0){Tt("No other sessions to move to");return}KA(Qt),Me(0),le("move"),Tt("");return}at.upArrow?Ut(Qt=>(Qt-1+ft.length)%ft.length):at.downArrow&&Ut(Qt=>(Qt+1)%ft.length);return}if(gt==="q"){S();return}if(gt==="R"){fe();return}if(gt==="s"&&Pt.length>0){ve(F2(Pt[j].name,Wt));return}if(gt==="f"){re(st=>!st),x(0);return}if(at.tab&&Pt.length>0){wt(st=>{let Qt=new Set(st),pA=Pt[j].name;return Qt.has(pA)?Qt.delete(pA):Qt.add(pA),Qt}),x(st=>(st+1)%Pt.length);return}if(gt==="X"&&ne.size>0){for(let st of ne)I?.(st);wt(new Set),fe();return}if(gt==="D"&&ne.size>0){Z("confirm-batch-kill");return}if(gt==="/"){Z("search"),Mt(""),x(0);return}if(gt==="i"&&Pt.length>0){let st=Pt[j];fA(st),Ht(v2(st.name)),de(0),Z("detail");return}if(gt==="h"){Z("help");return}if(gt==="n"){Z("new"),Jt("name"),J(""),ee(""),Tt("");return}if(gt==="r"&&Pt.length>0){Z("rename"),J(Pt[j].name),Tt("");return}if(gt==="x"&&Pt.length>0){I?.(Pt[j].name),fe();return}if(gt==="d"&&Pt.length>0){Z("confirm-kill");return}if(gt==="c"&&Pt.length>0){let st=Pt[j];Gt(st),jt(Gm(st.name)),Ut(0),le("list"),Tt(""),Z("config");return}at.upArrow?x(st=>(st-1+Pt.length)%Pt.length):at.downArrow?x(st=>(st+1)%Pt.length):at.return&&Pt.length>0&&(s?.(Pt[j]),S())}),L==="new")return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"blue",children:" tmuxtui "}),(0,R.jsxs)(_,{children:[" ","new session"]})]}),(0,R.jsxs)(Bt,{marginBottom:1,flexDirection:"column",children:[(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{color:zt==="name"?"cyan":"white",bold:zt==="name",children:"Name: "}),(0,R.jsx)(_,{color:zt==="name"?"cyan":"white",children:q}),zt==="name"&&(0,R.jsx)(_,{backgroundColor:"cyan",children:" "})]}),(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{color:zt==="path"?"cyan":"white",bold:zt==="path",children:"Path: "}),(0,R.jsx)(_,{color:zt==="path"?"cyan":"white",children:yt}),zt==="path"&&(0,R.jsx)(_,{backgroundColor:"cyan",children:" "})]})]}),kt&&(0,R.jsx)(Bt,{marginBottom:1,children:(0,R.jsx)(_,{color:"red",children:kt})}),(0,R.jsx)(Bt,{children:(0,R.jsx)(_,{dimColor:!0,children:"tab switch | \u21B5 create | esc cancel"})})]});if(L==="rename")return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"blue",children:" tmuxtui "}),(0,R.jsxs)(_,{children:[" ","rename session"]})]}),(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{children:"New name: "}),(0,R.jsx)(_,{color:"cyan",children:q}),(0,R.jsx)(_,{backgroundColor:"cyan",children:" "})]}),kt&&(0,R.jsx)(Bt,{marginBottom:1,children:(0,R.jsx)(_,{color:"red",children:kt})}),(0,R.jsx)(Bt,{children:(0,R.jsx)(_,{dimColor:!0,children:"\u21B5 confirm | esc cancel"})})]});if(L==="confirm-kill"&&Pt.length>0){let gt=Pt[j];return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsx)(Bt,{marginBottom:1,children:(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"red",children:" \u26A0 delete "})}),(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{children:"Kill session "}),(0,R.jsx)(_,{bold:!0,color:"red",children:gt.name}),(0,R.jsx)(_,{children:"?"})]}),(0,R.jsx)(Bt,{children:(0,R.jsx)(_,{dimColor:!0,children:"y confirm | n/esc cancel"})})]})}if(L==="confirm-batch-kill"&&ne.size>0)return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsx)(Bt,{marginBottom:1,children:(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"red",children:" \u26A0 batch delete "})}),(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{children:"Kill "}),(0,R.jsx)(_,{bold:!0,color:"red",children:ne.size}),(0,R.jsx)(_,{children:" sessions?"})]}),[...ne].map(gt=>(0,R.jsx)(Bt,{marginLeft:2,children:(0,R.jsxs)(_,{color:"red",children:["- ",gt]})},gt)),(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{dimColor:!0,children:"y confirm | n/esc cancel"})})]});if(L==="search"){let gt=T.filter(st=>v(bt,st.name)),at=Math.min(j,Math.max(0,gt.length-1));return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"blue",children:" tmuxtui "}),(0,R.jsx)(_,{children:" "}),(0,R.jsx)(_,{color:"cyan",children:"/"}),(0,R.jsx)(_,{color:"cyan",children:bt}),(0,R.jsx)(_,{backgroundColor:"cyan",children:" "}),(0,R.jsx)(_,{dimColor:!0,children:` ${gt.length}/${T.length}`})]}),gt.length===0?(0,R.jsx)(_,{dimColor:!0,children:"No matching sessions"}):(0,R.jsxs)(Bt,{flexDirection:"column",children:[(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:" "}),(0,R.jsx)(_,{dimColor:!0,children:"NAME".padEnd(22)}),(0,R.jsx)(_,{dimColor:!0,children:"WINS".padEnd(7)}),(0,R.jsx)(_,{dimColor:!0,children:"STATUS".padEnd(8)}),(0,R.jsx)(_,{dimColor:!0,children:" LAST USED"})]}),gt.map((st,Qt)=>(0,R.jsx)(Bt,{flexDirection:"column",marginBottom:1,children:(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:Qt===at?"\u25B8 ":" "}),(0,R.jsx)(_,{bold:!0,color:Qt===at?"cyan":st.attached?"green":"white",children:(st.name.length>20?st.name.slice(0,17)+"...":st.name).padEnd(22)}),(0,R.jsx)(_,{dimColor:!0,children:`${st.windows} win${st.windows!==1?"s":""}`.padEnd(7)}),(0,R.jsx)(_,{color:"yellow",children:st.attached?"attached":" "}),(0,R.jsxs)(_,{dimColor:!0,children:[" ",AQ(st.lastAttached)]})]})},st.sessionId))]}),n&&(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{dimColor:!0,children:"\u2191\u2193 select | \u21B5 attach | esc cancel"})})]})}if(L==="detail"&&ce){let gt=Ce;return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"blue",children:" tmuxtui "}),(0,R.jsx)(_,{children:" "}),(0,R.jsx)(_,{bold:!0,color:"cyan",children:ce.name}),(0,R.jsxs)(_,{dimColor:!0,children:[" ",ce.path.replace(process.env.HOME||"","~")]})]}),At.length===0?(0,R.jsx)(_,{dimColor:!0,children:"No windows found"}):At.map((at,st)=>(0,R.jsxs)(Bt,{flexDirection:"column",marginBottom:1,children:[(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:st===gt?"\u25B8 ":" "}),(0,R.jsx)(_,{bold:!0,color:st===gt?"cyan":at.active?"green":"white",children:at.name}),(0,R.jsx)(_,{dimColor:!0,children:` ${at.panes} pane${at.panes!==1?"s":""}`}),(0,R.jsx)(_,{color:"yellow",children:at.active?" active":""})]}),st===gt&&at.paneList&&at.paneList.map(Qt=>(0,R.jsxs)(Bt,{marginLeft:3,children:[(0,R.jsx)(_,{dimColor:!0,children:`[${Qt.index}] `}),(0,R.jsx)(_,{color:Qt.active?"green":"white",children:Qt.currentCommand}),Qt.currentPath&&(0,R.jsx)(_,{dimColor:!0,children:` ${Qt.currentPath.replace(process.env.HOME||"","~")}`})]},Qt.index))]},at.index)),n&&(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{dimColor:!0,children:"\u2191\u2193 select | esc back"})})]})}if(L==="help")return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"blue",children:" tmuxtui "}),(0,R.jsx)(_,{children:" "}),(0,R.jsx)(_,{bold:!0,color:"cyan",children:"Help"}),(0,R.jsx)(_,{dimColor:!0,children:" All available commands"})]}),(0,R.jsxs)(Bt,{flexDirection:"column",children:[(0,R.jsx)(_,{bold:!0,color:"white",children:"NAVIGATION"}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{bold:!0,children:"\u2191\u2193"}),(0,R.jsx)(_,{dimColor:!0,children:" Select session"})]}),(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{bold:!0,color:"white",children:"SESSION MANAGEMENT"})}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{bold:!0,children:"\u21B5"}),(0,R.jsx)(_,{dimColor:!0,children:" Attach to selected session"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"green",bold:!0,children:"n"}),(0,R.jsx)(_,{dimColor:!0,children:" Create new session"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"yellow",bold:!0,children:"r"}),(0,R.jsx)(_,{dimColor:!0,children:" Rename selected session"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"blue",bold:!0,children:"x"}),(0,R.jsx)(_,{dimColor:!0,children:" Detach selected session"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"red",bold:!0,children:"d"}),(0,R.jsx)(_,{dimColor:!0,children:" Delete selected session"})]}),(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{bold:!0,color:"white",children:"SEARCH & FILTER"})}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"cyan",bold:!0,children:"/"}),(0,R.jsx)(_,{dimColor:!0,children:" Search sessions by name"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"yellow",bold:!0,children:"s"}),(0,R.jsx)(_,{dimColor:!0,children:" Toggle favorite on selected session"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"cyan",bold:!0,children:"f"}),(0,R.jsx)(_,{dimColor:!0,children:" Filter list to favorites only"})]}),(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{bold:!0,color:"white",children:"ADVANCED"})}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"magenta",bold:!0,children:"c"}),(0,R.jsx)(_,{dimColor:!0,children:" Config \u2014 manage windows for selected session"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"white",bold:!0,children:"i"}),(0,R.jsx)(_,{dimColor:!0,children:" Show session details (windows & panes)"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"white",bold:!0,children:"R"}),(0,R.jsx)(_,{dimColor:!0,children:" Refresh session list"})]}),(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{bold:!0,color:"white",children:"BATCH OPERATIONS"})}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"white",bold:!0,children:"Tab"}),(0,R.jsx)(_,{dimColor:!0,children:" Mark / unmark session"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"blue",bold:!0,children:"X"}),(0,R.jsx)(_,{dimColor:!0,children:" Batch detach all marked sessions"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"red",bold:!0,children:"D"}),(0,R.jsx)(_,{dimColor:!0,children:" Batch delete all marked sessions"})]}),(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{bold:!0,color:"white",children:"OTHER"})}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{bold:!0,children:"q"}),(0,R.jsx)(_,{dimColor:!0,children:" Quit tmuxtui"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{bold:!0,children:"h"}),(0,R.jsx)(_,{dimColor:!0,children:" Show this help screen"})]})]}),n&&(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{dimColor:!0,children:"esc back to sessions"})})]});if(L==="config"&&Kt){if(Ke==="new")return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"magenta",children:" config "}),(0,R.jsxs)(_,{children:[" ","new window"]})]}),(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{children:"Name: "}),(0,R.jsx)(_,{color:"cyan",children:q}),(0,R.jsx)(_,{backgroundColor:"cyan",children:" "})]}),kt&&(0,R.jsx)(Bt,{marginBottom:1,children:(0,R.jsx)(_,{color:"red",children:kt})}),(0,R.jsx)(Bt,{children:(0,R.jsx)(_,{dimColor:!0,children:"\u21B5 create | esc cancel"})})]});if(Ke==="rename")return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"magenta",children:" config "}),(0,R.jsxs)(_,{children:[" ","rename window"]})]}),(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{children:"New name: "}),(0,R.jsx)(_,{color:"cyan",children:q}),(0,R.jsx)(_,{backgroundColor:"cyan",children:" "})]}),kt&&(0,R.jsx)(Bt,{marginBottom:1,children:(0,R.jsx)(_,{color:"red",children:kt})}),(0,R.jsx)(Bt,{children:(0,R.jsx)(_,{dimColor:!0,children:"\u21B5 confirm | esc cancel"})})]});if(Ke==="confirm-delete"&&ft.length>0){let at=ft[Ae];return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsx)(Bt,{marginBottom:1,children:(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"red",children:" \u26A0 delete "})}),(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{children:"Delete window "}),(0,R.jsx)(_,{bold:!0,color:"red",children:at.name}),(0,R.jsx)(_,{children:"?"})]}),(0,R.jsx)(Bt,{children:(0,R.jsx)(_,{dimColor:!0,children:"y confirm | n/esc cancel"})})]})}if(Ke==="list")return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"magenta",children:" config "}),(0,R.jsxs)(_,{children:[" ",Kt.name]}),(0,R.jsxs)(_,{dimColor:!0,children:[" windows (",ft.length,")"]})]}),ft.length===0?(0,R.jsx)(_,{dimColor:!0,children:"No windows found"}):ft.map((at,st)=>(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:st===Ae?"\u25B8 ":" "}),(0,R.jsx)(_,{bold:!0,color:st===Ae?"cyan":at.active?"green":"white",children:at.name.padEnd(20)}),(0,R.jsxs)(_,{dimColor:!0,children:[at.panes," pane",at.panes!==1?"s":""]}),(0,R.jsx)(_,{color:"yellow",children:at.active?" active":""})]},at.index)),n&&(0,R.jsxs)(Bt,{marginTop:1,children:[(0,R.jsx)(_,{dimColor:!0,children:"\u2191\u2193 select | "}),(0,R.jsx)(_,{color:"green",bold:!0,children:"n"}),(0,R.jsx)(_,{dimColor:!0,children:" new | "}),(0,R.jsx)(_,{color:"yellow",bold:!0,children:"r"}),(0,R.jsx)(_,{dimColor:!0,children:" rename | "}),(0,R.jsx)(_,{color:"red",bold:!0,children:"d"}),(0,R.jsx)(_,{dimColor:!0,children:" delete | "}),ft.length>0&&ft[Ae].panes===1&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(_,{color:"cyan",bold:!0,children:"i"}),(0,R.jsx)(_,{dimColor:!0,children:" init panes | "})]}),ft.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(_,{color:"blue",bold:!0,children:"m"}),(0,R.jsx)(_,{dimColor:!0,children:" move | "})]}),(0,R.jsx)(_,{dimColor:!0,children:"esc back"})]})]});if(Ke==="move")return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"magenta",children:" config "}),(0,R.jsxs)(_,{children:[" ","move window "]}),(0,R.jsx)(_,{bold:!0,color:"cyan",children:ft[Ae]?.name}),(0,R.jsx)(_,{children:" to:"})]}),be.map((at,st)=>(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:st===Se?"\u25B8 ":" "}),(0,R.jsx)(_,{bold:!0,color:st===Se?"cyan":"white",children:at.name}),(0,R.jsx)(_,{dimColor:!0,children:` ${at.windows} win${at.windows!==1?"s":""}`}),(0,R.jsx)(_,{color:"yellow",children:at.attached?" attached":""})]},at.sessionId)),kt&&(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{color:"red",children:kt})}),n&&(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{dimColor:!0,children:"\u2191\u2193 select | \u21B5 move | esc cancel"})})]});let gt=Os[Ct];return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"magenta",children:" config "}),(0,R.jsxs)(_,{children:[" ",ft[Ae]?.name]}),(0,R.jsx)(_,{dimColor:!0,children:" init panes"})]}),Os.map((at,st)=>(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:st===Ct?"\u25B8 ":" "}),(0,R.jsx)(_,{bold:!0,color:st===Ct?"cyan":"white",children:`${at.id}. ${at.name.padEnd(12)}`}),(0,R.jsx)(_,{dimColor:!0,children:`${at.panes} pane${at.panes!==1?"s":""}`})]},at.id)),(0,R.jsxs)(Bt,{marginTop:1,flexDirection:"column",children:[(0,R.jsx)(_,{dimColor:!0,children:"Preview:"}),gt.preview.map((at,st)=>(0,R.jsx)(_,{color:"cyan",children:at},st))]}),kt&&(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{color:"red",children:kt})}),n&&(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{dimColor:!0,children:"\u2191\u2193 select | \u21B5 apply | esc cancel"})})]})}let Lt=Math.min(j,Math.max(0,Pt.length-1));return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"blue",children:" tmuxtui "}),(0,R.jsxs)(_,{dimColor:!0,children:[" ","tmux sessions (",Pt.length,Rt?" \u2605":"","/",T.length,")"]})]}),Pt.length===0?(0,R.jsx)(_,{dimColor:!0,children:Rt?"No favorite sessions":"No tmux sessions found"}):(0,R.jsxs)(Bt,{flexDirection:"column",children:[(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:" "}),(0,R.jsx)(_,{dimColor:!0,children:"NAME".padEnd(22)}),(0,R.jsx)(_,{dimColor:!0,children:"WINS".padEnd(7)}),(0,R.jsx)(_,{dimColor:!0,children:"STATUS".padEnd(8)}),(0,R.jsx)(_,{dimColor:!0,children:" LAST USED"})]}),Pt.map((gt,at)=>(0,R.jsxs)(Bt,{flexDirection:"column",marginBottom:1,children:[(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:ne.has(gt.name)?"\u2611":"\u2610"}),(0,R.jsx)(_,{children:Wt.has(gt.name)?"\u2605":" "}),(0,R.jsx)(_,{children:at===Lt?"\u25B8":" "}),(0,R.jsx)(_,{bold:!0,color:at===Lt?"cyan":gt.attached?"green":"white",children:(gt.name.length>20?gt.name.slice(0,17)+"...":gt.name).padEnd(22)}),(0,R.jsx)(_,{dimColor:!0,children:`${gt.windows} win${gt.windows!==1?"s":""}`.padEnd(7)}),(0,R.jsx)(_,{color:"yellow",children:gt.attached?"attached":" "}),(0,R.jsxs)(_,{dimColor:!0,children:[" ",AQ(gt.lastAttached)]})]}),gt.path&&(0,R.jsxs)(_,{dimColor:!0,children:[" ",gt.path.replace(process.env.HOME||"","~")]})]},gt.sessionId))]}),n&&(0,R.jsxs)(Bt,{marginTop:1,flexDirection:"column",children:[(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{dimColor:!0,children:"\u2191\u2193 select | \u21B5 attach | "}),(0,R.jsx)(_,{color:"green",bold:!0,children:"n"}),(0,R.jsx)(_,{dimColor:!0,children:" new | "}),(0,R.jsx)(_,{color:"yellow",bold:!0,children:"r"}),(0,R.jsx)(_,{dimColor:!0,children:" rename | "}),(0,R.jsx)(_,{color:"magenta",bold:!0,children:"c"}),(0,R.jsx)(_,{dimColor:!0,children:" config | "}),(0,R.jsx)(_,{dimColor:!0,children:"q quit | "}),(0,R.jsx)(_,{bold:!0,children:"h"}),(0,R.jsx)(_,{dimColor:!0,children:" help"})]}),(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{color:"cyan",bold:!0,children:"/"}),(0,R.jsx)(_,{dimColor:!0,children:" search | "}),(0,R.jsx)(_,{color:"yellow",bold:!0,children:"s"}),(0,R.jsx)(_,{dimColor:!0,children:" star | "}),(0,R.jsx)(_,{color:"cyan",bold:!0,children:"f"}),(0,R.jsx)(_,{dimColor:!0,children:" filter | "}),(0,R.jsx)(_,{color:"white",bold:!0,children:"R"}),(0,R.jsx)(_,{dimColor:!0,children:" refresh | "}),(0,R.jsx)(_,{color:"blue",bold:!0,children:"x"}),(0,R.jsx)(_,{dimColor:!0,children:" detach | "}),(0,R.jsx)(_,{color:"red",bold:!0,children:"d"}),(0,R.jsx)(_,{dimColor:!0,children:" delete | "}),(0,R.jsx)(_,{color:"white",bold:!0,children:"i"}),(0,R.jsx)(_,{dimColor:!0,children:" info"})]}),(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{color:"white",bold:!0,children:"Tab"}),(0,R.jsx)(_,{dimColor:!0,children:" mark | "}),(0,R.jsx)(_,{color:"blue",bold:!0,children:"X"}),(0,R.jsx)(_,{dimColor:!0,children:" batch detach | "}),(0,R.jsx)(_,{color:"red",bold:!0,children:"D"}),(0,R.jsx)(_,{dimColor:!0,children:" batch kill"})]})]})]})}function lQ({onSelect:n,onCreate:u,onKill:s,onRename:f,onDetach:E,favoritesOnly:p}){return(0,R.jsx)(k_,{interactive:!!process.stdin.isTTY,favoritesOnly:p,onSelect:n,onCreate:u,onKill:s,onRename:f,onDetach:E})}function zm(n){process.stdout.write(`\x1B]0;[tmux] ${n}\x07`);let u=`'${n.replace(/'/g,"'\\''")}'`,s=process.env.TMUX?`tmux switch-client -t ${u}`:`tmux attach-session -t ${u}`;uQ(s,{stdio:"inherit"})}var Ha=process.argv.slice(2);function W_(){console.log(`
291
+ `).map(p=>{let[I,S,v,T,G]=p.split(" ");return{index:parseInt(I,10),title:S,currentCommand:v,currentPath:T,active:G==="1"}}):[]}catch{return[]}}function v2(n){return Gm(n).map(s=>({...s,paneList:J_(n,s.index)}))}function R2(n,u,s){let f=n.replace(/'/g,"'\\''"),E=s.replace(/'/g,"'\\''");Ml(`tmux move-window -s '${f}':${u} -t '${E}':`,{stdio:"pipe"})}function AQ(n){if(!n)return"\u2014";let u=new Date(n*1e3),s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],f=u.getHours().toString().padStart(2,"0"),E=u.getMinutes().toString().padStart(2,"0");return`${s[u.getMonth()]} ${u.getDate()} ${f}:${E}`}import{readFileSync as Y_,writeFileSync as K_,mkdirSync as q_}from"fs";import{join as N2}from"path";import{homedir as j_}from"os";var x2=N2(j_(),".config","tmuxtui"),T2=N2(x2,"favorites.json");function _2(){try{let n=JSON.parse(Y_(T2,"utf-8"));return new Set(n.favorites||[])}catch{return new Set}}function X_(n){q_(x2,{recursive:!0}),K_(T2,JSON.stringify({favorites:[...n]},null,2))}function F2(n,u){let s=new Set(u);return s.has(n)?s.delete(n):s.add(n),X_(s),s}var R=ae(aQ(),1);function k_({interactive:n,favoritesOnly:u,onSelect:s,onCreate:f,onKill:E,onRename:p,onDetach:I}){let{exit:S}=$h();function v(gt,at){let st=gt.toLowerCase(),Qt=at.toLowerCase(),pA=0;for(let ha=0;ha<Qt.length&&pA<st.length;ha++)Qt[ha]===st[pA]&&pA++;return pA===st.length}let[T,G]=(0,cn.useState)(pr),[j,x]=(0,cn.useState)(0),[L,Z]=(0,cn.useState)("list"),[q,J]=(0,cn.useState)(""),[yt,ee]=(0,cn.useState)(""),[zt,Jt]=(0,cn.useState)("name"),[kt,Tt]=(0,cn.useState)(""),[Kt,Gt]=(0,cn.useState)(null),[ft,jt]=(0,cn.useState)([]),[Ae,Ut]=(0,cn.useState)(0),[Ke,le]=(0,cn.useState)("list"),[Ct,_t]=(0,cn.useState)(0),[bt,Mt]=(0,cn.useState)(""),[ce,fA]=(0,cn.useState)(null),[At,Ht]=(0,cn.useState)([]),[Ce,de]=(0,cn.useState)(0),[be,KA]=(0,cn.useState)([]),[Se,Me]=(0,cn.useState)(0),[Wt,ve]=(0,cn.useState)(_2),[Rt,re]=(0,cn.useState)(u??!1),[ne,wt]=(0,cn.useState)(new Set),fe=()=>{let gt=pr();G(gt),x(at=>Math.min(at,Math.max(0,gt.length-1)))},Pt=Rt?T.filter(gt=>Wt.has(gt.name)):T,gA=()=>{if(!Kt)return;let gt=Gm(Kt.name);jt(gt),Ut(at=>Math.min(at,Math.max(0,gt.length-1)))};if(n&&Ph((gt,at)=>{if(L==="new"){if(at.escape){Z("list"),J(""),ee(""),Tt("");return}if(at.tab){Jt(st=>st==="name"?"path":"name");return}if(at.return){if(!q.trim()){Tt("Session name is required");return}let st=(yt||process.cwd()).replace(/^~/,process.env.HOME||"~");f?.(q.trim(),st),S();return}if(at.backspace||at.delete){zt==="name"?J(st=>st.slice(0,-1)):ee(st=>st.slice(0,-1)),Tt("");return}gt&&!at.ctrl&&!at.meta&&(zt==="name"?J(st=>st+gt):ee(st=>st+gt),Tt(""));return}if(L==="rename"){if(at.escape){Z("list"),J(""),Tt("");return}if(at.return){if(!q.trim()){Tt("Name cannot be empty");return}p?.(T[j].name,q.trim()),fe(),Z("list"),J(""),Tt("");return}if(at.backspace||at.delete){J(st=>st.slice(0,-1)),Tt("");return}gt&&!at.ctrl&&!at.meta&&(J(st=>st+gt),Tt(""));return}if(L==="confirm-kill"){if(at.escape||gt==="n"){Z("list");return}(gt==="y"||at.return)&&(E?.(Pt[j].name),fe(),Z("list"));return}if(L==="confirm-batch-kill"){if(at.escape||gt==="n"){Z("list");return}if(gt==="y"||at.return){for(let st of ne)E?.(st);wt(new Set),fe(),Z("list")}return}if(L==="search"){if(at.escape){Z("list"),Mt("");return}if(at.return){let st=T.filter(Qt=>v(bt,Qt.name));st.length>0&&(s?.(st[j]),S());return}if(at.backspace||at.delete){Mt(st=>st.slice(0,-1));return}if(at.upArrow||at.downArrow){let st=T.filter(Qt=>v(bt,Qt.name));at.upArrow?x(Qt=>(Qt-1+st.length)%st.length):x(Qt=>(Qt+1)%st.length);return}gt&&!at.ctrl&&!at.meta&&(Mt(st=>st+gt),x(0));return}if(L==="detail"){if(at.escape){Z("list"),fA(null),Ht([]);return}at.upArrow?de(st=>(st-1+At.length)%At.length):at.downArrow&&de(st=>(st+1)%At.length);return}if(L==="help"){if(at.escape||gt==="q"||gt==="h"){Z("list");return}return}if(L==="config"){if(Ke==="new"){if(at.escape){le("list"),J(""),Tt("");return}if(at.return){if(!q.trim()){Tt("Window name is required");return}try{Q2(Kt.name,q.trim(),Kt.path)}catch(Qt){Tt(Qt.message);return}gA(),le("list"),J(""),Tt("");return}if(at.backspace||at.delete){J(Qt=>Qt.slice(0,-1)),Tt("");return}gt&&!at.ctrl&&!at.meta&&(J(Qt=>Qt+gt),Tt(""));return}if(Ke==="rename"){if(at.escape){le("list"),J(""),Tt("");return}if(at.return){if(!q.trim()){Tt("Name cannot be empty");return}try{D2(Kt.name,ft[Ae].index,q.trim())}catch(Qt){Tt(Qt.message);return}gA(),le("list"),J(""),Tt("");return}if(at.backspace||at.delete){J(Qt=>Qt.slice(0,-1)),Tt("");return}gt&&!at.ctrl&&!at.meta&&(J(Qt=>Qt+gt),Tt(""));return}if(Ke==="confirm-delete"){if(at.escape||gt==="n"){le("list");return}if(gt==="y"||at.return){try{y2(Kt.name,ft[Ae].index)}catch(Qt){Tt(Qt.message),le("list");return}gA(),le("list")}return}if(Ke==="init-panes"){if(at.escape){le("list"),Tt("");return}if(at.return){try{S2(Kt.name,ft[Ae].index,Os[Ct].id,Kt.path)}catch(Qt){Tt(Qt.message);return}gA(),le("list");return}at.upArrow?_t(Qt=>(Qt-1+Os.length)%Os.length):at.downArrow&&_t(Qt=>(Qt+1)%Os.length);return}if(Ke==="move"){if(at.escape){le("list"),KA([]);return}if(at.return&&be.length>0){try{R2(Kt.name,ft[Ae].index,be[Se].name)}catch(Qt){Tt(Qt.message),le("list"),KA([]);return}gA(),le("list"),KA([]);return}at.upArrow?Me(Qt=>(Qt-1+be.length)%be.length):at.downArrow&&Me(Qt=>(Qt+1)%be.length);return}if(at.escape){fe(),Z("list"),Gt(null);return}if(gt==="n"){le("new"),J(""),Tt("");return}if(gt==="r"&&ft.length>0){le("rename"),J(ft[Ae].name),Tt("");return}if(gt==="d"&&ft.length>0){le("confirm-delete");return}let st=ft.length>0&&ft[Ae].panes===1;if(gt==="i"&&st){_t(0),le("init-panes"),Tt("");return}if(gt==="m"&&ft.length>0){let Qt=pr().filter(pA=>pA.name!==Kt.name);if(Qt.length===0){Tt("No other sessions to move to");return}KA(Qt),Me(0),le("move"),Tt("");return}at.upArrow?Ut(Qt=>(Qt-1+ft.length)%ft.length):at.downArrow&&Ut(Qt=>(Qt+1)%ft.length);return}if(gt==="q"){S();return}if(gt==="R"){fe();return}if(gt==="s"&&Pt.length>0){ve(F2(Pt[j].name,Wt));return}if(gt==="f"){re(st=>!st),x(0);return}if(at.tab&&Pt.length>0){wt(st=>{let Qt=new Set(st),pA=Pt[j].name;return Qt.has(pA)?Qt.delete(pA):Qt.add(pA),Qt}),x(st=>(st+1)%Pt.length);return}if(gt==="X"&&ne.size>0){for(let st of ne)I?.(st);wt(new Set),fe();return}if(gt==="D"&&ne.size>0){Z("confirm-batch-kill");return}if(gt==="/"){Z("search"),Mt(""),x(0);return}if(gt==="i"&&Pt.length>0){let st=Pt[j];fA(st),Ht(v2(st.name)),de(0),Z("detail");return}if(gt==="h"){Z("help");return}if(gt==="n"){Z("new"),Jt("name"),J(""),ee(""),Tt("");return}if(gt==="r"&&Pt.length>0){Z("rename"),J(Pt[j].name),Tt("");return}if(gt==="x"&&Pt.length>0){I?.(Pt[j].name),fe();return}if(gt==="d"&&Pt.length>0){Z("confirm-kill");return}if(gt==="c"&&Pt.length>0){let st=Pt[j];Gt(st),jt(Gm(st.name)),Ut(0),le("list"),Tt(""),Z("config");return}at.upArrow?x(st=>(st-1+Pt.length)%Pt.length):at.downArrow?x(st=>(st+1)%Pt.length):at.return&&Pt.length>0&&(s?.(Pt[j]),S())}),L==="new")return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"blue",children:" tmuxtui "}),(0,R.jsxs)(_,{children:[" ","new session"]})]}),(0,R.jsxs)(Bt,{marginBottom:1,flexDirection:"column",children:[(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{color:zt==="name"?"cyan":"white",bold:zt==="name",children:"Name: "}),(0,R.jsx)(_,{color:zt==="name"?"cyan":"white",children:q}),zt==="name"&&(0,R.jsx)(_,{backgroundColor:"cyan",children:" "})]}),(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{color:zt==="path"?"cyan":"white",bold:zt==="path",children:"Path: "}),(0,R.jsx)(_,{color:zt==="path"?"cyan":"white",children:yt}),zt==="path"&&(0,R.jsx)(_,{backgroundColor:"cyan",children:" "})]})]}),kt&&(0,R.jsx)(Bt,{marginBottom:1,children:(0,R.jsx)(_,{color:"red",children:kt})}),(0,R.jsx)(Bt,{children:(0,R.jsx)(_,{dimColor:!0,children:"tab switch | \u21B5 create | esc cancel"})})]});if(L==="rename")return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"blue",children:" tmuxtui "}),(0,R.jsxs)(_,{children:[" ","rename session"]})]}),(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{children:"New name: "}),(0,R.jsx)(_,{color:"cyan",children:q}),(0,R.jsx)(_,{backgroundColor:"cyan",children:" "})]}),kt&&(0,R.jsx)(Bt,{marginBottom:1,children:(0,R.jsx)(_,{color:"red",children:kt})}),(0,R.jsx)(Bt,{children:(0,R.jsx)(_,{dimColor:!0,children:"\u21B5 confirm | esc cancel"})})]});if(L==="confirm-kill"&&Pt.length>0){let gt=Pt[j];return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsx)(Bt,{marginBottom:1,children:(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"red",children:" \u26A0 delete "})}),(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{children:"Kill session "}),(0,R.jsx)(_,{bold:!0,color:"red",children:gt.name}),(0,R.jsx)(_,{children:"?"})]}),(0,R.jsx)(Bt,{children:(0,R.jsx)(_,{dimColor:!0,children:"y confirm | n/esc cancel"})})]})}if(L==="confirm-batch-kill"&&ne.size>0)return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsx)(Bt,{marginBottom:1,children:(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"red",children:" \u26A0 batch delete "})}),(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{children:"Kill "}),(0,R.jsx)(_,{bold:!0,color:"red",children:ne.size}),(0,R.jsx)(_,{children:" sessions?"})]}),[...ne].map(gt=>(0,R.jsx)(Bt,{marginLeft:2,children:(0,R.jsxs)(_,{color:"red",children:["- ",gt]})},gt)),(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{dimColor:!0,children:"y confirm | n/esc cancel"})})]});if(L==="search"){let gt=T.filter(st=>v(bt,st.name)),at=Math.min(j,Math.max(0,gt.length-1));return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"blue",children:" tmuxtui "}),(0,R.jsx)(_,{children:" "}),(0,R.jsx)(_,{color:"cyan",children:"/"}),(0,R.jsx)(_,{color:"cyan",children:bt}),(0,R.jsx)(_,{backgroundColor:"cyan",children:" "}),(0,R.jsx)(_,{dimColor:!0,children:` ${gt.length}/${T.length}`})]}),gt.length===0?(0,R.jsx)(_,{dimColor:!0,children:"No matching sessions"}):(0,R.jsxs)(Bt,{flexDirection:"column",children:[(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:" "}),(0,R.jsx)(_,{dimColor:!0,children:"NAME".padEnd(22)}),(0,R.jsx)(_,{dimColor:!0,children:"WINS".padEnd(7)}),(0,R.jsx)(_,{dimColor:!0,children:"STATUS".padEnd(8)}),(0,R.jsx)(_,{dimColor:!0,children:" LAST USED"})]}),gt.map((st,Qt)=>(0,R.jsx)(Bt,{flexDirection:"column",marginBottom:1,children:(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:Qt===at?"\u25B8 ":" "}),(0,R.jsx)(_,{bold:!0,color:Qt===at?"cyan":st.attached?"green":"white",children:(st.name.length>20?st.name.slice(0,17)+"...":st.name).padEnd(22)}),(0,R.jsx)(_,{dimColor:!0,children:`${st.windows} win${st.windows!==1?"s":""}`.padEnd(7)}),(0,R.jsx)(_,{color:"yellow",children:st.attached?"attached":" "}),(0,R.jsxs)(_,{dimColor:!0,children:[" ",AQ(st.lastAttached)]})]})},st.sessionId))]}),n&&(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{dimColor:!0,children:"\u2191\u2193 select | \u21B5 attach | esc cancel"})})]})}if(L==="detail"&&ce){let gt=Ce;return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"blue",children:" tmuxtui "}),(0,R.jsx)(_,{children:" "}),(0,R.jsx)(_,{bold:!0,color:"cyan",children:ce.name}),(0,R.jsxs)(_,{dimColor:!0,children:[" ",ce.path.replace(process.env.HOME||"","~")]})]}),At.length===0?(0,R.jsx)(_,{dimColor:!0,children:"No windows found"}):At.map((at,st)=>(0,R.jsxs)(Bt,{flexDirection:"column",marginBottom:1,children:[(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:st===gt?"\u25B8 ":" "}),(0,R.jsx)(_,{bold:!0,color:st===gt?"cyan":at.active?"green":"white",children:at.name}),(0,R.jsx)(_,{dimColor:!0,children:` ${at.panes} pane${at.panes!==1?"s":""}`}),(0,R.jsx)(_,{color:"yellow",children:at.active?" active":""})]}),st===gt&&at.paneList&&at.paneList.map(Qt=>(0,R.jsxs)(Bt,{marginLeft:3,children:[(0,R.jsx)(_,{dimColor:!0,children:`[${Qt.index}] `}),(0,R.jsx)(_,{color:Qt.active?"green":"white",children:Qt.currentCommand}),Qt.currentPath&&(0,R.jsx)(_,{dimColor:!0,children:` ${Qt.currentPath.replace(process.env.HOME||"","~")}`})]},Qt.index))]},at.index)),n&&(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{dimColor:!0,children:"\u2191\u2193 select | esc back"})})]})}if(L==="help")return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"blue",children:" tmuxtui "}),(0,R.jsx)(_,{children:" "}),(0,R.jsx)(_,{bold:!0,color:"cyan",children:"Help"}),(0,R.jsx)(_,{dimColor:!0,children:" All available commands"})]}),(0,R.jsxs)(Bt,{flexDirection:"column",children:[(0,R.jsx)(_,{bold:!0,color:"white",children:"NAVIGATION"}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{bold:!0,children:"\u2191\u2193"}),(0,R.jsx)(_,{dimColor:!0,children:" Select session"})]}),(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{bold:!0,color:"white",children:"SESSION MANAGEMENT"})}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{bold:!0,children:"\u21B5"}),(0,R.jsx)(_,{dimColor:!0,children:" Attach to selected session"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"green",bold:!0,children:"n"}),(0,R.jsx)(_,{dimColor:!0,children:" Create new session"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"yellow",bold:!0,children:"r"}),(0,R.jsx)(_,{dimColor:!0,children:" Rename selected session"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"blue",bold:!0,children:"x"}),(0,R.jsx)(_,{dimColor:!0,children:" Detach selected session"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"red",bold:!0,children:"d"}),(0,R.jsx)(_,{dimColor:!0,children:" Delete selected session"})]}),(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{bold:!0,color:"white",children:"SEARCH & FILTER"})}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"cyan",bold:!0,children:"/"}),(0,R.jsx)(_,{dimColor:!0,children:" Search sessions by name"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"yellow",bold:!0,children:"s"}),(0,R.jsx)(_,{dimColor:!0,children:" Toggle favorite on selected session"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"cyan",bold:!0,children:"f"}),(0,R.jsx)(_,{dimColor:!0,children:" Filter list to favorites only"})]}),(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{bold:!0,color:"white",children:"ADVANCED"})}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"magenta",bold:!0,children:"c"}),(0,R.jsx)(_,{dimColor:!0,children:" Config \u2014 manage windows for selected session"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"white",bold:!0,children:"i"}),(0,R.jsx)(_,{dimColor:!0,children:" Show session details (windows & panes)"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"white",bold:!0,children:"R"}),(0,R.jsx)(_,{dimColor:!0,children:" Refresh session list"})]}),(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{bold:!0,color:"white",children:"BATCH OPERATIONS"})}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"white",bold:!0,children:"Tab"}),(0,R.jsx)(_,{dimColor:!0,children:" Mark / unmark session"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"blue",bold:!0,children:"X"}),(0,R.jsx)(_,{dimColor:!0,children:" Batch detach all marked sessions"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{color:"red",bold:!0,children:"D"}),(0,R.jsx)(_,{dimColor:!0,children:" Batch delete all marked sessions"})]}),(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{bold:!0,color:"white",children:"OTHER"})}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{bold:!0,children:"q"}),(0,R.jsx)(_,{dimColor:!0,children:" Quit tmuxtui"})]}),(0,R.jsxs)(_,{children:[" ",(0,R.jsx)(_,{bold:!0,children:"h"}),(0,R.jsx)(_,{dimColor:!0,children:" Show this help screen"})]}),(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{bold:!0,color:"white",children:"PERSISTENCE"})}),(0,R.jsx)(_,{dimColor:!0,children:" Sessions live in tmux server memory and do NOT survive reboots."}),(0,R.jsx)(_,{dimColor:!0,children:" Install tmux-resurrect + tmux-continuum to save/restore across restarts."})]}),n&&(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{dimColor:!0,children:"esc back to sessions"})})]});if(L==="config"&&Kt){if(Ke==="new")return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"magenta",children:" config "}),(0,R.jsxs)(_,{children:[" ","new window"]})]}),(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{children:"Name: "}),(0,R.jsx)(_,{color:"cyan",children:q}),(0,R.jsx)(_,{backgroundColor:"cyan",children:" "})]}),kt&&(0,R.jsx)(Bt,{marginBottom:1,children:(0,R.jsx)(_,{color:"red",children:kt})}),(0,R.jsx)(Bt,{children:(0,R.jsx)(_,{dimColor:!0,children:"\u21B5 create | esc cancel"})})]});if(Ke==="rename")return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"magenta",children:" config "}),(0,R.jsxs)(_,{children:[" ","rename window"]})]}),(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{children:"New name: "}),(0,R.jsx)(_,{color:"cyan",children:q}),(0,R.jsx)(_,{backgroundColor:"cyan",children:" "})]}),kt&&(0,R.jsx)(Bt,{marginBottom:1,children:(0,R.jsx)(_,{color:"red",children:kt})}),(0,R.jsx)(Bt,{children:(0,R.jsx)(_,{dimColor:!0,children:"\u21B5 confirm | esc cancel"})})]});if(Ke==="confirm-delete"&&ft.length>0){let at=ft[Ae];return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsx)(Bt,{marginBottom:1,children:(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"red",children:" \u26A0 delete "})}),(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{children:"Delete window "}),(0,R.jsx)(_,{bold:!0,color:"red",children:at.name}),(0,R.jsx)(_,{children:"?"})]}),(0,R.jsx)(Bt,{children:(0,R.jsx)(_,{dimColor:!0,children:"y confirm | n/esc cancel"})})]})}if(Ke==="list")return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"magenta",children:" config "}),(0,R.jsxs)(_,{children:[" ",Kt.name]}),(0,R.jsxs)(_,{dimColor:!0,children:[" windows (",ft.length,")"]})]}),ft.length===0?(0,R.jsx)(_,{dimColor:!0,children:"No windows found"}):ft.map((at,st)=>(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:st===Ae?"\u25B8 ":" "}),(0,R.jsx)(_,{bold:!0,color:st===Ae?"cyan":at.active?"green":"white",children:at.name.padEnd(20)}),(0,R.jsxs)(_,{dimColor:!0,children:[at.panes," pane",at.panes!==1?"s":""]}),(0,R.jsx)(_,{color:"yellow",children:at.active?" active":""})]},at.index)),n&&(0,R.jsxs)(Bt,{marginTop:1,children:[(0,R.jsx)(_,{dimColor:!0,children:"\u2191\u2193 select | "}),(0,R.jsx)(_,{color:"green",bold:!0,children:"n"}),(0,R.jsx)(_,{dimColor:!0,children:" new | "}),(0,R.jsx)(_,{color:"yellow",bold:!0,children:"r"}),(0,R.jsx)(_,{dimColor:!0,children:" rename | "}),(0,R.jsx)(_,{color:"red",bold:!0,children:"d"}),(0,R.jsx)(_,{dimColor:!0,children:" delete | "}),ft.length>0&&ft[Ae].panes===1&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(_,{color:"cyan",bold:!0,children:"i"}),(0,R.jsx)(_,{dimColor:!0,children:" init panes | "})]}),ft.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(_,{color:"blue",bold:!0,children:"m"}),(0,R.jsx)(_,{dimColor:!0,children:" move | "})]}),(0,R.jsx)(_,{dimColor:!0,children:"esc back"})]})]});if(Ke==="move")return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"magenta",children:" config "}),(0,R.jsxs)(_,{children:[" ","move window "]}),(0,R.jsx)(_,{bold:!0,color:"cyan",children:ft[Ae]?.name}),(0,R.jsx)(_,{children:" to:"})]}),be.map((at,st)=>(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:st===Se?"\u25B8 ":" "}),(0,R.jsx)(_,{bold:!0,color:st===Se?"cyan":"white",children:at.name}),(0,R.jsx)(_,{dimColor:!0,children:` ${at.windows} win${at.windows!==1?"s":""}`}),(0,R.jsx)(_,{color:"yellow",children:at.attached?" attached":""})]},at.sessionId)),kt&&(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{color:"red",children:kt})}),n&&(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{dimColor:!0,children:"\u2191\u2193 select | \u21B5 move | esc cancel"})})]});let gt=Os[Ct];return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"magenta",children:" config "}),(0,R.jsxs)(_,{children:[" ",ft[Ae]?.name]}),(0,R.jsx)(_,{dimColor:!0,children:" init panes"})]}),Os.map((at,st)=>(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:st===Ct?"\u25B8 ":" "}),(0,R.jsx)(_,{bold:!0,color:st===Ct?"cyan":"white",children:`${at.id}. ${at.name.padEnd(12)}`}),(0,R.jsx)(_,{dimColor:!0,children:`${at.panes} pane${at.panes!==1?"s":""}`})]},at.id)),(0,R.jsxs)(Bt,{marginTop:1,flexDirection:"column",children:[(0,R.jsx)(_,{dimColor:!0,children:"Preview:"}),gt.preview.map((at,st)=>(0,R.jsx)(_,{color:"cyan",children:at},st))]}),kt&&(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{color:"red",children:kt})}),n&&(0,R.jsx)(Bt,{marginTop:1,children:(0,R.jsx)(_,{dimColor:!0,children:"\u2191\u2193 select | \u21B5 apply | esc cancel"})})]})}let Lt=Math.min(j,Math.max(0,Pt.length-1));return(0,R.jsxs)(Bt,{flexDirection:"column",paddingX:1,children:[(0,R.jsxs)(Bt,{marginBottom:1,children:[(0,R.jsx)(_,{bold:!0,color:"white",backgroundColor:"blue",children:" tmuxtui "}),(0,R.jsxs)(_,{dimColor:!0,children:[" ","tmux sessions (",Pt.length,Rt?" \u2605":"","/",T.length,")"]})]}),Pt.length===0?(0,R.jsx)(_,{dimColor:!0,children:Rt?"No favorite sessions":"No tmux sessions found"}):(0,R.jsxs)(Bt,{flexDirection:"column",children:[(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:" "}),(0,R.jsx)(_,{dimColor:!0,children:"NAME".padEnd(22)}),(0,R.jsx)(_,{dimColor:!0,children:"WINS".padEnd(7)}),(0,R.jsx)(_,{dimColor:!0,children:"STATUS".padEnd(8)}),(0,R.jsx)(_,{dimColor:!0,children:" LAST USED"})]}),Pt.map((gt,at)=>(0,R.jsxs)(Bt,{flexDirection:"column",marginBottom:1,children:[(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{children:ne.has(gt.name)?"\u2611":"\u2610"}),(0,R.jsx)(_,{children:Wt.has(gt.name)?"\u2605":" "}),(0,R.jsx)(_,{children:at===Lt?"\u25B8":" "}),(0,R.jsx)(_,{bold:!0,color:at===Lt?"cyan":gt.attached?"green":"white",children:(gt.name.length>20?gt.name.slice(0,17)+"...":gt.name).padEnd(22)}),(0,R.jsx)(_,{dimColor:!0,children:`${gt.windows} win${gt.windows!==1?"s":""}`.padEnd(7)}),(0,R.jsx)(_,{color:"yellow",children:gt.attached?"attached":" "}),(0,R.jsxs)(_,{dimColor:!0,children:[" ",AQ(gt.lastAttached)]})]}),gt.path&&(0,R.jsxs)(_,{dimColor:!0,children:[" ",gt.path.replace(process.env.HOME||"","~")]})]},gt.sessionId))]}),n&&(0,R.jsxs)(Bt,{marginTop:1,flexDirection:"column",children:[(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{dimColor:!0,children:"\u2191\u2193 select | \u21B5 attach | "}),(0,R.jsx)(_,{color:"green",bold:!0,children:"n"}),(0,R.jsx)(_,{dimColor:!0,children:" new | "}),(0,R.jsx)(_,{color:"yellow",bold:!0,children:"r"}),(0,R.jsx)(_,{dimColor:!0,children:" rename | "}),(0,R.jsx)(_,{color:"magenta",bold:!0,children:"c"}),(0,R.jsx)(_,{dimColor:!0,children:" config | "}),(0,R.jsx)(_,{dimColor:!0,children:"q quit | "}),(0,R.jsx)(_,{bold:!0,children:"h"}),(0,R.jsx)(_,{dimColor:!0,children:" help"})]}),(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{color:"cyan",bold:!0,children:"/"}),(0,R.jsx)(_,{dimColor:!0,children:" search | "}),(0,R.jsx)(_,{color:"yellow",bold:!0,children:"s"}),(0,R.jsx)(_,{dimColor:!0,children:" star | "}),(0,R.jsx)(_,{color:"cyan",bold:!0,children:"f"}),(0,R.jsx)(_,{dimColor:!0,children:" filter | "}),(0,R.jsx)(_,{color:"white",bold:!0,children:"R"}),(0,R.jsx)(_,{dimColor:!0,children:" refresh | "}),(0,R.jsx)(_,{color:"blue",bold:!0,children:"x"}),(0,R.jsx)(_,{dimColor:!0,children:" detach | "}),(0,R.jsx)(_,{color:"red",bold:!0,children:"d"}),(0,R.jsx)(_,{dimColor:!0,children:" delete | "}),(0,R.jsx)(_,{color:"white",bold:!0,children:"i"}),(0,R.jsx)(_,{dimColor:!0,children:" info"})]}),(0,R.jsxs)(Bt,{children:[(0,R.jsx)(_,{color:"white",bold:!0,children:"Tab"}),(0,R.jsx)(_,{dimColor:!0,children:" mark | "}),(0,R.jsx)(_,{color:"blue",bold:!0,children:"X"}),(0,R.jsx)(_,{dimColor:!0,children:" batch detach | "}),(0,R.jsx)(_,{color:"red",bold:!0,children:"D"}),(0,R.jsx)(_,{dimColor:!0,children:" batch kill"})]})]})]})}function lQ({onSelect:n,onCreate:u,onKill:s,onRename:f,onDetach:E,favoritesOnly:p}){return(0,R.jsx)(k_,{interactive:!!process.stdin.isTTY,favoritesOnly:p,onSelect:n,onCreate:u,onKill:s,onRename:f,onDetach:E})}function zm(n){process.stdout.write(`\x1B]0;[tmux] ${n}\x07`);let u=`'${n.replace(/'/g,"'\\''")}'`,s=process.env.TMUX?`tmux switch-client -t ${u}`:`tmux attach-session -t ${u}`;uQ(s,{stdio:"inherit"})}var Ha=process.argv.slice(2);function W_(){console.log(`
292
292
  tmuxtui - Terminal UI for tmux session management
293
293
 
294
294
  USAGE:
@@ -310,7 +310,7 @@ EXAMPLES:
310
310
  tmuxtui init Create session from current directory
311
311
  tmuxtui . Open current directory's tmux session
312
312
  tmuxtui --favorites Show only favorited sessions
313
- `)}(Ha[0]==="help"||Ha[0]==="-h"||Ha[0]==="--help")&&(W_(),process.exit(0));(Ha[0]==="version"||Ha[0]==="-v"||Ha[0]==="--version")&&(console.log("1.3.2"),process.exit(0));if(Ha[0]==="init"||Ha[0]==="-i"){let n=G2(process.cwd()),u=process.cwd();try{eQ(n,u),console.log(`${n} project has been added to tmuxtui`)}catch{console.error("Failed to create session. A session with the same name may already exist."),process.exit(1)}process.exit(0)}if(Ha[0]==="."){let n=G2(process.cwd());if(pr().find(f=>f.name===n))try{zm(n)}catch{process.exit(1)}else console.error(`Session "${n}" not found. Run \`tmuxtui init\` to create it first.`),process.exit(1);process.exit(0)}if(Ha[0]==="last"||Ha[0]==="-l"){let n=pr();n.length===0&&(console.error("No tmux sessions found"),process.exit(1));try{zm(n[0].name)}catch{process.exit(1)}process.exit(0)}if(Ha[0]==="update"){let n="1.3.2";console.log(`Current version: v${n}`);let u;try{u=uQ("npm view tmux-tui version",{encoding:"utf8"}).trim()}catch{console.error("Failed to check latest version. Please check your network connection."),process.exit(1)}n===u&&(console.log("Already up to date."),process.exit(0)),console.log(`Updating to v${u}...`);try{uQ("npm install -g tmux-tui@latest",{stdio:"inherit"})}catch{process.exit(1)}console.log(`Done. Updated to v${u}`),process.exit(0)}var P_=Ha.includes("--favorites")||Ha.includes("-F"),H2=Ha.filter(n=>n!=="--favorites"&&n!=="-F");H2[0]!==void 0&&(console.error(`Unknown argument: ${H2[0]}`),console.error('Use "tmuxtui -h" or "tmuxtui --help" for usage information.'),process.exit(1));var tE={session:null,newSession:null},$_=Zh(O2.default.createElement(lQ,{onSelect:n=>{tE.session=n},onCreate:(n,u)=>{eQ(n,u),tE.newSession=n},onKill:n=>{m2(n)},onRename:(n,u)=>{I2(n,u)},onDetach:n=>{h2(n)},favoritesOnly:P_}));await $_.waitUntilExit();try{tE.session?zm(tE.session.name):tE.newSession&&zm(tE.newSession)}catch{process.exit(1)}
313
+ `)}(Ha[0]==="help"||Ha[0]==="-h"||Ha[0]==="--help")&&(W_(),process.exit(0));(Ha[0]==="version"||Ha[0]==="-v"||Ha[0]==="--version")&&(console.log("1.3.3"),process.exit(0));if(Ha[0]==="init"||Ha[0]==="-i"){let n=G2(process.cwd()),u=process.cwd();try{eQ(n,u),console.log(`${n} project has been added to tmuxtui`)}catch{console.error("Failed to create session. A session with the same name may already exist."),process.exit(1)}process.exit(0)}if(Ha[0]==="."){let n=G2(process.cwd());if(pr().find(f=>f.name===n))try{zm(n)}catch{process.exit(1)}else console.error(`Session "${n}" not found. Run \`tmuxtui init\` to create it first.`),process.exit(1);process.exit(0)}if(Ha[0]==="last"||Ha[0]==="-l"){let n=pr();n.length===0&&(console.error("No tmux sessions found"),process.exit(1));try{zm(n[0].name)}catch{process.exit(1)}process.exit(0)}if(Ha[0]==="update"){let n="1.3.3";console.log(`Current version: v${n}`);let u;try{u=uQ("npm view tmux-tui version",{encoding:"utf8"}).trim()}catch{console.error("Failed to check latest version. Please check your network connection."),process.exit(1)}n===u&&(console.log("Already up to date."),process.exit(0)),console.log(`Updating to v${u}...`);try{uQ("npm install -g tmux-tui@latest",{stdio:"inherit"})}catch{process.exit(1)}console.log(`Done. Updated to v${u}`),process.exit(0)}var P_=Ha.includes("--favorites")||Ha.includes("-F"),H2=Ha.filter(n=>n!=="--favorites"&&n!=="-F");H2[0]!==void 0&&(console.error(`Unknown argument: ${H2[0]}`),console.error('Use "tmuxtui -h" or "tmuxtui --help" for usage information.'),process.exit(1));var tE={session:null,newSession:null},$_=Zh(O2.default.createElement(lQ,{onSelect:n=>{tE.session=n},onCreate:(n,u)=>{eQ(n,u),tE.newSession=n},onKill:n=>{m2(n)},onRename:(n,u)=>{I2(n,u)},onDetach:n=>{h2(n)},favoritesOnly:P_}));await $_.waitUntilExit();try{tE.session?zm(tE.session.name):tE.newSession&&zm(tE.newSession)}catch{process.exit(1)}
314
314
  /*! Bundled license information:
315
315
 
316
316
  react/cjs/react.production.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tmux-tui",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Terminal UI for tmux session management",
5
5
  "type": "module",
6
6
  "bin": {