import{b as e,s as t}from"./runtime-core.esm-bundler-Babufkcf.js";import{t as n}from"./create-CGAkPJkS.js";import{r}from"./QIcon-cTVL6ikA.js";import{a as i,t as a}from"./QBtn-DkiaKEsC.js";import{i as o,n as s}from"./private.use-form-5dfnQmaM.js";import{t as c}from"./QBtnGroup-BtEmFA9a.js";var l=n({name:`QBtnToggle`,props:{...o,modelValue:{required:!0},options:{type:Array,required:!0,validator:e=>e.every(e=>(`label`in e||`icon`in e||`slot`in e)&&`value`in e)},color:String,textColor:String,toggleColor:{type:String,default:`primary`},toggleTextColor:String,outline:Boolean,flat:Boolean,unelevated:Boolean,rounded:Boolean,push:Boolean,glossy:Boolean,size:String,padding:String,noCaps:Boolean,noWrap:Boolean,dense:Boolean,readonly:Boolean,disable:Boolean,stack:Boolean,stretch:Boolean,spread:Boolean,clearable:Boolean,ripple:{type:[Boolean,Object],default:!0}},emits:[`update:modelValue`,`clear`,`click`],setup(n,{slots:o,emit:l}){let u=t(()=>n.options.find(e=>e.value===n.modelValue)!==void 0),d=t(()=>({type:`hidden`,name:n.name,value:n.modelValue})),f=s(d),p=t(()=>i(n)),m=t(()=>({rounded:n.rounded,dense:n.dense,...p.value})),h=t(()=>n.options.map((e,t)=>{let{attrs:r,value:i,slot:a,...o}=e;return{slot:a,props:{key:t,"aria-pressed":i===n.modelValue?`true`:`false`,...r,...o,...m.value,disable:n.disable||o.disable===!0,color:i===n.modelValue?_(o,`toggleColor`):_(o,`color`),textColor:i===n.modelValue?_(o,`toggleTextColor`):_(o,`textColor`),noCaps:_(o,`noCaps`)===!0,noWrap:_(o,`noWrap`)===!0,size:_(o,`size`),padding:_(o,`padding`),ripple:_(o,`ripple`),stack:_(o,`stack`)===!0,stretch:_(o,`stretch`)===!0,onClick(t){g(i,e,t)}}}}));function g(e,t,r){n.readonly||(n.modelValue===e?n.clearable&&(l(`update:modelValue`,null,null),l(`clear`)):l(`update:modelValue`,e,t),l(`click`,r))}function _(e,t){return e[t]===void 0?n[t]:e[t]}function v(){let t=h.value.map(t=>e(a,t.props,t.slot===void 0?void 0:o[t.slot]));return n.name!==void 0&&!n.disable&&u.value&&f(t,`push`),r(o.default,t)}return()=>e(c,{class:`q-btn-toggle`,...p.value,rounded:n.rounded,stretch:n.stretch,glossy:n.glossy,spread:n.spread},v)}});export{l as t};