1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f2a32577-951c-46c9-899c-dc7532fffac8",e._sentryDebugIdIdentifier="sentry-dbid-f2a32577-951c-46c9-899c-dc7532fffac8")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6808],{53687:function(e,t,a){"use strict";a.d(t,{ThemeProvider:function(){return s}});var n=a(57437);a(2265);var r=a(25922);function s(e){let{children:t,...a}=e;return(0,n.jsx)(r.f,{...a,children:t})}},71322:function(e,t,a){"use strict";a.d(t,{Qx:function(){return o},Zi:function(){return i},fy:function(){return s},hl:function(){return c},nx:function(){return l}});let n="https://api.semust.com";async function r(e){if(!e.ok){let t=await e.json().catch(()=>({})),a=Error(t.error||"Request failed");throw a.status=e.status,a.code=t.code,a.required=t.required,a}return e.json()}let s={getInsight:async e=>{let{userId:t,projectId:a,recommendationId:s,idToken:c}=e,i=await fetch("".concat(n,"/v2/users/").concat(t,"/projects/").concat(a,"/recommendations/").concat(s,"/insight"),{headers:{Authorization:"Bearer ".concat(c)}});return 204===i.status?null:r(i)},getSummary:async e=>{let{userId:t,projectId:a,idToken:s}=e;return r(await fetch("".concat(n,"/v2/users/").concat(t,"/projects/").concat(a,"/recommendations/summary"),{headers:{Authorization:"Bearer ".concat(s)}}))},getRecommendations:async e=>{let{userId:t,projectId:a,idToken:s,status:c="pending",source:i="",category:o="",priority:l="",page:u=1,limit:d=20,lang:f=""}=e,h=new URLSearchParams({status:c,page:u,limit:d});return i&&h.set("source",i),o&&h.set("category",o),l&&h.set("priority",l),f&&h.set("lang",f),r(await fetch("".concat(n,"/v2/users/").concat(t,"/projects/").concat(a,"/recommendations?").concat(h),{headers:{Authorization:"Bearer ".concat(s)}}))},generate:async e=>{let{userId:t,projectId:a,idToken:s}=e;return r(await fetch("".concat(n,"/v2/users/").concat(t,"/projects/").concat(a,"/recommendations/generate"),{method:"POST",headers:{Authorization:"Bearer ".concat(s)}}))},action:async e=>{let{userId:t,projectId:a,idToken:s,recommendationId:c,action:i,body:o,lang:l=""}=e,u=new URLSearchParams({action:i});return l&&u.set("lang",l),r(await fetch("".concat(n,"/v2/users/").concat(t,"/projects/").concat(a,"/recommendations/").concat(c,"?").concat(u),{method:"POST",headers:{Authorization:"Bearer ".concat(s),"Content-Type":"application/json"},body:o?JSON.stringify(o):void 0}))},getProgress:async e=>{let{userId:t,projectId:a,idToken:s}=e;return r(await fetch("".concat(n,"/v2/users/").concat(t,"/projects/").concat(a,"/recommendations/progress"),{headers:{Authorization:"Bearer ".concat(s)}}))}},c={get:async e=>{let{userId:t,idToken:a,kind:s="users",period:c="month",sort:i="total"}=e,o=new URLSearchParams({kind:s,period:c,sort:i});return r(await fetch("".concat(n,"/v2/users/").concat(t,"/leaderboard?").concat(o),{headers:{Authorization:"Bearer ".concat(a)}}))},winners:async e=>{let{userId:t,idToken:a}=e;return r(await fetch("".concat(n,"/v2/users/").concat(t,"/leaderboard/winners"),{headers:{Authorization:"Bearer ".concat(a)}}))},updateShare:async e=>{let{userId:t,idToken:a,season:s,shareName:c,shareLang:i}=e;return r(await fetch("".concat(n,"/v2/users/").concat(t,"/leaderboard/winners/").concat(s,"/share"),{method:"POST",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"},body:JSON.stringify({share_name:c,share_lang:i})}))}},i={get:async e=>{let{userId:t,idToken:a}=e;return r(await fetch("".concat(n,"/v2/users/").concat(t,"/tasks/email-prefs"),{headers:{Authorization:"Bearer ".concat(a)}}))},set:async e=>{let{userId:t,idToken:a,emailType:s,isSubscribed:c,enableGlobal:i=!1}=e;return r(await fetch("".concat(n,"/v2/users/").concat(t,"/tasks/email-prefs"),{method:"POST",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"},body:JSON.stringify({email_type:s,is_subscribed:c,enable_global:i})}))}},o=e=>"https://api.dicebear.com/10.x/adventurer/svg?seed=".concat(encodeURIComponent(e||"semust")),l={get:async e=>{let{userId:t,idToken:a}=e;return r(await fetch("".concat(n,"/v2/users/").concat(t,"/referrals"),{headers:{Authorization:"Bearer ".concat(a)}}))},claim:async e=>{let{userId:t,idToken:a,code:s}=e;return r(await fetch("".concat(n,"/v2/users/").concat(t,"/referrals/claim"),{method:"POST",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"},body:JSON.stringify({code:s})}))}}},55795:function(e,t,a){"use strict";a.d(t,{AmplitudeUserSync:function(){return c}});
1var n=a(2265),r=a(20688),s=a(92580);function c(){let{user:e,activePayment:t}=(0,r._)()||{},{setUserId:a,identify:c,isInitialized:i}=(0,s.i)();return(0,n.useEffect)(()=>{i&&((null==e?void 0:e.uid)?(a(e.uid),t&&c(e.uid,{email:e.email||void 0,plan_status:null==t?void 0:t.status,plan:null==t?void 0:t.plan,billing_type:null==t?void 0:t.billing_type,subscription_type:null==t?void 0:t.subscription_type})):a(null))},[e,t,i,a,c]),null}},84140:function(e,t,a){"use strict";a.d(t,{default:function(){return h}});var n=a(57437),r=a(2265),s=a(99376),c=a(20688),i=a(62869),o=a(28360),l=a(38706),u=a(89345),d=a(84286);function f(){let{userId:e,userEmail:t,idToken:a,setEmailVerified:s,hasPendingOTP:f}=(0,c._)(),h=(0,l.T_)("Components"),m="https://api.semust.com",[p,x]=(0,r.useState)(f?"otp":"initial"),[g,y]=(0,r.useState)(""),[b,v]=(0,r.useState)(!1),[w,j]=(0,r.useState)(""),[N,S]=(0,r.useState)(0),k=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(N<=0)return;let e=setInterval(()=>S(e=>e-1),1e3);return()=>clearInterval(e)},[N]),(0,r.useEffect)(()=>{"otp"===p&&k.current&&k.current.focus()},[p]);let _=async()=>{v(!0),j("");try{let t=await fetch("".concat(m,"/v2/users/").concat(e,"/send-otp"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(a)}}),n=await t.json();n.success?(x("otp"),S(60),y("")):j(h(n.error)||n.error)}catch(e){j(h("otpInvalid"))}finally{v(!1)}},z=async()=>{if(6===g.length){v(!0),j("");try{let t=await fetch("".concat(m,"/v2/users/").concat(e,"/verify-otp"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(a)},body:JSON.stringify({code:g})}),n=await t.json();n.success?s("verified"):(j(h(n.error)||n.error),y(""))}catch(e){j(h("otpInvalid"))}finally{v(!1)}}},T=async()=>{N>0||await _()};return(0,n.jsx)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",children:(0,n.jsxs)("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl border border-gray-200 dark:border-gray-700 p-8 w-full max-w-md mx-4",children:[(0,n.jsxs)("div",{className:"flex flex-col items-center mb-6",children:[(0,n.jsx)("div",{className:"w-16 h-16 bg-blue-50 dark:bg-blue-900/30 rounded-full flex items-center justify-center mb-4",children:"initial"===p?(0,n.jsx)(u.Z,{className:"w-8 h-8 text-blue-600 dark:text-blue-400"}):(0,n.jsx)(d.Z,{className:"w-8 h-8 text-blue-600 dark:text-blue-400"})}),(0,n.jsx)("h2",{className:"text-xl font-bold text-gray-900 dark:text-white text-center",children:h("otpTitle")}),(0,n.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center mt-2",children:"initial"===p?h("otpSubtitle",{email:t}):h("otpCodeSent",{email:t})}),"initial"===p&&(0,n.jsx)("p",{className:"text-xs text-gray-400 dark:text-gray-500 text-center mt-3",children:h("otpDescription")})]}),"initial"===p?(0,n.jsx)(i.z,{onClick:_,variant:"v2",className:"w-full h-12 text-base font-semibold",disabled:b,children:b?(0,n.jsx)(o.Z,{}):h("otpSendCode")}):(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("input",{ref:k,type:"text",inputMode:"numeric",maxLength:6,value:g,onChange:e=>{y(e.target.value.replace(/\D/g,""))},onKeyDown:e=>{"Enter"===e.key&&6===g.length&&z()},placeholder:h("otpPlaceholder"),className:"flex h-14 w-full rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 px-4 py-2 text-center text-2xl font-mono tracking-[0.5em] text-gray-900 dark:text-white placeholder:text-gray-400 placeholder:text-base placeholder:tracking-normal focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"}),(0,n.jsx)(i.z,{onClick:z,variant:"v2",className:"w-full h-12 text-base font-semibold",disabled:b||6!==g.length,children:b?(0,n.jsx)(o.Z,{}):h("otpVerifyButton")}),(0,n.jsx)("div",{className:"text-center",children:(0,n.jsx)("button",{onClick:T,disabled:N>0||b,className:"text-sm text-blue-600 dark:text-blue-400 hover:underline disabled:text-gray-400 disabled:no-underline disabled:cursor-not-allowed",children:N>0?h("otpResendTimer",{seconds:N}):h("otpResend")})})]}),w&&(0,n.jsx)("p",{className:"text-red-500 text-sm text-center mt-4",children:w})]})})}function h(e){let{children:t}=e,{user:a,loading:i,userActive:o,activePayment:l,emailVerified:u}=(0,c._)(),d=(0,s.useRouter)(),h=(0,s.usePathname)(),m=["/settings","/login","/register","/password-reset","/share"],p=e=>m.includes(e)||e.startsWith("/payments")||e.startsWith("/invite")||e.startsWith("/share");return(0,r.useEffect)(()=>
1{if(!i){if(a){let e=l&&"free_trial"===l.plan&&0===l.remaining_days,t=l&&("success"===l.status||"in_trial"===l.status);o&&(!e||t)||p(h)||h.startsWith("/api")||d.push("/payments?status=expired")}else p(h)||d.push("/login")}},[a,i,o,l,h]),(0,n.jsxs)(n.Fragment,{children:[!i&&a&&"pending"===u&&!h.startsWith("/first-step")&&(0,n.jsx)(f,{}),t]})}},37589:function(e,t,a){"use strict";a.d(t,{default:function(){return o}});var n=a(57437),r=a(20688),s=a(38706),c=a(30623);function i(){let{backendDown:e}=(0,r._)(),t=(0,s.T_)("Components");return e?(0,n.jsx)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-background",children:(0,n.jsxs)("div",{className:"flex flex-col items-center gap-6 text-center px-6 max-w-md",children:[(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("div",{className:"absolute inset-0 rounded-full bg-primary/10 animate-ping"}),(0,n.jsx)("div",{className:"relative flex items-center justify-center w-20 h-20 rounded-full bg-primary/10",children:(0,n.jsx)(c.Z,{className:"h-10 w-10 text-primary"})})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:t("maintenance.title")}),(0,n.jsx)("p",{className:"text-muted-foreground text-sm leading-relaxed",children:t("maintenance.description")})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,n.jsx)("div",{className:"h-4 w-4 border-2 border-primary border-t-transparent rounded-full animate-spin"}),t("maintenance.reconnecting")]}),(0,n.jsx)("p",{className:"border-t border-border/60 pt-4 text-xs leading-relaxed text-muted-foreground/80",children:t("maintenance.vpnNote")})]})}):null}function o(e){let{children:t}=e;return(0,n.jsxs)(r.H,{children:[t,(0,n.jsx)(i,{})]})}},98766:function(e,t,a){"use strict";a.d(t,{ReferralCapture:function(){return o}});var n=a(2265),r=a(20688),s=a(71322);let c="semust_ref",i=/^[A-Za-z0-9_-]{4,32}$/;function o(){let{user:e,loading:t}=(0,r._)()||{};return(0,n.useEffect)(()=>{try{let e=new URLSearchParams(window.location.search).get("ref");e&&i.test(e)&&localStorage.setItem(c,JSON.stringify({code:e,at:Date.now()}))}catch(e){}},[]),(0,n.useEffect)(()=>{if(t||!(null==e?void 0:e.uid))return;let a=function(){try{let e=JSON.parse(localStorage.getItem(c)||"null");if(!(null==e?void 0:e.code)||Date.now()-e.at>2592e6)return null;return e}catch(e){return null}}();a&&(async()=>{try{let t=await e.getIdToken();await s.nx.claim({userId:e.uid,idToken:t,code:a.code}),localStorage.removeItem(c)}catch(e){}})()},[e,t]),null}},56050:function(){}}]);
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.