@frontegg/js 6.61.0 → 6.62.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.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see frontegg.production.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||o,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,s):i(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},l=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),r=new L(i||[]);return a._invoke=function(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var l=T(r,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var s=y(e,t,n);if("normal"===s.type){if(i=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i="completed",n.method="throw",n.arg=s.arg)}}}(e,n,r),a}function y(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var f={};function g(){}function p(){}function S(){}var v={};u(v,l,(function(){return this}));var h=Object.getPrototypeOf,m=h&&h(h(O([])));m&&m!==n&&a.call(m,l)&&(v=m);var b=S.prototype=g.prototype=Object.create(v);function A(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(o,r,l,s){var c=y(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,l,s)}),(function(e){n("throw",e,l,s)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return n("throw",e,l,s)}))}s(c.arg)}var o;this._invoke=function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}}function T(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var i=y(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function O(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return p.prototype=S,u(b,"constructor",S),u(S,"constructor",p),p.displayName=u(S,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},A(k.prototype),u(k.prototype,s,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new k(d(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},A(b),u(b,c,"Generator"),u(b,l,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},t.values=O,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var l=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(l&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;I(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return cT},AdminPortalRenderer:function(){return yT},AppHolder:function(){return P},CheckoutDialog:function(){return uT},FronteggApp:function(){return lT},HostedLogin:function(){return sT},LoginBoxRenderer:function(){return pT},defaultTheme:function(){return fT},getThemeAdminByName:function(){return dT},getThemeByName:function(){return gT},initialize:function(){return IT}});var e={};n.r(e),n.d(e,{Delete:function(){return Xo},Get:function(){return Ho},Patch:function(){return Yo},Post:function(){return Jo},PostDownload:function(){return Zo},Put:function(){return Qo},getBaseUrl:function(){return zo}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return Ua},getSubTenantsAsTree:function(){return Ma},getTenants:function(){return _a},switchTenant:function(){return Ra}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return rr},OAuthLogout:function(){return Cr},SocialLoginProviders:function(){return ar},acceptInvitation:function(){return Lr},activateAccount:function(){return kr},bulkCreateIPRestriction:function(){return er},changePhoneNumber:function(){return ys},changePhoneNumberWithVerification:function(){return us},checkIfAllowToRememberMfaDevice:function(){return xl},createDomainRestriction:function(){return Ha},createIPRestriction:function(){return Za},createOrUpdateSessionConfigrations:function(){return wl},createSSOConfiguration:function(){return Gl},createSSOConfigurationByMetadata:function(){return ql},createSSODomain:function(){return Jl},createSSOGroup:function(){return es},createSamlGroup:function(){return pl},deleteAllSessionsForUser:function(){return Dl},deleteDomainRestriction:function(){return Ya},deleteIPRestriction:function(){return nr},deleteSSOConfiguration:function(){return zl},deleteSSODomain:function(){return Yl},deleteSSOGroup:function(){return ns},deleteSamlGroup:function(){return vl},deleteSessionForUser:function(){return Cl},deleteTenantApiToken:function(){return Nl},deleteUserApiToken:function(){return $l},disableMFAAuthenticatorApp:function(){return Gr},disableMFASMS:function(){return zr},disableMFAWebAuthn:function(){return Hr},disableMfa:function(){return Kr},enrollMFAAuthenticatorApp:function(){return $r},enrollMFAAuthenticatorAppForLogin:function(){return Qr},enrollMFASMS:function(){return xr},enrollMFASMSForLogin:function(){return el},enrollMFAWebAuthn:function(){return jr},enrollMFAWebAuthnForLogin:function(){return ol},enrollMfa:function(){return Mr},exchangeOAuthTokens:function(){return rs},forgotPassword:function(){return Dr},generateLoginResponse:function(){return fr},generateLoginResponseFromOAuthResponse:function(){return pr},generateLoginResponseV2:function(){return gr},getActivateAccountStrategy:function(){return Tr},getCaptchaPolicy:function(){return Wa},getCurrentUserSession:function(){return Ll},getCurrentUserSessions:function(){return Il},getDomainRestrictions:function(){return za},getDomainRestrictionsConfig:function(){return qa},getGlobalSecurityPolicy:function(){return Na},getIPRestrictions:function(){return Qa},getIPRestrictionsConfig:function(){return Xa},getLockoutPolicy:function(){return Va},getMFADevices:function(){return Jr},getMFAStrategiesConfig:function(){return hs},getMfaPolicy:function(){return $a},getOidcConfiguration:function(){return hl},getPasswordConfigPolicy:function(){return Ba},getPasswordHistoryPolicy:function(){return Ka},getSSOConfigurations:function(){return Kl},getSSODefaultRoles:function(){return Xl},getSSOGroups:function(){return is},getSSOPublicConfiguration:function(){return ml},getSamlConfiguration:function(){return ll},getSamlRoles:function(){return yl},getSamlRolesGroups:function(){return fl},getSamlVendorConfiguration:function(){return cl},getSessionConfigurations:function(){return El},getSocialLoginProviders:function(){return bl},getSocialLoginProvidersV2:function(){return Al},getTenantApiTokensData:function(){return _l},getUserApiTokensData:function(){return Rl},getUserById:function(){return Fl},getVendorConfig:function(){return Tl},getVendorMfaPolicy:function(){return Fa},getVendorPublicAuthStrategiesConfig:function(){return vs},loadPasswordConfig:function(){return _r},login:function(){return br},loginViaSocialLogin:function(){return kl},loginWithMfa:function(){return Ar},logout:function(){return wr},oidcPostLogin:function(){return mr},oidcPostLoginV2:function(){return as},passwordlessPostLogin:function(){return jl},passwordlessPreLogin:function(){return Vl},postLogin:function(){return hr},preDisableMFASMS:function(){return Br},preDisableMFAWebAuthn:function(){return qr},preEnrollMFAAuthenticatorApp:function(){return Nr},preEnrollMFAAuthenticatorAppForLogin:function(){return Yr},preEnrollMFASMS:function(){return Fr},preEnrollMFASMSForLogin:function(){return Zr},preEnrollMFAWebAuthn:function(){return Vr},preEnrollMFAWebAuthnForLogin:function(){return il},preLogin:function(){return Sr},preLoginV2:function(){return os},preLoginWithIdpType:function(){return vr},preVerifyMFASMSForLogin:function(){return tl},preVerifyMFAWebAuthnForLogin:function(){return al},recoverMfaToken:function(){return Ur},refreshToken:function(){return Or},refreshTokenV2:function(){return Er},resendActivationEmail:function(){return Pr},resendInvitationEmail:function(){return Ir},resetPassword:function(){return Rr},resetPhoneNumber:function(){return ss},revokeSessionsForUser:function(){return Ol},saveLockoutPolicy:function(){return ja},saveMfaPolicy:function(){return xa},savePasswordHistoryPolicy:function(){return Ga},setSSODefaultRoles:function(){return Zl},signUpUser:function(){return Pl},silentOAuthRefreshToken:function(){return ls},testCurrentIp:function(){return ir},testCurrentIpInAllowList:function(){return or},updateDomainRestrictionConfig:function(){return Ja},updateIPRestrictionConfig:function(){return tr},updateSSOConfiguration:function(){return Bl},updateSSOConfigurationByMetadata:function(){return Hl},updateSSOGroup:function(){return ts},updateSamlConfiguration:function(){return sl},updateSamlGroup:function(){return Sl},updateSamlRoles:function(){return gl},updateSamlVendorMetadata:function(){return ul},updateTenantApiTokensData:function(){return Ml},updateUserApiTokensData:function(){return Ul},validateSSODomain:function(){return Ql},validateSamlDomain:function(){return dl},verifyChangePhoneNumber:function(){return ds},verifyInviteToken:function(){return Wl},verifyMFAAuthenticatorAppForLogin:function(){return Xr},verifyMFASMSForLogin:function(){return nl},verifyMFAWebAuthnForLogin:function(){return rl},verifyMfa:function(){return Wr},verifyNewDeviceSession:function(){return Ss},verifyResetPhoneNumber:function(){return cs},webAuthnCreateNewDeviceSession:function(){return ps},webAuthnPostLogin:function(){return gs},webAuthnPreLogin:function(){return fs}});var a={};n.r(a),n.d(a,{addUser:function(){return Ps},changePassword:function(){return ks},createInviteUserLink:function(){return Os},deleteInviteUserLink:function(){return ws},deleteUser:function(){return Is},getInviteLinkConfiguration:function(){return Ds},getInviteUserLink:function(){return Cs},getProfile:function(){return ms},loadAvailablePermissions:function(){return _s},loadAvailableRoles:function(){return Rs},loadStats:function(){return Us},loadUsers:function(){return Ts},resendActivationLink:function(){return Ms},resendInvitationLink:function(){return Ns},resendInvitationLinkToAllTenants:function(){return $s},updateInviteUserLink:function(){return Es},updateProfile:function(){return bs},updateProfileImage:function(){return As},updateUser:function(){return Ls}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return Ws},getCurrentUserIpMetadata:function(){return xs},getIpAdressMetadata:function(){return Ks},getNotificationsMetadata:function(){return Vs},getSamlMetadata:function(){return js}});var l={};n.r(l),n.d(l,{downloadReport:function(){return Qs},getReport:function(){return Hs},getReports:function(){return qs},renderReport:function(){return Js},scheduleReport:function(){return Ys},sendReport:function(){return Xs}});var s={};n.r(s),n.d(s,{getNotifications:function(){return Zs},markAllAsRead:function(){return nc},updateNotificationIsPinned:function(){return tc},updateNotificationStatus:function(){return ec}});var c={};n.r(c),n.d(c,{exportAudits:function(){return rc},getAudits:function(){return oc},getAuditsStats:function(){return ac}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return bc},deleteEmailSubscriptions:function(){return hc},deleteSMSConfiguration:function(){return Lc},deleteSMSSubscriptions:function(){return Pc},deleteSlackConfiguration:function(){return fc},deleteWebhooksConfiguration:function(){return wc},getCategories:function(){return _c},getChannelMaps:function(){return Uc},getEmailConfiguration:function(){return pc},getSMSConfiguration:function(){return Ac},getSlackChannels:function(){return dc},getSlackConfiguration:function(){return cc},getSlackScope:function(){return uc},getWebhookLog:function(){return Cc},getWebhooksConfigurations:function(){return Oc},patchEmailConfiguration:function(){return vc},patchSMSConfiguration:function(){return Tc},postEmailConfiguration:function(){return Sc},postSMSConfiguration:function(){return kc},postSlackCode:function(){return gc},postSlackConfiguration:function(){return yc},postWebhookRetry:function(){return Rc},postWebhookTest:function(){return Dc},postWebhooksConfiguration:function(){return Ec},putEmailSubscriptions:function(){return mc},putSMSSubscriptions:function(){return Ic}});var d={};n.r(d),n.d(d,{getSettings:function(){return Nc},updateSettings:function(){return Mc}});var y={};n.r(y),n.d(y,{addRole:function(){return jc},attachPermissionToRoles:function(){return zc},attachPermissionsToRole:function(){return Gc},deleteRole:function(){return Wc},getPermissionCategories:function(){return qc},getPermissions:function(){return Bc},getRoles:function(){return Vc},updateRole:function(){return Kc}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return Iu},ISubscriptionStatus:function(){return Tu},PaymentMethodType:function(){return Pu},ProviderType:function(){return Lu},TenantCreatedAction:function(){return Eu},TrialEndAction:function(){return Ou},cancelManagedSubscription:function(){return tu},cancelSubscription:function(){return Yc},createStripeCustomer:function(){return pu},createStripePaymentMethodSetupIntentSecret:function(){return vu},createSubscription:function(){return fu},createTenantConfiguration:function(){return bu},getManagedSubscription:function(){return Zc},getManagedSubscriptions:function(){return eu},getPaymentMethod:function(){return du},getPaymentMethods:function(){return uu},getPaymentProviders:function(){return Au},getStripeCustomer:function(){return gu},getStripePaymentProviderConfiguration:function(){return Su},getSubscription:function(){return Jc},getSubscriptionInvoice:function(){return lu},getSubscriptionInvoicePdf:function(){return su},getSubscriptionInvoices:function(){return ru},getSubscriptionPlan:function(){return au},getSubscriptionPlans:function(){return ou},getSubscriptionSummaries:function(){return hu},getSubscriptions:function(){return Hc},getTenantConfiguration:function(){return mu},getVendorPublicConfigurations:function(){return ku},renewManagedSubscription:function(){return nu},renewSubscription:function(){return Qc},updateManagedSubscription:function(){return iu},updatePaymentMethodBillingDetails:function(){return yu},updateSubscription:function(){return Xc}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return Uu}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return Fu},addUserToTenantAndSubTenants:function(){return Nu},loadAllUsers:function(){return Mu},removeUserFromTenantAndSubTenants:function(){return $u},removeUserRolesFromSubTenants:function(){return xu},setUserRolesForSubTenants:function(){return Vu}});var S={};n.r(S),n.d(S,{loadFeatureFlags:function(){return ju}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return zu},createConfiguration:function(){return Gu},deleteConfiguration:function(){return Bu},getConfigs:function(){return Wu},updateConfiguration:function(){return Ku}});var h={};n.r(h),n.d(h,{impersonate:function(){return qu}});var m={};n.r(m),n.d(m,{AuthStrategyEnum:function(){return rr},ContextHolder:function(){return Ko},FronteggApiError:function(){return Bo},FronteggContext:function(){return Go},ISubscriptionCancellationPolicy:function(){return Iu},ISubscriptionStatus:function(){return Tu},MFAStrategyEnum:function(){return Du},PaymentMethodType:function(){return Pu},ProviderType:function(){return Lu},RestrictionType:function(){return _n},ScimConnectionSource:function(){return Zu},SecondaryAuthStrategy:function(){return wu},SocialLoginProviders:function(){return ar},TenantType:function(){return _u},UserManagedByEnum:function(){return Ru},WebAuthnDeviceType:function(){return Cu},api:function(){return ed},countConfigurationUsers:function(){return zu},createConfiguration:function(){return Gu},default:function(){return td},deleteConfiguration:function(){return Bu},fetch:function(){return e},fronteggAuthApiRoutes:function(){return Hu},fronteggRefreshTokenUrl:function(){return Ju},fronteggSilentRefreshTokenUrl:function(){return Yu},fronteggTenantsUrl:function(){return Xu},fronteggUsersUrl:function(){return Qu},getConfigs:function(){return Wu},loadFeatureFlags:function(){return ju},updateConfiguration:function(){return Ku}});var b={};function A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function T(e,t,n){return t&&k(e.prototype,t),n&&k(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(b),n.d(b,{AccountPageFields:function(){return Yk},DomainRestrictionsTabFields:function(){return nT},GeneralSettingsTabFields:function(){return eT},InviteUserModalFields:function(){return Jk},IpRestrictionsTabFields:function(){return tT},Metadata:function(){return Wk},PrivacyPageFields:function(){return Hk},ProfilePageFields:function(){return qk},SecurityPageTabs:function(){return Xk},SessionManagementTabFields:function(){return Zk},SsoPageTabs:function(){return iT},SubscriptionsPageFields:function(){return Qk},fieldAppearance:function(){return oT},tabAppearance:function(){return aT}});var P=function(){function e(){A(this,e)}return T(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},I.apply(this,arguments)}function L(e,t,n,i,o,a,r){try{var l=e[a](r),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(i,o)}function O(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){L(a,i,o,r,l,"next",e)}function l(e){L(a,i,o,r,l,"throw",e)}r(void 0)}))}}P._apps={};var E=n(841),w=n.n(E);function C(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function D(e){return!!e&&!!e[ve]}function R(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===he}(e)||Array.isArray(e)||!!e[Se]||!!e.constructor[Se]||F(e)||x(e))}function _(e,t,n){void 0===n&&(n=!1),0===U(e)?(n?Object.keys:me)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function U(e){var t=e[ve];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:F(e)?2:x(e)?3:0}function M(e,t){return 2===U(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function N(e,t,n){var i=U(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function $(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function F(e){return ye&&e instanceof Map}function x(e){return fe&&e instanceof Set}function V(e){return e.o||e.t}function j(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=be(e);delete t[ve];for(var n=me(t),i=0;i<n.length;i++){var o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function W(e,t){return void 0===t&&(t=!1),G(e)||D(e)||!R(e)||(U(e)>1&&(e.set=e.add=e.clear=e.delete=K),Object.freeze(e),t&&_(e,(function(e,t){return W(t,!0)}),!0)),e}function K(){C(2)}function G(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function B(e){var t=Ae[e];return t||C(18,e),t}function z(){return ue}function q(e,t){t&&(B("Patches"),e.u=[],e.s=[],e.v=t)}function H(e){J(e),e.p.forEach(Q),e.p=null}function J(e){e===ue&&(ue=e.l)}function Y(e){return ue={p:[],l:ue,h:e,m:!0,_:0}}function Q(e){var t=e[ve];0===t.i||1===t.i?t.j():t.O=!0}function X(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||B("ES5").S(t,e,i),i?(n[ve].P&&(H(t),C(4)),R(e)&&(e=Z(t,e),t.l||te(t,e)),t.u&&B("Patches").M(n[ve].t,e,t.u,t.s)):e=Z(t,n,[]),H(t),t.u&&t.v(t.u,t.s),e!==pe?e:void 0}function Z(e,t,n){if(G(t))return t;var i=t[ve];if(!i)return _(t,(function(o,a){return ee(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return te(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=j(i.k):i.o;_(3===i.i?new Set(o):o,(function(t,a){return ee(e,i,o,t,a,n)})),te(e,o,!1),n&&e.u&&B("Patches").R(i,n,e.u,e.s)}return i.o}function ee(e,t,n,i,o,a){if(D(o)){var r=Z(e,o,a&&t&&3!==t.i&&!M(t.D,i)?a.concat(i):void 0);if(N(n,i,r),!D(r))return;e.m=!1}if(R(o)&&!G(o)){if(!e.h.F&&e._<1)return;Z(e,o),t&&t.A.l||te(e,o)}}function te(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&W(t,n)}function ne(e,t){var n=e[ve];return(n?V(n):e)[t]}function ie(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=Object.getPrototypeOf(n)}}function oe(e){e.P||(e.P=!0,e.l&&oe(e.l))}function ae(e){e.o||(e.o=j(e.t))}function re(e,t,n){var i=F(t)?B("MapSet").N(t,n):x(t)?B("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:z(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=ke;n&&(o=[i],a=Te);var r=Proxy.revocable(o,a),l=r.revoke,s=r.proxy;return i.k=s,i.j=l,s}(t,n):B("ES5").J(t,n);return(n?n.A:z()).p.push(i),i}function le(e){return D(e)||C(22,e),function e(t){if(!R(t))return t;var n,i=t[ve],o=U(t);if(i){if(!i.P&&(i.i<4||!B("ES5").K(i)))return i.t;i.I=!0,n=se(t,o),i.I=!1}else n=se(t,o);return _(n,(function(t,o){i&&function(e,t){return 2===U(e)?e.get(t):e[t]}(i.t,t)===o||N(n,t,e(o))})),3===o?new Set(n):n}(e)}function se(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return j(e)}var ce,ue,de="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ye="undefined"!=typeof Map,fe="undefined"!=typeof Set,ge="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,pe=de?Symbol.for("immer-nothing"):((ce={})["immer-nothing"]=!0,ce),Se=de?Symbol.for("immer-draftable"):"__$immer_draftable",ve=de?Symbol.for("immer-state"):"__$immer_state",he=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),me="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,be=Object.getOwnPropertyDescriptors||function(e){var t={};return me(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ae={},ke={get:function(e,t){if(t===ve)return e;var n=V(e);if(!M(n,t))return function(e,t,n){var i,o=ie(t,n);return o?"value"in o?o.value:null===(i=o.get)||void 0===i?void 0:i.call(e.k):void 0}(e,n,t);var i=n[t];return e.I||!R(i)?i:i===ne(e.t,t)?(ae(e),e.o[t]=re(e.A.h,i,e)):i},has:function(e,t){return t in V(e)},ownKeys:function(e){return Reflect.ownKeys(V(e))},set:function(e,t,n){var i=ie(V(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=ne(V(e),t),a=null==o?void 0:o[ve];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if($(n,o)&&(void 0!==n||M(e.t,t)))return!0;ae(e),oe(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==ne(e.t,t)||t in e.t?(e.D[t]=!1,ae(e),oe(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=V(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){C(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){C(12)}},Te={};_(ke,(function(e,t){Te[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Te.deleteProperty=function(e,t){return Te.set.call(this,e,t,void 0)},Te.set=function(e,t,n){return ke.set.call(this,e[0],t,n,e[0])};var Pe=function(){function e(e){var t=this;this.g=ge,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var i=arguments.length,r=Array(i>1?i-1:0),l=1;l<i;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&C(6),void 0!==i&&"function"!=typeof i&&C(7),R(e)){var l=Y(t),s=re(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?H(l):J(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return q(l,i),X(e,l)}),(function(e){throw H(l),e})):(q(l,i),X(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===pe&&(r=void 0),t.F&&W(r,!0),i){var u=[],d=[];B("Patches").M(e,r,u,d),i(u,d)}return r}C(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){R(e)||C(8),D(e)&&(e=le(e));var t=Y(this),n=re(this,e,void 0);return n[ve].C=!0,J(t),n},t.finishDraft=function(e,t){var n=(e&&e[ve]).A;return q(n,t),X(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ge&&C(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=B("Patches").$;return D(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Ie=new Pe,Le=Ie.produce,Oe=(Ie.produceWithPatches.bind(Ie),Ie.setAutoFreeze.bind(Ie),Ie.setUseProxies.bind(Ie),Ie.applyPatches.bind(Ie),Ie.createDraft.bind(Ie),Ie.finishDraft.bind(Ie),Le);function Ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?we(Object(n),!0).forEach((function(t){Ee(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):we(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function De(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Re="function"==typeof Symbol&&Symbol.observable||"@@observable",_e=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ue={INIT:"@@redux/INIT"+_e(),REPLACE:"@@redux/REPLACE"+_e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+_e()}};function Me(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Ne(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(De(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(De(1));return n(Ne)(e,t)}if("function"!=typeof e)throw new Error(De(2));var o=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(De(3));return a}function d(e){if("function"!=typeof e)throw new Error(De(4));if(s)throw new Error(De(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(De(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Me(e))throw new Error(De(7));if(void 0===e.type)throw new Error(De(8));if(s)throw new Error(De(9));try{s=!0,a=o(a,e)}finally{s=!1}for(var t=r=l,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(De(10));o=e,y({type:Ue.REPLACE})}function g(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(De(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Re]=function(){return this},e}return y({type:Ue.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Re]=g,i}function $e(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Ue.INIT}))throw new Error(De(12));if(void 0===n(void 0,{type:Ue.PROBE_UNKNOWN_ACTION()}))throw new Error(De(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},l=0;l<r.length;l++){var s=r[l],c=n[s],u=e[s],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(De(14));o[s]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function Fe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function xe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw new Error(De(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=Fe.apply(void 0,a)(n.dispatch),Ce(Ce({},n),{},{dispatch:i})}}}function Ve(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var je=Ve();je.withExtraArgument=Ve;var We,Ke=je,Ge=(We=function(e,t){return We=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},We(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}We(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Be=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},ze=Object.defineProperty,qe=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),He=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,Ye=function(e,t,n){return t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Qe=function(e,t){for(var n in t||(t={}))He.call(t,n)&&Ye(e,n,t[n]);if(qe)for(var i=0,o=qe(t);i<o.length;i++)n=o[i],Je.call(t,n)&&Ye(e,n,t[n]);return e},Xe="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Fe:Fe.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Ze=function(e){function t(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Ge(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Be([void 0],e[0].concat(this)))):new(t.bind.apply(t,Be([void 0],e.concat(this))))},t}(Array);function et(e){return R(e)?Oe(e,(function(){})):e}function tt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new Ze);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(Ke):i.push(Ke.withExtraArgument(n.extraArgument))),i}function nt(e){var t,n=function(e){return tt(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,l=void 0===r?n():r,s=i.devTools,c=void 0===s||s,u=i.preloadedState,d=void 0===u?void 0:u,y=i.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=$e(a)}var g=l;"function"==typeof g&&(g=g(n));var p=xe.apply(void 0,g),S=Fe;c&&(S=Xe(Qe({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(f)?v=Be([p],f):"function"==typeof f&&(v=f(v)),Ne(t,d,S.apply(void 0,v))}function it(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return Qe(Qe({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ot(e){var t,n={},i=[],o={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,o},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,i,t]}function at(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:et(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?ot(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=Qe(Qe({},o),l);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?ot(t):[t,n,i],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return et(e())};else{var c=et(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Be([r[t.type]],l.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[s]),n.reduce((function(e,n){if(n){var i;if(D(e))return void 0===(i=n(e,t))?e:i;if(R(e))return Oe(e,(function(e){return n(e,t)}));if(void 0===(i=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}return e}),e)}return u.getInitialState=o,u}(i,u,r,c)}return a.forEach((function(e){var n,i,a=o[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,i=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=i?it(c,i):it(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:s,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var rt="listenerMiddleware";it(rt+"/add"),it(rt+"/removeAll"),it(rt+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[ve];return ke.get(t,e)},set:function(t){var n=this[ve];ke.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ve];if(!o.P)switch(o.i){case 5:i(o)&&oe(o);break;case 4:n(o)&&oe(o)}}}function n(e){for(var t=e.t,n=e.k,i=me(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==ve){var r=t[a];if(void 0===r&&!M(t,a))return!0;var l=n[a],s=l&&l[ve];if(s?s.t!==r:!$(l,r))return!0}}var c=!!t[ve];return i.length!==me(t).length+(c?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var i=0;i<t.length;i++)if(!t.hasOwnProperty(i))return!0;return!1}var o={};!function(e,t){Ae[e]||(Ae[e]=t)}("ES5",{J:function(t,n){var i=Array.isArray(t),o=function(t,n){if(t){for(var i=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(i,""+o,e(o,!0));return i}var a=be(n);delete a[ve];for(var r=me(a),l=0;l<r.length;l++){var s=r[l];a[s]=e(s,t||!!a[s].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(i,t),a={i:i?5:4,A:n?n.A:z(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ve,{value:a,writable:!0}),o},S:function(e,n,o){o?D(n)&&n[ve].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ve];if(n){var o=n.t,a=n.k,r=n.D,l=n.i;if(4===l)_(a,(function(t){t!==ve&&(void 0!==o[t]||M(o,t)?r[t]||e(a[t]):(r[t]=!0,oe(n)))})),_(o,(function(e){void 0!==a[e]||M(a,e)||(r[e]=!1,oe(n))}));else if(5===l){if(i(n)&&(oe(n),r.length=!0),a.length<o.length)for(var s=a.length;s<o.length;s++)r[s]=!1;else for(var c=o.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,o.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}();const lt=(e,t)=>n=>I({},n,{[e]:t[e]}),st=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>I({},t,{[e]:I({},t[e],n)})}),ct=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return I({},n,{[e]:I({},n[e],{[t]:I({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),ut=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return I({},t,{[e]:I({},t[e],{loaders:I({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),dt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return I({},t,{[e]:I({},t[e],{errors:I({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),yt=(e=500)=>new Promise((t=>setTimeout(t,e))),ft="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",gt=new Uint8Array(256);for(let e=0;e<ft.length;e++)gt[ft.charCodeAt(e)]=e;const pt=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,l,s=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=gt[e.charCodeAt(i)],a=gt[e.charCodeAt(i+1)],r=gt[e.charCodeAt(i+2)],l=gt[e.charCodeAt(i+3)],c[s++]=o<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},St=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(St(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let i,o="";for(i=0;i<n;i+=3)o+=ft[t[i]>>2],o+=ft[(3&t[i])<<4|t[i+1]>>4],o+=ft[(15&t[i+1])<<2|t[i+2]>>6],o+=ft[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1):n%3==1&&(o=o.substring(0,o.length-2)),o})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=St(e[n]);return t}return e};let vt,ht,mt;!function(e){e.preLogin="preLogin",e.magicLinkPreLoginSuccess="magicLinkPreLoginSuccess",e.loginWithSmsOtc="loginWithSmsOtc",e.loginWithQuickSmsOtc="loginWithQuickSmsOtc",e.loginWithOtc="loginWithOtc",e.loginWithPassword="loginWithPassword",e.loginWithTwoFactor="loginWithTwoFactor",e.redirectToSSO="redirectToSSO",e.loginWithSSOFailed="loginWithSSOFailed",e.success="success",e.forceTwoFactor="forceTwoFactor",e.recoverTwoFactor="recoverTwoFactor"}(vt||(vt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(ht||(ht={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(mt||(mt={}));const bt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",At="HOSTED_LOGIN_VERIFIER_KEY",kt="auth",Tt="connectivity",Pt="auditLogs",It="vendor",Lt={flow:ht.Login,step:vt.preLogin,loading:!1,email:"",tenants:[]},Ot={setLoginState:st("loginState"),resetLoginState:lt("loginState",{loginState:Lt})},Et={requestAuthorize:it("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:it("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:it("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:it("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:it("auth/afterAuthNavigation"),preLogin:it("auth/preLogin",(e=>({payload:e}))),postLogin:it("auth/postLogin",(e=>({payload:e}))),login:it("auth/login",(e=>({payload:e}))),loginWithMfa:it("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:it("auth/recoverMfa",(e=>({payload:e}))),logout:it("auth/logout",(e=>({payload:e}))),silentLogout:it("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:it("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:it("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:it("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:it("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:it("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:it("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:it("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:it("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:it("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:it("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:it("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:it("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:it("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:it("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:it("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:it("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:it("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:it("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:it("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:it("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:it("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let wt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(wt||(wt={}));const Ct={step:wt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Dt={setActivateState:st("activateState"),resetActivateState:lt("activateState",{activateState:Ct}),setActivateStrategyState:ct("activateState","activationStrategy")},Rt={activateAccount:it("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:it("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:it("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:it("auth/resendActivationEmail",(e=>({payload:e})))};let _t;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(_t||(_t={}));const Ut={step:_t.validate},Mt={setAcceptInvitationState:st("acceptInvitationState"),resetAcceptInvitationState:lt("acceptInvitationState",{acceptInvitationState:Ut})},Nt={acceptInvitation:it("auth/acceptInvitation",(e=>({payload:e})))};let $t;!function(e){e.forgotPassword="forgotPassword",e.success="success"}($t||($t={}));const Ft={step:$t.forgotPassword,loading:!1,email:"",passwordConfig:null},xt={setForgotPasswordState:st("forgotPasswordState"),resetForgotPasswordState:lt("forgotPasswordState",{forgotPasswordState:Ft})},Vt={forgotPassword:it("auth/forgotPassword",(e=>({payload:e}))),resetPassword:it("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:it("auth/loadPasswordConfig",(e=>({payload:e})))};let jt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(jt||(jt={}));const Wt={step:jt.ResetPhoneNumber,loading:!1},Kt={setResetPhoneNumberState:st("resetPhoneNumberState"),resetResetPhoneNumberState:lt("resetPhoneNumberState",{resetPhoneNumberState:Wt})},Gt={resetPhoneNumber:it("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:it("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:it("auth/changePhoneNumber",(e=>({payload:e})))},Bt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},zt={setSSOLoader:ut("ssoState"),setSSOError:dt("ssoState"),setSSOState:st("ssoState"),resetSSOState:lt("ssoState",{ssoState:Bt})},qt={loadSSOConfigurationsV2:it("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:it("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:it("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:it("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:it("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:it("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:it("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:it("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:it("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:it("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:it("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:it("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:it("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:it("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:it("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:it("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:it("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:it("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:it("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:it("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:it("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:it("auth/oidcPostlogin",(e=>({payload:e})))},Ht={loading:!1,error:null},Jt={setProfileState:st("profileState"),resetProfileState:lt("profileState",{profileState:Ht})},Yt={loadProfile:it("auth/loadProfile"),saveProfile:it("auth/saveProfile",(e=>({payload:e}))),changePassword:it("auth/changePassword",(e=>({payload:e})))};let Qt;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(Qt||(Qt={}));const Xt={step:Qt.verify,loading:!1,saving:!1},Zt={setMfaState:st("mfaState"),resetMfaState:lt("mfaState",{mfaState:Xt})},en={enrollMfa:it("auth/enrollMfa"),getMFADevices:it("auth/getMFADevices"),getMFAStrategies:it("auth/getMFAStrategies"),verifyMfa:it("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:it("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:it("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:it("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:it("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:it("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:it("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:it("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:it("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:it("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:it("auth/disableMfaWebAuthn",(e=>({payload:e})))},tn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},nn={setTeamLoader:ut("teamState"),setTeamError:dt("teamState"),setTeamState:st("teamState"),resetTeamState:lt("teamState",{teamState:tn})},on={loadUsers:it("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:it("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:it("auth/loadRoles",(e=>({payload:e}))),addUser:it("auth/addUser",(e=>({payload:e}))),addUsersBulk:it("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:it("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:it("auth/updateUser",(e=>({payload:e}))),deleteUser:it("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:it("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:it("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:it("auth/lockUser",(e=>({payload:e}))),resendActivationLink:it("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:it("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:it("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:it("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:it("auth/getInvitationLink"),createInvitationLink:it("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:it("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:it("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:it("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:it("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:it("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:it("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:it("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:it("auth/closeLockUserDialog",(e=>({payload:e})))},an={firstLoad:!0,loading:!1,error:""},rn={setSocialLoginsState:st("socialLoginState"),resetSocialLoginsState:lt("socialLoginState",{socialLoginState:an})},ln={loadSocialLoginsConfiguration:it("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:it("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:it("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:it("auth/setSocialLoginError",(e=>({payload:e})))};let sn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(sn||(sn={}));const cn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:sn.SignUp},un={setSignUpState:st("signUpState"),resetSignUpState:lt("signUpState",{signUpState:cn})},dn={signUpUser:it("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:it("auth/resetSignUpStateSoft")},yn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},fn={setApiTokensLoader:ut("apiTokensState"),setApiTokensError:dt("apiTokensState"),setApiTokensState:st("apiTokensState"),resetApiTokensState:lt("apiTokensState",{apiTokensState:yn})},gn={loadApiTokens:it("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:it("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:it("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:it("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:it("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:it("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:it("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:it("auth/deleteTenantApiToken",(e=>({payload:e})))},pn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},Sn={setSecurityPolicyState:st("securityPolicyState"),setSecurityPolicyGlobalState:ct("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:ct("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:ct("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:ct("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:ct("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyLockoutState:ct("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:ct("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:ct("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:ct("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:lt("securityPolicyState",{securityPolicyState:pn})},vn={loadSecurityPolicy:it("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:it("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:it("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:it("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:it("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:it("auth/loadSecurityPolicyLockout"),saveSecurityPolicyLockout:it("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:it("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:it("auth/loadSecurityPolicyPasswordHistory"),saveSecurityPolicyPasswordHistory:it("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:it("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:it("auth/loadPublicAuthStrategiesPolicy")},hn={loading:!1},mn={setAccountSettingsState:st("accountSettingsState"),resetAccountSettingsState:lt("accountSettingsState",{accountSettingsState:hn})},bn={loadAccountSettings:it("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:it("auth/saveAccountSettings",(e=>({payload:e})))},An={tenants:[],subTenants:[],loading:!0,tenantTree:null},kn={setTenantsState:st("tenantsState"),resetTenantsState:lt("tenantsState",{tenantsState:An})},Tn={switchTenant:it("auth/switchTenant",(e=>({payload:e}))),loadTenants:it("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:it("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:it("auth/loadSubTenantsTree",(e=>({payload:e})))},Pn={loading:!1,roles:[],permissions:[],permissionCategories:[]},In={setRolesState:st("rolesState"),resetRolesState:lt("rolesState",{rolesState:Pn})},Ln={loadRolesAndPermissions:it("auth/loadRoles",(e=>({payload:e}))),addRole:it("auth/addRole",(e=>({payload:e}))),updateRole:it("auth/updateRole",(e=>({payload:e}))),deleteRole:it("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:it("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:it("auth/attachPermissionToRoles",(e=>({payload:e})))},On={loading:!1,sessions:[]},En={setSessionsState:st("sessionsState"),resetSessionsState:lt("sessionsState",{sessionsState:On})},wn={loadUserSessions:it("auth/loadUserSessions"),loadCurrentUserSession:it("auth/loadCurrentUserSession"),deleteUserSession:it("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:it("auth/deleteAllUserSessions"),revokeUserSessions:it("auth/revokeUserSessions",(e=>({payload:e})))},Cn={loading:!1,configurations:{}},Dn={setSessionsPolicyState:st("sessionsPolicyState"),resetSessionsPolicyState:lt("sessionsPolicyState",{sessionsPolicyState:Cn})},Rn={loadSessionsPolicy:it("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:it("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let _n;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(_n||(_n={}));const Un={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:_n.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Mn={setRestrictionsState:st("restrictionsState"),setIpRestrictionsState:ct("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:ct("restrictionsState","emailDomainRestrictions")},Nn={checkIfUserIpValid:it("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:it("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:it("auth/loadIpRestrictions"),saveIpRestriction:it("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:it("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:it("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:it("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:it("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:it("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:it("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},$n={loading:!1},Fn={setProvisioningState:st("provisioningState"),resetProvisioningState:lt("provisioningState",{provisioningState:$n})},xn={loadProvisionConnections:it("auth/loadProvisionConnections"),createProvisionConnection:it("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:it("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:it("auth/updateProvisionConnection",(e=>({payload:e})))},Vn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:cn,loginState:Lt,activateState:Ct,acceptInvitationState:Ut,forgotPasswordState:Ft,ssoState:Bt,profileState:Ht,mfaState:Xt,teamState:tn,socialLoginState:an,apiTokensState:yn,securityPolicyState:pn,accountSettingsState:hn,tenantsState:An,rolesState:Pn,resetPhoneNumberState:Wt,sessionsState:On,sessionsPolicyState:Cn,restrictionsState:Un,provisioningState:$n},jn=I({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},Vn),{reducer:Wn,actions:Kn}=at({name:kt,initialState:jn,reducers:I({resetState:e=>I({},e,Vn),setState:(e,{payload:t})=>I({},e,t),setUser:("user",(e,{payload:t})=>I({},e,{user:t}))},Ot,rn,Dt,Mt,xt,Kt,un,Jt,zt,Zt,nn,fn,Sn,mn,kn,In,En,Dn,Mn,Fn)});const Gn=I({},Kn,Et,ln,Rt,Nt,Vt,Gt,dn,Yt,qt,en,on,gn,vn,bn,Tn,Ln,wn,Rn,Nn,xn);var Bn=function(e){return"@@redux-saga/"+e},zn=Bn("CANCEL_PROMISE"),qn=Bn("CHANNEL_END"),Hn=Bn("IO"),Jn=Bn("MATCH"),Yn=Bn("MULTICAST"),Qn=Bn("SAGA_ACTION"),Xn=Bn("SELF_CANCELLATION"),Zn=Bn("TASK"),ei=Bn("TASK_CANCEL"),ti=Bn("TERMINATE"),ni=Bn("LOCATION");function ii(e,t){if(null==e)return{};var n,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var oi=function(e){return null==e},ai=function(e){return null!=e},ri=function(e){return"function"==typeof e},li=function(e){return"string"==typeof e},si=Array.isArray,ci=function(e){return e&&ri(e.then)},ui=function(e){return e&&ri(e.next)&&ri(e.throw)},di=function e(t){return t&&(li(t)||gi(t)||ri(t)||si(t)&&t.every(e))},yi=function(e){return e&&ri(e.take)&&ri(e.close)},fi=function(e){return ri(e)&&e.hasOwnProperty("toString")},gi=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},pi=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[zn]=function(){clearTimeout(n)},i},Si=function(e){return function(){return e}},vi=Si(!0),hi=function(){},mi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var bi=function(e,t){I(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ai(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var ki=function(e){throw e},Ti=function(e){return{value:e,done:!0}};function Pi(e,t,n){void 0===t&&(t=ki),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:Ti,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Ii(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Li=function(e){return Array.apply(null,new Array(e))},Oi=function(e){return function(t){return e(Object.defineProperty(t,Qn,{value:!0}))}},Ei=function(e){return e===ti},wi=function(e){return e===ei},Ci=function(e){return Ei(e)||wi(e)};function Di(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=si(e)?Li(o):{},l={};return i.forEach((function(e){var i=function(i,l){n||(l||Ci(i)?(t.cancel(),t(i,l)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=hi,l[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return l[e].cancel()})))},l}function Ri(e){return{name:e.name||"anonymous",location:_i(e)}}function _i(e){return e[ni]}var Ui=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),i=0,o=0,a=0,r=function(t){n[o]=t,o=(o+1)%e,i++},l=function(){if(0!=i){var t=n[a];return n[a]=null,i--,a=(a+1)%e,t}},s=function(){for(var e=[];i;)e.push(l());return e};return{isEmpty:function(){return 0==i},put:function(l){var c;if(i<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=l,a=o=(o+1)%e;break;case 4:c=2*e,n=s(),i=n.length,o=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},Mi="TAKE",Ni="CALL",$i="FORK",Fi="SELECT",xi=function(e,t){var n;return(n={})[Hn]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Vi(e,t){return void 0===e&&(e="*"),di(e)?(ai(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),xi(Mi,{pattern:e})):yi(n=e)&&n[Yn]&&ai(t)&&di(t)?xi(Mi,{channel:e,pattern:t}):yi(e)?(ai(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),xi(Mi,{channel:e})):void 0;var n}function ji(e,t){return oi(t)&&(t=e,e=void 0),xi("PUT",{channel:e,action:t})}function Wi(e){var t=xi("ALL",e);return t.combinator=!0,t}function Ki(e,t){var n,i=null;return ri(e)?n=e:(si(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&li(n)&&ri(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function Gi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return xi(Ni,Ki(e,n))}function Bi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return xi($i,Ki(e,n))}function zi(e){return void 0===e&&(e=Xn),xi("CANCEL",e)}function qi(e){void 0===e&&(e=mi);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return xi(Fi,{selector:e,args:n})}var Hi=Gi.bind(null,pi);var Ji=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Yi=[],Qi=0;function Xi(e){try{to(),e()}finally{no()}}function Zi(e){Yi.push(e),Qi||(to(),io())}function eo(e){try{return to(),e()}finally{io()}}function to(){Qi++}function no(){Qi--}function io(){var e;for(no();!Qi&&void 0!==(e=Yi.shift());)Xi(e)}var oo=function(e){return function(t){return e.some((function(e){return co(e)(t)}))}},ao=function(e){return function(t){return e(t)}},ro=function(e){return function(t){return t.type===String(e)}},lo=function(e){return function(t){return t.type===e}},so=function(){return vi};function co(e){var t="*"===e?so:li(e)?ro:si(e)?oo:fi(e)?ro:ri(e)?ao:gi(e)?lo:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var uo={type:qn},yo=function(e){return e&&e.type===qn};function fo(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(uo)}))},(e={})[Yn]=!0,e.put=function(e){if(!t)if(yo(e))a();else for(var o=n=i,r=0,l=o.length;r<l;r++){var s=o[r];s[Jn](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=so),t?e(uo):(e[Jn]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Ai(i,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[Qn]?l(e):Zi((function(){l(e)}))},r}function go(e,t){var n=e[zn];ri(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var po,So=0,vo=function(){return++So};function ho(e){e.isRunning()&&e.cancel()}var mo=((po={}).TAKE=function(e,t,n){var i=t.channel,o=void 0===i?e.channel:i,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!yo(e)||r?n(e):n(ti)};try{o.take(l,ai(a)?co(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},po.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Zi((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&ci(t)?go(t,n):n(t)}))},po.ALL=function(e,t,n,i){var o=i.digestEffect,a=So,r=Object.keys(t);if(0!==r.length){var l=Di(t,n);r.forEach((function(e){o(t[e],a,l[e],e)}))}else n(si(t)?[]:{})},po.RACE=function(e,t,n,i){var o=i.digestEffect,a=So,r=Object.keys(t),l=si(t)?Li(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Ci(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=hi,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,s[e],e)}))},po.CALL=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,l=i.task;try{var s=a.apply(o,r);if(ci(s))return void go(s,n);if(ui(s))return void wo(e,s,l.context,So,Ri(a),!1,n);n(s)}catch(e){n(e,!0)}},po.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){oi(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},po.FORK=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,l=t.detached,s=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var o=n.apply(t,i);if(ui(o))return o;var a=!1;return Pi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!ci(o)})}))}catch(e){return Pi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Ri(t)}(c,a);eo((function(){var t=wo(e,c,s.context,So,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},po.JOIN=function(e,t,n,i){var o=i.task,a=function(e,t){if(e.isRunning()){var n={task:o,cb:t};t.cancel=function(){e.isRunning()&&Ai(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(si(t)){if(0===t.length)return void n([]);var r=Di(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},po.CANCEL=function(e,t,n,i){var o=i.task;t===Xn?ho(o):si(t)?t.forEach(ho):ho(t),n()},po.SELECT=function(e,t,n){var i=t.selector,o=t.args;try{n(i.apply(void 0,[e.getState()].concat(o)))}catch(e){n(e,!0)}},po.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Ui());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(uo):e.isEmpty()?(n.push(i),i.cancel=function(){Ai(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(uo):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(uo)}}}}(t.buffer),a=co(i),r=function t(n){yo(n)||e.channel.take(t,a),o.put(n)},l=o.close;o.close=function(){r.cancel(),l()},e.channel.take(r,a),n(o)},po.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},po.FLUSH=function(e,t,n){t.flush(n)},po.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},po.SET_CONTEXT=function(e,t,n,i){var o=i.task;bi(o.context,t),n()},po);function bo(e,t){return e+"?"+t}function Ao(e){var t=e.name,n=e.location;return n?t+" "+bo(n.fileName,n.lineNumber):t}function ko(e){var t,n,i,o=(t=function(e){return e.cancelledTasks},n=e,(i=[]).concat.apply(i,n.map(t)));return o.length?["Tasks cancelled due to error:"].concat(o).join("\n"):""}var To=null,Po=[],Io=function(e){e.crashedEffect=To,Po.push(e)},Lo=function(){To=null,Po.length=0},Oo=function(){var e,t,n=Po[0],i=Po.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=_i(e))?t.code+" "+bo(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Ao(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+Ao(e.meta)})),[ko(Po)]).join("\n")};function Eo(e,t,n,i,o,a,r){var l;void 0===r&&(r=hi);var s,c,u=0,d=null,y=[],f=Object.create(n),g=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,g.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){o.push(t),t.cont=function(l,s){a||(Ai(o,t),t.cont=hi,s?r(l):(t===e&&(i=l),o.length||(a=!0,n(i))))}}function s(){a||(a=!0,o.forEach((function(e){e.cont=hi,e.cancel()})),o=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return o}}}(t,0,p);function p(t,n){if(n){if(u=2,Io({meta:o,cancelledTasks:y}),S.isRoot){var i=Oo();Lo(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===ei?u=1:1!==u&&(u=3),s=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((l={})[Zn]=!0,l.id=i,l.meta=o,l.isRoot=a,l.context=f,l.joiners=[],l.queue=g,l.cancel=function(){0===u&&(u=1,g.cancelAll(),p(ei,!1))},l.cont=r,l.end=p,l.setContext=function(e){bi(f,e)},l.toPromise=function(){return d||(d=Ji(),2===u?d.reject(c):0!==u&&d.resolve(s)),d.promise},l.isRunning=function(){return 0===u},l.isCancelled=function(){return 1===u||0===u&&1===t.status},l.isAborted=function(){return 2===u},l.result=function(){return s},l.error=function(){return c},l);return S}function wo(e,t,n,i,o,a,r){var l=e.finalizeRunEffect((function(t,n,i){ci(t)?go(t,i):ui(t)?wo(e,t,c.context,n,o,!1,i):t&&t[Hn]?(0,mo[t.type])(e,t.payload,i,u):i(t)}));d.cancel=hi;var s={meta:o,cancel:function(){0===s.status&&(s.status=1,d(ei))},status:0},c=Eo(e,s,n,i,o,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var o;n?(o=t.throw(e),Lo()):wi(e)?(s.status=1,d.cancel(),o=ri(t.return)?t.return(ei):{done:!0,value:ei}):o=Ei(e)?ri(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==s.status&&(s.status=3),s.cont(o.value)):y(o.value,i,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,i,o){void 0===o&&(o="");var a,r=vo();function s(n,o){a||(a=!0,i.cancel=hi,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){To=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),s.cancel=hi,i.cancel=function(){a||(a=!0,s.cancel(),s.cancel=hi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function Co(e,t){for(var n=e.channel,i=void 0===n?fo():n,o=e.dispatch,a=e.getState,r=e.context,l=void 0===r?{}:r,s=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?Ii:u,y=arguments.length,f=new Array(y>2?y-2:0),g=2;g<y;g++)f[g-2]=arguments[g];var p,S=t.apply(void 0,f),v=vo();if(s&&(s.rootSagaStarted=s.rootSagaStarted||hi,s.effectTriggered=s.effectTriggered||hi,s.effectResolved=s.effectResolved||hi,s.effectRejected=s.effectRejected||hi,s.effectCancelled=s.effectCancelled||hi,s.actionDispatched=s.actionDispatched||hi,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Fe.apply(void 0,c);p=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else p=mi;var m={channel:i,dispatch:Oi(o),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:p};return eo((function(){var e=wo(m,S,l,v,Ri(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var Do=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?fo():a,l=n.sagaMonitor,s=ii(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Co.bind(null,I({},s,{context:o,channel:r,dispatch:i,getState:n,sagaMonitor:l})),function(e){return function(t){l&&l.actionDispatched&&l.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){bi(o,e)},c},Ro=function(e){return{done:!0,value:e}},_o={};function Uo(e){return yi(e)?"channel":fi(e)?String(e):ri(e)?e.name:String(e)}function Mo(e,t,n){var i,o,a,r=t;function l(t,n){if(r===_o)return Ro(t);if(n&&!o)throw r=_o,n;i&&i(t);var l=n?e[o](n):e[r]();return r=l.nextState,a=l.effect,i=l.stateUpdater,o=l.errorState,r===_o?Ro(t):a}return Pi(l,(function(e){return l(null,e)}),n)}function No(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:Vi(e)},l=function(e){return{done:!1,value:Bi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return Mo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Uo(e)+", "+t.name+")")}function $o(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,l={done:!1,value:Vi(e)},s=function(e){return{done:!1,value:Bi.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:zi(e)}},u=function(e){return a=e},d=function(e){return r=e};return Mo({q1:function(){return{nextState:"q2",effect:l,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:s(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:s(r),stateUpdater:u}}},"q1","takeLatest("+Uo(e)+", "+t.name+")")}function Fo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:Vi(e)},l=function(e){return{done:!1,value:Gi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return Mo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Uo(e)+", "+t.name+")")}function xo(e,t,n){for(var i=e,o=arguments.length,a=new Array(o>3?o-3:0),r=3;r<o;r++)a[r-3]=arguments[r];var l={done:!1,value:Gi.apply(void 0,[n].concat(a))},s={done:!1,value:Hi(t)};return Mo({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:_o}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function Vo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Bi.apply(void 0,[No,e,t].concat(i))}function jo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Bi.apply(void 0,[$o,e,t].concat(i))}function Wo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Bi.apply(void 0,[Fo,e,t].concat(i))}class Ko{constructor(){this.context=null,this.accessToken=null,this.user=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return Ko.instance||(Ko.instance=new Ko),Ko.instance}static setContext(e){Ko.getInstance().context=e}static setAccessToken(e){Ko.getInstance().accessToken=e}static setUser(e){Ko.getInstance().user=e}static setOnRedirectTo(e){Ko.getInstance().onRedirectTo=e}static setLogout(e,t){Ko.getInstance().logout=n=>{n?e(n):Ko.onRedirectTo(t)}}static getContext(){var e;return null!=(e=Ko.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Ko.getInstance().accessToken}static getUser(){return Ko.getInstance().user}static onRedirectTo(e,t){return Ko.getInstance().onRedirectTo(e,t)}static logout(e){return Ko.getInstance().logout(e)}}Ko.instance=void 0;const Go={getContext:()=>Ko.getContext(),getAccessToken:()=>Ko.getAccessToken(),getUser:()=>Ko.getUser(),onRedirectTo:(e,t)=>Ko.onRedirectTo(e,t),logout:e=>Ko.logout(e)};class Bo extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function zo(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}const qo=async e=>{var t,n,i;const o=Ko.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Ko.getAccessToken)(),o={};i&&(o.Authorization=`Bearer ${i}`),t&&(o["Content-Type"]=t);for(const t of await async function(e){let t=[];return e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),t}(e))o[`${t.key}`]=`${t.value}`;return o["x-frontegg-source"]="frontegg-react",o}(o,e.contentType),r=await async function(e,t,n){const i=zo(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),l=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:I({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===l.status)return window.location.href=await l.text(),new Promise((()=>{}));if(!l.ok){var s,c;if(413===l.status)throw new Bo("Error request is too large",l.status);let e;try{e=await l.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=o.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new Bo(e,l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},Ho=async(e,t,n)=>qo(I({url:e,method:"GET",contentType:"application/json",params:t},n)),Jo=async(e,t,n)=>qo(I({url:e,method:"POST",contentType:"application/json",body:t},n)),Yo=async(e,t,n)=>qo(I({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Qo=async(e,t,n)=>qo(I({url:e,method:"PUT",contentType:"application/json",body:t},n)),Xo=async(e,t,n)=>qo(I({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Zo=async(e,t,n,i)=>qo(I({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),ea={v1:"/identity/resources/users/webauthn/v1/devices"},ta={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},na={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}}},ia={v1:"/identity/resources/configurations/v1"},oa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},aa={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2"},ra={v1:"/identity/resources/permissions/v1"},la={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},invites:{user:{v1:"/identity/resources/tenants/invites/v1/user"},verify:{v1:"/identity/resources/tenants/invites/v1/verify"},configuration:{v1:"/identity/resources/tenants/invites/v1/configuration"}}},sa={v1:"/identity/resources/roles/v1"},ca={v1:"/identity/resources/sub-tenants/users/v1"},ua={v1:"/resources/impersonation/v1/impersonate"},da={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},ya={v1:"/team/resources/members/v1"},fa={v1:"/team/resources/roles/v1"},ga={v1:"/team/resources/stats/v1"},pa={v1:"/team/resources/profile"},Sa={v1:"/tenants/resources/account-settings/v1"},va={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},ha={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},ma={subscriptions:{v1:"/subscriptions/resources/billing/subscriptions/v1"},plans:{v1:"/subscriptions/resources/billing/plans/v1"},invoices:{v1:"/subscriptions/resources/billing/invoices/v1"},paymentMethods:{v1:"/subscriptions/resources/billing/payment-methods/v1"},summaries:{v1:"/subscriptions/resources/billing/summaries/v1"},tenantConfiguration:{v1:"/subscriptions/resources/billing/tenant-configurations/v1"},configurations:{vendorPublicConfigurations:{v1:"/subscriptions/resources/billing/configurations/vendor-public-configurations/v1"}},paymentProviders:{stripe:{customers:{v1:"/subscriptions/resources/billing/payment-providers/stripe/customers/v1"},publicConfigurations:{v1:"/subscriptions/resources/billing/payment-providers/stripe/public-configurations/v1"},subscriptions:{v1:"/subscriptions/resources/billing/payment-providers/stripe/subscriptions/v1"},setupIntents:{v1:"/subscriptions/resources/billing/payment-providers/stripe/setup-intents/v1"}}}},ba={v1:"/subscriptions/resources/payment-providers/v1"},Aa={v1:"/subscriptions/resources/subscriptions/v1"},ka={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Ta={v1:"/reports/engine/resources/triggers/v1"},Pa="/notification",Ia="/audits",La={v1:"/event/resources/configurations/v1"},Oa="/webhook",Ea="/oauth",wa="/flags",Ca="/directory/resources/v1/configurations/scim2",Da="/directory/resources/scim/temp";async function Ra(e){return Qo(`${na.v1}/tenant`,e)}async function _a(){return Ho(`${na.v2}/me/tenants`)}async function Ua(){return Ho(va.v1)}async function Ma(){return Ho(va.tree.v1)}async function Na(){return Ho(ia.v1)}async function $a(){return Ho(`${ia.v1}/mfa-policy`)}async function Fa(){return Ho(`${ia.v1}/mfa-policy/vendor`)}async function xa(e){return e.id?Yo(`${ia.v1}/mfa-policy`,e):Jo(`${ia.v1}/mfa-policy`,e)}async function Va(){return Ho(`${ia.v1}/lockout-policy`)}async function ja(e){return e.id?Yo(`${ia.v1}/lockout-policy`,e):Jo(`${ia.v1}/lockout-policy`,e)}async function Wa(){try{return await Ho(`${ia.v1}/captcha-policy/public`)}catch{return null}}async function Ka(){return Ho(`${ia.v1}/password-history-policy`)}async function Ga(e){return e.id?Yo(`${ia.v1}/password-history-policy`,e):Jo(`${ia.v1}/password-history-policy`,e)}async function Ba(){return Ho(`${ia.v1}/password`)}async function za(){return Ho(`${oa.emailDomain.v1}`)}async function qa(){return Ho(`${oa.emailDomain.v1}/config`)}async function Ha(e){return Jo(`${oa.emailDomain.v1}`,e)}async function Ja(e){return Jo(`${oa.emailDomain.v1}/config`,e)}async function Ya(e){return Xo(`${oa.emailDomain.v1}/${e}`)}async function Qa(e){return Ho(`${oa.ip.v1}`,e)}async function Xa(){return Ho(`${oa.ip.v1}/config`)}async function Za(e){return Jo(`${oa.ip.v1}`,e)}async function er(e){return Jo(`${oa.ip.v1}/bulk`,e)}async function tr(e){return Jo(`${oa.ip.v1}/config`,e)}async function nr(e){return Xo(`${oa.ip.v1}/${e}`)}async function ir(){return Jo(`${oa.ip.v1}/verify`)}async function or(){return Jo(`${oa.ip.v1}/verify/allow`)}let ar,rr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(ar||(ar={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(rr||(rr={}));class lr extends Error{constructor(e){super(e)}}const sr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new lr("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,i,o=0,a=0;i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?n+=String.fromCharCode(255&e>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};class cr extends Error{constructor(e){super(e)}}const ur=(e,t={})=>{const n=t.header?0:1;try{return JSON.parse((e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(e){return decodeURIComponent(sr(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return sr(t)}})(e.split(".")[n]))}catch(e){throw new cr("Invalid token specified: "+e.message)}},dr=["type"],yr=["type"];async function fr(e){if(!e.accessToken)return e;Ko.setAccessToken(e.accessToken);const t=await Ho(`${na.v2}/me`),n=I({},e,e.accessToken?ur(e.accessToken):{},t);return Ko.setUser(n),n}async function gr(e){if(!e.accessToken)return{user:e};Ko.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Ho(`${na.v2}/me`),_a()]),i=I({},e,e.accessToken?ur(e.accessToken):{},t);return Ko.setUser(i),{user:i,tenants:n}}async function pr(e){Ko.setAccessToken(e.id_token);const t=await Ho(`${na.v2}/me`),n=e.id_token?ur(e.id_token):{},i=I({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:n.exp?Math.ceil(n.exp-(new Date).getTime()/1e3):300});return Ko.setUser(i),i}async function Sr(e){try{const{address:t}=await Jo(`${ta.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function vr(e){return Jo(`${ta.v1}/user/saml/prelogin`,e)}async function hr(e){return fr(await Jo(`${ta.v1}/user/saml/postlogin`,e))}async function mr(e){return fr(await Jo(`${ta.v1}/user/oidc/postlogin`,e))}async function br(e){return fr(await Jo(`${ta.v1}/user`,e))}async function Ar(e){return fr(await Jo(`${ta.v1}/user/mfa/verify`,e))}async function kr(e){return Jo(`${na.v1}/activate`,e)}async function Tr(e){return Ho(`${na.v1}/activate/strategy`,e)}async function Pr(e){return Jo(`${na.v1}/activate/reset`,e)}async function Ir(e){return Jo(`${na.v1}/invitation/reset`,e)}async function Lr(e){return Jo(`${na.v1}/invitation/accept`,e)}async function Or(){return fr(await Jo(`${ta.v1}/user/token/refresh`))}async function Er(){return gr(await Jo(`${ta.v1}/user/token/refresh`))}async function wr(){return Jo(`${ta.v1}/logout`)}async function Cr(e){return Ho(`${Ea}/logout`,e)}async function Dr(e){return Jo(`${na.v1}/passwords/reset`,e)}async function Rr(e){return Jo(`${na.v1}/passwords/reset/verify`,e)}async function _r(e){return Ho(`${na.v1}/passwords/config`,e)}async function Ur(e){return Jo(`${ta.v1}/user/mfa/recover`,e)}async function Mr(){return Jo(`${na.v1}/mfa/enroll`)}async function Nr(){return Jo(`${na.v1}/mfa/authenticator/enroll`)}async function $r(e){return Jo(`${na.v1}/mfa/authenticator/enroll/verify`,e)}async function Fr(e){return Jo(`${na.v1}/mfa/sms/enroll`,e)}async function xr(e){return Jo(`${na.v1}/mfa/sms/enroll/verify`,e)}async function Vr(){return Jo(`${na.v1}/mfa/webauthn/enroll`)}async function jr(e){return Jo(`${na.v1}/mfa/webauthn/enroll/verify`,e)}async function Wr(e){return Jo(`${na.v1}/mfa/enroll/verify`,e)}async function Kr(e){return Jo(`${na.v1}/mfa/disable`,e)}async function Gr(e,t){return Jo(`${na.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Br(e){return Jo(`${na.v1}/mfa/sms/${e}/disable`)}async function zr(e,t){return Jo(`${na.v1}/mfa/sms/${e}/disable/verify`,t)}async function qr(e){return Jo(`${na.v1}/mfa/webauthn/${e}/disable`)}async function Hr(e,t){return Jo(`${na.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Jr(){return Ho(`${na.v1}/mfa/devices`)}async function Yr(e){return Jo(`${ta.v1}/user/mfa/authenticator/enroll`,e)}async function Qr(e){return Jo(`${ta.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Xr(e,t){return Jo(`${ta.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Zr(e){return Jo(`${ta.v1}/user/mfa/sms/enroll`,e)}async function el(e){return Jo(`${ta.v1}/user/mfa/sms/enroll/verify`,e)}async function tl(e,t){return Jo(`${ta.v1}/user/mfa/sms/${e}`,t)}async function nl(e,t){return Jo(`${ta.v1}/user/mfa/sms/${e}/verify`,t)}async function il(e){return Jo(`${ta.v1}/user/mfa/webauthn/enroll`,e)}async function ol(e){return Jo(`${ta.v1}/user/mfa/webauthn/enroll/verify`,e)}async function al(e,t){return Jo(`${ta.v1}/user/mfa/webauthn/${e}`,t)}async function rl(e,t){return Jo(`${ta.v1}/user/mfa/webauthn/${e}/verify`,t)}async function ll(){return Ho(`${da.v1}/saml/configurations`)}async function sl(e){return Jo(`${da.v1}/saml/configurations`,e)}async function cl(){return Ho(`${da.v1}/saml/configurations/vendor-config`)}async function ul(e){return Qo(`${da.v1}/saml/configurations/metadata`,e)}async function dl(){return Qo(`${da.v1}/saml/validations/domain`)}async function yl(){return Ho(`${da.v1}/saml/configurations/roles/default`)}async function fl(){return Ho(`${da.v2}/saml/configurations/groups`)}async function gl({roleIds:e}){return Jo(`${da.v1}/saml/configurations/roles/default`,{roleIds:e})}async function pl({roleIds:e,group:t}){return Jo(`${da.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Sl({roleIds:e,group:t,id:n}){return Yo(`${da.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function vl({id:e}){return Xo(`${da.v2}/saml/configurations/groups/${e}`)}async function hl(){return Ho(`${da.v1}/oidc/configurations`)}async function ml(){return Ho(`${da.v2}/configurations/public`)}async function bl(){return Ho(aa.v1)}async function Al(){return Ho(aa.v2)}async function kl({provider:e,code:t,idToken:n,redirectUri:i,codeVerifier:o,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),i&&(s.redirectUri=i),o&&(s.code_verifier=o),l&&(s.state=l),Jo(`${ta.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function Tl(){return Ho(`${ia.v1}/public`)}async function Pl(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Jo(`${na.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await fr(n):void 0,userId:i,tenantId:o}}async function Il(){return Ho(na.sessions.currentUser.v1)}async function Ll(){return Ho(`${na.sessions.currentUser.v1}/current`)}async function Ol(e){return Jo(`${na.sessions.v1}/revoke`,{userId:e})}async function El(){return Ho(na.sessions.configurations.v1)}async function wl(e){await Jo(na.sessions.configurations.v1,e)}async function Cl(e){await Xo(`${na.sessions.currentUser.v1}/${e}`)}async function Dl(){await Xo(`${na.sessions.currentUser.v1}/all`)}async function Rl(){return Ho(na.apiTokens.v1)}async function _l(){return Ho(la.apiTokens.v1)}async function Ul(e){return Jo(na.apiTokens.v1,e)}async function Ml(e){return Jo(la.apiTokens.v2,e)}async function Nl({tokenId:e}){return Xo(`${la.apiTokens.v1}/${e}`)}async function $l({tokenId:e}){return Xo(`${na.apiTokens.v1}/${e}`)}async function Fl({userId:e}){return Ho(`${na.v1}/${e}`)}async function xl(e){return Ho(`${ia.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Vl(e){let{type:t}=e,n=ii(e,dr);return Jo(`${ta.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function jl(e){let{type:t}=e,n=ii(e,yr);return Jo(`${ta.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Wl({token:e}){return Jo(la.invites.verify.v1,{token:e})}async function Kl(){return Ho(`${da.v1}/configurations`)}async function Gl(e){return Jo(`${da.v1}/configurations`,e)}async function Bl(e,t){return Yo(`${da.v1}/configurations/${e}`,t)}async function zl(e){return Xo(`${da.v1}/configurations/${e}`)}async function ql(e){return Jo(`${da.v1}/configurations/metadata`,e)}async function Hl(e,t){return Qo(`${da.v1}/configurations/${e}/metadata`,t)}async function Jl(e,t){return Jo(`${da.v1}/configurations/${e}/domains`,t)}async function Yl(e,t){return Xo(`${da.v1}/configurations/${e}/domains/${t}`)}async function Ql(e,t){return Qo(`${da.v1}/configurations/${e}/domains/${t}/validate`)}async function Xl(e){return Ho(`${da.v1}/configurations/${e}/roles`)}async function Zl(e,t){return Qo(`${da.v1}/configurations/${e}/roles`,t)}async function es(e,t){return Jo(`${da.v1}/configurations/${e}/groups`,t)}async function ts(e,{roleIds:t,group:n,id:i}){return Yo(`${da.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function ns(e,t){return Xo(`${da.v1}/configurations/${e}/groups/${t}`)}async function is(e){return Ho(`${da.v1}/configurations/${e}/groups`)}async function os(e){return Jo(`${ta.v2}/user/sso/prelogin`,e)}async function as(e){return fr(await Jo(`${ta.v2}/user/oidc/postlogin`,e))}async function rs(e){return pr(await Jo(`${Ea}/token`,e))}async function ls(){return pr(await Jo(`${Ea}/authorize/silent`))}async function ss(e){return Jo(`${na.v1}/phone/reset`,e)}async function cs(e){return Jo(`${na.v1}/phone/reset/verify`,e)}async function us(e){return Jo(`${na.v1}/phone`,e)}async function ds(e){return Jo(`${na.v1}/phone/verify`,e)}async function ys(e){return Qo(`${na.v1}/phone/change`,e)}async function fs(e){return Jo(`${ta.v1}/webauthn/prelogin`,e)}async function gs(e){return Jo(`${ta.v1}/webauthn/postlogin`,e)}async function ps(){return Jo(ea.v1)}async function Ss(e){return Jo(`${ea.v1}/verify`,e)}async function vs(){return Ho(`${ia.v1}/auth/strategies/public`)}async function hs(){return Ho(`${ia.v1}/mfa/strategies`)}async function ms(e){return Ho(`${na.v2}/me`,null!=e?e:{addRoles:!0})}async function bs(e){return Qo(`${na.v2}/me`,e)}async function As(e){return Qo(`${pa.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function ks(e){return Jo(`${na.v1}/passwords/change`,e)}async function Ts(e){var t,n,i,o,a,r;const l=(e.filter||[]).reduce(((e,t)=>I({},e,{[t.id]:t.value})),{}),s=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(i=e.sort)||null==(o=i[0])?void 0:o.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return Ho(ya.v1,I({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function Ps(e){return Jo(na.v2,I({},e,{provider:"local"}))}async function Is(e){return Xo(`${ya.v1}/${e.userId}`)}async function Ls(e){return Qo(ya.v1,e)}async function Os(e){return Jo(la.invites.user.v1,I({},e))}async function Es(e){return Yo(la.invites.user.v1,I({},e))}async function ws(){return Xo(la.invites.user.v1)}async function Cs(){return Ho(la.invites.user.v1)}async function Ds(){return Ho(la.invites.configuration.v1)}async function Rs(){return Ho(fa.v1)}async function _s(){return Ho(ra.v1)}async function Us(){return Ho(`${ga.v1}/members`)}async function Ms(e){return Jo(`${ya.v1}/${e.userId}/resendActivationEmail`,{})}async function Ns(e){return Jo(na.v2,I({},e,{provider:"local"}))}async function $s(e){return Jo(na.invitation.resendAll.v1,I({},e))}async function Fs(e){var t,n;const i=await Ho("/metadata",e);if(null!=i&&null!=(t=i.rows)&&t[0])return null==i||null==(n=i.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function xs(){const e=await Ho("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Vs=async()=>Fs({entityName:"notifications"}),js=async()=>Fs({entityName:"saml"}),Ws=async()=>Fs({entityName:"audits"}),Ks=async e=>async function(e){const t=await Ho(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Gs=["dataFilters"],Bs=["templateId","dataFilters"],zs=["dataFilters"];async function qs(e){return Ho(`${ka.v2}/tenant-reports`,e)}async function Hs(e){return Ho(`${ka.v2}/${e.id}/tenant-reports`)}async function Js(e){let{dataFilters:t}=e,n=ii(e,Gs);return{html:await Ho(`${Ta.v1}/preview-report`,I({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Ys(e){let{templateId:t,dataFilters:n}=e,i=ii(e,Bs);return Jo(`${ka.v2}/${t}/tenant-reports`,I({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Qs(e){let{dataFilters:t}=e,n=ii(e,zs);const i=await Ho(`${Ta.v1}/preview-report`,I({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),l=URL.createObjectURL(r),s=document.createElement("a");s.href=l,s.setAttribute("download",`report_${n.name||""}.${a}`),s.click(),setTimeout(s.remove.bind(s))}async function Xs(e){return Jo(`${Ta.v1}/tenant-reports`,e)}async function Zs(e){return Ho(Pa,{params:e})}async function ec(e){return Qo(`${Pa}/status`,{params:e})}async function tc(e){const{notificationId:t,pinStatus:n}=e;return Qo(`${Pa}/${n}`,{notificationId:t})}async function nc(){return Jo(`${Pa}/status/mark-all-read`)}const ic=["endpoint","headerProps"];async function oc(e){return Ho(Ia,e)}async function ac(e){return Ho(`${Ia}/stats`,e)}async function rc(e){const{endpoint:t,headerProps:n}=e,i=ii(e,ic);return Zo(`${Ia}/export/${t}`,{properties:n},i)}const lc=["eventKey"],sc=["eventKey"],cc=()=>Ho(`${ha.v1}/slack`),uc=()=>Ho(`${ha.v1}/slack/applications`),dc=()=>Ho(`${ha.v1}/slack/channels`),yc=e=>e.id?Yo(`${ha.v1}/slack/subscription/${e.id}`,e):Jo(`${ha.v1}/slack/subscriptions`,e),fc=e=>Xo(`${ha.v1}/slack/subscriptions/${e.id}`),gc=e=>Jo(`${ha.v1}/slack/applications/registrations`,{code:e}),pc=()=>Ho(`${ha.v1}/emails`),Sc=e=>{let{eventKey:t}=e,n=ii(e,lc);return Jo(`${ha.v1}/emails/${t}`,n)},vc=({eventKey:e,enabled:t})=>Yo(`${ha.v1}/emails/${e}`,{enabled:t}),hc=(e,t)=>Xo(`${ha.v1}/emails/${e}/subscriptions/${t}`),mc=(e,t,n)=>Qo(`${ha.v1}/emails/${t}/subscriptions/${e}`,n),bc=e=>Xo(`${ha.v1}/emails/${e}`),Ac=()=>Ho(`${ha.v2}/sms`),kc=e=>{let{eventKey:t}=e,n=ii(e,sc);return Jo(`${ha.v2}/sms/${t}`,n)},Tc=({eventKey:e,enabled:t})=>Yo(`${ha.v2}/sms/${e}`,{enabled:t}),Pc=(e,t)=>Xo(`${ha.v2}/sms/${e}/subscriptions/${t}`),Ic=(e,t,n)=>Qo(`${ha.v2}/sms/${t}/subscriptions/${e}`,n),Lc=e=>Xo(`${ha.v2}/sms/${e}`),Oc=()=>Ho(Oa),Ec=e=>e._id?Yo(`${Oa}/${e._id}`,e):Jo(`${Oa}/custom`,e),wc=e=>Xo(`${Oa}/${e}`),Cc=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Ho(`${Oa}/logs/?${i.toString()}`)},Dc=e=>Jo(`${Oa}/test`,e),Rc=e=>Jo(`${Oa}/logs/${e}/retries`),_c=()=>Ho(`${La.v1}/categories`),Uc=e=>Ho(La.v1,{channels:e});async function Mc(e){return Qo(Sa.v1,e)}async function Nc(){return Ho(Sa.v1)}const $c=["roleId"],Fc=["roleId"],xc=["permissionId"];async function Vc(){return Ho(sa.v1)}async function jc(e){return Jo(sa.v1,e)}async function Wc({roleId:e}){return Xo(`${sa.v1}/${e}`)}async function Kc(e){let{roleId:t}=e,n=ii(e,$c);return Yo(`${sa.v1}/${t}`,n)}async function Gc(e){let{roleId:t}=e,n=ii(e,Fc);return Qo(`${sa.v1}/${t}/permissions`,n)}async function Bc(){return Ho(ra.v1)}async function zc(e){let{permissionId:t}=e,n=ii(e,xc);return Qo(`${ra.v1}/${t}/roles`,n)}async function qc(){return Ho(`${ra.v1}/categories`)}async function Hc(){return Ho(ma.subscriptions.v1)}async function Jc(e){return Ho(`${ma.subscriptions.v1}/${e}`)}async function Yc(e){return Qo(`${ma.subscriptions.v1}/${e}/cancellations/`,{})}async function Qc(e){return Qo(`${ma.subscriptions.v1}/${e}/renewals/`,{})}async function Xc(e,{paymentMethodId:t,planId:n}){return Qo(`${ma.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Zc(e){return Ho(`${Aa.v1}/${e}`)}async function eu(){return Ho(`${Aa.v1}`)}async function tu(e){return Qo(`${Aa.v1}/${e}/cancellations/`,{})}async function nu(e){return Qo(`${Aa.v1}/${e}/renewals/`,{})}async function iu(e,{paymentMethodId:t,planId:n}){return Qo(`${Aa.v1}/${e}`,{paymentMethodId:t,planId:n})}async function ou(){return Ho(ma.plans.v1)}async function au(e){return Ho(`${ma.plans.v1}/${e}`)}async function ru(){return Ho(ma.invoices.v1)}async function lu(e){return Ho(`${ma.invoices.v1}/${e}`)}async function su(e,t){return Ho(`${ma.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const cu=["email"];async function uu(){return Ho(ma.paymentMethods.v1)}async function du(e){return Ho(`${ma.paymentMethods.v1}/${e}`)}async function yu(e,t){let{email:n}=t,i=ii(t,cu);return Yo(`${ma.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function fu(e){return Jo(ma.paymentProviders.stripe.subscriptions.v1,e)}async function gu(e){return Ho(`${ma.paymentProviders.stripe.customers.v1}/${e}`)}async function pu(e){return Jo(`${ma.paymentProviders.stripe.customers.v1}`,e)}async function Su(){return Ho(`${ma.paymentProviders.stripe.publicConfigurations.v1}`)}async function vu(e){return Jo(`${ma.paymentProviders.stripe.setupIntents.v1}`,e)}async function hu(e){return Ho(`${ma.summaries.v1}/${e}`)}async function mu(e){return Ho(`${ma.tenantConfiguration.v1}/${e}`)}async function bu(e){return Jo(`${ma.tenantConfiguration.v1}`,e)}async function Au(){return Ho(ba.v1)}async function ku(){return Ho(`${ma.configurations.vendorPublicConfigurations.v1}`)}let Tu,Pu,Iu,Lu,Ou,Eu,wu,Cu,Du,Ru,_u;async function Uu(){return Ho("/vendors/public")}async function Mu(e){return Ho(ca.v1,e)}async function Nu(e){return Jo(ca.v1,e)}async function $u(e){return Xo(ca.v1,e)}async function Fu(e,t){return Jo(`${ca.v1}/${e}/roles`,t)}async function xu(e,t){return Xo(`${ca.v1}/${e}/roles`,t)}async function Vu(e,t){return Yo(`${ca.v1}/${e}/roles`,t)}async function ju(){return Ho(wa)}async function Wu(){return Ho(`${Ca}`)}async function Ku(e,t){return Yo(`${Ca}/${e}`,t)}async function Gu(e){return Jo(`${Ca}`,e)}async function Bu(e){return Xo(`${Ca}/${e}`)}async function zu(e){return Ho(`${Da}/${e}/Users/count`)}async function qu(e){return Jo(`${ua.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Tu||(Tu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Pu||(Pu={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Iu||(Iu={})),(Lu||(Lu={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Ou||(Ou={})),function(e){e.CREATE="create_customer"}(Eu||(Eu={})),function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode"}(wu||(wu={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Cu||(Cu={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Du||(Du={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Ru||(Ru={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(_u||(_u={}));const Hu=[`${ta.v1}/logout`,`${ta.v1}/user/saml/postlogin`,`${ta.v2}/user/oidc/postlogin`,`${ta.v1}/user`,`${ta.v1}/user/mfa/verify`,`${ta.v1}/user/token/refresh`,`${na.v1}`,`${na.v1}/signUp`,`${ta.v1}/passwordless/magiclink/postlogin`,`${ta.v1}/passwordless/code/postlogin`,`${ta.v1}/passwordless/smscode/postlogin`,`${na.v1}/activate`,`${na.v1}/invitation/accept`,`${Ea}/token`,`${Ea}/authorize/silent`],Ju=`${ta.v1}/user/token/refresh`,Yu=`${Ea}/authorize/silent`,Qu=`${na.v2}/me`,Xu=`${na.v2}/me/tenants`;let Zu;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Zu||(Zu={}));const ed={auth:o,teams:a,metadata:r,reports:l,connectivity:u,notifications:s,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:g,subTenants:p,featureFlags:S,directory:v,impersonate:h};var td={fetch:e,ContextHolder:Ko,FronteggContext:Go,api:ed,FronteggApiError:Bo,AuthStrategyEnum:rr,SocialLoginProviders:ar,ISubscriptionCancellationPolicy:Iu,ISubscriptionStatus:Tu,PaymentMethodType:Pu,ProviderType:Lu};let nd,id;function od(e,t){const n=I({},e);return t.forEach((e=>{delete n[e]})),n}async function ad(e){const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function rd(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(e){e.LOAD_SSO_CONFIGURATIONS="LOAD_SSO_CONFIGURATIONS",e.SAVE_SSO_CONFIGURATION="SAVE_SSO_CONFIGURATION",e.UPDATE_SSO_CONFIGURATION="UPDATE_SSO_CONFIGURATION",e.SAVE_SSO_CONFIGURATION_BY_METADATA="SAVE_SSO_CONFIGURATION_BY_METADATA",e.UPDATE_SSO_CONFIGURATION_BY_METADATA="UPDATE_SSO_CONFIGURATION",e.DELETE_SSO_CONFIGURATION="DELETE_SSO_CONFIGURATION",e.SAVE_SSO_DOMAIN="SAVE_SSO_DOMAIN",e.DELETE_SSO_DOMAIN="DELETE_SSO_DOMAIN",e.VALIDATE_SSO_DOMAIN="VALIDATE_SSO_DOMAIN",e.UPDATE_SSO_DEFAULT_ROLES="UPDATE_SSO_DEFAULT_ROLES",e.DELETE_SSO_GROUPS="DELETE_SSO_GROUPS",e.SAVE_SSO_GROUPS="SAVE_SSO_GROUPS",e.GET_SSO_AUTHORIZATION_ROLES="GET_SSO_AUTHORIZATION_ROLES"}(nd||(nd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(id||(id={}));const ld=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n})),sd={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},cd=I({},sd,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),ud={id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!0,profileImage:void 0,profilePictureUrl:"https://www.gravatar.com/avatar/42b2ad2bad6fc9b9db5086dfcf8072ac?d=https://ui-avatars.com/api/fe/128/random?t=1617261890875?t=1617261917434",roles:[{id:"roleId",key:"admin",isDefault:!1,name:"Admin",description:null,permissions:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",key:"fe.*",name:"General Admin",description:void 0,categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),roleIds:void 0,verified:void 0},dd=I({},ud,{accessToken:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MTY5YmY0Zi02YmI5LTQ5NGMtOGNkZS05MDc4NDQ0NWY4MDciLCJuYW1lIjoiRHVtbXkgVXNlciIsImVtYWlsIjoiZHVtbXlAZnJvbnRlZ2cuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsIm1ldGFkYXRhIjp7fSwicm9sZXMiOlsiYWRtaW4iXSwicGVybWlzc2lvbnMiOlsiZmUuKiJdLCJ0ZW5hbnRJZCI6Im15LXRlbmFudC1pZCIsInRlbmFudElkcyI6WyJteS10ZW5hbnQtaWQiXSwicHJvZmlsZVBpY3R1cmVVcmwiOiJodHRwczovL3d3dy5ncmF2YXRhci5jb20vYXZhdGFyLzQyYjJhZDJiYWQ2ZmM5YjlkYjUwODZkZmNmODA3MmFjP2Q9aHR0cHM6Ly91aS1hdmF0YXJzLmNvbS9hcGkvZmUvMTI4L3JhbmRvbT90PTE2MTcyNjE4OTA4NzU_dD0xNjE3MjYxOTE3NDM0IiwidHlwZSI6InVzZXJUb2tlbiIsImlhdCI6MTYxNzkwNjMyNCwiZXhwIjoxNjE3OTkyNzI0LCJpc3MiOiJmcm9udGVnZyJ9.paaXLkpWEWbQmUtoK2P8IwXCxK4WJp7XhXonvzF8g1I",expiresIn:86400,mfaRequired:!1,refreshToken:"refresh-token-dummy-de39dc9c-9d22-4852-b7f5-c3c0aa613b58",type:"userToken",iat:1617906324,exp:1617992724,iss:"frontegg",email_verified:!0}),yd={loading:!1,error:void 0,saving:!0,profile:ud},fd={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date,allowOverrideEnforcePasswordHistory:!0,allowOverridePasswordComplexity:!1,allowOverridePasswordExpiration:!1,allowSignups:!0,apiTokensEnabled:!0,cookieSameSite:"cookieSameSite",defaultRefreshTokenExpiration:0,defaultTokenExpiration:1,publicKey:"publicKey"},gd={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:rr.EmailAndPassword},pd={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Sd={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},vd={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},hd={enabled:!0,domain:"domain",validated:!0,generatedVerification:"generatedVerification",ssoEndpoint:"ssoEndpoint",publicCertificate:"publicCertificate",signRequest:!0,createdAt:new Date,updatedAt:new Date,acsUrl:void 0,spEntityId:void 0,oidcClientId:void 0,oidcSecret:void 0,type:void 0},md={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},bd=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Ad={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:hd,roles:bd,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},kd=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Td={id:"id2",email:"demo-user2@frontegg.com",name:"Demo User Name2",phone:void 0,profileImage:void 0,profileImageUrl:void 0,tenantId:"tenantId",vendorId:"vendorId",roleIds:[],activatedForTenant:!0,verified:!1,createdAt:(new Date).toISOString(),customData:void 0,lastLogin:void 0,mfaEnabled:void 0,roles:[]},Pd={id:"id",email:"demo-user@frontegg.com",name:"Demo User Name",phone:void 0,profileImage:void 0,profileImageUrl:void 0,tenantId:"tenantId",vendorId:"vendorId",roleIds:[],activatedForTenant:!0,createdAt:new Date(2022,4,1).toISOString(),verified:!0,customData:void 0,lastLogin:new Date(2022,5,25).toISOString(),mfaEnabled:void 0,roles:[]},Id={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Ld=[Pd,Td],Od=[Id],Ed=[{id:"my-tenant-id",isReseller:!1,name:"Frontegg demo",deletedAt:null,metadata:void 0,tenantId:"my-tenant-id",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date,address:void 0,timezone:void 0,dateFormat:void 0,timeFormat:void 0,currency:void 0,logo:void 0}],wd=[{id:"laptop",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15",createdAt:new Date,ipAddress:"190.194.88.251",current:!0},{id:"iphone",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Mobile/15E148 Safari/604.1",createdAt:new Date(Date.now()-1e4),ipAddress:"191.49.203.21"},{id:"tablet",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; SGP771 Build/32.2.A.0.253; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.98 Safari/537.36",createdAt:new Date(Date.now()-3e4),ipAddress:"130.19.196.136"},{id:"anotherlaptop",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15",createdAt:new Date(Date.now()-1002232300),ipAddress:"2.228.163.92"}],Cd={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Dd={isActive:!0,strategy:_n.ALLOW},Rd=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:_n.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:_n.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:_n.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:_n.BLOCK,description:"IP 4"}];let _d,Ud,Md;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(_d||(_d={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Ud||(Ud={})),function(e){e.profile="profile",e.privacy="privacy",e.personalApiTokens="personalApiTokens",e.account="account",e.users="users",e.security="security",e.sso="sso",e.audits="audits",e.webhooks="webhooks",e.apiTokens="apiTokens",e.roles="roles",e.subscriptions="subscription"}(Md||(Md={})),Md.profile,Md.privacy,Md.personalApiTokens,Md.account,Md.users,Md.security,Md.sso,Md.audits,Md.webhooks,Md.apiTokens,Md.roles,Md.subscriptions;const Nd=["events","url"];function*$d(){yield ji(Gn.setSignUpState({loading:!0}));try{const e=yield Gi(ed.auth.getVendorConfig),{allowSignups:t,allowNotVerifiedUsersLogin:n}=e;yield ji(Gn.setSignUpState({loading:!1,allowSignUps:t,allowNotVerifiedUsersLogin:n,firstLoad:!1})),yield ji(Gn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*Fd(e){let{payload:{events:t,url:n}}=e,i=ii(e.payload,Nd);yield ji(Gn.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield qi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield Gi(ed.auth.signUpUser,i);if(!i.invitationToken){var o;const{email:e,name:a,companyName:r}=i;null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:Ud.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(Ko.setAccessToken(null==l?void 0:l.accessToken),Ko.setUser(l),!r&&l&&zy(l)){const t=yield Jy(l);yield ji(Gn.setState(t)),a(e.loginUrl)}else yield ji(Gn.setSignUpState({loading:!1,shouldActivate:r,stage:sn.SignUpSuccess})),yield ji(Gn.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield ji(Gn.loadTenants()))}catch(e){Ko.setAccessToken(null),Ko.setUser(null),yield ji(Gn.setSignUpState({loading:!1,error:e.message}))}yield ji(Gn.setSignUpState({loading:!1}))}function*xd(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield qi((e=>e.auth.signUpState));yield ji(Gn.resetSignUpState()),yield ji(Gn.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Vd(){yield Wo(Gn.signUpUser,Fd),yield Wo(Gn.resetSignUpStateSoft,xd)}const jd={setVendorState:(e,{payload:t})=>I({},e,t)},Wd={loadVendorPublicInfo:it("vendor/loadVendorPublicInfo")},Kd={loading:!1},{reducer:Gd,actions:Bd}=at({name:It,initialState:Kd,reducers:I({},jd)}),zd=I({},Bd,Wd);function*qd(){yield ji(zd.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield ed.vendor.getVendorPublicInfo();yield ji(zd.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield ji(zd.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Hd=["callback"],Jd=["callback"],Yd=["callback"],Qd=["callback"],Xd=["callback"],Zd=["callback"];function*ey(){yield ji(Gn.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getGlobalSecurityPolicy);yield ji(Gn.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield ji(Gn.loadSecurityPolicyMfa()),yield ji(Gn.loadSecurityPolicyVendorMfa()),yield ji(Gn.loadSecurityPolicyLockout()),yield ji(Gn.loadSecurityPolicyCaptcha()),yield ji(Gn.loadPublicAuthStrategiesPolicy())}function*ty(){yield ji(Gn.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getVendorConfig);yield ji(Gn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*ny(){yield ji(Gn.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getVendorPublicAuthStrategiesConfig);yield ji(Gn.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*iy(){yield ji(Gn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getMfaPolicy);yield ji(Gn.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*oy(){yield ji(Gn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getVendorMfaPolicy);yield ji(Gn.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*ay(e){let{payload:{callback:t}}=e,n=ii(e.payload,Hd);yield ji(Gn.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Gi(ed.auth.saveMfaPolicy,n);yield ji(Gn.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*ry(){yield ji(Gn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getLockoutPolicy);yield ji(Gn.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*ly(e){let{payload:{callback:t}}=e,n=ii(e.payload,Jd);yield ji(Gn.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Gi(ed.auth.saveLockoutPolicy,n);yield ji(Gn.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*sy(){yield ji(Gn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getCaptchaPolicy);yield ji(Gn.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*cy(){yield ji(Gn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getPasswordHistoryPolicy);yield ji(Gn.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*uy(e){let{payload:{callback:t}}=e,n=ii(e.payload,Yd);yield ji(Gn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Gi(ed.auth.savePasswordHistoryPolicy,n);yield ji(Gn.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*dy(){yield ji(Gn.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getPasswordConfigPolicy);yield ji(Gn.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*yy(){yield Wo(Gn.loadSecurityPolicy,ey),yield Vo(Gn.saveSecurityPolicyMfa,ay),yield Vo(Gn.loadSecurityPolicyMfa,iy),yield Vo(Gn.loadSecurityPolicyVendorMfa,oy),yield Vo(Gn.saveSecurityPolicyLockout,ly),yield Vo(Gn.loadSecurityPolicyLockout,ry),yield Vo(Gn.loadSecurityPolicyCaptcha,sy),yield Vo(Gn.saveSecurityPolicyPasswordHistory,uy),yield Vo(Gn.loadSecurityPolicyPasswordHistory,cy),yield Vo(Gn.loadVendorPasswordConfig,dy),yield Vo(Gn.loadPublicSecurityPolicy,ty),yield Vo(Gn.loadPublicAuthStrategiesPolicy,ny)}function*fy(){yield ji(Gn.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield ji(Gn.setSecurityPolicyPublicState({policy:gd,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*gy(){yield ji(Gn.setSecurityPolicyGlobalState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyGlobalState({policy:fd,loading:!1})),yield ji(Gn.loadSecurityPolicyMfa()),yield ji(Gn.loadSecurityPolicyVendorMfa()),yield ji(Gn.loadSecurityPolicyLockout()),yield ji(Gn.loadSecurityPolicyCaptcha())}function*py(){yield ji(Gn.setSecurityPolicyMfaState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyMfaState({policy:pd,loading:!1}))}function*Sy(){yield ji(Gn.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyVendorMfaState({policy:pd,loading:!1}))}function*vy(e){var t;let{payload:{callback:n}}=e,i=ii(e.payload,Qd);yield ji(Gn.setSecurityPolicyMfaState({saving:!0,error:null}));const o=I({},Sd,{id:null!=(t=i.id)?t:Sd.id,enforceMFAType:i.enforceMFAType});yield yt(),yield ji(Gn.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*hy(){yield ji(Gn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyLockoutState({policy:Sd,loading:!1}))}function*my(e){let{payload:{callback:t}}=e,n=ii(e.payload,Xd);yield ji(Gn.setSecurityPolicyLockoutState({saving:!0,error:null})),yield yt();const i=I({},n,Sd,{id:n.id?n.id:Sd.id});null==t||t(i),yield ji(Gn.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*by(){yield ji(Gn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyLockoutState({policy:Sd,loading:!1}))}function*Ay(){yield ji(Gn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyPasswordHistoryState({policy:vd,loading:!1}))}function*ky(e){let{payload:{callback:t}}=e,n=ii(e.payload,Zd);yield ji(Gn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield yt();const i=I({},n,vd,{id:n.id?n.id:vd.id});null==t||t(i),yield ji(Gn.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*Ty(){yield Wo(Gn.loadSecurityPolicy,gy),yield Vo(Gn.loadPublicSecurityPolicy,fy),yield Vo(Gn.saveSecurityPolicyMfa,vy),yield Vo(Gn.loadSecurityPolicyMfa,py),yield Vo(Gn.loadSecurityPolicyVendorMfa,Sy),yield Vo(Gn.saveSecurityPolicyLockout,my),yield Vo(Gn.loadSecurityPolicyLockout,hy),yield Vo(Gn.loadSecurityPolicyCaptcha,by),yield Vo(Gn.saveSecurityPolicyPasswordHistory,ky),yield Vo(Gn.loadSecurityPolicyPasswordHistory,Ay)}const Py=["callback"],Iy=["callback"],Ly=["callback"],Oy=["callback"],Ey=["callback","events"],wy=["callback"],Cy=["callback"],Dy=["callback"],Ry=["callback"],_y=["callback"],Uy=["callback"],My=["callback"],Ny=["callback"],$y=["callback"],Fy=["callback","deviceId"],xy=["callback","deviceId"],Vy=["callback","deviceId"],jy=["callback","deviceId"],Wy={[rr.Code]:vt.loginWithOtc,[rr.EmailAndPassword]:vt.loginWithPassword,[rr.MagicLink]:vt.magicLinkPreLoginSuccess,[rr.SmsCode]:vt.loginWithSmsOtc};function*Ky(){var e;const t=Ko.onRedirectTo,{routes:n,includeQueryParam:i}=yield qi((e=>e.auth)),{loginUrl:o,logoutUrl:a,socialLoginCallbackUrl:r,activateUrl:l}=n;let{authenticatedUrl:s}=n;const c=window.localStorage.getItem(bt);c&&![o,a,r,l].includes(c)&&(s=c),window.localStorage.removeItem(bt),yield Hi(200),ji(Gn.resetLoginState());const u=new URL(null==(e=window)?void 0:e.location.href);let d=s;var y;u.searchParams.get("redirectUrl")?d=null!=(y=u.searchParams.get("redirectUrl"))?y:s:i&&(d+=window.location.search),t(d,{refresh:d.startsWith("http")})}function*Gy(){let e;try{var t;const n=yield Gi(ed.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield ji(Gn.setState({ssoACS:e}))}function*By(){try{const{isActive:e}=yield Gi(ed.auth.getSSOPublicConfiguration);yield ji(Gn.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const zy=e=>e.mfaRequired&&e.mfaToken?(Ko.setAccessToken(null),Ko.setUser(null),!0):(Ko.setAccessToken(e.accessToken),Ko.setUser(e),!1),qy=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return Qt.authenticatorApp;if(t)return Qt.smsVerifyCode}return Qt.verify},Hy=e=>{if(1===e.length){const[t]=e;if(t===Du.AuthenticatorApp)return Qt.authenticatorApp;if(t===Du.SMS)return Qt.smsSetPhoneNumber}return Qt.verify};function*Jy(e){let t=vt.loginWithTwoFactor,n={};const{loginState:i}=yield qi((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield Gi(ed.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:qy(e.mfaDevices)}:(n={step:Hy(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=vt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:ht.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:I({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a})}}function*Yy(){const{hostedLoginBox:e}=yield qi((e=>e.auth));e?yield Gi(Qy):yield Gi(Xy)}function*Qy(){const{user:e}=yield qi((e=>e.auth));if(null==e||!e.refreshToken)return Ko.setAccessToken(null),Ko.setUser(null),void(yield ji(Gn.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Gi(ed.auth.exchangeOAuthTokens,t);yield ji(Gn.setState({user:n,isAuthenticated:!0})),yield ji(Gn.loadTenants())}catch(e){Ko.setAccessToken(null),Ko.setUser(null),yield ji(Gn.setState({user:null,isAuthenticated:!1}))}}function*Xy(){try{const n=Ko.onRedirectTo,{routes:i,loginState:o}=yield qi((e=>e.auth)),{user:a,tenants:r}=yield Gi(ed.auth.refreshTokenV2);if(zy(a)){const e=yield Jy(a);yield ji(Gn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}else{var e,t;a.id&&localStorage.setItem("userId",a.id);const l=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,s=l&&"true"!==localStorage.getItem(`${a.id}-${l}`)&&!window.location.pathname.endsWith(i.logoutUrl);yield ji(Gn.setTenantsState({tenants:r,loading:!1})),yield ji(Gn.setState({user:a,isAuthenticated:!0,loginState:I({},o,{quickLoginToRegister:l,flow:s?ht.RegisterQuickLogin:ht.Login})}));const c=new URL(null==(t=window)?void 0:t.location.href).searchParams.get("invitationToken"),u=[i.socialLoginCallbackUrl,i.oidcRedirectUrl,i.samlCallbackUrl];c||u.push(i.loginUrl,i.signUpUrl),s?n(i.loginUrl):u.some((e=>e&&window.location.pathname.endsWith(e)))&&(o.isNewUser&&i.signUpSuccessUrl&&i.socialLoginCallbackUrl===window.location.pathname?n(i.signUpSuccessUrl,{refresh:i.signUpSuccessUrl.startsWith("http")}):yield Ky())}}catch(e){Ko.setAccessToken(null),Ko.setUser(null),yield ji(Gn.setState({user:void 0,isAuthenticated:!1}))}}function*Zy({payload:{callback:e}}){try{const{ip:t}=yield Gi(ed.metadata.getCurrentUserIpMetadata);yield ji(Gn.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*ef({payload:e}){const t=[];e&&(yield ji(Gn.setState({isLoading:!0})),yield ji(Gn.loadSocialLoginsConfigurationV2()),t.push(Gi($d)),t.push(Gi(ny)),t.push(Gi(By)),t.push(Gi(qd)),t.push(Gi(Gy))),t.push(Gi(Yy)),yield Wi(t),yield ji(Gn.setState({isLoading:!1}))}function*tf({accessToken:e,user:t}){if(!e)return void(yield ji(Gn.setState({user:void 0,isAuthenticated:!1})));const n=Ko.onRedirectTo,{routes:i}=yield qi((e=>e.auth));if(zy(t)){const e=yield Jy(t);yield ji(Gn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*nf({payload:e}){const t=[];yield ji(Gn.loadSocialLoginsConfigurationV2()),t.push(Gi($d)),t.push(Gi(By)),t.push(Gi(qd)),t.push(Gi(Gy)),t.push(Gi(tf,e)),yield Wi(t)}function*of({payload:e}){const{disableSilentRefresh:t}=yield qi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield Gi(ed.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield ji(Gn.setState({user:e,isAuthenticated:!0})),yield ji(Gn.loadTenants()),yield ji(Gn.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield qi((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if((e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;let e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield ji(Gn.setState({isLoading:!0}));const a=rd(),r=rd(),l=yield Gi(ad,r);localStorage.setItem(At,r);const s=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${zo(n,"/oauth/authorize")}/oauth/authorize`,u=I({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:s,code_challenge:l,code_challenge_method:"S256",nonce:a},e);i(`${c}?${new URLSearchParams(u).toString()}`,{refresh:!0})}(e)}}function*af({payload:e}){const t=localStorage.getItem(At)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield qi((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy}))),o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`,a={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield Gi(ed.auth.exchangeOAuthTokens,a);yield ji(Gn.setState({user:e,isAuthenticated:!0})),yield ji(Gn.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Ky()}}function*rf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Py);try{yield ji(Gn.setLoginState({loading:!0}));const e=yield Gi(ed.auth.changePhoneNumberWithVerification,n);yield ji(Gn.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:vt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1}))}}function*lf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Iy);try{yield ji(Gn.setLoginState({loading:!0})),yield Gi(ed.auth.verifyChangePhoneNumber,n),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1}))}}function*sf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ly);try{yield ji(Gn.setLoginState({loading:!0}));const e=yield Gi(ed.auth.passwordlessPreLogin,I({},n,{type:rr.SmsCode}));yield ji(Gn.setLoginState({step:vt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*cf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Oy);try{const{onRedirectTo:e,routes:i}=yield qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ji(Gn.setLoginState({loading:!0}));const o=yield Gi(ed.auth.passwordlessPreLogin,n),a=Wy[n.type];if(a===vt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield ji(Gn.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:jt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield ji(Gn.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*uf(e){let{payload:{callback:t,events:n}}=e,i=ii(e.payload,Ey);try{yield ji(Gn.setLoginState({loading:!0}));const e=yield Gi(ed.auth.passwordlessPostLogin,i),a=Ko.onRedirectTo,{routes:r}=yield qi((e=>e.auth));if(zy(e)){const t=yield Jy(e);yield ji(Gn.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield qi((e=>e.auth)),l=yield Gi(ed.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:l.email,origin:_d.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield ji(Gn.setState({user:l,isAuthenticated:!0})),yield ji(Gn.setLoginState({error:void 0})),yield ji(Gn.loadTenants()),i.flow===ht.Login?yield Ky():a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield ji(Gn.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*df({payload:e}){try{yield ji(Gn.setLoginState({loading:!0}));const{name:t}=yield Gi(ed.auth.verifyInviteToken,e);yield ji(Gn.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield ji(Gn.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*yf({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield ji(Gn.setLoginState({loading:!0}));try{const o=yield qi((({auth:{onRedirectTo:e}})=>e));let{address:a,idpType:r}=yield Gi(ed.auth.preLoginV2,{email:e});if(a){if(r===id.Oidc&&!a.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield qi((({auth:{routes:e}})=>({routes:e})));a+=`&redirect_uri=${window.location.origin}${e}`}yield ji(Gn.setLoginState({step:vt.redirectToSSO,loading:!1,ssoRedirectUrl:a})),setTimeout((()=>{o(a,{refresh:!0})}),2e3)}else yield ff({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield ff({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*ff(e){let{callback:t}=e,n=ii(e,wy);const i=yield qi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield ji(Gn.setLoginState({step:vt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===rr.EmailAndPassword?(yield ji(Gn.setLoginState({step:vt.loginWithPassword,loading:!1})),null==t||t()):[rr.MagicLink,rr.Code,rr.SmsCode].includes(null==i?void 0:i.authStrategy)?yield ji(Gn.passwordlessPreLogin(I({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield ji(Gn.setLoginState({step:vt.loginWithPassword,loading:!1})),null==t||t())}function*gf({payload:{callback:e}}){try{yield ji(Gn.setLoginState({loading:!0}));const{options:t}=yield Gi(ed.auth.webAuthnCreateNewDeviceSession);t.user.id=pt(t.user.id),t.challenge=pt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield ji(Gn.setLoginState({error:t.message})),null==e||e(null)}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*pf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Cy);try{yield ji(Gn.setLoginState({loading:!0}));const e=St(n.publicKey);yield Gi(ed.auth.verifyNewDeviceSession,{id:e.id,response:e.response}),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message})),null==t||t(null)}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*Sf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Dy);try{var i;yield ji(Gn.setLoginState({loading:!0}));const{options:e}=yield Gi(ed.auth.webAuthnPreLogin,n);e.challenge=pt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>I({},e,{id:pt(e.id)}))),yield ji(Gn.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield ji(Gn.setLoginState({error:e.message})),null==t||t(null)}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*vf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ry);try{var i;yield ji(Gn.setLoginState({loading:!0}));const e=St(n.publicKey),o=yield Gi(ed.auth.webAuthnPostLogin,I({},e,{response:I({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(zy(o)){const e=Ko.onRedirectTo,{routes:t}=yield qi((e=>e.auth)),n=yield Jy(o);yield ji(Gn.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield Gi(ed.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield ji(Gn.loadTenants()),yield ji(Gn.setState({user:e,isAuthenticated:!0})),yield ji(Gn.setLoginState({error:void 0})),yield Ky(),null==t||t(!0)}}catch(e){yield ji(Gn.setLoginState({error:e.message})),null==t||t(null)}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*hf({payload:e}){const{onRedirectTo:t,routes:n}=yield qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ji(Gn.setLoginState({loading:!0}));try{const t=yield Gi(ed.auth.postLogin,e);Ko.setAccessToken(t.accessToken),Ko.setUser(t),yield ji(Gn.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Ky()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield ji(Gn.setLoginState({step:vt.loginWithSSOFailed,loading:!1}))}}function*mf({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield ji(Gn.setLoginState({loading:!0}));try{const a=yield Gi(ed.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});Ko.setAccessToken(a.accessToken),Ko.setUser(a);const r=Ko.onRedirectTo,{routes:l}=yield qi((e=>e.auth));if(zy(a)){const e=yield Jy(a);yield ji(Gn.setState(e)),r(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield qi((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield ji(Gn.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===ht.Login?vt.success:t.step,tenants:[],tenantsLoading:!0}})),yield ji(Gn.loadTenants()),n&&t.flow===ht.Login&&(yield Ky())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){Ko.setAccessToken(null),Ko.setUser(null),yield ji(Gn.setLoginState({email:e,error:t.message,loading:!1}))}}function*bf({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield ji(Gn.setLoginState({loading:!0}));try{const o=yield Gi(ed.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield qi((e=>e.auth)),r=a.flow===ht.Login?vt.success:a.step;yield ji(Gn.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:o,isAuthenticated:!0})),o.id&&localStorage.setItem("userId",o.id),yield ji(Gn.loadTenants()),yield ji(Gn.setLoginState({error:void 0,loading:!1})),a.flow===ht.Login&&(yield Ky()),null==i||i(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*Af({payload:e}){yield ji(Gn.setLoginState({loading:!0}));try{yield Gi(ed.auth.recoverMfaToken,e),yield ji(Gn.setLoginState({loading:!1,error:void 0,step:vt.preLogin})),yield ji(Gn.setState({user:void 0,isAuthenticated:!1}))}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1}))}}function*kf({payload:e}){const{hostedLoginBox:t}=yield qi((e=>e.auth));yield ji(Gn.setState({isLoading:!0}));try{t?yield Gi(ed.auth.OAuthLogout):yield Gi(ed.auth.logout)}catch{}yield ji(Gn.resetState()),yield ji(Gn.requestAuthorize(!0)),null==e||e()}function*Tf({payload:e}){var t;try{yield Gi(ed.auth.logout)}catch{}setTimeout((()=>{var t;return null==e||null==(t=e.callback)?void 0:t.call(e,!0)}),null!=(t=null==e?void 0:e.callbackTimeout)?t:500)}function*Pf({user:e,tenants:t}){const n={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield ji(Gn.setMfaState(n)),yield ji(Gn.setUser(e)),yield ji(Gn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*If({user:e,tenants:t}){const{loginState:n}=yield qi((e=>e.auth));yield ji(Gn.setUser(e)),yield ji(Gn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id),n.flow===ht.Login&&(yield Ky()),yield ji(Gn.setState({isAuthenticated:!0}))}function*Lf(e){let{payload:{callback:t}}=e,n=ii(e.payload,_y);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.preEnrollMFASMSForLogin,n);yield ji(Gn.setMfaState({otcToken:e.otcToken,step:Qt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Of(e){let{payload:{callback:t}}=e,n=ii(e.payload,Uy);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.enrollMFASMSForLogin,n),i=yield Gi(ed.auth.generateLoginResponseV2,e);yield Pf(i),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Ef(e){let{payload:{callback:t}}=e,n=ii(e.payload,My);yield ji(Gn.setLoginState({loading:!0}));try{var i;const e=yield Gi(ed.auth.preEnrollMFAWebAuthnForLogin,n),o=I({},e.options,{challenge:pt(e.options.challenge),user:I({},e.options.user,{id:pt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>I({},e,{id:pt(e.id)})))});yield ji(Gn.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*wf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ny);yield ji(Gn.setLoginState({loading:!0}));try{const e=St(n.publicKey),i=yield Gi(ed.auth.enrollMFAWebAuthnForLogin,I({},n,{options:e})),o=yield Gi(ed.auth.generateLoginResponseV2,i);yield Pf(o),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Cf(e){let{payload:{callback:t}}=e,n=ii(e.payload,$y);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield Gi(ed.auth.generateLoginResponseV2,e);yield Pf(i),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Df(e){let{payload:{callback:t,deviceId:n}}=e,i=ii(e.payload,Fy);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.preVerifyMFASMSForLogin,n,i);yield ji(Gn.setMfaState({otcToken:e.otcToken,step:Qt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Rf(e){let{payload:{callback:t,deviceId:n}}=e,i=ii(e.payload,xy);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.verifyMFASMSForLogin,n,i),o=yield Gi(ed.auth.generateLoginResponseV2,e);yield If(o),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*_f(e){let{payload:{callback:t,deviceId:n}}=e,i=ii(e.payload,Vy);yield ji(Gn.setLoginState({loading:!0}));try{var o;const e=yield Gi(ed.auth.preVerifyMFAWebAuthnForLogin,n,i),a=I({},e.options,{challenge:pt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>I({},e,{id:pt(e.id)})))});yield ji(Gn.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Uf(e){let{payload:{callback:t,deviceId:n}}=e,i=ii(e.payload,jy);yield ji(Gn.setLoginState({loading:!0}));try{const e=St(i.publicKey),o=yield Gi(ed.auth.verifyMFAWebAuthnForLogin,n,I({},i,{options:e})),a=yield Gi(ed.auth.generateLoginResponseV2,o);yield If(a),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Mf(){yield Wo(Gn.requestAuthorize,ef),yield Wo(Gn.requestAuthorizeSSR,nf),yield Wo(Gn.requestHostedLoginAuthorize,of),yield Wo(Gn.handleHostedLoginCallback,af),yield Wo(Gn.preLogin,yf),yield Wo(Gn.postLogin,hf),yield Wo(Gn.login,mf),yield Wo(Gn.logout,kf),yield Wo(Gn.silentLogout,Tf),yield Wo(Gn.loginWithMfa,bf),yield Wo(Gn.recoverMfa,Af),yield Wo(Gn.quickSmsPasswordlessPreLogin,sf),yield Wo(Gn.changePhoneNumberWithVerification,rf),yield Wo(Gn.verifyChangePhoneNumber,lf),yield Wo(Gn.passwordlessPreLogin,cf),yield Wo(Gn.passwordlessPostLogin,uf),yield Wo(Gn.verifyInviteToken,df),yield Wo(Gn.webAuthnPrelogin,Sf),yield Wo(Gn.webAuthnPostLogin,vf),yield Wo(Gn.webAuthnCreateNewDeviceSession,gf),yield Wo(Gn.webAuthnVerifyNewDeviceSession,pf),yield Wo(Gn.afterAuthNavigation,Ky),yield Wo(Gn.getUserIP,Zy),yield Wo(Gn.preEnrollMFASMSForLogin,Lf),yield Wo(Gn.enrollMFASMSForLogin,Of),yield Wo(Gn.preEnrollMFAWebAuthnForLogin,Ef),yield Wo(Gn.enrollMFAWebAuthnForLogin,wf),yield Wo(Gn.enrollMFAAuthenticatorAppForLogin,Cf),yield Wo(Gn.preVerifyMFASMSForLogin,Df),yield Wo(Gn.verifyMFASMSForLogin,Rf),yield Wo(Gn.preVerifyMFAWebAuthnForLogin,_f),yield Wo(Gn.verifyMFAWebAuthnForLogin,Uf)}function*Nf({payload:e}){e&&(yield ji(Gn.setState({isLoading:!0})));const t=dd;yield ji(Gn.loadTenants()),yield ji(Gn.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*$f({payload:{callback:e}}){try{const{ip:t}=Rd[0];yield ji(Gn.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Ff(){yield Wo(Gn.requestAuthorize,Nf),yield Wo(Gn.afterAuthNavigation,Ky),yield Wo(Gn.getUserIP,$f)}const xf=["callback","samlVendor"],Vf=["callback","samlVendor"];function*jf(){try{var e,t;yield ji(Gn.setSSOState({loading:!0}));const n=yield Gi(ed.auth.getSamlConfiguration),i=yield Gi(ed.auth.getOidcConfiguration),o=yield Gi(ed.metadata.getSamlMetadata);n.acsUrl=null==o||null==(e=o.configuration)?void 0:e.acsUrl,n.spEntityId=null==o||null==(t=o.configuration)?void 0:t.spEntityId,n.isSamlActive=null==o?void 0:o.isActive,yield ji(Gn.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield ji(Gn.setSSOState({error:e.message,loading:!1}))}}function*Wf({payload:e}){const t=yield qi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield ji(Gn.setSSOState({error:void 0,[n]:!0}));try{const i=yield ld(e[0]),o=yield Gi(ed.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield ji(Gn.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield ji(Gn.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Kf({payload:e}){const{configFile:t,callback:n}=e,i=yield qi((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield ji(Gn.setSSOState({error:void 0,[o]:!0}));try{const e=yield ld(t),a=yield Gi(ed.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield ji(Gn.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield ji(Gn.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*Gf({payload:e}){const{callback:t,samlVendor:n}=e,i=ii(e,xf),o=yield qi((e=>e.auth.ssoState.samlConfiguration)),a=I({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield ji(Gn.setSSOState({samlConfiguration:I({},o,a)})));if(yield ji(Gn.setSSOState({error:void 0,[r]:!0})),e.type===id.Saml){var l,s;const e=yield Gi(ed.metadata.getSamlMetadata);a.acsUrl=null==e||null==(l=e.configuration)?void 0:l.acsUrl,a.spEntityId=null==e||null==(s=e.configuration)?void 0:s.spEntityId}const i=od(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==o?void 0:o.domain)!==(null==i?void 0:i.domain)&&(i.ssoEndpoint="",i.publicCertificate="",i.signRequest=!1),i.type=null==n?void 0:n.toLowerCase();const c=yield Gi(ed.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield ji(Gn.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*Bf({payload:{callback:e}={}}){const t=yield qi((e=>e.auth.ssoState.samlConfiguration));try{yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield Gi(ed.auth.validateSamlDomain),yield ji(Gn.setSSOState({samlConfiguration:I({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield ji(Gn.setSSOState({samlConfiguration:I({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*zf(){try{const e=yield Gi(ed.auth.getSamlRoles),t=yield Gi(ed.auth.getSamlRolesGroups);yield ji(Gn.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield ji(Gn.setSSOState({error:e.message}))}}function*qf({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield Gi(ed.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Wi(e.map((e=>Gi(ed.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield ji(Gn.setSSOState({error:e.message}))}}(n)),yield zf(),yield ji(Gn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ji(Gn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Hf({payload:{callback:e,id:t}}){try{yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield Gi(ed.auth.deleteSamlGroup,{id:t}),yield zf(),yield ji(Gn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ji(Gn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Jf({payload:{group:e,roleIds:t,callback:n}}){try{yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield Gi(ed.auth.createSamlGroup,{group:e,roleIds:t}),yield zf(),yield ji(Gn.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield ji(Gn.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*Yf({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield ji(Gn.setSSOState({loading:!0})),yield Gi(ed.auth.oidcPostLoginV2,t),yield Gi(Yy),yield ji(Gn.setSSOState({loading:!1}))}catch(e){var n;yield ji(Gn.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*Qf(){yield Vo(Gn.loadSSOConfigurations,jf),yield Vo(Gn.saveSSOConfigurations,Gf),yield Vo(Gn.saveSSOConfigurationsFile,Wf),yield Vo(Gn.saveSSOConfigurationsFileWithCallback,Kf),yield Vo(Gn.validateSSODomain,Bf),yield Vo(Gn.loadSSOAuthorizationRoles,zf),yield Vo(Gn.updateSSOAuthorizationRoles,qf),yield Vo(Gn.deleteSamlGroup,Hf),yield Vo(Gn.createSamlGroup,Jf),yield Vo(Gn.oidcPostlogin,Yf)}function*Xf(){yield ji(Gn.setSSOState({loading:!0})),yield yt(),yield ji(Gn.setSSOState({samlConfiguration:hd,loading:!1,firstLoad:!1}))}function*Zf({payload:e}){const t="saving";yield ji(Gn.setSSOState({error:void 0,[t]:!0}));const n=I({},yield qi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield ji(Gn.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*eg({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=ii(e,Vf),r=Ad.samlConfiguration,l=I({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield ji(Gn.setSSOState({samlConfiguration:I({},r,l)})));yield ji(Gn.setSSOState({error:void 0,[s]:!0})),yield yt(),l.acsUrl=null==md||null==(t=md.configuration)?void 0:t.acsUrl,l.spEntityId=null==md||null==(n=md.configuration)?void 0:n.spEntityId;const c=od(l,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==o?void 0:o.toLowerCase(),yield yt(),yield ji(Gn.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==i||i(!0)}function*tg({payload:{callback:e}={}}){const t=Ad.samlConfiguration;yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield yt(),yield ji(Gn.setSSOState({samlConfiguration:I({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*ng(){yield yt(),yield ji(Gn.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*ig({payload:{callback:e,authorizationRoles:t}}){yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield yt(),yield ji(Gn.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*og(){yield Vo(Gn.loadSSOConfigurations,Xf),yield Vo(Gn.saveSSOConfigurations,eg),yield Vo(Gn.saveSSOConfigurationsFile,Zf),yield Vo(Gn.validateSSODomain,tg),yield Vo(Gn.loadSSOAuthorizationRoles,ng),yield Vo(Gn.updateSSOAuthorizationRoles,ig)}const ag=["callback"],rg=["callback","ssoConfigId"],lg=["callback","ssoConfigId"];function*sg(){try{return yield Gi(ed.auth.getOidcConfiguration)}catch(e){return null}}function*cg(){try{return yield Gi(ed.metadata.getSamlMetadata)}catch(e){return null}}function*ug(){try{yield ji(Gn.setSSOLoader({key:nd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Wi([Gi(sg),Gi(cg)]),n=yield Gi(ed.auth.getSSOConfigurations);yield ji(Gn.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield ji(Gn.setSSOError({key:nd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield ji(Gn.setSSOLoader({key:nd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*dg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=ii(e,ag),i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield Gi(ed.auth.createSSOConfiguration,I({},n,{enabled:null!=(o=n.enabled)&&o}));yield ji(Gn.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*yg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ld(t),o=yield Gi(ed.auth.createSSOConfigurationByMetadata,{metadata:e});yield ji(Gn.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*fg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=ii(e,rg),o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Gi(ed.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield ji(Gn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ji(Gn.setSSOError({key:nd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*gg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ld(i),a=yield Gi(ed.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield ji(Gn.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield ji(Gn.setSSOError({key:nd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*pg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Gi(ed.auth.deleteSSOConfiguration,t),yield ji(Gn.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Sg({payload:e}){const{callback:t,ssoConfigId:n}=e,i=ii(e,lg);yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_DOMAIN,value:!0}));const o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Gi(ed.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?I({},t,{domains:[...t.domains,e]}):t));yield ji(Gn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_DOMAIN,value:!1}))}}function*vg({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield ji(Gn.setSSOLoader({key:nd.DELETE_SSO_DOMAIN,value:!0}));const o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Gi(ed.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?I({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield ji(Gn.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.DELETE_SSO_DOMAIN,value:!1}))}}function*hg({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield ji(Gn.setSSOLoader({key:nd.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Gi(ed.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?I({},e,{domains:e.domains.map((e=>e.id===n?I({},e,{validated:!0}):e))}):e));yield ji(Gn.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*mg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Gi(ed.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?I({},e,{roleIds:n}):e));yield ji(Gn.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield ji(Gn.setSSOError({key:nd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*bg({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_GROUPS,value:!0}));const o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Wi(t.map((e=>Gi(ed.auth.deleteSSOGroup,n,e)))),yield Wi(e.map((e=>Gi(ed.auth.createSSOGroup,n,e))));const a=yield Gi(ed.auth.getSSOGroups,n),r=o.map((e=>e.id===n?I({},e,{groups:a}):e));yield ji(Gn.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_GROUPS,value:!1}))}}function*Ag({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Wi(t.map((t=>Gi(ed.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_GROUPS,value:!1}))}}function*kg(){yield Vo(Gn.loadSSOConfigurationsV2,ug),yield Vo(Gn.saveSSOConfigurationV2,dg),yield Vo(Gn.saveSSODomain,Sg),yield Vo(Gn.deleteSSODomain,vg),yield Vo(Gn.validateSSODomainV2,hg),yield Vo(Gn.updateSSOConfiguration,fg),yield Vo(Gn.deleteSSOConfiguration,pg),yield Vo(Gn.setSSOGroups,bg),yield Vo(Gn.updateSSOGroups,Ag),yield Vo(Gn.setSSODefaultRoles,mg),yield Vo(Gn.saveSSOConfigurationByMetadata,yg),yield Vo(Gn.updateSSOConfigurationByMetadata,gg)}const Tg=["callback","profilePictureUrl"],Pg=["callback","profilePictureUrl"];function*Ig(){yield ji(Gn.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return Gi.apply(void 0,[xo,e,t,n].concat(o))}(3,2e3,ed.teams.getProfile),t=yield qi((e=>e.auth.user));Gn.setUser(I({},t,e)),yield ji(Gn.setProfileState({profile:e,loading:!1}))}catch(e){yield ji(Gn.setProfileState({loading:!1,error:e.message}))}}function*Lg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=ii(e.payload,Tg);yield ji(Gn.setProfileState({saving:!0,error:null}));try{const e=yield qi((e=>e.auth.profileState.profile));let o=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const i=`image/${n[1]}`,o=function(e,t){const n=atob(e),i=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),o=new Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);i.push(new Uint8Array(o))}return new Blob(i,{type:t})}(n[2],i),a=new FormData;return a.append(t,new File([o],t,{type:i})),a}(n,"image");if(e){o=yield Gi(ed.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=I({},e,i,{profilePictureUrl:o}),r=yield Gi(ed.teams.updateProfile,a),l=yield qi((e=>e.auth.user));yield ji(Gn.setUser(I({},l,r))),yield ji(Gn.setProfileState({profile:r,saving:!1})),null==t||t(a)}catch(e){yield ji(Gn.setProfileState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Og({payload:e}){yield ji(Gn.setProfileState({loading:!0}));try{var t;yield Gi(ed.teams.changePassword,e),yield ji(Gn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Eg(){yield Wo(Gn.loadProfile,Ig),yield Vo(Gn.saveProfile,Lg),yield Vo(Gn.changePassword,Og)}function*wg(){yield ji(Gn.setProfileState({loading:!0})),yield yt(),yield ji(Gn.setUser(I({},dd,ud))),yield ji(Gn.setProfileState({loading:!1,profile:ud}))}function*Cg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=ii(e.payload,Pg);yield ji(Gn.setProfileState({saving:!0,error:null}));const o=yd;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=I({},o.profile,i,{profilePictureUrl:a}),l=dd;yield yt(),yield ji(Gn.setUser(I({},l,r))),yield ji(Gn.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Dg({payload:e}){var t;yield ji(Gn.setProfileState({loading:!0})),yield yt(),yield ji(Gn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Rg(){yield Wo(Gn.loadProfile,wg),yield Vo(Gn.saveProfile,Cg),yield Vo(Gn.changePassword,Dg)}const _g=["callback"],Ug=["callback"],Mg=["callback"],Ng=["deviceId","callback"],$g=["deviceId","callback"],Fg=["callback"],xg=["deviceId"],Vg=["deviceId"],jg=["callback"],Wg=["deviceId"],Kg=["callback"];function*Gg(e){const{step:t}=yield qi((e=>e.auth.mfaState));return{step:e.recoveryCode?Qt.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Bg(){yield ji(Gn.setMfaState({saving:!0}));try{const{qrCode:e}=yield Gi(ed.auth.enrollMfa);yield ji(Gn.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message}))}}function*zg(e){let{payload:{callback:t}}=e,n=ii(e.payload,_g);yield ji(Gn.setMfaState({saving:!0}));try{const e=yield qi((e=>e.auth.user)),i=yield Gi(ed.auth.verifyMfa,n),o=yield Gi(ed.auth.getMFADevices),a=yield Gg(i);yield ji(Gn.setMfaState(I({},a,{mfaDevices:o}))),yield ji(Gn.setUser(I({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*qg(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ug);yield ji(Gn.setMfaState({loading:!0}));try{const e=yield Gi(ed.auth.loginWithMfa,n),i={step:Qt.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield ji(Gn.setMfaState(i)),yield ji(Gn.setState({user:e})),yield ji(Gn.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield ji(Gn.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Hg({payload:e}){yield ji(Gn.setMfaState({saving:!0}));try{var t;yield Gi(ed.auth.disableMfa,e);const n=yield Gi(ed.auth.getMFADevices);yield ji(Gn.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*Jg({payload:e}){yield ji(Gn.setMfaState({saving:!0}));try{var t,n;const i=yield Gi(ed.auth.preEnrollMFAWebAuthn),o=I({},i.options,{challenge:pt(i.options.challenge),user:I({},i.options.user,{id:pt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>I({},e,{id:pt(e.id)})))});yield ji(Gn.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield ji(Gn.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*Yg(e){let{payload:{callback:t}}=e,n=ii(e.payload,Mg);yield ji(Gn.setMfaState({saving:!0}));try{const e=St(n.publicKey),i=yield Gi(ed.auth.enrollMFAWebAuthn,I({},n,{options:e})),o=yield Gi(ed.auth.getMFADevices),a=yield Gg(i);yield ji(Gn.setMfaState(I({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Qg(e){let{payload:{deviceId:t,callback:n}}=e;ii(e.payload,Ng),yield ji(Gn.setMfaState({saving:!0}));try{var i;const e=yield Gi(ed.auth.preDisableMFAWebAuthn,t),o=I({},e.options,{challenge:pt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>I({},e,{id:pt(e.id)})))});yield ji(Gn.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*Xg(e){let{payload:{deviceId:t,callback:n}}=e,i=ii(e.payload,$g);yield ji(Gn.setMfaState({saving:!0}));try{const e=St(i.publicKey);yield Gi(ed.auth.disableMFAWebAuthn,t,I({},i,{options:e}));const o=yield Gi(ed.auth.getMFADevices);yield ji(Gn.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*Zg({payload:e}){yield ji(Gn.setMfaState({saving:!0}));try{var t;const n=yield Gi(ed.auth.preEnrollMFASMS,e);yield ji(Gn.setMfaState({saving:!1,error:void 0,otcToken:n.otcToken,phoneNumber:n.phoneNumber})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*ep(e){let{payload:{callback:t}}=e,n=ii(e.payload,Fg);yield ji(Gn.setMfaState({saving:!0}));try{const e=yield Gi(ed.auth.enrollMFASMS,n),i=yield Gi(ed.auth.getMFADevices),o=yield Gg(e);yield ji(Gn.setMfaState(I({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*tp(e){let{payload:{deviceId:t}}=e,n=ii(e.payload,xg);yield ji(Gn.setMfaState({saving:!0}));try{var i;const e=yield Gi(ed.auth.preDisableMFASMS,t);yield ji(Gn.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*np(e){let{payload:{deviceId:t}}=e,n=ii(e.payload,Vg);yield ji(Gn.setMfaState({saving:!0}));try{var i;yield Gi(ed.auth.disableMFASMS,t,n);const e=yield Gi(ed.auth.getMFADevices);yield ji(Gn.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*ip(){yield ji(Gn.setMfaState({loading:!0}));try{yield qi((e=>e.auth.user));const e=yield Gi(ed.auth.getMFADevices);yield ji(Gn.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield ji(Gn.setMfaState({loading:!1,error:e.message}))}}function*op(){yield ji(Gn.setMfaState({loading:!0}));try{const e=(yield Gi(ed.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield ji(Gn.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield ji(Gn.setMfaState({loading:!1,error:e.message}))}}function*ap(){yield Vo(Gn.enrollMfa,Bg),yield Vo(Gn.getMFADevices,ip),yield Vo(Gn.getMFAStrategies,op),yield Vo(Gn.verifyMfa,zg),yield Vo(Gn.disableMfa,Hg),yield Vo(Gn.verifyMfaAfterForce,qg),yield Vo(Gn.preDisableMfaSms,tp),yield Vo(Gn.disableMfaSms,np),yield Vo(Gn.preEnrollMfaSms,Zg),yield Vo(Gn.enrollMfaSms,ep),yield Vo(Gn.preEnrollMfaWebAuthn,Jg),yield Vo(Gn.enrollMfaWebAuthn,Yg),yield Vo(Gn.preDisableMfaWebAuthn,Qg),yield Vo(Gn.disableMfaWebAuthn,Xg)}function*rp(){yield ji(Gn.setMfaState({saving:!0})),yield ji(Gn.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*lp({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield qi((e=>e.auth.mfaState));yield ji(Gn.setMfaState({saving:!0})),yield yt();const n={token:"token",recoveryCode:"recoveryCode"},i={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:I({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield ji(Gn.setMfaState(i)),yield ji(Gn.setUser(I({},dd,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*sp(e){let{payload:{callback:t}}=e,n=ii(e.payload,jg);yield ji(Gn.setMfaState({loading:!0})),yield yt();const i=I({},n,{recoveryCode:"recoveryCode"}),o={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield ji(Gn.setMfaState(o)),yield yt(),yield ji(Gn.setUser(I({},dd,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*cp({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield qi((e=>e.auth.mfaState));yield ji(Gn.setMfaState({saving:!0})),yield yt(),yield ji(Gn.setMfaState({saving:!1,error:void 0,mfaDevices:I({},n,{authenticators:[]})})),yield ji(Gn.setUser(I({},dd))),null==(t=e.callback)||t.call(e,!0)}function*up(e){let{}=e,t=ii(e.payload,Wg);yield ji(Gn.setMfaState({saving:!0}));try{var n;yield ji(Gn.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*dp({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield qi((e=>e.auth.mfaState));yield ji(Gn.setMfaState({saving:!0})),yield yt(),yield ji(Gn.setMfaState({loading:!1,error:void 0,mfaDevices:I({},n,{phones:[]})})),yield ji(Gn.setUser(I({},dd))),null==(t=e.callback)||t.call(e,!0)}function*yp({payload:e}){var t;yield ji(Gn.setMfaState({saving:!0})),yield yt(),yield ji(Gn.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*fp(e){let{payload:{callback:t}}=e;ii(e.payload,Kg);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield qi((e=>e.auth.mfaState));yield ji(Gn.setMfaState({saving:!0})),yield yt();const i={token:"token",recoveryCode:"recoveryCode"},o={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:I({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield ji(Gn.setMfaState(o)),yield ji(Gn.setUser(I({},dd,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*gp(){yield Vo(Gn.enrollMfa,rp),yield Vo(Gn.verifyMfa,lp),yield Vo(Gn.disableMfa,cp),yield Vo(Gn.verifyMfaAfterForce,sp),yield Vo(Gn.preDisableMfaSms,up),yield Vo(Gn.disableMfaSms,dp),yield Vo(Gn.preEnrollMfaSms,yp),yield Vo(Gn.enrollMfaSms,fp)}const pp=["callback"];function*Sp({payload:e}){yield ji(Gn.setForgotPasswordState({loading:!0}));try{yield Gi(ed.auth.forgotPassword,e),yield ji(Gn.setForgotPasswordState({loading:!1,error:void 0,step:$t.success}))}catch(e){yield ji(Gn.setForgotPasswordState({loading:!1,error:e.message||"Unknown error occurred"}))}}function*vp(e){let{payload:{callback:t}}=e,n=ii(e.payload,pp);yield ji(Gn.setForgotPasswordState({loading:!0}));try{yield Gi(ed.auth.resetPassword,n),yield ji(Gn.setForgotPasswordState({loading:!1,error:void 0,step:$t.success})),null==t||t(!0)}catch(e){yield ji(Gn.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1)}}function*hp({payload:e}){yield ji(Gn.setForgotPasswordState({loading:!0}));try{const t=yield Gi(ed.auth.loadPasswordConfig,e);yield ji(Gn.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield ji(Gn.setForgotPasswordState({loading:!1,error:e.message}))}}function*mp(){yield Wo(Gn.forgotPassword,Sp),yield Wo(Gn.resetPassword,vp),yield Wo(Gn.loadPasswordConfig,hp)}let bp;!function(e){e.USERS="USERS",e.STATS="STATS",e.UPDATE_USER="UPDATE_USER",e.DELETE_USER="DELETE_USER",e.RESEND_ACTIVATE_LINK="RESEND_ACTIVATE_LINK",e.RESEND_INVITATION_LINK="RESEND_INVITATION_LINK",e.ROLES_AND_PERMISSIONS="ROLES_AND_PERMISSIONS",e.CREATE_TOKEN_LINK="CREATE_TOKEN_LINK",e.GET_TOKEN_LINK="GET_TOKEN_LINK",e.UPDATE_TOKEN_LINK="UPDATE_TOKEN_LINK",e.DELETE_TOKEN_LINK="DELETE_TOKEN_LINK",e.CONFIG_TOKEN_LINK="CONFIG_TOKEN_LINK"}(bp||(bp={}));const Ap=["callback","events"],kp=["callback"],Tp=["callback"];function*Pp({payload:{userId:e,token:t}}){yield ji(Gn.setActivateState({loading:!0,step:wt.activating}));try{const{isAuthenticated:n}=yield qi((e=>e.auth));n&&(yield ji(Gn.silentLogout()));const i=yield Gi(ed.auth.getActivateAccountStrategy,{userId:e,token:t});yield ji(Gn.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield ji(Gn.setActivateState({loading:!1,step:wt.activatingForm})))}catch(e){yield ji(Gn.setActivateState({loading:!1,error:e.message}))}}function*Ip(e){let{payload:{callback:t,events:n}}=e,i=ii(e.payload,Ap);yield ji(Gn.setActivateState({loading:!0}));try{const e=Ko.onRedirectTo,{routes:a}=yield qi((e=>e.auth)),r=yield Gi(ed.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(zy(r)){yield ji(Gn.setActivateState({step:wt.success}));const t=yield Jy(r);yield ji(Gn.setState(t)),yield Hi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield ji(Gn.setActivateState({step:wt.success}));const{user:e,tenants:t}=yield Gi(ed.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:_d.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield ji(Gn.setTenantsState({tenants:t,loading:!1})),yield ji(Gn.setState({user:e,isAuthenticated:!0})),yield Hi(1e3),yield Ky(),yield ji(Gn.resetActivateState())}null==t||t(!0)}catch(e){yield ji(Gn.setActivateState({loading:!1,error:e.message}))}}function*Lp({payload:e}){const{callback:t}=e,n=ii(e,kp);yield ji(Gn.setActivateStrategyState({loading:!0}));try{const e=yield Gi(ed.auth.getActivateAccountStrategy,n);yield ji(Gn.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield ji(Gn.setActivateStrategyState({loading:!1,error:e.message}))}}function*Op({payload:e}){const{callback:t}=e,n=ii(e,Tp);yield ji(Gn.setTeamLoader({key:bp.RESEND_ACTIVATE_LINK,value:n.email})),yield ji(Gn.setActivateState({loading:!0}));try{yield Gi(ed.auth.resendActivationEmail,n),yield ji(Gn.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield ji(Gn.setActivateState({loading:!1,error:e.message})),yield ji(Gn.setTeamError({key:bp.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:bp.RESEND_ACTIVATE_LINK,value:!1}))}function*Ep(){yield Wo(Gn.activateAccount,Ip),yield Wo(Gn.preActivateAccount,Pp),yield Wo(Gn.getActivateAccountStrategy,Lp),yield Wo(Gn.resendActivationEmail,Op)}function*wp({payload:e}){if(e.token&&e.userId)try{yield ji(Gn.setAcceptInvitationState({error:void 0,step:_t.pending})),yield Gi(ed.auth.acceptInvitation,e),yield ji(Gn.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:_t.success}}))}catch(e){yield ji(Gn.setAcceptInvitationState({step:_t.failed,error:e.message}))}else yield ji(Gn.setAcceptInvitationState({error:void 0,step:_t.invalid}))}function*Cp(){yield Wo(Gn.acceptInvitation,wp)}var Dp,Rp=new Uint8Array(16);function _p(){if(!Dp&&!(Dp="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Dp(Rp)}for(var Up=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Mp=function(e){return"string"==typeof e&&Up.test(e)},Np=[],$p=0;$p<256;++$p)Np.push(($p+256).toString(16).substr(1));var Fp=function(e,t,n){var i=(e=e||{}).random||(e.rng||_p)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=i[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Np[e[t+0]]+Np[e[t+1]]+Np[e[t+2]]+Np[e[t+3]]+"-"+Np[e[t+4]]+Np[e[t+5]]+"-"+Np[e[t+6]]+Np[e[t+7]]+"-"+Np[e[t+8]]+Np[e[t+9]]+"-"+Np[e[t+10]]+Np[e[t+11]]+Np[e[t+12]]+Np[e[t+13]]+Np[e[t+14]]+Np[e[t+15]]).toLowerCase();if(!Mp(n))throw TypeError("Stringified UUID is invalid");return n}(i)};const xp=["callback"],Vp=["roles"],jp=["callback"],Wp=["callback","profileImage"],Kp=["callback"],Gp=["callback","userId"],Bp=["callback"],zp=["callback"],qp=["callback"],Hp=["callback"],Jp=["callback"],Yp=["callback"],Qp=["callback"],Xp=["callback","profileImage"],Zp=["callback"],eS=["callback"],tS=["callback"],nS=["callback"],iS=["callback"],oS=["callback"],aS=()=>qi((e=>e.auth.teamState));function*rS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield aS(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(i=e.filter)?i:l.filter,d=null!=(o=e.sort)?o:l.sort;yield ji(Gn.setTeamLoader({key:bp.USERS,value:!a})),yield ji(Gn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield Wi([Gi(ed.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Gi(ed.teams.loadAvailableRoles),Gi(ed.teams.loadAvailablePermissions)]);yield ji(Gn.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield ji(Gn.setTeamError({key:bp.USERS,value:e.message})),yield ji(Gn.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield ji(Gn.setTeamLoader({key:bp.USERS,value:!1}))}function*lS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield aS(),c={_limit:(null!=(t=e._limit)?t:s.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:s.allUsersQueryParams._offset)||0,_filter:(null!=(i=e._filter)?i:s.allUsersQueryParams._filter)||"",_sortBy:(null!=(o=e._sortBy)?o:s.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:s.allUsersQueryParams._order)||"DESC"};yield ji(Gn.setTeamLoader({key:bp.USERS,value:!r})),yield ji(Gn.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield Wi([Gi(ed.subTenants.loadAllUsers,I({},c)),Gi(ed.teams.loadAvailableRoles),Gi(ed.teams.loadAvailablePermissions)]);yield ji(Gn.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==l||l(e)}catch(e){yield ji(Gn.setTeamError({key:bp.USERS,value:e.message})),yield ji(Gn.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield ji(Gn.setTeamLoader({key:bp.USERS,value:!1}))}function*sS({payload:e}){yield ji(Gn.setTeamLoader({key:bp.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield Wi([Gi(ed.teams.loadAvailableRoles),Gi(ed.teams.loadAvailablePermissions)]);yield ji(Gn.setTeamState({roles:n,permissions:i})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:i})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield ji(Gn.setTeamError({key:bp.ROLES_AND_PERMISSIONS,value:t.message}))}yield ji(Gn.setTeamLoader({key:bp.ROLES_AND_PERMISSIONS,value:!0}))}function*cS({payload:e}){const{callback:t}=e,n=ii(e,xp),i=yield aS();yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})}));try{const e=yield Gi(ed.teams.addUser,n),{roles:o}=e,a=I({},ii(e,Vp),{roleIds:o.map((e=>e.id))});null==t||t(a),yield ji(Gn.setTeamState({users:[a,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*uS({payload:e}){const{callback:t}=e,n=yield aS();yield ji(Gn.setTeamState({addUserDialogState:I({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield ji(Gn.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Gi(ed.teams.addUser,t),i.push(t.email)}catch(e){o.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:[],silentLoading:e.emails.length>0};yield ji(Gn.loadUsers(r)),yield ji(Gn.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*dS({payload:e}){const{callback:t}=e,n=ii(e,jp),i=yield aS();yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})}));try{yield Gi(ed.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield Gi(ed.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield ji(Gn.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*yS({payload:e}){const{callback:t}=e,n=ii(e,Wp),{id:i}=n,o=yield aS(),a=o.users.find((e=>e.id===n.id));yield ji(Gn.setTeamLoader({key:bp.UPDATE_USER,value:i||""})),yield ji(Gn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0})})),yield ji(Gn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?I({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield Gi(ed.teams.updateUser,n);null==t||t(e),yield ji(Gn.setTeamState({users:o.users.map((t=>t.id===e.id?I({},t,e,{createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield ji(Gn.setTeamLoader({key:bp.UPDATE_USER,value:!1}))}catch(e){yield ji(Gn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?I({},e,a):e))})),yield ji(Gn.setTeamLoader({key:bp.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*fS({payload:e}){const{callback:t}=e,n=ii(e,Kp),i=yield aS();yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})}));try{yield Gi(ed.teams.deleteUser,n),null==t||t(!0),yield ji(Gn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*gS({payload:e}){const{callback:t,userId:n}=e,i=ii(e,Gp),o=yield aS();yield ji(Gn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0})}));try{yield Gi(ed.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return I({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield ji(Gn.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[I({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield ji(Gn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*pS({payload:e}){const{callback:t}=e,n=ii(e,Bp),i=yield aS();yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})}));try{yield Gi(ed.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield ji(Gn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*SS({payload:e}){const{callback:t}=e,n=ii(e,zp);yield ji(Gn.setTeamLoader({key:bp.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Gi(ed.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:bp.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:bp.RESEND_ACTIVATE_LINK,value:!1}))}function*vS({payload:e}){const{callback:t}=e,n=ii(e,qp);yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:n.email}));try{yield Gi(ed.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:bp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:!1}))}function*hS({payload:e}){const{callback:t}=e,n=ii(e,Hp);yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:n.email}));try{yield Gi(ed.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:bp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:!1}))}function*mS({payload:e}){const{callback:t}=e,n=ii(e,Jp);yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:n.email}));try{yield Gi(ed.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:bp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:!1}))}function*bS(){yield ji(Gn.setTeamError({key:bp.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Gi(ed.teams.getInviteLinkConfiguration);yield ji(Gn.setTeamState({inviteTokenState:I({},e)}))}catch(e){yield ji(Gn.setTeamError({key:bp.CONFIG_TOKEN_LINK,value:e.message}))}}function*AS(){yield ji(Gn.setTeamError({key:bp.GET_TOKEN_LINK,value:!1}));try{yield Gi(bS);const e=yield Gi(ed.teams.getInviteUserLink),{inviteTokenState:t}=yield aS();yield ji(Gn.setTeamState({inviteTokenState:I({},t,e)}))}catch(e){yield ji(Gn.setTeamError({key:bp.GET_TOKEN_LINK,value:e.message}))}}function*kS({payload:{callback:e}}){yield ji(Gn.setTeamError({key:bp.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield aS();try{const n=yield Gi(ed.teams.createInviteUserLink,{expiresInMinutes:43200});yield ji(Gn.setTeamState({inviteTokenState:I({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield ji(Gn.setTeamError({key:bp.CREATE_TOKEN_LINK,value:t.message}))}}function*TS({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield aS();yield ji(Gn.setTeamError({key:bp.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield Gi(ed.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield ji(Gn.setTeamState({inviteTokenState:I({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield ji(Gn.setTeamError({key:bp.UPDATE_TOKEN_LINK,value:t.message}))}}function*PS({payload:e}){const{callback:t}=null!=e?e:{};yield ji(Gn.setTeamError({key:bp.DELETE_TOKEN_LINK,value:!1}));try{yield Gi(ed.teams.deleteInviteUserLink),yield ji(Gn.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:bp.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*IS({payload:e}){yield ji(Gn.setTeamState({addUserDialogState:I({open:!0,loading:!1,error:!1},e)}))}function*LS({payload:e}){const t=yield aS(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield ji(Gn.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*OS({payload:e}){yield ji(Gn.setTeamState({deleteUserDialogState:I({open:!0,loading:!1,error:!1},e)}))}function*ES({payload:e}){const t=yield aS(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield ji(Gn.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*wS(){yield jo(Gn.loadUsers,rS),yield jo(Gn.loadAllSubTenantsUsers,lS),yield jo(Gn.loadRoles,sS),yield Vo(Gn.addUser,cS),yield Vo(Gn.addUsersBulk,uS),yield Vo(Gn.addUserToSubTenants,dS),yield Vo(Gn.updateUser,yS),yield Vo(Gn.setUserRolesForSubTenants,gS),yield Vo(Gn.deleteUser,fS),yield Vo(Gn.deleteUserFromSubTenants,pS),yield Vo(Gn.resendActivationLink,SS),yield Vo(Gn.resendInvitationLink,vS),yield Vo(Gn.resendInvitationEmail,hS),yield Vo(Gn.resendInvitationLinkToAllSubTenants,mS),yield Vo(Gn.getInvitationLink,AS),yield Vo(Gn.createInvitationLink,kS),yield Vo(Gn.updateInvitationLink,TS),yield Vo(Gn.deleteInvitationLink,PS),yield Vo(Gn.openAddUserDialog,IS),yield Vo(Gn.closeAddUserDialog,LS),yield Vo(Gn.openDeleteUserDialog,OS),yield Vo(Gn.closeDeleteUserDialog,ES)}function*CS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield aS(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(i=e.filter)?i:l.filter,d=null!=(o=e.sort)?o:l.sort;yield ji(Gn.setTeamLoader({key:bp.USERS,value:!a})),yield ji(Gn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield yt(),yield ji(Gn.setTeamState({users:Ld,totalPages:2,totalItems:10,roles:bd,permissions:kd})),yield ji(Gn.setTeamLoader({key:bp.USERS,value:!1})),null==r||r(Ld)}function*DS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield aS(),c=null!=(t=e._limit)?t:s.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:s.allUsersQueryParams._offset,d=null!=(i=e._filter)?i:s.allUsersQueryParams._filter,y=null!=(o=e._sortBy)?o:s.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:s.allUsersQueryParams._order;yield ji(Gn.setTeamLoader({key:bp.USERS,value:!r})),yield ji(Gn.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield yt(),yield ji(Gn.setTeamState({allUsers:Od,totalPages:2,totalItems:10,roles:bd,permissions:kd})),yield ji(Gn.setTeamLoader({key:bp.USERS,value:!1})),null==l||l(Od)}function*RS({payload:e}){var t;yield ji(Gn.setTeamLoader({key:bp.ROLES_AND_PERMISSIONS,value:!0})),yield yt(),yield ji(Gn.setTeamState({roles:bd,permissions:kd})),yield ji(Gn.setTeamLoader({key:bp.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:bd,permissions:kd})}function*_S({payload:e}){const{callback:t}=e,n=ii(e,Yp),i=yield aS();yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})})),yield yt();const o=I({},Pd,n,{id:`${Fp()}`});null==t||t(o),yield ji(Gn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*US({payload:e}){const{callback:t}=e,n=ii(e,Qp),i=yield aS();yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})})),yield yt();const o=I({},Pd,n,{id:`${Fp()}`});yield ji(Gn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*MS({payload:e}){var t;const{callback:n}=e,i=ii(e,Xp),{id:o}=i,a=yield aS(),r=a.users.find((e=>e.id===i.id));yield ji(Gn.setTeamLoader({key:bp.UPDATE_USER,value:o||""})),yield ji(Gn.setTeamState({addUserDialogState:I({},a.addUserDialogState,{loading:!0})})),yield ji(Gn.setTeamState({addUserDialogState:I({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?I({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield yt();const l=I({},r,i);null==n||n(l),yield ji(Gn.setTeamState({users:a.users.map((e=>e.id===l.id?I({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield ji(Gn.setTeamLoader({key:bp.UPDATE_USER,value:!1}))}function*NS({payload:e}){const{callback:t}=e,n=ii(e,Zp),i=yield aS();yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*$S({payload:e}){const{callback:t}=e,n=ii(e,eS),i=yield aS();yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*FS({payload:e}){const{callback:t}=e,n=ii(e,tS);yield ji(Gn.setTeamLoader({key:bp.RESEND_ACTIVATE_LINK,value:n.userId})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamLoader({key:bp.RESEND_ACTIVATE_LINK,value:!1}))}function*xS({payload:e}){const{callback:t}=e,n=ii(e,nS);yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:!1}))}function*VS({payload:e}){const{callback:t}=e,n=ii(e,iS);yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:!1}))}function*jS({payload:e}){const{callback:t}=e,n=ii(e,oS);yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:!1}))}function*WS(){yield jo(Gn.loadUsers,CS),yield jo(Gn.loadAllSubTenantsUsers,DS),yield jo(Gn.loadRoles,RS),yield Vo(Gn.addUser,_S),yield Vo(Gn.addUserToSubTenants,US),yield Vo(Gn.updateUser,MS),yield Vo(Gn.deleteUser,NS),yield Vo(Gn.deleteUserFromSubTenants,$S),yield Vo(Gn.resendActivationLink,FS),yield Vo(Gn.resendInvitationLink,xS),yield Vo(Gn.resendInvitationEmail,VS),yield Vo(Gn.resendInvitationLinkToAllSubTenants,jS),yield Vo(Gn.openAddUserDialog,IS),yield Vo(Gn.closeAddUserDialog,LS),yield Vo(Gn.openDeleteUserDialog,OS),yield Vo(Gn.closeDeleteUserDialog,ES)}const KS=["authorizationUrl"],GS=["events","url"];function*BS(){try{yield ji(Gn.setSocialLoginsState({loading:!0}));const e=yield Gi(ed.auth.getSocialLoginProviders);yield ji(Gn.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield ji(Gn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*zS(){try{const e=yield qi((e=>e.root.context));yield ji(Gn.setSocialLoginsState({loading:!0}));const t=(yield Gi(ed.auth.getSocialLoginProvidersV2)).map((t=>{let{authorizationUrl:n}=t,i=ii(t,KS);const o=zo(e,null!=n?n:"");return I({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield ji(Gn.setSocialLoginsState({socialLoginsConfigV2:t,loading:!1,firstLoad:!1}))}catch(e){yield ji(Gn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*qS(e){let{payload:{events:t,url:n}}=e,i=ii(e.payload,GS);try{yield ji(Gn.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Gi(ed.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:Ud.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:i.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:_d.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield ji(Gn.setLoginState({email:e,isNewUser:r})),yield Yy(),localStorage.removeItem("register-quick-login"),yield ji(Gn.setSocialLoginsState({loading:!1}))}catch(e){var r;yield ji(Gn.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*HS({payload:e}){yield ji(Gn.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*JS(){yield Wo(Gn.loadSocialLoginsConfiguration,BS),yield Wo(Gn.loadSocialLoginsConfigurationV2,zS),yield Wo(Gn.loginViaSocialLogin,qS),yield jo(Gn.setSocialLoginError,HS)}let YS;function*QS({payload:e}){yield ji(Gn.setApiTokensState({apiTokenType:e}));try{if(yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})),"user"===e){const e=yield Gi(ed.auth.getUserApiTokensData);yield ji(Gn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{const e=yield Gi(ed.auth.getTenantApiTokensData),{items:t}=yield Gi(ed.teams.loadAvailableRoles),{items:n}=yield Gi(ed.teams.loadAvailablePermissions);yield ji(Gn.setApiTokensState({apiTokensDataTenant:null!=e?e:[],roles:null!=t?t:[],permissions:null!=n?n:[]}))}yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1}))}catch(e){yield ji(Gn.setApiTokensError({key:YS.LOAD_API_TOKENS,value:e.message})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1}))}}function*XS({payload:e}){const{description:t,callback:n}=e,{apiTokensDataUser:i}=yield qi((e=>e.auth.apiTokensState));try{yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!0}));const e=yield Gi(ed.auth.updateUserApiTokensData,{description:t});yield ji(Gn.setApiTokensState({showAddTokenDialog:!1})),yield Hi(200),yield ji(Gn.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!1})),null==n||n(null)}catch(e){yield ji(Gn.setApiTokensError({key:YS.ADD_API_TOKEN,value:e.message})),yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!1})),null==n||n(null,e.message)}}function*ZS({payload:e}){const{description:t,roleIds:n,callback:i}=e,{apiTokensDataTenant:o}=yield qi((e=>e.auth.apiTokensState));try{yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!0}));const e=yield Gi(ed.auth.updateTenantApiTokensData,{description:t,roleIds:n});yield ji(Gn.setApiTokensState({showAddTokenDialog:!1})),yield Hi(200),yield ji(Gn.setApiTokensState({apiTokensDataTenant:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield ji(Gn.setApiTokensError({key:YS.ADD_API_TOKEN,value:e.message})),yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*ev({payload:e}){const{apiTokensDataUser:t}=yield qi((e=>e.auth.apiTokensState));try{yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!0})),yield Gi(ed.auth.deleteUserApiToken,{tokenId:e}),yield ji(Gn.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!1}))}catch(e){yield ji(Gn.setApiTokensError({key:YS.DELETE_API_TOKEN,value:e.message})),yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!1}))}}function*tv({payload:e}){const{apiTokensDataTenant:t}=yield qi((e=>e.auth.apiTokensState));try{yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!0})),yield Gi(ed.auth.deleteTenantApiToken,{tokenId:e}),yield ji(Gn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!1}))}catch(e){yield ji(Gn.setApiTokensError({key:YS.DELETE_API_TOKEN,value:e.message})),yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!1}))}}function*nv({payload:e}){null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield Wi([Gi(ed.auth.getUserApiTokensData),Gi(ed.auth.getTenantApiTokensData)]);yield ji(Gn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setApiTokensError({key:YS.LOAD_API_TOKENS,value:t.message})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*iv({payload:e}){null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield Gi(ed.auth.getUserApiTokensData);yield ji(Gn.setApiTokensState({apiTokensDataUser:null!=n?n:[]})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setApiTokensError({key:YS.LOAD_API_TOKENS,value:t.message})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*ov({payload:e}){null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield Gi(ed.auth.getTenantApiTokensData);yield ji(Gn.setApiTokensState({apiTokensDataTenant:null!=n?n:[]})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setApiTokensError({key:YS.LOAD_API_TOKENS,value:t.message})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*av(){yield Wo(Gn.loadApiTokens,nv),yield Wo(Gn.loadUserApiTokens,iv),yield Wo(Gn.loadTenantApiTokens,ov),yield Wo(Gn.initApiTokensData,QS),yield Vo(Gn.addUserApiToken,XS),yield Vo(Gn.addTenantApiToken,ZS),yield jo(Gn.deleteTenantApiToken,tv),yield jo(Gn.deleteUserApiToken,ev)}function*rv({payload:e}){if(yield ji(Gn.setApiTokensState({apiTokenType:e})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})),"user"===e){yield Hi(200);const e=[sd];yield ji(Gn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{var t;yield Hi(200),yield ji(Gn.setApiTokensState({apiTokensDataTenant:null!=(t=[cd])?t:[],roles:null!=bd?bd:[],permissions:null!=kd?kd:[]}))}yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1}))}function*lv({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield qi((e=>e.auth.apiTokensState)),a=I({},cd,{description:t,roleIds:n,clientId:`CLIENT_ID_${Fp()}`});yield ji(Gn.setApiTokensState({showAddTokenDialog:!1})),yield Hi(200),yield ji(Gn.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Hi(200),yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*sv({payload:e}){yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!0})),yield Hi(200);const t=[cd];yield ji(Gn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!1}))}function*cv({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})));const n=[sd],i=[cd];yield ji(Gn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Hi(200),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*uv({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})));const n=[sd];yield ji(Gn.setApiTokensState({apiTokensDataUser:n})),yield Hi(200),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*dv({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})));const n=[cd];yield ji(Gn.setApiTokensState({apiTokensDataTenant:n})),yield Hi(200),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*yv(){yield Wo(Gn.loadApiTokens,cv),yield Wo(Gn.loadUserApiTokens,uv),yield Wo(Gn.loadTenantApiTokens,dv),yield Wo(Gn.initApiTokensData,rv),yield Vo(Gn.addTenantApiToken,lv),yield jo(Gn.deleteTenantApiToken,sv)}function*fv({payload:e}){try{var t;yield ji(Gn.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield qi((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Gi(ed.accountSettings.updateSettings,I({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield ji(Gn.setAccountSettingsState(I({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield ji(Gn.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*gv({payload:e}){yield ji(Gn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Gi(ed.accountSettings.getSettings);yield ji(Gn.setAccountSettingsState(I({},e,{loading:!1})))}catch(e){yield ji(Gn.setAccountSettingsState({loading:!1,error:e.message}))}}function*pv(){yield Wo(Gn.saveAccountSettings,fv),yield Wo(Gn.loadAccountSettings,gv)}function*Sv({payload:e}){var t;yield ji(Gn.setAccountSettingsState({loading:!0})),yield yt();const{accountSettingsState:n}=yield qi((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=I({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield ji(Gn.setAccountSettingsState(I({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*vv({payload:e}){yield ji(Gn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield yt(),yield ji(Gn.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*hv(){yield Wo(Gn.saveAccountSettings,Sv),yield Wo(Gn.loadAccountSettings,vv)}function*mv({payload:{tenantId:e,callback:t}}){yield ji(Gn.setState({isLoading:!0}));try{yield Gi(ed.tenants.switchTenant,{tenantId:e}),yield Gi(Yy),(null==t?void 0:t(!0))||(yield ji(Gn.setState({isLoading:!1})))}catch(e){yield ji(Gn.setState({isLoading:!1})),null==t||t(!1,e)}}function*bv({payload:e}){yield ji(Gn.setTenantsState({loading:!0}));try{var t;const n=yield Gi(ed.tenants.getTenants);yield ji(Gn.setTenantsState({tenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield ji(Gn.setTenantsState({loading:!1}))}}function*Av({payload:e}){yield ji(Gn.setTenantsState({loading:!0}));try{var t;const n=yield Gi(ed.tenants.getSubTenants);yield ji(Gn.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*kv({payload:e}){yield ji(Gn.setTenantsState({loading:!0}));try{var t;const n=yield Gi(ed.tenants.getSubTenantsAsTree);yield ji(Gn.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Tv(){yield Vo(Gn.loadTenants,bv),yield Vo(Gn.loadSubTenants,Av),yield Vo(Gn.switchTenant,mv),yield Vo(Gn.loadSubTenantsTree,kv)}function*Pv(){yield ji(Gn.setTenantsState({loading:!0})),yield yt(),yield ji(Gn.setTenantsState({tenants:Ed,loading:!1}))}function*Iv(){yield Vo(Gn.loadTenants,Pv)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(YS||(YS={}));const Lv=["callback"],Ov=["callback"],Ev=["callback"],wv=["callback"],Cv=["callback"];function*Dv({payload:e}){var t;yield ji(Gn.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Wi([Gi(ed.roles.getRoles),Gi(ed.roles.getPermissions),Gi(ed.roles.getPermissionCategories)]),[t,n,i]=e;yield ji(Gn.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield ji(Gn.setRolesState({error:e.message,loading:!1}))}}function*Rv(e){let{payload:{callback:t}}=e,n=ii(e.payload,Lv);yield ji(Gn.setRolesState({saving:!0}));try{const e=yield Gi(ed.roles.addRole,n),i=yield Gi(ed.roles.getRoles);yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*_v(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ov);yield ji(Gn.setRolesState({saving:!0}));try{yield Gi(ed.roles.deleteRole,n),yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*Uv(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ev);yield ji(Gn.setRolesState({saving:!0}));try{const e=yield Gi(ed.roles.updateRole,n);yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Mv(e){let{payload:{callback:t}}=e,n=ii(e.payload,wv);yield ji(Gn.setRolesState({saving:!0}));try{const e=yield Gi(ed.roles.attachPermissionsToRole,n);yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Nv(e){let{payload:{callback:t}}=e,n=ii(e.payload,Cv);yield ji(Gn.setRolesState({saving:!0}));try{const e=yield Gi(ed.roles.attachPermissionToRoles,n);yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*$v(){yield Wo(Gn.loadRolesAndPermissions,Dv),yield Vo(Gn.addRole,Rv),yield Vo(Gn.deleteRole,_v),yield Vo(Gn.updateRole,Uv),yield Vo(Gn.attachPermissionsToRole,Mv),yield Vo(Gn.attachPermissionToRoles,Nv)}const Fv=["callback"],xv=["callback"],Vv=["callback"];function*jv(e){let{payload:{callback:t}}=e,n=ii(e.payload,Fv);yield ji(Gn.setResetPhoneNumberState({loading:!0}));try{const e=yield Gi(ed.auth.resetPhoneNumber,n);yield ji(Gn.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:jt.VerifyResetPhoneNumber})),yield ji(Gn.setLoginState({email:n.email}))}catch(e){yield ji(Gn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Wv(e){let{payload:{callback:t}}=e,n=ii(e.payload,xv);yield ji(Gn.setResetPhoneNumberState({loading:!0}));try{const e=yield Gi(ed.auth.verifyResetPhoneNumber,n);yield ji(Gn.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:jt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield ji(Gn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Kv(e){let{payload:{callback:t}}=e,n=ii(e.payload,Vv);yield ji(Gn.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Gi(ed.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield ji(Gn.setLoginState({step:vt.loginWithSmsOtc})),yield ji(Gn.passwordlessPreLogin({type:rr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield ji(Gn.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Gv(){yield Wo(Gn.resetPhoneNumber,jv),yield Wo(Gn.verifyResetPhoneNumber,Wv),yield Wo(Gn.changePhoneNumber,Kv)}function*Bv(){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getCurrentUserSessions);yield ji(Gn.setSessionsState({sessions:e,loading:!1}))}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*zv(){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getCurrentUserSession);yield ji(Gn.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*qv({payload:{id:e}}){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{yield Gi(ed.auth.deleteSessionForUser,e),yield ji(Gn.loadUserSessions())}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*Hv({payload:{callback:e,userId:t}}){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{yield Gi(ed.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield ji(Gn.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Jv(){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{yield Gi(ed.auth.deleteAllSessionsForUser),yield ji(Gn.loadUserSessions())}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*Yv(){yield jo(Gn.loadUserSessions,Bv),yield jo(Gn.deleteUserSession,qv),yield jo(Gn.deleteAllUserSessions,Jv),yield jo(Gn.loadCurrentUserSession,zv),yield Vo(Gn.revokeUserSessions,Hv)}function*Qv(){yield ji(Gn.setSessionsState({loading:!0,error:null})),yield ji(Gn.setSessionsState({sessions:wd,loading:!1}))}function*Xv({payload:{id:e}}){yield ji(Gn.setSessionsState({loading:!0,error:null}));const t=(yield qi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield ji(Gn.setSessionsState({sessions:t,loading:!1}))}function*Zv(){yield ji(Gn.setSessionsState({loading:!0,error:null}));const e=wd.filter((e=>e.current));yield ji(Gn.setSessionsState({sessions:e,loading:!1}))}function*eh(){yield jo(Gn.loadUserSessions,Qv),yield jo(Gn.deleteUserSession,Xv),yield jo(Gn.deleteAllUserSessions,Zv)}const th=["callback"],nh=["callback"];function*ih(){yield ji(Gn.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getSessionConfigurations);yield ji(Gn.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*oh({payload:e}){yield ji(Gn.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=ii(e,th);yield Gi(ed.auth.createOrUpdateSessionConfigrations,n),yield ji(Gn.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield ji(Gn.setSessionsPolicyState({error:e,loading:!1}))}}function*ah(){yield Wo(Gn.loadSessionsPolicy,ih),yield jo(Gn.createOrUpdateSessionsPolicy,oh)}function*rh(){yield ji(Gn.setSessionsPolicyState({loading:!0,error:null}));const e=yield qi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Cd}));yield ji(Gn.setSessionsPolicyState(I({},e,{loading:!1})))}function*lh({payload:e}){yield ji(Gn.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=ii(e,nh);null==t||t(!0),yield ji(Gn.setSessionsPolicyState({configurations:n,loading:!1}))}function*sh(){yield Wo(Gn.loadSessionsPolicy,rh),yield jo(Gn.createOrUpdateSessionsPolicy,lh)}const ch=["callback"],uh=["callback"],dh=["callback"],yh=["callback"],fh=["callback"],gh=["callback"],ph=["callback"],Sh=["callback"],vh=()=>qi((e=>e.auth.restrictionsState.ipRestrictions)),hh=()=>qi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*mh(){yield ji(Gn.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getDomainRestrictionsConfig),t=(yield Gi(ed.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ji(Gn.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield ji(Gn.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*bh(e){let{payload:{callback:t}}=e,n=ii(e.payload,ch);yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield hh();try{var o;yield Gi(ed.auth.createDomainRestriction,n);const e=(yield Gi(ed.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield ji(Gn.setEmailDomainRestrictionsState({data:{config:(null==(o=i.data)?void 0:o.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ah(e){let{payload:{callback:t}}=e,n=ii(e.payload,uh);yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Gi(ed.auth.updateDomainRestrictionConfig,n),i=(yield Gi(ed.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ji(Gn.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*kh({payload:{id:e}}){yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield hh();try{var n;yield Gi(ed.auth.deleteDomainRestriction,e);const i=(yield Gi(ed.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield ji(Gn.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:_n.ALLOW},restrictions:i},saving:!1}))}catch(e){yield ji(Gn.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Th=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:_n.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*Ph(){yield ji(Gn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield vh(),t=yield Gi(ed.auth.getIPRestrictionsConfig),n=Th({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield Gi(ed.auth.getIPRestrictions,n);yield ji(Gn.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield ji(Gn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Ih(){try{const{valid:e}=yield Gi(ed.auth.testCurrentIpInAllowList);yield ji(Gn.setIpRestrictionsState({userIpValid:e}))}catch(e){yield ji(Gn.setIpRestrictionsState({error:e.message}))}}function*Lh({payload:{callback:e}}){yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield qi((e=>e.auth.userIp));yield Wi([Gi(ed.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:_n.ALLOW}),Gi(ed.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield vh(),i=Th(n.pagination),{items:o,_metadata:{totalPages:a}}=yield Gi(ed.auth.getIPRestrictions,i);yield ji(Gn.setIpRestrictionsState({data:{config:{isActive:!0,strategy:_n.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield ji(Gn.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Oh(e){let{payload:{callback:t}}=e,n=ii(e.payload,dh);yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));const i=yield vh();try{var o,a;yield Gi(ed.auth.createIPRestriction,n);const e=yield vh(),r=Th(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Gi(ed.auth.getIPRestrictions,r);yield Ih(),yield ji(Gn.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:_n.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Eh(e){let{payload:{callback:t}}=e,n=ii(e.payload,yh);yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));try{yield Gi(ed.auth.updateIPRestrictionConfig,n);const e=yield vh(),i=yield Gi(ed.auth.getIPRestrictionsConfig),o=Th(I({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield Gi(ed.auth.getIPRestrictions,o);yield Ih(),yield ji(Gn.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*wh({payload:{id:e,callback:t}}){yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));const n=yield vh();try{var i;yield Gi(ed.auth.deleteIPRestriction,e);const o=yield vh(),a=Th(o.pagination),{items:r,_metadata:{totalPages:l}}=yield Gi(ed.auth.getIPRestrictions,a);yield Ih(),yield ji(Gn.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:_n.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ch(){yield Wo(Gn.loadIpRestrictions,Ph),yield Wo(Gn.loadEmailDomainRestrictions,mh),yield Vo(Gn.saveIpRestriction,Oh),yield Vo(Gn.saveIpRestrictionsConfig,Eh),yield Vo(Gn.deleteIpRestriction,wh),yield Vo(Gn.checkIfUserIpValid,Ih),yield Vo(Gn.addCurrentUserIpAndActivate,Lh),yield Vo(Gn.saveEmailDomainRestriction,bh),yield Vo(Gn.saveEmailDomainRestrictionsConfig,Ah),yield Vo(Gn.deleteEmailDomainRestriction,kh)}function*Dh(){yield ji(Gn.setIpRestrictionsState({loading:!0,error:null})),yield ji(Gn.setIpRestrictionsState({data:{restrictions:Rd.filter((e=>e.strategy===Dd.strategy)),config:Dd},totalPages:1,pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Rh(){yield ji(Gn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield vh(),t=Rd[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield ji(Gn.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield ji(Gn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*_h(e){var t,n,i;let{payload:{callback:o}}=e,a=ii(e.payload,fh);yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));const r=yield vh(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield ji(Gn.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:_n.ALLOW},restrictions:[...l,I({},a,{createdAt:new Date,updatedAt:new Date,id:Fp(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*Uh(e){var t,n,i;let{payload:{callback:o}}=e,a=ii(e.payload,gh);const r=yield vh();yield ji(Gn.setIpRestrictionsState({saving:!0,error:null})),yield ji(Gn.setIpRestrictionsState({data:{config:I({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield ji(Gn.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*Mh({payload:{id:e,callback:t}}){var n;yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));const i=yield vh();yield ji(Gn.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:_n.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*Nh(){yield ji(Gn.setEmailDomainRestrictionsState({loading:!0,error:null})),yield ji(Gn.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:_n.ALLOW}],config:{active:!0,listType:_n.ALLOW,blockPublicDomains:!1}}}))}function*$h(e){var t,n;let{payload:{callback:i}}=e,o=ii(e.payload,ph);const a=yield hh();yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),null==i||i(!0),yield ji(Gn.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],I({},o,{id:Date.now().toString()})]},saving:!1}))}function*Fh(e){var t;let{payload:{callback:n}}=e,i=ii(e.payload,Sh);const o=yield hh();yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),null==n||n(!0),yield ji(Gn.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||_n.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*xh({payload:{id:e}}){var t,n;const i=yield hh();yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),yield ji(Gn.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:_n.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*Vh(){yield Wo(Gn.loadIpRestrictions,Dh),yield Wo(Gn.loadEmailDomainRestrictions,Nh),yield Vo(Gn.saveIpRestriction,_h),yield Vo(Gn.saveIpRestrictionsConfig,Uh),yield Vo(Gn.deleteIpRestriction,Mh),yield Vo(Gn.checkIfUserIpValid,Rh),yield Vo(Gn.saveEmailDomainRestriction,$h),yield Vo(Gn.saveEmailDomainRestrictionsConfig,Fh),yield Vo(Gn.deleteEmailDomainRestriction,xh)}const jh=["callback"],Wh=["id"];function*Kh(e){const{count:t}=yield Gi(ed.directory.countConfigurationUsers,e.id);return I({},e,{count:t})}function*Gh(){yield ji(Gn.setProvisioningState({loading:!0,error:null}));try{const e=yield Gi(ed.directory.getConfigs),t=yield Wi(e.map((e=>Kh(e))));yield ji(Gn.setProvisioningState({connections:t,loading:!1}))}catch(e){yield ji(Gn.setProvisioningState({error:e.message,loading:!1}))}}function*Bh(e){let{payload:{callback:t}}=e,n=ii(e.payload,jh);yield ji(Gn.setProvisioningState({loading:!0,error:null}));try{const e=yield Gi(ed.directory.createConfiguration,n),i=yield Gi(ed.directory.getConfigs),o=yield Wi(i.map((e=>Kh(e))));yield ji(Gn.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield ji(Gn.setProvisioningState({error:e.message,loading:!1}))}}function*zh(e){let{payload:{id:t}}=e,n=ii(e.payload,Wh);yield ji(Gn.setProvisioningState({loading:!0,error:null}));try{yield Gi(ed.directory.updateConfiguration,t,n);const e=yield Gi(ed.directory.getConfigs),i=yield Wi(e.map((e=>Kh(e))));yield ji(Gn.setProvisioningState({connections:i,loading:!1}))}catch(e){yield ji(Gn.setProvisioningState({error:e.message,loading:!1}))}}function*qh({payload:{id:e,callback:t}}){yield ji(Gn.setProvisioningState({loading:!0,error:null}));try{yield Gi(ed.directory.deleteConfiguration,e);const n=yield Gi(ed.directory.getConfigs),i=yield Wi(n.map((e=>Kh(e))));yield ji(Gn.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*Hh(){yield Wo(Gn.loadProvisionConnections,Gh),yield Vo(Gn.createProvisionConnection,Bh),yield Vo(Gn.deleteProvisionConnection,qh),yield Vo(Gn.updateProvisionConnection,zh)}var Jh={sagas:function*(){yield Wi([Gi(Mf),Gi(Ep),Gi(Cp),Gi(mp),Gi(Gv),Gi(Qf),Gi(kg),Gi(Eg),Gi(ap),Gi(wS),Gi(JS),Gi(Vd),Gi(av),Gi(yy),Gi(pv),Gi(Tv),Gi($v),Gi(Yv),Gi(ah),Gi(Ch),Gi(Hh)])},mockSagas:function*(){yield Wi([Gi(Ff),Gi(og),Gi(Rg),Gi(gp),Gi(WS),Gi(yv),Gi(Ty),Gi(eh),Gi(hv),Gi(Iv),Gi(sh),Gi(Vh)])},storeName:kt,initialState:jn,reducer:Wn,actions:Gn};const Yh=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>I({},t,{[e]:I({},t[e],n)})}),Qh={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Xh={setAuditLogsState:Yh("auditLogsState"),resetAuditLogsState:e=>I({},e,{auditLogsState:Qh})},Zh={exportAuditsCsv:it("auditLogs/exportAuditsCsv"),loadAuditLogs:it("auditLogs/loadAuditLogs",(e=>({payload:e})))},em={loading:!0},tm={setAuditsMetadataState:Yh("auditsMetadataState"),resetAuditsMetadataState:e=>I({},e,{auditsMetadataState:em})},nm={loadAuditsMetadata:it("auditLogs/loadAuditsMetadata")},im={auditLogsState:Qh,auditsMetadataState:em},{reducer:om,actions:am}=at({name:Pt,initialState:im,reducers:I({resetState:e=>I({},e,im),setState:(e,{payload:t})=>I({},e,t)},Xh,tm)}),rm=I({},am,Zh,nm),lm=e=>"createdAt"!==e.id,sm={total:20,data:Array.from(Array(5).keys()).map((e=>I({ip:"198.143.51.1",user:"Demo User Name",email:"demo-user@frontegg.com"},(()=>{switch(Math.floor(6*Math.random())){case 0:return{action:"Updated profile",description:"User updated profile details",severity:"Info"};case 1:return{action:"User logged in",severity:"Info",description:"User logged in to the product"};case 2:return{action:"User failed to login",severity:"High",description:"User failed to login with password"};case 3:return{action:"Added user",severity:"Info",description:"Added user david+535@frontegg.com to tenant"};case 4:return{action:"Assigned roles",severity:"Info",description:"Assigned 0 roles for user"};case 5:return{action:"Removed user david+108@frontegg.com from account",severity:"Info",description:"Removed access from the account for user david+108@frontegg.com"}}})(),{json:{key1:"value1",key2:"value2",key3:"value3",key4:"value4"},tenantId:"my-tenant-id",vendorId:"my-vendor-id",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",createdAt:`2022-04-07 10:${50-e}:40.201`})))},cm={properties:[{showInTable:!0,name:"createdAt",displayName:"Time",type:"Timestamp",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!1},{showInTable:!0,name:"email",displayName:"User",type:"Email",filterable:!0,sortable:!0,isPredefined:!0,chosen:!1,selected:!1},{showInTable:!0,name:"action",displayName:"Action",type:"AlphaNumeric",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!0,name:"description",type:"AlphaNumeric",sortable:!1,filterable:!1,displayName:"Description",isPredefined:!0,chosen:!1,selected:!1},{showInTable:!0,name:"ip",displayName:"IP Address",type:"IpAddress",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!1,name:"severity",displayName:"Severity",type:"Severity",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!1,name:"userAgent",displayName:"User Agent",type:"AlphaNumeric",filterable:!0,sortable:!0,isPredefined:!0,chosen:!1,selected:!1},{showInTable:!1,name:"json",type:"Json",sortable:!0,filterable:!0,displayName:"Json Data",showInMoreInfo:"Always",isPredefined:!1}]},um=()=>qi((e=>e.auditLogs.auditLogsState)),dm=()=>qi((e=>e.auditLogs.auditsMetadataState));function*ym(){const e=yield um(),{columns:t}=yield dm();try{const n=e.filter,i=e.sort.reduce(((e,t)=>I({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>I({},e,{[t.id]:t.value})),{});yield ji(rm.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield ed.audits.exportAudits(I({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield ji(rm.setAuditLogsState({isDownloadingCsv:!1}))}function*fm({payload:e}){yield ji(rm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield um(),{columns:n}=yield dm();try{var i,o,a,r,l;const s=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield ji(rm.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>I({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>I({},e,{[t.id]:t.value})),{});n||(yield ji(rm.loadAuditsMetadata()));const{data:g,total:p}=yield Gi(ed.audits.getAudits,I({offset:c,count:s},y,f));yield ji(rm.setAuditLogsState({loading:!1,logs:null!=g?g:[],totalPages:+Math.ceil(p/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield ji(rm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*gm(){yield Vo(rm.exportAuditsCsv,ym),yield Vo(rm.loadAuditLogs,fm)}function*pm({payload:e}){yield ji(rm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield um(),{columns:n}=yield dm();try{var i,o,a,r,l;const s=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield ji(rm.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield ji(rm.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=sm;let i=n.filter((e=>t=>e.filter(lm).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];i=i.sort(((e,t)=>(n,i)=>n[e]>i[e]?t?-1:1:i[e]>n[e]?t?1:-1:0)(e,n))}return{data:i,total:i.length}})(u,d);yield ji(rm.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield ji(rm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Sm(){yield Vo(rm.loadAuditLogs,pm)}function*vm(){yield ji(rm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Gi(ed.metadata.getAuditsMetadata);yield ji(rm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ji(rm.setAuditsMetadataState({error:e,loading:!1}))}}function*hm(){yield Vo(rm.loadAuditsMetadata,vm)}function*mm(){yield ji(rm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=cm;yield ji(rm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ji(rm.setAuditsMetadataState({error:e,loading:!1}))}}function*bm(){yield Vo(rm.loadAuditsMetadata,mm)}var Am={sagas:function*(){yield Wi([Gi(gm),Gi(hm)])},mockSagas:function*(){yield Wi([Gi(Sm),Gi(bm)])},storeName:Pt,initialState:im,reducer:om,actions:rm};const km={total:0,offset:0,filter:"",sortBy:"createdAt",context:null,filters:[],rowsData:[],lastUpdated:new Date,isLoading:!0,isFetchMore:!1,totalToday:0,currentPage:0,headerProps:[],sortDirection:"desc",severeThisWeek:0,predefinedFilters:[],isDownloadingCsv:!1,virtualScroll:!1},{name:Tm,actions:Pm,reducer:Im}=at({name:"audits",initialState:km,reducers:{setContext:(e,{payload:t})=>{e.context=t},startLoading:e=>{e.isLoading=!0},setVirtualScroll:(e,{payload:t})=>{e.virtualScroll=t},startRefresh:e=>{e.isLoading=!0},startFetching:e=>{e.isFetchMore=!0},finishLoading:e=>{e.isLoading=!1},startDownloadingCsv:e=>{e.isDownloadingCsv=!0},stopDownloadingCsv:e=>{e.isDownloadingCsv=!1},loadStatsSuccess:(e,{payload:t})=>{e.error=void 0,e.totalToday=t.totalToday,e.severeThisWeek=t.severeThisWeek},loadItemFailedAction:(e,{payload:t})=>{e.error=I({},e.error,{[t.name]:t.error})},loadMetadataSuccess:(e,{payload:t})=>{e.error={},e.headerProps=t.properties,e.themeAudits=t.theme?t.theme.styles:{}},loadAuditsSuccess:(e,{payload:t})=>{e.error={},e.rowsData=t.rowsData,e.lastUpdated=new Date,e.total=t.total},fetchMoreSuccess:(e,{payload:t})=>{e.error={},e.offset=t.offset,e.currentPage=t.currentPage,e.isFetchMore=!1},setFilterData:(e,{payload:t})=>{e.filters=t,e.currentPage=0,e.offset=0,e.isLoading=!0},textSearch:(e,{payload:t})=>{e.filter=t,e.currentPage=0,e.offset=0,e.isLoading=!0},onPageChange:(e,{payload:t})=>{e.currentPage=t-1,e.offset=20*e.currentPage,e.isLoading=!0},setDataSorting:(e,{payload:t})=>{e.sortBy=t.sortBy,e.currentPage=0,e.sortDirection="asc"===t.sortDirection?"desc":"asc",e.offset=0,e.isLoading=!0},setPredefinedFilters:(e,{payload:t})=>{e.predefinedFilters=t,e.filters=Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),Lm=I({},Pm,{initData:it(`${Tm}/initData`),loadAudits:it(`${Tm}/loadAudits`),removeFilter:it(`${Tm}/removeFilter`),filterData:it(`${Tm}/filterData`),exportCSV:it(`${Tm}/exportCSV`),deleteAudits:it(`${Tm}/deleteAudits`)}),Om=()=>qi((e=>e[Tm]));function*Em(){const{sortBy:e,sortDirection:t}=yield Om();try{const n=yield Gi(ed.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield ji(Lm.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield ji(Lm.loadItemFailedAction(t))}}function*wm(){try{const e=yield Gi(ed.metadata.getAuditsMetadata);yield ji(Lm.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield ji(Lm.loadItemFailedAction(t))}}const Cm=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Dm({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield Om(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield Om():{rowsData:[]};try{const e=Cm(t),{data:l,total:d}=yield Gi(ed.audits.getAudits,I({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield ji(Lm.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield ji(Lm.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield ji(Lm.loadItemFailedAction(t))}}function*Rm(){yield ji(Lm.startLoading()),yield Wi([Em(),wm(),Dm({payload:{onlyOneLoad:!1},type:""})]),yield ji(Lm.finishLoading())}function*_m({payload:e}){const{filters:t}=yield Om(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield ji(Lm.setFilterData(i))}function*Um({payload:e}){const{filters:t}=yield Om();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const i=[...t.slice(0,n),e,...t.slice(n+1)];yield ji(Lm.setFilterData(i))}function*Mm(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield Om(),a=Cm(e);yield ji(Lm.startDownloadingCsv());try{yield ed.audits.exportAudits(I({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield ji(Lm.stopDownloadingCsv())}}function*Nm(){yield jo(Lm.initData,Rm),yield jo(Lm.removeFilter,_m),yield jo(Lm.filterData,Um),yield jo([Lm.loadAudits,Lm.textSearch,Lm.onPageChange],Dm),yield jo([Lm.setFilterData,Lm.setDataSorting,Lm.startRefresh],(()=>Dm({payload:{appendMode:!1},type:""}))),yield jo(Lm.exportCSV,Mm)}const $m={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},Fm={initData:()=>I({},$m),setConnectivityState:(e,{payload:t})=>I({},e,t),cleanWebhookTestData:e=>I({},e,{testResult:void 0}),cleanWebhookLogsData:e=>I({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return I({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>I({},e,{error:void 0}),cleanSlackData:e=>I({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>I({},e,{retryResult:I({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>I({},e,{retryResult:I({},e.retryResult,t)})}},xm={loadSlackActions:it("connectivity/loadSlackActions"),loadDataAction:it("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:it("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:it("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:it("connectivity/loadScope"),deleteWebhookConfigAction:it("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:it("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:it("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},Vm={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:jm,actions:Wm}=at({name:Tt,initialState:Vm,reducers:I({},Fm)}),Km=I({},Wm,xm),Gm={slack:ed.connectivity.getSlackConfiguration,email:ed.connectivity.getEmailConfiguration,sms:ed.connectivity.getSMSConfiguration,webhook:ed.connectivity.getWebhooksConfigurations,categories:ed.connectivity.getCategories,channelMap:ed.connectivity.getChannelMaps},Bm={slack:ed.connectivity.postSlackConfiguration,email:ed.connectivity.postEmailConfiguration,sms:ed.connectivity.postSMSConfiguration,webhook:ed.connectivity.postWebhooksConfiguration},zm=["email","slack","sms","webhook"],qm={sms:{title:"connectivity.sms",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({enabled:e})=>e)))&&t},image:"sms"},email:{title:"common.email",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({enabled:e})=>e)))&&t},image:"email"},slack:{title:"connectivity.slack",events:e=>{var t;return(null==e||null==(t=e.slackSubscriptions)?void 0:t.length)||0},isActive:e=>{var t;return null!=(t=!(null==e||!e.slackSubscriptions.some((({isActive:e})=>e))))&&t},image:"slack"},webhook:{title:"connectivity.webhook",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({isActive:e})=>e)))&&t},image:"webhook"}},Hm=["id"],Jm=["id","enabled"],Ym=["categories","channelMap"];function*Qm(e){return yield Gi(Zm,{payload:{api:e},type:""})}function*Xm({payload:e=zm}){yield ji(Km.setConnectivityState({isLoading:!0}));try{const t=yield Wi([...e.map(Qm),yield Zm({payload:{api:"categories"},type:""}),yield function*(){return(yield Wi(e.map((function*(e){return yield Zm({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>I({},t,{[`${e[i]}`]:n})),{})}()]),n=yield Zm({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?I({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:qm[e[o]].events(i),active:qm[e[o]].isActive(i),platform:qm[e[o]].title,image:qm[e[o]].image}]}):n:I({},n,{[`${Ym[o-e.length]}`]:i})),{list:[],webhook:n});yield ji(Km.setConnectivityState(I({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield ji(Km.setConnectivityState({isLoading:!1}))}}function*Zm({payload:{api:e,params:t}}){try{return yield Gi(Gm[e],t)}catch(e){return}}function*eb(){try{yield ji(Km.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Gi(ed.connectivity.getSlackChannels);yield ji(Km.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield ji(Km.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*tb(e,t){const{connectivity:{list:n}}=yield qi(),i=n.find((({key:t})=>t===e));if(!i)return;const o=qm[e].isActive(t);o!==i.active&&(yield ji(Km.setConnectivityState({list:n.map((t=>t.key===e?I({},t,{active:o}):t))})))}function*nb({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield qi((e=>e.connectivity));try{if(yield ji(Km.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield qi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield Wi([...i.reduce(((e,t)=>{var i,o;return!t.id&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length||(null==n?void 0:n.find((e=>{let{id:n}=e,i=ii(e,Hm);return n===t.id&&JSON.stringify(I({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield Gi(Bm.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Gi(ed.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield qi(),{processIds:i}=yield qi((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield Wi([...e.reduce(((e,t)=>!o.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield Gi("email"===t?ed.connectivity.postEmailConfiguration:ed.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:i}=e,o=n[0],{id:a="",enabled:r}=o,l=ii(o,Jm);return yield Wi([yield Gi("email"===t?ed.connectivity.patchEmailConfiguration:ed.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield Gi("email"===t?ed.connectivity.putEmailSubscriptions:ed.connectivity.putSMSSubscriptions,a,i,I({},l,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return Gi("email"===t?ed.connectivity.deleteEmailSubscriptions:ed.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield Zm({payload:{api:t},type:""});yield ji(Km.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield tb(t,e)}else yield ji(Km.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield Gi(Bm[e],t),!["sms","email"].includes(e)){const o=yield Zm({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield ji(Km.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield tb(e,o),null==n||n(!0)}}catch(e){var o;yield ji(Km.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*ib({payload:e}){try{yield ed.connectivity.postSlackCode(e)}catch{}yield ji(Km.setConnectivityState({error:void 0,isSaving:!1}))}function*ob(){const{slackChannels:e}=yield qi((e=>e.connectivity));try{yield ji(Km.setConnectivityState({slackChannels:I({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Gi(ed.connectivity.getSlackScope);yield ji(Km.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield ji(Km.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*ab({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield qi((e=>e.connectivity));try{yield ji(Km.setConnectivityState({isSaving:!0})),yield Gi(ed.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield Zm({payload:{api:"webhook"},type:""});o&&(yield ji(Km.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*rb({payload:e}){try{yield ji(Km.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Gi(ed.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield ji(Km.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield ji(Km.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield ji(Km.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*lb({payload:e}){try{const{statusCode:t}=yield Gi(ed.connectivity.postWebhookRetry,e);yield ji(Km.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield ji(Km.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*sb({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield qi((e=>e.connectivity));try{yield ji(Km.setConnectivityState({webhookLogs:I({},i,{isLoading:!0})}));const o=yield Gi(ed.connectivity.getWebhookLog,e,n,t);yield ji(Km.setConnectivityState({error:void 0,webhookLogs:I({isLoading:!1},o)}))}catch(e){yield ji(Km.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var cb={sagas:function*(){yield Vo(Km.loadDataAction,Xm),yield jo(Km.loadSlackActions,eb),yield Vo(Km.postDataAction,nb),yield Vo(Km.postCodeAction,ib),yield Vo(Km.loadScope,ob),yield Vo(Km.deleteWebhookConfigAction,ab),yield Vo(Km.postWebhookTestAction,rb),yield Vo(Km.postWebhookRetryAction,lb),yield jo(Km.loadWebhookLogsAction,sb)},storeName:Tt,initialState:Vm,reducer:jm,actions:Km};function ub(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,t.payload)}}}function db(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>I({},n,{[e]:t(n[e],i)})}}function yb(e){return db(e,((e,t)=>I({},e,{loading:t.payload})))}function fb(e){return db(e,((e,t)=>I({},e,{error:t.payload,loading:!1})))}const gb={loading:!1,error:null,fetching:!0,plans:[]},{actions:pb,reducer:Sb,name:vb}=at({name:"subscriptions/plans",initialState:gb,reducers:I({},ub())}),hb=I({loadPlans:it(`${vb}/loadPlans`)},pb),mb={loading:!1,error:null,fetching:!0,config:null},bb=I({},ub()),{actions:Ab,reducer:kb,name:Tb}=at({name:"subscriptions/config",initialState:mb,reducers:bb}),Pb=I({loadPaymentConfiguration:it(`${Tb}/loadPaymentConfiguration`)},Ab),Ib={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},Lb=I({},ub(),{setCancellationLoading:yb("cancellation"),setCancellationError:fb("cancellation"),setRenewalLoading:yb("renewal"),setRenewalError:fb("renewal")}),{reducer:Ob,actions:Eb,name:wb}=at({name:"subscriptions/billing/subscription",initialState:Ib,reducers:Lb}),Cb=I({load:it(`${wb}/loadSubscription`),cancelSubscription:it(`${wb}/cancelSubscription`),renewSubscription:it(`${wb}/renewSubscription`)},Eb),Db={loading:!1,error:null,fetching:!0},Rb=I({},ub()),{reducer:_b,actions:Ub,name:Mb}=at({name:"subscriptions/billing/information",initialState:Db,reducers:Rb}),Nb=I({loadBillingInformation:it(`${Mb}/loadBillingInformation`),cancelSubscription:Cb.cancelSubscription,renewSubscription:Cb.renewSubscription},Ub),$b={loading:!1,error:null,fetching:!0},Fb=I({},ub(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,t.payload)}}),{reducer:xb,actions:Vb,name:jb}=at({name:"subscriptions/billing/payment",initialState:$b,reducers:Fb}),Wb=I({loadPaymentMethod:it(`${jb}/loadPaymentMethod`),submitPaymentMethod:it(`${jb}/submitPaymentMethod`),submitPaymentMethodError:it(`${jb}/submitPaymentMethodError`),submitPaymentMethodSuccess:it(`${jb}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:it(`${jb}/updateBillingDetails`,(e=>({payload:e})))},Vb),Kb={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},Gb=I({},ub(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{invoiceDownload:I({},e.invoiceDownload,t.payload)})}}),{reducer:Bb,actions:zb,name:qb}=at({name:"subscriptions/billing/invoices",initialState:Kb,reducers:Gb}),Hb=I({loadInvoices:it(`${qb}/loadInvoices`),downloadInvoice:it(`${qb}/downloadInvoice`,(e=>({payload:e})))},zb),Jb={information:Db,invoices:Kb,paymentMethod:$b,subscription:Ib},Yb={invoices:Hb,information:Nb,paymentMethod:Wb,subscription:Cb},Qb=$e({invoices:Bb,information:_b,paymentMethod:xb,subscription:Ob}),Xb={fetching:!0,loading:!1,error:null,confirmed:!1},Zb=I({},ub()),{actions:eA,reducer:tA,name:nA}=at({name:"subscriptions/checkout",initialState:Xb,reducers:Zb}),iA=I({loadCheckout:it(`${nA}/loadCheckout`),resetCheckout:it(`${nA}/resetCheckout`),submitCheckout:it(`${nA}/submitCheckout`),confirmCheckout:it(`${nA}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:it(`${nA}/errorCheckout`,(e=>({payload:e})))},eA),oA={loading:!1,error:null,cardSetupIntentSecret:null},aA=I({},ub()),{reducer:rA,actions:lA,name:sA}=at({name:"subscriptions/stripe",initialState:oA,reducers:aA}),cA=I({loadCustomer:it(`${sA}/loadCustomer`),createCardSetupIntentSecret:it(`${sA}/createCardSetupIntentSecret`)},lA),uA={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:dA,reducer:yA,name:fA}=at({name:"subscriptions/vendorPublicConfig",initialState:uA,reducers:I({},ub())}),gA=I({loadVendorPublicConfiguration:it(`${fA}/loadVendorPublicConfiguration`)},dA),pA={config:mb,plans:gb,checkout:Xb,billing:Jb,stripe:oA,vendorPublicConfig:uA},SA={config:Pb,billing:Yb,plans:hb,checkout:iA,stripe:cA,vendorPublicConfig:gA},vA=$e({config:kb,billing:Qb,plans:Sb,checkout:tA,stripe:rA,vendorPublicConfig:yA});let hA,mA,bA;function AA({policy:e}){return{policy:bA.AT_PERIOD_END}}function kA(e){switch(e){case Tu.ACTIVE:return mA.ACTIVE;case Tu.INCOMPLETE:return mA.INCOMPLETE;case Tu.CANCELED:return mA.CANCELED;case Tu.EXPIRED:return mA.EXPIRED;case Tu.TRIALING:return mA.TRIALING;default:return mA.EXPIRED}}!function(e){e.STRIPE="Stripe"}(hA||(hA={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(mA||(mA={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(bA||(bA={}));const TA={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Tu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},PA=[{id:"prod_J60fUEvI7qV1eL",externalId:"prod_J60fUEvI7qV1eL",name:"Premium",description:"",price:{id:"price_1IToe8Ewsu4qiqnndAV76J69",externalId:"price_1IToe8Ewsu4qiqnndAV76J69",currency:"usd",amount:1e4},slug:"premium"},{id:"prod_J60duauCpXfcur",externalId:"prod_J60duauCpXfcur",name:"Free",description:"Totally free plan. Nothing to pay.",price:{id:"price_1ITocfEwsu4qiqnnnBHDx9fQ",externalId:"price_1ITocfEwsu4qiqnnnBHDx9fQ",currency:"usd",amount:0},slug:"free"}],IA=[{id:"in_1JbhYWEwsu4qiqnnrUh6hsHa",externalId:"in_1JbhYWEwsu4qiqnnrUh6hsHa",subscriptionId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",paymentDate:"2021-09-20T08:08:51.000Z",totalAmount:1e4,currency:"usd",paid:!0,receiptNumber:""},{id:"in_1JbhYWEwsu4qiqnnrUh6hsHa",externalId:"in_1JbhYWEwsu4qiqnnrUh6hsHa",subscriptionId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",paymentDate:"2021-08-20T08:08:51.000Z",totalAmount:1e4,currency:"usd",paid:!0,receiptNumber:""}],LA=[{id:"id",externalId:"externalId",type:Pu.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],OA={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*EA(){yield Vo(Cb.load,wA),yield Vo(Cb.cancelSubscription,DA),yield Vo(Cb.renewSubscription,RA)}function*wA(){const e=yield qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield $A(e)}function*CA(){yield ji(Cb.setLoading(!0));try{const[e]=yield Gi(ed.subscriptions.getManagedSubscriptions);yield ji(Cb.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield ji(Cb.setError(e))}}function*DA(){const{subscription:e}=yield qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ji(Cb.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ji(Cb.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Tu.ACTIVE)try{yield ji(Cb.setCancellationLoading(!0)),yield Gi(ed.subscriptions.cancelManagedSubscription,t),yield CA(),yield ji(Cb.setCancellationLoading(!1))}catch(e){yield ji(Cb.setCancellationError(e.message))}}function*RA(){const{subscription:e}=yield qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ji(Cb.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ji(Cb.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Iu.AT_PERIOD_END)try{yield ji(Cb.setRenewalLoading(!0)),yield Gi(ed.subscriptions.renewManagedSubscription,t),yield CA(),yield ji(Cb.setRenewalLoading(!1))}catch(e){yield ji(Cb.setCancellationError(e.message))}}function*_A(){yield ji(Cb.setLoading(!0)),yield Hi(500),yield ji(Cb.setState({subscription:TA,fetching:!1,loading:!1,error:null}))}function*UA(){yield Vo(Cb.load,_A)}function*MA(){yield Vo(Nb.loadBillingInformation,NA)}function*NA(){yield function*(e){const t=yield qi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield $A(n,!1):yield ji(Nb.setError(t?"Not authorized":"Internal feature failure"))}()}function*$A(e,t){yield ji(Nb.setLoading(!0));try{var n,i;const o=yield Gi(ed.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let l,s=null;r?l=yield Gi(ed.subscriptions.getSubscriptionPlan,a):([,l]=yield Wi([Gi(CA),Gi(ed.subscriptions.getSubscriptionPlan,a)]),s=yield qi((e=>e.subscriptions.billing.subscription.subscription||null))),yield ji(Nb.setState(I({loading:!1,fetching:!1,summary:o},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?mA.ACTIVE:kA(s.status),cancellation:s.cancellation&&AA(s.cancellation),trialEnd:s.trialEnd?s.trialEnd:null}}:{},l?{plan:{id:l.id,name:l.name,description:l.description,price:(null==(n=l.price)?void 0:n.amount)||0,currency:(null==(i=l.price)?void 0:i.currency)||"usd",recurringInterval:"month",slug:l.slug}}:{})))}catch(e){yield ji(Nb.setError(e.message))}}function*FA(){yield function*(){var e,t;yield ji(Nb.setLoading(!0)),yield Hi(500),yield ji(Nb.setState({loading:!1,fetching:!1,summary:{subscriptionId:TA.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Lu.Stripe,externallyManaged:!1,currentPlanId:PA[0].id,defaultPlanId:PA[0].id},plan:I({},PA[0],{price:null==(e=PA[0].price)?void 0:e.amount,currency:null==(t=PA[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*xA(){yield Vo(Nb.loadBillingInformation,FA)}function*VA(){yield Vo(Wb.loadPaymentMethod,jA),yield Vo(Wb.submitPaymentMethod,KA),yield Vo(Wb.submitPaymentMethodError,GA),yield Vo(Wb.submitPaymentMethodSuccess,BA),yield Vo(Wb.updatePaymentMethodBillingDetails,WA)}function*jA(){yield ji(Wb.setLoading(!0));try{const e=(yield Gi(ed.subscriptions.getPaymentMethods))[0];yield ji(Wb.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield ji(Wb.setError(e.message))}}function*WA({payload:e}){yield ji(Wb.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield Gi(ed.subscriptions.updatePaymentMethodBillingDetails,t,I({email:n},i)),yield Gi(jA),null==o||o(!0)}catch(e){yield ji(Wb.setError(e.message)),null==o||o(!1)}yield ji(Wb.setLoading(!1))}function*KA(){yield ji(Wb.setLoading(!0))}function*GA({payload:e}){yield ji(Wb.setError(e))}function*BA(){yield ji(Wb.loadPaymentMethod())}function*zA(){yield ji(Wb.setLoading(!0)),yield Hi(500);const e=LA[0];yield ji(Wb.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*qA(){yield Vo(Wb.loadPaymentMethod,zA)}function*HA(){yield Vo(Hb.loadInvoices,JA),yield Vo(Hb.downloadInvoice,YA)}function*JA(){yield ji(Hb.setLoading(!0));try{const e=(yield Gi(ed.subscriptions.getSubscriptionInvoices)).map((e=>({id:e.id,externalId:e.externalId,subscriptionId:e.subscriptionId,paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2),currency:e.currency||"usd",paid:e.paid||!1,receiptNumber:e.receiptNumber})));yield ji(Hb.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield ji(Hb.setError(e.message))}}function*YA({payload:e}){yield ji(Hb.setInvoiceDownloadState({loading:!0,error:null}));try{yield Gi(ed.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield ji(Hb.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield ji(Hb.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*QA(){yield ji(Hb.setLoading(!0)),yield Hi(500),yield ji(Hb.setState({loading:!1,fetching:!1,invoices:IA.map((e=>I({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield ji(Hb.setLoading(!1))}function*XA(){yield Vo(Hb.loadInvoices,QA)}function*ZA(){yield Wi([Gi(MA),Gi(VA),Gi(HA),Gi(EA)])}function*ek(){yield Wi([Gi(xA),Gi(qA),Gi(XA),Gi(UA)])}function*tk(){yield Vo(iA.loadCheckout,nk),yield Vo(iA.resetCheckout,ik),yield Vo(iA.submitCheckout,ok),yield Vo(iA.confirmCheckout,ak),yield Vo(iA.errorCheckout,lk)}function*nk(){yield ji(iA.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*ik(){yield ji(iA.setState({loading:!1,error:null,confirmed:!1}))}function*ok(){yield ji(iA.setState({loading:!0,error:null}))}function*ak({payload:{paymentMethodId:e,planId:t}}){const n=yield qi((e=>e.subscriptions.billing.subscription.subscription)),i=yield qi((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Tu.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield ji(iA.setState({loading:!0,error:null})),o&&a)return yield rk(),void(yield ji(Cb.setState({subscription:I({},n,{status:Tu.ACTIVE})})));try{yield Gi(ed.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Wi([NA(),jA(),JA()]),yield rk()}catch(e){yield ji(iA.setState({loading:!1,error:e.message}))}}else yield ji(iA.setState({loading:!1,error:"Subscription not found"}))}function*rk(){yield ji(iA.setState({loading:!1,error:null,confirmed:!0}))}function*lk({payload:e}){yield ji(iA.setState({loading:!1,error:e}))}function*sk(){yield Vo(iA.resetCheckout,ik)}function*ck(){yield Vo(hb.loadPlans,uk)}function*uk(){yield ji(hb.setLoading(!0));try{const e=(yield Gi(ed.subscriptions.getSubscriptionPlans)).map((e=>{var t,n;return{id:e.id,name:e.name,description:e.description,price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month",slug:e.slug}}));yield ji(hb.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield ji(hb.setError(e.message))}}function*dk(){yield ji(hb.setLoading(!0)),yield Hi(500),yield ji(hb.setState({fetching:!1,loading:!1,plans:PA.map((e=>{var t,n;return I({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*yk(){yield Vo(hb.loadPlans,dk)}function*fk(){yield Vo(Pb.loadPaymentConfiguration,gk)}function*gk(){yield ji(Pb.setLoading(!0));try{(yield Gi(ed.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Lu.Stripe))?yield function*(){yield ji(Pb.setLoading(!0));try{const e=yield Gi(ed.subscriptions.getStripePaymentProviderConfiguration);yield ji(Pb.setState({loading:!1,fetching:!1,config:{paymentProvider:hA.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield ji(Pb.setError(e.message))}}():yield ji(Pb.setError("Payment provider not configured"))}catch(e){yield ji(Pb.setError(e.message))}}function*pk(){yield ji(Pb.setLoading(!0)),yield Hi(500),yield ji(Pb.setState({loading:!1,fetching:!1,config:{paymentProvider:hA.STRIPE,apiKey:""}}))}function*Sk(){yield Vo(Pb.loadPaymentConfiguration,pk)}function*vk(){yield Vo(cA.createCardSetupIntentSecret,hk)}function*hk({payload:e}){yield ji(cA.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Gi(ed.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield ji(cA.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield ji(cA.setError(e.message))}}function*mk(){yield Vo(gA.loadVendorPublicConfiguration,bk)}function*bk(){yield ji(gA.setLoading(!0));try{const e=yield Gi(ed.subscriptions.getVendorPublicConfigurations);yield ji(gA.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield ji(gA.setError(e.message))}}function*Ak(){yield ji(gA.setLoading(!0)),yield Hi(500),yield ji(gA.setState({fetching:!1,loading:!1,vendorPublicConfig:OA}))}function*kk(){yield Vo(gA.loadVendorPublicConfiguration,Ak)}var Tk={sagas:function*(){yield Wi([Gi(ZA),Gi(tk),Gi(ck),Gi(fk),Gi(vk),Gi(mk)])},mockSagas:function*(){yield Wi([Gi(ek),Gi(sk),Gi(yk),Gi(Sk),Gi(kk)])},reducer:vA,actions:SA,initialState:pA,storeName:"subscriptions"},Pk={sagas:function*(){yield Vo(zd.loadVendorPublicInfo,qd)},storeName:It,initialState:Kd,reducer:Gd,actions:zd};const{reducer:Ik}=at({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Ko.setContext(t),I({},e,{context:t}))}}}),Lk=(e,t,n=!1,i,o,a=!1,r="path")=>{let l=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var s,c,u,d,y,f,g,p,S,v;n||a||Ko.setContext(e.context);const t=Do(),h=[...tt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=nt({middleware:h,preloadedState:{root:I({},e,{previewMode:n,urlStrategy:r}),[Jh.storeName]:I({},Jh.initialState,i,null!=(s=null==o?void 0:o.auth)?s:{},{routes:I({},Jh.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[Am.storeName]:I({},Am.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:I({},Am.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:I({},Am.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[Tm]:I({},km,null!=(v=null==o?void 0:o.audits)?v:{}),[cb.storeName]:cb.initialState,[Tk.storeName]:Tk.initialState,[Pk.storeName]:Pk.initialState},reducer:$e({root:Ik,[Jh.storeName]:Jh.reducer,[Am.storeName]:Am.reducer,[Tm]:Im,[cb.storeName]:cb.reducer,[Tk.storeName]:Tk.reducer,[Pk.storeName]:Pk.reducer})});const m=function*(){yield Wi([Gi(Jh.sagas),Gi(Am.sagas),Gi(Nm),Gi(cb.sagas),Gi(Tk.sagas),Gi(Pk.sagas)])},b=function*(){yield Wi([Gi(Jh.mockSagas),Gi(Am.mockSagas),Gi(Tk.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(Gn.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var Ok=n(714),Ek=n.n(Ok);function wk(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function Ck(e){if(e.type)return e;if("#"===e.charAt(0))return Ck(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const i=e.substring(t+1,e.length-1);let o,a;if("color"===n){if(a=i.split(" "),o=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(o))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+o)}else a=i.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:o}}function Dk(e){const{type:t,colorSpace:n}=e;let{values:i}=e;return-1!==t.indexOf("rgb")?i=i.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),i=-1!==t.indexOf("color")?`${n} ${i.join(" ")}`:`${i.join(", ")}`,`${t}(${i})`}function Rk(e){if(0===e.indexOf("#"))return e;const{values:t}=Ck(e);return`#${t.map(((e,t)=>function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(3===t?Math.round(255*e):e))).join("")}`}function _k(e,t){if(e=Ck(e),t=wk(t),-1!==e.type.indexOf("hsl"))e.values[2]*=1-t;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]*=1-t;return Dk(e)}function Uk(e,t){if(e=Ck(e),t=wk(t),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*t;else if(-1!==e.type.indexOf("rgb"))for(let n=0;n<3;n+=1)e.values[n]+=(255-e.values[n])*t;else if(-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]+=(1-e.values[n])*t;return Dk(e)}const Mk=e=>{if(e)return{main:e,light:Rk(Uk(e,.4)),dark:Rk(_k(e,.15)),hover:Rk(_k(e,.15)),active:Rk(_k(e,.2))}},Nk=e=>{if(e)return{main:e,light:Uk(e,.7),dark:_k(e,.2)}},$k=(e,t)=>{var n,i,o,a,r,l,s,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?I({},t,{palette:{primary:I({},Mk(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:I({},Mk(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(l=null==e||null==(s=e.palette)?void 0:s.secondaryText)?l:"#000000"}),danger:I({},Mk(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:I({},Nk(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:I({},Nk(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:I({},Nk(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:I({},Nk(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},Fk={},xk={},Vk={},jk={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},multipleSSO:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class Wk{constructor(){this._theme=Fk,this._themeV2=xk,this._navigation=jk,this._localizations=Vk}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Wk;return n.set(e),Wk._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}set(e){try{var t,n,i,o,a,r,l;this._navigation=Ek().all([null!=(t=jk)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=Ek().all([null!=(i=Fk)?i:{},$k(null==e?void 0:e.theme,Fk)]),this._themeV2=Ek().all([null!=(o=xk)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=Ek().all([null!=(r=Vk)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=jk,this._theme=Fk,this._themeV2=xk,this._localizations=Vk}}}Wk._instances={};var Kk={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","use-new-mfa-pages":"on"},Gk=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},Bk=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(t);return Object.keys(n).forEach((function(e){return i.setAttribute(e,n[e])})),e.appendChild(i),i},zk=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))};let qk,Hk,Jk,Yk,Qk,Xk,Zk,eT,tT,nT,iT;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(qk||(qk={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(Hk||(Hk={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(Jk||(Jk={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(Yk||(Yk={})),function(e){e.Invoices="invoices"}(Qk||(Qk={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(Xk||(Xk={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(Zk||(Zk={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(eT||(eT={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(tT||(tT={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(nT||(nT={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(iT||(iT={}));const oT={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},aT={hidden:"hidden",edit:"edit"};var rT="6.61.0",lT=function(){function e(t,n){var i,o,a,r,l=this,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];A(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(rT),this.customElementName="",this.adminPortalEl=void 0,this.adminPortalRenderer=void 0,this.loginBoxEl=void 0,this.checkoutDialogEl=void 0,this.checkoutDialogRenderer=void 0,this.adminPortalContainer=void 0,this.loginBoxContainer=void 0,this.checkoutDialogContainer=void 0,this.loginBoxRenderer=void 0,this.store=void 0,this.flags={},this.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=O(w().mark((function e(){var t,n,i,o,a;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Ho,l.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:a=e.sent,l.options.metadata=null!=(n=null==a||null==(i=a.rows)||null==(o=i[0])?void 0:o.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:Wk.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=O(w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l.options.hostedLoginBox||l.options.builderMode||"nextjs"===l.options.framework||l.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=O(w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l.options.previewMode&&!l.options.builderMode){e.next=4;break}l.flags=Kk,e.next=13;break;case 4:return e.prev=4,e.next=7,ju();case 7:l.flags=e.sent,e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 13:case"end":return e.stop()}}),e,null,[[4,10]])}))),this.updateLocalizationsSetter=function(e){l.updateLocalizations=e};var c=Gk(n),u="frontegg-app-".concat(c);this.iframeRendering=s,this.name=c,this.options=I({},t,{contextOptions:I({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=u;var d=this.options.authOptions?I({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};d.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.store=null!=(o=this.options.store)?o:Lk({context:this.options.contextOptions},this,this.options.previewMode,d,{auth:null!=(a=this.options.authOptions)?a:{},audits:null!=(r=this.options.auditsOptions)?r:{}},!1,this.options.urlStrategy),P.setInstance(c,this)}var t,n,i,o;return T(e,[{key:"initContainers",value:(o=O(w().mark((function e(t){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.adminPortalEl=t.adminPortalEl,this.loginBoxEl=t.loginBoxEl,this.checkoutDialogEl=t.checkoutDialogEl,this.adminPortalContainer=t.adminPortalContainer,this.loginBoxContainer=t.loginBoxContainer,this.checkoutDialogContainer=t.checkoutDialogContainer;try{"nextjs"!==this.options.framework&&document.body.classList.add("frontegg-loading")}catch(e){}return e.next=9,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;Wk.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:m,FronteggTypes:b})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=O(w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=O(w().mark((function e(){var t;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=O(w().mark((function e(t){var n;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,I({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),sT=function(){function e(){A(this,e)}return T(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=P.getInstance(i);e&&t?(Ko.setAccessToken(t),Ko.setUser(I({},n,{accessToken:t})),o.store.dispatch(Gn.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(Gn.loadTenants())):(Ko.setAccessToken(null),Ko.setUser(null),o.store.dispatch(Gn.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),cT=function(){function e(){A(this,e)}return T(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).hideAdminPortal()}}]),e}(),uT=function(){function e(){A(this,e)}return T(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";P.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).hideCheckoutDialog()}}]),e}(),dT=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},yT=function(){function e(t,n,i,o){A(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=i?i:Lk({context:a},this,!0,void 0,void 0,!0),this.options=I({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a},o),this.app=new lT(this.options,t,!0),Wk.set({},t)}var t;return T(e,[{key:"render",value:(t=O(w().mark((function e(t){var n,i,o,a,r=this;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,zk(this);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"setStaticRoute",value:function(e){var t;null==(t=this.setRoute)||t.call(this,e)}},{key:"unmount",value:function(){try{var e;null==(e=this.app.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin Portal renderer",e)}}},{key:"setTheme",value:function(e){var t;this.themeOptions=e,this.themeSetter||console.warn("this.themeSetter is not defined yet"),null==(t=this.themeSetter)||t.call(this,this.themeOptions)}}]),e}(),fT="modern",gT=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[fT]},pT=function(){function e(t,n,i,o){A(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=i?i:Lk({context:a},this,!0,void 0,void 0,!0),this.options=I({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a,onRedirectTo:function(){console.debug("path")}},o),this.app=new lT(this.options,t,!0),Wk.set({},t)}var t;return T(e,[{key:"render",value:(t=O(w().mark((function e(t){var n,i,o,a,r=this;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,zk(this);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"unmount",value:function(){try{var e;null==(e=this.app.loginBoxRenderer)||e.unmount()}catch(e){console.error("Failed to unmount login box renderer",e)}}},{key:"setTheme",value:function(e){var t;this.themeOptions=e,this.themeSetter||console.warn("this.themeSetter is not defined yet"),null==(t=this.themeSetter)||t.call(this,this.themeOptions)}},{key:"setStaticRoute",value:function(e){var t;this.setRoute||console.warn("this.setRoute is not defined yet"),null==(t=this.setRoute)||t.call(this,e)}},{key:"setStore",value:function(e){this.store.dispatch({type:"auth/setState",payload:e})}}]),e}();function ST(e,t){return ST=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ST(e,t)}function vT(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ST(e,t)}function hT(e){return hT="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hT(e)}function mT(e,t){if(t&&("object"===hT(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function bT(e){return bT=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},bT(e)}function AT(){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}}function kT(e,t,n){return kT=AT()?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&&ST(o,n.prototype),o},kT.apply(null,arguments)}function TT(e){var t="function"==typeof Map?new Map:void 0;return TT=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return kT(e,arguments,bT(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ST(n,e)},TT(e)}function PT(e){var t=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}}();return function(){var n,i=bT(e);if(t){var o=bT(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return mT(this,n)}}var IT=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new lT(e,t);if("undefined"!=typeof document){var i;if(!e.contextOptions.baseUrl){var o=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(o.message),o}if(!customElements.get("frontegg-app")){var a=function(e){vT(n,e);var t=PT(n);function n(){var e;A(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return(e=t.call.apply(t,[this].concat(o))).app=null,e}return T(n,[{key:"connectedCallback",value:function(){this.updateContent()}},{key:"attributeChangedCallback",value:function(e,t,n){if("app-name"===e){if(null===t)return;if(t===n)return;this.innerHTML="",null===n?this.remove():this.updateContent()}console.debug("attributeChangedCallback",e,t,n)}},{key:"updateContent",value:function(){var e,t=null!=(e=this.getAttribute("app-name"))?e:"default",n=P.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=Bk(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=Bk(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=Bk(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=i.attachShadow({mode:"open"}),l=o.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),c=Bk(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=Bk(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=Bk(s,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:i,loginBoxContainer:o,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(TT(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||o,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,s):i(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},l=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),r=new L(i||[]);return a._invoke=function(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var l=T(r,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var s=y(e,t,n);if("normal"===s.type){if(i=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i="completed",n.method="throw",n.arg=s.arg)}}}(e,n,r),a}function y(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var f={};function g(){}function p(){}function S(){}var v={};u(v,l,(function(){return this}));var h=Object.getPrototypeOf,m=h&&h(h(O([])));m&&m!==n&&a.call(m,l)&&(v=m);var b=S.prototype=g.prototype=Object.create(v);function A(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(o,r,l,s){var c=y(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,l,s)}),(function(e){n("throw",e,l,s)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return n("throw",e,l,s)}))}s(c.arg)}var o;this._invoke=function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}}function T(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var i=y(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function O(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return p.prototype=S,u(b,"constructor",S),u(S,"constructor",p),p.displayName=u(S,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},A(k.prototype),u(k.prototype,s,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new k(d(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},A(b),u(b,c,"Generator"),u(b,l,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},t.values=O,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var l=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(l&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;I(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return cT},AdminPortalRenderer:function(){return yT},AppHolder:function(){return P},CheckoutDialog:function(){return uT},FronteggApp:function(){return lT},HostedLogin:function(){return sT},LoginBoxRenderer:function(){return pT},defaultTheme:function(){return fT},getThemeAdminByName:function(){return dT},getThemeByName:function(){return gT},initialize:function(){return IT}});var e={};n.r(e),n.d(e,{Delete:function(){return Xo},Get:function(){return Ho},Patch:function(){return Yo},Post:function(){return Jo},PostDownload:function(){return Zo},Put:function(){return Qo},getBaseUrl:function(){return zo}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return Ua},getSubTenantsAsTree:function(){return Ma},getTenants:function(){return _a},switchTenant:function(){return Ra}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return rr},OAuthLogout:function(){return Cr},SocialLoginProviders:function(){return ar},acceptInvitation:function(){return Lr},activateAccount:function(){return kr},bulkCreateIPRestriction:function(){return er},changePhoneNumber:function(){return ys},changePhoneNumberWithVerification:function(){return us},checkIfAllowToRememberMfaDevice:function(){return xl},createDomainRestriction:function(){return Ha},createIPRestriction:function(){return Za},createOrUpdateSessionConfigrations:function(){return wl},createSSOConfiguration:function(){return Gl},createSSOConfigurationByMetadata:function(){return ql},createSSODomain:function(){return Jl},createSSOGroup:function(){return es},createSamlGroup:function(){return pl},deleteAllSessionsForUser:function(){return Dl},deleteDomainRestriction:function(){return Ya},deleteIPRestriction:function(){return nr},deleteSSOConfiguration:function(){return zl},deleteSSODomain:function(){return Yl},deleteSSOGroup:function(){return ns},deleteSamlGroup:function(){return vl},deleteSessionForUser:function(){return Cl},deleteTenantApiToken:function(){return Nl},deleteUserApiToken:function(){return $l},disableMFAAuthenticatorApp:function(){return Gr},disableMFASMS:function(){return zr},disableMFAWebAuthn:function(){return Hr},disableMfa:function(){return Kr},enrollMFAAuthenticatorApp:function(){return $r},enrollMFAAuthenticatorAppForLogin:function(){return Qr},enrollMFASMS:function(){return xr},enrollMFASMSForLogin:function(){return el},enrollMFAWebAuthn:function(){return jr},enrollMFAWebAuthnForLogin:function(){return ol},enrollMfa:function(){return Mr},exchangeOAuthTokens:function(){return rs},forgotPassword:function(){return Dr},generateLoginResponse:function(){return fr},generateLoginResponseFromOAuthResponse:function(){return pr},generateLoginResponseV2:function(){return gr},getActivateAccountStrategy:function(){return Tr},getCaptchaPolicy:function(){return Wa},getCurrentUserSession:function(){return Ll},getCurrentUserSessions:function(){return Il},getDomainRestrictions:function(){return za},getDomainRestrictionsConfig:function(){return qa},getGlobalSecurityPolicy:function(){return Na},getIPRestrictions:function(){return Qa},getIPRestrictionsConfig:function(){return Xa},getLockoutPolicy:function(){return Va},getMFADevices:function(){return Jr},getMFAStrategiesConfig:function(){return hs},getMfaPolicy:function(){return $a},getOidcConfiguration:function(){return hl},getPasswordConfigPolicy:function(){return Ba},getPasswordHistoryPolicy:function(){return Ka},getSSOConfigurations:function(){return Kl},getSSODefaultRoles:function(){return Xl},getSSOGroups:function(){return is},getSSOPublicConfiguration:function(){return ml},getSamlConfiguration:function(){return ll},getSamlRoles:function(){return yl},getSamlRolesGroups:function(){return fl},getSamlVendorConfiguration:function(){return cl},getSessionConfigurations:function(){return El},getSocialLoginProviders:function(){return bl},getSocialLoginProvidersV2:function(){return Al},getTenantApiTokensData:function(){return _l},getUserApiTokensData:function(){return Rl},getUserById:function(){return Fl},getVendorConfig:function(){return Tl},getVendorMfaPolicy:function(){return Fa},getVendorPublicAuthStrategiesConfig:function(){return vs},loadPasswordConfig:function(){return _r},login:function(){return br},loginViaSocialLogin:function(){return kl},loginWithMfa:function(){return Ar},logout:function(){return wr},oidcPostLogin:function(){return mr},oidcPostLoginV2:function(){return as},passwordlessPostLogin:function(){return jl},passwordlessPreLogin:function(){return Vl},postLogin:function(){return hr},preDisableMFASMS:function(){return Br},preDisableMFAWebAuthn:function(){return qr},preEnrollMFAAuthenticatorApp:function(){return Nr},preEnrollMFAAuthenticatorAppForLogin:function(){return Yr},preEnrollMFASMS:function(){return Fr},preEnrollMFASMSForLogin:function(){return Zr},preEnrollMFAWebAuthn:function(){return Vr},preEnrollMFAWebAuthnForLogin:function(){return il},preLogin:function(){return Sr},preLoginV2:function(){return os},preLoginWithIdpType:function(){return vr},preVerifyMFASMSForLogin:function(){return tl},preVerifyMFAWebAuthnForLogin:function(){return al},recoverMfaToken:function(){return Ur},refreshToken:function(){return Or},refreshTokenV2:function(){return Er},resendActivationEmail:function(){return Pr},resendInvitationEmail:function(){return Ir},resetPassword:function(){return Rr},resetPhoneNumber:function(){return ss},revokeSessionsForUser:function(){return Ol},saveLockoutPolicy:function(){return ja},saveMfaPolicy:function(){return xa},savePasswordHistoryPolicy:function(){return Ga},setSSODefaultRoles:function(){return Zl},signUpUser:function(){return Pl},silentOAuthRefreshToken:function(){return ls},testCurrentIp:function(){return ir},testCurrentIpInAllowList:function(){return or},updateDomainRestrictionConfig:function(){return Ja},updateIPRestrictionConfig:function(){return tr},updateSSOConfiguration:function(){return Bl},updateSSOConfigurationByMetadata:function(){return Hl},updateSSOGroup:function(){return ts},updateSamlConfiguration:function(){return sl},updateSamlGroup:function(){return Sl},updateSamlRoles:function(){return gl},updateSamlVendorMetadata:function(){return ul},updateTenantApiTokensData:function(){return Ml},updateUserApiTokensData:function(){return Ul},validateSSODomain:function(){return Ql},validateSamlDomain:function(){return dl},verifyChangePhoneNumber:function(){return ds},verifyInviteToken:function(){return Wl},verifyMFAAuthenticatorAppForLogin:function(){return Xr},verifyMFASMSForLogin:function(){return nl},verifyMFAWebAuthnForLogin:function(){return rl},verifyMfa:function(){return Wr},verifyNewDeviceSession:function(){return Ss},verifyResetPhoneNumber:function(){return cs},webAuthnCreateNewDeviceSession:function(){return ps},webAuthnPostLogin:function(){return gs},webAuthnPreLogin:function(){return fs}});var a={};n.r(a),n.d(a,{addUser:function(){return Ps},changePassword:function(){return ks},createInviteUserLink:function(){return Os},deleteInviteUserLink:function(){return ws},deleteUser:function(){return Is},getInviteLinkConfiguration:function(){return Ds},getInviteUserLink:function(){return Cs},getProfile:function(){return ms},loadAvailablePermissions:function(){return _s},loadAvailableRoles:function(){return Rs},loadStats:function(){return Us},loadUsers:function(){return Ts},resendActivationLink:function(){return Ms},resendInvitationLink:function(){return Ns},resendInvitationLinkToAllTenants:function(){return $s},updateInviteUserLink:function(){return Es},updateProfile:function(){return bs},updateProfileImage:function(){return As},updateUser:function(){return Ls}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return Ws},getCurrentUserIpMetadata:function(){return xs},getIpAdressMetadata:function(){return Ks},getNotificationsMetadata:function(){return Vs},getSamlMetadata:function(){return js}});var l={};n.r(l),n.d(l,{downloadReport:function(){return Qs},getReport:function(){return Hs},getReports:function(){return qs},renderReport:function(){return Js},scheduleReport:function(){return Ys},sendReport:function(){return Xs}});var s={};n.r(s),n.d(s,{getNotifications:function(){return Zs},markAllAsRead:function(){return nc},updateNotificationIsPinned:function(){return tc},updateNotificationStatus:function(){return ec}});var c={};n.r(c),n.d(c,{exportAudits:function(){return rc},getAudits:function(){return oc},getAuditsStats:function(){return ac}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return bc},deleteEmailSubscriptions:function(){return hc},deleteSMSConfiguration:function(){return Lc},deleteSMSSubscriptions:function(){return Pc},deleteSlackConfiguration:function(){return fc},deleteWebhooksConfiguration:function(){return wc},getCategories:function(){return _c},getChannelMaps:function(){return Uc},getEmailConfiguration:function(){return pc},getSMSConfiguration:function(){return Ac},getSlackChannels:function(){return dc},getSlackConfiguration:function(){return cc},getSlackScope:function(){return uc},getWebhookLog:function(){return Cc},getWebhooksConfigurations:function(){return Oc},patchEmailConfiguration:function(){return vc},patchSMSConfiguration:function(){return Tc},postEmailConfiguration:function(){return Sc},postSMSConfiguration:function(){return kc},postSlackCode:function(){return gc},postSlackConfiguration:function(){return yc},postWebhookRetry:function(){return Rc},postWebhookTest:function(){return Dc},postWebhooksConfiguration:function(){return Ec},putEmailSubscriptions:function(){return mc},putSMSSubscriptions:function(){return Ic}});var d={};n.r(d),n.d(d,{getSettings:function(){return Nc},updateSettings:function(){return Mc}});var y={};n.r(y),n.d(y,{addRole:function(){return jc},attachPermissionToRoles:function(){return zc},attachPermissionsToRole:function(){return Gc},deleteRole:function(){return Wc},getPermissionCategories:function(){return qc},getPermissions:function(){return Bc},getRoles:function(){return Vc},updateRole:function(){return Kc}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return Iu},ISubscriptionStatus:function(){return Tu},PaymentMethodType:function(){return Pu},ProviderType:function(){return Lu},TenantCreatedAction:function(){return Eu},TrialEndAction:function(){return Ou},cancelManagedSubscription:function(){return tu},cancelSubscription:function(){return Yc},createStripeCustomer:function(){return pu},createStripePaymentMethodSetupIntentSecret:function(){return vu},createSubscription:function(){return fu},createTenantConfiguration:function(){return bu},getManagedSubscription:function(){return Zc},getManagedSubscriptions:function(){return eu},getPaymentMethod:function(){return du},getPaymentMethods:function(){return uu},getPaymentProviders:function(){return Au},getStripeCustomer:function(){return gu},getStripePaymentProviderConfiguration:function(){return Su},getSubscription:function(){return Jc},getSubscriptionInvoice:function(){return lu},getSubscriptionInvoicePdf:function(){return su},getSubscriptionInvoices:function(){return ru},getSubscriptionPlan:function(){return au},getSubscriptionPlans:function(){return ou},getSubscriptionSummaries:function(){return hu},getSubscriptions:function(){return Hc},getTenantConfiguration:function(){return mu},getVendorPublicConfigurations:function(){return ku},renewManagedSubscription:function(){return nu},renewSubscription:function(){return Qc},updateManagedSubscription:function(){return iu},updatePaymentMethodBillingDetails:function(){return yu},updateSubscription:function(){return Xc}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return Uu}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return Fu},addUserToTenantAndSubTenants:function(){return Nu},loadAllUsers:function(){return Mu},removeUserFromTenantAndSubTenants:function(){return $u},removeUserRolesFromSubTenants:function(){return xu},setUserRolesForSubTenants:function(){return Vu}});var S={};n.r(S),n.d(S,{loadFeatureFlags:function(){return ju}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return zu},createConfiguration:function(){return Gu},deleteConfiguration:function(){return Bu},getConfigs:function(){return Wu},updateConfiguration:function(){return Ku}});var h={};n.r(h),n.d(h,{impersonate:function(){return qu}});var m={};n.r(m),n.d(m,{AuthStrategyEnum:function(){return rr},ContextHolder:function(){return Ko},FronteggApiError:function(){return Bo},FronteggContext:function(){return Go},ISubscriptionCancellationPolicy:function(){return Iu},ISubscriptionStatus:function(){return Tu},MFAStrategyEnum:function(){return Du},PaymentMethodType:function(){return Pu},ProviderType:function(){return Lu},RestrictionType:function(){return _n},ScimConnectionSource:function(){return Zu},SecondaryAuthStrategy:function(){return wu},SocialLoginProviders:function(){return ar},TenantType:function(){return _u},UserManagedByEnum:function(){return Ru},WebAuthnDeviceType:function(){return Cu},api:function(){return ed},countConfigurationUsers:function(){return zu},createConfiguration:function(){return Gu},default:function(){return td},deleteConfiguration:function(){return Bu},fetch:function(){return e},fronteggAuthApiRoutes:function(){return Hu},fronteggRefreshTokenUrl:function(){return Ju},fronteggSilentRefreshTokenUrl:function(){return Yu},fronteggTenantsUrl:function(){return Xu},fronteggUsersUrl:function(){return Qu},getConfigs:function(){return Wu},loadFeatureFlags:function(){return ju},updateConfiguration:function(){return Ku}});var b={};function A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function T(e,t,n){return t&&k(e.prototype,t),n&&k(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(b),n.d(b,{AccountPageFields:function(){return Yk},DomainRestrictionsTabFields:function(){return nT},GeneralSettingsTabFields:function(){return eT},InviteUserModalFields:function(){return Jk},IpRestrictionsTabFields:function(){return tT},Metadata:function(){return Wk},PrivacyPageFields:function(){return Hk},ProfilePageFields:function(){return qk},SecurityPageTabs:function(){return Xk},SessionManagementTabFields:function(){return Zk},SsoPageTabs:function(){return iT},SubscriptionsPageFields:function(){return Qk},fieldAppearance:function(){return oT},tabAppearance:function(){return aT}});var P=function(){function e(){A(this,e)}return T(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},I.apply(this,arguments)}function L(e,t,n,i,o,a,r){try{var l=e[a](r),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(i,o)}function O(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){L(a,i,o,r,l,"next",e)}function l(e){L(a,i,o,r,l,"throw",e)}r(void 0)}))}}P._apps={};var E=n(841),w=n.n(E);function C(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function D(e){return!!e&&!!e[ve]}function R(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===he}(e)||Array.isArray(e)||!!e[Se]||!!e.constructor[Se]||F(e)||x(e))}function _(e,t,n){void 0===n&&(n=!1),0===U(e)?(n?Object.keys:me)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function U(e){var t=e[ve];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:F(e)?2:x(e)?3:0}function M(e,t){return 2===U(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function N(e,t,n){var i=U(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function $(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function F(e){return ye&&e instanceof Map}function x(e){return fe&&e instanceof Set}function V(e){return e.o||e.t}function j(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=be(e);delete t[ve];for(var n=me(t),i=0;i<n.length;i++){var o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function W(e,t){return void 0===t&&(t=!1),G(e)||D(e)||!R(e)||(U(e)>1&&(e.set=e.add=e.clear=e.delete=K),Object.freeze(e),t&&_(e,(function(e,t){return W(t,!0)}),!0)),e}function K(){C(2)}function G(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function B(e){var t=Ae[e];return t||C(18,e),t}function z(){return ue}function q(e,t){t&&(B("Patches"),e.u=[],e.s=[],e.v=t)}function H(e){J(e),e.p.forEach(Q),e.p=null}function J(e){e===ue&&(ue=e.l)}function Y(e){return ue={p:[],l:ue,h:e,m:!0,_:0}}function Q(e){var t=e[ve];0===t.i||1===t.i?t.j():t.O=!0}function X(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||B("ES5").S(t,e,i),i?(n[ve].P&&(H(t),C(4)),R(e)&&(e=Z(t,e),t.l||te(t,e)),t.u&&B("Patches").M(n[ve].t,e,t.u,t.s)):e=Z(t,n,[]),H(t),t.u&&t.v(t.u,t.s),e!==pe?e:void 0}function Z(e,t,n){if(G(t))return t;var i=t[ve];if(!i)return _(t,(function(o,a){return ee(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return te(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=j(i.k):i.o;_(3===i.i?new Set(o):o,(function(t,a){return ee(e,i,o,t,a,n)})),te(e,o,!1),n&&e.u&&B("Patches").R(i,n,e.u,e.s)}return i.o}function ee(e,t,n,i,o,a){if(D(o)){var r=Z(e,o,a&&t&&3!==t.i&&!M(t.D,i)?a.concat(i):void 0);if(N(n,i,r),!D(r))return;e.m=!1}if(R(o)&&!G(o)){if(!e.h.F&&e._<1)return;Z(e,o),t&&t.A.l||te(e,o)}}function te(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&W(t,n)}function ne(e,t){var n=e[ve];return(n?V(n):e)[t]}function ie(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=Object.getPrototypeOf(n)}}function oe(e){e.P||(e.P=!0,e.l&&oe(e.l))}function ae(e){e.o||(e.o=j(e.t))}function re(e,t,n){var i=F(t)?B("MapSet").N(t,n):x(t)?B("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:z(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=ke;n&&(o=[i],a=Te);var r=Proxy.revocable(o,a),l=r.revoke,s=r.proxy;return i.k=s,i.j=l,s}(t,n):B("ES5").J(t,n);return(n?n.A:z()).p.push(i),i}function le(e){return D(e)||C(22,e),function e(t){if(!R(t))return t;var n,i=t[ve],o=U(t);if(i){if(!i.P&&(i.i<4||!B("ES5").K(i)))return i.t;i.I=!0,n=se(t,o),i.I=!1}else n=se(t,o);return _(n,(function(t,o){i&&function(e,t){return 2===U(e)?e.get(t):e[t]}(i.t,t)===o||N(n,t,e(o))})),3===o?new Set(n):n}(e)}function se(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return j(e)}var ce,ue,de="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ye="undefined"!=typeof Map,fe="undefined"!=typeof Set,ge="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,pe=de?Symbol.for("immer-nothing"):((ce={})["immer-nothing"]=!0,ce),Se=de?Symbol.for("immer-draftable"):"__$immer_draftable",ve=de?Symbol.for("immer-state"):"__$immer_state",he=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),me="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,be=Object.getOwnPropertyDescriptors||function(e){var t={};return me(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ae={},ke={get:function(e,t){if(t===ve)return e;var n=V(e);if(!M(n,t))return function(e,t,n){var i,o=ie(t,n);return o?"value"in o?o.value:null===(i=o.get)||void 0===i?void 0:i.call(e.k):void 0}(e,n,t);var i=n[t];return e.I||!R(i)?i:i===ne(e.t,t)?(ae(e),e.o[t]=re(e.A.h,i,e)):i},has:function(e,t){return t in V(e)},ownKeys:function(e){return Reflect.ownKeys(V(e))},set:function(e,t,n){var i=ie(V(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=ne(V(e),t),a=null==o?void 0:o[ve];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if($(n,o)&&(void 0!==n||M(e.t,t)))return!0;ae(e),oe(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==ne(e.t,t)||t in e.t?(e.D[t]=!1,ae(e),oe(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=V(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){C(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){C(12)}},Te={};_(ke,(function(e,t){Te[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Te.deleteProperty=function(e,t){return Te.set.call(this,e,t,void 0)},Te.set=function(e,t,n){return ke.set.call(this,e[0],t,n,e[0])};var Pe=function(){function e(e){var t=this;this.g=ge,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var i=arguments.length,r=Array(i>1?i-1:0),l=1;l<i;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&C(6),void 0!==i&&"function"!=typeof i&&C(7),R(e)){var l=Y(t),s=re(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?H(l):J(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return q(l,i),X(e,l)}),(function(e){throw H(l),e})):(q(l,i),X(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===pe&&(r=void 0),t.F&&W(r,!0),i){var u=[],d=[];B("Patches").M(e,r,u,d),i(u,d)}return r}C(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){R(e)||C(8),D(e)&&(e=le(e));var t=Y(this),n=re(this,e,void 0);return n[ve].C=!0,J(t),n},t.finishDraft=function(e,t){var n=(e&&e[ve]).A;return q(n,t),X(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ge&&C(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=B("Patches").$;return D(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Ie=new Pe,Le=Ie.produce,Oe=(Ie.produceWithPatches.bind(Ie),Ie.setAutoFreeze.bind(Ie),Ie.setUseProxies.bind(Ie),Ie.applyPatches.bind(Ie),Ie.createDraft.bind(Ie),Ie.finishDraft.bind(Ie),Le);function Ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?we(Object(n),!0).forEach((function(t){Ee(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):we(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function De(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Re="function"==typeof Symbol&&Symbol.observable||"@@observable",_e=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ue={INIT:"@@redux/INIT"+_e(),REPLACE:"@@redux/REPLACE"+_e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+_e()}};function Me(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Ne(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(De(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(De(1));return n(Ne)(e,t)}if("function"!=typeof e)throw new Error(De(2));var o=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(De(3));return a}function d(e){if("function"!=typeof e)throw new Error(De(4));if(s)throw new Error(De(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(De(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Me(e))throw new Error(De(7));if(void 0===e.type)throw new Error(De(8));if(s)throw new Error(De(9));try{s=!0,a=o(a,e)}finally{s=!1}for(var t=r=l,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(De(10));o=e,y({type:Ue.REPLACE})}function g(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(De(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Re]=function(){return this},e}return y({type:Ue.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Re]=g,i}function $e(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Ue.INIT}))throw new Error(De(12));if(void 0===n(void 0,{type:Ue.PROBE_UNKNOWN_ACTION()}))throw new Error(De(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},l=0;l<r.length;l++){var s=r[l],c=n[s],u=e[s],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(De(14));o[s]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function Fe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function xe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw new Error(De(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=Fe.apply(void 0,a)(n.dispatch),Ce(Ce({},n),{},{dispatch:i})}}}function Ve(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var je=Ve();je.withExtraArgument=Ve;var We,Ke=je,Ge=(We=function(e,t){return We=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},We(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}We(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Be=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},ze=Object.defineProperty,qe=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),He=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,Ye=function(e,t,n){return t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Qe=function(e,t){for(var n in t||(t={}))He.call(t,n)&&Ye(e,n,t[n]);if(qe)for(var i=0,o=qe(t);i<o.length;i++)n=o[i],Je.call(t,n)&&Ye(e,n,t[n]);return e},Xe="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Fe:Fe.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Ze=function(e){function t(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Ge(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Be([void 0],e[0].concat(this)))):new(t.bind.apply(t,Be([void 0],e.concat(this))))},t}(Array);function et(e){return R(e)?Oe(e,(function(){})):e}function tt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new Ze);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(Ke):i.push(Ke.withExtraArgument(n.extraArgument))),i}function nt(e){var t,n=function(e){return tt(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,l=void 0===r?n():r,s=i.devTools,c=void 0===s||s,u=i.preloadedState,d=void 0===u?void 0:u,y=i.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=$e(a)}var g=l;"function"==typeof g&&(g=g(n));var p=xe.apply(void 0,g),S=Fe;c&&(S=Xe(Qe({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(f)?v=Be([p],f):"function"==typeof f&&(v=f(v)),Ne(t,d,S.apply(void 0,v))}function it(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return Qe(Qe({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ot(e){var t,n={},i=[],o={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,o},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,i,t]}function at(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:et(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?ot(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=Qe(Qe({},o),l);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?ot(t):[t,n,i],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return et(e())};else{var c=et(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Be([r[t.type]],l.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[s]),n.reduce((function(e,n){if(n){var i;if(D(e))return void 0===(i=n(e,t))?e:i;if(R(e))return Oe(e,(function(e){return n(e,t)}));if(void 0===(i=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}return e}),e)}return u.getInitialState=o,u}(i,u,r,c)}return a.forEach((function(e){var n,i,a=o[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,i=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=i?it(c,i):it(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:s,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var rt="listenerMiddleware";it(rt+"/add"),it(rt+"/removeAll"),it(rt+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[ve];return ke.get(t,e)},set:function(t){var n=this[ve];ke.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ve];if(!o.P)switch(o.i){case 5:i(o)&&oe(o);break;case 4:n(o)&&oe(o)}}}function n(e){for(var t=e.t,n=e.k,i=me(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==ve){var r=t[a];if(void 0===r&&!M(t,a))return!0;var l=n[a],s=l&&l[ve];if(s?s.t!==r:!$(l,r))return!0}}var c=!!t[ve];return i.length!==me(t).length+(c?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var i=0;i<t.length;i++)if(!t.hasOwnProperty(i))return!0;return!1}var o={};!function(e,t){Ae[e]||(Ae[e]=t)}("ES5",{J:function(t,n){var i=Array.isArray(t),o=function(t,n){if(t){for(var i=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(i,""+o,e(o,!0));return i}var a=be(n);delete a[ve];for(var r=me(a),l=0;l<r.length;l++){var s=r[l];a[s]=e(s,t||!!a[s].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(i,t),a={i:i?5:4,A:n?n.A:z(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ve,{value:a,writable:!0}),o},S:function(e,n,o){o?D(n)&&n[ve].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ve];if(n){var o=n.t,a=n.k,r=n.D,l=n.i;if(4===l)_(a,(function(t){t!==ve&&(void 0!==o[t]||M(o,t)?r[t]||e(a[t]):(r[t]=!0,oe(n)))})),_(o,(function(e){void 0!==a[e]||M(a,e)||(r[e]=!1,oe(n))}));else if(5===l){if(i(n)&&(oe(n),r.length=!0),a.length<o.length)for(var s=a.length;s<o.length;s++)r[s]=!1;else for(var c=o.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,o.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}();const lt=(e,t)=>n=>I({},n,{[e]:t[e]}),st=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>I({},t,{[e]:I({},t[e],n)})}),ct=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return I({},n,{[e]:I({},n[e],{[t]:I({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),ut=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return I({},t,{[e]:I({},t[e],{loaders:I({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),dt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return I({},t,{[e]:I({},t[e],{errors:I({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),yt=(e=500)=>new Promise((t=>setTimeout(t,e))),ft="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",gt=new Uint8Array(256);for(let e=0;e<ft.length;e++)gt[ft.charCodeAt(e)]=e;const pt=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,l,s=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=gt[e.charCodeAt(i)],a=gt[e.charCodeAt(i+1)],r=gt[e.charCodeAt(i+2)],l=gt[e.charCodeAt(i+3)],c[s++]=o<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},St=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(St(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let i,o="";for(i=0;i<n;i+=3)o+=ft[t[i]>>2],o+=ft[(3&t[i])<<4|t[i+1]>>4],o+=ft[(15&t[i+1])<<2|t[i+2]>>6],o+=ft[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1):n%3==1&&(o=o.substring(0,o.length-2)),o})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=St(e[n]);return t}return e};let vt,ht,mt;!function(e){e.preLogin="preLogin",e.magicLinkPreLoginSuccess="magicLinkPreLoginSuccess",e.loginWithSmsOtc="loginWithSmsOtc",e.loginWithQuickSmsOtc="loginWithQuickSmsOtc",e.loginWithOtc="loginWithOtc",e.loginWithPassword="loginWithPassword",e.loginWithTwoFactor="loginWithTwoFactor",e.redirectToSSO="redirectToSSO",e.loginWithSSOFailed="loginWithSSOFailed",e.success="success",e.forceTwoFactor="forceTwoFactor",e.recoverTwoFactor="recoverTwoFactor"}(vt||(vt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(ht||(ht={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(mt||(mt={}));const bt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",At="HOSTED_LOGIN_VERIFIER_KEY",kt="auth",Tt="connectivity",Pt="auditLogs",It="vendor",Lt={flow:ht.Login,step:vt.preLogin,loading:!1,email:"",tenants:[]},Ot={setLoginState:st("loginState"),resetLoginState:lt("loginState",{loginState:Lt})},Et={requestAuthorize:it("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:it("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:it("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:it("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:it("auth/afterAuthNavigation"),preLogin:it("auth/preLogin",(e=>({payload:e}))),postLogin:it("auth/postLogin",(e=>({payload:e}))),login:it("auth/login",(e=>({payload:e}))),loginWithMfa:it("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:it("auth/recoverMfa",(e=>({payload:e}))),logout:it("auth/logout",(e=>({payload:e}))),silentLogout:it("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:it("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:it("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:it("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:it("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:it("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:it("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:it("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:it("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:it("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:it("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:it("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:it("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:it("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:it("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:it("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:it("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:it("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:it("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:it("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:it("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:it("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let wt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(wt||(wt={}));const Ct={step:wt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Dt={setActivateState:st("activateState"),resetActivateState:lt("activateState",{activateState:Ct}),setActivateStrategyState:ct("activateState","activationStrategy")},Rt={activateAccount:it("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:it("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:it("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:it("auth/resendActivationEmail",(e=>({payload:e})))};let _t;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(_t||(_t={}));const Ut={step:_t.validate},Mt={setAcceptInvitationState:st("acceptInvitationState"),resetAcceptInvitationState:lt("acceptInvitationState",{acceptInvitationState:Ut})},Nt={acceptInvitation:it("auth/acceptInvitation",(e=>({payload:e})))};let $t;!function(e){e.forgotPassword="forgotPassword",e.success="success"}($t||($t={}));const Ft={step:$t.forgotPassword,loading:!1,email:"",passwordConfig:null},xt={setForgotPasswordState:st("forgotPasswordState"),resetForgotPasswordState:lt("forgotPasswordState",{forgotPasswordState:Ft})},Vt={forgotPassword:it("auth/forgotPassword",(e=>({payload:e}))),resetPassword:it("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:it("auth/loadPasswordConfig",(e=>({payload:e})))};let jt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(jt||(jt={}));const Wt={step:jt.ResetPhoneNumber,loading:!1},Kt={setResetPhoneNumberState:st("resetPhoneNumberState"),resetResetPhoneNumberState:lt("resetPhoneNumberState",{resetPhoneNumberState:Wt})},Gt={resetPhoneNumber:it("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:it("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:it("auth/changePhoneNumber",(e=>({payload:e})))},Bt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},zt={setSSOLoader:ut("ssoState"),setSSOError:dt("ssoState"),setSSOState:st("ssoState"),resetSSOState:lt("ssoState",{ssoState:Bt})},qt={loadSSOConfigurationsV2:it("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:it("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:it("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:it("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:it("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:it("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:it("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:it("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:it("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:it("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:it("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:it("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:it("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:it("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:it("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:it("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:it("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:it("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:it("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:it("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:it("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:it("auth/oidcPostlogin",(e=>({payload:e})))},Ht={loading:!1,error:null},Jt={setProfileState:st("profileState"),resetProfileState:lt("profileState",{profileState:Ht})},Yt={loadProfile:it("auth/loadProfile"),saveProfile:it("auth/saveProfile",(e=>({payload:e}))),changePassword:it("auth/changePassword",(e=>({payload:e})))};let Qt;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(Qt||(Qt={}));const Xt={step:Qt.verify,loading:!1,saving:!1},Zt={setMfaState:st("mfaState"),resetMfaState:lt("mfaState",{mfaState:Xt})},en={enrollMfa:it("auth/enrollMfa"),getMFADevices:it("auth/getMFADevices"),getMFAStrategies:it("auth/getMFAStrategies"),verifyMfa:it("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:it("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:it("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:it("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:it("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:it("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:it("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:it("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:it("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:it("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:it("auth/disableMfaWebAuthn",(e=>({payload:e})))},tn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},nn={setTeamLoader:ut("teamState"),setTeamError:dt("teamState"),setTeamState:st("teamState"),resetTeamState:lt("teamState",{teamState:tn})},on={loadUsers:it("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:it("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:it("auth/loadRoles",(e=>({payload:e}))),addUser:it("auth/addUser",(e=>({payload:e}))),addUsersBulk:it("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:it("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:it("auth/updateUser",(e=>({payload:e}))),deleteUser:it("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:it("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:it("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:it("auth/lockUser",(e=>({payload:e}))),resendActivationLink:it("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:it("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:it("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:it("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:it("auth/getInvitationLink"),createInvitationLink:it("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:it("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:it("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:it("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:it("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:it("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:it("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:it("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:it("auth/closeLockUserDialog",(e=>({payload:e})))},an={firstLoad:!0,loading:!1,error:""},rn={setSocialLoginsState:st("socialLoginState"),resetSocialLoginsState:lt("socialLoginState",{socialLoginState:an})},ln={loadSocialLoginsConfiguration:it("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:it("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:it("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:it("auth/setSocialLoginError",(e=>({payload:e})))};let sn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(sn||(sn={}));const cn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:sn.SignUp},un={setSignUpState:st("signUpState"),resetSignUpState:lt("signUpState",{signUpState:cn})},dn={signUpUser:it("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:it("auth/resetSignUpStateSoft")},yn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},fn={setApiTokensLoader:ut("apiTokensState"),setApiTokensError:dt("apiTokensState"),setApiTokensState:st("apiTokensState"),resetApiTokensState:lt("apiTokensState",{apiTokensState:yn})},gn={loadApiTokens:it("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:it("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:it("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:it("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:it("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:it("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:it("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:it("auth/deleteTenantApiToken",(e=>({payload:e})))},pn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},Sn={setSecurityPolicyState:st("securityPolicyState"),setSecurityPolicyGlobalState:ct("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:ct("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:ct("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:ct("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:ct("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyLockoutState:ct("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:ct("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:ct("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:ct("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:lt("securityPolicyState",{securityPolicyState:pn})},vn={loadSecurityPolicy:it("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:it("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:it("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:it("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:it("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:it("auth/loadSecurityPolicyLockout"),saveSecurityPolicyLockout:it("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:it("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:it("auth/loadSecurityPolicyPasswordHistory"),saveSecurityPolicyPasswordHistory:it("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:it("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:it("auth/loadPublicAuthStrategiesPolicy")},hn={loading:!1},mn={setAccountSettingsState:st("accountSettingsState"),resetAccountSettingsState:lt("accountSettingsState",{accountSettingsState:hn})},bn={loadAccountSettings:it("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:it("auth/saveAccountSettings",(e=>({payload:e})))},An={tenants:[],subTenants:[],loading:!0,tenantTree:null},kn={setTenantsState:st("tenantsState"),resetTenantsState:lt("tenantsState",{tenantsState:An})},Tn={switchTenant:it("auth/switchTenant",(e=>({payload:e}))),loadTenants:it("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:it("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:it("auth/loadSubTenantsTree",(e=>({payload:e})))},Pn={loading:!1,roles:[],permissions:[],permissionCategories:[]},In={setRolesState:st("rolesState"),resetRolesState:lt("rolesState",{rolesState:Pn})},Ln={loadRolesAndPermissions:it("auth/loadRoles",(e=>({payload:e}))),addRole:it("auth/addRole",(e=>({payload:e}))),updateRole:it("auth/updateRole",(e=>({payload:e}))),deleteRole:it("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:it("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:it("auth/attachPermissionToRoles",(e=>({payload:e})))},On={loading:!1,sessions:[]},En={setSessionsState:st("sessionsState"),resetSessionsState:lt("sessionsState",{sessionsState:On})},wn={loadUserSessions:it("auth/loadUserSessions"),loadCurrentUserSession:it("auth/loadCurrentUserSession"),deleteUserSession:it("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:it("auth/deleteAllUserSessions"),revokeUserSessions:it("auth/revokeUserSessions",(e=>({payload:e})))},Cn={loading:!1,configurations:{}},Dn={setSessionsPolicyState:st("sessionsPolicyState"),resetSessionsPolicyState:lt("sessionsPolicyState",{sessionsPolicyState:Cn})},Rn={loadSessionsPolicy:it("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:it("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let _n;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(_n||(_n={}));const Un={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:_n.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Mn={setRestrictionsState:st("restrictionsState"),setIpRestrictionsState:ct("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:ct("restrictionsState","emailDomainRestrictions")},Nn={checkIfUserIpValid:it("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:it("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:it("auth/loadIpRestrictions"),saveIpRestriction:it("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:it("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:it("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:it("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:it("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:it("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:it("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},$n={loading:!1},Fn={setProvisioningState:st("provisioningState"),resetProvisioningState:lt("provisioningState",{provisioningState:$n})},xn={loadProvisionConnections:it("auth/loadProvisionConnections"),createProvisionConnection:it("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:it("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:it("auth/updateProvisionConnection",(e=>({payload:e})))},Vn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:cn,loginState:Lt,activateState:Ct,acceptInvitationState:Ut,forgotPasswordState:Ft,ssoState:Bt,profileState:Ht,mfaState:Xt,teamState:tn,socialLoginState:an,apiTokensState:yn,securityPolicyState:pn,accountSettingsState:hn,tenantsState:An,rolesState:Pn,resetPhoneNumberState:Wt,sessionsState:On,sessionsPolicyState:Cn,restrictionsState:Un,provisioningState:$n},jn=I({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},Vn),{reducer:Wn,actions:Kn}=at({name:kt,initialState:jn,reducers:I({resetState:e=>I({},e,Vn),setState:(e,{payload:t})=>I({},e,t),setUser:("user",(e,{payload:t})=>I({},e,{user:t}))},Ot,rn,Dt,Mt,xt,Kt,un,Jt,zt,Zt,nn,fn,Sn,mn,kn,In,En,Dn,Mn,Fn)});const Gn=I({},Kn,Et,ln,Rt,Nt,Vt,Gt,dn,Yt,qt,en,on,gn,vn,bn,Tn,Ln,wn,Rn,Nn,xn);var Bn=function(e){return"@@redux-saga/"+e},zn=Bn("CANCEL_PROMISE"),qn=Bn("CHANNEL_END"),Hn=Bn("IO"),Jn=Bn("MATCH"),Yn=Bn("MULTICAST"),Qn=Bn("SAGA_ACTION"),Xn=Bn("SELF_CANCELLATION"),Zn=Bn("TASK"),ei=Bn("TASK_CANCEL"),ti=Bn("TERMINATE"),ni=Bn("LOCATION");function ii(e,t){if(null==e)return{};var n,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var oi=function(e){return null==e},ai=function(e){return null!=e},ri=function(e){return"function"==typeof e},li=function(e){return"string"==typeof e},si=Array.isArray,ci=function(e){return e&&ri(e.then)},ui=function(e){return e&&ri(e.next)&&ri(e.throw)},di=function e(t){return t&&(li(t)||gi(t)||ri(t)||si(t)&&t.every(e))},yi=function(e){return e&&ri(e.take)&&ri(e.close)},fi=function(e){return ri(e)&&e.hasOwnProperty("toString")},gi=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},pi=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[zn]=function(){clearTimeout(n)},i},Si=function(e){return function(){return e}},vi=Si(!0),hi=function(){},mi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var bi=function(e,t){I(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ai(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var ki=function(e){throw e},Ti=function(e){return{value:e,done:!0}};function Pi(e,t,n){void 0===t&&(t=ki),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:Ti,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Ii(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Li=function(e){return Array.apply(null,new Array(e))},Oi=function(e){return function(t){return e(Object.defineProperty(t,Qn,{value:!0}))}},Ei=function(e){return e===ti},wi=function(e){return e===ei},Ci=function(e){return Ei(e)||wi(e)};function Di(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=si(e)?Li(o):{},l={};return i.forEach((function(e){var i=function(i,l){n||(l||Ci(i)?(t.cancel(),t(i,l)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=hi,l[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return l[e].cancel()})))},l}function Ri(e){return{name:e.name||"anonymous",location:_i(e)}}function _i(e){return e[ni]}var Ui=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),i=0,o=0,a=0,r=function(t){n[o]=t,o=(o+1)%e,i++},l=function(){if(0!=i){var t=n[a];return n[a]=null,i--,a=(a+1)%e,t}},s=function(){for(var e=[];i;)e.push(l());return e};return{isEmpty:function(){return 0==i},put:function(l){var c;if(i<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=l,a=o=(o+1)%e;break;case 4:c=2*e,n=s(),i=n.length,o=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},Mi="TAKE",Ni="CALL",$i="FORK",Fi="SELECT",xi=function(e,t){var n;return(n={})[Hn]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Vi(e,t){return void 0===e&&(e="*"),di(e)?(ai(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),xi(Mi,{pattern:e})):yi(n=e)&&n[Yn]&&ai(t)&&di(t)?xi(Mi,{channel:e,pattern:t}):yi(e)?(ai(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),xi(Mi,{channel:e})):void 0;var n}function ji(e,t){return oi(t)&&(t=e,e=void 0),xi("PUT",{channel:e,action:t})}function Wi(e){var t=xi("ALL",e);return t.combinator=!0,t}function Ki(e,t){var n,i=null;return ri(e)?n=e:(si(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&li(n)&&ri(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function Gi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return xi(Ni,Ki(e,n))}function Bi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return xi($i,Ki(e,n))}function zi(e){return void 0===e&&(e=Xn),xi("CANCEL",e)}function qi(e){void 0===e&&(e=mi);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return xi(Fi,{selector:e,args:n})}var Hi=Gi.bind(null,pi);var Ji=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Yi=[],Qi=0;function Xi(e){try{to(),e()}finally{no()}}function Zi(e){Yi.push(e),Qi||(to(),io())}function eo(e){try{return to(),e()}finally{io()}}function to(){Qi++}function no(){Qi--}function io(){var e;for(no();!Qi&&void 0!==(e=Yi.shift());)Xi(e)}var oo=function(e){return function(t){return e.some((function(e){return co(e)(t)}))}},ao=function(e){return function(t){return e(t)}},ro=function(e){return function(t){return t.type===String(e)}},lo=function(e){return function(t){return t.type===e}},so=function(){return vi};function co(e){var t="*"===e?so:li(e)?ro:si(e)?oo:fi(e)?ro:ri(e)?ao:gi(e)?lo:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var uo={type:qn},yo=function(e){return e&&e.type===qn};function fo(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(uo)}))},(e={})[Yn]=!0,e.put=function(e){if(!t)if(yo(e))a();else for(var o=n=i,r=0,l=o.length;r<l;r++){var s=o[r];s[Jn](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=so),t?e(uo):(e[Jn]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Ai(i,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[Qn]?l(e):Zi((function(){l(e)}))},r}function go(e,t){var n=e[zn];ri(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var po,So=0,vo=function(){return++So};function ho(e){e.isRunning()&&e.cancel()}var mo=((po={}).TAKE=function(e,t,n){var i=t.channel,o=void 0===i?e.channel:i,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!yo(e)||r?n(e):n(ti)};try{o.take(l,ai(a)?co(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},po.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Zi((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&ci(t)?go(t,n):n(t)}))},po.ALL=function(e,t,n,i){var o=i.digestEffect,a=So,r=Object.keys(t);if(0!==r.length){var l=Di(t,n);r.forEach((function(e){o(t[e],a,l[e],e)}))}else n(si(t)?[]:{})},po.RACE=function(e,t,n,i){var o=i.digestEffect,a=So,r=Object.keys(t),l=si(t)?Li(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Ci(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=hi,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,s[e],e)}))},po.CALL=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,l=i.task;try{var s=a.apply(o,r);if(ci(s))return void go(s,n);if(ui(s))return void wo(e,s,l.context,So,Ri(a),!1,n);n(s)}catch(e){n(e,!0)}},po.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){oi(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},po.FORK=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,l=t.detached,s=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var o=n.apply(t,i);if(ui(o))return o;var a=!1;return Pi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!ci(o)})}))}catch(e){return Pi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Ri(t)}(c,a);eo((function(){var t=wo(e,c,s.context,So,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},po.JOIN=function(e,t,n,i){var o=i.task,a=function(e,t){if(e.isRunning()){var n={task:o,cb:t};t.cancel=function(){e.isRunning()&&Ai(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(si(t)){if(0===t.length)return void n([]);var r=Di(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},po.CANCEL=function(e,t,n,i){var o=i.task;t===Xn?ho(o):si(t)?t.forEach(ho):ho(t),n()},po.SELECT=function(e,t,n){var i=t.selector,o=t.args;try{n(i.apply(void 0,[e.getState()].concat(o)))}catch(e){n(e,!0)}},po.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Ui());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(uo):e.isEmpty()?(n.push(i),i.cancel=function(){Ai(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(uo):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(uo)}}}}(t.buffer),a=co(i),r=function t(n){yo(n)||e.channel.take(t,a),o.put(n)},l=o.close;o.close=function(){r.cancel(),l()},e.channel.take(r,a),n(o)},po.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},po.FLUSH=function(e,t,n){t.flush(n)},po.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},po.SET_CONTEXT=function(e,t,n,i){var o=i.task;bi(o.context,t),n()},po);function bo(e,t){return e+"?"+t}function Ao(e){var t=e.name,n=e.location;return n?t+" "+bo(n.fileName,n.lineNumber):t}function ko(e){var t,n,i,o=(t=function(e){return e.cancelledTasks},n=e,(i=[]).concat.apply(i,n.map(t)));return o.length?["Tasks cancelled due to error:"].concat(o).join("\n"):""}var To=null,Po=[],Io=function(e){e.crashedEffect=To,Po.push(e)},Lo=function(){To=null,Po.length=0},Oo=function(){var e,t,n=Po[0],i=Po.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=_i(e))?t.code+" "+bo(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Ao(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+Ao(e.meta)})),[ko(Po)]).join("\n")};function Eo(e,t,n,i,o,a,r){var l;void 0===r&&(r=hi);var s,c,u=0,d=null,y=[],f=Object.create(n),g=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,g.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){o.push(t),t.cont=function(l,s){a||(Ai(o,t),t.cont=hi,s?r(l):(t===e&&(i=l),o.length||(a=!0,n(i))))}}function s(){a||(a=!0,o.forEach((function(e){e.cont=hi,e.cancel()})),o=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return o}}}(t,0,p);function p(t,n){if(n){if(u=2,Io({meta:o,cancelledTasks:y}),S.isRoot){var i=Oo();Lo(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===ei?u=1:1!==u&&(u=3),s=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((l={})[Zn]=!0,l.id=i,l.meta=o,l.isRoot=a,l.context=f,l.joiners=[],l.queue=g,l.cancel=function(){0===u&&(u=1,g.cancelAll(),p(ei,!1))},l.cont=r,l.end=p,l.setContext=function(e){bi(f,e)},l.toPromise=function(){return d||(d=Ji(),2===u?d.reject(c):0!==u&&d.resolve(s)),d.promise},l.isRunning=function(){return 0===u},l.isCancelled=function(){return 1===u||0===u&&1===t.status},l.isAborted=function(){return 2===u},l.result=function(){return s},l.error=function(){return c},l);return S}function wo(e,t,n,i,o,a,r){var l=e.finalizeRunEffect((function(t,n,i){ci(t)?go(t,i):ui(t)?wo(e,t,c.context,n,o,!1,i):t&&t[Hn]?(0,mo[t.type])(e,t.payload,i,u):i(t)}));d.cancel=hi;var s={meta:o,cancel:function(){0===s.status&&(s.status=1,d(ei))},status:0},c=Eo(e,s,n,i,o,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var o;n?(o=t.throw(e),Lo()):wi(e)?(s.status=1,d.cancel(),o=ri(t.return)?t.return(ei):{done:!0,value:ei}):o=Ei(e)?ri(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==s.status&&(s.status=3),s.cont(o.value)):y(o.value,i,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,i,o){void 0===o&&(o="");var a,r=vo();function s(n,o){a||(a=!0,i.cancel=hi,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){To=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),s.cancel=hi,i.cancel=function(){a||(a=!0,s.cancel(),s.cancel=hi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function Co(e,t){for(var n=e.channel,i=void 0===n?fo():n,o=e.dispatch,a=e.getState,r=e.context,l=void 0===r?{}:r,s=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?Ii:u,y=arguments.length,f=new Array(y>2?y-2:0),g=2;g<y;g++)f[g-2]=arguments[g];var p,S=t.apply(void 0,f),v=vo();if(s&&(s.rootSagaStarted=s.rootSagaStarted||hi,s.effectTriggered=s.effectTriggered||hi,s.effectResolved=s.effectResolved||hi,s.effectRejected=s.effectRejected||hi,s.effectCancelled=s.effectCancelled||hi,s.actionDispatched=s.actionDispatched||hi,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Fe.apply(void 0,c);p=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else p=mi;var m={channel:i,dispatch:Oi(o),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:p};return eo((function(){var e=wo(m,S,l,v,Ri(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var Do=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?fo():a,l=n.sagaMonitor,s=ii(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Co.bind(null,I({},s,{context:o,channel:r,dispatch:i,getState:n,sagaMonitor:l})),function(e){return function(t){l&&l.actionDispatched&&l.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){bi(o,e)},c},Ro=function(e){return{done:!0,value:e}},_o={};function Uo(e){return yi(e)?"channel":fi(e)?String(e):ri(e)?e.name:String(e)}function Mo(e,t,n){var i,o,a,r=t;function l(t,n){if(r===_o)return Ro(t);if(n&&!o)throw r=_o,n;i&&i(t);var l=n?e[o](n):e[r]();return r=l.nextState,a=l.effect,i=l.stateUpdater,o=l.errorState,r===_o?Ro(t):a}return Pi(l,(function(e){return l(null,e)}),n)}function No(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:Vi(e)},l=function(e){return{done:!1,value:Bi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return Mo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Uo(e)+", "+t.name+")")}function $o(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,l={done:!1,value:Vi(e)},s=function(e){return{done:!1,value:Bi.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:zi(e)}},u=function(e){return a=e},d=function(e){return r=e};return Mo({q1:function(){return{nextState:"q2",effect:l,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:s(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:s(r),stateUpdater:u}}},"q1","takeLatest("+Uo(e)+", "+t.name+")")}function Fo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:Vi(e)},l=function(e){return{done:!1,value:Gi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return Mo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Uo(e)+", "+t.name+")")}function xo(e,t,n){for(var i=e,o=arguments.length,a=new Array(o>3?o-3:0),r=3;r<o;r++)a[r-3]=arguments[r];var l={done:!1,value:Gi.apply(void 0,[n].concat(a))},s={done:!1,value:Hi(t)};return Mo({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:_o}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function Vo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Bi.apply(void 0,[No,e,t].concat(i))}function jo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Bi.apply(void 0,[$o,e,t].concat(i))}function Wo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Bi.apply(void 0,[Fo,e,t].concat(i))}class Ko{constructor(){this.context=null,this.accessToken=null,this.user=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return Ko.instance||(Ko.instance=new Ko),Ko.instance}static setContext(e){Ko.getInstance().context=e}static setAccessToken(e){Ko.getInstance().accessToken=e}static setUser(e){Ko.getInstance().user=e}static setOnRedirectTo(e){Ko.getInstance().onRedirectTo=e}static setLogout(e,t){Ko.getInstance().logout=n=>{n?e(n):Ko.onRedirectTo(t)}}static getContext(){var e;return null!=(e=Ko.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Ko.getInstance().accessToken}static getUser(){return Ko.getInstance().user}static onRedirectTo(e,t){return Ko.getInstance().onRedirectTo(e,t)}static logout(e){return Ko.getInstance().logout(e)}}Ko.instance=void 0;const Go={getContext:()=>Ko.getContext(),getAccessToken:()=>Ko.getAccessToken(),getUser:()=>Ko.getUser(),onRedirectTo:(e,t)=>Ko.onRedirectTo(e,t),logout:e=>Ko.logout(e)};class Bo extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function zo(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}const qo=async e=>{var t,n,i;const o=Ko.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Ko.getAccessToken)(),o={};i&&(o.Authorization=`Bearer ${i}`),t&&(o["Content-Type"]=t);for(const t of await async function(e){let t=[];return e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),t}(e))o[`${t.key}`]=`${t.value}`;return o["x-frontegg-source"]="frontegg-react",o}(o,e.contentType),r=await async function(e,t,n){const i=zo(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),l=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:I({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===l.status)return window.location.href=await l.text(),new Promise((()=>{}));if(!l.ok){var s,c;if(413===l.status)throw new Bo("Error request is too large",l.status);let e;try{e=await l.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=o.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new Bo(e,l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},Ho=async(e,t,n)=>qo(I({url:e,method:"GET",contentType:"application/json",params:t},n)),Jo=async(e,t,n)=>qo(I({url:e,method:"POST",contentType:"application/json",body:t},n)),Yo=async(e,t,n)=>qo(I({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Qo=async(e,t,n)=>qo(I({url:e,method:"PUT",contentType:"application/json",body:t},n)),Xo=async(e,t,n)=>qo(I({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Zo=async(e,t,n,i)=>qo(I({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),ea={v1:"/identity/resources/users/webauthn/v1/devices"},ta={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},na={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}}},ia={v1:"/identity/resources/configurations/v1"},oa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},aa={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2"},ra={v1:"/identity/resources/permissions/v1"},la={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},invites:{user:{v1:"/identity/resources/tenants/invites/v1/user"},verify:{v1:"/identity/resources/tenants/invites/v1/verify"},configuration:{v1:"/identity/resources/tenants/invites/v1/configuration"}}},sa={v1:"/identity/resources/roles/v1"},ca={v1:"/identity/resources/sub-tenants/users/v1"},ua={v1:"/resources/impersonation/v1/impersonate"},da={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},ya={v1:"/team/resources/members/v1"},fa={v1:"/team/resources/roles/v1"},ga={v1:"/team/resources/stats/v1"},pa={v1:"/team/resources/profile"},Sa={v1:"/tenants/resources/account-settings/v1"},va={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},ha={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},ma={subscriptions:{v1:"/subscriptions/resources/billing/subscriptions/v1"},plans:{v1:"/subscriptions/resources/billing/plans/v1"},invoices:{v1:"/subscriptions/resources/billing/invoices/v1"},paymentMethods:{v1:"/subscriptions/resources/billing/payment-methods/v1"},summaries:{v1:"/subscriptions/resources/billing/summaries/v1"},tenantConfiguration:{v1:"/subscriptions/resources/billing/tenant-configurations/v1"},configurations:{vendorPublicConfigurations:{v1:"/subscriptions/resources/billing/configurations/vendor-public-configurations/v1"}},paymentProviders:{stripe:{customers:{v1:"/subscriptions/resources/billing/payment-providers/stripe/customers/v1"},publicConfigurations:{v1:"/subscriptions/resources/billing/payment-providers/stripe/public-configurations/v1"},subscriptions:{v1:"/subscriptions/resources/billing/payment-providers/stripe/subscriptions/v1"},setupIntents:{v1:"/subscriptions/resources/billing/payment-providers/stripe/setup-intents/v1"}}}},ba={v1:"/subscriptions/resources/payment-providers/v1"},Aa={v1:"/subscriptions/resources/subscriptions/v1"},ka={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Ta={v1:"/reports/engine/resources/triggers/v1"},Pa="/notification",Ia="/audits",La={v1:"/event/resources/configurations/v1"},Oa="/webhook",Ea="/oauth",wa="/flags",Ca="/directory/resources/v1/configurations/scim2",Da="/directory/resources/scim/temp";async function Ra(e){return Qo(`${na.v1}/tenant`,e)}async function _a(){return Ho(`${na.v2}/me/tenants`)}async function Ua(){return Ho(va.v1)}async function Ma(){return Ho(va.tree.v1)}async function Na(){return Ho(ia.v1)}async function $a(){return Ho(`${ia.v1}/mfa-policy`)}async function Fa(){return Ho(`${ia.v1}/mfa-policy/vendor`)}async function xa(e){return e.id?Yo(`${ia.v1}/mfa-policy`,e):Jo(`${ia.v1}/mfa-policy`,e)}async function Va(){return Ho(`${ia.v1}/lockout-policy`)}async function ja(e){return e.id?Yo(`${ia.v1}/lockout-policy`,e):Jo(`${ia.v1}/lockout-policy`,e)}async function Wa(){try{return await Ho(`${ia.v1}/captcha-policy/public`)}catch{return null}}async function Ka(){return Ho(`${ia.v1}/password-history-policy`)}async function Ga(e){return e.id?Yo(`${ia.v1}/password-history-policy`,e):Jo(`${ia.v1}/password-history-policy`,e)}async function Ba(){return Ho(`${ia.v1}/password`)}async function za(){return Ho(`${oa.emailDomain.v1}`)}async function qa(){return Ho(`${oa.emailDomain.v1}/config`)}async function Ha(e){return Jo(`${oa.emailDomain.v1}`,e)}async function Ja(e){return Jo(`${oa.emailDomain.v1}/config`,e)}async function Ya(e){return Xo(`${oa.emailDomain.v1}/${e}`)}async function Qa(e){return Ho(`${oa.ip.v1}`,e)}async function Xa(){return Ho(`${oa.ip.v1}/config`)}async function Za(e){return Jo(`${oa.ip.v1}`,e)}async function er(e){return Jo(`${oa.ip.v1}/bulk`,e)}async function tr(e){return Jo(`${oa.ip.v1}/config`,e)}async function nr(e){return Xo(`${oa.ip.v1}/${e}`)}async function ir(){return Jo(`${oa.ip.v1}/verify`)}async function or(){return Jo(`${oa.ip.v1}/verify/allow`)}let ar,rr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(ar||(ar={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(rr||(rr={}));class lr extends Error{constructor(e){super(e)}}const sr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new lr("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,i,o=0,a=0;i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?n+=String.fromCharCode(255&e>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};class cr extends Error{constructor(e){super(e)}}const ur=(e,t={})=>{const n=t.header?0:1;try{return JSON.parse((e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(e){return decodeURIComponent(sr(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return sr(t)}})(e.split(".")[n]))}catch(e){throw new cr("Invalid token specified: "+e.message)}},dr=["type"],yr=["type"];async function fr(e){if(!e.accessToken)return e;Ko.setAccessToken(e.accessToken);const t=await Ho(`${na.v2}/me`),n=I({},e,e.accessToken?ur(e.accessToken):{},t);return Ko.setUser(n),n}async function gr(e){if(!e.accessToken)return{user:e};Ko.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Ho(`${na.v2}/me`),_a()]),i=I({},e,e.accessToken?ur(e.accessToken):{},t);return Ko.setUser(i),{user:i,tenants:n}}async function pr(e){Ko.setAccessToken(e.id_token);const t=await Ho(`${na.v2}/me`),n=e.id_token?ur(e.id_token):{},i=I({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:n.exp?Math.ceil(n.exp-(new Date).getTime()/1e3):300});return Ko.setUser(i),i}async function Sr(e){try{const{address:t}=await Jo(`${ta.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function vr(e){return Jo(`${ta.v1}/user/saml/prelogin`,e)}async function hr(e){return fr(await Jo(`${ta.v1}/user/saml/postlogin`,e))}async function mr(e){return fr(await Jo(`${ta.v1}/user/oidc/postlogin`,e))}async function br(e){return fr(await Jo(`${ta.v1}/user`,e))}async function Ar(e){return fr(await Jo(`${ta.v1}/user/mfa/verify`,e))}async function kr(e){return Jo(`${na.v1}/activate`,e)}async function Tr(e){return Ho(`${na.v1}/activate/strategy`,e)}async function Pr(e){return Jo(`${na.v1}/activate/reset`,e)}async function Ir(e){return Jo(`${na.v1}/invitation/reset`,e)}async function Lr(e){return Jo(`${na.v1}/invitation/accept`,e)}async function Or(){return fr(await Jo(`${ta.v1}/user/token/refresh`))}async function Er(){return gr(await Jo(`${ta.v1}/user/token/refresh`))}async function wr(){return Jo(`${ta.v1}/logout`)}async function Cr(e){return Ho(`${Ea}/logout`,e)}async function Dr(e){return Jo(`${na.v1}/passwords/reset`,e)}async function Rr(e){return Jo(`${na.v1}/passwords/reset/verify`,e)}async function _r(e){return Ho(`${na.v1}/passwords/config`,e)}async function Ur(e){return Jo(`${ta.v1}/user/mfa/recover`,e)}async function Mr(){return Jo(`${na.v1}/mfa/enroll`)}async function Nr(){return Jo(`${na.v1}/mfa/authenticator/enroll`)}async function $r(e){return Jo(`${na.v1}/mfa/authenticator/enroll/verify`,e)}async function Fr(e){return Jo(`${na.v1}/mfa/sms/enroll`,e)}async function xr(e){return Jo(`${na.v1}/mfa/sms/enroll/verify`,e)}async function Vr(){return Jo(`${na.v1}/mfa/webauthn/enroll`)}async function jr(e){return Jo(`${na.v1}/mfa/webauthn/enroll/verify`,e)}async function Wr(e){return Jo(`${na.v1}/mfa/enroll/verify`,e)}async function Kr(e){return Jo(`${na.v1}/mfa/disable`,e)}async function Gr(e,t){return Jo(`${na.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Br(e){return Jo(`${na.v1}/mfa/sms/${e}/disable`)}async function zr(e,t){return Jo(`${na.v1}/mfa/sms/${e}/disable/verify`,t)}async function qr(e){return Jo(`${na.v1}/mfa/webauthn/${e}/disable`)}async function Hr(e,t){return Jo(`${na.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Jr(){return Ho(`${na.v1}/mfa/devices`)}async function Yr(e){return Jo(`${ta.v1}/user/mfa/authenticator/enroll`,e)}async function Qr(e){return Jo(`${ta.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Xr(e,t){return Jo(`${ta.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Zr(e){return Jo(`${ta.v1}/user/mfa/sms/enroll`,e)}async function el(e){return Jo(`${ta.v1}/user/mfa/sms/enroll/verify`,e)}async function tl(e,t){return Jo(`${ta.v1}/user/mfa/sms/${e}`,t)}async function nl(e,t){return Jo(`${ta.v1}/user/mfa/sms/${e}/verify`,t)}async function il(e){return Jo(`${ta.v1}/user/mfa/webauthn/enroll`,e)}async function ol(e){return Jo(`${ta.v1}/user/mfa/webauthn/enroll/verify`,e)}async function al(e,t){return Jo(`${ta.v1}/user/mfa/webauthn/${e}`,t)}async function rl(e,t){return Jo(`${ta.v1}/user/mfa/webauthn/${e}/verify`,t)}async function ll(){return Ho(`${da.v1}/saml/configurations`)}async function sl(e){return Jo(`${da.v1}/saml/configurations`,e)}async function cl(){return Ho(`${da.v1}/saml/configurations/vendor-config`)}async function ul(e){return Qo(`${da.v1}/saml/configurations/metadata`,e)}async function dl(){return Qo(`${da.v1}/saml/validations/domain`)}async function yl(){return Ho(`${da.v1}/saml/configurations/roles/default`)}async function fl(){return Ho(`${da.v2}/saml/configurations/groups`)}async function gl({roleIds:e}){return Jo(`${da.v1}/saml/configurations/roles/default`,{roleIds:e})}async function pl({roleIds:e,group:t}){return Jo(`${da.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Sl({roleIds:e,group:t,id:n}){return Yo(`${da.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function vl({id:e}){return Xo(`${da.v2}/saml/configurations/groups/${e}`)}async function hl(){return Ho(`${da.v1}/oidc/configurations`)}async function ml(){return Ho(`${da.v2}/configurations/public`)}async function bl(){return Ho(aa.v1)}async function Al(){return Ho(aa.v2)}async function kl({provider:e,code:t,idToken:n,redirectUri:i,codeVerifier:o,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),i&&(s.redirectUri=i),o&&(s.code_verifier=o),l&&(s.state=l),Jo(`${ta.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function Tl(){return Ho(`${ia.v1}/public`)}async function Pl(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Jo(`${na.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await fr(n):void 0,userId:i,tenantId:o}}async function Il(){return Ho(na.sessions.currentUser.v1)}async function Ll(){return Ho(`${na.sessions.currentUser.v1}/current`)}async function Ol(e){return Jo(`${na.sessions.v1}/revoke`,{userId:e})}async function El(){return Ho(na.sessions.configurations.v1)}async function wl(e){await Jo(na.sessions.configurations.v1,e)}async function Cl(e){await Xo(`${na.sessions.currentUser.v1}/${e}`)}async function Dl(){await Xo(`${na.sessions.currentUser.v1}/all`)}async function Rl(){return Ho(na.apiTokens.v1)}async function _l(){return Ho(la.apiTokens.v1)}async function Ul(e){return Jo(na.apiTokens.v1,e)}async function Ml(e){return Jo(la.apiTokens.v2,e)}async function Nl({tokenId:e}){return Xo(`${la.apiTokens.v1}/${e}`)}async function $l({tokenId:e}){return Xo(`${na.apiTokens.v1}/${e}`)}async function Fl({userId:e}){return Ho(`${na.v1}/${e}`)}async function xl(e){return Ho(`${ia.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Vl(e){let{type:t}=e,n=ii(e,dr);return Jo(`${ta.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function jl(e){let{type:t}=e,n=ii(e,yr);return Jo(`${ta.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Wl({token:e}){return Jo(la.invites.verify.v1,{token:e})}async function Kl(){return Ho(`${da.v1}/configurations`)}async function Gl(e){return Jo(`${da.v1}/configurations`,e)}async function Bl(e,t){return Yo(`${da.v1}/configurations/${e}`,t)}async function zl(e){return Xo(`${da.v1}/configurations/${e}`)}async function ql(e){return Jo(`${da.v1}/configurations/metadata`,e)}async function Hl(e,t){return Qo(`${da.v1}/configurations/${e}/metadata`,t)}async function Jl(e,t){return Jo(`${da.v1}/configurations/${e}/domains`,t)}async function Yl(e,t){return Xo(`${da.v1}/configurations/${e}/domains/${t}`)}async function Ql(e,t){return Qo(`${da.v1}/configurations/${e}/domains/${t}/validate`)}async function Xl(e){return Ho(`${da.v1}/configurations/${e}/roles`)}async function Zl(e,t){return Qo(`${da.v1}/configurations/${e}/roles`,t)}async function es(e,t){return Jo(`${da.v1}/configurations/${e}/groups`,t)}async function ts(e,{roleIds:t,group:n,id:i}){return Yo(`${da.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function ns(e,t){return Xo(`${da.v1}/configurations/${e}/groups/${t}`)}async function is(e){return Ho(`${da.v1}/configurations/${e}/groups`)}async function os(e){return Jo(`${ta.v2}/user/sso/prelogin`,e)}async function as(e){return fr(await Jo(`${ta.v2}/user/oidc/postlogin`,e))}async function rs(e){return pr(await Jo(`${Ea}/token`,e))}async function ls(){return pr(await Jo(`${Ea}/authorize/silent`))}async function ss(e){return Jo(`${na.v1}/phone/reset`,e)}async function cs(e){return Jo(`${na.v1}/phone/reset/verify`,e)}async function us(e){return Jo(`${na.v1}/phone`,e)}async function ds(e){return Jo(`${na.v1}/phone/verify`,e)}async function ys(e){return Qo(`${na.v1}/phone/change`,e)}async function fs(e){return Jo(`${ta.v1}/webauthn/prelogin`,e)}async function gs(e){return Jo(`${ta.v1}/webauthn/postlogin`,e)}async function ps(){return Jo(ea.v1)}async function Ss(e){return Jo(`${ea.v1}/verify`,e)}async function vs(){return Ho(`${ia.v1}/auth/strategies/public`)}async function hs(){return Ho(`${ia.v1}/mfa/strategies`)}async function ms(e){return Ho(`${na.v2}/me`,null!=e?e:{addRoles:!0})}async function bs(e){return Qo(`${na.v2}/me`,e)}async function As(e){return Qo(`${pa.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function ks(e){return Jo(`${na.v1}/passwords/change`,e)}async function Ts(e){var t,n,i,o,a,r;const l=(e.filter||[]).reduce(((e,t)=>I({},e,{[t.id]:t.value})),{}),s=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(i=e.sort)||null==(o=i[0])?void 0:o.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return Ho(ya.v1,I({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function Ps(e){return Jo(na.v2,I({},e,{provider:"local"}))}async function Is(e){return Xo(`${ya.v1}/${e.userId}`)}async function Ls(e){return Qo(ya.v1,e)}async function Os(e){return Jo(la.invites.user.v1,I({},e))}async function Es(e){return Yo(la.invites.user.v1,I({},e))}async function ws(){return Xo(la.invites.user.v1)}async function Cs(){return Ho(la.invites.user.v1)}async function Ds(){return Ho(la.invites.configuration.v1)}async function Rs(){return Ho(fa.v1)}async function _s(){return Ho(ra.v1)}async function Us(){return Ho(`${ga.v1}/members`)}async function Ms(e){return Jo(`${ya.v1}/${e.userId}/resendActivationEmail`,{})}async function Ns(e){return Jo(na.v2,I({},e,{provider:"local"}))}async function $s(e){return Jo(na.invitation.resendAll.v1,I({},e))}async function Fs(e){var t,n;const i=await Ho("/metadata",e);if(null!=i&&null!=(t=i.rows)&&t[0])return null==i||null==(n=i.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function xs(){const e=await Ho("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Vs=async()=>Fs({entityName:"notifications"}),js=async()=>Fs({entityName:"saml"}),Ws=async()=>Fs({entityName:"audits"}),Ks=async e=>async function(e){const t=await Ho(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Gs=["dataFilters"],Bs=["templateId","dataFilters"],zs=["dataFilters"];async function qs(e){return Ho(`${ka.v2}/tenant-reports`,e)}async function Hs(e){return Ho(`${ka.v2}/${e.id}/tenant-reports`)}async function Js(e){let{dataFilters:t}=e,n=ii(e,Gs);return{html:await Ho(`${Ta.v1}/preview-report`,I({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Ys(e){let{templateId:t,dataFilters:n}=e,i=ii(e,Bs);return Jo(`${ka.v2}/${t}/tenant-reports`,I({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Qs(e){let{dataFilters:t}=e,n=ii(e,zs);const i=await Ho(`${Ta.v1}/preview-report`,I({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),l=URL.createObjectURL(r),s=document.createElement("a");s.href=l,s.setAttribute("download",`report_${n.name||""}.${a}`),s.click(),setTimeout(s.remove.bind(s))}async function Xs(e){return Jo(`${Ta.v1}/tenant-reports`,e)}async function Zs(e){return Ho(Pa,{params:e})}async function ec(e){return Qo(`${Pa}/status`,{params:e})}async function tc(e){const{notificationId:t,pinStatus:n}=e;return Qo(`${Pa}/${n}`,{notificationId:t})}async function nc(){return Jo(`${Pa}/status/mark-all-read`)}const ic=["endpoint","headerProps"];async function oc(e){return Ho(Ia,e)}async function ac(e){return Ho(`${Ia}/stats`,e)}async function rc(e){const{endpoint:t,headerProps:n}=e,i=ii(e,ic);return Zo(`${Ia}/export/${t}`,{properties:n},i)}const lc=["eventKey"],sc=["eventKey"],cc=()=>Ho(`${ha.v1}/slack`),uc=()=>Ho(`${ha.v1}/slack/applications`),dc=()=>Ho(`${ha.v1}/slack/channels`),yc=e=>e.id?Yo(`${ha.v1}/slack/subscription/${e.id}`,e):Jo(`${ha.v1}/slack/subscriptions`,e),fc=e=>Xo(`${ha.v1}/slack/subscriptions/${e.id}`),gc=e=>Jo(`${ha.v1}/slack/applications/registrations`,{code:e}),pc=()=>Ho(`${ha.v1}/emails`),Sc=e=>{let{eventKey:t}=e,n=ii(e,lc);return Jo(`${ha.v1}/emails/${t}`,n)},vc=({eventKey:e,enabled:t})=>Yo(`${ha.v1}/emails/${e}`,{enabled:t}),hc=(e,t)=>Xo(`${ha.v1}/emails/${e}/subscriptions/${t}`),mc=(e,t,n)=>Qo(`${ha.v1}/emails/${t}/subscriptions/${e}`,n),bc=e=>Xo(`${ha.v1}/emails/${e}`),Ac=()=>Ho(`${ha.v2}/sms`),kc=e=>{let{eventKey:t}=e,n=ii(e,sc);return Jo(`${ha.v2}/sms/${t}`,n)},Tc=({eventKey:e,enabled:t})=>Yo(`${ha.v2}/sms/${e}`,{enabled:t}),Pc=(e,t)=>Xo(`${ha.v2}/sms/${e}/subscriptions/${t}`),Ic=(e,t,n)=>Qo(`${ha.v2}/sms/${t}/subscriptions/${e}`,n),Lc=e=>Xo(`${ha.v2}/sms/${e}`),Oc=()=>Ho(Oa),Ec=e=>e._id?Yo(`${Oa}/${e._id}`,e):Jo(`${Oa}/custom`,e),wc=e=>Xo(`${Oa}/${e}`),Cc=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Ho(`${Oa}/logs/?${i.toString()}`)},Dc=e=>Jo(`${Oa}/test`,e),Rc=e=>Jo(`${Oa}/logs/${e}/retries`),_c=()=>Ho(`${La.v1}/categories`),Uc=e=>Ho(La.v1,{channels:e});async function Mc(e){return Qo(Sa.v1,e)}async function Nc(){return Ho(Sa.v1)}const $c=["roleId"],Fc=["roleId"],xc=["permissionId"];async function Vc(){return Ho(sa.v1)}async function jc(e){return Jo(sa.v1,e)}async function Wc({roleId:e}){return Xo(`${sa.v1}/${e}`)}async function Kc(e){let{roleId:t}=e,n=ii(e,$c);return Yo(`${sa.v1}/${t}`,n)}async function Gc(e){let{roleId:t}=e,n=ii(e,Fc);return Qo(`${sa.v1}/${t}/permissions`,n)}async function Bc(){return Ho(ra.v1)}async function zc(e){let{permissionId:t}=e,n=ii(e,xc);return Qo(`${ra.v1}/${t}/roles`,n)}async function qc(){return Ho(`${ra.v1}/categories`)}async function Hc(){return Ho(ma.subscriptions.v1)}async function Jc(e){return Ho(`${ma.subscriptions.v1}/${e}`)}async function Yc(e){return Qo(`${ma.subscriptions.v1}/${e}/cancellations/`,{})}async function Qc(e){return Qo(`${ma.subscriptions.v1}/${e}/renewals/`,{})}async function Xc(e,{paymentMethodId:t,planId:n}){return Qo(`${ma.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Zc(e){return Ho(`${Aa.v1}/${e}`)}async function eu(){return Ho(`${Aa.v1}`)}async function tu(e){return Qo(`${Aa.v1}/${e}/cancellations/`,{})}async function nu(e){return Qo(`${Aa.v1}/${e}/renewals/`,{})}async function iu(e,{paymentMethodId:t,planId:n}){return Qo(`${Aa.v1}/${e}`,{paymentMethodId:t,planId:n})}async function ou(){return Ho(ma.plans.v1)}async function au(e){return Ho(`${ma.plans.v1}/${e}`)}async function ru(){return Ho(ma.invoices.v1)}async function lu(e){return Ho(`${ma.invoices.v1}/${e}`)}async function su(e,t){return Ho(`${ma.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const cu=["email"];async function uu(){return Ho(ma.paymentMethods.v1)}async function du(e){return Ho(`${ma.paymentMethods.v1}/${e}`)}async function yu(e,t){let{email:n}=t,i=ii(t,cu);return Yo(`${ma.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function fu(e){return Jo(ma.paymentProviders.stripe.subscriptions.v1,e)}async function gu(e){return Ho(`${ma.paymentProviders.stripe.customers.v1}/${e}`)}async function pu(e){return Jo(`${ma.paymentProviders.stripe.customers.v1}`,e)}async function Su(){return Ho(`${ma.paymentProviders.stripe.publicConfigurations.v1}`)}async function vu(e){return Jo(`${ma.paymentProviders.stripe.setupIntents.v1}`,e)}async function hu(e){return Ho(`${ma.summaries.v1}/${e}`)}async function mu(e){return Ho(`${ma.tenantConfiguration.v1}/${e}`)}async function bu(e){return Jo(`${ma.tenantConfiguration.v1}`,e)}async function Au(){return Ho(ba.v1)}async function ku(){return Ho(`${ma.configurations.vendorPublicConfigurations.v1}`)}let Tu,Pu,Iu,Lu,Ou,Eu,wu,Cu,Du,Ru,_u;async function Uu(){return Ho("/vendors/public")}async function Mu(e){return Ho(ca.v1,e)}async function Nu(e){return Jo(ca.v1,e)}async function $u(e){return Xo(ca.v1,e)}async function Fu(e,t){return Jo(`${ca.v1}/${e}/roles`,t)}async function xu(e,t){return Xo(`${ca.v1}/${e}/roles`,t)}async function Vu(e,t){return Yo(`${ca.v1}/${e}/roles`,t)}async function ju(){return Ho(wa)}async function Wu(){return Ho(`${Ca}`)}async function Ku(e,t){return Yo(`${Ca}/${e}`,t)}async function Gu(e){return Jo(`${Ca}`,e)}async function Bu(e){return Xo(`${Ca}/${e}`)}async function zu(e){return Ho(`${Da}/${e}/Users/count`)}async function qu(e){return Jo(`${ua.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Tu||(Tu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Pu||(Pu={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Iu||(Iu={})),(Lu||(Lu={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Ou||(Ou={})),function(e){e.CREATE="create_customer"}(Eu||(Eu={})),function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode"}(wu||(wu={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Cu||(Cu={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Du||(Du={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Ru||(Ru={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(_u||(_u={}));const Hu=[`${ta.v1}/logout`,`${ta.v1}/user/saml/postlogin`,`${ta.v2}/user/oidc/postlogin`,`${ta.v1}/user`,`${ta.v1}/user/mfa/verify`,`${ta.v1}/user/token/refresh`,`${na.v1}`,`${na.v1}/signUp`,`${ta.v1}/passwordless/magiclink/postlogin`,`${ta.v1}/passwordless/code/postlogin`,`${ta.v1}/passwordless/smscode/postlogin`,`${na.v1}/activate`,`${na.v1}/invitation/accept`,`${Ea}/token`,`${Ea}/authorize/silent`],Ju=`${ta.v1}/user/token/refresh`,Yu=`${Ea}/authorize/silent`,Qu=`${na.v2}/me`,Xu=`${na.v2}/me/tenants`;let Zu;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Zu||(Zu={}));const ed={auth:o,teams:a,metadata:r,reports:l,connectivity:u,notifications:s,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:g,subTenants:p,featureFlags:S,directory:v,impersonate:h};var td={fetch:e,ContextHolder:Ko,FronteggContext:Go,api:ed,FronteggApiError:Bo,AuthStrategyEnum:rr,SocialLoginProviders:ar,ISubscriptionCancellationPolicy:Iu,ISubscriptionStatus:Tu,PaymentMethodType:Pu,ProviderType:Lu};let nd,id;function od(e,t){const n=I({},e);return t.forEach((e=>{delete n[e]})),n}async function ad(e){const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function rd(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(e){e.LOAD_SSO_CONFIGURATIONS="LOAD_SSO_CONFIGURATIONS",e.SAVE_SSO_CONFIGURATION="SAVE_SSO_CONFIGURATION",e.UPDATE_SSO_CONFIGURATION="UPDATE_SSO_CONFIGURATION",e.SAVE_SSO_CONFIGURATION_BY_METADATA="SAVE_SSO_CONFIGURATION_BY_METADATA",e.UPDATE_SSO_CONFIGURATION_BY_METADATA="UPDATE_SSO_CONFIGURATION",e.DELETE_SSO_CONFIGURATION="DELETE_SSO_CONFIGURATION",e.SAVE_SSO_DOMAIN="SAVE_SSO_DOMAIN",e.DELETE_SSO_DOMAIN="DELETE_SSO_DOMAIN",e.VALIDATE_SSO_DOMAIN="VALIDATE_SSO_DOMAIN",e.UPDATE_SSO_DEFAULT_ROLES="UPDATE_SSO_DEFAULT_ROLES",e.DELETE_SSO_GROUPS="DELETE_SSO_GROUPS",e.SAVE_SSO_GROUPS="SAVE_SSO_GROUPS",e.GET_SSO_AUTHORIZATION_ROLES="GET_SSO_AUTHORIZATION_ROLES"}(nd||(nd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(id||(id={}));const ld=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n})),sd={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},cd=I({},sd,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),ud={id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!0,profileImage:void 0,profilePictureUrl:"https://www.gravatar.com/avatar/42b2ad2bad6fc9b9db5086dfcf8072ac?d=https://ui-avatars.com/api/fe/128/random?t=1617261890875?t=1617261917434",roles:[{id:"roleId",key:"admin",isDefault:!1,name:"Admin",description:null,permissions:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",key:"fe.*",name:"General Admin",description:void 0,categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),roleIds:void 0,verified:void 0},dd=I({},ud,{accessToken:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MTY5YmY0Zi02YmI5LTQ5NGMtOGNkZS05MDc4NDQ0NWY4MDciLCJuYW1lIjoiRHVtbXkgVXNlciIsImVtYWlsIjoiZHVtbXlAZnJvbnRlZ2cuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsIm1ldGFkYXRhIjp7fSwicm9sZXMiOlsiYWRtaW4iXSwicGVybWlzc2lvbnMiOlsiZmUuKiJdLCJ0ZW5hbnRJZCI6Im15LXRlbmFudC1pZCIsInRlbmFudElkcyI6WyJteS10ZW5hbnQtaWQiXSwicHJvZmlsZVBpY3R1cmVVcmwiOiJodHRwczovL3d3dy5ncmF2YXRhci5jb20vYXZhdGFyLzQyYjJhZDJiYWQ2ZmM5YjlkYjUwODZkZmNmODA3MmFjP2Q9aHR0cHM6Ly91aS1hdmF0YXJzLmNvbS9hcGkvZmUvMTI4L3JhbmRvbT90PTE2MTcyNjE4OTA4NzU_dD0xNjE3MjYxOTE3NDM0IiwidHlwZSI6InVzZXJUb2tlbiIsImlhdCI6MTYxNzkwNjMyNCwiZXhwIjoxNjE3OTkyNzI0LCJpc3MiOiJmcm9udGVnZyJ9.paaXLkpWEWbQmUtoK2P8IwXCxK4WJp7XhXonvzF8g1I",expiresIn:86400,mfaRequired:!1,refreshToken:"refresh-token-dummy-de39dc9c-9d22-4852-b7f5-c3c0aa613b58",type:"userToken",iat:1617906324,exp:1617992724,iss:"frontegg",email_verified:!0}),yd={loading:!1,error:void 0,saving:!0,profile:ud},fd={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date,allowOverrideEnforcePasswordHistory:!0,allowOverridePasswordComplexity:!1,allowOverridePasswordExpiration:!1,allowSignups:!0,apiTokensEnabled:!0,cookieSameSite:"cookieSameSite",defaultRefreshTokenExpiration:0,defaultTokenExpiration:1,publicKey:"publicKey"},gd={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:rr.EmailAndPassword},pd={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Sd={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},vd={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},hd={enabled:!0,domain:"domain",validated:!0,generatedVerification:"generatedVerification",ssoEndpoint:"ssoEndpoint",publicCertificate:"publicCertificate",signRequest:!0,createdAt:new Date,updatedAt:new Date,acsUrl:void 0,spEntityId:void 0,oidcClientId:void 0,oidcSecret:void 0,type:void 0},md={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},bd=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Ad={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:hd,roles:bd,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},kd=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Td={id:"id2",email:"demo-user2@frontegg.com",name:"Demo User Name2",phone:void 0,profileImage:void 0,profileImageUrl:void 0,tenantId:"tenantId",vendorId:"vendorId",roleIds:[],activatedForTenant:!0,verified:!1,createdAt:(new Date).toISOString(),customData:void 0,lastLogin:void 0,mfaEnabled:void 0,roles:[]},Pd={id:"id",email:"demo-user@frontegg.com",name:"Demo User Name",phone:void 0,profileImage:void 0,profileImageUrl:void 0,tenantId:"tenantId",vendorId:"vendorId",roleIds:[],activatedForTenant:!0,createdAt:new Date(2022,4,1).toISOString(),verified:!0,customData:void 0,lastLogin:new Date(2022,5,25).toISOString(),mfaEnabled:void 0,roles:[]},Id={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Ld=[Pd,Td],Od=[Id],Ed=[{id:"my-tenant-id",isReseller:!1,name:"Frontegg demo",deletedAt:null,metadata:void 0,tenantId:"my-tenant-id",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date,address:void 0,timezone:void 0,dateFormat:void 0,timeFormat:void 0,currency:void 0,logo:void 0}],wd=[{id:"laptop",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15",createdAt:new Date,ipAddress:"190.194.88.251",current:!0},{id:"iphone",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Mobile/15E148 Safari/604.1",createdAt:new Date(Date.now()-1e4),ipAddress:"191.49.203.21"},{id:"tablet",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; SGP771 Build/32.2.A.0.253; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.98 Safari/537.36",createdAt:new Date(Date.now()-3e4),ipAddress:"130.19.196.136"},{id:"anotherlaptop",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15",createdAt:new Date(Date.now()-1002232300),ipAddress:"2.228.163.92"}],Cd={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Dd={isActive:!0,strategy:_n.ALLOW},Rd=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:_n.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:_n.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:_n.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:_n.BLOCK,description:"IP 4"}];let _d,Ud,Md;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(_d||(_d={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Ud||(Ud={})),function(e){e.profile="profile",e.privacy="privacy",e.personalApiTokens="personalApiTokens",e.account="account",e.users="users",e.security="security",e.sso="sso",e.audits="audits",e.webhooks="webhooks",e.apiTokens="apiTokens",e.roles="roles",e.subscriptions="subscription"}(Md||(Md={})),Md.profile,Md.privacy,Md.personalApiTokens,Md.account,Md.users,Md.security,Md.sso,Md.audits,Md.webhooks,Md.apiTokens,Md.roles,Md.subscriptions;const Nd=["events","url"];function*$d(){yield ji(Gn.setSignUpState({loading:!0}));try{const e=yield Gi(ed.auth.getVendorConfig),{allowSignups:t,allowNotVerifiedUsersLogin:n}=e;yield ji(Gn.setSignUpState({loading:!1,allowSignUps:t,allowNotVerifiedUsersLogin:n,firstLoad:!1})),yield ji(Gn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*Fd(e){let{payload:{events:t,url:n}}=e,i=ii(e.payload,Nd);yield ji(Gn.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield qi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield Gi(ed.auth.signUpUser,i);if(!i.invitationToken){var o;const{email:e,name:a,companyName:r}=i;null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:Ud.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(Ko.setAccessToken(null==l?void 0:l.accessToken),Ko.setUser(l),!r&&l&&zy(l)){const t=yield Jy(l);yield ji(Gn.setState(t)),a(e.loginUrl)}else yield ji(Gn.setSignUpState({loading:!1,shouldActivate:r,stage:sn.SignUpSuccess})),yield ji(Gn.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield ji(Gn.loadTenants()))}catch(e){Ko.setAccessToken(null),Ko.setUser(null),yield ji(Gn.setSignUpState({loading:!1,error:e.message}))}yield ji(Gn.setSignUpState({loading:!1}))}function*xd(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield qi((e=>e.auth.signUpState));yield ji(Gn.resetSignUpState()),yield ji(Gn.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Vd(){yield Wo(Gn.signUpUser,Fd),yield Wo(Gn.resetSignUpStateSoft,xd)}const jd={setVendorState:(e,{payload:t})=>I({},e,t)},Wd={loadVendorPublicInfo:it("vendor/loadVendorPublicInfo")},Kd={loading:!1},{reducer:Gd,actions:Bd}=at({name:It,initialState:Kd,reducers:I({},jd)}),zd=I({},Bd,Wd);function*qd(){yield ji(zd.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield ed.vendor.getVendorPublicInfo();yield ji(zd.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield ji(zd.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Hd=["callback"],Jd=["callback"],Yd=["callback"],Qd=["callback"],Xd=["callback"],Zd=["callback"];function*ey(){yield ji(Gn.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getGlobalSecurityPolicy);yield ji(Gn.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield ji(Gn.loadSecurityPolicyMfa()),yield ji(Gn.loadSecurityPolicyVendorMfa()),yield ji(Gn.loadSecurityPolicyLockout()),yield ji(Gn.loadSecurityPolicyCaptcha()),yield ji(Gn.loadPublicAuthStrategiesPolicy())}function*ty(){yield ji(Gn.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getVendorConfig);yield ji(Gn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*ny(){yield ji(Gn.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getVendorPublicAuthStrategiesConfig);yield ji(Gn.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*iy(){yield ji(Gn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getMfaPolicy);yield ji(Gn.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*oy(){yield ji(Gn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getVendorMfaPolicy);yield ji(Gn.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*ay(e){let{payload:{callback:t}}=e,n=ii(e.payload,Hd);yield ji(Gn.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Gi(ed.auth.saveMfaPolicy,n);yield ji(Gn.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*ry(){yield ji(Gn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getLockoutPolicy);yield ji(Gn.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*ly(e){let{payload:{callback:t}}=e,n=ii(e.payload,Jd);yield ji(Gn.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Gi(ed.auth.saveLockoutPolicy,n);yield ji(Gn.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*sy(){yield ji(Gn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getCaptchaPolicy);yield ji(Gn.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*cy(){yield ji(Gn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getPasswordHistoryPolicy);yield ji(Gn.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*uy(e){let{payload:{callback:t}}=e,n=ii(e.payload,Yd);yield ji(Gn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Gi(ed.auth.savePasswordHistoryPolicy,n);yield ji(Gn.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*dy(){yield ji(Gn.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getPasswordConfigPolicy);yield ji(Gn.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*yy(){yield Wo(Gn.loadSecurityPolicy,ey),yield Vo(Gn.saveSecurityPolicyMfa,ay),yield Vo(Gn.loadSecurityPolicyMfa,iy),yield Vo(Gn.loadSecurityPolicyVendorMfa,oy),yield Vo(Gn.saveSecurityPolicyLockout,ly),yield Vo(Gn.loadSecurityPolicyLockout,ry),yield Vo(Gn.loadSecurityPolicyCaptcha,sy),yield Vo(Gn.saveSecurityPolicyPasswordHistory,uy),yield Vo(Gn.loadSecurityPolicyPasswordHistory,cy),yield Vo(Gn.loadVendorPasswordConfig,dy),yield Vo(Gn.loadPublicSecurityPolicy,ty),yield Vo(Gn.loadPublicAuthStrategiesPolicy,ny)}function*fy(){yield ji(Gn.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield ji(Gn.setSecurityPolicyPublicState({policy:gd,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*gy(){yield ji(Gn.setSecurityPolicyGlobalState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyGlobalState({policy:fd,loading:!1})),yield ji(Gn.loadSecurityPolicyMfa()),yield ji(Gn.loadSecurityPolicyVendorMfa()),yield ji(Gn.loadSecurityPolicyLockout()),yield ji(Gn.loadSecurityPolicyCaptcha())}function*py(){yield ji(Gn.setSecurityPolicyMfaState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyMfaState({policy:pd,loading:!1}))}function*Sy(){yield ji(Gn.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyVendorMfaState({policy:pd,loading:!1}))}function*vy(e){var t;let{payload:{callback:n}}=e,i=ii(e.payload,Qd);yield ji(Gn.setSecurityPolicyMfaState({saving:!0,error:null}));const o=I({},Sd,{id:null!=(t=i.id)?t:Sd.id,enforceMFAType:i.enforceMFAType});yield yt(),yield ji(Gn.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*hy(){yield ji(Gn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyLockoutState({policy:Sd,loading:!1}))}function*my(e){let{payload:{callback:t}}=e,n=ii(e.payload,Xd);yield ji(Gn.setSecurityPolicyLockoutState({saving:!0,error:null})),yield yt();const i=I({},n,Sd,{id:n.id?n.id:Sd.id});null==t||t(i),yield ji(Gn.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*by(){yield ji(Gn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyLockoutState({policy:Sd,loading:!1}))}function*Ay(){yield ji(Gn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyPasswordHistoryState({policy:vd,loading:!1}))}function*ky(e){let{payload:{callback:t}}=e,n=ii(e.payload,Zd);yield ji(Gn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield yt();const i=I({},n,vd,{id:n.id?n.id:vd.id});null==t||t(i),yield ji(Gn.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*Ty(){yield Wo(Gn.loadSecurityPolicy,gy),yield Vo(Gn.loadPublicSecurityPolicy,fy),yield Vo(Gn.saveSecurityPolicyMfa,vy),yield Vo(Gn.loadSecurityPolicyMfa,py),yield Vo(Gn.loadSecurityPolicyVendorMfa,Sy),yield Vo(Gn.saveSecurityPolicyLockout,my),yield Vo(Gn.loadSecurityPolicyLockout,hy),yield Vo(Gn.loadSecurityPolicyCaptcha,by),yield Vo(Gn.saveSecurityPolicyPasswordHistory,ky),yield Vo(Gn.loadSecurityPolicyPasswordHistory,Ay)}const Py=["callback"],Iy=["callback"],Ly=["callback"],Oy=["callback"],Ey=["callback","events"],wy=["callback"],Cy=["callback"],Dy=["callback"],Ry=["callback"],_y=["callback"],Uy=["callback"],My=["callback"],Ny=["callback"],$y=["callback"],Fy=["callback","deviceId"],xy=["callback","deviceId"],Vy=["callback","deviceId"],jy=["callback","deviceId"],Wy={[rr.Code]:vt.loginWithOtc,[rr.EmailAndPassword]:vt.loginWithPassword,[rr.MagicLink]:vt.magicLinkPreLoginSuccess,[rr.SmsCode]:vt.loginWithSmsOtc};function*Ky(){var e;const t=Ko.onRedirectTo,{routes:n,includeQueryParam:i}=yield qi((e=>e.auth)),{loginUrl:o,logoutUrl:a,socialLoginCallbackUrl:r,activateUrl:l}=n;let{authenticatedUrl:s}=n;const c=window.localStorage.getItem(bt);c&&![o,a,r,l].includes(c)&&(s=c),window.localStorage.removeItem(bt),yield Hi(200),ji(Gn.resetLoginState());const u=new URL(null==(e=window)?void 0:e.location.href);let d=s;var y;u.searchParams.get("redirectUrl")?d=null!=(y=u.searchParams.get("redirectUrl"))?y:s:i&&(d+=window.location.search),t(d,{refresh:d.startsWith("http")})}function*Gy(){let e;try{var t;const n=yield Gi(ed.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield ji(Gn.setState({ssoACS:e}))}function*By(){try{const{isActive:e}=yield Gi(ed.auth.getSSOPublicConfiguration);yield ji(Gn.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const zy=e=>e.mfaRequired&&e.mfaToken?(Ko.setAccessToken(null),Ko.setUser(null),!0):(Ko.setAccessToken(e.accessToken),Ko.setUser(e),!1),qy=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return Qt.authenticatorApp;if(t)return Qt.smsVerifyCode}return Qt.verify},Hy=e=>{if(1===e.length){const[t]=e;if(t===Du.AuthenticatorApp)return Qt.authenticatorApp;if(t===Du.SMS)return Qt.smsSetPhoneNumber}return Qt.verify};function*Jy(e){let t=vt.loginWithTwoFactor,n={};const{loginState:i}=yield qi((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield Gi(ed.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:qy(e.mfaDevices)}:(n={step:Hy(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=vt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:ht.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:I({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a})}}function*Yy(){const{hostedLoginBox:e}=yield qi((e=>e.auth));e?yield Gi(Qy):yield Gi(Xy)}function*Qy(){const{user:e}=yield qi((e=>e.auth));if(null==e||!e.refreshToken)return Ko.setAccessToken(null),Ko.setUser(null),void(yield ji(Gn.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Gi(ed.auth.exchangeOAuthTokens,t);yield ji(Gn.setState({user:n,isAuthenticated:!0})),yield ji(Gn.loadTenants())}catch(e){Ko.setAccessToken(null),Ko.setUser(null),yield ji(Gn.setState({user:null,isAuthenticated:!1}))}}function*Xy(){try{const n=Ko.onRedirectTo,{routes:i,loginState:o}=yield qi((e=>e.auth)),{user:a,tenants:r}=yield Gi(ed.auth.refreshTokenV2);if(zy(a)){const e=yield Jy(a);yield ji(Gn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}else{var e,t;a.id&&localStorage.setItem("userId",a.id);const l=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,s=l&&"true"!==localStorage.getItem(`${a.id}-${l}`)&&!window.location.pathname.endsWith(i.logoutUrl);yield ji(Gn.setTenantsState({tenants:r,loading:!1})),yield ji(Gn.setState({user:a,isAuthenticated:!0,loginState:I({},o,{quickLoginToRegister:l,flow:s?ht.RegisterQuickLogin:ht.Login})}));const c=new URL(null==(t=window)?void 0:t.location.href).searchParams.get("invitationToken"),u=[i.socialLoginCallbackUrl,i.oidcRedirectUrl,i.samlCallbackUrl];c||u.push(i.loginUrl,i.signUpUrl),s?n(i.loginUrl):u.some((e=>e&&window.location.pathname.endsWith(e)))&&(o.isNewUser&&i.signUpSuccessUrl&&i.socialLoginCallbackUrl===window.location.pathname?n(i.signUpSuccessUrl,{refresh:i.signUpSuccessUrl.startsWith("http")}):yield Ky())}}catch(e){Ko.setAccessToken(null),Ko.setUser(null),yield ji(Gn.setState({user:void 0,isAuthenticated:!1}))}}function*Zy({payload:{callback:e}}){try{const{ip:t}=yield Gi(ed.metadata.getCurrentUserIpMetadata);yield ji(Gn.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*ef({payload:e}){const t=[];e&&(yield ji(Gn.setState({isLoading:!0})),yield ji(Gn.loadSocialLoginsConfigurationV2()),t.push(Gi($d)),t.push(Gi(ny)),t.push(Gi(By)),t.push(Gi(qd)),t.push(Gi(Gy))),t.push(Gi(Yy)),yield Wi(t),yield ji(Gn.setState({isLoading:!1}))}function*tf({accessToken:e,user:t}){if(!e)return void(yield ji(Gn.setState({user:void 0,isAuthenticated:!1})));const n=Ko.onRedirectTo,{routes:i}=yield qi((e=>e.auth));if(zy(t)){const e=yield Jy(t);yield ji(Gn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*nf({payload:e}){const t=[];yield ji(Gn.loadSocialLoginsConfigurationV2()),t.push(Gi($d)),t.push(Gi(By)),t.push(Gi(qd)),t.push(Gi(Gy)),t.push(Gi(tf,e)),yield Wi(t)}function*of({payload:e}){const{disableSilentRefresh:t}=yield qi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield Gi(ed.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield ji(Gn.setState({user:e,isAuthenticated:!0})),yield ji(Gn.loadTenants()),yield ji(Gn.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield qi((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if((e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;let e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield ji(Gn.setState({isLoading:!0}));const a=rd(),r=rd(),l=yield Gi(ad,r);localStorage.setItem(At,r);const s=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${zo(n,"/oauth/authorize")}/oauth/authorize`,u=I({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:s,code_challenge:l,code_challenge_method:"S256",nonce:a},e);i(`${c}?${new URLSearchParams(u).toString()}`,{refresh:!0})}(e)}}function*af({payload:e}){const t=localStorage.getItem(At)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield qi((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy}))),o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`,a={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield Gi(ed.auth.exchangeOAuthTokens,a);yield ji(Gn.setState({user:e,isAuthenticated:!0})),yield ji(Gn.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Ky()}}function*rf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Py);try{yield ji(Gn.setLoginState({loading:!0}));const e=yield Gi(ed.auth.changePhoneNumberWithVerification,n);yield ji(Gn.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:vt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1}))}}function*lf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Iy);try{yield ji(Gn.setLoginState({loading:!0})),yield Gi(ed.auth.verifyChangePhoneNumber,n),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1}))}}function*sf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ly);try{yield ji(Gn.setLoginState({loading:!0}));const e=yield Gi(ed.auth.passwordlessPreLogin,I({},n,{type:rr.SmsCode}));yield ji(Gn.setLoginState({step:vt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*cf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Oy);try{const{onRedirectTo:e,routes:i}=yield qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ji(Gn.setLoginState({loading:!0}));const o=yield Gi(ed.auth.passwordlessPreLogin,n),a=Wy[n.type];if(a===vt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield ji(Gn.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:jt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield ji(Gn.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*uf(e){let{payload:{callback:t,events:n}}=e,i=ii(e.payload,Ey);try{yield ji(Gn.setLoginState({loading:!0}));const e=yield Gi(ed.auth.passwordlessPostLogin,i),a=Ko.onRedirectTo,{routes:r}=yield qi((e=>e.auth));if(zy(e)){const t=yield Jy(e);yield ji(Gn.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield qi((e=>e.auth)),l=yield Gi(ed.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:l.email,origin:_d.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield ji(Gn.setState({user:l,isAuthenticated:!0})),yield ji(Gn.setLoginState({error:void 0})),yield ji(Gn.loadTenants()),i.flow===ht.Login?yield Ky():a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield ji(Gn.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*df({payload:e}){try{yield ji(Gn.setLoginState({loading:!0}));const{name:t}=yield Gi(ed.auth.verifyInviteToken,e);yield ji(Gn.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield ji(Gn.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*yf({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield ji(Gn.setLoginState({loading:!0}));try{const o=yield qi((({auth:{onRedirectTo:e}})=>e));let{address:a,idpType:r}=yield Gi(ed.auth.preLoginV2,{email:e});if(a){if(r===id.Oidc&&!a.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield qi((({auth:{routes:e}})=>({routes:e})));a+=`&redirect_uri=${window.location.origin}${e}`}yield ji(Gn.setLoginState({step:vt.redirectToSSO,loading:!1,ssoRedirectUrl:a})),setTimeout((()=>{o(a,{refresh:!0})}),2e3)}else yield ff({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield ff({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*ff(e){let{callback:t}=e,n=ii(e,wy);const i=yield qi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield ji(Gn.setLoginState({step:vt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===rr.EmailAndPassword?(yield ji(Gn.setLoginState({step:vt.loginWithPassword,loading:!1})),null==t||t()):[rr.MagicLink,rr.Code,rr.SmsCode].includes(null==i?void 0:i.authStrategy)?yield ji(Gn.passwordlessPreLogin(I({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield ji(Gn.setLoginState({step:vt.loginWithPassword,loading:!1})),null==t||t())}function*gf({payload:{callback:e}}){try{yield ji(Gn.setLoginState({loading:!0}));const{options:t}=yield Gi(ed.auth.webAuthnCreateNewDeviceSession);t.user.id=pt(t.user.id),t.challenge=pt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield ji(Gn.setLoginState({error:t.message})),null==e||e(null)}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*pf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Cy);try{yield ji(Gn.setLoginState({loading:!0}));const e=St(n.publicKey);yield Gi(ed.auth.verifyNewDeviceSession,{id:e.id,response:e.response}),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message})),null==t||t(null)}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*Sf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Dy);try{var i;yield ji(Gn.setLoginState({loading:!0}));const{options:e}=yield Gi(ed.auth.webAuthnPreLogin,n);e.challenge=pt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>I({},e,{id:pt(e.id)}))),yield ji(Gn.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield ji(Gn.setLoginState({error:e.message})),null==t||t(null)}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*vf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ry);try{var i;yield ji(Gn.setLoginState({loading:!0}));const e=St(n.publicKey),o=yield Gi(ed.auth.webAuthnPostLogin,I({},e,{response:I({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(zy(o)){const e=Ko.onRedirectTo,{routes:t}=yield qi((e=>e.auth)),n=yield Jy(o);yield ji(Gn.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield Gi(ed.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield ji(Gn.loadTenants()),yield ji(Gn.setState({user:e,isAuthenticated:!0})),yield ji(Gn.setLoginState({error:void 0})),yield Ky(),null==t||t(!0)}}catch(e){yield ji(Gn.setLoginState({error:e.message})),null==t||t(null)}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*hf({payload:e}){const{onRedirectTo:t,routes:n}=yield qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ji(Gn.setLoginState({loading:!0}));try{const t=yield Gi(ed.auth.postLogin,e);Ko.setAccessToken(t.accessToken),Ko.setUser(t),yield ji(Gn.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Ky()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield ji(Gn.setLoginState({step:vt.loginWithSSOFailed,loading:!1}))}}function*mf({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield ji(Gn.setLoginState({loading:!0}));try{const a=yield Gi(ed.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});Ko.setAccessToken(a.accessToken),Ko.setUser(a);const r=Ko.onRedirectTo,{routes:l}=yield qi((e=>e.auth));if(zy(a)){const e=yield Jy(a);yield ji(Gn.setState(e)),r(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield qi((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield ji(Gn.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===ht.Login?vt.success:t.step,tenants:[],tenantsLoading:!0}})),yield ji(Gn.loadTenants()),n&&t.flow===ht.Login&&(yield Ky())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){Ko.setAccessToken(null),Ko.setUser(null),yield ji(Gn.setLoginState({email:e,error:t.message,loading:!1}))}}function*bf({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield ji(Gn.setLoginState({loading:!0}));try{const o=yield Gi(ed.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield qi((e=>e.auth)),r=a.flow===ht.Login?vt.success:a.step;yield ji(Gn.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:o,isAuthenticated:!0})),o.id&&localStorage.setItem("userId",o.id),yield ji(Gn.loadTenants()),yield ji(Gn.setLoginState({error:void 0,loading:!1})),a.flow===ht.Login&&(yield Ky()),null==i||i(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*Af({payload:e}){yield ji(Gn.setLoginState({loading:!0}));try{yield Gi(ed.auth.recoverMfaToken,e),yield ji(Gn.setLoginState({loading:!1,error:void 0,step:vt.preLogin})),yield ji(Gn.setState({user:void 0,isAuthenticated:!1}))}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1}))}}function*kf({payload:e}){const{hostedLoginBox:t}=yield qi((e=>e.auth));yield ji(Gn.setState({isLoading:!0}));try{t?yield Gi(ed.auth.OAuthLogout):yield Gi(ed.auth.logout)}catch{}yield ji(Gn.resetState()),yield ji(Gn.requestAuthorize(!0)),null==e||e()}function*Tf({payload:e}){var t;try{yield Gi(ed.auth.logout)}catch{}setTimeout((()=>{var t;return null==e||null==(t=e.callback)?void 0:t.call(e,!0)}),null!=(t=null==e?void 0:e.callbackTimeout)?t:500)}function*Pf({user:e,tenants:t}){const n={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield ji(Gn.setMfaState(n)),yield ji(Gn.setUser(e)),yield ji(Gn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*If({user:e,tenants:t}){const{loginState:n}=yield qi((e=>e.auth));yield ji(Gn.setUser(e)),yield ji(Gn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id),n.flow===ht.Login&&(yield Ky()),yield ji(Gn.setState({isAuthenticated:!0}))}function*Lf(e){let{payload:{callback:t}}=e,n=ii(e.payload,_y);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.preEnrollMFASMSForLogin,n);yield ji(Gn.setMfaState({otcToken:e.otcToken,step:Qt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Of(e){let{payload:{callback:t}}=e,n=ii(e.payload,Uy);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.enrollMFASMSForLogin,n),i=yield Gi(ed.auth.generateLoginResponseV2,e);yield Pf(i),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Ef(e){let{payload:{callback:t}}=e,n=ii(e.payload,My);yield ji(Gn.setLoginState({loading:!0}));try{var i;const e=yield Gi(ed.auth.preEnrollMFAWebAuthnForLogin,n),o=I({},e.options,{challenge:pt(e.options.challenge),user:I({},e.options.user,{id:pt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>I({},e,{id:pt(e.id)})))});yield ji(Gn.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*wf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ny);yield ji(Gn.setLoginState({loading:!0}));try{const e=St(n.publicKey),i=yield Gi(ed.auth.enrollMFAWebAuthnForLogin,I({},n,{options:e})),o=yield Gi(ed.auth.generateLoginResponseV2,i);yield Pf(o),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Cf(e){let{payload:{callback:t}}=e,n=ii(e.payload,$y);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield Gi(ed.auth.generateLoginResponseV2,e);yield Pf(i),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Df(e){let{payload:{callback:t,deviceId:n}}=e,i=ii(e.payload,Fy);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.preVerifyMFASMSForLogin,n,i);yield ji(Gn.setMfaState({otcToken:e.otcToken,step:Qt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Rf(e){let{payload:{callback:t,deviceId:n}}=e,i=ii(e.payload,xy);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.verifyMFASMSForLogin,n,i),o=yield Gi(ed.auth.generateLoginResponseV2,e);yield If(o),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*_f(e){let{payload:{callback:t,deviceId:n}}=e,i=ii(e.payload,Vy);yield ji(Gn.setLoginState({loading:!0}));try{var o;const e=yield Gi(ed.auth.preVerifyMFAWebAuthnForLogin,n,i),a=I({},e.options,{challenge:pt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>I({},e,{id:pt(e.id)})))});yield ji(Gn.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Uf(e){let{payload:{callback:t,deviceId:n}}=e,i=ii(e.payload,jy);yield ji(Gn.setLoginState({loading:!0}));try{const e=St(i.publicKey),o=yield Gi(ed.auth.verifyMFAWebAuthnForLogin,n,I({},i,{options:e})),a=yield Gi(ed.auth.generateLoginResponseV2,o);yield If(a),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Mf(){yield Wo(Gn.requestAuthorize,ef),yield Wo(Gn.requestAuthorizeSSR,nf),yield Wo(Gn.requestHostedLoginAuthorize,of),yield Wo(Gn.handleHostedLoginCallback,af),yield Wo(Gn.preLogin,yf),yield Wo(Gn.postLogin,hf),yield Wo(Gn.login,mf),yield Wo(Gn.logout,kf),yield Wo(Gn.silentLogout,Tf),yield Wo(Gn.loginWithMfa,bf),yield Wo(Gn.recoverMfa,Af),yield Wo(Gn.quickSmsPasswordlessPreLogin,sf),yield Wo(Gn.changePhoneNumberWithVerification,rf),yield Wo(Gn.verifyChangePhoneNumber,lf),yield Wo(Gn.passwordlessPreLogin,cf),yield Wo(Gn.passwordlessPostLogin,uf),yield Wo(Gn.verifyInviteToken,df),yield Wo(Gn.webAuthnPrelogin,Sf),yield Wo(Gn.webAuthnPostLogin,vf),yield Wo(Gn.webAuthnCreateNewDeviceSession,gf),yield Wo(Gn.webAuthnVerifyNewDeviceSession,pf),yield Wo(Gn.afterAuthNavigation,Ky),yield Wo(Gn.getUserIP,Zy),yield Wo(Gn.preEnrollMFASMSForLogin,Lf),yield Wo(Gn.enrollMFASMSForLogin,Of),yield Wo(Gn.preEnrollMFAWebAuthnForLogin,Ef),yield Wo(Gn.enrollMFAWebAuthnForLogin,wf),yield Wo(Gn.enrollMFAAuthenticatorAppForLogin,Cf),yield Wo(Gn.preVerifyMFASMSForLogin,Df),yield Wo(Gn.verifyMFASMSForLogin,Rf),yield Wo(Gn.preVerifyMFAWebAuthnForLogin,_f),yield Wo(Gn.verifyMFAWebAuthnForLogin,Uf)}function*Nf({payload:e}){e&&(yield ji(Gn.setState({isLoading:!0})));const t=dd;yield ji(Gn.loadTenants()),yield ji(Gn.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*$f({payload:{callback:e}}){try{const{ip:t}=Rd[0];yield ji(Gn.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Ff(){yield Wo(Gn.requestAuthorize,Nf),yield Wo(Gn.afterAuthNavigation,Ky),yield Wo(Gn.getUserIP,$f)}const xf=["callback","samlVendor"],Vf=["callback","samlVendor"];function*jf(){try{var e,t;yield ji(Gn.setSSOState({loading:!0}));const n=yield Gi(ed.auth.getSamlConfiguration),i=yield Gi(ed.auth.getOidcConfiguration),o=yield Gi(ed.metadata.getSamlMetadata);n.acsUrl=null==o||null==(e=o.configuration)?void 0:e.acsUrl,n.spEntityId=null==o||null==(t=o.configuration)?void 0:t.spEntityId,n.isSamlActive=null==o?void 0:o.isActive,yield ji(Gn.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield ji(Gn.setSSOState({error:e.message,loading:!1}))}}function*Wf({payload:e}){const t=yield qi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield ji(Gn.setSSOState({error:void 0,[n]:!0}));try{const i=yield ld(e[0]),o=yield Gi(ed.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield ji(Gn.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield ji(Gn.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Kf({payload:e}){const{configFile:t,callback:n}=e,i=yield qi((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield ji(Gn.setSSOState({error:void 0,[o]:!0}));try{const e=yield ld(t),a=yield Gi(ed.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield ji(Gn.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield ji(Gn.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*Gf({payload:e}){const{callback:t,samlVendor:n}=e,i=ii(e,xf),o=yield qi((e=>e.auth.ssoState.samlConfiguration)),a=I({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield ji(Gn.setSSOState({samlConfiguration:I({},o,a)})));if(yield ji(Gn.setSSOState({error:void 0,[r]:!0})),e.type===id.Saml){var l,s;const e=yield Gi(ed.metadata.getSamlMetadata);a.acsUrl=null==e||null==(l=e.configuration)?void 0:l.acsUrl,a.spEntityId=null==e||null==(s=e.configuration)?void 0:s.spEntityId}const i=od(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==o?void 0:o.domain)!==(null==i?void 0:i.domain)&&(i.ssoEndpoint="",i.publicCertificate="",i.signRequest=!1),i.type=null==n?void 0:n.toLowerCase();const c=yield Gi(ed.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield ji(Gn.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*Bf({payload:{callback:e}={}}){const t=yield qi((e=>e.auth.ssoState.samlConfiguration));try{yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield Gi(ed.auth.validateSamlDomain),yield ji(Gn.setSSOState({samlConfiguration:I({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield ji(Gn.setSSOState({samlConfiguration:I({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*zf(){try{const e=yield Gi(ed.auth.getSamlRoles),t=yield Gi(ed.auth.getSamlRolesGroups);yield ji(Gn.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield ji(Gn.setSSOState({error:e.message}))}}function*qf({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield Gi(ed.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Wi(e.map((e=>Gi(ed.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield ji(Gn.setSSOState({error:e.message}))}}(n)),yield zf(),yield ji(Gn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ji(Gn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Hf({payload:{callback:e,id:t}}){try{yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield Gi(ed.auth.deleteSamlGroup,{id:t}),yield zf(),yield ji(Gn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ji(Gn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Jf({payload:{group:e,roleIds:t,callback:n}}){try{yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield Gi(ed.auth.createSamlGroup,{group:e,roleIds:t}),yield zf(),yield ji(Gn.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield ji(Gn.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*Yf({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield ji(Gn.setSSOState({loading:!0})),yield Gi(ed.auth.oidcPostLoginV2,t),yield Gi(Yy),yield ji(Gn.setSSOState({loading:!1}))}catch(e){var n;yield ji(Gn.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*Qf(){yield Vo(Gn.loadSSOConfigurations,jf),yield Vo(Gn.saveSSOConfigurations,Gf),yield Vo(Gn.saveSSOConfigurationsFile,Wf),yield Vo(Gn.saveSSOConfigurationsFileWithCallback,Kf),yield Vo(Gn.validateSSODomain,Bf),yield Vo(Gn.loadSSOAuthorizationRoles,zf),yield Vo(Gn.updateSSOAuthorizationRoles,qf),yield Vo(Gn.deleteSamlGroup,Hf),yield Vo(Gn.createSamlGroup,Jf),yield Vo(Gn.oidcPostlogin,Yf)}function*Xf(){yield ji(Gn.setSSOState({loading:!0})),yield yt(),yield ji(Gn.setSSOState({samlConfiguration:hd,loading:!1,firstLoad:!1}))}function*Zf({payload:e}){const t="saving";yield ji(Gn.setSSOState({error:void 0,[t]:!0}));const n=I({},yield qi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield ji(Gn.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*eg({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=ii(e,Vf),r=Ad.samlConfiguration,l=I({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield ji(Gn.setSSOState({samlConfiguration:I({},r,l)})));yield ji(Gn.setSSOState({error:void 0,[s]:!0})),yield yt(),l.acsUrl=null==md||null==(t=md.configuration)?void 0:t.acsUrl,l.spEntityId=null==md||null==(n=md.configuration)?void 0:n.spEntityId;const c=od(l,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==o?void 0:o.toLowerCase(),yield yt(),yield ji(Gn.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==i||i(!0)}function*tg({payload:{callback:e}={}}){const t=Ad.samlConfiguration;yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield yt(),yield ji(Gn.setSSOState({samlConfiguration:I({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*ng(){yield yt(),yield ji(Gn.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*ig({payload:{callback:e,authorizationRoles:t}}){yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield yt(),yield ji(Gn.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*og(){yield Vo(Gn.loadSSOConfigurations,Xf),yield Vo(Gn.saveSSOConfigurations,eg),yield Vo(Gn.saveSSOConfigurationsFile,Zf),yield Vo(Gn.validateSSODomain,tg),yield Vo(Gn.loadSSOAuthorizationRoles,ng),yield Vo(Gn.updateSSOAuthorizationRoles,ig)}const ag=["callback"],rg=["callback","ssoConfigId"],lg=["callback","ssoConfigId"];function*sg(){try{return yield Gi(ed.auth.getOidcConfiguration)}catch(e){return null}}function*cg(){try{return yield Gi(ed.metadata.getSamlMetadata)}catch(e){return null}}function*ug(){try{yield ji(Gn.setSSOLoader({key:nd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Wi([Gi(sg),Gi(cg)]),n=yield Gi(ed.auth.getSSOConfigurations);yield ji(Gn.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield ji(Gn.setSSOError({key:nd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield ji(Gn.setSSOLoader({key:nd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*dg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=ii(e,ag),i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield Gi(ed.auth.createSSOConfiguration,I({},n,{enabled:null!=(o=n.enabled)&&o}));yield ji(Gn.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*yg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ld(t),o=yield Gi(ed.auth.createSSOConfigurationByMetadata,{metadata:e});yield ji(Gn.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*fg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=ii(e,rg),o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Gi(ed.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield ji(Gn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ji(Gn.setSSOError({key:nd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*gg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ld(i),a=yield Gi(ed.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield ji(Gn.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield ji(Gn.setSSOError({key:nd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*pg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Gi(ed.auth.deleteSSOConfiguration,t),yield ji(Gn.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Sg({payload:e}){const{callback:t,ssoConfigId:n}=e,i=ii(e,lg);yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_DOMAIN,value:!0}));const o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Gi(ed.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?I({},t,{domains:[...t.domains,e]}):t));yield ji(Gn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_DOMAIN,value:!1}))}}function*vg({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield ji(Gn.setSSOLoader({key:nd.DELETE_SSO_DOMAIN,value:!0}));const o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Gi(ed.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?I({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield ji(Gn.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.DELETE_SSO_DOMAIN,value:!1}))}}function*hg({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield ji(Gn.setSSOLoader({key:nd.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Gi(ed.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?I({},e,{domains:e.domains.map((e=>e.id===n?I({},e,{validated:!0}):e))}):e));yield ji(Gn.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*mg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Gi(ed.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?I({},e,{roleIds:n}):e));yield ji(Gn.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield ji(Gn.setSSOError({key:nd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*bg({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_GROUPS,value:!0}));const o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Wi(t.map((e=>Gi(ed.auth.deleteSSOGroup,n,e)))),yield Wi(e.map((e=>Gi(ed.auth.createSSOGroup,n,e))));const a=yield Gi(ed.auth.getSSOGroups,n),r=o.map((e=>e.id===n?I({},e,{groups:a}):e));yield ji(Gn.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_GROUPS,value:!1}))}}function*Ag({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Wi(t.map((t=>Gi(ed.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_GROUPS,value:!1}))}}function*kg(){yield Vo(Gn.loadSSOConfigurationsV2,ug),yield Vo(Gn.saveSSOConfigurationV2,dg),yield Vo(Gn.saveSSODomain,Sg),yield Vo(Gn.deleteSSODomain,vg),yield Vo(Gn.validateSSODomainV2,hg),yield Vo(Gn.updateSSOConfiguration,fg),yield Vo(Gn.deleteSSOConfiguration,pg),yield Vo(Gn.setSSOGroups,bg),yield Vo(Gn.updateSSOGroups,Ag),yield Vo(Gn.setSSODefaultRoles,mg),yield Vo(Gn.saveSSOConfigurationByMetadata,yg),yield Vo(Gn.updateSSOConfigurationByMetadata,gg)}const Tg=["callback","profilePictureUrl"],Pg=["callback","profilePictureUrl"];function*Ig(){yield ji(Gn.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return Gi.apply(void 0,[xo,e,t,n].concat(o))}(3,2e3,ed.teams.getProfile),t=yield qi((e=>e.auth.user));Gn.setUser(I({},t,e)),yield ji(Gn.setProfileState({profile:e,loading:!1}))}catch(e){yield ji(Gn.setProfileState({loading:!1,error:e.message}))}}function*Lg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=ii(e.payload,Tg);yield ji(Gn.setProfileState({saving:!0,error:null}));try{const e=yield qi((e=>e.auth.profileState.profile));let o=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const i=`image/${n[1]}`,o=function(e,t){const n=atob(e),i=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),o=new Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);i.push(new Uint8Array(o))}return new Blob(i,{type:t})}(n[2],i),a=new FormData;return a.append(t,new File([o],t,{type:i})),a}(n,"image");if(e){o=yield Gi(ed.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=I({},e,i,{profilePictureUrl:o}),r=yield Gi(ed.teams.updateProfile,a),l=yield qi((e=>e.auth.user));yield ji(Gn.setUser(I({},l,r))),yield ji(Gn.setProfileState({profile:r,saving:!1})),null==t||t(a)}catch(e){yield ji(Gn.setProfileState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Og({payload:e}){yield ji(Gn.setProfileState({loading:!0}));try{var t;yield Gi(ed.teams.changePassword,e),yield ji(Gn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Eg(){yield Wo(Gn.loadProfile,Ig),yield Vo(Gn.saveProfile,Lg),yield Vo(Gn.changePassword,Og)}function*wg(){yield ji(Gn.setProfileState({loading:!0})),yield yt(),yield ji(Gn.setUser(I({},dd,ud))),yield ji(Gn.setProfileState({loading:!1,profile:ud}))}function*Cg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=ii(e.payload,Pg);yield ji(Gn.setProfileState({saving:!0,error:null}));const o=yd;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=I({},o.profile,i,{profilePictureUrl:a}),l=dd;yield yt(),yield ji(Gn.setUser(I({},l,r))),yield ji(Gn.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Dg({payload:e}){var t;yield ji(Gn.setProfileState({loading:!0})),yield yt(),yield ji(Gn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Rg(){yield Wo(Gn.loadProfile,wg),yield Vo(Gn.saveProfile,Cg),yield Vo(Gn.changePassword,Dg)}const _g=["callback"],Ug=["callback"],Mg=["callback"],Ng=["deviceId","callback"],$g=["deviceId","callback"],Fg=["callback"],xg=["deviceId"],Vg=["deviceId"],jg=["callback"],Wg=["deviceId"],Kg=["callback"];function*Gg(e){const{step:t}=yield qi((e=>e.auth.mfaState));return{step:e.recoveryCode?Qt.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Bg(){yield ji(Gn.setMfaState({saving:!0}));try{const{qrCode:e}=yield Gi(ed.auth.enrollMfa);yield ji(Gn.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message}))}}function*zg(e){let{payload:{callback:t}}=e,n=ii(e.payload,_g);yield ji(Gn.setMfaState({saving:!0}));try{const e=yield qi((e=>e.auth.user)),i=yield Gi(ed.auth.verifyMfa,n),o=yield Gi(ed.auth.getMFADevices),a=yield Gg(i);yield ji(Gn.setMfaState(I({},a,{mfaDevices:o}))),yield ji(Gn.setUser(I({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*qg(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ug);yield ji(Gn.setMfaState({loading:!0}));try{const e=yield Gi(ed.auth.loginWithMfa,n),i={step:Qt.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield ji(Gn.setMfaState(i)),yield ji(Gn.setState({user:e})),yield ji(Gn.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield ji(Gn.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Hg({payload:e}){yield ji(Gn.setMfaState({saving:!0}));try{var t;yield Gi(ed.auth.disableMfa,e);const n=yield Gi(ed.auth.getMFADevices);yield ji(Gn.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*Jg({payload:e}){yield ji(Gn.setMfaState({saving:!0}));try{var t,n;const i=yield Gi(ed.auth.preEnrollMFAWebAuthn),o=I({},i.options,{challenge:pt(i.options.challenge),user:I({},i.options.user,{id:pt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>I({},e,{id:pt(e.id)})))});yield ji(Gn.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield ji(Gn.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*Yg(e){let{payload:{callback:t}}=e,n=ii(e.payload,Mg);yield ji(Gn.setMfaState({saving:!0}));try{const e=St(n.publicKey),i=yield Gi(ed.auth.enrollMFAWebAuthn,I({},n,{options:e})),o=yield Gi(ed.auth.getMFADevices),a=yield Gg(i);yield ji(Gn.setMfaState(I({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Qg(e){let{payload:{deviceId:t,callback:n}}=e;ii(e.payload,Ng),yield ji(Gn.setMfaState({saving:!0}));try{var i;const e=yield Gi(ed.auth.preDisableMFAWebAuthn,t),o=I({},e.options,{challenge:pt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>I({},e,{id:pt(e.id)})))});yield ji(Gn.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*Xg(e){let{payload:{deviceId:t,callback:n}}=e,i=ii(e.payload,$g);yield ji(Gn.setMfaState({saving:!0}));try{const e=St(i.publicKey);yield Gi(ed.auth.disableMFAWebAuthn,t,I({},i,{options:e}));const o=yield Gi(ed.auth.getMFADevices);yield ji(Gn.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*Zg({payload:e}){yield ji(Gn.setMfaState({saving:!0}));try{var t;const n=yield Gi(ed.auth.preEnrollMFASMS,e);yield ji(Gn.setMfaState({saving:!1,error:void 0,otcToken:n.otcToken,phoneNumber:n.phoneNumber})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*ep(e){let{payload:{callback:t}}=e,n=ii(e.payload,Fg);yield ji(Gn.setMfaState({saving:!0}));try{const e=yield Gi(ed.auth.enrollMFASMS,n),i=yield Gi(ed.auth.getMFADevices),o=yield Gg(e);yield ji(Gn.setMfaState(I({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*tp(e){let{payload:{deviceId:t}}=e,n=ii(e.payload,xg);yield ji(Gn.setMfaState({saving:!0}));try{var i;const e=yield Gi(ed.auth.preDisableMFASMS,t);yield ji(Gn.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*np(e){let{payload:{deviceId:t}}=e,n=ii(e.payload,Vg);yield ji(Gn.setMfaState({saving:!0}));try{var i;yield Gi(ed.auth.disableMFASMS,t,n);const e=yield Gi(ed.auth.getMFADevices);yield ji(Gn.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*ip(){yield ji(Gn.setMfaState({loading:!0}));try{yield qi((e=>e.auth.user));const e=yield Gi(ed.auth.getMFADevices);yield ji(Gn.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield ji(Gn.setMfaState({loading:!1,error:e.message}))}}function*op(){yield ji(Gn.setMfaState({loading:!0}));try{const e=(yield Gi(ed.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield ji(Gn.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield ji(Gn.setMfaState({loading:!1,error:e.message}))}}function*ap(){yield Vo(Gn.enrollMfa,Bg),yield Vo(Gn.getMFADevices,ip),yield Vo(Gn.getMFAStrategies,op),yield Vo(Gn.verifyMfa,zg),yield Vo(Gn.disableMfa,Hg),yield Vo(Gn.verifyMfaAfterForce,qg),yield Vo(Gn.preDisableMfaSms,tp),yield Vo(Gn.disableMfaSms,np),yield Vo(Gn.preEnrollMfaSms,Zg),yield Vo(Gn.enrollMfaSms,ep),yield Vo(Gn.preEnrollMfaWebAuthn,Jg),yield Vo(Gn.enrollMfaWebAuthn,Yg),yield Vo(Gn.preDisableMfaWebAuthn,Qg),yield Vo(Gn.disableMfaWebAuthn,Xg)}function*rp(){yield ji(Gn.setMfaState({saving:!0})),yield ji(Gn.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*lp({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield qi((e=>e.auth.mfaState));yield ji(Gn.setMfaState({saving:!0})),yield yt();const n={token:"token",recoveryCode:"recoveryCode"},i={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:I({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield ji(Gn.setMfaState(i)),yield ji(Gn.setUser(I({},dd,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*sp(e){let{payload:{callback:t}}=e,n=ii(e.payload,jg);yield ji(Gn.setMfaState({loading:!0})),yield yt();const i=I({},n,{recoveryCode:"recoveryCode"}),o={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield ji(Gn.setMfaState(o)),yield yt(),yield ji(Gn.setUser(I({},dd,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*cp({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield qi((e=>e.auth.mfaState));yield ji(Gn.setMfaState({saving:!0})),yield yt(),yield ji(Gn.setMfaState({saving:!1,error:void 0,mfaDevices:I({},n,{authenticators:[]})})),yield ji(Gn.setUser(I({},dd))),null==(t=e.callback)||t.call(e,!0)}function*up(e){let{}=e,t=ii(e.payload,Wg);yield ji(Gn.setMfaState({saving:!0}));try{var n;yield ji(Gn.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*dp({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield qi((e=>e.auth.mfaState));yield ji(Gn.setMfaState({saving:!0})),yield yt(),yield ji(Gn.setMfaState({loading:!1,error:void 0,mfaDevices:I({},n,{phones:[]})})),yield ji(Gn.setUser(I({},dd))),null==(t=e.callback)||t.call(e,!0)}function*yp({payload:e}){var t;yield ji(Gn.setMfaState({saving:!0})),yield yt(),yield ji(Gn.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*fp(e){let{payload:{callback:t}}=e;ii(e.payload,Kg);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield qi((e=>e.auth.mfaState));yield ji(Gn.setMfaState({saving:!0})),yield yt();const i={token:"token",recoveryCode:"recoveryCode"},o={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:I({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield ji(Gn.setMfaState(o)),yield ji(Gn.setUser(I({},dd,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*gp(){yield Vo(Gn.enrollMfa,rp),yield Vo(Gn.verifyMfa,lp),yield Vo(Gn.disableMfa,cp),yield Vo(Gn.verifyMfaAfterForce,sp),yield Vo(Gn.preDisableMfaSms,up),yield Vo(Gn.disableMfaSms,dp),yield Vo(Gn.preEnrollMfaSms,yp),yield Vo(Gn.enrollMfaSms,fp)}const pp=["callback"];function*Sp({payload:e}){yield ji(Gn.setForgotPasswordState({loading:!0}));try{yield Gi(ed.auth.forgotPassword,e),yield ji(Gn.setForgotPasswordState({loading:!1,error:void 0,step:$t.success}))}catch(e){yield ji(Gn.setForgotPasswordState({loading:!1,error:e.message||"Unknown error occurred"}))}}function*vp(e){let{payload:{callback:t}}=e,n=ii(e.payload,pp);yield ji(Gn.setForgotPasswordState({loading:!0}));try{yield Gi(ed.auth.resetPassword,n),yield ji(Gn.setForgotPasswordState({loading:!1,error:void 0,step:$t.success})),null==t||t(!0)}catch(e){yield ji(Gn.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1)}}function*hp({payload:e}){yield ji(Gn.setForgotPasswordState({loading:!0}));try{const t=yield Gi(ed.auth.loadPasswordConfig,e);yield ji(Gn.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield ji(Gn.setForgotPasswordState({loading:!1,error:e.message}))}}function*mp(){yield Wo(Gn.forgotPassword,Sp),yield Wo(Gn.resetPassword,vp),yield Wo(Gn.loadPasswordConfig,hp)}let bp;!function(e){e.USERS="USERS",e.STATS="STATS",e.UPDATE_USER="UPDATE_USER",e.DELETE_USER="DELETE_USER",e.RESEND_ACTIVATE_LINK="RESEND_ACTIVATE_LINK",e.RESEND_INVITATION_LINK="RESEND_INVITATION_LINK",e.ROLES_AND_PERMISSIONS="ROLES_AND_PERMISSIONS",e.CREATE_TOKEN_LINK="CREATE_TOKEN_LINK",e.GET_TOKEN_LINK="GET_TOKEN_LINK",e.UPDATE_TOKEN_LINK="UPDATE_TOKEN_LINK",e.DELETE_TOKEN_LINK="DELETE_TOKEN_LINK",e.CONFIG_TOKEN_LINK="CONFIG_TOKEN_LINK"}(bp||(bp={}));const Ap=["callback","events"],kp=["callback"],Tp=["callback"];function*Pp({payload:{userId:e,token:t}}){yield ji(Gn.setActivateState({loading:!0,step:wt.activating}));try{const{isAuthenticated:n}=yield qi((e=>e.auth));n&&(yield ji(Gn.silentLogout()));const i=yield Gi(ed.auth.getActivateAccountStrategy,{userId:e,token:t});yield ji(Gn.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield ji(Gn.setActivateState({loading:!1,step:wt.activatingForm})))}catch(e){yield ji(Gn.setActivateState({loading:!1,error:e.message}))}}function*Ip(e){let{payload:{callback:t,events:n}}=e,i=ii(e.payload,Ap);yield ji(Gn.setActivateState({loading:!0}));try{const e=Ko.onRedirectTo,{routes:a}=yield qi((e=>e.auth)),r=yield Gi(ed.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(zy(r)){yield ji(Gn.setActivateState({step:wt.success}));const t=yield Jy(r);yield ji(Gn.setState(t)),yield Hi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield ji(Gn.setActivateState({step:wt.success}));const{user:e,tenants:t}=yield Gi(ed.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:_d.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield ji(Gn.setTenantsState({tenants:t,loading:!1})),yield ji(Gn.setState({user:e,isAuthenticated:!0})),yield Hi(1e3),yield Ky(),yield ji(Gn.resetActivateState())}null==t||t(!0)}catch(e){yield ji(Gn.setActivateState({loading:!1,error:e.message}))}}function*Lp({payload:e}){const{callback:t}=e,n=ii(e,kp);yield ji(Gn.setActivateStrategyState({loading:!0}));try{const e=yield Gi(ed.auth.getActivateAccountStrategy,n);yield ji(Gn.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield ji(Gn.setActivateStrategyState({loading:!1,error:e.message}))}}function*Op({payload:e}){const{callback:t}=e,n=ii(e,Tp);yield ji(Gn.setTeamLoader({key:bp.RESEND_ACTIVATE_LINK,value:n.email})),yield ji(Gn.setActivateState({loading:!0}));try{yield Gi(ed.auth.resendActivationEmail,n),yield ji(Gn.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield ji(Gn.setActivateState({loading:!1,error:e.message})),yield ji(Gn.setTeamError({key:bp.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:bp.RESEND_ACTIVATE_LINK,value:!1}))}function*Ep(){yield Wo(Gn.activateAccount,Ip),yield Wo(Gn.preActivateAccount,Pp),yield Wo(Gn.getActivateAccountStrategy,Lp),yield Wo(Gn.resendActivationEmail,Op)}function*wp({payload:e}){if(e.token&&e.userId)try{yield ji(Gn.setAcceptInvitationState({error:void 0,step:_t.pending})),yield Gi(ed.auth.acceptInvitation,e),yield ji(Gn.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:_t.success}}))}catch(e){yield ji(Gn.setAcceptInvitationState({step:_t.failed,error:e.message}))}else yield ji(Gn.setAcceptInvitationState({error:void 0,step:_t.invalid}))}function*Cp(){yield Wo(Gn.acceptInvitation,wp)}var Dp,Rp=new Uint8Array(16);function _p(){if(!Dp&&!(Dp="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Dp(Rp)}for(var Up=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Mp=function(e){return"string"==typeof e&&Up.test(e)},Np=[],$p=0;$p<256;++$p)Np.push(($p+256).toString(16).substr(1));var Fp=function(e,t,n){var i=(e=e||{}).random||(e.rng||_p)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=i[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Np[e[t+0]]+Np[e[t+1]]+Np[e[t+2]]+Np[e[t+3]]+"-"+Np[e[t+4]]+Np[e[t+5]]+"-"+Np[e[t+6]]+Np[e[t+7]]+"-"+Np[e[t+8]]+Np[e[t+9]]+"-"+Np[e[t+10]]+Np[e[t+11]]+Np[e[t+12]]+Np[e[t+13]]+Np[e[t+14]]+Np[e[t+15]]).toLowerCase();if(!Mp(n))throw TypeError("Stringified UUID is invalid");return n}(i)};const xp=["callback"],Vp=["roles"],jp=["callback"],Wp=["callback","profileImage"],Kp=["callback"],Gp=["callback","userId"],Bp=["callback"],zp=["callback"],qp=["callback"],Hp=["callback"],Jp=["callback"],Yp=["callback"],Qp=["callback"],Xp=["callback","profileImage"],Zp=["callback"],eS=["callback"],tS=["callback"],nS=["callback"],iS=["callback"],oS=["callback"],aS=()=>qi((e=>e.auth.teamState));function*rS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield aS(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(i=e.filter)?i:l.filter,d=null!=(o=e.sort)?o:l.sort;yield ji(Gn.setTeamLoader({key:bp.USERS,value:!a})),yield ji(Gn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield Wi([Gi(ed.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Gi(ed.teams.loadAvailableRoles),Gi(ed.teams.loadAvailablePermissions)]);yield ji(Gn.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield ji(Gn.setTeamError({key:bp.USERS,value:e.message})),yield ji(Gn.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield ji(Gn.setTeamLoader({key:bp.USERS,value:!1}))}function*lS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield aS(),c={_limit:(null!=(t=e._limit)?t:s.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:s.allUsersQueryParams._offset)||0,_filter:(null!=(i=e._filter)?i:s.allUsersQueryParams._filter)||"",_sortBy:(null!=(o=e._sortBy)?o:s.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:s.allUsersQueryParams._order)||"DESC"};yield ji(Gn.setTeamLoader({key:bp.USERS,value:!r})),yield ji(Gn.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield Wi([Gi(ed.subTenants.loadAllUsers,I({},c)),Gi(ed.teams.loadAvailableRoles),Gi(ed.teams.loadAvailablePermissions)]);yield ji(Gn.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==l||l(e)}catch(e){yield ji(Gn.setTeamError({key:bp.USERS,value:e.message})),yield ji(Gn.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield ji(Gn.setTeamLoader({key:bp.USERS,value:!1}))}function*sS({payload:e}){yield ji(Gn.setTeamLoader({key:bp.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield Wi([Gi(ed.teams.loadAvailableRoles),Gi(ed.teams.loadAvailablePermissions)]);yield ji(Gn.setTeamState({roles:n,permissions:i})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:i})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield ji(Gn.setTeamError({key:bp.ROLES_AND_PERMISSIONS,value:t.message}))}yield ji(Gn.setTeamLoader({key:bp.ROLES_AND_PERMISSIONS,value:!0}))}function*cS({payload:e}){const{callback:t}=e,n=ii(e,xp),i=yield aS();yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})}));try{const e=yield Gi(ed.teams.addUser,n),{roles:o}=e,a=I({},ii(e,Vp),{roleIds:o.map((e=>e.id))});null==t||t(a),yield ji(Gn.setTeamState({users:[a,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*uS({payload:e}){const{callback:t}=e,n=yield aS();yield ji(Gn.setTeamState({addUserDialogState:I({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield ji(Gn.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Gi(ed.teams.addUser,t),i.push(t.email)}catch(e){o.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:[],silentLoading:e.emails.length>0};yield ji(Gn.loadUsers(r)),yield ji(Gn.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*dS({payload:e}){const{callback:t}=e,n=ii(e,jp),i=yield aS();yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})}));try{yield Gi(ed.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield Gi(ed.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield ji(Gn.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*yS({payload:e}){const{callback:t}=e,n=ii(e,Wp),{id:i}=n,o=yield aS(),a=o.users.find((e=>e.id===n.id));yield ji(Gn.setTeamLoader({key:bp.UPDATE_USER,value:i||""})),yield ji(Gn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0})})),yield ji(Gn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?I({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield Gi(ed.teams.updateUser,n);null==t||t(e),yield ji(Gn.setTeamState({users:o.users.map((t=>t.id===e.id?I({},t,e,{createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield ji(Gn.setTeamLoader({key:bp.UPDATE_USER,value:!1}))}catch(e){yield ji(Gn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?I({},e,a):e))})),yield ji(Gn.setTeamLoader({key:bp.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*fS({payload:e}){const{callback:t}=e,n=ii(e,Kp),i=yield aS();yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})}));try{yield Gi(ed.teams.deleteUser,n),null==t||t(!0),yield ji(Gn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*gS({payload:e}){const{callback:t,userId:n}=e,i=ii(e,Gp),o=yield aS();yield ji(Gn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0})}));try{yield Gi(ed.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return I({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield ji(Gn.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[I({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield ji(Gn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*pS({payload:e}){const{callback:t}=e,n=ii(e,Bp),i=yield aS();yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})}));try{yield Gi(ed.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield ji(Gn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*SS({payload:e}){const{callback:t}=e,n=ii(e,zp);yield ji(Gn.setTeamLoader({key:bp.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Gi(ed.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:bp.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:bp.RESEND_ACTIVATE_LINK,value:!1}))}function*vS({payload:e}){const{callback:t}=e,n=ii(e,qp);yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:n.email}));try{yield Gi(ed.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:bp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:!1}))}function*hS({payload:e}){const{callback:t}=e,n=ii(e,Hp);yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:n.email}));try{yield Gi(ed.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:bp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:!1}))}function*mS({payload:e}){const{callback:t}=e,n=ii(e,Jp);yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:n.email}));try{yield Gi(ed.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:bp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:!1}))}function*bS(){yield ji(Gn.setTeamError({key:bp.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Gi(ed.teams.getInviteLinkConfiguration);yield ji(Gn.setTeamState({inviteTokenState:I({},e)}))}catch(e){yield ji(Gn.setTeamError({key:bp.CONFIG_TOKEN_LINK,value:e.message}))}}function*AS(){yield ji(Gn.setTeamError({key:bp.GET_TOKEN_LINK,value:!1}));try{yield Gi(bS);const e=yield Gi(ed.teams.getInviteUserLink),{inviteTokenState:t}=yield aS();yield ji(Gn.setTeamState({inviteTokenState:I({},t,e)}))}catch(e){yield ji(Gn.setTeamError({key:bp.GET_TOKEN_LINK,value:e.message}))}}function*kS({payload:{callback:e}}){yield ji(Gn.setTeamError({key:bp.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield aS();try{const n=yield Gi(ed.teams.createInviteUserLink,{expiresInMinutes:43200});yield ji(Gn.setTeamState({inviteTokenState:I({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield ji(Gn.setTeamError({key:bp.CREATE_TOKEN_LINK,value:t.message}))}}function*TS({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield aS();yield ji(Gn.setTeamError({key:bp.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield Gi(ed.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield ji(Gn.setTeamState({inviteTokenState:I({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield ji(Gn.setTeamError({key:bp.UPDATE_TOKEN_LINK,value:t.message}))}}function*PS({payload:e}){const{callback:t}=null!=e?e:{};yield ji(Gn.setTeamError({key:bp.DELETE_TOKEN_LINK,value:!1}));try{yield Gi(ed.teams.deleteInviteUserLink),yield ji(Gn.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:bp.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*IS({payload:e}){yield ji(Gn.setTeamState({addUserDialogState:I({open:!0,loading:!1,error:!1},e)}))}function*LS({payload:e}){const t=yield aS(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield ji(Gn.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*OS({payload:e}){yield ji(Gn.setTeamState({deleteUserDialogState:I({open:!0,loading:!1,error:!1},e)}))}function*ES({payload:e}){const t=yield aS(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield ji(Gn.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*wS(){yield jo(Gn.loadUsers,rS),yield jo(Gn.loadAllSubTenantsUsers,lS),yield jo(Gn.loadRoles,sS),yield Vo(Gn.addUser,cS),yield Vo(Gn.addUsersBulk,uS),yield Vo(Gn.addUserToSubTenants,dS),yield Vo(Gn.updateUser,yS),yield Vo(Gn.setUserRolesForSubTenants,gS),yield Vo(Gn.deleteUser,fS),yield Vo(Gn.deleteUserFromSubTenants,pS),yield Vo(Gn.resendActivationLink,SS),yield Vo(Gn.resendInvitationLink,vS),yield Vo(Gn.resendInvitationEmail,hS),yield Vo(Gn.resendInvitationLinkToAllSubTenants,mS),yield Vo(Gn.getInvitationLink,AS),yield Vo(Gn.createInvitationLink,kS),yield Vo(Gn.updateInvitationLink,TS),yield Vo(Gn.deleteInvitationLink,PS),yield Vo(Gn.openAddUserDialog,IS),yield Vo(Gn.closeAddUserDialog,LS),yield Vo(Gn.openDeleteUserDialog,OS),yield Vo(Gn.closeDeleteUserDialog,ES)}function*CS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield aS(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(i=e.filter)?i:l.filter,d=null!=(o=e.sort)?o:l.sort;yield ji(Gn.setTeamLoader({key:bp.USERS,value:!a})),yield ji(Gn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield yt(),yield ji(Gn.setTeamState({users:Ld,totalPages:2,totalItems:10,roles:bd,permissions:kd})),yield ji(Gn.setTeamLoader({key:bp.USERS,value:!1})),null==r||r(Ld)}function*DS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield aS(),c=null!=(t=e._limit)?t:s.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:s.allUsersQueryParams._offset,d=null!=(i=e._filter)?i:s.allUsersQueryParams._filter,y=null!=(o=e._sortBy)?o:s.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:s.allUsersQueryParams._order;yield ji(Gn.setTeamLoader({key:bp.USERS,value:!r})),yield ji(Gn.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield yt(),yield ji(Gn.setTeamState({allUsers:Od,totalPages:2,totalItems:10,roles:bd,permissions:kd})),yield ji(Gn.setTeamLoader({key:bp.USERS,value:!1})),null==l||l(Od)}function*RS({payload:e}){var t;yield ji(Gn.setTeamLoader({key:bp.ROLES_AND_PERMISSIONS,value:!0})),yield yt(),yield ji(Gn.setTeamState({roles:bd,permissions:kd})),yield ji(Gn.setTeamLoader({key:bp.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:bd,permissions:kd})}function*_S({payload:e}){const{callback:t}=e,n=ii(e,Yp),i=yield aS();yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})})),yield yt();const o=I({},Pd,n,{id:`${Fp()}`});null==t||t(o),yield ji(Gn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*US({payload:e}){const{callback:t}=e,n=ii(e,Qp),i=yield aS();yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})})),yield yt();const o=I({},Pd,n,{id:`${Fp()}`});yield ji(Gn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*MS({payload:e}){var t;const{callback:n}=e,i=ii(e,Xp),{id:o}=i,a=yield aS(),r=a.users.find((e=>e.id===i.id));yield ji(Gn.setTeamLoader({key:bp.UPDATE_USER,value:o||""})),yield ji(Gn.setTeamState({addUserDialogState:I({},a.addUserDialogState,{loading:!0})})),yield ji(Gn.setTeamState({addUserDialogState:I({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?I({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield yt();const l=I({},r,i);null==n||n(l),yield ji(Gn.setTeamState({users:a.users.map((e=>e.id===l.id?I({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield ji(Gn.setTeamLoader({key:bp.UPDATE_USER,value:!1}))}function*NS({payload:e}){const{callback:t}=e,n=ii(e,Zp),i=yield aS();yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*$S({payload:e}){const{callback:t}=e,n=ii(e,eS),i=yield aS();yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*FS({payload:e}){const{callback:t}=e,n=ii(e,tS);yield ji(Gn.setTeamLoader({key:bp.RESEND_ACTIVATE_LINK,value:n.userId})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamLoader({key:bp.RESEND_ACTIVATE_LINK,value:!1}))}function*xS({payload:e}){const{callback:t}=e,n=ii(e,nS);yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:!1}))}function*VS({payload:e}){const{callback:t}=e,n=ii(e,iS);yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:!1}))}function*jS({payload:e}){const{callback:t}=e,n=ii(e,oS);yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamLoader({key:bp.RESEND_INVITATION_LINK,value:!1}))}function*WS(){yield jo(Gn.loadUsers,CS),yield jo(Gn.loadAllSubTenantsUsers,DS),yield jo(Gn.loadRoles,RS),yield Vo(Gn.addUser,_S),yield Vo(Gn.addUserToSubTenants,US),yield Vo(Gn.updateUser,MS),yield Vo(Gn.deleteUser,NS),yield Vo(Gn.deleteUserFromSubTenants,$S),yield Vo(Gn.resendActivationLink,FS),yield Vo(Gn.resendInvitationLink,xS),yield Vo(Gn.resendInvitationEmail,VS),yield Vo(Gn.resendInvitationLinkToAllSubTenants,jS),yield Vo(Gn.openAddUserDialog,IS),yield Vo(Gn.closeAddUserDialog,LS),yield Vo(Gn.openDeleteUserDialog,OS),yield Vo(Gn.closeDeleteUserDialog,ES)}const KS=["authorizationUrl"],GS=["events","url"];function*BS(){try{yield ji(Gn.setSocialLoginsState({loading:!0}));const e=yield Gi(ed.auth.getSocialLoginProviders);yield ji(Gn.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield ji(Gn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*zS(){try{const e=yield qi((e=>e.root.context));yield ji(Gn.setSocialLoginsState({loading:!0}));const t=(yield Gi(ed.auth.getSocialLoginProvidersV2)).map((t=>{let{authorizationUrl:n}=t,i=ii(t,KS);const o=zo(e,null!=n?n:"");return I({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield ji(Gn.setSocialLoginsState({socialLoginsConfigV2:t,loading:!1,firstLoad:!1}))}catch(e){yield ji(Gn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*qS(e){let{payload:{events:t,url:n}}=e,i=ii(e.payload,GS);try{yield ji(Gn.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Gi(ed.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:Ud.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:i.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:_d.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield ji(Gn.setLoginState({email:e,isNewUser:r})),yield Yy(),localStorage.removeItem("register-quick-login"),yield ji(Gn.setSocialLoginsState({loading:!1}))}catch(e){var r;yield ji(Gn.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*HS({payload:e}){yield ji(Gn.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*JS(){yield Wo(Gn.loadSocialLoginsConfiguration,BS),yield Wo(Gn.loadSocialLoginsConfigurationV2,zS),yield Wo(Gn.loginViaSocialLogin,qS),yield jo(Gn.setSocialLoginError,HS)}let YS;function*QS({payload:e}){yield ji(Gn.setApiTokensState({apiTokenType:e}));try{if(yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})),"user"===e){const e=yield Gi(ed.auth.getUserApiTokensData);yield ji(Gn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{const e=yield Gi(ed.auth.getTenantApiTokensData),{items:t}=yield Gi(ed.teams.loadAvailableRoles),{items:n}=yield Gi(ed.teams.loadAvailablePermissions);yield ji(Gn.setApiTokensState({apiTokensDataTenant:null!=e?e:[],roles:null!=t?t:[],permissions:null!=n?n:[]}))}yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1}))}catch(e){yield ji(Gn.setApiTokensError({key:YS.LOAD_API_TOKENS,value:e.message})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1}))}}function*XS({payload:e}){const{description:t,callback:n}=e,{apiTokensDataUser:i}=yield qi((e=>e.auth.apiTokensState));try{yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!0}));const e=yield Gi(ed.auth.updateUserApiTokensData,{description:t});yield ji(Gn.setApiTokensState({showAddTokenDialog:!1})),yield Hi(200),yield ji(Gn.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!1})),null==n||n(null)}catch(e){yield ji(Gn.setApiTokensError({key:YS.ADD_API_TOKEN,value:e.message})),yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!1})),null==n||n(null,e.message)}}function*ZS({payload:e}){const{description:t,roleIds:n,callback:i}=e,{apiTokensDataTenant:o}=yield qi((e=>e.auth.apiTokensState));try{yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!0}));const e=yield Gi(ed.auth.updateTenantApiTokensData,{description:t,roleIds:n});yield ji(Gn.setApiTokensState({showAddTokenDialog:!1})),yield Hi(200),yield ji(Gn.setApiTokensState({apiTokensDataTenant:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield ji(Gn.setApiTokensError({key:YS.ADD_API_TOKEN,value:e.message})),yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*ev({payload:e}){const{apiTokensDataUser:t}=yield qi((e=>e.auth.apiTokensState));try{yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!0})),yield Gi(ed.auth.deleteUserApiToken,{tokenId:e}),yield ji(Gn.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!1}))}catch(e){yield ji(Gn.setApiTokensError({key:YS.DELETE_API_TOKEN,value:e.message})),yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!1}))}}function*tv({payload:e}){const{apiTokensDataTenant:t}=yield qi((e=>e.auth.apiTokensState));try{yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!0})),yield Gi(ed.auth.deleteTenantApiToken,{tokenId:e}),yield ji(Gn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!1}))}catch(e){yield ji(Gn.setApiTokensError({key:YS.DELETE_API_TOKEN,value:e.message})),yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!1}))}}function*nv({payload:e}){null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield Wi([Gi(ed.auth.getUserApiTokensData),Gi(ed.auth.getTenantApiTokensData)]);yield ji(Gn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setApiTokensError({key:YS.LOAD_API_TOKENS,value:t.message})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*iv({payload:e}){null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield Gi(ed.auth.getUserApiTokensData);yield ji(Gn.setApiTokensState({apiTokensDataUser:null!=n?n:[]})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setApiTokensError({key:YS.LOAD_API_TOKENS,value:t.message})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*ov({payload:e}){null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield Gi(ed.auth.getTenantApiTokensData);yield ji(Gn.setApiTokensState({apiTokensDataTenant:null!=n?n:[]})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setApiTokensError({key:YS.LOAD_API_TOKENS,value:t.message})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*av(){yield Wo(Gn.loadApiTokens,nv),yield Wo(Gn.loadUserApiTokens,iv),yield Wo(Gn.loadTenantApiTokens,ov),yield Wo(Gn.initApiTokensData,QS),yield Vo(Gn.addUserApiToken,XS),yield Vo(Gn.addTenantApiToken,ZS),yield jo(Gn.deleteTenantApiToken,tv),yield jo(Gn.deleteUserApiToken,ev)}function*rv({payload:e}){if(yield ji(Gn.setApiTokensState({apiTokenType:e})),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})),"user"===e){yield Hi(200);const e=[sd];yield ji(Gn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{var t;yield Hi(200),yield ji(Gn.setApiTokensState({apiTokensDataTenant:null!=(t=[cd])?t:[],roles:null!=bd?bd:[],permissions:null!=kd?kd:[]}))}yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1}))}function*lv({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield qi((e=>e.auth.apiTokensState)),a=I({},cd,{description:t,roleIds:n,clientId:`CLIENT_ID_${Fp()}`});yield ji(Gn.setApiTokensState({showAddTokenDialog:!1})),yield Hi(200),yield ji(Gn.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Hi(200),yield ji(Gn.setApiTokensLoader({key:YS.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*sv({payload:e}){yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!0})),yield Hi(200);const t=[cd];yield ji(Gn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ji(Gn.setApiTokensLoader({key:YS.DELETE_API_TOKEN,value:!1}))}function*cv({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})));const n=[sd],i=[cd];yield ji(Gn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Hi(200),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*uv({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})));const n=[sd];yield ji(Gn.setApiTokensState({apiTokensDataUser:n})),yield Hi(200),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*dv({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!0})));const n=[cd];yield ji(Gn.setApiTokensState({apiTokensDataTenant:n})),yield Hi(200),yield ji(Gn.setApiTokensLoader({key:YS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*yv(){yield Wo(Gn.loadApiTokens,cv),yield Wo(Gn.loadUserApiTokens,uv),yield Wo(Gn.loadTenantApiTokens,dv),yield Wo(Gn.initApiTokensData,rv),yield Vo(Gn.addTenantApiToken,lv),yield jo(Gn.deleteTenantApiToken,sv)}function*fv({payload:e}){try{var t;yield ji(Gn.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield qi((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Gi(ed.accountSettings.updateSettings,I({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield ji(Gn.setAccountSettingsState(I({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield ji(Gn.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*gv({payload:e}){yield ji(Gn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Gi(ed.accountSettings.getSettings);yield ji(Gn.setAccountSettingsState(I({},e,{loading:!1})))}catch(e){yield ji(Gn.setAccountSettingsState({loading:!1,error:e.message}))}}function*pv(){yield Wo(Gn.saveAccountSettings,fv),yield Wo(Gn.loadAccountSettings,gv)}function*Sv({payload:e}){var t;yield ji(Gn.setAccountSettingsState({loading:!0})),yield yt();const{accountSettingsState:n}=yield qi((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=I({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield ji(Gn.setAccountSettingsState(I({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*vv({payload:e}){yield ji(Gn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield yt(),yield ji(Gn.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*hv(){yield Wo(Gn.saveAccountSettings,Sv),yield Wo(Gn.loadAccountSettings,vv)}function*mv({payload:{tenantId:e,callback:t}}){yield ji(Gn.setState({isLoading:!0}));try{yield Gi(ed.tenants.switchTenant,{tenantId:e}),yield Gi(Yy),(null==t?void 0:t(!0))||(yield ji(Gn.setState({isLoading:!1})))}catch(e){yield ji(Gn.setState({isLoading:!1})),null==t||t(!1,e)}}function*bv({payload:e}){yield ji(Gn.setTenantsState({loading:!0}));try{var t;const n=yield Gi(ed.tenants.getTenants);yield ji(Gn.setTenantsState({tenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield ji(Gn.setTenantsState({loading:!1}))}}function*Av({payload:e}){yield ji(Gn.setTenantsState({loading:!0}));try{var t;const n=yield Gi(ed.tenants.getSubTenants);yield ji(Gn.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*kv({payload:e}){yield ji(Gn.setTenantsState({loading:!0}));try{var t;const n=yield Gi(ed.tenants.getSubTenantsAsTree);yield ji(Gn.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Tv(){yield Vo(Gn.loadTenants,bv),yield Vo(Gn.loadSubTenants,Av),yield Vo(Gn.switchTenant,mv),yield Vo(Gn.loadSubTenantsTree,kv)}function*Pv(){yield ji(Gn.setTenantsState({loading:!0})),yield yt(),yield ji(Gn.setTenantsState({tenants:Ed,loading:!1}))}function*Iv(){yield Vo(Gn.loadTenants,Pv)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(YS||(YS={}));const Lv=["callback"],Ov=["callback"],Ev=["callback"],wv=["callback"],Cv=["callback"];function*Dv({payload:e}){var t;yield ji(Gn.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Wi([Gi(ed.roles.getRoles),Gi(ed.roles.getPermissions),Gi(ed.roles.getPermissionCategories)]),[t,n,i]=e;yield ji(Gn.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield ji(Gn.setRolesState({error:e.message,loading:!1}))}}function*Rv(e){let{payload:{callback:t}}=e,n=ii(e.payload,Lv);yield ji(Gn.setRolesState({saving:!0}));try{const e=yield Gi(ed.roles.addRole,n),i=yield Gi(ed.roles.getRoles);yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*_v(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ov);yield ji(Gn.setRolesState({saving:!0}));try{yield Gi(ed.roles.deleteRole,n),yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*Uv(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ev);yield ji(Gn.setRolesState({saving:!0}));try{const e=yield Gi(ed.roles.updateRole,n);yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Mv(e){let{payload:{callback:t}}=e,n=ii(e.payload,wv);yield ji(Gn.setRolesState({saving:!0}));try{const e=yield Gi(ed.roles.attachPermissionsToRole,n);yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Nv(e){let{payload:{callback:t}}=e,n=ii(e.payload,Cv);yield ji(Gn.setRolesState({saving:!0}));try{const e=yield Gi(ed.roles.attachPermissionToRoles,n);yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*$v(){yield Wo(Gn.loadRolesAndPermissions,Dv),yield Vo(Gn.addRole,Rv),yield Vo(Gn.deleteRole,_v),yield Vo(Gn.updateRole,Uv),yield Vo(Gn.attachPermissionsToRole,Mv),yield Vo(Gn.attachPermissionToRoles,Nv)}const Fv=["callback"],xv=["callback"],Vv=["callback"];function*jv(e){let{payload:{callback:t}}=e,n=ii(e.payload,Fv);yield ji(Gn.setResetPhoneNumberState({loading:!0}));try{const e=yield Gi(ed.auth.resetPhoneNumber,n);yield ji(Gn.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:jt.VerifyResetPhoneNumber})),yield ji(Gn.setLoginState({email:n.email}))}catch(e){yield ji(Gn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Wv(e){let{payload:{callback:t}}=e,n=ii(e.payload,xv);yield ji(Gn.setResetPhoneNumberState({loading:!0}));try{const e=yield Gi(ed.auth.verifyResetPhoneNumber,n);yield ji(Gn.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:jt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield ji(Gn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Kv(e){let{payload:{callback:t}}=e,n=ii(e.payload,Vv);yield ji(Gn.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Gi(ed.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield ji(Gn.setLoginState({step:vt.loginWithSmsOtc})),yield ji(Gn.passwordlessPreLogin({type:rr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield ji(Gn.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Gv(){yield Wo(Gn.resetPhoneNumber,jv),yield Wo(Gn.verifyResetPhoneNumber,Wv),yield Wo(Gn.changePhoneNumber,Kv)}function*Bv(){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getCurrentUserSessions);yield ji(Gn.setSessionsState({sessions:e,loading:!1}))}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*zv(){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getCurrentUserSession);yield ji(Gn.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*qv({payload:{id:e}}){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{yield Gi(ed.auth.deleteSessionForUser,e),yield ji(Gn.loadUserSessions())}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*Hv({payload:{callback:e,userId:t}}){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{yield Gi(ed.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield ji(Gn.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Jv(){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{yield Gi(ed.auth.deleteAllSessionsForUser),yield ji(Gn.loadUserSessions())}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*Yv(){yield jo(Gn.loadUserSessions,Bv),yield jo(Gn.deleteUserSession,qv),yield jo(Gn.deleteAllUserSessions,Jv),yield jo(Gn.loadCurrentUserSession,zv),yield Vo(Gn.revokeUserSessions,Hv)}function*Qv(){yield ji(Gn.setSessionsState({loading:!0,error:null})),yield ji(Gn.setSessionsState({sessions:wd,loading:!1}))}function*Xv({payload:{id:e}}){yield ji(Gn.setSessionsState({loading:!0,error:null}));const t=(yield qi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield ji(Gn.setSessionsState({sessions:t,loading:!1}))}function*Zv(){yield ji(Gn.setSessionsState({loading:!0,error:null}));const e=wd.filter((e=>e.current));yield ji(Gn.setSessionsState({sessions:e,loading:!1}))}function*eh(){yield jo(Gn.loadUserSessions,Qv),yield jo(Gn.deleteUserSession,Xv),yield jo(Gn.deleteAllUserSessions,Zv)}const th=["callback"],nh=["callback"];function*ih(){yield ji(Gn.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getSessionConfigurations);yield ji(Gn.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*oh({payload:e}){yield ji(Gn.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=ii(e,th);yield Gi(ed.auth.createOrUpdateSessionConfigrations,n),yield ji(Gn.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield ji(Gn.setSessionsPolicyState({error:e,loading:!1}))}}function*ah(){yield Wo(Gn.loadSessionsPolicy,ih),yield jo(Gn.createOrUpdateSessionsPolicy,oh)}function*rh(){yield ji(Gn.setSessionsPolicyState({loading:!0,error:null}));const e=yield qi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Cd}));yield ji(Gn.setSessionsPolicyState(I({},e,{loading:!1})))}function*lh({payload:e}){yield ji(Gn.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=ii(e,nh);null==t||t(!0),yield ji(Gn.setSessionsPolicyState({configurations:n,loading:!1}))}function*sh(){yield Wo(Gn.loadSessionsPolicy,rh),yield jo(Gn.createOrUpdateSessionsPolicy,lh)}const ch=["callback"],uh=["callback"],dh=["callback"],yh=["callback"],fh=["callback"],gh=["callback"],ph=["callback"],Sh=["callback"],vh=()=>qi((e=>e.auth.restrictionsState.ipRestrictions)),hh=()=>qi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*mh(){yield ji(Gn.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getDomainRestrictionsConfig),t=(yield Gi(ed.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ji(Gn.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield ji(Gn.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*bh(e){let{payload:{callback:t}}=e,n=ii(e.payload,ch);yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield hh();try{var o;yield Gi(ed.auth.createDomainRestriction,n);const e=(yield Gi(ed.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield ji(Gn.setEmailDomainRestrictionsState({data:{config:(null==(o=i.data)?void 0:o.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ah(e){let{payload:{callback:t}}=e,n=ii(e.payload,uh);yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Gi(ed.auth.updateDomainRestrictionConfig,n),i=(yield Gi(ed.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ji(Gn.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*kh({payload:{id:e}}){yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield hh();try{var n;yield Gi(ed.auth.deleteDomainRestriction,e);const i=(yield Gi(ed.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield ji(Gn.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:_n.ALLOW},restrictions:i},saving:!1}))}catch(e){yield ji(Gn.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Th=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:_n.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*Ph(){yield ji(Gn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield vh(),t=yield Gi(ed.auth.getIPRestrictionsConfig),n=Th({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield Gi(ed.auth.getIPRestrictions,n);yield ji(Gn.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield ji(Gn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Ih(){try{const{valid:e}=yield Gi(ed.auth.testCurrentIpInAllowList);yield ji(Gn.setIpRestrictionsState({userIpValid:e}))}catch(e){yield ji(Gn.setIpRestrictionsState({error:e.message}))}}function*Lh({payload:{callback:e}}){yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield qi((e=>e.auth.userIp));yield Wi([Gi(ed.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:_n.ALLOW}),Gi(ed.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield vh(),i=Th(n.pagination),{items:o,_metadata:{totalPages:a}}=yield Gi(ed.auth.getIPRestrictions,i);yield ji(Gn.setIpRestrictionsState({data:{config:{isActive:!0,strategy:_n.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield ji(Gn.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Oh(e){let{payload:{callback:t}}=e,n=ii(e.payload,dh);yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));const i=yield vh();try{var o,a;yield Gi(ed.auth.createIPRestriction,n);const e=yield vh(),r=Th(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Gi(ed.auth.getIPRestrictions,r);yield Ih(),yield ji(Gn.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:_n.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Eh(e){let{payload:{callback:t}}=e,n=ii(e.payload,yh);yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));try{yield Gi(ed.auth.updateIPRestrictionConfig,n);const e=yield vh(),i=yield Gi(ed.auth.getIPRestrictionsConfig),o=Th(I({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield Gi(ed.auth.getIPRestrictions,o);yield Ih(),yield ji(Gn.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*wh({payload:{id:e,callback:t}}){yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));const n=yield vh();try{var i;yield Gi(ed.auth.deleteIPRestriction,e);const o=yield vh(),a=Th(o.pagination),{items:r,_metadata:{totalPages:l}}=yield Gi(ed.auth.getIPRestrictions,a);yield Ih(),yield ji(Gn.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:_n.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ch(){yield Wo(Gn.loadIpRestrictions,Ph),yield Wo(Gn.loadEmailDomainRestrictions,mh),yield Vo(Gn.saveIpRestriction,Oh),yield Vo(Gn.saveIpRestrictionsConfig,Eh),yield Vo(Gn.deleteIpRestriction,wh),yield Vo(Gn.checkIfUserIpValid,Ih),yield Vo(Gn.addCurrentUserIpAndActivate,Lh),yield Vo(Gn.saveEmailDomainRestriction,bh),yield Vo(Gn.saveEmailDomainRestrictionsConfig,Ah),yield Vo(Gn.deleteEmailDomainRestriction,kh)}function*Dh(){yield ji(Gn.setIpRestrictionsState({loading:!0,error:null})),yield ji(Gn.setIpRestrictionsState({data:{restrictions:Rd.filter((e=>e.strategy===Dd.strategy)),config:Dd},totalPages:1,pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Rh(){yield ji(Gn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield vh(),t=Rd[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield ji(Gn.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield ji(Gn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*_h(e){var t,n,i;let{payload:{callback:o}}=e,a=ii(e.payload,fh);yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));const r=yield vh(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield ji(Gn.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:_n.ALLOW},restrictions:[...l,I({},a,{createdAt:new Date,updatedAt:new Date,id:Fp(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*Uh(e){var t,n,i;let{payload:{callback:o}}=e,a=ii(e.payload,gh);const r=yield vh();yield ji(Gn.setIpRestrictionsState({saving:!0,error:null})),yield ji(Gn.setIpRestrictionsState({data:{config:I({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield ji(Gn.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*Mh({payload:{id:e,callback:t}}){var n;yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));const i=yield vh();yield ji(Gn.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:_n.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*Nh(){yield ji(Gn.setEmailDomainRestrictionsState({loading:!0,error:null})),yield ji(Gn.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:_n.ALLOW}],config:{active:!0,listType:_n.ALLOW,blockPublicDomains:!1}}}))}function*$h(e){var t,n;let{payload:{callback:i}}=e,o=ii(e.payload,ph);const a=yield hh();yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),null==i||i(!0),yield ji(Gn.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],I({},o,{id:Date.now().toString()})]},saving:!1}))}function*Fh(e){var t;let{payload:{callback:n}}=e,i=ii(e.payload,Sh);const o=yield hh();yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),null==n||n(!0),yield ji(Gn.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||_n.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*xh({payload:{id:e}}){var t,n;const i=yield hh();yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),yield ji(Gn.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:_n.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*Vh(){yield Wo(Gn.loadIpRestrictions,Dh),yield Wo(Gn.loadEmailDomainRestrictions,Nh),yield Vo(Gn.saveIpRestriction,_h),yield Vo(Gn.saveIpRestrictionsConfig,Uh),yield Vo(Gn.deleteIpRestriction,Mh),yield Vo(Gn.checkIfUserIpValid,Rh),yield Vo(Gn.saveEmailDomainRestriction,$h),yield Vo(Gn.saveEmailDomainRestrictionsConfig,Fh),yield Vo(Gn.deleteEmailDomainRestriction,xh)}const jh=["callback"],Wh=["id"];function*Kh(e){const{count:t}=yield Gi(ed.directory.countConfigurationUsers,e.id);return I({},e,{count:t})}function*Gh(){yield ji(Gn.setProvisioningState({loading:!0,error:null}));try{const e=yield Gi(ed.directory.getConfigs),t=yield Wi(e.map((e=>Kh(e))));yield ji(Gn.setProvisioningState({connections:t,loading:!1}))}catch(e){yield ji(Gn.setProvisioningState({error:e.message,loading:!1}))}}function*Bh(e){let{payload:{callback:t}}=e,n=ii(e.payload,jh);yield ji(Gn.setProvisioningState({loading:!0,error:null}));try{const e=yield Gi(ed.directory.createConfiguration,n),i=yield Gi(ed.directory.getConfigs),o=yield Wi(i.map((e=>Kh(e))));yield ji(Gn.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield ji(Gn.setProvisioningState({error:e.message,loading:!1}))}}function*zh(e){let{payload:{id:t}}=e,n=ii(e.payload,Wh);yield ji(Gn.setProvisioningState({loading:!0,error:null}));try{yield Gi(ed.directory.updateConfiguration,t,n);const e=yield Gi(ed.directory.getConfigs),i=yield Wi(e.map((e=>Kh(e))));yield ji(Gn.setProvisioningState({connections:i,loading:!1}))}catch(e){yield ji(Gn.setProvisioningState({error:e.message,loading:!1}))}}function*qh({payload:{id:e,callback:t}}){yield ji(Gn.setProvisioningState({loading:!0,error:null}));try{yield Gi(ed.directory.deleteConfiguration,e);const n=yield Gi(ed.directory.getConfigs),i=yield Wi(n.map((e=>Kh(e))));yield ji(Gn.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*Hh(){yield Wo(Gn.loadProvisionConnections,Gh),yield Vo(Gn.createProvisionConnection,Bh),yield Vo(Gn.deleteProvisionConnection,qh),yield Vo(Gn.updateProvisionConnection,zh)}var Jh={sagas:function*(){yield Wi([Gi(Mf),Gi(Ep),Gi(Cp),Gi(mp),Gi(Gv),Gi(Qf),Gi(kg),Gi(Eg),Gi(ap),Gi(wS),Gi(JS),Gi(Vd),Gi(av),Gi(yy),Gi(pv),Gi(Tv),Gi($v),Gi(Yv),Gi(ah),Gi(Ch),Gi(Hh)])},mockSagas:function*(){yield Wi([Gi(Ff),Gi(og),Gi(Rg),Gi(gp),Gi(WS),Gi(yv),Gi(Ty),Gi(eh),Gi(hv),Gi(Iv),Gi(sh),Gi(Vh)])},storeName:kt,initialState:jn,reducer:Wn,actions:Gn};const Yh=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>I({},t,{[e]:I({},t[e],n)})}),Qh={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Xh={setAuditLogsState:Yh("auditLogsState"),resetAuditLogsState:e=>I({},e,{auditLogsState:Qh})},Zh={exportAuditsCsv:it("auditLogs/exportAuditsCsv"),loadAuditLogs:it("auditLogs/loadAuditLogs",(e=>({payload:e})))},em={loading:!0},tm={setAuditsMetadataState:Yh("auditsMetadataState"),resetAuditsMetadataState:e=>I({},e,{auditsMetadataState:em})},nm={loadAuditsMetadata:it("auditLogs/loadAuditsMetadata")},im={auditLogsState:Qh,auditsMetadataState:em},{reducer:om,actions:am}=at({name:Pt,initialState:im,reducers:I({resetState:e=>I({},e,im),setState:(e,{payload:t})=>I({},e,t)},Xh,tm)}),rm=I({},am,Zh,nm),lm=e=>"createdAt"!==e.id,sm={total:20,data:Array.from(Array(5).keys()).map((e=>I({ip:"198.143.51.1",user:"Demo User Name",email:"demo-user@frontegg.com"},(()=>{switch(Math.floor(6*Math.random())){case 0:return{action:"Updated profile",description:"User updated profile details",severity:"Info"};case 1:return{action:"User logged in",severity:"Info",description:"User logged in to the product"};case 2:return{action:"User failed to login",severity:"High",description:"User failed to login with password"};case 3:return{action:"Added user",severity:"Info",description:"Added user david+535@frontegg.com to tenant"};case 4:return{action:"Assigned roles",severity:"Info",description:"Assigned 0 roles for user"};case 5:return{action:"Removed user david+108@frontegg.com from account",severity:"Info",description:"Removed access from the account for user david+108@frontegg.com"}}})(),{json:{key1:"value1",key2:"value2",key3:"value3",key4:"value4"},tenantId:"my-tenant-id",vendorId:"my-vendor-id",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",createdAt:`2022-04-07 10:${50-e}:40.201`})))},cm={properties:[{showInTable:!0,name:"createdAt",displayName:"Time",type:"Timestamp",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!1},{showInTable:!0,name:"email",displayName:"User",type:"Email",filterable:!0,sortable:!0,isPredefined:!0,chosen:!1,selected:!1},{showInTable:!0,name:"action",displayName:"Action",type:"AlphaNumeric",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!0,name:"description",type:"AlphaNumeric",sortable:!1,filterable:!1,displayName:"Description",isPredefined:!0,chosen:!1,selected:!1},{showInTable:!0,name:"ip",displayName:"IP Address",type:"IpAddress",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!1,name:"severity",displayName:"Severity",type:"Severity",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!1,name:"userAgent",displayName:"User Agent",type:"AlphaNumeric",filterable:!0,sortable:!0,isPredefined:!0,chosen:!1,selected:!1},{showInTable:!1,name:"json",type:"Json",sortable:!0,filterable:!0,displayName:"Json Data",showInMoreInfo:"Always",isPredefined:!1}]},um=()=>qi((e=>e.auditLogs.auditLogsState)),dm=()=>qi((e=>e.auditLogs.auditsMetadataState));function*ym(){const e=yield um(),{columns:t}=yield dm();try{const n=e.filter,i=e.sort.reduce(((e,t)=>I({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>I({},e,{[t.id]:t.value})),{});yield ji(rm.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield ed.audits.exportAudits(I({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield ji(rm.setAuditLogsState({isDownloadingCsv:!1}))}function*fm({payload:e}){yield ji(rm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield um(),{columns:n}=yield dm();try{var i,o,a,r,l;const s=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield ji(rm.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>I({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>I({},e,{[t.id]:t.value})),{});n||(yield ji(rm.loadAuditsMetadata()));const{data:g,total:p}=yield Gi(ed.audits.getAudits,I({offset:c,count:s},y,f));yield ji(rm.setAuditLogsState({loading:!1,logs:null!=g?g:[],totalPages:+Math.ceil(p/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield ji(rm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*gm(){yield Vo(rm.exportAuditsCsv,ym),yield Vo(rm.loadAuditLogs,fm)}function*pm({payload:e}){yield ji(rm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield um(),{columns:n}=yield dm();try{var i,o,a,r,l;const s=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield ji(rm.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield ji(rm.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=sm;let i=n.filter((e=>t=>e.filter(lm).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];i=i.sort(((e,t)=>(n,i)=>n[e]>i[e]?t?-1:1:i[e]>n[e]?t?1:-1:0)(e,n))}return{data:i,total:i.length}})(u,d);yield ji(rm.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield ji(rm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Sm(){yield Vo(rm.loadAuditLogs,pm)}function*vm(){yield ji(rm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Gi(ed.metadata.getAuditsMetadata);yield ji(rm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ji(rm.setAuditsMetadataState({error:e,loading:!1}))}}function*hm(){yield Vo(rm.loadAuditsMetadata,vm)}function*mm(){yield ji(rm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=cm;yield ji(rm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ji(rm.setAuditsMetadataState({error:e,loading:!1}))}}function*bm(){yield Vo(rm.loadAuditsMetadata,mm)}var Am={sagas:function*(){yield Wi([Gi(gm),Gi(hm)])},mockSagas:function*(){yield Wi([Gi(Sm),Gi(bm)])},storeName:Pt,initialState:im,reducer:om,actions:rm};const km={total:0,offset:0,filter:"",sortBy:"createdAt",context:null,filters:[],rowsData:[],lastUpdated:new Date,isLoading:!0,isFetchMore:!1,totalToday:0,currentPage:0,headerProps:[],sortDirection:"desc",severeThisWeek:0,predefinedFilters:[],isDownloadingCsv:!1,virtualScroll:!1},{name:Tm,actions:Pm,reducer:Im}=at({name:"audits",initialState:km,reducers:{setContext:(e,{payload:t})=>{e.context=t},startLoading:e=>{e.isLoading=!0},setVirtualScroll:(e,{payload:t})=>{e.virtualScroll=t},startRefresh:e=>{e.isLoading=!0},startFetching:e=>{e.isFetchMore=!0},finishLoading:e=>{e.isLoading=!1},startDownloadingCsv:e=>{e.isDownloadingCsv=!0},stopDownloadingCsv:e=>{e.isDownloadingCsv=!1},loadStatsSuccess:(e,{payload:t})=>{e.error=void 0,e.totalToday=t.totalToday,e.severeThisWeek=t.severeThisWeek},loadItemFailedAction:(e,{payload:t})=>{e.error=I({},e.error,{[t.name]:t.error})},loadMetadataSuccess:(e,{payload:t})=>{e.error={},e.headerProps=t.properties,e.themeAudits=t.theme?t.theme.styles:{}},loadAuditsSuccess:(e,{payload:t})=>{e.error={},e.rowsData=t.rowsData,e.lastUpdated=new Date,e.total=t.total},fetchMoreSuccess:(e,{payload:t})=>{e.error={},e.offset=t.offset,e.currentPage=t.currentPage,e.isFetchMore=!1},setFilterData:(e,{payload:t})=>{e.filters=t,e.currentPage=0,e.offset=0,e.isLoading=!0},textSearch:(e,{payload:t})=>{e.filter=t,e.currentPage=0,e.offset=0,e.isLoading=!0},onPageChange:(e,{payload:t})=>{e.currentPage=t-1,e.offset=20*e.currentPage,e.isLoading=!0},setDataSorting:(e,{payload:t})=>{e.sortBy=t.sortBy,e.currentPage=0,e.sortDirection="asc"===t.sortDirection?"desc":"asc",e.offset=0,e.isLoading=!0},setPredefinedFilters:(e,{payload:t})=>{e.predefinedFilters=t,e.filters=Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),Lm=I({},Pm,{initData:it(`${Tm}/initData`),loadAudits:it(`${Tm}/loadAudits`),removeFilter:it(`${Tm}/removeFilter`),filterData:it(`${Tm}/filterData`),exportCSV:it(`${Tm}/exportCSV`),deleteAudits:it(`${Tm}/deleteAudits`)}),Om=()=>qi((e=>e[Tm]));function*Em(){const{sortBy:e,sortDirection:t}=yield Om();try{const n=yield Gi(ed.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield ji(Lm.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield ji(Lm.loadItemFailedAction(t))}}function*wm(){try{const e=yield Gi(ed.metadata.getAuditsMetadata);yield ji(Lm.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield ji(Lm.loadItemFailedAction(t))}}const Cm=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Dm({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield Om(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield Om():{rowsData:[]};try{const e=Cm(t),{data:l,total:d}=yield Gi(ed.audits.getAudits,I({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield ji(Lm.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield ji(Lm.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield ji(Lm.loadItemFailedAction(t))}}function*Rm(){yield ji(Lm.startLoading()),yield Wi([Em(),wm(),Dm({payload:{onlyOneLoad:!1},type:""})]),yield ji(Lm.finishLoading())}function*_m({payload:e}){const{filters:t}=yield Om(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield ji(Lm.setFilterData(i))}function*Um({payload:e}){const{filters:t}=yield Om();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const i=[...t.slice(0,n),e,...t.slice(n+1)];yield ji(Lm.setFilterData(i))}function*Mm(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield Om(),a=Cm(e);yield ji(Lm.startDownloadingCsv());try{yield ed.audits.exportAudits(I({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield ji(Lm.stopDownloadingCsv())}}function*Nm(){yield jo(Lm.initData,Rm),yield jo(Lm.removeFilter,_m),yield jo(Lm.filterData,Um),yield jo([Lm.loadAudits,Lm.textSearch,Lm.onPageChange],Dm),yield jo([Lm.setFilterData,Lm.setDataSorting,Lm.startRefresh],(()=>Dm({payload:{appendMode:!1},type:""}))),yield jo(Lm.exportCSV,Mm)}const $m={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},Fm={initData:()=>I({},$m),setConnectivityState:(e,{payload:t})=>I({},e,t),cleanWebhookTestData:e=>I({},e,{testResult:void 0}),cleanWebhookLogsData:e=>I({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return I({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>I({},e,{error:void 0}),cleanSlackData:e=>I({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>I({},e,{retryResult:I({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>I({},e,{retryResult:I({},e.retryResult,t)})}},xm={loadSlackActions:it("connectivity/loadSlackActions"),loadDataAction:it("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:it("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:it("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:it("connectivity/loadScope"),deleteWebhookConfigAction:it("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:it("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:it("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},Vm={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:jm,actions:Wm}=at({name:Tt,initialState:Vm,reducers:I({},Fm)}),Km=I({},Wm,xm),Gm={slack:ed.connectivity.getSlackConfiguration,email:ed.connectivity.getEmailConfiguration,sms:ed.connectivity.getSMSConfiguration,webhook:ed.connectivity.getWebhooksConfigurations,categories:ed.connectivity.getCategories,channelMap:ed.connectivity.getChannelMaps},Bm={slack:ed.connectivity.postSlackConfiguration,email:ed.connectivity.postEmailConfiguration,sms:ed.connectivity.postSMSConfiguration,webhook:ed.connectivity.postWebhooksConfiguration},zm=["email","slack","sms","webhook"],qm={sms:{title:"connectivity.sms",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({enabled:e})=>e)))&&t},image:"sms"},email:{title:"common.email",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({enabled:e})=>e)))&&t},image:"email"},slack:{title:"connectivity.slack",events:e=>{var t;return(null==e||null==(t=e.slackSubscriptions)?void 0:t.length)||0},isActive:e=>{var t;return null!=(t=!(null==e||!e.slackSubscriptions.some((({isActive:e})=>e))))&&t},image:"slack"},webhook:{title:"connectivity.webhook",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({isActive:e})=>e)))&&t},image:"webhook"}},Hm=["id"],Jm=["id","enabled"],Ym=["categories","channelMap"];function*Qm(e){return yield Gi(Zm,{payload:{api:e},type:""})}function*Xm({payload:e=zm}){yield ji(Km.setConnectivityState({isLoading:!0}));try{const t=yield Wi([...e.map(Qm),yield Zm({payload:{api:"categories"},type:""}),yield function*(){return(yield Wi(e.map((function*(e){return yield Zm({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>I({},t,{[`${e[i]}`]:n})),{})}()]),n=yield Zm({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?I({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:qm[e[o]].events(i),active:qm[e[o]].isActive(i),platform:qm[e[o]].title,image:qm[e[o]].image}]}):n:I({},n,{[`${Ym[o-e.length]}`]:i})),{list:[],webhook:n});yield ji(Km.setConnectivityState(I({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield ji(Km.setConnectivityState({isLoading:!1}))}}function*Zm({payload:{api:e,params:t}}){try{return yield Gi(Gm[e],t)}catch(e){return}}function*eb(){try{yield ji(Km.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Gi(ed.connectivity.getSlackChannels);yield ji(Km.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield ji(Km.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*tb(e,t){const{connectivity:{list:n}}=yield qi(),i=n.find((({key:t})=>t===e));if(!i)return;const o=qm[e].isActive(t);o!==i.active&&(yield ji(Km.setConnectivityState({list:n.map((t=>t.key===e?I({},t,{active:o}):t))})))}function*nb({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield qi((e=>e.connectivity));try{if(yield ji(Km.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield qi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield Wi([...i.reduce(((e,t)=>{var i,o;return!t.id&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length||(null==n?void 0:n.find((e=>{let{id:n}=e,i=ii(e,Hm);return n===t.id&&JSON.stringify(I({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield Gi(Bm.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Gi(ed.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield qi(),{processIds:i}=yield qi((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield Wi([...e.reduce(((e,t)=>!o.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield Gi("email"===t?ed.connectivity.postEmailConfiguration:ed.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:i}=e,o=n[0],{id:a="",enabled:r}=o,l=ii(o,Jm);return yield Wi([yield Gi("email"===t?ed.connectivity.patchEmailConfiguration:ed.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield Gi("email"===t?ed.connectivity.putEmailSubscriptions:ed.connectivity.putSMSSubscriptions,a,i,I({},l,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return Gi("email"===t?ed.connectivity.deleteEmailSubscriptions:ed.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield Zm({payload:{api:t},type:""});yield ji(Km.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield tb(t,e)}else yield ji(Km.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield Gi(Bm[e],t),!["sms","email"].includes(e)){const o=yield Zm({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield ji(Km.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield tb(e,o),null==n||n(!0)}}catch(e){var o;yield ji(Km.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*ib({payload:e}){try{yield ed.connectivity.postSlackCode(e)}catch{}yield ji(Km.setConnectivityState({error:void 0,isSaving:!1}))}function*ob(){const{slackChannels:e}=yield qi((e=>e.connectivity));try{yield ji(Km.setConnectivityState({slackChannels:I({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Gi(ed.connectivity.getSlackScope);yield ji(Km.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield ji(Km.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*ab({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield qi((e=>e.connectivity));try{yield ji(Km.setConnectivityState({isSaving:!0})),yield Gi(ed.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield Zm({payload:{api:"webhook"},type:""});o&&(yield ji(Km.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*rb({payload:e}){try{yield ji(Km.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Gi(ed.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield ji(Km.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield ji(Km.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield ji(Km.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*lb({payload:e}){try{const{statusCode:t}=yield Gi(ed.connectivity.postWebhookRetry,e);yield ji(Km.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield ji(Km.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*sb({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield qi((e=>e.connectivity));try{yield ji(Km.setConnectivityState({webhookLogs:I({},i,{isLoading:!0})}));const o=yield Gi(ed.connectivity.getWebhookLog,e,n,t);yield ji(Km.setConnectivityState({error:void 0,webhookLogs:I({isLoading:!1},o)}))}catch(e){yield ji(Km.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var cb={sagas:function*(){yield Vo(Km.loadDataAction,Xm),yield jo(Km.loadSlackActions,eb),yield Vo(Km.postDataAction,nb),yield Vo(Km.postCodeAction,ib),yield Vo(Km.loadScope,ob),yield Vo(Km.deleteWebhookConfigAction,ab),yield Vo(Km.postWebhookTestAction,rb),yield Vo(Km.postWebhookRetryAction,lb),yield jo(Km.loadWebhookLogsAction,sb)},storeName:Tt,initialState:Vm,reducer:jm,actions:Km};function ub(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,t.payload)}}}function db(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>I({},n,{[e]:t(n[e],i)})}}function yb(e){return db(e,((e,t)=>I({},e,{loading:t.payload})))}function fb(e){return db(e,((e,t)=>I({},e,{error:t.payload,loading:!1})))}const gb={loading:!1,error:null,fetching:!0,plans:[]},{actions:pb,reducer:Sb,name:vb}=at({name:"subscriptions/plans",initialState:gb,reducers:I({},ub())}),hb=I({loadPlans:it(`${vb}/loadPlans`)},pb),mb={loading:!1,error:null,fetching:!0,config:null},bb=I({},ub()),{actions:Ab,reducer:kb,name:Tb}=at({name:"subscriptions/config",initialState:mb,reducers:bb}),Pb=I({loadPaymentConfiguration:it(`${Tb}/loadPaymentConfiguration`)},Ab),Ib={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},Lb=I({},ub(),{setCancellationLoading:yb("cancellation"),setCancellationError:fb("cancellation"),setRenewalLoading:yb("renewal"),setRenewalError:fb("renewal")}),{reducer:Ob,actions:Eb,name:wb}=at({name:"subscriptions/billing/subscription",initialState:Ib,reducers:Lb}),Cb=I({load:it(`${wb}/loadSubscription`),cancelSubscription:it(`${wb}/cancelSubscription`),renewSubscription:it(`${wb}/renewSubscription`)},Eb),Db={loading:!1,error:null,fetching:!0},Rb=I({},ub()),{reducer:_b,actions:Ub,name:Mb}=at({name:"subscriptions/billing/information",initialState:Db,reducers:Rb}),Nb=I({loadBillingInformation:it(`${Mb}/loadBillingInformation`),cancelSubscription:Cb.cancelSubscription,renewSubscription:Cb.renewSubscription},Ub),$b={loading:!1,error:null,fetching:!0},Fb=I({},ub(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,t.payload)}}),{reducer:xb,actions:Vb,name:jb}=at({name:"subscriptions/billing/payment",initialState:$b,reducers:Fb}),Wb=I({loadPaymentMethod:it(`${jb}/loadPaymentMethod`),submitPaymentMethod:it(`${jb}/submitPaymentMethod`),submitPaymentMethodError:it(`${jb}/submitPaymentMethodError`),submitPaymentMethodSuccess:it(`${jb}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:it(`${jb}/updateBillingDetails`,(e=>({payload:e})))},Vb),Kb={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},Gb=I({},ub(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{invoiceDownload:I({},e.invoiceDownload,t.payload)})}}),{reducer:Bb,actions:zb,name:qb}=at({name:"subscriptions/billing/invoices",initialState:Kb,reducers:Gb}),Hb=I({loadInvoices:it(`${qb}/loadInvoices`),downloadInvoice:it(`${qb}/downloadInvoice`,(e=>({payload:e})))},zb),Jb={information:Db,invoices:Kb,paymentMethod:$b,subscription:Ib},Yb={invoices:Hb,information:Nb,paymentMethod:Wb,subscription:Cb},Qb=$e({invoices:Bb,information:_b,paymentMethod:xb,subscription:Ob}),Xb={fetching:!0,loading:!1,error:null,confirmed:!1},Zb=I({},ub()),{actions:eA,reducer:tA,name:nA}=at({name:"subscriptions/checkout",initialState:Xb,reducers:Zb}),iA=I({loadCheckout:it(`${nA}/loadCheckout`),resetCheckout:it(`${nA}/resetCheckout`),submitCheckout:it(`${nA}/submitCheckout`),confirmCheckout:it(`${nA}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:it(`${nA}/errorCheckout`,(e=>({payload:e})))},eA),oA={loading:!1,error:null,cardSetupIntentSecret:null},aA=I({},ub()),{reducer:rA,actions:lA,name:sA}=at({name:"subscriptions/stripe",initialState:oA,reducers:aA}),cA=I({loadCustomer:it(`${sA}/loadCustomer`),createCardSetupIntentSecret:it(`${sA}/createCardSetupIntentSecret`)},lA),uA={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:dA,reducer:yA,name:fA}=at({name:"subscriptions/vendorPublicConfig",initialState:uA,reducers:I({},ub())}),gA=I({loadVendorPublicConfiguration:it(`${fA}/loadVendorPublicConfiguration`)},dA),pA={config:mb,plans:gb,checkout:Xb,billing:Jb,stripe:oA,vendorPublicConfig:uA},SA={config:Pb,billing:Yb,plans:hb,checkout:iA,stripe:cA,vendorPublicConfig:gA},vA=$e({config:kb,billing:Qb,plans:Sb,checkout:tA,stripe:rA,vendorPublicConfig:yA});let hA,mA,bA;function AA({policy:e}){return{policy:bA.AT_PERIOD_END}}function kA(e){switch(e){case Tu.ACTIVE:return mA.ACTIVE;case Tu.INCOMPLETE:return mA.INCOMPLETE;case Tu.CANCELED:return mA.CANCELED;case Tu.EXPIRED:return mA.EXPIRED;case Tu.TRIALING:return mA.TRIALING;default:return mA.EXPIRED}}!function(e){e.STRIPE="Stripe"}(hA||(hA={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(mA||(mA={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(bA||(bA={}));const TA={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Tu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},PA=[{id:"prod_J60fUEvI7qV1eL",externalId:"prod_J60fUEvI7qV1eL",name:"Premium",description:"",price:{id:"price_1IToe8Ewsu4qiqnndAV76J69",externalId:"price_1IToe8Ewsu4qiqnndAV76J69",currency:"usd",amount:1e4},slug:"premium"},{id:"prod_J60duauCpXfcur",externalId:"prod_J60duauCpXfcur",name:"Free",description:"Totally free plan. Nothing to pay.",price:{id:"price_1ITocfEwsu4qiqnnnBHDx9fQ",externalId:"price_1ITocfEwsu4qiqnnnBHDx9fQ",currency:"usd",amount:0},slug:"free"}],IA=[{id:"in_1JbhYWEwsu4qiqnnrUh6hsHa",externalId:"in_1JbhYWEwsu4qiqnnrUh6hsHa",subscriptionId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",paymentDate:"2021-09-20T08:08:51.000Z",totalAmount:1e4,currency:"usd",paid:!0,receiptNumber:""},{id:"in_1JbhYWEwsu4qiqnnrUh6hsHa",externalId:"in_1JbhYWEwsu4qiqnnrUh6hsHa",subscriptionId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",paymentDate:"2021-08-20T08:08:51.000Z",totalAmount:1e4,currency:"usd",paid:!0,receiptNumber:""}],LA=[{id:"id",externalId:"externalId",type:Pu.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],OA={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*EA(){yield Vo(Cb.load,wA),yield Vo(Cb.cancelSubscription,DA),yield Vo(Cb.renewSubscription,RA)}function*wA(){const e=yield qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield $A(e)}function*CA(){yield ji(Cb.setLoading(!0));try{const[e]=yield Gi(ed.subscriptions.getManagedSubscriptions);yield ji(Cb.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield ji(Cb.setError(e))}}function*DA(){const{subscription:e}=yield qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ji(Cb.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ji(Cb.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Tu.ACTIVE)try{yield ji(Cb.setCancellationLoading(!0)),yield Gi(ed.subscriptions.cancelManagedSubscription,t),yield CA(),yield ji(Cb.setCancellationLoading(!1))}catch(e){yield ji(Cb.setCancellationError(e.message))}}function*RA(){const{subscription:e}=yield qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ji(Cb.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ji(Cb.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Iu.AT_PERIOD_END)try{yield ji(Cb.setRenewalLoading(!0)),yield Gi(ed.subscriptions.renewManagedSubscription,t),yield CA(),yield ji(Cb.setRenewalLoading(!1))}catch(e){yield ji(Cb.setCancellationError(e.message))}}function*_A(){yield ji(Cb.setLoading(!0)),yield Hi(500),yield ji(Cb.setState({subscription:TA,fetching:!1,loading:!1,error:null}))}function*UA(){yield Vo(Cb.load,_A)}function*MA(){yield Vo(Nb.loadBillingInformation,NA)}function*NA(){yield function*(e){const t=yield qi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield $A(n,!1):yield ji(Nb.setError(t?"Not authorized":"Internal feature failure"))}()}function*$A(e,t){yield ji(Nb.setLoading(!0));try{var n,i;const o=yield Gi(ed.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let l,s=null;r?l=yield Gi(ed.subscriptions.getSubscriptionPlan,a):([,l]=yield Wi([Gi(CA),Gi(ed.subscriptions.getSubscriptionPlan,a)]),s=yield qi((e=>e.subscriptions.billing.subscription.subscription||null))),yield ji(Nb.setState(I({loading:!1,fetching:!1,summary:o},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?mA.ACTIVE:kA(s.status),cancellation:s.cancellation&&AA(s.cancellation),trialEnd:s.trialEnd?s.trialEnd:null}}:{},l?{plan:{id:l.id,name:l.name,description:l.description,price:(null==(n=l.price)?void 0:n.amount)||0,currency:(null==(i=l.price)?void 0:i.currency)||"usd",recurringInterval:"month",slug:l.slug}}:{})))}catch(e){yield ji(Nb.setError(e.message))}}function*FA(){yield function*(){var e,t;yield ji(Nb.setLoading(!0)),yield Hi(500),yield ji(Nb.setState({loading:!1,fetching:!1,summary:{subscriptionId:TA.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Lu.Stripe,externallyManaged:!1,currentPlanId:PA[0].id,defaultPlanId:PA[0].id},plan:I({},PA[0],{price:null==(e=PA[0].price)?void 0:e.amount,currency:null==(t=PA[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*xA(){yield Vo(Nb.loadBillingInformation,FA)}function*VA(){yield Vo(Wb.loadPaymentMethod,jA),yield Vo(Wb.submitPaymentMethod,KA),yield Vo(Wb.submitPaymentMethodError,GA),yield Vo(Wb.submitPaymentMethodSuccess,BA),yield Vo(Wb.updatePaymentMethodBillingDetails,WA)}function*jA(){yield ji(Wb.setLoading(!0));try{const e=(yield Gi(ed.subscriptions.getPaymentMethods))[0];yield ji(Wb.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield ji(Wb.setError(e.message))}}function*WA({payload:e}){yield ji(Wb.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield Gi(ed.subscriptions.updatePaymentMethodBillingDetails,t,I({email:n},i)),yield Gi(jA),null==o||o(!0)}catch(e){yield ji(Wb.setError(e.message)),null==o||o(!1)}yield ji(Wb.setLoading(!1))}function*KA(){yield ji(Wb.setLoading(!0))}function*GA({payload:e}){yield ji(Wb.setError(e))}function*BA(){yield ji(Wb.loadPaymentMethod())}function*zA(){yield ji(Wb.setLoading(!0)),yield Hi(500);const e=LA[0];yield ji(Wb.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*qA(){yield Vo(Wb.loadPaymentMethod,zA)}function*HA(){yield Vo(Hb.loadInvoices,JA),yield Vo(Hb.downloadInvoice,YA)}function*JA(){yield ji(Hb.setLoading(!0));try{const e=(yield Gi(ed.subscriptions.getSubscriptionInvoices)).map((e=>({id:e.id,externalId:e.externalId,subscriptionId:e.subscriptionId,paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2),currency:e.currency||"usd",paid:e.paid||!1,receiptNumber:e.receiptNumber})));yield ji(Hb.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield ji(Hb.setError(e.message))}}function*YA({payload:e}){yield ji(Hb.setInvoiceDownloadState({loading:!0,error:null}));try{yield Gi(ed.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield ji(Hb.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield ji(Hb.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*QA(){yield ji(Hb.setLoading(!0)),yield Hi(500),yield ji(Hb.setState({loading:!1,fetching:!1,invoices:IA.map((e=>I({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield ji(Hb.setLoading(!1))}function*XA(){yield Vo(Hb.loadInvoices,QA)}function*ZA(){yield Wi([Gi(MA),Gi(VA),Gi(HA),Gi(EA)])}function*ek(){yield Wi([Gi(xA),Gi(qA),Gi(XA),Gi(UA)])}function*tk(){yield Vo(iA.loadCheckout,nk),yield Vo(iA.resetCheckout,ik),yield Vo(iA.submitCheckout,ok),yield Vo(iA.confirmCheckout,ak),yield Vo(iA.errorCheckout,lk)}function*nk(){yield ji(iA.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*ik(){yield ji(iA.setState({loading:!1,error:null,confirmed:!1}))}function*ok(){yield ji(iA.setState({loading:!0,error:null}))}function*ak({payload:{paymentMethodId:e,planId:t}}){const n=yield qi((e=>e.subscriptions.billing.subscription.subscription)),i=yield qi((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Tu.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield ji(iA.setState({loading:!0,error:null})),o&&a)return yield rk(),void(yield ji(Cb.setState({subscription:I({},n,{status:Tu.ACTIVE})})));try{yield Gi(ed.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Wi([NA(),jA(),JA()]),yield rk()}catch(e){yield ji(iA.setState({loading:!1,error:e.message}))}}else yield ji(iA.setState({loading:!1,error:"Subscription not found"}))}function*rk(){yield ji(iA.setState({loading:!1,error:null,confirmed:!0}))}function*lk({payload:e}){yield ji(iA.setState({loading:!1,error:e}))}function*sk(){yield Vo(iA.resetCheckout,ik)}function*ck(){yield Vo(hb.loadPlans,uk)}function*uk(){yield ji(hb.setLoading(!0));try{const e=(yield Gi(ed.subscriptions.getSubscriptionPlans)).map((e=>{var t,n;return{id:e.id,name:e.name,description:e.description,price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month",slug:e.slug}}));yield ji(hb.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield ji(hb.setError(e.message))}}function*dk(){yield ji(hb.setLoading(!0)),yield Hi(500),yield ji(hb.setState({fetching:!1,loading:!1,plans:PA.map((e=>{var t,n;return I({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*yk(){yield Vo(hb.loadPlans,dk)}function*fk(){yield Vo(Pb.loadPaymentConfiguration,gk)}function*gk(){yield ji(Pb.setLoading(!0));try{(yield Gi(ed.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Lu.Stripe))?yield function*(){yield ji(Pb.setLoading(!0));try{const e=yield Gi(ed.subscriptions.getStripePaymentProviderConfiguration);yield ji(Pb.setState({loading:!1,fetching:!1,config:{paymentProvider:hA.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield ji(Pb.setError(e.message))}}():yield ji(Pb.setError("Payment provider not configured"))}catch(e){yield ji(Pb.setError(e.message))}}function*pk(){yield ji(Pb.setLoading(!0)),yield Hi(500),yield ji(Pb.setState({loading:!1,fetching:!1,config:{paymentProvider:hA.STRIPE,apiKey:""}}))}function*Sk(){yield Vo(Pb.loadPaymentConfiguration,pk)}function*vk(){yield Vo(cA.createCardSetupIntentSecret,hk)}function*hk({payload:e}){yield ji(cA.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Gi(ed.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield ji(cA.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield ji(cA.setError(e.message))}}function*mk(){yield Vo(gA.loadVendorPublicConfiguration,bk)}function*bk(){yield ji(gA.setLoading(!0));try{const e=yield Gi(ed.subscriptions.getVendorPublicConfigurations);yield ji(gA.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield ji(gA.setError(e.message))}}function*Ak(){yield ji(gA.setLoading(!0)),yield Hi(500),yield ji(gA.setState({fetching:!1,loading:!1,vendorPublicConfig:OA}))}function*kk(){yield Vo(gA.loadVendorPublicConfiguration,Ak)}var Tk={sagas:function*(){yield Wi([Gi(ZA),Gi(tk),Gi(ck),Gi(fk),Gi(vk),Gi(mk)])},mockSagas:function*(){yield Wi([Gi(ek),Gi(sk),Gi(yk),Gi(Sk),Gi(kk)])},reducer:vA,actions:SA,initialState:pA,storeName:"subscriptions"},Pk={sagas:function*(){yield Vo(zd.loadVendorPublicInfo,qd)},storeName:It,initialState:Kd,reducer:Gd,actions:zd};const{reducer:Ik}=at({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Ko.setContext(t),I({},e,{context:t}))}}}),Lk=(e,t,n=!1,i,o,a=!1,r="path")=>{let l=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var s,c,u,d,y,f,g,p,S,v;n||a||Ko.setContext(e.context);const t=Do(),h=[...tt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=nt({middleware:h,preloadedState:{root:I({},e,{previewMode:n,urlStrategy:r}),[Jh.storeName]:I({},Jh.initialState,i,null!=(s=null==o?void 0:o.auth)?s:{},{routes:I({},Jh.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[Am.storeName]:I({},Am.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:I({},Am.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:I({},Am.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[Tm]:I({},km,null!=(v=null==o?void 0:o.audits)?v:{}),[cb.storeName]:cb.initialState,[Tk.storeName]:Tk.initialState,[Pk.storeName]:Pk.initialState},reducer:$e({root:Ik,[Jh.storeName]:Jh.reducer,[Am.storeName]:Am.reducer,[Tm]:Im,[cb.storeName]:cb.reducer,[Tk.storeName]:Tk.reducer,[Pk.storeName]:Pk.reducer})});const m=function*(){yield Wi([Gi(Jh.sagas),Gi(Am.sagas),Gi(Nm),Gi(cb.sagas),Gi(Tk.sagas),Gi(Pk.sagas)])},b=function*(){yield Wi([Gi(Jh.mockSagas),Gi(Am.mockSagas),Gi(Tk.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(Gn.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var Ok=n(714),Ek=n.n(Ok);function wk(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function Ck(e){if(e.type)return e;if("#"===e.charAt(0))return Ck(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const i=e.substring(t+1,e.length-1);let o,a;if("color"===n){if(a=i.split(" "),o=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(o))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+o)}else a=i.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:o}}function Dk(e){const{type:t,colorSpace:n}=e;let{values:i}=e;return-1!==t.indexOf("rgb")?i=i.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),i=-1!==t.indexOf("color")?`${n} ${i.join(" ")}`:`${i.join(", ")}`,`${t}(${i})`}function Rk(e){if(0===e.indexOf("#"))return e;const{values:t}=Ck(e);return`#${t.map(((e,t)=>function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(3===t?Math.round(255*e):e))).join("")}`}function _k(e,t){if(e=Ck(e),t=wk(t),-1!==e.type.indexOf("hsl"))e.values[2]*=1-t;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]*=1-t;return Dk(e)}function Uk(e,t){if(e=Ck(e),t=wk(t),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*t;else if(-1!==e.type.indexOf("rgb"))for(let n=0;n<3;n+=1)e.values[n]+=(255-e.values[n])*t;else if(-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]+=(1-e.values[n])*t;return Dk(e)}const Mk=e=>{if(e)return{main:e,light:Rk(Uk(e,.4)),dark:Rk(_k(e,.15)),hover:Rk(_k(e,.15)),active:Rk(_k(e,.2))}},Nk=e=>{if(e)return{main:e,light:Uk(e,.7),dark:_k(e,.2)}},$k=(e,t)=>{var n,i,o,a,r,l,s,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?I({},t,{palette:{primary:I({},Mk(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:I({},Mk(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(l=null==e||null==(s=e.palette)?void 0:s.secondaryText)?l:"#000000"}),danger:I({},Mk(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:I({},Nk(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:I({},Nk(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:I({},Nk(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:I({},Nk(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},Fk={},xk={},Vk={},jk={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},multipleSSO:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class Wk{constructor(){this._theme=Fk,this._themeV2=xk,this._navigation=jk,this._localizations=Vk}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Wk;return n.set(e),Wk._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}set(e){try{var t,n,i,o,a,r,l;this._navigation=Ek().all([null!=(t=jk)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=Ek().all([null!=(i=Fk)?i:{},$k(null==e?void 0:e.theme,Fk)]),this._themeV2=Ek().all([null!=(o=xk)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=Ek().all([null!=(r=Vk)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=jk,this._theme=Fk,this._themeV2=xk,this._localizations=Vk}}}Wk._instances={};var Kk={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","use-new-mfa-pages":"on"},Gk=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},Bk=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(t);return Object.keys(n).forEach((function(e){return i.setAttribute(e,n[e])})),e.appendChild(i),i},zk=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))};let qk,Hk,Jk,Yk,Qk,Xk,Zk,eT,tT,nT,iT;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(qk||(qk={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(Hk||(Hk={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(Jk||(Jk={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(Yk||(Yk={})),function(e){e.Invoices="invoices"}(Qk||(Qk={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(Xk||(Xk={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(Zk||(Zk={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(eT||(eT={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(tT||(tT={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(nT||(nT={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(iT||(iT={}));const oT={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},aT={hidden:"hidden",edit:"edit"};var rT="6.62.0",lT=function(){function e(t,n){var i,o,a,r,l=this,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];A(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(rT),this.customElementName="",this.adminPortalEl=void 0,this.adminPortalRenderer=void 0,this.loginBoxEl=void 0,this.checkoutDialogEl=void 0,this.checkoutDialogRenderer=void 0,this.adminPortalContainer=void 0,this.loginBoxContainer=void 0,this.checkoutDialogContainer=void 0,this.loginBoxRenderer=void 0,this.store=void 0,this.flags={},this.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=O(w().mark((function e(){var t,n,i,o,a;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Ho,l.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:a=e.sent,l.options.metadata=null!=(n=null==a||null==(i=a.rows)||null==(o=i[0])?void 0:o.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:Wk.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=O(w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l.options.hostedLoginBox||l.options.builderMode||"nextjs"===l.options.framework||l.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=O(w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l.options.previewMode&&!l.options.builderMode){e.next=4;break}l.flags=Kk,e.next=13;break;case 4:return e.prev=4,e.next=7,ju();case 7:l.flags=e.sent,e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 13:case"end":return e.stop()}}),e,null,[[4,10]])}))),this.updateLocalizationsSetter=function(e){l.updateLocalizations=e};var c=Gk(n),u="frontegg-app-".concat(c);this.iframeRendering=s,this.name=c,this.options=I({},t,{contextOptions:I({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=u;var d=this.options.authOptions?I({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};d.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.store=null!=(o=this.options.store)?o:Lk({context:this.options.contextOptions},this,this.options.previewMode,d,{auth:null!=(a=this.options.authOptions)?a:{},audits:null!=(r=this.options.auditsOptions)?r:{}},!1,this.options.urlStrategy),P.setInstance(c,this)}var t,n,i,o;return T(e,[{key:"initContainers",value:(o=O(w().mark((function e(t){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.adminPortalEl=t.adminPortalEl,this.loginBoxEl=t.loginBoxEl,this.checkoutDialogEl=t.checkoutDialogEl,this.adminPortalContainer=t.adminPortalContainer,this.loginBoxContainer=t.loginBoxContainer,this.checkoutDialogContainer=t.checkoutDialogContainer;try{"nextjs"!==this.options.framework&&document.body.classList.add("frontegg-loading")}catch(e){}return e.next=9,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;Wk.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:m,FronteggTypes:b})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=O(w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=O(w().mark((function e(){var t;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=O(w().mark((function e(t){var n;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,I({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),sT=function(){function e(){A(this,e)}return T(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=P.getInstance(i);e&&t?(Ko.setAccessToken(t),Ko.setUser(I({},n,{accessToken:t})),o.store.dispatch(Gn.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(Gn.loadTenants())):(Ko.setAccessToken(null),Ko.setUser(null),o.store.dispatch(Gn.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),cT=function(){function e(){A(this,e)}return T(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).hideAdminPortal()}}]),e}(),uT=function(){function e(){A(this,e)}return T(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";P.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).hideCheckoutDialog()}}]),e}(),dT=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},yT=function(){function e(t,n,i,o){A(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=i?i:Lk({context:a},this,!0,void 0,void 0,!0),this.options=I({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a},o),this.app=new lT(this.options,t,!0),Wk.set({},t)}var t;return T(e,[{key:"render",value:(t=O(w().mark((function e(t){var n,i,o,a,r=this;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,zk(this);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"setStaticRoute",value:function(e){var t;null==(t=this.setRoute)||t.call(this,e)}},{key:"unmount",value:function(){try{var e;null==(e=this.app.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin Portal renderer",e)}}},{key:"setTheme",value:function(e){var t;this.themeOptions=e,this.themeSetter||console.warn("this.themeSetter is not defined yet"),null==(t=this.themeSetter)||t.call(this,this.themeOptions)}}]),e}(),fT="modern",gT=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[fT]},pT=function(){function e(t,n,i,o){A(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=i?i:Lk({context:a},this,!0,void 0,void 0,!0),this.options=I({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a,onRedirectTo:function(){console.debug("path")}},o),this.app=new lT(this.options,t,!0),Wk.set({},t)}var t;return T(e,[{key:"render",value:(t=O(w().mark((function e(t){var n,i,o,a,r=this;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,zk(this);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"unmount",value:function(){try{var e;null==(e=this.app.loginBoxRenderer)||e.unmount()}catch(e){console.error("Failed to unmount login box renderer",e)}}},{key:"setTheme",value:function(e){var t;this.themeOptions=e,this.themeSetter||console.warn("this.themeSetter is not defined yet"),null==(t=this.themeSetter)||t.call(this,this.themeOptions)}},{key:"setStaticRoute",value:function(e){var t;this.setRoute||console.warn("this.setRoute is not defined yet"),null==(t=this.setRoute)||t.call(this,e)}},{key:"setStore",value:function(e){this.store.dispatch({type:"auth/setState",payload:e})}}]),e}();function ST(e,t){return ST=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ST(e,t)}function vT(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ST(e,t)}function hT(e){return hT="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hT(e)}function mT(e,t){if(t&&("object"===hT(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function bT(e){return bT=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},bT(e)}function AT(){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}}function kT(e,t,n){return kT=AT()?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&&ST(o,n.prototype),o},kT.apply(null,arguments)}function TT(e){var t="function"==typeof Map?new Map:void 0;return TT=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return kT(e,arguments,bT(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ST(n,e)},TT(e)}function PT(e){var t=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}}();return function(){var n,i=bT(e);if(t){var o=bT(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return mT(this,n)}}var IT=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new lT(e,t);if("undefined"!=typeof document){var i;if(!e.contextOptions.baseUrl){var o=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(o.message),o}if(!customElements.get("frontegg-app")){var a=function(e){vT(n,e);var t=PT(n);function n(){var e;A(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return(e=t.call.apply(t,[this].concat(o))).app=null,e}return T(n,[{key:"connectedCallback",value:function(){this.updateContent()}},{key:"attributeChangedCallback",value:function(e,t,n){if("app-name"===e){if(null===t)return;if(t===n)return;this.innerHTML="",null===n?this.remove():this.updateContent()}console.debug("attributeChangedCallback",e,t,n)}},{key:"updateContent",value:function(){var e,t=null!=(e=this.getAttribute("app-name"))?e:"default",n=P.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=Bk(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=Bk(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=Bk(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=i.attachShadow({mode:"open"}),l=o.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),c=Bk(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=Bk(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=Bk(s,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:i,loginBoxContainer:o,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(TT(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));