Ë
    Ãrœh¡  ã                  ó@   — d Z ddlmZ ddlZddlmZ dd„Zdd„Zd	d„Zy)
z Utilities for working with URLs.é    )ÚannotationsN)Úparsec                ód   — t        j                  d| «      st        dj                  | «      «      ‚y )Nz[a-zA-Z0-9_-]*z,"{}" is outside the restricted character set)ÚreÚ	fullmatchÚ
ValueErrorÚformat)Úparts    úƒ/var/www/html/ai-insurance-compliance-backend/venv/lib/python3.12/site-packages/google/generativeai/notebook/sheets_sanitize_url.pyÚ_validate_url_partr      s-   € Ü<‰<Ð(¨$Ô/ÜÐG×NÑNÈtÓTÓUÐUð 0ó    c                ó”   — t        j                  | «      j                  «       D ]"  \  }}t        |«       |D ]  }t        |«       Œ Œ$ y )N)r   Úparse_qsÚitemsr   )r
   ÚkeyÚvaluesÚvalues       r   Ú_validate_url_query_or_fragmentr      sF   € Ü—~‘~ dÓ+×1Ñ1Ó3ò &‰ˆˆVÜ˜3ÔØò 	&ˆEÜ˜uÕ%ñ	&ñ&r   c                óP  — t        j                  | «      }|j                  dk7  r$t        dj	                  |j                  «      «      ‚|j
                  dvr$t        dj	                  |j
                  «      «      ‚	 |j                  j                  d«      D ]  }t        |«       Œ 	 |j                  r$t        dj	                  |j                  «      «      ‚	 t        |j                  «       	 t        |j                  «       | S # t        $ r*}t        dj	                  |j                  «      «      |‚d}~ww xY w# t        $ r*}t        d	j	                  |j                  «      «      |‚d}~ww xY w# t        $ r*}t        d
j	                  |j                  «      «      |‚d}~ww xY w)aØ  Sanitize a Sheets URL.

    Run some saftey checks to check whether `url` is a Sheets URL. This is not a
    general-purpose URL sanitizer. Rather, it makes use of the fact that we know
    the URL has to be for Sheets so we can make a few assumptions about (e.g. the
    domain).

    Args:
      url: The url to sanitize.

    Returns:
      The sanitized url.

    Raises:
      ValueError: If `url` does not match the expected restrictions for a Sheets
      URL.
    Úhttpsz/Scheme for Sheets url must be "https", got "{}")zdocs.google.comzsheets.googleapis.comz9Domain for Sheets url must be "docs.google.com", got "{}"ú/z%Invalid path for Sheets url, got "{}"Nz(Params component must be empty, got "{}"z&Invalid query for Sheets url, got "{}"z)Invalid fragment for Sheets url, got "{}")r   ÚurlparseÚschemer   r	   ÚnetlocÚpathÚsplitr   Úparamsr   ÚqueryÚfragment)ÚurlÚparse_resultr   Úexcs       r   Úsanitize_sheets_urlr#   "   s”  € ô$ —>‘> #Ó&€LØ×Ñ˜gÒ%ÜØ=×DÑDÀ\×EXÑEXÓYó
ð 	
ð ×ÑÐ"NÑNÜØG×NÑNÈ|×ObÑObÓcó
ð 	
ð
eØ$×)Ñ)×/Ñ/°Ó4ò 	)ˆHÜ˜xÕ(ñ	)ð ×ÒÜÐC×JÑJÈ<×K^ÑK^Ó_Ó`Ð`ðÜ'¨×(:Ñ(:Ô;ðÜ'¨×(=Ñ(=Ô>ð €Jøô/ ò eÜÐ@×GÑGÈ×HYÑHYÓZÓ[ÐadÐdûðeûô ò ÜØ4×;Ñ;¸L×<NÑ<NÓOó
àð	ûðûô ò ÜØ7×>Ñ>¸|×?TÑ?TÓUó
àð	ûðúsH   Á<+D ÃD< Ã/E2 Ä	D9Ä%D4Ä4D9Ä<	E/Å%E*Å*E/Å2	F%Å;%F Æ F%)r
   ÚstrÚreturnÚNone)r    r$   r%   r$   )	Ú__doc__Ú
__future__r   r   Úurllibr   r   r   r#   © r   r   ú<module>r+      s#   ðñ 'Ý "ã 	Ý óVó
&ô7r   