+
    ~j$              	      *   ^ RI Ht ^ RIt^ RIHtHt ^ RIHt ^RIH	t	 RR/R R llt
]R	RR
RRR/R R ll4       t]R	RR
R/R R ll4       tR	RR
RRR/R R llt]R	RR
RRRRR/R R ll4       t]R	RR
RRR/R R ll4       tR	RR
RRRRR/R R lltR# )    )annotationsN)Literaloverload)rtc)ATTRIBUTE_AGENT_NAME
agent_namec               $    V ^8  d   QhRRRRRR/# )   roomrtc.Roomr   
str | Nonereturnrtc.RemoteParticipant )formats   "u/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/livekit/agents/utils/participant.py__annotate__r      s-     9J 9J
9J 9J 	9J    c                 aaa"   V P                  4       '       g   \        R4      h\        P                  ! 4       oR V3R lloR VV3R llpR VV3R llpR V3R	 llpV P	                  R
V4       V P	                  RV4       V P	                  RV4        V P
                  P                  4        FK  pS! V4      '       g   K  Vu V P                  R
V4       V P                  RV4       V P                  RV4       # 	  SG Rj  xL
 V P                  R
V4       V P                  RV4       V P                  RV4       #  L:  T P                  R
T4       T P                  RT4       T P                  RT4       i ; i5i)a]  
Wait for an agent participant to join the room.

Args:
    room: The room to wait for the agent in.
    agent_name: If provided, waits for an agent with matching lk.agent.name attribute.
               If None, returns the first agent participant found.

Returns:
    The agent participant.

Raises:
    RuntimeError: If the room is not connected.
room is not connectedc                    V ^8  d   QhRRRR/# )r
   pr   r   boolr   )r   s   "r   r   $wait_for_agent.<locals>.__annotate__#   s     D D. D4 Dr   c                   < V P                   \        P                  P                  8w  d   R # Sf   R# V P                  P                  \        4      S8H  # )FT)kindr   ParticipantKindPARTICIPANT_KIND_AGENT
attributesgetr   )r   r   s   &r   matches_agent%wait_for_agent.<locals>.matches_agent#   sB    66S((???|| 45CCr   c                    V ^8  d   QhRRRR/# r
   r   r   r   Noner   )r   s   "r   r   r   *   s      $9 d r   c                z   < S! V 4      '       d,   SP                  4       '       g   SP                  V 4       R # R # R # Ndone
set_result)r   futr!   s   &r   on_participant_connected0wait_for_agent.<locals>.on_participant_connected*   s,    CHHJJNN1 %/r   c               $    V ^8  d   QhRRRRRR/# )r
   changedz	list[str]r   rtc.Participantr   r%   r   )r   s   "r   r   r   .   s!      y _  r   c                   < \        V\        P                  4      '       d<   S! V4      '       d,   SP                  4       '       g   SP	                  V4       R # R # R # R # r'   )
isinstancer   RemoteParticipantr)   r*   )r/   r   r+   r!   s   &&r   on_attributes_changed-wait_for_agent.<locals>.on_attributes_changed.   sC    a..//M!4D4DSXXZZNN1 NX4D/r   c                    V ^8  d   QhRRRR/# r
   stateintr   r%   r   )r   s   "r   r   r   2   s     e e3 e4 er   c                   < V \         P                  P                  8X  d5   SP                  4       '       g   SP	                  \        R 4      4       R# R# R# )z5room disconnected while waiting for agent participantNr   ConnectionStateCONN_DISCONNECTEDr)   set_exceptionRuntimeErrorr8   r+   s   &r   on_connection_state_changed3wait_for_agent.<locals>.on_connection_state_changed2   ?    C''999#((**l+bcd CM9r   participant_connectedparticipant_attributes_changedconnection_state_changedN)isconnectedr?   asyncioFutureonremote_participantsvaluesoff)r   r   r,   r4   rA   r   r+   r!   s   &d    @@r   wait_for_agentrN      s[    & 233181ACD D  e e 	GG#%=>GG,.CDGG&(CD
