+
    f4jh                        R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt. R5Ot ! R R]4      t	]P                  ! 4       t/ tRsRsR6RR/R lltR6R ltR7R ltR	 tR
 tRR/R lt ! R R4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t]t ! R R]4      t ! R R]4      t ! R R]4      t ! R  R!]4      t R" t!R# t"]PF                  R$,          R%8X  d    ! R& R']4      t$]PF                  R(8X  d    ! R) R*]4      t%]PF                  R+8X  d$   ^ R,I&H't' ]''       d   ^ R-I(H)t)H*t*H+t+  ! R. R/]4      t,R0 R1 lt-R6R2 R3 llt.]/R48X  d
   ].! 4        R# R# )8z?Interfaces for launching and remotely controlling web browsers.NErrorc                       ] tR t^tRtR# )r    N)__name__
__module____qualname____firstlineno____static_attributes__r       lib/python3.14/webbrowser.pyr   r      s    r
   	preferredFc               L   \         ;_uu_ 4        \        f   \        4        W.\        V P	                  4       &   V'       g   \
        '       d&   V  R2\
        8X  d   \        P                  ^ V 4       M\        P                  V 4       RRR4       R#   + '       g   i     R# ; i)zRegister a browser connector.Nz.desktop)_lock	_tryorderregister_standard_browsers	_browserslower_os_preferred_browserinsertappend)nameklassinstancer   s   &&&$r   registerr      sj    	&(#("3	$**,
 ..dV83DH]3]Q%T" 
s   >B:BB#	c                0   \         f*   \        ;_uu_ 4        \         f   \        4        RRR4       V e   V .pM\         pV F  pRV9   dB   \        P                  ! V4      pVR,          R8X  d   \        VRR 4      u # \        V4      u #  \        VP                  4       ,          pV^,          e   V^,          u # V^ ,          f   K  V^ ,          ! 4       u # 	  \        R4      h  + '       g   i     L; i  \         d    \        T4      p Lki ; i)zCReturn a browser launcher instance appropriate for the environment.N%s&z!could not locate runnable browser)r   r   r   shlexsplitBackgroundBrowserGenericBrowserr   r   KeyError_synthesizer   )usingalternativesbrowsercommands   &   r   getr(   (   s    U *,  w 7?kk'*Gr{c!("66%g../#GMMO4 qz%qz!'qz|##  $ 3
443 U&  /%g./s   C)C<)C9	<DDc                    \         f*   \        ;_uu_ 4        \         f   \        4        RRR4       \          F)  p\        V4      pVP	                  WV4      '       g   K(   R# 	  R#   + '       g   i     LE; i)aZ  Display url using the default browser.

If possible, open url in a location determined by new.
- 0: the same browser window (the default).
- 1: a new browser window.
- 2: a new browser page ("tab").
If possible, autoraise raises the window (the default) or not.

If opening the browser succeeds, return True.
If there is a problem, return False.
NTF)r   r   r   r(   open)urlnew	autoraiser   r&   s   &&&  r   r*   r*   K   sV     U *,  d)<<),,   Us   A''A7	c                    \        V ^4      # )zmOpen url in a new window of the default browser.

If not possible, then open url in the only browser window.
r*   r+   s   &r   open_newr1   b       
 Q<r
   c                    \        V ^4      # )z}Open url in a new page ("tab") of the default browser.

If not possible, then the behavior becomes equivalent to open_new().
r/   r0   s   &r   open_new_tabr4   j   r2   r
   c                  V P                  4       ^ ,          p\        P                  ! V4      '       g   RR.# \        P                  P                  V4      p \        VP                  4       ,          pT^,          pT'       dq   TP                  4       TP
                  8X  dR   ^ RI	pTP                  T4      pYn
        \        P                  P                  T 4      Tn        \        T RYQR7       RT.# RR.#   \         d    RR.u # i ; i)a  Attempt to synthesize a controller based on existing controllers.

This is useful to create a controller when a user specifies a path to
an entry in the BROWSER environment variable -- we can copy a general
controller to operate using a specific installation of the desired
browser in this way.

If we can't create a controller in this way, or if there is no
executable for the requested browser, return [None, None].

