+
    Q(imm                        ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIHtHtHt ^ RI	H
t
 ^ RIHt ^ RIHtHtHtHt ^ RI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" ^ R
I#H$t$H%t% ^ RI&H't' ^ RI(H)t)H*t* ]PV                  R-8  d   M ]'       d   ^ RI,H-t- ]! ]'RR7      t. ! R R]4      t/R R lt0R R lt1RRRR/R R llt2R R lt3R R lt4RRR R/R! R" llt5R# R$ lt6R% R& lt7R' R( lt8R) R* lt9RR/R+ R, llt:R# ).    N)CallableIterableSequence)suppress)partial)TYPE_CHECKINGAny
NamedTuple
get_origin)_bool)resolve_optional)ArgumentArgumentCollection)	ArgumentOrderErrorCoercionErrorCombinedShortOptionErrorConsumeMultipleErrorCycloptsErrorMissingArgumentErrorRequiresEqualsErrorUnknownOptionErrorValidationError)POSITIONAL_ONLYPOSITIONAL_OR_KEYWORD)Token)UNSETis_option_like)Groupcli)sourcec                   8   a  ] tR t^)t o Rt    V 3R ltRtV tR# )_KeywordMatchz?Represents a matched CLI token with its corresponding argument.c                ^   < V ^8  d   Qh/ S[ ;R&   S[;R&   S[S[ R3,          ;R&   S[;R&   # )   matched_tokenargument.keysimplicit_value)strr   tupler	   )format__classdict__s   "S/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/cyclopts/bind.py__annotate___KeywordMatch.__annotate__)   sA          S/        N)__name__
__module____qualname____firstlineno____doc____annotate_func____static_attributes____classdictcell__)r,   s   @r-   r"   r"   )   s$     I J ' . =  r0   r"   c                    V ^8  d   QhRR\         ,          \        \         ,          ,          R\        \         ,          /# )r$   tokensNreturn)r)   r   list)r+   s   "r-   r.   r.   9   s+      TCZ(3-7 DI r0   c                     V f   \         P                  R,          p V # \        V \        4      '       d   \        P
                  ! V 4      p V # \        V 4      p V # )N   NN)sysargv
isinstancer)   shlexsplitr=   )r;   s   &r-   normalize_tokensrF   9   sO    ~"
 M	 
FC	 	 V$ M fMr0   c                >    V ^8  d   QhR\         \        R3,          /# )r$   r<   .)r*   r)   )r+   s   "r-   r.   r.   C   s      eCHo r0   c           	      \   V '       g   R# V ^ ,          P                   pV R,           F  pVP                   '       g   Ru # \        \        WP                   RR7      4       F,  w  pw  rEWE8w  g   K  V^ 8X  d   Ru u # VP                   RV p M	  VR\        VP                   4       pK  	  V# )r   r?   F)strictNr1   )r'   	enumerateziplen)argument_collectioncommonr&   i
common_keyargument_keys   &     r-   _common_root_keysrR   C   s    	 #((F'++}}}I-6s6==Y^7_-`)A)
)6I!r* .a ,#hmm,- , Mr0   end_of_options_delimiter--stop_at_first_unknownFc                    V ^8  d   QhR\         R\        \        ,          R\        R\        R\        \
        \        ,          \        R,          3,          /# )r$   rM   r;   rS   rU   r<   N)r   r   r)   boolr*   r=   int)r+   s   "r-   r.   r.   U   sW     b6 b6+b6SMb6 "	b6
  b6 49cDj !b6r0   c               2   . . rT. p^ pV'       d    VP                  V4      pWR pVRV p\        V4       EF  w  rV^ 8  d   V^,          pK  \        V
RR7      '       gg   V'       d;   VP	                  WR 4       VP	                  \        V	\        V4      4      4        EM:VP                  V
4       VP                  V	4       K  . p^ pV
P                  R4      ;'       d    V
P                  R4      '       * pRV
9   dD   V
P                  R^4      w  r V P                  V4       VP                  V4       V^,          pRpMT
p. pRp VP                  \        V.V P                  V4      O5!  4       \        T4       EFR  w  ppTe)   T\        T4      ^,
          8X  d   TP                  T4       TP                   P                  P                  '       d3   TP                   P                  \#        TP$                  ^R7      4       K  TP&                  \        JEd   T'       d    \)        TR,          4      pT'       d>   TP                   P                  \#        TP$                  TP&                  R7      4       EK   \/        TP&                  \0        4      '       dC   TP                   P                  \#        TP$                  TP&                  '       * R7      4       EKb  EKe  TP                   P                  \#        TP$                  TP&                  R7      4       EK  \        T4      ^8  d)   \3        R
 T 4       4      pT^8  d   \5        RT 2R7      hTP                   P7                  TP8                  4      w  pp TP                   P                  P:                  '       dK   TP$                  P                  R4      '       d*   T'       g"   \=        TP                   TP$                  R7      hTP                   P                  P>                  p!T!e   \/        T!\@        4      '       g   Q hT!e   T!MRw  p"p#\C        \D        4      ;_uu_ 4        T '       d   T!e   \F        P                  ! 4        Fm  p$Y^,           T$,           ,          p
