@strands.gg/accui 2.18.1 → 2.19.1

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.
Files changed (74) hide show
  1. package/dist/StrandsUIPlugin-5AOCDOcM.cjs.js +143 -0
  2. package/dist/StrandsUIPlugin-AI0SbvpH.es.js +20708 -0
  3. package/dist/StrandsUIPlugin-B0HUf-tm.es.js +20437 -0
  4. package/dist/StrandsUIPlugin-B98LOdrQ.cjs.js +143 -0
  5. package/dist/StrandsUIPlugin-BbeOau1G.cjs.js +143 -0
  6. package/dist/StrandsUIPlugin-BcARSDQF.cjs.js +143 -0
  7. package/dist/StrandsUIPlugin-CCRrewS9.es.js +20587 -0
  8. package/dist/StrandsUIPlugin-CQk56uZ2.es.js +19805 -0
  9. package/dist/StrandsUIPlugin-Cgmu6cTA.es.js +20440 -0
  10. package/dist/StrandsUIPlugin-CpBH0QFc.cjs.js +272 -0
  11. package/dist/StrandsUIPlugin-Ct91SLTy.es.js +20587 -0
  12. package/dist/StrandsUIPlugin-DHhawL07.cjs.js +143 -0
  13. package/dist/StrandsUIPlugin-DY7VCw7G.es.js +20437 -0
  14. package/dist/StrandsUIPlugin-DZU1IjwD.cjs.js +143 -0
  15. package/dist/StrandsUIPlugin-Tpi8IoJc.cjs.js +143 -0
  16. package/dist/StrandsUIPlugin-lRGsfjf5.es.js +20440 -0
  17. package/dist/index.cjs.js +5 -5
  18. package/dist/index.es.js +2902 -2806
  19. package/dist/nuxt/module.cjs.js +6 -6
  20. package/dist/nuxt/module.es.js +17 -17
  21. package/dist/nuxt/runtime/composables/useStrandsAuth.cjs.js +1 -1
  22. package/dist/nuxt/runtime/composables/useStrandsAuth.d.ts +7 -1
  23. package/dist/nuxt/runtime/composables/useStrandsAuth.es.js +24 -19
  24. package/dist/nuxt/runtime/plugin.client.cjs.js +1 -1
  25. package/dist/nuxt/runtime/plugin.client.es.js +9 -14
  26. package/dist/nuxt/runtime/plugin.server.cjs.js +1 -1
  27. package/dist/nuxt/runtime/plugin.server.es.js +1 -1
  28. package/dist/types/composables.d.ts +6 -2
  29. package/dist/types/index.d.ts +14 -0
  30. package/dist/useDarkMode-Cew-NWjS.cjs.js +1 -0
  31. package/dist/useDarkMode-CvinMR9O.es.js +102 -0
  32. package/dist/useDarkMode-OZ_A8-6H.es.js +102 -0
  33. package/dist/useStrandsAuth-B7Fqq-Qp.es.js +717 -0
  34. package/dist/useStrandsAuth-BDTnh_c_.es.js +702 -0
  35. package/dist/useStrandsAuth-CEQ4UsKz.cjs.js +1 -0
  36. package/dist/useStrandsAuth-CboHAkjH.es.js +717 -0
  37. package/dist/useStrandsAuth-CetpoBNk.cjs.js +1 -0
  38. package/dist/useStrandsAuth-D2HvStMt.es.js +787 -0
  39. package/dist/useStrandsAuth-DSLFMDTj.es.js +717 -0
  40. package/dist/useStrandsAuth-Db5ZGvxL.cjs.js +1 -0
  41. package/dist/useStrandsAuth-Dz3Grglt.cjs.js +1 -0
  42. package/dist/useStrandsAuth-FVoni53L.es.js +666 -0
  43. package/dist/useStrandsAuth-Yp5OpRHU.cjs.js +1 -0
  44. package/dist/useStrandsConfig-48gZP9xV.es.js +209 -0
  45. package/dist/useStrandsConfig-B8h5hDy7.es.js +219 -0
  46. package/dist/useStrandsConfig-BGJg1LlC.es.js +213 -0
  47. package/dist/useStrandsConfig-BY_IIwK8.cjs.js +1 -0
  48. package/dist/useStrandsConfig-DRGldIzy.cjs.js +1 -0
  49. package/dist/vite.cjs.js +1 -1
  50. package/dist/vite.es.js +1 -1
  51. package/dist/vue/components/SignedIn.vue.d.ts +3 -1
  52. package/dist/vue/components/VirtualList.vue.d.ts +36 -0
  53. package/dist/vue/composables/useKnownAccounts.d.ts +33 -0
  54. package/dist/vue/index.d.ts +1 -0
  55. package/dist/vue/ui/UiBunnyFontPicker.vue.d.ts +23 -0
  56. package/dist/vue/ui/UiInput/UiInput.Select.vue.d.ts +806 -0
  57. package/dist/webcomponents/entries/strands-alert.d.ts +2 -0
  58. package/dist/webcomponents/entries/strands-button.d.ts +2 -0
  59. package/dist/webcomponents/entries/strands-card.d.ts +2 -0
  60. package/dist/webcomponents/entries/strands-checkbox-group.d.ts +2 -0
  61. package/dist/webcomponents/entries/strands-divider.d.ts +2 -0
  62. package/dist/webcomponents/entries/strands-input.d.ts +2 -0
  63. package/dist/webcomponents/entries/strands-link.d.ts +2 -0
  64. package/dist/webcomponents/entries/strands-loader-spinner.d.ts +2 -0
  65. package/dist/webcomponents/entries/strands-modal.d.ts +2 -0
  66. package/dist/webcomponents/entries/strands-pill.d.ts +2 -0
  67. package/dist/webcomponents/entries/strands-radio-group.d.ts +2 -0
  68. package/dist/webcomponents/entries/strands-slider.d.ts +2 -0
  69. package/dist/webcomponents/entries/strands-table.d.ts +2 -0
  70. package/dist/webcomponents/entries/strands-tabs.d.ts +2 -0
  71. package/dist/webcomponents/entries/strands-theme-toggle.d.ts +2 -0
  72. package/dist/webcomponents/entries/strands-toggle.d.ts +2 -0
  73. package/dist/webcomponents/entries/strands-tooltip.d.ts +2 -0
  74. package/package.json +16 -16
