Ë
    H~éjöS  ã                  ób  — U d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZ ddlmZ ddlmZ ddlZddlmZmZmZ  ej*                  d	«      Zd
ZdZdZdZdZe G d„ d«      «       Z ed¬«       G d„ d«      «       Z	 	 	 	 	 	 	 	 d5d„Z G d„ de«      Z dddddœZ! ejD                  d«      Z#d6d„Z$dZ%d7d „Z&i Z'd!e(d"<   d8d#„Z)dZ*d9d$„Z+d:d%„Z,d&Z-d'Z.d(Z/d)Z0d*Z1	 d;	 	 	 d<d+„Z2d;d=d,„Z3	 	 	 d>	 	 	 	 	 	 	 d?d-„Z4	 	 	 	 	 	 	 	 d@d.„Z5dAd/„Z6	 d;	 	 	 dBd0„Z7d;dCd1„Z8dDd2„Z9	 dE	 	 	 	 	 	 	 dFd3„Z:dGd4„Z;y)Hz”License validation and caching for CloakBrowser Pro.

Handles license key resolution, server validation with local caching,
and Pro version checks.
é    )ÚannotationsN)ÚMapping)Ú	dataclass)ÚPathé   )Úget_cache_dirÚget_platform_tagÚnormalize_release_channelÚcloakbrowserz-https://cloakbrowser.dev/api/license/validatez-https://cloakbrowser.dev/api/download/versionz2https://cloakbrowser.dev/api/license/session/counti€Q i  c                  ó,   — e Zd ZU ded<   ded<   ded<   y)ÚLicenseInfoÚboolÚvalidÚstrÚplanú
str | NoneÚexpiresN©Ú__name__Ú
__module__Ú__qualname__Ú__annotations__© ó    úK/home/boxd/.venv-cloak/lib/python3.12/site-packages/cloakbrowser/license.pyr   r   "   s   … àƒKØ
ƒIØÔr   r   T)Úfrozenc                  ó6   — e Zd ZU ded<   ded<   ded<   ded<   y)ÚProReleaseInfor   ÚversionÚrequested_channelÚresolved_channelr   ÚfallbackNr   r   r   r   r   r   )   s   … àƒLØÓØÓØ„Nr   r   c           	     ó  — t        | j                  d| j                  d|«      «      «      }t        | j                  d| j                  dd«      «      «      }| j                  d«      }t        ||||�t        |«      ¬«      S ||k7  ¬«      S )uè   Build a ProReleaseInfo from a resolution-sidecar dict (snake_case, with a
    camelCase fallback for sidecars written by an older JS wrapper). A missing
    ``fallback`` defaults to ``requested != resolved`` â€” mirrors JS and .NET.r    ÚrequestedChannelr!   ÚresolvedChannelÚstabler"   ©r   r    r!   r"   )r   Úgetr   r   )Údatar   ÚchannelÚ	requestedÚresolvedr"   s         r   Ú_release_from_sidecarr-   1   s�   € ô �D—H‘HÐ0°$·(±(Ð;MÈwÓ2WÓXÓY€IÜ�4—8‘8Ð.°·±Ð9JÈHÓ0UÓVÓW€HØ�x‰x˜
Ó#€HÜØØ#Ø!Ø#+Ð#7”�h“ô	ð ð >GÈ(Ñ=Rô	ð r   c                  ó   — e Zd ZdZy)ÚCloakBrowserLicenseErroraI  The Pro binary refused to run for a license reason.

    Raised when a launch fails and the browser process exited with one of the
    Pro binary's license exit codes (see ``_LICENSE_EXIT_MESSAGES``). Carries a
    human-readable reason instead of the opaque "target/browser closed" error
    the caller would otherwise see.
    N)r   r   r   Ú__doc__r   r   r   r/   r/   B   s   „ òr   r/   zjCloakBrowser Pro: session limit reached for your plan. Close another running session or upgrade your plan.z^CloakBrowser Pro: license key is invalid, expired, or missing. Check CLOAKBROWSER_LICENSE_KEY.zdCloakBrowser Pro: couldn't verify your license (license server unreachable or a connection problem).zOCloakBrowser Pro: local configuration problem, ~/.cloakbrowser is not writable.)éL   éM   éN   éO   z"process did exit:\s*exitCode=(\d+)c                ó¸   — t         j                  | xs d«      }|sy	 t        |j                  d«      «      }t
        j                  |«      S # t        $ r Y yw xY w)zÕMap a launch-failure message to a license reason, or None.

    Returns the human message when the browser process exited with a known
    license exit code, else None so a genuine crash propagates unchanged.
    Ú Nr   )Ú_EXIT_CODE_REÚsearchÚintÚgroupÚ
