§
    ®	Êjò  ã                  óÈ   — d Z ddlmZ ddlZddlZddlmZ ddlmZm	Z	 ddl
mZmZ ddlmZmZmZ dd„Zdd„Zdd„Zddd„Zedk    r ej         e¦   «         ¦  «         dS dS )aË  Command-line interface for invisible_playwright.

TWO COMMANDS, and that is the whole surface.

It was six: fetch, fetch --force, path, version, clear-cache, doctor. Every one
of them was a step somebody had to know to take, in a package whose entire
promise is that the browser handles itself. The ones that are gone did not lose
their behaviour, they lost their command:

  doctor       every cached engine is checked against the seal by `fetch`, on
               every run. It was the thing most worth doing and the thing least
               likely to be typed, which is the worst combination a subcommand
               can have.
  --force      unnecessary once `fetch` verifies: a tree that does not match the
               seal is replaced because it does not match, not because a flag was
               passed.
  path         `fetch` prints the resolved path as its last line, so
               `$(invisible-playwright fetch)` is the scripting form and it also
               guarantees the thing it names actually exists. `path` promised a
               path and could hand back one to a tree that was wrong.
  clear-cache  deliberately NOT folded in. The cache root belongs to
               invisible_core and not to this package, so pruning "trees no
               seal points at" would delete an engine this package did not put
               there. It was written for invisible_firefox, whose repository
               was deleted on 2026-08-18 while the package stayed on the index,
               so an installed copy still shares that root - and the reason
               holds for anything else built on the core.
               `version` prints the cache location; removing a directory is a
               thing a person can do without a subcommand for it.

The `tag` argument went with them. The seal decides which engine this build runs
and `verify_engine` refuses anything else, so a tag on the command line could
only ever name something that would then be rejected.
é    )ÚannotationsNé   )Ú__version__)ÚBINARY_VERSIONÚFIREFOX_UPSTREAM_VERSION)Ú
cache_rootÚensure_binary)Údeclared_core_pinÚinstalled_core_versionÚrecorded_core_versionÚ_argsúargparse.NamespaceÚreturnÚintc                ó¬  — ddl m} ddlm}m}  |¦   «         }g } |¦   «         D ]\\  }}|€|                     |j        dgf¦  «         Œ% |||¦  «        }|r)|                     |j        t          |¦  «        f¦  «         Œ]|D ]F\  }	}t          d|	› �t          j
        ¬¦  «         |D ] }
t          d|
› �t          j
        ¬¦  «         Œ!ŒG|r2t          t          |¦  «        › d	|j        › �t          j
        ¬¦  «         	 t          ¦   «         }n6# t          $ r)}t          d
|› �t          j
        ¬¦  «         Y d}~dS d}~ww xY wt          |¦  «         dS )aB  Make the engine present and correct, then say where it is.

    The check runs BEFORE the download, not after, and that ordering is the
    point: a cached tree that no longer matches the seal is the case worth
    catching, and it is invisible to a "download if missing" that only looks at
    whether a file exists.
    r   )Úiter_cached_engines)Úactive_sealÚengine_problemsNz%no readable engine (incomplete tree?)z'cached engine does not match the seal: )Úfilez    z7 cached tree(s) will not be used; the sealed engine is zerror: r   )Úinvisible_core.downloadr   Úinvisible_core.sealr   r   ÚappendÚnameÚlistÚprintÚsysÚstderrÚlenÚtagr	   Ú	Exception)r   r   r   r   ÚsealÚbadÚ	directoryÚidentÚproblemsr   ÚproblemÚpathÚes                úHC:\Projects\Muse2API\.venv\Lib\site-packages\invisible_playwright/cli.pyÚ
_cmd_fetchr*   3   sÏ  € ð <Ð;Ð;Ð;Ð;Ð;Ø@Ð@Ð@Ð@Ð@Ð@Ð@Ð@àˆ;‰=Œ=€DØ
€CØ/Ð/Ñ1Ô1ð 9ð 9Ñˆ	�5Øˆ=Ø�JŠJ˜	œÐ)PÐ(QÐRÑSÔSÐSØØ"�? 5¨$Ñ/Ô/ˆØð 	9Ø�JŠJ˜	œ­¨X©¬Ð7Ñ8Ô8Ð8øàð 5ð 5‰ˆˆhÝÐ>¸Ð>Ð>ÅSÄZÐPÑPÔPÐPØð 	5ð 	5ˆGÝÐ"˜Ð"Ð"­¬Ð4Ñ4Ô4Ð4Ð4ð	5à
ð .õ
 	•�S‘”ð ð Ø”ðð Ý"%¤*ð	.ñ 	.ô 	.ð 	.ðÝ‰ŒˆˆøÝð ð ð Ýˆm˜ˆmˆm¥#¤*Ð-Ñ-Ô-Ð-Øˆqˆqˆqˆqˆqøøøøðøøøõ 
ˆ$�K„K€KØˆ1s   Ä D Ä
EÄD=Ä=Ec                óö  — ddl m}  |¦   «         }t          ¦   «         pd}t          ¦   «         }t	          ¦   «         }t          dt          › �¦  «         t          d|› �|rd|› d�ndz   ¦  «         |r||k    rt          d	|› d
�¦  «         t          d|j        › d|j        › d|j	        › �¦  «         t          d|j
        d d…         › d|j        › d�¦  «         t          dt          ¦   «         › �¦  «         dS )Nr   )r   Úunknownúinvisible_playwright zinvisible_core       z   (declared: ==ú)Ú z)                     install record says z  (STALE RECORD)zengine               z
  Firefox z  build zseal                 é   z  [ú]zcache                )r   r   Ú_installed_core_versionÚ_recorded_core_versionÚ_declared_core_pinr   r   r   Úupstream_versionÚbuild_idÚdigestÚoriginr   )r   r   ÚsÚcore_vÚrecordedÚwants         r)   Ú_cmd_versionr=   ^   s>  € ð 0Ð/Ð/Ð/Ð/Ð/Øˆ‰Œ€Aõ %Ñ&Ô&Ð3¨)€FÝ%Ñ'Ô'€HÝÑÔ€DÝ	Ð
