Server : Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6 System : Windows NT USER-PC 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) AMD64 User : User ( 0) PHP Version : 7.4.6 Disable Function : NONE Directory : C:/Program Files/Avast Software/Avast/gui_resources/default_av/ |
//{"name":"Notifications","version":"1.2.351","created":"2021-03-09T09:12:09.759Z"} import t from"./ractive.js";import{napiTracker as e,windowApi as i,serviceRequest as s,moduleManager as n,eventer as a}from"./napi.js";import{napiUtils as o,productModel as r,settingsService as l}from"./napiExtensions.js";import{stringUtils as c,logger as d}from"./libs.js";import{nls as m}from"./i18n.js";var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},p=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,_=/^0b[01]+$/i,h=/^0o[0-7]+$/i,g=parseInt,b="object"==typeof f&&f&&f.Object===Object&&f,v="object"==typeof self&&self&&self.Object===Object&&self,x=b||v||Function("return this")(),y=Object.prototype.toString,I=Math.max,T=Math.min,k=function(){return x.Date.now()};function S(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function w(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==y.call(t)}(t))return NaN;if(S(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=S(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(p,"");var i=_.test(t);return i||h.test(t)?g(t.slice(2),i?2:8):u.test(t)?NaN:+t}var A=function(t,e,i){var s,n,a,o,r,l,c=0,d=!1,m=!1,f=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function p(e){var i=s,a=n;return s=n=void 0,c=e,o=t.apply(a,i)}function u(t){return c=t,r=setTimeout(h,e),d?p(t):o}function _(t){var i=t-l;return void 0===l||i>=e||i<0||m&&t-c>=a}function h(){var t=k();if(_(t))return g(t);r=setTimeout(h,function(t){var i=e-(t-l);return m?T(i,a-(t-c)):i}(t))}function g(t){return r=void 0,f&&s?p(t):(s=n=void 0,o)}function b(){var t=k(),i=_(t);if(s=arguments,n=this,l=t,i){if(void 0===r)return u(l);if(m)return r=setTimeout(h,e),p(l)}return void 0===r&&(r=setTimeout(h,e)),o}return e=w(e)||0,S(i)&&(d=!!i.leading,a=(m="maxWait"in i)?I(w(i.maxWait)||0,e):a,f="trailing"in i?!!i.trailing:f),b.cancel=function(){void 0!==r&&clearTimeout(r),c=0,s=l=n=r=void 0},b.flush=function(){return void 0===r?o:g(k())},b};const D=t.extend({template:{v:3,t:[{t:7,e:"div",a:{class:["banner -notification ",{t:2,x:{r:["item.Severity"],s:'_0?"-"+_0:"-neutral"'}}," -",{t:2,r:"type"}],"data-test":["ntf_item_",{t:2,r:"type"},"_",{t:2,r:"@index"}]},f:[{t:4,f:[{t:7,e:"div",a:{class:"banner__logo"}}],n:50,x:{r:["type"],s:'_0==="alert"'}}," ",{t:7,e:"div",f:[{t:7,e:"div",a:{class:"h4 -margins","data-test":"ntf_item-name"},f:[{t:2,r:"item.Title"}]}," ",{t:7,e:"div",a:{class:"p -small g-break-word","data-test":"ntf_item-desc"},f:[{t:2,x:{r:["stripHtml","item.Desc"],s:"_0(_1)"}}]}," ",{t:7,e:"div",a:{class:"text -secondary -tiny g-margin-top--10","data-test":"ntf_item-time"},f:[{t:2,x:{r:["moment","item.Timestamp"],s:'_0(_1).format("lll")'}}]}," ",{t:4,f:[{t:4,f:[{t:7,e:"a",a:{href:[{t:2,r:"item.Link"}],class:["btn -small ",{t:2,x:{r:["item.Severity"],s:'_0==="critical"?"-secondary":""'}}," g-margin-top--20"],"data-test":"ntf_item-fix"},v:{click:"clicked"},f:[{t:2,r:"item.ButtonCaption"}]}],n:50,r:"item.Link"},{t:4,n:51,f:[{t:7,e:"kin-button",v:{click:"clicked"},a:{size:"small",class:"g-margin-top--20","data-test":"ntf_item-fix"},f:[{t:2,r:"item.ButtonCaption"}]}],r:"item.Link"}],n:50,x:{r:["type","item.ButtonCaption"],s:'_0==="alert"&&_1'}}," ",{t:4,f:[{t:7,e:"kin-button",v:{click:"clear"},a:{type:"secondary",size:"small",class:"g-margin-top--20 g-margin-left--5","data-test":"ntf_item-close"},f:[{t:3,x:{r:["nls"],s:'_0("global.gotIt")'}}]}],n:50,x:{r:["type","item.origin","item.DarkWebMonitor"],s:'_0==="alert"&&_1!=="omni"&&!_2'}}]}," ",{t:7,e:"div",a:{class:"banner__icon"},f:[{t:4,f:[{t:7,e:"div",a:{class:"avatar -notification"},f:[{t:7,e:"img",a:{class:"avatar__img",src:[{t:2,r:"item.image"}]}}]}],n:50,r:"item.image"},{t:4,n:51,f:[{t:4,n:50,x:{r:["item.initials"],s:"_0"},f:[{t:7,e:"div",a:{class:"avatar -notification"},f:[{t:7,e:"span",a:{class:"avatar__initials"},f:[{t:2,r:"item.initials"}]}]}]},{t:4,n:50,x:{r:["item.initials","item.icon"],s:"(!(_0))&&(_1)"},f:[" ",{t:4,f:[{t:7,e:"div",a:{class:"avatar -notification"},f:[{t:7,e:"span",a:{class:"avatar__icon"},f:[{t:7,e:"kin-icon",a:{name:[{t:2,r:"item.icon"}],size:"32"}}]}]}],n:50,x:{r:["type"],s:'_0!=="alert"'}},{t:4,n:51,f:[{t:7,e:"kin-icon",a:{name:[{t:2,r:"item.icon"}],size:"40"}}],x:{r:["type"],s:'_0!=="alert"'}}]},{t:4,n:50,x:{r:["item.initials","item.icon","item.DarkWebMonitor"],s:"(!(_0))&&((!(_1))&&(_2))"},f:[]},{t:4,n:50,x:{r:["item.initials","item.icon","item.DarkWebMonitor","item.Type"],s:"(!(_0))&&((!(_1))&&((!(_2))&&(_3===12)))"},f:[" ",{t:4,f:[{t:7,e:"div",a:{class:"avatar -notification"},f:[{t:7,e:"span",a:{class:"avatar__icon"},f:[{t:7,e:"kin-icon",a:{name:"circle-critical-neutral",size:"32"}}]}]}],n:50,x:{r:["type"],s:'_0!=="alert"'}},{t:4,n:51,f:[{t:7,e:"kin-icon",a:{name:"circle-critical-neutral",size:"40"}}],x:{r:["type"],s:'_0!=="alert"'}}]},{t:4,n:50,x:{r:["item.initials","item.icon","item.DarkWebMonitor","item.Type"],s:"(!(_0))&&((!(_1))&&((!(_2))&&((!(_3===12))&&(_3>10))))"},f:[" ",{t:4,f:[{t:7,e:"div",a:{class:"avatar -notification"},f:[{t:7,e:"span",a:{class:"avatar__icon"},f:[{t:7,e:"kin-icon",a:{name:"icon-m-devices-omni",size:"32"}}]}]}],n:50,x:{r:["type"],s:'_0!=="alert"'}},{t:4,n:51,f:[{t:7,e:"kin-icon",a:{name:"icon-m-devices-omni",size:"40"}}],x:{r:["type"],s:'_0!=="alert"'}}]},{t:4,n:50,x:{r:["item.initials","item.icon","item.DarkWebMonitor","item.Type"],s:"(!(_0))&&((!(_1))&&((!(_2))&&((!(_3===12))&&(!(_3>10)))))"},f:[" ",{t:4,f:[{t:7,e:"div",a:{class:"avatar -notification"},f:[{t:7,e:"span",a:{class:"avatar__icon"},f:[{t:7,e:"Icon",a:{name:["notification-",{t:2,r:"item.Type"}],cssCls:"g-font--32"}}]}]}],n:50,x:{r:["type"],s:'_0!=="alert"'}},{t:4,n:51,f:[{t:7,e:"Icon",a:{name:["notification-",{t:2,r:"item.Type"}],cssCls:"g-font--40"}}],x:{r:["type"],s:'_0!=="alert"'}}]}],r:"item.image"}]}]}]},data:function(){return{type:null,item:null,stripHtml:c.stripHtml}},oninit(){this.log=d.createLogger("notifications.item",null,this.get("item.Title")),this.log.info("oninit"),this.on("clicked",(()=>{const t=this.get("item");this.log.info("item clicked.. firing action"),e.event("Notifications","Click",t.Title+" - "+t.ButtonCaption),this.fire("itemActionFired"),t.Url?i.browse(t.Url):t.Link||s("app.notificationCenter.DoItemAction",t.ItemUID).then((()=>{this.log.debug("item action done"),this.fire("itemActionDone")})).catch((t=>{this.log.error("item action failed",t)}))})),this.on("clear",(()=>{this.log.info("removing item");const t=this.get("item.ItemUID");let e,i;o.isVersionSupported("19.8")?(e="app.notificationCenter.SetItemViewed",i={ItemUID:t}):(e="app.notificationCenter.RemoveItem",i=t),s(e,i).then((()=>{this.log.debug("item removed"),this.fire("itemRemoved")})).catch((t=>{console.error("removing item failed",t)}))}))}}),C=t.extend({template:{v:3,t:[{t:7,e:"div",a:{class:["banner -notification -neutral -",{t:2,r:"type"}],"data-test":["ntf_item_",{t:2,r:"type"},"_",{t:2,r:"@index"}]},f:[{t:4,f:[{t:7,e:"div",a:{class:"banner__logo"}}],n:50,x:{r:["type"],s:'_0!=="ignored"'}}," ",{t:7,e:"div",f:[{t:4,f:[{t:7,e:"div",a:{class:"h4 -margins","data-test":"ntf_item-name"},f:[{t:3,x:{r:["getExpiringText"],s:'_0("title")'}}]}," ",{t:7,e:"div",a:{class:"p -small g-break-word","data-test":"ntf_item-desc"},f:[{t:3,x:{r:["getExpiringText"],s:'_0("desc")'}}]}],n:50,x:{r:["issue.id"],s:'_0==="expiring"'}},{t:4,n:51,f:[{t:7,e:"div",a:{class:"h4 -margins","data-test":"ntf_item-name"},f:[{t:3,x:{r:["nls","issue.id"],s:'_0("dashboard.problems."+_1)'}}]}," ",{t:4,f:[{t:7,e:"div",a:{class:"p -small g-break-word","data-test":"ntf_item-desc"},f:[{t:3,x:{r:["nls"],s:'_0("dashboard.problems.subscription_paid_expired.omni.desc")'}}]}],n:50,x:{r:["issue.id","isOmni"],s:'_0==="subscription_paid_expired"&&_1'}},{t:4,n:51,f:[{t:7,e:"div",a:{class:"p -small g-break-word","data-test":"ntf_item-desc"},f:[{t:3,x:{r:["nls","issue.id"],s:'_0("dashboard.problems."+_1+".desc")'}}]}],x:{r:["issue.id","isOmni"],s:'_0==="subscription_paid_expired"&&_1'}}],x:{r:["issue.id"],s:'_0==="expiring"'}}," ",{t:7,e:"div",a:{class:"g-margin-top--20"},f:[{t:4,f:[{t:4,f:[{t:7,e:"kin-button",v:{click:{n:"unignoreIssue",d:[{t:2,r:"issue.id"}]}},a:{type:"secondary",size:"small","data-test":"ntf_item-fix"},f:[{t:3,x:{r:["nls"],s:'_0("notifications.unignore")'}}]}],n:50,r:"issue.ignored"},{t:4,n:51,f:[{t:4,n:50,x:{r:["isAfb","isAfbSoho","isBuyBC","issue.id","isReseller"],s:"(_0&&_2(_3))||(_1&&_2(_3)&&_4)"},f:[{t:7,e:"p",a:{class:"p -small -margins"},f:[{t:4,f:[{t:3,x:{r:["nls"],s:'_0("dashboard.problems.subscription_business_reseller.action")'}}],n:50,r:"isReseller"},{t:4,n:51,f:[{t:3,x:{r:["nls"],s:'_0("dashboard.problems.subscription_business.action")'}}],r:"isReseller"}]}," ",{t:4,f:[{t:7,e:"kin-button",v:{click:{n:"ignoreIssue",d:[{t:2,r:"issue.id"}]}},a:{size:"small",type:"secondary","data-test":"ntf_item-ignore"},f:[{t:3,x:{r:["nls"],s:'_0("notifications.ignore")'}}]}],n:50,r:"issue.ignorable"}]},{t:4,n:50,x:{r:["isAfb","isAfbSoho","isBuyBC","issue.id","isReseller","issue.ignorable"],s:"(!((_0&&_2(_3))||(_1&&_2(_3)&&_4)))&&(_5)"},f:[" ",{t:7,e:"kin-button",a:{grouped:"true",size:"small","data-test":"ntf_item-fix"},v:{click:{n:"fixIssue",d:[{t:2,r:"issue.id"}]}},f:[{t:3,x:{r:["nls","issue.id"],s:'_0("dashboard.problems."+_1+".action")'}}]}," ",{t:7,e:"kin-dropdown",a:{class:"g-margin-left--5"},f:[{t:7,e:"div",a:{slot:"dropdown-activator"},f:[{t:7,e:"kin-button",a:{size:"small",type:"secondary",icononly:0,title:[{t:2,x:{r:["nls"],s:'_0("global.moreOptions")'}}]},f:[{t:7,e:"kin-icon",a:{name:"icon-s-controls-menu-more",size:"12"},f:[]}]}]}," ",{t:7,e:"kin-dropdown-item",v:{click:{n:"ignoreIssue",d:[{t:2,r:"issue.id"}]}},a:{"data-test":"ntf_item-ignore"},f:[{t:3,x:{r:["nls"],s:'_0("notifications.ignore")'}}]}]}]},{t:4,n:50,x:{r:["isAfb","isAfbSoho","isBuyBC","issue.id","isReseller","issue.ignorable"],s:"(!((_0&&_2(_3))||(_1&&_2(_3)&&_4)))&&(!(_5))"},f:[" ",{t:7,e:"kin-button",v:{click:{n:"fixIssue",d:[{t:2,r:"issue.id"}]}},a:{size:"small","data-test":"ntf_item-fix"},f:[{t:3,x:{r:["getExpiringText","nls","issue.id"],s:'_2==="expiring"?_0("action"):_1("dashboard.problems."+_2+".action")'}}]}]}],r:"issue.ignored"}],n:50,x:{r:["issue.id"],s:'_0!=="passive_mode_locked"'}}]}]}," ",{t:7,e:"div",a:{class:"banner__icon"},f:[{t:4,f:[{t:7,e:"div",a:{class:"avatar -notification"},f:[{t:7,e:"span",a:{class:"avatar__icon"},f:[{t:7,e:"Icon",a:{name:["shield",{t:4,f:["-danger"],n:50,x:{r:["priority"],s:"_0<4"}},{t:4,n:51,f:["-attention"],x:{r:["priority"],s:"_0<4"}}],cssCls:"g-font--32"}}]}]}],n:50,x:{r:["type"],s:'_0!=="alert"'}},{t:4,n:51,f:[{t:7,e:"Icon",a:{name:["shield",{t:4,f:["-danger"],n:50,x:{r:["priority"],s:"_0<4"}},{t:4,n:51,f:["-attention"],x:{r:["priority"],s:"_0<4"}}],cssCls:"g-font--40"}}],x:{r:["type"],s:'_0!=="alert"'}}]}]}]},data:function(){return{type:null,issue:null,isBuyBC:r.isBuyBcProblem,isAfb:r.isAfbEdition(),isAfbSoho:r.isAfbSoho(),isReseller:r.isReseller(),isOmni:"omni"===r.getProduct(),getExpiringText:function(t){let e;const i=r.getExpiration(),s=r.isTrial(),n=r.getProduct(),a=m(o.getProductStringId()),l="pro_av"===n,c="omni"===n;switch(t){case"title":e=m(s?"dashboard.problems.expiring.trial":"dashboard.problems.expiring",i);break;case"desc":e=c?m("dashboard.problems.expiring.omni.desc"):m(l?s?"dashboard.problems.expiring.trial.pro.desc":"dashboard.problems.expiring.pro.desc":s?"dashboard.problems.expiring.trial.desc":"dashboard.problems.expiring.desc",a);break;case"action":e=m(s?"dashboard.problems.expiring.trial.action":"dashboard.problems.expiring.action")}return e}}},oninit(){this.on("fixIssue",((t,i)=>{e.event("Notifications","Click",i+" - fix"),s("app.avService.FixIssue",{issueId:i}).then((()=>s("app.settings.ApplySettings"))).then((()=>this.emit("updateStatus")))})),this.on("ignoreIssue",((t,e)=>{s("app.avService.IgnoreIssue",{issueId:e,ignore:!0}).then((()=>this.emit("updateStatus")))})),this.on("unignoreIssue",((t,e)=>{s("app.avService.IgnoreIssue",{issueId:e,ignore:!1}).then((()=>this.emit("updateStatus")))}))}});const E=new class{dismissOldAvResolvedIssues(t){if(t.length>100){t.sort(((t,e)=>e.Timestamp-t.Timestamp));for(let e=99;e<t.length;e++)s("app.notificationCenter.RemoveItem",t[e].ItemUID).catch((t=>{console.error("app.notificationCenter.RemoveItem failed",t)}))}}loadOmniNotifications(t){return n.importModule("Smarthome","store").then((e=>e.loadNotifications(t))).catch((t=>(console.log(t),[])))}loadDarkWebMonitorNotifications(){return n.importModule("DarkWebMonitor","notificationService").then((t=>t.loadNotifications())).catch((t=>(console.log(t),[])))}getIssuesCount(){return this.getIssues(!0).then((t=>t.unresolvedIssues.length+t.persistentAvIssues.length)).catch((t=>(console.error("Notifications getIssuesCount failed",t),0)))}getIssues(t){const e=[],i="omni"===r.getProduct();return e.push(s("app.notificationCenter.GetStatus")),i?(e.push(this.loadOmniNotifications(t)),e.push(s("app.ring.stateInfo"))):(e.push(Promise.resolve([])),e.push(Promise.resolve([]))),this.hasDwmPromise||(this.hasDwmPromise=l.getValue("avdef://config/GuiCache/EnableDarkWeb").then((t=>"1"===t))),e.push(this.hasDwmPromise.then((t=>t?this.loadDarkWebMonitorNotifications():[]))),e.push(r.update()),Promise.all(e).then((([t,e,s,n])=>{t.Items.forEach((t=>{t.Timestamp=1e3*t.Timestamp}));const a=e.filter((t=>!t.resolved)),o=e.filter((t=>t.resolved)),l=t.Items.filter((t=>!t.Viewed)),c=t.Items.filter((t=>t.Viewed));this.dismissOldAvResolvedIssues(c);let d=o.concat(c);d.sort(((t,e)=>e.Timestamp-t.Timestamp)),d=d.slice(0,100);const m=a.concat(l).concat(n);m.sort(((t,e)=>e.Timestamp-t.Timestamp));const f=r.getState().issues;let p=[];const u=[];for(const i in f)f[i]&&(f[i].id=i,f[i].ignored?u.push(f[i]):p.push(f[i]));return p.sort(((t,e)=>t.priority-e.priority)),u.sort(((t,e)=>t.priority-e.priority)),i&&s&&["CHILD_PAIRING","CHILD_FINISHED"].includes(s.state)&&(p=p.filter((t=>"expiring"!==t.id&&"subscription_paid_expired"!==t.id))),{resolvedIssues:d,unresolvedIssues:m,persistentAvIssues:p,ignoredPersistentAvIssues:u}}))}},N=d.createLogger("notifications.index"),B="omni"===r.getProduct(),R=B,L=[{id:"ntf_alerts",title:"notifications.tabs.alerts",emptyTitle:"notifications.noAlerts.title",emptyDesc:B?"notifications.noAlerts.omni.desc":"notifications.noAlerts.desc",type:"alert",issues:[],items:[]},{id:"ntf_activities",title:B?"notifications.tabs.resolved":"notifications.tabs.history",type:"activity",dismisAllAllowed:!B,issues:[],items:[]},{id:"ntf_ignoredIssues",title:"notifications.tabs.ignoredIssues",type:"ignored",issues:[],items:[]}],P=t.extend({template:{v:3,t:[{t:7,e:"Screen",f:[{t:7,e:"div",a:{class:"tab__sticky","data-test":"ntf_area"},f:[{t:7,e:"div",a:{class:"tab__wrap nui_caption_client-overlay"},f:[{t:4,f:[{t:7,e:"button",a:{role:"tab","aria-selected":[{t:2,x:{r:["selectedTab.id","./id"],s:"_0===_1"}}],class:["tab ntf_tab ",{t:2,x:{r:["emptyTitle","emptyDesc","issues.length","items.length"],s:'!_0&&!_1&&_2===0&&_3===0?"-disabled":""'}}," ",{t:2,x:{r:["selectedTab.id","./id"],s:'_0===_1?"-active":""'}}],disabled:[{t:2,x:{r:["emptyTitle","emptyDesc","issues.length","items.length"],s:"!_0&&!_1&&_2===0&&_3===0"}}],"data-test":["ntf_tab-",{t:2,r:"type"}]},v:{click:{m:"selectTab",a:{r:["."],s:"[_0]"}}},f:[{t:4,f:[{t:7,e:"h3",a:{title:[{t:2,x:{r:["nls"],s:'_0("notifications")'}}]},f:[{t:2,x:{r:["nls","./title"],s:"_0(_1)"}}]}],n:50,x:{r:["selectedTab.id","./id"],s:"_0===_1"}},{t:4,n:51,f:[{t:2,x:{r:["nls","./title"],s:"_0(_1)"}}],x:{r:["selectedTab.id","./id"],s:"_0===_1"}}]}],n:52,r:"tabs"}]}," ",{t:7,e:"div",a:{class:"tab__scroll",id:[{t:2,r:"scrollElmId"}]},f:[{t:4,f:[{t:4,f:[{t:7,e:"div",a:{id:[{t:2,r:"id"}],class:["ntf_section ",{t:2,x:{r:["scrollBetweenTabs"],s:'!_0?"ntf_section_no_scroll_between":""'}}]},f:[{t:4,f:[{t:7,e:"h3",a:{class:"h6 g-margin-bottom--20"},f:[{t:3,x:{r:["nls","title"],s:"_0(_1)"}}]}],n:50,x:{r:["scrollBetweenTabs","@index"],s:"_0&&_1>0"}}," ",{t:4,f:[{t:7,e:"div",a:{class:"g-align--right"},f:[{t:7,e:"button",a:{class:"a g-margin-right--10 checklist__item -btn"},v:{click:{n:"dismissAll",d:[{t:2,r:"."}]}},f:[{t:3,x:{r:["nls"],s:'_0("global.dismissAll")'}}]}]}],n:50,r:"dismisAllAllowed"}," ",{t:4,f:[{t:7,e:"Item",a:{type:[{t:2,r:"type"}],item:[{t:2,r:"."}]}}],n:52,r:"items"}," ",{t:4,f:[{t:7,e:"Issue",a:{type:[{t:2,r:"type"}],issue:[{t:2,r:"."}]}}],n:52,r:"issues"}]}],n:50,x:{r:["scrollBetweenTabs","selectedTab.id","id","issues.length","items.length"],s:"(_0||_1===_2)&&(_3||_4)"}},{t:4,n:51,f:[{t:4,n:50,x:{r:["scrollBetweenTabs","selectedTab.id","id","emptyTitle","emptyDesc"],s:"(_0||_1===_2)&&_3&&_4"},f:[{t:7,e:"div",a:{id:[{t:2,r:"id"}],class:"ntf_section -empty"},f:[{t:7,e:"div",a:{class:"svg -empty-notifications ntf_icon","data-test":"ntf_empty_icon"}}," ",{t:7,e:"p",a:{class:"h4 -margins"},f:[{t:3,x:{r:["nls","emptyTitle"],s:"_0(_1)"}}]}," ",{t:7,e:"p",a:{class:"p -secondary -small"},f:[{t:3,x:{r:["nls","emptyDesc"],s:"_0(_1)"}}]}]}]}],x:{r:["scrollBetweenTabs","selectedTab.id","id","issues.length","items.length"],s:"(_0||_1===_2)&&(_3||_4)"}}],n:52,r:"tabs"}]}]}]}]},css:".ntf_section_no_scroll_between .banner.-ignored {\n opacity: 1 !important;\n}\n.ntf_tab {\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n width: 33.33%;\n}\n.ntf_section {\n padding: 2rem 0;\n margin: 2rem 0;\n border-bottom: solid 1px var(--table-border);\n}\n.ntf_section:first-child {\n margin-top: 0;\n padding-top: 0;\n}\n.ntf_section:last-of-type {\n margin-bottom: 0;\n border-bottom: 0;\n}\n.ntf_section.-empty {\n text-align: center;\n}\n.ntf_item {\n padding: 2rem 0;\n margin: 0 auto;\n display: flex;\n flex-flow: row;\n justify-content: space-between;\n align-items: center;\n position: relative;\n text-align: start;\n}\n.ntf_icon {\n margin: 1rem 0 2rem;\n font-size: 24rem;\n}\n",components:{Item:D,Issue:C},data:()=>({scrollElmId:"ntf_scroll_elm",tabs:L,selectedTab:L[0],scrollBetweenTabs:R}),oninit(){this.listeners=[],this.on("*.closeNotifications",(()=>{a.emit("nui.overlay.close")})),this.on("dismissAll",((t,e)=>{if(e&&e.items){const t=[];for(const i of e.items)t.push(s("app.notificationCenter.RemoveItem",i.ItemUID));Promise.allSettled(t).then((()=>{this.updateStatus()}))}})),this.on("Item.itemActionFired",(()=>{N.debug("item action fired"),this.fire("closeNotifications")})),this.on("Item.itemActionDone",(()=>{N.debug("item action done"),this.updateStatus()})),this.on("Item.itemRemoved",(()=>{N.debug("item removed.. updating product model"),this.updateStatus()})),a.on("dwmIssuesUpdate",(()=>{this.updateStatus()})),this.listeners.push(a.on("notificationCenter.onStatusChanged.insertItem",(t=>{N.debug("notificationCenter.onStatusChanged.insertItem",t),this.updateStatus()}))),this.listeners.push(a.on("product.change.state",(()=>{this.updateStatus()}))),this.on("*.updateStatus",(()=>{this.updateStatus()})),this.updateStatus()},initScroll(){this.scrollElm=this.find("#ntf_scroll_elm");const t=this.find("#"+L[0].id),e=t.getBoundingClientRect();this.removeScrollListener(),this.scrollElm&&(this.handleScroll=()=>this.scrollElm.scrollTop<e.height?this.set("selectedTab",t):L.forEach(((t,e)=>{const i=this.find("#"+t.id);i&&this.scrollElm.scrollTop>i.offsetTop-this.scrollElm.clientHeight&&this.set("selectedTab",t)})),this.addScrollListener())},selectTab(t){R?(this.removeScrollListener(),this.scrollToElm(t.id),this.set("selectedTab",t),setTimeout((()=>{this.addScrollListener()}))):(this.set("selectedTab",t),this.scrollToElm(t.id))},scrollToElm(t){const e=this.find("#"+t);e&&e.scrollIntoView({block:"start"})},removeScrollListener(){this.scrollElm&&this.handleScroll&&this.scrollElm.removeEventListener("scroll",this.handleScroll)},addScrollListener(){this.scrollElm&&this.handleScroll&&this.scrollElm.addEventListener("scroll",this.handleScroll)},sendIssuesGA(){if(!this._gaSent){const t=this.get("tabs"),i={alert:"Number of alerts",activity:"Number of activities",ignored:"Number of ignored issues"};t.forEach((t=>{const s=t.issues.length+t.items.length;e.event("Notifications",i[t.type],s>20?"20+":s)})),this._gaSent=!0}},updateStatus:A((function(){E.getIssues(!1).then((t=>{if(this.merge("tabs[0].items",t.unresolvedIssues,{compare:"ItemUID"}),this.merge("tabs[0].issues",t.persistentAvIssues,{compare:"id"}),this.merge("tabs[1].items",t.resolvedIssues,{compare:"ItemUID"}),this.merge("tabs[2].issues",t.ignoredPersistentAvIssues,{compare:"id"}),this.screenReady(),this.sendIssuesGA(),R)this.initScroll();else{const e=this.get("selectedTab.id");(e===L[1].id&&0===t.resolvedIssues.length||e===L[2].id&&0===t.ignoredPersistentAvIssues.length)&&this.selectTab(L[0])}})).catch((t=>{console.error("updating status failed",t)}))}),500),onteardown(){this.listeners.forEach((t=>{t()})),this.removeScrollListener()}});export default P;export{E as serviceProxy};const j={name:"Notifications",version:"1.2.351",created:"2021-03-09T09:12:09.759Z"};export{j as metadata};