ó
    ­[j]  ã                  óÂ   • S SK Jr  S SKrS SKJrJrJr  S SKJr  \R                  " S5      r
\R                  " S5      rSS jrSS jrSS	 jr        SS
 jrSS jrg)é    )ÚannotationsN)ÚAnyÚMappingÚCallable©Úquotez^(?:\.|%2[eE]){1,2}$z	\{(\w+)\}c                ó   • [        U SS9$ )u»   Percent-encode `value` for use in a URI path segment.

Considers characters not in `pchar` set from RFC 3986 Â§3.3 to be unsafe.
https://datatracker.ietf.org/doc/html/rfc3986#section-3.3
z!$&'()*+,;=:@©Úsafer   ©Úvalues    ÚW/home/mande/repo/quber/.venv/lib/python3.13/site-packages/landingai_ade/_utils/_path.pyÚ_quote_path_segment_partr      s   € ô �˜_Ñ-Ð-ó    c                ó   • [        U SS9$ )uÄ   Percent-encode `value` for use in a URI query string.

Considers &, = and characters not in `query` set from RFC 3986 Â§3.4 to be unsafe.
https://datatracker.ietf.org/doc/html/rfc3986#section-3.4
z!$'()*+,;:@/?r
   r   r   s    r   Ú_quote_query_partr      s   € ô �˜_Ñ-Ð-r   c                ó   • [        U SS9$ )uº   Percent-encode `value` for use in a URI fragment.

Considers characters not in `fragment` set from RFC 3986 Â§3.5 to be unsafe.
https://datatracker.ietf.org/doc/html/rfc3986#section-3.5
z!$&'()*+,;=:@/?r
   r   r   s    r   Ú_quote_fragment_partr   &   s   € ô �Ð.Ñ/Ð/r   c                óD  • [         R                  U 5      n[        S[        U5      S5       Ha  nX4   nXQ;  a  [	        SU S35      eX   nUc  SX4'   M(  [        U[        5      (       a  U(       a  SOSX4'   ML  U" [        X   5      5      X4'   Mc     SR                  U5      $ )	z½Replace {name} placeholders in `template`, quoting each value with `quoter`.

Placeholder names are looked up in `values`.

Raises:
    KeyError: If a placeholder is not found in `values`.
é   é   za value for placeholder {z} was not providedÚnullÚtrueÚfalseÚ )	Ú_PLACEHOLDER_REÚsplitÚrangeÚlenÚKeyErrorÚ
isinstanceÚboolÚstrÚjoin)ÚtemplateÚvaluesÚquoterÚpartsÚiÚnameÚvals          r   Ú_interpolater,   /   sœ   € ô ×!Ñ! (Ó+€Eä�1”c˜%“j !Ö$ˆØ‰xˆØÓÜÐ7¸°vÐ=PÐQÓRÐRØ‰lˆØ‰;ØˆE‹HÜ˜œT×"Ñ"Þ!$‘v¨'ˆE‹Háœc &¡,Ó/Ó0ˆE‹Hñ %ð �7‰7�5‹>Ðr   c               ó’  • SnSnU nSU;   a  UR                  SS5      u  pBSU;   a  UR                  SS5      u  pCUn[        XQ[        5      nUR                  S5       H1  n[        R	                  U5      (       d  M  [        SU< SU< S35      e   UnUb  US[        X1[        5      -   -  nUb  US[        X![        5      -   -  nU$ )	uS  Interpolate {name} placeholders in `template` from keyword arguments.

Args:
    template: The template string containing {name} placeholders.
    **kwargs: Keyword arguments to interpolate into the template.

Returns:
    The template with placeholders interpolated and percent-encoded.

    Safe characters for percent-encoding are dependent on the URI component.
    Placeholders in path and fragment portions are percent-encoded where the `segment`
    and `fragment` sets from RFC 3986 respectively are considered safe.
    Placeholders in the query portion are percent-encoded where the `query` set from
    RFC 3986 Â§3.3 is considered safe except for = and & characters.

Raises:
    KeyError: If a placeholder is not found in `kwargs`.
    ValueError: If resulting path contains /./ or /../ segments (including percent-encoded dot-segments).
NÚ#r   Ú?Ú/zConstructed path z contains dot-segment z which is not allowed)r   r,   r   Ú_DOT_SEGMENT_REÚmatchÚ
ValueErrorr   r   )	r%   ÚkwargsÚfragment_templateÚquery_templateÚrestÚpath_templateÚpath_resultÚsegmentÚresults	            r   r8   r8   N   sê   € ð* %)ÐØ!%€Nà€DØ
ˆdƒ{Ø"&§*¡*¨S°!Ó"4ÑˆØ
ˆdƒ{Ø#Ÿz™z¨#¨qÓ1ÑˆØ€Mô ˜}Ô6NÓO€Kð ×$Ñ$ SÖ)ˆÜ× Ñ  ×)Ó)ÜÐ0°±Ð?UÐV]ÑU`Ð`uÐvÓwÐwñ *ð €FØÑ!Ø�#œ ^Ô=NÓOÑOÑOˆØÑ$Ø�#œÐ%6Ô@TÓUÑUÑUˆà€Mr   )r   r#   Úreturnr#   )r%   r#   r&   zMapping[str, Any]r'   zCallable[[str], str]r<   r#   )r%   r#   r4   r   r<   r#   )Ú
__future__r   ÚreÚtypingr   r   r   Úurllib.parser   Úcompiler1   r   r   r   r   r,   r8   © r   r   Ú<module>rC      sv   ðÝ "ã 	÷ñ õ
 ð —*’*Ð4Ó5€à—*’*˜\Ó*€ô	.ô.ô0ðØðàðð !ðð 	ô	õ>1r   