o
    -˜Žj«  ã                   @   sf   d dl mZmZmZmZmZ ddd„Zddd„Zdd	„ Zd
d„ Z	ddd„Z
eZ	 ddd„Zdd„ ZdS )é    )ÚInlineKeyboardButtonÚInlineKeyboardMarkupÚKeyboardButtonÚReplyKeyboardMarkupÚ
ForceReplyNc                 C   sb   | du rg } g }| D ]!}g }|D ]}t |tƒrt||ƒnt|Ž }| |¡ q| |¡ q
t|d�S )z®
    Create an InlineKeyboardMarkup from a list of lists of buttons.
    :param rows: List of lists of buttons. Defaults to empty list.
    :return: InlineKeyboardMarkup
    N)Úinline_keyboard)Ú
isinstanceÚstrÚbtnÚappendr   )ÚrowsÚlinesÚrowÚlineÚbutton© r   úU/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/helpers/helpers.pyÚikb
   s   ÿ
r   Úcallback_datac                 C   s   t | fi ||i¤ŽS )zÚ
    Create an InlineKeyboardButton.

    :param text: Text of the button.
    :param value: Value of the button.
    :param type: Type of the button. Defaults to "callback_data".
    :return: InlineKeyboardButton
    )r   )ÚtextÚvalueÚtyper   r   r   r
       s   	r
   c                 C   s>   g }| j D ]}g }|D ]}t|ƒ}| |¡ q| |¡ q|S )zš
    Create a list of lists of buttons from an InlineKeyboardMarkup.

    :param keyboard: InlineKeyboardMarkup
    :return: List of lists of buttons
    )r   Úntbr   )Úkeyboardr   r   r   r   r   r   r   Úbki.   s   
r   c                 C   s<   dD ]}t | |ƒ}|r nq| j|g} |dkr|  |¡ | S )z—
    Create a button list from an InlineKeyboardButton.

    :param button: InlineKeyboardButton
    :return: Button as a list to be used in btn()
    )r   ÚurlÚswitch_inline_queryÚ switch_inline_query_current_chatÚcallback_gamer   )Úgetattrr   r   )r   Úbtn_typer   r   r   r   r   @   s   
ÿ

r   c                 K   s‚   | du rg } g }| D ]-}g }|D ]!}t |ƒ}t|tƒr t|ƒ}nt|tƒr,tdi |¤Ž}| |¡ q| |¡ q
tdd|i|¤ŽS )zï
    Create a ReplyKeyboardMarkup from a list of lists of buttons.

    :param rows: List of lists of buttons. Defaults to empty list.
    :param kwargs: Other arguments to pass to ReplyKeyboardMarkup.
    :return: ReplyKeyboardMarkup
    Nr   r   )r   r   r	   r   Údictr   r   )r   Úkwargsr   r   r   r   Úbutton_typer   r   r   ÚkbX   s   


r$   Tc                 C   s
   t | d�S )z†
    Create a ForceReply.

    :param selective: Whether the reply should be selective. Defaults to True.
    :return: ForceReply
    ©Ú	selective)r   r%   r   r   r   Úforce_replyx   s   
r'   c                    s    ‡ ‡fdd„t dtˆ ƒˆƒD ƒS )z˜
    Split an array into chunks.

    :param input_array: The array to split.
    :param size: The size of each chunk.
    :return: List of chunks.
    c                    s   g | ]
}ˆ ||ˆ … ‘qS r   r   )Ú.0Úi©Úinput_arrayÚsizer   r   Ú
<listcomp>Š   s    zarray_chunk.<locals>.<listcomp>r   )ÚrangeÚlenr*   r   r*   r   Úarray_chunk‚   s    r0   )N)r   )T)Úpyrogram.typesr   r   r   r   r   r   r
   r   r   r$   Úkbtnr'   r0   r   r   r   r   Ú<module>   s    
	



