1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[55127],{55127:function(e,t,a){a.r(t),a.d(t,{default:function(){return v}});var s=a(65724),n=a(42920),r=a(22579),o=a(80710),i=a(34102),l=a(68125),c=a(2512),d=a(6749),u=a(89282),m=a(32862),p=a(79449),f=a(76205),x=a(28070);let h=e=>{try{return decodeURIComponent(decodeURIComponent(e))}catch(t){try{return decodeURIComponent(e)}catch(t){return e}}},g=e=>{let t=e.trim().toLowerCase();return t?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)?null:"Please enter a valid email":"Email is required"},b=(e,t)=>{let a=encodeURIComponent(e||"/community");document.cookie="stytch_auth_redirect=".concat(a,"; path=/; max-age=1800; samesite=lax"),document.cookie="stytch_auth_type=".concat(t,"; path=/; max-age=1800; samesite=lax"),sessionStorage.setItem("stytch_auth_redirect",e||"/community"),sessionStorage.setItem("stytch_auth_type",t)},w=(0,c.forwardRef)(function(e,t){let{label:a,rightSlot:n,id:r,value:o,className:i,...l}=e,d=(0,c.useId)(),u=r||d,m="string"==typeof o?o.length>0:!!o;return(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{ref:t,id:u,value:o,placeholder:" ",className:(0,f.cn)("peer h-14 w-full rounded-[4px] border border-[#cfd9de] bg-white px-4 pt-3 text-[15px] text-[#0f0f0f]","placeholder-transparent focus:border-[#0f0f0f] focus:outline-none focus:ring-0","transition-colors disabled:opacity-60",n?"pr-12":"",i),...l}),(0,s.jsx)("label",{htmlFor:u,className:(0,f.cn)("pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 bg-white px-1 text-[15px] text-[#536471] transition-all","peer-focus:top-0 peer-focus:-translate-y-1/2 peer-focus:text-[12px] peer-focus:text-[#0f0f0f]",m&&"top-0 -translate-y-1/2 text-[12px] text-[#0f0f0f]"),children:a}),n&&(0,s.jsx)("div",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:n})]})}),y=()=>(0,s.jsxs)("svg",{viewBox:"0 0 24 24",className:"h-[18px] w-[18px]","aria-hidden":"true",children:[(0,s.jsx)("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),(0,s.jsx)("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),(0,s.jsx)("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),(0,s.jsx)("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]});function v(e){let{open:t,onOpenChange:a,initialMode:v="login",communityId:j,communityName:N,communitySlug:C,communityLogo:k,communityPrimaryColor:S,redirectUrl:_}=e,P=N?h(N):"",I=P.length>0,L=S||"#4f46e5",E=P.charAt(0).toUpperCase()||"C",R=(0,p.getSupabaseBrowserClient)(),[F,z]=(0,c.useState)(v),[U,T]=(0,c.useState)(""),[Z,q]=(0,c.useState)(""),[B,D]=(0,c.useState)(!1),[V,M]=(0,c.useState)(""),[O,G]=(0,c.useState)(""),[H,A]=(0,c.useState)(""),[W,$]=(0,c.useState)(!1),[J,K]=(0,c.useState)(!1),Y=(0,c.useRef)(null);(0,c.useEffect)(()=>{t&&z(v)},[t,v]),(0,c.useEffect)(()=>{A(""),q(""),D(!1),"login"===F&&(M(""),G(""))},[F]),(0,c.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>{var e;return null===(e=Y.current)||void 0===e?void 0:e.focus()},80);return()=>clearTimeout(e)},[t,F]);let Q=(0,c.useMemo)(()=>_||(C?"/".concat(C):j?"/community/".concat(j):"/community"),[_,C,j]),X=(0,c.useMemo)(()=>{let e=new URLSearchParams;j&&e.set("communityId",j),C&&e.set("slug",C),N&&e.set("communityName",N),Q&&e.set("redirectUrl",Q);let t=e.toString();return t?"/forgot-password?".concat(t):"/forgot-password"},[j,C,N,Q]),ee=(0,c.useCallback)(async e=>{try{await Promise.race([R.auth.setSession({access_token:e.access_token,refresh_token:e.refresh_token}).then(e=>{let{error:t}=e;t&&console.error("setSession warning:",t.message)}),new Promise(e=>setTimeout(e,1500))])}catch(e){console.error("bridgeSupabaseSession error (ignored):",e)}await new Promise(e=>setTimeout(e,80))},[R]),et=(0,c.useCallback)(e=>{let t=e||"/community";try{let e=new URL(t,window.location.origin);e.searchParams.delete("modal");let a=window.location.pathname+window.location.search,s=e.origin===window.location.origin,n=s?e.pathname+e.search+e.hash:e.toString();if(s&&a===e.pathname+e.search){window.location.reload();return}t=n}catch(e){}try{window.location.replace(t)}catch(e){window.location.href=t}},[]),ea=(0,c.useCallback)(async()=>{K(!0),A("");try{b(Q,"oauth");let e=new URL("/api/stytch/oauth",window.location.origin);e.searchParams.set("provider","google"),e.searchParams.set("start","1"),e.searchParams.set("redirect",Q);let t=await fetch(e.toString()),a=await t.json();if(!t.ok||!a.redirect_url)throw Error(a.error||"Failed to start Google sign in");window.location.assign(a.redirect_url)}catch(e){A((null==e?void 0:e.message)||"Failed to continue with Google. Please try again."),K(!1)}},[Q]),es=(0,c.useCallback)(async e=>{e.preventDefault(),A("");let t=g(U);if(t)return A(t);if(!Z)return A("Please enter your password");$(!0);try{var a;let e=await fetch("/api/stytch/passwords",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:U.trim().toLowerCase(),password:Z})}
1),t=await e.json();if(!e.ok||!t.success)throw Error(t.message||"Sign in failed");let s=null===(a=t.data)||void 0===a?void 0:a.session;if(!(null==s?void 0:s.access_token)||!(null==s?void 0:s.refresh_token))throw Error("No session returned from authentication");await ee(s),(0,m.yl)(),et(Q)}catch(t){let e="string"==typeof(null==t?void 0:t.message)?t.message:"Sign in failed";A(e.toLowerCase().includes("credential")||e.toLowerCase().includes("invalid login")||e.toLowerCase().includes("invalid email or password")?"Invalid email or password. Please try again.":e),$(!1)}},[U,Z,ee,Q]),en=(0,c.useCallback)(async e=>{if(e.preventDefault(),A(""),!V.trim())return A("First name is required");if(!O.trim())return A("Last name is required");let t=g(U);if(t)return A(t);if(!Z||Z.length<8)return A("Password must be at least 8 characters");$(!0);try{var a;let e=await fetch("/api/stytch/signup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:U.trim().toLowerCase(),password:Z,name:"".concat(V.trim()," ").concat(O.trim()).trim()})}),t=await e.json();if(!e.ok||!t.success)throw Error(t.message||"Sign up failed");let s=null===(a=t.data)||void 0===a?void 0:a.session;if(!(null==s?void 0:s.access_token)||!(null==s?void 0:s.refresh_token))throw Error("No session returned after signup");await ee(s),et("/onboarding?next=".concat(encodeURIComponent(Q)))}catch(e){A((null==e?void 0:e.message)||"Sign up failed"),$(!1)}},[V,O,U,Z,ee,Q]),er=W||!U.trim()||!Z,eo=W||!V.trim()||!O.trim()||!U.trim()||Z.length<8,ei=W||J,el=(0,s.jsx)("button",{type:"button",tabIndex:-1,onClick:()=>D(e=>!e),className:"text-[#536471] transition-colors hover:text-[#0f0f0f]","aria-label":B?"Hide password":"Show password",children:B?(0,s.jsx)(n.Z,{className:"h-4 w-4"}):(0,s.jsx)(r.Z,{className:"h-4 w-4"})});return(0,s.jsx)(u.Vq,{open:t,onOpenChange:a,children:(0,s.jsx)(u.cZ,{className:(0,f.cn)("gap-0 overflow-hidden border-0 bg-white p-0","max-h-[100dvh] overflow-y-auto sm:max-h-[92vh]","w-full max-w-[454px] sm:w-[calc(100%-32px)] sm:rounded-[12px]","rounded-none sm:rounded-[12px]","shadow-[0_20px_48px_-8px_rgba(15,15,15,0.18)]"),children:(0,s.jsxs)("div",{className:"px-6 pb-7 pt-7 sm:px-10 sm:pb-9 sm:pt-9",children:[(0,s.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,s.jsx)("div",{className:"mb-4",children:k?(0,s.jsx)(i.default,{src:k,alt:P||"Community",width:76,height:76,priority:!0,className:"h-[76px] w-[76px] rounded-[20px] object-cover shadow-[0_6px_20px_-4px_rgba(15,15,15,0.22)] ring-1 ring-black/5"}):(0,s.jsx)("div",{className:"flex h-[76px] w-[76px] items-center justify-center rounded-[20px] text-[30px] font-bold text-white shadow-[0_6px_20px_-4px_rgba(15,15,15,0.22)] ring-1 ring-black/5",style:{background:"linear-gradient(135deg, ".concat(L," 0%, ").concat(L,"cc 100%)")},"aria-hidden":"true",children:E})}),(0,s.jsx)(u.$N,{className:"text-[27px] font-extrabold leading-[1.15] tracking-[-0.02em] text-[#0f0f0f]",children:I?P:"login"===F?"Welcome back":"Create your account"}),(0,s.jsx)(u.Be,{className:"mt-2 text-[15px] leading-snug text-[#536471]",children:I?"login"===F?"Log in to access this community":"Sign up to join this community":"login"===F?"Log in to continue":"Free forever \xb7 No credit card required"})]}),(0,s.jsxs)("div",{className:(0,f.cn)("mt-7"),children:[void 0!==x&&("public-token-live-233c70d2-28a8-4cd8-af30-c25039d5857f".startsWith("public-token-live-")||"public-token-live-233c70d2-28a8-4cd8-af30-c25039d5857f".startsWith("public-token-test-"))&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",onClick:ea,disabled:ei,className:(0,f.cn)("group relative flex h-11 w-full items-center justify-center gap-2.5 rounded-full","border border-[#dadce0] bg-white transition-all hover:bg-[#f7f9f9] hover:shadow-sm","text-[14px] font-medium text-[#3c4043]","disabled:cursor-not-allowed disabled:opacity-60"),children:J?(0,s.jsx)(o.Z,{className:"h-5 w-5 animate-spin"}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(y,{}),(0,s.jsx)("span",{children:"Continue with Google"})]})}),(0,s.jsxs)("div",{className:"my-4 flex items-center gap-3",children:[(0,s.jsx)("div",{className:"h-px flex-1 bg-[#e5e7eb]"}),(0,s.jsx)("span",{className:"text-[11px] font-medium uppercase tracking-[0.08em] text-[#9ca3af]",children:"or"}),(0,s.jsx)("div",{className:"h-px flex-1 bg-[#e5e7eb]"})]})]}),H&&(0,s.jsx)("div",{className:"mb-3 rounded-md border border-red-200 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:H}),"login"===F?(0,s.jsxs)("form",{onSubmit:es,className:"space-y-3",children:[(0,s.jsx)(w,{ref:Y,label:"Email",type:"email",autoComplete:"email",value:U,onChange:e=>{T(e.target.value),A("")},disabled:ei}),(0,s.jsx)(w,{label:"Password",type:B?"text":"password",autoComplete:"current-password",value:Z,onChange:e=>{q(e.target.value),A("")},disabled:ei,rightSlot:el}),(0,s.jsx)("div",{className:"pb-1 pt-1",children:(0,s.jsx)(l.default,{href:X,className:"text-[14px] text-[#1d9bf0] hover:underline",children:"Forgot password?"})}),(0,s.jsx)(d.z,{type:"submit",disabled:er,className:(0,f.cn)("h-12 w-full rounded-[6px] text-[14px] font-bold uppercase tracking-wide","transition-colors",er?"cursor-not-allowed bg-[#e5e7eb] text-[#9ca3af] hover:bg-[#e5e7eb]":"bg-[#0f0f0f] text-white hover:bg-[#272727]"),children:W?(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[(0,s.jsx)(o.Z,{className:"h-4 w-4 animate-spin"})," Logging in..."]}):"Log In"}),(0,s.jsxs)("p",{className:"pt-3 text-center text-[14px] text-[#0f0f0f]",children:["Don't have an account?"," ",(0,s.jsx)("button",{type:"button",onClick:()=>z("signup"),className:"font-medium text-[#1d9bf0] hover:underline",children:"Sign up for free"})]})]}):(0,s.jsxs)("form",{onSubmit:en,className:"space-y-3",children:[(0,s.jsx)(w,{ref:Y,label:"First name",type:"text",autoComplete:"given-name",value:V,onChange:e=>{M(e.target.value),A("")},disabled:ei}),(0,s.jsx)(w,{label:"Last name",type:"text",autoComplete:"family-name",value:O,onChange:e=>{G(e.target.value),A("")},disabled:ei}),(0,s.jsx)(w,{label:"Email",type:"email",autoComplete:"email",value:U,onChange:e=>{T(e.target.value),A("")},disabled:ei}),(0,s.jsx)(w,{label:"Password",type:B?"text":"password",autoComplete:"new-password",value:Z,onChange:e=>{q(e.target.value),A("")},disabled:ei,rightSlot:el}),(0,s.jsx)(d.z,{type:"submit",disabled:eo,className:(0,f.cn)("mt-2 h-12 w-full rounded-[6px] text-[14px] font-bold uppercase tracking-wide","transition-colors",eo?"cursor-not-allowed bg-[#e5e7eb] text-[#9ca3af] hover:bg-[#e5e7eb]":"bg-[#0f0f0f] text-white hover:bg-[#272727]"),children:W?(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[(0,s.jsx)(o.Z,{className:"h-4 w-4 animate-spin"})," Creating..."]}):"Sign Up"}),(0,s.jsxs)("p",{className:"pt-2 text-center text-[12px] text-[#536471]",children:["By signing up, you accept our"," ",(0,s.jsx)("a",{href:"/legal?t=terms",target:"_blank",rel:"noopener noreferrer",className:"text-[#1d9bf0] hover:underline",children:"terms"})," ","and"," ",(0,s.jsx)("a",{href:"/legal?t=privacy",target:"_blank",rel:"noopener noreferrer",className:"text-[#1d9bf0] hover:underline",children:"privacy policy"}),"."]}),(0,s.jsxs)("p",{className:"pt-2 text-center text-[14px] text-[#0f0f0f]",children:["Already have an account?"," ",(0,s.jsx)("button",{type:"button",onClick:()=>z("login"),className:"font-medium text-[#1d9bf0] hover:underline",children:"Log in"})]})]})]}),(0,s.jsxs)("div",{className:"mt-7 flex items-center justify-center gap-1.5 border-t border-[#f0f0f0] pt-5",children:[(0,s.jsx)("span",{className:"text-[11px] font-medium tracking-wide text-[#9ca3af]",children:"Powered by"}),(0,s.jsx)(i.default,{src:"https://idanijjeygvcdmdhcmqs.supabase.co/storage/v1/object/public/public-assets/instaloops/instaloops-blu.png",alt:"Instaloops",width:68,height:20,className:"h-[15p
1x] w-auto object-contain opacity-60"})]})]})})})}},89282:function(e,t,a){a.d(t,{$N:function(){return h},Be:function(){return g},GG:function(){return u},PK:function(){return d},Vq:function(){return l},cN:function(){return x},cZ:function(){return p},fK:function(){return f},hg:function(){return c},t9:function(){return m}});var s=a(65724),n=a(61699),r=a(22273),o=a(2512),i=a(76205);let l=n.fC,c=n.xz,d=n.h_,u=n.x8,m=(0,o.forwardRef)((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(n.aV,{ref:t,className:(0,i.cn)("fixed inset-0 z-[200] bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...r})});m.displayName=n.aV.displayName;let p=(0,o.forwardRef)((e,t)=>{let{className:a,children:o,...l}=e;return(0,s.jsxs)(d,{children:[(0,s.jsx)(m,{}),(0,s.jsxs)(n.VY,{ref:t,className:(0,i.cn)("fixed left-[50%] top-[50%] z-[200] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-xl",a),...l,children:[o,(0,s.jsxs)(n.x8,{className:"absolute right-4 top-4 roun
1ded-full p-1 opacity-70 ring-offset-background transition-all duration-200 hover:bg-muted hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,s.jsx)(r.Z,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});p.displayName=n.VY.displayName;let f=e=>{let{className:t,...a}=e;return(0,s.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...a})};f.displayName="DialogHeader";let x=e=>{let{className:t,...a}=e;return(0,s.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a})};x.displayName="DialogFooter";let h=(0,o.forwardRef)((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(n.Dx,{ref:t,className:(0,i.cn)("text-lg font-semibold leading-none tracking-tight",a),...r})});h.displayName=n.Dx.displayName;let g=(0,o.forwardRef)((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(n.dk,{ref:t,className:(0,i.cn)("text-sm text-muted-foreground",a),...r})});g.displayName=n.dk.displayName},32862:function(e,t,a){a.d(t,{SO:function(){return r},yl:function(){return n}});let s="il_upgrade_prompt_pending",n=()=>{try{sessionStorage.setItem(s,"1")}catch(e){}},r=()=>{try{if("1"!==sessionStorage.getItem(s))return!1;return sessionStorage.removeItem(s),!0}catch(e){return!1}}}}]);
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.