
    X j2                    6   S SK Jr  S SKJrJr  S SKJr  \(       a  S SKJr   " S S5      r	 " S S5      r
 " S	 S
5      r " S S5      r " S S5      r " S S5      r " S S5      r " S S5      r " S S5      r " S S5      r " S S5      r " S S5      rg)    )annotations)TYPE_CHECKINGAny)command_builder)WebSocketConnectionc                  (    \ rS rSrSrSrSrSrSrSr	g)	SameSite   z5Represents the possible same site values for cookies.strictlaxnonedefault N)
__name__
__module____qualname____firstlineno____doc__STRICTLAXNONEDEFAULT__static_attributes__r       w/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/selenium/webdriver/common/bidi/storage.pyr	   r	      s    ?F
CDGr   r	   c                  4    \ rS rSrSrSrSrS	S jrS
S jrSr	g)
BytesValue$   zRepresents a bytes value.base64stringc                    Xl         X l        g Ntypevalue)selfr$   r%   s      r   __init__BytesValue.__init__*   s    	
r   c                4    U R                   U R                  S.$ )zfConverts the BytesValue to a dictionary.

Returns:
    A dictionary representation of the BytesValue.
r#   r#   r&   s    r   to_dictBytesValue.to_dict.   s     		DJJ77r   r#   N)r$   strr%   r-   returnzdict[str, str])
r   r   r   r   r   TYPE_BASE64TYPE_STRINGr'   r+   r   r   r   r   r   r   $   s    #KK8r   r   c                  h    \ rS rSrSr      S                 SS jjr\S	S j5       rSrg)
Cookie7   zRepresents a cookie.Nc
                p    Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        g r"   	namer%   domainpathsize	http_onlysecure	same_siteexpiry
r&   r7   r%   r8   r9   r:   r;   r<   r=   r>   s
             r   r'   Cookie.__init__:   1     	
		""r   c                   UR                  S5      nU(       d  [        S5      eUR                  S5      nU(       d  [        S5      e[        UR                  S0 5      R                  S5      UR                  S0 5      R                  S5      5      nU " [        U5      U[        U5      UR                  S5      UR                  S5      UR                  S	5      UR                  S
5      UR                  S5      UR                  S5      S9	$ )zCreates a Cookie instance from a dictionary.

Args:
    data: A dictionary containing the cookie information.

Returns:
    A new instance of Cookie.
r7   z$name is required and cannot be emptyr8   z&domain is required and cannot be emptyr%   r$   r9   r:   httpOnlyr<   sameSiter>   r6   )get
ValueErrorr   r-   )clsdatar7   r8   r%   s        r   	from_dictCookie.from_dictP   s     xxCDD(#EFF488GR044V<dhhwPR>S>W>WX_>`aTv;&!&!hhz*88H%hhz*88H%

 
	
r   	r8   r>   r;   r7   r9   r=   r<   r:   r%   )NNNNNN)r7   r-   r%   r   r8   r-   r9   
str | Noner:   
int | Noner;   bool | Noner<   rN   r=   rL   r>   rM   )rH   dict[str, Any]r/   r3   	r   r   r   r   r   r'   classmethodrI   r   r   r   r   r3   r3   7   s      !%" $!  	
      , 
 
r   r3   c                  d    \ rS rSrSr         S                 SS jjrS	S jrSrg)
CookieFilterp   z Represents a filter for cookies.Nc
                p    Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        g r"   r6   r?   s
             r   r'   CookieFilter.__init__s   rA   r   c                   0 nU R                   b  U R                   US'   U R                  b  U R                  R                  5       US'   U R                  b  U R                  US'   U R                  b  U R                  US'   U R
                  b  U R
                  US'   U R                  b  U R                  US'   U R                  b  U R                  US'   U R                  b  U R                  US'   U R                  b  U R                  US	'   U$ )
zjConverts the CookieFilter to a dictionary.

Returns:
    A dictionary representation of the CookieFilter.
r7   r%   r8   r9   r:   rC   r<   rD   r>   )
r7   r%   r+   r8   r9   r:   r;   r<   r=   r>   r&   results     r   r+   CookieFilter.to_dict   s     "$99 !YYF6N::!"jj002F7O;;"#{{F899 !YYF6N99 !YYF6N>>%!%F:;;"#{{F8>>%!%F:;;"#{{F8r   rK   )	NNNNNNNNN)r7   rL   r%   zBytesValue | Noner8   rL   r9   rL   r:   rM   r;   rN   r<   rN   r=   rL   r>   rM   r/   rO   r   r   r   r   r   r'   r+   r   r   r   r   rS   rS   p   s    *  #'!!%" $! ! 	
      ,r   rS   c                  :    \ rS rSrSrSSS jjr\S	S j5       rSrg)
