import{a as k,b as V,c as j}from"./chunk-BFIBXLWL.js";import{a as D,b as N}from"./chunk-IDTJ2LL2.js";import{bd as T,dd as F,uc as E}from"./chunk-CBXQYRPM.js";import{Bc as h,Ka as s,Kb as S,La as w,Mb as g,Rc as L,ab as u,cb as o,da as p,gb as O,ka as v,la as c,mb as a,nb as m,ob as y,pa as M,qa as d,ra as f,sb as _,sc as A,tc as b,vb as C,xb as l,za as I}from"./chunk-LVXYIJUI.js";var x=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=c({type:t})}static{this.\u0275inj=p({imports:[h]})}}return t})();function H(t,r){if(t&1){let e=_();a(0,"mat-chip-option",6),C("click",function(){d(e);let n=l(2);return f(n.toggleSelectAll())}),S(1),m()}if(t&2){let e=l(2);o("selected",e.areAllOptionsSelected()),s(),g(" ",e.getSelectAllLabel()," ")}}function U(t,r){t&1&&y(0,"mat-divider",7),t&2&&o("vertical",!0)}function $(t,r){if(t&1){let e=_();a(0,"mat-chip-option",6),C("click",function(){let n=d(e).$implicit,z=l(2);return f(z.toggleOption(n))}),S(1),m()}if(t&2){let e=r.$implicit,i=l(2);o("selected",i.isSelected(e)),s(),g(" ",e.text," ")}}function q(t,r){if(t&1&&(a(0,"div",1)(1,"mat-chip-listbox",2),u(2,H,2,2,"mat-chip-option",3)(3,U,1,1,"mat-divider",4)(4,$,2,2,"mat-chip-option",5),m()()),t&2){let e=l();s(),o("tabIndex",-1)("multiple",e.allowMultipleSelection),s(),o("ngIf",e.showSelectAllChip),s(),o("ngIf",e.showSelectAllChip),s(),o("ngForOf",e.options)}}var G=(()=>{class t{constructor(e){this.translateService=e,this.class="abs-chip",this.selectedOptions=[],this.allowMultipleSelection=!1,this.showSelectAllChip=!1,this.selectionChanged=new I,this.selectedItems=new Set}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!E.isNullOrEmptyArray(this.options)}areAllOptionsSelected(){return this.selectedItems.size===this.options.length}static{this.\u0275fac=function(i){return new(i||t)(w(L))}}static{this.\u0275cmp=v({type:t,selectors:[["abs-chip"]],hostVars:2,hostBindings:function(i,n){i&2&&O(n.class)},inputs:{options:"options",selectedOptions:"selectedOptions",allowMultipleSelection:"allowMultipleSelection",showSelectAllChip:"showSelectAllChip"},outputs:{selectionChanged:"selectionChanged"},features:[M],decls:1,vars:1,consts:[["class","abs-chip-wrapper",4,"ngIf"],[1,"abs-chip-wrapper"],[1,"abs-chip-listbox",3,"tabIndex","multiple"],["class","abs-chip-option",3,"selected","click",4,"ngIf"],[3,"vertical",4,"ngIf"],["class","abs-chip-option",3,"selected","click",4,"ngFor","ngForOf"],[1,"abs-chip-option",3,"click","selected"],[3,"vertical"]],template:function(i,n){i&1&&u(0,q,5,5,"div",0),i&2&&o("ngIf",n.hasOptions())},dependencies:[A,b,V,k,D],encapsulation:2})}}return t})();var J=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=c({type:t})}static{this.\u0275inj=p({imports:[h,j,N,T,F,x]})}}return t})();export{G as a,x as b,J as c};
