import{r as g,_ as L,A as W,b as M,j as e,d7 as p,bq as v,W as C,cs as H,aA as R,bn as f,b2 as _,d8 as $,I as y,g as h,w,aC as N,x as b,O,m as F,d as P,X as V,V as o,y as k,aa as q,d9 as Q,c as A,a as E,da as U,db as X,e as S,a2 as G,dc as J,dd as K}from"./index-Bf3Szspx.js";import{I as T}from"./Icon-SjE0NP4G.js";import{B as Y}from"./Box-BF9Usm77.js";const Z=g.lazy(()=>L(()=>import("./index-Bf3Szspx.js").then(s=>s.gk),[]));function ee({children:s,bottom:n=null,collapse:t=!1,variant:i="temporary",setCollapse:a=()=>null,onClose:d=()=>null,...c}){const r=W("xs"),l=M(),m=l.formatMessage({id:"altLogo"}),x=l.formatMessage({id:"titleLogo"}),z=l.formatMessage({id:"common.collapseMenu"}),D=l.formatMessage({id:"common.openMenu"});return e.jsxs(p.Drawer,{variant:i,onClose:d,...c,className:t?"collapsed":"",classes:{paper:t?"collapsed":""},children:[e.jsxs(p.LogoWrapper,{children:[e.jsx(v,{onClick:d,to:C.dashboard,title:x,children:e.jsx(p.Logo,{src:H,height:21,alt:m,title:m,collapse:t})}),i==="permanent"&&e.jsx(R,{title:t?D:z,placement:"right",children:e.jsx(p.CollapseButton,{onClick:a,collapse:t,disableRipple:!0,children:t?e.jsx(T,{name:"menu_uncollapse",size:18}):e.jsx(T,{name:"double_arrow_left",size:14})})}),e.jsx(f,{mdUp:!0,children:e.jsx(p.CrossWrapper,{onClick:d,children:e.jsx(_,{})})})]}),e.jsx(f,{mdDown:!0,children:!$&&!r?e.jsx(Z,{autoHide:!0,style:{height:"calc(100vh - 108px)"},disableHorizontalScroll:!0,renderThumbVertical:B=>e.jsx("div",{...B,style:{...B.style,cursor:"pointer",borderRadius:"inherit",backgroundColor:"#8B8CA5"}}),children:e.jsx(p.Content,{children:s})}):e.jsx(p.AppleWrapper,{children:e.jsx(p.Content,{children:s})})}),e.jsx(f,{mdUp:!0,children:e.jsx(p.Content,{children:s})}),n]})}y("div")({width:"100%",height:1,backgroundColor:h.white,opacity:.2,margin:"20px 0"},"Line");const u={Dialog:w(s=>({paper:{padding:"62px 24px 24px",width:"100%",maxWidth:280,textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",[s.breakpoints.up("sm")]:{maxWidth:388,padding:"90px 40px 40px"}}}))(N),Text:y("p")(({theme:s})=>({fontSize:13,lineHeight:"24px",marginTop:20,marginBottom:32,fontWeight:500,color:h.gray.darkest,[s.breakpoints.up("md")]:{fontSize:16,lineHeight:"26px",marginTop:22,marginBottom:58}})),Button:w(s=>({root:{marginRight:12,width:"50%",minWidth:0,padding:0,[s.breakpoints.up("md")]:{marginRight:17},"&:last-child":{marginRight:0}}}))(b),ChildrenBox:y("div")({marginTop:16,width:"100%"})};function se({text:s,description:n="",closeText:t="",confirmText:i="",onConfirm:a,loading:d=!1,image:c=null,children:r,...l}){const m=M(),x=i||m.formatMessage({id:"common.yes"});return e.jsxs(u.Dialog,{...l,children:[c&&e.jsx("img",{width:"140",height:"140",src:c,alt:""}),e.jsx(u.Text,{children:s}),n&&e.jsx(u.Text,{children:n}),e.jsxs(Y,{display:"flex",children:[e.jsx(u.Button,{variant:"outlined",onClick:l.onClose,children:t||m.formatMessage({id:"common.cancel"})}),e.jsx(u.Button,{onClick:a,loading:d,children:x})]}),r&&e.jsx(u.ChildrenBox,{display:"flex",children:r})]})}function te({open:s,onClose:n}){const t=M(),i=O();return e.jsx(se,{open:s,text:t.formatMessage({id:"myQRCodes.subscribeMessage"}),confirmText:t.formatMessage({id:"common.buy"}),onConfirm:()=>{i.push(C.plansAndPayments),n()},onClose:n})}const ne=(s,n=!1)=>{const t=Math[n?"ceil":"floor"](s/864e5),i=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),a=Math.floor(s%(1e3*60*60)/(1e3*60));return{days:t,hours:i,minutes:a,expired:s<=0}},I=(s,n={})=>{const{enabled:t=!0,completeDay:i=!1}=n,a=s*1e3,[d,c]=g.useState(a-Date.now());return g.useEffect(()=>{if(t){const r=setInterval(()=>{const l=a-Date.now();c(l),l<0&&clearInterval(r)},1e3);return()=>clearInterval(r)}},[a,t]),ne(d,i)},ie=F((s,n,t)=>({content:{[s.breakpoints.down("sm")]:{padding:"16px 16px 0"}},title:{textAlign:"center",marginBottom:24,fontWeight:500,fontSize:24,lineHeight:"36px",[s.breakpoints.down("sm")]:{marginBottom:12,fontSize:18,lineHeight:"32px"}},counter:{marginBottom:24,display:"flex",justifyContent:"center",alignItems:"center",gap:"15px",[s.breakpoints.down("sm")]:{marginBottom:20,gap:"10px"}},counterItem:{display:"flex",flexDirection:"column",alignItems:"center",width:78,[s.breakpoints.down("sm")]:{width:60}},counterNumber:{display:"inline-block",height:44,marginBottom:9,fontSize:40,lineHeight:"44px",fontWeight:700,[s.breakpoints.down("sm")]:{height:32,marginBottom:3,fontSize:28,lineHeight:"32px"}},counterText:{display:"inline-block",height:12,fontSize:10,lineHeight:"12px",fontWeight:700,textTransform:"uppercase"},message:{textAlign:"center",color:h.gray.darkest,fontSize:13,lineHeight:"24px",[s.breakpoints.down("sm")]:{textAlign:"left",fontSize:12,lineHeight:"20px"},[`&.${t.messageTop}`]:{marginBottom:19,[s.breakpoints.down("sm")]:{marginBottom:20}},[`&.${t.messageBottom}`]:{marginBottom:28,[s.breakpoints.down("sm")]:{marginBottom:24}}},messageTop:{},messageBottom:{},bold:{fontWeight:700,color:h.black},list:{display:"flex",flexDirection:"column",gap:"8px",paddingLeft:29,marginBottom:22,[s.breakpoints.down("sm")]:{paddingLeft:0,gap:"12px",marginBottom:20},"& li":{display:"flex",alignItems:"center","& > svg":{marginRight:12},"& > p":{margin:0,fontWeight:700,fontSize:16,lineHeight:"30px",[s.breakpoints.down("sm")]:{fontSize:13,lineHeight:"20px"}}}},actions:{borderTop:`2px solid ${h.gray.normal}`,display:"flex",justifyContent:"space-between",paddingTop:24,[s.breakpoints.down("sm")]:{padding:"16px 24px",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px","& > button":{width:"100%"}}}})),oe=w(s=>({paper:{width:590,padding:"40px 40px 28px",[s.breakpoints.down("sm")]:{width:"calc(100vw - 40px)",padding:0}}}))(N);function j(s){return e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s,children:[e.jsx("circle",{cx:"10",cy:"10",r:"10",fill:"#FE4256"}),e.jsx("path",{d:"M7 7L13 13",stroke:"white",strokeWidth:"2"}),e.jsx("path",{d:"M7 13L13 7",stroke:"white",strokeWidth:"2"})]})}function ae({open:s=!1,onClose:n=()=>{}}){const t=ie(),{user:i}=P(({user:m})=>({user:m.user})),{days:a,hours:d,minutes:c,expired:r}=I(i.triallingEndsAt,{enabled:s}),l=V.unix(i.triallingEndsAt).format("LL");return e.jsxs(oe,{open:s,children:[e.jsxs("div",{className:t.content,children:[e.jsx("p",{className:t.title,children:e.jsx(o,{id:"modalTrialEndsAt.title"})}),e.jsxs("div",{className:t.counter,children:[e.jsxs("div",{className:t.counterItem,children:[e.jsx("span",{className:t.counterNumber,children:r?0:a}),e.jsx("span",{className:t.counterText,children:e.jsx(o,{id:"common.days"})})]}),e.jsxs("div",{className:t.counterItem,children:[e.jsx("span",{className:t.counterNumber,children:r?0:d}),e.jsx("span",{className:t.counterText,children:e.jsx(o,{id:"common.hours"})})]}),e.jsxs("div",{className:t.counterItem,children:[e.jsx("span",{className:t.counterNumber,children:r?0:c}),e.jsx("span",{className:t.counterText,children:e.jsx(o,{id:"common.smallMinutes"})})]})]}),e.jsx("p",{className:k([t.message,t.messageTop]),children:e.jsx(o,{id:"modalTrialEndsAt.messageTop",values:{date:l,bold:(...m)=>e.jsx("span",{className:t.bold,children:m})}})}),e.jsxs("ul",{className:t.list,children:[e.jsxs("li",{children:[e.jsx(j,{}),e.jsx("p",{children:e.jsx(o,{id:"modalTrialEndsAt.list.1"})})]}),e.jsxs("li",{children:[e.jsx(j,{}),e.jsx("p",{children:e.jsx(o,{id:"modalTrialEndsAt.list.2"})})]}),e.jsxs("li",{children:[e.jsx(j,{}),e.jsx("p",{children:e.jsx(o,{id:"modalTrialEndsAt.list.3"})})]}),e.jsxs("li",{children:[e.jsx(j,{}),e.jsx("p",{children:e.jsx(o,{id:"modalTrialEndsAt.list.4"})})]})]}),e.jsx("p",{className:k([t.message,t.messageBottom]),children:e.jsx(o,{id:"modalTrialEndsAt.messageBottom",values:{siteName:q}})})]}),e.jsxs("div",{className:t.actions,children:[e.jsx(b,{color:"secondary",variant:"outlined",onClick:n,children:e.jsx(o,{id:"common.close"})}),e.jsx(b,{component:v,to:C.plansAndPayments,onClick:n,children:e.jsx(o,{id:"common.upgradeNow"})})]})]})}function re({triallingEndsAt:s,hidden:n=!1}){const t=Q(),{days:i,expired:a}=I(s,{completeDay:!0}),[d,c]=g.useState(!1);return e.jsxs("div",{className:k(t.root,{[t.hidden]:n}),children:[e.jsxs("div",{className:t.content,children:[e.jsx(T,{name:"clock",size:20}),e.jsx("p",{children:a?e.jsx(o,{id:"trialEnds.expiredMessage"}):e.jsx(e.Fragment,{children:i===1?e.jsx(o,{id:"trialEnds.zeroMessage"}):e.jsx(o,{id:"trialEnds.message",values:{days:i}})})})]}),e.jsx(b,{size:"small",width:130,className:t.button,onClick:()=>c(!0),children:e.jsx(o,{id:"common.upgrade"})}),e.jsx(ae,{open:d,onClose:()=>c(!1)})]})}function le({onClose:s=()=>null,collapse:n=!1,setCollapse:t=()=>null,variant:i="temporary",...a}){const d=A(),{loggedIn:c,user:r,translationsReady:l,subscribeModalOpen:m}=E(({user:x})=>({loggedIn:x.loggedIn,user:x.user,translationsReady:x.translationsReady,subscribeModalOpen:x.subscribeModalOpen}));return e.jsxs(e.Fragment,{children:[e.jsx(ee,{onClose:s,collapse:n,setCollapse:t,variant:i,...a,bottom:c&&e.jsx(U.BottomWrapper,{children:(r.subscriptionInfo.isTrialling||r.subscriptionInfo.isTrialEnded)&&e.jsx(re,{triallingEndsAt:r.triallingEndsAt,hidden:n})}),children:l&&e.jsx(X,{onClick:s,collapse:n})}),e.jsx(te,{open:m,onClose:()=>d(S.setSubscribeModalOpen(!1))})]})}function de(){const s=E(i=>i.user.sidebarOpen),n=G(J.breakpoints.down(1600),{noSsr:!0}),t=A();return g.useEffect(()=>{const i=n?206:300;document.documentElement.style.setProperty("--sidebar-width",`${s?i:64}px`),s?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open")},[s,n]),e.jsx(f,{mdDown:!0,children:e.jsx(K.Container,{className:s?"open":"",children:e.jsx(le,{variant:"permanent",open:!0,collapse:!s,setCollapse:()=>t(S.toggleSidebar())})})})}const xe=g.memo(de);export{le as A,se as C,ae as M,xe as S,te as a,I as u};