N)r   r   )r   shutilwhichospathbasenamer   r   r"   copyr   r   )r&   r   cmdr   r'   
controllerr;   s   &$     r   r#   r#   r   s     --/!
C<<d|77C DDJJL) Jdjjlj&9&99YYz*
! gg..w7
$Ij!!$<  d|s   C8 8D
	D
c                   Z   a  ] tR t^t o RtR.tR
R ltRR ltR tR t	]
R 4       tRtV tR	# )BaseBrowserz3Parent class for all browsers. Do not use directly.r   c                    Wn         Wn        R # N)r   r:   selfr   s   &&r   __init__BaseBrowser.__init__   s    	r
   c                    \         hrA   )NotImplementedErrorrC   r+   r,   r-   s   &&&&r   r*   BaseBrowser.open   s    !!r
   c                &    V P                  V^4      # )   r/   rC   r+   s   &&r   r1   BaseBrowser.open_new       yya  r
   c                &    V P                  V^4      # )   r/   rL   s   &&r   r4   BaseBrowser.open_new_tab   rN   r
   c                    V '       d7   V P                  4       P                  R4      '       d   \        RV : 24      hR# R# )zCEnsures that the URL is safe to pass to subprocesses as a parameter-z'Invalid URL (leading dash disallowed): N)lstrip
startswith
ValueErrorr0   s   &r   
_check_urlBaseBrowser._check_url   s7     3::<**3//FsgNOO 03r
   )r:   r   N)     T)r   r   r   r   __doc__argsrD   r*   r1   r4   staticmethodrW   r	   __classdictcell____classdict__s   @r   r?   r?      s9     =6D"!! P Pr
   r?   c                   4   a  ] tR t^t o RtR tRR ltRtV tR# )r!   zOClass for all browsers started with a command
and without remote functionality.c                    \        V\        4      '       d   Wn        R .V n        MV^ ,          V n        VR,          V n        \        P
                  P                  V P                  4      V n        R# )r   :rK   NNN)
isinstancestrr   r]   r8   r9   r:   rB   s   &&r   rD   GenericBrowser.__init__   sO    dC  IDI QDIRDI((3r
   c                   \         P                  ! R V4       V P                  V4       V P                  .V P                   Uu. uF  pVP                  RV4      NK  	  up,           p \         P                  R,          R8X  d   \        P                  ! V4      pM\        P                  ! VRR7      pVP                  4       '       * # u upi   \         d     R# i ; i)webbrowser.openr   N   NwinT)	close_fdsF)sysauditrW   r   r]   replaceplatform
subprocessPopenwaitOSErrorrC   r+   r,   r-   argcmdlineps   &&&&   r   r*   GenericBrowser.open   s    		#S)99+,0II!7,5S "%T3!7,5!7 7	||B5($$W-$$W=vvx<!7  		s   C(AC CC)r]   r:   r   NrZ   )	r   r   r   r   r\   rD   r*   r	   r_   r`   s   @r   r!   r!      s     ,4 r
   r!   c                   .   a  ] tR t^t o RtRR ltRtV tR# )r    zAClass for all browsers which are to be started in the
background.c                   V P                   .V P                   Uu. uF  pVP                  R V4      NK  	  up,           p\        P                  ! RV4       V P                  V4        \        P                  R,          R8X  d   \        P                  ! V4      pM\        P                  ! VRRR7      pVP                  4       RJ # u upi   \         d     R# i ; i)r   rh   ri   rk   T)rl   start_new_sessionNF)r   r]   ro   rm   rn   rW   rp   rq   rr   pollrt   ru   s   &&&&   r   r*   BackgroundBrowser.open   s    99+,0II!7,5S "%T3!7,5!7 7		#S)	||B5($$W-$$W7;=668t##!7  		s   C(AC CCr   NrZ   r   r   r   r   r\   r*   r	   r_   r`   s   @r   r    r       s      r
   r    c                   X   a  ] tR t^t o RtRtRtRtRR.tRt	Rt
RtR
R ltRR ltR	tV tR# )UnixBrowserz=Parent class for all Unix browsers with remote functionality.NFT%actionr   c           	        . pV'       d<   V P                   '       d*   \        V4      pV P                   V,          pV'       d   V.pV P                  .V,           V,           pV'       g   V P                  '       d   \        P
                  pMR p\        P                  ! TRTV P                  ;'       d    T;'       g    R VRR7      p	V'       d    V	P                  ^4      p