TP                   P                  PH                  '       g   \        T
4      '       d    EM%TP                  T
4       T^,          pKo  	  EMTT,          p\        T4       F  p$\        T4      ^8X  dR   TP                   PK                  T4      '       g-   TP                   PM                  TTP8                  4      '       d   ^p MY^,           T$,           ,          p
TP                   P                  PH                  '       g4   \        T
4      '       d#   \O        TP                   TTP$                  R7      hTP                  T
4       T^,          pK  	  RRR4       T'       g   T '       d   T!e   T"^ 8  d&   \Q        TP                   TTP$                  T"T#^ R7      h\S        TP                   PT                  4      p%\W        T%4      ;'       g    T%! 4       p&TP                   P                  \#        TP$                  T&TP8                  R7      4       EK)  \O        TP                   TTP$                  R7      h\        T4      T,          '       d#   \O        TP                   TTP$                  R7      hT!ey   \        T4      \Y        ^T4      ,          p'T'T"8  d&   \Q        TP                   TTP$                  T"T#T'R7      hT#e-   T'T#8  d&   \Q        TP                   TTP$                  T"T#T'R7      h\        T4       FB  w  p(pTP                   P                  \#        TP$                  TT(TP8                  R7      4       KD  	  EKU  	  EK  	  Rp)\        ^\        V4      4       F*  p$VV$,          VV$^,
          ,          ^,           8w  g   K(  T$p) M	  VP	                  V4       VV)3#   \         d     ELi ; i  \         d    T
p ELi ; i  \         Ed    T'       Edk   \        T
4      ^8  EdZ   \        T
RR7      '       EdF   TP                  R4      p^ pT\        T4      8  Ed   TT,          pRT 2p T P                  T4      w  pppT\        Jg   TP                  P                  '       d)   TP                  \        TTTT4      4       T^,          pK  TT^,           R pTP                  \        TTTT4      4       T'       d   TpT^,          pMc  \         dV    T'       d   TP	                  YR 4       TR3u u u # TP                  T4       TP                  T	4       T^,          p EK  i ; iT'       g    E	K   ELfT'       d   TP	                  YR 4       TR3u u # TP                  T
4       TP                  T	4        E	K  i ; i  \*         dO   pTP,                  f   \#        TP$                  R	7      Tn        TP                   f   TP                   Tn        h Rp?ii ; i  + '       g   i     EL; i)a  Extract keyword arguments and flags from the token stream.

Returns
-------
unused_tokens: list[str]
    Tokens not consumed by any keyword or flag.
contiguous_positional_count: int | None
    Number of leading contiguous non-option tokens before the first gap
    caused by keyword extraction. ``None`` if all non-option tokens are
    contiguous (i.e. no keywords were interleaved among positional tokens).

    For example, given ``a b c --bar 8 --baz 10 d``, the unused tokens are
    ``['a', 'b', 'c', 'd']`` with original indices ``[0, 1, 2, 6]``.
    The gap between indices 2 and 6 yields ``contiguous_positional_count=3``.
    This is used by ``_parse_pos`` to prevent positional-only list parameters
    from consuming tokens that appeared after keyword arguments.
