+
    LRj+q                     H   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^RI	H
t
Ht ^RIHtHtHtHt ^RIHtHtHt ^RIHt ^RIHtHt ^RIHtHtHtHtHtH t H!t!H"t"H#t#H$t$H%t%H&t&H't'H(t(H)t)H*t*H+t+H,t, ^RI-H.t.H/t/H0t0H1t1H2t2H3t3 R	 t4R
 t5R t6R t7RR lt8RR lt9RR lt:R# )u)  sshj.run — the grid interaction loop (render/keys/insert).

B2 step 4c: moved verbatim from sshj_cli.py (single-file era) — no
behavior change, EXCEPT one path line: the sshj-relay lookup used
os.path.dirname(abspath(__file__)), which is the package dir in the
single-file era (src) but one level too deep inside the package now,
so it is os.path.dirname(os.path.dirname(...)) — the resolved path is
unchanged (src/sshj-relay). Owns the two-stage Tab input insertion
(TIOCSTI, then the relay fallback) and the run_inline key loop; pick()
is the thin entry the composition root (connect.main) calls. Edges:
ui (render/incoming_rows/_erase/scroll_feed_up/FLAG_TOGGLES), term
(Term/keys/anchor), state (Conns incoming), fuzzy (sort/visible),
identity, cmd (ssh_cmd_str preview), jsonio (last-used record).
N)ssh_cmd_strssh_cmd_str_typed)is_single_charkey_action_mapload_configresolved_keymap)SORT_LABELS
sort_hostsvisible_hosts)Identity)load_last_successrecord_last_used)ANCHORCSIK_BSK_CTRLK_DOWNK_ENDK_ENTERK_HOMEK_LEFTK_PGDNK_PGUPK_RIGHTK_TABK_UPTerm_GRID_BOTTOM_ROWcapture_anchorquery_cursor)FLAG_TOGGLESKEYMAP_eraseincoming_rowsrenderscroll_feed_upc                6   a  \        V 3R l\         4       4      # )u3  The default-key set for one KEYMAP action; a dispatch
`key in _keymap_keys("up")` is a table lookup, not a re-spelled
literal — the hint and the handler share one source of truth (SG1-6).
The CONFIG-merged sets are built per-run in run_inline (see
`_build_action_sets`), which is what actually dispatches.c              3   L   <"   T F  w  rr4VS8X  g   K  Vf   K  Vx  K  	  R # 5iN ).0k_aliasact_labelactions   &    src/sshj/run.py	<genexpr>_keymap_keys.<locals>.<genexpr>,   s,      9V11cv *+ QVs   $$
$)	frozensetr!   )r/   s   fr0   _keymap_keysr4   &   s      9V 9 9 9    c                    / p\        4       pV P                  4        F6  w  r4V F+  pW1V&   \        V4      '       g   K  VP                  V4       K-  	  K8  	  W3# )aQ  key -> action over the config-merged keymap (action -> [keys]).
Returns (action_of, single_char_actions): `action_of` maps a key to its
action (None if unbound); `single_char_actions` is the set of BOUND
single-character keys (the input-mode rule consults it: a bound
single-char key types instead of acting while the field has content).)setitemsr   add)kmap	action_ofsingler-   keysr+   s   &     r0   _build_action_setsr>   0   sT     IUFZZ\	AaLa  

1  "
 r5   c                D    VR8X  d   \        WV4      # \        WVRR7      # )u  The text a stage key places into the input line (two-stage: first
press stages, second commits). `form` == "alias" (right arrow): the
RUNNABLE command with the host's NAME — an ssh alias becomes exactly
`ssh <name>` (e.g. `ssh phone`), no `--`. `form` == "address" (tab):
the command with the NAME swapped for the ADDRESS (user@host:port) —
what the footer's right side shows (`ssh [flags] user@host:port`),
typed form (no `--` so it's runnable as placed). For a raw/discovered
target both forms agree (there is no alias).aliasT)resolved)r   )hstatuseff_argsforms   &&&&r0   _staged_commandrF   @   s'     w H55Q4@@r5   c                     ^ RI p\        P                  P                  4       pV P	                  4        F/  pVP
                  ! V\        P                  \        V.4      4       K1  	  R#   \         d     R# i ; i)u  Put `text` into the shell's input FIELD (an editable command line),