PartitionKey   z#Represents a storage partition key.Nc                    Xl         X l        g r"   user_contextsource_originr&   rb   rc   s      r   r'   PartitionKey.__init__   s    (*r   c                L    U " UR                  S5      UR                  S5      S9$ )zCreates a PartitionKey instance from a dictionary.

Args:
    data: A dictionary containing the partition key information.

Returns:
    A new instance of PartitionKey.
userContextsourceOriginra   )rE   )rG   rH   s     r   rI   PartitionKey.from_dict   s)     -0((>2
 	
r   )rc   rb   NNrb   rL   rc   rL   )rH   rO   r/   r^   rP   r   r   r   r^   r^      s    -+ 
 
r   r^   c                  ,    \ rS rSrSrSS jrSS jrSrg)	"BrowsingContextPartitionDescriptor   z3Represents a browsing context partition descriptor.c                    SU l         Xl        g )Ncontextr$   rp   )r&   rp   s     r   r'   +BrowsingContextPartitionDescriptor.__init__   s    	r   c                4    U R                   U R                  S.$ )zConverts the BrowsingContextPartitionDescriptor to a dictionary.

Returns:
    Dict: A dictionary representation of the BrowsingContextPartitionDescriptor.
rq   rq   r*   s    r   r+   *BrowsingContextPartitionDescriptor.to_dict   s     		dll;;r   )rp   r$   N)rp   r-   r.   r\   r   r   r   rm   rm      s    =<r   rm   c                  0    \ rS rSrSrSSS jjrS	S jrSrg)
StorageKeyPartitionDescriptor   z.Represents a storage key partition descriptor.Nc                *    SU l         Xl        X l        g )N
storageKeyr$   rb   rc   rd   s      r   r'   &StorageKeyPartitionDescriptor.__init__   s     	(*r   c                    SU R                   0nU R                  b  U R                  US'   U R                  b  U R                  US'   U$ )zConverts the StorageKeyPartitionDescriptor to a dictionary.

Returns:
    Dict: A dictionary representation of the StorageKeyPartitionDescriptor.
r$   rg   rh   rz   rX   s     r   r+   %StorageKeyPartitionDescriptor.to_dict   sO     $))$($($5$5F=!)%)%7%7F>"r   )rc   r$   rb   rj   rk   r.   r\   r   r   r   rv   rv      s    8+
r   rv   c                  X    \ rS rSrSr     S               SS jjrS	S jrSrg)
PartialCookie   z(Represents a partial cookie for setting.Nc	                d    Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        g r"   )r7   r%   r8   r9   r;   r<   r=   r>   )	r&   r7   r%   r8   r9   r;   r<   r=   r>   s	            r   r'   PartialCookie.__init__   s,     	
	""r   c                   U R                   U R                  R                  5       U R                  S.nU R                  b  U R                  US'   U R
                  b  U R
                  US'   U R                  b  U R                  US'   U R                  b  U R                  US'   U R                  b  U R                  US'   U$ )zzConverts the PartialCookie to a dictionary.

Returns:
-------
    Dict: A dictionary representation of the PartialCookie.
)r7   r%   r8   r9   rC   r<   rD   r>   )	r7   r%   r+   r8   r9   r;   r<   r=   r>   rX   s     r   r+   PartialCookie.to_dict   s     IIZZ'')kk"

 99 !YYF6N>>%!%F:;;"#{{F8>>%!%F:;;"#{{F8r   )r8   r>   r;   r7   r9   r=   r<   r%   )NNNNN)r7   r-   r%   r   r8   r-   r9   rL   r;   rN   r<   rN   r=   rL   r>   rM   r[   r\   r   r   r   r   r      sn    2  !%" $!  	
     (r   r   c                  6    \ rS rSrSrSS jr\SS j5       rSrg)	GetCookiesResulti  z.Represents the result of a getCookies command.c                    Xl         X l        g r"   cookiespartition_key)r&   r   r   s      r   r'   GetCookiesResult.__init__  s    *r   c                    UR                  S/ 5       Vs/ s H  n[        R                  U5      PM     nn[        R                  UR                  S0 5      5      nU " X4S9$ s  snf )zCreates a GetCookiesResult instance from a dictionary.

Args:
    data: A dictionary containing the get cookies result information.

Returns:
    A new instance of GetCookiesResult.