NT)allow_numbers-rT   =F)keywordr(   )r]   c              3      "   T FD  qP                   \        J g   K  VP                  P                  P                  '       d   K@  ^x  KF  	  R# 5i)r@   N)r(   r   r&   	parametercount).0ms   & r-   	<genexpr>&_parse_kw_and_flags.<locals>.<genexpr>  s7      -#*a.>.>%.GPQPZPZPdPdPjPj7s   A#A
Az6Cannot combine multiple value-taking options in token )msg)r&   r]   )r&   tokens_so_farr]   )r&   rf   r]   min_requiredmax_allowedactual_count)r]   r(   r'   )r]   valueindexr'   )r   N)-rk   
ValueErrorrJ   r   extendrangerL   append
startswithrE   matchr"   lstripr   r_   r`   r&   CliTokenr%   r(   r   r   tokenrC   rW   sumr   token_countr'   requires_equalsr   consume_multipler*   r   
IndexError	itertoolsallow_leading_hyphen_should_attempt_json_dict_should_attempt_json_listr   r   r   hintr   max)*rM   r;   rS   rU   unused_tokenspositional_only_tokensunused_token_original_indicesskip_next_iterationsdelimiter_indexrO   ru   
cli_valuesconsume_countallow_combined_flags
cli_option	cli_valuematchesattached_valuecharspositionchar	test_flagargr'   implicit	remaindermatch_indexrr   coerced_valueevalue_taking_counttokens_per_elementconsume_all	cm_boundscm_mincm_maxjr   empty_container
n_elementsrk   contiguous_positional_counts*   &&$$                                      r-   _parse_kw_and_flagsr   U   s-	   0 -/)/1!	.$ll+CDO &,,<%=",_-Ff%!# A% e488$$$VBZ0-44U1c&k5JK  ')003 "
  %//4SSU=M=Md=S9S %<$)KKQ$7!J	##))*5!!),"',$ J')%)5	NN=\6I6O6OPZ6[\]j #,G"4K )kS\A=M.M!!.1~~''---%%hu7J7J[\&]^%%U2(-jn(= %--$U-@-@QVQeQef &e&:&:DAA!NN11 (1D1DY^YmYmUm n !NN))(5;N;N_d_s_s*tu w<!#), -#*- *& *A-6"XYcXd e  38..2L2LUZZ2X/"K>>++;;;@S@S@^@^_c@d@dmw-!& % 3 3  "NN44EE	 (Jy%,H,HHH.7.Cj))"y'<!*!2A$*q519$5E#(>>#;#;#P#P#PUcdiUjUj %&--e40A50 "3 &);;!&}!5A":!3 % H H T T#(>>#K#KJX]XbXb#c#c56 2 !&$*q519$5E#(>>#;#;#P#P#PUcdiUjUj&:-2^^2<,1,?,?'" !"
 '--e40A50% "6 *< ""y'<!A:"6)..8(-(;(;-3,2-.#   00C0CD+5d+;+C+Ct+C*F--$U-@-@Q`glgqgqr
 3%*^^:W\WjWj  _'999.!&zSXSfSf 
 !,%(_A?Q8R%R
%."6)..8(-(;(;-3,2-7#  "-*v2E"6)..8(-(;(;-3,2-7#  -6j,A(y--$U-@-@	Y^ejeoeop -Ba #5 &p /31c789(+/LQQRU/SVW/WW*+' :
 /0555I  		J  # #
#  3	 $#E
Q>%_d;e;e #))#.U+ ?D"#D6
I&.A.G.G	.R+T8#50CMM4G4G4G#NN=Cx+XY$MH ).hln(=I#NN=Cx+XY( 2; - 2!% &0)00<#0$#66%,,Y75<<Q? A&   )!((4($..$$U+-44Q7g3	B ) 77?&.u7J7J&KAG::-).AJb *))s   `7 -a	+a*h)Cj	.+j	Bj	7aa	aah&2Ah&
:e*&e*+h&-<e*)h&*g
=g
h&+g
h&	g


h&h&$h&?"h&%h&)j4A	i==jjc                <    V ^8  d   QhR\         R\        R\        /# )r$   rM   starting_indexr<   )r   rX   )r+   s   "r-   r.   r.   z  s$      =O ad il r0   c                 <   ^ p\         P                  ! 4        Fm  p V P                  W,           4      w  p pTP                  P
                  \        Jd    T# TP                  4       w  rgT'       d   \        R4      hY&,          pKo  	  V#   \         d      T# i ; i)r   z1Cannot have 2 all-consuming positional arguments.)r{   r`   rr   rm   
field_infokindr   rw   )rM   r   n_tokens_to_leaverO   r&   _future_tokens_per_elementfuture_consume_alls   &&      r-   #_future_positional_only_token_countr   z  s    __	066~7IJNHa ##?:
 	 9A8L8L8N5!PQQ6    	 	s   BBBc          	          V ^8  d   QhR\         \        ,          R\        R\        \        \        \        3,          ,          /# )r$   r;   rS   r<   )r   r)   r=   r*   rW   )r+   s   "r-   r.   r.     s9     , ,(3- ,SV ,[_`efikofo`p[q ,r0   c                      V P                  V4      pV R V  Uu. uF  q3R3NK  	  upW^,           R   Uu. uF  q3R3NK  	  up,           # u upi u upi   \         d    T  Uu. uF  q3R3NK  	  Mu upi upu # i ; i)NFT)rk   rm   )r;   rS   r   ts   &&  r-   _preprocess_positional_tokensr     s    , ,,'?@$*+;O$<=$<qE