/¥+Ð
/Ð
/Ñ0Ô0Ð0Ý	Ð
* &Ð
*Ð
*ÈDÐ.XÐ.HÀÐ.HÐ.HÐ.HÐ.HÐVXÑ
YÑZÔZÐZØð V�H Ò&Ð&ÝÐT¸(ÐTÐTÐTÑUÔUÐUÝ	Ð
[ !¤%Ð
[Ð
[°1Ô3EÐ
[Ð
[ÈqÌzÐ
[Ð
[Ñ\Ô\Ð\Ý	Ð
? !¤(¨3¨B¨3¤-Ð
?Ð
?°A´HÐ
?Ð
?Ð
?Ñ@Ô@Ð@õ 
Ð
0¥*¡,¤,Ð
0Ð
0Ñ1Ô1Ð1Øˆ1ó    úargparse.ArgumentParserc                 ó  — t          j        dd¬¦  «        } |                      ddddt          › dt          › d	t
          › d
�¬¦  «         |                      d¬¦  «        }|                     dd¬¦  «         |                     dd¬¦  «         | S )Nzinvisible-playwrightzinvisible_playwright CLI)ÚprogÚdescriptionz-Vz	--versionÚversionr-   z (BINARY_VERSION=z
, Firefox r.   )ÚactionrC   Úcmd)ÚdestÚfetchzWdownload the engine if missing, check every cached one against the seal, print the path)Úhelpz'print wrapper, core and engine versions)ÚargparseÚArgumentParserÚadd_argumentr   r   r   Úadd_subparsersÚ
add_parser)ÚpÚsubs     r)   Úbuild_parserrP   w   s´   € ÝÔÐ%;ÐIcÐdÑdÔd€Að ‡N‚NØˆk )Ø{­Ð{Ð{ÅnÐ{Ð{Õ`xÐ{Ð{Ð{ð ñ ô ð ð ×
Ò
 Ð
Ñ
&Ô
&€CØ‡N‚N�7ð;ð ñ <ô <ð <ð ‡N‚N�9Ð#L€NÑMÔMÐMØ€Hr>   Úargvúlist[str] | Nonec                óÊ   — t          ¦   «         }|                     | ¦  «        }|j        €|                     d¦  «         t          t
          dœ} ||j                 |¦  «        S )NzKa subcommand is required (try --help, --version, or one of: fetch, version))rG   rC   )rP   Ú
parse_argsrE   Úerrorr*   r=   )rQ   ÚparserÚargsÚdispatchs       r)   ÚmainrY   ‡   sf   € Ý‰^Œ^€FØ×Ò˜TÑ"Ô"€DØ„xÐð 	�ŠÐbÑcÔcÐcåÝðð €Hð ˆ8�D”HÔ˜dÑ#Ô#Ð#r>   Ú__main__)r   r   r   r   )r   r?   )N)rQ   rR   r   r   )Ú__doc__Ú
__future__r   rI   r   r/   r   Úinvisible_corer   r   r   r   r	   Ú_pinr
   r4   r   r2   r   r3   r*   r=   rP   rY   Ú__name__Úexit© r>   r)   ú<module>rb      s3  ðð!ð !ðD #Ð "Ð "Ð "Ð "Ð "à €€€Ø 
€
€
€
à Ð Ð Ð Ð Ð Ø CÐ CÐ CÐ CÐ CÐ CÐ CÐ CØ =Ð =Ð =Ð =Ð =Ð =Ð =Ð =ðð ð ð ð ð ð ð ð ð ð(ð (ð (ð (ðVð ð ð ð2ð ð ð ð $ð $ð $ð $ð $ð" ˆzÒÐØ€C„HˆTˆT‰VŒVÑÔÐÐÐð Ðr>   