var e,t,o={3701(e,t,o){o.d(t,{n:()=>s});var s,r=o(2900),i=o(7704),c=o(9609),n=o(4084),d=o(2927),a=o(8899),l=o(742),p=function(e,t,o,s){var r,i=arguments.length,c=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,o,s);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(c=(i<3?r(c):i>3?r(t,o,c):r(t,o))||c);return i>3&&c&&Object.defineProperty(t,o,c),c};!function(e){let t=class extends((0,i.TS)(d.LitElement)){constructor(){super(...arguments),this.multiple=!1,this.suppressContainerFocus=!1,this.doubleClickToExpand=!1,this.handleAccordionItemFocus=()=>{this.toggleAttribute("focusable",!0)},this.handleAccordionItemBlur=()=>{this.toggleAttribute("focusable",!1)}}get slotItem(){return this.accordionItemSlotElement}filterSlotted(){return this.accordionItemSlotElement.assignedElements()}switchFocusedAccordionItem(e){const t=this.slotted.findIndex(e=>e.hasAttribute("focus-visible")),o=this.slotted.length;let s=t;for(s=(o+s+e)%o;this.slotted[s].disabled;)s=(o+s+e)%o;this.focusAccordionItem(this.slotted[s])}focusAccordionItem(e){e.hasAttribute("focus-visible")||requestAnimationFrame(()=>e.header.focus())}setActiveAccordionItem(e){this.multiple?e.expanded=!e.expanded:(this.slotted.forEach(t=>{const o=t;o.expanded&&!t.isEqualNode(e)&&(o.expanded=!1)}),e.expanded=!0)}setupExpandedAccordionItems(){this.multiple||this.slotted.filter(e=>e.expanded).forEach((e,t)=>{const o=e;o.expanded&&t>0&&(o.expanded=!1)})}setupFocusAccordionItems(){this.slotted.forEach(e=>{this.suppressContainerFocus||(e.addEventListener("focus",this.handleAccordionItemFocus),e.addEventListener("blur",this.handleAccordionItemBlur))})}removeFocusAccordionItems(){this.slotted.forEach(e=>{this.suppressContainerFocus||(e.removeEventListener("focus",this.handleAccordionItemFocus),e.removeEventListener("blur",this.handleAccordionItemBlur))})}handleKeyDown(e){const{srcEvent:t}=e.detail,{code:o}=t;switch(o){case r.Uz.Space:case r.Uz.Enter:{const{target:t}=e;t&&this.setActiveAccordionItem(t);break}case r.Uz.ArrowDown:this.switchFocusedAccordionItem(1);break;case r.Uz.ArrowUp:this.switchFocusedAccordionItem(-1);break;case r.Uz.Home:{const e=this.slotted[0];this.focusAccordionItem(e);break}case r.Uz.End:{const e=this.slotted[this.slotted.length-1];this.focusAccordionItem(e);break}}}handleClick(e){const{target:t}=e,o=this.slotted.find(e=>e.isSameNode(t));o&&this.setActiveAccordionItem(o)}propagateDoubleClickSetting(){this.slotted.forEach(e=>{e.doubleClickToExpand=this.doubleClickToExpand})}updated(e){super.updated(e),e.has("slotted")&&(this.setupExpandedAccordionItems(),this.setupFocusAccordionItems(),this.propagateDoubleClickSetting())}connectedCallback(){super.connectedCallback(),this.addEventListener("accordion-item-keydown",this.handleKeyDown),this.addEventListener("accordion-item-click",this.handleClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("accordion-item-keydown",this.handleKeyDown),this.removeEventListener("accordion-item-click",this.handleClick),this.removeFocusAccordionItems()}static get styles(){return[n.A,l.A]}render(){return d.html`
        <div class="md-accordion" part="accordion">
          <slot name="accordion-item"></slot>
        </div>
      `}};p([(0,a.property)({type:Boolean,reflect:!0})],t.prototype,"multiple",void 0),p([(0,a.property)({type:Boolean,attribute:"suppress-container-focus"})],t.prototype,"suppressContainerFocus",void 0),p([(0,a.property)({type:Boolean,attribute:"double-click-to-expand"})],t.prototype,"doubleClickToExpand",void 0),p([(0,a.query)('slot[name="accordion-item"]')],t.prototype,"accordionItemSlotElement",void 0),t=p([(0,c.w)("md-accordion")],t),e.ELEMENT=t}(s||(s={}))},7704(e,t,o){o.d(t,{TS:()=>s.T}),o(2364),o(3203),o(9938),o(5201),o(4781);var s=o(608)}},s={};function r(e){var t=s[e];if(void 0!==t)return t.exports;var i=s[e]={exports:{}};return o[e](i,i.exports,r),i.exports}r.m=o,e=[],r.O=(t,o,s,i)=>{if(!o){var c=1/0;for(l=0;l<e.length;l++){for(var[o,s,i]=e[l],n=!0,d=0;d<o.length;d++)(!1&i||c>=i)&&Object.keys(r.O).every(e=>r.O[e](o[d]))?o.splice(d--,1):(n=!1,i<c&&(c=i));if(n){e.splice(l--,1);var a=s();void 0!==a&&(t=a)}}return t}i=i||0;for(var l=e.length;l>0&&e[l-1][2]>i;l--)e[l]=e[l-1];e[l]=[o,s,i]},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);export{r as __webpack_require__};t={561:0,2942:0,5323:0,6220:0,7704:0,8180:0},r.C=e=>{var o,s,{__webpack_esm_ids__:i,__webpack_esm_modules__:c,__webpack_esm_runtime__:n}=e,d=0;for(o in c)r.o(c,o)&&(r.m[o]=c[o]);for(n&&n(r);d<i.length;d++)s=i[d],r.o(t,s)&&t[s]&&t[s][0](),t[i[d]]=0;r.O()},r.O.j=e=>0===t[e];import*as i from"../9609.js";r.C(i);import*as c from"../4084.js";r.C(c);import*as n from"../2364.js";r.C(n);import*as d from"../9938.js";r.C(d);import*as a from"../4781.js";r.C(a);import*as l from"../5201.js";r.C(l);import*as p from"../2900.js";r.C(p);import*as m from"../2927.js";r.C(m);import*as h from"../608.js";r.C(h);import*as u from"../8899.js";r.C(u);import*as f from"../3203.js";r.C(f);import*as v from"../742.js";r.C(v);var b=r.O(void 0,[9609,4084,2364,9938,4781,5201,2900,2927,608,8899,3203,742],()=>r(3701));const A=(b=r.O(b)).n;export{A as Accordion};