@strands.gg/accui 2.1.5 → 2.1.6

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 (173) hide show
  1. package/dist/index.d.ts +1 -6
  2. package/dist/js/auth-components-BJhPF4dS.js +8195 -0
  3. package/dist/js/auth-components-BJhPF4dS.js.br +0 -0
  4. package/dist/js/auth-components-BJhPF4dS.js.gz +0 -0
  5. package/dist/js/auth-components-CXT-W3fG.js +1 -0
  6. package/dist/js/auth-components-CXT-W3fG.js.br +0 -0
  7. package/dist/js/auth-components-CXT-W3fG.js.gz +0 -0
  8. package/dist/js/composables-BqIRpDGP.js +1609 -0
  9. package/dist/js/composables-BqIRpDGP.js.br +0 -0
  10. package/dist/js/composables-BqIRpDGP.js.gz +0 -0
  11. package/dist/js/composables-BqLSXNon.js +1 -0
  12. package/dist/js/composables-BqLSXNon.js.br +0 -0
  13. package/dist/js/composables-BqLSXNon.js.gz +0 -0
  14. package/dist/js/icons-CQ3z-CUv.js +398 -0
  15. package/dist/js/icons-CQ3z-CUv.js.br +0 -0
  16. package/dist/js/icons-CQ3z-CUv.js.gz +0 -0
  17. package/dist/js/icons-MGGFfB13.js +1 -0
  18. package/dist/js/index-87OecKtg.js +1 -0
  19. package/dist/js/index-B113vWue.js +106 -0
  20. package/dist/js/nuxt/module-BA8ZjBpp.js +1 -0
  21. package/dist/{nuxt/module.es.js → js/nuxt/module-YfdoaPCb.js} +2 -0
  22. package/dist/{nuxt/runtime/composables/useAuthenticatedFetch.es.js → js/nuxt/runtime/composables/useAuthenticatedFetch-DToDCO6a.js} +1 -1
  23. package/dist/js/nuxt/runtime/composables/useAuthenticatedFetch-qYkd06Dm.js +1 -0
  24. package/dist/{nuxt/runtime/composables/useStrandsAuth.es.js → js/nuxt/runtime/composables/useStrandsAuth-8b_bomlH.js} +1 -1
  25. package/dist/js/nuxt/runtime/composables/useStrandsAuth-Dn15YEQw.js +1 -0
  26. package/dist/{nuxt/runtime/middleware/auth.global.es.js → js/nuxt/runtime/middleware/auth.global-_2xq-SvK.js} +1 -1
  27. package/dist/js/nuxt/runtime/middleware/auth.global-dZpk-3-I.js +1 -0
  28. package/dist/js/nuxt/runtime/plugin.client-D7S6ulTg.js +1 -0
  29. package/dist/{nuxt/runtime/plugin.client.es.js → js/nuxt/runtime/plugin.client-KK_pCEfA.js} +2 -4
  30. package/dist/js/nuxt/runtime/plugin.server-BpSAN5Gh.js +1 -0
  31. package/dist/{nuxt/runtime/plugin.server.es.js → js/nuxt/runtime/plugin.server-CGdeJOoz.js} +1 -1
  32. package/dist/js/nuxt/runtime/plugins/auth-interceptor.client-BQu0eR16.js +1 -0
  33. package/dist/{nuxt/runtime/plugins/auth-interceptor.client.es.js → js/nuxt/runtime/plugins/auth-interceptor.client-DIa4pC59.js} +1 -1
  34. package/dist/js/nuxt-DqhAWeo-.js +1 -0
  35. package/dist/{nuxt.es.js → js/nuxt-MUpTW0D9.js} +3 -3
  36. package/dist/{nuxt-v4/module.es.js → js/nuxt-v4/module-CCvkwSrU.js} +2 -0
  37. package/dist/js/nuxt-v4/module-CDtxGAn8.js +1 -0
  38. package/dist/{nuxt-v4/runtime/composables/useAuthenticatedFetch.es.js → js/nuxt-v4/runtime/composables/useAuthenticatedFetch-I0BKB43E.js} +1 -1
  39. package/dist/js/nuxt-v4/runtime/composables/useAuthenticatedFetch-fAO6ieYd.js +1 -0
  40. package/dist/{nuxt-v4/runtime/composables/useStrandsAuth.es.js → js/nuxt-v4/runtime/composables/useStrandsAuth-BZe8CTx0.js} +1 -1
  41. package/dist/js/nuxt-v4/runtime/composables/useStrandsAuth-DPGVMZ-e.js +1 -0
  42. package/dist/js/nuxt-v4/runtime/middleware/auth.global-B0pyByUu.js +1 -0
  43. package/dist/{nuxt-v4/runtime/middleware/auth.global.es.js → js/nuxt-v4/runtime/middleware/auth.global-C_saJaMU.js} +1 -1
  44. package/dist/{nuxt-v4/runtime/plugin.client.es.js → js/nuxt-v4/runtime/plugin.client-CxLmYQfu.js} +2 -4
  45. package/dist/js/nuxt-v4/runtime/plugin.client-DGO53i-e.js +1 -0
  46. package/dist/{nuxt-v4/runtime/plugin.server.es.js → js/nuxt-v4/runtime/plugin.server-BM6HYyiZ.js} +1 -1
  47. package/dist/js/nuxt-v4/runtime/plugin.server-D_dUMHYo.js +1 -0
  48. package/dist/js/nuxt-v4/runtime/plugins/auth-interceptor.client-CUNOTFBp.js +1 -0
  49. package/dist/{nuxt-v4/runtime/plugins/auth-interceptor.client.es.js → js/nuxt-v4/runtime/plugins/auth-interceptor.client-Qht8QSLW.js} +1 -1
  50. package/dist/{nuxt-v4.es.js → js/nuxt-v4-C5JN4uyM.js} +3 -3
  51. package/dist/js/nuxt-v4-DuwGUuhX.js +1 -0
  52. package/dist/js/ui-components-BC1UK39i.js +5204 -0
  53. package/dist/js/ui-components-BC1UK39i.js.br +0 -0
  54. package/dist/js/ui-components-BC1UK39i.js.gz +0 -0
  55. package/dist/js/ui-components-CocLXkUI.js +1 -0
  56. package/dist/js/ui-components-CocLXkUI.js.br +0 -0
  57. package/dist/js/ui-components-CocLXkUI.js.gz +0 -0
  58. package/dist/js/utils-B9zcSW52.js +1 -0
  59. package/dist/js/utils-B9zcSW52.js.br +0 -0
  60. package/dist/js/utils-B9zcSW52.js.gz +0 -0
  61. package/dist/js/utils-BZHeJkZf.js +1080 -0
  62. package/dist/js/utils-BZHeJkZf.js.br +0 -0
  63. package/dist/js/utils-BZHeJkZf.js.gz +0 -0
  64. package/dist/nuxt/module.d.ts +1 -5
  65. package/dist/nuxt/runtime/composables/useAuthenticatedFetch.d.ts +1 -20
  66. package/dist/nuxt/runtime/composables/useStrandsAuth.d.ts +1 -142
  67. package/dist/nuxt/runtime/middleware/auth.global.d.ts +1 -3
  68. package/dist/nuxt/runtime/plugin.client.d.ts +1 -3
  69. package/dist/nuxt/runtime/plugin.server.d.ts +1 -3
  70. package/dist/nuxt/runtime/plugins/auth-interceptor.client.d.ts +1 -3
  71. package/dist/nuxt-v4/module.d.ts +1 -5
  72. package/dist/nuxt-v4/runtime/composables/useAuthenticatedFetch.d.ts +1 -20
  73. package/dist/nuxt-v4/runtime/composables/useStrandsAuth.d.ts +1 -27
  74. package/dist/nuxt-v4/runtime/middleware/auth.global.d.ts +1 -3
  75. package/dist/nuxt-v4/runtime/plugin.client.d.ts +1 -3
  76. package/dist/nuxt-v4/runtime/plugin.server.d.ts +1 -3
  77. package/dist/nuxt-v4/runtime/plugins/auth-interceptor.client.d.ts +1 -3
  78. package/dist/nuxt-v4.d.ts +1 -4
  79. package/dist/nuxt.d.ts +1 -4
  80. package/dist/robots.txt +4 -0
  81. package/dist/sitemap.xml +9 -0
  82. package/dist/styles/accui-DF7zRGFD.css +1 -0
  83. package/dist/styles/accui-DF7zRGFD.css.br +0 -0
  84. package/dist/styles/accui-DF7zRGFD.css.gz +0 -0
  85. package/package.json +5 -1
  86. package/dist/accui.css +0 -1
  87. package/dist/nuxt/module.cjs.js +0 -1
  88. package/dist/nuxt/runtime/composables/useAuthenticatedFetch.cjs.js +0 -1
  89. package/dist/nuxt/runtime/composables/useStrandsAuth.cjs.js +0 -1
  90. package/dist/nuxt/runtime/middleware/auth.d.ts +0 -7
  91. package/dist/nuxt/runtime/middleware/auth.global.cjs.js +0 -1
  92. package/dist/nuxt/runtime/middleware/guest.d.ts +0 -7
  93. package/dist/nuxt/runtime/plugin.client.cjs.js +0 -1
  94. package/dist/nuxt/runtime/plugin.server.cjs.js +0 -1
  95. package/dist/nuxt/runtime/plugins/auth-interceptor.client.cjs.js +0 -1
  96. package/dist/nuxt/types.d.ts +0 -45
  97. package/dist/nuxt-v4/module.cjs.js +0 -1
  98. package/dist/nuxt-v4/runtime/composables/useAuthenticatedFetch.cjs.js +0 -1
  99. package/dist/nuxt-v4/runtime/composables/useStrandsAuth.cjs.js +0 -1
  100. package/dist/nuxt-v4/runtime/middleware/auth.global.cjs.js +0 -1
  101. package/dist/nuxt-v4/runtime/plugin.client.cjs.js +0 -1
  102. package/dist/nuxt-v4/runtime/plugin.server.cjs.js +0 -1
  103. package/dist/nuxt-v4/runtime/plugins/auth-interceptor.client.cjs.js +0 -1
  104. package/dist/nuxt-v4/types.d.ts +0 -63
  105. package/dist/nuxt-v4.cjs.js +0 -1
  106. package/dist/nuxt.cjs.js +0 -1
  107. package/dist/shared/defaults.d.ts +0 -2
  108. package/dist/strands-auth-ui.cjs.js +0 -1
  109. package/dist/strands-auth-ui.es.js +0 -10561
  110. package/dist/types/index.d.ts +0 -236
  111. package/dist/useStrandsAuth-CTlaiFqK.cjs +0 -1
  112. package/dist/useStrandsAuth-Cev-PTun.js +0 -899
  113. package/dist/useStrandsConfig-Cxb360Os.js +0 -179
  114. package/dist/useStrandsConfig-Z9_36OcV.cjs +0 -1
  115. package/dist/utils/index.d.ts +0 -1
  116. package/dist/utils/slots.d.ts +0 -1
  117. package/dist/utils/validation.d.ts +0 -12
  118. package/dist/vue/components/SignedIn.vue.d.ts +0 -54
  119. package/dist/vue/components/SignedOut.vue.d.ts +0 -54
  120. package/dist/vue/components/StrandsAuth.vue.d.ts +0 -25
  121. package/dist/vue/components/StrandsBackupCodesModal.vue.d.ts +0 -12
  122. package/dist/vue/components/StrandsCompleteSignUp.vue.d.ts +0 -21
  123. package/dist/vue/components/StrandsConfigProvider.vue.d.ts +0 -22
  124. package/dist/vue/components/StrandsConfirmModal.vue.d.ts +0 -22
  125. package/dist/vue/components/StrandsEmailMfaSetupModal.vue.d.ts +0 -12
  126. package/dist/vue/components/StrandsHardwareKeySetupModal.vue.d.ts +0 -15
  127. package/dist/vue/components/StrandsLogo.vue.d.ts +0 -8
  128. package/dist/vue/components/StrandsMFASetup.vue.d.ts +0 -16
  129. package/dist/vue/components/StrandsMfaModal.vue.d.ts +0 -12
  130. package/dist/vue/components/StrandsMfaVerification.vue.d.ts +0 -17
  131. package/dist/vue/components/StrandsPasswordReset.vue.d.ts +0 -15
  132. package/dist/vue/components/StrandsSecuredFooter.vue.d.ts +0 -22
  133. package/dist/vue/components/StrandsSessionsModal.vue.d.ts +0 -14
  134. package/dist/vue/components/StrandsSettingsModal.vue.d.ts +0 -18
  135. package/dist/vue/components/StrandsSignIn.vue.d.ts +0 -21
  136. package/dist/vue/components/StrandsSignUp.vue.d.ts +0 -19
  137. package/dist/vue/components/StrandsTotpSetupModal.vue.d.ts +0 -12
  138. package/dist/vue/components/StrandsUserButton.vue.d.ts +0 -30
  139. package/dist/vue/components/StrandsUserProfile.vue.d.ts +0 -26
  140. package/dist/vue/components/SvgIcon.vue.d.ts +0 -17
  141. package/dist/vue/components/VirtualList.vue.d.ts +0 -37
  142. package/dist/vue/components/icons/IconGithub.vue.d.ts +0 -3
  143. package/dist/vue/components/icons/IconGoogle.vue.d.ts +0 -3
  144. package/dist/vue/components/icons/index.d.ts +0 -2
  145. package/dist/vue/components/index.d.ts +0 -26
  146. package/dist/vue/composables/useAuthenticatedFetch.d.ts +0 -20
  147. package/dist/vue/composables/useOAuthProviders.d.ts +0 -74
  148. package/dist/vue/composables/useStrandsAuth.d.ts +0 -130
  149. package/dist/vue/composables/useStrandsConfig.d.ts +0 -11
  150. package/dist/vue/composables/useStrandsMfa.d.ts +0 -38
  151. package/dist/vue/index.d.ts +0 -12
  152. package/dist/vue/plugins/StrandsUIPlugin.d.ts +0 -19
  153. package/dist/vue/ui/UiAlert.vue.d.ts +0 -31
  154. package/dist/vue/ui/UiAvatarEditor.vue.d.ts +0 -25
  155. package/dist/vue/ui/UiButton.vue.d.ts +0 -54
  156. package/dist/vue/ui/UiCard.vue.d.ts +0 -29
  157. package/dist/vue/ui/UiInput.vue.d.ts +0 -48
  158. package/dist/vue/ui/UiLevelProgress.vue.d.ts +0 -19
  159. package/dist/vue/ui/UiLink.vue.d.ts +0 -42
  160. package/dist/vue/ui/UiLoader.vue.d.ts +0 -15
  161. package/dist/vue/ui/UiModal.vue.d.ts +0 -33
  162. package/dist/vue/ui/UiTabs.vue.d.ts +0 -17
  163. package/dist/vue/ui/UiToggle.vue.d.ts +0 -15
  164. package/dist/vue/ui/index.d.ts +0 -29
  165. package/dist/vue/utils/contrast.d.ts +0 -79
  166. package/dist/vue/utils/debounce.d.ts +0 -12
  167. package/dist/vue/utils/fontPreloader.d.ts +0 -19
  168. package/dist/vue/utils/iconProps.d.ts +0 -9
  169. package/dist/vue/utils/lazyComponents.d.ts +0 -2
  170. package/dist/vue/utils/levels.d.ts +0 -27
  171. package/dist/vue/utils/performanceInit.d.ts +0 -40
  172. package/dist/vue/utils/requestCache.d.ts +0 -49
  173. package/dist/vue/utils/sounds.d.ts +0 -56
