
     f                        d dl mZ ddlmZmZ d dlmZ d dlZd dlZddl	m
Z
 e G d d                      Ze G d	 d
                      ZddZ	 dddZddZ	 dddZdS )    )annotations   )event_classT_JSON_DICT)	dataclassN)targetc                  D    e Zd ZU dZded<   ded<   d Zed             ZdS )	FileHandlerAcceptz
    The following types are the replica of
    https://crsrc.org/c/chrome/browser/web_applications/proto/web_app_os_integration_state.proto;drc=9910d3be894c8f142c977ba1023f30a656bc13fc;l=67
    str
media_typeztyping.List[str]file_extensionsc                ^    t                      }| j        |d<   d | j        D             |d<   |S )N	mediaTypec                    g | ]}|S  r   .0is     n/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/selenium/webdriver/common/devtools/v126/pwa.py
<listcomp>z-FileHandlerAccept.to_json.<locals>.<listcomp>   s    !B!B!B!!B!B!B    fileExtensions)dictr   r   selfjsons     r   to_jsonzFileHandlerAccept.to_json   s8    vv O[!B!BT-A!B!B!Br   c                b     | t          |d                   d |d         D                       S )Nr   c                ,    g | ]}t          |          S r   r   r   s     r   r   z/FileHandlerAccept.from_json.<locals>.<listcomp>%   s    DDDSVVDDDr   r   )r   r   r    clsr   s     r   	from_jsonzFileHandlerAccept.from_json!   sB    s4,--DDT2B-CDDD
 
 
 	
r   N)__name__
__module____qualname____doc____annotations__r   classmethodr#   r   r   r   r
   r
      sa           OOO%%%%   
 
 [
 
 
r   r
   c                  J    e Zd ZU ded<   ded<   ded<   d Zed             ZdS )	FileHandlerr   actionztyping.List[FileHandlerAccept]acceptsdisplay_namec                r    t                      }| j        |d<   d | j        D             |d<   | j        |d<   |S )Nr,   c                6    g | ]}|                                 S r   )r   r   s     r   r   z'FileHandler.to_json.<locals>.<listcomp>4   s     ===1199;;===r   r-   displayName)r   r,   r-   r.   r   s     r   r   zFileHandler.to_json1   sA    vvX=====Y"/]r   c                     | t          |d                   d |d         D             t          |d                             S )Nr,   c                B    g | ]}t                               |          S r   )r
   r#   r   s     r   r   z)FileHandler.from_json.<locals>.<listcomp><   s'    MMM&0033MMMr   r-   r1   )r,   r-   r.   r    r!   s     r   r#   zFileHandler.from_json8   sO    stH~&&MMT)_MMMT-011
 
 
 	
r   N)r$   r%   r&   r(   r   r)   r#   r   r   r   r+   r+   )   sa         KKK++++   
 
 [
 
 
r   r+   manifest_idr   returnWtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[int, typing.List[FileHandler]]]c              #     K   t                      }| |d<   d|d}|V }t          |d                   d |d         D             fS )aZ  
    Returns the following OS state for the given manifest id.

    :param manifest_id: The id from the webapp's manifest file, commonly it's the url of the site installing the webapp. See https://web.dev/learn/pwa/web-app-manifest.
    :returns: A tuple with the following items:

        0. **badgeCount** - 
        1. **fileHandlers** - 
    
manifestIdzPWA.getOsAppStatemethodparams
badgeCountc                B    g | ]}t                               |          S r   )r+   r#   r   s     r   r   z$get_os_app_state.<locals>.<listcomp>V   s&    @@@a		q	!	!@@@r   fileHandlers)r   intr4   r;   cmd_dictr   s       r   get_os_app_staterB   A   sh       &&F&F<% H >>DD@@4+?@@@ r   install_url_or_bundle_urltyping.Optional[str]0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c              #  P   K   t                      }| |d<   |||d<   d|d}|V }dS )a  
    Installs the given manifest identity, optionally using the given install_url
    or IWA bundle location.

    TODO(crbug.com/337872319) Support IWA to meet the following specific
    requirement.
    IWA-specific install description: If the manifest_id is isolated-app://,
    install_url_or_bundle_url is required, and can be either an http(s) URL or
    file:// URL pointing to a signed web bundle (.swbn). The .swbn file's
    signing key must correspond to manifest_id. If Chrome is not in IWA dev
    mode, the installation will fail, regardless of the state of the allowlist.

    :param manifest_id:
    :param install_url_or_bundle_url: *(Optional)* The location of the app or bundle overriding the one derived from the manifestId.
    r8   NinstallUrlOrBundleUrlzPWA.installr9   r   )r4   rC   r;   rA   r   s        r   installrI   Z   sM      & &&F&F< ,*C&' H >>DDDr   c              #  B   K   t                      }| |d<   d|d}|V }dS )ze
    Uninstals the given manifest_id and closes any opened app windows.

    :param manifest_id:
    r8   zPWA.uninstallr9   NrH   r@   s       r   	uninstallrK   x   s<       &&F&F<! H >>DDDr   url;typing.Generator[T_JSON_DICT, T_JSON_DICT, target.TargetID]c              #     K   t                      }| |d<   |||d<   d|d}|V }t          j                            |d                   S )ar  
    Launches the installed web app, or an url in the same web app instead of the
    default start url if it is provided. Returns a tab / web contents based
    Target.TargetID which can be used to attach to via Target.attachToTarget or
    similar APIs.

    :param manifest_id:
    :param url: *(Optional)*
    :returns: ID of the tab target created as a result.
    r8   NrL   z
PWA.launchr9   targetId)r   r   TargetIDr#   )r4   rL   r;   rA   r   s        r   launchrQ      sa       &&F&F<
u H >>D?$$T*%5666r   )r4   r   r5   r6   )N)r4   r   rC   rD   r5   rE   )r4   r   r5   rE   )r4   r   rL   rD   r5   rM   )
__future__r   utilr   r   dataclassesr   enumtyping r   r
   r+   rB   rI   rK   rQ   r   r   r   <module>rX      s=   # " " " " " * * * * * * * * ! ! ! ! ! !         
 
 
 
 
 
 
 
2 
 
 
 
 
 
 
 
.   6 ;?    <   & %)7 7 7 7 7 7 7r   