+
    ^eòjÌT  ã                   ó¤  € R 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	 ^ RI
HtHtHtHtHtHtHtHtHtHt ^ RIt^ RIHt ^ RI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&H't' ]PP                  ! ])4      t*] ! R R4      4       t+]PX                  ! 4       t-R R lt.R t/R R lt0R R lt1R R lt2 ! R R]34      t4 ! R R4      t5 ^ RI6H7t7 ]7Pp                  ]5n9        ]5Pp                  ]7n8        ]]<]=]>]&]3,          t?]]?,          t@]]?,          tA]]A]@3,          tB ! R R]4      tCR#   ]: d    ]*Pw                  R4        LRi ; i)u�  Server-Sent Events response for Starlette / FastAPI.

Intentional divergence from ``starlette.responses.StreamingResponse``
--------------------------------------------------------------------

``EventSourceResponse`` is modelled on Starlette's ``StreamingResponse`` and
re-syncs most of its behaviour (WebSocket denial, ``collapse_excgroups()``
around the task group, ``memoryview`` chunk handling). The following points
are deliberate divergences â€” DO NOT "fix" them without reading the rationale:

1. ASGI ``spec_version >= 2.4`` fast path is NOT adopted.
   Upstream short-circuits to ``await stream_response(send)`` and converts
   ``OSError`` into ``ClientDisconnect``, skipping ``listen_for_disconnect``.
   We keep ``_listen_for_disconnect`` running because it
     (a) invokes ``client_close_handler_callable`` on disconnect,
     (b) flips ``self.active = False`` so ``_ping`` and the cooperative
         shutdown grace loop exit promptly.
   Adopting the upstream fast path would regress both features.

2. ``_wrap_websocket_denial_send`` is inlined in this module rather than
   inherited from ``starlette.responses.Response``. The helper landed on
   Starlette ``main`` after our minimum pin (``starlette>=0.41.3``); inline
   until the floor moves past the release that contains it.

3. ``collapse_excgroups()`` is vendored in ``sse_starlette._utils`` rather
   than imported from ``starlette._utils`` (private module).
N)Ú	dataclassÚfield)ÚdatetimeÚtimezone)
ÚAnyÚAsyncIterableÚ	AwaitableÚCallableÚ	CoroutineÚIteratorÚMappingÚOptionalÚSetÚUnion)ÚBackgroundTask)Úiterate_in_threadpool)ÚMutableHeaders)ÚResponse)ÚReceiveÚScopeÚSendÚMessage)Úcollapse_excgroups)ÚServerSentEventÚensure_bytesc                   óF   a € ] tR t^>t o Rt]! ]R7      tRtV 3R lt	Rt
V tR# )Ú_ShutdownStatez®Per-thread state for shutdown coordination.

