UNPKG

@authgear/web

Version:

With Authgear SDK for Single Page Applications (SPA), you can easily integrate authentication features into your app (Angular, Vue, React, or any JavaScript websites). In most cases, it involves just a few lines of code to enable multiple authentication m

1,589 lines (1,384 loc) 320 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); /** * @public */ var AuthenticatorType = /*#__PURE__*/function (AuthenticatorType) { AuthenticatorType["Password"] = "password"; AuthenticatorType["OOBOTPEmail"] = "oob_otp_email"; AuthenticatorType["OOBOTPSMS"] = "oob_otp_sms"; AuthenticatorType["TOTP"] = "totp"; AuthenticatorType["Passkey"] = "passkey"; AuthenticatorType["Unknown"] = "unknown"; return AuthenticatorType; }({}); /** * @public */ var AuthenticatorKind = /*#__PURE__*/function (AuthenticatorKind) { AuthenticatorKind["Primary"] = "primary"; AuthenticatorKind["Secondary"] = "secondary"; AuthenticatorKind["Unknown"] = "unknown"; return AuthenticatorKind; }({}); /** * @public */ /** * UserInfo is the result of fetchUserInfo. * It contains `sub` which is the User ID, * as well as OIDC standard claims like `email`, * see https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims. * * In addition to these standard claims, it may include custom claims * defined by Authgear to support additional functionality like `isVerified`. * * @public */ /** * ColorScheme represents the color scheme supported by Authgear. * A colorscheme is either light or dark. Authgear supports both by default. * * @public */ var ColorScheme = /*#__PURE__*/function (ColorScheme) { /** * Force to use the light color scheme in the AuthUI when the project config is "Auto". */ ColorScheme["Light"] = "light"; /** * Force to use the dark color scheme in the AuthUI when the project config is "Auto". */ ColorScheme["Dark"] = "dark"; return ColorScheme; }({}); /** * Prompt parameter options. * * @public */ var PromptOption = /*#__PURE__*/function (PromptOption) { /** * The `none` prompt is used to sliently authenticate the user without prompting for any action. * This prompt bypasses the need for `login` and `consent` prompts * only when the user has previously given consent to the application and has an active session. */ PromptOption["None"] = "none"; /** * The `login` prompt requires the user to log in to the authentication provider which forces the user to re-authenticate. */ PromptOption["Login"] = "login"; /** * The `consent` prompt asks the user to consent to the scopes. * * @internal */ PromptOption["Consent"] = "consent"; /** * The select_account prompt present a "Continue" screen to for the user to choose * to continue with the session in the cookies or login to another account. * * @internal */ PromptOption["SelectAccount"] = "select_account"; return PromptOption; }({}); /** * @internal */ /** * @internal */ /** * @internal */ /** * @internal */ /** * @internal */ /** * @internal */ function _decodeAuthenticators(r) { if (!Array.isArray(r)) { return undefined; } return r.map(function (a) { return { createdAt: new Date(a["created_at"]), updatedAt: new Date(a["updated_at"]), type: parseAuthenticatorType(a["type"]), kind: parseAuthenticatorKind(a["kind"]) }; }); } /** * @internal */ function parseAuthenticatorType(value) { switch (value) { case "password": return AuthenticatorType.Password; case "oob_otp_email": return AuthenticatorType.OOBOTPEmail; case "oob_otp_sms": return AuthenticatorType.OOBOTPSMS; case "totp": return AuthenticatorType.TOTP; case "passkey": return AuthenticatorType.Passkey; default: return AuthenticatorType.Unknown; } } /** * @internal */ function parseAuthenticatorKind(value) { switch (value) { case "primary": return AuthenticatorKind.Primary; case "secondary": return AuthenticatorKind.Secondary; default: return AuthenticatorKind.Unknown; } } /** * @internal */ function _decodeUserInfo(r) { var _r$custom_attributes, _r$httpsAuthgearC, _r$httpsAuthgearC2, _r$httpsAuthgearC3, _r$httpsAuthgearC4, _r$address, _r$address2, _r$address3, _r$address4, _r$address5, _r$address6; var raw = r; var customAttributes = (_r$custom_attributes = r["custom_attributes"]) != null ? _r$custom_attributes : {}; return { sub: r["sub"], isVerified: (_r$httpsAuthgearC = r["https://authgear.com/claims/user/is_verified"]) != null ? _r$httpsAuthgearC : false, isAnonymous: (_r$httpsAuthgearC2 = r["https://authgear.com/claims/user/is_anonymous"]) != null ? _r$httpsAuthgearC2 : false, canReauthenticate: (_r$httpsAuthgearC3 = r["https://authgear.com/claims/user/can_reauthenticate"]) != null ? _r$httpsAuthgearC3 : false, recoveryCodeEnabled: (_r$httpsAuthgearC4 = r["https://authgear.com/claims/user/recovery_code_enabled"]) != null ? _r$httpsAuthgearC4 : false, roles: r["https://authgear.com/claims/user/roles"], authenticators: _decodeAuthenticators(r["https://authgear.com/claims/user/authenticators"]), raw: raw, customAttributes: customAttributes, email: r["email"], emailVerified: r["email_verified"], phoneNumber: r["phone_number"], phoneNumberVerified: r["phone_number_verified"], preferredUsername: r["preferred_username"], familyName: r["family_name"], givenName: r["given_name"], middleName: r["middle_name"], name: r["name"], nickname: r["nickname"], picture: r["picture"], profile: r["profile"], website: r["website"], gender: r["gender"], birthdate: r["birthdate"], zoneinfo: r["zoneinfo"], locale: r["locale"], address: { formatted: (_r$address = r["address"]) == null ? void 0 : _r$address["formatted"], streetAddress: (_r$address2 = r["address"]) == null ? void 0 : _r$address2["street_address"], locality: (_r$address3 = r["address"]) == null ? void 0 : _r$address3["locality"], region: (_r$address4 = r["address"]) == null ? void 0 : _r$address4["region"], postalCode: (_r$address5 = r["address"]) == null ? void 0 : _r$address5["postal_code"], country: (_r$address6 = r["address"]) == null ? void 0 : _r$address6["country"] } }; } /** * @internal */ /** * @internal */ /** * @internal */ /** * TokenStorage is an interface controlling when refresh tokens are stored. * Normally you do not need to implement this interface. * You can use one of those implementations provided by the SDK. * * @public */ /** * @internal */ /** * @internal */ /** * @internal */ /** * Options for the constructor of a Container. * * @public */ /** * @internal */ /** * @internal */ /** * @internal */ /** * @internal */ /** * The session state. * * An freshly constructed instance has the session state "UNKNOWN"; * * After a call to configure, the session state would become "AUTHENTICATED" if a previous session was found, * or "NO_SESSION" if such session was not found. * * Please refer to {@link SessionStateChangeReason} for more information. * * @public */ var SessionState = /*#__PURE__*/function (SessionState) { SessionState["Unknown"] = "UNKNOWN"; SessionState["NoSession"] = "NO_SESSION"; SessionState["Authenticated"] = "AUTHENTICATED"; return SessionState; }({}); /** * The reason why SessionState is changed. * * These reasons can be thought of as the transition of a SessionState, which is described as follows: * * ``` * LOGOUT / INVALID / CLEAR * +----------------------------------------------+ * v | * State: UNKNOWN ----- NO_TOKEN ----> State: NO_SESSION ---- AUTHENTICATED -----> State: AUTHENTICATED * | ^ * +--------------------------------------------------------------------------------+ * FOUND_TOKEN * ``` * @public */ var SessionStateChangeReason = /*#__PURE__*/function (SessionStateChangeReason) { SessionStateChangeReason["NoToken"] = "NO_TOKEN"; SessionStateChangeReason["FoundToken"] = "FOUND_TOKEN"; SessionStateChangeReason["Authenticated"] = "AUTHENTICATED"; SessionStateChangeReason["Logout"] = "LOGOUT"; SessionStateChangeReason["Invalid"] = "INVALID"; SessionStateChangeReason["Clear"] = "CLEAR"; return SessionStateChangeReason; }({}); /** * The path of the page in Authgear. * * @public */ var Page = /*#__PURE__*/function (Page) { /** * The path of the settings page in Authgear. */ Page["Settings"] = "/settings"; /** * The path of the indenties page in Authgear. */ Page["Identities"] = "/settings/identities"; return Page; }({}); /** * The actions that can be performed in Authgear settings page. * * @public */ var SettingsAction = /*#__PURE__*/function (SettingsAction) { /** * Change password in Authgear settings page. */ SettingsAction["ChangePassword"] = "change_password"; /** * Delete account in Authgear settings page. */ SettingsAction["DeleteAccount"] = "delete_account"; /** * Add email in Authgear settings page. */ SettingsAction["AddEmail"] = "add_email"; /** * Add phone in Authgear settings page. */ SettingsAction["AddPhone"] = "add_phone"; /** * Add username in Authgear settings page. */ SettingsAction["AddUsername"] = "add_username"; /** * Change email in Authgear settings page. */ SettingsAction["ChangeEmail"] = "change_email"; /** * Change phone in Authgear settings page. */ SettingsAction["ChangePhone"] = "change_phone"; /** * Change username in Authgear settings page. */ SettingsAction["ChangeUsername"] = "change_username"; return SettingsAction; }({}); /** * @internal */ function _typeof$1(o) { "@babel/helpers - typeof"; return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$1(o); } function toPrimitive$2(t, r) { if ("object" != _typeof$1(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof$1(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return (String )(t); } function toPropertyKey$3(t) { var i = toPrimitive$2(t, "string"); return "symbol" == _typeof$1(i) ? i : i + ""; } function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, toPropertyKey$3(o.key), o); } } function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", { writable: false }), e; } function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof$1(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: true, configurable: true } }), Object.defineProperty(t, "prototype", { writable: false }), e && _setPrototypeOf(t, e); } function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } } function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() { return !!t; })(); } function _construct(t, e, r) { if (_isNativeReflectConstruct$1()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; } function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); } function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** * AuthgearError is the root class of error produced by the SDK. * * @public */ var AuthgearError = /*#__PURE__*/function (_Error) { function AuthgearError() { return _callSuper(this, AuthgearError, arguments); } _inherits(AuthgearError, _Error); return _createClass(AuthgearError); }(/*#__PURE__*/_wrapNativeSuper(Error)); /** * ErrorName contains all possible name in {@link ServerError} * * @public */ var ErrorName = /*#__PURE__*/function (ErrorName) { /** * Indicates that the server does not understand the request (i.e. syntactic error). * Status code: 400 */ ErrorName["BadRequest"] = "BadRequest"; /** * Indicates that the server understands the request, but refuse to process it (i.e. semantic error). * Status code: 400 */ ErrorName["Invalid"] = "Invalid"; /** * Indicates that the client does not have valid credentials (i.e. authentication error). * Status code: 401 */ ErrorName["Unauthorized"] = "Unauthorized"; /** * Indicates that the client's credentials are not allowed for the request (i.e. authorization error). * Status code: 403 */ ErrorName["Forbidden"] = "Forbidden"; /** * Indicates that the server cannot find the requested resource. * Status code: 404 */ ErrorName["NotFound"] = "NotFound"; /** * Indicates that the resource is already exists on the server. * Status code: 409 */ ErrorName["AlreadyExists"] = "AlreadyExists"; /** * Indicates that the client has sent too many requests in a given amount of time. * Status code: 429 */ ErrorName["TooManyRequest"] = "TooManyRequest"; /** * Indicates that the server encountered an unexpected condition and unable to process the request. * Status code: 500 */ ErrorName["InternalError"] = "InternalError"; /** * Indicates that the server is not ready to handle the request. * Status code: 503 */ ErrorName["ServiceUnavailable"] = "ServiceUnavailable"; return ErrorName; }({}); /** * CancelError means cancel. * If you catch an error and it is instanceof CancelError, * then the operation was cancelled. * * @public */ var CancelError = /*#__PURE__*/function (_AuthgearError) { function CancelError() { return _callSuper(this, CancelError, arguments); } _inherits(CancelError, _AuthgearError); return _createClass(CancelError); }(AuthgearError); /** * ServerError represents error received from the server. * * @public */ var ServerError = /*#__PURE__*/function (_AuthgearError2) { /** * Error name. * * @remarks * See {@link ErrorName} for possible values. * New error names may be added in future. */ /** * Error message. * * @remarks * Error messages are provided for convenience, and not stable APIs; * Consumers should use {@link ServerError.name} or * {@link ServerError.reason} to distinguish between different errors. */ /** * Error reason. */ /** * Additional error information. */ function ServerError(message, name, reason, info) { var _this; _this = _callSuper(this, ServerError, [message]); _this.name = name; _this.reason = reason; _this.info = info; return _this; } _inherits(ServerError, _AuthgearError2); return _createClass(ServerError); }(AuthgearError); /** * OAuthError represents the oauth error response. * https://tools.ietf.org/html/rfc6749#section-4.1.2.1 * * @public */ var OAuthError = /*#__PURE__*/function (_AuthgearError3) { function OAuthError(_ref) { var _this2; var state = _ref.state, error = _ref.error, error_description = _ref.error_description, error_uri = _ref.error_uri; _this2 = _callSuper(this, OAuthError, [error + (error_description != null ? ": " + error_description : "")]); _this2.state = state; _this2.error = error; _this2.error_description = error_description; _this2.error_uri = error_uri; return _this2; } _inherits(OAuthError, _AuthgearError3); return _createClass(OAuthError); }(AuthgearError); /** * @internal */ // eslint-disable-next-line complexity function _decodeError(err) { // Construct ServerError if it looks like one. if (err != null && !(err instanceof Error) && typeof err.name === "string" && typeof err.reason === "string" && typeof err.message === "string") { return new ServerError(err.message, err.name, err.reason, err.info); } // If it is an Error, just return it. if (err instanceof Error) { return err; } // If it has message, construct an Error from the message. if (err != null && typeof err.message === "string") { return new Error(err.message); } // If it can be turned into string, use it as message. if (err != null && typeof err.toString === "function") { return new Error(err.toString()); } // Otherwise cast it to string and use it as message. return new Error(String(err)); } /** * PreAuthenticatedURLNotAllowedError is the root class of errors related to pre-authenticated URL. * * @public */ var PreAuthenticatedURLNotAllowedError = /*#__PURE__*/function (_AuthgearError4) { function PreAuthenticatedURLNotAllowedError() { return _callSuper(this, PreAuthenticatedURLNotAllowedError, arguments); } _inherits(PreAuthenticatedURLNotAllowedError, _AuthgearError4); return _createClass(PreAuthenticatedURLNotAllowedError); }(AuthgearError); /** * This may happen if the "Pre-authenticated URL" feature was not enabled when the user logged in during this session. * Ask the user to log in again to enable this feature. * * @public */ var PreAuthenticatedURLInsufficientScopeError = /*#__PURE__*/function (_PreAuthenticatedURLN) { function PreAuthenticatedURLInsufficientScopeError() { return _callSuper(this, PreAuthenticatedURLInsufficientScopeError, arguments); } _inherits(PreAuthenticatedURLInsufficientScopeError, _PreAuthenticatedURLN); return _createClass(PreAuthenticatedURLInsufficientScopeError); }(PreAuthenticatedURLNotAllowedError); /** * The user logged in from an older SDK version that does not support the pre-authenticated URL. * Ask the user to log in again to resolve the problem. * * @public */ var PreAuthenticatedURLIDTokenNotFoundError = /*#__PURE__*/function (_PreAuthenticatedURLN2) { function PreAuthenticatedURLIDTokenNotFoundError() { return _callSuper(this, PreAuthenticatedURLIDTokenNotFoundError, arguments); } _inherits(PreAuthenticatedURLIDTokenNotFoundError, _PreAuthenticatedURLN2); return _createClass(PreAuthenticatedURLIDTokenNotFoundError); }(PreAuthenticatedURLNotAllowedError); /** * The device secret is not found. This may happen if the "Pre-authenticated URL" feature was not enabled when the user logged in during this session. * Ask the user to log in again to enable this feature. * * @public */ var PreAuthenticatedURLDeviceSecretNotFoundError = /*#__PURE__*/function (_PreAuthenticatedURLN3) { function PreAuthenticatedURLDeviceSecretNotFoundError() { return _callSuper(this, PreAuthenticatedURLDeviceSecretNotFoundError, arguments); } _inherits(PreAuthenticatedURLDeviceSecretNotFoundError, _PreAuthenticatedURLN3); return _createClass(PreAuthenticatedURLDeviceSecretNotFoundError); }(PreAuthenticatedURLNotAllowedError); function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var regeneratorRuntime$1 = {exports: {}}; var OverloadYield = {exports: {}}; (function (module) { function _OverloadYield(e, d) { this.v = e, this.k = d; } module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports; } (OverloadYield)); var OverloadYieldExports = OverloadYield.exports; var regenerator$1 = {exports: {}}; var regeneratorDefine = {exports: {}}; (function (module) { function _regeneratorDefine(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } module.exports = _regeneratorDefine = function regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, module.exports.__esModule = true, module.exports["default"] = module.exports, _regeneratorDefine(e, r, n, t); } module.exports = _regeneratorDefine, module.exports.__esModule = true, module.exports["default"] = module.exports; } (regeneratorDefine)); var regeneratorDefineExports = regeneratorDefine.exports; (function (module) { var regeneratorDefine = regeneratorDefineExports; function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return regeneratorDefine(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = true, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), true), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (regeneratorDefine(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), regeneratorDefine(u), regeneratorDefine(u, o, "Generator"), regeneratorDefine(u, n, function () { return this; }), regeneratorDefine(u, "toString", function () { return "[object Generator]"; }), (module.exports = _regenerator = function _regenerator() { return { w: i, m: f }; }, module.exports.__esModule = true, module.exports["default"] = module.exports)(); } module.exports = _regenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; } (regenerator$1)); var regeneratorExports = regenerator$1.exports; var regeneratorAsync = {exports: {}}; var regeneratorAsyncGen = {exports: {}}; var regeneratorAsyncIterator = {exports: {}}; (function (module) { var OverloadYield = OverloadYieldExports; var regeneratorDefine = regeneratorDefineExports; function AsyncIterator(t, e) { function n(r, o, i, f) { try { var c = t[r](o), u = c.value; return u instanceof OverloadYield ? e.resolve(u.v).then(function (t) { n("next", t, i, f); }, function (t) { n("throw", t, i, f); }) : e.resolve(u).then(function (t) { c.value = t, i(c); }, function (t) { return n("throw", t, i, f); }); } catch (t) { f(t); } } var r; this.next || (regeneratorDefine(AsyncIterator.prototype), regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () { return this; })), regeneratorDefine(this, "_invoke", function (t, o, i) { function f() { return new e(function (e, r) { n(t, i, e, r); }); } return r = r ? r.then(f, f) : f(); }, true); } module.exports = AsyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports; } (regeneratorAsyncIterator)); var regeneratorAsyncIteratorExports = regeneratorAsyncIterator.exports; (function (module) { var regenerator = regeneratorExports; var regeneratorAsyncIterator = regeneratorAsyncIteratorExports; function _regeneratorAsyncGen(r, e, t, o, n) { return new regeneratorAsyncIterator(regenerator().w(r, e, t, o), n || Promise); } module.exports = _regeneratorAsyncGen, module.exports.__esModule = true, module.exports["default"] = module.exports; } (regeneratorAsyncGen)); var regeneratorAsyncGenExports = regeneratorAsyncGen.exports; (function (module) { var regeneratorAsyncGen = regeneratorAsyncGenExports; function _regeneratorAsync(n, e, r, t, o) { var a = regeneratorAsyncGen(n, e, r, t, o); return a.next().then(function (n) { return n.done ? n.value : a.next(); }); } module.exports = _regeneratorAsync, module.exports.__esModule = true, module.exports["default"] = module.exports; } (regeneratorAsync)); var regeneratorAsyncExports = regeneratorAsync.exports; var regeneratorKeys = {exports: {}}; (function (module) { function _regeneratorKeys(e) { var n = Object(e), r = []; for (var t in n) r.unshift(t); return function e() { for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = false, e; return e.done = true, e; }; } module.exports = _regeneratorKeys, module.exports.__esModule = true, module.exports["default"] = module.exports; } (regeneratorKeys)); var regeneratorKeysExports = regeneratorKeys.exports; var regeneratorValues = {exports: {}}; var _typeof = {exports: {}}; (function (module) { function _typeof(o) { "@babel/helpers - typeof"; return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o); } module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; } (_typeof)); var _typeofExports = _typeof.exports; (function (module) { var _typeof = _typeofExports["default"]; function _regeneratorValues(e) { if (null != e) { var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"], r = 0; if (t) return t.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) return { next: function next() { return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; } }; } throw new TypeError(_typeof(e) + " is not iterable"); } module.exports = _regeneratorValues, module.exports.__esModule = true, module.exports["default"] = module.exports; } (regeneratorValues)); var regeneratorValuesExports = regeneratorValues.exports; (function (module) { var OverloadYield = OverloadYieldExports; var regenerator = regeneratorExports; var regeneratorAsync = regeneratorAsyncExports; var regeneratorAsyncGen = regeneratorAsyncGenExports; var regeneratorAsyncIterator = regeneratorAsyncIteratorExports; var regeneratorKeys = regeneratorKeysExports; var regeneratorValues = regeneratorValuesExports; function _regeneratorRuntime() { var r = regenerator(), e = r.m(_regeneratorRuntime), t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor; function n(r) { var e = "function" == typeof r && r.constructor; return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name)); } var o = { "throw": 1, "return": 2, "break": 3, "continue": 3 }; function a(r) { var e, t; return function (n) { e || (e = { stop: function stop() { return t(n.a, 2); }, "catch": function _catch() { return n.v; }, abrupt: function abrupt(r, e) { return t(n.a, o[r], e); }, delegateYield: function delegateYield(r, o, a) { return e.resultName = o, t(n.d, regeneratorValues(r), a); }, finish: function finish(r) { return t(n.f, r); } }, t = function t(r, _t, o) { n.p = e.prev, n.n = e.next; try { return r(_t, o); } finally { e.next = n.n; } }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; try { return r.call(this, e); } finally { n.p = e.prev, n.n = e.next; } }; } return (module.exports = _regeneratorRuntime = function _regeneratorRuntime() { return { wrap: function wrap(e, t, n, o) { return r.w(a(e), t, n, o && o.reverse()); }, isGeneratorFunction: n, mark: r.m, awrap: function awrap(r, e) { return new OverloadYield(r, e); }, AsyncIterator: regeneratorAsyncIterator, async: function async(r, e, t, o, u) { return (n(e) ? regeneratorAsyncGen : regeneratorAsync)(a(r), e, t, o, u); }, keys: regeneratorKeys, values: regeneratorValues }; }, module.exports.__esModule = true, module.exports["default"] = module.exports)(); } module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; } (regeneratorRuntime$1)); var regeneratorRuntimeExports = regeneratorRuntime$1.exports; // TODO(Babel 8): Remove this file. var runtime = regeneratorRuntimeExports(); var regenerator = runtime; // Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736= try { regeneratorRuntime = runtime; } catch (accidentalStrictMode) { if (typeof globalThis === "object") { globalThis.regeneratorRuntime = runtime; } else { Function("r", "regeneratorRuntime = r")(runtime); } } var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator); var fails$d = function (exec) { try { return !!exec(); } catch (error) { return true; } }; var fails$c = fails$d; var functionBindNative = !fails$c(function () { // eslint-disable-next-line es/no-function-prototype-bind -- safe var test = (function () { /* empty */ }).bind(); // eslint-disable-next-line no-prototype-builtins -- safe return typeof test != 'function' || test.hasOwnProperty('prototype'); }); var NATIVE_BIND$3 = functionBindNative; var FunctionPrototype$2 = Function.prototype; var call$b = FunctionPrototype$2.call; // eslint-disable-next-line es/no-function-prototype-bind -- safe var uncurryThisWithBind = NATIVE_BIND$3 && FunctionPrototype$2.bind.bind(call$b, call$b); var functionUncurryThis = NATIVE_BIND$3 ? uncurryThisWithBind : function (fn) { return function () { return call$b.apply(fn, arguments); }; }; var uncurryThis$h = functionUncurryThis; var toString$7 = uncurryThis$h({}.toString); var stringSlice$3 = uncurryThis$h(''.slice); var classofRaw$2 = function (it) { return stringSlice$3(toString$7(it), 8, -1); }; var uncurryThis$g = functionUncurryThis; var fails$b = fails$d; var classof$6 = classofRaw$2; var $Object$4 = Object; var split$3 = uncurryThis$g(''.split); // fallback for non-array-like ES3 and non-enumerable old V8 strings var indexedObject = fails$b(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe return !$Object$4('z').propertyIsEnumerable(0); }) ? function (it) { return classof$6(it) === 'String' ? split$3(it, '') : $Object$4(it); } : $Object$4; // we can't use just `it == null` since of `document.all` special case // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec var isNullOrUndefined$3 = function (it) { return it === null || it === undefined; }; var isNullOrUndefined$2 = isNullOrUndefined$3; var $TypeError$8 = TypeError; // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible var requireObjectCoercible$3 = function (it) { if (isNullOrUndefined$2(it)) throw new $TypeError$8("Can't call method on " + it); return it; }; // toObject with fallback for non-array-like ES3 strings var IndexedObject$1 = indexedObject; var requireObjectCoercible$2 = requireObjectCoercible$3; var toIndexedObject$5 = function (it) { return IndexedObject$1(requireObjectCoercible$2(it)); }; var iterators = {}; var check = function (it) { return it && it.Math === Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var globalThis_1 = // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func -- fallback (function () { return this; })() || Function('return this')(); // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot var documentAll = typeof document == 'object' && document.all; // `IsCallable` abstract operation // https://tc39.es/ecma262/#sec-iscallable // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing var isCallable$e = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) { return typeof argument == 'function' || argument === documentAll; } : function (argument) { return typeof argument == 'function'; }; var globalThis$f = globalThis_1; var isCallable$d = isCallable$e; var WeakMap$1 = globalThis$f.WeakMap; var weakMapBasicDetection = isCallable$d(WeakMap$1) && /native code/.test(String(WeakMap$1)); var isCallable$c = isCallable$e; var isObject$7 = function (it) { return typeof it == 'object' ? it !== null : isCallable$c(it); }; var fails$a = fails$d; // Detect IE8's incomplete defineProperty implementation var descriptors = !fails$a(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7; }); var objectDefineProperty = {}; var globalThis$e = globalThis_1; var isObject$6 = isObject$7; var document$1 = globalThis$e.document; // typeof document.createElement is 'object' in old IE var EXISTS$1 = isObject$6(document$1) && isObject$6(document$1.createElement); var documentCreateElement$1 = function (it) { return EXISTS$1 ? document$1.createElement(it) : {}; }; var DESCRIPTORS$c = descriptors; var fails$9 = fails$d; var createElement = documentCreateElement$1; // Thanks to IE8 for its funny defineProperty var ie8DomDefine = !DESCRIPTORS$c && !fails$9(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty(createElement('div'), 'a', { get: function () { return 7; } }).a !== 7; }); var DESCRIPTORS$b = descriptors; var fails$8 = fails$d; // V8 ~ Chrome 36- // https://bugs.chromium.org/p/v8/issues/detail?id=3334 var v8PrototypeDefineBug = DESCRIPTORS$b && fails$8(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty(function () { /* empty */ }, 'prototype', { value: 42, writable: false }).prototype !== 42; }); var isObject$5 = isObject$7; var $String$3 = String; var $TypeError$7 = TypeError; // `Assert: Type(argument) is Object` var anObject$7 = function (argument) { if (isObject$5(argument)) return argument; throw new $TypeError$7($String$3(argument) + ' is not an object'); }; var NATIVE_BIND$2 = functionBindNative; var call$a = Function.prototype.call; // eslint-disable-next-line es/no-function-prototype-bind -- safe var functionCall = NATIVE_BIND$2 ? call$a.bind(call$a) : function () { return call$a.apply(call$a, arguments); }; var path$4 = {}; var path$3 = path$4; var globalThis$d = globalThis_1; var isCallable$b = isCallable$e; var aFunction = function (variable) { return isCallable$b(variable) ? variable : undefined; }; var getBuiltIn$6 = function (namespace, method) { return arguments.length < 2 ? aFunction(path$3[namespace]) || aFunction(globalThis$d[namespace]) : path$3[namespace] && path$3[namespace][method] || globalThis$d[namespace] && globalThis$d[namespace][method]; }; var uncurryThis$f = functionUncurryThis; var objectIsPrototypeOf = uncurryThis$f({}.isPrototypeOf); var globalThis$c = globalThis_1; var navigator = globalThis$c.navigator; var userAgent$1 = navigator && navigator.userAgent; var environmentUserAgent = userAgent$1 ? String(userAgent$1) : ''; var globalThis$b = globalThis_1; var userAgent = environmentUserAgent; var process = globalThis$b.process; var Deno = globalThis$b.Deno; var versions = process && process.versions || Deno && Deno.version; var v8 = versions && versions.v8; var match, version; if (v8) { match = v8.split('.'); // in old Chrome, versions of V8 isn't V8 = Chrome / 10 // but their correct versions are not interesting for us version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); } // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` // so check `userAgent` even if `.v8` exists, but 0 if (!version && userAgent) { match = userAgent.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { match = userAgent.match(/Chrome\/(\d+)/); if (match) version = +match[1]; } } var environmentV8Version = version; /* eslint-disable es/no-symbol -- required for testing */ var V8_VERSION = environmentV8Version; var fails$7 = fails$d; var globalThis$a = globalThis_1; var $String$2 = globalThis$a.String; // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$7(function () { var symbol = Symbol('symbol detection'); // Chrome 38 Symbol has incorrect toString conversion // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will, // of course, fail. return !$String$2(symbol) || !(Object(symbol) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances !Symbol.sham && V8_VERSION && V8_VERSION < 41; }); /* eslint-disable es/no-symbol -- required for testing */ var NATIVE_SYMBOL$1 = symbolConstructorDetection; var useSymbolAsUid = NATIVE_SYMBOL$1 && !Symbol.sham && typeof Symbol.iterator == 'symbol'; var getBuiltIn$5 = getBuiltIn$6; var isCallable$a = isCallable$e; var isPrototypeOf$1 = objectIsPrototypeOf; var USE_SYMBOL_AS_UID$1 = useSymbolAsUid; var $Object$3 = Object; var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) { return typeof it == 'symbol'; } : function (it) { var $Symbol = getBuiltIn$5('Symbol'); return isCallable$a($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$3(it)); }; var $String$1 = String; var tryToString$2 = function (argument) { try { return $String$1(argument); } catch (error) { return 'Object'; } }; var isCallable$9 = isCallable$e; var tryToString$1 = tryToString$2; var $TypeError$6 = TypeError; // `Assert: IsCallable(argument) is true` var aCallable$3 = function (argument) { if (isCallable$9(argument)) return argument; throw new $TypeError$6(tryToString$1(argument) + ' is not a function'); }; var aCallable$2 = aCallable$3; var isNullOrUndefined$1 = isNullOrUndefined$3; // `GetMethod` abstract operation // https://tc39.es/ecma262/#sec-getmethod var getMethod$3 = function (V, P) { var func = V[P]; return isNullOrUndefined$1(func) ? undefined : aCallable$2(func); }; var call$9 = functionCall; var isCallable$8 = isCallable$e; var isObject$4 = isObject$7; var $TypeError$5 = TypeError; // `OrdinaryToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-ordinarytoprimitive var ordinaryToPrimitive$1 = function (input, pref) { var fn, val; if (pref === 'string' && isCallable$8(fn = input.toString) && !isObject$4(val = call$9(fn, input))) return val; if (isCallable$8(fn = input.valueOf) && !isObject$4(val = call$9(fn, input))) return val; if (pref !== 'string' && isCallable$8(fn = input.toString) && !isObject$4(val = call$9(fn, input))) return val; throw new $TypeError$5("Can't convert object to primitive value"); }; var sharedStore = {exports: {}}; var isPure = true; var globalThis$9 = globalThis_1; // eslint-disable-next-line es/no-object-defineproperty -- safe var defineProperty$3 = Object.defineProperty; var defineGlobalProperty$1 = function (key, value) { try { defineProperty$3(globalThis$9, key, { value: value, configurable: true, writable: true }); } catch (error) { globalThis$9[key] = value; } return value; }; var globalThis$8 = globalThis_1; var defineGlobalProperty = defineGlobalProperty$1; var SHARED = '__core-js_shared__'; var store$3 = sharedStore.exports = globalThis$8[SHARED] || defineGlobalProperty(SHARED, {}); (store$3.versions || (store$3.versions = [])).push({ version: '3.46.0', mode: 'pure' , copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)', license: 'https://github.com/zloirock/core-js/blob/v3.46.0/LICENSE', source: 'https://github.com/zloirock/core-js' }); var sharedStoreExports = sharedStore.exports; var store$2 = sharedStoreExports; var shared$3 = function (key, value) { return store$2[key] || (store$2[key] = value || {}); }; var requireObjectCoercible$1 = requireObjectCoercible$3; var $Object$2 = Object; // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject var toObject$4 = function (argument) { return $Object$2(requireObjectCoercible$1(argument)); }; var uncurryThis$e = functionUncurryThis; var toObject$3 = toObject$4; var hasOwnProperty = uncurryThis$e({}.hasOwnProperty); // `HasOwnProperty` abstract operation // https://tc39.es/ecma262/#sec-hasownproperty // eslint-disable-next-line es/no-object-hasown -- safe var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) { return hasOwnProperty(toObject$3(it), key); }; var uncurryThis$d = functionUncurryThis; var id = 0; var postfix = Math.random(); var toString$6 = uncurryThis$d(1.1.toString); var uid$2 = function (key) { return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$6(++id + postfix, 36); }; var globalThis$7 = globalThis_1; var shared$2 = shared$3; var hasOwn$9 = hasOwnProperty_1; var uid$1 = uid$2; var NATIVE_SYMBOL = symbolConstructorDetection; var USE_SYMBOL_AS_UID = useSymbolAsUid; var Symbol$1 = globalThis$7.Symbol; var WellKnownSymbolsStore = shared$2('wks'); var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1; var wellKnownSymbol$a = function (name) { if (!hasOwn$9(WellKnownSymbolsStore, name)) { WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$9(Symbol$1, name) ? Symbol$1[name] : createWellKnownSymbol('Symbol.' + name); } return WellKnownSymbolsStore[name]; }; var call$8 = functionCall; var isObject$3 = isObject$7; var isSymbol$1 = isSymbol$2; var getMethod$2 = getMethod$3; var ordinaryToPrimitive = ordinaryToPrimitive$1; var wellKnownSymbol$9 = wellKnownSymbol$a; var $TypeError$4 = TypeError; var TO_PRIMITIVE = wellKnownSymbol$9('toPrimitive'); // `ToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-toprimitive var toPrimitive$1 = function (input, pref) { if (!isObject$3(input) || isSymbol$1(input)) return input; var exoticToPrim = getMethod$2(input, TO_PRIMITIVE); var result; if (exoticToPrim) { if (pref === undefined) pref = 'default'; result = call$8(exoticToPrim, input, pref); if (!isObject$3(result) || isSymbol$1(result)) return result; throw new $TypeError$4("Can't convert object to primitive value"); } if (pref === undefined) pref = 'number'; return ordinaryToPrimitive(input, pref); }; var toPrimitive = toPrimitive$1; var isSymbol = isSymbol$2; // `ToPropertyKey` abstract operation // https://tc39.es/ecma262/#sec-topropertykey var toPropertyKey$2 = function (argument) { var key = toPrimitive(argument, 'string'); return isSymbol(key) ? key : key + ''; }; var DESCRIPTORS$a = descriptors; var IE8_DOM_DEFINE$1 = ie8DomDefine; var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug; var anObject$6 = anObject$7; var toPropertyKey$1 = toPropertyKey$2; var $TypeError$3 = TypeError; // eslint-disable-next-line es/no-object-defineproperty -- safe var $defineProperty = Object.defineProperty; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; var ENUMERABLE = 'enumerable'; var CONFIGURABLE$1 = 'configurable'; v