import{a as ye}from"./chunk-HYAJENKW.js";import{a as N,c as H,e as Ee,f as ke}from"./chunk-PLS4K4KY.js";import"./chunk-JN2ZUHXX.js";import"./chunk-NLCRYDJ4.js";import"./chunk-RB5TOXJE.js";import{a as Y}from"./chunk-XOY5UTVP.js";import"./chunk-G7OJYPNY.js";import"./chunk-3GSDFESG.js";import"./chunk-7QEXVS2A.js";import"./chunk-KCLQIV7M.js";import"./chunk-5KCUTXXV.js";import{a as Pe}from"./chunk-5OT2MLHH.js";import"./chunk-LAJI7RPC.js";import"./chunk-WFZJP5WR.js";import"./chunk-F6KLNSUK.js";import{a as _e}from"./chunk-4MZCYQX4.js";import{b as Fe,c as Ce,d as Oe}from"./chunk-YOJ4KGSB.js";import"./chunk-I6FSQTEP.js";import"./chunk-CO3X7TQN.js";import{F as K,I as $,Ob as W,Qb as we,a as Ye,pa as Ie,qa as Se,ra as xe,s as ue,sb as Re,ub as g,va as ie,vb as v,wa as Q,xa as Te,y as he,yb as Ve}from"./chunk-YSQLW2JA.js";import{nd as A}from"./chunk-NVJ2ZZFT.js";import{Aa as f,Ba as D,Cb as le,Dc as x,Fc as me,Fg as E,He as te,Jg as ge,Ka as re,Kg as be,Lb as B,Mc as T,Nc as l,Pd as F,Qf as R,Rd as j,Sd as C,Se as fe,Te as G,Ue as q,Wb as ce,_a as I,a as oe,ab as S,bb as m,cb as z,cd as pe,db as L,dd as p,eb as ne,fc as w,g as He,gb as U,ha as P,hd as k,ic as de,jb as ae,md as h,mg as ve,nd as c,va as M,wa as b,ya as d}from"./chunk-SKPDQO4E.js";var De=`<div class="h-100">
  <side-navigation *ngIf="(!viewModeSelf && registrationPoint) || (viewModeSelf)">
    <ng-template side-navigation-nav>
      <div class="row">
        <div class="col-12 mb-3">
          <armon-visitor-registration-point-panel [registrationPoint]="registrationPoint"
            (registrationPointClick)="openRegistrationPointSelection()" *ngIf="!viewModeSelf">
          </armon-visitor-registration-point-panel>
        </div>
        <div class="col-12 mb-3">
          <label class="report-form-label">{{'VISITOR.VISIT_STATE_TITLE' | translate}}</label>
          <div class="btn-group btn-group-sm w-100">
            <button class="btn"
              [ngClass]="{'btn-primary': visitorFilter.filter.state==1, 'btn-outline-primary': visitorFilter.filter.state!=1}"
              (click)="onStateChanged(1)">{{'VISITOR.VISIT_STATE_ALL' | translate}}</button>
            <button class="btn"
              [ngClass]="{'btn-success': visitorFilter.filter.state==2, 'btn-outline-success': visitorFilter.filter.state!=2}"
              (click)="onStateChanged(2)">{{'VISITOR.VISIT_STATE_ACTIVE' | translate}}</button>
            <button class="btn"
              [ngClass]="{'btn-danger': visitorFilter.filter.state==3, 'btn-outline-danger': visitorFilter.filter.state!=3}"
              (click)="onStateChanged(3)">{{'VISITOR.VISIT_STATE_EXPECTED' | translate}}</button>
          </div>
        </div>
        <div class="col-12 mb-2">
          <!-- Search visitors -->
          <label class="report-form-label">{{'VISITOR.FILTER_TITLE_SEARCH_VISITORS' | translate}}</label>
          <armon-visitor-search [hideChips]="true" [notStoreSelection]="true" (itemSelected)="onVisitorSelected($event)"
            [showActiveFilter]="false" [activeFilterSelected]="false" [(visitStateType)]="visitorFilter.filter.state">
          </armon-visitor-search>
        </div>
        <div class="col-12 mb-2">
          <!-- Unique Fields -->
          <ng-container *ngIf="!viewModeSelf">
            <ng-container *ngFor="let formField of uniqueFormFields">
              <label class="report-form-label">{{formField.caption}} {{'COMMON.SEARCH' | translate}}</label>
              <armon-filter-input #uniqueFieldInput [minLength]="3" placeholder="COMMON.SEARCH"
                (entryCompleted)="onUniqueFieldEntered($event, formField)"></armon-filter-input>
            </ng-container>
          </ng-container>
        </div>
        <div class="col-12 mb-2">
          <ng-container *ngIf="visibleCredentialDataInput">
            <label class="report-form-label" *ngIf="!viewModeSelf">{{'VISITOR.FILTER_TITLE_SEARCH_CREDENTIAL' |
              translate}}</label>
            <armon-filter-input #credentialDataInput [minLength]="3" placeholder="CREDENTIAL.TITLE_DATA"
              (entryCompleted)="onCredentialDataEntered($event)" *ngIf="!viewModeSelf"></armon-filter-input>
          </ng-container>
        </div>
        <div class="col-12" *ngIf="gdprEnabled">
          <armon-visitor-approve-list></armon-visitor-approve-list>
        </div>
      </div>
    </ng-template>
    <ng-template side-navigation-content>
      <div class="row" *ngIf="showVisitorForm">
        <div class="col-xl-12">
          <armon-visitor-form #visitorForm [visitor]="currentVisitor" [visitId]="currentVisitId"
            [viewModeSelf]="viewModeSelf" (dismiss)="onVisitorFormDismiss()"
            (completed)="onVisitorFormCompleted($event)"></armon-visitor-form>
        </div>
      </div>
      <div class="h-100 py-3" [hidden]="showVisitorForm">
        <div class="row">
          <div class="col-12 d-flex align-items-center column-gap-2">
            <nz-button-group *ngIf="!viewModeSelf">
              <button nz-button (click)="onAddVisitorButtonClicked()" nzType="primary">{{'VISITOR.ADD'
                | translate}}</button>
              <button nz-button nz-dropdown [nzDropdownMenu]="registrationMenu" nzPlacement="bottomRight"
                nzTrigger="click" nzType="primary">
                <cds-icon shape="angle" direction="down"></cds-icon>
              </button>
            </nz-button-group>
            <nz-dropdown-menu #registrationMenu="nzDropdownMenu">
              <ul nz-menu>
                <li nz-menu-item (click)="onAddBulkVisitorButtonClicked()">{{'VISITOR.ADD_NEW_VISIT_BULK'|
                  translate}}</li>
              </ul>
            </nz-dropdown-menu>

            <nz-button-group *ngIf="viewModeSelf || managerPreRegisterAvailable">
              <button nz-button (click)="onAddPreRegisterButtonClicked()"
                [nzType]="viewModeSelf?'primary':'default'">{{'VISITOR.ADD_PREREGISTER'
                | translate}}</button>
              <button nz-button nz-dropdown [nzDropdownMenu]="preRegistrationMenu" nzPlacement="bottomRight"
                nzTrigger="click" [nzType]="viewModeSelf?'primary':'default'">
                <cds-icon shape="angle" direction="down"></cds-icon>
              </button>
            </nz-button-group>
            <nz-dropdown-menu #preRegistrationMenu="nzDropdownMenu">
              <ul nz-menu>
                <li nz-menu-item (click)="onAddBulkPreRegisterButtonClicked()">{{'VISITOR.ADD_PREREGISTER_BULK'|
                  translate}}</li>
              </ul>
            </nz-dropdown-menu>
            <div class="spinner-border spinner-border-sm text-primary ms-2" role="status" [hidden]="!updatingList">
            </div>
            <button class="btn btn-sm btn-outline-danger ms-auto" *ngIf="QRCodeEnabled"
              (click)="onQRCodeTerminateClicked()">
              <cds-icon shape="qr-code" class="me-2"></cds-icon>{{'BUTTON.TERMINATE'
              | translate}}
            </button>
          </div>
        </div>
        <div class="col-12 mt-3 activeVisitorListArea" *ngIf="visitors">

          <!-- ------------------------------------------- -->
          <p-table #dt [value]="visitors" dataKey="visitId" [responsive]="true" rowExpandMode="single">
            <ng-template pTemplate="header">
              <tr>
                <th>{{'REPORT.VISITOR_HISTORY_HEADER_DATE' | translate}}</th>
                <th *ngFor="let column of columnFields">{{column.caption}}</th>
              </tr>
              <tr *ngIf="!viewModeSelf">
                <th>&nbsp;</th>
                <th *ngFor="let column of columnFields" [ngSwitch]="column.type" class="filters-container">
                  <input *ngSwitchCase="1" pInputText type="text"
                    (input)="onListRefreshed($event.target.value, column)">
                  <input *ngSwitchCase="7" pInputText type="text"
                    (input)="onListRefreshed($event.target.value, column)">
                  <input *ngSwitchCase="8" pInputText type="text"
                    (input)="onListRefreshed($event.target.value, column)">
                  <input *ngSwitchCase="9" pInputText type="text"
                    (input)="onListRefreshed($event.target.value, column)">
                  <!-- <p-dropdown *ngSwitchCase="7" [options]="column.options.options" (onChange)="onListRefreshed($event.value, column)"></p-dropdown> -->
                </th>
              </tr>
            </ng-template>
            <ng-template pTemplate="body" let-visitor let-rowData let-expanded="expanded">
              <tr [pRowToggler]="rowData" [attr.expanded]="expanded" class="data-row visitorRow"
                [attr.state]="visitor.state">
                <td>
                  <div class="date-container">
                    <span class="date-title-expected"
                      *ngIf="visitor.startDateText && visitor.isExpectedStartDate">{{'VISITOR.VISIT_DATE_EXPECTED_START'|
                      translate}}</span>
                    <span class="date-title"
                      *ngIf="visitor.startDateText && !visitor.isExpectedStartDate">{{'VISITOR.VISIT_DATE_START'|
                      translate}}</span>
                    <span class="mb-2">{{visitor.startDateText}}</span>
                    <span class="date-title-expected"
                      *ngIf="visitor.endDateText && visitor.isExpectedEndDate">{{'VISITOR.VISIT_DATE_EXPECTED_END'|
                      translate}}</span>
                    <span class="date-title"
                      *ngIf="visitor.endDateText && !visitor.isExpectedEndDate">{{'VISITOR.VISIT_DATE_END'|
                      translate}}</span>
                    <span>{{visitor.endDateText}}</span>
                  </div>
                </td>
                <td *ngFor="let column of columnFields">
                  <ng-container [ngSwitch]="column.type">
                    <div *ngSwitchCase="5">
                      <cds-icon shape="{{visitor.values[column.name]?'check-circle':'minus'}}" class="cds-icon-20"
                        solid={{visitor.values[column.name]}}></cds-icon>
                    </div>
                    <span *ngSwitchDefault>{{visitor.values[column.name]}}</span>
                  </ng-container>
                </td>
              </tr>
            </ng-template>
            <ng-template pTemplate="rowexpansion" let-visitor>
              <tr>
                <td [attr.colspan]="columnFields.length + 1" class="expanded-row">

                  <button class="btn btn-sm btn-primary" *ngIf="!viewModeSelf || visitor.state==3" style="margin: 2px;"
                    (click)="onShowDetailsClicked($event, visitor.visitorProfileId, visitor.visitId, visitor.state)">{{'BUTTON.DETAILS'
                    | translate}}</button>
                  <button class="btn btn-sm btn-danger me-2" (click)="onTerminateVisitClicked($event, visitor.visitId)"
                    *ngIf="visitor.state==2 && !viewModeSelf">{{'BUTTON.TERMINATE'
                    | translate}}</button>
                  <button class="btn btn-sm btn-danger me-2"
                    (click)="onDeletePreregisterVisitClicked($event, visitor.visitId)"
                    *ngIf="visitor.state==3 && (viewModeSelf || permissionDeletePreRegistrations)">{{'BUTTON.DELETE'
                    | translate}}</button>
                  <button class="btn btn-sm btn-outline-primary me-2"
                    (click)="onPrintBadgeClicked($event, visitor.visitorProfileId)"
                    *ngIf="printableVisitorCard && visitor.state==2 && !viewModeSelf">{{'BUTTON.CARD_PRINT'
                    | translate}}</button>
                  <div class="photo-container" *ngIf="visitor.thumbnail">
                    <div>
                      <img class="photo-image" [src]="visitor.thumbnail" (click)="onImageClicked(visitor.thumbnail)">
                    </div>
                  </div>
                  <div *ngFor="let field of detailFields" class="ps-2 pt-2">
                    <ng-container *ngIf="visitor.values[field.name]">
                      <span><strong>{{field.caption}} : </strong></span>
                      <span>{{visitor.values[field.name]}}</span>
                    </ng-container>
                  </div>
                </td>
              </tr>
            </ng-template>
          </p-table>
          <!-- ------------------------------------------- -->

          <div class="centered showMoreArea" *ngIf="visitorResponse.total > visitors.length">

            <button class="responsiveContent btn btn-sm btn-link"
              (click)="onShowMoreClicked($event)">{{'BUTTON.LOADMORE'
              | translate}}</button>

          </div>

        </div>
      </div>
    </ng-template>
  </side-navigation>
  <div *ngIf="(!viewModeSelf && !registrationPoint)">
    <div class="row">
      <div class="col-12 centered mt-4">
        <div>
          <div class="alert alert-info" role="alert">
            {{'VISITOR.REGISTRATION_POINT_DIRECTION' | translate}}
          </div>
        </div>
      </div>
      <div class="col-12 centered mt-3">
        <button class="btn btm-sm btn-primary"
          (click)="openRegistrationPointSelection()">{{'VISITOR.REGISTRATION_POINT_SELECT'
          | translate}}</button>
      </div>
    </div>
  </div>
</div>`;var Ae=`.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}.activeVisitorListArea{height:-webkit-calc(100% - 36px);height:-moz-calc(100% - 36px);height:calc(100% - 36px);overflow:auto;padding-bottom:8px;margin-right:-.5rem;margin-left:-.5rem}.filter-button-group .btn{width:100%;padding-left:.1rem;padding-right:.1rem}.visitorFormArea{overflow:auto}.filterHeader{border-bottom:1px solid rgb(235,235,235)}.filterHeader>p{margin-top:6px}.filterContent{padding-right:12px}.filterContent>p{margin-bottom:8px}.visitorRow{margin:auto;font-size:.672rem}.visitorRow[state="2"]{background-color:#f5fbef!important}.visitorRow[state="3"]{background-color:#fffbf5!important}.showMoreArea{margin-top:24px}.filters-container input{width:100%;background:#fff;border:1px solid #CCC;color:#c82602;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem}.date-container{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-align:start;-ms-flex-align:start;-webkit-align-items:flex-start;-moz-align-items:flex-start;align-items:flex-start;margin-top:3px;font-size:.588rem}.date-container .date-title,.date-container .date-title-expected{font-size:.672rem;color:#0a2a5a}.photo-container{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;margin:6px 2px}.photo-container .photo-image{cursor:zoom-in;border:1px solid #aaa;width:90px!important;height:auto;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem}
`;var Ne=`<div class="modal-header">
    <span class="text-lg">{{'VISITOR.REGISTRATION_POINT_TITLE' | translate}}</span>
</div>
<div class="modal-body">
    <div class="alert alert-info" role="alert" *ngIf="!registrationPoint">
        {{'VISITOR.REGISTRATION_POINT_DIRECTION' | translate}}
    </div>

    <div *ngFor="let registrationPoint of registrationPoints" class="mb-2">
        <armon-visitor-registration-point-panel [registrationPoint]="registrationPoint"
            (registrationPointClick)="onRegistrationPointClicked($event)"></armon-visitor-registration-point-panel>
    </div>
</div>
<div class="modal-footer">
    <button class="btn btn-primary" (click)="onCancelClicked($event)">
        {{'BUTTON.CANCEL' | translate}}
    </button>
</div>`;var Me=`.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}.registration-point-panel{width:100%;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex}.registration-point-panel .icon-container{padding:.3rem;background-color:#5565a9;-webkit-border-top-left-radius:.56rem;-moz-border-radius-topleft:.56rem;border-top-left-radius:.56rem;-webkit-border-v-left-radius:.56rem;-moz-border-radius-bottomleft:.56rem;border-bottom-left-radius:.56rem;color:#fff}.registration-point-panel .point-container{-webkit-flex-grow:1;-webkit-box-flex:1;-moz-flex-grow:1;-ms-flex-positive:1;flex-grow:1;padding:.3rem;-webkit-border-top-right-radius:.56rem;-moz-border-radius-topv:.56rem;border-top-right-radius:.56rem;-webkit-border-v-right-radius:.56rem;-moz-border-radius-bottomright:.56rem;border-bottom-right-radius:.56rem;background-color:#4451871a;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center}.registration-point-panel .point-container .point-name{font-size:.756rem;line-height:.7rem;color:#445187}
`;var ze=`<div class="registration-point-panel" (click)="onClicked($event)">
    <div class="icon-container">
        <cds-icon shape="barrier" style="width: 30px; height: 30px;"></cds-icon>
    </div>
    <div class="point-container">
        <span class="point-name" *ngIf="registrationPoint">{{registrationPoint.name}}</span>
        <span *ngIf="!registrationPoint">
            <cds-icon shape="warning-standard" class="no-point-icon me-2" solid size="sm"></cds-icon><span
                class="no-point">{{'VISITOR.REGISTRATION_NO_POINT'|translate}}</span>
        </span>
        <ng-container *ngIf="registrationPoint && gdprEnabled">
            <span class="device-status" *ngIf="registrationPoint.isGDPRRequired">
                <span
                    [ngClass]="{'color-success': registrationPoint.isConnected, 'color-error': !registrationPoint.isConnected}">&#9724;</span>
                <span class="ms-1" [ngClass]="{'color-error': !registrationPoint.isConnected}">{{ (
                    registrationPoint.isConnected ? 'VISITOR.APPROVE_DEVICE_CONNECTED' :
                    'VISITOR.APPROVE_DEVICE_NOT_CONNECTED' ) | translate }}</span>
            </span>
            <span class="device-status" *ngIf="!registrationPoint.isGDPRRequired">
                <span class="text-italic">{{ 'VISITOR.APPROVE_NOT_REQUIRED' | translate }}</span>
            </span>
        </ng-container>
    </div>
</div>`;var Le=`.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}.registration-point-panel{width:100%;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;cursor:pointer}.registration-point-panel .icon-container{padding:.35rem;background-color:#5565a9;-webkit-border-top-left-radius:.56rem;-moz-border-radius-topleft:.56rem;border-top-left-radius:.56rem;-webkit-border-v-left-radius:.56rem;-moz-border-radius-bottomleft:.56rem;border-bottom-left-radius:.56rem;color:#fff}.registration-point-panel .point-container{-webkit-flex-grow:1;-webkit-box-flex:1;-moz-flex-grow:1;-ms-flex-positive:1;flex-grow:1;padding:.35rem;-webkit-border-top-right-radius:.56rem;-moz-border-radius-topv:.56rem;border-top-right-radius:.56rem;-webkit-border-v-right-radius:.56rem;-moz-border-radius-bottomright:.56rem;border-bottom-right-radius:.56rem;background-color:#4451871a;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}.registration-point-panel .point-container .point-name,.registration-point-panel .point-container .no-point{font-size:.756rem;color:#445187}.registration-point-panel .point-container .no-point,.registration-point-panel .point-container .no-point-icon{color:#c82602}.registration-point-panel .point-container .device-status{color:#7c85ab;font-size:.588rem;margin-top:.07rem}.registration-point-panel:hover .point-container{background-color:#44518733}
`;var st=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},O=class{sessionService;socketService;registrationPoint;registrationPointClick=new P;subscriptionVisitorRegistrationDeviceStatus;gdprEnabled;listMode=!1;constructor(e,t){this.sessionService=e,this.socketService=t,this.gdprEnabled=this.sessionService.currentOrganization&&this.sessionService.currentOrganization.visitorModuleSettings&&this.sessionService.currentOrganization.visitorModuleSettings.gdprEnabled}ngOnInit(){this.gdprEnabled&&(this.subscriptionVisitorRegistrationDeviceStatus=this.socketService.onVisitorRegistrationDeviceStatusChanged.subscribe(e=>{if(this.sessionService.currentOrganization.visitorModuleSettings&&this.sessionService.currentOrganization.visitorModuleSettings.visitorRegistrationPoints){let t=this.sessionService.currentOrganization.visitorModuleSettings.visitorRegistrationPoints.find(i=>i.id==e.registrationPointId);t&&this.registrationPoint.id==t.id&&(this.registrationPoint.isConnected=t.isConnected)}}))}ngOnDestroy(){this.subscriptionVisitorRegistrationDeviceStatus&&this.subscriptionVisitorRegistrationDeviceStatus.unsubscribe()}onClicked(e){this.registrationPointClick.emit(this.registrationPoint)}static ctorParameters=()=>[{type:F},{type:we}];static propDecorators={registrationPoint:[{type:f}],registrationPointClick:[{type:D}]}};O=st([d({selector:"armon-visitor-registration-point-panel",template:ze,standalone:!0,imports:[m,I,p],styles:[Le]})],O);var ot=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},X=class extends C{visitorService;registrationPoints;registrationPoint;constructor(e){super(),this.visitorService=e}onModalInitialized(){super.onModalInitialized(),this.registrationPoint=this.visitorService.selectedRegistrationPoint,this.registrationPoints=this.visitorService.availableRegistrationPoints}onCancelClicked(e){this.cancelModal()}onRegistrationPointClicked(e){this.visitorService.selectedRegistrationPoint=e,this.closeModal(e)}static ctorParameters=()=>[{type:v}]};X=ot([d({selector:"armon-visitor-registration-point-selection",template:Ne,standalone:!0,imports:[m,S,O,p],styles:[Me]})],X);var Ue=`<div class="modal-header">
  <div class="d-flex flex-column">
    <span class="action-title text-base" *ngIf="action==1">{{'VISITOR.ADD'|translate}}</span>
    <span class="action-title-terminate text-base" *ngIf="action==2">{{'VISITOR.TERMINATE'|translate}}</span>
  </div>
</div>
<div class="modal-body">
  <div class="row color-primary">
    <div class="col-12 text-center justify-content-center d-flex">
      <div class="graphic-container">
        <cds-icon shape="credential_qrcode" style="width: 84px; height: 84px;"></cds-icon>
        <div class="tablet-icon">
          <div class="pos-relative">
            <cds-icon shape="tablet" solid size="xxl"></cds-icon>
            <span class="spinner-border spinner-border-sm tablet-spinner"></span>
          </div>
        </div>
      </div>
    </div>
    <div class="col-12 text-center mt-4 text-md">
      {{'VISITOR.PROFILE_QRCODE_INFO'|translate}}
    </div>
    <div class="col-12 text-center my-3 text-sm">
      {{'VISITOR.PROFILE_QRCODE_SUB_INFO'|translate}}
    </div>
  </div>
</div>`;var Be=`.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}.action-title,.action-title-terminate{color:#0a2a5a;font-weight:500}.action-title-terminate{color:#c82602}.graphic-container{position:relative;width:120px;height:120px}.graphic-container .tablet-icon{position:absolute;right:0;bottom:0;background-color:#fff;padding-top:3px;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem}.graphic-container .tablet-spinner{position:absolute;left:14px;top:10px}
`;var at=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},y=class extends C{interactionService;visitorService;action;registrationPointId;constructor(e,t){super(),this.interactionService=e,this.visitorService=t}onModalInitialized(){if(super.onModalInitialized(),ce(this.action))this.cancelModal();else switch(this.action){case V.AddVisit:this.visitorService.getQRCodeVisitId(this.registrationPointId).subscribe(e=>{this.closeModal(e)},e=>{this.cancelModal()});break;case V.Terminate:this.visitorService.terminaterQRCodeVisit(this.registrationPointId).subscribe(e=>{this.closeModal(e)},e=>{this.cancelModal()});break}}static ctorParameters=()=>[{type:R},{type:v}];static propDecorators={action:[{type:f}],registrationPointId:[{type:f}]}};y=at([d({selector:"armon-visitor-qrcode-modal",template:Ue,standalone:!0,imports:[m,p],styles:[Be]})],y);var V;(function(n){n[n.AddVisit=1]="AddVisit",n[n.Terminate=2]="Terminate"})(V||(V={}));var je=`<div class="formArea p-3 expected-visits-container"
  *ngIf="visibleExpectedVisits && visitor && visitor.expectedVisits && visitor.expectedVisits.length>0 && !replacedVisitorProfileId">
  <div class="title mb-3">{{'VISITOR.PREREGISTRATION_LIST'|translate}}</div>
  <div class="expected-visit py-1" *ngFor="let expectedVisit of visitor.expectedVisits">
    <button class="btn btn-sm btn-primary" (click)="onPreregisterSelectClicked(expectedVisit)">
      {{'VISITOR.SHOW_VISIT' | translate}}
    </button>
    <span class="fullname">{{expectedVisit.visitedUserProfile?.fullname}}</span>
    <span class="date" *ngIf="expectedVisit.expectedStartUtc">&nbsp; &nbsp;
      <span *ngIf="expectedVisit.expectedStartUtc">{{expectedVisit.expectedStartUtc | date:'longDate'}}</span>
      <!-- <span *ngIf="expectedVisit.expectedEndUtc"> -
        {{expectedVisit.expectedEndUtc | date:'medium'}}</span> -->
    </span>
  </div>
</div>
<div class="formArea p-4 pos-relative">
  <div class="formContent">
    <button class="btn btn-success btn-sm refresh-button" (click)="onRefreshFormClicked($event)"
      *ngIf="inEditMode && !viewModeSelf && visibleRefreshButton" [disabled]="disableRefreshButton">
      <cds-icon shape="refresh" class="me-2" solid></cds-icon>{{'VISITOR.FORM_REFRESH'|translate}}
    </button>
    <dynamic-form *ngIf="visitorProfileFormInfo" [header]="'VISITOR.VISITOR_PROFILE'"
      [formGroup]="visitorProfileFormInfo.formGroup" [formFields]="visitorProfileFormInfo.formFields"
      [fieldEndpoint]="visitorProfileFormInfo.endpointField"
      [showQRButton]="QRCodeEnabledAtPoint && !isPreregister && !viewModeSelf"
      (readQRCodeClicked)="onVisitorReadQRCodeClicked($event)" [formEndpoint]="visitorProfileFormInfo.endpointForm"
      [isEmptyForm]="!visitor" [isEnabledForm]="!visitor" #dynamicForm
      (suggestionSelected)="onVisitorSuggestionSelected($event)" (suggestionLoaded)="onVisitorSuggestionLoaded($event)"
      [showStartupSuggestion]="!viewModeSelf && isPreregister"></dynamic-form>

    <div *ngIf="visitor && visitor.profile && (visitor.profile.isTempPermitted || visitor.profile.isBlacklisted)"
      class="row">
      <div class="detail-state-container col-sm-12"
        [ngClass]="{'col-md-6': visitor.profile.isTempPermitted, 'col-md-12': !visitor.profile.isTempPermitted}"
        *ngIf="visitor.profile.isBlacklisted">
        <div class="detail-state-item">
          <span class="state-title">
            <cds-icon shape="no-access" class="color-error me-2" solid></cds-icon>{{'VISITOR.BLACK_LIST'
            |
            translate}}
          </span>
          <span class="state-date" *ngIf="visitor.profile.blacklistState">{{'VISITOR.STATE_START_DATE'
            | translate}} : {{visitor.profile.blacklistState.startUtcText}}</span>
          <span class="state-date" *ngIf="visitor.profile.blacklistState">{{'VISITOR.STATE_END_DATE'
            | translate}} : {{visitor.profile.blacklistState.endUtcText}}</span>
          <span class="state-note"
            *ngIf="visitor.profile.blacklistState && visitor.profile.blacklistState.note">{{'VISITOR.STATE_NOTE'
            | translate}} : {{visitor.profile.blacklistState.note}}</span>
        </div>
      </div>

      <div class="detail-state-container col-sm-12"
        [ngClass]="{'col-md-6': visitor.profile.isBlacklisted, 'col-md-12': !visitor.profile.isBlacklisted}"
        *ngIf="visitor.profile.isTempPermitted">
        <div class="detail-state-item">
          <span class="state-title">
            <cds-icon shape="success-standard" class="color-dark-blue-color me-2" solid></cds-icon>
            {{'VISITOR.TEMPORARY_PERMITTED'
            |
            translate}}
          </span>
          <span class="state-date" *ngIf="visitor.profile.tempPermitState">{{'VISITOR.STATE_START_DATE'
            | translate}} : {{visitor.profile.tempPermitState.startUtcText}}</span>
          <span class="state-date" *ngIf="visitor.profile.tempPermitState">{{'VISITOR.STATE_END_DATE'
            | translate}} : {{visitor.profile.tempPermitState.endUtcText}}</span>
          <span class="state-note"
            *ngIf="visitor.profile.tempPermitState && visitor.profile.tempPermitState.note">{{'VISITOR.STATE_NOTE'
            | translate}} : {{visitor.profile.tempPermitState.note}}</span>
          <span class="state-date" *ngIf="!visitor.profile.tempPermitState">{{'VISITOR.INFO_NO_TEMPORARY_PERMITTED_USER'
            | translate}}</span>
        </div>
      </div>

    </div>

    <div class="row" *ngIf="hasTerminatedLastVisit && !inNewVisitMode">
      <div class="col-12 b-b-1 my-2">
        <span class="text-md">
          {{'VISITOR.LAST_VISIT_DETAILS' | translate}}
        </span>
      </div>
      <ng-container *ngFor="let item of visitor.lastVisit.info">
        <div class="col-xl-3 col-lg-3 col-md-6 col-12"><span class="text-sm text-bold">{{item.name | translate}}</span>
        </div>
        <div class="col-xl-3 col-lg-3 col-md-6 col-12"><span class="text-sm">{{item.value}}</span></div>
      </ng-container>
    </div>

    <div *ngIf="!inNewVisitMode && (!hasLastVisit || hasTerminatedLastVisit)">
      <button class="btn btn-sm btn-primary mt-2" (click)="onAddNewVisitClicked($event)">
        {{'VISITOR.ADD_NEW_VISIT' | translate}}
      </button>
    </div>

    <ng-container *ngIf="inNewVisitMode || (hasLastVisit && !hasTerminatedLastVisit)">
      <dynamic-form *ngIf="visitFormInfo" [showEditButton]="false" [header]="'VISITOR.VISIT_DETAILS'"
        [formGroup]="visitFormInfo.formGroup" [formFields]="visitFormInfo.formFields"
        [fieldEndpoint]="visitFormInfo.endpointField" [formEndpoint]="visitFormInfo.endpointForm" #dynamicForm
        [isEmptyForm]="inNewVisitMode && !usingLastVisitData"
        [isEnabledForm]="viewModeSelf || (!viewModeSelf && inNewVisitMode)"></dynamic-form>

      <div class="px-2">
        <div class="row" *ngIf="credentialFieldDefinition">
          <div class="col-md-2 col-sm-12">
            <label for="credentialDataInput"
              [ngClass]="{'required': credentialFieldDefinition.required}">{{credentialFieldDefinition.caption}}</label>
          </div>

          <div class="col-md-10 col-sm-12">
            <armon-filter-input #credentialDataInput [tooltipAtTop]="true" [minLength]=3
              [disabled]="visitFormInfo.formGroup.disabled" placeholder="CREDENTIAL.TITLE_DATA"
              (entryCompleted)="onCredentialDataEntered($event)"></armon-filter-input>
          </div>
        </div>
      </div>

      <div class="row mt-3 justify-content-center" *ngIf="currentVisitCredentials.length > 0">
        <div class="col-md-4 col-sm-12" *ngFor="let credentialData of currentVisitCredentials">
          <armon-credential [credential]="credentialData" [disabled]="visitFormInfo.formGroup.disabled"
            (credentialRemoved)="onCredentialRemoved($event)"></armon-credential>
        </div>
      </div>

    </ng-container>

  </div>

  <div class="d-flex justify-content-between mt-3">
    <div class="d-flex align-items-center">
      <button type="button" class="btn btn-link"
        *ngIf="QRCodeEnabledInModule && !inEditMode && hasLastVisit && !hasTerminatedLastVisit && !viewModeSelf"
        (click)="onSendInvitationAgainClicked($event)">
        <cds-icon shape="credential_qrcode" class="cds-icon-18 me-2"></cds-icon>{{'VISITOR.INVITATION_SEND_AGAIN'|
        translate}}
      </button>
    </div>
    <div>
      <button type="button" class="btn btn-outline-primary me-2"
        (click)="onCancelClicked($event)">{{(viewModeSelf?'BUTTON.CLOSE':'BUTTON.CANCEL')
        | translate}}</button>
      <button type="button" class="btn btn-danger me-2" #terminateButton (click)="onTerminateClicked($event)"
        *ngIf="!inEditMode && hasLastVisit && !hasTerminatedLastVisit && !viewModeSelf">{{'BUTTON.TERMINATE'
        | translate}}</button>
      <button type="button" class="btn btn-primary me-2" (click)="onSaveClicked($event, false)" *ngIf="inEditMode"
        [disabled]="!isValid">{{'BUTTON.SAVE'
        | translate}}</button>
      <button type="button" class="btn btn-success" (click)="onSaveClicked($event, true)"
        *ngIf="inEditMode && !viewModeSelf" [disabled]="!isValid">{{'BUTTON.SAVE_AND_ADD'
        | translate}}</button>
    </div>
  </div>

</div>
<!-- <pre>inNewVisitMode: {{inNewVisitMode}}</pre>
<pre>inEditMode: {{inEditMode}}</pre>
<pre>hasLastVisit: {{hasLastVisit}}</pre>
<pre>hasTerminatedLastVisit: {{hasTerminatedLastVisit}}</pre>
<pre>viewModeSelf : {{viewModeSelf}}</pre>
<pre>usingLastVisitData : {{usingLastVisitData}}</pre> -->
<!-- <pre>{{replacedVisitorProfileId}}</pre> -->`;var Ge=`.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}.formArea{-webkit-border-radius:.75rem;-moz-border-radius:.75rem;border-radius:.75rem;background:#fff;border:1px solid rgb(235,235,235);-moz-transition:width .25s ease;-webkit-transition:width .25s ease;-o-transition:width .25s ease;transition:width .25s ease}.expected-visits-container{margin-bottom:12px;background-color:#fff7eb}.expected-visits-container .title{font-weight:400;font-size:.756rem;color:#000}.expected-visits-container .expected-visit{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;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center}.expected-visits-container .expected-visit .fullname,.expected-visits-container .expected-visit .date{font-size:.672rem;line-height:.55rem}.detail-state-container{padding-left:12px;padding-right:12px;margin-bottom:1rem}.detail-state-item{padding:.3rem;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;background-color:#fff;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem;box-shadow:0 0 4px #ccc}.detail-state-item .state-title{margin:.2rem 0;font-size:.756rem}.detail-state-item .state-date{margin:.15rem 0;font-size:.672rem}.detail-state-item .state-note{margin:.15rem 0;font-size:.588rem}.refresh-button{position:absolute;top:.7rem;right:.7rem}
`;var dt=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},J=class{detector;dynamicFormService;visitorService;interactionService;authService;sessionService;modalService;visitor;visitId;viewModeSelf=!0;dismiss=new P;completed=new P;credentialDataInput;terminateButton;dynamicForms;visitorProfileFormInfo;visitFormInfo;credentialFieldDefinition;currentVisitCredentials=[];inNewVisitMode;usingLastVisitData;visibleExpectedVisits=!0;replacedVisitorProfileId=null;isPreregister=null;disableRefreshButton=!1;visibleRefreshButton=!1;gdprEnabled;QRCodeEnabledAtPoint;QRCodeEnabledInModule;formInitDate;constructor(e,t,i,s,o,r,a){this.detector=e,this.dynamicFormService=t,this.visitorService=i,this.interactionService=s,this.authService=o,this.sessionService=r,this.modalService=a,this.gdprEnabled=this.sessionService.currentOrganization&&this.sessionService.currentOrganization.visitorModuleSettings&&this.sessionService.currentOrganization.visitorModuleSettings.gdprEnabled,this.QRCodeEnabledInModule=this.sessionService.currentOrganization&&this.sessionService.currentOrganization.visitorModuleSettings&&this.sessionService.currentOrganization.visitorModuleSettings.qrCodeEnabled,this.QRCodeEnabledAtPoint=this.QRCodeEnabledInModule&&this.visitorService.selectedRegistrationPoint?.isGDPRRequired}ngOnInit(){this.initializeForms(),this.setVisitorData(this.visitor)}ngAfterViewInit(){setTimeout(()=>{this.terminateButton&&this.terminateButton.nativeElement&&this.terminateButton.nativeElement.focus()},500)}get inEditMode(){return this.viewModeSelf||this.visitorProfileFormInfo&&this.visitorProfileFormInfo.formGroup.enabled||this.inNewVisitMode&&this.visitFormInfo&&this.visitFormInfo.formGroup.enabled}get isValid(){return!this.visitorProfileFormInfo.formGroup.invalid&&(!this.inNewVisitMode||!this.visitFormInfo.formGroup.invalid&&(!this.credentialFieldDefinition||!this.credentialFieldDefinition.required||this.currentVisitCredentials.length>0))}get hasLastVisit(){return this.visitor&&this.visitor.lastVisit!==void 0&&this.visitor.lastVisit!==null}get hasTerminatedLastVisit(){return this.hasLastVisit&&this.visitor.lastVisit.isTerminated}changeVisitorData(e){this.setVisitorData(e)}onEscKeyPress(e){}onCancelClicked(e){this.dismiss.emit()}resetFormInitDate(){this.formInitDate=new Date}getRequestProfileFields(){let e=[];return this.visitorProfileFormInfo.formFields.forEach(t=>{let i=this.visitorProfileFormInfo.formGroup.get(t.name)?this.visitorProfileFormInfo.formGroup.get(t.name).value:null;if(i!=null){let s=new E;s.name=t.name,s.value=i,e.push(s)}}),e}setRequestVisitFields(e){e.visitFields=[],this.visitFormInfo.formFields.forEach(t=>{let i=this.visitFormInfo.formGroup.get(t.name)?this.visitFormInfo.formGroup.get(t.name).value:null;if(i!=null)if(t.name===c.VISIT.AccessControlPoints)i.length>0&&i[0]instanceof K?e.accessControlPointIds=i.map(s=>s.value):e.accessControlPointIds=i;else{let s=new E;s.name=t.name,s.value=i,e.visitFields.push(s)}}),e.credentials=this.currentVisitCredentials.map(t=>{let i=new be;return i.copyFrom(this.sessionService,t),i})}onSaveClicked(e,t=!1){if(this.viewModeSelf){let i=new Te;i.visitorProfileId=this.visitor?this.visitor.profile.id:void 0,this.inNewVisitMode||(i.visitId=this.visitId),this.visitorProfileFormInfo.formGroup.enabled&&(i.visitorProfileFields=this.getRequestProfileFields()),this.setRequestVisitFields(i),i.force=!1,this.requestAddPreRegistration(i,t)}else if(this.inNewVisitMode){let i=new Q;if(this.visitId&&(i.visitId=this.visitId),i.visitorProfileId=this.visitor?this.visitor.profile.id:void 0,this.visitorProfileFormInfo.formGroup.enabled&&(i.visitorProfileFields=this.getRequestProfileFields()),this.visitFormInfo.formGroup.enabled&&this.setRequestVisitFields(i),this.replacedVisitorProfileId&&(i.replacedVisitorProfileId=this.replacedVisitorProfileId),this.visitorService.selectedRegistrationPoint)i.visitorRegistrationPointId=this.visitorService.selectedRegistrationPoint.id;else{this.interactionService.showMessage("VISITOR.REGISTRATION_POINT_DIRECTION",null,l.Error);return}i.processTime=x.local().diff(x.fromJSDate(this.formInitDate),["seconds"]).toObject().seconds,this.gdprEnabled&&this.completed.emit(t),i.force=!1,this.requestAddVisit(i,t)}else if(this.visitorProfileFormInfo.formGroup.enabled){let i=new ie;i.id=this.visitor.profile.id,i.fields=[],this.visitorProfileFormInfo.formFields.forEach(s=>{i.fields=this.getRequestProfileFields()}),this.visitorService.upsertVisitorProfile(i).subscribe(s=>{this.completed.emit(t)})}}requestAddVisit(e,t){this.visitorService.addVisit(e,this.getRequestProfileFields(),!this.gdprEnabled).subscribe({next:i=>{this.gdprEnabled||this.completed.emit(t)},error:i=>{i&&i.status&&i.status===T.VisitorNewVisitHookError&&this.interactionService.showDialog("VISITOR.ADD_NEW_VISIT",i.error.message,null,null,!0,"BUTTON.SAVE","BUTTON.CANCEL",!1,()=>{e.force=!0,this.requestAddVisit(e,t)}),i&&i.status&&i.status===T.VisitorNewVisitFieldError&&this.interactionService.showDialog("VISITOR.ADD_NEW_VISIT",i.error.message,null,null,!1,"BUTTON.OK",null,!1,()=>{})}})}requestAddPreRegistration(e,t){this.visitorService.upsertPreRegisterVisit(e,this.authService.checkPermission(k.VISITOR.getWrite())).subscribe({next:i=>{if(this.inNewVisitMode)this.completed.emit(t);else if(this.visitorProfileFormInfo.formGroup.enabled){let s=new ie;s.id=this.visitor.profile.id,s.fields=[],this.visitorProfileFormInfo.formFields.forEach(o=>{s.fields=this.getRequestProfileFields()}),this.visitorService.upsertVisitorProfile(s).subscribe(o=>{this.completed.emit(t)})}else this.completed.emit(t)},error:i=>{i&&i.status&&i.status===T.VisitorPreregisterHookError&&this.interactionService.showDialog("VISITOR.ADD_PREREGISTER",i.error.message,null,null,!0,"BUTTON.SAVE","BUTTON.CANCEL",!1,()=>{e.force=!0,this.requestAddPreRegistration(e,t)}),i&&i.status&&i.status===T.VisitorPreregisterFieldError&&this.interactionService.showDialog("VISITOR.ADD_PREREGISTER",i.error.message,null,null,!1,"BUTTON.OK",null,!1,()=>{})}})}onTerminateClicked(e){this.hasLastVisit&&(this.sessionService.currentOrganization.visitorModuleSettings&&this.sessionService.currentOrganization.visitorModuleSettings.skipTerminateConfirmation?this.terminateVisit(this.visitor.lastVisit.id):this.interactionService.showDialog("","VISITOR.APPROVE_FOR_TERMINATE",null,null,!0,"BUTTON.TERMINATE","BUTTON.CANCEL",!0,()=>{this.terminateVisit(this.visitor.lastVisit.id)}))}terminateVisit(e){this.visitorService.terminateVisit(this.visitor.lastVisit.id).subscribe(t=>{this.completed.emit(!1)})}onAddNewVisitClicked(e){this.visibleExpectedVisits=!1,this.currentVisitCredentials=[],this.hasTerminatedLastVisit&&this.visitFormInfo?this.sessionService.currentOrganization.visitorModuleSettings&&this.sessionService.currentOrganization.visitorModuleSettings.skipAskToUseLastVisitData?this.showNewVisitForm(!0):this.interactionService.showDialog("","VISITOR.APPROVE_COPY_LAST_VISIT",null,null,!0,"BUTTON.YES","BUTTON.NO",!1,()=>{this.showNewVisitForm(!0)},()=>{this.showNewVisitForm()}):this.inNewVisitMode=!0}showNewVisitForm(e=!1){this.inNewVisitMode=!0,e&&(this.usingLastVisitData=!0),w(this.visitFormInfo,this.visitor.lastVisit.fields,!0)}loadPreRegisterVisit(e){this.visibleExpectedVisits=!1,this.visitorService.getVisitDetails(e).subscribe(t=>{this.visitId=e,this.inNewVisitMode=!0,this.usingLastVisitData=!0,Object.keys(t.lastVisit.fields).findIndex(i=>i==c.VISIT.CameraSnapshot)>-1&&(t.lastVisit.fields[c.VISIT.CameraSnapshot]=void 0),w(this.visitFormInfo,t.lastVisit.fields)})}onPreregisterSelectClicked(e){this.loadPreRegisterVisit(e.id)}onVisitorSuggestionSelected(e){e&&(e.id?this.getVisitorDetail(e.id):e.autoFillFields&&e.autoFillFields.length>0&&w(this.visitorProfileFormInfo,e.autoFillFields.reduce((t,i)=>(t[i.name]=i.value,t),{})))}onVisitorSuggestionLoaded(){this.resetFormInitDate()}onVisitorReadQRCodeClicked(e){this.modalService.open(y,{settings:{size:"md"},props:{action:V.AddVisit,registrationPointId:this.visitorService.selectedRegistrationPoint.id}}).result.then(t=>{this.visitorService.getVisitDetails(t).subscribe(i=>{this.visitId=t,this.setVisitorData(i,!1)})}).catch(t=>{})}getVisitorDetail(e){this.visitor&&this.visitor.profile.id&&this.isPreregister&&(this.replacedVisitorProfileId=this.visitor.profile.id);let t=null;this.isPreregister&&(t=this.visitor.lastVisit),this.visitorService.getVisitorDetails(e).subscribe(i=>{t&&(i.lastVisit=t),this.setVisitorData(i,!0)})}onCredentialDataEntered(e){if(e==null||e.length===0)return;this.credentialDataInput.resetText();let t=this.currentVisitCredentials.find(i=>i.data===e);if(t)this.interactionService.showDialog("IDENTITY.TITLE_CREDENTIALS","CREDENTIAL.INFO_REMOVE",null,null,!0,"BUTTON.REMOVE","",!0,()=>{this.onCredentialRemoved(t.id)});else{let i=new ge;i.data=e,this.modalService.open(Ee,{settings:{size:"md",centered:!0,scrollable:!0},props:{credential:i,types:this.sessionService.currentOrganization.visitorModuleSettings.availableCredentials}}).result.then(s=>{s&&this.currentVisitCredentials.push(s)}).catch(s=>{})}}onCredentialRemoved(e){de(this.currentVisitCredentials,"id",e)}initializeForms(){let e=this.visitorService.getCustomKeys();this.viewModeSelf?(this.visitFormInfo=this.dynamicFormService.getFormInfo(h.VisitSelfPreRegister,!1,e),this.visitorProfileFormInfo=this.dynamicFormService.getFormInfo(h.VisitorProfileSelfPreRegister,!1,e)):(this.visitFormInfo=this.dynamicFormService.getFormInfo(h.Visit,!1,e),this.visitorProfileFormInfo=this.dynamicFormService.getFormInfo(h.VisitorProfile,!1,e),(this.visitFormInfo.formFields&&this.visitFormInfo.formFields.findIndex(t=>t.triggers&&t.triggers.length>0)>-1||this.visitorProfileFormInfo.formFields&&this.visitorProfileFormInfo.formFields.findIndex(t=>t.triggers&&t.triggers.length>0)>-1)&&(this.visibleRefreshButton=!0)),this.viewModeSelf||(this.credentialFieldDefinition=this.dynamicFormService.getFieldDefinition(h.Visit,"credentials"))}setVisitorData(e,t=!1){this.resetFormInitDate(),this.isPreregister||(this.isPreregister=e&&e.lastVisit&&!e.lastVisit.startUtc,this.visitFormInfo.formFields.find(i=>i.name===c.VISIT.AccessControlPoints)&&(this.visitFormInfo.formFields.find(i=>i.name===c.VISIT.AccessControlPoints).options.UI_forceToLoadDefaultValue=!1,this.visitFormInfo.formFields.find(i=>i.name===c.VISIT.AccessControlPoints).options.UI_showLoadDefaultValueButton=!0)),this.visitor=e,this.currentVisitCredentials=[],this.viewModeSelf?this.inNewVisitMode=this.visitId===null||this.visitId===void 0:this.inNewVisitMode=e==null||!this.visitor.lastVisit||!this.visitor.lastVisit.startUtc,this.usingLastVisitData=!1,this.visitor&&(this.visitor.profile&&w(this.visitorProfileFormInfo,this.visitor.profile.fields),this.viewModeSelf?this.visitId!=null&&this.visitor.lastVisit&&!t&&w(this.visitFormInfo,this.visitor.lastVisit.fields):this.visitor.lastVisit&&(!this.visitor.lastVisit.isTerminated||this.visitor.lastVisit.startUtc!=null)&&(t||w(this.visitFormInfo,this.visitor.lastVisit.fields),this.visitor.lastVisit.startUtc==null&&(this.usingLastVisitData=!0),this.viewModeSelf||(this.currentVisitCredentials=this.visitor.lastVisit.fields[c.VISIT.Credentials]||[]))),this.detector.detectChanges(),this.visibleExpectedVisits&&e&&e.expectedVisits&&e.expectedVisits.length==1&&!this.replacedVisitorProfileId&&this.onPreregisterSelectClicked(e.expectedVisits[0])}onRefreshFormClicked(e){this.disableRefreshButton==!1&&(this.resetFormInitDate(),this.dynamicForms.forEach(t=>{t.triggerRefresh()}),this.disableRefreshButton=!0,setTimeout(()=>{this.disableRefreshButton=!1},2e3))}onSendInvitationAgainClicked(e){this.visitorService.resendVisitInvitation(this.visitor.lastVisit.id).subscribe(t=>{this.interactionService.showMessage("VISITOR.INVITATION_SENT",null,l.Success)})}static ctorParameters=()=>[{type:re},{type:$},{type:v},{type:R},{type:W},{type:F},{type:j}];static propDecorators={visitor:[{type:f}],visitId:[{type:f}],viewModeSelf:[{type:f}],dismiss:[{type:D}],completed:[{type:D}],credentialDataInput:[{type:b,args:["credentialDataInput"]}],terminateButton:[{type:b,args:["terminateButton"]}],dynamicForms:[{type:M,args:["dynamicForm"]}]}};J=dt([d({selector:"armon-visitor-form",host:{"(document:keyup.escape)":"onEscKeyPress($event)"},template:je,standalone:!0,imports:[m,S,H,G,q,I,Y,ke,ae,p],styles:[Ge]})],J);var qe=`<ng-container>
  <input #templateFileInput type="file" style="display:none" (change)="onChangedTemplateFile($event)" accept=".xlsx" />
  <ng-container *ngIf="visible">
    <div class="modal-header">
      <span class="text-lg">{{(preRegistration?'VISITOR.ADD_PREREGISTER_BULK':'VISITOR.ADD_NEW_VISIT_BULK') |
        translate}}</span>
    </div>
    <div class="modal-body px-4">
      <div class="row">
        <div class="col-12">
          <div class="alert alert-info" role="alert" *ngIf="!registrationPoint">
            {{'VISITOR.BULK_ACTION_INFO' | translate}}
          </div>
        </div>
      </div>
      <div class="row mt-4">
        <div class="col-12 d-flex flex-column mb-3">
          <div class="d-flex justify-content-between w-100 border border-1 rounded-2 border-light-subtle py-3 px-3">
            <button class="btn btn-sm btn-primary" (click)="onDownloadClicked($event)">
              {{'VISITOR.BULK_DOWNLOAD_TEMPLATE' | translate}}
            </button>
            <cds-icon shape="download" class="me-2 color-secondary" size="lg" solid></cds-icon>
          </div>
        </div>
        <div class="col-12 d-flex flex-column">
          <div class="d-flex justify-content-center w-100 border border-1 rounded-2 border-light-subtle py-3 px-3">
            <div class="row w-100">
              <div class="col-12 mb-3">
                <form [formGroup]="form">
                  <div class="row">
                    <div class="col-12">
                      <div class="form-group">
                        <label class="report-form-label" for="nameInput">{{'VISITOR.BULK_EVENT_NAME' |
                          translate}}</label>
                        <input type="text" id="nameInput" [formControl]="form.get('eventName')"
                          [ngClass]="{'is-invalid': form.get('eventName').invalid}"
                          class="form-control form-control-sm">
                        <ng-template
                          *ngTemplateOutlet="controlValidationTemplate; context: {$implicit: cameraForm, control:form.get('eventName')}">
                        </ng-template>
                      </div>
                    </div>
                    <div class="col-12 col-md-6" *ngIf="this.preRegistration == false || this.autoRegistration == true">
                      <div class="form-check">
                        <input type="checkbox" id="autoTerminationCheckbox" name="autoTerminationCheckbox"
                          class="form-check-input" [formControl]="form.get('autoTermination')">
                        <label class="form-check-label" for="autoTerminationCheckbox">{{'VISITOR.BULK_AUTO_TERMINATION'
                          | translate}}</label>
                      </div>
                    </div>
                  </div>
                </form>
              </div>
              <div class="col-12">
                <dynamic-form *ngIf="visitFormInfo" [showEditButton]="false" [header]="'VISITOR.VISIT_DETAILS'"
                  [formGroup]="visitFormInfo.formGroup" [formFields]="visitFormInfo.formFields"
                  [fieldEndpoint]="visitFormInfo.endpointField" [formEndpoint]="visitFormInfo.endpointForm" #dynamicForm
                  [isEmptyForm]="inNewVisitMode && !usingLastVisitData"
                  [isEnabledForm]="viewModeSelf || (!viewModeSelf && inNewVisitMode)"></dynamic-form>
              </div>
              <div class="col-12 d-flex justify-content-between border-top border-light-subtle pt-3">
                <button class="btn btn-sm btn-primary" (click)="onUploadClicked($event)"
                  [disabled]="visitFormInfo.formGroup.invalid || form.invalid">
                  {{'VISITOR.BULK_UPLOAD_TEMPLATE' | translate}}
                </button>
                <cds-icon shape="upload" class="me-2 color-secondary" size="lg" solid></cds-icon>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="modal-footer">
      <button class="btn btn-outline-primary" (click)="onCancelClicked($event)">
        {{'BUTTON.CLOSE' | translate}}
      </button>
    </div>
  </ng-container>
</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>
    </div>
  </ng-container>
</ng-template>`;var Ke=`.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}.action-title,.action-title-terminate{font-size:.65rem;line-height:.75rem;color:#0a2a5a;font-weight:500}.action-title-terminate{color:#c82602}
`;var Z=class n extends me{preRegistration;autoRegistration;visitFields;static getEmptyModel(){return new n}};var se=He(Ye());var ft=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},_=class extends C{interactionService;visitorService;dynamicFormService;translate;formBuilder;preRegistration=!1;autoRegistration=!1;visitorRegistrationPointId;visible=!1;form;visitFormInfo;nowDate=new Date;templateFileInput;constructor(e,t,i,s,o){super(),this.interactionService=e,this.visitorService=t,this.dynamicFormService=i,this.translate=s,this.formBuilder=o}onModalInitialized(){super.onModalInitialized(),this.initializeForms(),this.visible=!0}initializeForms(){this.form=this.formBuilder.group(oe({eventName:["",te.required]},this.preRegistration==!1||this.autoRegistration==!0?{autoTermination:[!1,te.required]}:{}));let e=this.visitorService.getCustomKeys();this.preRegistration&&!this.autoRegistration?this.visitFormInfo=this.dynamicFormService.getFormInfo(h.VisitSelfPreRegister,!1,e):this.visitFormInfo=this.dynamicFormService.getFormInfo(h.Visit,!1,e),this.preRegistration==!1&&this.visitFormInfo.formFields.forEach(t=>{t.name==c.VISIT.ExpectedDate&&t.options&&(t.options.isStartVisible=!1)})}onDownloadClicked(e){this.visitorService.downloadBulkRegistrationTemplate(this.preRegistration,this.autoRegistration).subscribe(t=>{this.translate.get(["VISITOR.ADD_PREREGISTER_BULK","VISITOR.ADD_NEW_VISIT_BULK"]).subscribe(i=>{se.default.saveAs(t,i[this.preRegistration?"VISITOR.ADD_PREREGISTER_BULK":"VISITOR.ADD_NEW_VISIT_BULK"]+" "+x.local().toLocaleString(x.DATETIME_MED)+".xlsx"),this.interactionService.showMessage("VISITOR.BULK_ACTION_DOWNLOAD_COMPLETED",null,l.Success)})})}onUploadClicked(e){this.templateFileInput.nativeElement.click()}setRequestVisitFields(e){e.visitFields=[],this.visitFormInfo.formFields.forEach(t=>{let i=this.visitFormInfo.formGroup.get(t.name)?this.visitFormInfo.formGroup.get(t.name).value:null;if(i!=null)if(t.name===c.VISIT.AccessControlPoints)i.length>0&&i[0]instanceof K?e.accessControlPointIds=i.map(s=>s.value):e.accessControlPointIds=i;else{let s=new E;s.name=t.name,s.value=i,e.visitFields.push(s)}})}onChangedTemplateFile(e){if(e.target.files&&e.target.files.length>0){let t=e.target.files[0],i=new FormData;i.append("file",t);let s=new Q;this.setRequestVisitFields(s);let o=new Z;o.preRegistration=this.preRegistration,o.autoRegistration=this.autoRegistration;let r={visitorRegistrationPointId:this.visitorRegistrationPointId,accessControlPointIds:s.accessControlPointIds,visitFormFields:s.visitFields};Object.assign(r,this.form.value),o.visitFields=JSON.stringify(r),this.visitorService.uploadBulkRegistrationTemplate(i,o).subscribe(a=>{a.type=="application/json"?(this.interactionService.showMessage("VISITOR.BULK_ACTION_UPLOAD_COMPLETED",null,l.Success),this.closeModal()):this.interactionService.showDialog("VISITOR.BULK_UPLOAD_TEMPLATE","VISITOR.BULK_ACTION_UPLOAD_RECORD_ERROR",null,null,!1,"BUTTON.OK","",!1,()=>{this.translate.get(["VISITOR.ADD_PREREGISTER_BULK","VISITOR.ADD_NEW_VISIT_BULK","FEEDBACK.TYPE_MINOR_ERROR"]).subscribe(u=>{se.default.saveAs(a,u[this.preRegistration?"VISITOR.ADD_PREREGISTER_BULK":"VISITOR.ADD_NEW_VISIT_BULK"]+" "+u["FEEDBACK.TYPE_MINOR_ERROR"]+" "+x.local().toLocaleString(x.DATETIME_MED)+".xlsx"),this.interactionService.showMessage("VISITOR.BULK_ACTION_DOWNLOAD_ERROR_COMPLETED",null,l.Success),setTimeout(()=>{e.target.value=null},1e3)})})})}}static ctorParameters=()=>[{type:R},{type:v},{type:$},{type:pe},{type:fe}];static propDecorators={preRegistration:[{type:f}],autoRegistration:[{type:f}],visitorRegistrationPointId:[{type:f}],templateFileInput:[{type:b,args:["templateFileInput",{static:!0}]}]}};_=ft([d({selector:"armon-visitor-bulk-registration-modal",template:qe,standalone:!0,imports:[ve,m,G,q,I,U,H,p],styles:[Ke]})],_);var $e=`<div class="mt-4">
    <span class="text-sm text-bold mb-2">{{'VISITOR.APPROVE_LIST_TITLE'|translate}}</span>
    <div class="approves-container" *ngIf="approveList && approveList.length>0">
        <ng-container *ngFor="let approve of approveList">
            <ng-template *ngTemplateOutlet="approveUI; context: {$implicit: approve}">
            </ng-template>
        </ng-container>
    </div>
    <div class="text-sm text-center color-gray-dark" *ngIf="!approveList || approveList.length==0">
        {{'VISITOR.APPROVE_LIST_NO_RECORD'|translate}}</div>
</div>

<!-- UI TEMPLATE -->
<ng-template #approveUI let-approve>
    <div class="approve-item" [attr.state]="approve.state">
        <div class="icon-container">
            <ng-container [ngSwitch]="approve.state">
                <span class="spinner-border spinner-border-sm" *ngSwitchCase="1"></span>
                <cds-icon shape="exclamation-triangle" solid *ngSwitchCase="2" size="md"></cds-icon>
                <cds-icon shape="check-circle" solid *ngSwitchCase="3" size="md"></cds-icon>
                <cds-icon shape="exclamation-circle" solid *ngSwitchCase="4" size="md"></cds-icon>
                <cds-icon shape="hourglass" solid *ngSwitchCase="5" size="md"></cds-icon>
            </ng-container>
        </div>
        <div class="info-container">
            <span class="fullname-text">{{approve.fullname}}</span>
            <span class="state-text">{{approve.stateText|translate}}</span>
        </div>
    </div>
</ng-template>`;var Qe=`.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}.approves-container{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-align:stretch;-ms-flex-align:stretch;-webkit-align-items:stretch;-moz-align-items:stretch;align-items:stretch}.approves-container .approve-item{margin-bottom:6px;padding:6px;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem;border-left:2px solid #FFF;background-color:#f5f5f5;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-align:stretch;-ms-flex-align:stretch;-webkit-align-items:stretch;-moz-align-items:stretch;align-items:stretch}.approves-container .approve-item[state="1"]{color:#0369a1;border-color:#0369a1}.approves-container .approve-item[state="2"]{color:#c82602;border-color:#c82602}.approves-container .approve-item[state="3"]{color:#62a325;border-color:#62a325}.approves-container .approve-item[state="4"],.approves-container .approve-item[state="5"]{color:#eb8d00;border-color:#eb8d00}.approves-container .approve-item .icon-container{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items: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;width:26px;margin-right:6px}.approves-container .approve-item .info-container{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}.approves-container .approve-item .info-container .fullname-text{font-size:.672rem;line-height:.6rem}.approves-container .approve-item .info-container .state-text{font-size:.588rem;line-height:.55rem;font-weight:500}
`;var ht=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ee=class{visitorService;approveList=[];newVisitApproveStatusSubscription;deleteVisitApproveStatusSubscription;constructor(e){this.visitorService=e}ngOnInit(){this.newVisitApproveStatusSubscription=this.visitorService.onNewVisitApproveStatusAdded().subscribe(e=>{this.approveList=this.visitorService.getNewVisitApproveStatusList()}),this.deleteVisitApproveStatusSubscription=this.visitorService.onNewVisitApproveStatusDeleted().subscribe(e=>{this.approveList=this.visitorService.getNewVisitApproveStatusList()}),this.approveList=this.approveList=this.visitorService.getNewVisitApproveStatusList()}ngOnDestroy(){this.newVisitApproveStatusSubscription&&this.newVisitApproveStatusSubscription.unsubscribe(),this.deleteVisitApproveStatusSubscription&&this.deleteVisitApproveStatusSubscription.unsubscribe()}createDummyData(){let e=g.getEmptyModel(null);e.state=A.Waiting,e.stateText=g.getStateText(e.state);let t=g.getEmptyModel(null);t.state=A.Approved,t.stateText=g.getStateText(t.state);let i=g.getEmptyModel(null);i.state=A.Rejected,i.stateText=g.getStateText(i.state);let s=g.getEmptyModel(null);s.state=A.Failed,s.stateText=g.getStateText(s.state),this.approveList.push(e,t,i,s)}addNewStatus(e){e.onStateChanged().subscribe(t=>{}),this.approveList.unshift(e)}static ctorParameters=()=>[{type:v}]};ee=ht([d({selector:"armon-visitor-approve-list",template:$e,standalone:!0,imports:[m,S,U,z,L,p],styles:[Qe]})],ee);var gt=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},We=class extends Ve{sanitizer;visitorService;authService;interactionService;systemService;modalService;sessionService;uniqueFieldInputs;credentialDataInput;visitorForm;viewModeSelf=!0;permissionDeletePreRegistrations=!1;managerPreRegisterAvailable=!1;showVisitorForm;currentVisitor;currentVisitId=null;visitorResponse;visitors;visitorFilter;lastState;columnFilters=[];updatingList=!1;subscriptionVisitorListChanged;subscriptionConnectionStateChanged;uniqueFormFields=[];visibleCredentialDataInput=!1;columnFields;detailFields;registrationPoint;filterTake=null;gdprEnabled;QRCodeEnabled;printableVisitorCard;constructor(e,t,i,s,o,r,a){super(),this.sanitizer=e,this.visitorService=t,this.authService=i,this.interactionService=s,this.systemService=o,this.modalService=r,this.sessionService=a,this.sessionService.currentOrganization&&this.sessionService.currentOrganization.visitorModuleSettings&&this.sessionService.currentOrganization.visitorModuleSettings.visitFormFields&&(this.uniqueFormFields=this.sessionService.currentOrganization.visitorModuleSettings.visitFormFields.filter(u=>u.unique),this.visibleCredentialDataInput=this.sessionService.currentOrganization.visitorModuleSettings.visitFormFields.filter(u=>u.name==c.VISIT.Credentials).length>0)}setViewFlags(){this.gdprEnabled=this.sessionService.currentOrganization&&this.sessionService.currentOrganization.visitorModuleSettings&&this.sessionService.currentOrganization.visitorModuleSettings.gdprEnabled&&this.visitorService.selectedRegistrationPoint?.isGDPRRequired,this.QRCodeEnabled=this.sessionService.currentOrganization&&this.sessionService.currentOrganization.visitorModuleSettings&&this.sessionService.currentOrganization.visitorModuleSettings.qrCodeEnabled&&this.visitorService.selectedRegistrationPoint?.isGDPRRequired,this.printableVisitorCard=this.sessionService.currentOrganization&&this.sessionService.currentOrganization.visitorModuleSettings&&this.sessionService.currentOrganization.visitorModuleSettings.printableVisitorCard}ngOnInit(){this.setViewFlags(),this.viewModeSelf=!this.authService.checkPermission(k.VISITOR.getWrite()),this.permissionDeletePreRegistrations=this.authService.checkPermission(k.VISITOR.getDeletePreRegistrations()),this.viewModeSelf==!1&&this.sessionService.currentOrganization.visitorModuleSettings&&this.sessionService.currentOrganization.visitorModuleSettings.preRegistrationAvailable&&this.authService.checkPermission(k.VISITOR.getPreregister())&&(this.managerPreRegisterAvailable=!0),this.initializeSubscriptions(),this.viewModeSelf==!1?this.checkRegistrationPoint():this.fetchVisitors()}ngOnDestroy(){this.subscriptionVisitorListChanged.unsubscribe(),this.subscriptionConnectionStateChanged.unsubscribe()}checkRegistrationPoint(e=!0){this.registrationPoint=this.visitorService.selectedRegistrationPoint,this.registrationPoint?(this.setViewFlags(),this.onVisitorFormDismiss(),this.fetchVisitors()):e&&this.openRegistrationPointSelection()}onAddVisitorButtonClicked(){this.setVisitorForm(!0)}onAddBulkVisitorButtonClicked(){this.modalService.open(_,{settings:{size:"xl"},props:{preRegistration:!1,autoRegistration:!1,visitorRegistrationPointId:this.visitorService.selectedRegistrationPoint.id}}).result.then(e=>{}).catch(e=>{})}onAddPreRegisterButtonClicked(){this.managerPreRegisterAvailable&&(this.viewModeSelf=!0),this.setVisitorForm(!0)}onAddBulkPreRegisterButtonClicked(){this.interactionService.showDialog("VISITOR.ADD_PREREGISTER_BULK","VISITOR.BULK_AUTO_REGISTRATION_QUESTION",null,null,!0,"VISITOR.BULK_AUTO_REGISTRATION_REJECT","VISITOR.BULK_AUTO_REGISTRATION_CONFIRM",!1,()=>{this.modalService.open(_,{settings:{size:"xl"},props:{preRegistration:!0,autoRegistration:!1,visitorRegistrationPointId:this.visitorService.selectedRegistrationPoint.id}}).result.then(e=>{}).catch(e=>{})},()=>{this.modalService.open(_,{settings:{size:"xl"},props:{preRegistration:!0,autoRegistration:!0,visitorRegistrationPointId:this.visitorService.selectedRegistrationPoint.id}}).result.then(e=>{}).catch(e=>{})})}onVisitorSelected(e){this.managerPreRegisterAvailable&&(this.viewModeSelf=!1),this.getVisitorDetails(e.id)}onShowMoreClicked(e){this.fetchVisitors(!0)}onShowDetailsClicked(e,t,i,s){this.currentVisitId=i,this.viewModeSelf?this.getVisitDetails(i):s==Ie.Active?this.getVisitorDetails(t):this.getVisitDetails(i,!0)}onTerminateVisitClicked(e,t){this.sessionService.currentOrganization.visitorModuleSettings&&this.sessionService.currentOrganization.visitorModuleSettings.skipTerminateConfirmation?this.terminateVisit(t):this.interactionService.showDialog("","VISITOR.APPROVE_FOR_TERMINATE",null,null,!0,"BUTTON.TERMINATE","BUTTON.CANCEL",!0,()=>{this.terminateVisit(t)})}terminateVisit(e){this.visitorService.terminateVisit(e).subscribe(t=>{})}onDeletePreregisterVisitClicked(e,t){this.interactionService.showDialog("","VISITOR.APPROVE_FOR_DELETE_PREREGISTER",null,null,!0,"BUTTON.DELETE","BUTTON.CANCEL",!0,()=>{this.visitorService.deletePreregisterVisit(t,this.permissionDeletePreRegistrations).subscribe(i=>{this.fetchVisitors()})})}onCredentialDataEntered(e){this.managerPreRegisterAvailable&&(this.viewModeSelf=!1),!(e==null||e.length===0)&&(this.credentialDataInput.resetText(),this.visitorService.findVisitorByCredential(this.sessionService.getConvertedCredentialData(e)).subscribe({next:t=>{switch(t.existance){case N.NotExists:this.interactionService.showMessage("VISITOR.VISITOR_CREDENTIAL_NOT_FOUND",null,l.Warning);break;case N.Visitor:this.setVisitorForm(!0,t.visitor);break;case N.Member:t.memberInfo?this.interactionService.showMessage("IDENTITY.CREDENTIAL_IN_USE_EDITABLE_NAME",null,l.Warning,{fullname:t.memberInfo}):this.interactionService.showMessage("IDENTITY.CREDENTIAL_IN_USE_EDITABLE",null,l.Warning);break;case N.NotPermitted:this.interactionService.showMessage("IDENTITY.CREDENTIAL_IN_USE_NOT_EDITABLE",null,l.Warning);break;default:this.interactionService.showMessage("VISITOR.VISITOR_CREDENTIAL_NOT_FOUND",null,l.Warning);break}},error:t=>{t&&t.status&&t.status===T.NotFound&&this.interactionService.showMessage("VISITOR.VISITOR_CREDENTIAL_NOT_FOUND",null,l.Warning)}}))}onUniqueFieldEntered(e,t){if(this.managerPreRegisterAvailable&&(this.viewModeSelf=!1),e==null||e.length===0)return;this.uniqueFieldInputs.forEach(s=>{s.resetText()});let i;switch(t.type){case B.Number:i=+e;break;default:i=e;break}this.visitorService.searchVisitorByUniqueField(t.name,i,this.registrationPoint?this.registrationPoint.id:null).subscribe(s=>{s?this.setVisitorForm(!0,s):this.interactionService.showMessage("VISITOR.NO_VISITOR_WITH_FILTER",null,l.Warning)},s=>{s&&s.status&&s.status===T.NotFound&&this.interactionService.showMessage("VISITOR.NO_VISITOR_WITH_FILTER",null,l.Warning)})}onVisitorFormDismiss(){this.managerPreRegisterAvailable&&(this.viewModeSelf=!1),this.setVisitorForm(!1)}onVisitorFormCompleted(e){this.managerPreRegisterAvailable&&(this.viewModeSelf=!1),this.setVisitorForm(!1),e&&setTimeout(()=>{this.onAddVisitorButtonClicked()},500)}firstListRefreshed=!0;onListRefreshed(e,t){this.firstListRefreshed==!1?(this.columnFilters=this.updateColumnFilters(this.columnFilters,e,t.name),this.createDelay(this.fetchVisitors)):this.firstListRefreshed=!1}updateColumnFilters(e,t,i){let s=e.findIndex(o=>o.name==i);if(s!=-1)t&&t!=""?e[s].value=t:e.splice(s,1);else{let o=new E;o.value=t,o.name=i,e.push(o)}return e}onStateChanged(e){this.managerPreRegisterAvailable&&(this.viewModeSelf=!1),this.setVisitorForm(!1),this.visitorFilter.filter.state=e,setTimeout(()=>{this.fetchVisitors()},700)}initializeSubscriptions(){this.subscriptionVisitorListChanged=this.visitorService.onVisitorListChanged.subscribe(()=>{setTimeout(()=>{this.fetchVisitors()},700)}),this.subscriptionConnectionStateChanged=this.systemService.onConnectionStatusChanged.subscribe(e=>{e&&setTimeout(()=>{this.fetchVisitors()},700)})}validateFormField(e,t){if((e.type===B.Text||e.type===B.Textarea)&&e.options){if(t.length<e.options.minLength)return this.interactionService.showMessage("VALIDATION.MIN_LENGTH",null,l.Warning,{min:e.options.minLength}),!1;if(t.length>e.options.maxLength)return this.interactionService.showMessage("VALIDATION.MAX_LENGTH",null,l.Warning,{max:e.options.maxLength}),!1}return!0}fetchVisitors(e=!1){this.visitorFilter||this.createFilter();let t=!0;if(this.visitorFilter.filter.profileFields=[],this.visitorFilter.filter.visitFields=[],this.viewModeSelf==!1)if(this.visitorService.selectedRegistrationPoint)this.visitorFilter.filter.visitorRegistrationPointId=this.visitorService.selectedRegistrationPoint.id;else{this.interactionService.showMessage("VISITOR.REGISTRATION_POINT_DIRECTION",null,l.Error);return}if(this.columnFilters&&this.columnFilters.length>0){let i=this.sessionService.currentOrganization.visitorModuleSettings.visitFormFields.filter(o=>o.reportable),s=this.sessionService.currentOrganization.visitorModuleSettings.visitorProfileFormFields.filter(o=>o.reportable);this.columnFilters.forEach(o=>{let r=i.find(u=>u.name===o.name),a=s.find(u=>u.name===o.name);r?this.visitorFilter.filter.visitFields.push(o):a&&this.visitorFilter.filter.profileFields.push(o)})}e?(this.visitorFilter.skip+=this.visitorResponse.items.length,this.filterTake=this.visitorFilter.skip+this.visitorFilter.take):(this.visitorFilter.skip=0,this.filterTake?this.filterTake>200?this.visitorFilter.take=200:this.visitorFilter.take=this.filterTake:this.visitorFilter.take=50),t&&(this.updatingList=!0,this.visitorService.listUnterminatedVisits(this.visitorFilter,this.viewModeSelf,!1).subscribe(i=>{(!this.visitors||!e)&&(this.visitors=[]),i.items.forEach(r=>{r.thumbnail&&(r.thumbnail=this.sanitizer.bypassSecurityTrustResourceUrl(r.thumbnail))});let s=i.fields.filter(r=>!(r.listingInDetail&&r.listingInDetail==!0)),o=i.fields.filter(r=>!!(r.listingInDetail&&r.listingInDetail==!0));this.columnFields=s,this.detailFields=o,this.visitorResponse=i,this.visitors.push(...i.items||[]),this.updatingList=!1},i=>{this.updatingList=!1}))}createFilter(){this.visitorFilter=new xe;let e=new Se;this.visitorFilter.filter=e,this.visitorFilter.sortAscending=!1,this.visitorFilter.skip=0,this.visitorFilter.take=50}getVisitorDetails(e){this.visitorService.getVisitorDetails(e).subscribe(t=>{this.setVisitorForm(!0,t)})}getVisitDetails(e,t=!1){this.visitorService.getVisitDetails(e).subscribe(i=>{t&&Object.keys(i.lastVisit.fields).findIndex(s=>s==c.VISIT.CameraSnapshot)>-1&&(i.lastVisit.fields[c.VISIT.CameraSnapshot]=void 0),this.setVisitorForm(!0,i)})}setVisitorForm(e,t){e?(this.filterTake=null,this.showVisitorForm&&this.visitorForm?this.visitorForm.changeVisitorData(t):(this.currentVisitor=t,this.showVisitorForm=!0)):(this.showVisitorForm=!1,this.currentVisitor=null,this.currentVisitId=null)}openRegistrationPointSelection(){this.modalService.open(X,{settings:{size:"md",scrollable:!0}}).result.then(e=>{this.checkRegistrationPoint(!1)}).catch(e=>{this.checkRegistrationPoint(!1)})}onPrintBadgeClicked(e,t){this.visitorService.printVisitCard(t)}onImageClicked(e){this.interactionService.showFullScreenImage({src:e,width:"480px"})}onQRCodeTerminateClicked(e){this.modalService.open(y,{settings:{size:"md"},props:{action:V.Terminate,registrationPointId:this.visitorService.selectedRegistrationPoint.id}}).result.then(t=>{}).catch(t=>{})}static ctorParameters=()=>[{type:le},{type:v},{type:W},{type:R},{type:Re},{type:j},{type:F}];static propDecorators={uniqueFieldInputs:[{type:M,args:["uniqueFieldInput"]}],credentialDataInput:[{type:b,args:["credentialDataInput"]}],visitorForm:[{type:b,args:["visitorForm"]}]}};We=gt([d({selector:"armon-visitors",template:De,standalone:!0,imports:[m,Oe,Fe,O,I,ye,S,Y,ee,Ce,J,Pe,he,ue,_e,z,L,ne,p],styles:[Ae]})],We);export{We as VisitorsComponent};
