import{a as qi}from"./chunk-UBSAMB7X.js";import{a as Ki,b as Qi,e as Ji,f as Zi}from"./chunk-3KPR3FO6.js";import{a as B}from"./chunk-4JEDZFF7.js";import{c as ni}from"./chunk-5LREW6CF.js";import{a as Xi}from"./chunk-3G7YHUMG.js";import{b as Yi}from"./chunk-SSOVJIY6.js";import{c as oi}from"./chunk-LQM6MUAA.js";import{a as ji}from"./chunk-WV3N7X46.js";import{a as I}from"./chunk-7UJCN5XE.js";import{A as W,G as pi,Kb as Di,O as Y,Q as Ei,R as x,Rd as Bi,Vd as zi,X as Ai,Xd as Hi,ce as Vi,de as Gi,ee as Ui,fe as Wi,h as Li,hd as Fi,md as Ri,q as wi,td as $i,xd as ei}from"./chunk-DKEE7ZBC.js";import{c as ti,d as $}from"./chunk-BRIXTJFQ.js";import{Ad as Mi,Cb as c,Da as A,Eb as k,F as hi,Fb as O,Gb as b,Hb as r,I as gi,Ib as s,J as Ci,Jb as C,La as yi,Ma as D,Na as j,Nb as U,O as _i,Pb as F,Qb as d,Qc as Ti,S as Si,Tb as R,Ua as ki,Ub as ri,Y as Ni,ab as Q,ac as p,bc as X,cc as v,dc as li,e as _,f as vi,fb as a,gb as u,k as ui,na as M,nc as Ii,oa as h,oc as Z,qa as xi,qb as g,tb as Oi,ub as y,uc as f,va as E,vc as m,wb as J,wc as ii,ya as N,zb as bi,zd as Pi}from"./chunk-5TLFY4BG.js";import{k as n}from"./chunk-2JBJP72O.js";var st=15e3,L=class L{constructor(t,i){this.notificationsApiService=t;this.accountStoreService=i;n(this,"count$",new vi({count:{open:0}}));n(this,"stopPolling$",new _);n(this,"pollCount$",hi(0,st).pipe(M(()=>this.readNotificationsCount$()),h(this.stopPolling$)))}readNotificationsCount$(){let t=this.accountStoreService.accountId;return t===null?gi:this.notificationsApiService.readNotificationsCount$(t,["open"])}getCount$(){return this.count$.asObservable()}updateCount(){this.stopPolling(),this.startPolling()}stopPolling(){this.stopPolling$.next()}startPolling(){this.pollCount$?.subscribe(t=>{this.count$.next(t)})}};n(L,"\u0275fac",function(i){return new(i||L)(N(B),N(Yi))}),n(L,"\u0275prov",E({token:L,factory:L.\u0275fac,providedIn:"root"}));var z=L;var w=class w{constructor(){n(this,"_closedNotificationId",new _);n(this,"closedNotificationId",this._closedNotificationId.asObservable());n(this,"_closePanel",new _);n(this,"closePanel",this._closePanel.asObservable());n(this,"_closedMultipleNotifications",new _);n(this,"closedMultipleNotifications",this._closedMultipleNotifications.asObservable())}emitClosedNotification(t){this._closedNotificationId.next(t)}emitClosePanel(){this._closePanel.next()}emitClosedMultipleNotifications(){this._closedMultipleNotifications.next(),this.emitClosePanel()}};n(w,"\u0275fac",function(i){return new(i||w)}),n(w,"\u0275prov",E({token:w,factory:w.\u0275fac}));var T=w;var ct=(e,t)=>({openNotificationsOfGivenType:e,allOpenNotifications:t});function rt(e,t){e&1&&C(0,"uik-loading-spinner-component")}function lt(e,t){if(e&1&&(C(0,"div",0),f(1,"translate")),e&2){let i=d();y("innerHtml",ii(1,1,i.message,Z(4,ct,i.openNotificationsOfGivenType,i.allOpenNotifications)),Q)}}var H=class H{constructor(t){this.notificationsStoreService=t;n(this,"inputData");n(this,"openNotificationsOfGivenType",0);n(this,"allOpenNotifications",0);n(this,"isLoading",!0);n(this,"message","project.process-notifications.confirm-message-of-type");n(this,"destroy$",new _)}ngOnInit(){this.openNotificationsOfGivenType=this.inputData.count,this.notificationsStoreService.getCount$().pipe(_i(()=>ui),Ni(()=>this.isLoading=!1),Si(1),h(this.destroy$)).subscribe(t=>{this.allOpenNotifications=t.count.open||0,this.openNotificationsOfGivenType<this.allOpenNotifications&&(this.message="project.process-notifications.confirm-message"),this.openNotificationsOfGivenType===this.allOpenNotifications&&(this.message="project.process-notifications.confirm-message-all")})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}};n(H,"\u0275fac",function(i){return new(i||H)(u(z))}),n(H,"\u0275cmp",A({type:H,selectors:[["app-notification-close-confirmation-dialog"]],inputs:{inputData:"inputData"},decls:2,vars:2,consts:[[3,"innerHtml"]],template:function(i,o){i&1&&g(0,rt,1,0,"uik-loading-spinner-component")(1,lt,2,7,"div",0),i&2&&(c(o.isLoading?0:-1),a(),c(o.isLoading?-1:1))},dependencies:[ei,$],encapsulation:2}));var ai=H;var P=class P extends Di{constructor(i,o,l,S,K,at,qt){super(P);this.dialog=i;this.toastService=o;this.translateService=l;this.errorResponseDialogService=S;this.notificationsStoreService=K;this.notificationsApiService=at;this.notificationsRefreshListService=qt}closeNotification(i,o){this.notificationsApiService.updateNotificationMetaData$(i,o,{state:"closed"}).subscribe({next:()=>{this.toastService.showToast({text:this.translateService.instant("project.process-notifications.toast-success",{count:1}),type:"success"}),this.notificationsStoreService.updateCount(),this.notificationsRefreshListService.emitClosedNotification(o)},error:l=>{this.errorResponseDialogService.show(l)}})}closeAllNotificationsByType(i,o){this.notificationsApiService.readNotificationsCountByType$(i,o,["open"]).pipe(M(l=>this.openConfirmCloseAllNotificationsDialog$(l.count.open??0)),M(()=>this.notificationsApiService.closeAllNotificationsByType$(i,o))).subscribe({next:l=>this.handleCloseAllNotificationsResponse(l),error:l=>this.errorResponseDialogService.show(l)})}closeAllNotifications(i){this.notificationsApiService.readNotificationsCount$(i,["open"]).pipe(M(o=>this.openConfirmCloseAllNotificationsDialog$(o.count.open??0)),M(()=>this.notificationsApiService.closeAllNotifications$(i))).subscribe({next:o=>this.handleCloseAllNotificationsResponse(o),error:o=>this.errorResponseDialogService.show(o)})}openConfirmCloseAllNotificationsDialog$(i){let o=new Bi;o.className="close-multiple-notifications-dialog",o.header=this.translateService.instant("project.process-notifications.title"),o.closeBtnTxt=this.translateService.instant("states.cancel"),o.actionBtnTxt=this.translateService.instant("states.confirm"),o.inputData={count:i},o.bodyComponent=ai;let l=this.dialog.open(zi,{dialogData:o});return l.events.action.pipe(Ci(S=>S!==null),xi(()=>l.close()))}handleCloseAllNotificationsResponse(i){this.toastService.showToast({text:this.translateService.instant("project.process-notifications.toast-success",{count:i.changed}),type:"success"}),this.notificationsStoreService.updateCount(),this.notificationsRefreshListService.emitClosedMultipleNotifications()}};n(P,"\u0275fac",function(o){return new(o||P)(N(Hi),N(Ri),N(ti),N(oi),N(z),N(B),N(T))}),n(P,"\u0275prov",E({token:P,factory:P.\u0275fac,providedIn:"root"}));var si=P;var mt=(e,t)=>({closing:e,closed:t}),vt=e=>({time:e});function ut(e,t){if(e&1&&(r(0,"div",2),p(1),s()),e&2){let i=d();a(),v(" ",i.notification.formattedTitle," ")}}function ht(e,t){if(e&1){let i=U();r(0,"span",14),F("click",function(){D(i);let l=d().$implicit,S=d(2);return j(S.goToEntity(l.link))}),p(1),s()}if(e&2){let i=d().$implicit;a(),v(" ",i.text," ")}}function gt(e,t){if(e&1&&(r(0,"span"),p(1),r(2,"span"),p(3),f(4,"translate"),s(),p(5,") "),s()),e&2){let i=d().$implicit;a(),v(" ",i.text," ("),a(2),X(m(4,2,"project.notifications.device-removed"))}}function Ct(e,t){if(e&1&&C(0,"span",13),e&2){let i=d().$implicit;y("innerHtml",i.text,Q)}}function _t(e,t){e&1&&C(0,"br")}function St(e,t){if(e&1&&p(0),e&2){let i=d().$implicit;v(" ",i.text," ")}}function Nt(e,t){if(e&1&&g(0,ht,2,1,"span",12)(1,gt,6,4,"span")(2,Ct,1,1,"span",13)(3,_t,1,0,"br")(4,St,1,1),e&2){let i=t.$implicit;c(i.isLinkNeeded?0:-1),a(),c(i.isEntityRemoved?1:-1),a(),c(!i.isLinkNeeded&&!i.isEntityRemoved&&i.isStatic?2:-1),a(),c(i.isNewline?3:-1),a(),c(!i.isLinkNeeded&&!i.isEntityRemoved&&!i.isStatic&&!i.isNewline?4:-1)}}function xt(e,t){if(e&1&&(r(0,"div",3),O(1,Nt,5,5,null,null,k),s()),e&2){let i=d();a(),b(i.notification.slices)}}function yt(e,t){if(e&1&&(r(0,"div")(1,"div",17),f(2,"translate"),C(3,"div",18),s(),p(4),s()),e&2){let i=t.$implicit;a(),R("uikTooltip",m(2,2,"project.notifications.anomaly-detection.tooltip.unresolved")),a(3),v(" ",i.text," ")}}function kt(e,t){if(e&1&&(r(0,"div",16)(1,"div",17),f(2,"translate"),C(3,"div",18),s(),p(4),f(5,"translate"),s()),e&2){let i=t.$implicit;a(),R("uikTooltip",m(2,3,"project.notifications.anomaly-detection.tooltip.resolved")),a(3),li(" ",i.text," ",m(5,5,"project.notifications.anomaly-detection.metric-suffix.resolved")," ")}}function Ot(e,t){if(e&1&&(r(0,"div",3)(1,"div",15),p(2),f(3,"translate"),s(),O(4,yt,5,4,"div",null,k),O(6,kt,6,7,"div",16,k),s()),e&2){let i=d();a(2),v(" ",m(3,1,"project.notifications.anomaly-detection.desc")," "),a(2),b(i.unresolvedMetrics),a(2),b(i.resolvedMetrics)}}function bt(e,t){if(e&1&&(r(0,"div")(1,"div",17),f(2,"translate"),C(3,"div",18),s(),p(4),s()),e&2){let i=t.$implicit;a(),R("uikTooltip",m(2,2,"project.notifications.device-health.tooltip.unresolved")),a(3),v(" ",i.text," ")}}function It(e,t){if(e&1&&(r(0,"div",16)(1,"div",17),f(2,"translate"),C(3,"div",18),s(),p(4),f(5,"translate"),s()),e&2){let i=t.$implicit;a(),R("uikTooltip",m(2,3,"project.notifications.device-health.tooltip.resolved")),a(3),li(" ",i.text," ",m(5,5,"project.notifications.device-health.metric-suffix.resolved")," ")}}function Tt(e,t){if(e&1&&(r(0,"div",3)(1,"div",15),p(2),f(3,"translate"),s(),O(4,bt,5,4,"div",null,k),O(6,It,6,7,"div",16,k),s()),e&2){let i=d();a(2),v(" ",m(3,1,"project.notifications.device-health.desc")," "),a(2),b(i.unresolvedMetrics),a(2),b(i.resolvedMetrics)}}function Pt(e,t){if(e&1&&(r(0,"div",4),p(1),f(2,"translate"),s()),e&2){let i=d();ri("routerLink","/project/",i.accountId,"/management/license"),a(),v(" ",m(2,3,"project.notifications.go-to-license-pool-link")," ")}}function Mt(e,t){if(e&1){let i=U();r(0,"div",19),F("click",function(){D(i);let l=d();return j(l.goToDeviceTable())}),p(1),f(2,"translate"),s()}e&2&&(a(),v(" ",m(2,1,"project.notifications.all.device-table-link")," "))}function Lt(e,t){if(e&1&&(r(0,"div",6),p(1),f(2,"translate"),s()),e&2){let i=d();ri("routerLink","/project/",i.accountId,"/dashboard/list/lta"),a(),v(" ",m(2,3,"project.notifications.go-to-lta-dashboard-link")," ")}}function wt(e,t){if(e&1){let i=U();r(0,"div",20),F("click",function(){D(i);let l=d();return j(l.goToNotificationSettings(l.notification.type))}),p(1),f(2,"translate"),s()}e&2&&(a(),v(" ",m(2,1,"project.notifications.all.settings-link")," "))}function Et(e,t){e&1&&(r(0,"span"),p(1),f(2,"translate"),s()),e&2&&(a(),X(m(2,1,"project.notifications.today")))}function At(e,t){e&1&&(r(0,"span"),p(1),f(2,"translate"),s()),e&2&&(a(),X(m(2,1,"project.notifications.yesterday")))}function Dt(e,t){if(e&1&&(r(0,"span",10),p(1),f(2,"translate"),s()),e&2){let i=d();a(),v(" ",ii(2,1,"project.notifications.open-for",Ii(4,vt,i.notification.openForInfo))," ")}}function jt(e,t){e&1&&C(0,"uik-svg-icon",23),e&2&&y("iconStyle","svg-icon-medium")}function Ft(e,t){if(e&1){let i=U();r(0,"uik-dropdown-item",24),F("click",function(){D(i);let l=d(2);return j(l.closeNotification())}),p(1),f(2,"translate"),s(),r(3,"uik-dropdown-item",25),F("click",function(){D(i);let l=d(2);return j(l.closeAllNotificationsOfThisType())}),p(4),f(5,"translate"),s()}e&2&&(a(),v(" ",m(2,2,"project.notifications.close")," "),a(3),v(" ",m(5,4,"project.notifications.close-current-type")," "))}function Rt(e,t){e&1&&(r(0,"uik-dropdown",11),g(1,jt,1,1,"ng-template",21)(2,Ft,6,6,"ng-template",22),s())}var V=class V{constructor(t,i,o,l,S,K){this.router=t;this.notificationsRefreshListService=i;this.deviceApiService=o;this.deviceTableFilterStateChangerService=l;this.rulesProvider=S;this.notificationCloseService=K;n(this,"accountId");n(this,"notification");n(this,"isFilterOpenSelected");n(this,"isFilterClosedSelected");n(this,"insidePopup",!1);n(this,"isToday");n(this,"isYesterday");n(this,"resolvedMetrics");n(this,"unresolvedMetrics");n(this,"metricCount");n(this,"isAnomalyDetectionAlert",!1);n(this,"isInspectionAlert",!1);n(this,"isDeviceHealthAlert",!1);n(this,"isLicenseAssignmentAlert",!1);n(this,"isLtaAutoBlockingEndpointAlert",!1);n(this,"destroy$",new _)}ngOnInit(){this.notificationsRefreshListService.closedNotificationId.pipe(h(this.destroy$)).subscribe(t=>{this.hideClosedNotification(t)})}ngOnChanges(){this.notification.openForInfo=this.prepareOpenForInfo(this.notification),this.notification.formattedCreatedAt=this.prepareFormattedCreatedAtInfo(this.notification,I.new()),this.resolvedMetrics=this.notification.slices.filter(t=>t.isMetricResolved===!0),this.unresolvedMetrics=this.notification.slices.filter(t=>t.isMetricResolved===!1),this.metricCount=this.resolvedMetrics.length+this.unresolvedMetrics.length,this.isAnomalyDetectionAlert=this.notification.type===Ki,this.isInspectionAlert=this.rulesProvider.inspectionRuleNames.has(this.notification.type),this.isDeviceHealthAlert=this.notification.type===Qi,this.isLicenseAssignmentAlert=this.notification.type.endsWith(":licenseAssignmentFailed"),this.isLtaAutoBlockingEndpointAlert=this.notification.type===Ji}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}goToEntity(t){this.router.navigate([t]),this.notificationsRefreshListService.emitClosePanel()}goToDeviceTable(){let t=W(this.notification.template.references,i=>i.type==="device");this.deviceApiService.readDevice$(this.accountId,t[0].id).pipe(h(this.destroy$)).subscribe(i=>{this.notificationsRefreshListService.emitClosePanel(),this.deviceTableFilterStateChangerService.goToDeviceTableWithSerialNumberFilter(i.status.serial)})}goToNotificationSettings(t){t?this.router.navigate([`/project/${this.accountId}/specifications/notifications/alerts`,t]):this.router.navigate([`/project/${this.accountId}/specifications/notifications/alerts`]),this.notificationsRefreshListService.emitClosePanel()}closeNotification(){this.notificationCloseService.closeNotification(this.accountId,this.notification.id)}prepareOpenForInfo(t){let i=I.new(t.stateUpdatedAt);return I.duration(i.diff(t.createdAt)).humanize()}prepareFormattedCreatedAtInfo(t,i){let o=I.new(i).subtract(1,"days");return this.isToday=I.new(t.createdAt).isSame(i,"day"),this.isYesterday=I.new(t.createdAt).isSame(o,"day"),this.isToday||this.isYesterday?this.formatDate(t,"HH:mm"):this.formatDate(t,"Do MMM")}formatDate(t,i){return I.new(t.createdAt).format(i)}hideClosedNotification(t){this.notification.id===t&&this.notification.isOpen&&(this.notification.isOpen=!1)}closeAllNotificationsOfThisType(){this.notificationCloseService.closeAllNotificationsByType(this.accountId,this.notification.type)}};n(V,"\u0275fac",function(i){return new(i||V)(u(Pi),u(T),u(ni),u(Xi),u(Zi),u(si))}),n(V,"\u0275cmp",A({type:V,selectors:[["app-notification-item"]],inputs:{accountId:"accountId",notification:"notification",isFilterOpenSelected:"isFilterOpenSelected",isFilterClosedSelected:"isFilterClosedSelected",insidePopup:"insidePopup"},features:[yi],decls:17,vars:24,consts:[["data-atlas","notification-item",3,"id","ngClass"],[1,"notification-text-wrap"],[1,"notification-title"],[1,"notification-description"],[1,"details-link","uik-hyperlink",3,"routerLink"],[1,"details-link","uik-hyperlink"],["data-test","lta-dashboard-link",1,"details-link","uik-hyperlink",3,"routerLink"],[1,"notification-settings-link","uik-hyperlink"],[1,"notification-time"],["data-test","notification-date-time",1,"notification-time-date"],[1,"notification-open-for-label"],["data-atlas","notification-context-menu",1,"notification-context-menu"],["data-test","slice-link","data-atlas","notification-entity-link",1,"uik-hyperlink"],[2,"white-space","pre",3,"innerHtml"],["data-test","slice-link","data-atlas","notification-entity-link",1,"uik-hyperlink",3,"click"],[1,"notification-anomaly-detection-desc"],[1,"resolved"],[1,"circle-indicator-wrapper",3,"uikTooltip"],[1,"circle-indicator"],[1,"details-link","uik-hyperlink",3,"click"],[1,"notification-settings-link","uik-hyperlink",3,"click"],["uikDropdownTitle",""],["uikDropdownMenu",""],["name","more",3,"iconStyle"],["data-atlas","close-notification",1,"action-item",3,"click"],["data-atlas","close-all-notifications-of-same-type",1,"action-item",3,"click"]],template:function(i,o){i&1&&(r(0,"div",0)(1,"div",1),g(2,ut,2,1,"div",2)(3,xt,3,0,"div",3)(4,Ot,8,3,"div",3)(5,Tt,8,3,"div",3),s(),g(6,Pt,3,5,"div",4)(7,Mt,3,3,"div",5)(8,Lt,3,5,"div",6)(9,wt,3,3,"div",7),r(10,"div",8)(11,"span",9),g(12,Et,3,3,"span")(13,At,3,3,"span"),p(14),s(),g(15,Dt,3,6,"span",10),s(),g(16,Rt,3,0,"uik-dropdown",11),s()),i&2&&(bi("notification-item ",o.notification.type,""),J("inside-popup",o.insidePopup),R("id",o.notification.id),y("ngClass",Z(21,mt,!o.notification.isOpen&&o.isFilterOpenSelected&&!o.isFilterClosedSelected,o.notification.state==="closed"||!o.notification.isOpen&&o.isFilterOpenSelected&&o.isFilterClosedSelected||!o.notification.isOpen&&!o.isFilterOpenSelected&&!o.isFilterClosedSelected)),Oi("notification-type",o.notification.type),a(2),c(o.notification.formattedTitle?2:-1),a(),c(o.notification.slices&&!o.isAnomalyDetectionAlert&&!o.isDeviceHealthAlert?3:-1),a(),c(o.isAnomalyDetectionAlert&&o.metricCount>0?4:-1),a(),c(o.notification.slices&&o.isDeviceHealthAlert?5:-1),a(),c(o.isLicenseAssignmentAlert?6:-1),a(),c(o.isAnomalyDetectionAlert||o.isInspectionAlert?7:-1),a(),c(o.isLtaAutoBlockingEndpointAlert?8:-1),a(),c(o.isAnomalyDetectionAlert||o.isInspectionAlert?9:-1),a(3),c(o.isToday?12:-1),a(),c(o.isYesterday?13:-1),a(),v(" ",o.notification.formattedCreatedAt," "),a(),c(o.notification.state==="closed"||!o.notification.isOpen?15:-1),a(),c(o.notification.state==="open"&&o.notification.isOpen?16:-1))},dependencies:[Ti,Fi,Wi,Vi,Gi,Ui,$i,Mi,$],styles:['[_ngcontent-%COMP%]:root{--uik-halo-width: 3px;--uik-svg-icon-size-xs: 14px;--uik-svg-icon-size-s: 16px;--uik-svg-icon-size-m: 20px;--uik-svg-icon-size-l: 24px;--uik-svg-icon-size-xl: 32px;--uik-input-height: 32px;--uik-button-height: 32px;--uik-button-padding: 0 8px;--uik-input-margin-top: 8px;--uik-input-label-margin-top: 16px;--uik-input-label-margin-bottom: 16px;--uik-input-padding-left: 12px;--uik-input-padding-right: 12px;--uik-input-padding-right-for-show-text-toggle: 36px;--uik-margin-top-needed-to-align-to-input: calc( var(--uik-input-label-margin-top) + var(--uik-line-height-normal-font-size) + var(--uik-input-margin-top) );--uik-margin-top-needed-to-align-to-input-without-label-margin: calc( var(--uik-line-height-normal-font-size) + var(--uik-input-margin-top) );--uik-margin-top-needed-to-align-to-input-without-label-text: calc( var(--uik-input-label-margin-top) + var(--uik-input-margin-top) );--uik-calendar-popup-width: 350px;--uik-drop-shadow-dark: drop-shadow(0 0 .25rem rgb(0 0 0 / .75));--uik-drop-shadow-light: drop-shadow(0 0 .25rem rgb(0 0 0 / .25))}[_nghost-%COMP%]{--notification-time: var(--uik-grayPrimary);--notification-active-color: var(--uik-orangePrimary);--notification-closed-color: var(--uik-graySecondary);--notification-border-bottom-color: var(--uik-grayTertiary);--notification-background-color-hover: var(--uik-highlight-background-color-hover);--notification-background-color-closed: var(--uik-grayQuaternary);--notification-font-color: var(--uik-font-color);--notification-resolved-circle-background-color: var(--uik-greenPrimary)}.notification-item[_ngcontent-%COMP%]{--notification-border-left-color: var(--notification-active-color);display:grid;padding:10px 10px 10px 16px;cursor:default;border-left:3px solid var(--notification-border-left-color);border-bottom:1px solid var(--notification-border-bottom-color);grid-template-columns:130px minmax(130px,1fr) 60px;grid-template-areas:"dateTime           dateTime        context" "main               main            context" "detailsLink        settingsLink    context"}.notification-item[_ngcontent-%COMP%]   .notification-text-wrap[_ngcontent-%COMP%]{grid-area:main}.notification-item[_ngcontent-%COMP%]   .notification-settings-link[_ngcontent-%COMP%]{grid-area:settingsLink}.notification-item[_ngcontent-%COMP%]   .details-link[_ngcontent-%COMP%]{grid-area:detailsLink}.notification-item[_ngcontent-%COMP%]   .notification-time[_ngcontent-%COMP%]{grid-area:dateTime}.notification-item[_ngcontent-%COMP%]   .notification-context-menu[_ngcontent-%COMP%]{grid-area:context}.notification-item.inside-popup[_ngcontent-%COMP%]{border:none;padding:15px;grid-template-areas:"main               main            context" "detailsLink        settingsLink    dateTime"}.notification-item.inside-popup[_ngcontent-%COMP%]   .notification-time[_ngcontent-%COMP%]{justify-self:end}.notification-item.closing[_ngcontent-%COMP%]{--notification-border-left-color: var(--notification-closed-color);height:0;padding-top:0;padding-bottom:0;border-bottom:none;transition:all .3s ease .1s;overflow:hidden;background-color:var(--notification-background-color-closed)}.notification-item.closing[_ngcontent-%COMP%]   *[_ngcontent-%COMP%]{opacity:0;display:none}.notification-item.closed[_ngcontent-%COMP%]{--notification-border-left-color: var(--notification-closed-color);background-color:var(--notification-background-color-closed)}.notification-item[_ngcontent-%COMP%]:hover{background-color:var(--notification-background-color-hover)}.notification-item[_ngcontent-%COMP%]   .notification-text-wrap[_ngcontent-%COMP%]   .notification-title[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;display:inline-block;width:100%;margin-bottom:0;font-weight:var(--uik-font-weight-semi-bold);color:var(--notification-font-color)}.notification-item[_ngcontent-%COMP%]   .notification-text-wrap[_ngcontent-%COMP%]   .notification-description[_ngcontent-%COMP%]{overflow-x:hidden;text-overflow:ellipsis;display:inline-block;width:100%;font-weight:var(--uik-font-weight-continuous-text);font-size:var(--uik-font-size-small);margin-bottom:0;color:var(--notification-font-color)}.notification-item[_ngcontent-%COMP%]   .notification-text-wrap[_ngcontent-%COMP%]   .notification-description[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]:not(:last-of-type){display:inline-flex}.notification-item[_ngcontent-%COMP%]   .notification-text-wrap[_ngcontent-%COMP%]   .notification-description[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]:not(:last-of-type) > span[_ngcontent-%COMP%]{display:contents}.notification-item[_ngcontent-%COMP%]   .notification-text-wrap[_ngcontent-%COMP%]   .notification-description[_ngcontent-%COMP%]   .notification-anomaly-detection-desc[_ngcontent-%COMP%]{margin-bottom:4px}.notification-item[_ngcontent-%COMP%]   .notification-text-wrap[_ngcontent-%COMP%]   .notification-description[_ngcontent-%COMP%]   .circle-indicator-wrapper[_ngcontent-%COMP%]{display:inline-grid;height:16px;width:16px;place-content:center}.notification-item[_ngcontent-%COMP%]   .notification-text-wrap[_ngcontent-%COMP%]   .notification-description[_ngcontent-%COMP%]   .circle-indicator-wrapper[_ngcontent-%COMP%]   .circle-indicator[_ngcontent-%COMP%]{width:8px;height:8px;background-color:var(--notification-active-color);border-radius:50%;display:inline-block;margin-right:8px;margin-left:8px}.notification-item[_ngcontent-%COMP%]   .notification-text-wrap[_ngcontent-%COMP%]   .notification-description[_ngcontent-%COMP%]   .resolved[_ngcontent-%COMP%]   .circle-indicator[_ngcontent-%COMP%]{background-color:var(--notification-resolved-circle-background-color)}.notification-item[_ngcontent-%COMP%]   .notification-settings-link[_ngcontent-%COMP%], .notification-item[_ngcontent-%COMP%]   .details-link[_ngcontent-%COMP%]{font-size:var(--uik-font-size-small)}.notification-item[_ngcontent-%COMP%]   .notification-time[_ngcontent-%COMP%]{font-size:var(--uik-font-size-small);color:var(--notification-time)}.notification-item[_ngcontent-%COMP%]   .notification-time[_ngcontent-%COMP%]   .notification-time-date[_ngcontent-%COMP%]{display:inline-block}.notification-item[_ngcontent-%COMP%]   .notification-time[_ngcontent-%COMP%]   .notification-open-for-label[_ngcontent-%COMP%]:before{content:"-";margin:0 5px}.notification-item[_ngcontent-%COMP%]   uik-dropdown.notification-context-menu[_ngcontent-%COMP%]{--uik-dropdown-button-padding-inline: 0px;--uik-dropdown-button-border-color: transparent;display:grid;align-self:start;justify-items:end}']}));var ci=V;function Bt(e,t){e&1&&(r(0,"h3",2),p(1),f(2,"translate"),s()),e&2&&(a(),v(" ",m(2,1,"project.notifications.empty-list")," "))}function zt(e,t){e&1&&(r(0,"h3",2),p(1),f(2,"translate"),s()),e&2&&(a(),v(" ",m(2,1,"project.notifications.empty-list-open")," "))}function Ht(e,t){e&1&&(r(0,"h3",2),p(1),f(2,"translate"),s()),e&2&&(a(),v(" ",m(2,1,"project.notifications.empty-list-closed")," "))}function Vt(e,t){if(e&1&&g(0,Bt,3,3,"h3",2)(1,zt,3,3,"h3",2)(2,Ht,3,3,"h3",2),e&2){let i=d();c(i.isNotificationListOpenEmpty&&i.isNotificationListClosedEmpty&&i.isFilterAllSelected?0:-1),a(),c(i.isNotificationListOpenEmpty&&i.isFilterOpenSelected?1:-1),a(),c(i.isNotificationListClosedEmpty&&i.isFilterClosedSelected?2:-1)}}function Gt(e,t){if(e&1&&C(0,"app-notification-item",4),e&2){let i=d().$implicit,o=d(2);y("accountId",o.accountId)("notification",i)("isFilterOpenSelected",o.isFilterOpenSelected)("isFilterClosedSelected",o.isFilterClosedSelected)("insidePopup",o.insidePopup)}}function Ut(e,t){if(e&1&&g(0,Gt,1,5,"app-notification-item",4),e&2){let i=t.$implicit,o=d(2);c(o.lodashIncludes(o.notificationStates,i.state)?0:-1)}}function Wt(e,t){if(e&1&&(r(0,"div",3),O(1,Ut,1,1,null,null,k),s()),e&2){let i=d();J("flash-bg",i.animateBg),a(),b(i.notificationsList)}}function Yt(e,t){e&1&&C(0,"uik-loading-spinner-component",1)}var G=class G{constructor(t,i,o,l,S,K,at){this.notificationsApiService=t;this.deviceApiService=i;this.notificationTemplateFormatterService=o;this.translateService=l;this.errorResponseDialogService=S;this.winRef=K;this.notificationsRefreshListService=at;n(this,"accountId");n(this,"notificationStates");n(this,"limitNotifications");n(this,"insidePopup",!1);n(this,"loadMoreEvent",new ki);n(this,"language");n(this,"notificationsList");n(this,"isNotificationListEmpty");n(this,"isNotificationListOpenEmpty");n(this,"isNotificationListClosedEmpty");n(this,"isFilterAllSelected");n(this,"isFilterOpenSelected");n(this,"isFilterClosedSelected");n(this,"isLoading");n(this,"isLoadingMore");n(this,"infoNext");n(this,"animateBg");n(this,"notificationsResponse");n(this,"lodashIncludes",x);n(this,"devicesList");n(this,"paramLimit");n(this,"destroy$",new _);n(this,"initializeNotifications$",new _);this.isNotificationListEmpty=!0,this.isLoading=!0,this.animateBg=!1}ngOnInit(){this.notificationsRefreshListService.closedNotificationId.pipe(h(this.destroy$)).subscribe(t=>{let i=this.notificationsList.find(o=>o.id===t);i&&(i.isOpen=!1),this.isFilterOpenSelected&&!this.isFilterClosedSelected&&this.checkListEmptyAfterClosing()}),this.translateService&&(this.language=this.translateService.currentLang,this.initializeNotifications(this.notificationStates),this.translateService.onLangChange.pipe(h(this.destroy$)).subscribe(t=>{this.language=t.lang,this.initializeNotifications(this.notificationStates)}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),this.initializeNotifications$.complete()}initializeNotifications(t){this.initializeNotifications$.next(),this.notificationsList=[],this.isLoading=!0,this.notificationStates=t,this.setFilterStates();let i=this.buildRequestParams(!1);this.notificationsApiService.readNotifications$(this.accountId,i).pipe(h(this.initializeNotifications$),h(this.destroy$)).subscribe({next:o=>{this.notificationsResponse=o,this.processGetNotificationResponse(this.notificationsResponse),this.isLoading=!1},error:o=>this.showErrorMessage(o)}),this.deviceApiService.readAllDevices1$(this.accountId).pipe(h(this.initializeNotifications$),h(this.destroy$)).subscribe({next:o=>{this.devicesList=o,this.processGetNotificationResponse(this.notificationsResponse)},error:o=>{this.showErrorMessage(o)}})}loadMore(){this.isLoadingMore=!0;let t=this.buildRequestParams(!0);this.notificationsApiService.readNotifications$(this.accountId,t).pipe(h(this.destroy$)).subscribe({next:i=>{this.infoNext=Y(i,"next")?i.next:null,Y(i,"alerts")&&(this.checkNotificationDuplicate(this.notificationsList,i.alerts),i.alerts.forEach(o=>{this.updateNotification(o)}),this.notificationsList=wi(this.notificationsList,i.alerts)),this.loadMoreEvent.emit(!!this.infoNext),this.isLoadingMore=!1,this.animateBg=!1},error:i=>{this.animateBg=!1,this.showErrorMessage(i)}})}checkListEmptyAfterClosing(){let t=!!this.infoNext,i=!this.notificationsList.some(o=>o.isOpen);this.isNotificationListOpenEmpty=t?!1:i,i&&t&&(this.animateBg=!0,this.loadMore())}buildRequestParams(t){let i={lang:this.language,states:this.notificationStates};if(this.limitNotifications&&(i.limit=this.limitNotifications),this.getParamLimit(),this.paramLimit&&(i.limit=this.paramLimit),t){let o=Li(this.infoNext),l=Ei(this.infoNext);o.forEach((S,K)=>{i[S]=encodeURI(l[K])})}return i}setFilterStates(){this.isFilterAllSelected=x(this.notificationStates,"open")&&x(this.notificationStates,"closed"),this.isFilterOpenSelected=x(this.notificationStates,"open")&&!x(this.notificationStates,"closed"),this.isFilterClosedSelected=x(this.notificationStates,"closed")&&!x(this.notificationStates,"open")}processGetNotificationResponse(t){this.infoNext=Y(t,"next")?t.next:null,Y(t,"alerts")&&(this.notificationsList=t.alerts),this.checkEmptyList(),this.isNotificationListEmpty||this.notificationsList.forEach(i=>{this.updateNotification(i)}),this.loadMoreEvent.emit(!!this.infoNext)}checkEmptyList(){this.isNotificationListEmpty=Ai(this.notificationsList);let t=W(this.notificationsList,{state:"open"});this.isNotificationListOpenEmpty=!t.length;let i=W(this.notificationsList,{state:"closed"});this.isNotificationListClosedEmpty=!i.length}getParamLimit(){this.winRef&&(this.paramLimit=this.winRef.nativeWindow.location.href.split(/\?limit=/)[1])}checkNotificationDuplicate(t,i){let o=pi(t,"id");pi(i,"id").forEach(S=>{x(o,S)&&console.error(`notification ${S} is duplicate`)})}updateNotification(t){return t.isOpen=!0,t.formattedTitle=this.notificationTemplateFormatterService.formatTitle(t,this.language,this.devicesList),t.slices=this.notificationTemplateFormatterService.formatText(t,this.language,this.devicesList),t}showErrorMessage(t){this.errorResponseDialogService.show(t)}};n(G,"\u0275fac",function(i){return new(i||G)(u(B),u(ni),u(qi),u(ti),u(oi),u(ji),u(T))}),n(G,"\u0275cmp",A({type:G,selectors:[["app-notifications-list"]],inputs:{accountId:"accountId",notificationStates:"notificationStates",limitNotifications:"limitNotifications",insidePopup:"insidePopup"},outputs:{loadMoreEvent:"loadMoreEvent"},decls:3,vars:3,consts:[["data-atlas","notification-list",1,"notification-list",3,"flash-bg"],[1,"notification-loading"],["data-atlas","text-no-notification",1,"text-no-notification"],["data-atlas","notification-list",1,"notification-list"],[3,"accountId","notification","isFilterOpenSelected","isFilterClosedSelected","insidePopup"]],template:function(i,o){i&1&&g(0,Vt,3,3)(1,Wt,3,2,"div",0)(2,Yt,1,0,"uik-loading-spinner-component",1),i&2&&(c(!o.isLoading&&!o.isLoadingMore?0:-1),a(),c(!o.isLoading&&o.notificationsList?1:-1),a(),c(o.isLoading||o.isLoadingMore?2:-1))},dependencies:[ei,ci,$],styles:["[_nghost-%COMP%]{--notifications-list-background-color: var(--uik-white);--notifications-list-background-color-flash: var(--uik-graySecondary)}[_nghost-%COMP%]   .notification-list[_ngcontent-%COMP%]{margin:0;list-style:none;background-color:var(--notifications-list-background-color);transition:background-color 4s ease-out}[_nghost-%COMP%]   .notification-list.flash-bg[_ngcontent-%COMP%]{background-color:var(--notifications-list-background-color-flash);transition:background-color .5s ease}[_nghost-%COMP%]   .text-no-notification[_ngcontent-%COMP%], [_nghost-%COMP%]   .notification-loading[_ngcontent-%COMP%]{padding:20px 0;justify-content:center;display:flex}"]}));var nt=G;export{z as a,T as b,si as c,nt as d};
