(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[716],{4742:function(e,t,n){Promise.resolve().then(n.bind(n,6873))},6873:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return m}});var s=n(7437),r=n(7648),a=n(2265),o=n(9376),u=n(4196),c=n(8349),i=n(1265),l=n(9203),d=n(3548);function m(){let e=(0,o.useRouter)(),{user:t,loading:n,isConfigured:m}=(0,i.a)(),[f,p]=(0,a.useState)(""),[x,h]=(0,a.useState)(""),[b,g]=(0,a.useState)(!1),[w,v]=(0,a.useState)(""),[j,y]=(0,a.useState)("/dashboard");(0,a.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get("next");e&&e.startsWith("/")&&y(e)},[]),(0,a.useEffect)(()=>{!n&&t&&e.replace(j)},[n,t,e,j]);let N=async t=>{if(t.preventDefault(),!l.O||!m){v("Connexion indisponible : variables Supabase manquantes.");return}g(!0),v("");let{error:n}=await l.O.auth.signInWithPassword({email:f,password:x});if(n){v(n.message),g(!1);return}(0,d.L)("login",{method:"email"}),e.replace(j)};return(0,s.jsxs)("main",{className:"min-h-screen bg-cloud-dancer",children:[(0,s.jsx)(u.default,{}),(0,s.jsx)("section",{className:"pt-28 pb-16 px-4",children:(0,s.jsxs)("div",{className:"max-w-md mx-auto bg-white rounded-2xl border border-stone-200 shadow-sm p-8",children:[(0,s.jsx)("p",{className:"text-xs tracking-[0.16em] uppercase text-eucalyptus mb-3",children:"Espace client"}),(0,s.jsx)("h1",{className:"text-3xl font-serif text-mahogany mb-2",children:"Connexion"}),(0,s.jsx)("p",{className:"text-stone-600 mb-8",children:"Retrouve tes voyages sauvegard\xe9s et tes carnets confirm\xe9s."}),!m&&(0,s.jsx)("div",{className:"mb-6 p-4 rounded-xl border border-amber-200 bg-amber-50 text-sm text-amber-900",children:"Supabase n'est pas configur\xe9 en environnement courant."}),(0,s.jsxs)("form",{onSubmit:N,className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-stone-700 mb-1.5",children:"Email"}),(0,s.jsx)("input",{type:"email",required:!0,value:f,onChange:e=>p(e.target.value),placeholder:"ton.email@exemple.fr",className:"w-full rounded-lg border border-stone-300 px-4 py-3 focus:outline-none focus:ring-2 focus:ring-eucalyptus/30 focus:border-eucalyptus"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-stone-700 mb-1.5",children:"Mot de passe"}),(0,s.jsx)("input",{type:"password",required:!0,value:x,onChange:e=>h(e.target.value),placeholder:"••••••••",className:"w-full rounded-lg border border-stone-300 px-4 py-3 focus:outline-none focus:ring-2 focus:ring-eucalyptus/30 focus:border-eucalyptus"})]}),w&&(0,s.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700",children:w}),(0,s.jsx)("button",{type:"submit",disabled:b||!m,className:"w-full bg-eucalyptus text-white font-medium py-3 rounded-lg hover:bg-eucalyptus/90 transition disabled:opacity-50 disabled:cursor-not-allowed",children:b?"Connexion en cours...":"Me connecter"})]}),(0,s.jsxs)("p",{className:"text-sm text-stone-600 mt-6",children:["Pas encore de compte ?"," ",(0,s.jsx)(r.default,{href:"/auth/register",className:"text-mahogany font-semibold hover:underline",children:"Cr\xe9er un compte"})]})]})}),(0,s.jsx)(c.default,{})]})}},3548:function(e,t,n){"use strict";n.d(t,{L:function(){return r}});var s=n(6340);function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,s.Fd)()&&"function"==typeof window.gtag&&window.gtag("event",e,t)}},6340:function(e,t,n){"use strict";n.d(t,{Fd:function(){return o},TY:function(){return a},tA:function(){return r}});let s="heldonica_cookie_consent_v1";function r(){let e=window.localStorage.getItem(s);return"accepted"===e||"rejected"===e?e:null}function a(e){window.localStorage.setItem(s,e),window.dispatchEvent(new Event("heldonica-cookie-consent-updated"))}function o(){return"accepted"===r()}},9376:function(e,t,n){"use strict";var s=n(5475);n.o(s,"usePathname")&&n.d(t,{usePathname:function(){return s.usePathname}}),n.o(s,"useRouter")&&n.d(t,{useRouter:function(){return s.useRouter}})}},function(e){e.O(0,[762,648,434,303,333,971,117,744],function(){return e(e.s=4742)}),_N_E=e.O()}]);