
    MhC	                        d dl mZ d dl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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     [/var/www/html/test/jupyter/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__&   s    DGCr   slicec                    d S r   r&   r'   s      r   r(   z_ExplodedList.__setitem__)   s    FIcr   SupportsIndex | slice_T | Iterable[_T]c                *   t          |t                    s'|                                }t          ||dz             }t          |t                    rt	          d|g          }t                                          |t          |                     dS )zl
        Ensure that when `(style_str, 'long string')` is set, the string will be
        exploded.
           zList[_T]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%#@#@AAAAAr   )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" " " "
 GGG XGIII XIB B B B B B B B B B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.
    )r/   r   r   )r9   resultstylestringrestcs         r   r   r   <   s}     )]++ F ) - -v 	- 	-AMM5!+d++,,,,	-    r   N)r9   r   r   r:   )
__future__r   typingr   r   r   r   r   r	   "prompt_toolkit.formatted_text.baser
   typing_extensionsr   __all__r   r   r   r&   r   r   <module>rF      s    " " " " " " I I I I I I I I I I I I I I I I C C C C C C 0//////  WT-...(B (B (B (B (BDH (B (B (BV! ! ! ! ! !r   