J))002AQ 	(*BC13HI+-HI 3 y(*BC13HI+-HI	 (*BC13HI+-HIsB   BE?(E E 	7E? E EE 7E?E 8E<<E?identityr   include_localFc          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r
   r   r   rO   r   r   Jlist[rtc.ParticipantKind.ValueType] | rtc.ParticipantKind.ValueType | NonerP   Literal[False]r   r   r   )r   s   "r   r   r   H   s=        
    U	 
 "   r   c                  "   R # 5ir'   r   r   rO   r   rP   s   &$$$r   wait_for_participantrV   G   s
          c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r
   r   r   rO   r   r   rR   rP   Literal[True]r   r0   r   )r   s   "r   r   r   R   s=      
  U	
 ! r   c                  "   R # 5ir'   r   rU   s   &$$$r   rV   rV   Q   s
      rW   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r
   r   r   rO   r   r   rR   rP   r   r   r0   r   )r   s   "r   r   r   [   sD     7K 7K
7K 7K U	7K
 7K 7Kr   c               l  aaaa	"   V P                  4       '       g   \        R4      h\        P                  \        P
                  ,          ! 4       oR V3R llo	R VVV	3R llpR V3R llpV P                  RV4       V P                  R	V4        V'       dV   V P                  pSe   VP                  S8X  d5   S	! V4      '       d'   VV P                  RV4       V P                  R	V4       # V P                  P                  4        FL  pVP                  \        P                  P                  8X  d	   V! V4       SP                  4       '       g   KL   M	  SG R
j  xL
 V P                  RV4       V P                  R	V4       #  L(  T P                  RT4       T P                  R	T4       i ; i5i)a  
Returns a participant that matches the given identity. If identity is None, the first
participant that joins the room will be returned.
If the participant has already joined, the function will return immediately.

When `include_local` is True, the local participant is also considered.
r   c                    V ^8  d   QhRRRR/# )r
   r   r0   r   r   r   )r   s   "r   r   *wait_for_participant.<locals>.__annotate__n   s      o $ r   c                x   < Sf   R# \        S\        4      '       d   V P                  S9   # V P                  S8H  # NT)r2   listr   )r   r   s   &r   
kind_match(wait_for_participant.<locals>.kind_matchn   s4    <dD!!66T>!vv~r   c                    V ^8  d   QhRRRR/# r$   r   )r   s   "r   r   r^   w   s     " ""7 "D "r   c                   < Se   V P                   S8X  d<   S! V 4      '       d,   SP                  4       '       g   SP                  V 4       R # R # R # R # r'   )rO   r)   r*   )r   r+   rO   rb   s   &r   _on_participant_active4wait_for_participant.<locals>._on_participant_activew   sA    

h 6JqMM88::q!  =J 6r   c                    V ^8  d   QhRRRR/# r7   r   )r   s   "r   r   r^   |   s     _ _C _D _r   c                   < V \         P                  P                  8X  d5   SP                  4       '       g   SP	                  \        R 4      4       R# R# R# )z/room disconnected while waiting for participantNr;   r@   s   &r   _on_connection_state_changed:wait_for_participant.<locals>._on_connection_state_changed|   s?    C''999#((**l+\]^ CM9r   participant_activerF   N)rG   r?   rH   rI   r   ParticipantrJ   local_participantrO   rM   rK   rL   r8   ParticipantStatePARTICIPANT_STATE_ACTIVEr)   )
r   rO   r   rP   rf   rj   localr   r+   rb   s
   &dd$    @@r   rV   rV   [   sd     233
..
)
+C " "
_ _ 	GG "89GG&(DEK**E ENNh$>JuDUDU 	%'=>+-IJ ))002Aww#..GGG&q)xxzz	 3 y%'=>+-IJ %'=>+-IJsO   BF4F .F F %F41A!F 	F  F	!F $%F4	F &F11F4wait_for_subscriptionc               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r
   r   r   rO   r   r   >list[rtc.TrackKind.ValueType] | rtc.TrackKind.ValueType | NonerP   rS   rr   r   r   rtc.RemoteTrackPublicationr   )r   s   "r   r   r      sG     % %
% % I	%
 "%  %  %r   c                  "   R # 5ir'   r   r   rO   r   rP   rr   s   &$$$$r   wait_for_track_publicationrx      s
      "%rW   c               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r
   r   r   rO   r   r   rt   rP   rY   rr   r   r   rtc.TrackPublicationr   )r   s   "r   r   r      sG      
  I	
 !   r   c                  "   R # 5ir'   r   rw   s   &$$$$r   rx   rx      s
      rW   c               0    V ^8  d   QhRRRRRRRRR	RR
R/# )r
   r   r   rO   r   r   rt   rP   r   rr   r   rz   r   )r   s   "r   r   r      sW     fK fK
fK fK I	fK
 fK  fK fKr   c                 a aaaaaa"   S P                  4       '       g   \        R4      h\        P                  \        P
                  ,          ! 4       oR V3R lloR VVV3R lloR VV3R llpR VV3R	 llpR
 VVVV 3R llpR V3R llpS'       d   S P                  RV4       MS P                  RV4       V'       d   S P                  RV4       S P                  RV4        V'       d   S P                  p	Se   V	P                  S8X  d   V	P                  P                  4        Fx  p