V
'       * # V P                  '       d   V	P                  4       f   R# R# V	P                  4       '       * #   \        P                   d     R# i ; i)NTrl   stdinstdoutstderrr|   F)
raise_optsintr   
backgroundrq   DEVNULLrr   redirect_stdoutrs   TimeoutExpiredr}   )rC   r]   remoter-   r+   	raise_optoptrw   inoutrx   rcs   &&&&&      r   _invokeUnixBrowser._invoke   s    	doooII//),C E	99+	)D0T___&&E EWE%)%9%9%C%Ce%K%Kt$)TC VVAYv ___vvxvvx< ,, s   D& &D?>D?c                   \         P                  ! R V4       V^ 8X  d   V P                  pMQV^8X  d   V P                  pM=V^8X  d)   V P                  f   V P                  pMV P                  pM\        RV 24      hV P                  VP                  RV4      4       V P                   Uu. uF%  pVP                  RV4      P                  RV4      NK'  	  ppV Uu. uF  qU'       g   K  VNK  	  ppV P                  VRW14      pV'       g>   V P                   Uu. uF  qUP                  RV4      NK  	  ppV P                  VRR4      # R# u upi u upi u upi )rh   z8Bad 'new' parameter to open(); expected 0, 1, or 2, got r   r   TF)rm   rn   remote_actionremote_action_newwinremote_action_newtabr   rW   ro   remote_argsr   r]   )rC   r+   r,   r-   actionrv   r]   successs   &&&&    r   r*   UnixBrowser.open  sE   		#S)!8''FAX..FAX((02222 4475: ; ; 	Iv67  ++-+C Iv.66tSA+ 	 -#+tst+,,tT9:6:ii@isKKc*iD@<<eU33-+ As   ,+E	E+EEr   rA   rZ   )r   r   r   r   r\   r   r   r   r   r   r   r   r   r*   r	   r_   r`   s   @r   r   r      sD     GJJO d#KM" H r
   r   c                   2    ] tR tRtRtRR.tRtRtRtRt	R	t
R
# )Mozillai0  z$Launcher class for Mozilla browsers.r   r   rY   z-new-windowz-new-tabTr   Nr   r   r   r   r\   r   r   r   r   r   r	   r   r
   r   r   r   0  s%    .d#KM(%Jr
   r   c                   6    ] tR tRtRtRR.tRR.tRtRtR	t	R
t
R# )Epiphanyi:  z$Launcher class for Epiphany browser.z-noraiserY   r   r   -nz-wTr   N)r   r   r   r   r\   r   r   r   r   r   r	   r   r
   r   r   r   :  s)    .b!Jd#KMJr
   r   c                   2    ] tR tRtRtRR.tRtRtRtRt	Rt
R	# )
ChromeiD  z)Launcher class for Google Chrome browser.r   r   rY   --new-windowTr   Nr   r   r
   r   r   r   D  s%    3d#KM)Jr
   r   c                   2    ] tR tRtRtRR.tRtRtRtRt	Rt
R	# )
OperaiQ  z!Launcher class for Opera browser.r   r   rY   r   Tr   Nr   r   r
   r   r   r   Q  s%    +d#KM)Jr
   r   c                   6    ] tR tRtRtRR.tRtRtRtRt	Rt
