import{d as n,b5 as E,j as e,G as t,T as I,t as h,I as y,a9 as P,U as m,c as w,L as p,a8 as M,aO as L,b6 as f,D as R,E as _,C as k,aM as b,b7 as W,Z as G,aq as F}from"../index.Crez7j-Y.bundle.js";import{d as D,a as T}from"./VisibilityOff.BrXGwV_2.bundle.js";import{N as A,K as O}from"./NaverButton.BVbVolwP.bundle.js";import"./naver_login_logo.C8L06Jil.bundle.js";function U(){var a,l;const[r,s]=n.useState(!1),c=n.useCallback(()=>{s(d=>!d)},[]),{methods:j,onSubmit:x}=E(),{register:u,handleSubmit:g,formState:{errors:i}}=j;return e.jsx("form",{onSubmit:g(x),children:e.jsxs(t,{container:!0,gap:1,my:2,children:[e.jsx(t,{item:!0,desktop:12,mobile:12,mb:2,children:e.jsx(I,{variant:"title",align:"center",children:"비회원 주문조회"})}),e.jsx(t,{item:!0,desktop:12,mobile:12,children:e.jsx(h,{...u("orderNo"),fullWidth:!0,placeholder:"주문번호",error:!!i.orderNo,helperText:(a=i.orderNo)==null?void 0:a.message,autoComplete:"orderNo"})}),e.jsx(t,{item:!0,desktop:12,mobile:12,children:e.jsx(h,{...u("password"),fullWidth:!0,placeholder:"주문번호 비밀번호",autoComplete:"new-password",type:r?"text":"password",name:"password",error:!!i.password,helperText:(l=i.password)==null?void 0:l.message,InputProps:{sx:{p:0},endAdornment:e.jsx(y,{sx:{position:"absolute",right:10},onClick:c,onMouseDown:d=>d.preventDefault(),children:r?e.jsx(D,{}):e.jsx(T,{})})}})}),e.jsx(t,{item:!0,desktop:12,mobile:12,mt:2,children:e.jsx(P,{fullWidth:!0,variant:"contained",color:"black",type:"submit",sx:{p:1.5},children:"주문조회"})})]})})}function H(){var s;const r=(s=new URLSearchParams(location.search).get("redirect"))!=null?s:m.MAIN;return e.jsx(w,{pt:5,children:e.jsx(p,{display:"inline-block",variant:"buttonLarge",underline:"none",href:r,py:2,px:4,border:"1px solid ".concat(M),width:"100%",children:"비회원 주문하기"})})}function V(){var S,C;const[r,s]=n.useState(!1),c=n.useCallback(()=>{s(o=>!o)},[]),{methods:j,onSubmit:x}=L(),{register:u,handleSubmit:g,setValue:i,formState:{errors:a}}=j,[l,d]=n.useState(!0);n.useEffect(()=>{const o=localStorage.getItem(f);o&&(d(!0),i("memberId",o))},[i]);const N=n.useCallback((o,v)=>{d(v),v||localStorage.removeItem(f)},[]),B=n.useCallback(async o=>{l&&localStorage.setItem(f,o.memberId),await x(o)},[l,x]);return e.jsxs(e.Fragment,{children:[e.jsx("form",{onSubmit:g(B),children:e.jsxs(t,{container:!0,spacing:1,children:[e.jsx(t,{item:!0,desktop:12,mobile:12,children:e.jsx(h,{...u("memberId"),autoComplete:"memberId",fullWidth:!0,placeholder:"아이디",error:!!a.memberId,helperText:(S=a.memberId)==null?void 0:S.message})}),e.jsx(t,{item:!0,desktop:12,mobile:12,children:e.jsx(w,{position:"relative",display:"flex",alignItems:"center",children:e.jsx(h,{...u("password"),fullWidth:!0,placeholder:"비밀번호",autoComplete:"new-password",InputProps:{sx:{p:0},endAdornment:e.jsx(y,{sx:{position:"absolute",right:10},onClick:c,onMouseDown:o=>o.preventDefault(),children:r?e.jsx(D,{}):e.jsx(T,{})})},type:r?"text":"password",error:!!a.password,helperText:(C=a.password)==null?void 0:C.message})})}),e.jsx(t,{item:!0,desktop:12,mobile:12,children:e.jsx(w,{display:"flex",children:e.jsx(R,{control:e.jsx(_,{checked:l,onChange:N}),label:e.jsx(I,{variant:"body",children:"아이디 저장"})})})}),e.jsx(t,{item:!0,desktop:12,mobile:12,children:e.jsx(P,{fullWidth:!0,type:"submit",variant:"contained",color:"black",sx:{p:1.5},children:"로그인"})})]})}),e.jsxs(t,{container:!0,sx:{alignItems:"center",justifyContent:"space-evenly",mt:2},children:[e.jsx(t,{desktop:3,mobile:3,container:!0,justifyContent:"center",children:e.jsx(p,{variant:"subtitle1",href:m.FIND_ID,underline:"none",color:k,align:"center",children:"아이디찾기"})}),e.jsx(b,{orientation:"vertical",flexItem:!0}),e.jsx(t,{desktop:3,mobile:4,container:!0,justifyContent:"center",children:e.jsx(p,{variant:"subtitle1",href:m.FIND_PASSWORD,underline:"none",color:k,children:"비밀번호찾기"})}),e.jsx(b,{orientation:"vertical",flexItem:!0}),e.jsx(t,{desktop:3,mobile:3,container:!0,justifyContent:"center",children:e.jsx(p,{variant:"subtitle1",href:m.SIGN_UP_METHOD,underline:"none",color:k,children:"회원가입"})})]})]})}function K(){const{submitNaverLogin:r,submitKakaoLogin:s}=L();return e.jsxs(t,{container:!0,gap:1,my:2,children:[e.jsx(t,{item:!0,desktop:12,mobile:12,mb:2,children:e.jsx(I,{variant:"title",align:"center",children:"간편 로그인"})}),e.jsx(t,{item:!0,desktop:12,mobile:12,children:e.jsx(A,{onButtonClick:r,buttonText:"네이버 아이디로 로그인"})}),e.jsx(t,{item:!0,desktop:12,mobile:12,children:e.jsx(O,{onButtonClick:s,buttonText:"카카오 아이디로 로그인"})})]})}function J(){const r=W(),s=new URLSearchParams(r.search).get("redirect"),c=s==null?void 0:s.includes(m.ORDER_SHEET);return e.jsxs(G,{maxWidth:450,children:[e.jsx(t,{mobile:12,desktop:12,children:e.jsx(F,{variant:"title",title:"로그인",align:"center",pt:3,pb:0})}),e.jsxs(t,{mobile:12,p:3,children:[e.jsx(V,{}),e.jsx(b,{sx:{marginTop:"40px"}}),e.jsx(K,{}),e.jsx(b,{sx:{marginTop:"40px"}}),c?e.jsx(H,{}):e.jsx(U,{})]})]})}export{J as default};