import{a as _}from"./chunk-FPW5VPYQ.js";import{T as a,U as E}from"./chunk-APYRIPVN.js";import{e as T}from"./chunk-QR6QDJJ7.js";import{a as P}from"./chunk-466723TI.js";import{a as v,b as Q}from"./chunk-YADAVUVK.js";import{$b as l,Ac as y,Bc as d,Cc as r,Cd as S,Kb as m,Nd as b,Qb as h,Td as w,ic as s,jc as c,kc as f,od as M,tc as u,uc as A,vc as C,xb as g,zc as x}from"./chunk-HEIW4SFT.js";w();Q();M();w();var I=["*"];function D(o,L){if(o&1&&(s(0,"div",3),f(1,"paw-action",4),c()),o&2){let e=u();g(),l("id",(e.id?e.id+"-":"accordion-")+e.toggleAllAction.id)("action",e.toggleAllAction)}}var U=(()=>{class o{get isAllCollapsed(){return this.expandedCount===0}constructor(){this.toggle=!0,this.toggleAllAction={id:"toggle-all-panels",label:"HideAll",icon:"fa-regular fa-chevron-down paw-font-size-xs",styleClass:"paw-accordion-panel-toggle",onSelected:e=>{this.toggleAccordion()}},this.expandedCount=0,this.expandedStatesS=[]}ngOnInit(){this.setToggleLabel()}ngAfterViewInit(){this.assignAccordionToPannels(),this.syncToggledState(),this.handlePanelStateChanges()}ngOnDestroy(){v.iterate(this.expandedStatesS,e=>{e.unsubscribe()})}expandAll(){this.panels.forEach(e=>{e.expansionPanel.accordion=this.matAccordion,e.expansionPanel.open()})}collapseAll(){this.panels.forEach(e=>{e.expansionPanel.accordion=this.matAccordion,e.expansionPanel.close()})}toggleAccordion(){if(this.isAllCollapsed){this.expandAll();return}this.collapseAll()}setToggleLabel(){this.toggleAllAction.label=this.isAllCollapsed?"ShowAll":"HideAll"}assignAccordionToPannels(){this.panels.forEach(e=>{e.expansionPanel.accordion=this.matAccordion})}syncToggledState(){this.expandedCount=0,this.panels.forEach(e=>{e.isExpanded&&this.expandedCount++}),this.setToggleLabel()}handlePanelStateChanges(){this.panels.forEach(e=>{let t=e.expanded.subscribe(n=>{this.syncToggledState()});this.expandedStatesS.push(t)})}static{this.\u0275fac=function(t){return new(t||o)}}static{this.\u0275cmp=m({type:o,selectors:[["paw-accordion"]],contentQueries:function(t,n,i){if(t&1&&x(i,_,5),t&2){let p;d(p=r())&&(n.panels=p)}},viewQuery:function(t,n){if(t&1&&y(a,7),t&2){let i;d(i=r())&&(n.matAccordion=i.first)}},inputs:{toggle:"toggle",id:"id"},ngContentSelectors:I,decls:5,vars:1,consts:[["matAccordion",""],["class","paw-padding-bottom-s",4,"ngIf"],["multi",""],[1,"paw-padding-bottom-s"],[3,"id","action"]],template:function(t,n){t&1&&(A(),h(0,D,2,2,"div",1),s(1,"div")(2,"mat-accordion",2,0),C(4),c()()),t&2&&l("ngIf",n.toggle)},dependencies:[b,S,E,a,T,P],encapsulation:2})}}return o})();export{U as a};
