import{c as v,r as _,j as e,F,H as P}from"./app-BiexncSX.js";import{q as j}from"./index-DDBh_SM-.js";import{H as Q}from"./heading-CDALPReo.js";import{I as f}from"./input-error-BizLhD6E.js";import{B as q}from"./button-Cwvd_D5X.js";import{I as w}from"./input-C7geQw3H.js";import{L as h}from"./label-BACPLsln.js";import{A as C}from"./app-layout-BB5SDrLz.js";import{S as E,a as I}from"./layout-DJiDge_Q.js";import{K as H}from"./transition-B8SoPG3p.js";/* empty css            */import"./utils-DvRnx1Xn.js";import"./index-Dql7-O7m.js";import"./index-BLf-KPWz.js";import"./sonner-8z7PTnwf.js";import"./index-BphRgCCf.js";import"./loader-circle-C36m3ppM.js";import"./createLucideIcon-CiyItOCI.js";import"./triangle-alert-Dp60wOMH.js";import"./index-Bx9iUFeV.js";import"./index-BKRdUh5V.js";import"./index-DRVc8jnD.js";import"./index-CqDcnRSI.js";import"./x-Cp4MPESs.js";import"./tooltip-CFZPZp2b.js";import"./index-B9bcoF29.js";import"./index-3q7cNFQn.js";import"./index-vCsTGnV6.js";import"./index-BxgPClSG.js";import"./index-CW_Do8vH.js";import"./index-BzyVuPsA.js";import"./sun-D646Bdfj.js";import"./index-jmbesBs1.js";import"./chevrons-up-down-B23gAN10.js";import"./bed-double-DlbqgL2k.js";import"./utensils-CU7nxPop.js";import"./globe-CZ3jv1ui.js";import"./chevron-right-D-bIFB2o.js";import"./house-CmuRWHdh.js";import"./separator-BE6xCedb.js";import"./index-Drs7entj.js";const s=r=>({url:s.url(r),method:"get"});s.definition={methods:["get","head"],url:"/settings/password"};s.url=r=>s.definition.url+j(r);s.get=r=>({url:s.url(r),method:"get"});s.head=r=>({url:s.url(r),method:"head"});const g=r=>({action:s.url(r),method:"get"});g.get=r=>({action:s.url(r),method:"get"});g.head=r=>({action:s.url({[r?.mergeQuery?"mergeQuery":"query"]:{_method:"HEAD",...r?.query??r?.mergeQuery??{}}}),method:"get"});s.form=g;const t=r=>({url:t.url(r),method:"put"});t.definition={methods:["put"],url:"/settings/password"};t.url=r=>t.definition.url+j(r);t.put=r=>({url:t.url(r),method:"put"});const b=r=>({action:t.url({[r?.mergeQuery?"mergeQuery":"query"]:{_method:"PUT",...r?.query??r?.mergeQuery??{}}}),method:"post"});b.put=r=>({action:t.url({[r?.mergeQuery?"mergeQuery":"query"]:{_method:"PUT",...r?.query??r?.mergeQuery??{}}}),method:"post"});t.form=b;const L={update:t},R=[{title:"Password settings",href:I().url}];function Nr(){const r=v.c(8),y=_.useRef(null),x=_.useRef(null);let o,a;r[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(P,{title:"Password settings"}),a=e.jsx("h1",{className:"sr-only",children:"Password Settings"}),r[0]=o,r[1]=a):(o=r[0],a=r[1]);let m;r[2]===Symbol.for("react.memo_cache_sentinel")?(m=e.jsx(Q,{variant:"small",title:"Update password",description:"Ensure your account is using a long, random password to stay secure"}),r[2]=m):m=r[2];let i,n,l;r[3]===Symbol.for("react.memo_cache_sentinel")?(i=L.update.form(),n={preserveScroll:!0},l=["password","password_confirmation","current_password"],r[3]=i,r[4]=n,r[5]=l):(i=r[3],n=r[4],l=r[5]);let p;r[6]===Symbol.for("react.memo_cache_sentinel")?(p=u=>{u.password&&y.current?.focus(),u.current_password&&x.current?.focus()},r[6]=p):p=r[6];let d;return r[7]===Symbol.for("react.memo_cache_sentinel")?(d=e.jsxs(C,{breadcrumbs:R,children:[o,a,e.jsx(E,{children:e.jsxs("div",{className:"space-y-6",children:[m,e.jsx(F,{...i,options:n,resetOnError:l,resetOnSuccess:!0,onError:p,className:"space-y-6",children:u=>{const{errors:c,processing:N,recentlySuccessful:S}=u;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{htmlFor:"current_password",children:"Current password"}),e.jsx(w,{id:"current_password",ref:x,name:"current_password",type:"password",className:"mt-1 block w-full",autoComplete:"current-password",placeholder:"Current password"}),e.jsx(f,{message:c.current_password})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{htmlFor:"password",children:"New password"}),e.jsx(w,{id:"password",ref:y,name:"password",type:"password",className:"mt-1 block w-full",autoComplete:"new-password",placeholder:"New password"}),e.jsx(f,{message:c.password})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{htmlFor:"password_confirmation",children:"Confirm password"}),e.jsx(w,{id:"password_confirmation",name:"password_confirmation",type:"password",className:"mt-1 block w-full",autoComplete:"new-password",placeholder:"Confirm password"}),e.jsx(f,{message:c.password_confirmation})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(q,{disabled:N,"data-test":"update-password-button",children:"Save password"}),e.jsx(H,{show:S,enter:"transition ease-in-out",enterFrom:"opacity-0",leave:"transition ease-in-out",leaveTo:"opacity-0",children:e.jsx("p",{className:"text-sm text-neutral-600",children:"Saved"})})]})]})}})]})})]}),r[7]=d):d=r[7],d}export{Nr as default};
