/* empty css             *//* empty css                  */import{m as e,a9 as a,aJ as l,M as u,aL as s,O as n,d as t,aO as o,o as i,l as d,f as r,ar as v}from"./index-2b50ecca.js";const m=t({__name:"index",props:{modelValue:Boolean|Number|String,api:String,id:Number|String},emits:["update:modelValue","refresh"],setup(t,{emit:m}){const c=t,{enabled:p,success:f,loading:g,afterEnabled:b}=function(){const t=e(!1),o=e(!1),i=e();return{enabled:function(e,n,d={}){o.value=!0,a.put(e+"/enable/"+n,d).then((e=>{e.data.code===l.SUCCESS?(t.value=!0,u.success(e.data.message),s(i.value)&&i.value()):u.error(e.data.message)})).finally((()=>{o.value=!1}))},success:e=>{n(t,(function(){t.value=!1,e()}))},loading:o,afterEnabled:i}}(),S=e(),E=e();return"boolean"==typeof c.modelValue?(S.value=!0,E.value=!1):(S.value=o.ENABLE,E.value=o.DISABLE),f((()=>{m("update:modelValue",c.modelValue===S.value?E.value:S.value)})),b.value=()=>{m("refresh")},(e,a)=>{const l=v;return i(),d(l,{onChange:a[0]||(a[0]=e=>r(p)(t.api,t.id)),"active-value":S.value,"inactive-value":E.value,"model-value":t.modelValue,loading:r(g)},null,8,["active-value","inactive-value","model-value","loading"])}}});export{m as _};
