import{a as e,i as t,n,p as r,r as i}from"./createLucideIcon-XxmMb-o2.js";import{t as a}from"./button-DM0MIgIC.js";import{t as o}from"./password-input-BMqwGmqj.js";import{r as s,t as c}from"./react-DGZBJm-I.js";import{n as l}from"./wayfinder-Dp7PqxvV.js";import{S as u}from"./app-BvqieymH.js";import{t as d}from"./input-error-oHEIsY1C.js";import{t as f}from"./label-DTKsHeRF.js";import{t as p}from"./spinner-CWH4EzOz.js";import{n as m}from"./confirm-Culw9Q-x.js";var h=i(),g=e=>({url:g.url(e),method:`get`});g.definition={methods:[`get`,`head`],url:`/passkeys/confirm/options`},g.url=e=>g.definition.url+l(e),g.get=e=>({url:g.url(e),method:`get`}),g.head=e=>({url:g.url(e),method:`head`});var _=e=>({action:g.url(e),method:`get`});_.get=e=>({action:g.url(e),method:`get`}),_.head=e=>({action:g.url({[e?.mergeQuery?`mergeQuery`:`query`]:{_method:`HEAD`,...e?.query??e?.mergeQuery??{}}}),method:`get`}),g.form=_;var v=e=>({url:v.url(e),method:`post`});v.definition={methods:[`post`],url:`/passkeys/confirm`},v.url=e=>v.definition.url+l(e),v.post=e=>({url:v.url(e),method:`post`});var y=e=>({action:v.url(e),method:`post`});y.post=e=>({action:v.url(e),method:`post`}),v.form=y;var b=n();function x(e){let t=(0,h.c)(24),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{routes:r,label:i,loadingLabel:o,separator:l}=n,f;t[2]===r?f=t[3]:(f=r&&{routes:{options:r.options.url,submit:r.submit.url}},t[2]=r,t[3]=f);let m;t[4]===f?m=t[5]:(m={...f,onSuccess:S},t[4]=f,t[5]=m);let{verify:g,isLoading:_,error:v,isSupported:y}=c(m);if(!y)return null;let x;t[6]===_?x=t[7]:(x=_?(0,b.jsx)(p,{}):(0,b.jsx)(s,{className:`h-4 w-4`}),t[6]=_,t[7]=x);let C=_?o??`Authenticating...`:i??`Sign in with a passkey`,w;t[8]!==_||t[9]!==x||t[10]!==C||t[11]!==g?(w=(0,b.jsxs)(a,{type:`button`,variant:`outline`,className:`w-full`,onClick:g,disabled:_,children:[x,C]}),t[8]=_,t[9]=x,t[10]=C,t[11]=g,t[12]=w):w=t[12];let T;t[13]===v?T=t[14]:(T=v&&(0,b.jsx)(d,{message:v,className:`text-center`}),t[13]=v,t[14]=T);let E;t[15]!==w||t[16]!==T?(E=(0,b.jsxs)(`div`,{className:`grid gap-2`,children:[w,T]}),t[15]=w,t[16]=T,t[17]=E):E=t[17];let D;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,b.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,b.jsx)(u,{className:`w-full`})}),t[18]=D):D=t[18];let O=l??`Or continue with email`,k;t[19]===O?k=t[20]:(k=(0,b.jsxs)(`div`,{className:`relative my-6`,children:[D,(0,b.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,b.jsx)(`span`,{className:`bg-background text-muted-foreground px-2`,children:O})})]}),t[19]=O,t[20]=k);let A;return t[21]!==k||t[22]!==E?(A=(0,b.jsxs)(b.Fragment,{children:[E,k]}),t[21]=k,t[22]=E,t[23]=A):A=t[23],A}function S(e){r.visit(e.redirect??`/dashboard`)}function C(){let n=(0,h.c)(3),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,b.jsx)(e,{title:`Confirm password`}),n[0]=r):r=n[0];let i;n[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,b.jsx)(x,{routes:{options:g(),submit:v()},label:`Confirm with passkey`,loadingLabel:`Confirming...`,separator:`Or confirm with password`}),n[1]=i):i=n[1];let a;return n[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,b.jsxs)(b.Fragment,{children:[r,i,(0,b.jsx)(t,{...m.form(),resetOnSuccess:[`password`],children:w})]}),n[2]=a):a=n[2],a}function w(e){let{processing:t,errors:n}=e;return(0,b.jsxs)(`div`,{className:`space-y-6`,children:[(0,b.jsxs)(`div`,{className:`grid gap-2`,children:[(0,b.jsx)(f,{htmlFor:`password`,children:`Password`}),(0,b.jsx)(o,{id:`password`,name:`password`,placeholder:`Password`,autoComplete:`current-password`,autoFocus:!0}),(0,b.jsx)(d,{message:n.password})]}),(0,b.jsx)(`div`,{className:`flex items-center`,children:(0,b.jsxs)(a,{className:`w-full`,disabled:t,"data-test":`confirm-password-button`,children:[t&&(0,b.jsx)(p,{}),`Confirm password`]})})]})}C.layout={title:`Confirm password`,description:`This is a secure area of the application. Please confirm your password before continuing.`};export{C as default};