import{a as h}from"./chunk-5WJM4RWS.js";import{a as g}from"./chunk-CO3X7TQN.js";import{Tc as s}from"./chunk-NVJ2ZZFT.js";import{Aa as p,Qd as d,Qf as u,ab as x,bb as m,dd as b,ya as l}from"./chunk-SKPDQO4E.js";var k=`<div class="snapshot-detail-container" *ngIf="snapshots">\r
    <div class="button-container pt-3" *ngIf="snapshots.length>1">\r
        <div class="snapshot-button" [attr.active]="nIndex==index" *ngFor="let snapshot of snapshots;let nIndex=index;"\r
            click-stop-propagation (click)="index=nIndex;">\r
            <span>{{nIndex+1}}</span>\r
        </div>\r
    </div>\r
    <div class="snapshot-container">\r
        <ng-container *ngFor="let snapshot of snapshots;let nIndex=index;">\r
            <armon-camera-snapshot [snapshot]="snapshot" [hidden]="nIndex!=index"></armon-camera-snapshot>\r
        </ng-container>\r
    </div>\r
</div>`;var v=`.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}.snapshot-detail-container{margin:.35rem 0;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-line-pack:stretch;-webkit-align-content:stretch;-moz-align-content:stretch;align-content:stretch}.snapshot-detail-container .button-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}.snapshot-detail-container .button-container .snapshot-button{cursor:pointer;margin:0 0 3px;-webkit-border-top-left-radius:.375rem;-moz-border-radius-topleft:.375rem;border-top-left-radius:.375rem;-webkit-border-v-left-radius:.375rem;-moz-border-radius-bottomleft:.375rem;border-bottom-left-radius:.375rem;padding-left:3px;height:1.4rem;width:1.4rem;background-color:#1455b6;color:#fff;text-align:center;font-size:.756rem;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-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}.snapshot-detail-container .button-container .snapshot-button:hover{background-color:#0a2a5a}.snapshot-detail-container .button-container .snapshot-button[active=true]{cursor:default;background-color:#000}
`;var w=`<div class="snapshot-detail-item">
    <img *ngIf="snapshot.status==2 && visibleNoImage==false && data!=''" [src]="data" click-stop-propagation (click)="onImageClicked($event)">
    <div class="no-image" *ngIf="visibleNoImage" [attr.status]="snapshot.status">
        <!-- NOT RECEIVED -->
        <span class="spinner-border spinner-border-sm text-white" *ngIf="snapshot.status==1"></span>
        <span *ngIf="snapshot.status==1">{{'CAMERA.LOG_SNAPSHOT_NOT_RECEIVED'|translate}}</span>
        <!-- SUCCESS LOADING -->
        <span class="spinner-border spinner-border-sm text-white" *ngIf="snapshot.status==2"></span>
        <!-- FAILED -->
        <ng-container *ngIf="snapshot.status==3">
            <cds-icon shape="warning-standard" size="sm"></cds-icon>
            <span >{{'CAMERA.LOG_SNAPSHOT_FAILED'|translate}}</span>
        </ng-container>
        <!-- ARCHIEVED -->
        <ng-container *ngIf="snapshot.status==98">
            <cds-icon shape="archive" size="sm"></cds-icon>
            <span >{{'CAMERA.LOG_SNAPSHOT_ARCHIVED'|translate}}</span>
        </ng-container>
        <!-- UNAUTHORIZED -->
        <ng-container *ngIf="snapshot.status==99">
            <cds-icon shape="eye-hide" solid size="sm"></cds-icon>
            <span>{{'CAMERA.LOG_SNAPSHOT_UNAUTHORIZED'|translate}}</span>
        </ng-container>
    </div>
</div>`;var y=`.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 .snapshot-detail-item img{max-height:160px;max-width:100%;width:auto;border:1px solid black;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem;cursor:zoom-in}:host .snapshot-detail-item .base-no-image,:host .snapshot-detail-item .no-image[status="99"],:host .snapshot-detail-item .no-image[status="98"],:host .snapshot-detail-item .no-image[status="3"],:host .snapshot-detail-item .no-image[status="2"],:host .snapshot-detail-item .no-image[status="1"]{height:80px;width:195.2px;background-color:#000;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;padding:12px}:host .snapshot-detail-item .base-no-image span,:host .snapshot-detail-item .no-image[status="99"] span,:host .snapshot-detail-item .no-image[status="98"] span,:host .snapshot-detail-item .no-image[status="3"] span,:host .snapshot-detail-item .no-image[status="2"] span,:host .snapshot-detail-item .no-image[status="1"] span{margin-top:6px;text-align:center;font-size:.588rem;line-height:.55rem}:host .snapshot-detail-item .no-image[status="1"]{color:#42bafb}:host .snapshot-detail-item .no-image[status="3"]{color:#fd8166}:host .snapshot-detail-item .no-image[status="98"]{color:#afe27f}:host .snapshot-detail-item .no-image[status="99"]{color:#fd8166}
`;var R=function(i,t,n,a){var o=arguments.length,e=o<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,n):a,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(i,t,n,a);else for(var c=i.length-1;c>=0;c--)(r=i[c])&&(e=(o<3?r(e):o>3?r(t,n,e):r(t,n))||e);return o>3&&e&&Object.defineProperty(t,n,e),e},f=class{cameraService;interactionService;screenWidthService;snapshot;data=null;visibleNoImage=!0;notReceivedIntervalTimer=null;loadTryInterval=3e3;constructor(t,n,a){this.cameraService=t,this.interactionService=n,this.screenWidthService=a}ngOnInit(){this.snapshot.status==s.Success&&this.loadData()}ngOnDestroy(){this.clearTimer()}clearTimer(){this.notReceivedIntervalTimer&&clearInterval(this.notReceivedIntervalTimer)}startTimer(){this.clearTimer(),this.notReceivedIntervalTimer=setInterval(()=>{this.loadData()},this.loadTryInterval)}ngOnChanges(t){if(!t.snapshot.isFirstChange())switch(this.visibleNoImage=!0,this.data=null,this.snapshot.status){case s.NotReceived:this.startTimer();break;case s.Success:this.loadData();break;case s.Fail:break}}loadData(){this.cameraService.getCameraSnapshot(this.snapshot.accessLogId,this.snapshot.snapshotId).subscribe(t=>{switch(this.data="data:image/jpeg;base64,"+t.snapshot,this.visibleNoImage=!1,this.snapshot.status){case s.NotReceived:this.snapshot.status=s.Success,this.clearTimer();break}},t=>{if(t.status==410)this.snapshot.status=s.Archived,this.clearTimer();else if(t.status==411)this.snapshot.status=s.Unauthorized,this.clearTimer();else switch(this.snapshot.status){case s.NotReceived:break;case s.Success:this.startTimer();break}})}onImageClicked(t){this.interactionService.showFullScreenImage({src:this.data,width:this.screenWidthService.isMobile()?"480px":"640px"})}static ctorParameters=()=>[{type:h},{type:u},{type:g}];static propDecorators={snapshot:[{type:p}]}};f=R([l({selector:"armon-camera-snapshot",template:w,standalone:!0,imports:[m,d,b],styles:[y]})],f);var j=function(i,t,n,a){var o=arguments.length,e=o<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,n):a,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(i,t,n,a);else for(var c=i.length-1;c>=0;c--)(r=i[c])&&(e=(o<3?r(e):o>3?r(t,n,e):r(t,n))||e);return o>3&&e&&Object.defineProperty(t,n,e),e},I=class{cameraService;snapshots;index=0;constructor(t){this.cameraService=t}ngOnInit(){}static ctorParameters=()=>[{type:h}];static propDecorators={snapshots:[{type:p}]}};I=j([l({selector:"armon-camera-snapshot-gallery",template:k,standalone:!0,imports:[m,x,d,f],styles:[v]})],I);export{I as a};
