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