L iUddlmZddlmZmZmZmZddlmZddl m Z ddl m Z ddl mZddlmZddlmZdd lmZmZdd lmZerdd lmZdd lmZdd lmZedZded< ddZ ddZ!Gdde Z"y)) annotations) TYPE_CHECKINGLiteral TypeAliascast)Self)DeltaGenerator)compute_and_register_element_id)StreamlitAPIException)Block) ForwardMsg)enqueue_messageget_script_run_ctx)register_widget) TracebackType)Cursor)WidgetCallback)smalllargemediumr DialogWidthc|dk(r$tjjjS|dk(r$tjjjStjjj S)zMaps the user-provided literal to a value of the DialogWidth proto enum. Returns the mapped enum field for "small" by default and otherwise the mapped type. rr) BlockProtoDialogrLARGEMEDIUMSMALL)widths c/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/streamlit/elements/lib/dialog.py_process_dialog_width_inputr )s\   ,,222   ,,333    ( ( . ..c`t}|r"|r|jr tdd|_yyy)aCheck whether a dialog has already been opened in the same script run. Only one dialog is supposed to be opened. The check is implemented in a way that for a script run, the open function can only be called once. One dialog at a time is a product decision and not a technical one. Raises ------ StreamlitAPIException Raised when a dialog has already been opened in the current script run. zOnly one dialog is allowed to be opened at the same time. Please make sure to not call a dialog-decorated function more than once in a script run.TN)rhas_dialog_openedr ) should_openscript_run_ctxs r!_assert_first_dialog_to_be_openedr&8s@()N~  + +'k ,0( &{r!ceZdZedddd d dZ d fd ZddZddZdd Zdfd Z dfd Z xZ S)rTrignore) dismissibler on_dismissc v|dvrt|std|dt}||j_||j_t ||j_|dk7}d}|rdt}tddd||||t|s t|nd}||j_ t|t|r|ndd d |d |jjr |jjjng} t!d |j#|t$} | | _|| _| S)N)r(rerunzYou have passed zI to `on_dismiss`. But only 'ignore', 'rerun', or a callable is supported.r(dialogFcallback)user_keykey_as_main_identitydgtitler)rr*c|SNxs rz Dialog._create..sqr!c|Sr4r5r6s rr8z Dialog._create..sQr! trigger_value)on_change_handler deserializer serializerctx value_typer) block_protodg_type)callabler rr-r2r)r rrr stridr _active_dg_cursor delta_pathr_blockr _delta_path_current_proto) parentr2r)rr*r@is_dismiss_activated element_idr>rGr-s r_createzDialog._createRsH 0 0*9M'":,/77  !l #(  )4 &#>u#E   *X5 %&C8%*'2::2F3z?J J%/K   ! 080D*$(&*  5;4E4E4M4MF   % % 0 0SU h +v VW' + r!cFt|||||d|_d|_yr4)super__init__rJrI)selfroot_containercursorrK block_type __class__s rrQzDialog.__init__s* D26-1r!c|j |j tdt|t }|j|j j dd|jjj|j||jjj_ |jj|_t|y)zISend an updated proto message to indicate the open-status for the dialog.Nz;Dialog not correctly initialized. This should never happen.) rJrI RuntimeErrorr&r metadatarGdelta add_blockCopyFromr-is_openr)rRr$msgs r_updatezDialog._updates    &$*:*:*BM  *+6l%)%5%5 " $$T%8%89-8 ""*!ii11r!c&|jdy)NTr_rRs ropenz Dialog.opens Tr!c&|jdy)NFrarbs rclosez Dialog.closes Ur!c$t||Sr4)rP __enter__)rRrVs rrgzDialog.__enter__s  r!c&t||||Sr4)rP__exit__)rRexc_typeexc_valexc_tbrVs rrizDialog.__exit__s w'6::r!) rKr r2rCr)boolrrr*z+Literal['ignore', 'rerun'] | WidgetCallbackreturnr) rSz int | NonerTz Cursor | NonerKzDeltaGenerator | NonerUz str | NonernNoner$rmrnro)rnro)rnr)rjztype[BaseException] | NonerkzBaseException | NonerlzTracebackType | NonernzLiteral[False]) __name__ __module__ __qualname__ staticmethodrNrQr_rcrergri __classcell__)rVs@rrrQs !$BJ === =  = @ = ==~ 2" 2 2& 2  2  2";,;&;% ;  ;;r!rN)rrrnz'BlockProto.Dialog.DialogWidth.ValueTyperp)# __future__rtypingrrrrtyping_extensionsrstreamlit.delta_generatorr streamlit.elements.lib.utilsr streamlit.errorsr streamlit.proto.Block_pb2r rstreamlit.proto.ForwardMsg_pb2r 7streamlit.runtime.scriptrunner_utils.script_run_contextrrstreamlit.runtime.statertypesrstreamlit.cursorrrr__annotations__r r&rr5r!rrsp#::"4H2954#'6 !;< Y< /  /, /02r;^r;r!