ValueErrorÚ_LICENSE_EXIT_MESSAGESr(   )Ú
error_textÚmatchÚ	exit_codes      r   Úlicense_error_messager@   h   s]   € ô × Ñ  Ò!1¨rÓ2€EÙØðÜ˜Ÿ™ A›Ó'ˆ	ô "×%Ñ% iÓ0Ð0øô ò Ùðús   žA Á	AÁAÚ CLOAKBROWSER_LICENSE_STATUS_FILEc                óJ   — t         j                  | «      }|�t        |«      S dS )ag  Map a raw license exit code (76-79) to a CloakBrowserLicenseError.

    Returns None for any code that is not a known license denial, so a genuine
    crash is never mislabelled. Companion to ``license_error_message`` (which
    parses the code out of a launch-failure string); this takes the integer
    directly, for the post-handshake file-based path.
    N)r<   r(   r/   )ÚcodeÚmsgs     r   Úlicense_error_for_coderE   ‚   s)   € ô !×
$Ñ
$ TÓ
*€CØ,/¨OÔ# CÓ(ÐEÀÐEr   zdict[str, int]Ú_OBSERVED_DENIALSc                óF  — t         j                  | «      }|�|S t        j                  j	                  | «      sy	 t        | d¬«      5 }t        t        j                  |«      «      }ddd«       	 t        j                  | «       t         | <   |S # 1 sw Y   Œ*xY w# t        t        t        t        j                  f$ r( Y 	 t        j                  | «       y# t        $ r Y yw xY ww xY w# t        $ r Y Œpw xY w# 	 t        j                  | «       w # t        $ r Y w w xY wxY w)u÷  Read and consume a denial file written by the binary, returning its code.

    The file holds a single JSON integer (the license exit code). Reading is
    destructive: the file is unlinked afterwards so a later launch can't see a
    stale code, but the observed code is cached in-process so a concurrent
    second guarded call still surfaces the denial. Any problem â€” file absent,
    unreadable, or not a valid int â€” yields None, meaning "no license signal,
    treat as an ordinary error".
    Nzutf-8)Úencoding)rF   r(   ÚosÚpathÚexistsÚopenr9   ÚjsonÚloadÚOSErrorr;   Ú	TypeErrorÚJSONDecodeErrorÚunlink)rJ   ÚcachedÚfhrC   s       r   Úread_denial_filerU   –   s  € ô ×"Ñ" 4Ó(€FØÐØˆô �7‰7�>‰>˜$ÔØð	Ü�$ Ô)ð 	&¨RÜ”t—y‘y “}Ó%ˆD÷	&ð
	Ü�I‰I�dŒOð #Ô�dÑØ€K÷	&ð 	&ûä”Z¤¬D×,@Ñ,@ÐAò Øð	Ü�I‰I�d�OøÜò 	Ùð	úðûô
 ò 	Ùð	ûð	Ü�I‰I�d�OøÜò 	Ùð	ýsƒ   »B ÁBÁ'B Á0C* ÂBÂB Â#C'Â?C9 ÃC Ã	C#Ã"C#Ã&C'Ã'C9 Ã*	C6Ã5C6Ã9D Ã;DÄD Ä	DÄD ÄDÄD c                ó   — 	 t        j                   «       }| j                  d«      D ]7  }	 ||j                  «       j                  z
  t        kD  r|j                  «        Œ9 y# t        $ r Y ŒFw xY w# t        $ r Y yw xY w)zEBest-effort removal of denial files older than the TTL. Never raises.z*.jsonN)ÚtimeÚglobÚstatÚst_mtimeÚ_DENIAL_FILE_TTL_SECONDSrR   rO   )Ú