not onto the console — called AFTER the grid has left the terminal
(termios restored). TIOCSTI stuffs the characters into the tty's input
queue, so the shell's line editor (readline/zle) picks them up exactly
as if typed. Returns True on success; False where the kernel
refuses TIOCSTI (WSL2 >= 6.2, tmux) — the caller then tries the relay,
and only prints the command as a last resort.NTF)
fcntlsysstdinfilenoencodeioctltermiosTIOCSTIbytes	Exception)textrH   fdbs   &   r0   _insert_into_inputrU   N   s[    YYAKKGOOUA3Z8  s   A%A) )A87A8c           	        ^ RI pVP                  ! R4      ;'       g|    \        P                  P	                  \        P                  P                  \        P                  P                  \        P                  P                  \        4      4      4      R4      p\        P                  P                  V4      '       g   R# \        \        P                  4      pV'       d   \        V4      VR&    \        P                  ! \        P                  ! V4       R\        P                  ! V 4       2RVR7      pR#   \          d     R# i ; i)a3  TIOCSTI fallback for kernels that refuse it (WSL2 >= 6.2): run
`sshj-relay`, which spawns a child bash whose readline line is
prefilled with `text` under the REAL prompt (starship), editable;
Enter runs it, Ctrl-C discards. `grid_row` (the grid's last painted
row, 1-based) is passed so a discard erases only the child's
prompt+line. Returns True when the relay ran and the line was left
as the user left it (committed OR abandoned) so the caller does NOT
print; False only when the relay is missing or errors, then the
caller prints the command as a last resort.Nz
sshj-relayFSSHJ_RELAY_GRID_ROW T)shellenv)shutilwhichospathjoindirnameabspath__file__existsdictenvironstr
subprocesscallshlexquoterQ   )rR   grid_rowr[   relayrZ   rcs   &&    r0   _insert_via_relayrn   `   s     LL& S S"'',,
(ABC\+SE77>>%  
rzz
C%(]!"__E 231U[[5F4GH#'S2   s   1AD9 9EEc                  a aaaBaCaDaEaF \        4       p\        4       pR^ up	oD. ROp
RoFRoE\        4       p\        4       pVR,          pVR,          pRp\	        \        V4      4      w  pp\        4       pVVBVCVDVEVF3R lp^pRp^ pRpRpVV 3R lp VP                  4        VP                  4       w  pp\        ^\        \        S 4      ^4      4      p^V,           \        V4      ,           p\        R	,          e   \        R	,          MV^,
          p\        ^ \        VV^,
          4      4      pV^,           pVV,
          ^,           p \        ^ V\        ^ V 4      ,
          4      p!V!'       d   \        VV!4       \        ^VV!,
          4      p"VV3p#SP                  4        Ve   VP                  4        SP                  4        VP                  4        VP!                  4        VP                  4          VP                  4       w  ppVV3V#8w  d	   VV3p#R
pK%  V'       Ed   RpVP#                  \$         R24       R
p\'        RR7      p$V
^,          p%V$'       Ed-   V%'       Ed$   V$^ ,          ^,           p&V%w  p'p(p)^ p*\)        V'4       FF  w  p+p,V+V(8  d!   V*V,V,           ^,
          V,          ,          p*K-  V+V(8X  d   V*V)V,          ,          p*KF   M	  \        ^V&V*,
          4      p-^\        V4      ,           p\        ^ VVV-,
          ,
          4      p!V!'       d4   \        VV!4       \        ^V"V!,
          4      p.\        ^V-V!,
          4      p-MT"p.\        ^\        V.V-4      4      p/VP#                  \$         V/ R\$         R24       T-p"MVP#                  \$         R\$         R24       RV
^ &   V"^,
          p\+        \-        V! 4       WV4      V	4      oCSC'       g
   ^ oDV! 4       oCSD\        SC4      8  d   \        ^ \        SC4      ^,
          4      oDSP/                  SC U0u. uF  p0V0R,          NK  	  up04       V'       d?   V	'       g7   \        ^ \        \        SC4      ^,
          \1        V4      ^,
          4      4      oDSF'       d   SFp1MV'       d   V	'       g   Tp1MT	p1\        \        SC4      ^4      p2VV",
          ^,
          V
^,          ;'       g    ^ ,
          \        V4      ,
          p3V2V38  dV   V"^8  dO   \        V2V3,
          V"^,
          4      p4V4^ 8  d.   \        VV44       \        ^V"V4,
          4      p"V"^,
          pRV
^ &   \        ^\        \        SC4      ^VV",
          ^,
          V
^,          ;'       g    ^ ,
          \        V4      ,
          4      4      p5\3        \5        V4      4      \3        V4      ,           oB\7        VSCSDSV\8        P8                  ! 4       VVVV"V5WV1SBWm\:        V,          R7      w  p6p7p8p9\        VV74      pVP=                  R4      p:V:f   EK-  SF;'       g    T	;'       g    T'       * p;Rp<Rp=V:P?                  \@        4      '       dO   V:\B        9   dD   \B        V:,          p>V>V9   d   VPE                  V>4      MVPG                  V>4       RpV! 4        R
p<EMVPI                  V:4      p?V?RJ;'       d    \K        V:4      p@V@'       d   V;'       g   Rp?V?R 9   d   SC'       d   \        ^V^,          ^,
          4      pAV?R8X  d   \        ^ SD^,
          4      oDMV?R8X  d%   \        \        SC4      ^,
          SD^,           4      oDMbV?R8X  d   \        ^ SDXA,
          4      oDMGV?R8X  d%   \        \        SC4      ^,
          SDXA,           4      oDMV?R8X  d   ^ oDM\        SC4      ^,
          oDRpR
p=R
p<EMV?R8X  d   SF'       d   RoFMV	'       d   Rp	MV'       d   RpMV'       d   VPM                  4        M\O        VV"VVV4       VP#                  \$         V" R24       RSRR\Q        V4      3SPS                  4        Ve   VPS                  4        SPS                  4        VPS                  4        VPU                  4        # R
p<EMV?R8X  d   SF'       g   V	'       g	   V'       d   RRRuoFp	p\O        VV"VVV4       VP#                  \$         V" R24       RSRR\Q        V4      3SPS                  4        Ve   VPS                  4        SPS                  4        VPS                  4        VPU                  4        # V?R8X  d   SC'       d   \O        VV"VVV4       VP#                  \$         V" R24       SCSD,          SRR\Q        V4      3SPS                  4        Ve   VPS                  4        SPS                  4        VPS                  4        VPU                  4        # V?R!9   d   SC'       d   SF'       d   V"\V        ^ &   \O        VV"VVV4       VP#                  \$         V" R24       SCSD,          SRSF\Q        V4      3SPS                  4        Ve   VPS                  4        SPS                  4        VPS                  4        VPU                  4        # V?R8X  d   RMRoE\Y        SCSD,          SPZ                  PI                  SCSD,          R,          4      SBSE4      oFRRp	pR
p<MrV?R8X  d6   WP]                  V4      ^,           \        V4      ,          ,          p^ oDR
p=R
p<M6V:\^        8X  d,   SF'       d   SFRR" oFMV	'       d   V	RR" p	MV'       d   VRR" pR
p<V<'       gu   \        V:4      ^8X  d8   V:Pa                  4       '       d"   SF'       d   SFV:,          oFMVV:,           R#R pR
p<M-V:Pc                  4       '       d   SF'       d   RoFRpV	V:,          p	R
p<V='       g   E	K  SD\        SC4      8  g   E	K  V! 4        E
K  u up0i   SPS                  4        i ; i  Te   TPS                  4        SPS                  4        TPS                  4        TPU                  4        i ; i)$uV  Main loop on the PRIMARY screen. Returns
(host, checker, mode, text): mode 'connect' (host chosen), 'quit'
(None), or 'insert' (host chosen, text = the command to leave in the
shell's input field — tab with the command in the field; main() stuffs
it via TIOCSTI after term.leave(), printing it where the kernel
refuses TIOCSTI (WSL2/tmux)). Nr@   keymapsortc                    < S'       dI   S'       d?   \        SS,          S P                  P                  SS,          R,          4      SS4      oR# R# R# )u   Re-stage a staged command for the current selection (same form)
after a move or a flag toggle — a staged command FOLLOWS the
selection.r@   N)rF   rC   get)checkerrD   rowssel
stage_formtab_cmds   r0   _restagerun_inline.<locals>._restage   sA    
 t%d3i&-nn&8&8c79K&L&.
<G 7r5   Fc                  2   < SS P                  4       ,           # r(   )snapshot)	discoveryhostss   r0   	all_hostsrun_inline.<locals>.all_hosts   s    y))+++r5   rowTz0m[?25lg      ?)timeoutz;1HJH)r:   
sort_labelg?updownpage_uppage_dnhomequitleftconnectstage_aliasinsertaddress)N    NNNN)lastlast_successalpha)r   r   r   r   r   end)r   stage_address)2r   r   r7   r   r>   r   r   entersizemaxminlenr#   r   r%   start
load_cacheputr   r   	enumerater
   r	   reprioritizeinttuplesortedr$   timer   read_key
startswithr   r    discardr9   rt   r   clearr"   r3   stopleaver   rF   rC   indexr   isdigitisprintable)Gr   	last_usedru   r~   conns
extra_args
speed_scantermidentquerydrawntoggle_flags_cfg	kmap_syms	sort_mode
sort_modesr;   single_char_actionsr   rz   input_offsetdigits
max_extentresize_pendingcursor_hiddenr   hgtwdtk_openr   arow
top_wantedavailStop	prev_sizeposmetarlensiidxk0WiLnew_topold_top	wipe_fromrB   displaydesiredfreenkk_
footer_row	input_rowcur_colkeyfield_emptyhandledmovedflr-   single_boundhalfrD   rv   rw   rx   ry   sG   f&ff&&&                                                           @@@@@r0   
run_inliner   z   s
    6DJEQJE3-E GJ5L =DXIVI2J%7	"&$"I"$&L< < LFJNM,]

99;S QCJ+,Ju-- &u 9ve}sQw1c$a() AX
j 1$1s1e}$%4#!Z!^$#J	!p	99;S :*!$c
I%)N!>%*N4 HHuK01$(M&s3C 8DsttFQJ)-dB$-dODAq 4x !a#gkc%9 9!"d !R3Y % %4 #&aQ-
 e 441g#67*43&)!S1WoG&)!Wq[&9G&)G %(3w+@$A	C53se1!=>% C5#a1#E!H!$qJ$y{I+-.35 C$;D#d)#aTQ/C$$$%?$Qajj$%?@ %aSY]CK!O!DEC %GE$G#G c$i,Sy1}aA6u9MMT>cAgGdNC!G4A1u&tQ/!!S1Wo%(1W
#'aCD	2 #c	AqQ ?"/"6!78 9& !!56z9JJ4:$Wtyy{Ec2uWh*95571:y' !Z8
mmC(; $+#=#=e#=#=v>>>&))c\.A%c*B02l0BL((,)--b1FJ"G#--,C $'d?#J#J~c7JL#K" . .26"1sax1n5$;"%aq/C F]"%c$i!mS1W"=C I-"%at"4C I-"%c$i!mS4Z"@C F]"#C"%d)a-C!# $"& #&(G"$&E#%'F)(..0"4j#sC HHuSE%56#'&" ), 7$8h LLN!OO



q #' #ev57R2GUFtS*c3?C5S!12#Wfb%l3 4N LLN!OO



W 	)dtS*c3?C5S!12#Cy'9b%l3 4D LLN!OO



M  @@T #25,Q/"4j#sC HHuSE%56#'9gx ), 7$8f LLN!OO



o 14}0DW!* #"1$s)29..2D2D6:3i6H3J2:J#H )+B"& %/0@0@0K23147::0G %H	 $"&"&-crlG"$)#2JE#%+CR[F"&3x1}"#sNG&,slBC%8F"&**
 #&(G!#"&5S3t9_
 Ja &@d LLN!OO



sN  E"p 3-p  !Ap  $F8p  o;.p  =p  =p  
p  p  8p  Ep  )	p  3&p  A)p  p  p   p  1Cp  

p  
p   
p  +A	p  4p p 	p  p  $p  ,?p  +p >p  p  ?p  p !p #p  2p  :Ap  p p Bp  4p  p  p  %p  p  .p  <p  p  p  1p   pp Aqc           	         \         P                  ! 4       pVP                  VP                  rV^8  g   V	^28  d9   \        RV	 RV R2\        P                  R7       \        P                  ! ^4       \        4         \        WW#VWV4      #   \         d    ^^Pr Loi ; i  \         d    RRRR\        4       3u # i ; i)zReturns (host, checker, mode, text). mode: 'connect' (enter),
'insert' (tab staged the command, then enter: leave the command in the
shell's input field; text = the command) or 'quit' (esc/ctrl-c -> None).zsshj: terminal too small (x))fileNr   rp   )r]   get_terminal_sizelinescolumnsOSErrorprintrI   stderrexitr   r   KeyboardInterruptr3   )
r   r   ru   r~   r   r   r   r   r   r   s
   &&&&&&&   r0   pickr     s    
##%::t||S Qw#(*3%qQ7cjjI
3%G$2 	2  rS  3T62y{223s#   ,B ?B! BB!B>=B>)rp   )r)   N);__doc__rH   r]   ri   r[   rg   rI   rN   r   cmdr   r   configr   r   r   r   fuzzyr   r	   r
   identityr   lastusedr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   uir    r!   r"   r#   r$   r%   r4   r>   rF   rU   rn   r   r   r)   r5   r0   <module>r      s     	    
   /% % 9 9  94 4 4 4 4 9 A$4Wt3r5   