import{_ as H,a as M}from"./CJ26lxUV.js";import{_ as T}from"./D7TmchvX.js";import O from"./DgZ9OEJo.js";import{_ as j}from"./dbr-bJEC.js";import{_ as z}from"./CEdIFHZn.js";import{_ as R}from"./BR_ubjDa.js";import{_ as q}from"./ncYpbZOT.js";import{v as F,x as G,y as L,z as B,A as J,r as K,B as v,_ as Q,c as W,a as s,t as l,p as S,q as X,b as o,w as m,C as Y,o as p,d as I}from"./CChoqk00.js";import{u as Z}from"./B1YZX18f.js";import{u as $}from"./DTzhji9-.js";import{m as ee}from"./4Fu3KWqy.js";import"./sP9qBMVh.js";import"./oBAm95WQ.js";import"./Ba4kvkeX.js";import"./Du23p2ZK.js";import"./BBOawLyY.js";const te=F({__name:"index",async setup(n,{expose:_}){_();let t,e;const u=G(),{getChartData:h,getMissedAlerts:c}=Z(),{data:f,error:x,status:g}=([t,e]=L(()=>h()),t=await t,e(),t),d=B().getDashboardLink(),{t:w}=J(),{tracker:a}=$(),r=K(!1),y=["CPU","CPULoadAverage","TopProcesses"];a("mini_app_page_view","page","miniapp");const{data:U,error:b,status:k}=([t,e]=L(()=>c()),t=await t,e(),t),N=v(()=>{var i,A;return k.value==="pending"||b.value?0:((A=(i=U.value)==null?void 0:i.data)==null?void 0:A.alerts)||0}),C=v(()=>{const i=window.sessionStorage.getItem("dismissedUpsell");return i?ee(i,new Date().toISOString())/60>24:!0}),P=v(()=>!u.userIsLoggedIn&&k!=="pending"&&!r.value&&C.value),V=()=>{a("dismiss_upsell_for_24_hours","click_on","miniapp_upsell"),window.sessionStorage.setItem("dismissedUpsell",new Date().toISOString()),r.value=!0},E=B().getSignupLink(),D={UStore:u,getChartData:h,getMissedAlerts:c,data:f,error:x,status:g,dashboardLink:d,t:w,tracker:a,dismissedUpsell:r,titles:y,alertsData:U,alertsError:b,alertsStatus:k,alertCount:N,dismissedDateFarEnough:C,showUpsell:P,handleDismissUpsell:V,signupLink:E};return Object.defineProperty(D,"__isScriptSetup",{enumerable:!1,value:!0}),D}}),se={class:"flex @[450px]/whmmini:flex-row flex-col items-center justify-between gap-4 mb-4"},oe={class:"flex items-center gap-4 self-start @[450px]/whmmini:self-auto pl-2 @[400px]/whmmini:pl-0"},ne={class:"whmHeadline text-xl"},ae={class:"flex items-center gap-2"},re={class:"flex items-start self-start @[450px]/whmmini:self-auto pl-2 @[400px]/whmmini:pl-0"},ie={class:"font-medium text-2xl mb-4 text-white"},le={class:"text-sm w-56 text-balance mb-4 md:mb-16 leading-5 text-white"},me={class:"bg-white p-5 whmCard"};function _e(n,_,t,e,u,h){const c=M,f=H,x=T,g=O,d=j,w=z,a=R,r=q;return p(),W("div",null,[s("header",se,[s("div",oe,[s("h2",ne,l(e.t("ServerMonitoring")),1),s("div",ae,[e.UStore.userDetails.isAnonymous?X("",!0):(p(),S(c,{key:0})),o(f)])]),s("div",re,[o(x,{to:e.dashboardLink,class:"text-primary text-sm hover:underline","data-testid":"link-view-reports"},{default:m(()=>[I(l(n.$t("ViewReports")),1)]),_:1},8,["to"])])]),o(r,{"modal-style":!0,"custom-style":"mt-16",dismissable:!0,"dismiss-state":!e.showUpsell||e.dismissedUpsell},Y({default:m(()=>[s("div",me,[e.status!=="pending"?(p(),S(w,{key:0,data:e.data.data,titles:e.titles,layout:"thirdColumGridSmaller","chart-height":"360px"},null,8,["data"])):(p(),S(a,{key:1,error:e.error},null,8,["error"]))])]),_:2},[e.showUpsell&&e.alertsStatus!=="pending"?{name:"upsell",fn:m(()=>[o(d,{class:"absolute top-4 right-4","data-testid":"close-upsell",onClick:e.handleDismissUpsell},{default:m(()=>[o(g,{name:"clarity:close-line",class:"size-8 text-white duration-300 hover:text-primary hover:cursor-pointer"})]),_:1}),s("h2",ie,l(n.$t("MissedAlerts",{n:e.alertCount})),1),s("p",le,l(n.$t("MissedAlertsSentence")),1),o(d,{palette:"lightgray",class:"px-6",to:e.signupLink,"data-testid":"mini-modal__signup-button",onClick:_[0]||(_[0]=y=>e.tracker("signup_reminder","click_on","/signup"))},{default:m(()=>[I(l(n.$t("SignUp")),1)]),_:1},8,["to"])]),key:"0"}:void 0]),1032,["dismiss-state"])])}const De=Q(te,[["render",_e],["__file","index.vue"]]);export{De as default};
