"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[8399],{3393:(e,t,s)=>{s.d(t,{y:()=>a});var i=s(9696),n=s(79365),r=s(81365);const a=(...e)=>(0,i.Zz)(n.XX,n._$,n.yF,n.jd)((0,r.q)(...e))},5364:(e,t,s)=>{s.d(t,{T:()=>r,o:()=>a});var i=s(97810),n=s(51298);const r=(0,i.xE)("button-multi-selection-group-internal");class a extends((0,n.m)(r)){#e(){return this.items.filter(e=>e.hasAttribute("selected"))}onClick(e){e.target!==e.currentTarget&&(this.#e().includes(e.target)?e.target.removeAttribute("selected"):e.target.setAttribute("selected","true"),this.dispatchChange())}get value(){return this.#e().map(e=>e.value)}set value(e){this.items.forEach(t=>{e.includes(t.value)?t.setAttribute("selected","true"):t.removeAttribute("selected")})}get minItemsSelection(){return parseInt(this.getAttribute("min-items-selection"),10)||0}get maxItemsSelection(){return parseInt(this.getAttribute("max-items-selection"),10)||0}#t(e){const t=Array.isArray(e);return t||console.error("default-values must be an array, received:",e),t}get defaultValues(){const e=this.getAttribute("default-values");if(e)try{const t=JSON.parse(e);if(this.#t(t))return t}catch(e){console.error('could not parse data string from attribute "default-values" -',e.message)}return[]}setDefaultValues(){setTimeout(()=>{this.defaultValues&&(this.value=this.defaultValues,this.setCustomValidity())})}getValidity(){return this.isRequired&&!this.value.length?{valueMissing:!0}:this.isRequired&&this.minItemsSelection&&this.value.length<this.minItemsSelection?{rangeUnderflow:!0}:this.maxItemsSelection&&this.value.length>this.maxItemsSelection?{rangeOverflow:!0}:{}}init(){super.init(),this.setDefaultValues(),this.querySelector("slot").addEventListener("click",this.onClick.bind(this))}}},51298:(e,t,s)=>{s.d(t,{m:()=>a}),s(25964);var i=s(3393),n=s(97810),r=s(13011);const a=e=>{class t extends((0,i.y)({componentName:e,baseSelector:"slot"})){constructor(){super(),this.innerHTML='\n    <slot part="wrapper"></slot>\n      '}dispatchChange=r.r.bind(this,"change");get items(){return this.querySelector("slot").assignedElements()}get isReadonly(){return"true"===this.getAttribute("readonly")}get size(){return this.getAttribute("size")||"md"}get value(){console.warn("get value","is not implemented")}set value(e){console.warn("set value","is not implemented")}onSizeChange(){this.items.forEach(e=>{e.setAttribute("size",this.size)})}onReadOnlyChange(){this.querySelector("slot").toggleAttribute("inert",this.isReadonly)}getValidity(){console.warn("getValidity","is not implemented")}onObservedAttributeChange(e){e.forEach(e=>{switch(e){case"size":this.onSizeChange();break;case"readonly":this.onReadOnlyChange()}})}init(){this.addEventListener("focus",e=>{e.isTrusted&&this.items[0]?.focus()}),super.init?.(),(0,n.mx)(this,this.onObservedAttributeChange.bind(this),{includeAttrs:["size","readonly"]})}}return t}},91831:(e,t,s)=>{s.r(t),s.d(t,{ButtonMultiSelectionGroupInternalClass:()=>i.o});var i=s(5364);customElements.define(i.T,i.o)}}]);
//# sourceMappingURL=button-selection-group-fields-descope-button-multi-selection-group-internal-index-js.js.map