import{n as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-C21x__mS.js";import{n}from"./iframe-GrlyTB2d.js";import{a as r,i}from"./utils-DUM89eIj.js";import{d as a,l as o,y as s}from"./formatters-CVj-3Vn0-BFaHJqZL.js";import{n as c,t as l}from"./Select-tPi1vIDV.js";var u,d,f,p,m,h,g,_,v,y,b,x;function S(){return(S=e((()=>{u=`p4nQdZ`,d=`_94tg5v`,f=`HyK7Zs`,p=`Mm4hrB`,m=`clxxBQ`,h=`_5pJ7o-`,g=`VV6hKN`,_=`cuQNP0`,v=`w7nIOT`,y=`ed-Afj`,b=`Lbxloe`,x={button:u,valueContainer:d,swatch:f,optionsPalette:p,optionsDetailed:m,option:h,optionPalette:g,optionDetailed:_,optionMeta:v,optionMetaIcon:y,optionMetaLabel:b}})))()}function C({state:e,className:t}){return(0,A.jsx)(`span`,{className:r(x.swatch,t),"data-empty":e===`none`?``:void 0,style:{"--state-color":a[e]}})}function w(e){return!!(e?.icon||e?.label)}function T(e,t){return typeof t?.label==`string`&&t.label.trim()?t.label:e||`empty`}function E(e){return w(e)?(0,A.jsxs)(`span`,{className:x.optionMeta,children:[e?.icon?(0,A.jsx)(`span`,{className:x.optionMetaIcon,children:e.icon}):null,e?.label?(0,A.jsx)(`span`,{className:x.optionMetaLabel,children:e.label}):null]}):null}function D(e,t){return(0,A.jsxs)(`div`,{className:x.valueContainer,children:[(0,A.jsx)(C,{state:e}),E(t)]})}function O({label:e,description:t,disabled:n,placeholder:i,size:a,value:s,onChange:c,options:u=o,stateMeta:d,className:f,clearable:p}){let m=(0,k.useMemo)(()=>Array.from(new Set(u)),[u]),h=m.some(e=>w(d?.[e])),g={getOptionKey:e=>e||`__empty_state__`,getOptionLabel:e=>d?.[e]?.label??e,getOptionAriaLabel:e=>T(e,d?.[e]),renderValue:e=>D(e,d?.[e]),renderOption:e=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(C,{state:e}),h?E(d?.[e]):null]}),buttonClassName:x.button,optionsContentClassName:r(h?x.optionsDetailed:x.optionsPalette),getOptionClassName:()=>r(x.option,h?x.optionDetailed:x.optionPalette)};return(0,A.jsx)(l,{label:e,description:t,disabled:n,placeholder:i,size:a,value:s,onChange:c,options:m,className:f,clearable:p,...g})}var k,A;function j(){return(j=e((()=>{k=t(),s(),i(),c(),S(),A=n(),O.__docgenInfo={description:`Специализированный селект для выбора цветового или статусного состояния. Используется там, где значению соответствует визуальный swatch.`,methods:[],displayName:`StateSelect`,props:{placeholder:{required:!1,tsType:{name:`string`},description:``},options:{required:!1,tsType:{name:`unknown`},description:``,defaultValue:{value:`DEFAULT_VALUE_STATES`,computed:!0}},stateMeta:{required:!1,tsType:{name:`Partial`,elements:[{name:`Record`,elements:[{name:`State`},{name:`signature`,type:`object`,raw:`{
	label?: ReactNode;
	icon?: ReactNode;
}`,signature:{properties:[{key:`label`,value:{name:`ReactNode`,required:!1}},{key:`icon`,value:{name:`ReactNode`,required:!1}}]}}],raw:`Record<State, StateMeta>`}],raw:`Partial<Record<State, StateMeta>>`},description:``},className:{required:!1,tsType:{name:`string`},description:``},clearable:{required:!1,tsType:{name:`boolean`},description:``}},composes:[`Omit`]}})))()}export{j as n,O as t};