
    %h                       S SK Jr  S SKrS SKrS SKrS SKrS SKJr  S SKJ	r	  S SKJ
r
  S SKJr  S SKJr  SS	KJr  SS
 jr\R                   " S\5        SS jr\" / \" S5      QSPSP75      R)                  5       r\" S\5      r\" S\S-   5      r\" S\S-   5      r\" S\S-   5      rSS jrSS jrS\R8                  R:                  ;  a%  \R8                  R:                  R=                  S5        S S jrS!S jr g)"    )annotationsN)quote)unquote)	urlencode)urlsplit)
urlunsplit   )iter_multi_itemsc                r    [        U R                  U R                  U R                   SS9nXR                  4$ )zJUsed in :func:`uri_to_iri` after unquoting to re-quote any
invalid bytes.
 safe)r   objectstartend)eouts     E/var/www/auris/envauris/lib/python3.13/site-packages/werkzeug/urls.py_codec_error_url_quoter      s/     155)
3C:    werkzeug.url_quotec                   ^ SR                  S [        U5       5       5      n[        R                  " SU S3[        R                  5      mSU4S jjnSU  3Ul        U$ )zCreate a function that unquotes all percent encoded characters except those
given. This allows working with unquoted characters if possible while not changing
the meaning of a given part of a URL.
|c              3  <   #    U  H  n[        U5      S  v   M     g7f)02XN)ord).0cs     r   	<genexpr>%_make_unquote_part.<locals>.<genexpr>"   s     >1#a&s   z((?:%(?:z))+)c                   > [        TR                  U 5      5      n/ nU H:  nUR                  [        USS5      5        UR                  [	        US5      5        M<     SR                  U5      $ )Nzutf-8r   r   )itersplitappendr   nextjoin)valuepartsr   partpatterns       r   _unquote_partial,_make_unquote_part.<locals>._unquote_partial%   s]    W]]5)*DJJwtW.BCDJJtE2'  wws|r   	_unquote_)r'   strreturnr.   )r&   sortedrecompileI__name__)namecharschoicesr+   r*   s       @r   _make_unquote_partr8      sW    
 hh>u>>Gjj8G9D12448G #,D6 2r   !   %      fragmentqueryz&=+#pathz/?#userz:@/?#c                (   [        U 5      n[        UR                  5      n[        UR                  5      n[        UR                  5      nUR                  (       a  [        UR                  5      nOSnSU;   a  SU S3nUR                  (       a  U SUR                   3nUR                  (       aI  [        UR                  5      nUR                  (       a  [        UR                  5      nU SU 3nU SU 3n[        UR                  XRX445      $ )a  Convert a URI to an IRI. All valid UTF-8 characters are unquoted,
leaving all reserved and invalid characters quoted. If the URL has
a domain, it is decoded from Punycode.

>>> uri_to_iri("http://xn--n3h.net/p%C3%A5th?q=%C3%A8ry%DF")
'http://\u2603.net/p\xe5th?q=\xe8ry%DF'

:param uri: The URI to convert.

.. versionchanged:: 3.0
    Passing a tuple or bytes, and the ``charset`` and ``errors`` parameters,
    are removed.

.. versionchanged:: 2.3
    Which characters remain quoted is specific to each part of the URL.

.. versionchanged:: 0.15
    All reserved and invalid characters remain quoted. Previously,
    only some reserved characters were preserved, and invalid bytes
    were replaced instead of left quoted.

.. versionadded:: 0.6
r   :[]@)r   _unquote_pathr>   _unquote_queryr=   _unquote_fragmentr<   hostname_decode_idnaportusername_unquote_userpasswordr   scheme)urir(   r>   r=   r<   netlocauthrM   s           r   
uri_to_irirR   =   s    0 SME$D5;;'E 0H~~enn-
f}VHAzz81UZZL)~~U^^,>>$U^^4HV1XJ'D66(#u||V5CDDr   c                H   [        U 5      n[        UR                  SS9n[        UR                  SS9n[        UR                  SS9nUR
                  (       a+  UR
                  R                  S5      R                  S5      nOSnSU;   a  S	U S
3nUR                  (       a  U SUR                   3nUR                  (       aG  [        UR                  SS9nUR                  (       a  [        UR                  SS9nU SU 3nU SU 3n[        UR                  XRX445      $ )a  Convert an IRI to a URI. All non-ASCII and unsafe characters are
quoted. If the URL has a domain, it is encoded to Punycode.

>>> iri_to_uri('http://\u2603.net/p\xe5th?q=\xe8ry%DF')
'http://xn--n3h.net/p%C3%A5th?q=%C3%A8ry%DF'

:param iri: The IRI to convert.

.. versionchanged:: 3.0
    Passing a tuple or bytes, the ``charset`` and ``errors`` parameters,
    and the ``safe_conversion`` parameter, are removed.

.. versionchanged:: 2.3
    Which characters remain unquoted is specific to each part of the URL.

.. versionchanged:: 0.15
    All reserved characters remain unquoted. Previously, only some reserved
    characters were left unquoted.

.. versionchanged:: 0.9.6
   The ``safe_conversion`` parameter was added.

.. versionadded:: 0.6
z%!$&'()*+,/:;=@r   z%!$&'()*+,/:;=?@z%!#$&'()*+,/:;=?@idnaasciir   rA   rB   rC   z%!$&'()*+,;=rD   )r   r   r>   r=   r<   rH   encodedecoderJ   rK   rM   r   rN   )irir(   r>   r=   r<   rP   rQ   rM   s           r   
iri_to_urirY   q   s    2 SME "34D%++$67EU^^*=>H~~&&v.55g>
f}VHAzz81UZZL)~~U^^.9>>U^^.AHV1XJ'D66(#u||V5CDDr   zitms-servicesc                    U R                  S5      n UR                  S5      $ ! [         a    U s $ f = f! [         a     Of = f/ nUR	                  S5       HU  n UR                  UR                  S5      5        M&  ! [         a$    UR                  UR                  S5      5         MS  f = f   SR                  U5      $ )NrU   rT      ..)rV   UnicodeEncodeErrorrW   UnicodeDecodeErrorr#   r$   r&   )domaindatar(   r)   s       r   rI   rI      s    }}W%
{{6""     E

4 	/LLV,-! 	/LLW-.	/ ! 88E?s-   % 7 44
AA B  *B.-B.c                d    [        U 5       Vs/ s H  oS   c  M
  UPM     nn[        USS9$ s  snf )Nr	   z!$'()*,/:;?@r   )r
   r   )r=   xitemss      r   
_urlencoderd      s4    (/D/1Q4Q/EDU00 Es   	--)r   UnicodeErrorr/   ztuple[str, int])r5   r.   r6   r.   r/   zt.Callable[[str], str])rO   r.   r/   r.   )rX   r.   r/   r.   )r_   r.   r/   r.   )r=   z1t.Mapping[str, str] | t.Iterable[tuple[str, str]]r/   r.   )!
__future__r   codecsr1   typingturllib.parseurllibr   r   r   r   r   datastructuresr
   r   register_errorr8   bytesrangerW   _always_unsaferG   rF   rE   rL   rR   rY   parseuses_netlocr$   rI   rd    r   r   <module>rt      s    "  	      " ! # ,   *,B C2 1t1d1D1299;&z>B #G^f-DE"6>E+AB"6>G+CD1Eh4Et &,,222
LL##O421r   