import{$n as e,$t as t,Ar as n,J as r,K as i,Ln as a,Tt as o,W as s,Wn as c,Xt as l,Y as u,an as d,bn as f,ir as p,kr as m,kt as h,ln as g,mr as _,o as v,p as y,qn as b,s as x,v as S,wr as C,xr as w}from"./index-D1zydkDr.js";import{n as T,t as E}from"./VSelectionControl-BjOr0vi1.js";var D=g({indeterminate:Boolean,inset:Boolean,flat:Boolean,loading:{type:[Boolean,String],default:!1},...x(),...T()},`VSwitch`),O=d()({name:`VSwitch`,inheritAttrs:!1,props:D(),emits:{"update:focused":e=>!0,"update:modelValue":e=>!0,"update:indeterminate":e=>!0},setup(d,{attrs:g,slots:x}){let T=l(d,`indeterminate`),D=l(d,`modelValue`),{loaderClasses:O}=i(d),{isFocused:k,focus:A,blur:j}=y(d),M=w(),N=w(),P=a&&window.matchMedia(`(forced-colors: active)`).matches,F=C(()=>typeof d.loading==`string`&&d.loading!==``?d.loading:d.color),I=_(),L=C(()=>d.id||`switch-${I}`);function R(){T.value&&=!1}function z(e){e.stopPropagation(),e.preventDefault(),M.value?.input?.click()}return t(()=>{let[t,i]=f(g),a=v.filterProps(d),l=E.filterProps(d);return e(v,p({ref:N,class:[`v-switch`,{"v-switch--flat":d.flat},{"v-switch--inset":d.inset},{"v-switch--indeterminate":T.value},O.value,d.class]},t,a,{modelValue:D.value,"onUpdate:modelValue":e=>D.value=e,id:L.value,focused:k.value,style:d.style}),{...x,default:({id:t,messagesId:a,isDisabled:f,isReadonly:g,isValid:_})=>{let v={model:D,isValid:_};return e(E,p({ref:M},l,{modelValue:D.value,"onUpdate:modelValue":[e=>D.value=e,R],id:t.value,"aria-describedby":a.value,type:`checkbox`,"aria-checked":T.value?`mixed`:void 0,disabled:f.value,readonly:g.value,onFocus:A,onBlur:j},i),{...x,default:({backgroundColorClasses:e,backgroundColorStyles:t})=>b(`div`,{class:m([`v-switch__track`,P?void 0:e.value]),style:n(t.value),onClick:z},[x[`track-true`]&&b(`div`,{key:`prepend`,class:`v-switch__track-true`},[x[`track-true`](v)]),x[`track-false`]&&b(`div`,{key:`append`,class:`v-switch__track-false`},[x[`track-false`](v)])]),input:({inputNode:t,icon:i,backgroundColorClasses:a,backgroundColorStyles:l})=>b(c,null,[t,b(`div`,{class:m([`v-switch__thumb`,{"v-switch__thumb--filled":i||d.loading},d.inset||P?void 0:a.value]),style:n(d.inset?void 0:l.value)},[x.thumb?e(o,{defaults:{VIcon:{icon:i,size:`x-small`}}},{default:()=>[x.thumb({...v,icon:i})]}):e(h,null,{default:()=>[d.loading?e(s,{name:`v-switch`,active:!0,color:_.value===!1?void 0:F.value},{default:t=>x.loader?x.loader(t):e(r,{active:t.isActive,color:t.color,indeterminate:!0,size:`16`,width:`2`},null)}):i&&e(u,{key:String(i),icon:i,size:`x-small`},null)]})])])})}})}),S({},N)}});export{O as t};