R	tR
# )Elinksi[  z#Launcher class for Elinks browsers.z-remotezopenURL(%s%action)rY   z,new-windowz,new-tabFr   N)r   r   r   r   r\   r   r   r   r   r   r   r	   r   r
   r   r   r   [  s-    -23KM(%J Or
   r   c                   .   a  ] tR tRt o RtRR ltRtV tR# )	Konquerorii  zController for the KDE File Manager (kfm, or Konqueror).

See the output of ``kfmclient --commands``
for more information on the Konqueror remote-control interface.
c           	        \         P                  ! R V4       V P                  V4       V^8X  d   RpMRp\        P                  p \        P
                  ! RWA.RVWUR7      pVP                  4        R#   \         d     Mi ; i \        P
                  ! RRT.RTYURR7      pTP                  4       f   R# M  \         d     Mi ; i \        P
                  ! R
RT.RTYURR7      pTP                  4       R	J #   \         d     R# i ; i)rh   newTabopenURL	kfmclientT)rl   r   r   r   	konquerorz--silentr   Nkfmz-dF)	rm   rn   rW   rq   r   rr   rs   rt   r}   )rC   r+   r,   r-   r   devnullrx   s   &&&&   r   r*   Konqueror.openp  s#   		#S)!8FF$$
	  +v!;+/w(/AA FFH  			  +z3!?+/w(/379A vvx  	  			$  %s!3+/w(/379A 668t##  		s6   A4 4BBB9 9CCC; ;D
	D
r   NrZ   r   r`   s   @r   r   r   i  s     ,$ ,$r
   r   c                   2    ] tR tRtRtRR.tRtRtRtRt	Rt
R	# )
Edgei  z*Launcher class for Microsoft Edge browser.r   r   rY   r   Tr   Nr   r   r
   r   r   r     s%    4d#KM)Jr
   r   c                     \         P                  ! R 4      '       d   \        R R\        R 4      4       \         P                  ! R4      '       d   \        RR\        . RO4      4       \        P
                  ! RR4      P                  R4      p RV 9   g   R\        P                  9   d3   \         P                  ! R4      '       d   \        RR\        R4      4       R	V 9   g   R
\        P                  9   d7   \         P                  ! R4      '       d   \        R\        \        R4      4       \         P                  ! R4      '       d   \        RR\        R4      4       R F7  p\         P                  ! V4      '       g   K!  \        VR\        V4      4       K9  	  \         P                  ! R4      '       d   \        R\        \        R4      4       M6\         P                  ! R4      '       d   \        R\        \        R4      4       \         P                  ! R4      '       d   \        RR\        R4      4       R F7  p\         P                  ! V4      '       g   K!  \        VR\        V4      4       K9  	  \         P                  ! R4      '       d   \        RR\        R4      4       \         P                  ! R4      '       d   \        RR\        R4      4       R# R# )zxdg-openNgioXDG_CURRENT_DESKTOPrY   :GNOMEGNOME_DESKTOP_SESSION_IDz	gvfs-openKDEKDE_FULL_SESSIONr   zx-www-browserr   r   epiphanyoperamicrosoft-edge)r   r*   z--r   )firefox	iceweasel	seamonkeyzmozilla-firefoxmozilla)zgoogle-chromechromechromiumzchromium-browser)r6   r7   r   r    r8   getenvr   environr   r   r   r   r   r   )xdg_desktopr&   s     r   register_X_browsersr     s    ||JT#4Z#@A ||E/0KLM))126<<SAK 
K		#rzz	1LL%%d$5k$BC 
+		rzz	)LL%%i;)?@ ||O$$$(9/(JK<<  WdGG$45 ||E	9U#34	k	"	"i;)?@ ||JT8J#78 O<<  WdF7O4 O
 ||G$g/||$%%!4.>)?@ &r
   c                  
  a . s \        P                  R 8X  dY   \        RR\	        R4      4       \        RR\	        R4      4       \        RR\	        R4      4       \        RR\	        R4      4       \        P                  R8X  d   \        R	R\        4       R
R7       \        P                  R8X  d   \        RR\        R4      4       \        P                  R,          R8X  Ed   \        R\        4       \        P                  P                  \        P                  P                  RR4      R4      p \        P                  P                  \        P                  P                  RR4      R4      pRRRRRW3 F7  p\        P                  ! V4      '       g   K!  \        VR\        V4      4       K9  	  \        P                  ! R4      '       d   \        RR\        R4      4       EM\        P                  R 8w  d   \        P                  P                  R4      '       g&   \        P                  P                  R4      '       db    RP!                  4       p\"        P$                  ! V\"        P&                  R7      pVP)                  4       P+                  4       pVs\7        4        \        P                  P                  R4      '       d   \        P                  ! R 4      '       d   \        R R\9        R 4      4       \        P                  ! R!4      '       d   \        R!R\9        R!4      4       \        P                  ! R"4      '       d   \        R"R\;        R"4      4       \        P                  ! R#4      '       d   \        R#R\9        R#4      4       \        P                  ! R$4      '       d   \        R$R\9        R$4      4       R%\        P                  9   Ed+   \        P                  R%,          P!                  \        P<                  4      pVP?                  4        V F  o\@        ;QJ d    V3R& lR' 4       F  '       d   K   R(M	  R
M! V3R& lR' 4       4      '       da    \B        SPE                  4       ,          p\G        V^,          \8        4      '       g'   \         PI                  ^ SPE                  4       4       K   SR)8w  g   K  \M        SR
R7      pV^,          e   K  \        SR\9        S4      R
R7       K  	  R# R#   \.        \"        P0                  \2        \4        3 d     ELi ; i  \J         d     L|i ; i)*darwinMacOSXNdefaultr   zgoogle chromer   safariios
iosbrowserT)r   
serenityosBrowserri   rk   zwindows-defaultzPROGRAMFILES(x86)zC:\Program Files (x86)z%Microsoft\Edge\Application\msedge.exePROGRAMFILESzC:\Program Filesr   r   r   zMicrosoftEdge.exer   DISPLAYWAYLAND_DISPLAYz$xdg-settings get default-web-browser)r   TERMzwww-browserlinkselinkslynxw3mBROWSERc              3   ,   <"   T F	  qS9  x  K  	  R # 5irA   r   ).0xrw   s   & r   	<genexpr>-register_standard_browsers.<locals>.<genexpr>=  s     3UG#Us   z 	FrY   )'r   rm   rp   r   MacOSXOSAScript
IOSBrowserr    WindowsDefaultr8   r9   joinr   r(   r6   r7   r   r   rq   check_outputr   decodestripr   FileNotFoundErrorCalledProcessErrorPermissionErrorNotADirectoryErrorr   r!   r   pathsepreverseallr   r   rd   r   r"   r#   )	edge64edge32r&   r<   
raw_resultresultuserchoicesr'   rw   s	           @r   r   r     s   I
||x4!;<4!ABD/)"<=4!:; ||utZ\TB
|||#D"3I">?
||B5 "N3 bjjnn-@B[\HJ bjjnn^=PQHJ!;	81G||G$$$(9'(BC1 <<+,,%tT2E-FG <<8#	)B)BbjjnnUfFgFg	/<BBD'44SASAST
#**,224 )/%! ::>>&!!||M**n].KL||G$$$w(?@||H%%4)9:||F##~f'=>||E""nU&;< BJJjj+11"**= #Gs3U3sss3U333!'8G
 &gaj.AA!((GMMO<  B "}!'T:q6>WdN7,CtT# # 9 &z'D'D#%79 P   s%   AT	 'T5	%T21T25UUri   rk   c                   *   a  ] tR tRt o RR ltRtV tR# )r   iW  c                    \         P                  ! R V4       V P                  V4        \        P                  ! V4       R#   \
         d     R# i ; i)rh   TF)rm   rn   rW   r8   	startfilert   rH   s   &&&&r   r*   WindowsDefault.openX  sI    II'-OOC S!    s   A AAr   NrZ   r   r   r   r   r*   r	   r_   r`   s   @r   r   r   W  s     
	 
	r
   r   r   c                   @   a a ] tR tRt oRV 3R lltRR ltRtVtV ;t# )r   ii  c                &   < \         SV `  V4       R # rA   )superrD   )rC   r   	__class__s   &&r   rD   MacOSXOSAScript.__init__j  s    GT"r
   c                   \         P                  ! R V4       V P                  V4       VP                  RR4      pV P                  R8X  d@   VP                  R4      w  rEpV'       d   VP                  4       R9   d   RV R2pMRV R2pMRV P                   R	V R
2p\        P                  ! RR4      pVf   R# VP                  V4       VP                  4       p	V	'       * # )rh   "z%22r   r   zopen location "u2  
                        use framework "AppKit"
                        use AppleScript version "2.4"
                        use scripting additions

                        property NSWorkspace : a reference to current application's NSWorkspace
                        property NSURL : a reference to current application's NSURL

                        set http_url to NSURL's URLWithString:"https://python.org"
                        set browser_url to (NSWorkspace's sharedWorkspace)'s ¬
                            URLForApplicationToOpenURL:http_url
                        set app_path to browser_url's relativePath as text -- NSURL to absolute path '/Applications/Safari.app'

                        tell application app_path
                            activate
                            open location "z7"
                        end tell
                    z&
                   tell application "zH"
                       activate
                       open location "z,"
                   end
                   z/usr/bin/osascriptwF>   httphttps)rm   rn   rW   ro   r   	partitionr   r8   popenwriteclose)
rC   r+   r,   r-   proto_sep_restscriptosapiper   s
   &&&&      r   r*   MacOSXOSAScript.openm  s    II'-OOC ++c5)CyyI%%(]]3%7"UEKKM->>.se15F
", -05 1F&&&*ii[ 1''*e , hh3S9GMM&!B6Mr
   r   )r   rZ   )	r   r   r   r   rD   r*   r	   r_   __classcell__)r   ra   s   @@r   r   r   i  s     	#-	 -	r
   r   r   )objc)c_void_pc_char_pc_ulongc                   *   a  ] tR tRt o RR ltRtV tR# )r   i  c                
   \         P                  ! R V4       V P                  V4       \        f   R# \        \        P
                  n        \        P                  ! R4      p\        P                  ! R4      p\        \        \        \        .\        P
                  n        \        P
                  ! VVVP                  R4      ^4      p\        P                  ! R4      p\        P                  ! R4      p\        \        \        .\        P
                  n        \        P
                  ! WxV4      p	\        P                  ! R4      p