$<=TZmn[n[pTq@rTqqTTq@rrr=@r ,$*+FqE
F++,s8   A A
A AA 

A A;#A0/	A;:A;r   c                    V ^8  d   QhR\         R\        \        ,          R\        R\        R,          R\        \        ,          /# )r$   rM   r;   rS   r   Nr<   )r   r=   r)   rX   )r+   s   "r-   r.   r.     sM     ^7 ^7+^7I^7 "	^7
 "%t^7 
#Y^7r0   c          	        . pV'       g   . # \        W4      p\        P                  ! 4        EFb  p V P                  V4      w  p pTP
                  P                  \        J d   TP                  '       d3   TP                  ^ ,          P                  e   TP                  T4       K|  T'       dj   T^ ,          p	TP                  P                  '       g)   \        T	4      '       d   \        \        T	R7      T R7      h\!        TTT^ ,          ^ ,          R7      hTP#                  4       w  r\%        ^T
4      p
T'       dR   TP
                  P                  \&        J d4   \)        Y^,           4      pTe   \%        T\+        T4      T,
          4      pM^ p. p\+        T4      T,
          ^ 8  d   \+        T4      T,
          T
8  d$   \-        TT Uu. uF  q^ ,          NK  	  upR7      h\/        TRT
 4       Fp  w  pw  p	pT'       gE   TP                  P                  '       g)   \        T	4      '       d   \        \        T	R7      T R7      hTP                  \        YR7      4       Kr  	  YZR pT'       d   K   YP                  R&   T'       d   EKc   M	  V Uu. uF  q^ ,          NK  	  up#   \         d      K'  i ; iu upi u upi )a!  Assign positional tokens to positional parameters.

Parameters
----------
argument_collection: ArgumentCollection
    Arguments whose keyword/flag tokens have already been consumed.
tokens: list[str]
    Unused tokens from ``_parse_kw_and_flags``.
end_of_options_delimiter: str
    Delimiter after which all tokens are forced positional.
contiguous_positional_count: int | None
    If not ``None``, the number of leading contiguous positional tokens
    that were adjacent in the original CLI input (before keyword extraction
    created a gap). Used to cap how many tokens a ``POSITIONAL_ONLY``
    list/iterable parameter may consume, preventing it from greedily
    swallowing tokens that originally appeared after keyword arguments.
    See ``_parse_kw_and_flags`` for how this value is computed.
