@wacht/jsx 0.0.1-alpha.15 → 0.0.1-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +9 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +16 -8
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3922,13 +3922,21 @@ cursor: pointer;
|
|
|
3922
3922
|
gap: 12px;
|
|
3923
3923
|
margin-bottom: 0;
|
|
3924
3924
|
`,U0=()=>e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",style:{color:"var(--color-secondary-text)"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"11",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.5",opacity:"0.6"}),e.jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"0.5",opacity:"0.3"}),e.jsx("path",{d:"M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z",fill:"currentColor",opacity:"0.5"}),e.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor"}),e.jsx("text",{x:"12",y:"16.5",textAnchor:"middle",fill:"currentColor",fontSize:"6",opacity:"0.7",children:"?"})]}),W0=({browser:t})=>{const r=(t==null?void 0:t.toLowerCase())||"",o={width:20,height:20};return r.includes("chrome")?e.jsx(R0,{...o}):r.includes("firefox")?e.jsx(I0,{...o}):r.includes("safari")?e.jsx(T0,{...o}):r.includes("edge")?e.jsx(O0,{...o}):r.includes("opera")?e.jsx(M0,{...o}):r.includes("brave")?e.jsx(L0,{...o}):e.jsx(U0,{})},V0=()=>{const[t,r]=i.useState(null),{signins:o,removeSignin:n,refetch:a,loading:s}=tc(),{refetch:p}=Fe(),{toast:g}=It(),c=o,h=async l=>{try{await n(l),await Promise.all([a(),p()]),r(null),g("Session ended successfully","info")}catch(m){g(m.message||"Failed to end session. Please try again.","error")}},d=l=>{if(!l||l.trim()==="")return"Unknown";const m=new Date(l);if(isNaN(m.getTime()))return"Unknown";const v=Math.floor((new Date().getTime()-m.getTime())/(1e3*60));return v<1?"Just now":v<60?`${v}m ago`:v<1440?`${Math.floor(v/60)}h ago`:m.toLocaleDateString()};return s?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"20px"},children:e.jsx(Re,{})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsx("h3",{style:{fontSize:"16px",color:"var(--color-foreground)",margin:0},children:"Active Sessions"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--color-muted)",margin:0},children:"Manage your active browser sessions and sign-ins"})]}),e.jsx("div",{children:c&&c.length>0?e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(Ue,{children:[e.jsx(Ce,{children:"Browser & Device"}),e.jsx(Ce,{children:"Location"}),e.jsx(Ce,{children:"Last Active"}),e.jsx(Ce,{})]})}),e.jsx(_t,{children:c.map(l=>e.jsxs(Ue,{children:[e.jsx(Oe,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Al,{children:e.jsx(W0,{browser:l.browser||"Unknown"})}),e.jsxs("div",{children:[e.jsx("div",{children:l.browser||"Unknown Browser"}),l.device&&e.jsx("div",{style:{fontSize:"12px",color:"var(--color-muted)"},children:l.device})]})]})}),e.jsx(Oe,{children:e.jsxs("div",{children:[e.jsx("div",{children:l.city&&l.country?`${l.city}, ${l.country}`:"Unknown location"}),l.ip_address&&e.jsx("div",{style:{fontSize:"12px",color:"var(--color-muted)"},children:l.ip_address})]})}),e.jsx(Oe,{children:d(l.last_active_at)}),e.jsx(Ct,{children:e.jsxs(ot,{open:t===l.id,openChange:m=>r(m?l.id:null),children:[e.jsx(at,{children:e.jsx(nn,{children:"•••"})}),e.jsx(nt,{children:e.jsx(Pe,{onClick:()=>h(l.id),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(zt,{size:14}),"End Session"]})})})]})})]},l.id))})]}):e.jsx(it,{title:"No active sessions",description:"You don't have any active sessions at the moment."})})]})},G0=()=>{var b,f,I,j;const{deployment:t}=ve(),{toast:r}=It(),[o,n]=i.useState(null),[a,s]=i.useState(""),[p,g]=i.useState(!1),[c,h]=i.useState(null),[d,l]=i.useState(""),m=i.useRef(null),x=i.useRef({}),{user:v,createEmailAddress:w,deleteEmailAddress:C,prepareEmailVerification:$,attemptEmailVerification:y,makeEmailPrimary:z}=rr();if(!((f=(b=t==null?void 0:t.auth_settings)==null?void 0:b.email_address)!=null&&f.enabled))return null;const _=async S=>{try{if(S===(v==null?void 0:v.primary_email_address_id)){r("Cannot delete primary email address. Please set another email as primary first.","error");return}await C(S),v.refetch(),r("Email address deleted successfully","info")}catch(R){r(R.message||"Failed to delete email address. Please try again.","error")}},k=i.useMemo(()=>v!=null&&v.user_email_addresses?d.trim()?v.user_email_addresses.filter(S=>S.email.toLowerCase().includes(d.toLowerCase())):v.user_email_addresses:[],[v==null?void 0:v.user_email_addresses,d]);return e.jsxs(e.Fragment,{children:[e.jsxs(Bo,{style:{marginBottom:"20px"},children:[e.jsx(wt,{value:d,onChange:l,placeholder:"Search Email"}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx(K,{ref:m,onClick:()=>g(!0),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Add Email"}),p&&e.jsx(ti,{triggerRef:m,onClose:()=>g(!1),onAddEmail:async S=>{const R=await w(S);s(R.data.id),await $(R.data.id),v.refetch()},onPrepareVerification:async()=>{await $(a),v.refetch()},onAttemptVerification:async S=>{await y(a,S),v.refetch(),g(!1),s(""),r("Email added and verified successfully!","info")}})]})]}),k!=null&&k.length?e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(Ue,{children:[e.jsx(Ce,{children:"Email Address"}),e.jsx(Ce,{children:"Status"}),e.jsx(Ce,{})]})}),e.jsx(_t,{children:k.map(S=>e.jsxs(Ue,{children:[e.jsx(Oe,{children:S.email}),e.jsx(Oe,{children:S.id===(v==null?void 0:v.primary_email_address_id)?"Primary":S.verified?"Verified":"Not Verified"}),e.jsx(Ct,{children:S.id!==(v==null?void 0:v.primary_email_address_id)||!S.verified?e.jsxs(ot,{open:o===S.id,openChange:R=>n(R?S.id:null),children:[e.jsx(at,{children:e.jsx(nn,{ref:R=>{R&&(x.current[S.id]=R)},children:"•••"})}),e.jsxs(nt,{children:[S.id!==(v==null?void 0:v.primary_email_address_id)&&S.verified&&e.jsx(Pe,{onClick:async()=>{try{await z(S.id),v.refetch(),n(null),r("Primary email updated successfully","info")}catch(R){r(R.message||"Failed to update primary email","error")}},children:"Make primary"}),!S.verified&&e.jsx(Pe,{onClick:async()=>{n(null),await $(S.id),h(S.id)},children:"Verify email"}),S.id!==(v==null?void 0:v.primary_email_address_id)&&e.jsx(Pe,{$destructive:!0,onClick:()=>{_(S.id),n(null)},children:"Remove"})]})]}):null})]},S.id))})]}):e.jsx(it,{title:d?"No emails match your search":"No email addresses",description:"Add an email address to get started."}),c&&e.jsx(ti,{existingEmail:(j=(I=v==null?void 0:v.user_email_addresses)==null?void 0:I.find(S=>S.id===c))==null?void 0:j.email,triggerRef:{current:x.current[c]},onClose:()=>h(null),onAddEmail:async()=>{},onPrepareVerification:async()=>{await $(c),v.refetch()},onAttemptVerification:async S=>{await y(c,S),v.refetch(),h(null),r("Email verified successfully!","info")}})]})},H0=()=>{var k,b,f,I;const{deployment:t}=ve(),[r,o]=i.useState(null),[n,a]=i.useState(""),[s,p]=i.useState(!1),[g,c]=i.useState(null),[h,d]=i.useState(""),l=i.useRef(null),m=i.useRef({}),{user:x,createPhoneNumber:v,deletePhoneNumber:w,preparePhoneVerification:C,attemptPhoneVerification:$,makePhonePrimary:y}=rr();if(!((b=(k=t==null?void 0:t.auth_settings)==null?void 0:k.phone_number)!=null&&b.enabled))return null;const z=j=>{const S=Eo.find(R=>R.dialCode===j);return(S==null?void 0:S.flag)||"🌍"},_=i.useMemo(()=>x!=null&&x.user_phone_numbers?h.trim()?x.user_phone_numbers.filter(j=>j.phone_number.toLowerCase().includes(h.toLowerCase())):x.user_phone_numbers:[],[x==null?void 0:x.user_phone_numbers,h]);return e.jsxs(e.Fragment,{children:[e.jsxs(Bo,{style:{marginBottom:"20px"},children:[e.jsx(wt,{value:h,onChange:d,placeholder:"Search Phone"}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx(K,{ref:l,onClick:()=>p(!0),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Add Phone"}),s&&e.jsx(ni,{triggerRef:l,onClose:()=>p(!1),onAddPhone:async(j,S)=>{const R=await v(j,S);a(R.data.id),await C(R.data.id)},onPrepareVerification:async()=>{await C(n),x.refetch()},onAttemptVerification:async j=>{await $(n,j),x.refetch(),p(!1)}}),g&&e.jsx(ni,{existingPhone:(I=(f=x==null?void 0:x.user_phone_numbers)==null?void 0:f.find(j=>j.id===g))==null?void 0:I.phone_number,triggerRef:{current:m.current[g]},onClose:()=>c(null),onAddPhone:async()=>{},onPrepareVerification:async()=>{await C(g),x.refetch()},onAttemptVerification:async j=>{await $(g,j),x.refetch(),c(null)}})]})]}),_!=null&&_.length?e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(Ue,{children:[e.jsx(Ce,{children:"Phone Number"}),e.jsx(Ce,{children:"Status"}),e.jsx(Ce,{})]})}),e.jsx(_t,{children:_.map(j=>e.jsxs(Ue,{children:[e.jsx(Oe,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"18px"},children:z(j.country_code)}),e.jsx("span",{children:j.country_code}),e.jsx("span",{children:j.phone_number})]})}),e.jsx(Oe,{children:j.id===(x==null?void 0:x.primary_phone_number_id)?"Primary":j.verified?"Verified":"Not Verified"}),e.jsx(Ct,{children:e.jsxs(ot,{open:r===j.id,openChange:S=>o(S?j.id:null),children:[e.jsx(at,{children:e.jsx(nn,{ref:S=>{S&&(m.current[j.id]=S)},children:"•••"})}),e.jsxs(nt,{children:[j.id!==(x==null?void 0:x.primary_phone_number_id)&&j.verified&&e.jsx(Pe,{onClick:async()=>{await y(j.id),o(null),x.refetch()},children:"Make primary"}),!j.verified&&e.jsx(Pe,{onClick:async()=>{await C(j.id),c(j.id),o(null)},children:"Verify phone"}),e.jsx(Pe,{$destructive:!0,onClick:async()=>{await w(j.id),o(null),x.refetch()},children:"Remove"})]})]})})]},j.id))})]}):e.jsx(it,{title:h?"No phones match your search":"No phone numbers",description:"Add a phone number to get started."})]})},Al=u.div`
|
|
3925
|
+
width: 20px;
|
|
3926
|
+
height: 20px;
|
|
3927
|
+
flex-shrink: 0;
|
|
3928
|
+
display: flex;
|
|
3929
|
+
align-items: center;
|
|
3930
|
+
justify-content: center;
|
|
3931
|
+
overflow: hidden;
|
|
3932
|
+
|
|
3925
3933
|
svg {
|
|
3926
3934
|
width: 20px;
|
|
3927
3935
|
height: 20px;
|
|
3928
3936
|
flex-shrink: 0;
|
|
3929
3937
|
display: block;
|
|
3930
3938
|
}
|
|
3931
|
-
`,q0=()=>{const{user:t,disconnectSocialConnection:r,connectSocialAccount:o}=rr(),{deployment:n}=ve(),a={google_oauth:{icon:e.jsx(Dc,{}),label:"Google"},microsoft_oauth:{icon:e.jsx(Ac,{}),label:"Microsoft"},github_oauth:{icon:e.jsx(Lc,{}),label:"GitHub"},gitlab_oauth:{icon:e.jsx(Bc,{}),label:"GitLab"},linkedin_oauth:{icon:e.jsx(Fc,{}),label:"LinkedIn"},discord_oauth:{icon:e.jsx(Uc,{}),label:"Discord"},x_oauth:{icon:e.jsx(Nc,{}),label:"X"}},s=(n==null?void 0:n.social_connections.filter(p=>p.enabled))||[];return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx("h3",{style:{fontSize:"16px",margin:"0 0 6px 0",letterSpacing:"-0.01em",color:"var(--color-foreground)"},children:"Connected Accounts"}),e.jsx("p",{style:{fontSize:"13px",margin:0,lineHeight:"1.5",color:"var(--color-muted)"},children:"Connect social accounts for easy sign-in and profile sync"})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column"},children:s.map((p,g)=>{var d;const c=((d=t==null?void 0:t.social_connections)==null?void 0:d.filter(l=>l.provider===p.provider))||[],h=a[p.provider];return h?e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0",minHeight:"58px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",color:"var(--color-foreground)"},children:[e.jsx(Al,{children:h.icon}),e.jsx("div",{style:{fontSize:"14px",fontWeight:500},children:h.label})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[c.map(l=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",background:"var(--color-input-background)",border:"1px solid var(--color-border)",borderRadius:"6px",padding:"4px 8px",fontSize:"13px",color:"var(--color-muted)"},children:[e.jsx("span",{children:l.email_address}),e.jsx(nn,{onClick:async()=>{await r(l.id.toString()),t.refetch()},style:{padding:"2px"},children:e.jsx(Ke,{size:14})})]},l.id)),c.length>0?e.jsx(K,{onClick:()=>{o({provider:p.provider,redirectUri:window.location.href})},style:{padding:"6px 24px",fontSize:"13px"},children:"Add"}):e.jsx(K,{onClick:()=>{o({provider:p.provider,redirectUri:window.location.href})},style:{padding:"6px 14px",fontSize:"13px"},children:"Connect"})]})]}),g<s.length-1&&e.jsx("div",{style:{height:"1px",background:"var(--color-border)"}})]},p.provider):null})})]})},Dl=()=>{var
|
|
3939
|
+
`,q0=()=>{const{user:t,disconnectSocialConnection:r,connectSocialAccount:o}=rr(),{deployment:n}=ve(),a={google_oauth:{icon:e.jsx(Dc,{}),label:"Google"},microsoft_oauth:{icon:e.jsx(Ac,{}),label:"Microsoft"},github_oauth:{icon:e.jsx(Lc,{}),label:"GitHub"},gitlab_oauth:{icon:e.jsx(Bc,{}),label:"GitLab"},linkedin_oauth:{icon:e.jsx(Fc,{}),label:"LinkedIn"},discord_oauth:{icon:e.jsx(Uc,{}),label:"Discord"},x_oauth:{icon:e.jsx(Nc,{}),label:"X"}},s=(n==null?void 0:n.social_connections.filter(p=>p.enabled))||[];return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx("h3",{style:{fontSize:"16px",margin:"0 0 6px 0",letterSpacing:"-0.01em",color:"var(--color-foreground)"},children:"Connected Accounts"}),e.jsx("p",{style:{fontSize:"13px",margin:0,lineHeight:"1.5",color:"var(--color-muted)"},children:"Connect social accounts for easy sign-in and profile sync"})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column"},children:s.map((p,g)=>{var d;const c=((d=t==null?void 0:t.social_connections)==null?void 0:d.filter(l=>l.provider===p.provider))||[],h=a[p.provider];return h?e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0",minHeight:"58px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",color:"var(--color-foreground)"},children:[e.jsx(Al,{children:h.icon}),e.jsx("div",{style:{fontSize:"14px",fontWeight:500},children:h.label})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[c.map(l=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",background:"var(--color-input-background)",border:"1px solid var(--color-border)",borderRadius:"6px",padding:"4px 8px",fontSize:"13px",color:"var(--color-muted)"},children:[e.jsx("span",{children:l.email_address}),e.jsx(nn,{onClick:async()=>{await r(l.id.toString()),t.refetch()},style:{padding:"2px"},children:e.jsx(Ke,{size:14})})]},l.id)),c.length>0?e.jsx(K,{onClick:()=>{o({provider:p.provider,redirectUri:window.location.href})},style:{padding:"6px 24px",fontSize:"13px"},children:"Add"}):e.jsx(K,{onClick:()=>{o({provider:p.provider,redirectUri:window.location.href})},style:{padding:"6px 14px",fontSize:"13px"},children:"Connect"})]})]}),g<s.length-1&&e.jsx("div",{style:{height:"1px",background:"var(--color-border)"}})]},p.provider):null})})]})},Dl=()=>{var v,w,C,$,y,z,_;const{loading:t}=rr(),{deployment:r}=ve(),[o,n]=i.useState("profile"),[a,s]=i.useState(null),[p,g]=i.useState("info"),c=i.useCallback((k,b="info")=>{s(k),g(b),setTimeout(()=>s(null),3e3)},[s]);if(t)return e.jsx(le,{children:e.jsx(di,{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(Re,{})})});const h=r==null?void 0:r.auth_settings,d=(v=h==null?void 0:h.email_address)==null?void 0:v.enabled,l=(w=h==null?void 0:h.phone_number)==null?void 0:w.enabled,m=((C=r==null?void 0:r.social_connections)==null?void 0:C.some(k=>k.enabled))||!1,x=(($=h==null?void 0:h.password)==null?void 0:$.enabled)||((y=h==null?void 0:h.auth_factors_enabled)==null?void 0:y.authenticator)||((z=h==null?void 0:h.auth_factors_enabled)==null?void 0:z.phone_otp)||((_=h==null?void 0:h.auth_factors_enabled)==null?void 0:_.backup_code);return e.jsx(le,{children:e.jsx(D0,{children:e.jsx(kr.Provider,{value:{screen:null,setScreen:()=>{},toast:c},children:e.jsxs(di,{children:[e.jsx(N0,{children:e.jsxs(F0,{children:[e.jsx(dr,{$isActive:o==="profile",onClick:()=>n("profile"),children:e.jsxs(ur,{children:[e.jsx(Mo,{size:16}),"Profile"]})}),d&&e.jsx(dr,{$isActive:o==="email",onClick:()=>n("email"),children:e.jsxs(ur,{children:[e.jsx(Wr,{size:16}),"Email"]})}),l&&e.jsx(dr,{$isActive:o==="phone",onClick:()=>n("phone"),children:e.jsxs(ur,{children:[e.jsx(Rh,{size:16}),"Phone"]})}),m&&e.jsx(dr,{$isActive:o==="social",onClick:()=>n("social"),children:e.jsxs(ur,{children:[e.jsx(wh,{size:16}),"Connections"]})}),x&&e.jsx(dr,{$isActive:o==="security",onClick:()=>n("security"),children:e.jsxs(ur,{children:[e.jsx(Xo,{size:16}),"Security"]})}),e.jsx(dr,{$isActive:o==="sessions",onClick:()=>n("sessions"),children:e.jsxs(ur,{children:[e.jsx(Zp,{size:16}),"Sessions"]})})]})}),e.jsxs(B0,{children:[o==="profile"&&e.jsx(Z0,{}),o==="email"&&d&&e.jsx(G0,{}),o==="phone"&&l&&e.jsx(H0,{}),o==="social"&&m&&e.jsx(q0,{}),o==="security"&&x&&e.jsx(Y0,{}),o==="sessions"&&e.jsx(V0,{})]}),a&&e.jsx("div",{style:{position:"absolute",bottom:"20px",right:"20px",background:"var(--color-input-background)",border:"1px solid var(--color-border)",borderRadius:"8px",padding:"12px 16px",boxShadow:"0 4px 12px var(--color-shadow)",animation:"slideUp 0.3s ease-out"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[p==="error"?e.jsx(ut,{size:16,color:"var(--color-error)"}):e.jsx(rt,{size:16,color:"var(--color-success)"}),e.jsx("span",{style:{fontSize:"14px",color:"var(--color-foreground)"},children:a})]})})]})})})})},Y0=()=>{var ne,ye,be;const{deployment:t}=ve(),{user:r,updatePassword:o,removePassword:n,setupAuthenticator:a,verifyAuthenticator:s,deleteAuthenticator:p,generateBackupCodes:g,regenerateBackupCodes:c,updateProfile:h}=rr(),{toast:d}=It(),[l,m]=i.useState((r==null?void 0:r.second_factor_policy)||"none"),[x,v]=i.useState(!1),w=async te=>{try{await h({second_factor_policy:te}),m(te),d("Second factor policy updated successfully","info")}catch($e){d($e.message||"Failed to update second factor policy","error")}},[C,$]=i.useState(!1),[y,z]=i.useState(!1),[_,k]=i.useState(!1),[b,f]=i.useState(!1),I=i.useRef(null),j=i.useRef(null),S=i.useRef(null),R=i.useRef(null),[E,T]=i.useState("table"),[P,O]=i.useState(""),[D,M]=i.useState(""),[N,F]=i.useState(""),[J,ie]=i.useState(["",""]),[re,X]=i.useState([]),[U,Z]=i.useState(!1),[Q,ae]=i.useState(!1),[oe]=i.useState(!1),[ce,Y]=i.useState(!1),se=(ne=t==null?void 0:t.auth_settings)==null?void 0:ne.auth_factors_enabled,q=(be=(ye=t==null?void 0:t.auth_settings)==null?void 0:ye.password)==null?void 0:be.enabled;if(!(se!=null&&se.authenticator)&&!(se!=null&&se.backup_code)&&!q)return null;const H=async(te,$e)=>{await o(te,$e),await r.refetch(),d("Password updated successfully","info")},A=async te=>{await n(te),await r.refetch(),d("Password removed successfully","info")},B=()=>{var Ee,or,nr,Vr,za,Ea;if(!r)return!1;const te=(Ee=r.user_email_addresses)==null?void 0:Ee.some(_r=>_r.verified),$e=(or=r.user_phone_numbers)==null?void 0:or.some(_r=>_r.verified),fe=r.social_connections&&r.social_connections.length>0,ke=t==null?void 0:t.auth_settings;return(ke==null?void 0:ke.first_factor)==="email_otp"&&te||((nr=ke==null?void 0:ke.magic_link)==null?void 0:nr.enabled)&&te||((Vr=ke==null?void 0:ke.passkey)==null?void 0:Vr.enabled)||((za=ke==null?void 0:ke.auth_factors_enabled)==null?void 0:za.phone_otp)&&$e||fe&&((Ea=t==null?void 0:t.social_connections)==null?void 0:Ea.some(_r=>_r.enabled))},L=async()=>{if(J.some(te=>te.length!==6)){d("Please enter both 6-digit verification codes","error");return}try{if(ae(!0),await s(N,J),await r.refetch(),se!=null&&se.backup_code){const te=await g();X(te),await r.refetch(),T("backup")}else T("success")}catch(te){d(te.message||"Invalid verification codes","error")}finally{ae(!1)}},W=()=>{T("table"),O(""),M(""),F(""),ie(["",""]),X([]),d("Two-factor authentication setup completed successfully!","info")},ee=async()=>{var te;if((te=r==null?void 0:r.user_authenticator)!=null&&te.id)try{Y(!0),await p(r.user_authenticator.id),await r.refetch(),v(!1),d("Two-factor authentication removed successfully","info")}catch($e){d($e.message||"Failed to remove authenticator","error")}finally{Y(!1)}},pe=async()=>{if(!U)try{Z(!0);const te=await c();X(te),await r.refetch(),f(!0),d("New backup codes generated","info")}catch(te){d(te.message||"Failed to generate backup codes","error")}finally{Z(!1)}},Se=()=>{const te=re.join(`
|
|
3932
3940
|
`);navigator.clipboard.writeText(te).then(()=>{d("Backup codes copied to clipboard","info")}).catch(()=>{d("Failed to copy backup codes","error")})},Ne=()=>{const te=re.join(`
|
|
3933
3941
|
`),$e=new Blob([te],{type:"text/plain"}),fe=URL.createObjectURL($e),ke=document.createElement("a");ke.href=fe,ke.download="wacht-backup-codes.txt",ke.click(),URL.revokeObjectURL(fe),d("Backup codes downloaded","info")},G=[];return q&&G.push({id:"password",name:"Password",description:"Secure your account with a strong password",status:r!=null&&r.has_password?"Enabled":"Disabled",actions:r!=null&&r.has_password?["change"]:["setup"]}),se!=null&&se.authenticator&&G.push({id:"authenticator",name:"Two-Factor Authentication",description:"Use an authenticator app for extra security",status:r!=null&&r.user_authenticator?"Enabled":"Disabled",actions:r!=null&&r.user_authenticator?["remove"]:["setup"]}),r!=null&&r.user_authenticator&&G.push({id:"backup_codes",name:"Backup Codes",description:"Recovery codes if you lose your authenticator",status:r!=null&&r.backup_codes_generated?"Generated":"Not Generated",actions:["generate"]}),(r!=null&&r.user_authenticator||r!=null&&r.backup_codes_generated||r.second_factor_policy==="enforced"||r.primary_phone_number_id)&&G.push({id:"second_factor_policy",name:"Second Factor Policy",description:"Require a second factor for all sign-ins",status:l==="enforced"?"Enforced":"Optional",actions:["toggle"]}),E!=="table"?e.jsxs(e.Fragment,{children:[e.jsxs(Bo,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Xo,{size:16}),e.jsxs("span",{style:{fontSize:"14px",fontWeight:500,color:"var(--color-foreground)"},children:[E==="qr"&&"Setup Two-Factor Authentication",E==="verify"&&"Verify Your Authenticator",E==="backup"&&"Save Your Backup Codes",E==="success"&&"Setup Complete!"]})]}),e.jsx(K,{onClick:()=>T("table"),style:{padding:"8px 16px",fontSize:"14px",background:"var(--color-background)",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",color:"var(--color-foreground)",fontWeight:"500",cursor:"pointer",transition:"all 0.2s ease"},children:"← Back"})]}),e.jsxs("div",{style:{maxWidth:"500px",margin:"0 auto",textAlign:"center",padding:"24px"},children:[E==="qr"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{color:"var(--color-secondary-text)",marginBottom:"24px"},children:"Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)"}),e.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"24px"},children:oe?e.jsx("div",{style:{width:"200px",height:"200px",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-input-background)"},children:e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("div",{style:{width:"24px",height:"24px",border:"2px solid var(--color-border)",borderTop:"2px solid var(--color-primary)",borderRadius:"50%",animation:`${A0} 1s linear infinite`,margin:"0 auto 8px"}}),e.jsx("div",{style:{fontSize:"12px",color:"var(--color-secondary-text)"},children:"Loading QR Code..."})]})}):P?e.jsx("div",{style:{border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",padding:"16px",background:"white"},children:e.jsx(Sa,{value:P,size:200,level:"M",marginSize:0})}):e.jsx("div",{style:{width:"200px",height:"200px",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-input-background)",color:"var(--color-error)",fontSize:"14px",textAlign:"center"},children:"QR Code Not Available"})}),e.jsxs("div",{style:{background:"var(--color-input-background)",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",padding:"12px",marginBottom:"24px"},children:[e.jsx("p",{style:{fontSize:"14px",color:"var(--color-secondary-text)",margin:"0 0 8px 0"},children:"Or enter this code manually:"}),e.jsx("code",{style:{fontFamily:"monospace",fontSize:"14px",wordBreak:"break-all"},children:D||"Loading..."})]}),e.jsx(K,{onClick:()=>T("verify"),disabled:!P||!D,style:{padding:"10px 20px",background:!P||!D?"var(--color-border)":"var(--color-primary)",color:!P||!D?"var(--color-secondary-text)":"white",border:`1px solid ${!P||!D?"var(--color-border)":"var(--color-primary)"}`,cursor:!P||!D?"not-allowed":"pointer"},children:"I've Scanned the Code"})]}),E==="verify"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{color:"var(--color-secondary-text)",marginBottom:"24px"},children:"Enter two consecutive codes from your authenticator app to verify setup"}),e.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"center",marginBottom:"24px"},children:[e.jsx(de,{type:"text",placeholder:"000000",value:J[0],onChange:te=>{const $e=te.target.value.replace(/[^0-9]/g,"").substring(0,6);ie([$e,J[1]])},maxLength:6,style:{width:"100px",textAlign:"center",fontFamily:"monospace"}}),e.jsx(de,{type:"text",placeholder:"000000",value:J[1],onChange:te=>{const $e=te.target.value.replace(/[^0-9]/g,"").substring(0,6);ie([J[0],$e])},maxLength:6,style:{width:"100px",textAlign:"center",fontFamily:"monospace"}})]}),e.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"center"},children:[e.jsx(K,{onClick:()=>T("qr"),style:{padding:"8px 16px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:"Back"}),e.jsx(K,{onClick:L,disabled:Q||J.some(te=>te.length!==6),style:{padding:"8px 16px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)"},children:Q?"Verifying...":"Verify & Continue"})]})]}),E==="backup"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{background:"var(--color-warning-background)",border:"1px solid var(--color-warning-border)",borderRadius:"var(--radius-md)",padding:"16px",marginBottom:"24px",display:"flex",alignItems:"flex-start",gap:"12px",textAlign:"left"},children:[e.jsx(ut,{size:16,style:{color:"var(--color-warning)",marginTop:"2px"}}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,marginBottom:"4px"},children:"Important!"}),e.jsx("div",{style:{fontSize:"14px",color:"var(--color-secondary-text)"},children:"Store these codes safely. Each code can only be used once if you lose access to your authenticator device."})]})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"8px",marginBottom:"24px",maxWidth:"300px",margin:"0 auto 24px auto"},children:re.map((te,$e)=>e.jsx("div",{style:{background:"var(--color-input-background)",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",padding:"8px",fontFamily:"monospace",fontSize:"12px",textAlign:"center",cursor:"pointer"},onClick:()=>navigator.clipboard.writeText(te),children:te},$e))}),e.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"center",marginBottom:"24px"},children:[e.jsx(K,{onClick:Se,style:{padding:"8px 16px",fontSize:"14px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:"Copy All"}),e.jsxs(K,{onClick:Ne,style:{padding:"8px 16px",fontSize:"14px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:[e.jsx(Qo,{size:16,style:{marginRight:"4px"}}),"Download"]})]}),e.jsx(K,{onClick:W,style:{padding:"10px 20px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)"},children:"Complete Setup"})]}),E==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx(rt,{size:48,style:{color:"var(--color-success)",marginBottom:"16px"}}),e.jsx("h3",{style:{fontSize:"18px",fontWeight:600,margin:"0 0 8px 0"},children:"All Set!"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--color-secondary-text)",margin:0},children:"Your account is now protected with two-factor authentication."})]}),e.jsx(K,{onClick:W,style:{padding:"10px 20px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)"},children:"Continue to Security"})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Bo,{children:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:e.jsx("span",{style:{fontSize:"14px",fontWeight:400,color:"var(--color-foreground)"},children:"Security Settings"})})}),G.length?e.jsx("div",{children:G.map((te,$e)=>e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 0"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:400,color:"var(--color-foreground)"},children:te.name}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-secondary-text)"},children:te.description})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[e.jsx("span",{style:{padding:"4px 12px",borderRadius:"16px",fontSize:"12px",fontWeight:400,background:te.status==="Enabled"||te.status==="Generated"?"var(--color-success-background)":"var(--color-background-hover)",color:te.status==="Enabled"||te.status==="Generated"?"var(--color-success)":"var(--color-secondary-text)"},children:te.status}),e.jsxs("div",{style:{position:"relative"},children:[te.id==="password"&&e.jsx(e.Fragment,{children:r!=null&&r.has_password?e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsx(K,{ref:j,onClick:()=>z(!0),style:{padding:"6px 12px",fontSize:"12px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:"Change"}),y&&e.jsx(ci,{triggerRef:j,onClose:()=>z(!1),onChangePassword:H})]}),B()&&e.jsxs("div",{style:{position:"relative"},children:[e.jsx(K,{ref:S,onClick:()=>k(!0),style:{padding:"6px 12px",fontSize:"12px",background:"transparent",color:"var(--color-error)",border:"1px solid var(--color-error)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:"Remove"}),_&&e.jsx(k0,{triggerRef:S,onClose:()=>k(!1),onRemovePassword:A})]})]}):e.jsxs("div",{style:{position:"relative"},children:[e.jsx(K,{ref:j,onClick:()=>z(!0),style:{padding:"6px 12px",fontSize:"12px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:"Setup"}),y&&e.jsx(ci,{triggerRef:j,onClose:()=>z(!1),onChangePassword:H,isSetup:!0})]})}),te.id==="authenticator"&&!(r!=null&&r.user_authenticator)&&e.jsx(e.Fragment,{children:e.jsxs("div",{style:{position:"relative"},children:[e.jsx(K,{ref:I,onClick:()=>$(!0),disabled:oe,style:{padding:"6px 12px",fontSize:"12px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:oe?"Setting up...":"Setup"}),C&&e.jsx(f0,{triggerRef:I,onClose:()=>$(!1),onSetupTOTP:async()=>{const fe=await a();return F(fe.id),fe},onVerifyTOTP:async fe=>{await s(N,fe),await r.refetch(),d("Two-factor authentication enabled successfully!","info")}})]})}),te.id==="authenticator"&&(r==null?void 0:r.user_authenticator)&&e.jsxs("div",{style:{position:"relative"},children:[e.jsx(K,{onClick:()=>v(!0),disabled:ce,style:{padding:"6px 16px",fontSize:"13px",background:"var(--color-error)",border:"1px solid var(--color-error)",color:"white",cursor:ce?"not-allowed":"pointer",opacity:ce?.6:1},children:ce?"Removing...":"Remove"}),x&&e.jsx(on,{title:"Remove MFA and reset policy to default?",onConfirm:ee,onCancel:()=>v(!1)})]}),te.id==="backup_codes"&&e.jsx(e.Fragment,{children:e.jsxs("div",{style:{position:"relative"},children:[e.jsx(K,{ref:R,onClick:pe,disabled:U,style:{padding:"6px 12px",fontSize:"12px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:U?"Generating...":r!=null&&r.backup_codes_generated?"Regenerate":"Generate"}),b&&e.jsx(P0,{triggerRef:R,codes:re,onClose:()=>f(!1),onCopy:Se,onDownload:Ne})]})}),te.id==="second_factor_policy"&&e.jsx(Ao,{checked:l==="enforced",onChange:fe=>{w(fe?"enforced":"none")}})]})]})]}),$e<G.length-1&&e.jsx("div",{style:{height:"1px",background:"var(--color-border)",margin:"0"}})]},te.id))}):e.jsx(it,{title:"No security features available",description:"Contact your administrator to enable security features."})]})},Z0=()=>{var M,N;const{deployment:t}=ve(),{user:r,updateProfile:o,updateProfilePicture:n,deleteAccount:a}=rr(),{toast:s}=It(),[p,g]=i.useState(""),[c,h]=i.useState(""),[d,l]=i.useState(""),[m,x]=i.useState(!1),[v,w]=i.useState(!1),[C,$]=i.useState(!1),[y,z]=i.useState(""),[_,k]=i.useState((r==null?void 0:r.profile_picture_url)||null),b=i.useRef(null);i.useEffect(()=>{r&&!m&&(g(r.first_name||""),h(r.last_name||""),l(r.username||""),k(r.profile_picture_url||null),x(!0))},[r,m]);const f=i.useCallback(async()=>{if(r)try{const F={};p!==r.first_name&&(F.first_name=p),c!==r.last_name&&(F.last_name=c),d!==r.username&&(F.username=d),Object.keys(F).length>0&&await o(F)}catch(F){s(F.message||"Failed to save profile changes","error")}},[r,o,p,c,d,s]),I=F=>{g(F.target.value)},j=F=>{h(F.target.value)},S=F=>{l(F.target.value)},R=()=>{f()},E=()=>{f()},T=()=>{f()},P=F=>{var J;if((J=F.target.files)!=null&&J[0]){const ie=F.target.files[0];k(URL.createObjectURL(ie)),setTimeout(async()=>{try{await n(ie),r.refetch(),s("Profile picture updated successfully","info")}catch(re){s(re.message||"Failed to update profile picture","error"),k((r==null?void 0:r.profile_picture_url)||null)}},100)}},O=()=>{b.current&&b.current.click()};if(!r)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Re,{})});const D=async()=>{if(!(!r||y!==r.username)){$(!0);try{await a(""),s("Account deleted successfully","info")}catch(F){s(F.message||"Failed to delete account","error")}finally{$(!1),z(""),w(!1)}}};return e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-2xl)"},children:[e.jsxs("div",{style:{display:"flex",gap:"var(--space-2xl)",alignItems:"center"},children:[e.jsx("div",{style:{flexShrink:0},children:e.jsxs("div",{style:{width:"120px",height:"120px",borderRadius:"50%",border:"2px dashed var(--color-border)",background:_?"transparent":"var(--color-input-background)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"all 0.2s ease"},onClick:O,onMouseEnter:F=>{F.currentTarget.style.borderColor="var(--color-primary)",F.currentTarget.style.transform="scale(1.02)"},onMouseLeave:F=>{F.currentTarget.style.borderColor="var(--color-border)",F.currentTarget.style.transform="scale(1)"},children:[_?e.jsx("img",{src:_,alt:"Profile Picture",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):e.jsx(Mo,{size:32,color:"var(--color-muted)"}),e.jsx("input",{type:"file",ref:b,style:{display:"none"},accept:"image/*",onChange:P})]})}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{marginBottom:"var(--space-lg)"},children:[e.jsx("h3",{style:{fontSize:"var(--font-sm)",color:"var(--color-foreground)",margin:"0 0 var(--space-2xs) 0"},children:"Profile Picture"}),e.jsx("p",{style:{fontSize:"var(--font-xs)",color:"var(--color-secondary-text)",margin:0},children:"Upload an image to represent your profile"})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--space-sm)",marginBottom:"var(--space-sm)"},children:[e.jsxs(K,{onClick:()=>{var F;return(F=b.current)==null?void 0:F.click()},style:{padding:"var(--space-xs) var(--space-md)",fontSize:"var(--font-xs)",height:"32px",width:"100px",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx(Qo,{size:14}),_?"Change":"Upload"]}),e.jsxs(K,{onClick:async()=>{k(null),b.current&&(b.current.value="");try{await o({remove_profile_picture:!0}),await r.refetch(),s("Profile picture removed successfully","info")}catch(F){s(F.message||"Failed to remove profile picture","error"),k((r==null?void 0:r.profile_picture_url)||null)}},style:{background:"transparent",color:"var(--color-muted)",border:"1px solid var(--color-border)",padding:"var(--space-xs) var(--space-md)",fontSize:"var(--font-xs)",height:"32px",width:"100px",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx(ut,{size:14}),"Remove"]})]})]})]}),e.jsx("div",{style:{position:"relative",height:"1px",background:"var(--color-divider)",margin:"0"}}),e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"var(--space-md)"},children:[e.jsx("h3",{style:{fontSize:"var(--font-sm)",color:"var(--color-foreground)",margin:"0 0 var(--space-2xs) 0"},children:"Profile Details"}),e.jsx("p",{style:{fontSize:"var(--font-xs)",color:"var(--color-secondary-text)",margin:0},children:"Basic information about your profile"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-lg)"},children:[e.jsxs("div",{style:{display:"flex",gap:"var(--space-md)"},children:[e.jsxs(he,{style:{flex:1},children:[e.jsx(ue,{htmlFor:"firstName",children:"First Name"}),e.jsx(de,{id:"firstName",type:"text",value:p,onChange:I,onBlur:R,placeholder:"Enter your first name",required:!0})]}),e.jsxs(he,{style:{flex:1},children:[e.jsx(ue,{htmlFor:"lastName",children:"Last Name"}),e.jsx(de,{id:"lastName",type:"text",value:c,onChange:j,onBlur:E,placeholder:"Enter your last name",required:!0})]})]}),((N=(M=t==null?void 0:t.auth_settings)==null?void 0:M.username)==null?void 0:N.enabled)&&e.jsxs(he,{children:[e.jsx(ue,{htmlFor:"username",children:"Username"}),e.jsx(de,{id:"username",type:"text",value:d,onChange:S,onBlur:T,placeholder:"Enter your username",required:!0})]})]})]}),e.jsx("div",{style:{position:"relative",height:"1px",background:"var(--color-divider)",margin:"0"}}),e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsx("h3",{style:{fontSize:"16px",color:"var(--color-foreground)",margin:"0 0 4px 0"},children:"Danger Zone"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--color-muted)",margin:0},children:"Irreversible and destructive actions"})]}),e.jsxs("div",{style:{padding:"20px",border:"1px solid var(--color-error)",borderRadius:"8px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:v?"20px":"0"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"14px",color:"var(--color-foreground)",marginBottom:"4px",fontWeight:"500"},children:"Delete Account"}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-muted)"},children:"Once you delete your account, there is no going back. Please be certain."})]}),e.jsx(K,{onClick:()=>{v?(w(!1),z("")):w(!0)},style:{background:"var(--color-error)",color:"white",border:"none",padding:"6px 12px",fontSize:"13px",height:"32px",width:"auto"},children:v?"Cancel":"Delete"})]}),v&&e.jsxs("div",{style:{maxWidth:"400px"},children:[e.jsxs(he,{children:[e.jsx(ue,{htmlFor:"confirm_username",children:"Confirm by typing your username"}),e.jsx(de,{id:"confirm_username",type:"text",value:y,onChange:F=>z(F.target.value),placeholder:`Type "${r==null?void 0:r.username}" to confirm`})]}),e.jsx(K,{onClick:D,disabled:y!==(r==null?void 0:r.username)||C,style:{background:y===(r==null?void 0:r.username)?"var(--color-error)":"transparent",color:y===(r==null?void 0:r.username)?"white":"var(--color-muted)",border:"1px solid var(--color-border)",padding:"8px 16px",fontSize:"14px",height:"36px",cursor:y===(r==null?void 0:r.username)?"pointer":"not-allowed",opacity:y===(r==null?void 0:r.username)?1:.6,marginTop:"12px"},children:C?e.jsx(Re,{size:12}):"Delete Forever"})]})]})]})]})})},Nl=({isOpen:t,onClose:r,title:o,showHeader:n,headerContent:a,footerContent:s,customContent:p,children:g,showCloseButton:c})=>e.jsx(we,{isOpen:t,onClose:r,children:e.jsx(we.Overlay,{children:e.jsxs(we.Content,{style:{width:"900px",maxWidth:"100%"},children:[n&&e.jsx(we.Header,{showCloseButton:c,children:a||o}),p||g||e.jsx(Dl,{}),s&&e.jsx(we.Footer,{children:s})]})})}),K0=u.div`
|
|
3934
3942
|
position: relative;
|