denial_dirÚnowÚfs      r   Ú_sweep_stale_denialsr_   ¾   sx   € ð	Ü�i‰i‹kˆØ—‘ Ó*ò 	ˆAðØ˜Ÿ™›×*Ñ*Ñ*Ô-EÒEØ—H‘H”Jøñ	øô ò Ùðûäò Ùðús4   ‚(A1 «4A"ÁA1 Á"	A.Á+A1 Á-A.Á.A1 Á1	A=Á<A=c                 óì   — 	 t        j                  «       dz  dz  } | j                  dd¬«       t	        | «       t        | t        j                  «       j                  › d�z  «      S # t        $ r Y yw xY w)u°  Return a fresh, unique path for the binary to write a denial code to.

    Only computes the path (and ensures the parent dir exists) â€” the file is
    created by the binary, and only on a denial, so a granted launch leaves
    nothing behind. Returns None if the directory can't be created (e.g.
    ``~/.cloakbrowser`` not writable), in which case the caller simply skips the
    feature; the fix must never break a launch.
    ú.cloakbrowserÚdenialsT©ÚparentsÚexist_okNz.json)	r   ÚhomeÚmkdirrO   r_   r   ÚuuidÚuuid4Úhex)r\   s    r   Úmint_denial_filerk   Ì   sq   € ðÜ—Y‘Y“[ ?Ñ2°YÑ>ˆ
Ø×Ñ °ÐÔ5ô ˜Ô$ÜˆzœtŸz™z›|×/Ñ/Ð0°Ð6Ñ6Ó7Ð7øô ò Ùðús   ‚-A' Á'	A3Á2A3ÚparamÚenvÚdefault_fileÚcustom_fileÚnonec                óò  — | r&| j                  «       r| j                  «       t        fS t        j                  j	                  dd«      j                  «       }|r|t
        fS t        «       }|dz  }	 |j                  «       j                  «       }|rIt        j                  «       dz  }|j                  «       |j                  «       k(  rt        }nt        }||fS 	 dt        fS # t        $ r
 Y dt        fS w xY w)am  Resolve license key with source tracking for env-injection decisions.

    Returns (key, source) where source is one of the _LICENSE_KEY_SOURCE_*
    constants. The source tells the caller *how* the key was found so they
    can decide whether env injection is needed (e.g. the binary reads the
    default file path directly, so env injection is unnecessary).
    ÚCLOAKBROWSER_LICENSE_KEYr6   zlicense.keyra   N)ÚstripÚ_LICENSE_KEY_SOURCE_PARAMrI   Úenvironr(   Ú_LICENSE_KEY_SOURCE_ENVr   Ú	read_textr   rf   ÚresolveÚ _LICENSE_KEY_SOURCE_DEFAULT_FILEÚ_LICENSE_KEY_SOURCE_CUSTOM_FILErO   Ú_LICENSE_KEY_SOURCE_NONE)Úlicense_keyÚenv_keyÚ	cache_dirÚkey_fileÚcontentÚdefault_cacheÚsources          r   Ú _resolve_license_key_with_sourcerƒ   å   sú   € ñ �{×(Ñ(Ô*Ø×!Ñ!Ó#Ô%>Ð?Ð?ô �j‰j�n‰nÐ7¸Ó<×BÑBÓD€GÙØÔ0Ð1Ð1ô “€IØ˜=Ñ(€Hð
Ø×$Ñ$Ó&×,Ñ,Ó.ˆÙÜ ŸI™I›K¨/Ñ9ˆMØ× Ñ Ó" m×&;Ñ&;Ó&=Ò=Ü9‘ä8�Ø˜VÐ$Ð$ð ð Ô*Ð+Ð+øô ò ØàÔ*Ð+Ð+ðús   Á1A(C# Ã#	C6Ã5C6c                ó"   — t        | «      \  }}|S )z@Resolve the license key: explicit param > env var > file > None.)rƒ   )r|   ÚkeyÚ_s      r   Úresolve_license_keyr‡   
  s   € ä-¨kÓ:�F€CˆØ€Jr   c                óê   — t        | «      \  }}|�'|j                  «       D ��ci c]  \  }}|€Œ	||“Œ c}}nd}t        |||«      }|�$|€t        t        j
                  «      }||t        <   |S c c}}w )u‚  Build child process env dict with any needed license key injection.

    The Pro binary reads ``CLOAKBROWSER_LICENSE_KEY`` from its own process
    environment at startup.  This helper merges the resolved key into the
    child process env dict **only** when injection is necessary:

    * **param** or **custom_file** source -> inject the key into the child env
      (the binary cannot see the wrapper-only key or the custom file path).
    * **env** source -> the key is already in ``os.environ``, so the child
      inherits it naturally.  No injection.
    * **default_file** source -> the binary reads ``~/.cloakbrowser/license.key``
      directly, so injection is unnecessary (and keeps the key out of process
      env for security) â€” *unless* the caller passes a custom ``user_env``,
      which Playwright uses to replace (not merge) the child env; a replaced
      env can drop ``HOME`` and hide the file, so the key is injected then.
    * **none** -> no key at all, no injection.

    When *user_env* is provided (e.g. the caller passed ``env=`` via
    Playwright kwargs), it is used as the base instead of ``os.environ``,
    and the key is injected only when needed.

    When *status_file* is given, the denial-file path (see
    ``LICENSE_STATUS_FILE_ENV``) is added to the child env on every path â€” even
    the "inherit parent env" ones, which then have to become a full
    ``os.environ`` copy because Playwright *replaces* rather than merges the env.

    Returns ``None`` when no injection is needed and no custom user_env was
    given â€” Playwright treats ``env=None`` as "inherit parent env", which
    is correct in those cases.
    N)rƒ   ÚitemsÚ_build_key_envÚdictrI   ru   ÚLICENSE_STATUS_FILE_ENV)	r|   Úuser_envÚstatus_filer…   r‚   ÚkÚvÚbase_envÚresults	            r   Úbuild_launch_envr“     s†   € ôF 3°;Ó?�K€Cˆð Ðð #Ÿ.™.Ó*×<‘$�!�Q¨a©mˆˆA‰Ô<àð ô ˜C ¨Ó2€Fð
 ÐØˆ>Üœ"Ÿ*™*Ó%ˆFØ*5ˆÔ&Ñ'à€Mùó 	=s
   ¤