Issue #152 fix: Uses threading.local() instead of ContextVar to ensure
one watcher per thread rather than one per async context.
)Údefault_factoryFc                óV   <€ V ^8„  d   Qh/ S[ S[P                  ,          ;R&   S[;R&   # )é   ÚeventsÚwatcher_started)r   ÚanyioÚEventÚbool)ÚformatÚ__classdict__s   "€Úˆ/opt/data/installs/351f81cc06284494/environments/aa258815729c481f8402f54f4c368f83/venv/lib/python3.14/site-packages/sse_starlette/sse.pyÚ__annotate__Ú_ShutdownState.__annotate__>   s(   ø‡ ‚ ñ ‘—‘ÕÑ9ñ ñ Ñ!ò ó    © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Úsetr    r!   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__©r&   s   @r'   r   r   >   s"   ø‡ € ññ  %°SÔ9€FØ!€O÷ ƒ r*   r   c                ó$   € V ^8„  d   QhR\         /# ©r   Úreturn)r   )r%   s   "r'   r(   r(   N   s   € ÷ ñ œ^ñ r*   c                 óZ   € \        \        RR4      p V f   \        4       p V \        n        V # )z4Get or create shutdown state for the current thread.Úshutdown_stateN)ÚgetattrÚ_thread_stater   r:   )Ústates    r'   Ú_get_shutdown_stater>   N   s+   € ä”MÐ#3°TÓ:€EØ‚}ÜÓ ˆØ',ŒÔ$Ø€Lr*   c                 óØ   €  \         P                  ! \         P                  4      p \        V R4      '       d!   V P                  p\        VR4      '       d   V# R#   \
         d     R# i ; i)aM  
Try to get uvicorn Server instance via signal handler introspection.

When uvicorn registers signal handlers, they're bound methods on the Server instance.
We can retrieve the Server from the handler's __self__ attribute.

Returns None if:
- Not running under uvicorn
- Signal handler isn't a bound method
- Any introspection fails
Ú__self__Úshould_exitN)ÚsignalÚ	getsignalÚSIGTERMÚhasattrr@   Ú	Exception)ÚhandlerÚservers     r'   Ú_get_uvicorn_serverrI   W   sa   € ðÜ×"Ò"¤6§>¡>Ó2ˆÜ�7˜J×'Ò'Ø×%Ñ%ˆFÜ�v˜}×-Ò-Ø�ñ øô ô ØÙðús   ‚AA ÁA)Á(A)c                ó   € V ^8„  d   QhRR/# ©r   r8   Nr+   )r%   s   "r'   r(   r(   n   s   € ÷ %&ñ %& ñ %&r*   c               ƒ  ó„  "  € \        4       p   \        4       p\        P                  '       d   MM\        P                  '       d   Ve   VP                  '       d   M \
        P                  ! R4      G Rj  x€L
  Ko  \        V P                  4       F  pVP                  4        K  	  RV n
        R#  L;  RT n
        i ; i5i)aO  
Poll for shutdown and broadcast to all events in this context.

One watcher runs per thread (event loop). Checks two shutdown sources:
1. AppStatus.should_exit - set when our monkey-patch works
2. uvicorn Server.should_exit - via signal handler introspection (Issue #132 fix)

When either becomes True, signals all registered events.
Ng      à?F)r>   rI   Ú	AppStatusrA   Úenable_automatic_graceful_drainr"   ÚsleepÚlistr    r1   r!   )r=   Úuvicorn_serverÚevents      r'   Ú_shutdown_watcherrS   n   s�   é € ô  Ó!€Eð&Øô 1Ó2ˆNä×$×$Ð$Øô
 ×9×9Ð9Ø"Ò.Ø"×.×.Ð.àÜ—+’+˜cÓ"×"Ò"ô ˜%Ÿ,™,Ö'ˆEØ�I‰IŽKñ (ð !&ˆÖñ #øð !&ˆÕüs:   ‚C Ž7B4 ÁB4 ÁB4 Á6B2Á72B4 Â)	C Â2B4 Â4	B=Â=C c                ó   € V ^8„  d   QhRR/# rK   r+   )r%   s   "r'   r(   r(   –   s   € ÷ 
*ñ 
*¨dñ 
*r*   c                 óà   € \        4       p V P                  '       g9   RV n         \        P                  ! 4       pVP	                  \        4       4       R# R#   \         d    RT n         R# i ; i)zDEnsure the shutdown watcher is running for this thread (event loop).TFN)r>   r!   ÚasyncioÚget_running_loopÚcreate_taskrS   ÚRuntimeError)r=   Úloops     r'   Ú$_ensure_watcher_started_on_this_loopr[   –   sa   € äÓ!€EØ× × Ð Ø $ˆÔð	*Ü×+Ò+Ó-ˆDØ×ÑÔ.Ó0Ö1ñ	 !øô
 ô 	*à$)ˆE×!ð	*ús   ¥.A ÁA-Á,A-c                ó0   € V ^8„  d   QhR\         R\         /# )r   Úsendr8   ©r   )r%   s   "r'   r(   r(   £   s   € ÷ ñ ¤dð ¬tñ r*   c                ó   a € R V 3R llpV# )a'  Mirror of ``starlette.responses.Response._wrap_websocket_denial_send``.

Divergence #2 (see module docstring): inlined because the helper landed
on Starlette ``main`` (commit 9ee9519) after our minimum pin
``starlette>=0.41.3``. Drop this once the floor moves past the release
that contains it.
c                ó(   € V ^8„  d   QhR\         RR/# )r   Úmessager8   N)r   )r%   s   "r'   r(   Ú1_wrap_websocket_denial_send.<locals>.__annotate__¬   s   € ÷ ñ œwð ¨4ñ r*   c              “   ór   <"  € V R ,          pVR9   d   / V CR RV,           /Cp S! V 4      G Rj  x€L
  R#  L5i)Útypez
websocket.N>   úhttp.response.bodyúhttp.response.startr+   )ra   Úmessage_typer]   s   & €r'   ÚwrappedÚ,_wrap_websocket_denial_send.<locals>.wrapped¬   s;   øé € Ø˜v•ˆØÐHÔHØF˜ÐF &¨,¸Õ*EÑFˆGÙ�7‹m×Ôùs   ƒ+7®5¯7r+   )r]   rh   s   f r'   Ú_wrap_websocket_denial_sendrj   £   s   ø€ ÷ð ð €Nr*   c                   ó   € ] tR t^µtRtR# )ÚSendTimeoutErrorr+   N)r,   r-   r.   r/   r3   r+   r*   r'   rl   rl   µ   s   † Ûr*   rl   c                   ól   a € ] tR t^¹t o RtRtRtRt]R 4       t	]R 4       t
]R 4       tV 3R ltR	tV tR# )
rM   z\Helper to capture a shutdown signal from Uvicorn so we can gracefully terminate SSE streams.FTNc                 ó   € R\         n        R# )a  
Prevent automatic SSE stream termination on server shutdown.

