import{b as D}from"./chunk-EBHT4VVF.js";import{b as v}from"./chunk-OKQRNSE4.js";import{g as h}from"./chunk-5GJ7UEF2.js";import{b as y}from"./chunk-JOFGKPLY.js";import{a as d}from"./chunk-Y75MWVBQ.js";import{o as u}from"./chunk-GW2OL5S3.js";import{a as R}from"./chunk-P5XIDEFS.js";import{i as S}from"./chunk-CO3WTSA4.js";import{I as A,ea as m,ja as a,q as p}from"./chunk-DYUFV4HF.js";import{d as f,n as _}from"./chunk-INB5GR2I.js";_();var e=(function(t){return t[t.CompanyAndStores=1]="CompanyAndStores",t[t.Warehouses=2]="Warehouses",t[t.EmployeesAndRoles=3]="EmployeesAndRoles",t[t.Nomenclature=4]="Nomenclature",t[t.Accounts=5]="Accounts",t[t.Cashboxes=6]="Cashboxes",t[t.Remains=7]="Remains",t[t.AcceptanceDocuments=8]="AcceptanceDocuments",t[t.PostingDocuments=9]="PostingDocuments",t[t.WriteOffDocuments=10]="WriteOffDocuments",t[t.MovementDocuments=11]="MovementDocuments",t[t.RevisionDocuments=12]="RevisionDocuments",t[t.SellAndReturnDocuments=13]="SellAndReturnDocuments",t[t.Manufacture=16]="Manufacture",t[t.ReturnSupplier=17]="ReturnSupplier",t[t.Shifts=18]="Shifts",t[t.Administration=19]="Administration",t[t.Audit=20]="Audit",t[t.Order=21]="Order",t[t.BirsanVision=22]="BirsanVision",t})(e||{}),s={[e.CompanyAndStores]:"\u041A\u043E\u043C\u043F\u0430\u043D\u0438\u044F \u0438 \u0442\u043E\u0440\u0433\u043E\u0432\u0430\u044F \u0442\u043E\u0447\u043A\u0430",[e.Warehouses]:"\u0421\u043A\u043B\u0430\u0434\u044B",[e.EmployeesAndRoles]:"\u0421\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A\u0438 \u0438 \u0440\u043E\u043B\u0438",[e.Nomenclature]:"\u041D\u043E\u043C\u0435\u043D\u043A\u043B\u0430\u0442\u0443\u0440\u0430",[e.Accounts]:"\u0421\u0447\u0435\u0442\u0430",[e.Cashboxes]:"\u041A\u0430\u0441\u0441\u044B",[e.Remains]:"\u041E\u0441\u0442\u0430\u0442\u043A\u0438",[e.AcceptanceDocuments]:"\u041F\u0440\u0438\u0435\u043C\u043A\u0438",[e.PostingDocuments]:"\u041E\u043F\u0440\u0438\u0445\u043E\u0434\u043E\u0432\u0430\u043D\u0438\u044F",[e.WriteOffDocuments]:"\u0421\u043F\u0438\u0441\u0430\u043D\u0438\u044F",[e.MovementDocuments]:"\u041F\u0435\u0440\u0435\u043C\u0435\u0449\u0435\u043D\u0438\u044F",[e.RevisionDocuments]:"\u0420\u0435\u0432\u0438\u0437\u0438\u0438",[e.SellAndReturnDocuments]:"\u041F\u0440\u043E\u0434\u0430\u0436\u0438 \u0438 \u0432\u043E\u0437\u0432\u0440\u0430\u0442\u044B",[e.Manufacture]:"\u0418\u0437\u0433\u043E\u0442\u043E\u0432\u043B\u0435\u043D\u0438\u0435",[e.ReturnSupplier]:"\u0412\u043E\u0437\u0432\u0440\u0430\u0442\u044B \u043F\u043E\u0441\u0442\u0430\u0432\u0449\u0438\u043A\u0443",[e.Shifts]:"\u0421\u043C\u0435\u043D\u044B",[e.Administration]:"\u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435",[e.Audit]:"\u0410\u0443\u0434\u0438\u0442",[e.Order]:"\u041D\u0430\u043A\u043B\u0430\u0434\u043D\u044B\u0435",[e.BirsanVision]:"\u0414\u043E\u0441\u0442\u0443\u043F \u043A Birsan Vision"};var I=(()=>{let n=class n{constructor(c){this._http=c}getPermission(){return this._http.get("/api/permission/all",{headers:R})}};n.\u0275fac=function(r){return new(r||n)(a(S))},n.\u0275prov=m({token:n,factory:n.\u0275fac});let t=n;return t})();var o=class o{constructor(n,i,c,r){this._permissionsServiceApi=n,this._authService=i,this._employeeService=c,this._store=r}getPermissions(){return this._permissionsServiceApi.getPermission().pipe(A(1),p(n=>Object.keys(s).map(i=>(console.log(n),{id:+i,name:s[+i],permissions:n.filter(c=>c.group===+i)}))))}hasPermissions(n){return this._permissions?this._permissions.includes(n):(this._employeeService.getEmployeeById(this._employeeId).subscribe(i=>(this._store.dispatch(new y(i)),this._permissions.includes(n))),!1)}filteredItems(n){return n.filter(i=>i.options.filter(c=>(c.visible=c.permissions.some(r=>this.hasPermissions(r))||c.permissions.length===0,c.visible)).length)}};o.\u0275fac=function(i){return new(i||o)(a(I),a(v),a(D),a(u))},o.\u0275prov=m({token:o,factory:o.\u0275fac});var l=o;f([d(h.permissions)],l.prototype,"_permissions",void 0);f([d(h.employeeId)],l.prototype,"_employeeId",void 0);export{I as a,l as b};
//# sourceMappingURL=chunk-GDZZ2BEY.js.map
