
    YHh
                        d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ d dlmZ  ej$                  e      Zd	Z	 	 	 d	 	 	 	 	 	 	 	 	 dd
ZdddZddZdZy)    )annotationsN)Iterator)closing)import_module)Any)BackendType)RootComponentConstructor)fastapisanictornadoflask	starlettec                r   t         j                  t               |xs t        d      }|j	                         }|j                  ||        |xs t        |      }t        |      }t         j                  d|j                  |j                  ||       t        j                  |j                  |||             y)z)Run a component with a development serverzreactpy.backend.defaultz/ReactPy is running with '%s.%s' at http://%s:%sN)loggerwarning_DEVELOPMENT_RUN_FUNC_WARNINGr   create_development_app	configurefind_available_porttypeinfo
__module____name__asynciorunserve_development_app)	componenthostportimplementationappapp_clss         N/var/www/html/planif/env/lib/python3.12/site-packages/reactpy/backend/utils.pyr   r      s     NN01#O}5N'ON

/
/
1CS),,&t,D3iG
KK9 KK44S$EF    c                   t        ||      D ]  }t        t        j                               5 }	 t        j                  dv r/|j                  t        j                  t        j                  d       |j                  | |f       |cddd       c S  d| d| d| }t        |      # t        $ r Y nw xY w	 ddd       # 1 sw Y   xY w)z=Get a port that's available for the given host and port range)linuxdarwin   NzHost z  has no available port in range -)ranger   socketsysplatform
setsockopt
SOL_SOCKETSO_REUSEADDRbindOSErrorRuntimeError)r   port_minport_maxr   sockmsgs         r#   r   r   3   s    h) V]]_% 	<<#66
 OOF$5$5v7J7JAN		4,' 	 	 $9(1XJ
OC
s
  	 	 	s/   C AB'C '	B30C 2B33C  C		c               #     K   t         D ]9  } 	 t        |        t
        j                  dd      d    d|  }t        |       ; y# t        $ r t        j	                  d| d       Y `w xY ww)z*Yield all available server implementationszFailed to import %sT)exc_info.r(   r   N)SUPPORTED_BACKENDSr   ImportErrorr   debugr   rsplit)namereactpy_backend_names     r#   all_implementationsrA   G   sx     " 2	$
 #+//#q"9!"<!=QtfE0112  	LL.tLD	s'   
A-A.A-!A*'A-)A**A-zThe `run()` function is only intended for testing during development! To run in production, refer to the docs on how to use reactpy.backend.*.configure.)z	127.0.0.1NN)
r   r	   r   strr   z
int | Noner    zBackendType[Any] | NonereturnNone)i@  i(#  )r   rB   r4   intr5   rE   rC   rE   )rC   zIterator[BackendType[Any]])
__future__r   r   loggingr+   r,   collections.abcr   
contextlibr   	importlibr   typingr   reactpy.backend.typesr   reactpy.typesr	   	getLoggerr   r   r;   r   r   rA   r    r$   r#   <module>rP      s    "    
 $  #  - 2			8	$  .2	G'G
G G ,	G
 
G2(
2! r$   