"use strict";(self.webpackChunkwebadmin=self.webpackChunkwebadmin||[]).push([["libs_dialogs_remove-system_remove-system_component_ts"],{55328:(U,l,e)=>{e.r(l),e.d(l,{RemoveSystemModalContent:()=>I});var m=e(82529),d=e(60177),c=e(89417),h=e(60802),E=e(54843),p=e(19689),M=e(58415),v=e(45047),g=e(40221),f=e(48233),s=e(4020),C=e(39060),R=e(34875),P=e(64147),D=e(60272);const y=["disconnectAccountForm"],A=o=>({"hide-errors":o});function O(o,u){if(1&o){const r=s.RV6();s.j41(0,"button",16),s.bIt("click",function(){s.eBV(r);const t=s.XpG();return s.Njj(t.close())}),s.nrm(1,"div",17),s.k0s()}}function T(o,u){1&o&&(s.j41(0,"div")(1,"div",18),s.EFF(2," Password is required "),s.k0s()())}function F(o,u){if(1&o&&(s.qex(0),s.DNE(1,T,3,0,"div",12),s.bVm()),2&o){const r=s.XpG(),n=s.sdS(15);s.R7$(),s.Y8G("ngIf",n.touched&&n.dirty&&!r.wrongPassword)}}let I=(()=>{class o extends g.f{constructor(r,n,t,a,i){super(a),this.processService=r,this.renderer=n,this.toastService=t,this.system=i,this.LANG=f,this.auth={username:"",password:""},this.hideErrors=!0,this.credentialErrorHandler=()=>(this.wrongPassword=!0,this.auth.password="",this.renderer.selectRootElement("#password").focus(),!0)}ngOnInit(){this.auth.username=this.system.permissionManager.currentUser$$().email,this.disconnectFromAccount=this.processService.createProcess(()=>(this.lock(),this.disconnectAccountForm.controls.password.setErrors(void 0),this.wrongPassword=!1,(0,E._)(this.system.deleteFromCurrentAccount(this.auth.password))),{ignoreUnauthorized:!0,errorCodes:{accountBlocked:this.credentialErrorHandler,notAuthorized:this.credentialErrorHandler},errorPrefix:this.LANG.errorCodes.cantUnshareWithMeSystemPrefix},()=>{this.close(!0),this.toastService.notify({value:this.LANG.toastMessage.system.deleted.success,params:{systemName:this.system.info.systemName||this.system.info.name}},v.C.Success)},r=>{console.error(r),this.unlock()})}static{this.\u0275fac=function(n){return new(n||o)(s.rXU(C.z),s.rXU(s.sFG),s.rXU(R.z),s.rXU(m.ce),s.rXU(m.Qs))}}static{this.\u0275cmp=s.VBU({type:o,selectors:[["nx-modal-remove-model-content"]],viewQuery:function(n,t){if(1&n&&s.GBs(y,7),2&n){let a;s.mGM(a=s.lsd())&&(t.disconnectAccountForm=a.first)}},features:[s.Vt3],decls:21,vars:17,consts:[["disconnectAccountForm","ngForm"],["password","ngModel"],["name","disconnectAccountForm","novalidate","",3,"submit","ngClass"],[1,"modal-header"],[1,"modal-title"],["type","button","class","close","data-dismiss","modal","aria-label","Close",3,"click",4,"ngIf"],[1,"modal-body"],[1,"paragraph"],["translate","",1,"paragraph","mb-3"],[1,"form-group"],["for","password","translate","",1,"label"],["id","password","autocomplete","new-password","name","password","type","password","required","",1,"form-control",3,"ngModelChange","ngModel"],[4,"ngIf"],[1,"modal-footer"],[3,"process","form","actionType","buttonText"],[3,"process","cancelFn","discardFn"],["type","button","data-dismiss","modal","aria-label","Close",1,"close",3,"click"],[1,"close-content"],["translate","",1,"input-error"]],template:function(n,t){if(1&n){const a=s.RV6();s.j41(0,"form",2,0),s.bIt("submit",function(){return s.eBV(a),s.Njj(t.hideErrors=!1)}),s.j41(2,"div",3)(3,"h1",4),s.EFF(4),s.k0s(),s.DNE(5,O,2,0,"button",5),s.k0s(),s.j41(6,"div",6)(7,"p",7),s.EFF(8),s.k0s(),s.j41(9,"p",8),s.EFF(10," Enter password to continue. "),s.k0s(),s.j41(11,"div",9)(12,"label",10),s.EFF(13,"Password"),s.k0s(),s.j41(14,"input",11,1),s.mxI("ngModelChange",function(_){return s.eBV(a),s.DH7(t.auth.password,_)||(t.auth.password=_),s.Njj(_)}),s.k0s(),s.DNE(16,F,2,1,"ng-container",12),s.k0s()(),s.j41(17,"div",13),s.nrm(18,"nx-process-button",14),s.nI1(19,"translate"),s.nrm(20,"nx-cancel-button",15),s.k0s()()}if(2&n){const a=s.sdS(1),i=s.sdS(15);s.Y8G("ngClass",s.eq3(15,A,t.hideErrors)),s.R7$(4),s.JRh(t.LANG.dialogs.removeSystem.title),s.R7$(),s.Y8G("ngIf",t.closable),s.R7$(3),s.JRh(t.LANG.dialogs.removeSystem.message),s.R7$(6),s.R50("ngModel",t.auth.password),s.R7$(2),s.Y8G("ngIf",i.invalid),s.R7$(2),s.FS9("buttonText",s.bMT(19,13,"Disconnect")),s.Y8G("process",t.disconnectFromAccount)("form",a)("actionType","danger"),s.R7$(2),s.Y8G("process",t.disconnectFromAccount)("cancelFn",t.unlock)("discardFn",t.close)}},dependencies:[d.MD,d.YU,d.bT,c.YN,c.qT,c.me,c.BC,c.cb,c.YS,c.vS,c.cV,h.h,P.M,D.D,p.f,M.N],encapsulation:2})}}return o})()}}]);