@teamhanko/hanko-frontend-sdk 0.5.4-beta → 0.8.0
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/README.md +2 -22
- package/dist/Hanko.d.ts +2 -0
- package/dist/index.d.ts +3 -3
- package/dist/lib/Session.d.ts +47 -0
- package/dist/lib/events/CustomEvents.d.ts +2 -9
- package/dist/lib/events/Dispatcher.d.ts +7 -15
- package/dist/lib/events/Listener.d.ts +5 -28
- package/dist/lib/events/Relay.d.ts +3 -23
- package/dist/lib/state/session/SessionState.d.ts +12 -0
- package/dist/sdk.cjs +1 -1
- package/dist/sdk.cjs.map +1 -1
- package/dist/sdk.modern.js +1 -1
- package/dist/sdk.modern.js.map +1 -1
- package/dist/sdk.module.js +1 -1
- package/dist/sdk.module.js.map +1 -1
- package/dist/sdk.umd.js +1 -1
- package/dist/sdk.umd.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -85,17 +85,15 @@ To see the latest documentation, please click [here](https://docs.hanko.io/jsdoc
|
|
|
85
85
|
|
|
86
86
|
### Event Interfaces
|
|
87
87
|
|
|
88
|
-
- `
|
|
89
|
-
- `
|
|
88
|
+
- `SessionDetail`
|
|
89
|
+
- `AuthFlowCompletedDetail`
|
|
90
90
|
|
|
91
91
|
### Event Types
|
|
92
92
|
|
|
93
93
|
- `CustomEventWithDetail`
|
|
94
94
|
- `authFlowCompletedType`
|
|
95
|
-
- `sessionResumedType`
|
|
96
95
|
- `sessionCreatedType`
|
|
97
96
|
- `sessionExpiredType`
|
|
98
|
-
- `sessionNotPresentType`
|
|
99
97
|
- `userLoggedOutType`
|
|
100
98
|
- `userDeletedType`
|
|
101
99
|
|
|
@@ -183,12 +181,6 @@ const once = false;
|
|
|
183
181
|
const removeEventListener = hanko.onSessionCreated((eventDetail) => {
|
|
184
182
|
// Your code...
|
|
185
183
|
}, once);
|
|
186
|
-
|
|
187
|
-
// Removes the event listener, the callback function will not be called anymore.
|
|
188
|
-
removeEventListener();
|
|
189
|
-
|
|
190
|
-
// Removes all event listeners.
|
|
191
|
-
hanko.removeEventListeners();
|
|
192
184
|
```
|
|
193
185
|
|
|
194
186
|
The following events are available:
|
|
@@ -220,18 +212,6 @@ hanko.onSessionCreated((sessionDetail) => {
|
|
|
220
212
|
})
|
|
221
213
|
```
|
|
222
214
|
|
|
223
|
-
- "hanko-session-resumed": Will be triggered after the page has been loaded and there is a valid session, so it can be
|
|
224
|
-
utilized like the "hanko-auth-flow-completed" event, to restore the state of your page, where the user is logged in.
|
|
225
|
-
Note, that a "hanko-user-logged-out" event will be triggered instead of the "hanko-session-removed" event, after the
|
|
226
|
-
page has been loaded, when the user does not have a valid session.
|
|
227
|
-
|
|
228
|
-
```js
|
|
229
|
-
hanko.onSessionResumed((sessionDetail) => {
|
|
230
|
-
// The user is logged in, protected content can be shown.
|
|
231
|
-
console.info(`User is already logged in (user-id: "${sessionDetail.userID}", jwt: ${sessionDetail.jwt})`);
|
|
232
|
-
})
|
|
233
|
-
```
|
|
234
|
-
|
|
235
215
|
- "hanko-session-expired": Will be triggered when the session has expired, or when the session has been removed in
|
|
236
216
|
another browser window, because the user has logged out, or deleted the account.
|
|
237
217
|
|
package/dist/Hanko.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { ThirdPartyClient } from "./lib/client/ThirdPartyClient";
|
|
|
8
8
|
import { TokenClient } from "./lib/client/TokenClient";
|
|
9
9
|
import { Listener } from "./lib/events/Listener";
|
|
10
10
|
import { Relay } from "./lib/events/Relay";
|
|
11
|
+
import { Session } from "./lib/Session";
|
|
11
12
|
/**
|
|
12
13
|
* A class that bundles all available SDK functions.
|
|
13
14
|
*
|
|
@@ -26,6 +27,7 @@ declare class Hanko extends Listener {
|
|
|
26
27
|
thirdParty: ThirdPartyClient;
|
|
27
28
|
token: TokenClient;
|
|
28
29
|
relay: Relay;
|
|
30
|
+
session: Session;
|
|
29
31
|
constructor(api: string, timeout?: number);
|
|
30
32
|
}
|
|
31
33
|
export { Hanko };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,6 @@ import { PasswordConfig, EmailConfig, AccountConfig, Config, WebauthnFinalized,
|
|
|
15
15
|
export type { PasswordConfig, EmailConfig, AccountConfig, Config, WebauthnFinalized, TokenFinalized, UserInfo, Me, Credential, User, UserCreated, Passcode, WebauthnTransports, Attestation, Email, Emails, WebauthnCredential, WebauthnCredentials, Identity, };
|
|
16
16
|
import { HankoError, ConflictError, EmailAddressAlreadyExistsError, InvalidPasswordError, InvalidPasscodeError, InvalidWebauthnCredentialError, MaxNumOfEmailAddressesReachedError, MaxNumOfPasscodeAttemptsReachedError, NotFoundError, PasscodeExpiredError, RequestTimeoutError, TechnicalError, ThirdPartyError, TooManyRequestsError, UnauthorizedError, UserVerificationError, WebauthnRequestCancelledError } from "./lib/Errors";
|
|
17
17
|
export { HankoError, ConflictError, EmailAddressAlreadyExistsError, InvalidPasswordError, InvalidPasscodeError, InvalidWebauthnCredentialError, MaxNumOfEmailAddressesReachedError, MaxNumOfPasscodeAttemptsReachedError, NotFoundError, PasscodeExpiredError, RequestTimeoutError, TechnicalError, ThirdPartyError, TooManyRequestsError, UnauthorizedError, UserVerificationError, WebauthnRequestCancelledError, };
|
|
18
|
-
import { CustomEventWithDetail,
|
|
19
|
-
export type {
|
|
20
|
-
export { authFlowCompletedType,
|
|
18
|
+
import { CustomEventWithDetail, SessionDetail, AuthFlowCompletedDetail, authFlowCompletedType, sessionCreatedType, sessionExpiredType, userLoggedOutType, userDeletedType } from "./lib/events/CustomEvents";
|
|
19
|
+
export type { SessionDetail, AuthFlowCompletedDetail };
|
|
20
|
+
export { authFlowCompletedType, sessionCreatedType, sessionExpiredType, userLoggedOutType, userDeletedType, CustomEventWithDetail, };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { SessionDetail } from "./events/CustomEvents";
|
|
2
|
+
import { SessionState } from "./state/session/SessionState";
|
|
3
|
+
import { Cookie } from "./Cookie";
|
|
4
|
+
/**
|
|
5
|
+
A class representing a session.
|
|
6
|
+
|
|
7
|
+
@category SDK
|
|
8
|
+
@subcategory Session
|
|
9
|
+
*/
|
|
10
|
+
export declare class Session {
|
|
11
|
+
_sessionState: SessionState;
|
|
12
|
+
_cookie: Cookie;
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
Retrieves the session details.
|
|
16
|
+
|
|
17
|
+
@returns {SessionDetail} The session details.
|
|
18
|
+
*/
|
|
19
|
+
get(): SessionDetail;
|
|
20
|
+
/**
|
|
21
|
+
Checks if the user is logged in.
|
|
22
|
+
|
|
23
|
+
@returns {boolean} true if the user is logged in, false otherwise.
|
|
24
|
+
*/
|
|
25
|
+
isValid(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
Retrieves the session details.
|
|
28
|
+
|
|
29
|
+
@ignore
|
|
30
|
+
@returns {SessionDetail} The session details.
|
|
31
|
+
*/
|
|
32
|
+
_get(): SessionDetail;
|
|
33
|
+
/**
|
|
34
|
+
Checks if the auth flow is completed. The value resets after the next login attempt.
|
|
35
|
+
|
|
36
|
+
@returns {boolean} Returns true if the authentication flow is completed, false otherwise
|
|
37
|
+
*/
|
|
38
|
+
isAuthFlowCompleted(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
Validates the session.
|
|
41
|
+
|
|
42
|
+
@private
|
|
43
|
+
@param {SessionDetail} detail - The session details to validate.
|
|
44
|
+
@returns {boolean} true if the session details are valid, false otherwise.
|
|
45
|
+
*/
|
|
46
|
+
private static validate;
|
|
47
|
+
}
|
|
@@ -4,12 +4,6 @@
|
|
|
4
4
|
* @memberOf Listener
|
|
5
5
|
*/
|
|
6
6
|
export declare const sessionCreatedType: "hanko-session-created";
|
|
7
|
-
/**
|
|
8
|
-
* The type of the `hanko-session-resumed` event.
|
|
9
|
-
* @typedef {string} sessionResumedType
|
|
10
|
-
* @memberOf Listener
|
|
11
|
-
*/
|
|
12
|
-
export declare const sessionResumedType: "hanko-session-resumed";
|
|
13
7
|
/**
|
|
14
8
|
* The type of the `hanko-session-expired` event.
|
|
15
9
|
* @typedef {string} sessionExpiredType
|
|
@@ -34,7 +28,6 @@ export declare const userDeletedType: "hanko-user-deleted";
|
|
|
34
28
|
* @memberOf Listener
|
|
35
29
|
*/
|
|
36
30
|
export declare const authFlowCompletedType: "hanko-auth-flow-completed";
|
|
37
|
-
export declare const sessionNotPresentType: "hanko-session-not-present";
|
|
38
31
|
/**
|
|
39
32
|
* The data passed in the `hanko-session-created` or `hanko-session-resumed` event.
|
|
40
33
|
*
|
|
@@ -45,7 +38,7 @@ export declare const sessionNotPresentType: "hanko-session-not-present";
|
|
|
45
38
|
* @property {number} expirationSeconds - The number of seconds until the JWT expires.
|
|
46
39
|
* @property {string} userID - The user associated with the session.
|
|
47
40
|
*/
|
|
48
|
-
export interface
|
|
41
|
+
export interface SessionDetail {
|
|
49
42
|
jwt?: string;
|
|
50
43
|
expirationSeconds: number;
|
|
51
44
|
userID: string;
|
|
@@ -58,7 +51,7 @@ export interface SessionEventDetail {
|
|
|
58
51
|
* @subcategory Events
|
|
59
52
|
* @property {string} userID - The user associated with the removed session.
|
|
60
53
|
*/
|
|
61
|
-
export interface
|
|
54
|
+
export interface AuthFlowCompletedDetail {
|
|
62
55
|
userID: string;
|
|
63
56
|
}
|
|
64
57
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SessionDetail, AuthFlowCompletedDetail } from "./CustomEvents";
|
|
2
|
+
import { SessionState } from "../state/session/SessionState";
|
|
2
3
|
/**
|
|
3
4
|
* A class that dispatches custom events.
|
|
4
5
|
*
|
|
@@ -7,6 +8,7 @@ import { SessionEventDetail, AuthFlowCompletedEventDetail } from "./CustomEvents
|
|
|
7
8
|
*/
|
|
8
9
|
export declare class Dispatcher {
|
|
9
10
|
_dispatchEvent: any;
|
|
11
|
+
_sessionState: SessionState;
|
|
10
12
|
/**
|
|
11
13
|
* Dispatches a custom event.
|
|
12
14
|
*
|
|
@@ -15,18 +17,12 @@ export declare class Dispatcher {
|
|
|
15
17
|
* @private
|
|
16
18
|
*/
|
|
17
19
|
private dispatch;
|
|
18
|
-
/**
|
|
19
|
-
* Dispatches a "hanko-session-resumed" event to the document with the specified detail.
|
|
20
|
-
*
|
|
21
|
-
* @param {SessionEventDetail} detail - The event detail.
|
|
22
|
-
*/
|
|
23
|
-
dispatchSessionResumedEvent(detail: SessionEventDetail): void;
|
|
24
20
|
/**
|
|
25
21
|
* Dispatches a "hanko-session-created" event to the document with the specified detail.
|
|
26
22
|
*
|
|
27
|
-
* @param {
|
|
23
|
+
* @param {SessionDetail} detail - The event detail.
|
|
28
24
|
*/
|
|
29
|
-
dispatchSessionCreatedEvent(detail:
|
|
25
|
+
dispatchSessionCreatedEvent(detail: SessionDetail): void;
|
|
30
26
|
/**
|
|
31
27
|
* Dispatches a "hanko-session-expired" event to the document.
|
|
32
28
|
*/
|
|
@@ -42,11 +38,7 @@ export declare class Dispatcher {
|
|
|
42
38
|
/**
|
|
43
39
|
* Dispatches a "hanko-auth-flow-completed" event to the document with the specified detail.
|
|
44
40
|
*
|
|
45
|
-
* @param {
|
|
46
|
-
*/
|
|
47
|
-
dispatchAuthFlowCompletedEvent(detail: AuthFlowCompletedEventDetail): void;
|
|
48
|
-
/**
|
|
49
|
-
* Dispatches a "hanko-session-not-present" event to the document.
|
|
41
|
+
* @param {AuthFlowCompletedDetail} detail - The event detail.
|
|
50
42
|
*/
|
|
51
|
-
|
|
43
|
+
dispatchAuthFlowCompletedEvent(detail: AuthFlowCompletedDetail): void;
|
|
52
44
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Throttle } from "../Throttle";
|
|
2
|
-
import {
|
|
2
|
+
import { SessionDetail, AuthFlowCompletedDetail } from "./CustomEvents";
|
|
3
3
|
/**
|
|
4
4
|
* A callback function to be executed when an event is triggered.
|
|
5
5
|
*
|
|
@@ -25,7 +25,6 @@ type CleanupFunc = () => void;
|
|
|
25
25
|
*/
|
|
26
26
|
export declare class Listener {
|
|
27
27
|
throttleLimit: number;
|
|
28
|
-
_cleanupFunctions: CleanupFunc[];
|
|
29
28
|
_addEventListener: any;
|
|
30
29
|
_removeEventListener: any;
|
|
31
30
|
_throttle: typeof Throttle.throttle;
|
|
@@ -46,10 +45,6 @@ export declare class Listener {
|
|
|
46
45
|
* @returns {CleanupFunc} This function can be called to remove the event listener.
|
|
47
46
|
*/
|
|
48
47
|
private addEventListenerWithType;
|
|
49
|
-
/**
|
|
50
|
-
* Removes all currently installed event listeners.
|
|
51
|
-
*/
|
|
52
|
-
removeEventListeners(): void;
|
|
53
48
|
/**
|
|
54
49
|
* Maps the parameters for an event listener to the `EventListenerWithTypeParams` interface.
|
|
55
50
|
*
|
|
@@ -75,20 +70,11 @@ export declare class Listener {
|
|
|
75
70
|
* Adds an event listener for "hanko-session-created" events. Will be triggered across all browser windows, when the user
|
|
76
71
|
* logs in, or when the page has been loaded or refreshed and there is a valid session.
|
|
77
72
|
*
|
|
78
|
-
* @param {CallbackFunc<
|
|
79
|
-
* @param {boolean=} once - Whether the event listener should be removed after being called once.
|
|
80
|
-
* @returns {CleanupFunc} This function can be called to remove the event listener.
|
|
81
|
-
*/
|
|
82
|
-
onSessionCreated(callback: CallbackFunc<SessionEventDetail>, once?: boolean): CleanupFunc;
|
|
83
|
-
/**
|
|
84
|
-
* Adds an event listener for "hanko-session-resumed" events. Will be triggered, after the page has been loaded and
|
|
85
|
-
* the user has an active session.
|
|
86
|
-
*
|
|
87
|
-
* @param {CallbackFunc<SessionEventDetail>} callback - The function to be called when the event is triggered.
|
|
73
|
+
* @param {CallbackFunc<SessionDetail>} callback - The function to be called when the event is triggered.
|
|
88
74
|
* @param {boolean=} once - Whether the event listener should be removed after being called once.
|
|
89
75
|
* @returns {CleanupFunc} This function can be called to remove the event listener.
|
|
90
76
|
*/
|
|
91
|
-
|
|
77
|
+
onSessionCreated(callback: CallbackFunc<SessionDetail>, once?: boolean): CleanupFunc;
|
|
92
78
|
/**
|
|
93
79
|
* Adds an event listener for "hanko-session-expired" events. The event will be triggered across all browser windows
|
|
94
80
|
* as soon as the current JWT expires or the user logs out. It also triggers, when the user deletes the account in
|
|
@@ -119,19 +105,10 @@ export declare class Listener {
|
|
|
119
105
|
/**
|
|
120
106
|
* Adds an event listener for hanko-auth-flow-completed events. Will be triggered after the login or registration flow has been completed.
|
|
121
107
|
*
|
|
122
|
-
* @param {CallbackFunc<
|
|
123
|
-
* @param {boolean=} once - Whether the event listener should be removed after being called once.
|
|
124
|
-
* @returns {CleanupFunc} This function can be called to remove the event listener.
|
|
125
|
-
*/
|
|
126
|
-
onAuthFlowCompleted(callback: CallbackFunc<AuthFlowCompletedEventDetail>, once?: boolean): CleanupFunc;
|
|
127
|
-
/**
|
|
128
|
-
* Adds an event listener for hanko-session-not-present events. Will be triggered initially, after the page has been
|
|
129
|
-
* loaded and the user is logged out.
|
|
130
|
-
*
|
|
131
|
-
* @param {CallbackFunc<AuthFlowCompletedEventDetail>} callback - The function to be called when the event is triggered.
|
|
108
|
+
* @param {CallbackFunc<AuthFlowCompletedDetail>} callback - The function to be called when the event is triggered.
|
|
132
109
|
* @param {boolean=} once - Whether the event listener should be removed after being called once.
|
|
133
110
|
* @returns {CleanupFunc} This function can be called to remove the event listener.
|
|
134
111
|
*/
|
|
135
|
-
|
|
112
|
+
onAuthFlowCompleted(callback: CallbackFunc<AuthFlowCompletedDetail>, once?: boolean): CleanupFunc;
|
|
136
113
|
}
|
|
137
114
|
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { SessionEventDetail } from "./CustomEvents";
|
|
2
1
|
import { Listener } from "./Listener";
|
|
3
|
-
import { SessionState } from "../state/session/SessionState";
|
|
4
2
|
import { Scheduler } from "./Scheduler";
|
|
5
3
|
import { Dispatcher } from "./Dispatcher";
|
|
6
|
-
import {
|
|
4
|
+
import { Session } from "../Session";
|
|
7
5
|
/**
|
|
8
6
|
* A class that dispatches events and scheduled events, based on other events.
|
|
9
7
|
*
|
|
@@ -14,15 +12,14 @@ import { Cookie } from "../Cookie";
|
|
|
14
12
|
export declare class Relay extends Dispatcher {
|
|
15
13
|
_listener: Listener;
|
|
16
14
|
_scheduler: Scheduler;
|
|
17
|
-
|
|
18
|
-
_cookie: Cookie;
|
|
15
|
+
_session: Session;
|
|
19
16
|
constructor();
|
|
20
17
|
/**
|
|
21
18
|
* Removes the scheduled "hanko-session-expired" event and re-schedules a new event with updated expirationSeconds, to
|
|
22
19
|
* ensure the "hanko-session-expired" event won't be triggered too early.
|
|
23
20
|
*
|
|
24
21
|
* @private
|
|
25
|
-
* @param {
|
|
22
|
+
* @param {SessionDetail} detail - The event detail.
|
|
26
23
|
*/
|
|
27
24
|
private scheduleSessionExpiredEvent;
|
|
28
25
|
/**
|
|
@@ -32,12 +29,6 @@ export declare class Relay extends Dispatcher {
|
|
|
32
29
|
* @private
|
|
33
30
|
*/
|
|
34
31
|
private cancelSessionExpiredEvent;
|
|
35
|
-
/**
|
|
36
|
-
* Returns the session detail currently stored in the local storage.
|
|
37
|
-
*
|
|
38
|
-
* @returns {SessionEventDetail}
|
|
39
|
-
*/
|
|
40
|
-
getSessionDetail(): SessionEventDetail;
|
|
41
32
|
/**
|
|
42
33
|
* Handles the "storage" event in case the local storage entry, that contains the session detail has been changed by
|
|
43
34
|
* another window. Depending on the new value of `expirationSeconds`, it either dispatches a "hanko-session-created"
|
|
@@ -47,21 +38,10 @@ export declare class Relay extends Dispatcher {
|
|
|
47
38
|
* @param {StorageEvent} event - The storage event object.
|
|
48
39
|
*/
|
|
49
40
|
private handleStorageEvent;
|
|
50
|
-
/**
|
|
51
|
-
* Calls `func` when the document is ready.
|
|
52
|
-
*
|
|
53
|
-
* @param {function} func - The function to be called.
|
|
54
|
-
* @private
|
|
55
|
-
*/
|
|
56
|
-
private static onDocumentReady;
|
|
57
41
|
/**
|
|
58
42
|
* Listens for events sent in the current browser.
|
|
59
43
|
*
|
|
60
44
|
* @private
|
|
61
45
|
*/
|
|
62
46
|
private listenEventDependencies;
|
|
63
|
-
/**
|
|
64
|
-
* Restores the previous session details and dispatches initial events.
|
|
65
|
-
*/
|
|
66
|
-
dispatchInitialEvents(): void;
|
|
67
47
|
}
|
|
@@ -8,6 +8,7 @@ import { State } from "../State";
|
|
|
8
8
|
export interface LocalStorageSession {
|
|
9
9
|
expiry: number;
|
|
10
10
|
userID: string;
|
|
11
|
+
authFlowCompleted: boolean;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* A class to read and write local storage contents regarding sessions.
|
|
@@ -56,6 +57,17 @@ declare class SessionState extends State {
|
|
|
56
57
|
* @return {SessionState}
|
|
57
58
|
*/
|
|
58
59
|
setUserID(userID: string): SessionState;
|
|
60
|
+
/**
|
|
61
|
+
* Gets the authFlowCompleted indicator.
|
|
62
|
+
*/
|
|
63
|
+
getAuthFlowCompleted(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Sets the authFlowCompleted indicator.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} completed - The authFlowCompleted indicator.
|
|
68
|
+
* @return {SessionState}
|
|
69
|
+
*/
|
|
70
|
+
setAuthFlowCompleted(completed: boolean): SessionState;
|
|
59
71
|
/**
|
|
60
72
|
* Removes the session details.
|
|
61
73
|
*
|
package/dist/sdk.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function t(e){return t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},t(e)}function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}function n(e,t,i){return n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o},n.apply(null,arguments)}function i(e){var o="function"==typeof Map?new Map:void 0;return i=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==o){if(o.has(e))return o.get(e);o.set(e,i)}function i(){return n(e,arguments,t(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)},i(e)}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var s=/*#__PURE__*/function(t){function r(e,n,i){var s;return(s=t.call(this,e)||this).code=void 0,s.cause=void 0,s.code=n,s.cause=i,Object.setPrototypeOf(o(s),r.prototype),s}return e(r,t),r}(/*#__PURE__*/i(Error)),a=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Technical error","somethingWentWrong",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),c=/*#__PURE__*/function(t){function r(e,n){var i;return i=t.call(this,"Conflict error","conflict",n)||this,Object.setPrototypeOf(o(i),r.prototype),i}return e(r,t),r}(s),u=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Request timed out error","requestTimeout",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),d=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Request cancelled error","requestCancelled",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),h=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Invalid password error","invalidPassword",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),l=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Invalid Passcode error","invalidPasscode",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),p=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Invalid WebAuthn credential error","invalidWebauthnCredential",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),f=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Passcode expired error","passcodeExpired",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),v=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Maximum number of Passcode attempts reached error","passcodeAttemptsReached",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),w=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Not found error","notFound",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),m=/*#__PURE__*/function(t){function r(e,n){var i;return(i=t.call(this,"Too many requests error","tooManyRequests",n)||this).retryAfter=void 0,i.retryAfter=e,Object.setPrototypeOf(o(i),r.prototype),i}return e(r,t),r}(s),y=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Unauthorized error","unauthorized",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),g=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"User verification error","userVerification",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),E=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Maximum number of email addresses reached error","maxNumOfEmailAddressesReached",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),S=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"The email address already exists","emailAddressAlreadyExistsError",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),P=/*#__PURE__*/function(t){function r(e,n){var i;return i=t.call(this,"An error occurred during third party sign up/sign in",e,n)||this,Object.setPrototypeOf(o(i),r.prototype),i}return e(r,t),r}(s),b=/*#__PURE__*/function(){function e(e){this.key=void 0,this.ls=void 0,this.key=e,this.ls={}}var t=e.prototype;return t.read=function(){var e;try{var t=localStorage.getItem(this.key),r=decodeURIComponent(decodeURI(window.atob(t)));e=JSON.parse(r)}catch(e){return this.ls={},this}return this.ls=e,this},t.write=function(){var e=JSON.stringify(this.ls),t=window.btoa(encodeURI(encodeURIComponent(e)));return localStorage.setItem(this.key,t),this},e.timeToRemainingSeconds=function(e){return void 0===e&&(e=0),e-Math.floor(Date.now()/1e3)},e.remainingSecondsToTime=function(e){return void 0===e&&(e=0),Math.floor(Date.now()/1e3)+e},e}(),x=/*#__PURE__*/function(t){function r(){return t.call(this,"hanko_session")||this}e(r,t);var n=r.prototype;return n.read=function(){return t.prototype.read.call(this),this},n.getState=function(){var e;return(e=this.ls).session||(e.session={expiry:0,userID:""}),this.ls.session},n.getExpirationSeconds=function(){return b.timeToRemainingSeconds(this.getState().expiry)},n.setExpirationSeconds=function(e){return this.getState().expiry=b.remainingSecondsToTime(e),this},n.getUserID=function(){return this.getState().userID},n.setUserID=function(e){return this.getState().userID=e,this},n.reset=function(){var e=this.getState();return delete e.expiry,delete e.userID,this},r}(b),k=/*#__PURE__*/function(t){function r(){return t.call(this,"hanko")||this}return e(r,t),r.prototype.getUserState=function(e){var t;return(t=this.ls).users||(t.users={}),Object.prototype.hasOwnProperty.call(this.ls.users,e)||(this.ls.users[e]={}),this.ls.users[e]},r}(b),C=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}e(r,t);var n=r.prototype;return n.getState=function(e){var r;return(r=t.prototype.getUserState.call(this,e)).passcode||(r.passcode={})},n.read=function(){return t.prototype.read.call(this),this},n.getActiveID=function(e){return this.getState(e).id},n.setActiveID=function(e,t){return this.getState(e).id=t,this},n.getEmailID=function(e){return this.getState(e).emailID},n.setEmailID=function(e,t){return this.getState(e).emailID=t,this},n.reset=function(e){var t=this.getState(e);return delete t.id,delete t.ttl,delete t.resendAfter,delete t.emailID,this},n.getTTL=function(e){return b.timeToRemainingSeconds(this.getState(e).ttl)},n.setTTL=function(e,t){return this.getState(e).ttl=b.remainingSecondsToTime(t),this},n.getResendAfter=function(e){return b.timeToRemainingSeconds(this.getState(e).resendAfter)},n.setResendAfter=function(e,t){return this.getState(e).resendAfter=b.remainingSecondsToTime(t),this},r}(k),_="hanko-session-created",O="hanko-session-resumed",A="hanko-session-expired",T="hanko-user-logged-out",R="hanko-user-deleted",j="hanko-auth-flow-completed",D="hanko-session-not-present",I=/*#__PURE__*/function(t){function r(e,r){return t.call(this,e,{detail:r})||this}return e(r,t),r}(/*#__PURE__*/i(CustomEvent)),L=/*#__PURE__*/function(){function e(){this._dispatchEvent=document.dispatchEvent.bind(document)}var t=e.prototype;return t.dispatch=function(e,t){this._dispatchEvent(new I(e,t))},t.dispatchSessionResumedEvent=function(e){this.dispatch(O,e)},t.dispatchSessionCreatedEvent=function(e){this.dispatch(_,e)},t.dispatchSessionExpiredEvent=function(){this.dispatch(A,null)},t.dispatchUserLoggedOutEvent=function(){this.dispatch(T,null)},t.dispatchUserDeletedEvent=function(){this.dispatch(R,null)},t.dispatchAuthFlowCompletedEvent=function(e){this.dispatch(j,e)},t.dispatchSessionNotPresent=function(){this.dispatch(D,null)},e}();function U(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}var N=function e(t,r){function n(e,n,i){if("undefined"!=typeof document){"number"==typeof(i=U({},r,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var s in i)i[s]&&(o+="; "+s,!0!==i[s]&&(o+="="+i[s].split(";")[0]));return document.cookie=e+"="+t.write(n,e)+o}}return Object.create({set:n,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],n={},i=0;i<r.length;i++){var o=r[i].split("="),s=o.slice(1).join("=");try{var a=decodeURIComponent(o[0]);if(n[a]=t.read(s,a),e===a)break}catch(e){}}return e?n[e]:n}},remove:function(e,t){n(e,"",U({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,U({},this.attributes,t))},withConverter:function(t){return e(U({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"}),H=/*#__PURE__*/function(){function e(){this.authCookieName="hanko"}var t=e.prototype;return t.getAuthCookie=function(){return N.get(this.authCookieName)},t.setAuthCookie=function(e,t){void 0===t&&(t=!0),N.set(this.authCookieName,e,{secure:t})},t.removeAuthCookie=function(){N.remove(this.authCookieName)},e}(),W=/*#__PURE__*/function(){function e(e){this._xhr=void 0,this._xhr=e}return e.prototype.getResponseHeader=function(e){return this._xhr.getResponseHeader(e)},e}(),q=/*#__PURE__*/function(){function e(e){this.headers=void 0,this.ok=void 0,this.status=void 0,this.statusText=void 0,this.url=void 0,this._decodedJSON=void 0,this.xhr=void 0,this.headers=new W(e),this.ok=e.status>=200&&e.status<=299,this.status=e.status,this.statusText=e.statusText,this.url=e.responseURL,this.xhr=e}var t=e.prototype;return t.json=function(){return this._decodedJSON||(this._decodedJSON=JSON.parse(this.xhr.response)),this._decodedJSON},t.parseNumericHeader=function(e){var t=parseInt(this.headers.getResponseHeader(e),10);return isNaN(t)?0:t},e}(),M=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t=13e3),this.timeout=void 0,this.api=void 0,this.sessionState=void 0,this.passcodeState=void 0,this.dispatcher=void 0,this.cookie=void 0,this.api=e,this.timeout=t,this.sessionState=new x,this.passcodeState=new C,this.dispatcher=new L,this.cookie=new H}var t=e.prototype;return t._fetch=function(e,t,r){void 0===r&&(r=new XMLHttpRequest);var n=this.api+e,i=this.timeout,o=this.cookie.getAuthCookie();return new Promise(function(e,s){r.open(t.method,n,!0),r.setRequestHeader("Accept","application/json"),r.setRequestHeader("Content-Type","application/json"),o&&r.setRequestHeader("Authorization","Bearer "+o),r.timeout=i,r.withCredentials=!0,r.onload=function(){var t=new q(r);e(t)},r.onerror=function(){s(new a)},r.ontimeout=function(){s(new u)},r.send(t.body?t.body.toString():null)})},t.processResponseHeadersOnLogin=function(e,t){var r="",n=0;if(t.xhr.getAllResponseHeaders().split("\r\n").forEach(function(e){var i=e.toLowerCase();i.startsWith("x-auth-token")?r=t.headers.getResponseHeader("X-Auth-Token"):i.startsWith("x-session-lifetime")&&(n=parseInt(t.headers.getResponseHeader("X-Session-Lifetime"),10))}),r){var i=!!this.api.match("^https://");this.cookie.setAuthCookie(r,i)}this.passcodeState.read().reset(e).write(),n>0&&(this.sessionState.read(),this.sessionState.setExpirationSeconds(n),this.sessionState.setUserID(e),this.sessionState.write(),this.dispatcher.dispatchSessionCreatedEvent({jwt:r,userID:e,expirationSeconds:n}))},t.get=function(e){return this._fetch(e,{method:"GET"})},t.post=function(e,t){return this._fetch(e,{method:"POST",body:JSON.stringify(t)})},t.put=function(e,t){return this._fetch(e,{method:"PUT",body:JSON.stringify(t)})},t.patch=function(e,t){return this._fetch(e,{method:"PATCH",body:JSON.stringify(t)})},t.delete=function(e){return this._fetch(e,{method:"DELETE"})},e}(),K=function(e,t){void 0===t&&(t=13e3),this.client=void 0,this.client=new M(e,t)},z=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}return e(r,t),r.prototype.get=function(){try{return Promise.resolve(this.client.get("/.well-known/config")).then(function(e){if(!e.ok)throw new a;return e.json()})}catch(e){return Promise.reject(e)}},r}(K),F=/*#__PURE__*/function(t){function r(e,r){var n;return void 0===r&&(r=13e3),(n=t.call(this,e,r)||this).state=void 0,n.state=new C,n}e(r,t);var n=r.prototype;return n.initialize=function(e,t,r){try{var n=this;n.state.read();var i=n.state.getTTL(e),o=n.state.getActiveID(e),s=n.state.getEmailID(e),c=n.state.getResendAfter(e);if(c>0)throw new m(c);if(!r&&i>0&&t===s)return Promise.resolve({id:o,ttl:i});var u={user_id:e};return t&&(u.email_id=t),Promise.resolve(n.client.post("/passcode/login/initialize",u)).then(function(r){if(429===r.status)throw c=r.parseNumericHeader("Retry-After"),n.state.setResendAfter(e,c).write(),new m(c);if(!r.ok)throw new a;var i=r.json();return n.state.setActiveID(e,i.id).setTTL(e,i.ttl),t&&n.state.setEmailID(e,t),n.state.write(),i})}catch(e){return Promise.reject(e)}},n.finalize=function(e,t){try{var r=this,n=r.state.read().getActiveID(e);if(r.state.getTTL(e)<=0)throw new f;return Promise.resolve(r.client.post("/passcode/login/finalize",{id:n,code:t})).then(function(t){if(401===t.status)throw new l;if(410===t.status)throw r.state.reset(e).write(),new v;if(!t.ok)throw new a;r.client.processResponseHeadersOnLogin(e,t)})}catch(e){return Promise.reject(e)}},n.getTTL=function(e){return this.state.read().getTTL(e)},n.getResendAfter=function(e){return this.state.read().getResendAfter(e)},r}(K),J=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}e(r,t);var n=r.prototype;return n.getState=function(e){var r;return(r=t.prototype.getUserState.call(this,e)).password||(r.password={})},n.read=function(){return t.prototype.read.call(this),this},n.getRetryAfter=function(e){return b.timeToRemainingSeconds(this.getState(e).retryAfter)},n.setRetryAfter=function(e,t){return this.getState(e).retryAfter=b.remainingSecondsToTime(t),this},r}(k),B=/*#__PURE__*/function(t){function r(e,r){var n;return void 0===r&&(r=13e3),(n=t.call(this,e,r)||this).passwordState=void 0,n.passcodeState=void 0,n.passwordState=new J,n.passcodeState=new C,n}e(r,t);var n=r.prototype;return n.login=function(e,t){try{var r=this;return Promise.resolve(r.client.post("/password/login",{user_id:e,password:t})).then(function(t){if(401===t.status)throw new h;if(429===t.status){var n=t.parseNumericHeader("Retry-After");throw r.passwordState.read().setRetryAfter(e,n).write(),new m(n)}if(!t.ok)throw new a;r.client.processResponseHeadersOnLogin(e,t)})}catch(e){return Promise.reject(e)}},n.update=function(e,t){try{var r=this;return Promise.resolve(r.client.put("/password",{user_id:e,password:t})).then(function(e){if(401===e.status)throw r.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!e.ok)throw new a})}catch(e){return Promise.reject(e)}},n.getRetryAfter=function(e){return this.passwordState.read().getRetryAfter(e)},r}(K),V=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}e(r,t);var n=r.prototype;return n.getInfo=function(e){try{return Promise.resolve(this.client.post("/user",{email:e})).then(function(e){if(404===e.status)throw new w;if(!e.ok)throw new a;return e.json()})}catch(e){return Promise.reject(e)}},n.create=function(e){try{var t=this;return Promise.resolve(t.client.post("/users",{email:e})).then(function(e){if(409===e.status)throw new c;if(!e.ok)throw new a;var r=e.json();return r&&r.user_id&&t.client.processResponseHeadersOnLogin(r.user_id,e),r})}catch(e){return Promise.reject(e)}},n.getCurrent=function(){try{var e=this;return Promise.resolve(e.client.get("/me")).then(function(t){if(401===t.status)throw e.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!t.ok)throw new a;var r=t.json();return Promise.resolve(e.client.get("/users/"+r.id)).then(function(t){if(401===t.status)throw e.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!t.ok)throw new a;return t.json()})})}catch(e){return Promise.reject(e)}},n.delete=function(){try{var e=this;return Promise.resolve(e.client.delete("/user")).then(function(t){if(t.ok)return e.client.cookie.removeAuthCookie(),e.client.sessionState.reset().write(),void e.client.dispatcher.dispatchUserDeletedEvent();if(401===t.status)throw e.client.dispatcher.dispatchSessionExpiredEvent(),new y;throw new a})}catch(e){return Promise.reject(e)}},n.logout=function(){try{var e=this;return Promise.resolve(e.client.post("/logout")).then(function(t){if(e.client.cookie.removeAuthCookie(),e.client.sessionState.reset().write(),e.client.dispatcher.dispatchUserLoggedOutEvent(),401===t.status);else if(!t.ok)throw new a})}catch(e){return Promise.reject(e)}},r}(K);function X(e){const t="==".slice(0,(4-e.length%4)%4),r=e.replace(/-/g,"+").replace(/_/g,"/")+t,n=atob(r),i=new ArrayBuffer(n.length),o=new Uint8Array(i);for(let e=0;e<n.length;e++)o[e]=n.charCodeAt(e);return i}function G(e){const t=new Uint8Array(e);let r="";for(const e of t)r+=String.fromCharCode(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var $="copy",Q="convert";function Y(e,t,r){if(t===$)return r;if(t===Q)return e(r);if(t instanceof Array)return r.map(r=>Y(e,t[0],r));if(t instanceof Object){const n={};for(const[i,o]of Object.entries(t)){if(o.derive){const e=o.derive(r);void 0!==e&&(r[i]=e)}if(i in r)n[i]=null!=r[i]?Y(e,o.schema,r[i]):null;else if(o.required)throw new Error(`Missing key: ${i}`)}return n}}function Z(e,t){return{required:!0,schema:e,derive:t}}function ee(e){return{required:!0,schema:e}}function te(e){return{required:!1,schema:e}}var re={type:ee($),id:ee(Q),transports:te($)},ne={appid:te($),appidExclude:te($),credProps:te($)},ie={appid:te($),appidExclude:te($),credProps:te($)},oe={publicKey:ee({rp:ee($),user:ee({id:ee(Q),name:ee($),displayName:ee($)}),challenge:ee(Q),pubKeyCredParams:ee($),timeout:te($),excludeCredentials:te([re]),authenticatorSelection:te($),attestation:te($),extensions:te(ne)}),signal:te($)},se={type:ee($),id:ee($),rawId:ee(Q),authenticatorAttachment:te($),response:ee({clientDataJSON:ee(Q),attestationObject:ee(Q),transports:Z($,e=>{var t;return(null==(t=e.getTransports)?void 0:t.call(e))||[]})}),clientExtensionResults:Z(ie,e=>e.getClientExtensionResults())},ae={mediation:te($),publicKey:ee({challenge:ee(Q),timeout:te($),rpId:te($),allowCredentials:te([re]),userVerification:te($),extensions:te(ne)}),signal:te($)},ce={type:ee($),id:ee($),rawId:ee(Q),authenticatorAttachment:te($),response:ee({clientDataJSON:ee(Q),authenticatorData:ee(Q),signature:ee(Q),userHandle:ee(Q)}),clientExtensionResults:Z(ie,e=>e.getClientExtensionResults())};async function ue(e){const t=await navigator.credentials.create(function(e){return Y(X,oe,e)}(e));return function(e){return Y(G,se,e)}(t)}async function de(e){const t=await navigator.credentials.get(function(e){return Y(X,ae,e)}(e));return function(e){return Y(G,ce,e)}(t)}var he=/*#__PURE__*/function(){function e(){}return e.supported=function(){return!!(navigator.credentials&&navigator.credentials.create&&navigator.credentials.get&&window.PublicKeyCredential)},e.isPlatformAuthenticatorAvailable=function(){try{return this.supported()&&window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?Promise.resolve(window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()):Promise.resolve(!1)}catch(e){return Promise.reject(e)}},e.isSecurityKeySupported=function(){try{return void 0!==window.PublicKeyCredential&&window.PublicKeyCredential.isExternalCTAP2SecurityKeySupported?Promise.resolve(window.PublicKeyCredential.isExternalCTAP2SecurityKeySupported()):Promise.resolve(this.supported())}catch(e){return Promise.reject(e)}},e.isConditionalMediationAvailable=function(){try{return window.PublicKeyCredential&&window.PublicKeyCredential.isConditionalMediationAvailable?Promise.resolve(window.PublicKeyCredential.isConditionalMediationAvailable()):Promise.resolve(!1)}catch(e){return Promise.reject(e)}},e}(),le=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}e(r,t);var n=r.prototype;return n.getState=function(e){var r;return(r=t.prototype.getUserState.call(this,e)).webauthn||(r.webauthn={})},n.read=function(){return t.prototype.read.call(this),this},n.getCredentials=function(e){var t;return(t=this.getState(e)).credentials||(t.credentials=[])},n.addCredential=function(e,t){return this.getCredentials(e).push(t),this},n.matchCredentials=function(e,t){return this.getCredentials(e).filter(function(e){return t.find(function(t){return t.id===e})}).map(function(e){return{id:e}})},r}(k);function pe(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}var fe=/*#__PURE__*/function(t){function r(e,r){var n;return void 0===r&&(r=13e3),(n=t.call(this,e,r)||this).webauthnState=void 0,n.passcodeState=void 0,n.controller=void 0,n._getCredential=de,n._createCredential=ue,n.webauthnState=new le,n.passcodeState=new C,n}e(r,t);var n=r.prototype;return n.login=function(e,t){try{var r=this;return Promise.resolve(r.client.post("/webauthn/login/initialize",{user_id:e})).then(function(e){var n;function i(e){return n?e:Promise.resolve(r.client.post("/webauthn/login/finalize",o)).then(function(e){if(400===e.status||401===e.status)throw new p;if(!e.ok)throw new a;var t=e.json();return r.webauthnState.read().addCredential(t.user_id,t.credential_id).write(),r.client.processResponseHeadersOnLogin(t.user_id,e),t})}if(!e.ok)throw new a;var o,s=e.json();s.signal=r._createAbortSignal(),t&&(s.mediation="conditional");var c=pe(function(){return Promise.resolve(r._getCredential(s)).then(function(e){o=e})},function(e){throw new d(e)});return c&&c.then?c.then(i):i(c)})}catch(e){return Promise.reject(e)}},n.register=function(){try{var e=this;return Promise.resolve(e.client.post("/webauthn/registration/initialize")).then(function(t){function r(t){return n.transports=n.response.transports,Promise.resolve(e.client.post("/webauthn/registration/finalize",n)).then(function(t){if(401===t.status)throw e.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(422===t.status)throw new g;if(!t.ok)throw new a;var r=t.json();e.webauthnState.read().addCredential(r.user_id,r.credential_id).write()})}if(401===t.status)throw e.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!t.ok)throw new a;var n,i=t.json();i.signal=e._createAbortSignal();var o=pe(function(){return Promise.resolve(e._createCredential(i)).then(function(e){n=e})},function(e){throw new d(e)});return o&&o.then?o.then(r):r()})}catch(e){return Promise.reject(e)}},n.listCredentials=function(){try{var e=this;return Promise.resolve(e.client.get("/webauthn/credentials")).then(function(t){if(401===t.status)throw e.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!t.ok)throw new a;return t.json()})}catch(e){return Promise.reject(e)}},n.updateCredential=function(e,t){try{var r=this;return Promise.resolve(r.client.patch("/webauthn/credentials/"+e,{name:t})).then(function(e){if(401===e.status)throw r.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!e.ok)throw new a})}catch(e){return Promise.reject(e)}},n.deleteCredential=function(e){try{var t=this;return Promise.resolve(t.client.delete("/webauthn/credentials/"+e)).then(function(e){if(401===e.status)throw t.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!e.ok)throw new a})}catch(e){return Promise.reject(e)}},n.shouldRegister=function(e){try{var t=he.supported();if(!e.webauthn_credentials||!e.webauthn_credentials.length)return Promise.resolve(t);var r=this.webauthnState.read().matchCredentials(e.id,e.webauthn_credentials);return Promise.resolve(t&&!r.length)}catch(e){return Promise.reject(e)}},n._createAbortSignal=function(){return this.controller&&this.controller.abort(),this.controller=new AbortController,this.controller.signal},r}(K),ve=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}e(r,t);var n=r.prototype;return n.list=function(){try{var e=this;return Promise.resolve(e.client.get("/emails")).then(function(t){if(401===t.status)throw e.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!t.ok)throw new a;return t.json()})}catch(e){return Promise.reject(e)}},n.create=function(e){try{var t=this;return Promise.resolve(t.client.post("/emails",{address:e})).then(function(e){if(e.ok)return e.json();if(400===e.status)throw new S;if(401===e.status)throw t.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(409===e.status)throw new E;throw new a})}catch(e){return Promise.reject(e)}},n.setPrimaryEmail=function(e){try{var t=this;return Promise.resolve(t.client.post("/emails/"+e+"/set_primary")).then(function(e){if(401===e.status)throw t.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!e.ok)throw new a})}catch(e){return Promise.reject(e)}},n.delete=function(e){try{var t=this;return Promise.resolve(t.client.delete("/emails/"+e)).then(function(e){if(401===e.status)throw t.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!e.ok)throw new a})}catch(e){return Promise.reject(e)}},r}(K),we=/*#__PURE__*/function(t){function r(e,r){return void 0===r&&(r=13e3),t.call(this,e,r)||this}e(r,t);var n=r.prototype;return n.auth=function(e,t){try{var r=new URL("/thirdparty/auth",this.client.api);if(!e)throw new P("somethingWentWrong",new Error("provider missing from request"));if(!t)throw new P("somethingWentWrong",new Error("redirectTo missing from request"));return r.searchParams.append("provider",e),r.searchParams.append("redirect_to",t),window.location.assign(r.href),Promise.resolve()}catch(e){return Promise.reject(e)}},n.getError=function(){var e=new URLSearchParams(window.location.search),t=e.get("error"),r=e.get("error_description");if(t){var n="";switch(t){case"access_denied":n="thirdPartyAccessDenied";break;case"user_conflict":n="emailAddressAlreadyExistsError";break;case"multiple_accounts":n="thirdPartyMultipleAccounts";break;case"unverified_email":n="thirdPartyUnverifiedEmail";break;case"email_maxnum":n="maxNumOfEmailAddressesReached";break;default:n="somethingWentWrong"}return new P(n,new Error(r))}},r}(K),me=/*#__PURE__*/function(t){function r(e,r){return void 0===r&&(r=13e3),t.call(this,e,r)||this}return e(r,t),r.prototype.validate=function(){try{var e=this,t=new URLSearchParams(window.location.search).get("hanko_token");return t?(window.history.replaceState(null,null,window.location.pathname),Promise.resolve(e.client.post("/token",{value:t})).then(function(t){if(!t.ok)throw new a;var r=t.json();e.client.processResponseHeadersOnLogin(r.user_id,t)})):Promise.resolve()}catch(e){return Promise.reject(e)}},r}(K),ye=/*#__PURE__*/function(){function e(){}return e.throttle=function(e,t,r){void 0===r&&(r={});var n,i,o,s=r.leading,a=void 0===s||s,c=r.trailing,u=void 0===c||c,d=0,h=function(){d=!1===a?0:Date.now(),o=null,e.apply(n,i)};return function(){var r=Date.now();d||!1!==a||(d=r);var s=t-(r-d);n=this,i=[].slice.call(arguments),s<=0||s>t?(o&&(window.clearTimeout(o),o=null),d=r,e.apply(n,i)):o||!1===u||(o=window.setTimeout(h,s))}},e}(),ge=/*#__PURE__*/function(){function e(){this.throttleLimit=1e3,this._cleanupFunctions=[],this._addEventListener=document.addEventListener.bind(document),this._removeEventListener=document.removeEventListener.bind(document),this._throttle=ye.throttle}var t=e.prototype;return t.wrapCallback=function(e,t){var r=function(t){e(t.detail)};return t?this._throttle(r,this.throttleLimit,{leading:!0,trailing:!1}):r},t.addEventListenerWithType=function(e){var t=this,r=e.type,n=e.once,i=void 0!==n&&n,o=e.throttle,s=this.wrapCallback(e.callback,void 0!==o&&o);this._addEventListener(r,s,{once:i});var a=function(){return t._removeEventListener(r,s)};return this._cleanupFunctions.push(a),a},t.removeEventListeners=function(){this._cleanupFunctions.forEach(function(e){return e()}),this._cleanupFunctions=[]},e.mapAddEventListenerParams=function(e,t,r){return{type:e,callback:t.callback,once:t.once,throttle:r}},t.addEventListener=function(t,r,n){return this.addEventListenerWithType(e.mapAddEventListenerParams(t,r,n))},t.onSessionCreated=function(e,t){return this.addEventListener(_,{callback:e,once:t},!0)},t.onSessionResumed=function(e,t){return this.addEventListener(O,{callback:e,once:t},!0)},t.onSessionExpired=function(e,t){return this.addEventListener(A,{callback:e,once:t},!0)},t.onUserLoggedOut=function(e,t){return this.addEventListener(T,{callback:e,once:t})},t.onUserDeleted=function(e,t){return this.addEventListener(R,{callback:e,once:t})},t.onAuthFlowCompleted=function(e,t){return this.addEventListener(j,{callback:e,once:t})},t.onSessionNotPresent=function(e,t){return this.addEventListener(D,{callback:e,once:t},!0)},e}(),Ee=/*#__PURE__*/function(){function e(){this._tasks=[]}var t=e.prototype;return t.removeTask=function(e){window.clearTimeout(e.timeoutID),this._tasks=this._tasks.filter(function(t){return t!==e})},t.removeTasksWithType=function(e){var t=this;this._tasks.filter(function(t){return t.type===e}).forEach(function(e){return t.removeTask(e)})},t.scheduleTask=function(e,t,r){var n=this,i={timeoutID:window.setTimeout(function(){t(),n.removeTask(i)},1e3*r),type:e,func:t};this._tasks.push(i)},e}(),Se=/*#__PURE__*/function(t){function r(){var e;return(e=t.call(this)||this)._listener=new ge,e._scheduler=new Ee,e._sessionState=new x,e._cookie=new H,e.scheduleSessionExpiredEvent=function(t){e._scheduler.removeTasksWithType(A),e._scheduler.scheduleTask(A,function(){return e.dispatchSessionExpiredEvent()},t.expirationSeconds)},e.cancelSessionExpiredEvent=function(){e._scheduler.removeTasksWithType(A)},e.handleStorageEvent=function(t){if("hanko_session"===t.key){var r=e.getSessionDetail();r?e.dispatchSessionCreatedEvent(r):e.dispatchSessionExpiredEvent()}},e.listenEventDependencies(),e}e(r,t);var n=r.prototype;return n.getSessionDetail=function(){this._sessionState.read();var e=this._sessionState.getUserID(),t=this._sessionState.getExpirationSeconds(),r=this._cookie.getAuthCookie();return t>0&&null!=e&&e.length?{userID:e,expirationSeconds:t,jwt:r}:null},r.onDocumentReady=function(e){"complete"===document.readyState||"interactive"===document.readyState?setTimeout(e,1):document.addEventListener("DOMContentLoaded",e)},n.listenEventDependencies=function(){var e=this;this._listener.onSessionCreated(this.scheduleSessionExpiredEvent),this._listener.onSessionResumed(this.scheduleSessionExpiredEvent),this._listener.onSessionExpired(this.cancelSessionExpiredEvent),this._listener.onUserDeleted(this.cancelSessionExpiredEvent),this._listener.onUserLoggedOut(this.cancelSessionExpiredEvent),window.addEventListener("storage",this.handleStorageEvent),r.onDocumentReady(function(){return e.dispatchInitialEvents()})},n.dispatchInitialEvents=function(){this._sessionState.read();var e=this.getSessionDetail();e?this.dispatchSessionResumedEvent(e):this.dispatchSessionNotPresent()},r}(L),Pe=/*#__PURE__*/function(t){function r(e,r){var n;return void 0===r&&(r=13e3),(n=t.call(this)||this).api=void 0,n.config=void 0,n.user=void 0,n.webauthn=void 0,n.password=void 0,n.passcode=void 0,n.email=void 0,n.thirdParty=void 0,n.token=void 0,n.relay=void 0,n.api=e,n.config=new z(e,r),n.user=new V(e,r),n.webauthn=new fe(e,r),n.password=new B(e,r),n.passcode=new F(e,r),n.email=new ve(e,r),n.thirdParty=new we(e,r),n.token=new me(e,r),n.relay=new Se,n}return e(r,t),r}(ge);exports.ConfigClient=z,exports.ConflictError=c,exports.CustomEventWithDetail=I,exports.EmailAddressAlreadyExistsError=S,exports.EmailClient=ve,exports.Hanko=Pe,exports.HankoError=s,exports.InvalidPasscodeError=l,exports.InvalidPasswordError=h,exports.InvalidWebauthnCredentialError=p,exports.MaxNumOfEmailAddressesReachedError=E,exports.MaxNumOfPasscodeAttemptsReachedError=v,exports.NotFoundError=w,exports.PasscodeClient=F,exports.PasscodeExpiredError=f,exports.PasswordClient=B,exports.RequestTimeoutError=u,exports.TechnicalError=a,exports.ThirdPartyClient=we,exports.ThirdPartyError=P,exports.TokenClient=me,exports.TooManyRequestsError=m,exports.UnauthorizedError=y,exports.UserClient=V,exports.UserVerificationError=g,exports.WebauthnClient=fe,exports.WebauthnRequestCancelledError=d,exports.WebauthnSupport=he,exports.authFlowCompletedType=j,exports.sessionCreatedType=_,exports.sessionExpiredType=A,exports.sessionNotPresentType=D,exports.sessionResumedType=O,exports.userDeletedType=R,exports.userLoggedOutType=T;
|
|
1
|
+
function e(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function t(e){return t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},t(e)}function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}function n(e,t,i){return n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o},n.apply(null,arguments)}function i(e){var o="function"==typeof Map?new Map:void 0;return i=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==o){if(o.has(e))return o.get(e);o.set(e,i)}function i(){return n(e,arguments,t(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)},i(e)}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var s=/*#__PURE__*/function(t){function r(e,n,i){var s;return(s=t.call(this,e)||this).code=void 0,s.cause=void 0,s.code=n,s.cause=i,Object.setPrototypeOf(o(s),r.prototype),s}return e(r,t),r}(/*#__PURE__*/i(Error)),a=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Technical error","somethingWentWrong",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),c=/*#__PURE__*/function(t){function r(e,n){var i;return i=t.call(this,"Conflict error","conflict",n)||this,Object.setPrototypeOf(o(i),r.prototype),i}return e(r,t),r}(s),u=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Request timed out error","requestTimeout",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),h=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Request cancelled error","requestCancelled",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),d=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Invalid password error","invalidPassword",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),l=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Invalid Passcode error","invalidPasscode",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),p=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Invalid WebAuthn credential error","invalidWebauthnCredential",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),f=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Passcode expired error","passcodeExpired",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),v=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Maximum number of Passcode attempts reached error","passcodeAttemptsReached",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),w=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Not found error","notFound",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),m=/*#__PURE__*/function(t){function r(e,n){var i;return(i=t.call(this,"Too many requests error","tooManyRequests",n)||this).retryAfter=void 0,i.retryAfter=e,Object.setPrototypeOf(o(i),r.prototype),i}return e(r,t),r}(s),y=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Unauthorized error","unauthorized",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),g=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"User verification error","userVerification",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),E=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"Maximum number of email addresses reached error","maxNumOfEmailAddressesReached",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),S=/*#__PURE__*/function(t){function r(e){var n;return n=t.call(this,"The email address already exists","emailAddressAlreadyExistsError",e)||this,Object.setPrototypeOf(o(n),r.prototype),n}return e(r,t),r}(s),P=/*#__PURE__*/function(t){function r(e,n){var i;return i=t.call(this,"An error occurred during third party sign up/sign in",e,n)||this,Object.setPrototypeOf(o(i),r.prototype),i}return e(r,t),r}(s),b=/*#__PURE__*/function(){function e(e){this.key=void 0,this.ls=void 0,this.key=e,this.ls={}}var t=e.prototype;return t.read=function(){var e;try{var t=localStorage.getItem(this.key),r=decodeURIComponent(decodeURI(window.atob(t)));e=JSON.parse(r)}catch(e){return this.ls={},this}return this.ls=e,this},t.write=function(){var e=JSON.stringify(this.ls),t=window.btoa(encodeURI(encodeURIComponent(e)));return localStorage.setItem(this.key,t),this},e.timeToRemainingSeconds=function(e){return void 0===e&&(e=0),e-Math.floor(Date.now()/1e3)},e.remainingSecondsToTime=function(e){return void 0===e&&(e=0),Math.floor(Date.now()/1e3)+e},e}(),x=/*#__PURE__*/function(t){function r(){return t.call(this,"hanko_session")||this}e(r,t);var n=r.prototype;return n.read=function(){return t.prototype.read.call(this),this},n.getState=function(){var e;return(e=this.ls).session||(e.session={expiry:0,userID:"",authFlowCompleted:!1}),this.ls.session},n.getExpirationSeconds=function(){return b.timeToRemainingSeconds(this.getState().expiry)},n.setExpirationSeconds=function(e){return this.getState().expiry=b.remainingSecondsToTime(e),this},n.getUserID=function(){return this.getState().userID},n.setUserID=function(e){return this.getState().userID=e,this},n.getAuthFlowCompleted=function(){return this.getState().authFlowCompleted},n.setAuthFlowCompleted=function(e){return this.getState().authFlowCompleted=e,this},n.reset=function(){var e=this.getState();return delete e.expiry,delete e.userID,this},r}(b),C=/*#__PURE__*/function(t){function r(){return t.call(this,"hanko")||this}return e(r,t),r.prototype.getUserState=function(e){var t;return(t=this.ls).users||(t.users={}),Object.prototype.hasOwnProperty.call(this.ls.users,e)||(this.ls.users[e]={}),this.ls.users[e]},r}(b),k=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}e(r,t);var n=r.prototype;return n.getState=function(e){var r;return(r=t.prototype.getUserState.call(this,e)).passcode||(r.passcode={})},n.read=function(){return t.prototype.read.call(this),this},n.getActiveID=function(e){return this.getState(e).id},n.setActiveID=function(e,t){return this.getState(e).id=t,this},n.getEmailID=function(e){return this.getState(e).emailID},n.setEmailID=function(e,t){return this.getState(e).emailID=t,this},n.reset=function(e){var t=this.getState(e);return delete t.id,delete t.ttl,delete t.resendAfter,delete t.emailID,this},n.getTTL=function(e){return b.timeToRemainingSeconds(this.getState(e).ttl)},n.setTTL=function(e,t){return this.getState(e).ttl=b.remainingSecondsToTime(t),this},n.getResendAfter=function(e){return b.timeToRemainingSeconds(this.getState(e).resendAfter)},n.setResendAfter=function(e,t){return this.getState(e).resendAfter=b.remainingSecondsToTime(t),this},r}(C),_="hanko-session-created",A="hanko-session-expired",O="hanko-user-logged-out",T="hanko-user-deleted",j="hanko-auth-flow-completed",R=/*#__PURE__*/function(t){function r(e,r){return t.call(this,e,{detail:r})||this}return e(r,t),r}(/*#__PURE__*/i(CustomEvent)),I=/*#__PURE__*/function(){function e(){this._dispatchEvent=document.dispatchEvent.bind(document),this._sessionState=new x}var t=e.prototype;return t.dispatch=function(e,t){this._dispatchEvent(new R(e,t))},t.dispatchSessionCreatedEvent=function(e){this.dispatch(_,e)},t.dispatchSessionExpiredEvent=function(){this.dispatch(A,null)},t.dispatchUserLoggedOutEvent=function(){this.dispatch(O,null)},t.dispatchUserDeletedEvent=function(){this.dispatch(T,null)},t.dispatchAuthFlowCompletedEvent=function(e){this._sessionState.read().setAuthFlowCompleted(!0).write(),this.dispatch(j,e)},e}();function D(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}var L=function e(t,r){function n(e,n,i){if("undefined"!=typeof document){"number"==typeof(i=D({},r,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var s in i)i[s]&&(o+="; "+s,!0!==i[s]&&(o+="="+i[s].split(";")[0]));return document.cookie=e+"="+t.write(n,e)+o}}return Object.create({set:n,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],n={},i=0;i<r.length;i++){var o=r[i].split("="),s=o.slice(1).join("=");try{var a=decodeURIComponent(o[0]);if(n[a]=t.read(s,a),e===a)break}catch(e){}}return e?n[e]:n}},remove:function(e,t){n(e,"",D({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,D({},this.attributes,t))},withConverter:function(t){return e(D({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"}),U=/*#__PURE__*/function(){function e(){this.authCookieName="hanko"}var t=e.prototype;return t.getAuthCookie=function(){return L.get(this.authCookieName)},t.setAuthCookie=function(e,t){void 0===t&&(t=!0),L.set(this.authCookieName,e,{secure:t})},t.removeAuthCookie=function(){L.remove(this.authCookieName)},e}(),N=/*#__PURE__*/function(){function e(e){this._xhr=void 0,this._xhr=e}return e.prototype.getResponseHeader=function(e){return this._xhr.getResponseHeader(e)},e}(),H=/*#__PURE__*/function(){function e(e){this.headers=void 0,this.ok=void 0,this.status=void 0,this.statusText=void 0,this.url=void 0,this._decodedJSON=void 0,this.xhr=void 0,this.headers=new N(e),this.ok=e.status>=200&&e.status<=299,this.status=e.status,this.statusText=e.statusText,this.url=e.responseURL,this.xhr=e}var t=e.prototype;return t.json=function(){return this._decodedJSON||(this._decodedJSON=JSON.parse(this.xhr.response)),this._decodedJSON},t.parseNumericHeader=function(e){var t=parseInt(this.headers.getResponseHeader(e),10);return isNaN(t)?0:t},e}(),W=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t=13e3),this.timeout=void 0,this.api=void 0,this.sessionState=void 0,this.passcodeState=void 0,this.dispatcher=void 0,this.cookie=void 0,this.api=e,this.timeout=t,this.sessionState=new x,this.passcodeState=new k,this.dispatcher=new I,this.cookie=new U}var t=e.prototype;return t._fetch=function(e,t,r){void 0===r&&(r=new XMLHttpRequest);var n=this.api+e,i=this.timeout,o=this.cookie.getAuthCookie();return new Promise(function(e,s){r.open(t.method,n,!0),r.setRequestHeader("Accept","application/json"),r.setRequestHeader("Content-Type","application/json"),o&&r.setRequestHeader("Authorization","Bearer "+o),r.timeout=i,r.withCredentials=!0,r.onload=function(){var t=new H(r);e(t)},r.onerror=function(){s(new a)},r.ontimeout=function(){s(new u)},r.send(t.body?t.body.toString():null)})},t.processResponseHeadersOnLogin=function(e,t){var r="",n=0;if(t.xhr.getAllResponseHeaders().split("\r\n").forEach(function(e){var i=e.toLowerCase();i.startsWith("x-auth-token")?r=t.headers.getResponseHeader("X-Auth-Token"):i.startsWith("x-session-lifetime")&&(n=parseInt(t.headers.getResponseHeader("X-Session-Lifetime"),10))}),r){var i=!!this.api.match("^https://");this.cookie.setAuthCookie(r,i)}this.passcodeState.read().reset(e).write(),n>0&&(this.sessionState.read(),this.sessionState.setExpirationSeconds(n),this.sessionState.setUserID(e),this.sessionState.setAuthFlowCompleted(!1),this.sessionState.write(),this.dispatcher.dispatchSessionCreatedEvent({jwt:r,userID:e,expirationSeconds:n}))},t.get=function(e){return this._fetch(e,{method:"GET"})},t.post=function(e,t){return this._fetch(e,{method:"POST",body:JSON.stringify(t)})},t.put=function(e,t){return this._fetch(e,{method:"PUT",body:JSON.stringify(t)})},t.patch=function(e,t){return this._fetch(e,{method:"PATCH",body:JSON.stringify(t)})},t.delete=function(e){return this._fetch(e,{method:"DELETE"})},e}(),F=function(e,t){void 0===t&&(t=13e3),this.client=void 0,this.client=new W(e,t)},q=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}return e(r,t),r.prototype.get=function(){try{return Promise.resolve(this.client.get("/.well-known/config")).then(function(e){if(!e.ok)throw new a;return e.json()})}catch(e){return Promise.reject(e)}},r}(F),M=/*#__PURE__*/function(t){function r(e,r){var n;return void 0===r&&(r=13e3),(n=t.call(this,e,r)||this).state=void 0,n.state=new k,n}e(r,t);var n=r.prototype;return n.initialize=function(e,t,r){try{var n=this;n.state.read();var i=n.state.getTTL(e),o=n.state.getActiveID(e),s=n.state.getEmailID(e),c=n.state.getResendAfter(e);if(c>0)throw new m(c);if(!r&&i>0&&t===s)return Promise.resolve({id:o,ttl:i});var u={user_id:e};return t&&(u.email_id=t),Promise.resolve(n.client.post("/passcode/login/initialize",u)).then(function(r){if(429===r.status)throw c=r.parseNumericHeader("Retry-After"),n.state.setResendAfter(e,c).write(),new m(c);if(!r.ok)throw new a;var i=r.json();return n.state.setActiveID(e,i.id).setTTL(e,i.ttl),t&&n.state.setEmailID(e,t),n.state.write(),i})}catch(e){return Promise.reject(e)}},n.finalize=function(e,t){try{var r=this,n=r.state.read().getActiveID(e);if(r.state.getTTL(e)<=0)throw new f;return Promise.resolve(r.client.post("/passcode/login/finalize",{id:n,code:t})).then(function(t){if(401===t.status)throw new l;if(410===t.status)throw r.state.reset(e).write(),new v;if(!t.ok)throw new a;r.client.processResponseHeadersOnLogin(e,t)})}catch(e){return Promise.reject(e)}},n.getTTL=function(e){return this.state.read().getTTL(e)},n.getResendAfter=function(e){return this.state.read().getResendAfter(e)},r}(F),K=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}e(r,t);var n=r.prototype;return n.getState=function(e){var r;return(r=t.prototype.getUserState.call(this,e)).password||(r.password={})},n.read=function(){return t.prototype.read.call(this),this},n.getRetryAfter=function(e){return b.timeToRemainingSeconds(this.getState(e).retryAfter)},n.setRetryAfter=function(e,t){return this.getState(e).retryAfter=b.remainingSecondsToTime(t),this},r}(C),z=/*#__PURE__*/function(t){function r(e,r){var n;return void 0===r&&(r=13e3),(n=t.call(this,e,r)||this).passwordState=void 0,n.passcodeState=void 0,n.passwordState=new K,n.passcodeState=new k,n}e(r,t);var n=r.prototype;return n.login=function(e,t){try{var r=this;return Promise.resolve(r.client.post("/password/login",{user_id:e,password:t})).then(function(t){if(401===t.status)throw new d;if(429===t.status){var n=t.parseNumericHeader("Retry-After");throw r.passwordState.read().setRetryAfter(e,n).write(),new m(n)}if(!t.ok)throw new a;r.client.processResponseHeadersOnLogin(e,t)})}catch(e){return Promise.reject(e)}},n.update=function(e,t){try{var r=this;return Promise.resolve(r.client.put("/password",{user_id:e,password:t})).then(function(e){if(401===e.status)throw r.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!e.ok)throw new a})}catch(e){return Promise.reject(e)}},n.getRetryAfter=function(e){return this.passwordState.read().getRetryAfter(e)},r}(F),J=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}e(r,t);var n=r.prototype;return n.getInfo=function(e){try{return Promise.resolve(this.client.post("/user",{email:e})).then(function(e){if(404===e.status)throw new w;if(!e.ok)throw new a;return e.json()})}catch(e){return Promise.reject(e)}},n.create=function(e){try{var t=this;return Promise.resolve(t.client.post("/users",{email:e})).then(function(e){if(409===e.status)throw new c;if(!e.ok)throw new a;var r=e.json();return r&&r.user_id&&t.client.processResponseHeadersOnLogin(r.user_id,e),r})}catch(e){return Promise.reject(e)}},n.getCurrent=function(){try{var e=this;return Promise.resolve(e.client.get("/me")).then(function(t){if(401===t.status)throw e.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!t.ok)throw new a;var r=t.json();return Promise.resolve(e.client.get("/users/"+r.id)).then(function(t){if(401===t.status)throw e.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!t.ok)throw new a;return t.json()})})}catch(e){return Promise.reject(e)}},n.delete=function(){try{var e=this;return Promise.resolve(e.client.delete("/user")).then(function(t){if(t.ok)return e.client.cookie.removeAuthCookie(),e.client.sessionState.reset().write(),void e.client.dispatcher.dispatchUserDeletedEvent();if(401===t.status)throw e.client.dispatcher.dispatchSessionExpiredEvent(),new y;throw new a})}catch(e){return Promise.reject(e)}},n.logout=function(){try{var e=this;return Promise.resolve(e.client.post("/logout")).then(function(t){if(e.client.cookie.removeAuthCookie(),e.client.sessionState.reset().write(),e.client.dispatcher.dispatchUserLoggedOutEvent(),401===t.status);else if(!t.ok)throw new a})}catch(e){return Promise.reject(e)}},r}(F);function B(e){const t="==".slice(0,(4-e.length%4)%4),r=e.replace(/-/g,"+").replace(/_/g,"/")+t,n=atob(r),i=new ArrayBuffer(n.length),o=new Uint8Array(i);for(let e=0;e<n.length;e++)o[e]=n.charCodeAt(e);return i}function V(e){const t=new Uint8Array(e);let r="";for(const e of t)r+=String.fromCharCode(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var X="copy",G="convert";function $(e,t,r){if(t===X)return r;if(t===G)return e(r);if(t instanceof Array)return r.map(r=>$(e,t[0],r));if(t instanceof Object){const n={};for(const[i,o]of Object.entries(t)){if(o.derive){const e=o.derive(r);void 0!==e&&(r[i]=e)}if(i in r)n[i]=null!=r[i]?$(e,o.schema,r[i]):null;else if(o.required)throw new Error(`Missing key: ${i}`)}return n}}function Q(e,t){return{required:!0,schema:e,derive:t}}function Y(e){return{required:!0,schema:e}}function Z(e){return{required:!1,schema:e}}var ee={type:Y(X),id:Y(G),transports:Z(X)},te={appid:Z(X),appidExclude:Z(X),credProps:Z(X)},re={appid:Z(X),appidExclude:Z(X),credProps:Z(X)},ne={publicKey:Y({rp:Y(X),user:Y({id:Y(G),name:Y(X),displayName:Y(X)}),challenge:Y(G),pubKeyCredParams:Y(X),timeout:Z(X),excludeCredentials:Z([ee]),authenticatorSelection:Z(X),attestation:Z(X),extensions:Z(te)}),signal:Z(X)},ie={type:Y(X),id:Y(X),rawId:Y(G),authenticatorAttachment:Z(X),response:Y({clientDataJSON:Y(G),attestationObject:Y(G),transports:Q(X,e=>{var t;return(null==(t=e.getTransports)?void 0:t.call(e))||[]})}),clientExtensionResults:Q(re,e=>e.getClientExtensionResults())},oe={mediation:Z(X),publicKey:Y({challenge:Y(G),timeout:Z(X),rpId:Z(X),allowCredentials:Z([ee]),userVerification:Z(X),extensions:Z(te)}),signal:Z(X)},se={type:Y(X),id:Y(X),rawId:Y(G),authenticatorAttachment:Z(X),response:Y({clientDataJSON:Y(G),authenticatorData:Y(G),signature:Y(G),userHandle:Y(G)}),clientExtensionResults:Q(re,e=>e.getClientExtensionResults())};async function ae(e){const t=await navigator.credentials.create(function(e){return $(B,ne,e)}(e));return function(e){return $(V,ie,e)}(t)}async function ce(e){const t=await navigator.credentials.get(function(e){return $(B,oe,e)}(e));return function(e){return $(V,se,e)}(t)}var ue=/*#__PURE__*/function(){function e(){}return e.supported=function(){return!!(navigator.credentials&&navigator.credentials.create&&navigator.credentials.get&&window.PublicKeyCredential)},e.isPlatformAuthenticatorAvailable=function(){try{return this.supported()&&window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?Promise.resolve(window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()):Promise.resolve(!1)}catch(e){return Promise.reject(e)}},e.isSecurityKeySupported=function(){try{return void 0!==window.PublicKeyCredential&&window.PublicKeyCredential.isExternalCTAP2SecurityKeySupported?Promise.resolve(window.PublicKeyCredential.isExternalCTAP2SecurityKeySupported()):Promise.resolve(this.supported())}catch(e){return Promise.reject(e)}},e.isConditionalMediationAvailable=function(){try{return window.PublicKeyCredential&&window.PublicKeyCredential.isConditionalMediationAvailable?Promise.resolve(window.PublicKeyCredential.isConditionalMediationAvailable()):Promise.resolve(!1)}catch(e){return Promise.reject(e)}},e}(),he=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}e(r,t);var n=r.prototype;return n.getState=function(e){var r;return(r=t.prototype.getUserState.call(this,e)).webauthn||(r.webauthn={})},n.read=function(){return t.prototype.read.call(this),this},n.getCredentials=function(e){var t;return(t=this.getState(e)).credentials||(t.credentials=[])},n.addCredential=function(e,t){return this.getCredentials(e).push(t),this},n.matchCredentials=function(e,t){return this.getCredentials(e).filter(function(e){return t.find(function(t){return t.id===e})}).map(function(e){return{id:e}})},r}(C);function de(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}var le=/*#__PURE__*/function(t){function r(e,r){var n;return void 0===r&&(r=13e3),(n=t.call(this,e,r)||this).webauthnState=void 0,n.passcodeState=void 0,n.controller=void 0,n._getCredential=ce,n._createCredential=ae,n.webauthnState=new he,n.passcodeState=new k,n}e(r,t);var n=r.prototype;return n.login=function(e,t){try{var r=this;return Promise.resolve(r.client.post("/webauthn/login/initialize",{user_id:e})).then(function(e){var n;function i(e){return n?e:Promise.resolve(r.client.post("/webauthn/login/finalize",o)).then(function(e){if(400===e.status||401===e.status)throw new p;if(!e.ok)throw new a;var t=e.json();return r.webauthnState.read().addCredential(t.user_id,t.credential_id).write(),r.client.processResponseHeadersOnLogin(t.user_id,e),t})}if(!e.ok)throw new a;var o,s=e.json();s.signal=r._createAbortSignal(),t&&(s.mediation="conditional");var c=de(function(){return Promise.resolve(r._getCredential(s)).then(function(e){o=e})},function(e){throw new h(e)});return c&&c.then?c.then(i):i(c)})}catch(e){return Promise.reject(e)}},n.register=function(){try{var e=this;return Promise.resolve(e.client.post("/webauthn/registration/initialize")).then(function(t){function r(t){return n.transports=n.response.transports,Promise.resolve(e.client.post("/webauthn/registration/finalize",n)).then(function(t){if(401===t.status)throw e.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(422===t.status)throw new g;if(!t.ok)throw new a;var r=t.json();e.webauthnState.read().addCredential(r.user_id,r.credential_id).write()})}if(401===t.status)throw e.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!t.ok)throw new a;var n,i=t.json();i.signal=e._createAbortSignal();var o=de(function(){return Promise.resolve(e._createCredential(i)).then(function(e){n=e})},function(e){throw new h(e)});return o&&o.then?o.then(r):r()})}catch(e){return Promise.reject(e)}},n.listCredentials=function(){try{var e=this;return Promise.resolve(e.client.get("/webauthn/credentials")).then(function(t){if(401===t.status)throw e.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!t.ok)throw new a;return t.json()})}catch(e){return Promise.reject(e)}},n.updateCredential=function(e,t){try{var r=this;return Promise.resolve(r.client.patch("/webauthn/credentials/"+e,{name:t})).then(function(e){if(401===e.status)throw r.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!e.ok)throw new a})}catch(e){return Promise.reject(e)}},n.deleteCredential=function(e){try{var t=this;return Promise.resolve(t.client.delete("/webauthn/credentials/"+e)).then(function(e){if(401===e.status)throw t.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!e.ok)throw new a})}catch(e){return Promise.reject(e)}},n.shouldRegister=function(e){try{var t=ue.supported();if(!e.webauthn_credentials||!e.webauthn_credentials.length)return Promise.resolve(t);var r=this.webauthnState.read().matchCredentials(e.id,e.webauthn_credentials);return Promise.resolve(t&&!r.length)}catch(e){return Promise.reject(e)}},n._createAbortSignal=function(){return this.controller&&this.controller.abort(),this.controller=new AbortController,this.controller.signal},r}(F),pe=/*#__PURE__*/function(t){function r(){return t.apply(this,arguments)||this}e(r,t);var n=r.prototype;return n.list=function(){try{var e=this;return Promise.resolve(e.client.get("/emails")).then(function(t){if(401===t.status)throw e.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!t.ok)throw new a;return t.json()})}catch(e){return Promise.reject(e)}},n.create=function(e){try{var t=this;return Promise.resolve(t.client.post("/emails",{address:e})).then(function(e){if(e.ok)return e.json();if(400===e.status)throw new S;if(401===e.status)throw t.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(409===e.status)throw new E;throw new a})}catch(e){return Promise.reject(e)}},n.setPrimaryEmail=function(e){try{var t=this;return Promise.resolve(t.client.post("/emails/"+e+"/set_primary")).then(function(e){if(401===e.status)throw t.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!e.ok)throw new a})}catch(e){return Promise.reject(e)}},n.delete=function(e){try{var t=this;return Promise.resolve(t.client.delete("/emails/"+e)).then(function(e){if(401===e.status)throw t.client.dispatcher.dispatchSessionExpiredEvent(),new y;if(!e.ok)throw new a})}catch(e){return Promise.reject(e)}},r}(F),fe=/*#__PURE__*/function(t){function r(e,r){return void 0===r&&(r=13e3),t.call(this,e,r)||this}e(r,t);var n=r.prototype;return n.auth=function(e,t){try{var r=new URL("/thirdparty/auth",this.client.api);if(!e)throw new P("somethingWentWrong",new Error("provider missing from request"));if(!t)throw new P("somethingWentWrong",new Error("redirectTo missing from request"));return r.searchParams.append("provider",e),r.searchParams.append("redirect_to",t),window.location.assign(r.href),Promise.resolve()}catch(e){return Promise.reject(e)}},n.getError=function(){var e=new URLSearchParams(window.location.search),t=e.get("error"),r=e.get("error_description");if(t){var n="";switch(t){case"access_denied":n="thirdPartyAccessDenied";break;case"user_conflict":n="emailAddressAlreadyExistsError";break;case"multiple_accounts":n="thirdPartyMultipleAccounts";break;case"unverified_email":n="thirdPartyUnverifiedEmail";break;case"email_maxnum":n="maxNumOfEmailAddressesReached";break;default:n="somethingWentWrong"}return new P(n,new Error(r))}},r}(F),ve=/*#__PURE__*/function(t){function r(e,r){return void 0===r&&(r=13e3),t.call(this,e,r)||this}return e(r,t),r.prototype.validate=function(){try{var e=this,t=new URLSearchParams(window.location.search).get("hanko_token");return t?(window.history.replaceState(null,null,window.location.pathname),Promise.resolve(e.client.post("/token",{value:t})).then(function(t){if(!t.ok)throw new a;var r=t.json();e.client.processResponseHeadersOnLogin(r.user_id,t)})):Promise.resolve()}catch(e){return Promise.reject(e)}},r}(F),we=/*#__PURE__*/function(){function e(){}return e.throttle=function(e,t,r){void 0===r&&(r={});var n,i,o,s=r.leading,a=void 0===s||s,c=r.trailing,u=void 0===c||c,h=0,d=function(){h=!1===a?0:Date.now(),o=null,e.apply(n,i)};return function(){var r=Date.now();h||!1!==a||(h=r);var s=t-(r-h);n=this,i=[].slice.call(arguments),s<=0||s>t?(o&&(window.clearTimeout(o),o=null),h=r,e.apply(n,i)):o||!1===u||(o=window.setTimeout(d,s))}},e}(),me=/*#__PURE__*/function(){function e(){this.throttleLimit=1e3,this._addEventListener=document.addEventListener.bind(document),this._removeEventListener=document.removeEventListener.bind(document),this._throttle=we.throttle}var t=e.prototype;return t.wrapCallback=function(e,t){var r=function(t){e(t.detail)};return t?this._throttle(r,this.throttleLimit,{leading:!0,trailing:!1}):r},t.addEventListenerWithType=function(e){var t=this,r=e.type,n=e.once,i=void 0!==n&&n,o=e.throttle,s=this.wrapCallback(e.callback,void 0!==o&&o);return this._addEventListener(r,s,{once:i}),function(){return t._removeEventListener(r,s)}},e.mapAddEventListenerParams=function(e,t,r){return{type:e,callback:t.callback,once:t.once,throttle:r}},t.addEventListener=function(t,r,n){return this.addEventListenerWithType(e.mapAddEventListenerParams(t,r,n))},t.onSessionCreated=function(e,t){return this.addEventListener(_,{callback:e,once:t},!0)},t.onSessionExpired=function(e,t){return this.addEventListener(A,{callback:e,once:t},!0)},t.onUserLoggedOut=function(e,t){return this.addEventListener(O,{callback:e,once:t})},t.onUserDeleted=function(e,t){return this.addEventListener(T,{callback:e,once:t})},t.onAuthFlowCompleted=function(e,t){return this.addEventListener(j,{callback:e,once:t})},e}(),ye=/*#__PURE__*/function(){function e(){this._tasks=[]}var t=e.prototype;return t.removeTask=function(e){window.clearTimeout(e.timeoutID),this._tasks=this._tasks.filter(function(t){return t!==e})},t.removeTasksWithType=function(e){var t=this;this._tasks.filter(function(t){return t.type===e}).forEach(function(e){return t.removeTask(e)})},t.scheduleTask=function(e,t,r){var n=this,i={timeoutID:window.setTimeout(function(){t(),n.removeTask(i)},1e3*r),type:e,func:t};this._tasks.push(i)},e}(),ge=/*#__PURE__*/function(){function e(){this._sessionState=void 0,this._cookie=void 0,this._sessionState=new x,this._cookie=new U}var t=e.prototype;return t.get=function(){var t=this._get();return e.validate(t)?t:null},t.isValid=function(){var t=this._get();return e.validate(t)},t._get=function(){return this._sessionState.read(),{userID:this._sessionState.getUserID(),expirationSeconds:this._sessionState.getExpirationSeconds(),jwt:this._cookie.getAuthCookie()}},t.isAuthFlowCompleted=function(){return this._sessionState.read(),this._sessionState.getAuthFlowCompleted()},e.validate=function(e){var t;return!!(e.expirationSeconds>0&&null!=(t=e.userID)&&t.length)},e}(),Ee=/*#__PURE__*/function(t){function r(){var e;return(e=t.call(this)||this)._listener=new me,e._scheduler=new ye,e._session=new ge,e.scheduleSessionExpiredEvent=function(t){e._scheduler.removeTasksWithType(A),e._scheduler.scheduleTask(A,function(){return e.dispatchSessionExpiredEvent()},t.expirationSeconds)},e.cancelSessionExpiredEvent=function(){e._scheduler.removeTasksWithType(A)},e.handleStorageEvent=function(t){if("hanko_session"===t.key){var r=e._session.get();r?e._session.isAuthFlowCompleted()?e.dispatchAuthFlowCompletedEvent({userID:r.userID}):e.dispatchSessionCreatedEvent(r):e.dispatchSessionExpiredEvent()}},e.listenEventDependencies(),e}return e(r,t),r.prototype.listenEventDependencies=function(){this._listener.onSessionCreated(this.scheduleSessionExpiredEvent),this._listener.onSessionExpired(this.cancelSessionExpiredEvent),this._listener.onUserDeleted(this.cancelSessionExpiredEvent),this._listener.onUserLoggedOut(this.cancelSessionExpiredEvent),window.addEventListener("storage",this.handleStorageEvent);var e=this._session.get();e&&this.scheduleSessionExpiredEvent(e)},r}(I),Se=/*#__PURE__*/function(t){function r(e,r){var n;return void 0===r&&(r=13e3),(n=t.call(this)||this).api=void 0,n.config=void 0,n.user=void 0,n.webauthn=void 0,n.password=void 0,n.passcode=void 0,n.email=void 0,n.thirdParty=void 0,n.token=void 0,n.relay=void 0,n.session=void 0,n.api=e,n.config=new q(e,r),n.user=new J(e,r),n.webauthn=new le(e,r),n.password=new z(e,r),n.passcode=new M(e,r),n.email=new pe(e,r),n.thirdParty=new fe(e,r),n.token=new ve(e,r),n.relay=new Ee,n.session=new ge,n}return e(r,t),r}(me);exports.ConfigClient=q,exports.ConflictError=c,exports.CustomEventWithDetail=R,exports.EmailAddressAlreadyExistsError=S,exports.EmailClient=pe,exports.Hanko=Se,exports.HankoError=s,exports.InvalidPasscodeError=l,exports.InvalidPasswordError=d,exports.InvalidWebauthnCredentialError=p,exports.MaxNumOfEmailAddressesReachedError=E,exports.MaxNumOfPasscodeAttemptsReachedError=v,exports.NotFoundError=w,exports.PasscodeClient=M,exports.PasscodeExpiredError=f,exports.PasswordClient=z,exports.RequestTimeoutError=u,exports.TechnicalError=a,exports.ThirdPartyClient=fe,exports.ThirdPartyError=P,exports.TokenClient=ve,exports.TooManyRequestsError=m,exports.UnauthorizedError=y,exports.UserClient=J,exports.UserVerificationError=g,exports.WebauthnClient=le,exports.WebauthnRequestCancelledError=h,exports.WebauthnSupport=ue,exports.authFlowCompletedType=j,exports.sessionCreatedType=_,exports.sessionExpiredType=A,exports.userDeletedType=T,exports.userLoggedOutType=O;
|
|
2
2
|
//# sourceMappingURL=sdk.cjs.map
|