PageSourceSearch

https://thepitchchapelhill.com/assets/auth-C8Y1DaRC.js

js thepitchchapelhill.com collected 2026-10-04 13:24:13 UTC 16,257 bytes, 1 lines download raw bytes

1import{s as P,r as o,j as e,u as re}from"./index-BiXu8FMX.js";import{c as ae,P as ne,a as L,u as ie,b as G,d as U,e as oe,f as ce,g as le,C as ue,h as F,i as de,L as I,I as R,B as D}from"./index-D3Dvtaho.js";import{i as he,a as pe,b as me,c as fe}from"./Ivy_Empty_Bar_Liquors_4.JPG.asset-C6DOcYOD.js";import{S as ge,E as we,L as be}from"./shield-check-oEf23hba.js";const xe=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],ve=ae("eye-off",xe);var ye={version:"1.1.2"},je="authorization_response",ke="/~oauth/initiate",Ne=["https://oauth.lovable.app","https://lovable.dev"],Ce="lovable://oauth-callback",Ee="http://127.0.0.1/iframe-oauth/callback",_e=500,Se=12e4;function Pe(t){let s;const a=new Promise(r=>{s=r}),n=r=>{if(!t.some(p=>r.origin===p))return;const d=r.data;!d||typeof d!="object"||d.type===je&&s(d.response)},u=()=>{window.removeEventListener("message",n)};return window.addEventListener("message",n),{cleanup:u,messagePromise:a}}function Ie(t){const s=window.screenX!==0||window.screenY!==0||!t,a=s?window.outerWidth*.5:window.screen.width*.5,n=s?window.outerHeight*.5:window.screen.height*.5,u=s?window.screenX+(window.outerWidth-a)/2:(window.screen.width-a)/2,r=s?window.screenY+(window.outerHeight-n)/2:(window.screen.height-n)/2;return{width:a,height:n,left:u,top:r}}function $(t,s){return t.state!==s?{error:new Error("State is invalid")}:t.error?t.error==="legacy_flow"?{error:new Error("This flow is not supported in Preview mode. Please open the app in a new tab to sign in.")}:{error:new Error(t.error_description??"Sign in failed")}:!t.access_token||!t.refresh_token?{error:new Error("No tokens received")}:{tokens:{access_token:t.access_token,refresh_token:t.refresh_token},error:null}}function Re(){const t=navigator.userAgent;return!!(/iPhone|iPad|iPod|Android/i.test(t)||/Macintosh/i.test(t)&&navigator.maxTouchPoints>1)}function Te(){return typeof crypto<"u"&&crypto.getRandomValues?[...crypto.getRandomValues(new Uint8Array(16))].map(t=>t.toString(16).padStart(2,"0")).join(""):Math.random().toString(36).substring(2)+Date.now().toString(36)}function Ae(t={}){const s=t.oauthBrokerUrl??ke,a=t.supportedOAuthOrigins??Ne;async function n(u,r={}){let m=!1;try{m=window.self!==window.top}catch{m=!0}const d=navigator.userAgent,p=/LovableApp\//.test(d),b=!p&&/lovable/i.test(d),v=Te();let f=r.redirect_uri??window.location.origin;p&&m?f=Ce:b&&m&&(f=Ee);const x=new URLSearchParams({...r.extraParams,provider:u,redirect_uri:f,state:v});if(!m)return window.location.href=`${s}?${x.toString()}`,{error:null,redirected:!0};!p&&!b&&x.set("response_mode","web_message");const j=`${s}?${x.toString()}`,N=b?[...a,window.location.origin]:a,{messagePromise:y,cleanup:g}=Pe(N);let c;if(Re())c=window.open(j,"_blank");else{const{width:h,height:C,left:k,top:S}=Ie(m);c=window.open(j,"oauth",`width=${h},height=${C},left=${k},top=${S}`)}if(!c&&(p||b)){let h;const C=new Promise((k,S)=>{h=setTimeout(()=>{S(new Error("OAuth timed out waiting for response"))},Se)});try{const k=await Promise.race([y,C]);return $(k,v)}catch(k){return{error:k instanceof Error?k:new Error(String(k))}}finally{h&&clearTimeout(h),g()}}if(!c)return g(),{error:new Error("Popup was blocked")};let l;const E=new Promise((h,C)=>{l=setInterval(()=>{c.closed&&(clearInterval(l),C(new Error("Sign in was cancelled")))},_e)});try{const h=await Promise.race([y,E]);return $(h,v)}catch(h){return{error:h instanceof Error?h:new Error(String(h))}}finally{clearInterval(l),g(),c?.close()}}return{signInWithOAuth:n}}typeof window<"u"&&(window.__lovable_cloud_auth_js_version=ye.version);function Le(t={}){return Ae(t)}const Oe=Le(),Me={auth:{signInWithOAuth:async(t,s)=>{const a=await Oe.signInWithOAuth(t,{...s,extraParams:{...s?.extraParams}});if(a.redirected||a.error)return a;try{await P.auth.setSession(a.tokens)}catch(n){return{error:n instanceof Error?n:new Error(String(n))}}return a}}};var T="Checkbox",[Be]=le(T),[He,O]=Be(T);function Ue(t){const{__scopeCheckbox:s,checked:a,children:n,defaultChecked:u,disabled:r,form:m,name:d,onCheckedChange:p,required:b,value:v="on",internal_do_not_use_render:f}=t,[x,j]=ie({prop:a,defaultProp:u??!1,onChange:p,caller:T}),[N,y]=o.useState(null),[g,c]=o.useState(null),l=o.useRef(!1),E=N?!!m||!!N.closest("form"):!0,h={checked:x,disabled:r,setChecked:j,control:N,setControl:y,name:d,form:m,value:v,hasConsumerStoppedPropagationRef:l,required:b,defaultChecked:_(u)?!1:u,isFormControl:E,bubbleInput:g,setBubbleInput:c};return e.jsx(He,{scope:s,...h,children:Fe(f)?f(h):n})}var W="CheckboxTrigger",V=o.forwardRef(({__scopeCheckbox:t,onKeyDown:s,onClick:a,...n},u)=>{const{control:r,value:m,disabled:d,checked:p,required:b,setControl:v,setChecked:f,hasConsumerStoppedPropagationRef:x,isFormControl:j,bubbleInput:N}=O(W,t),y=G(u,v),g=o.useRef(p);return o.useEffect(()=>{const c=r?.form;if(c){const l=()=>f(g.current);return c.addEventListener("reset",l),()=>c.removeEventListener("reset",l)}},[r,f]),e.jsx(L.button,{type:"button",role:"checkbox","aria-checked":_(p)?"mixed":p,"aria-required":b,"data-state":J(p),"data-disabled":d?"":void 0,disabled:d,value:m,...n,ref:y,onKeyDown:U(s,c=>{c.key==="Enter"&&c.preventDefault()}),onClick:U(a,c=>{f(l=>_(l)?!0:!l),N&&j&&(x.current=c.isPropagationStopped(),x.current||c.stopPropagation())})})});V.displayName=W;var M=o.forwardRef((t,s)=>{const{__scopeCheckbox:a,name:n,checked:u,defaultChecked:r,required:m,disabled:d,value:p,onCheckedChange:b,form:v,...f}=t;return e.jsx(Ue,{__scopeCheckbox:a,checked:u,defaultChecked:r,disabled:d,required:m,onCheckedChange:b,name:n,form:v,value:p,internal_do_not_use_render:({isFormControl:x})=>e.jsxs(e.Fragment,{children:[e.jsx(V,{...f,ref:s,__scopeCheckbox:a}),x&&e.jsx(Y,{__scopeCheckbox:a})]})})});M.displayName=T;var K="CheckboxIndicator",z=o.forwardRef((t,s)=>{const{__scopeCheckbox:a,forceMount:n,...u}=t,r=O(K,a);return e.jsx(ne,{present:n||_(r.checked)||r.checked===!0,children:e.jsx(L.span,{"data-state":J(r.checked),"data-disabled":r.disabled?"":void 0,...u,ref:s,style:{pointerEvents:"none",...t.style}})})});z.displayName=K;var X="CheckboxBubbleInput",Y=o.forwardRef(({__scopeCheckbox:t,...s},a)=>{const{control:n,hasConsumerStoppedPropagationRef:u,checked:r,defaultChecked:m,required:d,disabled:p,name:b,value:v,form:f,bubbleInput:x,setBubbleInput:j}=O(X,t),N=G(a,j),y=oe(r),g=ce(n);o.useEffect(()=>{const l=x;if(!l)return;const E=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(E,"checked").set,k=!u.current;if(y!==r&&C){const S=new Event("click",{bubbles:k});l.indeterminate=_(r),C.call(l,_(r)?!1:r),l.dispatchEvent(S)}},[x,y,r,u]);const c=o.useRef(_(r)?!1:r);return e.jsx(L.input,{type:"checkbox","aria-hidden":!0,defaultChecked:m??c.current,required:d,disabled:p,name:b,value:v,form:f,...s,tabIndex:-1,ref:N,style:{...s.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Y.displayName=X;function Fe(t){return typeof t=="function"}function _(t){return t==="indeterminate"}function J(t){return _(t)?"indeterminate":t?"checked":"unchecked"}const Q=o.forwardRef(({className:t,...s},a)=>e.jsx(M,{ref:a,className:F("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow cursor-pointer focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...s,children:e.jsx(z,{className:F("grid place-content-center text-current"),children:e.jsx(ue,{className:"h-4 w-4"})})}));Q.displayName=M.displayName;const De="/__l5e/assets-v1/9753d7ec-7349-48e0-ba13-e7ca4075a96b/BlueLights.JPG",$e={url:De},A="pitch-auth-remember",q=[he.url,pe.url,$e.url,me.url];
1function Ke(){const t=re(),[s,a]=o.useState("signin"),[n,u]=o.useState(""),[r,m]=o.useState(""),[d,p]=o.useState(!1),[b,v]=o.useState(!0),[f,x]=o.useState(""),[j,N]=o.useState(""),[y,g]=o.useState(null),[c,l]=o.useState(null),[E,h]=o.useState(!1),[C,k]=o.useState(!1),[S,Z]=o.useState(0);o.useEffect(()=>{const i=typeof window<"u"?localStorage.getItem(A):null;i&&(u(i),v(!0))},[]),o.useEffect(()=>{if(typeof window>"u"||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const i=window.setInterval(()=>Z(w=>(w+1)%q.length),9e3);return()=>window.clearInterval(i)},[]),o.useEffect(()=>{const{data:i}=P.auth.onAuthStateChange(w=>{w==="SIGNED_IN"&&t({to:"/ops"})});return P.auth.getSession().then(({data:w})=>{w.session&&t({to:"/ops"})}),()=>i.subscription.unsubscribe()},[t]);const B=o.useMemo(()=>/.+@.+\..+/.test(n.trim()),[n]),ee=async i=>{i.preventDefault(),h(!0),g(null),l(null);try{if(b?localStorage.setItem(A,n.trim()):localStorage.removeItem(A),s==="signin"){const{error:w}=await P.auth.signInWithPassword({email:n,password:r});if(w)throw w;k(!0),t({to:"/ops"})}else{const{data:w,error:H}=await P.auth.signUp({email:n,password:r,options:{emailRedirectTo:`${window.location.origin}/auth`,data:{full_name:`${f} ${j}`.trim(),first_name:f.trim(),last_name:j.trim()}}});if(H)throw H;w.session?l("Account created. The General Manager has been notified and must approve your access."):l("Check your email to confirm the account. After you sign in, the General Manager must approve your access before the Operations Hub opens.")}}catch(w){g(w instanceof Error?w.message:"Something went wrong")}finally{h(!1)}},te=async()=>{if(g(null),l(null),!B){g("Enter your work email above, then select Forgot password.");return}h(!0);const{error:i}=await P.auth.resetPasswordForEmail(n.trim(),{redirectTo:`${window.location.origin}/auth`});h(!1),i?g(i.message):l("Password reset link sent. Check your inbox.")},se=async()=>{g(null);const i=await Me.auth.signInWithOAuth("google",{redirect_uri:window.location.origin+"/auth"});if(i.error){g("Google sign-in failed. Try again.");return}i.redirected||t({to:"/ops"})};return e.jsxs("div",{className:"pitch-auth relative min-h-screen w-full overflow-hidden",children:[e.jsxs("div",{"aria-hidden":"true",className:"absolute inset-0",children:[q.map((i,w)=>e.jsx("img",{src:i,alt:"",loading:w===0?"eager":"lazy",decoding:"async",className:"pitch-auth-scene absolute inset-0 h-full w-full object-cover",style:{opacity:w===S?1:0}},i)),e.jsx("div",{className:"pitch-auth-veil absolute inset-0"}),e.jsx("div",{className:"pitch-auth-glow absolute inset-0"}),e.jsx("img",{src:fe.url,alt:"",loading:"lazy",decoding:"async",className:"pitch-auth-inset absolute bottom-0 left-0 hidden h-[42%] w-[38%] object-cover lg:block"}),e.jsx("div",{className:"pitch-auth-lines absolute inset-0"})]}),e.jsxs("div",{className:"relative z-10 mx-auto flex min-h-screen w-full max-w-[1500px] flex-col px-6 py-7 sm:px-10",children:[e.jsxs("header",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(de,{size:"text-2xl",className:"pitch-auth-logo"}),e.jsx("span",{className:"pitch-auth-rule hidden sm:block"}),e.jsx("span",{className:"pitch-auth-eyebrow hidden sm:block",children:"Employees & Partners"})]}),e.jsxs("span",{className:"pitch-auth-badge",children:[e.jsx(ge,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Secure access"]})]}),e.jsx("main",{className:"flex flex-1 items-center py-10",children:e.jsxs("div",{className:"grid w-full items-center gap-12 lg:grid-cols-[1.55fr_1fr] lg:gap-16",children:[e.jsxs("section",{className:"max-w-2xl",children:[e.jsx("p",{className:"pitch-auth-eyebrow",children:"Chapel Hill · 462 W Franklin St"}),e.jsxs("h1",{className:"pitch-auth-headline mt-5",children:["Where hospitality",e.jsx("br",{}),"meets ",e.jsx("span",{className:"pitch-auth-accent",children:"purpose."})]}),e.jsx("p",{className:"pitch-auth-sub mt-6 max-w-xl",children:"The operating hub for THE PITCH personnel, partners, and owners creating exceptional experiences together."}),e.jsx("p",{className:"pitch-auth-statement mt-9",children:"Better together. Bigger impact."})]}),e.jsxs("section",{className:"pitch-auth-panel w-full",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("p",{className:"pitch-auth-eyebrow",children:s==="signin"?"Sign in":"Request access"}),e.jsx("h2",{className:"pitch-auth-panel-title mt-2",children:s==="signin"?"Employees & Partners":"Create your account"}),e.jsx("p",{className:"pitch-auth-hint mt-2",children:s==="signin"?"Use the credentials issued to you by THE PITCH.":"New accounts start as pending. The General Manager reviews every request and assigns your role."})]}),e.jsxs("form",{onSubmit:ee,className:"space-y-4",noValidate:!0,children:[s==="signup"&&e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(I,{htmlFor:"first",className:"pitch-auth-label",children:"First name"}),e.jsx(R,{id:"first",className:"pitch-auth-input",value:f,onChange:i=>x(i.target.value),autoComplete:"given-name",required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(I,{htmlFor:"last",className:"pitch-auth-label",children:"Last name"}),e.jsx(R,{id:"last",className:"pitch-auth-input",value:j,onChange:i=>N(i.target.value),autoComplete:"family-name",required:!0})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(I,{htmlFor:"email",className:"pitch-auth-label",children:"Email address"}),e.jsx(R,{id:"email",type:"email",className:"pitch-auth-input",value:n,onChange:i=>u(i.target.value),autoComplete:"email","aria-invalid":n.length>0&&!B,"aria-describedby":"auth-feedback",required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(I,{htmlFor:"pw",className:"pitch-auth-label",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(R,{id:"pw",type:d?"text":"password",className:"pitch-auth-input pr-11",value:r,onChange:i=>m(i.target.value),autoComplete:s==="signin"?"current-password":"new-password","aria-describedby":"auth-feedback",required:!0}),e.jsx("button",{type:"button",onClick:()=>p(i=>!i),className:"pitch-auth-eye","aria-label":d?"Hide password":"Show password","aria-pressed":d,children:d?e.jsx(ve,{className:"h-4 w-4","aria-hidden":"true"}):e.jsx(we,{className:"h-4 w-4","aria-hidden":"true"})})]})]}),s==="signin"&&e.jsxs("div",{className:"flex items-center justify-between gap-3 pt-1",children:[e.jsxs("label",{className:"pitch-auth-remember",children:[e.jsx(Q,{checked:b,onCheckedChange:i=>v(i===!0),"aria-label":"Remember me"}),"Remember me"]}),e.jsx("button",{type:"button",onClick:te,className:"pitch-auth-link",children:"Forgot password?"})]}),e.jsxs("div",{id:"auth-feedback","aria-live":"polite",className:"space-y-2",children:[y&&e.jsx("p",{className:"pitch-auth-error",children:y}),c&&e.jsx("p",{className:"pitch-auth-notice",children:c}),C&&!y&&e.jsx("p",{className:"pitch-auth-notice",children:"Signed in. Opening the Operations Hub…"})]}),e.jsx(D,{type:"submit",className:"pitch-auth-submit w-full",disabled:E,children:E?e.
1jsxs(e.Fragment,{children:[e.jsx(be,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":"true"}),"Working…"]}):s==="signin"?"Sign in":"Create account"})]}),e.jsx("div",{className:"pitch-auth-divider",children:e.jsx("span",{children:"or"})}),e.jsx(D,{variant:"outline",className:"pitch-auth-google w-full",onClick:se,type:"button",children:"Continue with Google"}),e.jsx("button",{type:"button",className:"pitch-auth-switch",onClick:()=>{a(s==="signin"?"signup":"signin"),g(null),l(null)},children:s==="signin"?"New to THE PITCH? Request access":"Already have an account? Sign in"})]})]})}),e.jsxs("footer",{className:"pitch-auth-footer",children:[e.jsxs("span",{children:["© ",new Date().getFullYear()," THE PITCH Chapel Hill"]}),e.jsxs("nav",{className:"flex flex-wrap items-center gap-x-6 gap-y-2",children:[e.jsx("a",{href:"mailto:[email protected]?subject=Privacy%20Policy",children:"Privacy Policy"}),e.jsx("a",{href:"mailto:[email protected]?subject=Terms%20of%20Use",children:"Terms of Use"}),e.jsx("a",{href:"mailto:[email protected]",children:"Help & Support"})]})]})]})]})}export{Ke as component};

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.