Ë
    ±bjW
  ã                   óR   — d dl Z d dlZddededdfd„Zdddœd	ed
eddfd„Zdefd„Zy)é    NÚmin_sÚmax_sÚreturnc              ƒ   ór   K  — t        j                  t        j                  | |«      «      ƒ d {  –—†  y 7 Œ­w)N)ÚasyncioÚsleepÚrandomÚuniform)r   r   s     ú=/var/www/html/sergio/sergio-backend/app/automation/helpers.pyÚhuman_delayr      s#   è ø€ Ü
�-‰-œŸ™ u¨eÓ4Ó
5×5Ò5ús   ‚-7¯5°7iˆ  iÄ	  )Ú
timeout_msÚforce_after_msr   r   c             ƒ   óä  K  — ddl m} | j                  }	  ||«      ƒ d{  –—†  	 | j	                  t        ||«      ¬«      ƒ d{  –—†  y7 Œ*# t        $ r Y Œ3w xY w7 Œ# t        $ r Y nw xY w	  ||«      ƒ d{  –—†7   | j	                  |d¬«      ƒ d{  –—†7   y# t        $ r Y nw xY w| j                  |¬«      ƒ d{  –—†7  }|€t        d«      ‚|j                  d|«      ƒ d{  –—†7   y­w)	u!  
    Click without burning the full Playwright default timeout on overlays.
    Tries a short normal click â†’ force click â†’ JS click.

    Only dismisses the activation-guide calendar â€” never full close_hudl_popups(),
    which would close Hudl's Confirm / exchange wizard modal.
    r   )Ú_dismiss_activation_guideN©ÚtimeoutT)r   Úforcezsafe_click: element not foundz<(el) => { el.scrollIntoView({block:'center'}); el.click(); })	Úapp.automation.tasks.popupr   ÚpageÚ	ExceptionÚclickÚminÚelement_handleÚRuntimeErrorÚevaluate)Úlocatorr   r   r   r   Úhandles         r   Ú
safe_clickr   	   sú   è ø€ õ Eà�<‰<€DðÙ'¨Ó-×-Ð-ðØ�m‰m¤C¨
°NÓ$CˆmÓD×DÐDØð 	.ùÜò Ùðúð 	Eùäò ÙðúðÙ'¨Ó-×-Ñ-Ø�m‰m J°dˆmÓ;×;Ñ;ØøÜò Ùðúð ×)Ñ)°*Ð)Ó=×=Ð=€FØ€~ÜÐ:Ó;Ð;Ø
�-‰-ÐVÐX^Ó
_×_Ò_ùs»   ‚C0–A ¡A¢A §A ÁAÁA ÁC0ÁA Á	AÁC0ÁAÁC0ÁA Á	A+Á(C0Á*A+Á+C0Á/B Á:A=Á;B ÂBÂB ÂC0Â	B)Â&C0Â(B)Â)C0ÃCÃ'C0Ã)C,Ã*C0c              ƒ   ó°  K  — g d¢}|D ]¦  }| j                  |«      j                  }|j                  «       ƒ d{  –—† dk(  s|j                  «       ƒ d{  –—† sŒR	 |j	                  «       ƒ d{  –—† }|rt        d|› �«       Œ|t        d|› �«       |j                  d¬«      ƒ d{  –—†  |c S  t        d	«      ‚7 Œ‚7 Œi7 ŒQ# t
        $ r d}Y Œ\w xY w7 Œ+­w)
zœ
    Dynamically finds an ENABLED Next button, clicks it, and returns the selector used.
    Hudl changes the ID of the next button on different steps.
    )zrxpath=//footer//button[contains(translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'next')]zjxpath=//button[contains(translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'next')]z%xpath=//button[@id='eventNextButton']z)xpath=//button[@id='gameStatsNextButton']z)xpath=//button[@id='breakdownNextButton']z'xpath=//button[@id='optionsNextButton']z'xpath=//button[@id='messageNextButton']z3xpath=//footer//button[contains(@class, 'primary')]Nr   Fz Next button found but disabled: z$Found Next button dynamically with: i@  r   z@Could not find any enabled Next button dynamically on this page!)r   ÚfirstÚcountÚ
is_visibleÚis_disabledr   Úprintr   )r   Ú	selectorsÚselÚlocÚdisableds        r   Úfind_and_click_nextr)   ,   sÛ   è ø€ ò
	€Ió ˆØ�l‰l˜3Ó×%Ñ%ˆØ—‘“× Ò!¨s¯~©~Ó/?×)?Ð)?Øð	Ø Ÿ_™_Ó.×.ˆHñ ÜÐ4°S°EÐ:Ô;ØÜÐ4°S°EÐ:Ô;Ø�i‰i ˆiÓ%×%Ð%ØŠ
ð ô ÐVÓ
WÐWð øÐ)?øð /ùÜò 	ØŠHð	úð 	&úsc   ‚8CºB=»CÁB?ÁCÁCÁ/CÁ0CÁ44CÂ(CÂ)CÂ?CÃCÃCÃCÃCÃC)gš™™™™™é?gš™™™™™@)r   r	   Úfloatr   Úintr   Ústrr)   © ó    r   Ú<module>r/      sZ   ðÛ Û ñ6˜Uð 6°ð 6Àó 6ð 48Ètò  `¨Sð  `Èð  `ÐX\ó  `ðFX sô Xr.   