WARNING: When disabled, you MUST set AppStatus.should_exit = True
at some point during shutdown, or streams will never close and the
server will hang indefinitely (or until uvicorn's graceful shutdown
timeout expires).
FN©rM   rN   r+   r*   r'   Ú disable_automatic_graceful_drainÚ*AppStatus.disable_automatic_graceful_drainÀ   s   € ð 5:Œ	Ö1r*   c                 ó   € R\         n        R# )zß
Re-enable automatic SSE stream termination on server shutdown.

This restores the default behavior where SIGTERM triggers immediate
stream draining. Call this to undo a previous call to
disable_automatic_graceful_drain().
TNro   r+   r*   r'   Ú$enable_automatic_graceful_drain_modeÚ.AppStatus.enable_automatic_graceful_drain_modeÌ   s   € ð 59Œ	Ö1r*   c                 óœ   € \         P                  '       d   R \         n        \         P                  e   \         P                  ! V / VB  R# R# )TN)rM   rN   rA   Úoriginal_handler)ÚargsÚkwargss   *,r'   Úhandle_exitÚAppStatus.handle_exit×   s:   € ä×4×4Ð4Ø$(ŒIÔ!Ü×%Ñ%Ò1Ü×&Ò&¨Ð7°Ô7ñ 2r*   c                ó6   <€ V ^8„  d   Qh/ S[ S[,          ;R&   # )r   rv   )r   r	   )r%   r&   s   "€r'   r(   ÚAppStatus.__annotate__¹   s   ø‡ ‚ ñ
 ™xÕ(Ñ/ò r*   r+   )r,   r-   r.   r/   r0   rA   rN   rv   Ústaticmethodrp   rs   ry   r2   r3   r4   r5   s   @r'   rM   rM   ¹   sZ   ø‡ € Ùfà€KØ&*Ð#Ø+/Ðàñ	:ó ð	:ð ñ9ó ð9ð ñ8ó ð8÷? ƒ r*   rM   )ÚServerzHUvicorn not installed. Graceful shutdown on server termination disabled.c                   ó,  a € ] tR t^ït o Rt^tRtRV 3R lR llt]V 3R lR l4       t	]	P                  V 3R lR	 l4       t	RV 3R
 lR lltV 3R lR ltV 3R lR ltV 3R lR lt]V 3R lR l4       tV 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )ÚEventSourceResponseaa  Streaming response implementing the SSE (Server-Sent Events) specification.

Args:
    content: Async iterable or sync iterator yielding SSE event data.
    status_code: HTTP status code. Default: 200.
    headers: Additional HTTP headers.
    media_type: Response media type. Default: "text/event-stream".
    background: Background task to run after response completes.
    ping: Ping interval in seconds. Default: 15. Set to 0 to disable
        keep-alive pings entirely (no ping task is started).
    sep: Line separator for SSE messages ("\r\n", "\r", or "\n").
    ping_message_factory: Callable returning custom ping ServerSentEvent.
    data_sender_callable: Async callable for push-based data sending.
    send_timeout: Timeout in seconds for individual data or heartbeat sends.
    client_close_handler_callable: Async callback on client disconnect.
    shutdown_event: Optional ``anyio.Event`` set by the library when server
        shutdown is detected. Generators can watch this event to send farewell
        messages and exit cooperatively instead of receiving CancelledError.
    shutdown_grace_period: Seconds to wait after setting ``shutdown_event``
        before force-cancelling the generator. Must be >= 0. Should be less
        than your ASGI server's graceful shutdown timeout. Default: 0
        (immediate cancel, identical to pre-v3.3.0 behavior).
