"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("../tslib.es6-C4EgNkz1.js"),o=require("react"),f=require("classnames"),I=require("../utils-C9NL3q0j.js"),L=require("../toggle-button-DSderReK.js"),N=l=>{var{a11yText:u,a11yLabelId:m,layoutType:i="minimal",variant:c="checkbox",children:g,columnsMin:d,columnsXS:b,columnsSM:y,columnsMD:p,columnsXL:T,onChange:n,className:B}=l,h=q.__rest(l,["a11yText","a11yLabelId","layoutType","variant","children","columnsMin","columnsXS","columnsSM","columnsMD","columnsXL","onChange","className"]);const r=I.filterByType(g,L.ToggleButton),k=()=>r.reduce((s,e,t)=>(s[t]=e.props.pressed||!1,s),{}),[M,E]=o.useState(k),S=o.useCallback((s,e)=>{E(t=>{let a={};switch(c){case"checkbox":a=Object.assign({},t),a[e]=!t[e];break;case"radio-toggle":a[e]=!t[e];break;case"radio":a[e]=!0;break}return n&&n(s,{pressedButtonsIndex:a}),a})},[c,n]);return o.createElement("div",Object.assign({className:f(B,"toggle-button-group"),"data-columns-min":d,"data-columns-xs":b,"data-columns-sm":y,"data-columns-md":p,"data-columns-xl":T},h),o.createElement("ul",{"aria-label":u,"aria-labelledby":m},r.map((s,e)=>o.createElement("li",{key:e},o.cloneElement(s,{layoutType:i,pressed:M[e],onToggle:t=>{S(t,e)}})))))};exports.EbayToggleButtonGroup=N;
