import{m as w,k as j,O as f,b as S,bL as g,j as s,T as q,V as B,ax as b,W as C,bW as E,aE as L,Z as k,$ as F,X as P,x as T,bK as A}from"./index-6o6UQuBv.js";const N=w.div.withConfig({componentId:"sc-35e927ea-0"})(["display:flex;flex-direction:column;gap:24px;"]),K=w.div.withConfig({componentId:"sc-35e927ea-1"})(["display:flex;align-items:center;gap:4px;"]),y={Container:N,ButtonContainer:K},R=({...n})=>{const{close:r,boardData:a,onConfirm:e}=n,{t}=j(),{register:o,handleSubmit:m,formState:{errors:x}}=f({defaultValues:{password:""}}),{openAsyncDialog:h}=S(),p=m(async c=>{var l,u;try{await g.getArticle((a==null?void 0:a.boardNo)||"",(a==null?void 0:a.articleNo)||0,{password:c.password}),e==null||e(c.password)}catch(i){r(),await h({message:i instanceof Error&&(((u=(l=i==null?void 0:i.response)==null?void 0:l.data)==null?void 0:u.message)||i.message)||t("비밀번호가 일치하지 않습니다.")})}finally{r()}});return s.jsx(q,{...n,title:t("비밀번호 인증"),children:s.jsxs(y.Container,{children:[s.jsxs("form",{onSubmit:p,children:[s.jsx("p",{style:{fontSize:14,color:"#666",marginBottom:16,lineHeight:1.5},children:t("글 작성 시 설정한 비밀번호를 입력해 주세요.")}),s.jsxs(B,{children:[s.jsx(b,{isRequired:!0,children:t("비밀번호")}),s.jsx(C,{type:"password",placeholder:t("비밀번호 입력"),...o("password",{required:t("비밀번호를 입력해 주세요.")}),maxLength:20,autoFocus:!0}),s.jsx(E,{name:"password",errors:x})]})]}),s.jsxs(y.ButtonContainer,{children:[s.jsx(L,{type:"button",onClick:r,children:t("취소")},"cancel"),s.jsx(k,{type:"button",onClick:p,children:t("확인")},"submit")]})]})})},V=({close:n,onConfirm:r,isOpen:a=!0,boardData:e,...t})=>{const{t:o}=j(),{register:m,handleSubmit:x,formState:{errors:h}}=f({defaultValues:{password:""}}),{openAsyncDialog:p}=S(),c=x(async l=>{var u,i;try{await g.getArticle((e==null?void 0:e.boardNo)||"",(e==null?void 0:e.articleNo)||0,{password:l.password}),r==null||r(l.password)}catch(d){n(),await p({message:d instanceof Error&&(((i=(u=d==null?void 0:d.response)==null?void 0:u.data)==null?void 0:i.message)||d.message)||o("비밀번호가 일치하지 않습니다.")})}finally{n()}});return s.jsx(F,{...t,isDeskTopUsable:!0,isOpen:a,close:n,width:"400px",title:o("비밀번호 인증"),footerButtonList:[s.jsx(L,{type:"button",onClick:n,children:o("취소")},"cancel"),s.jsx(k,{type:"button",onClick:c,children:o("확인")},"submit")],children:s.jsxs("form",{onSubmit:c,children:[s.jsx("p",{style:{fontSize:14,color:"#666",marginBottom:16,lineHeight:1.5},children:o("글 작성 시 설정한 비밀번호를 입력해 주세요.")}),s.jsxs(B,{children:[s.jsx(b,{isRequired:!0,children:o("비밀번호")}),s.jsx(C,{type:"password",placeholder:o("비밀번호 입력"),...m("password",{required:o("비밀번호를 입력해 주세요.")}),maxLength:20,autoFocus:!0}),s.jsx(P,{name:"password",errors:h})]})]})})},v=({options:n}={})=>T({queryKey:A.config(),queryFn:async()=>{const{data:r}=await g.getConfig();return r},staleTime:3600*1e3,gcTime:7200*1e3,...n});export{R as P,V as a,v as u};