N)rj   )ru   rM   )r&   9prior_positional_or_keyword_supplied_as_keyword_argumentsru   )r&   rf   )rj   rk   :Nr   N)r   r{   r`   rr   rm   r   r   r   r;   r]   rp   r_   r|   r   r   rt   r   rw   r   r   r   rL   r   rJ   )rM   r;   rS   r   r   tokens_and_force_positionalrO   r&   r   ru   r   r   r   
new_tokensxrk   force_positionals   &&$$             r-   
_parse_posr     s   2 AC=	"?"a__	066q9NHa ##'<<8??1#5#=#=#IIPPQYZHq	))>>>>RWCXCX -8%3H^qrr,!) SL9!<Q?  +3*>*>*@' $678..33F !DDW]^Y^ _ +6$'%s+F'GJe'e%! !"
./2CCqH/03DDHZZ*%1L"M1LAQ441L"M 
 5>>YZm[m>n4o00/'0B0B0W0W0W\jkp\q\q,8%3H^qrr!!("DE 5p +FFY*Z';(**y | 665QaDD566w  		Z #N 7s   J,J?K,J<;J<c                $    V ^8  d   QhR\         /# r$   rM   r   )r+   s   "r-   r.   r.     s      $6 r0   c           
      P   V  F  pVP                   '       d   K  VP                  P                  f   Q hVP                  P                   FB  p \        P                  V,          pVP                   P                  \        W#RR7      4        K  	  K  	  R #   \         d     KZ  i ; i)Nenv)r]   rj   r    )r;   r_   env_varosenvironrp   r   KeyError)rM   r&   env_var_nameenv_var_values   &   r-   
_parse_envr     s    '???!!))555$..66L "

< 8 &&u\_d'ef 7 (  s   BB%$B%c                0    V ^8  d   QhR\         R\        /# )r$   rM   func)r   r   )r+   s   "r-   r.   r.     s     	 	+	
	r0   c                    \         P                  ! V4      P                  4       pV P                   FF  pVP                  \
        Jg   K  VP                  VP                  VP                  P                  &   KH  	  V# )z+Bind the mapping to the function signature.)	inspect	signaturebind_partial_root_argumentsrj   r   	argumentsr   name)rM   r   boundr&   s   &&  r-   _bindr     s^    
 d#002E'77>>&8@EOOH//445 8 Lr0   c                $    V ^8  d   QhR\         /# r   r   )r+   s   "r-   r.   r.     s     $ $(: $r0   c                 (    V F  pV! V 4       K  	  R # Nr1   )rM   configsconfigs   && r-   _parse_configsr     s    "# r0   c                T    V ^8  d   QhR\         \        R\        3,          ,          /# )r$   r<   r   )r=   r*   r   )r+   s   "r-   r.   r.     s#     ? ?U7<N3N-O(P ?r0   c                ,   / p\        \        V P                  R R7      4       F9  w  r#V P                  VR7      p\	        V4      pW4P                  VR7      3WV3&   K;  	  \        VP                  4       RR7       UUu. uF  w  rgVNK	  	  upp# u uppi )zSort groups into "deepest common-root-keys first" order.

This is imperfect, but probably works sufficiently well for practical use-cases.
c                     V P                   # r   )r   )r   s   &r-   <lambda>_sort_group.<locals>.<lambda>  s    qvvr0   )key)group)keys_prefixT)reverse)rJ   sortedgroups	filter_byrR   items)rM   outrO   r   group_argumentscommon_root_keysr   gas   &       r-   _sort_groupr     s    
 Cf%8%?%?EUVW-77e7D,_=&+-F-FSc-F-d%eq!"	 X
 #399;=>=51B=>>>s   ?Bc                    V ^8  d   QhR\         R\        R\        \        ,          R\        \         ,          R\        R\
        \        P                  \        \        ,          3,          /# )r$   r   rM   r;   r   rS   r<   )r   r   r=   r)   r   r*   r   BoundArguments)r+   s   "r-   r.   r.   $  si     B  B 
B +B  IB  h	B  "B  7!!49,-B r0   c                  Tp \        WVR7      w  rV\        VVVVR7      p\        V4       \        W4       VP	                  4        \        V4      p V F   w  rVP                   F  p
V
! V	4       K  	  K"  	  T Fg  pTP                  '       g   K  TP                  P                  '       g   K5  TP                  '       d   KI  TP                   '       d   K]  \#        TR7      h	  \%        Y4      pY3#   \        \        \        3 d9   p\        TP                  '       d   TP                  ^ ,          MRXR7      ThRp?ii ; i  \&         d   pY+n        Y[n        h Rp?ii ; i)aT  Parse and coerce CLI tokens to match a function's signature.

Parameters
----------
func: Callable
    Function.
argument_collection: ArgumentCollection
tokens: list[str]
    CLI tokens to parse and coerce to match ``f``'s signature.
configs: Iterable[Callable]
end_of_options_delimiter: str
    Everything after this special token is forced to be supplied as a positional argument.

Returns
-------
bound: inspect.BoundArguments
    The converted and bound positional and keyword arguments for ``f``.

unused_tokens: list[str]
    Remaining tokens that couldn't be matched to ``f``'s signature.
)rS   )rS   r    )exception_messager   N)r&   )r   r   r   r   _convertr   	validatorAssertionErrorrm   	TypeErrorr   argsparser   requiredr'   
has_tokensr   r   r   root_input_tokensr   )r   rM   r;   r   rS   r   r   groups_with_argumentsr   r   r   r   r&   r   s   &&&&$         r-   create_bound_argumentsr   $  sK   : M!5HIa6
2 #%=(C	
 	&'*4$$& +,? @	e*?&!&Io. "1 +@ ,H ~~~("5"5">">">x}}}]e]p]p]p*H==	 , )0  
I6 	e!AFF1IRW\]cdd	e  $'sT   AE &C5 :E E 1E E E 5E3D>>EE E#EE#)      );r   r{   r   rD   rA   collections.abcr   r   r   
contextlibr   	functoolsr   typingr   r	   r
   r   cyclopts._convertr   cyclopts.annotationsr   cyclopts.argumentr   r   cyclopts.exceptionsr   r   r   r   r   r   r   r   r   cyclopts.field_infor   r   cyclopts.tokenr   cyclopts.utilsr   r   version_infocyclopts.groupr   rt   r"   rF   rR   r   r   r   r   r   r   r   r   r   r1   r0   r-   <module>r     s      	  
 8 8   = = # 1 :
 
 
 G   0g $5'=J = $b6 %)	b6
 #(b6J	 ,^7 %)	^7
 /3^7B 	$?B  %)B  B r0   