L i UddlmZddlmZddlmZmZmZddlm Z m Z m Z m Z m Z mZddlmZddlmZddlmZddlmZeed zZd ed <eed zZd ed <eed zZd ed<eed zZd ed<eedzZd ed<edZd ed<edZd ed<edZ d ed<ddddZ!eGddZ"d-d.dZ# d/ d0dZ$d1d Z%d2d!Z&d3d"Z'd4d#Z(d5d$Z)d6d%Z*d&d'd(d&d(d)d*Z+ d7d+Z, d8d,Z-y)9) annotations) dataclass)Literal TypeAliascast)StreamlitInvalidColumnGapErrorStreamlitInvalidHeightError(StreamlitInvalidHorizontalAlignmentErrorStreamlitInvalidSizeError&StreamlitInvalidVerticalAlignmentErrorStreamlitInvalidWidthError)Block)GapSize) HeightConfig) WidthConfigstretchrWidthWithoutContent)rcontentWidthHeightWithoutContentHeightrsmallmediumlarge SpaceSizerrrGapleftcenterright distributeHorizontalAlignmenttopr!bottomr#VerticalAlignmentg?g@g@c*eZdZUdZded<dZded<y) LayoutConfigNzWidth | SpaceSize | NonewidthzHeight | SpaceSize | Noneheight)__name__ __module__ __qualname__r+__annotations__r,i/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/streamlit/elements/lib/layout_utils.pyr*r*3s&*E #*(,F %,r2r*ct|ttfs t||t|tr'dg}|r|j d||vr t||y|dkr t||y)a'Validate the width parameter. Parameters ---------- width : Any The width value to validate. allow_content : bool Whether to allow "content" as a valid width value. Raises ------ StreamlitInvalidWidthError If the width value is invalid. rrrN) isinstanceintstrr append)r+ allow_content valid_stringss r3validate_widthr;9st ec3Z (( >>%"    +  %,UMB B & !( >> r2Nc"t|ttfs t||t|trLg}|r|j d|r|j d|r|j |||vr t||y|dkr t||y)aValidate the height parameter. Parameters ---------- height : Any The height value to validate. allow_content : bool Whether to allow "content" as a valid height value. allow_stretch : bool Whether to allow "stretch" as a valid height value. additional_allowed : list[str] or None Additional string values to allow beyond the base allowed values. Raises ------ StreamlitInvalidHeightError If the height value is invalid. rrrN)r5r6r7r r8extend)r,r9 allow_stretchadditional_allowedr:s r3validate_heightr@Vs0 fsCj ))&-@@&#    +    +   !3 4  &-fmD D ' 1)&-@@ r2ct|ttfs t|t|trgd}||vr t|yt|tr|dkr t|yy)zValidate the size parameter for st.space. Parameters ---------- size : Any The size value to validate. Raises ------ StreamlitInvalidSizeError If the size value is invalid. rrN)r5r6r7r )sizer:s r3validate_space_sizerCsg dS#J ''--$? } $+D1 1 % D# 419'--$- r2ct}t|tr|tvrt||_|St|t t frt ||_|S|dk(r d|_|Sd|_ |SNrT) rr5r7SIZE_TO_REM_MAPPING rem_widthr6float pixel_width use_content use_stretch)r+ width_configs r3get_width_configrMs~=L%%+>">!4U!;   EC< (#&u:   ) #'   $(  r2ct}t|tr|tvrt||_|St|t t frt ||_|S|dk(r d|_|Sd|_ |SrE) rr5r7rF rem_heightr6rH pixel_heightrJrK)r, height_configs r3get_height_configrRs~ NM&#6-@#@#6v#>    FS%L )%([ "  9 $( ! %) ! r2ctjtjtjd}t |t r)|j }|j}||vr||S|tjSt||)z6Convert a gap string or None to a GapSize proto value.r)gap element_type) rSMALLMEDIUMLARGEr5r7lowerkeysNONEr)rTrU gap_mappinggap_size valid_sizess r3 get_gap_sizer_st..K #s99;!&&( { "x( ( || (S| LLr2c,gd}||vr t|dy)Nr st.container)r )horizontal_alignmentvalid_horizontal_alignmentss r3validate_horizontal_alignmentrds("K#>>6 .  ?r2c,gd}||vr t|dy)Nr%ra)r )vertical_alignmentvalid_vertical_alignmentss r3validate_vertical_alignmentrhs$ I!::45GXX;r2startr!end space_between)r r!r"r&r'r#c lgd}t|}||vr$tjjjS|dvr?t dt tjjd|jSt dt tjj|jS)N)rir!rjrkrirjr!%Block.FlexContainer.Justify.ValueTypeJUSTIFY_)map_to_flex_terminologyr FlexContainerJustifyJUSTIFY_UNDEFINEDrgetattrupper) alignment valid_justifyjustifys r3 get_justifyrys@M%i0Gm#""**<<<,, 3 E''//8GMMO;L1M N   /##++ /@B r2c gd}t|}||vr$tjjjSt dt tjjd|jS)Nrm#Block.FlexContainer.Align.ValueTypeALIGN_)rprrqAlignALIGN_UNDEFINEDrrtru)rv valid_alignaligns r3 get_alignrsf-K #I .E K""((888 -##))VEKKM?+CD r2)F)r+rr9boolreturnNone)FTN) r,zHeight | Literal['auto']r9rr>rr?zlist[str] | Nonerr)rBrrr)r+zWidth | SpaceSizerr)r,zHeight | SpaceSizerr)rTz str | NonerUr7rzGapSize.ValueType)rbr$rr)rfr(rr)rv'HorizontalAlignment | VerticalAlignmentrrn)rvrrr{). __future__r dataclassesrtypingrrrstreamlit.errorsrr r r r r streamlit.proto.Block_pb2rstreamlit.proto.GapSize_pb2r streamlit.proto.HeightConfig_pb2rstreamlit.proto.WidthConfig_pb2rr6rr0rrrrrr$r(rFr*r;r@rCrMrRr_rdrhrpryrr1r2r3rs#!++,/97!$wy'9!9Y9!566y6"% (:":i:'"677 7W%JKK 9K34Y4!()P!QYQ&'NO9O   -- - ?> +/ (A $(A(A(A) (A  (AV.0  M( Y   ! 6*$ 6 ( r2