\        P                  ! R	4      p\        \        .\        P
                  n        \        P
                  ! W4      p\        P                  ! R
4      p\        \        \        \        \        .\        P
                  n        R\        P
                  n        \        P
                  ! WV	RR4       R# )rh   NFs   NSStrings   stringWithCString:encoding:zutf-8s   NSURLs   URLWithString:s   UIApplications   sharedApplications"   openURL:options:completionHandler:T)rm   rn   rW   r  r  objc_msgSendrestypeobjc_getClasssel_registerNamer  r  argtypesencode)rC   r+   r,   r-   NSStringconstructor
url_stringNSURLurlWithString_ns_urlUIApplicationsharedApplication
shared_appopenURL_s   &&&&          r   r*   IOSBrowser.open  s{   II'-OOC | )1D% ))+6H//0NOK*2Hh)PD&**

7#	J &&x0E!223DEN*2Hh)GD&&&ujIF
 !../?@M $ 5 56J K*2H)=D&**=LJ ,,-RSH(Hh*D& )-D%jFD$Gr
   r   NrZ   r   r`   s   @r   r   r     s     5	 5	r
   r   c                H    V ^8  d   QhR\         \        ,          R,          /# rP   arg_listNlistre   )formats   "r   __annotate__r,    s      cT) r
   c           
          ^ RI pVP                  RRR7      pVP                  RRR7       VP                  4       pVP                  RR	R
^^ RRR7       VP                  RRR
^^ RRR7       VP	                  V 4      pV# )r[   NzOpen URL in a web browser.T)descriptioncolorr+   zURL to open)helpr   r   store_constnew_winzopen new window)r   constr   destr0  z-tz	--new-tabzopen new tab)argparseArgumentParseradd_argumentadd_mutually_exclusive_group
parse_args)r(  r5  parsergroupr]   s   &    r   r9  r9    s    $$0 % F M2//1E	t^M	-  / 
t[	*  , X&DKr
   c                H    V ^8  d   QhR\         \        ,          R,          /# r'  r)  )r+  s   "r   r,  r,    s      49t# r
   c                 r    \        V 4      p\        VP                  VP                  4       \	        R 4       R# )N)r9  r*   r+   r2  print)r(  r]   s   & r   mainr@    s%    hD4<< 	$Kr
   __main__)r   r*   r1   r4   r(   r   rA   rZ   )0r\   r8   r   r6   rm   rq   	threading__all__	Exceptionr   RLockr   r   r   r   r   r(   r*   r1   r4   r#   r?   r!   r    r   r   r   r   Chromiumr   r   r   r   r   r   rp   r   r   _ios_supportr  ctypesr  r  r  r   r9  r@  r   r   r
   r   <module>rI     s   E 
   
  
J	I 	 			 #e # 5F.e DP P2[ : (O+ Odk { [  K [ 3$ 3$l; "7AtcUX <<u " <<81+ 1l <<5!666[ 6r( zF r
   