import{a as j,b as B,c as z}from"./chunk-Q2WCAKHJ.js";import{a as V,b as N}from"./chunk-QZHSUPXF.js";import{$b as T,Uc as F,Xc as k}from"./chunk-ATD4AEXQ.js";import{$a as A,Bb as l,Ka as n,Kc as d,Oa as w,Pb as L,Qb as x,Sb as g,Ta as I,Ua as c,_c as D,da as a,fb as O,hb as u,ib as f,ja as h,ka as C,lb as y,mb as b,nb as r,ob as p,pb as m,qb as E,xa as v,xb as _,zb as S}from"./chunk-BXH3QC5E.js";var M=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=c({type:t});static \u0275inj=a({imports:[d]})}return t})();var U=(t,s)=>s.id;function q(t,s){if(t&1){let e=_();p(0,"mat-chip-option",3),S("click",function(){h(e);let o=l(2);return C(o.toggleSelectAll())}),x(1),m(),E(2,"mat-divider",4)}if(t&2){let e=l(2);r("selected",e.areAllOptionsSelected()),n(),g(" ",e.getSelectAllLabel()," "),n(),r("vertical",!0)}}function G(t,s){if(t&1){let e=_();p(0,"mat-chip-option",5),S("click",function(){let o=h(e).$implicit,H=l(2);return C(H.toggleOption(o))}),x(1),m()}if(t&2){let e=s.$implicit,i=l(2);r("selected",i.isSelected(e)),O("data-cy-text",e.text),n(),g(" ",e.text," ")}}function J(t,s){if(t&1&&(p(0,"div",0)(1,"mat-chip-listbox",1),u(2,q,3,3),y(3,G,2,3,"mat-chip-option",2,U),m()()),t&2){let e=l();n(),r("tabIndex",-1)("multiple",e.allowMultipleSelection),n(),f(e.showSelectAllChip?2:-1),n(),b(e.options)}}var K=(()=>{class t{translateService;class="abs-chip";options;selectedOptions=[];allowMultipleSelection=!1;showSelectAllChip=!1;selectionChanged=new A;selectedItems=new Set;constructor(e){this.translateService=e}ngOnChanges(e){e.options&&this.initializeSelection()}initializeSelection(){this.selectedItems.clear(),this.selectedOptions.forEach(e=>{this.options.includes(e)&&this.selectedItems.add(e)}),this.emitSelection()}toggleSelectAll(){this.areAllOptionsSelected()?this.selectedItems.clear():this.options.forEach(e=>this.selectedItems.add(e)),this.emitSelection()}toggleOption(e){this.selectedItems.has(e)?this.selectedItems.delete(e):this.selectedItems.add(e),this.emitSelection()}isSelected(e){return this.selectedItems.has(e)}emitSelection(){this.selectionChanged.emit(Array.from(this.selectedItems))}getSelectAllLabel(){return this.areAllOptionsSelected()?this.translateService.instant("LBL_DESELECT_ALL"):this.translateService.instant("LBL_SELECT_ALL")}hasOptions(){return!T.isNullOrEmptyArray(this.options)}areAllOptionsSelected(){return this.selectedItems.size===this.options.length}static \u0275fac=function(i){return new(i||t)(w(D))};static \u0275cmp=I({type:t,selectors:[["abs-chip"]],hostVars:2,hostBindings:function(i,o){i&2&&L(o.class)},inputs:{options:"options",selectedOptions:"selectedOptions",allowMultipleSelection:"allowMultipleSelection",showSelectAllChip:"showSelectAllChip"},outputs:{selectionChanged:"selectionChanged"},standalone:!1,features:[v],decls:1,vars:1,consts:[[1,"abs-chip-wrapper"],[1,"abs-chip-listbox",3,"tabIndex","multiple"],[1,"abs-chip-option",3,"selected"],["data-cy","chipSelectAll",1,"abs-chip-option",3,"click","selected"],[3,"vertical"],[1,"abs-chip-option",3,"click","selected"]],template:function(i,o){i&1&&u(0,J,5,3,"div",0),i&2&&f(o.hasOptions()?0:-1)},dependencies:[B,j,V],encapsulation:2})}return t})();var P=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=c({type:t});static \u0275inj=a({imports:[d,z,N,F,k,M]})}return t})();export{K as a,M as b,P as c};
