
     hp	                        d dl mZ d dlmZmZmZmZmZmZm	Z	 d dl
mZ erd dlmZ dgZ ede          Z G d d	ee                   ZddZdS )    )annotations)TYPE_CHECKINGIterableListTypeVarUnioncastoverload)OneStyleAndTextTuple)SupportsIndexexplode_text_fragments_T)boundc                  t     e Zd ZdZdZddZd fd
ZddZedd            Z	edd            Z	d fdZ	 xZ
S )_ExplodedListz
    Wrapper around a list, that marks it as 'exploded'.

    As soon as items are added or the list is extended, the new items are
    automatically exploded as well.
    Titemr   returnNonec                2    |                      |g           d S N)extend)selfr   s     W/var/www/html/Sam_Eipo/venv/lib/python3.11/site-packages/prompt_toolkit/layout/utils.pyappendz_ExplodedList.append   s    TF    lstIterable[_T]c                d    t                                          t          |                     d S r   )superr   r   )r   r   	__class__s     r   r   z_ExplodedList.extend   s(    -c2233333r   indexr   c                    t           r   )NotImplementedError)r   r!   r   s      r   insertz_ExplodedList.insert!   s    !!r   valuec                    d S r    r   r!   r%   s      r   __setitem__z_ExplodedList.__setitem__&       r   slicec                    d S r   r'   r(   s      r   r)   z_ExplodedList.__setitem__*   r*   r   SupportsIndex | slice_T | Iterable[_T]c           	     F   t          |t                    s'|                                }t          ||dz             }t          |t                    rt	          d|g          }t                                          |t          t	          d|                               dS )zl
        Ensure that when `(style_str, 'long string')` is set, the string will be
        exploded.
           zList[_T]r   N)
isinstancer+   	__index__tupler	   r   r)   r   )r   r!   r%   	int_indexr    s       r   r)   z_ExplodedList.__setitem__.   s     %'' 	4))I)Y]33EeU## 	.eW--EE#9$~u:U:U#V#VWWWWWr   )r   r   r   r   )r   r   r   r   )r!   r   r   r   r   r   )r!   r   r%   r   r   r   )r!   r+   r%   r   r   r   )r!   r-   r%   r.   r   r   )__name__
__module____qualname____doc__explodedr   r   r$   r
   r)   __classcell__)r    s   @r   r   r      s          H   4 4 4 4 4 4" " " "
    X    XX X X X X X X X X Xr   r   	fragmentsr   r   _ExplodedList[_T]c                    t          | t                    r| S g }| D ]$^}}}|D ]}|                    ||g|R            %t          |          S )a.  
    Turn a list of (style_str, text) tuples into another list where each string is
    exactly one character.

    It should be fine to call this function several times. Calling this on a
    list that is already exploded, is a null operation.

    :param fragments: List of (style, text) tuples.
    )r1   r   r   )r;   resultstylestringrestcs         r   r   r   >   s}     )]++ F ) - -v 	- 	-AMM5!+d++,,,,	-    r   N)r;   r   r   r<   )
__future__r   typingr   r   r   r   r   r	   r
   "prompt_toolkit.formatted_text.baser   typing_extensionsr   __all__r   r   r   r'   r   r   <module>rH      s    " " " " " " P P P P P P P P P P P P P P P P P P C C C C C C 0//////  WT-...*X *X *X *X *XDH *X *X *XZ! ! ! ! ! !r   