import{bz as v,az as n,q as u,F as p,aK as g,aj as k,z as d,bs as b,c5 as m,y as _,a_ as h,c6 as y,b_ as V}from"./index-p5QwxXYb.js";const x={name:"ViewToolbar",emits:["setOption"],props:{groups:{required:!0,type:Array}},computed:{iGroups(){const e=[];let s,a,f,c,r;const i=this.getValues();for(const t of this.groups){s={...t,iControls:[]};for(const l of t.controls){switch(f=null,c=null,r=!1,l.action){case"toggle":c=o=>this.toggle(l,o),l.value&&(f="blue");break;case"callback":c=o=>this.call(l,o);break}for(const o of l.enableIf||[])if(!i[o]){r=!0;break}for(const o of l.disableIf||[])if(i[o]){r=!0;break}a={...l,color:f,callback:c,disabled:r},s.iControls.push(a)}e.push(s)}return e}},methods:{toggle(e,s){e.value=!e.value,this.$emit("setOption",e.key,e.value),s.currentTarget.blur()},call(e,s){e.callback(),s.currentTarget.blur()},getValues(){const e={};for(const s of this.groups)for(const a of s.controls)a.key&&(e[a.key]=a.value);return e}}},T={class:"c-view-toolbar"};function w(e,s,a,f,c,r){return n(),u("div",T,[(n(!0),u(p,null,g(r.iGroups,i=>(n(),u("div",{class:"group",key:i.title},[(n(!0),u(p,null,g(i.iControls,t=>(n(),u("div",{class:k(["control",t.key]),key:t.title},[d(V,{class:k(t.title),icon:"",variant:"text",disabled:t.disabled,color:t.color,onClick:t.callback},{default:b(()=>[d(m,{size:"large"},{default:b(()=>[_(h(t.icon),1)]),_:2},1024),d(y,null,{default:b(()=>[_(h(t.title),1)]),_:2},1024)]),_:2},1032,["class","disabled","color","onClick"])],2))),128))]))),128))])}const I=v(x,[["render",w]]);export{I as V};
