o �J�h,�@s*ddlZddlZddlZddlZejr%ddlZGdd�dej�Z e� d�Z dZ dd d �Z Gd d �d e�ZGdd�dej�Ze�dee�Zdedejejdejejgefdefdd�ZGdd�d�ZzddlmZddlmZddlmZWdSey�ddl mZddl mZddl mZYdSw)�Nc@seZdZdefdd�ZdS)�HasHTML�returncCsdS�N���selfrr�QC:\pinokio\api\whisper-webui.git\app\env\lib\site-packages\markupsafe\__init__.py�__html__ �zHasHTML.__html__N)�__name__� __module__� __qualname__�strr rrrrr sr�_Pz2.1.5�func�t.Callable[_P, str]r�t.Callable[_P, Markup]cst���d �fdd � �}|S) Nr�Markup�args�_P.args�kwargs� _P.kwargsrcsDtt|�t|�|j�}t||��|j�|��|g|�Ri|���Sr)�_escape_argspec�list� enumerate�escape�items� __class__)rrr�arg_list�rrr�wrappedsz)_simple_escaping_wrapper.<locals>.wrapped)rrrrrrrr)� functools�wraps)rr rrr�_simple_escaping_wrappersr#c seZdZdZdZ dCdejdejeded d f�fd d � Z dDd d�Z dej edfd d f�fdd� Z dej edfd d fdd�Z dE�fdd� ZeZdejd d f�fdd� Zd ef�fdd� Zdejej edfd d f�fdd � Zejje_ !dFd"ejed#ed ejd f�fd$d%� Zejje_ !dFd"ejed#ed ejd f�fd&d'� Zejje_ (dGd)ed ejd f�fd*d+� Zejje_d efd,d-�Zd efd.d/�Zed0ejd d fd1d2��Zeej�Zeej �Z eej!�Z!eej"�Z"eej#�Z#eej$�Z$eej%�Z%eej&�Z&eej'�Z'eej(�Z(eej)�Z)eej*�Z*eej+�Z+eej,�Z,eej-�Z-eej.�Z.eej/�Z/e0j1d3k�r>eej2�Z2eej3�Z3d"ed ej4d4f�fd5d6� Z5d"ed ej4d4f�fd7d8� Z6d9ejd:ejd d fd;d<�Z7d=ej8eejfd d fd>d?�Z9d@ed d fdAdB�Z:�Z;S)Hra�A string that is ready to be safely inserted into an HTML or XML document, either because it was escaped or because it was marked safe. Passing an object to the constructor converts it to text and wraps it to mark it safe without escaping. To escape the text, use the :meth:`escape` class method instead. >>> Markup("Hello, <em>World</em>!") Markup('Hello, <em>World</em>!') >>> Markup(42) Markup('42') >>> Markup.escape("Hello, <em>World</em>!") Markup('Hello &lt;em&gt;World&lt;/em&gt;!') This implements the ``__html__()`` interface that some frameworks use. Passing an object that implements ``__html__()`` will wrap the output of that method, marking it safe. >>> class Foo: ... def __html__(self): ... return '<a href="/foo">foo</a>' ... >>> Markup(Foo()) Markup('<a href="/foo">foo</a>') This is a subclass of :class:`str`. It has the same methods, but escapes their arguments and returns a ``Markup`` instance. >>> Markup("<em>%s</em>") % ("foo & bar",) Markup('<em>foo &amp; bar</em>') >>> Markup("<em>Hello</em> ") + "<foo>" Markup('<em>Hello</em> &lt;foo&gt;') r�N�strict�base�encoding�errorsr�te.Selfcs:t|d�r |��}|durt��||�St��||||�S�Nr )�hasattrr �super�__new__)�clsr&r'r(�rrrr-Cs zMarkup.__new__cCs|Srrrrrrr Nr zMarkup.__html__�otherrcs0t|t�s t|d�r|�t��|�|���StSr*)� isinstancerr+rr,�__add__r�NotImplemented�rr0r/rrr2QszMarkup.__add__cCs(t|t�s t|d�r|�|��|�StSr*)r1rr+rr2r3r4rrr�__radd__WszMarkup.__radd__�num�te.SupportsIndexcs t|t�r|�t��|��StSr)r1�intrr,�__mul__r3)rr6r/rrr9]s zMarkup.__mul__�argcsht|t�rt�fdd�|D��}ntt|�d�r$t|t�s$t|�j�}nt|�j�f}��t�� |��S)Nc3s�|] }t|�j�VqdSr)�_MarkupEscapeHelperr)�.0�xrrr� <genexpr>hs�z!Markup.__mod__.<locals>.<genexpr>� __getitem__) r1�tupler+�typerr;rrr,�__mod__)rr:r/rrrBes zMarkup.__mod__cs|jj�dt����d�S)N�(�))rr r,�__repr__rr/rrrEr�zMarkup.__repr__�seqcs|�t��t|j|���Sr)rr,�join�mapr)rrGr/rrrHurFz Markup.join������sep�maxsplitc��fdd�t��||�D�S)Nc�g|]}��|��qSrr/�r<�vrrr� <listcomp>}�z Markup.split.<locals>.<listcomp>)r,�split�rrKrLr/rrrSz�z Markup.splitcrM)NcrNrr/rOrrrrQ�rRz!Markup.rsplit.<locals>.<listcomp>)r,�rsplitrTr/rrrV�rUz Markup.rsplitF�keependscs�fdd�t��|�D�S)NcrNrr/rOrrrrQ�rRz%Markup.splitlines.<locals>.<listcomp>)r,� splitlines)rrWr/rrrX�szMarkup.splitlinescCsddlm}|t|��S)u�Convert escaped markup back into a text string. This replaces HTML entities with the characters they represent. >>> Markup("Main &raquo; <em>About</em>").unescape() 'Main » <em>About</em>' r)�unescape)�htmlrYr)rrYrrrrY�s  zMarkup.unescapecCs�t|�} |�d�}|dkrn|�d|�}|dkrn|d|��||dd���}q |�d�}|dkr6n|�d|�}|dkrAn|d|��||d d���}q,d �|���}|�|���S) u�:meth:`unescape` the markup, remove tags, and normalize whitespace to single spaces. >>> Markup("Main &raquo; <em>About</em>").striptags() 'Main » About' Tz<!--rJz-->N��<�>�� )r�findrHrSrrY)r�value�start�endrrr� striptags�s*   �   �zMarkup.striptags�scCst|�}|j|ur ||�S|S)ztEscape a string. Calls :func:`escape` and ensures that for subclasses the correct type is returned. )rr)r.re�rvrrrr�s z Markup.escape)r[� )r)r)r)c�4t��|�|��\}}}|j}||�||�||�fSr)r,� partitionrr�rrK�lre�rr.r/rrri��zMarkup.partitioncrhr)r,� rpartitionrrrjr/rrrn�rmzMarkup.rpartitionrrcOst|j�}|�|�|||��Sr��EscapeFormatterrr�vformat)rrr� formatterrrr�format�s z Markup.formatrIcCst|j�}|�|�|d|��S)Nrro)rrIrrrrr� format_map�s zMarkup.format_map� format_speccCs|rtd��|S)Nz,Unsupported format specification for Markup.)� ValueError)rrurrr�__html_format__�szMarkup.__html_format__)r$Nr%)rr))r6r7rr))NrJ)F)<r r r �__doc__� __slots__�t�Any�Optionalrr-r �Unionr2r5r9�__rmul__rBrE�IterablerHr8�ListrSrV�boolrXrYrd� classmethodrr#r?� capitalize�title�lower�upper�replace�ljust�rjust�lstrip�rstrip�center�strip� translate� expandtabs�swapcase�zfill�casefold�sys� version_info� removeprefix� removesuffix�Tuplerirnrs�Mappingrtrw� __classcell__rrr/rrs�#�����  & ���� ���� ���  -                   � �rcsPeZdZdZdejejgefddf�fdd� Zdejde de fd d �Z �Z S) rp�rrrNcs||_t���dSr)rr,�__init__)rrr/rrr�szEscapeFormatter.__init__rarucCsjt|d�r |�|�}n#t|d�r$|rtd|�dt|��d���|��}n tj�||t|��}t|� |��S)Nrwr zFormat specifier z given, but z{ does not define __html_format__. A class that defines __html__ must define __html_format__ to work with format specifiers.) r+rwrvrAr �string� Formatter� format_fieldrr)rrarurfrrrr� s   � zEscapeFormatter.format_field) r r r ryrz�Callabler{rr�rr�r�rrr/rrps$ rp� _ListOrDict�obj�iterablercCs2|D]\}}t|t�st|d�r||�||<q|S)z,Helper for various string-wrapped functions.r )r1rr+)r�r�r�keyrarrrr s  �rc@s�eZdZdZdZdejdejejgefddfdd�Z d ejdd fd d �Z de fd d�Z de fdd�Z defdd�Zdefdd�ZdS)r;z"Helper for :meth:`Markup.__mod__`.�r�rr�rrNcCs||_||_dSrr�)rr�rrrrr�0s z_MarkupEscapeHelper.__init__�itemr)cCs|�|j||j�Sr)rr�r)rr�rrrr?4�z_MarkupEscapeHelper.__getitem__cCst|�|j��Sr)rrr�rrrr�__str__7sz_MarkupEscapeHelper.__str__cCst|�t|j���Sr)rr�reprr�rrrrrE:r�z_MarkupEscapeHelper.__repr__cC� t|j�Sr)r8r�rrrr�__int__=� z_MarkupEscapeHelper.__int__cCr�r)�floatr�rrrr� __float__@r�z_MarkupEscapeHelper.__float__)r r r rxryrzr{r�rr�r?rr�rEr8r�r�r�rrrrr;+s&r;r^r�)� escape_silent)�soft_str)rrrr)!r!r�r��typingrz� TYPE_CHECKING�typing_extensions�te�Protocolr� ParamSpecr� __version__r#rrr�rp�TypeVarr�dictr�rr{r�rr;� _speedupsrr�r�� ImportError�_nativerrrr�<module>sB   h� �� �      �
Memory