
    ,h"                    :   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 G d dej                        Z	 	 	 	 ddZ	 d	 	 	 	 	 ddZ	 	 	 	 ddZ	 d	 	 	 	 	 ddZ	 	 	 	 	 	 ddZ	 	 	 	 ddZ	 	 d	 	 	 	 	 	 	 ddZy)    )annotations   )event_classT_JSON_DICT)	dataclassN)targetc                  <    e Zd ZU dZded<   ded<   d Zed        Zy)	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_typetyping.List[str]file_extensionsc                |    t               }| j                  |d<   | j                  D cg c]  }| c}|d<   |S c c}w )N	mediaTypefileExtensions)dictr   r   selfjsonis      m/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/selenium/webdriver/common/devtools/v135/pwa.pyto_jsonzFileHandlerAccept.to_json   s>    v OO[-1-A-A!B!!B "Cs   	9c           	     l     | t        |d         |d   D cg c]  }t        |       c}      S c c}w )Nr   r   )r   r   )r   clsr   r   s      r   	from_jsonzFileHandlerAccept.from_json!   s7    4,--12B-CDSVD
 	
Ds   1
N)__name__
__module____qualname____doc____annotations__r   classmethodr        r   r
   r
      s-     O%% 
 
r$   r
   c                  B    e Zd ZU ded<   ded<   ded<   d Zed        Zy)	FileHandlerr   actionztyping.List[FileHandlerAccept]acceptsdisplay_namec                    t               }| j                  |d<   | j                  D cg c]  }|j                          c}|d<   | j                  |d<   |S c c}w )Nr'   r(   displayName)r   r'   r(   r   r)   r   s      r   r   zFileHandler.to_json1   sN    vX04=1199;=Y"//] >s   Ac           	          | t        |d         |d   D cg c]  }t        j                  |       c}t        |d               S c c}w )Nr'   r(   r+   )r'   r(   r)   )r   r
   r   r   s      r   r   zFileHandler.from_json8   sI    tH~&=A)_M&003MT-01
 	
Ms   A
N)r   r   r   r!   r   r"   r   r#   r$   r   r&   r&   )   s,    K++ 
 
r$   r&   c                  .    e Zd ZdZdZdZd Zed        Zy)DisplayModezF
    If user prefers opening the app in browser or an app window.
    
standalonebrowserc                    | j                   S N)value)r   s    r   r   zDisplayMode.to_jsonH   s    zzr$   c                     | |      S r2   r#   )r   r   s     r   r   zDisplayMode.from_jsonK   s    4yr$   N)	r   r   r   r    
STANDALONEBROWSERr   r"   r   r#   r$   r   r.   r.   A   s,     JG  r$   r.   c              #     K   t               }| |d<   d|d}|}t        |d         |d   D cg c]  }t        j                  |       c}fS c c}w w)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
badgeCountfileHandlers)r   intr&   r   )manifest_idr;   cmd_dictr   r   s        r   get_os_app_staterA   P   sg      &F&F<%H >DD+/+?@a		q	!@ @s   -AA	Ac              #  J   K   t               }| |d<   |||d<   d|d}|}yw)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   )r?   install_url_or_bundle_urlr;   r@   r   s        r   installrF   i   s@     & &F&F< ,*C&'H >Ds   !#c              #  <   K   t               }| |d<   d|d}|}yw)zf
    Uninstalls the given manifest_id and closes any opened app windows.

    :param manifest_id:
    r8   zPWA.uninstallr9   NrD   r?   r;   r@   r   s       r   	uninstallrI      s/      &F&F<!H >D   c              #     K   t               }| |d<   |||d<   d|d}|}t        j                  j                  |d         S w)aZ  
    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 page 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   urlz
PWA.launchr9   targetIdr   r   TargetIDr   )r?   rL   r;   r@   r   s        r   launchrP      sW      &F&F<
uH >D??$$T*%566s   AAc              #     K   t               }| |d<   |D cg c]  }| c}|d<   d|d}|}|d   D cg c]!  }t        j                  j                  |      # c}S c c}w c c}w w)a  
    Opens one or more local files from an installed web app identified by its
    manifestId. The web app needs to have file handlers registered to process
    the files. The API returns one or more page Target.TargetIDs which can be
    used to attach to via Target.attachToTarget or similar APIs.
    If some files in the parameters cannot be handled by the web app, they will
    be ignored. If none of the files can be handled, this API returns an error.
    If no files are provided as the parameter, this API also returns an error.

    According to the definition of the file handlers in the manifest file, one
    Target.TargetID may represent a page handling one or more files. The order
    of the returned Target.TargetIDs is not guaranteed.

    TODO(crbug.com/339454034): Check the existences of the input files.

    :param manifest_id:
    :param files:
    :returns: IDs of the tab targets created as the result.
    r8   fileszPWA.launchFilesInAppr9   	targetIdsrN   )r?   rR   r;   r   r@   r   s         r   launch_files_in_apprT      ss     . &F&F<"'(Qq(F7O(H >D26{2CDQFOO%%a(DD ) Es   A(	AA(&A#A(c              #  <   K   t               }| |d<   d|d}|}yw)z
    Opens the current page in its web app identified by the manifest id, needs
    to be called on a page target. This function returns immediately without
    waiting for the app to finish loading.

    :param manifest_id:
    r8   zPWA.openCurrentPageInAppr9   NrD   rH   s       r   open_current_page_in_apprV      s/      &F&F<,H >DrJ   c              #  t   K   t               }| |d<   |||d<   ||j                         |d<   d|d}|}yw)a  
    Changes user settings of the web app identified by its manifestId. If the
    app was not installed, this command returns an error. Unset parameters will
    be ignored; unrecognized values will cause an error.

    Unlike the ones defined in the manifest files of the web apps, these
    settings are provided by the browser and controlled by the users, they
    impact the way the browser handling the web apps.

    See the comment of each parameter.

    :param manifest_id:
    :param link_capturing: *(Optional)* If user allows the links clicked on by the user in the app's scope, or extended scope if the manifest has scope extensions and the flags ```DesktopPWAsLinkCapturingWithScopeExtensions```` and ````WebAppEnableScopeExtensions``` are enabled.  Note, the API does not support resetting the linkCapturing to the initial value, uninstalling and installing the web app again will reset it.  TODO(crbug.com/339453269): Setting this value on ChromeOS is not supported yet.
    :param display_mode: *(Optional)*
    r8   NlinkCapturingdisplayModezPWA.changeAppUserSettingsr9   )r   r   )r?   link_capturingdisplay_moder;   r@   r   s         r   change_app_user_settingsr\      sX     ( &F&F<!"0 , 4 4 6}-H >Ds   68)r?   r   returnzWtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[int, typing.List[FileHandler]]]r2   )r?   r   rE   typing.Optional[str]r]   0typing.Generator[T_JSON_DICT, T_JSON_DICT, None])r?   r   r]   r_   )r?   r   rL   r^   r]   z;typing.Generator[T_JSON_DICT, T_JSON_DICT, target.TargetID])r?   r   rR   r   r]   zHtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[target.TargetID]])NN)r?   r   rZ   ztyping.Optional[bool]r[   ztyping.Optional[DisplayMode]r]   r_   )
__future__r   utilr   r   dataclassesr   enumtyping r   r
   r&   Enumr.   rA   rF   rI   rP   rT   rV   r\   r#   r$   r   <module>rg      s9   # * !    
 
 
2 
 
 
.$)) 	^6 ;?#7 
8<	7& %)77!7 
C72EEE 
PED	7* 1559- 3 
8	r$   