import{aa as p,aR as V}from"./index.ef672c15.js";import{d as v,c as L,o as n,a as m,b as f,F as b,x as g}from"./index.477073af.js";import{_ as y}from"./InputElTab.vue_vue_type_style_index_0_lang.0530f92b.js";const w=v({__name:"InputMultipleChoice",props:{modelValue:{type:Array,default:()=>[]},list:{type:Array,default:()=>[]},maxSelect:{type:[Number,String],default:1},selectLetters:{type:String,default:"abcdefghijklmnopqrstuvwxyz"}},emits:["update:modelValue"],setup(u,{emit:c}){const a=u,x=t=>{const l=t%26;return a.selectLetters[l].toUpperCase()},i=t=>{if(a.modelValue.indexOf(t)>-1){const e=a.modelValue.filter(s=>s!=t);c("update:modelValue",e)}else c("update:modelValue",[...a.modelValue,t])},o=L(()=>a.list?V(a.list):[]),k=t=>{var r;const l=t.key.toLowerCase(),e="abcdefghijklmnopqrstuvwxyz".indexOf(l),s=(r=o.value[e])==null?void 0:r.value;s&&i(s)};return(t,l)=>(n(),m("div",{class:"space-y-2 outline-none",tabindex:"0",onKeyup:l[0]||(l[0]=e=>k(e))},[p(o).length==0?(n(),f(y,{key:0,prefix:"-",label:"No options"})):(n(!0),m(b,{key:1},g(p(o),(e,s)=>(n(),f(y,{key:e.value,selected:!!(e.value&&u.modelValue.includes(e.value)),prefix:x(s),label:e.name,onClick:r=>{var d;return i((d=e.value)!=null?d:"")}},null,8,["selected","prefix","label","onClick"]))),128))],32))}});export{w as default};