@@ -0,0 +1 @@
1
+ "use strict";const o=require("vue"),_e=require("./useStrandsConfig-BY_IIwK8.cjs.js"),$="strands_known_accounts";function R(){if(typeof document>"u")return[];try{const n=document.cookie.split(";").map(w=>w.trim()).find(w=>w.startsWith(`${$}=`));if(!n)return[];const f=n.slice($.length+1),m=decodeURIComponent(f),h=JSON.parse(m);return Array.isArray(h)?h:[]}catch{return[]}}const k=o.ref(R());function Ae(){function n(){k.value=R()}const f=o.computed(()=>k.value.find(s=>s.active)??null),m=o.computed(()=>k.value.filter(s=>!s.active)),h=o.computed(()=>k.value.length>1),w=o.computed(()=>k.value.length>0);return{accounts:k,activeAccount:f,otherAccounts:m,hasMultipleAccounts:h,hasKnownAccounts:w,refreshFromCookie:n}}class ke{cache=new Map;DEFAULT_TTL=300*1e3;async fetch(f,m,h=this.DEFAULT_TTL){const w=Date.now(),s=this.cache.get(f);if(s&&w-s.timestamp<s.ttl)return s.promise;this.cleanExpired();const d=m().finally(()=>{setTimeout(()=>{this.cache.delete(f)},h)});return this.cache.set(f,{promise:d,timestamp:w,ttl:h}),d}clear(){this.cache.clear()}invalidate(f){this.cache.delete(f)}cleanExpired(){const f=Date.now();for(const[m,h]of this.cache.entries())f-h.timestamp>h.ttl&&this.cache.delete(m)}getStats(){return{size:this.cache.size,entries:Array.from(this.cache.keys())}}}const p=new ke;function Ee(){return{fetch:p.fetch.bind(p),clear:p.clear.bind(p),invalidate:p.invalidate.bind(p),getStats:p.getStats.bind(p)}}function xe(n,f){let m=null;return(...h)=>{m&&clearTimeout(m),m=setTimeout(()=>{n(...h)},f)}}const j=xe((n,f)=>{typeof window<"u"&&localStorage.setItem(n,f)},300),E=n=>({id:n.id,email:n.email,firstName:n.first_name||n.firstName||"",lastName:n.last_name||n.lastName||"",avatar:n.avatar_url||n.avatar,mfaEnabled:n.mfa_enabled??n.mfaEnabled??!1,emailVerified:n.email_verified??n.emailVerified??!1,passwordUpdatedAt:n.password_updated_at||n.passwordUpdatedAt,settings:n.settings||{},xp:n.xp||0,level:n.level||1,next_level_xp:n.next_level_xp||n.next_level_xp||4,username:n.username,usernameLastChangedAt:n.username_last_changed_at||n.usernameLastChangedAt,createdAt:n.created_at||n.createdAt,updatedAt:n.updated_at||n.updatedAt||new Date().toISOString()}),U=()=>{if(typeof window>"u")return{currentUser:o.ref(null),currentSession:o.ref(null),loadingStates:o.ref({initializing:!0,signingIn:!1,signingUp:!1,signingOut:!1,refreshingToken:!1,sendingMfaEmail:!1,verifyingMfa:!1,loadingProfile:!1}),isInitialized:o.ref(!1),mfaRequired:o.ref(!1),mfaSessionId:o.ref(null),availableMfaMethods:o.ref([]),promise:null,refreshTimer:null,heartbeatTimer:null,refreshPromise:null,refreshTokenFn:null,startTimerFn:null,stopTimerFn:null};const n=window;return n.__STRANDS_AUTH_STATE__||(n.__STRANDS_AUTH_STATE__={currentUser:o.ref(null),currentSession:o.ref(null),loadingStates:o.ref({initializing:!0,signingIn:!1,signingUp:!1,signingOut:!1,refreshingToken:!1,sendingMfaEmail:!1,verifyingMfa:!1,loadingProfile:!1}),isInitialized:o.ref(!1),mfaRequired:o.ref(!1),mfaSessionId:o.ref(null),availableMfaMethods:o.ref([]),promise:null,refreshTimer:null,heartbeatTimer:null,refreshPromise:null,refreshTokenFn:null,startTimerFn:null,stopTimerFn:null}),n.__STRANDS_AUTH_STATE__},c=U();function Oe(){const{getUrl:n,config:f}=_e.useStrandsConfig(),{fetch:m,clear:h,invalidate:w}=Ee(),{currentUser:s,currentSession:d,loadingStates:i,isInitialized:y,mfaRequired:S,mfaSessionId:g,availableMfaMethods:_}=c,{refreshFromCookie:b}=Ae(),F=()=>{if(s.value=null,d.value=null,S.value=!1,g.value=null,_.value=[],A(),c.refreshPromise=null,h(),typeof window<"u"&&f.value?.onSignOutUrl){const t=window.location.pathname+window.location.search,e=f.value.onSignOutUrl;if(t!==e&&!t.startsWith(e)){const a=encodeURIComponent(t),r=e.includes("?")?"&":"?";window.location.href=`${e}${r}redirect=${a}`}}},J=o.computed(()=>i.value.initializing),z=o.computed(()=>i.value.signingIn),L=o.computed(()=>i.value.signingUp),H=o.computed(()=>i.value.signingOut),K=o.computed(()=>i.value.refreshingToken),V=o.computed(()=>i.value.sendingMfaEmail),q=o.computed(()=>i.value.verifyingMfa);o.computed(()=>i.value.loadingProfile);const C=o.computed(()=>i.value.signingIn||i.value.signingUp||i.value.signingOut||i.value.refreshingToken||i.value.sendingMfaEmail||i.value.verifyingMfa||i.value.loadingProfile),B=o.computed(()=>i.value.initializing||C.value),G=o.computed(()=>{const t=i.value;return t.initializing?"Checking authentication...":t.signingIn?"Signing you in...":t.signingUp?"Creating your account...":t.signingOut?"Signing you out...":t.refreshingToken?"Refreshing session...":t.sendingMfaEmail?"Sending verification code...":t.verifyingMfa?"Verifying code...":t.loadingProfile?"Loading profile...":"Loading..."}),W=()=>({"Content-Type":"application/json"}),Y=async()=>{try{const t=await fetch(n("authStatus"),{method:"GET",credentials:"include"});if(!t.ok)return!1;const e=await t.json();if(e.authenticated&&e.user){s.value=E(e.user);const a=e.expires_at?new Date(e.expires_at*1e3):new Date(Date.now()+480*60*1e3);return d.value={accessToken:"",refreshToken:"",expiresAt:a,userId:e.user.id},!0}return!1}catch{return!1}},Q=async(t,e,a)=>{const r=await fetch(n("mfaHardwareCompleteRegistration"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({device_id:t,credential:e})});if(!r.ok){const u=await r.text();let l="Failed to complete hardware key registration";try{const v=JSON.parse(u);l=v.message||v.error||u}catch{l=u||"Failed to complete hardware key registration"}throw new Error(l)}return r.json()},X=async(t,e,a="hardware")=>{const r=await fetch(n("mfaHardwareStartRegistration"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({device_name:t,device_type:a})});if(!r.ok){const u=await r.text();let l="Failed to start hardware key registration";try{const v=JSON.parse(u);l=v.message||v.error||u}catch{l=u||"Failed to start hardware key registration"}throw new Error(l)}return r.json()},Z=o.computed(()=>s.value!==null),ee=async t=>{i.value.signingIn=!0;try{S.value=!1,g.value=null,_.value=[];const e={"Content-Type":"application/json"};typeof window<"u"&&window.location&&(e.Origin=window.location.origin);const a=await fetch(n("signIn"),{method:"POST",headers:e,credentials:"include",body:JSON.stringify(t)});if(!a.ok)throw a.status===401?new Error("Invalid email or password"):a.status===403?new Error("Please verify your email address before signing in"):new Error(`Sign in failed: ${a.status} ${a.statusText}`);const r=await a.json();if(r.mfa_required){S.value=!0,g.value=r.mfa_session_id||null;const u=(r.available_mfa_methods||[]).map(l=>{let v=`${l.device_type.charAt(0).toUpperCase()+l.device_type.slice(1)} Authentication`;return l.device_type==="hardware"?v=l.device_name||"Security Key":l.device_type==="totp"?v=l.device_name||"Authenticator App":l.device_type==="email"&&(v=l.device_name||"Email Verification"),{id:l.device_id,device_type:l.device_type,device_name:l.device_name||v,is_active:!0,created_at:new Date().toISOString(),last_used_at:l.last_used_at,credential_id:l.credential_id,device_info:l.device_info}});return _.value=u,i.value.signingIn=!1,r}return await O(r),r}catch(e){throw e}finally{i.value.signingIn=!1}},te=async t=>{i.value.signingUp=!0;try{throw new Error("Sign up not implemented - please integrate with auth SDK")}finally{i.value.signingUp=!1}},ne=async t=>{i.value.signingOut=!0;try{const e=t?.all?`${n("signOut")}?all=true`:n("signOut");await(await fetch(e,{method:"POST",credentials:"include"})).text(),A(),c.refreshPromise=null,h(),s.value=null,d.value=null,S.value=!1,g.value=null,_.value=[],y.value=!1,b(),typeof window<"u"&&f.value?.onSignOutUrl&&(window.location.href=f.value.onSignOutUrl)}finally{i.value.signingOut=!1}},x=async()=>{if(c.refreshPromise)return await c.refreshPromise;c.refreshPromise=(async()=>{i.value.refreshingToken=!0;try{const e=await fetch(n("refresh"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"});if(!e.ok){if(e.status===401)return F(),!1;throw new Error(`Token refresh failed: ${e.status} ${e.statusText}`)}const a=await e.json();a.user&&(s.value=E(a.user));const u={accessToken:"",refreshToken:"",expiresAt:a.expires_at?new Date(a.expires_at*1e3):new Date(Date.now()+480*60*1e3),userId:a.user?.id||s.value?.id};return d.value=u,T(),w(`sessions:${s.value?.id||"unknown"}`),!0}catch{return F(),!1}finally{i.value.refreshingToken=!1}})();const t=await c.refreshPromise;return c.refreshPromise=null,t},ae=async()=>{const t=`profile:${d.value.accessToken.slice(0,20)}`;i.value.loadingProfile=!0;try{return await m(t,async()=>{const e=await fetch(n("profile"),{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d.value?.accessToken}`}});if(!e.ok)throw e.status===401?new Error("Authentication expired. Please sign in again."):new Error(`Failed to fetch profile: ${e.status} ${e.statusText}`);const a=await e.json();return s.value=E(a),s.value&&typeof window<"u"&&localStorage.setItem("strands_auth_user",JSON.stringify(s.value)),s.value})}finally{i.value.loadingProfile=!1}},ie=async t=>{i.value.loadingProfile=!0;try{const e=await fetch(n("profile"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d.value.accessToken}`},body:JSON.stringify({first_name:t.firstName,last_name:t.lastName})});if(!e.ok)throw e.status===401?new Error("Authentication expired. Please sign in again."):new Error(`Profile update failed: ${e.status} ${e.statusText}`);const a=await e.json();return s.value=E(a),s.value&&j("strands_auth_user",JSON.stringify(s.value)),s.value}finally{i.value.loadingProfile=!1}},se=async t=>{i.value.loadingProfile=!0;try{const e=await fetch(n("settings"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d.value.accessToken}`},body:JSON.stringify({settings:t})});if(!e.ok)throw e.status===401?new Error("Authentication expired. Please sign in again."):new Error(`Settings update failed: ${e.status} ${e.statusText}`);const a=await e.json();return s.value=E(a),s.value&&j("strands_auth_user",JSON.stringify(s.value)),s.value}finally{i.value.loadingProfile=!1}},re=async(t,e)=>{i.value.loadingProfile=!0;try{const a=await fetch(n("changeEmail"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d.value.accessToken}`},body:JSON.stringify({new_email:t,password:e})});if(!a.ok){if(a.status===401)throw new Error("Authentication expired. Please sign in again.");{const u=await a.json().catch(()=>({}));throw new Error(u.message||`Email change failed: ${a.status} ${a.statusText}`)}}const r=await a.json();return s.value&&(s.value={...s.value,email:t,emailVerified:!1,updatedAt:new Date().toISOString()},typeof window<"u"&&localStorage.setItem("strands_auth_user",JSON.stringify(s.value))),r}finally{i.value.loadingProfile=!1}},oe=async(t,e,a=!1)=>{if(!g.value)throw new Error("No MFA session available");i.value.verifyingMfa=!0;try{const r=n(a?"mfaBackupCodeVerify":"mfaSigninVerify"),u=a?{mfa_session_id:g.value,backup_code:e}:{mfa_session_id:g.value,device_id:t,code:e},l=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(u)});if(!l.ok){const P=await l.text();let D="MFA verification failed";try{const N=JSON.parse(P);D=N.message||N.error||P}catch{D=P||"MFA verification failed"}throw new Error(D)}const v=await l.json();return S.value=!1,g.value=null,_.value=[],await O(v),v}finally{i.value.verifyingMfa=!1}},le=async t=>{if(!g.value)throw new Error("No MFA session available");i.value.sendingMfaEmail=!0;try{const e=await fetch(n("mfaSigninSendEmail"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({mfa_session_id:g.value,device_id:t})});if(!e.ok){const r=await e.text();let u="Failed to send MFA email code";try{const l=JSON.parse(r);u=l.message||l.error||r}catch{u=r||"Failed to send MFA email code"}throw new Error(u)}return await e.json()}finally{i.value.sendingMfaEmail=!1}},ce=async t=>{if(!g.value)throw new Error("No MFA session available");const e=await fetch(n("mfaWebAuthnChallenge"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({mfa_session_id:g.value,device_id:t})});if(!e.ok){const a=await e.text();let r="Failed to get WebAuthn challenge";try{const u=JSON.parse(a);r=u.message||u.error||a}catch{r=a||r}throw new Error(r)}return e.json()},O=async t=>{try{t.user&&(s.value=E(t.user));const a={accessToken:"",refreshToken:"",expiresAt:t.expires_at?new Date(t.expires_at*1e3):new Date(Date.now()+480*60*1e3),userId:s.value?.id||t.user?.id};d.value=a,T(),b()}catch{}},ue=240*1e3,de=()=>{c.heartbeatTimer&&(clearInterval(c.heartbeatTimer),c.heartbeatTimer=null)};let M;const T=()=>{if(c.refreshTimer&&clearTimeout(c.refreshTimer),!d.value||typeof document<"u"&&document.visibilityState==="hidden")return;const t=new Date,a=d.value.expiresAt.getTime()-t.getTime()-60*1e3;if(a<=0){x();return}c.refreshTimer=setTimeout(async()=>{(typeof document>"u"||document.visibilityState==="visible")&&await x()&&T()},a),M()},A=()=>{c.refreshTimer&&(clearTimeout(c.refreshTimer),c.refreshTimer=null),de()};M=()=>{c.heartbeatTimer||(c.heartbeatTimer=setInterval(async()=>{if(typeof document<"u"&&document.visibilityState==="hidden"||!d.value)return;const t=Date.now();d.value.expiresAt.getTime()-t<=300*1e3&&await x(),!c.refreshTimer&&d.value&&T()},ue))},c.refreshTokenFn=x,c.startTimerFn=T,c.stopTimerFn=A;const I=async()=>{if(y.value){i.value.initializing=!1;return}if(c.promise){await c.promise;return}i.value.initializing=!0;const t=async()=>{try{typeof window<"u"&&(await Promise.race([Y(),new Promise(r=>setTimeout(()=>r(!1),5e3))])?T():(s.value=null,d.value=null)),y.value=!0,await new Promise(e=>setTimeout(e,50))}catch{}finally{i.value.initializing=!1,c.promise=null}};return c.promise=t(),c.promise},fe=async t=>{i.value.loadingProfile=!0;try{const e=await fetch(n("changeUsername"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({username:t})});if(!e.ok){const r=await e.json().catch(()=>({}));throw e.status===409?new Error("Username is already taken"):r.cooldown_end?new Error(`You can only change your username once every 30 days. You can change it again on ${new Date(r.cooldown_end).toLocaleDateString()}`):new Error(r.message||`Username change failed: ${e.status} ${e.statusText}`)}const a=await e.json();return s.value&&(s.value={...s.value,username:t,usernameLastChangedAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),a}finally{i.value.loadingProfile=!1}},he=async()=>{const t=await fetch(n("usernameCooldown"),{method:"GET",credentials:"include"});if(!t.ok)throw new Error(`Failed to get username cooldown: ${t.status} ${t.statusText}`);return t.json()},me=async t=>{const e=n("checkUsernameAvailability").replace("{username}",encodeURIComponent(t)),a=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});if(!a.ok)throw new Error(`Failed to check username availability: ${a.status} ${a.statusText}`);return a.json()},ge=async()=>{const t=`sessions:${s.value?.id||"no-user"}`;try{return await m(t,async()=>{const e=await fetch(n("sessions"),{method:"GET",credentials:"include"});if(!e.ok)throw await e.text(),new Error(`Failed to get user sessions: ${e.status} ${e.statusText}`);return e.json()},120*1e3)}catch(e){throw e}},ve=async()=>{const t=await fetch(n("sessionsStats"),{method:"GET",credentials:"include"});if(!t.ok)throw new Error(`Failed to get session stats: ${t.status} ${t.statusText}`);return t.json()},we=async t=>{const e=n("sessionRevoke").replace("{session_id}",encodeURIComponent(t)),a=await fetch(e,{method:"POST",credentials:"include"});if(!a.ok)throw new Error(`Failed to revoke session: ${a.status} ${a.statusText}`);return a.status===200},pe=async()=>{const t=await fetch(n("sessionsRevokeAll"),{method:"POST",credentials:"include"});if(!t.ok)throw new Error(`Failed to revoke all other sessions: ${t.status} ${t.statusText}`);return t.status===200},ye=async t=>{const e=await fetch(n("switchAccount"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({user_id:t})});if(!e.ok){const r=await e.json().catch(()=>({})),u=new Error(r.message||"Failed to switch account");throw u.code=r.code,u.email=r.email,u}const a=await e.json();return await O(a),a},Te=async t=>{if(!(await fetch(n("removeKnownAccount"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({user_id:t})})).ok)throw new Error("Failed to remove known account");b(),s.value?.id===t&&(s.value=null,d.value=null,A(),h())};if(typeof document<"u"&&typeof window<"u"){const t=window;t.__STRANDS_VISIBILITY_LISTENER__||(t.__STRANDS_VISIBILITY_LISTENER__=!0,document.addEventListener("visibilitychange",async()=>{const e=U();if(document.visibilityState==="visible"&&e.currentSession.value){const a=new Date;e.currentSession.value.expiresAt.getTime()-a.getTime()<=120*1e3?e.refreshTokenFn&&await e.refreshTokenFn():e.startTimerFn&&e.startTimerFn()}else document.visibilityState==="hidden"&&e.stopTimerFn&&e.stopTimerFn()}))}const Se=()=>{A(),h()};try{o.getCurrentInstance()&&o.onUnmounted(Se)}catch{}return y.value||I(),{user:o.computed(()=>s.value),currentUser:o.computed(()=>s.value),currentSession:o.computed(()=>d.value),isAuthenticated:Z,isLoading:o.computed(()=>B.value||!y.value),loading:C,loadingMessage:G,isInitializing:J,isInitialized:o.computed(()=>y.value),isSigningIn:z,isSigningUp:L,isSigningOut:H,isRefreshingToken:K,isSendingMfaEmail:V,isVerifyingMfa:q,mfaRequired:o.computed(()=>S.value),mfaSessionId:o.computed(()=>g.value),availableMfaMethods:o.computed(()=>_.value),signIn:ee,signUp:te,signOut:ne,refreshToken:x,fetchProfile:ae,updateProfile:ie,updateUserSettings:se,changeEmail:re,changeUsername:fe,getUsernameCooldown:he,checkUsernameAvailability:me,getUserSessions:ge,getSessionStats:ve,revokeSession:we,revokeAllOtherSessions:pe,initialize:I,setAuthData:O,verifyMfa:oe,sendMfaEmailCode:le,getMfaWebAuthnChallenge:ce,registerHardwareKey:X,completeHardwareKeyRegistration:Q,switchAccount:ye,removeKnownAccount:Te,startTokenRefreshTimer:T,stopTokenRefreshTimer:A,getAuthHeaders:W,forceReInit:()=>{y.value=!1,i.value.initializing=!0,I()}}}exports.useStrandsAuth=Oe;
@@ -0,0 +1,209 @@
1
+ import { ref as g, getCurrentInstance as h, inject as S, computed as f, provide as y } from "vue";
2
+ const d = {
3
+ baseUrl: "https://your-api.example.com",
4
+ accentColor: "#EA00A8",
5
+ autoRefresh: !0,
6
+ refreshInterval: 4,
7
+ protectedRoutes: [],
8
+ guestOnlyRoutes: ["/auth", "/login", "/register"],
9
+ devMode: !1,
10
+ styles: !0,
11
+ endpoints: {},
12
+ useSquircle: !0,
13
+ theme: "system"
14
+ }, a = {
15
+ signIn: "/api/v1/auth/sign-in",
16
+ signUp: "/api/v1/auth/sign-up",
17
+ signOut: "/api/v1/auth/sign-out",
18
+ refresh: "/api/v1/auth/refresh",
19
+ authStatus: "/api/v1/auth/status",
20
+ passwordReset: "/api/v1/auth/password-reset",
21
+ passwordResetConfirm: "/api/v1/auth/password-reset/confirm",
22
+ completeRegistration: "/api/v1/auth/complete-registration",
23
+ profile: "/api/v1/user/profile",
24
+ verifyEmail: "/api/v1/auth/verify-email",
25
+ oauthProviders: "/api/v1/oauth/providers",
26
+ oauthProvider: "/api/v1/oauth/providers/{provider_id}",
27
+ changeEmail: "/api/v1/user/change-email",
28
+ avatar: "/api/v1/user/avatar",
29
+ settings: "/api/v1/user/settings",
30
+ // Username endpoints
31
+ changeUsername: "/api/v1/user/username",
32
+ usernameCooldown: "/api/v1/user/username/cooldown",
33
+ checkUsernameAvailability: "/api/v1/username/{username}/available",
34
+ // MFA endpoints
35
+ mfaDevices: "/api/v1/mfa/devices",
36
+ mfaTotpSetup: "/api/v1/mfa/totp/setup",
37
+ mfaTotpVerify: "/api/v1/mfa/totp/verify",
38
+ mfaEmailSetup: "/api/v1/mfa/email/setup",
39
+ mfaEmailSend: "/api/v1/mfa/email/send",
40
+ mfaEmailVerify: "/api/v1/mfa/email/verify",
41
+ mfaDeviceDisable: "/api/v1/mfa/device/disable",
42
+ mfaBackupCodes: "/api/v1/mfa/backup-codes/regenerate",
43
+ // Hardware key endpoints
44
+ mfaHardwareStartRegistration: "/api/v1/mfa/hardware/start-registration",
45
+ mfaHardwareCompleteRegistration: "/api/v1/mfa/hardware/complete-registration",
46
+ // MFA sign-in specific endpoints
47
+ mfaSigninSendEmail: "/api/v1/auth/mfa/email/send",
48
+ mfaSigninVerify: "/api/v1/auth/mfa/verify",
49
+ mfaBackupCodeVerify: "/api/v1/auth/mfa/backup-code/verify",
50
+ mfaWebAuthnChallenge: "/api/v1/auth/mfa/webauthn/challenge",
51
+ // Session management endpoints
52
+ sessions: "/api/v1/sessions",
53
+ sessionsStats: "/api/v1/sessions/stats",
54
+ sessionRevoke: "/api/v1/sessions/{session_id}/revoke",
55
+ sessionsRevokeAll: "/api/v1/sessions/revoke-all"
56
+ }, p = Symbol("strands-config"), l = g(null);
57
+ function v(s) {
58
+ if (typeof window > "u" || !document.documentElement) return;
59
+ if (typeof CSS < "u" && CSS.registerProperty)
60
+ try {
61
+ CSS.registerProperty({
62
+ name: "--strands-accent",
63
+ syntax: "<color>",
64
+ inherits: !0,
65
+ initialValue: s
66
+ });
67
+ } catch {
68
+ }
69
+ document.documentElement.style.setProperty("--strands-accent", s), document.documentElement.style.setProperty("--accui-strands-accent", s);
70
+ const i = {
71
+ "--accui-strands-50": `color-mix(in srgb, ${s} 10%, white)`,
72
+ "--accui-strands-100": `color-mix(in srgb, ${s} 20%, white)`,
73
+ "--accui-strands-200": `color-mix(in srgb, ${s} 30%, white)`,
74
+ "--accui-strands-300": `color-mix(in srgb, ${s} 40%, white)`,
75
+ "--accui-strands-400": `color-mix(in srgb, ${s} 70%, white)`,
76
+ "--accui-strands-500": s,
77
+ "--accui-strands-600": `color-mix(in srgb, ${s} 85%, black)`,
78
+ "--accui-strands-700": `color-mix(in srgb, ${s} 70%, black)`,
79
+ "--accui-strands-800": `color-mix(in srgb, ${s} 55%, black)`,
80
+ "--accui-strands-900": `color-mix(in srgb, ${s} 40%, black)`,
81
+ "--accui-strands-950": `color-mix(in srgb, ${s} 25%, black)`
82
+ };
83
+ for (const [r, n] of Object.entries(i))
84
+ document.documentElement.style.setProperty(r, n);
85
+ }
86
+ function w(s) {
87
+ if (l.value = s, typeof window < "u" && document.documentElement) {
88
+ const i = s.useSquircle !== void 0 ? s.useSquircle : !0;
89
+ document.documentElement.style.setProperty("--strands-allow-squircle", i ? "1" : "0"), s.accentColor && v(s.accentColor);
90
+ }
91
+ try {
92
+ y(p, s);
93
+ } catch (i) {
94
+ console.warn("[Strands Auth] Could not provide config via Vue provide/inject. Config available via global state only.", i);
95
+ }
96
+ }
97
+ function b(s) {
98
+ let i = null;
99
+ try {
100
+ h() && (i = S(p, null));
101
+ } catch {
102
+ i = null;
103
+ }
104
+ let r = null;
105
+ try {
106
+ if (typeof window < "u") {
107
+ if (window.__STRANDS_CONFIG__)
108
+ r = window.__STRANDS_CONFIG__;
109
+ else if (window.__NUXT__) {
110
+ const t = window.__NUXT__;
111
+ r = t?.config?.public?.strandsAuth || t?.public?.strandsAuth || t?.strandsAuth;
112
+ }
113
+ }
114
+ } catch (t) {
115
+ console.error("[Strands Auth] Error accessing runtime configuration:", t);
116
+ }
117
+ const n = f(() => {
118
+ const t = {
119
+ ...d,
120
+ ...s || {},
121
+ ...i || {},
122
+ ...l.value || {},
123
+ ...r || {}
124
+ };
125
+ if (t.baseUrl === d.baseUrl && typeof window > "u" && console.warn("[Strands Auth] No baseUrl configured for SSR. Please provide a baseUrl in your strandsAuth configuration."), typeof window < "u" && document.documentElement) {
126
+ const e = t.useSquircle !== void 0 ? t.useSquircle : !0;
127
+ document.documentElement.style.setProperty("--strands-allow-squircle", e ? "1" : "0"), t.accentColor && document.documentElement.style.setProperty("--strands-accent", t.accentColor);
128
+ }
129
+ return t;
130
+ }), u = f(() => {
131
+ const e = n.value.endpoints || {};
132
+ return {
133
+ signIn: e.signIn || a.signIn,
134
+ signUp: e.signUp || a.signUp,
135
+ signOut: e.signOut || a.signOut,
136
+ refresh: e.refresh || a.refresh,
137
+ authStatus: e.authStatus || a.authStatus,
138
+ passwordReset: e.passwordReset || a.passwordReset,
139
+ passwordResetConfirm: e.passwordResetConfirm || a.passwordResetConfirm,
140
+ completeRegistration: e.completeRegistration || a.completeRegistration,
141
+ profile: e.profile || a.profile,
142
+ verifyEmail: e.verifyEmail || a.verifyEmail,
143
+ oauthProviders: e.oauthProviders || a.oauthProviders,
144
+ oauthProvider: e.oauthProvider || a.oauthProvider,
145
+ changeEmail: e.changeEmail || a.changeEmail,
146
+ avatar: e.avatar || a.avatar,
147
+ settings: e.settings || a.settings,
148
+ // Username endpoints
149
+ changeUsername: e.changeUsername || a.changeUsername,
150
+ usernameCooldown: e.usernameCooldown || a.usernameCooldown,
151
+ checkUsernameAvailability: e.checkUsernameAvailability || a.checkUsernameAvailability,
152
+ // MFA endpoints
153
+ mfaDevices: e.mfaDevices || a.mfaDevices,
154
+ mfaTotpSetup: e.mfaTotpSetup || a.mfaTotpSetup,
155
+ mfaTotpVerify: e.mfaTotpVerify || a.mfaTotpVerify,
156
+ mfaEmailSetup: e.mfaEmailSetup || a.mfaEmailSetup,
157
+ mfaEmailSend: e.mfaEmailSend || a.mfaEmailSend,
158
+ mfaEmailVerify: e.mfaEmailVerify || a.mfaEmailVerify,
159
+ mfaDeviceDisable: e.mfaDeviceDisable || a.mfaDeviceDisable,
160
+ mfaBackupCodes: e.mfaBackupCodes || a.mfaBackupCodes,
161
+ // Hardware key endpoints
162
+ mfaHardwareStartRegistration: e.mfaHardwareStartRegistration || a.mfaHardwareStartRegistration,
163
+ mfaHardwareCompleteRegistration: e.mfaHardwareCompleteRegistration || a.mfaHardwareCompleteRegistration,
164
+ // MFA sign-in specific endpoints
165
+ mfaSigninSendEmail: e.mfaSigninSendEmail || a.mfaSigninSendEmail,
166
+ mfaSigninVerify: e.mfaSigninVerify || a.mfaSigninVerify,
167
+ mfaBackupCodeVerify: e.mfaBackupCodeVerify || a.mfaBackupCodeVerify,
168
+ mfaWebAuthnChallenge: e.mfaWebAuthnChallenge || a.mfaWebAuthnChallenge,
169
+ // Session management endpoints
170
+ sessions: e.sessions || a.sessions,
171
+ sessionsStats: e.sessionsStats || a.sessionsStats,
172
+ sessionRevoke: e.sessionRevoke || a.sessionRevoke,
173
+ sessionsRevokeAll: e.sessionsRevokeAll || a.sessionsRevokeAll
174
+ };
175
+ });
176
+ return {
177
+ config: n,
178
+ endpoints: u,
179
+ getUrl: (t) => {
180
+ const e = n.value;
181
+ if (!e.baseUrl)
182
+ throw new Error("Base URL is required in configuration");
183
+ let o;
184
+ typeof t == "string" && t in u.value ? o = u.value[t] : typeof t == "string" ? o = t : o = u.value[t];
185
+ const m = e.baseUrl.replace(/\/$/, ""), c = o.startsWith("/") ? o : `/${o}`;
186
+ return console.debug(`[Strands Auth] Constructing URL for endpoint "${t}": ${m}${c}`), `${m}${c}`;
187
+ },
188
+ getSupportEmail: () => n.value.supportEmail || null
189
+ };
190
+ }
191
+ function E(s) {
192
+ if (l.value = s, typeof window < "u" && document.documentElement) {
193
+ const i = s.useSquircle !== void 0 ? s.useSquircle : !0;
194
+ document.documentElement.style.setProperty("--strands-allow-squircle", i ? "1" : "0"), s.accentColor && v(s.accentColor);
195
+ }
196
+ }
197
+ const A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
198
+ __proto__: null,
199
+ provideStrandsConfig: w,
200
+ setStrandsConfig: E,
201
+ useStrandsConfig: b
202
+ }, Symbol.toStringTag, { value: "Module" }));
203
+ export {
204
+ d as S,
205
+ A as a,
206
+ w as p,
207
+ E as s,
208
+ b as u
209
+ };
@@ -0,0 +1,219 @@
1
+ import { ref as g, getCurrentInstance as h, inject as S, computed as f, provide as y } from "vue";
2
+ const w = {
3
+ baseUrl: "https://your-api.example.com",
4
+ accentColor: "#EA00A8",
5
+ autoRefresh: !0,
6
+ refreshInterval: 4,
7
+ protectedRoutes: [],
8
+ guestOnlyRoutes: ["/auth", "/login", "/register"],
9
+ devMode: !1,
10
+ styles: !0,
11
+ endpoints: {},
12
+ useSquircle: !0,
13
+ theme: "system"
14
+ };
15
+ let d = !1;
16
+ const a = {
17
+ signIn: "/api/v1/auth/sign-in",
18
+ signUp: "/api/v1/auth/sign-up",
19
+ signOut: "/api/v1/auth/sign-out",
20
+ refresh: "/api/v1/auth/refresh",
21
+ authStatus: "/api/v1/auth/status",
22
+ passwordReset: "/api/v1/auth/password-reset",
23
+ passwordResetConfirm: "/api/v1/auth/password-reset/confirm",
24
+ completeRegistration: "/api/v1/auth/complete-registration",
25
+ profile: "/api/v1/user/profile",
26
+ verifyEmail: "/api/v1/auth/verify-email",
27
+ oauthProviders: "/api/v1/oauth/providers",
28
+ oauthProvider: "/api/v1/oauth/providers/{provider_id}",
29
+ changeEmail: "/api/v1/user/change-email",
30
+ avatar: "/api/v1/user/avatar",
31
+ settings: "/api/v1/user/settings",
32
+ // Username endpoints
33
+ changeUsername: "/api/v1/user/username",
34
+ usernameCooldown: "/api/v1/user/username/cooldown",
35
+ checkUsernameAvailability: "/api/v1/username/{username}/available",
36
+ // MFA endpoints
37
+ mfaDevices: "/api/v1/mfa/devices",
38
+ mfaTotpSetup: "/api/v1/mfa/totp/setup",
39
+ mfaTotpVerify: "/api/v1/mfa/totp/verify",
40
+ mfaEmailSetup: "/api/v1/mfa/email/setup",
41
+ mfaEmailSend: "/api/v1/mfa/email/send",
42
+ mfaEmailVerify: "/api/v1/mfa/email/verify",
43
+ mfaDeviceDisable: "/api/v1/mfa/device/disable",
44
+ mfaBackupCodes: "/api/v1/mfa/backup-codes/regenerate",
45
+ // Hardware key endpoints
46
+ mfaHardwareStartRegistration: "/api/v1/mfa/hardware/start-registration",
47
+ mfaHardwareCompleteRegistration: "/api/v1/mfa/hardware/complete-registration",
48
+ // MFA sign-in specific endpoints
49
+ mfaSigninSendEmail: "/api/v1/auth/mfa/email/send",
50
+ mfaSigninVerify: "/api/v1/auth/mfa/verify",
51
+ mfaBackupCodeVerify: "/api/v1/auth/mfa/backup-code/verify",
52
+ mfaWebAuthnChallenge: "/api/v1/auth/mfa/webauthn/challenge",
53
+ // Session management endpoints
54
+ sessions: "/api/v1/sessions",
55
+ sessionsStats: "/api/v1/sessions/stats",
56
+ sessionRevoke: "/api/v1/sessions/{session_id}/revoke",
57
+ sessionsRevokeAll: "/api/v1/sessions/revoke-all",
58
+ // Multi-account endpoints
59
+ switchAccount: "/api/v1/auth/switch-account",
60
+ removeKnownAccount: "/api/v1/auth/remove-known-account"
61
+ }, p = /* @__PURE__ */ Symbol("strands-config"), c = g(null);
62
+ function v(t) {
63
+ if (typeof window > "u" || !document.documentElement) return;
64
+ if (typeof CSS < "u" && CSS.registerProperty)
65
+ try {
66
+ CSS.registerProperty({
67
+ name: "--strands-accent",
68
+ syntax: "<color>",
69
+ inherits: !0,
70
+ initialValue: t
71
+ });
72
+ } catch {
73
+ }
74
+ document.documentElement.style.setProperty("--strands-accent", t), document.documentElement.style.setProperty("--accui-strands-accent", t);
75
+ const i = {
76
+ "--accui-strands-50": `color-mix(in srgb, ${t} 10%, white)`,
77
+ "--accui-strands-100": `color-mix(in srgb, ${t} 20%, white)`,
78
+ "--accui-strands-200": `color-mix(in srgb, ${t} 30%, white)`,
79
+ "--accui-strands-300": `color-mix(in srgb, ${t} 40%, white)`,
80
+ "--accui-strands-400": `color-mix(in srgb, ${t} 70%, white)`,
81
+ "--accui-strands-500": t,
82
+ "--accui-strands-600": `color-mix(in srgb, ${t} 85%, black)`,
83
+ "--accui-strands-700": `color-mix(in srgb, ${t} 70%, black)`,
84
+ "--accui-strands-800": `color-mix(in srgb, ${t} 55%, black)`,
85
+ "--accui-strands-900": `color-mix(in srgb, ${t} 40%, black)`,
86
+ "--accui-strands-950": `color-mix(in srgb, ${t} 25%, black)`
87
+ };
88
+ for (const [n, r] of Object.entries(i))
89
+ document.documentElement.style.setProperty(n, r);
90
+ }
91
+ function b(t) {
92
+ if (c.value = t, typeof window < "u" && document.documentElement) {
93
+ const i = t.useSquircle !== void 0 ? t.useSquircle : !0;
94
+ document.documentElement.style.setProperty("--strands-allow-squircle", i ? "1" : "0"), t.accentColor && v(t.accentColor);
95
+ }
96
+ try {
97
+ y(p, t);
98
+ } catch (i) {
99
+ console.warn("[Strands Auth] Could not provide config via Vue provide/inject. Config available via global state only.", i);
100
+ }
101
+ }
102
+ function E(t) {
103
+ let i = null;
104
+ try {
105
+ h() && (i = S(p, null));
106
+ } catch {
107
+ i = null;
108
+ }
109
+ let n = null;
110
+ try {
111
+ if (typeof window < "u") {
112
+ if (window.__STRANDS_CONFIG__)
113
+ n = window.__STRANDS_CONFIG__;
114
+ else if (window.__NUXT__) {
115
+ const s = window.__NUXT__;
116
+ n = s?.config?.public?.strandsAuth || s?.public?.strandsAuth || s?.strandsAuth;
117
+ }
118
+ }
119
+ } catch (s) {
120
+ console.error("[Strands Auth] Error accessing runtime configuration:", s);
121
+ }
122
+ const r = f(() => {
123
+ const s = {
124
+ ...w,
125
+ ...t || {},
126
+ ...i || {},
127
+ ...c.value || {},
128
+ ...n || {}
129
+ };
130
+ if (typeof window < "u" && document.documentElement) {
131
+ const e = s.useSquircle !== void 0 ? s.useSquircle : !0;
132
+ document.documentElement.style.setProperty("--strands-allow-squircle", e ? "1" : "0"), s.accentColor && document.documentElement.style.setProperty("--strands-accent", s.accentColor);
133
+ }
134
+ return s;
135
+ });
136
+ typeof window > "u" && !d && (c.value?.baseUrl || i?.baseUrl || t?.baseUrl || (d = !0, console.warn("[Strands Auth] No baseUrl configured for SSR. Please provide a baseUrl in your strandsAuth configuration.")));
137
+ const u = f(() => {
138
+ const e = r.value.endpoints || {};
139
+ return {
140
+ signIn: e.signIn || a.signIn,
141
+ signUp: e.signUp || a.signUp,
142
+ signOut: e.signOut || a.signOut,
143
+ refresh: e.refresh || a.refresh,
144
+ authStatus: e.authStatus || a.authStatus,
145
+ passwordReset: e.passwordReset || a.passwordReset,
146
+ passwordResetConfirm: e.passwordResetConfirm || a.passwordResetConfirm,
147
+ completeRegistration: e.completeRegistration || a.completeRegistration,
148
+ profile: e.profile || a.profile,
149
+ verifyEmail: e.verifyEmail || a.verifyEmail,
150
+ oauthProviders: e.oauthProviders || a.oauthProviders,
151
+ oauthProvider: e.oauthProvider || a.oauthProvider,
152
+ changeEmail: e.changeEmail || a.changeEmail,
153
+ avatar: e.avatar || a.avatar,
154
+ settings: e.settings || a.settings,
155
+ // Username endpoints
156
+ changeUsername: e.changeUsername || a.changeUsername,
157
+ usernameCooldown: e.usernameCooldown || a.usernameCooldown,
158
+ checkUsernameAvailability: e.checkUsernameAvailability || a.checkUsernameAvailability,
159
+ // MFA endpoints
160
+ mfaDevices: e.mfaDevices || a.mfaDevices,
161
+ mfaTotpSetup: e.mfaTotpSetup || a.mfaTotpSetup,
162
+ mfaTotpVerify: e.mfaTotpVerify || a.mfaTotpVerify,
163
+ mfaEmailSetup: e.mfaEmailSetup || a.mfaEmailSetup,
164
+ mfaEmailSend: e.mfaEmailSend || a.mfaEmailSend,
165
+ mfaEmailVerify: e.mfaEmailVerify || a.mfaEmailVerify,
166
+ mfaDeviceDisable: e.mfaDeviceDisable || a.mfaDeviceDisable,
167
+ mfaBackupCodes: e.mfaBackupCodes || a.mfaBackupCodes,
168
+ // Hardware key endpoints
169
+ mfaHardwareStartRegistration: e.mfaHardwareStartRegistration || a.mfaHardwareStartRegistration,
170
+ mfaHardwareCompleteRegistration: e.mfaHardwareCompleteRegistration || a.mfaHardwareCompleteRegistration,
171
+ // MFA sign-in specific endpoints
172
+ mfaSigninSendEmail: e.mfaSigninSendEmail || a.mfaSigninSendEmail,
173
+ mfaSigninVerify: e.mfaSigninVerify || a.mfaSigninVerify,
174
+ mfaBackupCodeVerify: e.mfaBackupCodeVerify || a.mfaBackupCodeVerify,
175
+ mfaWebAuthnChallenge: e.mfaWebAuthnChallenge || a.mfaWebAuthnChallenge,
176
+ // Session management endpoints
177
+ sessions: e.sessions || a.sessions,
178
+ sessionsStats: e.sessionsStats || a.sessionsStats,
179
+ sessionRevoke: e.sessionRevoke || a.sessionRevoke,
180
+ sessionsRevokeAll: e.sessionsRevokeAll || a.sessionsRevokeAll,
181
+ // Multi-account endpoints
182
+ switchAccount: e.switchAccount || a.switchAccount,
183
+ removeKnownAccount: e.removeKnownAccount || a.removeKnownAccount
184
+ };
185
+ });
186
+ return {
187
+ config: r,
188
+ endpoints: u,
189
+ getUrl: (s) => {
190
+ const e = r.value;
191
+ if (!e.baseUrl)
192
+ throw new Error("Base URL is required in configuration");
193
+ let o;
194
+ typeof s == "string" && s in u.value ? o = u.value[s] : typeof s == "string" ? o = s : o = u.value[s];
195
+ const l = e.baseUrl.replace(/\/$/, ""), m = o.startsWith("/") ? o : `/${o}`;
196
+ return console.debug(`[Strands Auth] Constructing URL for endpoint "${s}": ${l}${m}`), `${l}${m}`;
197
+ },
198
+ getSupportEmail: () => r.value.supportEmail || null
199
+ };
200
+ }
201
+ function C(t) {
202
+ if (c.value = t, typeof window < "u" && document.documentElement) {
203
+ const i = t.useSquircle !== void 0 ? t.useSquircle : !0;
204
+ document.documentElement.style.setProperty("--strands-allow-squircle", i ? "1" : "0"), t.accentColor && v(t.accentColor);
205
+ }
206
+ }
207
+ const k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
208
+ __proto__: null,
209
+ provideStrandsConfig: b,
210
+ setStrandsConfig: C,
211
+ useStrandsConfig: E
212
+ }, Symbol.toStringTag, { value: "Module" }));
213
+ export {
214
+ w as S,
215
+ k as a,
216
+ b as p,
217
+ C as s,
218
+ E as u
219
+ };