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