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