1import{j as e}from"./vendor-query-DubqxpgA.js";import{e as Z,i as J,r as a,L as j}from"./vendor-react-JyalZ63h.js";import{H as L}from"./vendor-helmet-iYQtFkxu.js";import{u as K,A as P,B as N,U as Y,G as $,T as ee,W as se,Z as te,s as k,t as ae}from"./index-Cq5x7r2d.js";import{I as m}from"./input-DT6qjlD-.js";import{L as i}from"./label-NhDGlPDt.js";import{C as S,b as E,c as T,d as F,a as D}from"./card-CajWOyxu.js";import{S as re,a as le,b as ie,c as ne,d as ce}from"./select-nOmfJctF.js";import{u as oe}from"./use-toast-DlZbtx9q.js";import{u as me}from"./usePageView-CaHxFyxa.js";import{u as de}from"./vendor-i18n-B0NrB2NZ.js";import{M as X}from"./mountain-Co0RQ46t.js";import{G as v}from"./gift-CtOUVsrp.js";import{M as A}from"./mail-BP0VodCP.js";import{S as H}from"./star-EHSbUeJV.js";import{Q as ue}from"./qr-code-BkvobK7Q.js";import{A as ge}from"./arrow-left-Deq08K7m.js";import{P as xe}from"./phone-CIoGEmGF.js";import{L as he}from"./lock-Briucmha.js";import{E as pe}from"./eye-off-D2EfLa0C.js";import{E as fe}from"./eye-D1XcuUcZ.js";import"./vendor-supabase-Clqdqihj.js";import"./index-CzzE9-A8.js";import"./index-J9_YgDOu.js";import"./index-CLb5DIrg.js";import"./index-Bl4tXC2P.js";import"./index-DPZU4SyD.js";import"./chevron-up-o_tDve5G.js";import"./check-BgoH1f79.js";function We(){me("/registracia");const n=Z(),[_]=J(),{toast:d}=oe(),{user:b,loading:u,signUp:q}=K(),{t:s,i18n:B}=de(),[y,r]=a.useState(!1),[g,G]=a.useState(!1),[M,z]=a.useState(!1),[x,I]=a.useState(""),[h,U]=a.useState(""),[l,V]=a.useState(""),[p,Q]=a.useState(""),[w,W]=a.useState(()=>{var t;return((t=B.language)==null?void 0:t.substring(0,2))||"sk"}),f=_.get("ref");a.useEffect(()=>{!u&&b&&n("/dashboard")},[b,u,n]);const O=async t=>{if(t.preventDefault(),r(!0),!l.trim()){d({title:"Meno je povinné",description:"ProsÃm zadajte vaÅ¡e meno a priezvisko.",variant:"destructive"}),r(!1);return}if(h.length<6){d({title:s("guestReg.weakPassword"),description:s("guestReg.weakPasswordDesc"),variant:"destructive"}),r(!1);return}const{data:c,error:R}=await q(x,h,{full_name:l||void 0});if(R){d({title:s("guestReg.regError"),description:R.message||s("guestReg.regErrorDesc"),variant:"destructive"}),r(!1);return}if(c!=null&&c.user){const o={preferred_language:w};if(l&&(o.full_name=l),p&&(o.phone=p),f){const{data:C}=await k.from("profiles").select("id").eq("referral_code",f).single();C&&(o.referred_by=C.id)}await k.from("profiles").update(o).eq("user_id",c.user.id)}ae("loyalty_signup","loyalty","registracia"),z(!0),r(!1)};return u?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"animate-pulse text-center",children:[e.jsx(X,{className:"w-12 h-12 text-primary mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:s("guestReg.loading")})]})}):M?e.jsxs(e.Fragment,{children:[e.jsx(L,{children:e.jsx("title",{children:s("guestReg.successPageTitle")})}),e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary/5 via-background to-accent/5 flex items-center justify-center p-4",children:e.jsxs(S,{className:"w-full max-w-md border-0 shadow-card text-center",children:[e.jsxs(E,{className:"pb-4",children:[e.jsx("div",{className:"w-20 h-20 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(v,{className:"w-10 h-10 text-green-600"})}),e.jsx(T,{className:"font-display text-2xl text-green-600",children:s("guestReg.successTitle")}),e.jsx(F,{className:"text-base",children:s("guestReg.successDesc")})]}),e.jsxs(D,{className:"space-y-6",children:[e.jsxs("div",{className:"bg-section-light rounded-xl p-4 space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("guestReg.checkEmail")}),e.jsxs("div",{className:"flex items-center justify-center gap-2 text-primary",children:[e.jsx(A,{className:"w-5 h-5"}),e.jsx("span",{className:"font-medium",children:x})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-semibold",children:s("guestReg.whatAwaits")}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-2",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4 text-amber-500"}),s("guestReg.autoPoints")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(P,{className:"w-4 h-4 text-primary"}),s("guestReg.exclusiveRewards")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(ue,{className:"w-4 h-4 text-primary"}),s("guestReg.digitalPass")]})]})]}),e.jsx(N,{onClick:()=>n("/prihlasenie"),className:"w-full",children:s("guestReg.loginButton")})]})]})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(L,{children:[e.jsx("title",{children:s("guestReg.pageTitle")}),e.jsx("meta",{name:"robots",content:"noindex, nofollow"}),e.jsx("meta",{name:"description",content:s("guestReg.pageDesc")})]}),e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary/5 via-background to-accent/5 flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs(N,{variant:"ghost",className:"mb-4",onClick:()=>n("/"),children:[e.jsx(ge,{className:"w-4 h-4 mr-2"}),s("guestReg.backToHome")]}),e.jsxs(S,{className:"border-0 shadow-card",children:[e.jsxs(E,{className:"text-center pb-2",children:[e.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-primary/20 to-accent/20 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(X,{className:"w-8 h-8 text-primary",strokeWidth:1.5})}),e.jsx(T,{className:"font-display text-2xl",children:s("guestReg.joinTitle")}),e.jsx(F,{children:s("guestReg.joinDesc")}),f&&e.jsx("div",{className:"mt-3 p-2 bg-green-50 border border-green-200 rounded-lg",children:e.jsxs("p",{className:"text-sm text-green-700 flex items-center justify-center gap-2",children:[e.jsx(v,{className:"w-4 h-4"}),s("guestReg.referralBonus")]})})]}),e.jsx(D,{children:e.jsxs("form",{onSubmit:O,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"fullName",children:s("guestReg.nameLabel")}),e.jsxs("div",{className:"relative",children:[e.jsx(Y,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(m,{id:"fullName",type:"text",placeholder:s("guestReg.namePlaceholder"),value:l,onCh
1ange:t=>V(t.target.value),className:"pl-10",required:!0})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"email",children:s("guestReg.emailLabel")}),e.jsxs("div",{className:"relative",children:[e.jsx(A,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(m,{id:"email",type:"email",placeholder:s("guestReg.emailPlaceholder"),value:x,onChange:t=>I(t.target.value),className:"pl-10",required:!0})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("guestReg.emailHint")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"phone",children:s("guestReg.phoneLabel")}),e.jsxs("div",{className:"relative",children:[e.jsx(xe,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(m,{id:"phone",type:"tel",placeholder:"+421 9XX XXX XXX",value:p,onChange:t=>Q(t.target.value),className:"pl-10"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(i,{htmlFor:"preferredLanguage",children:[e.jsx($,{className:"w-4 h-4 inline mr-1"}),s("guestReg.languageLabel","Preferovaný jazyk")]}),e.jsxs(re,{value:w,onValueChange:t=>W(t),children:[e.jsx(le,{children:e.jsx(ie,{})}),e.jsx(ne,{children:ee.map(t=>e.jsxs(ce,{value:t,children:[se[t]," ",te[t]]},t))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"password",children:s("guestReg.passwordLabel")}),e.jsxs("div",{className:"relative",children:[e.jsx(he,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(m,{id:"password",type:g?"text":"password",placeholder:s("guestReg.minChars"),value:h,onChange:t=>U(t.target.value),className:"pl-10 pr-10",required:!0,minLength:6}),e.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>G(!g),children:g?e.jsx(pe,{className:"w-4 h-4"}):e.jsx(fe,{className:"w-4 h-4"})})]})]}),e.jsx(N,{type:"submit",className:"w-full",size:"lg",disabled:y,children:s(y?"guestReg.registering":"guestReg.registerButton")}),e.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:[s("guestReg.agreeTerms")," ",e.jsx(j,{to:"/podmienky",className:"text-primary hover:underline",children:s("guestReg.terms")})," ",s("guestReg.and")," ",e.jsx(j,{to:"/ochrana-udajov",className:"text-primary hover:underline",children:s("guestReg.privacy")})]}),e.jsx("div",{className:"text-center pt-2",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s("guestReg.alreadyHaveAccount")," ",e.jsx(j,{to:"/prihlasenie",className:"text-primary hover:underline font-medium",children:s("guestReg.loginLink")})]})})]})})]}),e.jsxs("div",{className:"mt-8 bg-card rounded-xl p-6 shadow-soft",children:[e.jsx("h3",{className:"font-display font-semibold text-center mb-4",children:s("guestReg.benefitsTitle")}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mx-auto mb-2",children:e.jsx(H,{className:"w-6 h-6 text-primary"})}),e.jsx("p",{className:"font-semibold text-primary",children:s("guestReg.oneEur")}),e.jsx("p",{className:"text-muted-foreground text-xs",children:s("guestReg.onePoint")})]}),e.jsxs("div",{children:[e.jsx("div",{className:"w-12 h-12 bg-accent/10 rounded-full flex items-center justify-center mx-auto mb-2",children:e.jsx(v,{className:"w-6 h-6 text-accent-foreground"})}),e.jsx("p",{className:"font-semibold text-primary",children:s("guestReg.fourLevels")}),e.jsx("p",{className:"text-muted-foreground text-xs",children:s("guestReg.membership")})]}),e.jsxs("div",{children:[e.jsx("div",{className:"w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-2",children:e.jsx(P,{className:"w-6 h-6 text-green-600"})}),e.jsx("p",{className:"font-semibold text-primary",children:s("guestReg.twoHundredPoints")}),e.jsx("p",{className:"text-muted-foreground text-xs",children:s("guestReg.forReferral")})]})]})]})]})})]})}export{We as default};
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.