"use strict";(()=>{vare={};e.id=3751,e.ids=[3220,3751],e.modules={30671:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){returnfunctione(t,r){returnrint?t[r]:"then"int&&"function"==typeoft.then?t.then(t=>e(t,r)):"function"==typeoft&&"default"===r?t:void0}}})},41531:(e,t,r)=>{r.r(t),r.d(t,{config:()=>P,default:()=>S,getServerSideProps:()=>E,getStaticPaths:()=>y,getStaticProps:()=>b,reportWebVitals:()=>v,routeModule:()=>w,unstable_getServerProps:()=>O,unstable_getServerSideProps:()=>k,unstable_getStaticParams:()=>D,unstable_getStaticPaths:()=>N,unstable_getStaticProps:()=>A});vars={};r.r(s),r.d(s,{default:()=>_,getServerSideProps:()=>j});varn=r(63865),a=r(9455),i=r(30671),o=r(5583),c=r(19796),l=r(8732),u=r(82015),p=r.n(u),m=r(16757),d=r(91258),h=r(92702),x=r(46169),f=r(1013),g=r(71934);function_({user:e,email:t,productionEnvironment:r,existingAlerts:s}){letn="Unsubscribe | Datasquirel",a="Unsubscribe from email alerts",i=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("title",{children:n}),(0,l.jsx)("meta",{name:"description",content:a}),(0,l.jsx)(d.A,{pageTitle:n,pageDescription:a,pagePathname:"/unsubscribe"})]}),[o,c]=p().useState(!1);return(0,l.jsx)(p().Fragment,{children:(0,l.jsx)(f.A,{head:i,user:e,productionEnvironment:r,children:(0,l.jsx)("main",{children:(0,l.jsxs)("section",{children:[o&&(0,l.jsx)(m.A,{}),(0,l.jsxs)("div",{className:"flex-col",children:[(0,l.jsx)("h1",{className:"text-2xl",children:"Unsubscribe from Email alerts"}),!t&&(0,l.jsxs)("p",{className:"max-w-md",children:["No email please ",(0,l.jsx)("a",{href:"/login",children:"Login"})," ","to Access Email Subscriptions or click on"," ",(0,l.jsx)("i",{children:'"unsubscribe"'})," from your mail box"]}),t&&(0,l.jsxs)("form",{className:"flex flex-col items-start gap-4",onSubmit:r=>{r.preventDefault(),c(!0);lets=r.target;(0,x.A)("/api/unsubscribe",{method:"post",body:{email:t,alerts:s.alerts_checkbox.checked,userId:e?.id?e.id:null}}).then(e=>{console.log(e),c(!1)})},children:[(0,l.jsx)("span",{className:"bg-slate-100 py-1 px-3 rounded-full",children:t}),(0,l.jsxs)("div",{className:"flex items-center gap-1",children:[(0,l.jsx)("input",{type:"checkbox",name:"alerts_checkbox",id:"alerts_checkbox",defaultChecked:!!s,className:"w-6 h-6"}),(0,l.jsx)("label",{htmlFor:"alerts_checkbox",className:"text-base whitespace-nowrap text-slate-800",children:"Alerts"})]}),(0,l.jsx)("button",{children:"Save Settings"})]})]})]})})})})}asyncfunctionj({req:e,res:t,query:r}){lets=process.env.DSQL_HOST_ENV,n=await(0,h.A)(e,t),a=r.email?r.email:n?.email?n.email:null,i=await(0,g.A)(`SELECT email FROM unsubscribes WHERE email='${a}' AND type='alerts'`);return{props:{user:n,email:a,productionEnvironment:s,existingAlerts:!i[0]}}}letS=(0,i.M)(s,"default"),b=(0,i.M)(s,"getStaticProps"),y=(0,i.M)(s,"getStaticPaths"),E=(0,i.M)(s,"getServerSideProps"),P=(0,i.M)(s,"config"),v=(0,i.M)(s,"reportWebVitals"),A=(0,i.M)(s,"unstable_getStaticProps"),N=(0,i.M)(s,"unstable_getStaticPaths"),D=(0,i.M)(s,"unstable_getStaticParams"),O=(0,i.M)(s,"unstable_getServerProps"),k=(0,i.M)(s,"unstable_getServerSideProps"),w=newn.PagesRouteModule({definition:{kind:a.A.PAGES,page:"/unsubscribe",pathname:"/unsubscribe",bundlePath:"",filename:""},components:{App:c.default,Document:o.default},userland:s})},91258:(e,t,r)=>{r.d(t,{A:()=>i});vars=r(8732),n=r(82015),a=r.n(n);functioni({pageTitle:e,pageDescription:t,pagePathname:r,aceEditor:n}){return(0,s.jsxs)(a().Fragment,{children:[(0,s.jsx)("link",{rel:"canonical",href:"http://localhost:7070"+r}),(0,s.jsx)("meta",{property:"og:url",content:"http://localhost:7070"+r}),(0,s.jsx)("meta",{itemProp:"url",content:"http://localhost:7070"+r}),(0,s.jsx)("meta",{name:"twitter:url",content:"http://localhost:7070"+r}),(0,s.jsx)("meta",{property:"og:title",content:e}),(0,s.jsx)("meta",{property:"og:description",content:t}),(0,s.jsx)("meta",{itemProp:"name",content:e}),(0,s.jsx)("meta",{itemProp:"description",content:t}),(0,s.jsx)("meta",{name:"twitter:title",content:e}),(0,s.jsx)("meta",{name:"twitter:description",content:t}),n&&(0,s.jsxs)(a()