1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[896],{37441:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/app/subscription",function(){return t(72100)}])},44498:function(e,n,t){"use strict";t.d(n,{Z:function(){return i}});/** 2 * @license lucide-react v0.395.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */let i=(0,t(1462).Z)("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]])},72100:function(e,n,t){"use strict";let i;t.r(n),t.d(n,{default:function(){return N}});var s=t(85893),r=t(7963),a=t(45161),o=t(57747),l=t(72177),c=t(93108),u=t(17731),d=t(75788),p=t(62430),m={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let g=new Uint8Array(16),f=[];for(let e=0;e<256;++e)f.push((e+256).toString(16).slice(1));var h=function(e,n,t){if(m.randomUUID&&!n&&!e)return m.randomUUID();let s=(e=e||{}).random||(e.rng||function(){if(!i&&!(i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return i(g)})();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,n){t=t||0;for(let e=0;e<16;++e)n[t+e]=s[e];return n}return function(e,n=0){return f[e[n+0]]+f[e[n+1]]+f[e[n+2]]+f[e[n+3]]+"-"+f[e[n+4]]+f[e[n+5]]+"-"+f[e[n+6]]+f[e[n+7]]+"-"+f[e[n+8]]+f[e[n+9]]+"-"+f[e[n+10]]+f[e[n+11]]+f[e[n+12]]+f[e[n+13]]+f[e[n+14]]+f[e[n+15]]}(s)},y=t(8348),b=t(31885),x=t(67294),j=t(73572),w=t(8648);/** 7 * @license lucide-react v0.395.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */let v=(0,t(1462).Z)("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);var _=t(39332),C=t(11163),k=t(57773),S=t(30423),P=t(91132);function N(){var e,n;let{free_plan:t,monthly_plans:i,annual_plans:m}=y.default,{t:g}=(0,b.$G)(),{appUser:f,paddle:N}=(0,p.a)(),I=(0,r.p)(),T=(0,C.useRouter)(),[O,E]=(0,x.useState)(!1),L=(0,_.useSearchParams)(),[U,D]=(0,x.useState)(!1),A=L.get("subscription_success"),M=L.get("_ptxn"),[z,R]=(0,x.useState)(!1),[q,Z]=(0,x.useState)({title:"",description:"",onConfirmSuccess:"",onConfirmLoading:""}),W=(null==f?void 0:f.plan)==="free",B=(0,x.useRef)(""),{colorMode:G}=(0,a.If)(),[J,V]=(0,x.useState)(null),F=(0,x.useRef)(null),K=(0,x.useRef)(!1);(0,x.useEffect)(()=>{let e=localStorage.getItem("subPageDiscountShowed");return(null==f?void 0:f.plan)!=="free"||null!==F.current||e||(F.current=setTimeout(()=>{K.current||(localStorage.setItem("subPageDiscountShowed","true"),R(!0))},9e4)),()=>{clearTimeout(F.current)}},[null==f?void 0:f.plan]);let H=async e=>{K.current=!0,window.gtag("event","conversion",{send_to:"AW-16653015203/q95KCNbHy9MZEKOx44Q-"});let n=h();null==N||N.Checkout.open({items:[{priceId:"monthlyLite"===e?"pri_01j687hjhd48b3m20ver8y0j9j":"monthlyPremium"===e?"pri_01j3xgm23mgy02j2pae4mbcg5n":"annualLite"===e?"pri_01j687g1nazk4t1spekyar4frd":"pri_01j3xgr7qdvxwsshet6x1ajnv4",quantity:1}],settings:{theme:"dark"===G?"dark":"light",allowLogout:!1,successUrl:window.location.origin+"/app/subscription-success?unique="+n},customData:{user_id:f._id},customer:{email:f.email}})},Q=async e=>{f.subscriptionId&&"free"!==f.plan?(B.current="monthlyLite"===e.price?"pri_01j687hjhd48b3m20ver8y0j9j":"monthlyPremium"===e.price?"pri_01j3xgm23mgy02j2pae4mbcg5n":"annualLite"===e.price?"pri_01j687g1nazk4t1spekyar4frd":"pri_01j3xgr7qdvxwsshet6x1ajnv4",Z({title:g("actions.upgradePlan"),description:g("messages.wantToUpgradePlan"),onConfirmSuccess:g("messages.upgradedPlanSuccessfully"),onConfirmLoading:g("app.upgradingPlan")}),E(!0)):H(e.price)};(0,x.useEffect)(()=>{f.subscriptionId&&X()},[f.subscriptionId]),(0,x.useEffect)(()=>{A&&(T.replace("/app/subscription",void 0,{shallow:!0}),I({title:g("messages.updateMessage"),status:"info",duration:9e3,isClosable:!0}),setTimeout(()=>{window.location.reload()},3e3)),M&&T.replace("/app/subscription",void 0,{shallow:!0})},[]);let X=async()=>{let e=await fetch("/api/subs/get_subscription?subscription_id="+f.subscriptionId);e.ok&&V((await e.json()).data)},Y=async()=>{let e=await fetch("/api/subs/cancel_subscription",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscription_id:f.subscriptionId})});if(e.ok)return I.closeAll(),I({title:g("messages.updateMessage"),status:"info",duration:9e3,isClosable:!0}),setTimeout(()=>{window.location.reload()},3e3),await e.json();throw Error("Something went wrong.")},$=async()=>{let e=await fetch("/api/subs/resume_subscription",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscription_id:f.subscriptionId})});if(e.ok)return I.closeAll(),I({title:g("messages.updateMessage"),status:"info",duration:9e3,isClosable:!0}),setTimeout(()=>{window.location.reload()},3e3),await e.json();throw Error("Something went wrong.")},ee=async()=>{let e=await fetch("/api/subs/upgrade_subscription",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscription_id:f.subscriptionId,price_id:B.current})});if(e.ok){let n=await e.json();return I.closeAll(),I({title:g("messages.updateMessage"),status:"info",duration:9e3,isClosable:!0}),setTimeout(()=>{window.location.reload()},3e3),n}throw Error("Something went wrong.")},en=e=>{var n;if(null==f?void 0:null===(n=f.scheduledChange)||void 0===n?void 0:n.action)return!1;if(W)return!0;
11if("monthlyPremium"===e){if(f.subscriptionId&&"monthlyLite"===f.plan)return!0}else if("annualPremium"===e){if("annualPremium"!==f.plan)return!0}else if("annualLite"===e&&f.subscriptionId&&("monthlyLite"===f.plan||"monthlyPremium"===f.plan))return!0;return!1},et=U?m:i;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(P.Z,{setDialogOpen:R,dialogOpen:z,discount:15,code:"P2AFT5YBBJ",showTimer:!1}),(0,s.jsx)(w.Z,{dialogOpen:O,setDialogOpen:E,title:q.title,description:q.description,onConfirm:()=>{I.promise(q.title===g("actions.resubscribe")?$():q.title===g("actions.cancelPlan")?Y():ee(),{success:{title:g("nouns.success"),description:q.onConfirmSuccess},error:{title:g("nouns.error"),description:g("messages.somethingWentWrong")},loading:{title:q.onConfirmLoading,description:g("nouns.pleaseWait")}})}}),(0,s.jsxs)("div",{className:"bg-background rounded-lg shadow-lg p-6 flex justify-between items-center ".concat(W?"":"mb-4"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)(j.qE,{className:"h-16 w-16",children:[(0,s.jsx)(j.F$,{src:f.picture||"/static/images/user_placeholder.jpg"}),(0,s.jsx)(j.Q5,{children:f.name.split(" ").map(e=>e[0]).join("")})]}),(0,s.jsxs)("div",{className:"flex-col ",children:[(0,s.jsx)("div",{className:"flex items-center justify-between",children:(0,s.jsxs)("div",{className:"text-xl font-semibold",children:[f.name," "]})}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)("span",{className:" rounded-full dark:bg-gray-800 dark:text-gray-200 bg-gray-100 px-2 py-1 text-sm font-semibold ",children:g("landing.pricing."+f.plan)})})]})]}),(0,s.jsx)("div",{children:(null==J?void 0:null===(e=J.management_urls)||void 0===e?void 0:e.update_payment_method)&&(0,s.jsx)(u.Z,{href:null==J?void 0:null===(n=J.management_urls)||void 0===n?void 0:n.update_payment_method,variant:"primary",leftIcon:(0,s.jsx)(v,{size:16}),onClick:()=>{var e;window.location.href=null==J?void 0:null===(e=J.management_urls)||void 0===e?void 0:e.update_payment_method},children:g("actions.updatePaymentMethod")})})]}),W&&(0,s.jsx)(o.xu,{className:"flex items-center justify-center h-6",textAlign:"center",maxW:"xl",mx:"auto",mb:"4",mt:"4",children:(0,s.jsx)(k.N,{landing:!1})}),(0,s.jsx)(S.m,{yearly:U,setYearly:D}),(0,s.jsx)(l.M,{columns:[1,2],spacing:4,children:null==et?void 0:et.map((e,n)=>{var t;return(0,s.jsxs)(d.OO,{title:e.title,description:e.description,price:e.price,sx:e.isRecommended?{borderColor:"primary.500",_dark:{borderColor:"primary.500",bg:"blackAlpha.300"}}:{},children:[(0,s.jsx)(d.jC,{children:e.features.map((e,n)=>e?(0,s.jsx)(d.zD,{...e},n):(0,s.jsx)("br",{},n))}),e.price===f.plan?f.subscriptionId?(null==f?void 0:null===(t=f.scheduledChange)||void 0===t?void 0:t.action)==="cancel"?(0,s.jsx)(c.z,{variant:"primary",onClick:()=>{Z({title:g("actions.resubscribe"),description:g("messages.wantToResubscribe"),onConfirmSuccess:g("messages.resubscribedSuccessfully"),onConfirmLoading:g("app.resubscribing")}),E(!0)},children:g("actions.resubscribe")}):(0,s.jsx)(c.z,{onClick:()=>{Z({title:g("actions.cancelPlan"),description:g("messages.wantToCancelPlan"),onConfirmSuccess:g("messages.cancelledPlanSuccessfully"),onConfirmLoading:g("app.cancellingPlan")}),E(!0)},colorScheme:"red",children:g("actions.cancelPlan")}):(0,s.jsx)(c.z,{variant:"primary",isDisabled:!0,children:g("sidebar.currentPlan")}):en(e.price)?(0,s.jsx)(c.z,{variant:"primary",onClick:()=>Q(e),children:g("actions.upgrade")}):null]},e.id)})})]})}},48783:function(e,n,t){"use strict";t.d(n,{g:function(){return a}});var i=t(55281),s=t(16554),r=t(85893),a=(0,s.G)((e,n)=>(0,r.jsx)(i.K,{align:"center",...e,direction:"column",ref:n}));a.displayName="VStack"},24880:function(e,n,t){"use strict";t.d(n,{C:function(){return c}});var i=t(16554),s=t(77030),r=t(33179),a=t(16914),o=t(25432),l=t(85893),c=(0,i.G)(function(e,n){let t=(0,s.mq)("Badge",e),{className:i,...c}=(0,r.Lr)(e);return(0,l.jsx)(a.m.span,{ref:n,className:(0,o.cx)("chakra-badge",e.className),...c,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...t}})});c.displayName="Badge"}},function(e){e.O(0,[409,545,888,774,179],function(){return e(e.s=37441)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.