import{arrayType as e,booleanType as t,functionType as n,someType as r,stringType as i}from"../../_util/type.mjs";import a from"../../_util/classNames.mjs";import o from"../../_util/props-util/initDefaultProps.mjs";import s from"../../config-provider/hooks/useConfigInject.mjs";import c from"../style/index.mjs";import l from"./MotionThumb.mjs";import{computed as u,createVNode as d,defineComponent as f,shallowRef as p}from"vue";function m(e){return e.map(e=>typeof e==`object`&&e?e:{label:e?.toString(),title:e?.toString(),value:e})}var h=()=>({prefixCls:String,options:e(),block:t(),disabled:t(),size:i(),value:{...r([String,Number]),required:!0},motionName:String,onChange:n(),"onUpdate:value":n()}),g=(e,{slots:t,emit:n})=>{let{value:r,disabled:i,payload:o,title:s,prefixCls:c,label:l=t.label,checked:u,className:f}=e,p=e=>{i||n(`change`,e,r)};return d(`label`,{class:a({[`${c}-item-disabled`]:i},f)},[d(`input`,{class:`${c}-item-input`,type:`radio`,disabled:i,checked:u,onChange:p},null),d(`div`,{class:`${c}-item-label`,title:typeof s==`string`?s:``},[typeof l==`function`?l({value:r,disabled:i,payload:o,title:s}):l??r])])};g.inheritAttrs=!1;var _=f({name:`ASegmented`,inheritAttrs:!1,props:o(h(),{options:[],motionName:`thumb-motion`}),slots:Object,setup(e,{emit:t,slots:n,attrs:r}){let{prefixCls:i,direction:o,size:f}=s(`segmented`,e),[h,_]=c(i),v=p(),y=p(!1),b=u(()=>m(e.options)),x=(n,r)=>{e.disabled||(t(`update:value`,r),t(`change`,r))};return()=>{let t=i.value;return h(d(`div`,{...r,class:a(t,{[_.value]:!0,[`${t}-block`]:e.block,[`${t}-disabled`]:e.disabled,[`${t}-lg`]:f.value==`large`,[`${t}-sm`]:f.value==`small`,[`${t}-rtl`]:o.value===`rtl`},r.class),ref:v},[d(`div`,{class:`${t}-group`},[d(l,{containerRef:v,prefixCls:t,value:e.value,motionName:`${t}-${e.motionName}`,direction:o.value,getValueIndex:e=>b.value.findIndex(t=>t.value===e),onMotionStart:()=>{y.value=!0},onMotionEnd:()=>{y.value=!1}},null),b.value.map(r=>d(g,{key:r.value,prefixCls:t,checked:r.value===e.value,onChange:x,...r,className:a(r.className,`${t}-item`,{[`${t}-item-selected`]:r.value===e.value&&!y.value}),disabled:!!e.disabled||!!r.disabled},n))])]))}}});export{_ as default,h as segmentedProps};