o
    h                     @   sf   d dl mZmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
mZ d dlmZmZ G dd dZd	S )
    )ListSequence)Command)INLINE_STYLES)DOM)Options
OptionsMap)BlockElementc                   @   sd   e Zd ZdZdZdeddfddZdeddfd	d
Zde	fddZ
dededee defddZdS )
StyleStatez
    Handles the creation of inline styles on elements.
    Receives inline_style commands, and generates the element's `style`
    attribute from those.
    stylesstyle_optionsr   returnNc                 C   s   g | _ || _d S Nr   )selfr    r   \/var/www/html/ndineBlogger/venv/lib/python3.10/site-packages/draftjs_exporter/style_state.py__init__   s   
zStyleState.__init__commandc                 C   s<   |j dkr| j|j d S |j dkr| j|j d S d S )Nstart_inline_stylestop_inline_style)namer   appenddataremove)r   r   r   r   r   apply   s
   

zStyleState.applyc                 C   s   | j  S r   )r   )r   r   r   r   is_empty   s   zStyleState.is_emptydecorated_nodeblockblocksc                 C   sr   |}|   s7| jjdd | jD ]&}t| j|tj}t|j	}||d< ||d< d|i|d< t
|j||}q|S )NT)reverser   r    styleinline_style_range)r   r   sortr   getr   r   FALLBACKdictpropsr   create_elementelement)r   r   r   r    noder"   optionsr(   r   r   r   render_styles    s   

zStyleState.render_styles)__name__
__module____qualname____doc__	__slots__r   r   r   r   boolr   r
   r	   r   r-   r   r   r   r   r   
   s    r   N)typingr   r   draftjs_exporter.commandr   draftjs_exporter.constantsr   draftjs_exporter.domr   draftjs_exporter.optionsr   r   draftjs_exporter.typesr	   r
   r   r   r   r   r   <module>   s    