import{a as h,b as v}from"./chunk-BCH4TWDY.js";import{P as p,Q as g}from"./chunk-JE2X3YFA.js";import{Rd as d,T as a,d as n,ma as f,na as l,sa as o,xa as c}from"./chunk-4HFZZ7HS.js";import{e as m}from"./chunk-SZAW6ZBW.js";var R,y=m(()=>{l();f();d();v();g();R=(()=>{class t{constructor(e,i){this.unsavedChangesDialogService=e,this.currentUser=i}canDeactivate(e,i){if(e.isDirty&&this.currentUser.isLogged()){let r=i.data.editPermission;return r&&!this.currentUser.hasPermission(r)?new n(s=>this.processReturnType(e.rejectChange(),s)):new n(s=>{this.unsavedChangesDialogService.show().then(u=>{switch(u.action){case"save":this.processReturnType(e.validateChange(),s);break;case"discard":this.processReturnType(e.rejectChange(),s);break;case"cancel":this.processReturnType(e.cancelChange(),s);break}})})}return!0}processReturnType(e,i){if(e instanceof n){e.pipe(a(1)).subscribe(r=>{i.next(r),i.complete()});return}i.next(e),i.complete()}static{this.\u0275fac=function(i){return new(i||t)(c(h),c(p))}}static{this.\u0275prov=o({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})()});export{R as a,y as b};