@@ -1,236 +0,0 @@
1
- export interface User {
2
- id: string;
3
- email: string;
4
- firstName: string;
5
- lastName: string;
6
- avatar?: string;
7
- mfaEnabled: boolean;
8
- emailVerified: boolean;
9
- passwordUpdatedAt?: string | Date;
10
- settings?: any;
11
- xp: number;
12
- level: number;
13
- next_level_xp: number;
14
- username?: string;
15
- usernameLastChangedAt?: string | Date;
16
- createdAt: string | Date;
17
- updatedAt: string | Date;
18
- }
19
- export interface AuthenticatedFetchOptions extends RequestInit {
20
- /**
21
- * Whether to automatically refresh token if the request fails with 401
22
- * @default true
23
- */
24
- autoRefresh?: boolean;
25
- /**
26
- * Whether to throw an error if user is not authenticated
27
- * @default true
28
- */
29
- requireAuth?: boolean;
30
- /**
31
- * Base URL for the API requests
32
- * If not provided, will use the current origin
33
- */
34
- baseURL?: string;
35
- }
36
- export interface Session {
37
- id?: string;
38
- userId?: string;
39
- accessToken: string;
40
- refreshToken: string;
41
- expiresAt: Date;
42
- createdAt?: Date;
43
- }
44
- export interface SessionInfo {
45
- id: string;
46
- device_name?: string;
47
- device_type?: string;
48
- ip_address?: string;
49
- country?: string;
50
- city?: string;
51
- application_domain?: string;
52
- application_name?: string;
53
- created_at: string | Date;
54
- last_activity_at?: string | Date;
55
- is_current: boolean;
56
- }
57
- export interface SessionStats {
58
- total_sessions: number;
59
- active_sessions: number;
60
- devices_by_type: Record<string, number>;
61
- unique_locations: string[];
62
- }
63
- export interface AuthConfig {
64
- apiUrl: string;
65
- applicationId: string;
66
- publicKey: string;
67
- autoRefresh?: boolean;
68
- redirectUrl?: string;
69
- }
70
- export interface SignInCredentials {
71
- email: string;
72
- password: string;
73
- }
74
- export interface SignUpData {
75
- email: string;
76
- password: string;
77
- firstName: string;
78
- lastName: string;
79
- }
80
- export interface OAuthProvider {
81
- id: string;
82
- name: string;
83
- enabled: boolean;
84
- clientId?: string;
85
- scopes?: string[];
86
- }
87
- export interface StrandsAuthConfig {
88
- /**
89
- * Base URL for the Strands Auth API
90
- * @default 'https://your-api.example.com'
91
- */
92
- baseUrl?: string;
93
- /**
94
- * Client ID for authentication (optional - authentication is now based on domain)
95
- */
96
- clientId?: string;
97
- /**
98
- * Primary accent color for the auth components
99
- * @default '#EA00A8'
100
- */
101
- accentColor?: string;
102
- /**
103
- * Default redirect URL after successful authentication
104
- * @default '/'
105
- */
106
- redirectUrl?: string;
107
- /**
108
- * URL to redirect to after successful sign in
109
- * @default '/dashboard'
110
- */
111
- onSignInUrl?: string;
112
- /**
113
- * URL to redirect to after successful sign out
114
- * @default '/'
115
- */
116
- onSignOutUrl?: string;
117
- /**
118
- * Enable automatic token refresh
119
- * @default true
120
- */
121
- autoRefresh?: boolean;
122
- /**
123
- * Token refresh interval in minutes
124
- * @default 4
125
- */
126
- refreshInterval?: number;
127
- /**
128
- * Pages that should redirect to sign in if user is not authenticated
129
- * @default []
130
- */
131
- protectedRoutes?: string[];
132
- /**
133
- * Pages that should redirect away if user IS authenticated
134
- * @default ['/auth', '/login', '/register']
135
- */
136
- guestOnlyRoutes?: string[];
137
- /**
138
- * Enable development mode (shows debug info)
139
- * @default false
140
- */
141
- devMode?: boolean;
142
- /**
143
- * Support email address for contact links
144
- * @optional
145
- */
146
- supportEmail?: string;
147
- /**
148
- * OAuth2 redirect URL for OAuth providers
149
- * If not specified, will use {origin}/auth/callback
150
- * @optional
151
- */
152
- oauth2RedirectUrl?: string;
153
- /**
154
- * Automatically import CSS styles
155
- * Set to false if you want to manually import styles or use custom styling
156
- * @default true
157
- */
158
- styles?: boolean;
159
- /**
160
- * Custom API endpoints
161
- */
162
- endpoints?: Partial<StrandsAuthEndpoints>;
163
- }
164
- export interface StrandsAuthEndpoints {
165
- signIn: string;
166
- signUp: string;
167
- signOut: string;
168
- refresh: string;
169
- passwordReset: string;
170
- passwordResetConfirm: string;
171
- completeRegistration: string;
172
- profile: string;
173
- verifyEmail: string;
174
- oauthProviders: string;
175
- oauthProvider: string;
176
- changeEmail: string;
177
- avatar: string;
178
- settings: string;
179
- changeUsername: string;
180
- usernameCooldown: string;
181
- checkUsernameAvailability: string;
182
- mfaDevices: string;
183
- mfaTotpSetup: string;
184
- mfaTotpVerify: string;
185
- mfaEmailSetup: string;
186
- mfaEmailSend: string;
187
- mfaEmailVerify: string;
188
- mfaDeviceDisable: string;
189
- mfaBackupCodes: string;
190
- mfaHardwareStartRegistration: string;
191
- mfaHardwareCompleteRegistration: string;
192
- mfaSigninSendEmail: string;
193
- mfaSigninVerify: string;
194
- mfaBackupCodeVerify: string;
195
- mfaWebAuthnChallenge: string;
196
- sessions: string;
197
- sessionsStats: string;
198
- sessionRevoke: string;
199
- sessionsRevokeAll: string;
200
- }
201
- export interface AuthResponse {
202
- access_token: string;
203
- refresh_token: string;
204
- user: User;
205
- mfa_required?: boolean;
206
- mfa_session_id?: string;
207
- available_mfa_methods?: MfaDevice[];
208
- }
209
- export type MfaDeviceType = 'totp' | 'email' | 'hardware' | 'passkey';
210
- export interface MfaDevice {
211
- id: string;
212
- device_type: MfaDeviceType;
213
- device_name: string;
214
- is_active: boolean;
215
- last_used_at?: string | Date;
216
- created_at: string | Date;
217
- }
218
- export interface MfaDevicesResponse {
219
- devices: MfaDevice[];
220
- mfa_enabled: boolean;
221
- }
222
- export interface TotpSetupResponse {
223
- device_id: string;
224
- secret: string;
225
- qr_code_url: string;
226
- backup_codes: string[];
227
- }
228
- export interface BackupCodesResponse {
229
- backup_codes: string[];
230
- }
231
- export interface MfaErrorResponse {
232
- code: string;
233
- message: string;
234
- mfa_session_id?: string;
235
- available_methods?: string[];
236
- }
@@ -1 +0,0 @@
1
- "use strict";const e=require("vue"),a=require("./useStrandsConfig-Z9_36OcV.cjs");const t=new class{cache=new Map;DEFAULT_TTL=3e5;async fetch(e,a,t=this.DEFAULT_TTL){const n=Date.now(),i=this.cache.get(e);if(i&&n-i.timestamp<i.ttl)return i.promise;this.cleanExpired();const s=a().finally(()=>{setTimeout(()=>{this.cache.delete(e)},t)});return this.cache.set(e,{promise:s,timestamp:n,ttl:t}),s}clear(){this.cache.clear()}invalidate(e){this.cache.delete(e)}cleanExpired(){const e=Date.now();for(const[a,t]of this.cache.entries())e-t.timestamp>t.ttl&&this.cache.delete(a)}getStats(){return{size:this.cache.size,entries:Array.from(this.cache.keys())}}};const n=function(e,a){let t=null;return(...n)=>{t&&clearTimeout(t),t=setTimeout(()=>{e(...n)},a)}}((e,a)=>{"undefined"!=typeof window&&localStorage.setItem(e,a)},300),i=e=>({id:e.id,email:e.email,firstName:e.first_name||e.firstName||"",lastName:e.last_name||e.lastName||"",avatar:e.avatar_url||e.avatar,mfaEnabled:e.mfa_enabled??e.mfaEnabled??!1,emailVerified:e.email_verified??e.emailVerified??!1,passwordUpdatedAt:e.password_updated_at||e.passwordUpdatedAt,settings:e.settings||{},xp:e.xp||0,level:e.level||1,next_level_xp:e.next_level_xp||e.next_level_xp||4,username:e.username,usernameLastChangedAt:e.username_last_changed_at||e.usernameLastChangedAt,createdAt:e.created_at||e.createdAt,updatedAt:e.updated_at||e.updatedAt||(new Date).toISOString()}),s={currentUser:e.ref(null),currentSession:e.ref(null),loadingStates:e.ref({initializing:!0,signingIn:!1,signingUp:!1,signingOut:!1,refreshingToken:!1,sendingMfaEmail:!1,verifyingMfa:!1,loadingProfile:!1}),isInitialized:e.ref(!1),mfaRequired:e.ref(!1),mfaSessionId:e.ref(null),availableMfaMethods:e.ref([])};let r=null,o=null;exports.useStrandsAuth=function(){const{getUrl:l}=a.useStrandsConfig(),{fetch:u,clear:c,invalidate:d}={fetch:t.fetch.bind(t),clear:t.clear.bind(t),invalidate:t.invalidate.bind(t),getStats:t.getStats.bind(t)},{currentUser:f,currentSession:h,loadingStates:v,isInitialized:g,mfaRequired:m,mfaSessionId:w,availableMfaMethods:y}=s,p=e.computed(()=>v.value.initializing),S=e.computed(()=>v.value.signingIn),_=e.computed(()=>v.value.signingUp),T=e.computed(()=>v.value.signingOut),k=e.computed(()=>v.value.refreshingToken),E=e.computed(()=>v.value.sendingMfaEmail),A=e.computed(()=>v.value.verifyingMfa);e.computed(()=>v.value.loadingProfile);const O=e.computed(()=>v.value.signingIn||v.value.signingUp||v.value.signingOut||v.value.refreshingToken||v.value.sendingMfaEmail||v.value.verifyingMfa||v.value.loadingProfile),b=e.computed(()=>v.value.initializing||O.value),N=e.computed(()=>{const e=v.value;return e.initializing?"Checking authentication...":e.signingIn?"Signing you in...":e.signingUp?"Creating your account...":e.signingOut?"Signing you out...":e.refreshingToken?"Refreshing session...":e.sendingMfaEmail?"Sending verification code...":e.verifyingMfa?"Verifying code...":e.loadingProfile?"Loading profile...":"Loading..."}),I=()=>{if(!h.value?.accessToken)throw new Error("No access token available");h.value.expiresAt;const e={Authorization:`Bearer ${h.value.accessToken}`};return h.value?.refreshToken&&(e["x-refresh-token"]=h.value.refreshToken),e},x=e.computed(()=>null!==f.value),$=async()=>{v.value.signingOut=!0;try{C(),o=null,c(),f.value=null,h.value=null,m.value=!1,w.value=null,y.value=[],"undefined"!=typeof window&&(localStorage.removeItem("strands_auth_session"),localStorage.removeItem("strands_auth_user"))}finally{v.value.signingOut=!1}},P=async()=>{if(!h.value?.refreshToken)return!1;if(o)return await o;o=(async()=>{v.value.refreshingToken=!0;try{const e=await fetch(l("refresh"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:h.value.refreshToken})});if(!e.ok){if(401===e.status)return await $(),!1;throw new Error(`Token refresh failed: ${e.status} ${e.statusText}`)}const a=await e.json();a.user&&(f.value=i(a.user),f.value&&"undefined"!=typeof window&&localStorage.setItem("strands_auth_user",JSON.stringify(f.value)));const t={accessToken:a.access_token,refreshToken:a.refresh_token,expiresAt:new Date(Date.now()+3e5),userId:a.user?.id||f.value?.id};return h.value=t,"undefined"!=typeof window&&localStorage.setItem("strands_auth_session",JSON.stringify(t)),M(),d(`sessions:${h.value.accessToken.slice(0,20)}`),!0}catch(e){return await $(),!1}finally{v.value.refreshingToken=!1}})();const e=await o;return o=null,e},j=async e=>{try{e.user&&(f.value=i(e.user));const a={accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:new Date(Date.now()+3e5),userId:f.value?.id||e.user?.id};h.value=a,"undefined"!=typeof window&&(localStorage.setItem("strands_auth_session",JSON.stringify(a)),f.value&&localStorage.setItem("strands_auth_user",JSON.stringify(f.value))),M()}catch(a){}},M=()=>{if(r&&clearTimeout(r),!h.value)return;if("undefined"!=typeof document&&"hidden"===document.visibilityState)return;const e=new Date,a=h.value.expiresAt.getTime()-e.getTime()-6e4;a<=0?P():r=setTimeout(async()=>{if("undefined"==typeof document||"visible"===document.visibilityState){await P()&&M()}},a)},C=()=>{r&&(clearTimeout(r),r=null)},U=async()=>{if(!g.value){v.value.initializing=!0;try{if("undefined"!=typeof window){const a=localStorage.getItem("strands_auth_session"),t=localStorage.getItem("strands_auth_user");if(a&&t)try{const e=JSON.parse(a),n=JSON.parse(t);e.expiresAt=new Date(e.expiresAt),e.expiresAt>new Date?(h.value=e,f.value=n,M()):(localStorage.removeItem("strands_auth_session"),localStorage.removeItem("strands_auth_user"))}catch(e){localStorage.removeItem("strands_auth_session"),localStorage.removeItem("strands_auth_user")}}g.value=!0,await new Promise(e=>setTimeout(e,50))}catch(e){}finally{v.value.initializing=!1}}};"undefined"!=typeof document&&document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&h.value?M():"hidden"===document.visibilityState&&C()});const J=()=>{C(),c(),"undefined"!=typeof document&&document.removeEventListener("visibilitychange",()=>{})};try{e.onUnmounted(J)}catch(F){}return g.value||U(),{user:e.computed(()=>f.value),currentUser:e.computed(()=>f.value),currentSession:e.computed(()=>h.value),isAuthenticated:x,isLoading:e.computed(()=>b.value||!g.value),loading:e.computed(()=>O.value),loadingMessage:N,isInitializing:p,isSigningIn:S,isSigningUp:_,isSigningOut:T,isRefreshingToken:k,isSendingMfaEmail:E,isVerifyingMfa:A,mfaRequired:e.computed(()=>m.value),mfaSessionId:e.computed(()=>w.value),availableMfaMethods:e.computed(()=>y.value),signIn:async e=>{v.value.signingIn=!0;try{m.value=!1,w.value=null,y.value=[];const a={"Content-Type":"application/json"};"undefined"!=typeof window&&window.location&&(a.Origin=window.location.origin);const t=await fetch(l("signIn"),{method:"POST",headers:a,body:JSON.stringify(e)});if(!t.ok)throw 401===t.status?new Error("Invalid email or password"):403===t.status?new Error("Please verify your email address before signing in"):new Error(`Sign in failed: ${t.status} ${t.statusText}`);const n=await t.json();if(n.mfa_required){m.value=!0,w.value=n.mfa_session_id||null;const e=(n.available_mfa_methods||[]).map(e=>{let a=`${e.device_type.charAt(0).toUpperCase()+e.device_type.slice(1)} Authentication`;return"hardware"===e.device_type?a=e.device_name||"Security Key":"totp"===e.device_type?a=e.device_name||"Authenticator App":"email"===e.device_type&&(a=e.device_name||"Email Verification"),{id:e.device_id,device_type:e.device_type,device_name:e.device_name||a,is_active:!0,created_at:(new Date).toISOString(),last_used_at:e.last_used_at,credential_id:e.credential_id,device_info:e.device_info}});return y.value=e,v.value.signingIn=!1,n}return await j(n),n}catch(a){throw a}finally{v.value.signingIn=!1}},signUp:async e=>{v.value.signingUp=!0;try{throw new Error("Sign up not implemented - please integrate with auth SDK")}finally{v.value.signingUp=!1}},signOut:$,refreshToken:P,fetchProfile:async()=>{if(!h.value?.accessToken)throw new Error("No access token available");const e=`profile:${h.value.accessToken.slice(0,20)}`;v.value.loadingProfile=!0;try{return await u(e,async()=>{const e=await fetch(l("profile"),{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${h.value?.accessToken}`}});if(!e.ok)throw 401===e.status?new Error("Authentication expired. Please sign in again."):new Error(`Failed to fetch profile: ${e.status} ${e.statusText}`);const a=await e.json();return f.value=i(a),f.value&&"undefined"!=typeof window&&localStorage.setItem("strands_auth_user",JSON.stringify(f.value)),f.value})}finally{v.value.loadingProfile=!1}},updateProfile:async e=>{if(!h.value?.accessToken)throw new Error("No access token available");v.value.loadingProfile=!0;try{const a=await fetch(l("profile"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${h.value.accessToken}`},body:JSON.stringify({first_name:e.firstName,last_name:e.lastName})});if(!a.ok)throw 401===a.status?new Error("Authentication expired. Please sign in again."):new Error(`Profile update failed: ${a.status} ${a.statusText}`);const t=await a.json();return f.value=i(t),f.value&&n("strands_auth_user",JSON.stringify(f.value)),f.value}finally{v.value.loadingProfile=!1}},updateUserSettings:async e=>{if(!h.value?.accessToken)throw new Error("No access token available");v.value.loadingProfile=!0;try{const a=await fetch(l("settings"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${h.value.accessToken}`},body:JSON.stringify({settings:e})});if(!a.ok)throw 401===a.status?new Error("Authentication expired. Please sign in again."):new Error(`Settings update failed: ${a.status} ${a.statusText}`);const t=await a.json();return f.value=i(t),f.value&&n("strands_auth_user",JSON.stringify(f.value)),f.value}finally{v.value.loadingProfile=!1}},changeEmail:async(e,a)=>{if(!h.value?.accessToken)throw new Error("No access token available");v.value.loadingProfile=!0;try{const t=await fetch(l("changeEmail"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${h.value.accessToken}`},body:JSON.stringify({new_email:e,password:a})});if(!t.ok){if(401===t.status)throw new Error("Authentication expired. Please sign in again.");{const e=await t.json().catch(()=>({}));throw new Error(e.message||`Email change failed: ${t.status} ${t.statusText}`)}}const n=await t.json();return f.value&&(f.value={...f.value,email:e,emailVerified:!1,updatedAt:(new Date).toISOString()},"undefined"!=typeof window&&localStorage.setItem("strands_auth_user",JSON.stringify(f.value))),n}finally{v.value.loadingProfile=!1}},changeUsername:async e=>{if(!h.value?.accessToken)throw new Error("No access token available");v.value.loadingProfile=!0;try{const a=await fetch(l("changeUsername"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${h.value.accessToken}`},body:JSON.stringify({username:e})});if(!a.ok){const e=await a.json().catch(()=>({}));if(409===a.status)throw new Error("Username is already taken");if(e.cooldown_end)throw new Error(`You can only change your username once every 30 days. You can change it again on ${new Date(e.cooldown_end).toLocaleDateString()}`);throw new Error(e.message||`Username change failed: ${a.status} ${a.statusText}`)}const t=await a.json();return f.value&&(f.value={...f.value,username:e,usernameLastChangedAt:(new Date).toISOString(),updatedAt:(new Date).toISOString()},"undefined"!=typeof window&&localStorage.setItem("strands_auth_user",JSON.stringify(f.value))),t}finally{v.value.loadingProfile=!1}},getUsernameCooldown:async()=>{if(!h.value?.accessToken)throw new Error("No access token available");const e=await fetch(l("usernameCooldown"),{method:"GET",headers:{Authorization:`Bearer ${h.value.accessToken}`}});if(!e.ok)throw new Error(`Failed to get username cooldown: ${e.status} ${e.statusText}`);return e.json()},checkUsernameAvailability:async e=>{const a=l("checkUsernameAvailability").replace("{username}",encodeURIComponent(e)),t=await fetch(a,{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error(`Failed to check username availability: ${t.status} ${t.statusText}`);return t.json()},getUserSessions:async()=>{if(!h.value?.accessToken)throw new Error("No access token available");const e=`sessions:${h.value.accessToken.slice(0,20)}`;try{return await u(e,async()=>{const e=I(),a=await fetch(l("sessions"),{method:"GET",headers:e});if(!a.ok){await a.text();throw new Error(`Failed to get user sessions: ${a.status} ${a.statusText}`)}return a.json()},12e4)}catch(a){throw a}},getSessionStats:async()=>{const e=await fetch(l("sessionsStats"),{method:"GET",headers:I()});if(!e.ok)throw new Error(`Failed to get session stats: ${e.status} ${e.statusText}`);return e.json()},revokeSession:async e=>{const a=l("sessionRevoke").replace("{session_id}",encodeURIComponent(e)),t=await fetch(a,{method:"POST",headers:I()});if(!t.ok)throw new Error(`Failed to revoke session: ${t.status} ${t.statusText}`);return 200===t.status},revokeAllOtherSessions:async()=>{const e=await fetch(l("sessionsRevokeAll"),{method:"POST",headers:I()});if(!e.ok)throw new Error(`Failed to revoke all other sessions: ${e.status} ${e.statusText}`);return 200===e.status},initialize:U,setAuthData:j,verifyMfa:async(e,a,t=!1)=>{if(!w.value)throw new Error("No MFA session available");v.value.verifyingMfa=!0;try{const n=l(t?"mfaBackupCodeVerify":"mfaSigninVerify"),i=t?{mfa_session_id:w.value,backup_code:a}:{mfa_session_id:w.value,device_id:e,code:a},s=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok){const e=await s.text();let a="MFA verification failed";try{const t=JSON.parse(e);a=t.message||t.error||e}catch{a=e||"MFA verification failed"}throw new Error(a)}const r=await s.json();return m.value=!1,w.value=null,y.value=[],await j(r),r}finally{v.value.verifyingMfa=!1}},sendMfaEmailCode:async e=>{if(!w.value)throw new Error("No MFA session available");v.value.sendingMfaEmail=!0;try{const a=await fetch(l("mfaSigninSendEmail"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mfa_session_id:w.value,device_id:e})});if(!a.ok){const e=await a.text();let t="Failed to send MFA email code";try{const a=JSON.parse(e);t=a.message||a.error||e}catch{t=e||"Failed to send MFA email code"}throw new Error(t)}return await a.json()}finally{v.value.sendingMfaEmail=!1}},getMfaWebAuthnChallenge:async e=>{if(!w.value)throw new Error("No MFA session available");const a=await fetch(l("mfaWebAuthnChallenge"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mfa_session_id:w.value,device_id:e})});if(!a.ok){const e=await a.text();let t="Failed to get WebAuthn challenge";try{const a=JSON.parse(e);t=a.message||a.error||e}catch{t=e||t}throw new Error(t)}return a.json()},registerHardwareKey:async(e,a,t="hardware")=>{if(!h.value?.accessToken)throw new Error("No access token available");const n=await fetch(l("mfaHardwareStartRegistration"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${h.value.accessToken}`},body:JSON.stringify({device_name:e,device_type:t})});if(!n.ok){const e=await n.text();let a="Failed to start hardware key registration";try{const t=JSON.parse(e);a=t.message||t.error||e}catch{a=e||"Failed to start hardware key registration"}throw new Error(a)}return n.json()},completeHardwareKeyRegistration:async(e,a,t)=>{if(!h.value?.accessToken)throw new Error("No access token available");const n=await fetch(l("mfaHardwareCompleteRegistration"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${h.value.accessToken}`},body:JSON.stringify({device_id:e,credential:a})});if(!n.ok){const e=await n.text();let a="Failed to complete hardware key registration";try{const t=JSON.parse(e);a=t.message||t.error||e}catch{a=e||"Failed to complete hardware key registration"}throw new Error(a)}return n.json()},startTokenRefreshTimer:M,stopTokenRefreshTimer:C,getAuthHeaders:I,forceReInit:()=>{g.value=!1,v.value.initializing=!0,U()}}};