ú
Nc                ó˜  <€ V ^8„  d   QhRS[ RS[RS[S[S[S[3,          ,          RS[RS[S[,          RS[S[S[S[3,          ,          RS[S[,          RS[S[. S[	3,          ,          R	S[S[. S[
R,          3,          ,          RS[S[,          RS[S[S[.S[R
,          3,          ,          RS[S[P                  ,          RS[RR
/# )r   ÚcontentÚstatus_codeÚheadersÚ
media_typeÚ
backgroundÚpingÚsepÚping_message_factoryÚdata_sender_callableNÚsend_timeoutÚclient_close_handler_callableÚshutdown_eventÚshutdown_grace_periodr8   )NNN)ÚContentStreamÚintr   r   Ústrr   r   Úfloatr	   r   r
   r   r   r"   r#   )r%   r&   s   "€r'   r(   Ú EventSourceResponse.__annotate__  s  ø€ ÷ G'ñ G'áðG'ñ ðG'ñ ™'¡#¡s (Õ+Õ,ð	G'ñ
 ðG'ñ ™^Õ,ðG'ñ ‘u™S¡%˜ZÕ(Õ)ðG'ñ ‘c�]ðG'ñ '¡x°±OÐ0CÕ'DÕEðG'ñ 'Ù�R™Ð#3Õ4Ð4Õ5õ
ðG'ñ ™u•oðG'ñ (0Ù‘g�Y¡	¨$¥Ð/Õ0õ(
ðG'ñ" !¡§¡Õ-ð#G'ñ$  %ð%G'ð& 
ñ'G'r*   c                óz  € VR
9  d   \        RV 24      hT;'       g    V P                  V n        \        V\        4      '       d   Wn        M\        V4      V n        W n        Vf   V P                  MTV n        WPn	        W�n
        W n        \        4       pVe   VP                  V4       VP                  RR4       RVR&   RVR&   V P                  V4       Vf   V P                   MTV n        W€n        W°n        V^ 8  d   \        R4      hWÀn        WÐn        R	V n        \.        P0                  ! 4       V n        R # )Nz'sep must be one of: \r\n, \r, \n, got: zCache-Controlzno-storez
keep-aliveÚ
ConnectionÚnozX-Accel-Bufferingz"shutdown_grace_period must be >= 0T)Nr�   ÚÚ
)Ú
ValueErrorÚDEFAULT_SEPARATORr‰   Ú
isinstancer   Úbody_iteratorr   r„   r†   r‡   r‹   rŒ   r   ÚupdateÚ
setdefaultÚinit_headersÚDEFAULT_PING_INTERVALÚping_intervalrŠ   r�   Ú_shutdown_eventÚ_shutdown_grace_periodÚactiver"   ÚLockÚ
_send_lock)Úselfrƒ   r„   r…   r†   r‡   rˆ   r‰   rŠ   r‹   rŒ   r�   rŽ   r�   Ú_headerss   &&&&&&&&&&&&&& r'   Ú__init__ÚEventSourceResponse.__init__  s'  € ð* Ð0Ô0ÜÐJÈ3È%ÐPÓQÐQØ×0Ð0˜$×0Ñ0ˆŒô �gœ}×-Ò-Ø!(Õä!6°wÓ!?ˆDÔà&ÔØ-7Ò-?˜$Ÿ/š/ÀZˆŒØ$ŒØ$8Ô!Ø(Ôô "Ó#ˆØÒØ�O‰O˜GÔ$ð 	×Ñ˜O¨ZÔ8à!-ˆ�ÑØ(,ˆÐ$Ñ%Ø×Ñ˜(Ô#à;?º<˜T×7Ò7ÈTˆÔØ$8Ô!à-JÔ*ð ! 1Ô$ÜÐAÓBÐBØ-ÔØ&;Ô#àˆŒäŸ*š*›,ˆŽr*   c                ó6   <€ V ^8„  d   QhRS[ S[S[3,          /# r7   ©r   r‘   r“   )r%   r&   s   "€r'   r(   r”   U  s   ø€ ÷ #ñ #™u¡S©% ZÕ0ñ #r*   c                ó   € V P                   # ©N)Ú_ping_interval©r¨   s   &r'   r¢   Ú!EventSourceResponse.ping_intervalT  s   € à×"Ñ"Ð"r*   c                ó:   <€ V ^8„  d   QhRS[ S[S[3,          RR/# )r   Úvaluer8   Nr­   )r%   r&   s   "€r'   r(   r”   Y  s$   ø€ ÷ $ñ $¡5©©e¨Õ#4ð $¸ñ $r*   c                ó„   € \        V\        \        34      '       g   \        R 4      hV^ 8  d   \	        R4      hWn        R# )z"ping interval must be int or floatz,ping interval must be >= 0 (0 disables ping)N)rœ   r‘   r“   Ú	TypeErrorrš   r°   )r¨   r´   s   &&r'   r¢   r²   X  s8   € ä˜%¤#¤u ×.Ò.ÜÐ@ÓAÐAØ�1Œ9ÜÐKÓLÐLØ#Ör*   c                ó$   <€ V ^8„  d   QhRS[ RR/# )r   Úforcer8   N)r$   )r%   r&   s   "€r'   r(   r”   `  s   ø€ ÷ Sñ S©ð S¸ñ Sr*   c                ó   € \        R 4      h)z-Compression is not supported for SSE streams.)ÚNotImplementedError)r¨   r¸   s   &&r'   Úenable_compressionÚ&EventSourceResponse.enable_compression`  s   € Ü!Ð"QÓRÐRr*   c                ó*   <€ V ^8„  d   QhRS[ RS[RR/# )r   r]   ra   r8   N)r   r   )r%   r&   s   "€r'   r(   r”   c  s"   ø€ ÷ %ñ %©Tð %¹Gð %Èñ %r*   c              ƒ  ó  "  € \         P                  ! V P                  4      ;_uu_ 4       pV! V4      G Rj  x€L
  RRR4       X'       d   VP                  '       d   \	        4       hR# R#  L4  + '       g   i     L:; i5i)z@Send one ASGI message, applying the response's per-send timeout.N)r"   Úmove_on_afterrŒ   Úcancel_calledrl   )r¨   r]   ra   Úcancel_scopes   &&& r'   Ú_send_with_timeoutÚ&EventSourceResponse._send_with_timeoutc  s]   é € ä× Ò  ×!2Ñ!2×3Ô3°|Ù�w“-×Ð÷ 4÷ ˜L×6×6Ð6Ü"Ó$Ð$ñ 7‰<ñ  ÷ 4×3üs7   ‚)B«A.·A,¸A.¼BÁBÁBÁ,A.Á.A>	Á9Bc                ó$   <€ V ^8„  d   QhRS[ RR/# ©r   r]   r8   Nr^   )r%   r&   s   "€r'   r(   r”   k  s   ø€ ÷ Xñ X©4ð X°Dñ Xr*   c           
   ƒ  ó‚  "  € V! RRRV P                   RV P                  /4      G Rj  x€L
  V P                    Rj  x€L
  p\        W P                  4      p\
        P                  RV4        V P                  VRRRVR	R
/4      G Rj  x€L
  KX   Lh LU L
  \         d.    \        T P                  RR4      pTe   T! 4       G Rj  x€L 
  h i ; iD“T P                  ;_uu_4       GRj  x€L 
  RT n        T! RRRRR	R/4      G Rj  x€L 
  RRR4      GRj  x€L 
  R#   + GRj  x€L 
 '       g   i     R# ; i5i)zHSend out SSE data to the client as it becomes available in the iterator.rd   rf   Ústatusr…   Nz	chunk: %sre   ÚbodyÚ	more_bodyTÚacloseFr*   )r„   Úraw_headersr�   r   r‰   ÚloggerÚdebugrÂ   rl   r;   r§   r¥   )r¨   r]   ÚdataÚchunkrÊ   s   &&   r'   Ú_stream_responseÚ$EventSourceResponse._stream_responsek  s'  é € áàÐ-Ø˜$×*Ñ*Ø˜4×+Ñ+ðó
÷ 	
ð 	
ð ×,Ò,÷ 	ð 	�$Ü  §x¡xÓ0ˆEÜ�L‰L˜ eÔ,ð	Ø×-Ñ-ØØÐ1°6¸5À+ÈtÐTó÷ ò ñ	
ñ	ñøô $ô Ü  ×!3Ñ!3°X¸tÓD�ØÒ%Ù ›(—N‘NØð	úð -ð —?—?—?”?ØˆDŒKÙ˜Ð 4°f¸cÀ;ÐPUÐVÓW×WÑW÷ #—?—?—?—?”?üs®   ‚&D?¨B©D?¹C½B¾CÁ-D?Á/BÂ
BÂBÂD?ÂCÂBÂ0CÃC
ÃCÃD?Ã+C.Ã,D?Ã0D"Ä	DÄ
D"ÄD?ÄDÄD?Ä"D<	Ä(D+Ä)
D<	Ä4D<	Ä6	D?c                ó$   <€ V ^8„  d   QhRS[ RR/# )r   Úreceiver8   N)r   )r%   r&   s   "€r'   r(   r”   ‡  s   ø€ ÷ ñ ±Gð Àñ r*   c              ƒ  ó
  "  € V P                   '       di   V! 4       G Rj  x€L
 pVR,          R8X  g   K1  RV n         \        P                  R4       V P                  '       d   V P                  V4      G Rj  x€L
  R# R#  L_ L
5i)uI  Watch for a disconnect message from the client.

Divergence #1 (see module docstring): kept unconditionally instead of
adopting Starlette's ASGI 2.4 ``OSError â†’ ClientDisconnect`` fast path,
because this loop drives ``client_close_handler_callable`` and flips
``self.active = False`` for ``_ping`` and the shutdown grace loop.
Nrd   zhttp.disconnectFz+Got event: http.disconnect. Stop streaming.)r¥   rÌ   rÍ   r�   )r¨   rÓ   ra   s   && r'   Ú_listen_for_disconnectÚ*EventSourceResponse._listen_for_disconnect‡  sk   é € ð �k�kˆkÙ#›I—oˆGØ�v�Ð"3Ö3Ø#�”Ü—‘ÐJÔKØ×5×5Ð5Ø×<Ñ<¸WÓE×EÐEÙñ Ù%ñ
 Fùs1   ‚B•
BŸA? B´-BÁ"BÁ6BÁ7	BÂBc                ó   <€ V ^8„  d   QhRR/# rK   r+   )r%   r&   s   "€r'   r(   r”   ™  s   ø€ ÷ (ñ (¨4ñ (r*   c               ƒ  óÚ  "  € \         P                  '       d   R# \        4        \        4       p \        P
                  ! 4       pV P                  P                  V4        \         P                  '       d    V P                  P                  V4       R# VP                  4       G Rj  x€L
  V P                  P                  V4       R#  L!  T P                  P                  T4       i ; i5i)z0Wait for shutdown signal via the shared watcher.N)
rM   rA   r[   r>   r"   r#   r    ÚaddÚdiscardÚwait)r=   rR   s     r'   Ú_listen_for_exit_signalÚ+EventSourceResponse._listen_for_exit_signal˜  s¤   é € ô × × Ð Ùä,Ô.ä#Ó%ˆÜ—’“ˆØ�‰×Ñ˜Ôð	(ä×$×$Ð$Øð �L‰L× Ñ  Ö'ð —*‘*“,×Ðà�L‰L× Ñ  Ö'ñ øà�L‰L× Ñ  Õ'üs<   ‚AC+Á C Á7C+ÂC Â'C	Â(C Â,C+Ã	C ÃC(Ã(C+c                ó   <€ V ^8„  d   QhRR/# rK   r+   )r%   r&   s   "€r'   r(   r”   ¬  s   ø€ ÷ +ñ +¸$ñ +r*   c              ƒ  ó´  "  € V P                  4       G Rj  x€L
  V P                  '       d   V P                  P                  4        V P                  ^ 8”  dg   \        P
                  ! V P                  4      ;_uu_ 4        V P                  '       d!   \        P                  ! R4      G Rj  x€L
  K2   RRR4       R# R#  L© L  + '       g   i     R# ; i5i)aV  Wait for shutdown signal, then optionally give generator a grace period.

Issue #167: When a shutdown_event is provided, the library sets it before
returning, giving the generator a chance to send farewell events and exit
cooperatively. The shutdown_grace_period controls how long to wait before
force-cancelling via task group cancellation.
Ngš™™™™™¹?)rÜ   r£   r1   r¤   r"   r¿   r¥   rO   r±   s   &r'   Ú"_listen_for_exit_signal_with_graceÚ6EventSourceResponse._listen_for_exit_signal_with_grace¬  s¤   é € ð ×*Ñ*Ó,×,Ð,ð ××ÐØ× Ñ ×$Ñ$Ô&ð ×&Ñ&¨Ô*Ü×$Ò$ T×%@Ñ%@×AÕAØ—k—k�kÜŸ+š+ cÓ*×*Ò*ð "÷ BÑAñ +ñ 	-ñ +÷ B×AÐAüsE   ‚C–C —C­ACÂ CÂCÂ,CÂ-CÂ4CÃCÃC	Ã	Cc                ó$   <€ V ^8„  d   QhRS[ RR/# rÅ   r^   )r%   r&   s   "€r'   r(   r”   À  s   ø€ ÷ +ñ +¡ð +¨ñ +r*   c              ƒ  ó¦  "  € V P                   '       Ed   \        P                  ! V P                  4      G Rj  x€L
  V P                  '       d   V P	                  4       M;\        R\        P                  ! \        P                  4       2V P                  R7      p\        W P                  4      p\        P                  RV4       V P                  ;_uu_4       GRj  x€L
  V P                   '       d!   V P                  VRRRVRR	/4      G Rj  x€L
  RRR4      GRj  x€L
  EK&  R#  Lñ LM L L  + GRj  x€L 
 '       g   i     EKK  ; i5i)
af  Periodically send ping messages to keep the connection alive on proxies.
- frequency ca every 15 seconds.
- Alternatively one can send periodically a comment line (one starting with a ':' character)

Invariant (Issue #206): must NOT be started when ``ping_interval == 0``
(ping disabled), because ``anyio.sleep(0)`` is a bare checkpoint and the
loop would busy-spin, flooding the client with pings and contending for
``_send_lock`` with the data stream. ``__call__`` skips the task instead
of returning early here, since ``_ping`` runs under ``cancel_on_finish``
and any return would tear down the whole response.
Nzping - )Úcommentr‰   zping: %srd   re   rÈ   rÉ   T)r¥   r"   rO   r°   rŠ   r   r   Únowr   Úutcr‰   r   rÌ   rÍ   r§   rÂ   )r¨   r]   Ússe_pingÚ
ping_bytess   &&  r'   Ú_pingÚEventSourceResponse._pingÀ  sù   é € ð �k�k‰kÜ—+’+˜d×1Ñ1Ó2×2Ð2ð ×,×,Ð,ð ×)Ñ)Ô+ä$Ø%¤h§l¢l´8·<±<Ó&@Ð%AÐBÈÏÉôð ô & h·±Ó9ˆJÜ�L‰L˜ ZÔ0à———“Ø—;—;�;ð ×1Ñ1Øà"Ð$8Ø" JØ'¨ðó÷ ð ÷ '—’ñ Ù2ñ 'ñ÷ '——”üs{   ‚E–#E¹D+ºEÁBEÃD-Ã EÃ#.D3ÄD/ÄD3ÄEÄ!D1Ä"
EÄ-EÄ/D3Ä1EÄ3E	Ä9D<Ä:
E	ÅE	Å
Ec                ó0   <€ V ^8„  d   QhRS[ RS[RS[RR/# )r   ÚscoperÓ   r]   r8   N)r   r   r   )r%   r&   s   "€r'   r(   r”   í  s)   ø€ ÷ *$ñ *$¡Eð *$±Gð *$Á4ð *$ÈDñ *$r*   c           
   ƒ  óô  a aaa"  € VR,          R8X  d   \        S4      o\        4       ;_uu_ 4        \        P                  ! 4       ;_uu_4       GRj  x€L
 oR V3R llpSP	                  VV V3R l4       S P
                  ^ 8”  d   SP	                  VV V3R l4       SP	                  VS P                  4       S P                  '       d   SP	                  S P                  4       SP	                  VVV 3R l4       RRR4      GRj  x€L
  RRR4       S P                  e   S P                  4       G Rj  x€L
  R# R#  Lî L8  + GRj  x€L 
 '       g   i     LO; i  + '       g   i     LZ; i L;5i)	zôEntrypoint for Starlette's ASGI contract. We spin up tasks:
- _stream_response to push events
- _ping to keep the connection alive
- _listen_for_exit_signal to respond to server shutdown
- _listen_for_disconnect to respond to client disconnect
rd   Ú	websocketNc                óL   € V ^8„  d   QhR\         . \        R,          3,          /# )r   ÚcoroN)r	   r   )r%   s   "r'   r(   Ú2EventSourceResponse.__call__.<locals>.__annotate__   s!   € ÷ 5ñ 5´¸"¼iÈ½oÐ:MÕ1Nñ 5r*   c              “   óf   <"  € V ! 4       G R j  x€L
  SP                   P                  4        R #  L 5ir¯   )rÁ   Úcancel)rð   Ú
task_groups   &€r'   Úcancel_on_finishÚ6EventSourceResponse.__call__.<locals>.cancel_on_finish   s&   øé € Ù›&—L�LØ×+Ñ+×2Ñ2Ö4ñ !ùs   ƒ1Ž/�!1c                  ó&   <€ S P                  S4      # r¯   )rÐ   ©r¨   r]   s   €€r'   Ú<lambda>Ú.EventSourceResponse.__call__.<locals>.<lambda>  s   ø€ ¨d×.CÑ.CÀDÔ.Ir*   c                  ó&   <€ S P                  S4      # r¯   )ré   rø   s   €€r'   rù   rú   	  s   ø€ ÀDÇJÁJÈtÔDTr*   c                  ó&   <€ SP                  S 4      # r¯   )rÕ   )rÓ   r¨   s   €€r'   rù   rú     s   ø€ ¨d×.IÑ.IÈ'Ô.Rr*   )	rj   r   r"   Úcreate_task_groupÚ
start_soonr°   rà   r‹   r‡   )r¨   rì   rÓ   r]   rõ   rô   s   f&ff @r'   Ú__call__ÚEventSourceResponse.__call__í  s  ûé € ð ��=˜KÔ'Ü.¨tÓ4ˆDô
  ×!Õ!Ü×.Ò.×0×0Ô0°J÷5ð 5ð ×%Ñ%Ø$Õ&Iôð ×&Ñ&¨Ô*Ø×)Ñ)Ð*:Õ<TÔUØ×%Ñ%Ø$ d×&MÑ&Môð ×,×,Ð,Ø×)Ñ)¨$×*CÑ*CÔDð ×%Ñ%Ø$Õ&Rô÷) 1×0÷ "ð2 �?‰?Ò&Ø—/‘/Ó#×#Ò#ñ '÷1 1×0×0Ô0ú÷ "×!úñ4 $ùs}   †,E8²"E#ÁEÁE#ÁA6E	Ã2E	ÄE#ÄEÄE#Ä)E8Ä:E6Ä;E8ÅE#ÅE#ÅE ÅEÅ
E ÅE ÅE#Å#E3	Å.	E8)r°   r§   r£   r¤   r¥   r‡   r�   r�   r‹   r†   r¢   rŠ   rŒ   r‰   r„   )éÈ   Nztext/event-streamNNNNNNNNé    )F)r,   r-   r.   r/   r0   r¡   r›   rª   Úpropertyr¢   Úsetterr»   rÂ   rÐ   rÕ   r}   rÜ   rà   ré   rÿ   r3   r4   r5   s   @r'   r€   r€   ï   s²   ø‡ € ñð0 ÐØÐ÷G'ò G'ðR ÷#ó ð#ð ×Ñ÷$ó ð$÷Sò S÷%ð %÷Xð X÷8ð ð" ÷(ó ð(÷&+ð +÷(+ð +÷Z*$ö *$r*   r€   )Dr0   rV   ÚloggingrB   Ú	threadingÚdataclassesr   r   r   r   Útypingr   r   r   r	   r
   r   r   r   r   r   r"   Ústarlette.backgroundr   Ústarlette.concurrencyr   Ústarlette.datastructuresr   Ústarlette.responsesr   Ústarlette.typesr   r   r   r   Ússe_starlette._utilsr   Ússe_starlette.eventr   r   Ú	getLoggerr,   rÌ   r   Úlocalr<   r>   rI   rS   r[   rj   ÚTimeoutErrorrl   rM   Úuvicorn.mainr~   ry   rv   ÚImportErrorrÍ   r’   ÚbytesÚdictÚContentÚSyncContentStreamÚAsyncContentStreamr�   r€   r+   r*   r'   Ú<module>r     sD  ðñó8 Û Û Û ß (ß '÷÷ ÷ ó Ý /Ý 7Ý 3Ý (ß 9Ó 9å 3ß =ð 
×	Ò	˜8Ó	$€ð ÷"ð "ó ð"ð —’Ó!€õòõ.%&õP
*õô$	�|ô 	÷#8ñ #8ðLÝ#à!'×!3Ñ!3€IÔØ"×.Ñ.€FÔð ��U˜D /°3Ð6Õ
7€Ø˜WÕ%Ð Ø" 7Õ+Ð ØÐ(Ð*;Ð;Õ<€ôh$˜(ö h$øð ô Ø
‡L�LØRöðús   Ã(D4 Ä4EÅE