r   partitionKeyr   )rE   r3   rI   r^   )rG   rH   cookier   r   s        r   rI   GetCookiesResult.from_dict  s\     ;?((9b:QR:Q6##F+:QR$..txx/KL7@@ Ss   A!r   N)r   zlist[Cookie]r   r^   )rH   rO   r/   r   rP   r   r   r   r   r     s     8+ A Ar   r   c                  6    \ rS rSrSrSS jr\SS j5       rSrg)	SetCookieResulti(  z-Represents the result of a setCookie command.c                    Xl         g r"   r   r&   r   s     r   r'   SetCookieResult.__init__+      *r   c                X    [         R                  UR                  S0 5      5      nU " US9$ )zCreates a SetCookieResult instance from a dictionary.

Args:
    data: A dictionary containing the set cookie result information.

Returns:
    A new instance of SetCookieResult.
r   r   r^   rI   rE   rG   rH   r   s      r   rI   SetCookieResult.from_dict.  *     %..txx/KL//r   r   Nr   r^   )rH   rO   r/   r   rP   r   r   r   r   r   (  s    7+ 
0 
0r   r   c                  6    \ rS rSrSrSS jr\SS j5       rSrg)	DeleteCookiesResulti<  z1Represents the result of a deleteCookies command.c                    Xl         g r"   r   r   s     r   r'   DeleteCookiesResult.__init__?  r   r   c                X    [         R                  UR                  S0 5      5      nU " US9$ )zCreates a DeleteCookiesResult instance from a dictionary.

Args:
    data: A dictionary containing the delete cookies result information.

Returns:
    A new instance of DeleteCookiesResult.
r   r   r   r   s      r   rI   DeleteCookiesResult.from_dictB  r   r   r   Nr   )rH   rO   r/   r   rP   r   r   r   r   r   <  s    ;+ 
0 
0r   r   c                  t    \ rS rSrSrS	S jr  S
     SS jjr S     SS jjr  S
     SS jjrSr	g)StorageiP  z*BiDi implementation of the storage module.c                    Xl         g r"   conn)r&   r   s     r   r'   Storage.__init__S  s    	r   Nc                    0 nUb  UR                  5       US'   Ub  UR                  5       US'   U R                  R                  [        SU5      5      n[        R                  U5      $ )a  Gets cookies matching the specified filter.

Args:
    filter: Optional filter to specify which cookies to retrieve.
    partition: Optional partition key to limit the scope of the operation.

Returns:
    A GetCookiesResult containing the cookies and partition key.

Example:
    result = await storage.get_cookies(
        filter=CookieFilter(name="sessionId"),
        partition=PartitionKey(...)
    )
filter	partitionzstorage.getCookies)r+   r   executer   r   rI   r&   r   r   paramsrY   s        r   get_cookiesStorage.get_cookiesV  sf    ( %~~/F8 "+"3"3"5F;""?3G#PQ))&11r   c                    SUR                  5       0nUb  UR                  5       US'   U R                  R                  [        SU5      5      n[        R                  U5      $ )zSets a cookie in the browser.

Args:
    cookie: The cookie to set.
    partition: Optional partition descriptor.

Returns:
    The result of the set cookie command.
r   r   zstorage.setCookie)r+   r   r   r   r   rI   )r&   r   r   r   rY   s        r   
set_cookieStorage.set_cookies  s[     FNN,- "+"3"3"5F;""?3F#OP((00r   c                    0 nUb  UR                  5       US'   Ub  UR                  5       US'   U R                  R                  [        SU5      5      n[        R                  U5      $ )zDeletes cookies that match the given parameters.

Args:
    filter: Optional filter to match cookies to delete.
    partition: Optional partition descriptor.

Returns:
    The result of the delete cookies command.
r   r   zstorage.deleteCookies)r+   r   r   r   r   rI   r   s        r   delete_cookiesStorage.delete_cookies  sf     %~~/F8 "+"3"3"5F;""?3JF#ST",,V44r   r   )r   r   r/   Nonerj   )r   CookieFilter | Noner   IBrowsingContextPartitionDescriptor | StorageKeyPartitionDescriptor | Noner/   r   r"   )r   r   r   r   r/   r   )r   r   r   r   r/   r   )
r   r   r   r   r   r'   r   r   r   r   r   r   r   r   r   P  s    4
 '+_c2#2 ]2 
	2@ `d11 ]1 
	1. '+_c5#5 ]5 
	5 5r   r   N)
__future__r   typingr   r   %selenium.webdriver.common.bidi.commonr   .selenium.webdriver.remote.websocket_connectionr   r	   r   r3   rS   r^   rm   rv   r   r   r   r   r   r   r   r   <module>r      s   " # % AR 8 8&6
 6
r2 2j
 
.< <  ,- -`A A,0 0(0 0(M5 M5r   