import{b as D}from"./chunk-GF5II5JA.js";import{b as v}from"./chunk-D77MCZOO.js";import{g as s}from"./chunk-XUSKVTJP.js";import{b as y}from"./chunk-JOFGKPLY.js";import{a as h}from"./chunk-4QCIIFWS.js";import{n as A}from"./chunk-DC6G5OHZ.js";import{a as R}from"./chunk-JUPKAJPM.js";import{i as u}from"./chunk-Z2AWIQRI.js";import{L as S,ia as m,na as a,q as d}from"./chunk-C2QKZJOP.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.Audit=20]="Audit",t[t.Order=21]="Order",t[t.BirsanVision=22]="BirsanVision",t})(e||{}),p={[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.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(i){this._http=i}getPermission(){return this._http.get("/api/permission/all",{headers:R})}};n.\u0275fac=function(r){return new(r||n)(a(u))},n.\u0275prov=m({token:n,factory:n.\u0275fac});let t=n;return t})();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),d(n=>Object.keys(p).map(c=>({id:+c,name:p[+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 y(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(v),a(D),a(A))},o.\u0275prov=m({token:o,factory:o.\u0275fac});var l=o;f([h(s.permissions)],l.prototype,"_permissions",void 0);f([h(s.employeeId)],l.prototype,"_employeeId",void 0);export{I as a,l as b};
//# sourceMappingURL=chunk-YQRXO7LU.js.map
