import{d as g,u as h,c as y,o,a as r,f as l,m as x,k as b,e as k}from"./index.477073af.js";import{aa as e,ac as i,n as c}from"./index.ef672c15.js";const v={class:"toggle-wrap flex items-center py-1"},V=["value","checked"],O={class:"sr-only"},_={key:0,id:"toggleLabel",class:"text-input-size text-theme-600 hover:text-primary ml-4 cursor-pointer"},w={key:0},B={key:1},z=g({__name:"InputToggle",props:{modelValue:{type:[Boolean,String],default:!1},textOff:{type:String,default:""},textOn:{type:String,default:""}},emits:["update:modelValue"],setup(s,{emit:u}){const p=s,f=h(),m=n=>{u("update:modelValue",n.checked)},t=y(()=>{const n=p.modelValue;return typeof n=="string"?n=="on"||n=="true":n});return(n,a)=>(o(),r("label",v,[l("input",x({class:"absolute h-1 w-1 opacity-0"},e(f),{type:"checkbox",value:e(t),checked:e(t),onInput:a[0]||(a[0]=d=>m(d.target))}),null,16,V),l("button",{type:"button","aria-pressed":"false",class:c([e(t)==!0?"bg-primary-600":"bg-theme-300","relative inline-flex h-6 w-12 shrink-0 cursor-pointer rounded-full border-4 border-transparent transition-colors duration-200 ease-in-out focus:outline-none"]),onClick:a[1]||(a[1]=b(d=>u("update:modelValue",!e(t)),["stop"]))},[l("span",O,i(e(t)?"on":"off"),1),l("span",{"aria-hidden":"true",class:c([e(t)==!0?"translate-x-6 bg-primary-0 ring-primary-600":"translate-x-0 bg-theme-0 ring-theme-300","inline-block h-4 w-4 rounded-full ring-4 transition duration-200 ease-in-out"])},null,2)],2),s.textOn||s.textOff?(o(),r("span",_,[e(t)?(o(),r("span",w,i(s.textOn),1)):(o(),r("span",B,i(s.textOff),1))])):k("v-if",!0)]))}});export{z as default};
