import{a as V}from"./chunk-D4RZOGGF.js";import{nb as p,rb as z}from"./chunk-YSQLW2JA.js";import{Ua as L,pd as M,qd as U}from"./chunk-NVJ2ZZFT.js";import{Aa as h,He as a,Me as F,Nc as g,Ne as w,Pd as f,Qf as v,Se as T,Sf as k,Te as S,Ue as b,_a as E,ab as O,bb as d,bc as y,cb as P,db as C,dd as m,eb as A,gb as N,jb as R,ld as D,ya as l,zc as u}from"./chunk-SKPDQO4E.js";var j=`<ng-container *ngIf="visible">
    <div class="row justify-content-center">
        <div class="col-xl-8 col-lg-12 col-md-12">
            <div class="row" *ngIf="!userSessionWithSSO">
                <div class="col-xl-12">
                    <div class="section-title">
                        <cds-icon shape="key"
                            class="cds-icon-18 me-2"></cds-icon>{{'MYACCOUNT.SECTION_CHANGE_PASSWORD'|translate}}
                    </div>
                    <div class="col-12"></div>
                </div>
            </div>
            <div class="row" *ngIf="!userSessionWithSSO">
                <div class="col-xl-12">
                    <armon-account-change-password [profile]="profile"></armon-account-change-password>
                </div>
            </div>
            <ng-container *ngIf="visibleMultiFactor">
                <div class="row">
                    <div class="col-xl-12">
                        <div class="section-title">
                            <cds-icon shape="shield"
                                class="cds-icon-18 me-2"></cds-icon>{{'LICENSE.MULTI_FACTOR_SETTNGS_TITLE'|translate}}
                        </div>
                        <div class="col-xl-12"></div>
                    </div>
                </div>
                <div class="row mt-3">
                    <div class="col-xl-12">
                        <armon-account-multi-factor [profile]="profile"></armon-account-multi-factor>
                    </div>
                </div>
            </ng-container>
            <div class="row">
                <div class="col-xl-12">
                    <div class="section-title">
                        <cds-icon shape="devices" solid
                            class="cds-icon-18 me-2"></cds-icon>{{'MYACCOUNT.SECTION_DEVICES'|translate}}
                    </div>
                    <div class="col-xl-12"></div>
                </div>
            </div>
            <div class="row mt-3">
                <div class="col-xl-12">
                    <armon-account-devices></armon-account-devices>
                </div>
            </div>
        </div>
        <!-- END DEVICES -->

    </div>
</ng-container>`;var G=`.justify-content-center{-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center}.justify-content-flex-end{-webkit-box-pack:end;-moz-box-pack:end;-webkit-flex-pack:end;-ms-flex-pack:end;-moz-justify-content:flex-end;-webkit-justify-content:flex-end;justify-content:flex-end}.card-footer{padding:.28rem .7rem}.alert{font-size:.756rem}@media screen and (min-width: 992px){.modal-xxl{max-width:1640px}}@media screen and (min-width: 1200px){.modal-xxxl{max-width:1860px}}.modal-fs{max-width:none;position:absolute;margin:auto;inset:16px;height:100vh;display:flex}.btn-link{text-decoration:none}.btn-link:hover{text-decoration:underline}.invalid-feedback{margin-top:0!important;font-size:.672rem!important}:host .section-title{width:100%;padding:6px;border-bottom:solid 1px rgba(102,102,102,.2);color:#666}
`;var W=`<div class="row" [@listAnimation]="devices.length">
    <div class="col-xl-4 col-lg-6 col-md-12" *ngFor="let device of devices">
        <div class="card mb-3">
            <div class="card-body">
                <div class="device-container" [attr.iscurrentdevice]="device.isCurrentDevice">
                    <div class="device-icon" [ngSwitch]="device.device">
                        <cds-icon shape="computer" size="md" *ngSwitchCase="0"></cds-icon>
                        <cds-icon shape="display" size="md" *ngSwitchCase="1"></cds-icon>
                        <cds-icon shape="tablet" size="md" *ngSwitchCase="2"></cds-icon>
                        <cds-icon shape="mobile" size="md" *ngSwitchCase="3"></cds-icon>
                        <cds-icon shape="network-globe" size="md" *ngSwitchCase="4"></cds-icon>
                        <cds-icon shape="car" size="md" *ngSwitchCase="5"></cds-icon>
                        <cds-icon shape="application" size="md" *ngSwitchDefault></cds-icon>
                    </div>
                    <div class="device-info">
                        <span class="title">{{'MYACCOUNT.DEVICE_TYPE_'+device.device | translate}}</span>
                        <span class="operating-system">{{device.os}}</span>
                        <span class="last-access-date" *ngIf="!device.isCurrentDevice">
                            {{'MYACCOUNT.DEVICE_LAST_GRANT_DATE'|translate}} :
                            {{device.lastGrantSessionUtc| date:'medium'}}
                        </span>
                        <span class="last-access-date"
                            *ngIf="device.isCurrentDevice">{{'MYACCOUNT.DEVICE_CURRENT_INFO'|translate}}</span>
                    </div>
                </div>
            </div>
            <div class="card-footer">
                <button class="btn btn-sm btn-link" (click)="onDeleteDevice(device)"
                    *ngIf="!device.isCurrentDevice">{{'MYACCOUNT.DEVICE_REVOKE_ACCESS' | translate}}</button>
                <button class="btn btn-sm btn-link" (click)="onLogout($event)"
                    *ngIf="device.isCurrentDevice">{{'BUTTON.LOGOUT' | translate}}</button>
            </div>
        </div>
    </div>
</div>`;var q=`.justify-content-center{-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center}.justify-content-flex-end{-webkit-box-pack:end;-moz-box-pack:end;-webkit-flex-pack:end;-ms-flex-pack:end;-moz-justify-content:flex-end;-webkit-justify-content:flex-end;justify-content:flex-end}.card-footer{padding:.28rem .7rem}.alert{font-size:.756rem}@media screen and (min-width: 992px){.modal-xxl{max-width:1640px}}@media screen and (min-width: 1200px){.modal-xxxl{max-width:1860px}}.modal-fs{max-width:none;position:absolute;margin:auto;inset:16px;height:100vh;display:flex}.btn-link{text-decoration:none}.btn-link:hover{text-decoration:underline}.invalid-feedback{margin-top:0!important;font-size:.672rem!important}:host .device-container,:host .device-container[iscurrentdevice=true]{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-moz-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;flex-direction:row}:host .device-container .device-icon{background-color:#0a2a5a;margin:6px 12px 6px 0;width:48px;min-width:48px;height:48px;min-height:48px;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem}:host .device-container .device-icon cds-icon{color:#fff}:host .device-container .device-info{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center}:host .device-container .device-info .title{font-size:.84rem}:host .device-container .device-info .operating-system{font-size:.672rem}:host .device-container .device-info .last-access-date{margin-top:6px;font-size:.588rem}:host .device-container[iscurrentdevice=true] .device-icon{background-color:#0369a1}
`;var ee=function(s,e,t,o){var r=arguments.length,i=r<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,o);else for(var c=s.length-1;c>=0;c--)(n=s[c])&&(i=(r<3?n(i):r>3?n(e,t,i):n(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i},x=class{sessionService;identityService;interactionService;devices=[];constructor(e,t,o){this.sessionService=e,this.identityService=t,this.interactionService=o}ngOnInit(){this.getDevices()}getDevices(){this.identityService.getUserDevices().subscribe(e=>{e.items.forEach(t=>{t.isCurrentDevice=U.checkCurrentDevice(t,this.sessionService.currentTokenId)}),this.devices=e.items})}onDeleteDevice(e){this.interactionService.showDialog("MYACCOUNT.DEVICE_REVOKE_ACCESS","MYACCOUNT.DEVICE_REVOKE_ACCESS_CONFIRMATION",null,null,!0,"BUTTON.DELETE","",!0,()=>{this.identityService.revokeDeviceAccess(e.id).subscribe(()=>{this.interactionService.showMessage("MYACCOUNT.DEVICE_REVOKE_ACCESS_REVOKED",null,g.Success),this.getDevices()})})}onLogout(e){e.stopPropagation(),this.sessionService.logout()}static ctorParameters=()=>[{type:f},{type:p},{type:v}]};x=ee([l({selector:"armon-account-devices",template:W,animations:V,standalone:!0,imports:[O,P,C,A,d,R,m],styles:[q]})],x);var H=`<form [formGroup]="changePasswordForm">
  <div class="row">
    <div class="col-xl-6 col-lg-6 col-md-12">
      <div class="form-group">
        <label>{{'USER.USERNAME' | translate}}</label>
        <input id="username" type="text" class="form-control form-control-sm"
          [attr.value]="profile && profile.username ?profile.username:''" disabled>
      </div>
    </div>
    <div class="col-xl-6 col-lg-6 col-md-12">
      <div class="form-group">
        <label class="required">{{'USER.CURRENT_PASSWORD' | translate}}</label>
        <input id="fieldCurrentPassword" type="password" class="form-control form-control-sm"
          formControlName="currentPassword"
          [ngClass]="{'is-invalid': isUserAccountFormFieldInvalid('currentPassword')}">
        <div class="invalid-feedback"
          *ngIf="changePasswordForm.get('currentPassword').errors && changePasswordForm.get('currentPassword').errors.required">
          {{'VALIDATION.REQUIRED' | translate}}
        </div>
      </div>
    </div>
  </div>

  <div class="row">
    <div class="col-xl-6 col-lg-6 col-md-12">
      <div class="form-group">
        <label class="required">{{'USER.NEW_PASSWORD' | translate}}</label>
        <input id="fieldNewPassword" type="password" formControlName="newPassword" class="form-control form-control-sm"
          [ngClass]="{'is-invalid': isUserAccountFormFieldInvalid('newPassword')}">
        <div class="invalid-feedback"
          *ngIf="changePasswordForm.get('newPassword').errors && changePasswordForm.get('newPassword').errors.required">
          {{'VALIDATION.REQUIRED' | translate}}
        </div>
        <div class="invalid-feedback"
          *ngIf="changePasswordForm.get('newPassword').errors && changePasswordForm.get('newPassword').errors.minlength">
          <span [translate]="'VALIDATION.MIN_LENGTH'"
            [translateParams]="{min: changePasswordForm.get('newPassword').errors.minlength.requiredLength}"></span>
        </div>
        <div class="invalid-feedback"
          *ngIf="changePasswordForm.get('newPassword').errors && changePasswordForm.get('newPassword').errors.maxlength">
          <span [translate]="'VALIDATION.MAX_LENGTH'"
            [translateParams]="{max: changePasswordForm.get('newPassword').errors.maxlength.requiredLength}"></span>
        </div>
      </div>
    </div>
    <div class="col-xl-6 col-lg-6 col-md-12">
      <div class="form-group">
        <label class="required">{{'USER.CONFIRM_PASSWORD' | translate}}</label>
        <input id="fieldConfirmPassword" type="password" formControlName="confirmPassword"
          class="form-control form-control-sm"
          [ngClass]="{'is-invalid': isUserAccountFormFieldInvalid('confirmPassword') || isPasswordsNotMatched}">
        <div class="invalid-feedback"
          *ngIf="changePasswordForm.get('confirmPassword').errors && changePasswordForm.get('confirmPassword').errors.required">
          {{'VALIDATION.REQUIRED' | translate}}
        </div>
        <div class="invalid-feedback"
          *ngIf="changePasswordForm.get('confirmPassword').errors && changePasswordForm.get('confirmPassword').errors.minlength">
          <span [translate]="'VALIDATION.MIN_LENGTH'"
            [translateParams]="{min: changePasswordForm.get('confirmPassword').errors.minlength.requiredLength}"></span>
        </div>
        <div class="invalid-feedback"
          *ngIf="changePasswordForm.get('confirmPassword').errors && changePasswordForm.get('confirmPassword').errors.maxlength">
          <span [translate]="'VALIDATION.MAX_LENGTH'"
            [translateParams]="{max: changePasswordForm.get('confirmPassword').errors.maxlength.requiredLength}"></span>
        </div>
        <div class="invalid-feedback" *ngIf="isPasswordsNotMatched">
          {{'VALIDATION.PASSWORD_NOT_MATCH' | translate}}
        </div>
      </div>
    </div>
  </div>
</form>

<div class="d-flex justify-content-end">
  <button class="btn btn-primary" (click)="onChangePasswordClicked($event)"
    [disabled]="changePasswordForm.invalid || isPasswordsNotMatched">{{'MYACCOUNT.BUTTON_CHANGE_PASSWORD' |
    translate}}</button>
</div>`;var Y="";var oe=function(s,e,t,o){var r=arguments.length,i=r<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,o);else for(var c=s.length-1;c>=0;c--)(n=s[c])&&(i=(r<3?n(i):r>3?n(e,t,i):n(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i},_=class{identityService;interactionService;sessionService;profile;changePasswordForm=new F({currentPassword:new w("",a.required),newPassword:new w("",[a.required,a.minLength(u.PASSWORD_MIN_LENGTH),a.maxLength(u.PASSWORD_MAX_LENGTH)]),confirmPassword:new w("",[a.required,a.minLength(u.PASSWORD_MIN_LENGTH),a.maxLength(u.PASSWORD_MAX_LENGTH)])});FORM_FIELD_CURRENTPASSWORD="currentPassword";FORM_FIELD_NEWPASSWORD="newPassword";FORM_FIELD_CONFIRMPASSWORD="confirmPassword";constructor(e,t,o){this.identityService=e,this.interactionService=t,this.sessionService=o}ngOnInit(){}get isPasswordsNotMatched(){return this.changePasswordForm&&this.changePasswordForm.get(this.FORM_FIELD_NEWPASSWORD)&&this.changePasswordForm.get(this.FORM_FIELD_NEWPASSWORD).value&&this.changePasswordForm.get(this.FORM_FIELD_CONFIRMPASSWORD)&&this.changePasswordForm.get(this.FORM_FIELD_CONFIRMPASSWORD).value&&this.changePasswordForm.get(this.FORM_FIELD_NEWPASSWORD).value!==this.changePasswordForm.get(this.FORM_FIELD_CONFIRMPASSWORD).value}isUserAccountFormFieldInvalid(e){return y(this.changePasswordForm,e)}onChangePasswordClicked(e){let t=new L;t.oldPassword=this.changePasswordForm.get(this.FORM_FIELD_CURRENTPASSWORD).value,t.newPassword=this.changePasswordForm.get(this.FORM_FIELD_NEWPASSWORD).value,this.identityService.changeMyPassword(t).subscribe(()=>{this.interactionService.showDialog("USER.CHANGE_PASSWORD","USER.INFO_LOGOUT_REQUIRED",null,null,!1,"BUTTON.LOGOUT","",!1,()=>{this.sessionService.logout()})})}static ctorParameters=()=>[{type:p},{type:v},{type:f}];static propDecorators={profile:[{type:h}]}};_=oe([l({selector:"armon-account-change-password",template:H,standalone:!0,imports:[S,b,E,d,m],styles:[Y]})],_);var B=`<ng-container *ngIf="visible">
  <form [formGroup]="form">
    <div class="row mb-4">
      <div class="col-12">
        <div class="bg-white p-4 rounded-2">
          <div class="form-check form-switch">
            <input class="form-check-input cursor-pointer" type="checkbox" role="switch" id="enabledSwitch"
              [formControl]="form.get('enabled')">
            <label class="form-check-label cursor-pointer"
              for="enabledSwitch">{{'LICENSE.MULTI_FACTOR_SETTNGS_LABEL'|translate}}</label>
          </div>
          <ng-template
            *ngTemplateOutlet="controlValidationTemplate; context: {$implicit: form, control:form.get('enabled')}">
          </ng-template>
        </div>
      </div>
    </div>
  </form>
</ng-container>

<!-- FORM FIELD VALIDATION -->
<ng-template #controlValidationTemplate let-form let-control="control" let-isArray="isArray">
  <ng-container *ngIf="control.errors">
    <div class="invalid-feedback" style="display: initial;">
      <span
        *ngIf="control.errors.required">{{(isArray?'VALIDATION.MIN_ONE_SELECTED':'VALIDATION.REQUIRED')|translate}}</span>
      <span *ngIf="control.errors.ip">{{'VALIDATION.IP_V4_OR_V6'|translate}}</span>
      <span *ngIf="control.errors.numeric">{{'VALIDATION.POSITIVE_NUMBER'|translate}}</span>
      <span *ngIf="control.errors.max">{{'VALIDATION.MAX_VALUE'|translate:control.errors.max}}</span>
      <span *ngIf="control.errors.unique">{{'VALIDATION.UNIQUE'|translate}}</span>
      <span *ngIf="control.errors.domain">{{'VALIDATION.DOMAIN'|translate}}</span>
    </div>
  </ng-container>
</ng-template>`;var Q="";var ne=function(s,e,t,o){var r=arguments.length,i=r<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,o);else for(var c=s.length-1;c>=0;c--)(n=s[c])&&(i=(r<3?n(i):r>3?n(e,t,i):n(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i},I=class{identityService;formBuilder;interactionService;sessionService;profile;visible=!1;form;constructor(e,t,o,r){this.identityService=e,this.formBuilder=t,this.interactionService=o,this.sessionService=r}createForms(){this.form=this.formBuilder.group({enabled:[this.profile?.mfaSettings?.enabledStatus||!1,[a.required]]}),this.form.get("enabled").valueChanges.subscribe(e=>{let t=new M;t.mfaSettings={enabledStatus:e},this.identityService.upsertMultiFactorSettings(t).subscribe(o=>{this.interactionService.showMessage("LICENSE.MULTI_FACTOR_SETTNGS_USER_UPDATED",null,g.Success)})}),this.visible=!0}ngOnInit(){this.createForms()}static ctorParameters=()=>[{type:p},{type:T},{type:v},{type:f}];static propDecorators={profile:[{type:h}]}};I=ne([l({selector:"armon-account-multi-factor",template:B,standalone:!0,imports:[S,b,d,N,m],styles:[Q]})],I);var ce=function(s,e,t,o){var r=arguments.length,i=r<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,o);else for(var c=s.length-1;c>=0;c--)(n=s[c])&&(i=(r<3?n(i):r>3?n(e,t,i):n(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i},K=class{sessionService;settingsService;identityService;visible=!1;userSessionWithSSO;visibleMultiFactor=!1;profile;constructor(e,t,o){this.sessionService=e,this.settingsService=t,this.identityService=o}ngOnInit(){this.userSessionWithSSO=this.sessionService.sessionGrantType==D.SSO,this.settingsService.getOrganizationSettings().subscribe(e=>{this.visibleMultiFactor=e.multiFactorAuthenticationSettings.option===k.OPTIONAL}),this.getProfile()}getProfile(){this.identityService.getUserProfile().subscribe(e=>{this.profile=e,this.visible=!0})}static ctorParameters=()=>[{type:f},{type:z},{type:p}]};K=ce([l({selector:"armon-account-security",template:j,standalone:!0,imports:[d,_,x,I,m],styles:[G]})],K);export{K as AccountSecurityComponent};