A/¯A/c                ó¦   — |t         k(  r|€y|t        k(  s| €|S |t        k(  r|€y|�t        |«      nt        t        j
                  «      }| |d<   |S )z>The license-key half of build_launch_env (unchanged behavior).Nrr   )ry   r{   rv   r‹   rI   ru   )r…   r‚   r‘   Úmergeds       r   rŠ   rŠ   J  si   € ð Ô1Ò1°hÐ6FØð Ô)Ò)¨S¨[Øˆð Ô(Ò(¨XÐ-=Øð  (Ð3ŒT�(Œ^¼¼b¿j¹jÓ9I€Fð
 *-€FÐ%Ñ&à€Mr   c                ó|  — t        «       dz  }t        j                  | j                  «       «      j	                  «       }t        ||«      }|r|S 	 t        j                  t        d| id¬«      }|j                  «        |j                  «       }t        |j                  dd«      |j                  dd«      |j                  d	«      ¬
«      }|j                  rt        |||«       |S # t        $ rL}t         j#                  d|«       t        ||d¬«      }|rt         j#                  d«       |cY d}~S Y d}~yd}~ww xY w)zîValidate a license key with the CloakBrowser server.

    Checks a local file cache first (24h TTL). Falls back to stale
    cache if the server is unreachable.

    Returns LicenseInfo if validation succeeded, None on total failure.
    z.license_cacher|   ç      $@©rM   Útimeoutr   Fr   Úsolor   ©r   r   r   z%License validation request failed: %sT)Ú
