import{b7 as C,bt as l,bn as f,bk as h,bu as k,N as t,bv as w,bq as S,aq as y}from"./index-xnhGKCfe.js";const[z,c]=h("switch"),N={size:f,loading:Boolean,disabled:Boolean,modelValue:l,activeColor:String,inactiveColor:String,activeValue:{type:l,default:!0},inactiveValue:{type:l,default:!1}};var P=C({name:z,props:N,emits:["change","update:modelValue"],setup(e,{emit:d,slots:n}){const o=()=>e.modelValue===e.activeValue,u=()=>{if(!e.disabled&&!e.loading){const a=o()?e.inactiveValue:e.activeValue;d("update:modelValue",a),d("change",a)}},r=()=>{if(e.loading){const a=o()?e.activeColor:e.inactiveColor;return t(S,{class:c("loading"),color:a},null)}if(n.node)return n.node()};return k(()=>e.modelValue),()=>{var a;const{size:v,loading:b,disabled:s,activeColor:g,inactiveColor:m}=e,i=o(),V={fontSize:w(v),backgroundColor:i?g:m};return t("div",{role:"switch",class:c({on:i,loading:b,disabled:s}),style:V,tabindex:s?void 0:0,"aria-checked":i,onClick:u},[t("div",{class:c("node")},[r()]),(a=n.background)==null?void 0:a.call(n)])}}});const x=y(P);export{x as S};