S! V
P                  4      '       g   K  T
u S'       d   S P                  RV4       MS P                  RV4       V'       d   S P                  RV4       S P                  RV4       # 	  S P                  P                  4        F]  pVP                  P                  4        F$  pS! W4      '       g   K  SP                  V4        M	  SP                  4       '       g   K]   M	  SG Rj  xL
 S'       d   S P                  RV4       MS P                  RV4       V'       d   S P                  RV4       S P                  RV4       #  L]  S'       d   S P                  RT4       MS P                  RT4       T'       d   S P                  RT4       S P                  RT4       i ; i5i)a  Returns a track publication matching the given identity and kind.
If identity is None, the first track matching the kind will be returned.
If a matching track is already published (and subscribed when
``wait_for_subscription`` is set), the function returns immediately.

When `include_local` is True, tracks published by the local participant are also considered;
local publications resolve on publish and ignore ``wait_for_subscription``.
r   c                    V ^8  d   QhRRRR/# )r
   kzrtc.TrackKind.ValueTyper   r   r   )r   s   "r   r   0wait_for_track_publication.<locals>.__annotate__   s      - $ r   c                P   < Sf   R# \        S\        4      '       d   V S9   # V S8H  # r`   )r2   ra   )r   r   s   &r   rb   .wait_for_track_publication.<locals>.kind_match   s,    <dD!!9Dyr   c               $    V ^8  d   QhRRRRRR/# )r
   publicationru   participantr   r   r   r   )r   s   "r   r   r      s$     	 	/	>S			r   c                   < Se   VP                   S8X  g   R# S! V P                  4      '       g   R# S'       d#   V P                  '       d   V P                  f   R# R# )NFT)rO   r   
subscribedtrack)r   r   rO   rb   rr   s   &&r   _matches,wait_for_track_publication.<locals>._matches   sN      K$8$8H$D+**++ +*@*@*@[EVEVEbr   c               $    V ^8  d   QhRRRRRR/# )r
   r   ru   r   r   r   r%   r   )r   s   "r   r   r      s$     ( (/(>S(	(r   c                z   < SP                  4       '       g$   S! W4      '       d   SP                  V 4       R # R # R # r'   r(   )r   r   r   r+   s   &&r   _on_track_published7wait_for_track_publication.<locals>._on_track_published   s.     xxzzh{@@NN;' Azr   c               (    V ^8  d   QhRRRRRRRR/# )	r
   r   	rtc.Trackr   ru   r   r   r   r%   r   )r   s   "r   r   r      s0     ( ((/( +( 
	(r   c                z   < SP                  4       '       g$   S! W4      '       d   SP                  V4       R # R # R # r'   r(   )r   r   r   r   r+   s   &&&r   _on_track_subscribed8wait_for_track_publication.<locals>._on_track_subscribed   s.    
 xxzzh{@@NN;' Azr   c               $    V ^8  d   QhRRRRRR/# )r
   r   zrtc.LocalTrackPublication_trackr   r   r%   r   )r   s   "r   r   r      s$     ( (.(8A(	(r   c                   < SP                  4       '       d   R # SP                  pSe   VP                  S8X  d.   S! V P                  4      '       d   SP	                  V 4       R # R # R # r'   )r)   rn   rO   r   r*   )r   r   rq   r+   rO   rb   r   s   && r   _on_local_track_published=wait_for_track_publication.<locals>._on_local_track_published   sU     88::&&( :
;K[K[@\@\NN;' A] :r   c                    V ^8  d   QhRRRR/# r7   r   )r   s   "r   r   r      s     e eC eD er   c                   < V \         P                  P                  8X  d5   SP                  4       '       g   SP	                  \        R 4      4       R# R# R# )z5room disconnected while waiting for track publicationNr;   r@   s   &r   rj   @wait_for_track_publication.<locals>._on_connection_state_changed   rC   r   track_subscribedtrack_publishedlocal_track_publishedrF   N)rG   r?   rH   rI   r   TrackPublicationrJ   rn   rO   track_publicationsrL   r   rM   rK   r*   r)   )r   rO   r   rP   rr   r   r   r   rj   rq   local_publicationr   r   r   r+   rb   s   fdd$d        @@@r   rx   rx      sW      233
..--
.
0C 	 	( (( (( (e e "$89!#67')BCGG&(DEK**E5>>X#=).)A)A)H)H)J%!"3"8"89900 !HH')=>HH&(;<HH,.GH+-IJ) *K ))002A 33::<K++NN;/  = xxzz 3 y HH')=>HH&(;<HH,.GH+-IJ  HH')=>HH&(;<HH,.GH+-IJst   BK),K)$K),J 4AJ J 4K)%K))AJ 5(J "	J +J	,J /4K)$%K)	J 5K&%K&&K))
__future__r   rH   typingr   r   livekitr   typesr   rN   rV   rx   r   r   r   <module>r      s`   "  $  (9J "9Jx 
     X\	 
 %*  
  
   X\	 
7K  7K X\	7K
  7Kt 
%  % LP	%
 %*% #(% 
% 
   LP	 #( 
fK  fK LP	fK
  fK #(fK fKr   