1import{d as N,r as c,o as j,j as n,k as l,l as s,A as h,q as w,B as _,p as k,i as T,C as D,t as y,T as O,F as L,E as V,n as E}from"./vendor-vue-BezOTQRv.js";import{u as X}from"./useHyperAuth-Dft_wh3b.js";import{_ as M}from"./app-BoQy-ZL6.js";import"./vendor-inertia-DoowGBH0.js";const K={class:"min-h-screen flex flex-col justify-center py-12 sm:px-6 lg:px-8 bg-gray-50"},W={class:"mt-8 sm:mx-auto sm:w-full sm:max-w-md login-container"},U={key:0,class:"bg-white sm:rounded-lg sm:px-10 flex flex-col items-center justify-center",style:{padding:"5rem 5rem 2rem","border-radius":"20px"}},H={key:1,class:"bg-white sm:rounded-lg sm:px-10",style:{padding:"5rem 5rem 2rem","border-radius":"20px"}},J={class:"login-input mt-1 relative rounded-md"},z=["disabled"],G={key:0,class:"mt-2 text-sm text-red-600"},$=["disabled"],Q={key:0,class:"animate-spin rounded-full h-5 w-5 border-2 border-white/40 border-t-white"},Y={key:1,class:"text-[#F7F6F5] text-[16px]"},Z={class:"flex gap-2 mt-4"},ee=["onUpdate:modelValue","disabled","onInput","onKeydown"],te={key:0,class:"mt-2 text-sm text-red-600 text-center"},se={class:"flex gap-4"},oe=["disabled"],ae=["disabled"],re={key:0,class:"animate-spin rounded-full h-5 w-5 border-2 border-white/40 border-t-white mx-auto"},ne={key:1,class:"text-[#F7F6F5] text-[16px]"},le=N({__name:"CustomerLogin",setup(ie){const{sendOtp:P,verifyOtp:S}=X(),g=c(""),f=c(""),o=c(["","","","","",""]),u=c([]),v=c(!1),a=c(!1),d=c(""),x=c(!0);function C(){const t=document.cookie.split("; ").find(e=>e.startsWith("XSRF-TOKEN="))?.split("=")[1];return t?decodeURIComponent(t):document.querySelector('meta[name="csrf-token"]')?.getAttribute("content")||""}async function F(){const t=await fetch("/csrf-token",{method:"GET",credentials:"same-origin",headers:{"X-Requested-With":"XMLHttpRequest"}});if(t.ok){const e=await t.json().catch(()=>null);if(e?.csrfToken)return e.csrfToken}return C()}async function I(t){const e=await F();await fetch("/aws-login",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":e,"X-XSRF-TOKEN":e,"X-Requested-With":"XMLHttpRequest"},credentials:"same-origin",body:JSON.stringify({token:t})})}j(async()=>{try{const t=new URLSearchParams(window.location.search).get("source"),e=JSON.parse(localStorage.getItem("somany_auth")||"null");if(t==="myorders"&&e?.isLoggedIn&&e?.idToken&&e?.accessToken){try{await I(e.idToken)}catch{}window.location.href="/customer/orders-current";return}}catch{}x.value=!1});const R=(t,e)=>{const r=e.target.value;if(!/^\d*$/.test(r)){o.value[t]="";return}o.value[t]=r,r&&t<5&&u.value[t+1]?.focus(),f.value=o.value.join("")},q=(t,e)=>{e.key==="Backspace"&&!o.value[t]&&t>0&&u.value[t-1]?.focus(),e.key==="ArrowLeft"&&t>0&&u.value[t-1]?.focus(),e.key==="ArrowRight"&&t<5&&u.value[t+1]?.focus()},A=t=>{t.preventDefault();const p=(t.clipboardData?.getData("text")||"").replace(/\D/g,"").slice(0,6);for(let m=0;m<p.length&&m<6;m++)o.value[m]=p[m];const r=o.value.findIndex(m=>!m),i=r===-1?5:r;u.value[i]?.focus(),f.value=o.value.join("")},b=async()=>{if(!(a.value||!g.value)){a.value=!0,d.value="";try{await P(g.value),v.value=!0,o.value=["","","","","",""],f.value="",setTimeout(()=>{u.value[0]?.focus()},100)}catch(t){d.value=t?.response?.data?.message||"Failed to send OTP. Please try again."}finally{a.value=!1}}},B=async()=>{if(!(a.value||o.value.some(t=>!t))){a.value=!0,d.value="";try{await S(g.value,f.value),window.location.href="/customer/orders-current"}catch(t){d.value=t?.response?.data?.message||"OTP verification failed. Please try again.",o.value=["","","","","",""],f.value="",setTimeout(()=>{u.value[0]?.focus()},100),a.value=!1}}};return(t,e)=>(n(),l("div",K,[s("div",W,[x.value?(n(),l("div",U,[...e[1]||(e[1]=[s("div",{class:"animate-spin rounded-full h-10 w-10 border-4 border-gray-200 border-t-[#DD2227] mb-4"},null,-1),s("p",{class:"text-gray-600 text-sm"},"Signing you in...",-1)])])):(n(),l("div",H,[v.value?y("",!0):(n(),l("form",{key:0,onSubmit:h(b,["prevent"]),style:{gap:"3rem",display:"flex","flex-direction":"column"}},[e[4]||(e[4]=s("div",{class:"sm:mx-auto sm:w-full sm:max-w-md"},[s("h2",{class:"login-title mt-6 text-center text-3xl font-extrabold text-gray-900"}," Welcome! "),s("p",{class:"login-description mt-2 text-center text-sm text-gray-600"}," Sign in to view your quotes & orders. ")],-1)),s("div",null,[e[3]||(e[3]=s("label",{for:"mobile",class:"login-label"},"Enter your 10-digit mobile number.",-1)),s("div",J,[e[2]||(e[2]=s("div",{class:"absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none border-r border-[#
1E6E6E6] my-2 pr-2"},[s("span",{class:"text-[#AEB4B7] sm:text-sm"}," +91 ")],-1)),w(s("input",{id:"mobile","onUpdate:modelValue":e[0]||(e[0]=p=>g.value=p),type:"tel",maxlength:"10",pattern:"[0-9]{10}",required:"",class:"focus:ring-indigo-500 text-[#AEB4B7] focus:border-indigo-500 block w-full pl-14 py-3 sm:text-md border-gray-300 rounded-md h-[50px]",placeholder:"Mobile number",disabled:a.value,style:{border:"1px solid #E6E6E6","border-radius":"12px"}},null,8,z),[[_,g.value]])]),k(O,{name:"error-fade",mode:"out-in"},{default:T(()=>[d.value?(n(),l("p",G,D(d.value),1)):y("",!0)]),_:1})]),s("button",{type:"submit",class:"w-full flex justify-center mt-1 py-4 px-4 border border-transparent rounded-full shadow-sm text-sm font-medium text-white bg-[#DD2227] hover:bg-[#DD2227]/90 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[#DD2227] disabled:opacity-50",disabled:a.value,style:{"margin-top":"5rem"}},[a.value?(n(),l("span",Q)):(n(),l("span",Y,"Send OTP"))],8,$)],32)),v.value?(n(),l("form",{key:1,onSubmit:h(B,["prevent"]),style:{gap:"3rem",display:"flex","flex-direction":"column"}},[e[6]||(e[6]=s("div",{class:"sm:mx-auto sm:w-full sm:max-w-md"},[s("h2",{class:"login-title mt-6 text-center text-3xl font-extrabold text-gray-900"}," Welcome! "),s("p",{class:"login-description mt-2 text-center text-sm text-gray-600"}," Sign in to view your quotes & orders. ")],-1)),s("div",null,[e[5]||(e[5]=s("label",{for:"otp",class:"login-label"},"Please enter your OTP",-1)),s("div",Z,[(n(!0),l(L,null,V(o.value,(p,r)=>w((n(),l("input",{key:r,ref_for:!0,ref:i=>u.value[r]=i,"onUpdate:modelValue":i=>o.value[r]=i,type:"text",maxlength:"1",pattern:"[0-9]",required:"",class:"w-[70px] h-[70px] text-center text-lg font-semibold border-2 border-gray-300 rounded-lg focus:border-[#DD2227] focus:outline-none focus:ring-2 focus:ring-[#DD2227]/20 transition-colors",disabled:a.value,onInput:i=>R(r,i),onKeydown:i=>q(r,i),onPaste:A,style:{"font-size":"40px","font-family":"'Albert Sans'",border:"1px solid #E6E6E6"}},null,40,ee)),[[_,o.value[r]]])),128))]),k(O,{name:"error-fade",mode:"out-in"},{default:T(()=>[d.value?(n(),l("p",te,D(d.value),1)):y("",!0)]),_:1})]),s("div",se,[s("button",{type:"button",onClick:b,disabled:a.value,class:"flex-1 bg-gray-200 text-gray-700 hover:bg-gray-300 disabled:opacity-50 py-3 px-4 rounded-md text-sm font-medium transition-colors duration-200",style:{"border-radius":"30px"}}," Resend OTP ",8,oe),s("button",{type:"submit",disabled:a.value||!f.value,class:"flex-1 w-full bg-[#DD2227] text-white hover:bg-[#DD2227]/90 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[#DD2227] disabled:opacity-50 py-3 px-4 rounded-md text-sm font-medium transition-colors duration-200",style:{"border-radius":"30px"}},[a.value?(n(),l("span",re)):(n(),l("span",ne,"Verify OTP"))],8,ae)])],32)):y("",!0),e[7]||(e[7]=s("div",{class:"login-text"},[s("p",null,[E("By continuing, you agree to our "),s("a",{href:"#"},"Terms & Conditions"),E(".")])],-1))]))])]))}}),fe=M(le,[["__scopeId","data-v-68b1f5fc"]]);export{fe 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.