/*! For license information please see Accordion.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["l3-style"]=t(require("react")):e["l3-style"]=t(e.react)}(this,(e=>(()=>{var t={94184:(e,t)=>{var r;!function(){"use strict";var o={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var s=n.apply(null,r);s&&e.push(s)}}else if("object"===i){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){e.push(r.toString());continue}for(var u in r)o.call(r,u)&&r[u]&&e.push(u)}}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(r=function(){return n}.apply(t,[]))||(e.exports=r)}()},36346:(e,t,r)=>{"use strict";r.r(t)},42487:(e,t,r)=>{"use strict";r.r(t)},75251:(e,t,r)=>{"use strict";var o=r(8156),n=60103;if(t.Fragment=60107,"function"==typeof Symbol&&Symbol.for){var i=Symbol.for;n=i("react.element"),t.Fragment=i("react.fragment")}var s=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u=Object.prototype.hasOwnProperty,l={key:!0,ref:!0,__self:!0,__source:!0};function a(e,t,r){var o,i={},a=null,c=null;for(o in void 0!==r&&(a=""+r),void 0!==t.key&&(a=""+t.key),void 0!==t.ref&&(c=t.ref),t)u.call(t,o)&&!l.hasOwnProperty(o)&&(i[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===i[o]&&(i[o]=t[o]);return{$$typeof:n,type:e,key:a,ref:c,props:i,_owner:s.current}}t.jsx=a,t.jsxs=a},85893:(e,t,r)=>{"use strict";e.exports=r(75251)},10702:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const u=r(85893),l=s(r(94184)),a=i(r(8156)),c=s(r(98649));r(36346);const f="l3-accordion";const d=(0,a.forwardRef)((({children:e=null,allowMultiple:t=!1,"data-testid":r=f,defaultIndex:o=[],className:n="",id:i},s)=>{const d=(0,a.useRef)(null),p=(0,c.default)({refs:[s,d]}),[y,v]=(0,a.useState)(o),_=(0,a.useMemo)((()=>a.default.Children.toArray(e)),[e]),b=(0,a.useCallback)((e=>y.includes(e)),[y]),h=(0,a.useCallback)((e=>{if(t){const t=[...y];if(b(e)){const r=t.indexOf(e);r>-1&&t.splice(r,1)}else t.push(e);v(t)}else v([e])}),[b,y,t]),m=(0,a.useMemo)((()=>a.default.Children.map(_,((e,t)=>{const r=Object.assign({},null==e?void 0:e.props),o=(n=t,u=i,(s=r).id?s.id:u?`${u}--item-${n}`:`l3-accordion--item-${n}`);var n,s,u;return a.default.cloneElement(e,Object.assign(Object.assign({},r),{id:o,onClickAccordionCallback:()=>{h(t)},open:b(t)}))}))),[_,i,b,h]);return(0,u.jsx)("div",Object.assign({ref:p,className:(0,l.default)("accordion",n),"data-testid":r,id:i},{children:_&&m}))}));t.default=d},98649:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(8156);t.default=function({refs:e=[]}){return(0,o.useMemo)((()=>e.every((e=>null===e))?null:t=>{e.forEach((e=>{e&&function(e,t){if(null===e)return;if("function"==typeof e)return void e(t);try{e.current=t}catch(r){throw console.error(r),new Error(`Cannot assign value '${t}' to ref '${e}'`)}}(e,t)}))}),[e])}},41921:(e,t,r)=>{"use strict";r(42487)},8156:t=>{"use strict";t.exports=e}},r={};function o(e){var n=r[e];if(void 0!==n)return n.exports;var i=r[e]={exports:{}};return t[e].call(i.exports,i,i.exports,o),i.exports}return o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o(41921),o(10702)})()));
//# sourceMappingURL=Accordion.js.map