import{a as m,b as g,c as b,d as h,h as u}from"./chunk.XJAJO727.js";import{b as d,e as c}from"./chunk.OBAEIKIV.js";import{e as l}from"./chunk.6EV4YU6C.js";var s=class extends u{constructor(){super(...arguments);this.disableRole=!1;this.label=""}handleFocus(e){let t=a(e.target);t==null||t.classList.add("sd-button-group__button--focus")}handleBlur(e){let t=a(e.target);t==null||t.classList.remove("sd-button-group__button--focus")}handleMouseOver(e){let t=a(e.target);t==null||t.classList.add("sd-button-group__button--hover")}handleMouseOut(e){let t=a(e.target);t==null||t.classList.remove("sd-button-group__button--hover")}handleSlotChange(){let e=[...this.defaultSlot.assignedElements({flatten:!0})];e.forEach(t=>{let n=e.indexOf(t),o=a(t);o!==null&&(o.classList.add("sd-button-group__button"),o.classList.toggle("sd-button-group__button--first",n===0),o.classList.toggle("sd-button-group__button--inner",n>0&&n<e.length-1),o.classList.toggle("sd-button-group__button--last",n===e.length-1),o.classList.toggle("sd-button-group__button--radio",o.tagName.toLowerCase()==="sd-radio-button"))})}render(){return c`<slot part="base" role="${this.disableRole?"presentation":"group"}" aria-label="${this.label}" @focusout="${this.handleBlur}" @focusin="${this.handleFocus}" @mouseover="${this.handleMouseOver}" @mouseout="${this.handleMouseOut}" @slotchange="${this.handleSlotChange}"></slot>`}};s.styles=[...u.styles,d`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */@layer theme,base,components,utilities;
:host{display:inline-block}[part=base]{display:flex;flex-wrap:nowrap}`],l([h("slot")],s.prototype,"defaultSlot",2),l([b()],s.prototype,"disableRole",2),l([g({type:String,reflect:!0})],s.prototype,"label",2),s=l([m("sd-button-group")],s);function a(r){var e;let i="sd-button, sd-radio-button";return(e=r.closest(i))!=null?e:r.querySelector(i)}export{s as a};
