https://fieldagent-radar.netlify.app/_next/static/chunks/app/(public)/login/page-b6cc18de74026420.js
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[308],{738:function(e,t,r){Promise.resolve().then(r.bind(r,6151))},9376:function(e,t,r){"use strict";var n=r(5475);r.o(n,"useParams")&&r.d(t,{useParams:function(){return n.useParams}}),r.o(n,"usePathname")&&r.d(t,{usePathname:function(){return n.usePathname}}),r.o(n,"useRouter")&&r.d(t,{useRouter:function(){return n.useRouter}}),r.o(n,"useSearchParams")&&r.d(t,{useSearchParams:function(){return n.useSearchParams}})},6151:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return c}});var n=r(7437),a=r(2265),s=r(7648),o=r(9376),i=r(8123);function c(){let e=(0,o.useRouter)(),{refresh:t}=(0,i.aC)();(0,a.useEffect)(()=>{(0,i.jl)()&&e.replace("/dashboard")},[e]);let[r,c]=(0,a.useState)(""),[l,u]=(0,a.useState)(""),[d,m]=(0,a.useState)(""),[x,p]=(0,a.useState)(!1);async function f(n){n.preventDefault(),m(""),p(!0);let a=await (0,i.x4)(r,l);a.ok?(t(),e.push("/dashboard")):(m(a.error),p(!1))}return(0,n.jsx)("div",{className:"min-h-[calc(100vh-4rem)] flex items-center justify-center px-6",children:(0,n.jsxs)("div",{className:"w-full max-w-sm",children:[(0,n.jsxs)("div",{className:"mb-8 text-center",children:[(0,n.jsx)("h1",{className:"font-display text-primary text-[24px] font-semibold tracking-wide",children:"Welcome back"}),(0,n.jsx)("p",{className:"font-editorial italic text-text/40 text-[15px] mt-1",children:"Sign in to your FieldAgent account"})]}),(0,n.jsxs)("form",{onSubmit:f,className:"space-y-4",children:[d&&(0,n.jsx)("div",{className:"bg-critical/10 border border-critical/20 rounded-card px-4 py-3 text-critical text-[13px]",children:d}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"username",className:"block text-[11px] font-semibold tracking-[0.2em] uppercase text-text/40 mb-1.5",children:"Username"}),(0,n.jsx)("input",{id:"username",type:"text",required:!0,value:r,onChange:e=>c(e.target.value),className:"w-full bg-paper border border-grid rounded-card px-4 py-2.5 text-[14px] text-text placeholder:text-text/25 focus:outline-none focus:border-primary/40 transition-colors",placeholder:"farmer1"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"password",className:"block text-[11px] font-semibold tracking-[0.2em] uppercase text-text/40 mb-1.5",children:"Password"}),(0,n.jsx)("input",{id:"password",type:"password",required:!0,value:l,onChange:e=>u(e.target.value),className:"w-full bg-paper border border-grid rounded-card px-4 py-2.5 text-[14px] text-text placeholder:text-text/25 focus:outline-none focus:border-primary/40 transition-colors",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢"})]}),(0,n.jsx)("button",{type:"submit",disabled:x,className:"w-full bg-primary hover:bg-primary/90 disabled:bg-primary/50 text-white text-[15px] font-semibold px-7 py-3 rounded-full transition-colors",children:x?"Signing in...":"Sign in"})]}),(0,n.jsxs)("div",{className:"mt-6 border border-dashed border-primary/20 rounded-xl px-5 py-4 bg-primary/[0.02]",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3 mb-3",children:[(0,n.jsx)("div",{className:"w-8 h-8 rounded-lg bg-accent/10 flex items-center justify-center flex-shrink-0 mt-0.5",children:(0,n.jsxs)("svg",{className:"w-4 h-4 text-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})]})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-[13px] font-semibold text-text",children:"See FieldAgent in action"}),(0,n.jsx)("p",{className:"text-[12px] text-text/45 leading-relaxed mt-0.5",children:"This demo account has pre-populated fields, live weather data, USDA soil profiles, and completed health reports so you can explore the full agent experience."})]})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>{c("demo_farmer"),u("demo1234!")},className:"w-full bg-primary/[0.06] hover:bg-primary/10 border border-primary/15 rounded-lg px-4 py-2.5 transition-colors group flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,n.jsx)("div",{className:"w-6 h-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,n.jsx)("svg",{className:"w-3 h-3 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}),(0,n.jsx)("span",{className:"text-[12px] font-semibold text-text",children:"demo_farmer"})]}),(0,n.jsx)("span",{className:"text-[11px] text-accent font-semibold group-hover:translate-x-0.5 transition-transform",children:"Fill â"})]})]}),(0,n.jsxs)("p",{className:"mt-5 text-center text-[13px] text-text/40",children:["Don't have an account?"," ",(0,n.jsx)(s.default,{href:"/signup",className:"text-accent hover:text-accent/80 font-medium transition-colors",children:"Create one"})]})]})})}},8123:function(e,t,r){"use strict";r.d(t,{IU:function(){return p},Ms:function(){return c},Vo:function(){return f},aC:function(){return h},hP:function(){return s},jb:function(){return m},jl:function(){return u},x4:function(){return x},yE:function(){return l}});var n=r(2265),a=r(3217);function s(){return localStorage.getItem("access_token")}function o(e,t){localStorage.setItem("access_token",e),localStorage.setItem("refresh_token",t)}function i(e){localStorage.setItem("username",e)}function c(){return localStorage.getItem("username")}function l(){localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token"),localStorage.removeItem("username")}function u(){return!!s()}let d=null;async function m(){return d||(d=(async()=>{let e=localStorage.getItem("refresh_token");if(!e)return!1;try{let t=await fetch("".concat(a.T,"/auth/token/refresh/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh:e})});if(t.ok){let e=await t.json();return localStorage.setItem("access_token",e.access),!0}return l(),!1}catch(e){return!1}finally{d=null}})())}async function x(e,t){try{let r=await fetch("".concat(a.T,"/auth/login/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})});if(r.ok){let t=await r.json();return o(t.access,t.refresh),i(t.username||e),{ok:!0}}let n=await r.json().catch(()=>null),s=(null==n?void 0:n.detail)||(null==n?void 0:n.error)||"Invalid credentials";return{ok:!1,error:s}}catch(e){return{ok:!1,error:"Network error â is the backend running?"}}}async function p(e,t,r,n){try{let s=await fetch("".concat(a.T,"/auth/signup/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,email:t,phone_number:r,password:n})});if(s.ok||201===s.status){let t=await s.json();return o(t.access,t.refresh),i(t.username||e),{ok:!0}}let c=await s.json().catch(()=>null);if(c){let e=Object.values(c).flat()[0];if("string"==typeof e)return{ok:!1,error:e}}return{ok:!1,error:"Signup failed"}}catch(e){return{ok:!1,error:"Network error â is the backend running?"}}}let f=(0,n.createContext)({loggedIn:!1,logout:()=>{},refresh:()=>{}});function h(){return(0,n.useContext)(f)}},3217:function(e,t,r){"use strict";r.d(t,{T:function(){return n}});let n="https://crop-advisor-922c34c099bf.herokuapp.com/api/v1"}}
1,function(e){e.O(0,[648,971,117,744],function(){return e(e.s=738)}),_N_E=e.O()}]);
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.