8fD (ddlmZddlmZddlmZmZmZddlm Z erddl m Z GddZ e d krZdd lZdd lmZdd lmZdd lmZmZddlmZddlmZGddZeZeed Sd S))sqrt) lru_cache)SequenceTuple TYPE_CHECKING) ColorTripletTableceZdZdZdeeeeeffdZdedefdZ ddZ e d d eeeefdefd Z d S)PalettezA palette of available colors.colorsc||_dSN)_colors)selfrs x/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/rich/palette.py__init__zPalette.__init__s  numberreturnc*t|j|Sr)r r)rrs r __getitem__zPalette.__getitem__sT\&122rr c Tddlm}ddlm}ddlm}ddlm}|dddd t|j d d d }t|j D]S\}}| t|t||d||j|T|S)NrColorStyle)Textr indexRGBrr z colorsTright)titlecaption highlightcaption_justifyz )bgcolor)style)pip._vendor.rich.colorrpip._vendor.rich.stylerpip._vendor.rich.textrpip._vendor.rich.tabler lenr enumerateadd_rowstrreprfrom_rgb)rrrrr tabler colors r__rich__zPalette.__rich__s000000000000......000000   4<((111#   &dl33  LE5 MME U XUU>5>53I%J%J%JKKK      ri)maxsizer4c|\t|jjdtdtffd }t t t|j|}|S)zFind a color from a palette that most closely matches a given color. Args: color (Tuple[int, int, int]): RGB components in range 0 > 255. Returns: int: Index of closes matching color. r rc |\}}} |zdz} |z } |z } |z }d|z|z|zdz d|z|zzd|z |z|zdz zS)zGet the distance to a color.ii) r red2green2blue2red_meanredgreenblue_sqrtblue1 get_colorgreen1red1s rget_color_distancez)Palette.match..get_color_distance:s"+)E"2"2 D&%t )H+CVOE5=D5>S(3.14e)e#$8^t+d2q8: r)key)rrrintfloatminranger-) rr4rI min_indexrDrErFrGrHs @@@@@rmatchz Palette.match,s$feL,  c e          c$,//006HIII rN)rr ) __name__ __module__ __qualname____doc__rrrKrr rr5rrPr<rrr r s((xc3m(<=3#3,33330Yt5c3/Crr __main__N)Iterabler)ConsoleConsoleOptions)Segmentrc.eZdZdededeefdZdS)ColorBoxconsoleoptionsrc #K|jjdz }td|D]}t|jD]}||jz }||dzz }t j||d\}} } t j||d|z dz zd\} } } t j|dz| dz| dz}t j| dz| dz| dz}tdt||Vtj VdS) Nrrg?r9u▄)r4r') sizeheightrN max_widthcolorsys hls_to_rgbrr2rYrline)rr\r]rbyxhlr1g1b1r2g2b2r'r4s r__rich_console__zColorBox.__rich_console__Ts+\(1,F1f%% % %w011NNAG--AVaZ(A!)!4Q3!?!?JBB!)!4QQZ!^8Lc!R!RJBB#nR#XrCxcJJG!N28R#XrCxHHE!%UG)L)L)LMMMMMMlnn$$$$ % %rN)rQrRrSrWrXrVrYrqr<rrr[r[SsE %" %-; % g  % % % % % %rr[)mathr functoolsrtypingrrr color_tripletr r,r r rQrdrVr)rpip._vendor.rich.consolerWrXpip._vendor.rich.segmentrYr*rr[r\printr<rrrysm1111111111''''''-,,,,,,========@ zOOO,,,,,,@@@@@@@@000000,,,,,,%%%%%%%% giiG MM((**3r