ignore_ttlz4Using cached license validation (server unreachable)N)r   ÚhashlibÚsha256ÚencodeÚ	hexdigestÚ_read_cacheÚhttpxÚpostÚVALIDATE_URLÚraise_for_statusrM   r   r(   r   Ú_write_cacheÚ	ExceptionÚloggerÚwarning)	r|   Ú
cache_pathÚkey_sharS   Úrespr)   ÚinfoÚeÚstales	            r   Úvalidate_licenser°   i  s  € ô “Ð#3Ñ3€JÜ�n‰n˜[×/Ñ/Ó1Ó2×<Ñ<Ó>€Gä˜ WÓ-€FÙØˆðÜ�z‰zÜØ Ð-Øô
ˆð
 	×ÑÔØ�y‰y‹{ˆäØ—(‘(˜7 EÓ*Ø—‘˜& &Ó)Ø—H‘H˜YÓ'ô
ˆð �:Š:Ü˜ W¨dÔ3Øˆøäò Ü�‰Ð>ÀÔBä˜J¨¸DÔAˆÙÜ�N‰NÐQÔRØ�Läûðús   ÁBC& Ã&	D;Ã/<D6Ä+D;Ä6D;c                ór  — t        | «      }|dk(  rdt        «       › �n	t        «       }t        «       d|› �z  }t        «       d|› �z  }|j                  «       r­	 t	        j                  «       |j                  «       j                  z
  }|t        k  rt|j                  «       rdt        j                  |j                  «       «      }|j                  «       j                  «       }|r!|j                  d«      |k(  rt        |||«      S 	 |dk(  r	t"        › d�nt"        }t%        j                  |dt        «       id¬	«      }	|	j'                  «        |	j                  «       }|j                  d«      }|sy
t)        |j                  dd«      «      }
t+        t)        |«      t)        |j                  d|«      «      |
t-        |j                  d||
k7  «      «      ¬«      }|j.                  j1                  dd¬«       |j3                  d«      }|j5                  t        j6                  |j8                  «      «       t;        j<                  t)        |«      t)        |«      «       |j3                  d«      }|j5                  |j>                  «       t;        j<                  t)        |«      t)        |«      «       |S # t        t        t         f$ r Y �ŒÄw xY w# t@        $ rà}tB        jE                  d|«       	 |j                  «       j                  «       }|sY d
}~y
|j                  «       re	 t        j                  |j                  «       «      }|j                  d«      |k(  rt        |||«      cY d
}~S n# t        t        t         f$ r Y nw xY wt+        ||d|dk(  «      cY d
}~S # t        $ r Y nw xY wY d
}~y
d
}~ww xY w)zBGet the server-resolved Pro release and channel for this platform.ÚpreviewÚpreview_z.last_pro_version_check_z.last_pro_version_resolution_r   z?channel=previewz
X-Platformr—   )Úheadersr™   Nr!   r&   r    r"   r'   Trc   ú.tmpzPro version check failed: %s)#r
   r	   r   rK   rW   rY   rZ   ÚPRO_VERSION_CHECK_INTERVALrM   Úloadsrw   rs   r(   r-   rO   r;   rP   ÚPRO_VERSION_URLr¢   r¥   r   r   r   Úparentrg   Úwith_suffixÚ
write_textÚdumpsÚ__dict__rI   Úreplacer   r§   r¨   Údebug)Úrelease_channelr*   Úmarker_suffixÚmarkerÚresolution_markerÚager)   r   Úversion_urlr¬   r!   ÚreleaseÚresolution_tmpÚtmpr®   s                  r   Úget_pro_latest_releaserÉ   –  sK  € ô (¨Ó8€Gð �iÒð Ô#Ó%Ð&Ñ'äÓð ô
 ‹_Ð!9¸-¸ÐIÑI€FÜ%›Ð,IÈ-ÈÐ*YÑYÐà‡}�}„ð	Ü—)‘)“+ §¡£× 6Ñ 6Ñ6ˆCØÔ/Ò/Ð4E×4LÑ4LÔ4NÜ—z‘zÐ"3×"=Ñ"=Ó"?Ó@�Ø ×*Ñ*Ó,×2Ñ2Ó4�Ù˜tŸx™x¨	Ó2°gÒ=Ü0°°wÀÓHÐHð7ð ˜)Ò#ô ÐÐ/Ñ0ä ð 	ô
 �y‰yØØ!Ô#3Ó#5Ð6Øô
ˆð
 	×ÑÔØ�y‰y‹{ˆØ—(‘(˜9Ó%ˆÙØÜ˜tŸx™xÐ(:¸HÓEÓFÐÜ Ü˜“LÜ! $§(¡(Ð+>ÀÓ"HÓIØ-ÜØ—‘˜ WÐ0@Ñ%@ÓAóô	
ˆð 	�‰×Ñ D°4ÐÔ8Ø*×6Ñ6°vÓ>ˆØ×!Ñ!¤$§*¡*¨W×-=Ñ-=Ó">Ô?Ü
�
‰
”3�~Ó&¬Ð,=Ó(>Ô?Ø× Ñ  Ó(ˆØ�‰�w—‘Ô'Ü
�
‰
”3�s“8œS ›[Ô)ØˆøôI œ¤YÐ/ò 	Úð	ûôL ò Ü�‰Ð3°QÔ7ð	Ø×&Ñ&Ó(×.Ñ.Ó0ˆGÙÜð
 !×'Ñ'Ô)ðÜŸ:™:Ð&7×&AÑ&AÓ&CÓD�DØ—x‘x 	Ó*¨gÒ5Ü4°T¸7ÀGÓLÕLð 6øä¤¬YÐ7ò Ùðúä! '¨7°H¸gÈÑ>RÓSÕSøÜò 	Ùð	úäûð)úsˆ   ÁB+J2 ÄA)K Å0EK Ê2K
Ë	K
Ë	N6ËN1Ë- NÌNÌ#AM-Í&N6Í,NÍ-NÎNÎNÎNÎN6Î	N)Î&N1Î(N)Î)N1Î1N6c                ó8   — t        | «      }|r|j                  S dS )z:Get only the version from the server-resolved Pro release.N)rÉ   r   )rÀ   rÆ   s     r   Úget_pro_latest_versionrË   è  s   € ä$ _Ó5€GÙ%ˆ7�?‰?Ð/¨4Ð/r   c                óö   — 	 t        j                  t        d| id¬«      }|j                  «        |j	                  «       j                  d«      S # t        $ r }t        j                  d|«       Y d}~yd}~ww xY w)u€  How many concurrent sessions (seats) this license is holding right now.

    Deliberately NOT cached: a cached seat count is a wrong seat count. Returns
    None when the number is unknown â€” the server couldn't be reached, or it
    reported the count as unavailable (it does that instead of a false 0 while
    running in leaseless mode). Callers render None as "unavailable".
    r|   r—   r˜   ÚactivezSession count lookup failed: %sN)	r¢   r£   ÚSESSION_COUNT_URLr¥   rM   r(   r§   r¨   r¿   )r|   r¬   r®   s      r   Úget_active_session_countrÏ   î  sh   € ð
Ü�z‰zÜØ Ð-Øô
ˆð
 	×ÑÔØ�y‰y‹{�‰˜xÓ(Ð(øÜò Ü�‰Ð6¸Ô:Üûðús   ‚AA Á	A8ÁA3Á3A8c                óø  — 	 | j                  «       syt        j                  | j                  «       «      }|j	                  d«      |k7  ry|s1|j	                  dd«      }t        j
                  «       |z
  t        kD  ry|j	                  d«      }|r	 ddlm}m} |j                  |«      }|j                  €|j                  |j                  ¬«      }||j                  |j                  «      k  rt        d|j	                  d	d
«      |¬«      S 	 t        |j	                  dd«      |j	                  d	d
«      |¬«      S # t        t         f$ r Y Œ?w xY w# t        j"                  t$        t&        t         f$ r Y yw xY w)z9Read cached license validation if it exists and is fresh.NÚ
key_sha256Úvalidated_atr   r   )ÚdatetimeÚtimezone)ÚtzinfoFr   rš   r›   r   )rK   rM   r·   rw   r(   rW   ÚLICENSE_CACHE_TTLrÓ   rÔ   ÚfromisoformatrÕ   r¾   Úutcr]   r   r;   rP   rQ   rO   ÚKeyError)	rª   r«   rœ   r)   rÒ   r   rÓ   rÔ   Úexp_dts	            r   r¡   r¡     sR  € ð"Ø× Ñ Ô"Øä�z‰z˜*×.Ñ.Ó0Ó1ˆà�8‰8�LÓ! WÒ,ØáØŸ8™8 N°AÓ6ˆLÜ�y‰y‹{˜\Ñ)Ô,=Ò=Øà—(‘(˜9Ó%ˆÙðß7Ø!×/Ñ/°Ó8�Ø—=‘=Ð(Ø#Ÿ^™^°8·<±<˜^Ó@�FØ˜HŸL™L¨¯©Ó6Ò6Ü&¨U¸¿¹À&È&Ó9QÐ[bÔcÐcð 7ô
 Ø—(‘(˜7 EÓ*Ø—‘˜& &Ó)Øô
ð 	
øô ¤	Ð*ò Ùðûô × Ñ ¤'¬8´YÐ?ò ñ ðúsG   ‚E “7E Á2E Á>E ÂA<D> Ä.E Ä>EÅE ÅEÅE Å#E9Å8E9c           
     ó¾  — 	 | j                   j                  dd¬«       | j                  d«      }|j                  t	        j
                  ||j                  |j                  |j                  t        j                  «       dœ«      «       t        j                  t        |«      t        | «      «       y# t        $ r }t        j                  d|«       Y d}~yd}~ww xY w)zGWrite license validation result to local cache (atomic via tmp+rename).Trc   rµ   )rÑ   r   r   r   rÒ   z!Failed to write license cache: %sN)r¹   rg   rº   r»   rM   r¼   r   r   r   rW   rI   r¾   r   rO   r¨   r¿   )rª   r«   r­   Útmp_pathr®   s        r   r¦   r¦   ,  s©   € ð=Ø×Ñ×Ñ¨°tÐÔ<Ø×)Ñ)¨&Ó1ˆØ×ÑœDŸJ™JØ!Ø—Z‘ZØ—I‘IØ—|‘|Ü ŸI™I›Kñ(
ó ô 	ô 	�
‰
”3�x“=¤# j£/Õ2øÜò =Ü�‰Ð8¸!×<Ñ<ûð=ús   ‚B0B3 Â3	CÂ<CÃC)r)   zMapping[str, object]r   r   r*   r   Úreturnr   )r=   r   rÝ   r   )rC   r9   rÝ   zCloakBrowserLicenseError | None)rJ   r   rÝ   ú
int | None)r\   r   rÝ   ÚNone)rÝ   r   )N)r|   r   rÝ   ztuple[str | None, str])r|   r   rÝ   r   )NNN)r|   r   r�   zMapping[str, str | None] | NonerŽ   r   rÝ   údict[str, str] | None)r…   r   r‚   r   r‘   rà   rÝ   rà   )r|   r   rÝ   úLicenseInfo | None)rÀ   r   rÝ   zProReleaseInfo | None)rÀ   r   rÝ   r   )r|   r   rÝ   rÞ   )F)rª   r   r«   r   rœ   r   rÝ   rá   )rª   r   r«   r   r­   r   rÝ   rß   )<r0   Ú
__future__r   r�   rM   ÚloggingrI   ÚrerW   rh   Úcollections.abcr   Údataclassesr   Úpathlibr   r¢   Úconfigr   r	   r
   Ú	getLoggerr¨   r¤   r¸   rÎ   rÖ   r¶   r   r   r-   ÚRuntimeErrorr/   r<   Úcompiler7   r@   rŒ   rE   rF   r   rU   r[   r_   rk   rt   rv   ry   rz   r{   rƒ   r‡   r“   rŠ   r°   rÉ   rË   rÏ   r¡   r¦   r   r   r   ú<module>rì      s+  ðòõ #ã Û Û Û 	Û 	Û Û Ý #Ý !Ý ã ç NÑ Nà	ˆ×	Ñ	˜>Ó	*€à>€ØA€ØHÐ àÐ Ø!Ð ð ÷ð ó ðñ �$Ô÷ð ó ððØ
ðØ),ðØ7:ðàóô"˜|ô ð	0ð	$ð	0ð	ñÐ ð, �—
‘
Ð@ÓA€ó1ð. =Ð ó	Fð" %'Ð �>Ó &óðJ  Ð óó8ð$ $Ð ØÐ Ø#1Ð  Ø"/Ð Ø!Ð ð #ð",Øð",àó",ôJð #Ø04Ø"ð7Øð7à-ð7ð ð7ð ó	7ðtØ	ðØ ðØ,Aðàóó>*ð\ #'ðOØðOàóOôd0óð, 8=ð&Øð&Ø"ð&Ø04ð&àó&ôR=r   