@frontegg/js 6.145.0 → 6.146.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +8 -8
- package/umd/frontegg.production.min.js +1 -1
- package/version.js +1 -1
|
@@ -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 o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map((function(e){return o(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||i,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=o;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var i={};return n.isMergeableObject(e)&&a(e).forEach((function(t){i[t]=o(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])?i[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):i[a]=o(t[a],n))})),i}(e,n,s):o(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},378:function(e){"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var o,i,a;if(Array.isArray(t)){if((o=t.length)!=n.length)return!1;for(i=o;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((o=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=o;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=o;0!=i--;){var r=a[i];if(!e(t[r],n[r]))return!1}return!0}return t!=t&&n!=n}},609:function(e,t,n){var o=n(425).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},s=l.iterator||"@@iterator",c=l.asyncIterator||"@@asyncIterator",u=l.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,o){var i=t&&t.prototype instanceof g?t:g,a=Object.create(i.prototype),l=new O(o||[]);return r(a,"_invoke",{value:E(e,n,l)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,s,(function(){return this}));var m=Object.getPrototypeOf,A=m&&m(m(_([])));A&&A!==n&&a.call(A,s)&&(h=A);var b=v.prototype=g.prototype=Object.create(h);function T(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(i,r,l,s){var c=f(e[i],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==o(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 i;r(this,"_invoke",{value:function(e,o){function a(){return new t((function(t,i){n(e,o,t,i)}))}return i=i?i.then(a,a):a()}})}function E(e,t,n){var o="suspendedStart";return function(i,a){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var r=n.delegate;if(r){var l=I(r,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var s=f(e,t,n);if("normal"===s.type){if(o=n.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o="completed",n.method="throw",n.arg=s.arg)}}}function I(e,t){var n=t.method,o=e.iterator[n];if(void 0===o)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=f(o,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}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 L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function _(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=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 o.next=o}}return{next:w}}function w(){return{value:void 0,done:!0}}return S.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},T(k.prototype),d(k.prototype,c,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,o,i,a){void 0===a&&(a=Promise);var r=new k(y(e,n,o,i),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},T(b),d(b,u,"Generator"),d(b,s,(function(){return this})),d(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=_,O.prototype={constructor:O,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(L),!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,o){return r.type="throw",r.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],r=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var r=i?i.completion:{};return r.type=e,r.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):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),p},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),L(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:_(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=i,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 o=n(609)();e.exports=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var a=t[o]={exports:{}};return e[o](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 o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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 o={};return function(){"use strict";n.r(o),n.d(o,{AdminPortal:function(){return qO},AdminPortalRenderer:function(){return QO},AppHolder:function(){return C},CheckoutDialog:function(){return YO},FronteggApp:function(){return HO},HostedLogin:function(){return zO},LoginBoxRenderer:function(){return e_},createElement:function(){return OO},defaultTheme:function(){return XO},formatName:function(){return LO},getThemeAdminByName:function(){return JO},getThemeByName:function(){return ZO},initialize:function(){return c_},mockFlagsList:function(){return KO},restoreSearchParams:function(){return wO},waitThemeSetter:function(){return _O}});var e={};n.r(e),n.d(e,{Delete:function(){return _r},Get:function(){return Ir},Patch:function(){return Lr},Post:function(){return Pr},PostDownload:function(){return wr},Put:function(){return Or},extractHeadersFromOptions:function(){return Cr},getBaseUrl:function(){return Tr},getMetadataHeaders:function(){return kr}});var t={};n.r(t),n.d(t,{getHierarchyMetadata:function(){return Vr},getParentTenants:function(){return Mr},getParentTenantsById:function(){return Fr},getSubTenants:function(){return Dr},getSubTenantsAsTree:function(){return Nr},getTenants:function(){return Rr},getTenantsUsersCount:function(){return Gr},searchSubTenants:function(){return $r},switchTenant:function(){return Ur}});var i={};n.r(i),n.d(i,{GetUserJwt:function(){return Al},getCurrentUserTenantsV3:function(){return Il},getUsersGroups:function(){return El},getUsersRoles:function(){return kl},getUsersV2:function(){return bl},getUsersV3:function(){return Tl},sendResetBreachedPasswordEmails:function(){return Pl},updateUserProfileV2:function(){return Ll}});var a={};n.r(a),n.d(a,{loadEntitlements:function(){return Ol}});var r={};n.r(r),n.d(r,{FeatureFlags:function(){return Ul},loadFeatureFlags:function(){return Rl}});var l={};n.r(l),n.d(l,{AuthStrategyEnum:function(){return ko},MachineToMachineAuthStrategy:function(){return Eo},OAuthLogout:function(){return ss},SocialLoginProviders:function(){return To},acceptInvitation:function(){return os},activateAccount:function(){return Xl},activateAccountV2:function(){return Zl},bulkCreateIPRestriction:function(){return ll},changePhoneNumber:function(){return du},changePhoneNumberWithVerification:function(){return cu},checkIfAllowToRememberMfaDevice:function(){return Rc},createDomainRestriction:function(){return tl},createIPRestriction:function(){return rl},createOrUpdateSessionConfigrations:function(){return vc},createSSOConfiguration:function(){return $c},createSSOConfigurationByMetadata:function(){return Bc},createSSOConfigurationByMetadataUrl:function(){return Wc},createSSODomain:function(){return Hc},createSSOGroup:function(){return Qc},createSamlGroup:function(){return tc},createTenantAccessToken:function(){return Ic},createUserAccessToken:function(){return Ec},deleteAllSessionsForUser:function(){return mc},deleteDomainRestriction:function(){return ol},deleteIPRestriction:function(){return cl},deleteSSOConfiguration:function(){return xc},deleteSSODomain:function(){return zc},deleteSSOGroup:function(){return Zc},deleteSamlGroup:function(){return oc},deleteSessionForUser:function(){return hc},deleteTenantAccessToken:function(){return Tc},deleteTenantApiToken:function(){return wc},deleteUserAccessToken:function(){return kc},deleteUserApiToken:function(){return Cc},deleteWebAuthnDevice:function(){return vu},disableMFAAuthenticatorApp:function(){return Ts},disableMFASMS:function(){return Es},disableMFAWebAuthn:function(){return Ps},disableMfa:function(){return bs},enrollMFAAuthenticatorApp:function(){return gs},enrollMFAAuthenticatorAppForLogin:function(){return _s},enrollMFAAuthenticatorAppForLoginV2:function(){return ws},enrollMFASMS:function(){return vs},enrollMFASMSForLogin:function(){return Ms},enrollMFASMSForLoginV2:function(){return Fs},enrollMFAWebAuthn:function(){return ms},enrollMFAWebAuthnForLogin:function(){return Bs},enrollMFAWebAuthnForLoginV2:function(){return js},enrollMfa:function(){return fs},exchangeOAuthTokens:function(){return au},exchangeOAuthTokensV2:function(){return ou},forgotPassword:function(){return cs},generateLoginResponse:function(){return Fl},generateLoginResponseFromOAuthResponse:function(){return Bl},generateLoginResponseFromOAuthResponseV2:function(){return jl},generateLoginResponseV2:function(){return Gl},generateLoginResponseV3:function(){return xl},getActivateAccountStrategy:function(){return es},getCaptchaPolicy:function(){return qr},getCurrentUserSession:function(){return pc},getCurrentUserSessions:function(){return fc},getCustomSocialLoginProvidersV1:function(){return cc},getDomainRestrictions:function(){return Zr},getDomainRestrictionsConfig:function(){return el},getGlobalSecurityPolicy:function(){return xr},getIPRestrictions:function(){return il},getIPRestrictionsConfig:function(){return al},getLockoutPolicy:function(){return Kr},getMFADevices:function(){return Ls},getMFAStrategiesConfig:function(){return bu},getMeAndEntitlements:function(){return Eu},getMeV2:function(){return ku},getMfaPolicy:function(){return Br},getOidcConfiguration:function(){return ic},getPasswordConfigPolicy:function(){return Xr},getPasswordHistoryPolicy:function(){return Yr},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return Au},getSSOConfigurations:function(){return Gc},getSSODefaultRoles:function(){return Yc},getSSOGroups:function(){return eu},getSSOPublicConfiguration:function(){return ac},getSamlConfiguration:function(){return zs},getSamlRoles:function(){return Xs},getSamlRolesGroups:function(){return Zs},getSamlVendorConfiguration:function(){return Ys},getSessionConfigurations:function(){return Sc},getSocialLoginProviders:function(){return rc},getSocialLoginProvidersV2:function(){return lc},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return sc},getTenantAccessTokensData:function(){return bc},getTenantApiTokensData:function(){return Lc},getUserAccessTokensData:function(){return Ac},getUserApiTokensData:function(){return Pc},getUserAuthorization:function(){return Tu},getUserById:function(){return Uc},getVendorConfig:function(){return dc},getVendorLockoutPolicy:function(){return Hr},getVendorMfaPolicy:function(){return jr},getVendorPasswordHistoryPolicy:function(){return Jr},getVendorPublicAuthStrategiesConfig:function(){return mu},getWebAuthnDevices:function(){return Su},loadPasswordConfig:function(){return ds},login:function(){return ql},loginViaSocialLogin:function(){return uc},loginWithMfa:function(){return Jl},loginWithMfaV2:function(){return Ql},loginv2:function(){return Yl},logout:function(){return ls},oidcPostLogin:function(){return zl},oidcPostLoginV2:function(){return nu},passwordlessPostLogin:function(){return Mc},passwordlessPostLoginV2:function(){return Nc},passwordlessPreLogin:function(){return Dc},postLogin:function(){return Hl},preDisableMFASMS:function(){return ks},preDisableMFAWebAuthn:function(){return Is},preEnrollMFAAuthenticatorApp:function(){return ps},preEnrollMFAAuthenticatorAppForLogin:function(){return Os},preEnrollMFASMS:function(){return Ss},preEnrollMFASMSForLogin:function(){return Ns},preEnrollMFAWebAuthn:function(){return hs},preEnrollMFAWebAuthnForLogin:function(){return xs},preLogin:function(){return Wl},preLoginV2:function(){return tu},preLoginWithIdpType:function(){return Kl},preVerifyMFAEmailCode:function(){return Us},preVerifyMFASMSForLogin:function(){return Gs},preVerifyMFAWebAuthnForLogin:function(){return Ws},recoverMfaToken:function(){return ys},refreshToken:function(){return is},refreshTokenV2:function(){return as},refreshTokenV3:function(){return rs},resendActivationEmail:function(){return ts},resendInvitationEmail:function(){return ns},resetPassword:function(){return us},resetPhoneNumber:function(){return lu},revokeSessionsForUser:function(){return gc},saveLockoutPolicy:function(){return zr},saveMfaPolicy:function(){return Wr},savePasswordHistoryPolicy:function(){return Qr},setSSODefaultRoles:function(){return Jc},signUpUser:function(){return yc},silentOAuthRefreshToken:function(){return ru},silentOAuthRefreshTokenV2:function(){return iu},testCurrentIp:function(){return ul},testCurrentIpInAllowList:function(){return dl},updateDomainRestrictionConfig:function(){return nl},updateIPRestrictionConfig:function(){return sl},updateSSOConfiguration:function(){return Vc},updateSSOConfigurationByMetadata:function(){return jc},updateSSOConfigurationByMetadataUrl:function(){return Kc},updateSSOGroup:function(){return Xc},updateSamlConfiguration:function(){return qs},updateSamlGroup:function(){return nc},updateSamlRoles:function(){return ec},updateSamlVendorMetadata:function(){return Js},updateTenantApiTokensData:function(){return _c},updateUserApiTokensData:function(){return Oc},validateSSODomain:function(){return qc},validateSamlDomain:function(){return Qs},verifyChangePhoneNumber:function(){return uu},verifyInviteToken:function(){return Fc},verifyMFAAuthenticatorAppForLogin:function(){return Cs},verifyMFAEmailCode:function(){return Rs},verifyMFAEmailCodeV2:function(){return Ds},verifyMFASMSForLogin:function(){return $s},verifyMFASMSForLoginV2:function(){return Vs},verifyMFAWebAuthnForLogin:function(){return Ks},verifyMFAWebAuthnForLoginV2:function(){return Hs},verifyMfa:function(){return As},verifyNewDeviceSession:function(){return hu},verifyResetPhoneNumber:function(){return su},webAuthnCreateNewDeviceSession:function(){return gu},webAuthnPostLogin:function(){return fu},webAuthnPostLoginV2:function(){return pu},webAuthnPreLogin:function(){return yu}});var s={};n.r(s),n.d(s,{addUser:function(){return wu},changePassword:function(){return Ou},createInviteUserLink:function(){return Ru},deleteInviteUserLink:function(){return Nu},deleteUser:function(){return Cu},getInviteLinkConfiguration:function(){return Fu},getInviteUserLink:function(){return Mu},getProfile:function(){return Iu},loadAvailablePermissions:function(){return $u},loadAvailableRoles:function(){return Gu},loadStats:function(){return Vu},loadUsers:function(){return _u},resendActivationLink:function(){return xu},resendInvitationLink:function(){return Bu},resendInvitationLinkToAllTenants:function(){return ju},updateInviteUserLink:function(){return Du},updateProfile:function(){return Pu},updateProfileImage:function(){return Lu},updateUser:function(){return Uu}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return Ku},getAuditsMetadata:function(){return Ju},getCurrentUserIpMetadata:function(){return zu},getIpAdressMetadata:function(){return Qu},getNotificationsMetadata:function(){return qu},getSamlMetadata:function(){return Yu},updateAdminBoxMetadata:function(){return Hu}});var u={};n.r(u),n.d(u,{downloadReport:function(){return ad},getReport:function(){return nd},getReports:function(){return td},renderReport:function(){return od},scheduleReport:function(){return id},sendReport:function(){return rd}});var d={};n.r(d),n.d(d,{getNotifications:function(){return ld},markAllAsRead:function(){return ud},updateNotificationIsPinned:function(){return cd},updateNotificationStatus:function(){return sd}});var y={};n.r(y),n.d(y,{exportAudits:function(){return pd},getAudits:function(){return yd},getAuditsStats:function(){return fd}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return Od},deleteEmailSubscriptions:function(){return Pd},deleteSMSConfiguration:function(){return Dd},deleteSMSSubscriptions:function(){return Ud},deleteSlackConfiguration:function(){return bd},deleteWebhooksConfiguration:function(){return Fd},getCategories:function(){return xd},getChannelMaps:function(){return Bd},getEmailConfiguration:function(){return kd},getSMSConfiguration:function(){return _d},getSlackChannels:function(){return md},getSlackConfiguration:function(){return vd},getSlackScope:function(){return hd},getWebhookLog:function(){return Gd},getWebhooksConfigurations:function(){return Nd},patchEmailConfiguration:function(){return Id},patchSMSConfiguration:function(){return Cd},postEmailConfiguration:function(){return Ed},postSMSConfiguration:function(){return wd},postSlackCode:function(){return Td},postSlackConfiguration:function(){return Ad},postWebhookRetry:function(){return Vd},postWebhookTest:function(){return $d},postWebhooksConfiguration:function(){return Md},putEmailSubscriptions:function(){return Ld},putSMSSubscriptions:function(){return Rd}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return Kd},getSettings:function(){return Wd},updateSettings:function(){return jd}});var g={};n.r(g),n.d(g,{addRole:function(){return Jd},attachPermissionToRoles:function(){return ty},attachPermissionsToRole:function(){return Zd},deleteRole:function(){return Qd},getPermissionCategories:function(){return ny},getPermissions:function(){return ey},getRoles:function(){return Yd},updateRole:function(){return Xd}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return Dy},ISubscriptionStatus:function(){return Uy},PaymentMethodType:function(){return Ry},ProviderType:function(){return Ny},TenantCreatedAction:function(){return Fy},TrialEndAction:function(){return My},cancelManagedSubscription:function(){return uy},cancelSubscription:function(){return ay},createStripeCustomer:function(){return Ey},createStripePaymentMethodSetupIntentSecret:function(){return Py},createSubscription:function(){return Ty},createTenantConfiguration:function(){return _y},getManagedSubscription:function(){return sy},getManagedSubscriptions:function(){return cy},getPaymentMethod:function(){return Ay},getPaymentMethods:function(){return my},getPaymentProviders:function(){return wy},getStripeCustomer:function(){return ky},getStripePaymentProviderConfiguration:function(){return Iy},getSubscription:function(){return iy},getSubscriptionInvoice:function(){return Sy},getSubscriptionInvoicePdf:function(){return vy},getSubscriptionInvoices:function(){return gy},getSubscriptionPlan:function(){return py},getSubscriptionPlans:function(){return fy},getSubscriptionSummaries:function(){return Ly},getSubscriptions:function(){return oy},getTenantConfiguration:function(){return Oy},getVendorPublicConfigurations:function(){return Cy},renewManagedSubscription:function(){return dy},renewSubscription:function(){return ry},updateManagedSubscription:function(){return yy},updatePaymentMethodBillingDetails:function(){return by},updateSubscription:function(){return ly}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return Gy}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return By},addUserToTenantAndSubTenants:function(){return Vy},addUsersToSubTenant:function(){return Yy},createSubTenant:function(){return Ky},deleteSubTenant:function(){return Hy},loadAllUsers:function(){return $y},removeUserFromTenantAndSubTenants:function(){return xy},removeUserRolesFromSubTenants:function(){return jy},setUserRolesForSubTenants:function(){return Wy},updateSubAccountAccess:function(){return qy},updateSubTenant:function(){return zy}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return ef},createConfiguration:function(){return Xy},deleteConfiguration:function(){return Zy},getConfigs:function(){return Jy},updateConfiguration:function(){return Qy}});var A={};n.r(A),n.d(A,{impersonate:function(){return tf}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return uf},addUsersToGroup:function(){return yf},createGroup:function(){return lf},deleteGroup:function(){return cf},deleteRolesFromGroup:function(){return df},deleteUsersFromGroup:function(){return ff},getGroupById:function(){return of},getGroupConfiguration:function(){return pf},getGroups:function(){return af},getGroupsByIds:function(){return rf},updateGroup:function(){return sf},updateGroupConfiguration:function(){return gf}});var T={};n.r(T),n.d(T,{getInsights:function(){return vf},getRecommendations:function(){return Sf}});var k={};n.r(k),n.d(k,{createPhoneNumber:function(){return mf},deletePhoneNumber:function(){return Af},getUserPhoneNumbers:function(){return hf},preVerifyPhoneNumber:function(){return bf},verifyDeletePhoneNumber:function(){return kf},verifyPhoneNumber:function(){return Tf}});var E={};n.r(E),n.d(E,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return wl},AuthStrategyEnum:function(){return ko},ContextHolder:function(){return Na},FeatureFlags:function(){return Ul},FronteggApiError:function(){return Fa},FronteggContext:function(){return Ma},FronteggFrameworks:function(){return so},GetUsersFilterPreset:function(){return yo},GroupManagedByEnum:function(){return Nf},GroupRelations:function(){return Df},ISubscriptionCancellationPolicy:function(){return Dy},ISubscriptionStatus:function(){return Uy},InsightCode:function(){return Ff},LOAD_AUTHORIZATION_FF:function(){return ml},MFAStrategyEnum:function(){return hl},MachineToMachineAuthStrategy:function(){return Eo},NotEntitledJustification:function(){return _l},PaginationOrderEnum:function(){return co},PaymentMethodType:function(){return Ry},ProviderType:function(){return Ny},RecommendationActionKey:function(){return Gf},RecommendationCode:function(){return Mf},RecommendationSeverity:function(){return $f},RequestSource:function(){return lo},RestrictionType:function(){return Bn},ScimConnectionSource:function(){return Rf},SecondaryAuthStrategy:function(){return Sl},SecurityCategory:function(){return Vf},SocialLoginProviders:function(){return To},SortByEnum:function(){return uo},TenantSortByEnum:function(){return If},TenantType:function(){return Pf},UserManagedByEnum:function(){return Ef},WebAuthnDeviceType:function(){return vl},api:function(){return xf},countConfigurationUsers:function(){return ef},createConfiguration:function(){return Xy},default:function(){return Bf},deleteConfiguration:function(){return Zy},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Lf},fronteggHeaders:function(){return ro},fronteggRefreshTokenUrl:function(){return Of},fronteggSilentRefreshTokenUrl:function(){return _f},fronteggTenantsUrl:function(){return Cf},fronteggTenantsV3Url:function(){return Uf},fronteggUsersUrl:function(){return wf},getConfigs:function(){return Jy},loadFeatureFlags:function(){return Rl},providersArray:function(){return fo},updateConfiguration:function(){return Qy}});var I={};function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e){return L="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},L(e)}function O(e){var t=function(e,t){if("object"!==L(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!==L(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===L(t)?t:String(t)}function _(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,O(o.key),o)}}function w(e,t,n){return t&&_(e.prototype,t),n&&_(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(I),n.d(I,{AccountDetailsPageTabs:function(){return xO},AccountPageFields:function(){return DO},DomainRestrictionsTabFields:function(){return VO},GeneralSettingsTabFields:function(){return GO},InviteUserModalFields:function(){return RO},IpRestrictionsTabFields:function(){return $O},Metadata:function(){return PO},PrivacyPageFields:function(){return UO},ProfilePageFields:function(){return CO},SecurityPageTabs:function(){return MO},SessionManagementTabFields:function(){return FO},SubscriptionsPageFields:function(){return NO},alpha:function(){return mO},fieldAppearance:function(){return BO},tabAppearance:function(){return jO}});var C=function(){function e(){P(this,e)}return w(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 U(){return U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},U.apply(this,arguments)}function R(e,t,n,o,i,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(o,i)}function D(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function r(e){R(a,o,i,r,l,"next",e)}function l(e){R(a,o,i,r,l,"throw",e)}r(void 0)}))}}C._apps={};var N=n(841),M=n.n(N);function F(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];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 G(e){return!!e&&!!e[Ee]}function $(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)===Ie}(e)||Array.isArray(e)||!!e[ke]||!!e.constructor[ke]||K(e)||H(e))}function V(e,t,n){void 0===n&&(n=!1),0===x(e)?(n?Object.keys:Pe)(e).forEach((function(o){n&&"symbol"==typeof o||t(o,e[o],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function x(e){var t=e[Ee];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:K(e)?2:H(e)?3:0}function B(e,t){return 2===x(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function j(e,t,n){var o=x(e);2===o?e.set(t,n):3===o?(e.delete(t),e.add(n)):e[t]=n}function W(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function K(e){return me&&e instanceof Map}function H(e){return Ae&&e instanceof Set}function z(e){return e.o||e.t}function q(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Le(e);delete t[Ee];for(var n=Pe(t),o=0;o<n.length;o++){var i=n[o],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function Y(e,t){return void 0===t&&(t=!1),Q(e)||G(e)||!$(e)||(x(e)>1&&(e.set=e.add=e.clear=e.delete=J),Object.freeze(e),t&&V(e,(function(e,t){return Y(t,!0)}),!0)),e}function J(){F(2)}function Q(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function X(e){var t=Oe[e];return t||F(18,e),t}function Z(){return ve}function ee(e,t){t&&(X("Patches"),e.u=[],e.s=[],e.v=t)}function te(e){ne(e),e.p.forEach(ie),e.p=null}function ne(e){e===ve&&(ve=e.l)}function oe(e){return ve={p:[],l:ve,h:e,m:!0,_:0}}function ie(e){var t=e[Ee];0===t.i||1===t.i?t.j():t.O=!0}function ae(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.g||X("ES5").S(t,e,o),o?(n[Ee].P&&(te(t),F(4)),$(e)&&(e=re(t,e),t.l||se(t,e)),t.u&&X("Patches").M(n[Ee].t,e,t.u,t.s)):e=re(t,n,[]),te(t),t.u&&t.v(t.u,t.s),e!==Te?e:void 0}function re(e,t,n){if(Q(t))return t;var o=t[Ee];if(!o)return V(t,(function(i,a){return le(e,o,t,i,a,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return se(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var i=4===o.i||5===o.i?o.o=q(o.k):o.o;V(3===o.i?new Set(i):i,(function(t,a){return le(e,o,i,t,a,n)})),se(e,i,!1),n&&e.u&&X("Patches").R(o,n,e.u,e.s)}return o.o}function le(e,t,n,o,i,a){if(G(i)){var r=re(e,i,a&&t&&3!==t.i&&!B(t.D,o)?a.concat(o):void 0);if(j(n,o,r),!G(r))return;e.m=!1}if($(i)&&!Q(i)){if(!e.h.F&&e._<1)return;re(e,i),t&&t.A.l||se(e,i)}}function se(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&Y(t,n)}function ce(e,t){var n=e[Ee];return(n?z(n):e)[t]}function ue(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Object.getPrototypeOf(n)}}function de(e){e.P||(e.P=!0,e.l&&de(e.l))}function ye(e){e.o||(e.o=q(e.t))}function fe(e,t,n){var o=K(t)?X("MapSet").N(t,n):H(t)?X("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),o={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},i=o,a=_e;n&&(i=[o],a=we);var r=Proxy.revocable(i,a),l=r.revoke,s=r.proxy;return o.k=s,o.j=l,s}(t,n):X("ES5").J(t,n);return(n?n.A:Z()).p.push(o),o}function pe(e){return G(e)||F(22,e),function e(t){if(!$(t))return t;var n,o=t[Ee],i=x(t);if(o){if(!o.P&&(o.i<4||!X("ES5").K(o)))return o.t;o.I=!0,n=ge(t,i),o.I=!1}else n=ge(t,i);return V(n,(function(t,i){o&&function(e,t){return 2===x(e)?e.get(t):e[t]}(o.t,t)===i||j(n,t,e(i))})),3===i?new Set(n):n}(e)}function ge(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return q(e)}var Se,ve,he="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),me="undefined"!=typeof Map,Ae="undefined"!=typeof Set,be="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Te=he?Symbol.for("immer-nothing"):((Se={})["immer-nothing"]=!0,Se),ke=he?Symbol.for("immer-draftable"):"__$immer_draftable",Ee=he?Symbol.for("immer-state"):"__$immer_state",Ie=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Pe="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Le=Object.getOwnPropertyDescriptors||function(e){var t={};return Pe(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Oe={},_e={get:function(e,t){if(t===Ee)return e;var n=z(e);if(!B(n,t))return function(e,t,n){var o,i=ue(t,n);return i?"value"in i?i.value:null===(o=i.get)||void 0===o?void 0:o.call(e.k):void 0}(e,n,t);var o=n[t];return e.I||!$(o)?o:o===ce(e.t,t)?(ye(e),e.o[t]=fe(e.A.h,o,e)):o},has:function(e,t){return t in z(e)},ownKeys:function(e){return Reflect.ownKeys(z(e))},set:function(e,t,n){var o=ue(z(e),t);if(null==o?void 0:o.set)return o.set.call(e.k,n),!0;if(!e.P){var i=ce(z(e),t),a=null==i?void 0:i[Ee];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(W(n,i)&&(void 0!==n||B(e.t,t)))return!0;ye(e),de(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!==ce(e.t,t)||t in e.t?(e.D[t]=!1,ye(e),de(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=z(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty:function(){F(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){F(12)}},we={};V(_e,(function(e,t){we[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),we.deleteProperty=function(e,t){return we.set.call(this,e,t,void 0)},we.set=function(e,t,n){return _e.set.call(this,e[0],t,n,e[0])};var Ce=function(){function e(e){var t=this;this.g=be,this.F=!0,this.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=i);for(var o=arguments.length,r=Array(o>1?o-1:0),l=1;l<o;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var o;return(o=n).call.apply(o,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&F(6),void 0!==o&&"function"!=typeof o&&F(7),$(e)){var l=oe(t),s=fe(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?te(l):ne(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return ee(l,o),ae(e,l)}),(function(e){throw te(l),e})):(ee(l,o),ae(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===Te&&(r=void 0),t.F&&Y(r,!0),o){var u=[],d=[];X("Patches").M(e,r,u,d),o(u,d)}return r}F(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))};var o,i,a=t.produce(e,n,(function(e,t){o=e,i=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,o,i]})):[a,o,i]},"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){$(e)||F(8),G(e)&&(e=pe(e));var t=oe(this),n=fe(this,e,void 0);return n[Ee].C=!0,ne(t),n},t.finishDraft=function(e,t){var n=(e&&e[Ee]).A;return ee(n,t),ae(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!be&&F(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));var i=X("Patches").$;return G(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Ue=new Ce,Re=Ue.produce,De=(Ue.produceWithPatches.bind(Ue),Ue.setAutoFreeze.bind(Ue),Ue.setUseProxies.bind(Ue),Ue.applyPatches.bind(Ue),Ue.createDraft.bind(Ue),Ue.finishDraft.bind(Ue),Re);function Ne(e,t,n){return(t=O(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(n),!0).forEach((function(t){Ne(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ge(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 $e="function"==typeof Symbol&&Symbol.observable||"@@observable",Ve=function(){return Math.random().toString(36).substring(7).split("").join(".")},xe={INIT:"@@redux/INIT"+Ve(),REPLACE:"@@redux/REPLACE"+Ve(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ve()}};function Be(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 je(e,t,n){var o;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ge(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ge(1));return n(je)(e,t)}if("function"!=typeof e)throw new Error(Ge(2));var i=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(Ge(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ge(4));if(s)throw new Error(Ge(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(Ge(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Be(e))throw new Error(Ge(7));if(void 0===e.type)throw new Error(Ge(8));if(s)throw new Error(Ge(9));try{s=!0,a=i(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(Ge(10));i=e,y({type:xe.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ge(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[$e]=function(){return this},e}return y({type:xe.INIT}),(o={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[$e]=p,o}function We(e){for(var t=Object.keys(e),n={},o=0;o<t.length;o++){var i=t[o];"function"==typeof e[i]&&(n[i]=e[i])}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:xe.INIT}))throw new Error(Ge(12));if(void 0===n(void 0,{type:xe.PROBE_UNKNOWN_ACTION()}))throw new Error(Ge(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var o=!1,i={},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(Ge(14));i[s]=d,o=o||d!==u}return(o=o||r.length!==Object.keys(e).length)?i:e}}function Ke(){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 He(){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),o=function(){throw new Error(Ge(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return o=Ke.apply(void 0,a)(n.dispatch),Fe(Fe({},n),{},{dispatch:o})}}}function ze(e){return function(t){var n=t.dispatch,o=t.getState;return function(t){return function(i){return"function"==typeof i?i(n,o,e):t(i)}}}}var qe=ze();qe.withExtraArgument=ze;var Ye,Je=qe,Qe=(Ye=function(e,t){return Ye=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])},Ye(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}Ye(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Xe=function(e,t){for(var n=0,o=t.length,i=e.length;n<o;n++,i++)e[i]=t[n];return e},Ze=Object.defineProperty,et=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),tt=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable,ot=function(e,t,n){return t in e?Ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},it=function(e,t){for(var n in t||(t={}))tt.call(t,n)&&ot(e,n,t[n]);if(et)for(var o=0,i=et(t);o<i.length;o++)n=i[o],nt.call(t,n)&&ot(e,n,t[n]);return e},at="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Ke:Ke.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var rt=function(e){function t(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=e.apply(this,n)||this;return Object.setPrototypeOf(i,t.prototype),i}return Qe(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,Xe([void 0],e[0].concat(this)))):new(t.bind.apply(t,Xe([void 0],e.concat(this))))},t}(Array);function lt(e){return $(e)?De(e,(function(){})):e}function st(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,o=(e.immutableCheck,e.serializableCheck,new rt);return n&&(function(e){return"boolean"==typeof e}(n)?o.push(Je):o.push(Je.withExtraArgument(n.extraArgument))),o}function ct(e){var t,n=function(e){return st(e)},o=e||{},i=o.reducer,a=void 0===i?void 0:i,r=o.middleware,l=void 0===r?n():r,s=o.devTools,c=void 0===s||s,u=o.preloadedState,d=void 0===u?void 0:u,y=o.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=We(a)}var p=l;"function"==typeof p&&(p=p(n));var g=He.apply(void 0,p),S=Ke;c&&(S=at(it({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=Xe([g],f):"function"==typeof f&&(v=f(v)),je(t,d,S.apply(void 0,v))}function ut(e,t){function n(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(t){var i=t.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return it(it({type:e,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.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 dt(e){var t,n={},o=[],i={addCase:function(e,t){var o="string"==typeof e?e:e.type;if(o in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[o]=t,i},addMatcher:function(e,t){return o.push({matcher:e,reducer:t}),i},addDefaultCase:function(e){return t=e,i}};return e(i),[n,o,t]}function yt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,o="function"==typeof e.initialState?e.initialState:lt(e.initialState),i=e.reducers||{},a=Object.keys(i),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?dt(e.extraReducers):[e.extraReducers],n=t[0],i=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=it(it({},i),l);return function(e,t,n,o){void 0===n&&(n=[]);var i,a="function"==typeof t?dt(t):[t,n,o],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))i=function(){return lt(e())};else{var c=lt(e);i=function(){return c}}function u(e,t){void 0===e&&(e=i());var n=Xe([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 o;if(G(e))return void 0===(o=n(e,t))?e:o;if($(e))return De(e,(function(e){return n(e,t)}));if(void 0===(o=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return o}return e}),e)}return u.getInitialState=i,u}(o,u,r,c)}return a.forEach((function(e){var n,o,a=i[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,o=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=o?ut(c,o):ut(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 ft="listenerMiddleware";ut(ft+"/add"),ut(ft+"/removeAll"),ut(ft+"/remove"),function(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Ee];return _e.get(t,e)},set:function(t){var n=this[Ee];_e.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][Ee];if(!i.P)switch(i.i){case 5:o(i)&&de(i);break;case 4:n(i)&&de(i)}}}function n(e){for(var t=e.t,n=e.k,o=Pe(n),i=o.length-1;i>=0;i--){var a=o[i];if(a!==Ee){var r=t[a];if(void 0===r&&!B(t,a))return!0;var l=n[a],s=l&&l[Ee];if(s?s.t!==r:!W(l,r))return!0}}var c=!!t[Ee];return o.length!==Pe(t).length+(c?0:1)}function o(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 o=0;o<t.length;o++)if(!t.hasOwnProperty(o))return!0;return!1}var i={};!function(e,t){Oe[e]||(Oe[e]=t)}("ES5",{J:function(t,n){var o=Array.isArray(t),i=function(t,n){if(t){for(var o=Array(n.length),i=0;i<n.length;i++)Object.defineProperty(o,""+i,e(i,!0));return o}var a=Le(n);delete a[Ee];for(var r=Pe(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)}(o,t),a={i:o?5:4,A:n?n.A:Z(),P:!1,I:!1,D:{},l:n,t:t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,Ee,{value:a,writable:!0}),i},S:function(e,n,i){i?G(n)&&n[Ee].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Ee];if(n){var i=n.t,a=n.k,r=n.D,l=n.i;if(4===l)V(a,(function(t){t!==Ee&&(void 0!==i[t]||B(i,t)?r[t]||e(a[t]):(r[t]=!0,de(n)))})),V(i,(function(e){void 0!==a[e]||B(a,e)||(r[e]=!1,de(n))}));else if(5===l){if(o(n)&&(de(n),r.length=!0),a.length<i.length)for(var s=a.length;s<i.length;s++)r[s]=!1;else for(var c=i.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,i.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):o(e)}})}();const pt=(e,t)=>n=>U({},n,{[e]:t[e]}),gt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),St=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:o})=>{var i;return U({},n,{[e]:U({},n[e],{[t]:U({},null==n||null==(i=n[e])?void 0:i[t],o)})})}}),vt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o,i;return U({},t,{[e]:U({},t[e],{loaders:U({},null==(o=t[e])?void 0:o.loaders,{[n.key]:null==(i=n.value)||i})})})}}),ht=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o;return U({},t,{[e]:U({},t[e],{errors:U({},t[e].errors,{[n.key]:null==(o=n.value)||o})})})}}),mt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(o,{payload:i})=>{var a;return U({},o,{[e]:U({},o[e],{[t]:U({},null==o||null==(a=o[e])?void 0:a[t],i,n)})})}}),At=(e,t,n)=>o=>{var i;return U({},o,{[e]:U({},o[e],{[t]:U({},null==o||null==(i=o[e])?void 0:i[t],n)})})},bt=(e=500)=>new Promise((t=>setTimeout(t,e))),Tt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",kt=new Uint8Array(256);for(let e=0;e<Tt.length;e++)kt[Tt.charCodeAt(e)]=e;const Et=e=>{const t=.75*e.length,n=e.length;let o,i,a,r,l,s=0;const c=new Uint8Array(t);for(o=0;o<n;o+=4)i=kt[e.charCodeAt(o)],a=kt[e.charCodeAt(o+1)],r=kt[e.charCodeAt(o+2)],l=kt[e.charCodeAt(o+3)],c[s++]=i<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},It=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(It(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let o,i="";for(o=0;o<n;o+=3)i+=Tt[t[o]>>2],i+=Tt[(3&t[o])<<4|t[o+1]>>4],i+=Tt[(15&t[o+1])<<2|t[o+2]>>6],i+=Tt[63&t[o+2]];return n%3==2?i=i.substring(0,i.length-1):n%3==1&&(i=i.substring(0,i.length-2)),i})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=It(e[n]);return t}return e};let Pt,Lt,Ot;!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",e.promptPasskeys="promptPasskeys",e.breachedPassword="breachedPassword",e.breachedPasswordSuccess="breachedPasswordSuccess"}(Pt||(Pt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Lt||(Lt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Ot||(Ot={}));const _t="FRONTEGG_AFTER_AUTH_REDIRECT_URL",wt="HOSTED_LOGIN_VERIFIER_KEY",Ct="auth",Ut="connectivity",Rt="auditLogs",Dt="vendor",Nt={flow:Lt.Login,step:Pt.preLogin,loading:!1,email:"",tenants:[]},Mt={setLoginState:gt("loginState"),resetLoginState:pt("loginState",{loginState:Nt})},Ft={requestAuthorize:ut("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:ut("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:ut("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),requestHostedLoginAuthorizeV2:ut("auth/requestHostedLoginAuthorizeV2",(e=>({payload:e}))),handleHostedLoginCallback:ut("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:ut("auth/afterAuthNavigation"),preLogin:ut("auth/preLogin",(e=>({payload:e}))),postLogin:ut("auth/postLogin",(e=>({payload:e}))),login:ut("auth/login",(e=>({payload:e}))),loginWithMfa:ut("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:ut("auth/recoverMfa",(e=>({payload:e}))),logout:ut("auth/logout",(e=>({payload:e}))),silentLogout:ut("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:ut("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:ut("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:ut("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:ut("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:ut("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:ut("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:ut("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:ut("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:ut("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:ut("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:ut("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:ut("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:ut("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:ut("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:ut("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:ut("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:ut("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:ut("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:ut("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:ut("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:ut("auth/verifyMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAEmailCode:ut("auth/preVerifyMFAEmailCode",(e=>({payload:e}))),verifyMFAEmailCode:ut("auth/verifyMFAEmailCode",(e=>({payload:e}))),resetBreachedPassword:ut("auth/resetBreachedPassword",(e=>({payload:e})))};let Gt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Gt||(Gt={}));const $t={step:Gt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Vt={setActivateState:gt("activateState"),resetActivateState:pt("activateState",{activateState:$t}),setActivateStrategyState:St("activateState","activationStrategy")},xt={activateAccount:ut("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:ut("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:ut("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:ut("auth/resendActivationEmail",(e=>({payload:e})))};let Bt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Bt||(Bt={}));const jt={step:Bt.validate},Wt={setAcceptInvitationState:gt("acceptInvitationState"),resetAcceptInvitationState:pt("acceptInvitationState",{acceptInvitationState:jt})},Kt={acceptInvitation:ut("auth/acceptInvitation",(e=>({payload:e})))};let Ht;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Ht||(Ht={}));const zt={step:Ht.forgotPassword,loading:!1,email:"",passwordConfig:null},qt={setForgotPasswordState:gt("forgotPasswordState"),resetForgotPasswordState:pt("forgotPasswordState",{forgotPasswordState:zt})},Yt={forgotPassword:ut("auth/forgotPassword",(e=>({payload:e}))),resetPassword:ut("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:ut("auth/loadPasswordConfig",(e=>({payload:e})))};let Jt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Jt||(Jt={}));const Qt={step:Jt.ResetPhoneNumber,loading:!1},Xt={setResetPhoneNumberState:gt("resetPhoneNumberState"),resetResetPhoneNumberState:pt("resetPhoneNumberState",{resetPhoneNumberState:Qt})},Zt={resetPhoneNumber:ut("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:ut("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:ut("auth/changePhoneNumber",(e=>({payload:e})))},en={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},tn={setSSOLoader:vt("ssoState"),setSSOError:ht("ssoState"),setSSOState:gt("ssoState"),resetSSOState:pt("ssoState",{ssoState:en})},nn={loadSSOConfigurationsV2:ut("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:ut("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:ut("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:ut("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:ut("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:ut("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:ut("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:ut("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:ut("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:ut("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:ut("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:ut("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:ut("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:ut("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:ut("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:ut("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:ut("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:ut("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:ut("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:ut("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:ut("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:ut("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:ut("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:ut("auth/oidcPostlogin",(e=>({payload:e})))},on={loading:!1,error:null},an={setProfileState:gt("profileState"),resetProfileState:pt("profileState",{profileState:on})},rn={loadProfile:ut("auth/loadProfile"),saveProfile:ut("auth/saveProfile",(e=>({payload:e}))),changePassword:ut("auth/changePassword",(e=>({payload:e})))};let ln;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode"}(ln||(ln={}));const sn={step:ln.verify,loading:!1,saving:!1},cn={setMfaState:gt("mfaState"),resetMfaState:pt("mfaState",{mfaState:sn})},un={enrollMfa:ut("auth/enrollMfa"),getMFADevices:ut("auth/getMFADevices"),getMFAStrategies:ut("auth/getMFAStrategies"),verifyMfa:ut("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:ut("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:ut("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:ut("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:ut("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:ut("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:ut("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:ut("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:ut("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:ut("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:ut("auth/disableMfaWebAuthn",(e=>({payload:e})))},dn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,shouldShowSubTenantUsersIfReseller:!1,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}},yn={setTeamLoader:vt("teamState"),setTeamError:ht("teamState"),setTeamState:gt("teamState"),resetTeamState:pt("teamState",{teamState:dn})},fn={loadUsersV2:ut("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:ut("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:ut("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:ut("auth/loadRoles",(e=>({payload:e}))),addUser:ut("auth/addUser",(e=>({payload:e}))),addUsersBulk:ut("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:ut("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:ut("auth/updateUser",(e=>({payload:e}))),deleteUser:ut("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:ut("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:ut("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:ut("auth/lockUser",(e=>({payload:e}))),resendActivationLink:ut("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:ut("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:ut("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:ut("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:ut("auth/getInvitationLink"),createInvitationLink:ut("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:ut("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:ut("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:ut("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:ut("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:ut("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:ut("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:ut("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:ut("auth/closeLockUserDialog",(e=>({payload:e})))},pn={firstLoad:!0,loading:!1,error:""},gn={setSocialLoginsState:gt("socialLoginState"),resetSocialLoginsState:pt("socialLoginState",{socialLoginState:pn})},Sn={loadSocialLoginsConfiguration:ut("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:ut("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:ut("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:ut("auth/setSocialLoginError",(e=>({payload:e})))};let vn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(vn||(vn={}));const hn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:vn.SignUp},mn={setSignUpState:gt("signUpState"),resetSignUpState:pt("signUpState",{signUpState:hn})},An={signUpUser:ut("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:ut("auth/resetSignUpStateSoft")},bn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},Tn={setApiTokensLoader:vt("apiTokensState"),setApiTokensError:ht("apiTokensState"),setApiTokensState:gt("apiTokensState"),resetApiTokensState:pt("apiTokensState",{apiTokensState:bn})},kn={loadApiTokens:ut("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:ut("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:ut("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:ut("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:ut("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:ut("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:ut("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:ut("auth/deleteTenantApiToken",(e=>({payload:e})))},En={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},In={setSecurityPolicyState:gt("securityPolicyState"),setSecurityPolicyGlobalState:St("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:St("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:St("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:St("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:St("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:St("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:St("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:St("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:St("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:St("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:St("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:pt("securityPolicyState",{securityPolicyState:En})},Pn={loadSecurityPolicy:ut("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:ut("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:ut("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:ut("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:ut("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:ut("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:ut("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:ut("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:ut("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:ut("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:ut("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:ut("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:ut("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:ut("auth/loadPublicAuthStrategiesPolicy")},Ln={loading:!1},On={setAccountSettingsState:gt("accountSettingsState"),resetAccountSettingsState:pt("accountSettingsState",{accountSettingsState:Ln})},_n={loadAccountSettings:ut("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:ut("auth/saveAccountSettings",(e=>({payload:e})))},wn={tenants:[],subTenants:[],loading:!0,tenantTree:null},Cn={setTenantsState:gt("tenantsState"),resetTenantsState:pt("tenantsState",{tenantsState:wn})},Un={switchTenant:ut("auth/switchTenant",(e=>({payload:e}))),loadTenants:ut("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:ut("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:ut("auth/loadSubTenantsTree",(e=>({payload:e})))},Rn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Dn={setRolesState:gt("rolesState"),resetRolesState:pt("rolesState",{rolesState:Rn})},Nn={loadRolesAndPermissions:ut("auth/loadRoles",(e=>({payload:e}))),addRole:ut("auth/addRole",(e=>({payload:e}))),updateRole:ut("auth/updateRole",(e=>({payload:e}))),deleteRole:ut("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:ut("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:ut("auth/attachPermissionToRoles",(e=>({payload:e})))},Mn={loading:!1,sessions:[]},Fn={setSessionsState:gt("sessionsState"),resetSessionsState:pt("sessionsState",{sessionsState:Mn})},Gn={loadUserSessions:ut("auth/loadUserSessions"),loadCurrentUserSession:ut("auth/loadCurrentUserSession"),deleteUserSession:ut("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:ut("auth/deleteAllUserSessions"),revokeUserSessions:ut("auth/revokeUserSessions",(e=>({payload:e})))},$n={loading:!1,configurations:{}},Vn={setSessionsPolicyState:gt("sessionsPolicyState"),resetSessionsPolicyState:pt("sessionsPolicyState",{sessionsPolicyState:$n})},xn={loadSessionsPolicy:ut("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:ut("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Bn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Bn||(Bn={}));const jn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Bn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Wn={setRestrictionsState:gt("restrictionsState"),setIpRestrictionsState:St("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:St("restrictionsState","emailDomainRestrictions")},Kn={checkIfUserIpValid:ut("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:ut("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:ut("auth/loadIpRestrictions"),saveIpRestriction:ut("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:ut("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:ut("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:ut("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:ut("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:ut("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:ut("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Hn={loading:!1},zn={setProvisioningState:gt("provisioningState"),resetProvisioningState:pt("provisioningState",{provisioningState:Hn})},qn={loadProvisionConnections:ut("auth/loadProvisionConnections"),createProvisionConnection:ut("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:ut("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:ut("auth/updateProvisionConnection",(e=>({payload:e})))},Yn={devices:[],loading:!1,error:null},Jn={setPasskeysState:gt("passkeysState"),resetPasskeysState:pt("passkeysState",{passkeysState:Yn})},Qn={loadWebAuthnDevices:ut("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:ut("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Xn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Zn={setUsersGroupsLoader:vt("groupsState"),setUsersGroupsError:ht("groupsState"),setGroupsState:gt("groupsState"),resetUsersGroupsState:pt("groupsState",{groupsState:Xn})},eo={loadGroups:ut("auth/loadUsersGroups"),getGroupById:ut("auth/getGroupById",(e=>({payload:e}))),createGroup:ut("auth/createGroup",(e=>({payload:e}))),updateGroup:ut("auth/updateGroup",(e=>({payload:e}))),deleteGroup:ut("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:ut("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:ut("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:ut("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:ut("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:ut("auth/getGroupConfiguration"),updateGroupConfiguration:ut("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:ut("auth/getUsers",(e=>({payload:e})))},to={addGroupDialogState:{loading:!1,open:!1},editGroupDialogState:{loading:!1,open:!1},deleteGroupDialogState:{loading:!1,open:!1},addMembersToGroupDialogState:{loading:!1,open:!1,userIds:[]},deleteMemberFromGroupDialogState:{loading:!1,open:!1}},no={setGroupsDialogsState:gt("groupsDialogsState"),resetGroupsDialogsState:pt("groupsState",{groupsDialogsState:to}),openAddGroupDialog:At("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:At("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:mt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:At("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:mt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:At("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:At("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:At("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:mt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:At("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},oo={loading:!0,error:null},io={setCustomLoginState:gt("customLoginState"),resetCustomLoginState:pt("customLoginState",{customLoginState:oo})},ao={loadTenantMetadata:ut("auth/loadTenantMetadata"),updateTenantMetadata:ut("auth/updateTenantMetadata",(e=>({payload:e})))},ro={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let lo,so,co,uo,yo;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(lo||(lo={})),function(e){e.Nextjs="nextjs",e.React="react",e.Angular="angular",e.Vuejs="vuejs",e.Flutter="flutter",e.Ios="ios",e.Android="android",e.Vanillajs="vanillajs"}(so||(so={})),function(e){e.ASC="ASC",e.DESC="DESC"}(co||(co={})),function(e){e.createdAt="createdAt",e.name="name",e.email="email",e.id="id",e.verified="verified",e.isLocked="isLocked",e.provider="provider",e.tenantId="tenantId"}(uo||(uo={})),function(e){e.MFA_UNENROLLED="mfa-unenrolled",e.BREACHED_PASSWORDS="breached-passwords",e.INACTIVE="inactive"}(yo||(yo={}));const fo=["local","saml","google","github","facebook","microsoft","scim2","slack"],po={loaders:{},errors:{},accounts:{tenantId:"",children:[]},accountsQueryParams:{_limit:50,_offset:0,_filter:"",_subTenantId:""},searchAccountsData:[],rootAccount:{tenantId:""},selectedAccount:{tenantId:"",userJwt:{accessToken:"",expiresIn:0,expires:""},users:[],usersQueryParams:{_offset:0,_limit:10,_order:co.DESC,_sortBy:uo.name},usersPageOffset:0,accountSettings:{}}},go={setAllAccountsLoader:vt("allAccountsState"),setAllAccountsError:ht("allAccountsState"),setAllAccountsState:gt("allAccountsState"),setSelectedAccountState:St("allAccountsState","selectedAccount"),resetAllAccountsState:pt("allAccountsState",{allAccountsState:po})},So={loadAccounts:ut("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:ut("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:ut("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:ut("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:ut("auth/updateAccount",(e=>({payload:e}))),deleteSubAccount:ut("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:ut("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:ut("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:ut("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:ut("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:ut("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:ut("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setRootAccountData:ut("auth/setRootAccountData"),setSelectedSubAccountData:ut("auth/setSelectedSubAccountData",(e=>({payload:e}))),loadNumberOfUsersForSelectedSubAccount:ut("auth/loadNumberOfUsersForSelectedSubAccount",(e=>({payload:e})))},vo={createSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:"",canSelectParentAccount:!1},updateSubAccountDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1,jwt:""},deleteSubAccountDialog:{accountId:"",accountName:"",isParentAccount:!1,loading:!1,open:!1,error:!1,jwt:""},addUsersToAccountDialog:{loading:!1,open:!1,accountName:"",accountId:"",permissionToGiveAccessToSubAccounts:!1,jwt:""},deleteUserFromAccountDialog:{userId:"",userName:"",accountId:"",loading:!1,open:!1,jwt:""},editUserRolesDialog:{loading:!1,open:!1,jwt:"",accountId:"",userId:"",userName:"",userRoles:[]}},ho={setAllAccountDialogsState:gt("allAccountsDialogsState"),resetAllAccountDialogsState:pt("allAccountsDialogsState",{allAccountsDialogsState:vo}),openCreateSubAccountDialog:mt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:At("allAccountsDialogsState","createSubAccountDialog",vo.createSubAccountDialog),openUpdateSubAccountDialog:mt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:At("allAccountsDialogsState","updateSubAccountDialog",vo.updateSubAccountDialog),openDeleteSubAccountDialog:mt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:At("allAccountsDialogsState","deleteSubAccountDialog",vo.deleteSubAccountDialog),openAddUsersToAccountDialog:mt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:At("allAccountsDialogsState","addUsersToAccountDialog",vo.addUsersToAccountDialog),openDeleteUserFromAccountDialog:mt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:At("allAccountsDialogsState","deleteUserFromAccountDialog",vo.deleteUserFromAccountDialog),openEditUserRolesDialog:mt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:At("allAccountsDialogsState","editUserRolesDialog",vo.editUserRolesDialog)},mo={loaders:{},errors:{},recommendations:void 0,insights:void 0,score:0,breachedPasswordUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},unenrolledMfaUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},inactiveUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10,_maxInactiveSeconds:7776e3}}},Ao={setSecurityCenterState:gt("securityCenterState"),resetSecurityCenterState:pt("securityCenterState",{securityCenterState:mo}),setSecurityCenterStateLoader:vt("securityCenterState"),setSecurityCenterStateError:ht("securityCenterState")},bo={loadRecommendations:ut("auth/loadRecommendations"),loadInsights:ut("auth/loadInsights"),sendResetBreachedPasswordEmail:ut("auth/sendResetBreachedPasswordEmail",(e=>({payload:e}))),sendBulkResetBreachedPasswordEmails:ut("auth/sendBulkResetBreachedPasswordEmails",(e=>({payload:e}))),loadBreachedPasswordUsers:ut("auth/loadBreachedPasswordUsers",(e=>({payload:e}))),loadUnenrolledMfaUsers:ut("auth/loadUnenrolledMfaUsers",(e=>({payload:e}))),loadInactiveUsers:ut("auth/loadInactiveUsers",(e=>({payload:e})))};let To,ko,Eo;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(To||(To={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(ko||(ko={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Eo||(Eo={}));const Io={[ko.Code]:Pt.loginWithOtc,[ko.EmailAndPassword]:Pt.loginWithPassword,[ko.MagicLink]:Pt.magicLinkPreLoginSuccess,[ko.SmsCode]:Pt.loginWithSmsOtc},Po={loading:!1,error:null,phoneNumbers:void 0},Lo={setSmsState:gt("smsState"),resetSmsState:pt("smsState",{smsState:Po})},Oo={loadPhoneNumbers:ut("auth/loadPhoneNumbers"),setUpPhoneNumber:ut("auth/setUpPhoneNumber",(e=>({payload:e}))),verifyPhoneNumber:ut("auth/verifyPhoneNumber",(e=>({payload:e}))),deletePhoneNumber:ut("auth/deletePhoneNumber",(e=>({payload:e}))),verifyDeletePhoneNumber:ut("auth/deletePhoneNumber",(e=>({payload:e}))),preVerifyPhoneNumber:ut("auth/preVerifyPhoneNumber",(e=>({payload:e})))},_o={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:hn,loginState:Nt,activateState:$t,acceptInvitationState:jt,forgotPasswordState:zt,ssoState:en,profileState:on,customLoginState:oo,mfaState:sn,teamState:dn,groupsState:Xn,groupsDialogsState:to,socialLoginState:pn,apiTokensState:bn,securityPolicyState:En,accountSettingsState:Ln,tenantsState:wn,rolesState:Rn,resetPhoneNumberState:Qt,sessionsState:Mn,sessionsPolicyState:$n,restrictionsState:jn,provisioningState:Hn,passkeysState:Yn,allAccountsState:po,allAccountsDialogsState:vo,securityCenterState:mo,smsState:Po},wo=U({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",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:()=>{}},_o);let Co;!function(e){e.impersonating="impersonating",e.success="success"}(Co||(Co={}));const Uo={step:Co.impersonating,loading:!1},Ro={setImpersonateState:gt("impersonateState"),resetImpersonateState:pt("impersonateState",{impersonateState:Uo})},Do={impersonate:ut("impersonation/impersonate",(e=>({payload:e})))},{reducer:No,actions:Mo}=yt({name:Ct,initialState:wo,reducers:U({resetState:e=>U({},e,_o),setState:(e,{payload:t})=>U({},e,t),setUser:("user",(e,{payload:t})=>U({},e,{user:t})),setEntitlements:St("user","entitlements")},Mt,gn,Vt,Ro,Wt,qt,Xt,mn,an,io,tn,cn,yn,Zn,no,Tn,In,On,Cn,Dn,Fn,Vn,Wn,zn,Jn,go,ho,Ao,Lo)});const Fo=U({loadEntitlements:ut("auth/loadEntitlements",(e=>({payload:e})))},Mo,Ft,Sn,xt,Kt,Yt,Zt,An,rn,ao,nn,un,fn,eo,{},kn,Pn,_n,Un,Nn,Gn,xn,Kn,qn,Do,Qn,So,bo,Oo);var Go=function(e){return"@@redux-saga/"+e},$o=Go("CANCEL_PROMISE"),Vo=Go("CHANNEL_END"),xo=Go("IO"),Bo=Go("MATCH"),jo=Go("MULTICAST"),Wo=Go("SAGA_ACTION"),Ko=Go("SELF_CANCELLATION"),Ho=Go("TASK"),zo=Go("TASK_CANCEL"),qo=Go("TERMINATE"),Yo=Go("LOCATION");function Jo(e,t){if(null==e)return{};var n,o,i={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(i[n]=e[n]);return i}var Qo=function(e){return null==e},Xo=function(e){return null!=e},Zo=function(e){return"function"==typeof e},ei=function(e){return"string"==typeof e},ti=Array.isArray,ni=function(e){return e&&Zo(e.then)},oi=function(e){return e&&Zo(e.next)&&Zo(e.throw)},ii=function e(t){return t&&(ei(t)||li(t)||Zo(t)||ti(t)&&t.every(e))},ai=function(e){return e&&Zo(e.take)&&Zo(e.close)},ri=function(e){return Zo(e)&&e.hasOwnProperty("toString")},li=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},si=function(e,t){var n;void 0===t&&(t=!0);var o=new Promise((function(o){n=setTimeout(o,Math.min(2147483647,e),t)}));return o[$o]=function(){clearTimeout(n)},o},ci=function(e){return function(){return e}},ui=ci(!0),di=function(){},yi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var fi=function(e,t){U(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function pi(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var gi=function(e){throw e},Si=function(e){return{value:e,done:!0}};function vi(e,t,n){void 0===t&&(t=gi),void 0===n&&(n="iterator");var o={meta:{name:n},next:e,throw:t,return:Si,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function hi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var mi=function(e){return Array.apply(null,new Array(e))},Ai=function(e){return function(t){return e(Object.defineProperty(t,Wo,{value:!0}))}},bi=function(e){return e===qo},Ti=function(e){return e===zo},ki=function(e){return bi(e)||Ti(e)};function Ei(e,t){var n,o=Object.keys(e),i=o.length,a=0,r=ti(e)?mi(i):{},l={};return o.forEach((function(e){var o=function(o,l){n||(l||ki(o)?(t.cancel(),t(o,l)):(r[e]=o,++a===i&&(n=!0,t(r))))};o.cancel=di,l[e]=o})),t.cancel=function(){n||(n=!0,o.forEach((function(e){return l[e].cancel()})))},l}function Ii(e){return{name:e.name||"anonymous",location:Pi(e)}}function Pi(e){return e[Yo]}var Li=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),o=0,i=0,a=0,r=function(t){n[i]=t,i=(i+1)%e,o++},l=function(){if(0!=o){var t=n[a];return n[a]=null,o--,a=(a+1)%e,t}},s=function(){for(var e=[];o;)e.push(l());return e};return{isEmpty:function(){return 0==o},put:function(l){var c;if(o<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[i]=l,a=i=(i+1)%e;break;case 4:c=2*e,n=s(),o=n.length,i=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},Oi="TAKE",_i="CALL",wi="FORK",Ci="SELECT",Ui=function(e,t){var n;return(n={})[xo]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Ri(e,t){return void 0===e&&(e="*"),ii(e)?(Xo(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Ui(Oi,{pattern:e})):ai(n=e)&&n[jo]&&Xo(t)&&ii(t)?Ui(Oi,{channel:e,pattern:t}):ai(e)?(Xo(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Ui(Oi,{channel:e})):void 0;var n}function Di(e,t){return Qo(t)&&(t=e,e=void 0),Ui("PUT",{channel:e,action:t})}function Ni(e){var t=Ui("ALL",e);return t.combinator=!0,t}function Mi(e,t){var n,o=null;return Zo(e)?n=e:(ti(e)?(o=e[0],n=e[1]):(o=e.context,n=e.fn),o&&ei(n)&&Zo(o[n])&&(n=o[n])),{context:o,fn:n,args:t}}function Fi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return Ui(_i,Mi(e,n))}function Gi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return Ui(wi,Mi(e,n))}function $i(e){return void 0===e&&(e=Ko),Ui("CANCEL",e)}function Vi(e){void 0===e&&(e=yi);for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return Ui(Ci,{selector:e,args:n})}var xi=Fi.bind(null,si);var Bi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},ji=[],Wi=0;function Ki(e){try{qi(),e()}finally{Yi()}}function Hi(e){ji.push(e),Wi||(qi(),Ji())}function zi(e){try{return qi(),e()}finally{Ji()}}function qi(){Wi++}function Yi(){Wi--}function Ji(){var e;for(Yi();!Wi&&void 0!==(e=ji.shift());)Ki(e)}var Qi=function(e){return function(t){return e.some((function(e){return na(e)(t)}))}},Xi=function(e){return function(t){return e(t)}},Zi=function(e){return function(t){return t.type===String(e)}},ea=function(e){return function(t){return t.type===e}},ta=function(){return ui};function na(e){var t="*"===e?ta:ei(e)?Zi:ti(e)?Qi:ri(e)?Zi:Zo(e)?Xi:li(e)?ea:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var oa={type:Vo},ia=function(e){return e&&e.type===Vo};function aa(){var e,t,n,o,i,a,r=(t=!1,o=n=[],i=function(){o===n&&(o=n.slice())},a=function(){t=!0;var e=n=o;o=[],e.forEach((function(e){e(oa)}))},(e={})[jo]=!0,e.put=function(e){if(!t)if(ia(e))a();else for(var i=n=o,r=0,l=i.length;r<l;r++){var s=i[r];s[Bo](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=ta),t?e(oa):(e[Bo]=n,i(),o.push(e),e.cancel=(a=!1,function(){a||(a=!0,i(),pi(o,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[Wo]?l(e):Hi((function(){l(e)}))},r}function ra(e,t){var n=e[$o];Zo(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var la,sa=0,ca=function(){return++sa};function ua(e){e.isRunning()&&e.cancel()}var da=((la={}).TAKE=function(e,t,n){var o=t.channel,i=void 0===o?e.channel:o,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!ia(e)||r?n(e):n(qo)};try{i.take(l,Xo(a)?na(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},la.PUT=function(e,t,n){var o=t.channel,i=t.action,a=t.resolve;Hi((function(){var t;try{t=(o?o.put:e.dispatch)(i)}catch(e){return void n(e,!0)}a&&ni(t)?ra(t,n):n(t)}))},la.ALL=function(e,t,n,o){var i=o.digestEffect,a=sa,r=Object.keys(t);if(0!==r.length){var l=Ei(t,n);r.forEach((function(e){i(t[e],a,l[e],e)}))}else n(ti(t)?[]:{})},la.RACE=function(e,t,n,o){var i=o.digestEffect,a=sa,r=Object.keys(t),l=ti(t)?mi(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,o){c||(o||ki(t)?(n.cancel(),n(t,o)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=di,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||i(t[e],a,s[e],e)}))},la.CALL=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=o.task;try{var s=a.apply(i,r);if(ni(s))return void ra(s,n);if(oi(s))return void ba(e,s,l.context,sa,Ii(a),!1,n);n(s)}catch(e){n(e,!0)}},la.CPS=function(e,t,n){var o=t.context,i=t.fn,a=t.args;try{var r=function(e,t){Qo(e)?n(t):n(e,!0)};i.apply(o,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},la.FORK=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=t.detached,s=o.task,c=function(e){var t=e.context,n=e.fn,o=e.args;try{var i=n.apply(t,o);if(oi(i))return i;var a=!1;return vi((function(e){return a?{value:e,done:!0}:(a=!0,{value:i,done:!ni(i)})}))}catch(e){return vi((function(){throw e}))}}({context:i,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Ii(t)}(c,a);zi((function(){var t=ba(e,c,s.context,sa,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},la.JOIN=function(e,t,n,o){var i=o.task,a=function(e,t){if(e.isRunning()){var n={task:i,cb:t};t.cancel=function(){e.isRunning()&&pi(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(ti(t)){if(0===t.length)return void n([]);var r=Ei(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},la.CANCEL=function(e,t,n,o){var i=o.task;t===Ko?ua(i):ti(t)?t.forEach(ua):ua(t),n()},la.SELECT=function(e,t,n){var o=t.selector,i=t.args;try{n(o.apply(void 0,[e.getState()].concat(i)))}catch(e){n(e,!0)}},la.ACTION_CHANNEL=function(e,t,n){var o=t.pattern,i=function(e){void 0===e&&(e=Li());var t=!1,n=[];return{take:function(o){t&&e.isEmpty()?o(oa):e.isEmpty()?(n.push(o),o.cancel=function(){pi(n,o)}):o(e.take())},put:function(o){if(!t){if(0===n.length)return e.put(o);n.shift()(o)}},flush:function(n){t&&e.isEmpty()?n(oa):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var o=0,i=e.length;o<i;o++)(0,e[o])(oa)}}}}(t.buffer),a=na(o),r=function t(n){ia(n)||e.channel.take(t,a),i.put(n)},l=i.close;i.close=function(){r.cancel(),l()},e.channel.take(r,a),n(i)},la.CANCELLED=function(e,t,n,o){n(o.task.isCancelled())},la.FLUSH=function(e,t,n){t.flush(n)},la.GET_CONTEXT=function(e,t,n,o){n(o.task.context[t])},la.SET_CONTEXT=function(e,t,n,o){var i=o.task;fi(i.context,t),n()},la);function ya(e,t){return e+"?"+t}function fa(e){var t=e.name,n=e.location;return n?t+" "+ya(n.fileName,n.lineNumber):t}function pa(e){var t,n,o,i=(t=function(e){return e.cancelledTasks},n=e,(o=[]).concat.apply(o,n.map(t)));return i.length?["Tasks cancelled due to error:"].concat(i).join("\n"):""}var ga=null,Sa=[],va=function(e){e.crashedEffect=ga,Sa.push(e)},ha=function(){ga=null,Sa.length=0},ma=function(){var e,t,n=Sa[0],o=Sa.slice(1),i=n.crashedEffect?(e=n.crashedEffect,(t=Pi(e))?t.code+" "+ya(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+fa(n.meta)+(i?" \n when executing effect "+i:"")].concat(o.map((function(e){return" created by "+fa(e.meta)})),[pa(Sa)]).join("\n")};function Aa(e,t,n,o,i,a,r){var l;void 0===r&&(r=di);var s,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var o,i=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){i.push(t),t.cont=function(l,s){a||(pi(i,t),t.cont=di,s?r(l):(t===e&&(o=l),i.length||(a=!0,n(o))))}}function s(){a||(a=!0,i.forEach((function(e){e.cont=di,e.cancel()})),i=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return i}}}(t,0,g);function g(t,n){if(n){if(u=2,va({meta:i,cancelledTasks:y}),S.isRoot){var o=ma();ha(),e.onError(t,{sagaStack:o})}c=t,d&&d.reject(t)}else t===zo?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={})[Ho]=!0,l.id=o,l.meta=i,l.isRoot=a,l.context=f,l.joiners=[],l.queue=p,l.cancel=function(){0===u&&(u=1,p.cancelAll(),g(zo,!1))},l.cont=r,l.end=g,l.setContext=function(e){fi(f,e)},l.toPromise=function(){return d||(d=Bi(),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 ba(e,t,n,o,i,a,r){var l=e.finalizeRunEffect((function(t,n,o){ni(t)?ra(t,o):oi(t)?ba(e,t,c.context,n,i,!1,o):t&&t[xo]?(0,da[t.type])(e,t.payload,o,u):o(t)}));d.cancel=di;var s={meta:i,cancel:function(){0===s.status&&(s.status=1,d(zo))},status:0},c=Aa(e,s,n,o,i,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var i;n?(i=t.throw(e),ha()):Ti(e)?(s.status=1,d.cancel(),i=Zo(t.return)?t.return(zo):{done:!0,value:zo}):i=bi(e)?Zo(t.return)?t.return():{done:!0}:t.next(e),i.done?(1!==s.status&&(s.status=3),s.cont(i.value)):y(i.value,o,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,o,i){void 0===i&&(i="");var a,r=ca();function s(n,i){a||(a=!0,o.cancel=di,e.sagaMonitor&&(i?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),i&&function(e){ga=e}(t),o(n,i))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:i,effect:t}),s.cancel=di,o.cancel=function(){a||(a=!0,s.cancel(),s.cancel=di,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function Ta(e,t){for(var n=e.channel,o=void 0===n?aa():n,i=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?hi:u,y=arguments.length,f=new Array(y>2?y-2:0),p=2;p<y;p++)f[p-2]=arguments[p];var g,S=t.apply(void 0,f),v=ca();if(s&&(s.rootSagaStarted=s.rootSagaStarted||di,s.effectTriggered=s.effectTriggered||di,s.effectResolved=s.effectResolved||di,s.effectRejected=s.effectRejected||di,s.effectCancelled=s.effectCancelled||di,s.actionDispatched=s.actionDispatched||di,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Ke.apply(void 0,c);g=function(e){return function(t,n,o){return h((function(t){return e(t,n,o)}))(t)}}}else g=yi;var m={channel:o,dispatch:Ai(i),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return zi((function(){var e=ba(m,S,l,v,Ii(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var ka=function(e){var t,n=void 0===e?{}:e,o=n.context,i=void 0===o?{}:o,a=n.channel,r=void 0===a?aa():a,l=n.sagaMonitor,s=Jo(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,o=e.dispatch;return t=Ta.bind(null,U({},s,{context:i,channel:r,dispatch:o,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){fi(i,e)},c},Ea=function(e){return{done:!0,value:e}},Ia={};function Pa(e){return ai(e)?"channel":ri(e)?String(e):Zo(e)?e.name:String(e)}function La(e,t,n){var o,i,a,r=t;function l(t,n){if(r===Ia)return Ea(t);if(n&&!i)throw r=Ia,n;o&&o(t);var l=n?e[i](n):e[r]();return r=l.nextState,a=l.effect,o=l.stateUpdater,i=l.errorState,r===Ia?Ea(t):a}return vi(l,(function(e){return l(null,e)}),n)}function Oa(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:Ri(e)},l=function(e){return{done:!1,value:Gi.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return La({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Pa(e)+", "+t.name+")")}function _a(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r,l={done:!1,value:Ri(e)},s=function(e){return{done:!1,value:Gi.apply(void 0,[t].concat(o,[e]))}},c=function(e){return{done:!1,value:$i(e)}},u=function(e){return a=e},d=function(e){return r=e};return La({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("+Pa(e)+", "+t.name+")")}function wa(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:Ri(e)},l=function(e){return{done:!1,value:Fi.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return La({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Pa(e)+", "+t.name+")")}function Ca(e,t,n){for(var o=e,i=arguments.length,a=new Array(i>3?i-3:0),r=3;r<i;r++)a[r-3]=arguments[r];var l={done:!1,value:Fi.apply(void 0,[n].concat(a))},s={done:!1,value:xi(t)};return La({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:Ia}},q10:function(e){if((o-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function Ua(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return Gi.apply(void 0,[Oa,e,t].concat(o))}function Ra(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return Gi.apply(void 0,[_a,e,t].concat(o))}function Da(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return Gi.apply(void 0,[wa,e,t].concat(o))}class Na{constructor(){this.context=null,this.accessToken=null,this.user=null,this.requestSource=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout",this.entitlementsOptions=null,this.appName=null}static getInstance(){return Na.instance||(Na.instance=new Na),Na.instance}static setContext(e){Na.getInstance().context=e}static setAccessToken(e){Na.getInstance().accessToken=e}static setUser(e){Na.getInstance().user=e}static setRequestSource(e){Na.getInstance().requestSource=e}static setOnRedirectTo(e){Na.getInstance().onRedirectTo=e}static setLogout(e,t){Na.getInstance().logout=n=>{n?e(n):Na.onRedirectTo(t)}}static setEntitlementsOptions(e){Na.getInstance().entitlementsOptions=e}static setAppName(e){Na.getInstance().appName=e}static getContext(){var e;return null!=(e=Na.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Na.getInstance().accessToken}static getRequestSource(){return Na.getInstance().requestSource}static getUser(){return Na.getInstance().user}static onRedirectTo(e,t){return Na.getInstance().onRedirectTo(e,t)}static logout(e){return Na.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=Na.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static getAppName(){return Na.getInstance().appName}}Na.instance=void 0;const Ma={getContext:()=>Na.getContext(),getAccessToken:()=>Na.getAccessToken(),getUser:()=>Na.getUser(),onRedirectTo:(e,t)=>Na.onRedirectTo(e,t),logout:e=>Na.logout(e)};class Fa extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Ga={v1:"/identity/resources/users/webauthn/v1/devices"},$a={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Va={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",roles:{v3:"/identity/resources/users/v3/roles"},groups:{v3:"/identity/resources/users/v3/groups"},tenants:{me:{v3:"/identity/resources/users/v3/me/tenants"}},apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-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"}},passwords:{resetBreachedPasswords:{v1:"/identity/resources/users/v1/passwords/breached/reset/bulk"}},authorization:{v1:"/identity/resources/users/v1/me/authorization"}},xa={v1:"/identity/resources/configurations/v1"},Ba={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},ja={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Wa={v1:"/identity/resources/permissions/v1"},Ka={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},accessTokens:{v1:"/identity/resources/tenants/access-tokens/v1"},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"}},users:{v1:"/identity/resources/tenants/users/v1"}},Ha={v1:"/identity/resources/roles/v1"},za={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},qa={v1:"/identity/resources/impersonation/v1"},Ya={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Ja={v1:"/identity/resources/users/phone-numbers/v1"},Qa={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},Xa={v1:"/team/resources/members/v1"},Za={v1:"/team/resources/roles/v1"},er={v1:"/team/resources/stats/v1"},tr={v1:"/team/resources/profile"},nr={v1:"/tenants/resources/account-settings/v1"},or={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"},v2:"/tenants/resources/hierarchy/v2",metadata:{v2:"/tenants/resources/hierarchy/v2/metadata"}},ir={v1:"/tenants/resources/sub-tenants/v1"},ar={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},rr={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"}}}},lr={v1:"/subscriptions/resources/payment-providers/v1"},sr={v1:"/subscriptions/resources/subscriptions/v1"},cr={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},ur={v1:"/reports/engine/resources/triggers/v1"},dr="/notification",yr="/audits",fr={v1:"/event/resources/configurations/v1"},pr="/webhook",gr="/oauth",Sr="/flags",vr="/directory/resources/v1/configurations/scim2",hr="/directory/resources/scim/temp",mr="/entitlements/api/v1/user-entitlements",Ar={v1:"/security-center/resources/recommendations/v1"},br={v1:"/security-center/resources/insights/v1"};function Tr(e,t,n=!0){let o;o="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const i=e.urlPrefix||"frontegg",a="frontegg"===i&&!n;return o.endsWith("/")||(o+="/"),o.endsWith(i)||a||(o+=i),o}function kr(e){var t,n;const o={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(o[ro.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(o[ro.frameWork]=e.metadataHeaders.framework),o}const Er=async e=>{var t,n,o;const i=Na.getContext(),a=await async function(e,t){var n;const o=kr(e),i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Na.getAccessToken)(),a=Na.getRequestSource();t&&(o[ro.contentType]=t),a&&(o[ro.source]=a),i&&(o.Authorization=`Bearer ${i}`);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))o[`${t.key}`]=`${t.value}`;return o}(i,e.contentType),r=await async function(e,t,n){const o=Tr(e,t),i=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 o=Object.keys(t);for(const e of o){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${o}${t}`;const r=Object.keys(i).length>0;return i&&r&&(a+=`?${new URLSearchParams(i)}`),a}(i,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:U({},a,e.headers),credentials:null!=(n=null!=(o=e.credentials)?o:i.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 Fa("Error request is too large",l.status);let e,t=!0;try{e=await l.text(),e=JSON.parse(e)}catch(e){t=!1}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=i.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=i.logLevel)?c:"")&&console.error(e),new Fa(t?e:"We're facing some difficulties, Please try again",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{}}},Ir=async(e,t,n)=>Er(U({url:e,method:"GET",contentType:"application/json",params:t},n)),Pr=async(e,t,n)=>Er(U({url:e,method:"POST",contentType:"application/json",body:t},n)),Lr=async(e,t,n)=>Er(U({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Or=async(e,t,n)=>Er(U({url:e,method:"PUT",contentType:"application/json",body:t},n)),_r=async(e,t,n)=>Er(U({url:e,method:"DELETE",contentType:"application/json",body:t},n)),wr=async(e,t,n,o)=>Er(U({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),Cr=(e={})=>U({},e.jwt?{Authorization:e.jwt}:{});async function Ur(e){return Or(`${Va.v1}/tenant`,e)}async function Rr(){return Ir(`${Va.v2}/me/tenants`)}async function Dr(e){return Ir(or.v1,void 0,{headers:Cr(e)})}async function Nr(e){return Ir(or.tree.v1,void 0,{headers:Cr(e)})}async function Mr(e){return Ir(or.parents.v1,void 0,{headers:Cr(e)})}async function Fr(e,t){return Ir(`${or.parents.v1}/${e}`,void 0,{headers:Cr(t)})}async function Gr(e,t){return Pr(`${Ka.users.v1}/count`,e,{headers:Cr(t)})}async function $r(e,t){return Ir(or.v2,e,{headers:Cr(t)})}async function Vr(e,t){return Ir(or.metadata.v2,U({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Cr(t)})}async function xr(){return Ir(xa.v1)}async function Br(){return Ir(`${xa.v1}/mfa-policy`)}async function jr(){return Ir(`${xa.v1}/mfa-policy/vendor`)}async function Wr(e){return e.id?Lr(`${xa.v1}/mfa-policy`,e):Pr(`${xa.v1}/mfa-policy`,e)}async function Kr(){return Ir(`${xa.v1}/lockout-policy`)}async function Hr(){return Ir(`${xa.v1}/lockout-policy/vendor`)}async function zr(e){return e.id?Lr(`${xa.v1}/lockout-policy`,e):Pr(`${xa.v1}/lockout-policy`,e)}async function qr(){try{return await Ir(`${xa.v1}/captcha-policy/public`)}catch{return null}}async function Yr(){return Ir(`${xa.v1}/password-history-policy`)}async function Jr(){return Ir(`${xa.v1}/password-history-policy/vendor`)}async function Qr(e){return e.id?Lr(`${xa.v1}/password-history-policy`,e):Pr(`${xa.v1}/password-history-policy`,e)}async function Xr(){return Ir(`${xa.v1}/password`)}async function Zr(){return Ir(`${Ba.emailDomain.v1}`)}async function el(){return Ir(`${Ba.emailDomain.v1}/config`)}async function tl(e){return Pr(`${Ba.emailDomain.v1}`,e)}async function nl(e){return Pr(`${Ba.emailDomain.v1}/config`,e)}async function ol(e){return _r(`${Ba.emailDomain.v1}/${e}`)}async function il(e){return Ir(`${Ba.ip.v1}`,e)}async function al(){return Ir(`${Ba.ip.v1}/config`)}async function rl(e){return Pr(`${Ba.ip.v1}`,e)}async function ll(e){return Pr(`${Ba.ip.v1}/bulk`,e)}async function sl(e){return Pr(`${Ba.ip.v1}/config`,e)}async function cl(e){return _r(`${Ba.ip.v1}/${e}`)}async function ul(){return Pr(`${Ba.ip.v1}/verify`)}async function dl(){return Pr(`${Ba.ip.v1}/verify/allow`)}class yl extends Error{constructor(e){super(e)}}const fl="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new yl("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,o,i=0,a=0;o=t.charAt(a++);~o&&(e=i%4?64*e+o:o,i++%4)?n+=String.fromCharCode(255&e>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return n};class pl extends Error{constructor(e){super(e)}}const gl=(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(fl(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 fl(t)}})(e.split(".")[n]))}catch(e){throw new pl("Invalid token specified: "+e.message)}};let Sl,vl,hl;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}(Sl||(Sl={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(vl||(vl={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(hl||(hl={}));const ml="admin_portal_should_load_authorization";async function Al(e){return Pr(`${Va.v3}/me/token`,e)}async function bl(e,t){return Ir(Va.v2,e,{headers:Cr(t)})}async function Tl(e,t){return Ir(Va.v3,e,{headers:Cr(t)})}async function kl(e,t){return Ir(Va.roles.v3,U({},e,{ids:e.ids.join(",")}),{headers:Cr(t)})}async function El(e,t){return Ir(Va.groups.v3,U({},e,{ids:e.ids.join(",")}),{headers:Cr(t)})}async function Il(e){return Ir(Va.tenants.me.v3,void 0,{headers:Cr(e)})}async function Pl(){return Pr(Va.passwords.resetBreachedPasswords.v1)}async function Ll(e){return Or(`${Va.v2}/me`,e)}async function Ol(){return Ir(mr)}let _l;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(_l||(_l={}));const wl="admin_portal_entitlements",Cl={flags:{}};class Ul{constructor(){var e;this._flags={},this._flags=null!=(e=Cl.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Ul;return n.set(e),Ul._instances[t]=n,n}static getFeatureFlags(e,t){const n=this.getInstance(t);return e.map((e=>"on"===(null==n?void 0:n._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t;this._flags=U({},null!=(t=null==Cl?void 0:Cl.flags)?t:{},null!=e?e:{})}}async function Rl(){return Ir(Sr)}Ul._instances={};const Dl=["type"],Nl=["type"],Ml=["type"];async function Fl(e){if(!e.accessToken)return e;Na.setAccessToken(e.accessToken);const t=await Eu(),n=U({},e,e.accessToken?gl(e.accessToken):{},t);return Na.setUser(n),n}async function Gl(e){if(!e.accessToken)return{user:e};Na.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Eu(),Rr()]),o=U({},e,e.accessToken?gl(e.accessToken):{},t);return Na.setUser(o),{user:o,tenants:n}}function $l(){if(!Na.shouldLoadEntitlements())return!1;const[e]=Ul.getFeatureFlags([wl],Na.getAppName()||"");return e}function Vl(){const[e]=Ul.getFeatureFlags([ml],Na.getAppName()||"");return e}async function xl(e){const{accessToken:t}=e;if(!t)return{user:e};Na.setAccessToken(t);const[n,o]=await Promise.all([Eu(),Il()]),i=U({},e,t?gl(t):{},n);return Na.setUser(i),{user:i,tenants:o.tenants,activeTenant:o.activeTenant}}async function Bl(e){Na.setAccessToken(e.id_token);const t=await Eu(),n=e.id_token?gl(e.id_token):{},o=U({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Na.setUser(o),o}async function jl(e){Na.setAccessToken(e.id_token);const[t,n]=await Promise.all([Eu(),Il()]),o=e.id_token?gl(e.id_token):{},i=U({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},o,t,{expiresIn:e.expires_in||300});return Na.setUser(i),{user:i,tenants:n.tenants,activeTenant:n.activeTenant}}async function Wl(e){try{const{address:t}=await Pr(`${$a.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Kl(e){return Pr(`${$a.v1}/user/saml/prelogin`,e)}async function Hl(e){return Fl(await Pr(`${$a.v1}/user/saml/postlogin`,e))}async function zl(e){return Fl(await Pr(`${$a.v1}/user/oidc/postlogin`,e))}async function ql(e){return Fl(await Pr(`${$a.v1}/user`,e))}async function Yl(e){return xl(await Pr(`${$a.v1}/user`,e))}async function Jl(e){return Fl(await Pr(`${$a.v1}/user/mfa/verify`,e))}async function Ql(e){return xl(await Pr(`${$a.v1}/user/mfa/verify`,e))}async function Xl(e){return Pr(`${Va.v1}/activate`,e)}async function Zl(e){return xl(await Pr(`${Va.v1}/activate`,e))}async function es(e){return Ir(`${Va.v1}/activate/strategy`,e)}async function ts(e){return Pr(`${Va.v1}/activate/reset`,e)}async function ns(e){return Pr(`${Va.v1}/invitation/reset`,e)}async function os(e){return Pr(`${Va.v1}/invitation/accept`,e)}async function is(){return Fl(await Pr(`${$a.v1}/user/token/refresh`))}async function as(){return Gl(await Pr(`${$a.v1}/user/token/refresh`))}async function rs(){return xl(await Pr(`${$a.v1}/user/token/refresh`))}async function ls(){return Pr(`${$a.v1}/logout`)}async function ss(e){return Ir(`${gr}/logout`,e)}async function cs(e){return Pr(`${Va.v1}/passwords/reset`,e)}async function us(e){return Pr(`${Va.v1}/passwords/reset/verify`,e)}async function ds(e){return Ir(`${Va.v1}/passwords/config`,e)}async function ys(e){return Pr(`${$a.v1}/user/mfa/recover`,e)}async function fs(){return Pr(`${Va.v1}/mfa/enroll`)}async function ps(){return Pr(`${Va.v1}/mfa/authenticator/enroll`)}async function gs(e){return Pr(`${Va.v1}/mfa/authenticator/enroll/verify`,e)}async function Ss(e){return Pr(`${Va.v1}/mfa/sms/enroll`,e)}async function vs(e){return Pr(`${Va.v1}/mfa/sms/enroll/verify`,e)}async function hs(){return Pr(`${Va.v1}/mfa/webauthn/enroll`)}async function ms(e){return Pr(`${Va.v1}/mfa/webauthn/enroll/verify`,e)}async function As(e){return Pr(`${Va.v1}/mfa/enroll/verify`,e)}async function bs(e){return Pr(`${Va.v1}/mfa/disable`,e)}async function Ts(e,t){return Pr(`${Va.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function ks(e){return Pr(`${Va.v1}/mfa/sms/${e}/disable`)}async function Es(e,t){return Pr(`${Va.v1}/mfa/sms/${e}/disable/verify`,t)}async function Is(e){return Pr(`${Va.v1}/mfa/webauthn/${e}/disable`)}async function Ps(e,t){return Pr(`${Va.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Ls(){return Ir(`${Va.v1}/mfa/devices`)}async function Os(e){return Pr(`${$a.v1}/user/mfa/authenticator/enroll`,e)}async function _s(e){return Pr(`${$a.v1}/user/mfa/authenticator/enroll/verify`,e)}async function ws(e){return xl(await Pr(`${$a.v1}/user/mfa/authenticator/enroll/verify`,e))}async function Cs(e,t){return Pr(`${$a.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Us(e){return Pr(`${$a.v1}/user/mfa/emailcode`,e)}async function Rs(e){return Pr(`${$a.v1}/user/mfa/emailcode/verify`,e)}async function Ds(e){return xl(await Pr(`${$a.v1}/user/mfa/emailcode/verify`,e))}async function Ns(e){return Pr(`${$a.v1}/user/mfa/sms/enroll`,e)}async function Ms(e){return Pr(`${$a.v1}/user/mfa/sms/enroll/verify`,e)}async function Fs(e){return xl(await Pr(`${$a.v1}/user/mfa/sms/enroll/verify`,e))}async function Gs(e,t){return Pr(`${$a.v1}/user/mfa/sms/${e}`,t)}async function $s(e,t){return Pr(`${$a.v1}/user/mfa/sms/${e}/verify`,t)}async function Vs(e,t){return xl(await Pr(`${$a.v1}/user/mfa/sms/${e}/verify`,t))}async function xs(e){return Pr(`${$a.v1}/user/mfa/webauthn/enroll`,e)}async function Bs(e){return Pr(`${$a.v1}/user/mfa/webauthn/enroll/verify`,e)}async function js(e){return xl(await Pr(`${$a.v1}/user/mfa/webauthn/enroll/verify`,e))}async function Ws(e,t){return Pr(`${$a.v1}/user/mfa/webauthn/${e}`,t)}async function Ks(e,t){return Pr(`${$a.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Hs(e,t){return xl(await Pr(`${$a.v1}/user/mfa/webauthn/${e}/verify`,t))}async function zs(){return Ir(`${Qa.v1}/saml/configurations`)}async function qs(e){return Pr(`${Qa.v1}/saml/configurations`,e)}async function Ys(){return Ir(`${Qa.v1}/saml/configurations/vendor-config`)}async function Js(e){return Or(`${Qa.v1}/saml/configurations/metadata`,e)}async function Qs(){return Or(`${Qa.v1}/saml/validations/domain`)}async function Xs(){return Ir(`${Qa.v1}/saml/configurations/roles/default`)}async function Zs(){return Ir(`${Qa.v2}/saml/configurations/groups`)}async function ec({roleIds:e}){return Pr(`${Qa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function tc({roleIds:e,group:t}){return Pr(`${Qa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function nc({roleIds:e,group:t,id:n}){return Lr(`${Qa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function oc({id:e}){return _r(`${Qa.v2}/saml/configurations/groups/${e}`)}async function ic(){return Ir(`${Qa.v1}/oidc/configurations`)}async function ac(){return Ir(`${Qa.v2}/configurations/public`)}async function rc(){return Ir(ja.v1)}async function lc(){return Ir(ja.v2)}async function sc(){return Ir(`${ja.v2}/authenticated`)}async function cc(){return Ir(ja.custom.v1)}async function uc({provider:e,code:t,idToken:n,redirectUri:o,codeVerifier:i,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),o&&(s.redirectUri=o),i&&(s.code_verifier=i),l&&(s.state=l),Pr(`${$a.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function dc(){return Ir(`${xa.v1}/public`)}async function yc(e){const{shouldActivate:t,authResponse:n,userId:o,tenantId:i}=await Pr(`${Va.v1}/signUp`,e),a={shouldActivate:t,userId:o,tenantId:i};if(!t&&n){const{user:e,tenants:t,activeTenant:o}=await xl(n);return U({},a,{user:e,tenants:t,activeTenant:o})}return a}async function fc(){return Ir(Va.sessions.currentUser.v1)}async function pc(){return Ir(`${Va.sessions.currentUser.v1}/current`)}async function gc(e){return Pr(`${Va.sessions.v1}/revoke`,{userId:e})}async function Sc(){return Ir(Va.sessions.configurations.v1)}async function vc(e){await Pr(Va.sessions.configurations.v1,e)}async function hc(e){await _r(`${Va.sessions.currentUser.v1}/${e}`)}async function mc(){await _r(`${Va.sessions.currentUser.v1}/all`)}async function Ac(){return Ir(Va.accessTokens.v1)}async function bc(){return Ir(Ka.accessTokens.v1)}async function Tc({id:e}){return _r(`${Ka.accessTokens.v1}/${e}`)}async function kc({id:e}){return _r(`${Va.accessTokens.v1}/${e}`)}async function Ec(e){return Pr(Va.accessTokens.v1,e)}async function Ic(e){return Pr(Ka.accessTokens.v1,e)}async function Pc(){return Ir(Va.apiTokens.v1)}async function Lc(){return Ir(Ka.apiTokens.v1)}async function Oc(e){return Pr(Va.apiTokens.v1,e)}async function _c(e){return Pr(Ka.apiTokens.v2,e)}async function wc({tokenId:e}){return _r(`${Ka.apiTokens.v1}/${e}`)}async function Cc({tokenId:e}){return _r(`${Va.apiTokens.v1}/${e}`)}async function Uc({userId:e}){return Ir(`${Va.v1}/${e}`)}async function Rc(e){return Ir(`${xa.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Dc(e){let{type:t}=e,n=Jo(e,Dl);return Pr(`${$a.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Nc(e){let{type:t}=e,n=Jo(e,Nl);return xl(await Pr(`${$a.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function Mc(e){let{type:t}=e,n=Jo(e,Ml);return Pr(`${$a.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Fc({token:e}){return Pr(Ka.invites.verify.v1,{token:e})}async function Gc(){return Ir(`${Qa.v1}/configurations`)}async function $c(e){return Pr(`${Qa.v1}/configurations`,e)}async function Vc(e,t){return Lr(`${Qa.v1}/configurations/${e}`,t)}async function xc(e){return _r(`${Qa.v1}/configurations/${e}`)}async function Bc(e){return Pr(`${Qa.v1}/configurations/metadata`,e)}async function jc(e,t){return Or(`${Qa.v1}/configurations/${e}/metadata`,t)}async function Wc(e){return Pr(`${Qa.v1}/configurations/metadata-url`,e)}async function Kc(e,t){return Or(`${Qa.v1}/configurations/${e}/metadata-url`,t)}async function Hc(e,t){return Pr(`${Qa.v1}/configurations/${e}/domains`,t)}async function zc(e,t){return _r(`${Qa.v1}/configurations/${e}/domains/${t}`)}async function qc(e,t){return Or(`${Qa.v1}/configurations/${e}/domains/${t}/validate`)}async function Yc(e){return Ir(`${Qa.v1}/configurations/${e}/roles`)}async function Jc(e,t){return Or(`${Qa.v1}/configurations/${e}/roles`,t)}async function Qc(e,t){return Pr(`${Qa.v1}/configurations/${e}/groups`,t)}async function Xc(e,{roleIds:t,group:n,id:o}){return Lr(`${Qa.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function Zc(e,t){return _r(`${Qa.v1}/configurations/${e}/groups/${t}`)}async function eu(e){return Ir(`${Qa.v1}/configurations/${e}/groups`)}async function tu(e){return Pr(`${$a.v2}/user/sso/prelogin`,e)}async function nu(e){return Fl(await Pr(`${$a.v2}/user/oidc/postlogin`,e))}async function ou(e){return jl(await Pr(`${gr}/token`,e))}async function iu(){return jl(await Pr(`${gr}/authorize/silent`))}async function au(e){return Bl(await Pr(`${gr}/token`,e))}async function ru(){return Bl(await Pr(`${gr}/authorize/silent`))}async function lu(e){return Pr(`${Va.v1}/phone/reset`,e)}async function su(e){return Pr(`${Va.v1}/phone/reset/verify`,e)}async function cu(e){return Pr(`${Va.v1}/phone`,e)}async function uu(e){return Pr(`${Va.v1}/phone/verify`,e)}async function du(e){return Or(`${Va.v1}/phone/change`,e)}async function yu(e){return Pr(`${$a.v1}/webauthn/prelogin`,e)}async function fu(e){return Pr(`${$a.v1}/webauthn/postlogin`,e)}async function pu(e){return xl(await Pr(`${$a.v1}/webauthn/postlogin`,e))}async function gu(){return Pr(Ga.v1)}async function Su(){return Ir(Ga.v1)}async function vu(e){return _r(`${Ga.v1}/${e}`)}async function hu(e){return Pr(`${Ga.v1}/verify`,e)}async function mu(){return Ir(`${xa.v1}/auth/strategies/public`)}async function Au(){return Ir(`${xa.v1}/auth/strategies`)}async function bu(){return Ir(`${xa.v1}/mfa/strategies`)}async function Tu(){return Ir(`${Va.authorization.v1}`)}async function ku(){return Ir(`${Va.v2}/me`)}async function Eu(){const e=[{action:ku,shouldLoad:!0},{action:Ol,shouldLoad:$l()},{action:Tu,shouldLoad:Vl()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[t,n,o]=await Promise.all(e);return U({},t,null!=o?o:{},{entitlements:n})}async function Iu(e){return Ir(`${Va.v2}/me`,null!=e?e:{addRoles:!0})}async function Pu(e){return Or(`${Va.v2}/me`,e)}async function Lu(e){return Or(`${tr.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Ou(e){return Pr(`${Va.v1}/passwords/change`,e)}async function _u(e){var t,n,o,i,a,r;const l=(e.filter||[]).reduce(((e,t)=>U({},e,{[t.id]:t.value})),{}),s=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(o=e.sort)||null==(i=o[0])?void 0:i.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return Ir(Xa.v1,U({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function wu(e){return Pr(Va.v2,U({},e,{provider:"local"}))}async function Cu(e){return _r(`${Xa.v1}/${e.userId}`)}async function Uu(e){return Or(Xa.v1,e)}async function Ru(e){return Pr(Ka.invites.user.v1,U({},e))}async function Du(e){return Lr(Ka.invites.user.v1,U({},e))}async function Nu(){return _r(Ka.invites.user.v1)}async function Mu(){return Ir(Ka.invites.user.v1)}async function Fu(){return Ir(Ka.invites.configuration.v1)}async function Gu(){return Ir(Za.v1)}async function $u(){return Ir(Wa.v1)}async function Vu(){return Ir(`${er.v1}/members`)}async function xu(e){return Pr(`${Xa.v1}/${e.userId}/resendActivationEmail`,{})}async function Bu(e){return Pr(Va.v2,U({},e,{provider:"local"}))}async function ju(e){return Pr(Va.invitation.resendAll.v1,U({},e))}async function Wu(e){var t,n;const o=await Ir("/metadata",e);if(null!=o&&null!=(t=o.rows)&&t[0])return null==o||null==(n=o.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function Ku(){return Ir("/metadata/admin-box")}async function Hu(e){return Pr("/metadata/admin-box",e)}async function zu(){const e=await Ir("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const qu=async()=>Wu({entityName:"notifications"}),Yu=async()=>Wu({entityName:"saml"}),Ju=async()=>Wu({entityName:"audits"}),Qu=async e=>async function(e){const t=await Ir(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Xu=["dataFilters"],Zu=["templateId","dataFilters"],ed=["dataFilters"];async function td(e){return Ir(`${cr.v2}/tenant-reports`,e)}async function nd(e){return Ir(`${cr.v2}/${e.id}/tenant-reports`)}async function od(e){let{dataFilters:t}=e,n=Jo(e,Xu);return{html:await Ir(`${ur.v1}/preview-report`,U({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function id(e){let{templateId:t,dataFilters:n}=e,o=Jo(e,Zu);return Pr(`${cr.v2}/${t}/tenant-reports`,U({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function ad(e){let{dataFilters:t}=e,n=Jo(e,ed);const o=await Ir(`${ur.v1}/preview-report`,U({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let i="text/html",a="html";"pdf"===n.responseType?(i="application/pdf",a="pdf"):"image"===n.responseType&&(i="image/jpeg",a="jpg");const r=new Blob([o],{type:i}),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 rd(e){return Pr(`${ur.v1}/tenant-reports`,e)}async function ld(e){return Ir(dr,{params:e})}async function sd(e){return Or(`${dr}/status`,{params:e})}async function cd(e){const{notificationId:t,pinStatus:n}=e;return Or(`${dr}/${n}`,{notificationId:t})}async function ud(){return Pr(`${dr}/status/mark-all-read`)}const dd=["endpoint","headerProps"];async function yd(e){return Ir(yr,e)}async function fd(e){return Ir(`${yr}/stats`,e)}async function pd(e){const{endpoint:t,headerProps:n}=e,o=Jo(e,dd);return wr(`${yr}/export/${t}`,{properties:n},o)}const gd=["eventKey"],Sd=["eventKey"],vd=()=>Ir(`${ar.v1}/slack`),hd=()=>Ir(`${ar.v1}/slack/applications`),md=()=>Ir(`${ar.v1}/slack/channels`),Ad=e=>e.id?Lr(`${ar.v1}/slack/subscription/${e.id}`,e):Pr(`${ar.v1}/slack/subscriptions`,e),bd=e=>_r(`${ar.v1}/slack/subscriptions/${e.id}`),Td=e=>Pr(`${ar.v1}/slack/applications/registrations`,{code:e}),kd=()=>Ir(`${ar.v1}/emails`),Ed=e=>{let{eventKey:t}=e,n=Jo(e,gd);return Pr(`${ar.v1}/emails/${t}`,n)},Id=({eventKey:e,enabled:t})=>Lr(`${ar.v1}/emails/${e}`,{enabled:t}),Pd=(e,t)=>_r(`${ar.v1}/emails/${e}/subscriptions/${t}`),Ld=(e,t,n)=>Or(`${ar.v1}/emails/${t}/subscriptions/${e}`,n),Od=e=>_r(`${ar.v1}/emails/${e}`),_d=()=>Ir(`${ar.v2}/sms`),wd=e=>{let{eventKey:t}=e,n=Jo(e,Sd);return Pr(`${ar.v2}/sms/${t}`,n)},Cd=({eventKey:e,enabled:t})=>Lr(`${ar.v2}/sms/${e}`,{enabled:t}),Ud=(e,t)=>_r(`${ar.v2}/sms/${e}/subscriptions/${t}`),Rd=(e,t,n)=>Or(`${ar.v2}/sms/${t}/subscriptions/${e}`,n),Dd=e=>_r(`${ar.v2}/sms/${e}`),Nd=()=>Ir(pr),Md=e=>e._id?Lr(`${pr}/${e._id}`,e):Pr(`${pr}/custom`,e),Fd=e=>_r(`${pr}/${e}`),Gd=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Ir(`${pr}/logs/?${o.toString()}`)},$d=e=>Pr(`${pr}/test`,e),Vd=e=>Pr(`${pr}/logs/${e}/retries`),xd=()=>Ir(`${fr.v1}/categories`),Bd=e=>Ir(fr.v1,{channels:e});async function jd(e,t){return Or(nr.v1,e,{headers:Cr(t)})}async function Wd(e){return Ir(nr.v1,void 0,{headers:Cr(e)})}async function Kd(){return Ir(`${nr.v1}/public`)}const Hd=["roleId"],zd=["roleId"],qd=["permissionId"];async function Yd(){return Ir(Ha.v1)}async function Jd(e){return Pr(Ha.v1,e)}async function Qd({roleId:e}){return _r(`${Ha.v1}/${e}`)}async function Xd(e){let{roleId:t}=e,n=Jo(e,Hd);return Lr(`${Ha.v1}/${t}`,n)}async function Zd(e){let{roleId:t}=e,n=Jo(e,zd);return Or(`${Ha.v1}/${t}/permissions`,n)}async function ey(){return Ir(Wa.v1)}async function ty(e){let{permissionId:t}=e,n=Jo(e,qd);return Or(`${Wa.v1}/${t}/roles`,n)}async function ny(){return Ir(`${Wa.v1}/categories`)}async function oy(){return Ir(rr.subscriptions.v1)}async function iy(e){return Ir(`${rr.subscriptions.v1}/${e}`)}async function ay(e){return Or(`${rr.subscriptions.v1}/${e}/cancellations/`,{})}async function ry(e){return Or(`${rr.subscriptions.v1}/${e}/renewals/`,{})}async function ly(e,{paymentMethodId:t,planId:n}){return Or(`${rr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function sy(e){return Ir(`${sr.v1}/${e}`)}async function cy(){return Ir(`${sr.v1}`)}async function uy(e){return Or(`${sr.v1}/${e}/cancellations/`,{})}async function dy(e){return Or(`${sr.v1}/${e}/renewals/`,{})}async function yy(e,{paymentMethodId:t,planId:n}){return Or(`${sr.v1}/${e}`,{paymentMethodId:t,planId:n})}async function fy(){return Ir(rr.plans.v1)}async function py(e){return Ir(`${rr.plans.v1}/${e}`)}async function gy(){return Ir(rr.invoices.v1)}async function Sy(e){return Ir(`${rr.invoices.v1}/${e}`)}async function vy(e,t){return Ir(`${rr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const hy=["email"];async function my(){return Ir(rr.paymentMethods.v1)}async function Ay(e){return Ir(`${rr.paymentMethods.v1}/${e}`)}async function by(e,t){let{email:n}=t,o=Jo(t,hy);return Lr(`${rr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function Ty(e){return Pr(rr.paymentProviders.stripe.subscriptions.v1,e)}async function ky(e){return Ir(`${rr.paymentProviders.stripe.customers.v1}/${e}`)}async function Ey(e){return Pr(`${rr.paymentProviders.stripe.customers.v1}`,e)}async function Iy(){return Ir(`${rr.paymentProviders.stripe.publicConfigurations.v1}`)}async function Py(e){return Pr(`${rr.paymentProviders.stripe.setupIntents.v1}`,e)}async function Ly(e){return Ir(`${rr.summaries.v1}/${e}`)}async function Oy(e){return Ir(`${rr.tenantConfiguration.v1}/${e}`)}async function _y(e){return Pr(`${rr.tenantConfiguration.v1}`,e)}async function wy(){return Ir(lr.v1)}async function Cy(){return Ir(`${rr.configurations.vendorPublicConfigurations.v1}`)}let Uy,Ry,Dy,Ny,My,Fy;async function Gy(){return Ir("/vendors/public")}async function $y(e){return Ir(za.v1,e)}async function Vy(e){return Pr(za.v1,e)}async function xy(e,t){return _r(za.v1,e,{headers:Cr(t)})}async function By(e,t,n){return Pr(`${za.v1}/${e}/roles`,t,{headers:Cr(n)})}async function jy(e,t,n){return _r(`${za.v1}/${e}/roles`,t,{headers:Cr(n)})}async function Wy(e,t,n){return Lr(`${za.v1}/${e}/roles`,t,{headers:Cr(n)})}async function Ky(e,t){return Pr(ir.v1,e,{headers:Cr(t)})}async function Hy(e,t){return _r(`${ir.v1}/${e}`,void 0,{headers:Cr(t)})}async function zy({tenantId:e},t,n){return Lr(`${ir.v1}/${e}`,t,{headers:Cr(n)})}async function qy(e,t,n){return Or(`${za.v1}/${e}/access`,t,{headers:Cr(n)})}async function Yy(e,t){return Pr(`${za.v2}/`,e,{headers:Cr(t)})}async function Jy(){return Ir(`${vr}`)}async function Qy(e,t){return Lr(`${vr}/${e}`,t)}async function Xy(e){return Pr(`${vr}`,e)}async function Zy(e){return _r(`${vr}/${e}`)}async function ef(e){return Ir(`${hr}/${e}/Users/count`)}async function tf(e){return Pr(`${qa.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Uy||(Uy={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Ry||(Ry={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Dy||(Dy={})),(Ny||(Ny={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(My||(My={})),function(e){e.CREATE="create_customer"}(Fy||(Fy={}));const nf=["groupId"];async function of({groupId:e},t){return Ir(`${Ya.v1}/${e}`,U({},t))}async function af(e){return Ir(`${Ya.v1}`,U({},e))}async function rf(e,t){return Pr(`${Ya.getByIds.v1}`,e,{params:t})}async function lf(e){return Pr(`${Ya.v1}`,e)}async function sf(e){let{groupId:t}=e,n=Jo(e,nf);return Lr(`${Ya.v1}/${t}`,n)}async function cf(e){return _r(`${Ya.v1}/${e}`)}async function uf(e,t){return Pr(`${Ya.v1}/${e}/roles`,t)}async function df(e,t){return _r(`${Ya.v1}/${e}/roles`,t)}async function yf(e,t){return Pr(`${Ya.v1}/${e}/users`,t)}async function ff(e,t){return _r(`${Ya.v1}/${e}/users`,t)}async function pf(){return Ir(`${Ya.configurations.v1}`)}async function gf(e){return Pr(`${Ya.configurations.v1}`,e)}async function Sf(){return Ir(Ar.v1)}async function vf(){return Ir(br.v1)}async function hf(e){return Ir(`${Ja.v1}`,e)}async function mf(e){return Pr(`${Ja.v1}`,e)}async function Af(e){return _r(`${Ja.v1}/${e}`)}async function bf(e){return Pr(`${Ja.v1}/preverify`,e)}async function Tf(e){return Pr(`${Ja.v1}/verify`,e)}async function kf(e,t){return Pr(`${Ja.v1}/${e}/delete/verify`,t)}let Ef,If,Pf;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Ef||(Ef={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(If||(If={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Pf||(Pf={}));const Lf=[/^(.*)\/logout$/g,"/logout",/^\/identity\/resources\/auth\/v[0-9]*\/user\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/passwordless\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/webauthn\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/token\/refresh$/g,/^\/identity\/resources\/users\/v[0-9]*$/g,/^\/identity\/resources\/users\/v[0-9]*\/signUp$/g,/^\/identity\/resources\/users\/v[0-9]*\/activate$/g,/^\/identity\/resources\/users\/v[0-9]*\/invitation\/accept$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/verify$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/[^\/]*\/[^\/]*\/verify$/g,/^\/oauth\/token$/g,/^\/oauth\/authorize\/silent$/g],Of=`${$a.v1}/user/token/refresh`,_f=`${gr}/authorize/silent`,wf=`${Va.v2}/me`,Cf=`${Va.v2}/me/tenants`,Uf=`${Va.v3}/me/tenants`;let Rf,Df,Nf,Mf,Ff,Gf,$f,Vf;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Rf||(Rf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Df||(Df={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Nf||(Nf={})),function(e){e.FORCE_MFA="FORCE_MFA",e.BREACHED_PASSWORDS_EXIST="BREACHED_PASSWORDS_EXIST",e.ENABLE_USER_LOCKOUT="ENABLE_USER_LOCKOUT",e.STRENGTHEN_USER_LOCKOUT="STRENGTHEN_USER_LOCKOUT",e.ENABLE_PASSWORD_HISTORY="ENABLE_PASSWORD_HISTORY",e.STRENGTHEN_PASSWORD_HISTORY="STRENGTHEN_PASSWORD_HISTORY",e.ENABLE_FORCE_RELOGIN="ENABLE_FORCE_RELOGIN",e.SET_FORCE_RELOGIN="SET_FORCE_RELOGIN",e.ENABLE_SESSION_CONCURRENCY="ENABLE_SESSION_CONCURRENCY",e.SET_SESSION_CONCURRENCY="SET_SESSION_CONCURRENCY",e.ENABLE_IDLE_SESSION="ENABLE_IDLE_SESSION",e.SET_IDLE_SESSION="SET_IDLE_SESSION",e.ENABLE_IP_RESTRICTIONS="ENABLE_IP_RESTRICTIONS",e.CHANGE_IP_TO_ALLOWLIST="CHANGE_IP_TO_ALLOWLIST",e.ENABLE_DOMAIN_RESTRICTIONS="ENABLE_DOMAIN_RESTRICTIONS",e.CHANGE_DOMAIN_TO_ALLOWLIST="CHANGE_DOMAIN_TO_ALLOWLIST",e.CONFIGURE_SSO="CONFIGURE_SSO"}(Mf||(Mf={})),function(e){e.MFA_FORCED="MFA_FORCED",e.PARTIALLY_FORCED_MFA="PARTIALLY_FORCED_MFA",e.PARTIAL_MFA_USAGE="PARTIAL_MFA_USAGE",e.FULL_MFA_USAGE="FULL_MFA_USAGE",e.BREACHED_PASSWORD_USERS_EXIST="BREACHED_PASSWORD_USERS_EXIST",e.IMPROVE_LOCKOUT_POLICY="IMPROVE_LOCKOUT_POLICY",e.IMPROVE_PASSWORD_HISTORY_POLICY="IMPROVE_PASSWORD_HISTORY_POLICY",e.NO_SESSION_SETTINGS="NO_SESSION_SETTINGS",e.PARTIAL_SESSION_SETTINGS="PARTIAL_SESSION_SETTINGS",e.FULL_SESSION_SETTINGS="FULL_SESSION_SETTINGS",e.NO_IP_RESTRICTIONS="NO_IP_RESTRICTIONS",e.IP_ALLOWLIST="IP_ALLOWLIST",e.IP_DENYLIST="IP_DENYLIST",e.NO_DOMAIN_RESTRICTIONS="NO_DOMAIN_RESTRICTIONS",e.DOMAIN_ALLOWLIST="DOMAIN_ALLOWLIST",e.DOMAIN_DENYLIST="DOMAIN_DENYLIST",e.FULL_PASSWORD_SETTINGS="FULL_PASSWORD_SETTINGS"}(Ff||(Ff={})),function(e){e.SEND_RESET_BREACHED_PASSWORD_EMAIL="SEND_RESET_BREACHED_PASSWORD_EMAIL",e.ADJUST_FORCE_RELOGIN="ADJUST_FORCE_RELOGIN",e.ADJUST_MAX_CONCURRENT_SESSIONS="ADJUST_MAX_CONCURRENT_SESSIONS",e.ADJUST_IDLE_TIMEOUT="ADJUST_IDLE_TIMEOUT"}(Gf||(Gf={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}($f||($f={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(Vf||(Vf={}));const xf={auth:l,teams:s,metadata:c,reports:u,connectivity:f,notifications:d,audits:y,tenants:t,accountSettings:p,roles:g,subscriptions:S,vendor:v,subTenants:h,featureFlags:r,directory:m,impersonate:A,groups:b,users:i,entitlements:a,securityCenter:T,userPhoneNumbers:k};var Bf={fetch:e,ContextHolder:Na,FronteggContext:Ma,api:xf,FronteggApiError:Fa,AuthStrategyEnum:ko,MachineToMachineAuthStrategy:Eo,SocialLoginProviders:To,ISubscriptionCancellationPolicy:Dy,ISubscriptionStatus:Uy,PaymentMethodType:Ry,ProviderType:Ny};let jf,Wf;!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"}(jf||(jf={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Wf||(Wf={}));const Kf="input is invalid type",Hf="undefined"!=typeof ArrayBuffer,zf="0123456789abcdef".split(""),qf=[-2147483648,8388608,32768,128],Yf=[24,16,8,0],Jf=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Qf=["hex","array","digest","arrayBuffer"],Xf=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Hf&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const Zf=function(e){return function(t){const n=new tp(!0).update(t);return null==n?void 0:n[e]()}},ep=function(e){return function(t,n){const o=new np(t,!0).update(n);return null==o?void 0:o[e]()}};class tp{constructor(e=!1){this.blocks=void 0,this.h0=void 0,this.h1=void 0,this.h2=void 0,this.h3=void 0,this.h4=void 0,this.h5=void 0,this.h6=void 0,this.h7=void 0,this.block=void 0,this.start=void 0,this.bytes=void 0,this.hBytes=void 0,this.finalized=void 0,this.hashed=void 0,this.first=void 0,this.lastByteIndex=void 0,this.sharedMemory=!1,this.toString=()=>this.hex(),this.array=()=>tp.prototype.digest(),e?(Xf[0]=Xf[16]=Xf[1]=Xf[2]=Xf[3]=Xf[4]=Xf[5]=Xf[6]=Xf[7]=Xf[8]=Xf[9]=Xf[10]=Xf[11]=Xf[12]=Xf[13]=Xf[14]=Xf[15]=0,this.blocks=Xf):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.sharedMemory=e}update(e){if(this.finalized)return;let t;const n=typeof e;if("string"!==n){if("object"!==n)throw new Error(Kf);if(null===e)throw new Error(Kf);if(Hf&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Hf&&ArrayBuffer.isView(e)))throw new Error(Kf);t=!0}let o,i,a=0;const r=e.length,l=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,l[0]=this.block,l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0),t)for(i=this.start;a<r&&i<64;++a)l[i>>2]|=e[a]<<Yf[3&i++];else for(i=this.start;a<r&&i<64;++a)o=e.charCodeAt(a),o<128?l[i>>2]|=o<<Yf[3&i++]:o<2048?(l[i>>2]|=(192|o>>6)<<Yf[3&i++],l[i>>2]|=(128|63&o)<<Yf[3&i++]):o<55296||o>=57344?(l[i>>2]|=(224|o>>12)<<Yf[3&i++],l[i>>2]|=(128|o>>6&63)<<Yf[3&i++],l[i>>2]|=(128|63&o)<<Yf[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++a)),l[i>>2]|=(240|o>>18)<<Yf[3&i++],l[i>>2]|=(128|o>>12&63)<<Yf[3&i++],l[i>>2]|=(128|o>>6&63)<<Yf[3&i++],l[i>>2]|=(128|63&o)<<Yf[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=l[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}finalize(){if(this.finalized)return;this.finalized=!0;const e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=qf[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,o,i,a,r,l,s,c,u,d=this.h0,y=this.h1,f=this.h2,p=this.h3,g=this.h4,S=this.h5,v=this.h6,h=this.h7;const m=this.blocks;for(e=16;e<64;++e)i=m[e-15],t=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,i=m[e-2],n=(i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(l=704751109,i=m[0]-210244248,h=i-1521486534<<0,p=i+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),l=d&y,o=l^d&f^u,r=g&S^~g&v,i=h+n+r+Jf[e]+m[e],a=t+o,h=p+i<<0,p=i+a<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),s=p&d,o=s^p&y^l,r=h&g^~h&S,i=v+n+r+Jf[e+1]+m[e+1],a=t+o,v=f+i<<0,f=i+a<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&p,o=c^f&d^s,r=v&h^~v&g,i=S+n+r+Jf[e+2]+m[e+2],a=t+o,S=y+i<<0,y=i+a<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),u=y&f,o=u^y&p^c,r=S&v^~S&h,i=g+n+r+Jf[e+3]+m[e+3],a=t+o,g=d+i<<0,d=i+a<<0;this.h0=this.h0+d<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+p<<0,this.h4=this.h4+g<<0,this.h5=this.h5+S<<0,this.h6=this.h6+v<<0,this.h7=this.h7+h<<0}hex(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,o=this.h3,i=this.h4,a=this.h5,r=this.h6,l=this.h7;let s=zf[e>>28&15]+zf[e>>24&15]+zf[e>>20&15]+zf[e>>16&15]+zf[e>>12&15]+zf[e>>8&15]+zf[e>>4&15]+zf[15&e]+zf[t>>28&15]+zf[t>>24&15]+zf[t>>20&15]+zf[t>>16&15]+zf[t>>12&15]+zf[t>>8&15]+zf[t>>4&15]+zf[15&t]+zf[n>>28&15]+zf[n>>24&15]+zf[n>>20&15]+zf[n>>16&15]+zf[n>>12&15]+zf[n>>8&15]+zf[n>>4&15]+zf[15&n]+zf[o>>28&15]+zf[o>>24&15]+zf[o>>20&15]+zf[o>>16&15]+zf[o>>12&15]+zf[o>>8&15]+zf[o>>4&15]+zf[15&o]+zf[i>>28&15]+zf[i>>24&15]+zf[i>>20&15]+zf[i>>16&15]+zf[i>>12&15]+zf[i>>8&15]+zf[i>>4&15]+zf[15&i]+zf[a>>28&15]+zf[a>>24&15]+zf[a>>20&15]+zf[a>>16&15]+zf[a>>12&15]+zf[a>>8&15]+zf[a>>4&15]+zf[15&a]+zf[r>>28&15]+zf[r>>24&15]+zf[r>>20&15]+zf[r>>16&15]+zf[r>>12&15]+zf[r>>8&15]+zf[r>>4&15]+zf[15&r];return s+=zf[l>>28&15]+zf[l>>24&15]+zf[l>>20&15]+zf[l>>16&15]+zf[l>>12&15]+zf[l>>8&15]+zf[l>>4&15]+zf[15&l],s}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,o=this.h3,i=this.h4,a=this.h5,r=this.h6,l=this.h7,s=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return s.push(l>>24&255,l>>16&255,l>>8&255,255&l),s}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class np extends tp{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const o=typeof e;if("string"===o){const t=[],o=e.length;let i,a=0;for(n=0;n<o;++n)i=e.charCodeAt(n),i<128?t[a++]=i:i<2048?(t[a++]=192|i>>6,t[a++]=128|63&i):i<55296||i>=57344?(t[a++]=224|i>>12,t[a++]=128|i>>6&63,t[a++]=128|63&i):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++n)),t[a++]=240|i>>18,t[a++]=128|i>>12&63,t[a++]=128|i>>6&63,t[a++]=128|63&i);e=t}else{if("object"!==o)throw new Error(Kf);if(null===e)throw new Error(Kf);if(Hf&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Hf&&ArrayBuffer.isView(e)))throw new Error(Kf)}var i;e.length>64&&(e=null==(i=new tp(!0).update(e))?void 0:i.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}tp.call(this,t),this.update(r),this.oKeyPad=a,this.inner=!0,this.sharedMemory=t}finalize(){if(super.finalize(),this.inner){this.inner=!1;const e=this.array();tp.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),tp.prototype.finalize.call(this)}}}const op=function(){const e=Zf("hex");e.create=function(){return new tp},e.update=function(t){return e.create().update(t)};for(let t=0;t<Qf.length;++t){const n=Qf[t];e[n]=Zf(n)}return e}();function ip(e,t){const n=U({},e);return t.forEach((e=>{delete n[e]})),n}async function ap(e){var t,n;return null!=(t=window.crypto)&&null!=(n=t.subtle)&&n.digest?async function(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,"_")}(e):(console.warn("Generating CodeChallenge in non-secure domain:",window.location.origin),async function(e){const t=op.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function rp(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let o=0;o<e;o++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=ep("hex");e.create=function(e){return new np(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Qf.length;++t){const n=Qf[t];e[n]=ep(n)}}();const lp=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n}));function*sp(e){const t=yield Vi((e=>e.root.appName));return Ul.getFeatureFlags(e,t)}const cp={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},up=U({},cp,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),dp=[{id:"a040dcf6-b907-4e83-9970-6bd23c88fd40",key:"ReadOnly",name:"Read Only",description:null,isDefault:!1,createdAt:new Date,updatedAt:new Date,permissions:["5b7dafe6-12a1-402b-9082-8eb2777cfcd8","da1d1990-c99c-4086-b845-2d465de3227b"],tenantId:"tenantId",vendorId:"vendorId"},{id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0",key:"Admin",name:"Admin",description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:["502b112e-50fd-4e8d-875e-3abda628d94a","da015508-7cb1-4dcd-9436-d0518a2ecd21"],tenantId:"tenantId",vendorId:"vendorId"}],yp={sub:"",tenants:[],id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!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:"description",categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date,roleIds:[]}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),verified:!1},fp=U({},yp,{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}),pp={loading:!1,error:void 0,saving:!0,profile:yp},gp={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"},Sp={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:ko.EmailAndPassword,machineToMachineAuthStrategy:Eo.ClientCredentials},vp={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},hp={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},mp={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Ap={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},bp={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Tp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],kp={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Ap,roles:Tp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Ep=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Ip={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:[dp[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[dp[0]],managedBy:Nf.FRONTEGG}]},Pp={id:Ip.id,email:Ip.email,name:Ip.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[dp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Lp={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:[dp[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[dp[0]],managedBy:Nf.FRONTEGG}]},Op={id:Lp.id,email:Lp.email,name:Lp.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[dp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},_p={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},wp=[Lp,Ip],Cp=[Op,Pp],Up=[_p],Rp=[{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}],Dp=[{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"}],Np={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Mp={isActive:!0,strategy:Bn.ALLOW},Fp=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Bn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Bn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Bn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Bn.BLOCK,description:"IP 4"}],Gp=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(U({},Lp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},$p=e=>({id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0"+e,key:e,name:e,description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:[],tenantId:"tenantId",vendorId:"vendorId"}),Vp=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Gp(6),roles:[$p("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Nf.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Gp(44),roles:[$p("Editor")],managedBy:Nf.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Gp(8),roles:[$p("Viewer")],managedBy:Nf.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Gp(5),roles:[$p("Admin")],managedBy:Nf.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Gp(21),description:"BDR, AE, and inside sales",roles:[$p("Viewer")],managedBy:Nf.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Gp(23),description:"Dev success and customer success",roles:[$p("Admin")],managedBy:Nf.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Gp(10),description:"The marketing department",roles:[$p("Viewer")],managedBy:Nf.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Gp(4),description:"Human resources",roles:[$p("Viewer")],managedBy:Nf.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Gp(3),roles:[$p("Viewer")],managedBy:Nf.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Gp(8),roles:[$p("Editor")],managedBy:Nf.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Gp(4),roles:[$p("Viewer")],managedBy:Nf.FRONTEGG}],xp={scoring:{score:79},recommendations:{items:[{code:Mf.FORCE_MFA,severity:$f.WARNING,category:Vf.MFA},{code:Mf.ENABLE_FORCE_RELOGIN,severity:$f.WARNING,category:Vf.SESSIONS}]}},Bp={insights:{items:[{category:Vf.MFA,code:Ff.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:Vf.SESSIONS,code:Ff.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:Vf.PASSWORD,code:Ff.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:Vf.DOMAIN,code:Ff.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},jp={users:Cp,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},Wp={users:[Cp[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},Kp={users:[Cp[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0};let Hp,zp,qp;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Hp||(Hp={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(zp||(zp={})),function(e){e.profile="profile",e.privacy="privacy",e.personalApiTokens="personalApiTokens",e.account="account",e.users="users",e.groups="groups",e.security="security",e.sso="sso",e.audits="audits",e.webhooks="webhooks",e.apiTokens="apiTokens",e.roles="roles",e.subscriptions="subscription",e.allAccounts="allAccounts"}(qp||(qp={})),qp.profile,qp.privacy,qp.personalApiTokens,qp.account,qp.users,qp.groups,qp.security,qp.sso,qp.audits,qp.webhooks,qp.apiTokens,qp.roles,qp.subscriptions,qp.allAccounts;const Yp=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Jp=e=>{const{pathname:t}=new URL(e),n=Yp(e);return n?t+n:t},Qp=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},Xp="tenantId",Zp=e=>e.mfaRequired&&e.mfaToken?(Na.setAccessToken(null),Na.setUser(null),!0):(Na.setAccessToken(e.accessToken),Na.setUser(e),!1),eg=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:o}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),o=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:o,totalDevices:t+n+o}})(e);if(1===o){if(n)return ln.authenticatorApp;if(t)return ln.smsVerifyCode}return ln.verify},tg=e=>{if(1===e.length){const[t]=e;if(t===hl.AuthenticatorApp)return ln.authenticatorApp;if(t===hl.SMS)return ln.smsSetPhoneNumber;if(t===hl.EmailCode)return ln.emailVerifyCode}return ln.verify};function*ng(e){let t=Pt.loginWithTwoFactor,n={};const{loginState:o}=yield Vi((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield Fi(xf.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:eg(e.mfaDevices)}:(n={step:tg(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=Pt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:Lt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:U({},o,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:i,mfaDeviceExpiration:a,isBreachedPassword:e.isBreachedPassword})}}const og=(e,t)=>e?(e=>Boolean(null==e?void 0:e.statusCode))(e)?e.message:((e=>e instanceof Error||(null==e?void 0:e.message)&&(null==e?void 0:e.stack)&&"Error"===(null==e?void 0:e.name))(e)?console.error(e.message):"string"==typeof e&&console.error(e),null!=t?t:"We're facing some difficulties, Please try again"):t;let ig;function ag(e,t){var n,o;null==(n=(o=window).onFronteggEvent)||n.call(o,e,t)}!function(e){e.SIGNUP_COMPLETED="signup_completed",e.USER_VERIFIED="user_verified"}(ig||(ig={}));const rg=(e,t=[])=>Object.entries(e).reduce(((e,[n,o])=>"object"==typeof o?[...e,...rg(o,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:o}]),[]),lg=["callback"];function*sg(){yield Di(Fo.setCustomLoginState({loading:!0}));try{const e=yield Fi(xf.metadata.getAdminBoxMetadata);yield Di(Fo.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield Di(Fo.setCustomLoginState({loading:!1,error:og(e)}))}}function*cg(e){let{payload:{callback:t}}=e,n=Jo(e.payload,lg);try{yield Di(Fo.setCustomLoginState({error:null,saving:!0}));const e=rg(n);if(0===e.length)throw new Error("No changes to update");yield Fi(xf.metadata.updateAdminBoxMetadata,{actions:e});const o=yield Fi(xf.metadata.getAdminBoxMetadata);yield Di(Fo.setCustomLoginState({tenantMetadata:o,saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setCustomLoginState({error:og(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*ug(){var e;const[t]=yield Fi(sp,["admin_portal_login_per_tenant"]),n=!(null==(e=Na.getContext())||!e.tenantResolver);if(yield Vi((e=>e.auth.isAuthenticated))){var o;const e=yield null!=(o=Vi((({auth:e})=>{var t;return null==(t=e.tenantsState.activeTenant)?void 0:t.hasCustomLogin})))&&o;return t&&n&&e}return t&&n}function*dg(){try{var e;if(!(yield Fi(ug)))return;const t=yield Vi((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:o}=xf.accountSettings,{applicationUrl:i}=yield Fi(t?n:o);if(!i)return;const{routes:a}=yield Vi((e=>e.auth)),r=null!=(e=Yp(i))?e:"";yield Di(Fo.setState({routes:U({},a,{customLoginAuthenticatedUrl:i,customLoginUrl:a.loginUrl+r})})),yield Di(Fo.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*yg(){yield Da(Fo.loadTenantMetadata,sg),yield Da(Fo.updateTenantMetadata,cg)}let fg;!function(e){e.RECOMMENDATIONS="recommendations",e.INSIGHTS="insights",e.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS="sendBulkResetBreachedPasswordEmails",e.SEND_BREACHED_PASSWORD_EMAIL="sendBreachedPasswordEmail",e.BREACHED_PASSWORD_USERS_TABLE="breachedPasswordUsersTable",e.UNENROLLED_MFA_USERS_TABLE="unenrolledMfaUsersTable",e.INACTIVE_USERS_TABLE="inactiveUsersTable"}(fg||(fg={}));const pg=["callback"];function gg(e){return function*(t){const[n]=yield Fi(sp,["security-center-admin-portal-major-version"]);yield e(t),n&&(yield Sg(),yield vg())}}function*Sg(){const e=fg.RECOMMENDATIONS;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:o}=yield Fi(xf.securityCenter.getRecommendations);yield Di(Fo.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==o?void 0:o.score)?t:0}))}catch(t){yield Di(Fo.setSecurityCenterStateError({key:e,value:og(t)}))}finally{yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*vg(){const e=fg.INSIGHTS;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield Fi(xf.securityCenter.getInsights);yield Di(Fo.setSecurityCenterState({insights:t.items}))}catch(t){yield Di(Fo.setSecurityCenterStateError({key:e,value:og(t)}))}finally{yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*hg(e){let{payload:{callback:t}}=e,n=Jo(e.payload,pg);const o=fg.SEND_BREACHED_PASSWORD_EMAIL;yield Di(Fo.setSecurityCenterStateError({key:o,value:!1})),yield Di(Fo.setSecurityCenterStateLoader({key:o,value:!0}));try{yield Fi(xf.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield Di(Fo.setSecurityCenterStateError({key:o,value:og(e)})),null==t||t(!1,e)}finally{yield Di(Fo.setSecurityCenterStateLoader({key:o,value:!1}))}}function*mg({payload:{callback:e}}){const t=fg.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield Di(Fo.setSecurityCenterStateError({key:t,value:!1})),yield Di(Fo.setSecurityCenterStateLoader({key:t,value:!0}));try{yield Fi(xf.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield Di(Fo.setSecurityCenterStateError({key:t,value:og(n)})),null==e||e(!1)}finally{yield Di(Fo.setSecurityCenterStateLoader({key:t,value:!1}))}}function*Ag({key:e,tableState:t,updateStateKey:n,_offset:o,_limit:i,_preset:a,_email:r,_maxInactiveSeconds:l}){var s,c,u,d;yield Di(Fo.setSecurityCenterStateError({key:e,value:!1})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0}));const y=null!=(s=null!=o?o:null==t||null==(c=t.queryParams)?void 0:c._offset)?s:0,f=null!=(u=null!=i?i:null==t||null==(d=t.queryParams)?void 0:d._limit)?u:10,p=U({_offset:y,_limit:f,_includeSubTenants:!1,_preset:a,_maxInactiveSeconds:l},!!r&&{_email:r});try{const{items:t,_metadata:{totalItems:o,totalPages:i}}=yield Fi(xf.users.getUsersV3,p),a={totalUsersItems:o,totalUsersPages:i,usersPageOffset:y,queryParams:U({_offset:y,_limit:f,_maxInactiveSeconds:l},!!r&&{_email:r})};if(t.length){const e=yield function*(e){const t=e.map((e=>e.id)),n=yield Fi(xf.roles.getRoles),o=yield Fi(xf.users.getUsersRoles,{ids:t});return e.map((e=>{var t,i;const a=null==o||null==(t=o.find((t=>t.userId===e.id)))?void 0:t.roleIds;return U({},e,{roles:null!=(i=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?i:[]})}))}(t);yield Di(Fo.setSecurityCenterState({[n]:U({users:e},a)}))}else yield Di(Fo.setSecurityCenterState({[n]:U({users:[]},a)}))}catch(t){yield Di(Fo.setSecurityCenterStateError({key:e,value:og(t)}))}finally{yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*bg({payload:e}){var t;const n=fg.BREACHED_PASSWORD_USERS_TABLE,o=yield null!=(t=Vi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield Ag(U({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:yo.BREACHED_PASSWORDS,tableState:o},e))}function*Tg({payload:e}){var t;const n=fg.UNENROLLED_MFA_USERS_TABLE,o=yield null!=(t=Vi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield Ag(U({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:yo.MFA_UNENROLLED,tableState:o},e))}function*kg({payload:e}){var t;const n=fg.INACTIVE_USERS_TABLE,o=yield null!=(t=Vi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield Ag(U({key:n,updateStateKey:"inactiveUsersTable",_preset:yo.INACTIVE,tableState:o},e))}function*Eg(){yield Ua(Fo.loadRecommendations,Sg),yield Ua(Fo.loadInsights,vg),yield Ua(Fo.sendResetBreachedPasswordEmail,hg),yield Ua(Fo.sendBulkResetBreachedPasswordEmails,mg),yield Ua(Fo.loadBreachedPasswordUsers,bg),yield Ua(Fo.loadUnenrolledMfaUsers,Tg),yield Ua(Fo.loadInactiveUsers,kg)}function*Ig(){const e=fg.RECOMMENDATIONS;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield xi(500),yield Di(Fo.setSecurityCenterState({recommendations:xp.recommendations.items,score:xp.scoring.score})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*Pg(){const e=fg.INSIGHTS;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield xi(500),yield Di(Fo.setSecurityCenterState({insights:Bp.insights.items})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*Lg(){const e=fg.BREACHED_PASSWORD_USERS_TABLE;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield xi(500),yield Di(Fo.setSecurityCenterState({breachedPasswordUsersTable:jp})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*Og(){const e=fg.UNENROLLED_MFA_USERS_TABLE;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield xi(500),yield Di(Fo.setSecurityCenterState({unenrolledMfaUsersTable:Kp})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*_g(){const e=fg.INACTIVE_USERS_TABLE;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield xi(500),yield Di(Fo.setSecurityCenterState({inactiveUsersTable:Wp})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*wg({payload:{callback:e}}){const t=fg.SEND_BREACHED_PASSWORD_EMAIL;yield Di(Fo.setSecurityCenterStateLoader({key:t,value:!0})),yield xi(500),null==e||e(!0),yield Di(Fo.setSecurityCenterStateLoader({key:t,value:!1}))}function*Cg(){yield Ua(Fo.loadRecommendations,Ig),yield Ua(Fo.loadInsights,Pg),yield Ua(Fo.loadBreachedPasswordUsers,Lg),yield Ua(Fo.loadUnenrolledMfaUsers,Og),yield Ua(Fo.loadInactiveUsers,_g),yield Ua(Fo.sendResetBreachedPasswordEmail,wg)}const Ug=["callback"],Rg=["callback"],Dg=["callback"],Ng=["callback"],Mg=["callback"],Fg=["callback"];function*Gg(){yield Di(Fo.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getGlobalSecurityPolicy);yield Di(Fo.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyGlobalState({error:og(e),loading:!1}))}yield Di(Fo.loadSecurityPolicyMfa()),yield Di(Fo.loadSecurityPolicyVendorMfa()),yield Di(Fo.loadSecurityPolicyLockout()),yield Di(Fo.loadSecurityPolicyVendorLockout()),yield Di(Fo.loadSecurityPolicyVendorPasswordHistory()),yield Di(Fo.loadSecurityPolicyCaptcha()),yield Di(Fo.loadPublicAuthStrategiesPolicy())}function*$g(e){var t,n;if(!(yield Fi(ug)))return e;const o=yield Fi(xg);return null!=o&&null!=(t=o.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?U({},e,{authStrategy:o.mainAuthStrategies[0].strategy}):e}function*Vg(){yield Di(Fo.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getVendorConfig),t=yield $g(e);yield Di(Fo.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyPublicState({error:og(e),loading:!1}))}}function*xg(){const e=yield Vi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Fi(xf.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield Fi(xf.auth.getVendorPublicAuthStrategiesConfig),t}function*Bg(){yield Di(Fo.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield Fi(xg);yield function*(e){const t=yield Fi(ug);if(!e||!t)return;const{policy:n}=yield Vi((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield Di(Fo.setSecurityPolicyPublicState({policy:U({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield Di(Fo.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyAuthStrategyPublicState({error:og(e),loading:!1}))}}function*jg(){yield Di(Fo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getMfaPolicy);yield Di(Fo.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyMfaState({error:og(e),loading:!1}))}}function*Wg(){yield Di(Fo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getVendorMfaPolicy);yield Di(Fo.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyVendorMfaState({error:og(e),loading:!1}))}}function*Kg(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Ug);yield Di(Fo.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Fi(xf.auth.saveMfaPolicy,n);yield Di(Fo.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setSecurityPolicyMfaState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*Hg(){yield Di(Fo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getLockoutPolicy);yield Di(Fo.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyLockoutState({error:og(e),loading:!1}))}}function*zg(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Rg);yield Di(Fo.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Fi(xf.auth.saveLockoutPolicy,n);yield Di(Fo.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setSecurityPolicyLockoutState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*qg(){yield Di(Fo.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getVendorLockoutPolicy);yield Di(Fo.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyVendorLockoutState({error:og(e),loading:!1}))}}function*Yg(){yield Di(Fo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getCaptchaPolicy);yield Di(Fo.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyCaptchaState({error:og(e),loading:!1}))}}function*Jg(){yield Di(Fo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getPasswordHistoryPolicy);yield Di(Fo.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyPasswordHistoryState({error:og(e),loading:!1}))}}function*Qg(){yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getVendorPasswordHistoryPolicy);yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({error:og(e),loading:!1}))}}function*Xg(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Dg);yield Di(Fo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Fi(xf.auth.savePasswordHistoryPolicy,n);yield Di(Fo.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setSecurityPolicyPasswordHistoryState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*Zg(){yield Di(Fo.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getPasswordConfigPolicy);yield Di(Fo.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyPasswordState({error:og(e),loading:!1}))}}function*eS(){yield Da(Fo.loadSecurityPolicy,Gg),yield Ua(Fo.saveSecurityPolicyMfa,gg(Kg)),yield Ua(Fo.loadSecurityPolicyMfa,jg),yield Ua(Fo.loadSecurityPolicyVendorMfa,Wg),yield Ua(Fo.saveSecurityPolicyLockout,gg(zg)),yield Ua(Fo.loadSecurityPolicyLockout,Hg),yield Ua(Fo.loadSecurityPolicyVendorLockout,qg),yield Ua(Fo.loadSecurityPolicyCaptcha,Yg),yield Ua(Fo.saveSecurityPolicyPasswordHistory,gg(Xg)),yield Ua(Fo.loadSecurityPolicyPasswordHistory,Jg),yield Ua(Fo.loadSecurityPolicyVendorPasswordHistory,Qg),yield Ua(Fo.loadVendorPasswordConfig,Zg),yield Ua(Fo.loadPublicSecurityPolicy,Vg),yield Ua(Fo.loadPublicAuthStrategiesPolicy,Bg)}function*tS(){yield Di(Fo.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Di(Fo.setSecurityPolicyPublicState({policy:Sp,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyPublicState({error:og(e),loading:!1}))}}function*nS(){yield Di(Fo.setSecurityPolicyGlobalState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyGlobalState({policy:gp,loading:!1})),yield Di(Fo.loadSecurityPolicyMfa()),yield Di(Fo.loadSecurityPolicyVendorMfa()),yield Di(Fo.loadSecurityPolicyLockout()),yield Di(Fo.loadSecurityPolicyVendorLockout()),yield Di(Fo.loadSecurityPolicyPasswordHistory()),yield Di(Fo.loadSecurityPolicyVendorPasswordHistory()),yield Di(Fo.loadSecurityPolicyCaptcha())}function*oS(){yield Di(Fo.setSecurityPolicyMfaState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyMfaState({policy:vp,loading:!1}))}function*iS(){yield Di(Fo.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyVendorMfaState({policy:vp,loading:!1}))}function*aS(e){var t;let{payload:{callback:n}}=e,o=Jo(e.payload,Ng);yield Di(Fo.setSecurityPolicyMfaState({saving:!0,error:null}));const i=U({},hp,{id:null!=(t=o.id)?t:hp.id,enforceMFAType:o.enforceMFAType});yield bt(),yield Di(Fo.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*rS(){yield Di(Fo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyLockoutState({policy:hp,loading:!1}))}function*lS(){yield Di(Fo.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyVendorLockoutState({policy:hp,loading:!1}))}function*sS(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Mg);yield Di(Fo.setSecurityPolicyLockoutState({saving:!0,error:null})),yield bt();const o=U({},hp,n,{id:n.id?n.id:hp.id});null==t||t(o),yield Di(Fo.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*cS(){yield Di(Fo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyLockoutState({policy:hp,loading:!1}))}function*uS(){yield Di(Fo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyPasswordHistoryState({policy:mp,loading:!1}))}function*dS(){yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({policy:mp,loading:!1}))}function*yS(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Fg);yield Di(Fo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield bt();const o=U({},mp,n,{id:n.id?n.id:mp.id});null==t||t(o),yield Di(Fo.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*fS(){yield Da(Fo.loadSecurityPolicy,nS),yield Ua(Fo.loadPublicSecurityPolicy,tS),yield Ua(Fo.saveSecurityPolicyMfa,aS),yield Ua(Fo.loadSecurityPolicyMfa,oS),yield Ua(Fo.loadSecurityPolicyVendorMfa,iS),yield Ua(Fo.saveSecurityPolicyLockout,sS),yield Ua(Fo.loadSecurityPolicyLockout,rS),yield Ua(Fo.loadSecurityPolicyVendorLockout,lS),yield Ua(Fo.loadSecurityPolicyCaptcha,cS),yield Ua(Fo.saveSecurityPolicyPasswordHistory,yS),yield Ua(Fo.loadSecurityPolicyPasswordHistory,uS),yield Ua(Fo.loadSecurityPolicyVendorPasswordHistory,dS)}const pS=["events","url"];function*gS(){yield Di(Fo.setSignUpState({loading:!0}));try{const e=yield Fi(xf.auth.getVendorConfig),t=yield $g(e),{allowSignups:n,allowNotVerifiedUsersLogin:o}=e;yield Di(Fo.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:o,firstLoad:!1})),yield Di(Fo.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Di(Fo.setSignUpState({loading:!1,error:og(e),firstLoad:!1}))}}function*SS(e){let{payload:{events:t,url:n}}=e,o=Jo(e.payload,pS);yield Di(Fo.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield Vi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c,tenants:u=[],activeTenant:d}=yield Fi(xf.auth.signUpUser,o);if(!o.invitationToken){var i;const{email:e,name:a,companyName:r}=o,l={email:e,name:a,companyName:r,url:n,authenticationType:zp.PASSWORD,id:c,tenantId:s,createdAt:new Date};null==t||null==(i=t.signUpComplete)||i.call(t,l),ag(ig.SIGNUP_COMPLETED,l)}if(!r&&l&&Zp(l)){const t=yield ng(l);yield Di(Fo.setState(t)),a(e.loginUrl)}else{const{tenantsState:e}=yield Vi((e=>e.auth));yield Di(Fo.setSignUpState({loading:!1,shouldActivate:r,stage:vn.SignUpSuccess})),yield Di(Fo.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:U({},e,{tenants:u,activeTenant:d})}))}}catch(e){Na.setAccessToken(null),Na.setUser(null),yield Di(Fo.setSignUpState({loading:!1,error:og(e)}))}yield Di(Fo.setSignUpState({loading:!1}))}function*vS(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Vi((e=>e.auth.signUpState));yield Di(Fo.resetSignUpState()),yield Di(Fo.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*hS(){yield Da(Fo.signUpUser,SS),yield Da(Fo.resetSignUpStateSoft,vS)}const mS={setVendorState:(e,{payload:t})=>U({},e,t)},AS={loadVendorPublicInfo:ut("vendor/loadVendorPublicInfo")},bS={loading:!1},{reducer:TS,actions:kS}=yt({name:Dt,initialState:bS,reducers:U({},mS)}),ES=U({},kS,AS);function*IS(){yield Di(ES.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield xf.vendor.getVendorPublicInfo();yield Di(ES.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Di(ES.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var PS=n(378),LS=n.n(PS);function OS(e,t){return LS()(e,t)}function*_S({payload:e}){const t=null==e?void 0:e.callback;try{const e=yield Fi(xf.entitlements.loadEntitlements);yield function*(e){OS(yield Vi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield Di(Fo.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*wS(){yield Da(Fo.loadEntitlements,_S)}const CS=["callback"],US=["callback"],RS=["callback"],DS=["callback"],NS=["callback","events"],MS=["callback"],FS=["callback"],GS=["callback"],$S=["callback"],VS=["user"],xS=["callback"],BS=["callback"],jS=["callback"],WS=["callback"],KS=["callback"],HS=["callback","deviceId"],zS=["callback"],qS=["callback"],YS=["callback","deviceId"],JS=["callback","deviceId"],QS=["callback","deviceId"];function*XS(e){const t=yield Vi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return OS(t,null==e?void 0:e.entitlements)?U({},e,{entitlements:t}):e}function*ZS({user:e,tenants:t=[],activeTenant:n},o={}){const{tenantsState:i}=yield Vi((e=>e.auth));yield Di(Fo.setState(U({user:e,tenantsState:U({},i,{tenants:t,activeTenant:n,loading:!1})},o)))}function*ev(){const e=Na.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:o=!1,allowedRedirectOrigins:i=[]}=yield Vi((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:l,activateUrl:s}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;u||(yield Fi(dg),u=yield Vi((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})));const d=window.localStorage.getItem(_t);d&&![a,r,l,s].includes(d)&&(c=d),window.localStorage.removeItem(_t),yield bt(200),Di(Fo.resetLoginState());const y=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:o})=>{let i=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),o=new URL(e),i=o.origin===n.origin;return t.includes(o.origin)||i})(a,n)?i=a:console.warn("The redirect url param is not valid, the origin is a different site"):i=a:o&&(i+=window.location.search),i})({authenticatedUrl:u?Jp(u):c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(y,{refresh:y.startsWith("http")})}function*tv(){let e;try{var t;const n=yield Fi(xf.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield Di(Fo.setState({ssoACS:e}))}function*nv(){try{const{isActive:e}=yield Fi(xf.auth.getSSOPublicConfiguration);yield Di(Fo.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*ov(e){var t;const{routes:n,loginState:o}=yield Vi((e=>e.auth)),i=null!=(t=localStorage.getItem("register-quick-login"))?t:o.quickLoginToRegister;return i&&"true"!==localStorage.getItem(`${e.id}-${i}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*iv(){const{hostedLoginBox:e}=yield Vi((e=>e.auth));e?yield Fi(av):yield Fi(lv)}function*av(){const{user:e}=yield Vi((e=>e.auth));if(null==e||!e.refreshToken)return Na.setAccessToken(null),Na.setUser(null),void(yield Di(Fo.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Fi(xf.auth.exchangeOAuthTokensV2,t),o=yield Fi(XS,n.user);yield Fi(ZS,U({},n,{user:o}),{isAuthenticated:!0})}catch(e){Na.setAccessToken(null),Na.setUser(null),yield Di(Fo.setState({user:null,isAuthenticated:!1}))}}function*rv(){const{user:e}=yield Vi((e=>e.auth));if(null==e||!e.refreshToken)return Na.setAccessToken(null),Na.setUser(null),void(yield Di(Fo.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Fi(xf.auth.exchangeOAuthTokensV2,t),o=yield Fi(XS,n.user);yield Fi(ZS,U({},n,{user:o}),{isAuthenticated:!0})}catch(e){Na.setAccessToken(null),Na.setUser(null),yield Di(Fo.setState({user:null,isAuthenticated:!1}))}}function*lv(){try{const t=Na.onRedirectTo,{routes:n,loginState:o}=yield Vi((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Fi(xf.auth.refreshTokenV3);if(Zp(i)){const e=yield ng(i);yield Di(Fo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield ov(i),l=yield Fi(XS,i);yield Fi(ZS,{user:l,tenants:a,activeTenant:r},{loginState:U({},o,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield cv(n)}}catch(e){Na.setAccessToken(null),Na.setUser(null),yield Di(Fo.setState({user:void 0,isAuthenticated:!1}))}}function*sv(){try{const t=Na.onRedirectTo,{routes:n,loginState:o}=yield Vi((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Fi(xf.auth.refreshTokenV3);if(Zp(i)){const e=yield ng(i);yield Di(Fo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const l=yield Fi(XS,i);if(yield Fi(Ev))yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})),yield Fi(ZS,{user:l,tenants:a,activeTenant:r},{isLoading:!1}),t(n.loginUrl,{preserveQueryParams:!0});else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield ov(i);yield Fi(ZS,{user:l,tenants:a,activeTenant:r},{loginState:U({},o,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield cv(n)}}}catch(e){Na.setAccessToken(null),Na.setUser(null),yield Di(Fo.setState({user:void 0,isAuthenticated:!1}))}}function*cv(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=Na.onRedirectTo,{routes:i,loginState:a}=yield Vi((e=>e.auth)),r=n.searchParams.get("invitationToken"),l=[i.socialLoginCallbackUrl,i.oidcRedirectUrl,i.samlCallbackUrl];r||l.push(i.loginUrl,i.signUpUrl),e?o(i.loginUrl):l.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&i.signUpSuccessUrl&&i.socialLoginCallbackUrl===window.location.pathname?o(i.signUpSuccessUrl,{refresh:i.signUpSuccessUrl.startsWith("http")}):yield ev())}function*uv({payload:{callback:e}}){try{const{ip:t}=yield Fi(xf.metadata.getCurrentUserIpMetadata);yield Di(Fo.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*dv({payload:e}){const t=[];(yield Fi(ug))?yield Fi(iv):t.push(Fi(iv)),e&&(yield Di(Fo.setState({isLoading:!0})),yield Di(Fo.loadSocialLoginsConfigurationV2()),t.push(Fi(gS)),t.push(Fi(Bg)),t.push(Fi(nv)),t.push(Fi(IS)),t.push(Fi(tv)),t.push(Fi(dg))),yield Ni(t),yield Di(Fo.setState({isLoading:!1}))}function*yv({accessToken:e,user:t}){if(!e)return void(yield Di(Fo.setState({user:void 0,isAuthenticated:!1})));const n=Na.onRedirectTo,{routes:o}=yield Vi((e=>e.auth));if(Zp(t)){const e=yield ng(t);yield Di(Fo.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*fv({payload:e}){const t=[];yield Di(Fo.loadSocialLoginsConfigurationV2()),t.push(Fi(gS)),t.push(Fi(nv)),t.push(Fi(IS)),t.push(Fi(tv)),t.push(Fi(yv,e)),t.push(Fi(dg)),yield Ni(t)}const pv=e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}};function*gv(){const e=yield Fi(xf.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield Fi(ZS,e,{isAuthenticated:!0,isLoading:!1})}function*Sv({payload:e}){const{disableSilentRefresh:t}=yield Vi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield gv()}catch(t){yield hv(e)}}function*vv({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n}}){if(n){const{urlStrategy:e}=yield Vi((e=>({urlStrategy:e.root.urlStrategy}))),t=pv(e);if(yield Di(Fo.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:o}=yield Vi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(o)throw new Error("silent refresh is disabled");yield gv()}catch(n){if(!t)return void(yield Di(Fo.setState({isLoading:!1})));yield hv(e)}}function*hv(e){const{routes:t,context:n,onRedirectTo:o,urlStrategy:i}=yield Vi((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(pv(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield Di(Fo.setState({isLoading:!0}));const a=rp(),r=rp(),l=yield Fi(ap,r);localStorage.setItem(wt,r);let s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`;yield Fi(dg);const c=yield Vi((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));c&&(s.endsWith("/")&&(s=s.slice(0,-1)),s+=c);const u=`${Tr(n,"/oauth/authorize")}/oauth/authorize`,d=U({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);if(n.tenantResolver){var y;const e=yield null==(y=n.tenantResolver)?void 0:y.call(n);null!=e&&e.tenant&&(d.organization=e.tenant)}const f=Qp(Xp);f&&(d.tenantId=f),o(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*mv({payload:e}){const t=localStorage.getItem(wt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:o}=yield Vi((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let i=`${window.location.origin}${"path"===o?"":"#"}${n.hostedLoginRedirectUrl}`;yield Fi(dg);const a=yield Vi((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));a&&(i.endsWith("/")&&(i=i.slice(0,-1)),i+=a);const r={code:e.code,redirect_uri:i,code_verifier:t,grant_type:"authorization_code"};try{const e=yield Fi(xf.auth.exchangeOAuthTokensV2,r);yield Fi(ZS,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield Di(Fo.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{yield ev()}}function*Av(e){let{payload:{callback:t}}=e,n=Jo(e.payload,CS);try{yield Di(Fo.setLoginState({loading:!0}));const e=yield Fi(xf.auth.changePhoneNumberWithVerification,n);yield Di(Fo.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Pt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:og(e),loading:!1}))}}function*bv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,US);try{yield Di(Fo.setLoginState({loading:!0})),yield Fi(xf.auth.verifyChangePhoneNumber,n),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:og(e),loading:!1}))}}function*Tv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,RS);try{yield Di(Fo.setLoginState({loading:!0}));const e=yield Fi(xf.auth.passwordlessPreLogin,U({},n,{type:ko.SmsCode}));yield Di(Fo.setLoginState({step:Pt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:og(e),loading:!1})),null==t||t(e)}}function*kv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,DS);try{let e;yield Di(Fo.setLoginState({loading:!0})),function(e){return"email"in e}(n)&&(e=n.email);const o=yield Fi(xf.auth.passwordlessPreLogin,n),i=Io[n.type];yield Di(Fo.setLoginState({step:i,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:e,error:void 0})),null==t||t()}catch(e){yield Di(Fo.setLoginState({error:og(e),loading:!1})),null==t||t()}}function*Ev(){const{publicAuthStrategyPolicy:e}=yield Vi((e=>e.auth.securityPolicyState)),{policy:t}=e,n=(e=>{var t;return!(null==e||null==(t=e.secondaryAuthStrategies)||!t.some((({isActive:e,strategy:t})=>e&&t===Sl.Passkeys)))})(t),o="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield Fi(sp,["show-passkeys-new"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield Fi(xf.auth.getWebAuthnDevices);return yield Di(Fo.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*Iv(e){let{payload:{callback:t,events:n}}=e,o=Jo(e.payload,NS);try{yield Di(Fo.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield Fi(xf.auth.passwordlessPostLoginV2,o),l=Na.onRedirectTo,{routes:s}=yield Vi((e=>e.auth));if(Zp(e)){const t=yield ng(e);yield Di(Fo.setState(t)),l(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield Vi((e=>e.auth));if(e.emailVerified){var i;const t={email:e.email,origin:Hp.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name};null==n||null==(i=n.userVerified)||i.call(n,t),ag(ig.USER_VERIFIED,t)}e.id&&localStorage.setItem("userId",e.id),yield Fi(ZS,{user:e,tenants:a,activeTenant:r}),yield Di(Fo.setLoginState({error:void 0})),yield Di(Fo.setState({isLoading:!1})),o.flow===Lt.Login?(yield Fi(Ev))?(yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})),l(s.loginUrl,{preserveQueryParams:!0})):(yield Di(Fo.setState({isAuthenticated:!0})),yield ev()):l(s.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield Di(Fo.setLoginState({error:og(e,"Failed to authenticate")}))}finally{yield Di(Fo.setLoginState({loading:!1}))}}function*Pv({payload:e}){try{yield Di(Fo.setLoginState({loading:!0}));const{name:t}=yield Fi(xf.auth.verifyInviteToken,e);yield Di(Fo.setLoginState({inviteTokenTenantName:t}))}catch(e){yield Di(Fo.setLoginState({inviteTokenError:og(e,"We couldn't verify your invitation")}))}finally{yield Di(Fo.setLoginState({loading:!1}))}}function*Lv({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:o}}){yield Di(Fo.setLoginState({loading:!0}));try{const i=yield Vi((({auth:{onRedirectTo:e}})=>e)),a=Qp(Xp),{address:r,idpType:l}=yield Fi(xf.auth.preLoginV2,{email:e,tenantId:a});if(r){let e=r;if(l===Wf.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield Vi((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield Di(Fo.setLoginState({step:Pt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{i(e,{refresh:!0})}),2e3)}else yield Ov({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield Ov({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*Ov(e){let{callback:t}=e,n=Jo(e,MS);const o=yield Vi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==o||!o.authStrategy)return yield Di(Fo.setLoginState({step:Pt.loginWithPassword,loading:!1})),void(null==t||t());(null==o?void 0:o.authStrategy)===ko.EmailAndPassword?(yield Di(Fo.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t()):[ko.MagicLink,ko.Code,ko.SmsCode].includes(null==o?void 0:o.authStrategy)?yield Di(Fo.passwordlessPreLogin(U({},n,{type:null==o?void 0:o.authStrategy,callback:t}))):(yield Di(Fo.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t())}function*_v({payload:{callback:e}}){try{yield Di(Fo.setLoginState({loading:!0}));const{options:t}=yield Fi(xf.auth.webAuthnCreateNewDeviceSession);t.user.id=Et(t.user.id),t.challenge=Et(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield Di(Fo.setLoginState({error:og(t)})),null==e||e(null)}finally{yield Di(Fo.setLoginState({loading:!1}))}}function*wv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,FS);try{yield Di(Fo.setLoginState({loading:!0}));const e=It(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?vl.Platform:vl.CrossPlatform;yield Fi(xf.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:og(e)})),null==t||t(null)}finally{yield Di(Fo.setLoginState({loading:!1}))}}function*Cv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,GS);try{var o;yield Di(Fo.setPasskeysState({loading:!0})),yield Di(Fo.setLoginState({loading:!0}));const{options:e}=yield Fi(xf.auth.webAuthnPreLogin,n);e.challenge=Et(e.challenge),e.allowCredentials=null==(o=e.allowCredentials)?void 0:o.map((e=>U({},e,{id:Et(e.id)}))),yield Di(Fo.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield Di(Fo.setLoginState({error:og(e)})),null==t||t(null)}finally{yield Di(Fo.setPasskeysState({loading:!1})),yield Di(Fo.setLoginState({loading:!1}))}}function*Uv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,$S);try{var o;yield Di(Fo.setPasskeysState({loading:!0})),yield Di(Fo.setLoginState({loading:!0}));const e=It(n.publicKey),i=yield Fi(xf.auth.webAuthnPostLoginV2,U({},e,{response:U({},e.response,{userHandle:null!=(o=e.response.userHandle)?o:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken})),{user:a}=i,r=Jo(i,VS);if(Zp(a)){const e=Na.onRedirectTo,{routes:t}=yield Vi((e=>e.auth)),n=yield ng(a);yield Di(Fo.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield Fi(ZS,U({user:a},r),{isAuthenticated:!0}),yield Di(Fo.setLoginState({error:void 0})),yield ev(),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:og(e)})),null==t||t(null)}finally{yield Di(Fo.setPasskeysState({loading:!1})),yield Di(Fo.setLoginState({loading:!1}))}}function*Rv({payload:e}){const{onRedirectTo:t,routes:n}=yield Vi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Di(Fo.setLoginState({loading:!0}));try{const t=yield Fi(xf.auth.postLogin,e);yield Di(Fo.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield ev()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Di(Fo.setLoginState({step:Pt.loginWithSSOFailed,loading:!1}))}}function*Dv({payload:{email:e,password:t,recaptchaToken:n,invitationToken:o,callback:i}}){yield Di(Fo.setLoginState({loading:!0}));try{const{user:a,tenants:r=[],activeTenant:l}=yield Fi(xf.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:o}),s=Na.onRedirectTo,{routes:c}=yield Vi((e=>e.auth));if(Zp(a)){const e=yield ng(a);yield Di(Fo.setState(e)),s(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Vi((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield Fi(ZS,{user:a,tenants:r,activeTenant:l},{loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===Lt.Login?Pt.success:t.step,tenants:r,tenantsLoading:!0,isBreachedPassword:a.isBreachedPassword},isAuthenticated:n});const[o]=yield Fi(sp,["security-center-show-login-flows"]);t.flow===Lt.Login&&(o&&a.isBreachedPassword&&!n?yield Di(Fo.setLoginState({step:Pt.breachedPassword,loading:!1})):n&&((yield Fi(Ev))?(yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})),s(c.loginUrl,{preserveQueryParams:!0})):yield ev()))}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){Na.setAccessToken(null),Na.setUser(null),null==i||i(!1,t),yield Di(Fo.setLoginState({email:e,error:og(t),loading:!1}))}}function*Nv({payload:{mfaToken:e,value:t,rememberDevice:n,callback:o}}){yield Di(Fo.setLoginState({loading:!0}));try{const{user:i,tenants:a=[],activeTenant:r}=yield Fi(xf.auth.loginWithMfaV2,{mfaToken:e,value:t,rememberDevice:n}),{loginState:l}=yield Vi((e=>e.auth)),s=l.flow===Lt.Login?Pt.success:l.step,c=!!i.accessToken;yield Fi(ZS,{user:i,tenants:a,activeTenant:r},{loginState:{flow:l.flow,quickLoginToRegister:l.quickLoginToRegister,loading:!1,step:s,error:void 0,tenants:a},isAuthenticated:c}),i.id&&localStorage.setItem("userId",i.id),yield Di(Fo.setLoginState({error:void 0,loading:!1}));const[u]=yield Fi(sp,["security-center-show-login-flows"]);l.flow===Lt.Login&&(u&&l.isBreachedPassword&&!c?yield Di(Fo.setLoginState({step:Pt.breachedPassword,loading:!1})):(yield Fi(Ev))?yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield ev()),null==o||o(!0)}catch(e){yield Di(Fo.setLoginState({error:og(e),loading:!1})),null==o||o(!1,e)}}function*Mv({payload:e}){yield Di(Fo.setLoginState({loading:!0}));try{var t;yield Fi(xf.auth.recoverMfaToken,e),yield Di(Fo.setLoginState({loading:!1,error:void 0,step:Pt.preLogin})),yield Di(Fo.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setLoginState({error:og(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Fv({payload:e}){const{hostedLoginBox:t}=yield Vi((e=>e.auth));yield Di(Fo.setState({isLoading:!0}));try{t?yield Fi(xf.auth.OAuthLogout):yield Fi(xf.auth.logout)}catch{}yield Di(Fo.resetState()),yield Di(Fo.requestAuthorize(!0)),null==e||e()}function*Gv({payload:e}){var t;try{yield Fi(xf.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*$v({user:e,tenants:t,activeTenant:n}){const o={step:ln.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(o.recoveryCode=e.recoveryCode),yield Di(Fo.setMfaState(o)),yield Di(Fo.setUser(e)),yield Di(Fo.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Vv({user:e,tenants:t,activeTenant:n}){const{loginState:o}=yield Vi((e=>e.auth));yield Di(Fo.setUser(e)),yield Di(Fo.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield Vi((e=>e.auth.mfaState)),[a]=yield Fi(sp,["security-center-show-login-flows"]),r=!!e.accessToken;if(o.flow===Lt.Login)if(a&&o.isBreachedPassword&&!r)yield Di(Fo.setLoginState({step:Pt.breachedPassword,loading:!1}));else{const e=yield Fi(Ev);i===ln.smsVerifyCode&&e?yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield ev()}yield Di(Fo.setState({isAuthenticated:r}))}function*xv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,xS);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(xf.auth.preEnrollMFASMSForLogin,n);yield Di(Fo.setMfaState({otcToken:e.otcToken,step:ln.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Bv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,BS);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(xf.auth.enrollMFASMSForLoginV2,n);yield $v(e),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*jv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,jS);yield Di(Fo.setLoginState({loading:!0}));try{var o;const e=yield Fi(xf.auth.preEnrollMFAWebAuthnForLogin,n),i=U({},e.options,{challenge:Et(e.options.challenge),user:U({},e.options.user,{id:Et(e.options.user.id)}),excludeCredentials:null==(o=e.options.excludeCredentials)?void 0:o.map((e=>U({},e,{id:Et(e.id)})))});yield Di(Fo.setLoginState({loading:!1})),null==t||t({options:i,webauthnToken:e.webauthnToken})}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Wv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,WS);yield Di(Fo.setLoginState({loading:!0}));try{const e=It(n.publicKey),o=yield Fi(xf.auth.enrollMFAWebAuthnForLoginV2,U({},n,{options:e}));yield $v(o),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Kv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,KS);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(xf.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield $v(e),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Hv(e){let{payload:{callback:t,deviceId:n}}=e,o=Jo(e.payload,HS);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(xf.auth.preVerifyMFASMSForLogin,n,o);yield Di(Fo.setMfaState({otcToken:e.otcToken,step:ln.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*zv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,zS);try{const e=yield Fi(xf.auth.preVerifyMFAEmailCode,n);yield Di(Fo.setMfaState({otcToken:e.otcToken,step:ln.emailVerifyCode})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:og(e)})),null==t||t(null)}}function*qv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,qS);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(xf.auth.verifyMFAEmailCodeV2,n);yield Vv(e),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Yv(e){let{payload:{callback:t,deviceId:n}}=e,o=Jo(e.payload,YS);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(xf.auth.verifyMFASMSForLoginV2,n,o);yield Vv(e),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Jv(e){let{payload:{callback:t,deviceId:n}}=e,o=Jo(e.payload,JS);yield Di(Fo.setLoginState({loading:!0}));try{var i;const e=yield Fi(xf.auth.preVerifyMFAWebAuthnForLogin,n,o),a=U({},e.options,{challenge:Et(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>U({},e,{id:Et(e.id)})))});yield Di(Fo.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Qv(e){let{payload:{callback:t,deviceId:n}}=e,o=Jo(e.payload,QS);yield Di(Fo.setLoginState({loading:!0}));try{const e=It(o.publicKey),i=yield Fi(xf.auth.verifyMFAWebAuthnForLoginV2,n,U({},o,{options:e}));yield Vv(i),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Xv({payload:e}){yield Di(Fo.setLoginState({loading:!0}));try{yield Fi(xf.auth.forgotPassword,e),yield Di(Fo.setLoginState({loading:!1,error:void 0,step:Pt.breachedPasswordSuccess})),yield Di(Fo.setState({isAuthenticated:!1}))}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)}))}}function*Zv(){yield Da(Fo.requestAuthorize,dv),yield Da(Fo.requestAuthorizeSSR,fv),yield Da(Fo.requestHostedLoginAuthorize,Sv),yield Da(Fo.requestHostedLoginAuthorizeV2,vv),yield Da(Fo.handleHostedLoginCallback,mv),yield Da(Fo.preLogin,Lv),yield Da(Fo.postLogin,Rv),yield Da(Fo.login,Dv),yield Da(Fo.logout,Fv),yield Da(Fo.silentLogout,Gv),yield Da(Fo.loginWithMfa,Nv),yield Da(Fo.recoverMfa,Mv),yield Da(Fo.quickSmsPasswordlessPreLogin,Tv),yield Da(Fo.changePhoneNumberWithVerification,Av),yield Da(Fo.verifyChangePhoneNumber,bv),yield Da(Fo.passwordlessPreLogin,kv),yield Da(Fo.passwordlessPostLogin,Iv),yield Da(Fo.verifyInviteToken,Pv),yield Da(Fo.webAuthnPrelogin,Cv),yield Da(Fo.webAuthnPostLogin,Uv),yield Da(Fo.webAuthnCreateNewDeviceSession,_v),yield Da(Fo.webAuthnVerifyNewDeviceSession,wv),yield Da(Fo.afterAuthNavigation,ev),yield Da(Fo.getUserIP,uv),yield Da(Fo.preEnrollMFASMSForLogin,xv),yield Da(Fo.enrollMFASMSForLogin,Bv),yield Da(Fo.preEnrollMFAWebAuthnForLogin,jv),yield Da(Fo.enrollMFAWebAuthnForLogin,Wv),yield Da(Fo.enrollMFAAuthenticatorAppForLogin,Kv),yield Da(Fo.preVerifyMFASMSForLogin,Hv),yield Da(Fo.verifyMFASMSForLogin,Yv),yield Da(Fo.preVerifyMFAWebAuthnForLogin,Jv),yield Da(Fo.verifyMFAWebAuthnForLogin,Qv),yield Da(Fo.preVerifyMFAEmailCode,zv),yield Da(Fo.verifyMFAEmailCode,qv),yield Da(Fo.resetBreachedPassword,Xv)}function*eh({payload:e}){e&&(yield Di(Fo.setState({isLoading:!0})));const t=fp;yield Di(Fo.loadTenants()),yield Di(Fo.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*th({payload:{callback:e}}){try{const{ip:t}=Fp[0];yield Di(Fo.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*nh(){yield Da(Fo.requestAuthorize,eh),yield Da(Fo.afterAuthNavigation,ev),yield Da(Fo.getUserIP,th)}const oh=["callback","samlVendor"],ih=["callback","samlVendor"];function*ah(){try{var e,t;yield Di(Fo.setSSOState({loading:!0}));const n=yield Fi(xf.auth.getSamlConfiguration),o=yield Fi(xf.auth.getOidcConfiguration),i=yield Fi(xf.metadata.getSamlMetadata);n.acsUrl=null==i||null==(e=i.configuration)?void 0:e.acsUrl,n.spEntityId=null==i||null==(t=i.configuration)?void 0:t.spEntityId,n.isSamlActive=null==i?void 0:i.isActive,yield Di(Fo.setSSOState({samlConfiguration:n,oidcConfiguration:o,loading:!1,firstLoad:!1}))}catch(e){yield Di(Fo.setSSOState({error:og(e),loading:!1}))}}function*rh({payload:e}){const t=yield Vi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield Di(Fo.setSSOState({error:void 0,[n]:!0}));try{const o=yield lp(e[0]),i=yield Fi(xf.auth.updateSamlVendorMetadata,{metadata:o});i.isSamlActive=null==t?void 0:t.isSamlActive,yield Di(Fo.setSSOState({samlConfiguration:i,error:void 0,[n]:!1}))}catch(e){yield Di(Fo.setSSOState({samlConfiguration:t,error:og(e),[n]:!1}))}}function*lh({payload:e}){const{configFile:t,callback:n}=e,o=yield Vi((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield Di(Fo.setSSOState({error:void 0,[i]:!0}));try{const e=yield lp(t),a=yield Fi(xf.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==o?void 0:o.isSamlActive,yield Di(Fo.setSSOState({samlConfiguration:a,error:void 0,[i]:!1})),null==n||n(!0)}catch(e){yield Di(Fo.setSSOState({samlConfiguration:o,error:og(e),[i]:!1})),null==n||n(null,e)}}function*sh({payload:e}){const{callback:t,samlVendor:n}=e,o=Jo(e,oh),i=yield Vi((e=>e.auth.ssoState.samlConfiguration)),a=U({},i,o);let r="saving";(null==a?void 0:a.enabled)!==i.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield Di(Fo.setSSOState({samlConfiguration:U({},i,a)})));if(yield Di(Fo.setSSOState({error:void 0,[r]:!0})),e.type===Wf.Saml){var l,s;const e=yield Fi(xf.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 o=ip(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==i?void 0:i.domain)!==(null==o?void 0:o.domain)&&(o.ssoEndpoint="",o.publicCertificate="",o.signRequest=!1),o.type=null==n?void 0:n.toLowerCase();const c=yield Fi(xf.auth.updateSamlConfiguration,o);c.isSamlActive=null==i?void 0:i.isSamlActive,yield Di(Fo.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setSSOState({samlConfiguration:i,error:og(e),[r]:!1})),null==t||t(null,e)}}function*ch({payload:{callback:e}={}}){const t=yield Vi((e=>e.auth.ssoState.samlConfiguration));try{yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield Fi(xf.auth.validateSamlDomain),yield Di(Fo.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield Di(Fo.setSSOState({samlConfiguration:U({},t,{validated:!1}),error:og(n),saving:!1})),null==e||e(null,n)}}function*uh(){try{const e=yield Fi(xf.auth.getSamlRoles),t=yield Fi(xf.auth.getSamlRolesGroups);yield Di(Fo.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Di(Fo.setSSOState({error:og(e)}))}}function*dh({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield Fi(xf.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Ni(e.map((e=>Fi(xf.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Di(Fo.setSSOState({error:og(e)}))}}(n)),yield uh(),yield Di(Fo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Di(Fo.setSSOState({error:og(t),saving:!1})),null==e||e(null,t)}}function*yh({payload:{callback:e,id:t}}){try{yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield Fi(xf.auth.deleteSamlGroup,{id:t}),yield uh(),yield Di(Fo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Di(Fo.setSSOState({error:og(t),saving:!1})),null==e||e(null,t)}}function*fh({payload:{group:e,roleIds:t,callback:n}}){try{yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield Fi(xf.auth.createSamlGroup,{group:e,roleIds:t}),yield uh(),yield Di(Fo.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield Di(Fo.setSSOState({error:og(e),saving:!1})),null==n||n(null,e)}}function*ph({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Di(Fo.setSSOState({loading:!0})),yield Fi(xf.auth.oidcPostLoginV2,t),yield Fi(iv),yield Di(Fo.setSSOState({loading:!1}))}catch(e){yield Di(Fo.setSSOState({loading:!1,error:og(e,"Failed to authenticate"),firstLoad:!1}))}}function*gh(){yield Ua(Fo.loadSSOConfigurations,ah),yield Ua(Fo.saveSSOConfigurations,sh),yield Ua(Fo.saveSSOConfigurationsFile,rh),yield Ua(Fo.saveSSOConfigurationsFileWithCallback,lh),yield Ua(Fo.validateSSODomain,ch),yield Ua(Fo.loadSSOAuthorizationRoles,uh),yield Ua(Fo.updateSSOAuthorizationRoles,dh),yield Ua(Fo.deleteSamlGroup,yh),yield Ua(Fo.createSamlGroup,fh),yield Ua(Fo.oidcPostlogin,ph)}function*Sh(){yield Di(Fo.setSSOState({loading:!0})),yield bt(),yield Di(Fo.setSSOState({samlConfiguration:Ap,loading:!1,firstLoad:!1}))}function*vh({payload:e}){const t="saving";yield Di(Fo.setSSOState({error:void 0,[t]:!0}));const n=U({},yield Vi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield Di(Fo.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*hh({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Jo(e,ih),r=kp.samlConfiguration,l=U({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield Di(Fo.setSSOState({samlConfiguration:U({},r,l)})));yield Di(Fo.setSSOState({error:void 0,[s]:!0})),yield bt(),l.acsUrl=null==bp||null==(t=bp.configuration)?void 0:t.acsUrl,l.spEntityId=null==bp||null==(n=bp.configuration)?void 0:n.spEntityId;const c=ip(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==i?void 0:i.toLowerCase(),yield bt(),yield Di(Fo.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==o||o(!0)}function*mh({payload:{callback:e}={}}){const t=kp.samlConfiguration;yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield bt(),yield Di(Fo.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Ah(){yield bt(),yield Di(Fo.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*bh({payload:{callback:e,authorizationRoles:t}}){yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield bt(),yield Di(Fo.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Th(){yield Ua(Fo.loadSSOConfigurations,Sh),yield Ua(Fo.saveSSOConfigurations,hh),yield Ua(Fo.saveSSOConfigurationsFile,vh),yield Ua(Fo.validateSSODomain,mh),yield Ua(Fo.loadSSOAuthorizationRoles,Ah),yield Ua(Fo.updateSSOAuthorizationRoles,bh)}const kh=["callback"],Eh=["callback","ssoConfigId"],Ih=["callback","ssoConfigId"],Ph=["callback","ssoConfigId"];function*Lh(){try{return yield Fi(xf.auth.getOidcConfiguration)}catch(e){return null}}function*Oh(){try{return yield Fi(xf.metadata.getSamlMetadata)}catch(e){return null}}function*_h(){try{yield Di(Fo.setSSOLoader({key:jf.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Ni([Fi(Lh),Fi(Oh)]),n=yield Fi(xf.auth.getSSOConfigurations);yield Di(Fo.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Di(Fo.setSSOError({key:jf.LOAD_SSO_CONFIGURATIONS,value:og(e)}))}finally{yield Di(Fo.setSSOLoader({key:jf.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*wh({payload:e}){yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Jo(e,kh),o=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield Fi(xf.auth.createSSOConfiguration,U({},n,{enabled:null!=(i=n.enabled)&&i}));yield Di(Fo.setSSOState({ssoConfigurations:[...o,e]})),null==t||t(e)}catch(e){yield Di(Fo.setSSOError({key:jf.SAVE_SSO_CONFIGURATION,value:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Ch({payload:e}){yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,o=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield lp(t),i=yield Fi(xf.auth.createSSOConfigurationByMetadata,{metadata:e});yield Di(Fo.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield Di(Fo.setSSOError({key:jf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:og(e)})),null==n||n(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Uh({payload:e}){yield Di(Fo.setSSOLoader({key:jf.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Jo(e,Eh),i=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Fi(xf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t));yield Di(Fo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Di(Fo.setSSOError({key:jf.UPDATE_SSO_CONFIGURATION,value:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Rh({payload:e}){yield Di(Fo.setSSOLoader({key:jf.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:o}=e,i=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield lp(o),a=yield Fi(xf.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=i.map((e=>e.id===n?a:e));yield Di(Fo.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield Di(Fo.setSSOError({key:jf.UPDATE_SSO_CONFIGURATION,value:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Dh({payload:e}){yield Di(Fo.setSSOLoader({key:jf.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{yield Fi(xf.auth.deleteSSOConfiguration,t),yield Di(Fo.setSSOState({ssoConfigurations:o.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield Di(Fo.setSSOError({key:jf.DELETE_SSO_CONFIGURATION,value:og(e)})),null==n||n(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Nh({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Jo(e,Ih);yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_DOMAIN,value:!0}));const i=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Fi(xf.auth.createSSODomain,n,o),a=i.map((t=>t.id===n?U({},t,{domains:[...t.domains,e]}):t));yield Di(Fo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Di(Fo.setSSOError({key:jf.SAVE_SSO_DOMAIN,value:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_DOMAIN,value:!1}))}}function*Mh({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield Di(Fo.setSSOLoader({key:jf.DELETE_SSO_DOMAIN,value:!0}));const i=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{yield Fi(xf.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?U({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield Di(Fo.setSSOState({ssoConfigurations:e})),null==o||o(!0)}catch(e){yield Di(Fo.setSSOError({key:jf.DELETE_SSO_DOMAIN,value:og(e)})),null==o||o(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.DELETE_SSO_DOMAIN,value:!1}))}}function*Fh({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield Di(Fo.setSSOLoader({key:jf.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{yield Fi(xf.auth.validateSSODomain,o,n);const e=i.map((e=>e.id===o?U({},e,{domains:e.domains.map((e=>e.id===n?U({},e,{validated:!0}):e))}):e));yield Di(Fo.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield Di(Fo.setSSOError({key:jf.VALIDATE_SSO_DOMAIN,value:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Gh({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Di(Fo.setSSOLoader({key:jf.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{yield Fi(xf.auth.setSSODefaultRoles,t,{roleIds:n});const i=o.map((e=>e.id===t?U({},e,{roleIds:n}):e));yield Di(Fo.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield Di(Fo.setSSOError({key:jf.UPDATE_SSO_DEFAULT_ROLES,value:og(t)})),null==e||e(null,t)}finally{yield Di(Fo.setSSOLoader({key:jf.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*$h({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_GROUPS,value:!0}));const i=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ni(t.map((e=>Fi(xf.auth.deleteSSOGroup,n,e)))),yield Ni(e.map((e=>Fi(xf.auth.createSSOGroup,n,e))));const a=yield Fi(xf.auth.getSSOGroups,n),r=i.map((e=>e.id===n?U({},e,{groups:a}):e));yield Di(Fo.setSSOState({ssoConfigurations:r})),null==o||o(!0)}catch(e){yield Di(Fo.setSSOError({key:jf.SAVE_SSO_GROUPS,value:og(e)})),null==o||o(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_GROUPS,value:!1}))}}function*Vh({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Ni(t.map((t=>Fi(xf.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Di(Fo.setSSOError({key:jf.SAVE_SSO_GROUPS,value:og(e)})),null==n||n(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_GROUPS,value:!1}))}}function*xh({payload:e}){yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:o,callback:i}=e,a=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,l;o?(r=yield Fi(xf.auth.updateSSOConfigurationByMetadataUrl,o,e),l=a.map((e=>e.id===o?r:e))):(r=yield Fi(xf.auth.createSSOConfigurationByMetadataUrl,e),l=[r,...a]),yield Di(Fo.setSSOState({ssoConfigurations:l})),null==i||i(r)}catch(e){null==i||i(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Bh({payload:e}){yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Jo(e,Ph),i=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Fi(xf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t))):(e=yield Fi(xf.auth.createSSOConfiguration,o),a=[e,...i]),yield Di(Fo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*jh(){yield Ua(Fo.loadSSOConfigurationsV2,_h),yield Ua(Fo.saveSSOConfigurationV2,wh),yield Ua(Fo.saveSSODomain,Nh),yield Ua(Fo.deleteSSODomain,Mh),yield Ua(Fo.validateSSODomainV2,Fh),yield Ua(Fo.updateSSOConfiguration,Uh),yield Ua(Fo.deleteSSOConfiguration,Dh),yield Ua(Fo.setSSOGroups,$h),yield Ua(Fo.updateSSOGroups,Vh),yield Ua(Fo.setSSODefaultRoles,Gh),yield Ua(Fo.saveSSOConfigurationByMetadata,Ch),yield Ua(Fo.updateSSOConfigurationByMetadata,Rh),yield Ua(Fo.saveSSOConfigurationByUrl,xh),yield Ua(Fo.saveSSOConfigurationByData,Bh)}const Wh=["callback","profilePictureUrl"],Kh=["callback","profilePictureUrl"];function*Hh(){yield Di(Fo.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return Fi.apply(void 0,[Ca,e,t,n].concat(i))}(3,2e3,xf.teams.getProfile),t=yield Vi((e=>e.auth.user));Fo.setUser(U({},t,e)),yield Di(Fo.setProfileState({profile:e,loading:!1}))}catch(e){yield Di(Fo.setProfileState({loading:!1,error:og(e)}))}}function*zh(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Jo(e.payload,Wh);yield Di(Fo.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield Vi((e=>e.auth.profileState.profile));let i=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 o=`image/${n[1]}`,i=function(e,t){const n=atob(e),o=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),i=new Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);o.push(new Uint8Array(i))}return new Blob(o,{type:t})}(n[2],o),a=new FormData;return a.append(t,new File([i],t,{type:o})),a}(n,"image");if(e){i=yield Fi(xf.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(i);n.searchParams.set("t",t),i=n.href}}const a=U({},e,o,{profilePictureUrl:i}),r=yield Fi(xf.users.updateUserProfileV2,a),l=yield Vi((e=>e.auth.user));yield Di(Fo.setUser(U({},l,r))),yield Di(Fo.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield Di(Fo.setProfileState({saving:!1,error:og(e),loading:!1})),null==t||t(null,e)}}function*qh({payload:e}){yield Di(Fo.setProfileState({loading:!0}));try{var t;yield Fi(xf.teams.changePassword,e),yield Di(Fo.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setProfileState({loading:!1,error:og(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Yh(){yield Da(Fo.loadProfile,Hh),yield Ua(Fo.saveProfile,zh),yield Ua(Fo.changePassword,qh)}function*Jh(){yield Di(Fo.setProfileState({loading:!0})),yield bt(),yield Di(Fo.setUser(U({},fp,yp))),yield Di(Fo.setProfileState({loading:!1,profile:yp}))}function*Qh(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Jo(e.payload,Kh);yield Di(Fo.setProfileState({saving:!0,error:null}));const i=pp;let a=i.profile.profilePictureUrl;n!==i.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=U({},i.profile,o,{profilePictureUrl:a}),l=fp;yield bt(),yield Di(Fo.setUser(U({},l,r))),yield Di(Fo.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Xh({payload:e}){var t;yield Di(Fo.setProfileState({loading:!0})),yield bt(),yield Di(Fo.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Zh(){yield Da(Fo.loadProfile,Jh),yield Ua(Fo.saveProfile,Qh),yield Ua(Fo.changePassword,Xh)}const em=["callback"],tm=["callback"],nm=["user"],om=["callback"],im=["deviceId","callback"],am=["deviceId","callback"],rm=["callback"],lm=["deviceId"],sm=["deviceId"],cm=["callback"],um=["deviceId"],dm=["callback"];function*ym(e){const{step:t}=yield Vi((e=>e.auth.mfaState));return{step:e.recoveryCode?ln.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*fm(){yield Di(Fo.setMfaState({saving:!0}));try{const{qrCode:e}=yield Fi(xf.auth.enrollMfa);yield Di(Fo.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield Di(Fo.setMfaState({saving:!1,error:og(e)}))}}function*pm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,em);yield Di(Fo.setMfaState({saving:!0}));try{const e=yield Vi((e=>e.auth.user)),o=yield Fi(xf.auth.verifyMfa,n),i=yield Fi(xf.auth.getMFADevices),a=yield ym(o);yield Di(Fo.setMfaState(U({},a,{mfaDevices:i}))),yield Di(Fo.setUser(U({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*gm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,tm);yield Di(Fo.setMfaState({loading:!0}));try{const e=yield Fi(xf.auth.loginWithMfaV2,n),{user:o}=e,i=Jo(e,nm),a={step:ln.recoveryCode,loading:!1,saving:!1,error:void 0};null!=o&&o.recoveryCode&&(a.recoveryCode=o.recoveryCode),yield Di(Fo.setMfaState(a)),yield ZS(U({user:o},i)),null==t||t(a.recoveryCode)}catch(e){yield Di(Fo.setMfaState({loading:!1,error:og(e)})),null==t||t(null,e)}}function*Sm({payload:e}){yield Di(Fo.setMfaState({saving:!0}));try{var t;yield Fi(xf.auth.disableMfa,e);const n=yield Fi(xf.auth.getMFADevices);yield Di(Fo.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setMfaState({saving:!1,error:og(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*vm({payload:e}){yield Di(Fo.setMfaState({saving:!0}));try{var t,n;const o=yield Fi(xf.auth.preEnrollMFAWebAuthn),i=U({},o.options,{challenge:Et(o.options.challenge),user:U({},o.options.user,{id:Et(o.options.user.id)}),excludeCredentials:null==(t=o.options.excludeCredentials)?void 0:t.map((e=>U({},e,{id:Et(e.id)})))});yield Di(Fo.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:i,webauthnToken:o.webauthnToken})}catch(t){var o;yield Di(Fo.setMfaState({saving:!1,error:og(t)})),null==(o=e.callback)||o.call(e,null,t)}}function*hm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,om);yield Di(Fo.setMfaState({saving:!0}));try{const e=It(n.publicKey),o=yield Fi(xf.auth.enrollMFAWebAuthn,U({},n,{options:e})),i=yield Fi(xf.auth.getMFADevices),a=yield ym(o);yield Di(Fo.setMfaState(U({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*mm(e){let{payload:{deviceId:t,callback:n}}=e;Jo(e.payload,im),yield Di(Fo.setMfaState({saving:!0}));try{var o;const e=yield Fi(xf.auth.preDisableMFAWebAuthn,t),i=U({},e.options,{challenge:Et(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>U({},e,{id:Et(e.id)})))});yield Di(Fo.setMfaState({saving:!1})),null==n||n({options:i,webauthnToken:e.webauthnToken})}catch(e){yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==n||n(null,e)}}function*Am(e){let{payload:{deviceId:t,callback:n}}=e,o=Jo(e.payload,am);yield Di(Fo.setMfaState({saving:!0}));try{const e=It(o.publicKey);yield Fi(xf.auth.disableMFAWebAuthn,t,U({},o,{options:e}));const i=yield Fi(xf.auth.getMFADevices);yield Di(Fo.setMfaState({saving:!1,error:void 0,mfaDevices:i})),null==n||n(!0)}catch(e){yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==n||n(!1,e)}}function*bm({payload:e}){yield Di(Fo.setMfaState({saving:!0}));try{var t;const n=yield Fi(xf.auth.preEnrollMFASMS,e);yield Di(Fo.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 Di(Fo.setMfaState({saving:!1,error:og(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Tm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,rm);yield Di(Fo.setMfaState({saving:!0}));try{const e=yield Fi(xf.auth.enrollMFASMS,n),o=yield Fi(xf.auth.getMFADevices),i=yield ym(e);yield Di(Fo.setMfaState(U({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*km(e){let{payload:{deviceId:t}}=e,n=Jo(e.payload,lm);yield Di(Fo.setMfaState({saving:!0}));try{var o;const e=yield Fi(xf.auth.preDisableMFASMS,t);yield Di(Fo.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Em(e){let{payload:{deviceId:t}}=e,n=Jo(e.payload,sm);yield Di(Fo.setMfaState({saving:!0}));try{var o;yield Fi(xf.auth.disableMFASMS,t,n);const e=yield Fi(xf.auth.getMFADevices);yield Di(Fo.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Im(){yield Di(Fo.setMfaState({loading:!0}));try{yield Vi((e=>e.auth.user));const e=yield Fi(xf.auth.getMFADevices);yield Di(Fo.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield Di(Fo.setMfaState({loading:!1,error:og(e)}))}}function*Pm(){yield Di(Fo.setMfaState({loading:!0}));try{const e=(yield Fi(xf.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield Di(Fo.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield Di(Fo.setMfaState({loading:!1,error:og(e)}))}}function*Lm(){yield Ua(Fo.enrollMfa,fm),yield Ua(Fo.getMFADevices,Im),yield Ua(Fo.getMFAStrategies,Pm),yield Ua(Fo.verifyMfa,pm),yield Ua(Fo.disableMfa,Sm),yield Ua(Fo.verifyMfaAfterForce,gm),yield Ua(Fo.preDisableMfaSms,km),yield Ua(Fo.disableMfaSms,Em),yield Ua(Fo.preEnrollMfaSms,bm),yield Ua(Fo.enrollMfaSms,Tm),yield Ua(Fo.preEnrollMfaWebAuthn,vm),yield Ua(Fo.enrollMfaWebAuthn,hm),yield Ua(Fo.preDisableMfaWebAuthn,mm),yield Ua(Fo.disableMfaWebAuthn,Am)}function*Om(){yield Di(Fo.setMfaState({saving:!0})),yield Di(Fo.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*_m({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield Vi((e=>e.auth.mfaState));yield Di(Fo.setMfaState({saving:!0})),yield bt();const n={token:"token",recoveryCode:"recoveryCode"},o={step:ln.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:U({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(o.recoveryCode=n.recoveryCode),yield Di(Fo.setMfaState(o)),yield Di(Fo.setUser(U({},fp,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*wm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,cm);yield Di(Fo.setMfaState({loading:!0})),yield bt();const o=U({},n,{recoveryCode:"recoveryCode"}),i={step:ln.recoveryCode,loading:!1,error:void 0,saving:!1};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield Di(Fo.setMfaState(i)),yield bt(),yield Di(Fo.setUser(U({},fp,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Cm({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Vi((e=>e.auth.mfaState));yield Di(Fo.setMfaState({saving:!0})),yield bt(),yield Di(Fo.setMfaState({saving:!1,error:void 0,mfaDevices:U({},n,{authenticators:[]})})),yield Di(Fo.setUser(U({},fp))),null==(t=e.callback)||t.call(e,!0)}function*Um(e){let{}=e,t=Jo(e.payload,um);yield Di(Fo.setMfaState({saving:!0}));try{var n;yield Di(Fo.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var o;yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==(o=t.callback)||o.call(t,!1,e)}}function*Rm({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Vi((e=>e.auth.mfaState));yield Di(Fo.setMfaState({saving:!0})),yield bt(),yield Di(Fo.setMfaState({loading:!1,error:void 0,mfaDevices:U({},n,{phones:[]})})),yield Di(Fo.setUser(U({},fp))),null==(t=e.callback)||t.call(e,!0)}function*Dm({payload:e}){var t;yield Di(Fo.setMfaState({saving:!0})),yield bt(),yield Di(Fo.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*Nm(e){let{payload:{callback:t}}=e;Jo(e.payload,dm);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Vi((e=>e.auth.mfaState));yield Di(Fo.setMfaState({saving:!0})),yield bt();const o={token:"token",recoveryCode:"recoveryCode"},i={step:ln.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:U({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield Di(Fo.setMfaState(i)),yield Di(Fo.setUser(U({},fp,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Mm(){yield Ua(Fo.enrollMfa,Om),yield Ua(Fo.verifyMfa,_m),yield Ua(Fo.disableMfa,Cm),yield Ua(Fo.verifyMfaAfterForce,wm),yield Ua(Fo.preDisableMfaSms,Um),yield Ua(Fo.disableMfaSms,Rm),yield Ua(Fo.preEnrollMfaSms,Dm),yield Ua(Fo.enrollMfaSms,Nm)}const Fm=["callback"];function*Gm({payload:e}){yield Di(Fo.setForgotPasswordState({loading:!0}));try{var t;yield Fi(xf.auth.forgotPassword,e),yield Di(Fo.setForgotPasswordState({loading:!1,error:void 0,step:Ht.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setForgotPasswordState({loading:!1,error:og(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*$m(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Fm);yield Di(Fo.setForgotPasswordState({loading:!0}));try{yield Fi(xf.auth.resetPassword,n),yield Di(Fo.setForgotPasswordState({loading:!1,error:void 0,step:Ht.success})),null==t||t(!0)}catch(e){yield Di(Fo.setForgotPasswordState({loading:!1,error:og(e)})),null==t||t(!1,e)}}function*Vm({payload:e}){yield Di(Fo.setForgotPasswordState({loading:!0}));try{const t=yield Fi(xf.auth.loadPasswordConfig,e);yield Di(Fo.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Di(Fo.setForgotPasswordState({loading:!1,error:og(e)}))}}function*xm(){yield Da(Fo.forgotPassword,Gm),yield Da(Fo.resetPassword,$m),yield Da(Fo.loadPasswordConfig,Vm)}let Bm;!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"}(Bm||(Bm={}));const jm=["callback","events"],Wm=["user"],Km=["callback"],Hm=["callback"];function*zm({payload:{userId:e,token:t}}){yield Di(Fo.setActivateState({loading:!0,step:Gt.activating}));try{const{isAuthenticated:n}=yield Vi((e=>e.auth));n&&(yield Di(Fo.silentLogout()));const o=yield Fi(xf.auth.getActivateAccountStrategy,{userId:e,token:t});yield Di(Fo.setActivateStrategyState({strategy:o,loading:!1,error:void 0})),o.shouldSetPassword&&(yield Di(Fo.setActivateState({loading:!1,step:Gt.activatingForm})))}catch(e){yield Di(Fo.setActivateState({loading:!1,error:og(e)}))}}function*qm(e){let{payload:{callback:t,events:n}}=e,o=Jo(e.payload,jm);yield Di(Fo.setActivateState({loading:!0}));try{const e=Na.onRedirectTo,{routes:a}=yield Vi((e=>e.auth)),r=yield Fi(xf.auth.activateAccountV2,o),{user:l}=r,s=Jo(r,Wm);if(l.redirectLocation)return void(window.location.href=l.redirectLocation);if(Zp(l)){yield Di(Fo.setActivateState({step:Gt.success}));const t=yield ng(l);yield Di(Fo.setState(t)),yield xi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var i;yield Di(Fo.setActivateState({step:Gt.success}));const e={email:l.email,origin:Hp.ACTIVATION_LINK,id:l.id,tenantId:l.tenantId,name:l.name,createdAt:new Date};null==n||null==(i=n.userVerified)||i.call(n,e),ag(ig.USER_VERIFIED,e),yield Fi(ZS,U({user:l},s),{isAuthenticated:!0}),yield xi(1e3),yield ev(),yield Di(Fo.resetActivateState())}null==t||t(!0)}catch(e){yield Di(Fo.setActivateState({loading:!1,error:og(e)}))}}function*Ym({payload:e}){const{callback:t}=e,n=Jo(e,Km);yield Di(Fo.setActivateStrategyState({loading:!0}));try{const e=yield Fi(xf.auth.getActivateAccountStrategy,n);yield Di(Fo.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield Di(Fo.setActivateStrategyState({loading:!1,error:og(e)}))}}function*Jm({payload:e}){const{callback:t}=e,n=Jo(e,Hm);yield Di(Fo.setTeamLoader({key:Bm.RESEND_ACTIVATE_LINK,value:n.email})),yield Di(Fo.setActivateState({loading:!0}));try{yield Fi(xf.auth.resendActivationEmail,n),yield Di(Fo.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield Di(Fo.setActivateState({loading:!1,error:og(e)})),yield Di(Fo.setTeamError({key:Bm.RESEND_ACTIVATE_LINK,value:og(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Bm.RESEND_ACTIVATE_LINK,value:!1}))}function*Qm(){yield Da(Fo.activateAccount,qm),yield Da(Fo.preActivateAccount,zm),yield Da(Fo.getActivateAccountStrategy,Ym),yield Da(Fo.resendActivationEmail,Jm)}function*Xm({payload:e}){if(e.token&&e.userId)try{yield Di(Fo.setAcceptInvitationState({error:void 0,step:Bt.pending})),yield Fi(xf.auth.acceptInvitation,e),yield Di(Fo.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Bt.success}}))}catch(e){yield Di(Fo.setAcceptInvitationState({step:Bt.failed,error:og(e)}))}else yield Di(Fo.setAcceptInvitationState({error:void 0,step:Bt.invalid}))}function*Zm(){yield Da(Fo.acceptInvitation,Xm)}var eA,tA=new Uint8Array(16);function nA(){if(!eA&&!(eA="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 eA(tA)}for(var oA=/^(?:[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,iA=function(e){return"string"==typeof e&&oA.test(e)},aA=[],rA=0;rA<256;++rA)aA.push((rA+256).toString(16).substr(1));var lA=function(e,t,n){var o=(e=e||{}).random||(e.rng||nA)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=o[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(aA[e[t+0]]+aA[e[t+1]]+aA[e[t+2]]+aA[e[t+3]]+"-"+aA[e[t+4]]+aA[e[t+5]]+"-"+aA[e[t+6]]+aA[e[t+7]]+"-"+aA[e[t+8]]+aA[e[t+9]]+"-"+aA[e[t+10]]+aA[e[t+11]]+aA[e[t+12]]+aA[e[t+13]]+aA[e[t+14]]+aA[e[t+15]]).toLowerCase();if(!iA(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let sA,cA;!function(e){e.CREATE_GROUP="CREATE_GROUP",e.GET_GROUP="GET_GROUP",e.GET_GROUPS="GET_GROUPS",e.DELETE_GROUP="DELETE_GROUP",e.UPDATE_GROUP="UPDATE_GROUP",e.ADD_USERS_TO_GROUP="ADD_USERS_TO_GROUP",e.DELETE_USERS_FROM_GROUP="DELETE_USERS_FROM_GROUP",e.ADD_ROLES_TO_GROUP="ADD_ROLES_TO_GROUP",e.DELETE_ROLES_FROM_GROUP="DELETE_ROLES_FROM_GROUP",e.GET_GROUP_CONFIGURATION="GET_GROUP_CONFIGURATION",e.UPDATE_GROUP_CONFIGURATION="UPDATE_GROUP_CONFIGURATION",e.GET_TEAM_USERS="GET_TEAM_USERS"}(sA||(sA={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(cA||(cA={}));const uA=["callback"],dA=["roles"],yA=["callback"],fA=["callback","profileImage"],pA=["callback"],gA=["callback","userId"],SA=["callback"],vA=["callback"],hA=["callback"],mA=["callback"],AA=["callback"],bA=["callback"],TA=["callback"],kA=["callback","profileImage"],EA=["callback"],IA=["callback"],PA=["callback"],LA=["callback"],OA=["callback"],_A=["callback"],wA=()=>Vi((e=>e.auth.teamState));function*CA(){try{const{groups:e}=yield Fi(xf.groups.getGroups,{_groupsRelations:cA.roles});return e}catch(e){return[]}}function*UA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield wA(),c=null!=(t=e.pageSize)?t:s.pageSize,u=null!=(n=e.pageOffset)?n:s.pageOffset,d=null!=(o=e.filter)?o:s.filterV2,y=null!=(i=e.sort)?i:s.sortV2,f=null!=(a=null==e?void 0:e.shouldShowSubTenantUsersIfReseller)?a:null==s?void 0:s.shouldShowSubTenantUsersIfReseller;yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!r})),yield Di(Fo.setTeamState({pageSize:c,pageOffset:u,filterV2:d,sortV2:y}));try{const[{items:t,_metadata:{totalPages:n,totalItems:o}},{items:i},{items:a},r]=yield Ni([Fi(xf.users.getUsersV2,U({},(null==d?void 0:d.length)&&{_filter:d},y&&{_sortBy:y},e.order&&{_order:e.order},{_offset:u,_limit:c,_includeSubTenants:f})),Fi(xf.teams.loadAvailableRoles),Fi(xf.teams.loadAvailablePermissions),Fi(CA)]),s=t.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>r.filter((t=>t.id===e.id)))).flat();return U({},e,{groups:n})}));yield Di(Fo.setTeamState({users:s.map((e=>U({},e,{roleIds:e.roles.map((e=>e.id))}))),totalPages:n,totalItems:o,roles:i,permissions:a})),null==l||l(t)}catch(e){yield Di(Fo.setTeamError({key:Bm.USERS,value:og(e)})),yield Di(Fo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!1}))}function*RA({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield wA(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filter,d=null!=(i=e.sort)?i:l.sort;yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!a})),yield Di(Fo.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:o},{items:i}]=yield Ni([Fi(xf.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Fi(xf.teams.loadAvailableRoles),Fi(xf.teams.loadAvailablePermissions)]);yield Di(Fo.setTeamState({users:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==r||r(e)}catch(e){yield Di(Fo.setTeamError({key:Bm.USERS,value:e.message})),yield Di(Fo.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!1}))}function*DA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield wA(),c={_limit:(null!=(t=e._limit)?t:s.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:s.allUsersQueryParams._offset)||0,_filter:(null!=(o=e._filter)?o:s.allUsersQueryParams._filter)||"",_sortBy:(null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:s.allUsersQueryParams._order)||"DESC"};yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!r})),yield Di(Fo.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:o},{items:i}]=yield Ni([Fi(xf.subTenants.loadAllUsers,U({},c)),Fi(xf.teams.loadAvailableRoles),Fi(xf.teams.loadAvailablePermissions)]);yield Di(Fo.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==l||l(e)}catch(e){yield Di(Fo.setTeamError({key:Bm.USERS,value:og(e)})),yield Di(Fo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!1}))}function*NA({payload:e}){yield Di(Fo.setTeamLoader({key:Bm.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield Ni([Fi(xf.teams.loadAvailableRoles),Fi(xf.teams.loadAvailablePermissions)]);yield Di(Fo.setTeamState({roles:n,permissions:o})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:o})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield Di(Fo.setTeamError({key:Bm.ROLES_AND_PERMISSIONS,value:og(t)}))}yield Di(Fo.setTeamLoader({key:Bm.ROLES_AND_PERMISSIONS,value:!0}))}function*MA({payload:e}){const{callback:t}=e,n=Jo(e,uA),o=yield wA();yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield Fi(xf.teams.addUser,n),{roles:a}=e,r=U({},Jo(e,dA),{roleIds:null!=(i=null==a?void 0:a.map((e=>e.id)))?i:[]});null==t||t(r),yield Di(Fo.setTeamState({users:[r,...o.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!1,error:og(e)})})),null==t||t(null,e)}}function*FA({payload:e}){const{callback:t}=e,n=yield wA();yield Di(Fo.setTeamState({addUserDialogState:U({},n.addUserDialogState,{loading:!0})}));const o=[],i=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield Di(Fo.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Fi(xf.teams.addUser,t),o.push(t.email)}catch(e){i.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:"",silentLoading:e.emails.length>0};yield Di(Fo.loadUsersV2(r)),yield Di(Fo.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:i,allowedEmails:o})}function*GA({payload:e}){const{callback:t}=e,n=Jo(e,yA),o=yield wA();yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{yield Fi(xf.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield Fi(xf.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield Di(Fo.setTeamState({allUsers:e,totalPages:o,totalItems:i,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!1,error:og(e)})})),null==t||t(null,e)}}function*$A({payload:e}){const{callback:t}=e,n=Jo(e,fA),{id:o}=n,i=yield wA(),a=i.users.find((e=>e.id===n.id));yield Di(Fo.setTeamLoader({key:Bm.UPDATE_USER,value:o||""})),yield Di(Fo.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})})),yield Di(Fo.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0}),users:i.users.map((e=>e.id===n.id?U({},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 Fi(xf.teams.updateUser,n);null==t||t(e),yield Di(Fo.setTeamState({users:i.users.map((t=>t.id===e.id?U({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield Di(Fo.setTeamLoader({key:Bm.UPDATE_USER,value:!1}))}catch(e){yield Di(Fo.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:og(e)}),users:i.users.map((e=>e.id===n.id?U({},e,a):e))})),yield Di(Fo.setTeamLoader({key:Bm.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*VA({payload:e}){const{callback:t}=e,n=Jo(e,pA),o=yield wA();yield Di(Fo.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Fi(xf.teams.deleteUser,n),null==t||t(!0),yield Di(Fo.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Di(Fo.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!1,error:og(e)})})),null==t||t(null,e)}}function*xA({payload:e}){const{callback:t,userId:n}=e,o=Jo(e,gA),i=yield wA();yield Di(Fo.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})}));try{yield Fi(xf.subTenants.setUserRolesForSubTenants,n,o);const e=i.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return U({},e,{roles:(null==(t=o.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>i.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield Di(Fo.setTeamState({allUsers:[...i.allUsers.filter((e=>e.id!==n)),...e?[U({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield Di(Fo.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:og(e)})})),null==t||t(null,e)}}function*BA({payload:e}){const{callback:t}=e,n=Jo(e,SA),o=yield wA();yield Di(Fo.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Fi(xf.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield Di(Fo.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Di(Fo.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!1,error:og(e)})})),null==t||t(null,e)}}function*jA({payload:e}){const{callback:t}=e,n=Jo(e,vA);yield Di(Fo.setTeamLoader({key:Bm.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Fi(xf.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Bm.RESEND_ACTIVATE_LINK,value:og(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Bm.RESEND_ACTIVATE_LINK,value:!1}))}function*WA({payload:e}){const{callback:t}=e,n=Jo(e,hA);yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:n.email}));try{yield Fi(xf.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Bm.RESEND_INVITATION_LINK,value:og(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:!1}))}function*KA({payload:e}){const{callback:t}=e,n=Jo(e,mA);yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:n.email}));try{yield Fi(xf.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Bm.RESEND_INVITATION_LINK,value:og(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:!1}))}function*HA({payload:e}){const{callback:t}=e,n=Jo(e,AA);yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:n.email}));try{yield Fi(xf.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Bm.RESEND_INVITATION_LINK,value:og(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:!1}))}function*zA(){yield Di(Fo.setTeamError({key:Bm.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Fi(xf.teams.getInviteLinkConfiguration);yield Di(Fo.setTeamState({inviteTokenState:U({},e)}))}catch(e){yield Di(Fo.setTeamError({key:Bm.CONFIG_TOKEN_LINK,value:og(e)}))}}function*qA(){yield Di(Fo.setTeamError({key:Bm.GET_TOKEN_LINK,value:!1}));try{yield Fi(zA);const e=yield Fi(xf.teams.getInviteUserLink),{inviteTokenState:t}=yield wA();yield Di(Fo.setTeamState({inviteTokenState:U({},t,e)}))}catch(e){yield Di(Fo.setTeamError({key:Bm.GET_TOKEN_LINK,value:og(e)}))}}function*YA({payload:{callback:e}}){yield Di(Fo.setTeamError({key:Bm.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield wA();try{const n=yield Fi(xf.teams.createInviteUserLink,{expiresInMinutes:43200});yield Di(Fo.setTeamState({inviteTokenState:U({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield Di(Fo.setTeamError({key:Bm.CREATE_TOKEN_LINK,value:og(t)}))}}function*JA({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield wA();yield Di(Fo.setTeamError({key:Bm.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield Fi(xf.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield Di(Fo.setTeamState({inviteTokenState:U({},o,i)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield Di(Fo.setTeamError({key:Bm.UPDATE_TOKEN_LINK,value:og(t)}))}}function*QA({payload:e}){const{callback:t}=null!=e?e:{};yield Di(Fo.setTeamError({key:Bm.DELETE_TOKEN_LINK,value:!1}));try{yield Fi(xf.teams.deleteInviteUserLink),yield Di(Fo.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Bm.DELETE_TOKEN_LINK,value:og(e)})),null==t||t(!1,e)}}function*XA({payload:e}){yield Di(Fo.setTeamState({addUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*ZA({payload:e}){const t=yield wA(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Di(Fo.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*eb({payload:e}){yield Di(Fo.setTeamState({deleteUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*tb({payload:e}){const t=yield wA(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Di(Fo.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*nb(){yield Ra(Fo.loadUsers,RA),yield Ra(Fo.loadUsersV2,UA),yield Ra(Fo.loadAllSubTenantsUsers,DA),yield Ra(Fo.loadRoles,NA),yield Ua(Fo.addUser,MA),yield Ua(Fo.addUsersBulk,FA),yield Ua(Fo.addUserToSubTenants,GA),yield Ua(Fo.updateUser,$A),yield Ua(Fo.setUserRolesForSubTenants,xA),yield Ua(Fo.deleteUser,VA),yield Ua(Fo.deleteUserFromSubTenants,BA),yield Ua(Fo.resendActivationLink,jA),yield Ua(Fo.resendInvitationLink,WA),yield Ua(Fo.resendInvitationEmail,KA),yield Ua(Fo.resendInvitationLinkToAllSubTenants,HA),yield Ua(Fo.getInvitationLink,qA),yield Ua(Fo.createInvitationLink,YA),yield Ua(Fo.updateInvitationLink,JA),yield Ua(Fo.deleteInvitationLink,QA),yield Ua(Fo.openAddUserDialog,XA),yield Ua(Fo.closeAddUserDialog,ZA),yield Ua(Fo.openDeleteUserDialog,eb),yield Ua(Fo.closeDeleteUserDialog,tb)}function*ob({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield wA(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filterV2,d=null!=(i=e.sort)?i:l.sortV2;yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!a})),yield Di(Fo.setTeamState({pageSize:s,pageOffset:c,filterV2:u,sortV2:d})),yield bt(),yield Di(Fo.setTeamState({users:wp,totalPages:2,totalItems:10,roles:Tp,permissions:Ep})),yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!1})),null==r||r(wp)}function*ib({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield wA(),c=null!=(t=e._limit)?t:s.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:s.allUsersQueryParams._offset,d=null!=(o=e._filter)?o:s.allUsersQueryParams._filter,y=null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:s.allUsersQueryParams._order;yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!r})),yield Di(Fo.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield bt(),yield Di(Fo.setTeamState({allUsers:Up,totalPages:2,totalItems:10,roles:Tp,permissions:Ep})),yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!1})),null==l||l(Up)}function*ab({payload:e}){var t;yield Di(Fo.setTeamLoader({key:Bm.ROLES_AND_PERMISSIONS,value:!0})),yield bt(),yield Di(Fo.setTeamState({roles:Tp,permissions:Ep})),yield Di(Fo.setTeamLoader({key:Bm.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Tp,permissions:Ep})}function*rb({payload:e}){const{callback:t}=e,n=Jo(e,bA),o=yield wA();yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield bt();const i=U({},Lp,{groups:[]},n,{id:`${lA()}`});null==t||t(i),yield Di(Fo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*lb({payload:e}){const{callback:t}=e,n=Jo(e,TA),o=yield wA();yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield bt();const i=U({},Lp,n,{id:`${lA()}`});yield Di(Fo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*sb({payload:e}){var t;const{callback:n}=e,o=Jo(e,kA),{id:i}=o,a=yield wA(),r=a.users.find((e=>e.id===o.id));yield Di(Fo.setTeamLoader({key:Bm.UPDATE_USER,value:i||""})),yield Di(Fo.setTeamState({addUserDialogState:U({},a.addUserDialogState,{loading:!0})})),yield Di(Fo.setTeamState({addUserDialogState:U({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===o.id?U({},e,o):e))})),r.roleIds.length>0&&0===(null==(t=o.roleIds)?void 0:t.length)&&(o.roleIds=[""]),yield bt();const l=U({},r,o);null==n||n(l),yield Di(Fo.setTeamState({users:a.users.map((e=>e.id===l.id?U({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield Di(Fo.setTeamLoader({key:Bm.UPDATE_USER,value:!1}))}function*cb({payload:e}){const{callback:t}=e,n=Jo(e,EA),o=yield wA();yield Di(Fo.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*ub({payload:e}){const{callback:t}=e,n=Jo(e,IA),o=yield wA();yield Di(Fo.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*db({payload:e}){const{callback:t}=e,n=Jo(e,PA);yield Di(Fo.setTeamLoader({key:Bm.RESEND_ACTIVATE_LINK,value:n.userId})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamLoader({key:Bm.RESEND_ACTIVATE_LINK,value:!1}))}function*yb({payload:e}){const{callback:t}=e,n=Jo(e,LA);yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:n.email})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:!1}))}function*fb({payload:e}){const{callback:t}=e,n=Jo(e,OA);yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:n.email})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:!1}))}function*pb({payload:e}){const{callback:t}=e,n=Jo(e,_A);yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:n.email})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:!1}))}function*gb(){yield Ra(Fo.loadUsersV2,ob),yield Ra(Fo.loadAllSubTenantsUsers,ib),yield Ra(Fo.loadRoles,ab),yield Ua(Fo.addUser,rb),yield Ua(Fo.addUserToSubTenants,lb),yield Ua(Fo.updateUser,sb),yield Ua(Fo.deleteUser,cb),yield Ua(Fo.deleteUserFromSubTenants,ub),yield Ua(Fo.resendActivationLink,db),yield Ua(Fo.resendInvitationLink,yb),yield Ua(Fo.resendInvitationEmail,fb),yield Ua(Fo.resendInvitationLinkToAllSubTenants,pb),yield Ua(Fo.openAddUserDialog,XA),yield Ua(Fo.closeAddUserDialog,ZA),yield Ua(Fo.openDeleteUserDialog,eb),yield Ua(Fo.closeDeleteUserDialog,tb)}const Sb=["authorizationUrl"],vb=["events","url"];function*hb(){try{yield Di(Fo.setSocialLoginsState({loading:!0}));const e=yield Fi(xf.auth.getSocialLoginProviders);yield Di(Fo.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield Di(Fo.setSocialLoginsState({error:og(e),loading:!1,firstLoad:!1}))}}function*mb(){const e=yield Vi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Fi(xf.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield Fi(xf.auth.getSocialLoginProvidersV2),t}function*Ab(){try{const e=yield Vi((e=>e.root.context));yield Di(Fo.setSocialLoginsState({loading:!0}));const t=yield Fi(mb),{providers:n}=yield Fi(xf.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Jo(t,Sb);const i=Tr(e,null!=n?n:"");return U({},o,{authorizationUrl:n?`${i}${n}`:null})}));yield Di(Fo.setSocialLoginsState({socialLoginsConfigV2:o,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield Di(Fo.setSocialLoginsState({error:og(e),loading:!1,firstLoad:!1}))}}function*bb(e){let{payload:{events:t,url:n}}=e,o=Jo(e.payload,vb);try{yield Di(Fo.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Fi(xf.auth.loginViaSocialLogin,o);if(r){var i,a;const r={email:e,url:n,createdAt:new Date,id:l,tenantId:s},u=U({},r,{socialProvider:o.provider,authenticationType:zp.SOCIAL_LOGIN});null==t||null==(i=t.signUpComplete)||i.call(t,u),ag(ig.SIGNUP_COMPLETED,u);const d=U({},r,{origin:Hp.SOCIAL_LOGIN,name:c});null==t||null==(a=t.userVerified)||a.call(t,d),ag(ig.USER_VERIFIED,d)}l&&localStorage.setItem("userId",l),yield Di(Fo.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield Vi((e=>e.auth));e?yield Fi(rv):yield Fi(sv)}(),localStorage.removeItem("register-quick-login"),yield Di(Fo.setSocialLoginsState({loading:!1}))}catch(e){yield Di(Fo.setSocialLoginsState({loading:!1,error:og(e,"Failed to authenticate"),firstLoad:!1}))}}function*Tb({payload:e}){yield Di(Fo.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*kb(){yield Da(Fo.loadSocialLoginsConfiguration,hb),yield Da(Fo.loadSocialLoginsConfigurationV2,Ab),yield Da(Fo.loginViaSocialLogin,bb),yield Ra(Fo.setSocialLoginError,Tb)}let Eb;function*Ib({payload:e}){const{description:t,expires:n,callback:o}=e,{apiTokensDataUser:i}=yield Vi((e=>e.auth.apiTokensState));try{let e,a;yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield Fi(xf.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield Fi(xf.auth.updateUserApiTokensData,{description:t}),yield Di(Fo.setApiTokensState({showAddTokenDialog:!1})),yield xi(200),yield Di(Fo.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield Di(Fo.setApiTokensError({key:Eb.ADD_API_TOKEN,value:og(e)})),yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*Pb({payload:e}){const{description:t,roleIds:n,expires:o,callback:i}=e,{apiTokensDataTenant:a}=yield Vi((e=>e.auth.apiTokensState));try{let e,r;yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield Fi(xf.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield Fi(xf.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield Di(Fo.setApiTokensState({showAddTokenDialog:!1})),yield xi(200),yield Di(Fo.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===o?e.clientId:void 0}})),yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Di(Fo.setApiTokensError({key:Eb.ADD_API_TOKEN,value:og(e)})),yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*Lb({payload:e}){const{apiTokensDataUser:t}=yield Vi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!0})),n?(yield Fi(xf.auth.deleteUserAccessToken,{id:e}),yield Di(Fo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Fi(xf.auth.deleteUserApiToken,{tokenId:e}),yield Di(Fo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!1}))}catch(e){yield Di(Fo.setApiTokensError({key:Eb.DELETE_API_TOKEN,value:og(e)})),yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!1}))}}function*Ob({payload:e}){const{apiTokensDataTenant:t}=yield Vi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let o=t;try{yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!0})),n?(yield Fi(xf.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield Fi(xf.auth.deleteTenantApiToken,{tokenId:e}),o=t.filter((t=>t.clientId!==e))),yield Di(Fo.setApiTokensState({apiTokensDataTenant:o,deleteTokenDialog:{open:!1,id:e}})),yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!1}))}catch(e){yield Di(Fo.setApiTokensError({key:Eb.DELETE_API_TOKEN,value:og(e)})),yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!1}))}}function*_b({payload:e}){null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield Ni([Fi(xf.auth.getUserApiTokensData),Fi(xf.auth.getTenantApiTokensData)]);yield Di(Fo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setApiTokensError({key:Eb.LOAD_API_TOKENS,value:og(t)})),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*wb({payload:e}){null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Fi(xf.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=Fi(xf.auth.getUserAccessTokensData))?n:[]).accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Di(Fo.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield Di(Fo.setApiTokensError({key:Eb.LOAD_API_TOKENS,value:og(t)})),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Cb({payload:e}){null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Fi(xf.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Fi(xf.auth.getTenantAccessTokensData))?n:[],l=(null!=(o=null==r?void 0:r.accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Di(Fo.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield Di(Fo.setApiTokensError({key:Eb.LOAD_API_TOKENS,value:og(t)})),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Ub(){yield Da(Fo.loadApiTokens,_b),yield Da(Fo.loadUserApiTokens,wb),yield Da(Fo.loadTenantApiTokens,Cb),yield Ua(Fo.addUserApiToken,Ib),yield Ua(Fo.addTenantApiToken,Pb),yield Ra(Fo.deleteTenantApiToken,Ob),yield Ra(Fo.deleteUserApiToken,Lb)}function*Rb({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield Vi((e=>e.auth.apiTokensState)),a=U({},up,{description:t,roleIds:n,clientId:`CLIENT_ID_${lA()}`});yield Di(Fo.setApiTokensState({showAddTokenDialog:!1})),yield xi(200),yield Di(Fo.setApiTokensState({apiTokensDataTenant:[...i,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield xi(200),yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*Db({payload:e}){yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!0})),yield xi(200);const t=[up];yield Di(Fo.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!1}))}function*Nb({payload:e}){var t;null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!0})));const n=[cp],o=[up];yield Di(Fo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield xi(200),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Mb({payload:e}){var t;null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!0})));const n=[cp];yield Di(Fo.setApiTokensState({apiTokensDataUser:n})),yield xi(200),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Fb({payload:e}){var t;null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!0})));const n=[up];yield Di(Fo.setApiTokensState({apiTokensDataTenant:n})),yield xi(200),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Gb(){yield Da(Fo.loadApiTokens,Nb),yield Da(Fo.loadUserApiTokens,Mb),yield Da(Fo.loadTenantApiTokens,Fb),yield Ua(Fo.addTenantApiToken,Rb),yield Ra(Fo.deleteTenantApiToken,Db)}function*$b({payload:e}){try{var t;yield Di(Fo.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Vi((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Fi(xf.accountSettings.updateSettings,U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield Di(Fo.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield Di(Fo.setAccountSettingsState({loading:!1,error:og(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Vb({payload:e}){yield Di(Fo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Fi(xf.accountSettings.getSettings);yield Di(Fo.setAccountSettingsState(U({},e,{loading:!1})))}catch(e){yield Di(Fo.setAccountSettingsState({loading:!1,error:og(e)}))}}function*xb(){yield Da(Fo.saveAccountSettings,$b),yield Da(Fo.loadAccountSettings,Vb)}function*Bb({payload:e}){var t;yield Di(Fo.setAccountSettingsState({loading:!0})),yield bt();const{accountSettingsState:n}=yield Vi((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield Di(Fo.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*jb({payload:e}){yield Di(Fo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield bt(),yield Di(Fo.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Wb(){yield Da(Fo.saveAccountSettings,Bb),yield Da(Fo.loadAccountSettings,jb)}function*Kb({payload:{tenantId:e,callback:t}}){yield Di(Fo.setState({isLoading:!0}));try{yield Fi(xf.tenants.switchTenant,{tenantId:e}),yield Fi(iv),(null==t?void 0:t(!0))||(yield Di(Fo.setState({isLoading:!1})))}catch(e){yield Di(Fo.setState({isLoading:!1})),null==t||t(!1,e)}}function*Hb({payload:e}){yield Di(Fo.setTenantsState({loading:!0}));try{var t;const n=yield Fi(xf.users.getCurrentUserTenantsV3);yield Di(Fo.setTenantsState({tenants:n.tenants,activeTenant:n.activeTenant,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 Di(Fo.setTenantsState({loading:!1}))}}function*zb({payload:e}){yield Di(Fo.setTenantsState({loading:!0}));try{var t;const n=yield Fi(xf.tenants.getSubTenants);yield Di(Fo.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*qb({payload:e}){yield Di(Fo.setTenantsState({loading:!0}));try{var t;const n=yield Fi(xf.tenants.getSubTenantsAsTree);yield Di(Fo.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Yb(){yield Ua(Fo.loadTenants,Hb),yield Ua(Fo.loadSubTenants,zb),yield Ua(Fo.switchTenant,Kb),yield Ua(Fo.loadSubTenantsTree,qb)}function*Jb(){yield Di(Fo.setTenantsState({loading:!0})),yield bt(),yield Di(Fo.setTenantsState({tenants:Rp,activeTenant:Rp[0],loading:!1}))}function*Qb(){yield Ua(Fo.loadTenants,Jb)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(Eb||(Eb={}));const Xb=["callback"],Zb=["callback"],eT=["callback"],tT=["callback"],nT=["callback"];function*oT({payload:e}){var t;yield Di(Fo.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Ni([Fi(xf.roles.getRoles),Fi(xf.roles.getPermissions),Fi(xf.roles.getPermissionCategories)]),[t,n,o]=e;yield Di(Fo.setRolesState({roles:t,permissions:n,permissionCategories:o,loading:!1}))}catch(e){yield Di(Fo.setRolesState({error:og(e),loading:!1}))}}function*iT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Xb);yield Di(Fo.setRolesState({saving:!0}));try{const e=yield Fi(xf.roles.addRole,n),o=yield Fi(xf.roles.getRoles);yield Di(Fo.loadRolesAndPermissions({silentLoading:!0})),yield Di(Fo.setRolesState({roles:o,saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setRolesState({error:og(e),saving:!1})),null==t||t(null,e)}}function*aT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Zb);yield Di(Fo.setRolesState({saving:!0}));try{yield Fi(xf.roles.deleteRole,n),yield Di(Fo.loadRolesAndPermissions({silentLoading:!0})),yield Di(Fo.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setRolesState({error:og(e),saving:!1})),null==t||t(!1,e)}}function*rT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,eT);yield Di(Fo.setRolesState({saving:!0}));try{const e=yield Fi(xf.roles.updateRole,n);yield Di(Fo.loadRolesAndPermissions({silentLoading:!0})),yield Di(Fo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setRolesState({error:og(e),saving:!1})),null==t||t(null,e)}}function*lT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,tT);yield Di(Fo.setRolesState({saving:!0}));try{const e=yield Fi(xf.roles.attachPermissionsToRole,n);yield Di(Fo.loadRolesAndPermissions({silentLoading:!0})),yield Di(Fo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setRolesState({error:og(e),saving:!1})),null==t||t(null,e)}}function*sT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,nT);yield Di(Fo.setRolesState({saving:!0}));try{const e=yield Fi(xf.roles.attachPermissionToRoles,n);yield Di(Fo.loadRolesAndPermissions({silentLoading:!0})),yield Di(Fo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setRolesState({error:og(e),saving:!1})),null==t||t(null,e)}}function*cT(){yield Da(Fo.loadRolesAndPermissions,oT),yield Ua(Fo.addRole,iT),yield Ua(Fo.deleteRole,aT),yield Ua(Fo.updateRole,rT),yield Ua(Fo.attachPermissionsToRole,lT),yield Ua(Fo.attachPermissionToRoles,sT)}function*uT({payload:e}){var t;yield Di(Fo.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield Di(Fo.setRolesState({roles:dp,loading:!1}))}catch(e){yield Di(Fo.setRolesState({error:og(e),loading:!1}))}}function*dT(){yield Da(Fo.loadRolesAndPermissions,uT)}const yT=["callback"],fT=["callback"],pT=["callback"];function*gT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,yT);yield Di(Fo.setResetPhoneNumberState({loading:!0}));try{const e=yield Fi(xf.auth.resetPhoneNumber,n);yield Di(Fo.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Jt.VerifyResetPhoneNumber})),yield Di(Fo.setLoginState({email:n.email}))}catch(e){yield Di(Fo.setResetPhoneNumberState({loading:!1,error:og(e)})),null==t||t(null,e)}}function*ST(e){let{payload:{callback:t}}=e,n=Jo(e.payload,fT);yield Di(Fo.setResetPhoneNumberState({loading:!0}));try{const e=yield Fi(xf.auth.verifyResetPhoneNumber,n);yield Di(Fo.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Jt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield Di(Fo.setResetPhoneNumberState({loading:!1,error:og(e)})),null==t||t(null,e)}}function*vT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,pT);yield Di(Fo.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:o}=yield Vi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Fi(xf.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Di(Fo.setLoginState({step:Pt.loginWithSmsOtc})),yield Di(Fo.passwordlessPreLogin({type:ko.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(o.loginUrl),yield Di(Fo.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setResetPhoneNumberState({loading:!1,error:og(e)})),null==t||t(null,e)}}function*hT(){yield Da(Fo.resetPhoneNumber,gT),yield Da(Fo.verifyResetPhoneNumber,ST),yield Da(Fo.changePhoneNumber,vT)}function*mT(){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getCurrentUserSessions);yield Di(Fo.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*AT(){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getCurrentUserSession);yield Di(Fo.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*bT({payload:{id:e}}){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{yield Fi(xf.auth.deleteSessionForUser,e),yield Di(Fo.loadUserSessions())}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*TT({payload:{callback:e,userId:t}}){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{yield Fi(xf.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Di(Fo.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*kT(){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{yield Fi(xf.auth.deleteAllSessionsForUser),yield Di(Fo.loadUserSessions())}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*ET(){yield Ra(Fo.loadUserSessions,mT),yield Ra(Fo.deleteUserSession,bT),yield Ra(Fo.deleteAllUserSessions,kT),yield Ra(Fo.loadCurrentUserSession,AT),yield Ua(Fo.revokeUserSessions,TT)}function*IT(){yield Di(Fo.setSessionsState({loading:!0,error:null})),yield Di(Fo.setSessionsState({sessions:Dp,loading:!1}))}function*PT({payload:{id:e}}){yield Di(Fo.setSessionsState({loading:!0,error:null}));const t=(yield Vi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield Di(Fo.setSessionsState({sessions:t,loading:!1}))}function*LT(){yield Di(Fo.setSessionsState({loading:!0,error:null}));const e=Dp.filter((e=>e.current));yield Di(Fo.setSessionsState({sessions:e,loading:!1}))}function*OT(){yield Ra(Fo.loadUserSessions,IT),yield Ra(Fo.deleteUserSession,PT),yield Ra(Fo.deleteAllUserSessions,LT)}const _T=["callback"],wT=["callback"];function*CT(){yield Di(Fo.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getSessionConfigurations);yield Di(Fo.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*UT({payload:e}){yield Di(Fo.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Jo(e,_T);yield Fi(xf.auth.createOrUpdateSessionConfigrations,n),yield Di(Fo.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Di(Fo.setSessionsPolicyState({error:e,loading:!1}))}}function*RT(){yield Da(Fo.loadSessionsPolicy,CT),yield Ra(Fo.createOrUpdateSessionsPolicy,gg(UT))}function*DT(){yield Di(Fo.setSessionsPolicyState({loading:!0,error:null}));const e=yield Vi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Np}));yield Di(Fo.setSessionsPolicyState(U({},e,{loading:!1})))}function*NT({payload:e}){yield Di(Fo.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Jo(e,wT);null==t||t(!0),yield Di(Fo.setSessionsPolicyState({configurations:n,loading:!1}))}function*MT(){yield Da(Fo.loadSessionsPolicy,DT),yield Ra(Fo.createOrUpdateSessionsPolicy,NT)}const FT=["callback"],GT=["callback"],$T=["callback"],VT=["callback"],xT=["callback"],BT=["callback"],jT=["callback"],WT=["callback"],KT=()=>Vi((e=>e.auth.restrictionsState.ipRestrictions)),HT=()=>Vi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*zT(){yield Di(Fo.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getDomainRestrictionsConfig),t=(yield Fi(xf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Di(Fo.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield Di(Fo.setEmailDomainRestrictionsState({error:og(e),loading:!1}))}}function*qT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,FT);yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield HT();try{var i;yield Fi(xf.auth.createDomainRestriction,n);const e=(yield Fi(xf.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=o.data)?void 0:t.config.listType)}));yield Di(Fo.setEmailDomainRestrictionsState({data:{config:(null==(i=o.data)?void 0:i.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setEmailDomainRestrictionsState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*YT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,GT);yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Fi(xf.auth.updateDomainRestrictionConfig,n),o=(yield Fi(xf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Di(Fo.setEmailDomainRestrictionsState({data:{config:e,restrictions:o},saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setEmailDomainRestrictionsState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*JT({payload:{id:e}}){yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield HT();try{var n;yield Fi(xf.auth.deleteDomainRestriction,e);const o=(yield Fi(xf.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield Di(Fo.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Bn.ALLOW},restrictions:o},saving:!1}))}catch(e){yield Di(Fo.setEmailDomainRestrictionsState({saving:!1,error:og(e)}))}}const QT=e=>{var t,n,o;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Bn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(o=null==e?void 0:e._offset)?o:0}};function*XT(){yield Di(Fo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield KT(),t=yield Fi(xf.auth.getIPRestrictionsConfig),n=QT({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield Fi(xf.auth.getIPRestrictions,n);yield Di(Fo.setIpRestrictionsState({data:{restrictions:o,config:t},totalPages:i,pagination:n,loading:!1}))}catch(e){yield Di(Fo.setIpRestrictionsState({error:og(e),loading:!1}))}}function*ZT(){try{const{valid:e}=yield Fi(xf.auth.testCurrentIpInAllowList);yield Di(Fo.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Di(Fo.setIpRestrictionsState({error:og(e)}))}}function*ek({payload:{callback:e}}){yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Vi((e=>e.auth.userIp));yield Ni([Fi(xf.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Bn.ALLOW}),Fi(xf.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield KT(),o=QT(n.pagination),{items:i,_metadata:{totalPages:a}}=yield Fi(xf.auth.getIPRestrictions,o);yield Di(Fo.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Bn.ALLOW},restrictions:i},userIpValid:!0,pagination:o,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield Di(Fo.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*tk(e){let{payload:{callback:t}}=e,n=Jo(e.payload,$T);yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));const o=yield KT();try{var i,a;yield Fi(xf.auth.createIPRestriction,n);const e=yield KT(),r=QT(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Fi(xf.auth.getIPRestrictions,r);yield ZT(),yield Di(Fo.setIpRestrictionsState({data:{config:null!=(i=null==(a=o.data)?void 0:a.config)?i:{isActive:!1,strategy:Bn.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setIpRestrictionsState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*nk(e){let{payload:{callback:t}}=e,n=Jo(e.payload,VT);yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));try{yield Fi(xf.auth.updateIPRestrictionConfig,n);const e=yield KT(),o=yield Fi(xf.auth.getIPRestrictionsConfig),i=QT(U({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield Fi(xf.auth.getIPRestrictions,i);yield ZT(),yield Di(Fo.setIpRestrictionsState({data:{config:o,restrictions:a},pagination:i,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setIpRestrictionsState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*ok({payload:{id:e,callback:t}}){yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));const n=yield KT();try{var o;yield Fi(xf.auth.deleteIPRestriction,e);const i=yield KT(),a=QT(i.pagination),{items:r,_metadata:{totalPages:l}}=yield Fi(xf.auth.getIPRestrictions,a);yield ZT(),yield Di(Fo.setIpRestrictionsState({data:{config:(null==(o=n.data)?void 0:o.config)||{isActive:!1,strategy:Bn.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setIpRestrictionsState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*ik(){yield Da(Fo.loadIpRestrictions,gg(XT)),yield Da(Fo.loadEmailDomainRestrictions,gg(zT)),yield Ua(Fo.saveIpRestriction,gg(tk)),yield Ua(Fo.saveIpRestrictionsConfig,gg(nk)),yield Ua(Fo.deleteIpRestriction,gg(ok)),yield Ua(Fo.checkIfUserIpValid,gg(ZT)),yield Ua(Fo.addCurrentUserIpAndActivate,gg(ek)),yield Ua(Fo.saveEmailDomainRestriction,gg(qT)),yield Ua(Fo.saveEmailDomainRestrictionsConfig,gg(YT)),yield Ua(Fo.deleteEmailDomainRestriction,gg(JT))}function*ak(){yield Di(Fo.setIpRestrictionsState({loading:!0,error:null})),yield Di(Fo.setIpRestrictionsState({data:{restrictions:Fp.filter((e=>e.strategy===Mp.strategy)),config:Mp},totalPages:1,pagination:{_filter:Bn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*rk(){yield Di(Fo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield KT(),t=Fp[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield Di(Fo.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield Di(Fo.setIpRestrictionsState({error:og(e),loading:!1}))}}function*lk(e){var t,n,o;let{payload:{callback:i}}=e,a=Jo(e.payload,xT);yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));const r=yield KT(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield Di(Fo.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Bn.ALLOW},restrictions:[...l,U({},a,{createdAt:new Date,updatedAt:new Date,id:lA(),isActive:null==(o=a.isActive)||o,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Bn.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*sk(e){var t,n,o;let{payload:{callback:i}}=e,a=Jo(e.payload,BT);const r=yield KT();yield Di(Fo.setIpRestrictionsState({saving:!0,error:null})),yield Di(Fo.setIpRestrictionsState({data:{config:U({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(o=r.data)?void 0:o.restrictions)?n:[]},pagination:{_filter:Bn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield Di(Fo.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*ck({payload:{id:e,callback:t}}){var n;yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));const o=yield KT();yield Di(Fo.setIpRestrictionsState({data:{config:(null==(n=o.data)?void 0:n.config)||{isActive:!1,strategy:Bn.ALLOW},restrictions:o.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Bn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*uk(){yield Di(Fo.setEmailDomainRestrictionsState({loading:!0,error:null})),yield Di(Fo.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Bn.ALLOW}],config:{active:!0,listType:Bn.ALLOW,blockPublicDomains:!1}}}))}function*dk(e){var t,n;let{payload:{callback:o}}=e,i=Jo(e.payload,jT);const a=yield HT();yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield bt(),null==o||o(!0),yield Di(Fo.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:i.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],U({},i,{id:Date.now().toString()})]},saving:!1}))}function*yk(e){var t;let{payload:{callback:n}}=e,o=Jo(e.payload,WT);const i=yield HT();yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield bt(),null==n||n(!0),yield Di(Fo.setEmailDomainRestrictionsState({data:{config:{active:o.active,blockPublicDomains:o.blockPublicDomains||!1,listType:o.type||Bn.ALLOW},restrictions:[...(null==(t=i.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*fk({payload:{id:e}}){var t,n;const o=yield HT();yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield bt(),yield Di(Fo.setEmailDomainRestrictionsState({data:{config:(null==(t=o.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Bn.ALLOW},restrictions:((null==(n=o.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*pk(){yield Da(Fo.loadIpRestrictions,ak),yield Da(Fo.loadEmailDomainRestrictions,uk),yield Ua(Fo.saveIpRestriction,lk),yield Ua(Fo.saveIpRestrictionsConfig,sk),yield Ua(Fo.deleteIpRestriction,ck),yield Ua(Fo.checkIfUserIpValid,rk),yield Ua(Fo.saveEmailDomainRestriction,dk),yield Ua(Fo.saveEmailDomainRestrictionsConfig,yk),yield Ua(Fo.deleteEmailDomainRestriction,fk)}const gk=["callback"],Sk=["id"];function*vk(e){const{count:t}=yield Fi(xf.directory.countConfigurationUsers,e.id);return U({},e,{count:t})}function*hk(){yield Di(Fo.setProvisioningState({loading:!0,error:null}));try{const e=yield Fi(xf.directory.getConfigs),t=yield Ni(e.map((e=>vk(e))));yield Di(Fo.setProvisioningState({connections:t,loading:!1}))}catch(e){yield Di(Fo.setProvisioningState({error:og(e),loading:!1}))}}function*mk(e){let{payload:{callback:t}}=e,n=Jo(e.payload,gk);yield Di(Fo.setProvisioningState({loading:!0,error:null}));try{const e=yield Fi(xf.directory.createConfiguration,n),o=yield Fi(xf.directory.getConfigs),i=yield Ni(o.map((e=>vk(e))));yield Di(Fo.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield Di(Fo.setProvisioningState({error:og(e),loading:!1}))}}function*Ak(e){let{payload:{id:t}}=e,n=Jo(e.payload,Sk);yield Di(Fo.setProvisioningState({loading:!0,error:null}));try{yield Fi(xf.directory.updateConfiguration,t,n);const e=yield Fi(xf.directory.getConfigs),o=yield Ni(e.map((e=>vk(e))));yield Di(Fo.setProvisioningState({connections:o,loading:!1}))}catch(e){yield Di(Fo.setProvisioningState({error:og(e),loading:!1}))}}function*bk({payload:{id:e,callback:t}}){yield Di(Fo.setProvisioningState({loading:!0,error:null}));try{yield Fi(xf.directory.deleteConfiguration,e);const n=yield Fi(xf.directory.getConfigs),o=yield Ni(n.map((e=>vk(e))));yield Di(Fo.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setProvisioningState({error:og(e),loading:!1})),null==t||t(!1,e)}}function*Tk(){yield Da(Fo.loadProvisionConnections,hk),yield Ua(Fo.createProvisionConnection,mk),yield Ua(Fo.deleteProvisionConnection,bk),yield Ua(Fo.updateProvisionConnection,Ak)}const kk=["callback","events"];function*Ek(e){let{payload:{callback:t}}=e,n=Jo(e.payload,kk);yield Di(Fo.setImpersonateState({loading:!0}));try{yield Fi(xf.impersonate.impersonate,n),yield Di(Fo.setImpersonateState({step:Co.success})),yield xi(1e3),yield ev(),yield Di(Fo.resetImpersonateState()),null==t||t(!0)}catch(e){yield Di(Fo.setImpersonateState({loading:!1,error:og(e)}))}}function*Ik(){yield Da(Fo.impersonate,Ek)}function*Pk({payload:e}){const{callback:t,deviceId:n}=e;yield Di(Fo.setPasskeysState({loading:!0}));try{yield Fi(xf.auth.deleteWebAuthnDevice,n);const{devices:e}=yield Vi((e=>e.auth.passkeysState)),o=e.filter((e=>e.id!==n));yield Di(Fo.setPasskeysState({devices:o,loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setPasskeysState({loading:!1,error:og(e,null)})),null==t||t(null,e)}}function*Lk(){yield Di(Fo.setPasskeysState({loading:!0}));try{const{devices:e}=yield Fi(xf.auth.getWebAuthnDevices);yield Di(Fo.setPasskeysState({devices:e,loading:!1}))}catch(e){yield Di(Fo.setPasskeysState({loading:!1,error:og(e,null)}))}}function*Ok(){yield Ua(Fo.loadWebAuthnDevices,Lk),yield Ua(Fo.deleteWebAuthnDevice,Pk)}const _k=["roleIds","userIds"],wk=()=>Vi((e=>e.auth.groupsState));function*Ck({payload:e}){const t=sA.GET_TEAM_USERS;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Fi(xf.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield Di(Fo.setGroupsState({teamUsers:n}))}catch(e){yield Di(Fo.setUsersGroupsError({key:t,value:og(e)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Uk({payload:e}){const t=sA.GET_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Fi(xf.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:cA.rolesAndUsers});yield Di(Fo.setGroupsState({selectedGroup:n}))}catch(e){yield Di(Fo.setUsersGroupsError({key:t,value:og(e)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Rk(){const e=sA.GET_GROUPS,t=yield wk();yield Di(Fo.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Fi(xf.groups.getGroups,{_groupsRelations:cA.rolesAndUsers});yield Di(Fo.setGroupsState(U({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield Di(Fo.setUsersGroupsError({key:e,value:og(t)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:e,value:!1}))}}function*Dk({payload:e}){const t=sA.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Jo(e,_k);yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Fi(xf.groups.createGroup,U({name:i.name},!!i.description&&{description:i.description},{color:i.color}));null!=o&&o.length&&(yield Di(Fo.addUsersToGroup({groupId:r.id,userIds:o}))),null!=n&&n.length&&(yield Di(Fo.addRolesToGroup({groupId:r.id,roleIds:n}))),yield Di(Fo.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield Di(Fo.setUsersGroupsError({key:t,value:og(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Nk({payload:e}){const t=sA.UPDATE_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(xf.groups.updateGroup,e),yield Di(Fo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Di(Fo.setUsersGroupsError({key:t,value:og(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Mk({payload:e}){const t=sA.DELETE_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(xf.groups.deleteGroup,e.groupId),yield Di(Fo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Di(Fo.setUsersGroupsError({key:t,value:og(n)})),null==e||null==(o=e.callback)||o.call(e,!1,n)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Fk({payload:e}){const t=sA.ADD_ROLES_TO_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(xf.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield Di(Fo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Di(Fo.setUsersGroupsError({key:t,value:og(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Gk({payload:e}){const t=sA.DELETE_ROLES_FROM_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(xf.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield Di(Fo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Di(Fo.setUsersGroupsError({key:t,value:og(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*$k({payload:e}){const t=sA.ADD_USERS_TO_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(xf.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield Di(Fo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;null==e||null==(o=e.callback)||o.call(e,!1),yield Di(Fo.setUsersGroupsError({key:t,value:og(n)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Vk({payload:e}){const t=sA.DELETE_USERS_FROM_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(xf.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield Di(Fo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Di(Fo.setUsersGroupsError({key:t,value:og(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*xk(){const e=sA.GET_GROUP_CONFIGURATION;yield Di(Fo.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Fi(xf.groups.getGroupConfiguration);yield Di(Fo.setGroupsState({groupsConfiguration:t}))}catch(t){yield Di(Fo.setUsersGroupsError({key:e,value:og(t)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:e,value:!1}))}}function*Bk({payload:e}){const t=sA.UPDATE_GROUP_CONFIGURATION;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{yield Fi(xf.groups.updateGroupConfiguration,e),yield Di(Fo.getGroupConfiguration())}catch(e){yield Di(Fo.setUsersGroupsError({key:t,value:og(e)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*jk(){yield Ra(Fo.loadGroups,Rk),yield Ra(Fo.getGroupById,Uk),yield Ra(Fo.createGroup,Dk),yield Ra(Fo.updateGroup,Nk),yield Ra(Fo.deleteGroup,Mk),yield Ra(Fo.addRolesToGroup,Fk),yield Ra(Fo.deleteRolesFromGroup,Gk),yield Ra(Fo.addUsersToGroup,$k),yield Ra(Fo.deleteUsersFromGroup,Vk),yield Ra(Fo.getGroupConfiguration,xk),yield Ra(Fo.updateGroupConfiguration,Bk),yield Ra(Fo.getTeamUsers,Ck)}function*Wk(){const e=sA.GET_GROUPS;yield Di(Fo.setUsersGroupsLoader({key:e,value:!0}));const t=Vp;yield Di(Fo.setGroupsState({groups:t})),yield Di(Fo.setUsersGroupsLoader({key:e,value:!1}))}function*Kk({payload:e}){var t;const n=sA.CREATE_GROUP,{groups:o}=yield wk();yield Di(Fo.setUsersGroupsLoader({key:n,value:!0})),yield Di(Fo.setGroupsState({groups:[U({},e,{id:`${e.name}ID`,managedBy:Nf.FRONTEGG}),...null!=o?o:[]]})),yield xi(500),null==e||null==(t=e.callback)||t.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:n,value:!1}))}function*Hk({payload:e}){var t,n,o,i,a;const r=sA.UPDATE_GROUP,l=yield wk();yield Di(Fo.setUsersGroupsLoader({key:r,value:!0})),yield Di(Fo.setGroupsState({groups:null==l||null==(t=l.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:Nf.FRONTEGG}):t})),selectedGroup:U({},null==l?void 0:l.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(o=null==e?void 0:e.color)?o:"",description:null!=(i=null==e?void 0:e.description)?i:""})})),yield xi(500),null==e||null==(a=e.callback)||a.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:r,value:!1}))}function*zk({payload:e}){var t,n;const o=sA.DELETE_GROUP,i=yield wk();yield Di(Fo.setUsersGroupsLoader({key:o,value:!0})),yield Di(Fo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield xi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*qk({payload:e}){var t,n;const o=sA.ADD_ROLES_TO_GROUP,i=yield wk();yield Di(Fo.setUsersGroupsLoader({key:o,value:!0})),yield Di(Fo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield xi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*Yk({payload:e}){var t,n;const o=sA.DELETE_ROLES_FROM_GROUP,i=yield wk();yield Di(Fo.setUsersGroupsLoader({key:o,value:!0})),yield Di(Fo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield xi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*Jk({payload:e}){var t,n;const o=sA.ADD_USERS_TO_GROUP,i=yield wk();yield Di(Fo.setUsersGroupsLoader({key:o,value:!0})),yield Di(Fo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield xi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*Qk({payload:e}){var t,n;const o=sA.DELETE_USERS_FROM_GROUP,i=yield wk();yield Di(Fo.setUsersGroupsLoader({key:o,value:!0})),yield Di(Fo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield xi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*Xk(){const e=sA.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield wk();yield Di(Fo.setUsersGroupsLoader({key:e,value:!0})),t&&(yield Di(Fo.setGroupsState({groupsConfiguration:U({},t)}))),yield Di(Fo.setUsersGroupsLoader({key:e,value:!1}))}function*Zk({payload:e}){const t=sA.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield wk();yield Di(Fo.setUsersGroupsLoader({key:t,value:!0})),n&&(yield Di(Fo.setGroupsState({groupsConfiguration:U({},n,e)}))),yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}function*eE(){yield Ra(Fo.loadGroups,Wk),yield Ra(Fo.createGroup,Kk),yield Ra(Fo.updateGroup,Hk),yield Ra(Fo.deleteGroup,zk),yield Ra(Fo.addRolesToGroup,qk),yield Ra(Fo.deleteRolesFromGroup,Yk),yield Ra(Fo.addUsersToGroup,Jk),yield Ra(Fo.deleteUsersFromGroup,Qk),yield Ra(Fo.getGroupConfiguration,Xk),yield Ra(Fo.updateGroupConfiguration,Zk)}let tE;!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.SET_ROOT_ACCOUNT_DATA="SET_ROOT_ACCOUNT_DATA",e.SET_SELECTED_SUB_ACCOUNT_DATA="SET_SELECTED_SUB_ACCOUNT_DATA",e.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT="LOAD_NUMBER_OF_USERS_FOR_ACCOUNT",e.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER="UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER",e.CREATE_SUB_ACCOUNT="CREATE_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT="UPDATE_SUB_ACCOUNT",e.DELETE_SUB_ACCOUNT="DELETE_SUB_ACCOUNT",e.GET_ACCOUNT_USERS="GET_ACCOUNT_USERS",e.ADD_USERS_TO_ACCOUNT="ADD_USERS_TO_ACCOUNT",e.DELETE_USERS_FROM_ACCOUNT="DELETE_USERS_FROM_ACCOUNT",e.SET_USER_ROLES_FOR_SUB_ACCOUNT="SET_USER_ROLES_FOR_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT_SETTINGS="UPDATE_SUB_ACCOUNT_SETTINGS",e.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(tE||(tE={}));const nE=(e,t,n)=>{var o,i;return e.tenantId===t?U({},e,{name:n}):U({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>nE(e,t,n))))?o:[]})};function oE(e,t){var n;return U({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>oE(e,t))):[]})}function iE(e,t,n){var o,i;if(e.tenantId===t){var a;const t=[...null!=(a=null==e?void 0:e.children)?a:[],...n].filter(((e,t,n)=>t===n.findIndex((t=>t.tenantId===e.tenantId))));return U({},e,{children:t})}return U({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>iE(e,t,n))))?o:[]})}const aE=({items:e},t)=>e.map((e=>{var n,o;return{name:e.name,tenantId:e.tenantId,numberOfUsers:null!=(n=null==(o=t.find((t=>t.tenantId===e.tenantId)))?void 0:o.totalUsers)?n:0,createdAt:e.createdAt,metadata:e.metadata}})),rE=()=>Vi((e=>e.auth.allAccountsState));function*lE({payload:e}){const t=tE.GET_ACCOUNTS;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield rE(),{jwt:o,_limit:i,_offset:a}=e,r={_offset:null!=a?a:n._offset,_limit:null!=i?i:n._limit,_subTenantId:null==e?void 0:e._subTenantId};try{if(o){var l;const{selectedAccount:t}=yield rE(),{items:n,_links:i}=yield Fi(xf.tenants.searchSubTenants,r,{jwt:o}),a=yield Fi(xf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:o}),s=aE({items:n},a),c=iE(t.accounts?t.accounts:t,null!=(l=null==e?void 0:e._subTenantId)?l:"",s.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==i?void 0:i.next}))));yield Di(Fo.setSelectedAccountState({accounts:c}))}else{var s;const{accounts:t}=yield rE(),{items:n,_links:o}=yield Fi(xf.tenants.searchSubTenants,r),i=yield Fi(xf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=aE({items:n},i),l=iE(t,null!=(s=null==e?void 0:e._subTenantId)?s:"",a.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==o?void 0:o.next}))));yield Di(Fo.setAllAccountsState({accounts:l}))}}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*sE({payload:e}){const t=tE.SEARCH_ACCOUNTS;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield rE(),{jwt:o}=e;try{if(null!=e&&e._subTenantId){var i;const{items:t}=yield Fi(xf.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(i=null==e?void 0:e._filter)?i:"",_subTenantId:e._subTenantId},{jwt:o});yield Di(Fo.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*cE({payload:e}){const t=tE.GET_USER_JWT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:o}=e;try{const e=yield Fi(xf.users.GetUserJwt,{tenantId:n});yield Di(Fo.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==o||o(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),yield Di(Fo.setSelectedAccountState({accessPermission:!1})),null==o||o(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*uE({payload:e}){const t=tE.CREATE_SUB_ACCOUNT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:o,tenantId:i,jwt:a,callback:r}=e;try{if(a){const{accounts:e}=yield rE(),{selectedAccount:t}=yield rE(),r=yield Fi(xf.subTenants.createSubTenant,{name:n,parentTenantId:o,tenantId:i},{jwt:a}),l=iE(e,null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),s=iE(U({name:"",tenantId:""},null==t?void 0:t.accounts),null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Di(Fo.setAllAccountsState({accounts:l})),yield Di(Fo.setSelectedAccountState({accounts:s}))}else{const{accounts:e}=yield rE(),t=yield Fi(xf.subTenants.createSubTenant,{name:n,tenantId:i,parentTenantId:o}),a=iE(e,null!=o?o:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Di(Fo.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),null==r||r(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*dE({payload:e}){const t=tE.DELETE_SUB_ACCOUNT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:o,callback:i}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield rE();yield Fi(xf.subTenants.deleteSubTenant,o,{jwt:n});const i=oE(t,o),a=oE(null==e?void 0:e.accounts,o);yield Di(Fo.setAllAccountsState({accounts:i})),yield Di(Fo.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield rE();yield Fi(xf.subTenants.deleteSubTenant,o);const t=oE(e,o);yield Di(Fo.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),null==i||i(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*yE({payload:e}){const t=tE.UPDATE_SUB_ACCOUNT_SETTINGS;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:o,callback:i,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield rE();yield Fi(xf.subTenants.updateSubTenant,{tenantId:a},{name:o},{jwt:n});const i=nE(e.accounts,a,o);yield Di(Fo.setSelectedAccountState({name:o,accounts:i}));const r=nE(t,a,o);yield Di(Fo.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield rE();yield Fi(xf.subTenants.updateSubTenant,{tenantId:a},{name:o});const t=nE(e,a,o);yield Di(Fo.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),null==i||i(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*fE({payload:e}){const t=tE.DELETE_USERS_FROM_ACCOUNT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:o,jwt:i,callback:a}=e;try{yield Fi(xf.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:o},{jwt:i}),yield Di(Fo.getAccountUsers({jwt:i,_tenantId:o[0].tenantId})),null==a||a(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),null==a||a(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*pE({payload:e}){const t=tE.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:o,jwt:i,callback:a}=e,{selectedAccount:r}=yield rE();try{yield Fi(xf.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:o},{jwt:i}),yield Di(Fo.getAccountUsers({jwt:i,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),null==a||a(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*gE({payload:e}){const t=tE.ADD_USERS_TO_ACCOUNT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:o,jwt:i,callback:a,allowSubAccountAccess:r=!1,roleIds:l}=e;try{yield Fi(xf.subTenants.addUsersToSubTenant,{users:n,tenantId:o,allowSubAccountAccess:r,roleIds:l},{jwt:i}),yield Di(Fo.getAccountUsers({jwt:i,_tenantId:o})),null==a||a(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),null==a||a(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*SE({payload:e}){const t=tE.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield rE(),{userId:o,allowAccess:i,jwt:a,callback:r}=e;try{var l;yield Fi(xf.subTenants.updateSubAccountAccess,o,{allowAccess:i},{jwt:a}),yield Di(Fo.setSelectedAccountState({users:null==n||null==(l=n.users)?void 0:l.map((e=>e.id===o?U({},e,{subAccountAccessAllowed:i}):e))})),null==r||r(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),null==r||r(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*vE({payload:e}){var t,n,o,i,a,r,l,s;const c=tE.GET_ACCOUNT_USERS;yield Di(Fo.setAllAccountsLoader({key:c,value:!0}));const u=yield rE(),{jwt:d,_tenantId:y,_email:f}=e,p=null!=(t=null!=(n=null==e?void 0:e._offset)?n:null==u||null==(o=u.selectedAccount)||null==(i=o.usersQueryParams)?void 0:i._offset)?t:0,g=null!=(a=null!=(r=null==e?void 0:e._limit)?r:null==u||null==(l=u.selectedAccount)||null==(s=l.usersQueryParams)?void 0:s._limit)?a:10,S=U({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield Fi(xf.users.getUsersV3,S,{jwt:d}),o={totalUsersItems:t,totalUsersPages:n,usersQueryParams:U({_offset:null!=p?p:0,_limit:null!=g?g:10},!!f&&{_email:f})};if(e.length){const t=e.map((e=>e.id)),n=yield Fi(xf.roles.getRoles),i=yield Fi(xf.users.getUsersRoles,{ids:t},{jwt:d}),a=e.map((e=>{var t,o;const a=null==i||null==(t=i.find((t=>t.userId===e.id)))?void 0:t.roleIds;return U({},e,{roles:null!=(o=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?o:[]})}));yield Di(Fo.setSelectedAccountState(U({users:a},o)))}else yield Di(Fo.setSelectedAccountState(U({users:[]},o)))}catch(e){yield Di(Fo.setAllAccountsError({key:c,value:og(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:c,value:!1}))}}function*hE({payload:e}){const t=tE.SET_SELECTED_SUB_ACCOUNT_DATA;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var o,i,a,r,l,s,c;const e=yield Fi(xf.accountSettings.getSettings,{jwt:n}),u=yield Fi(xf.tenants.getTenantsUsersCount,{tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n}),d=yield Fi(xf.tenants.getParentTenants,{jwt:n}),y=yield Fi(xf.tenants.getHierarchyMetadata,{_tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n});yield Di(Fo.setSelectedAccountState({tenantId:null!=(a=e.tenantId)?a:"",name:e.name,numberOfUsersObject:u[0],parentsAccounts:d,numberOfSubAccounts:null==(r=y[0])?void 0:r.totalSubTenants,accountSettings:e,accounts:{name:e.name,tenantId:null!=(l=e.tenantId)?l:"",numberOfUsers:null==(s=u[0])?void 0:s.totalUsers,createdAt:void 0,children:[]}})),yield Di(Fo.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*mE(){const e=tE.SET_ROOT_ACCOUNT_DATA;yield Di(Fo.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield Vi((e=>e.auth.tenantsState)),{accounts:n}=yield rE();if(t)try{var o;const i=yield Fi(xf.tenants.getTenantsUsersCount,{tenantIds:[null==t?void 0:t.tenantId]}),a={name:null==t?void 0:t.name,tenantId:null==t?void 0:t.tenantId,numberOfUsers:null==(o=i[0])?void 0:o.totalUsers,createdAt:null==t?void 0:t.createdAt};yield Di(Fo.setAllAccountsState({rootAccount:a,accounts:U({},n,a)}))}catch(t){yield Di(Fo.setAllAccountsError({key:e,value:og(t)}))}finally{yield Di(Fo.setAllAccountsLoader({key:e,value:!1}))}}function*AE({payload:e}){const t=tE.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:o}=e;try{const e=yield Fi(xf.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:o});yield Di(Fo.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*bE(){yield Ra(Fo.loadAccounts,lE),yield Ra(Fo.searchAccounts,sE),yield Ra(Fo.updateSubAccountAccessForUser,SE),yield Ra(Fo.getUserJwtForSubAccount,cE),yield Ra(Fo.createSubAccount,uE),yield Ra(Fo.deleteSubAccount,dE),yield Ra(Fo.updateSubAccountSettings,yE),yield Ra(Fo.addUsersToAccount,gE),yield Ra(Fo.deleteUsersFromAccount,fE),yield Ra(Fo.setUserRolesForSubAccount,pE),yield Ra(Fo.getAccountUsers,vE),yield Ra(Fo.setRootAccountData,mE),yield Ra(Fo.setSelectedSubAccountData,hE),yield Ra(Fo.loadNumberOfUsersForSelectedSubAccount,AE)}const TE=["callback"],kE=["callback"],EE=["callback","phoneId"],IE=["callback","phoneId"],PE=["callback"];function*LE(){yield Di(Fo.setSmsState({loading:!0}));const e={_limit:10,_offset:0};try{const{items:t}=yield Fi(xf.userPhoneNumbers.getUserPhoneNumbers,e);yield Di(Fo.setSmsState({phoneNumbers:t}))}catch(e){yield Di(Fo.setSmsState({error:og(e)}))}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*OE(e){let{payload:{callback:t}}=e,n=Jo(e.payload,TE);yield Di(Fo.setSmsState({loading:!0}));try{const e=yield Fi(xf.userPhoneNumbers.createPhoneNumber,n);yield Di(Fo.setSmsState({otcToken:e.otcToken})),yield Fi(LE),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:og(e)})),null==t||t(null)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*_E(e){let{payload:{callback:t}}=e,n=Jo(e.payload,kE);yield Di(Fo.setSmsState({loading:!0}));try{yield Fi(xf.userPhoneNumbers.verifyPhoneNumber,n),yield Fi(LE),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:og(e)})),null==t||t(null)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*wE(e){let{payload:{callback:t,phoneId:n}}=e;Jo(e.payload,EE),yield Di(Fo.setSmsState({loading:!0}));try{const e=yield Fi(xf.userPhoneNumbers.deletePhoneNumber,n);yield Di(Fo.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:og(e)})),null==t||t(null)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*CE(e){let{payload:{callback:t,phoneId:n}}=e,o=Jo(e.payload,IE);yield Di(Fo.setSmsState({loading:!0}));try{yield Fi(xf.userPhoneNumbers.verifyDeletePhoneNumber,n,o),yield Fi(LE),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:og(e)})),null==t||t(null)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*UE(e){let{payload:{callback:t}}=e,n=Jo(e.payload,PE);yield Di(Fo.setSmsState({loading:!0}));try{const e=yield Fi(xf.userPhoneNumbers.preVerifyPhoneNumber,n);yield Di(Fo.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:og(e)})),null==t||t(null)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*RE(){yield Ua(Fo.loadPhoneNumbers,LE),yield Ua(Fo.setUpPhoneNumber,OE),yield Ua(Fo.verifyPhoneNumber,_E),yield Ua(Fo.deletePhoneNumber,wE),yield Ua(Fo.verifyDeletePhoneNumber,CE),yield Ua(Fo.preVerifyPhoneNumber,UE)}var DE={sagas:function*(){yield Ni([Fi(Zv),Fi(Qm),Fi(Zm),Fi(xm),Fi(hT),Fi(gh),Fi(jh),Fi(Yh),Fi(yg),Fi(Lm),Fi(nb),Fi(jk),Fi(kb),Fi(hS),Fi(Ub),Fi(eS),Fi(xb),Fi(Yb),Fi(cT),Fi(ET),Fi(RT),Fi(ik),Fi(Tk),Fi(Ik),Fi(Ok),Fi(bE),Fi(wS),Fi(Eg),Fi(RE)])},mockSagas:function*(){yield Ni([Fi(nh),Fi(Th),Fi(Zh),Fi(Mm),Fi(gb),Fi(Gb),Fi(fS),Fi(OT),Fi(Wb),Fi(Qb),Fi(MT),Fi(pk),Fi(dT),Fi(eE),Fi(Cg)])},storeName:Ct,initialState:wo,reducer:No,actions:Fo};const NE=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),ME={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},FE={setAuditLogsState:NE("auditLogsState"),resetAuditLogsState:e=>U({},e,{auditLogsState:ME})},GE={exportAuditsCsv:ut("auditLogs/exportAuditsCsv"),loadAuditLogs:ut("auditLogs/loadAuditLogs",(e=>({payload:e})))},$E={loading:!0},VE={setAuditsMetadataState:NE("auditsMetadataState"),resetAuditsMetadataState:e=>U({},e,{auditsMetadataState:$E})},xE={loadAuditsMetadata:ut("auditLogs/loadAuditsMetadata")},BE={auditLogsState:ME,auditsMetadataState:$E},{reducer:jE,actions:WE}=yt({name:Rt,initialState:BE,reducers:U({resetState:e=>U({},e,BE),setState:(e,{payload:t})=>U({},e,t)},FE,VE)}),KE=U({},WE,GE,xE),HE=e=>"createdAt"!==e.id,zE={total:20,data:Array.from(Array(5).keys()).map((e=>U({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`})))},qE={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}]},YE=()=>Vi((e=>e.auditLogs.auditLogsState)),JE=()=>Vi((e=>e.auditLogs.auditsMetadataState));function*QE(){const e=yield YE(),{columns:t}=yield JE();try{const n=e.filter,o=e.sort.reduce(((e,t)=>U({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),i=n.reduce(((e,t)=>U({},e,{[t.id]:t.value})),{});yield Di(KE.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield xf.audits.exportAudits(U({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},o,i))}catch(e){console.error("failed to export audits - ",e)}yield Di(KE.setAuditLogsState({isDownloadingCsv:!1}))}function*XE({payload:e}){yield Di(KE.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield YE(),{columns:n}=yield JE();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield Di(KE.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>U({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>U({},e,{[t.id]:t.value})),{});n||(yield Di(KE.loadAuditsMetadata()));const{data:p,total:g}=yield Fi(xf.audits.getAudits,U({offset:c,count:s},y,f));yield Di(KE.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield Di(KE.setAuditLogsState({loading:!1,error:og(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*ZE(){yield Ua(KE.exportAuditsCsv,QE),yield Ua(KE.loadAuditLogs,XE)}function*eI({payload:e}){yield Di(KE.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield YE(),{columns:n}=yield JE();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield Di(KE.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield Di(KE.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=zE;let o=n.filter((e=>t=>e.filter(HE).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];o=o.sort(((e,t)=>(n,o)=>n[e]>o[e]?t?-1:1:o[e]>n[e]?t?1:-1:0)(e,n))}return{data:o,total:o.length}})(u,d);yield Di(KE.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 Di(KE.setAuditLogsState({loading:!1,error:og(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*tI(){yield Ua(KE.loadAuditLogs,eI)}function*nI(){yield Di(KE.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Fi(xf.metadata.getAuditsMetadata);yield Di(KE.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Di(KE.setAuditsMetadataState({error:e,loading:!1}))}}function*oI(){yield Ua(KE.loadAuditsMetadata,nI)}function*iI(){yield Di(KE.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=qE;yield Di(KE.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Di(KE.setAuditsMetadataState({error:e,loading:!1}))}}function*aI(){yield Ua(KE.loadAuditsMetadata,iI)}var rI={sagas:function*(){yield Ni([Fi(ZE),Fi(oI)])},mockSagas:function*(){yield Ni([Fi(tI),Fi(aI)])},storeName:Rt,initialState:BE,reducer:jE,actions:KE};const lI={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:sI,actions:cI,reducer:uI}=yt({name:"audits",initialState:lI,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=U({},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]})))}}}),dI=U({},cI,{initData:ut(`${sI}/initData`),loadAudits:ut(`${sI}/loadAudits`),removeFilter:ut(`${sI}/removeFilter`),filterData:ut(`${sI}/filterData`),exportCSV:ut(`${sI}/exportCSV`),deleteAudits:ut(`${sI}/deleteAudits`)}),yI=()=>Vi((e=>e[sI]));function*fI(){const{sortBy:e,sortDirection:t}=yield yI();try{const n=yield Fi(xf.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Di(dI.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Di(dI.loadItemFailedAction(t))}}function*pI(){try{const e=yield Fi(xf.metadata.getAuditsMetadata);yield Di(dI.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Di(dI.loadItemFailedAction(t))}}const gI=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*SI({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield yI(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield yI():{rowsData:[]};try{const e=gI(t),{data:l,total:d}=yield Fi(xf.audits.getAudits,U({},r&&{paginationMode:"virtual"},{sortDirection:o,sortBy:n,filter:i},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield Di(dI.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield Di(dI.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Di(dI.loadItemFailedAction(t))}}function*vI(){yield Di(dI.startLoading()),yield Ni([fI(),pI(),SI({payload:{onlyOneLoad:!1},type:""})]),yield Di(dI.finishLoading())}function*hI({payload:e}){const{filters:t}=yield yI(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield Di(dI.setFilterData(o))}function*mI({payload:e}){const{filters:t}=yield yI();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const o=[...t.slice(0,n),e,...t.slice(n+1)];yield Di(dI.setFilterData(o))}function*AI(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield yI(),a=gI(e);yield Di(dI.startDownloadingCsv());try{yield xf.audits.exportAudits(U({endpoint:"csv/v2",headerProps:i,sortDirection:n,sortBy:t,filter:o},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield Di(dI.stopDownloadingCsv())}}function*bI(){yield Ra(dI.initData,vI),yield Ra(dI.removeFilter,hI),yield Ra(dI.filterData,mI),yield Ra([dI.loadAudits,dI.textSearch,dI.onPageChange],SI),yield Ra([dI.setFilterData,dI.setDataSorting,dI.startRefresh],(()=>SI({payload:{appendMode:!1},type:""}))),yield Ra(dI.exportCSV,AI)}const TI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},kI={initData:()=>U({},TI),setConnectivityState:(e,{payload:t})=>U({},e,t),cleanWebhookTestData:e=>U({},e,{testResult:void 0}),cleanWebhookLogsData:e=>U({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return U({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>U({},e,{error:void 0}),cleanSlackData:e=>U({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>U({},e,{retryResult:U({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>U({},e,{retryResult:U({},e.retryResult,t)})}},EI={loadSlackActions:ut("connectivity/loadSlackActions"),loadDataAction:ut("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:ut("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:ut("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:ut("connectivity/loadScope"),deleteWebhookConfigAction:ut("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:ut("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:ut("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},II={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:PI,actions:LI}=yt({name:Ut,initialState:II,reducers:U({},kI)}),OI=U({},LI,EI),_I={slack:xf.connectivity.getSlackConfiguration,email:xf.connectivity.getEmailConfiguration,sms:xf.connectivity.getSMSConfiguration,webhook:xf.connectivity.getWebhooksConfigurations,categories:xf.connectivity.getCategories,channelMap:xf.connectivity.getChannelMaps},wI={slack:xf.connectivity.postSlackConfiguration,email:xf.connectivity.postEmailConfiguration,sms:xf.connectivity.postSMSConfiguration,webhook:xf.connectivity.postWebhooksConfiguration},CI=["email","slack","sms","webhook"],UI={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"}},RI=["id"],DI=["id","enabled"],NI=["categories","channelMap"];function*MI(e){return yield Fi(GI,{payload:{api:e},type:""})}function*FI({payload:e=CI}){yield Di(OI.setConnectivityState({isLoading:!0}));try{const t=yield Ni([...e.map(MI),yield GI({payload:{api:"categories"},type:""}),yield function*(){return(yield Ni(e.map((function*(e){return yield GI({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>U({},t,{[`${e[o]}`]:n})),{})}()]),n=yield GI({payload:{api:"webhook"},type:""}),o=t.reduce(((n,o,i)=>e[i]?t[t.length-1][e[i]].length?U({},n,{[`${e[i]}`]:o,list:[...n.list,{id:i,key:e[i],events:UI[e[i]].events(o),active:UI[e[i]].isActive(o),platform:UI[e[i]].title,image:UI[e[i]].image}]}):n:U({},n,{[`${NI[i-e.length]}`]:o})),{list:[],webhook:n});yield Di(OI.setConnectivityState(U({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Di(OI.setConnectivityState({isLoading:!1}))}}function*GI({payload:{api:e,params:t}}){try{return yield Fi(_I[e],t)}catch(e){return}}function*$I(){try{yield Di(OI.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Fi(xf.connectivity.getSlackChannels);yield Di(OI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Di(OI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*VI(e,t){const{connectivity:{list:n}}=yield Vi(),o=n.find((({key:t})=>t===e));if(!o)return;const i=UI[e].isActive(t);i!==o.active&&(yield Di(OI.setConnectivityState({list:n.map((t=>t.key===e?U({},t,{active:i}):t))})))}function*xI({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield Vi((e=>e.connectivity));try{if(yield Di(OI.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...o]:o})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Vi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:o}=e;yield Ni([...o.reduce(((e,t)=>{var o,i;return!t.id&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length||(null==n?void 0:n.find((e=>{let{id:n}=e,o=Jo(e,RI);return n===t.id&&JSON.stringify(U({id:n},o))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length?[...e,t]:e}),[]).map((function*(e){return yield Fi(wI.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Fi(xf.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Vi(),{processIds:o}=yield Vi((e=>e.connectivity)),i=n[t];if(!i)return;let a=[];try{a=yield Ni([...e.reduce(((e,t)=>!i.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield Fi("email"===t?xf.connectivity.postEmailConfiguration:xf.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:o}=e,i=n[0],{id:a="",enabled:r}=i,l=Jo(i,DI);return yield Ni([yield Fi("email"===t?xf.connectivity.patchEmailConfiguration:xf.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield Fi("email"===t?xf.connectivity.putEmailSubscriptions:xf.connectivity.putSMSSubscriptions,a,o,U({},l,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=i.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 Fi("email"===t?xf.connectivity.deleteEmailSubscriptions:xf.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield GI({payload:{api:t},type:""});yield Di(OI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield VI(t,e)}else yield Di(OI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield Fi(wI[e],t),!["sms","email"].includes(e)){const i=yield GI({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield Di(OI.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield VI(e,i),null==n||n(!0)}}catch(e){yield Di(OI.setConnectivityState({error:og(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*BI({payload:e}){try{yield xf.connectivity.postSlackCode(e)}catch{}yield Di(OI.setConnectivityState({error:void 0,isSaving:!1}))}function*jI(){const{slackChannels:e}=yield Vi((e=>e.connectivity));try{yield Di(OI.setConnectivityState({slackChannels:U({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Fi(xf.connectivity.getSlackScope);yield Di(OI.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Di(OI.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*WI({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield Vi((e=>e.connectivity));try{yield Di(OI.setConnectivityState({isSaving:!0})),yield Fi(xf.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,og(e))}const i=yield GI({payload:{api:"webhook"},type:""});i&&(yield Di(OI.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*KI({payload:e}){try{yield Di(OI.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Fi(xf.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Di(OI.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Di(OI.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Di(OI.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*HI({payload:e}){try{const{statusCode:t}=yield Fi(xf.connectivity.postWebhookRetry,e);yield Di(OI.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Di(OI.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*zI({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield Vi((e=>e.connectivity));try{yield Di(OI.setConnectivityState({webhookLogs:U({},o,{isLoading:!0})}));const i=yield Fi(xf.connectivity.getWebhookLog,e,n,t);yield Di(OI.setConnectivityState({error:void 0,webhookLogs:U({isLoading:!1},i)}))}catch(e){yield Di(OI.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var qI={sagas:function*(){yield Ua(OI.loadDataAction,FI),yield Ra(OI.loadSlackActions,$I),yield Ua(OI.postDataAction,xI),yield Ua(OI.postCodeAction,BI),yield Ua(OI.loadScope,jI),yield Ua(OI.deleteWebhookConfigAction,WI),yield Ua(OI.postWebhookTestAction,KI),yield Ua(OI.postWebhookRetryAction,HI),yield Ra(OI.loadWebhookLogsAction,zI)},storeName:Ut,initialState:II,reducer:PI,actions:OI};function YI(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}}function JI(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>U({},n,{[e]:t(n[e],o)})}}function QI(e){return JI(e,((e,t)=>U({},e,{loading:t.payload})))}function XI(e){return JI(e,((e,t)=>U({},e,{error:t.payload,loading:!1})))}const ZI={loading:!1,error:null,fetching:!0,plans:[]},{actions:eP,reducer:tP,name:nP}=yt({name:"subscriptions/plans",initialState:ZI,reducers:U({},YI())}),oP=U({loadPlans:ut(`${nP}/loadPlans`)},eP),iP={loading:!1,error:null,fetching:!0,config:null},aP=U({},YI()),{actions:rP,reducer:lP,name:sP}=yt({name:"subscriptions/config",initialState:iP,reducers:aP}),cP=U({loadPaymentConfiguration:ut(`${sP}/loadPaymentConfiguration`)},rP),uP={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},dP=U({},YI(),{setCancellationLoading:QI("cancellation"),setCancellationError:XI("cancellation"),setRenewalLoading:QI("renewal"),setRenewalError:XI("renewal")}),{reducer:yP,actions:fP,name:pP}=yt({name:"subscriptions/billing/subscription",initialState:uP,reducers:dP}),gP=U({load:ut(`${pP}/loadSubscription`),cancelSubscription:ut(`${pP}/cancelSubscription`),renewSubscription:ut(`${pP}/renewSubscription`)},fP),SP={loading:!1,error:null,fetching:!0},vP=U({},YI()),{reducer:hP,actions:mP,name:AP}=yt({name:"subscriptions/billing/information",initialState:SP,reducers:vP}),bP=U({loadBillingInformation:ut(`${AP}/loadBillingInformation`),cancelSubscription:gP.cancelSubscription,renewSubscription:gP.renewSubscription},mP),TP={loading:!1,error:null,fetching:!0},kP=U({},YI(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}),{reducer:EP,actions:IP,name:PP}=yt({name:"subscriptions/billing/payment",initialState:TP,reducers:kP}),LP=U({loadPaymentMethod:ut(`${PP}/loadPaymentMethod`),submitPaymentMethod:ut(`${PP}/submitPaymentMethod`),submitPaymentMethodError:ut(`${PP}/submitPaymentMethodError`),submitPaymentMethodSuccess:ut(`${PP}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:ut(`${PP}/updateBillingDetails`,(e=>({payload:e})))},IP),OP={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},_P=U({},YI(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{invoiceDownload:U({},e.invoiceDownload,t.payload)})}}),{reducer:wP,actions:CP,name:UP}=yt({name:"subscriptions/billing/invoices",initialState:OP,reducers:_P}),RP=U({loadInvoices:ut(`${UP}/loadInvoices`),downloadInvoice:ut(`${UP}/downloadInvoice`,(e=>({payload:e})))},CP),DP={information:SP,invoices:OP,paymentMethod:TP,subscription:uP},NP={invoices:RP,information:bP,paymentMethod:LP,subscription:gP},MP=We({invoices:wP,information:hP,paymentMethod:EP,subscription:yP}),FP={fetching:!0,loading:!1,error:null,confirmed:!1},GP=U({},YI()),{actions:$P,reducer:VP,name:xP}=yt({name:"subscriptions/checkout",initialState:FP,reducers:GP}),BP=U({loadCheckout:ut(`${xP}/loadCheckout`),resetCheckout:ut(`${xP}/resetCheckout`),submitCheckout:ut(`${xP}/submitCheckout`),confirmCheckout:ut(`${xP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:ut(`${xP}/errorCheckout`,(e=>({payload:e})))},$P),jP={loading:!1,error:null,cardSetupIntentSecret:null},WP=U({},YI()),{reducer:KP,actions:HP,name:zP}=yt({name:"subscriptions/stripe",initialState:jP,reducers:WP}),qP=U({loadCustomer:ut(`${zP}/loadCustomer`),createCardSetupIntentSecret:ut(`${zP}/createCardSetupIntentSecret`)},HP),YP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:JP,reducer:QP,name:XP}=yt({name:"subscriptions/vendorPublicConfig",initialState:YP,reducers:U({},YI())}),ZP=U({loadVendorPublicConfiguration:ut(`${XP}/loadVendorPublicConfiguration`)},JP),eL={config:iP,plans:ZI,checkout:FP,billing:DP,stripe:jP,vendorPublicConfig:YP},tL={config:cP,billing:NP,plans:oP,checkout:BP,stripe:qP,vendorPublicConfig:ZP},nL=We({config:lP,billing:MP,plans:tP,checkout:VP,stripe:KP,vendorPublicConfig:QP});let oL,iL,aL;function rL({policy:e}){return{policy:aL.AT_PERIOD_END}}function lL(e){switch(e){case Uy.ACTIVE:return iL.ACTIVE;case Uy.INCOMPLETE:return iL.INCOMPLETE;case Uy.CANCELED:return iL.CANCELED;case Uy.EXPIRED:return iL.EXPIRED;case Uy.TRIALING:return iL.TRIALING;default:return iL.EXPIRED}}!function(e){e.STRIPE="Stripe"}(oL||(oL={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(iL||(iL={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(aL||(aL={}));const sL={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Uy.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},cL=[{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"}],uL=[{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:""}],dL=[{id:"id",externalId:"externalId",type:Ry.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],yL={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*fL(){yield Di(gP.setLoading(!0));try{const[e]=yield Fi(xf.subscriptions.getManagedSubscriptions);yield Di(gP.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Di(gP.setError(e))}}function*pL(){yield Ua(bP.loadBillingInformation,gL)}function*gL(){yield function*(e){const t=yield Vi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Vi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield SL(n,!1):yield Di(bP.setError(t?"Not authorized":"Internal feature failure"))}()}function*SL(e,t){yield Di(bP.setLoading(!0));try{var n,o;const i=yield Fi(xf.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield Fi(xf.subscriptions.getSubscriptionPlan,a):([,l]=yield Ni([Fi(fL),Fi(xf.subscriptions.getSubscriptionPlan,a)]),s=yield Vi((e=>e.subscriptions.billing.subscription.subscription||null))),yield Di(bP.setState(U({loading:!1,fetching:!1,summary:i},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?iL.ACTIVE:lL(s.status),cancellation:s.cancellation&&rL(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==(o=l.price)?void 0:o.currency)||"usd",recurringInterval:"month",slug:l.slug}}:{})))}catch(e){yield Di(bP.setError(og(e)))}}function*vL(){yield function*(){var e,t;yield Di(bP.setLoading(!0)),yield xi(500),yield Di(bP.setState({loading:!1,fetching:!1,summary:{subscriptionId:sL.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Ny.Stripe,externallyManaged:!1,currentPlanId:cL[0].id,defaultPlanId:cL[0].id},plan:U({},cL[0],{price:null==(e=cL[0].price)?void 0:e.amount,currency:null==(t=cL[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*hL(){yield Ua(bP.loadBillingInformation,vL)}function*mL(){yield Ua(LP.loadPaymentMethod,AL),yield Ua(LP.submitPaymentMethod,TL),yield Ua(LP.submitPaymentMethodError,kL),yield Ua(LP.submitPaymentMethodSuccess,EL),yield Ua(LP.updatePaymentMethodBillingDetails,bL)}function*AL(){yield Di(LP.setLoading(!0));try{const e=(yield Fi(xf.subscriptions.getPaymentMethods))[0];yield Di(LP.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Di(LP.setError(og(e)))}}function*bL({payload:e}){yield Di(LP.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield Fi(xf.subscriptions.updatePaymentMethodBillingDetails,t,U({email:n},o)),yield Fi(AL),null==i||i(!0)}catch(e){yield Di(LP.setError(og(e))),null==i||i(!1)}yield Di(LP.setLoading(!1))}function*TL(){yield Di(LP.setLoading(!0))}function*kL({payload:e}){yield Di(LP.setError(e))}function*EL(){yield Di(LP.loadPaymentMethod())}function*IL(){yield Di(LP.setLoading(!0)),yield xi(500);const e=dL[0];yield Di(LP.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*PL(){yield Ua(LP.loadPaymentMethod,IL)}function*LL(){yield Ua(RP.loadInvoices,OL),yield Ua(RP.downloadInvoice,_L)}function*OL(){yield Di(RP.setLoading(!0));try{const e=(yield Fi(xf.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 Di(RP.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Di(RP.setError(og(e)))}}function*_L({payload:e}){yield Di(RP.setInvoiceDownloadState({loading:!0,error:null}));try{yield Fi(xf.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Di(RP.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Di(RP.setInvoiceDownloadState({loading:!1,error:og(e,null)}))}}function*wL(){yield Di(RP.setLoading(!0)),yield xi(500),yield Di(RP.setState({loading:!1,fetching:!1,invoices:uL.map((e=>U({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Di(RP.setLoading(!1))}function*CL(){yield Ua(RP.loadInvoices,wL)}function*UL(){yield Ua(gP.load,RL),yield Ua(gP.cancelSubscription,DL),yield Ua(gP.renewSubscription,NL)}function*RL(){const e=yield Vi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield SL(e)}function*DL(){const{subscription:e}=yield Vi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Di(gP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Di(gP.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===Uy.ACTIVE)try{yield Di(gP.setCancellationLoading(!0)),yield Fi(xf.subscriptions.cancelManagedSubscription,t),yield fL(),yield Di(gP.setCancellationLoading(!1))}catch(e){yield Di(gP.setCancellationError(og(e)))}}function*NL(){const{subscription:e}=yield Vi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Di(gP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Di(gP.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Dy.AT_PERIOD_END)try{yield Di(gP.setRenewalLoading(!0)),yield Fi(xf.subscriptions.renewManagedSubscription,t),yield fL(),yield Di(gP.setRenewalLoading(!1))}catch(e){yield Di(gP.setCancellationError(og(e)))}}function*ML(){yield Di(gP.setLoading(!0)),yield xi(500),yield Di(gP.setState({subscription:sL,fetching:!1,loading:!1,error:null}))}function*FL(){yield Ua(gP.load,ML)}function*GL(){yield Ni([Fi(pL),Fi(mL),Fi(LL),Fi(UL)])}function*$L(){yield Ni([Fi(hL),Fi(PL),Fi(CL),Fi(FL)])}function*VL(){yield Ua(BP.loadCheckout,xL),yield Ua(BP.resetCheckout,BL),yield Ua(BP.submitCheckout,jL),yield Ua(BP.confirmCheckout,WL),yield Ua(BP.errorCheckout,HL)}function*xL(){yield Di(BP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*BL(){yield Di(BP.setState({loading:!1,error:null,confirmed:!1}))}function*jL(){yield Di(BP.setState({loading:!0,error:null}))}function*WL({payload:{paymentMethodId:e,planId:t}}){const n=yield Vi((e=>e.subscriptions.billing.subscription.subscription)),o=yield Vi((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===Uy.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield Di(BP.setState({loading:!0,error:null})),i&&a)return yield KL(),void(yield Di(gP.setState({subscription:U({},n,{status:Uy.ACTIVE})})));try{yield Fi(xf.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Ni([gL(),AL(),OL()]),yield KL()}catch(e){yield Di(BP.setState({loading:!1,error:og(e)}))}}else yield Di(BP.setState({loading:!1,error:"Subscription not found"}))}function*KL(){yield Di(BP.setState({loading:!1,error:null,confirmed:!0}))}function*HL({payload:e}){yield Di(BP.setState({loading:!1,error:e}))}function*zL(){yield Ua(BP.resetCheckout,BL)}function*qL(){yield Ua(oP.loadPlans,YL)}function*YL(){yield Di(oP.setLoading(!0));try{const e=(yield Fi(xf.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 Di(oP.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Di(oP.setError(og(e)))}}function*JL(){yield Di(oP.setLoading(!0)),yield xi(500),yield Di(oP.setState({fetching:!1,loading:!1,plans:cL.map((e=>{var t,n;return U({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*QL(){yield Ua(oP.loadPlans,JL)}function*XL(){yield Ua(cP.loadPaymentConfiguration,ZL)}function*ZL(){yield Di(cP.setLoading(!0));try{(yield Fi(xf.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Ny.Stripe))?yield function*(){yield Di(cP.setLoading(!0));try{const e=yield Fi(xf.subscriptions.getStripePaymentProviderConfiguration);yield Di(cP.setState({loading:!1,fetching:!1,config:{paymentProvider:oL.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Di(cP.setError(og(e)))}}():yield Di(cP.setError("Payment provider not configured"))}catch(e){yield Di(cP.setError(og(e)))}}function*eO(){yield Di(cP.setLoading(!0)),yield xi(500),yield Di(cP.setState({loading:!1,fetching:!1,config:{paymentProvider:oL.STRIPE,apiKey:""}}))}function*tO(){yield Ua(cP.loadPaymentConfiguration,eO)}function*nO(){yield Ua(qP.createCardSetupIntentSecret,oO)}function*oO({payload:e}){yield Di(qP.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Fi(xf.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Di(qP.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Di(qP.setError(og(e)))}}function*iO(){yield Ua(ZP.loadVendorPublicConfiguration,aO)}function*aO(){yield Di(ZP.setLoading(!0));try{const e=yield Fi(xf.subscriptions.getVendorPublicConfigurations);yield Di(ZP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Di(ZP.setError(og(e)))}}function*rO(){yield Di(ZP.setLoading(!0)),yield xi(500),yield Di(ZP.setState({fetching:!1,loading:!1,vendorPublicConfig:yL}))}function*lO(){yield Ua(ZP.loadVendorPublicConfiguration,rO)}var sO={sagas:function*(){yield Ni([Fi(GL),Fi(VL),Fi(qL),Fi(XL),Fi(nO),Fi(iO)])},mockSagas:function*(){yield Ni([Fi($L),Fi(zL),Fi(QL),Fi(tO),Fi(lO)])},reducer:nL,actions:tL,initialState:eL,storeName:"subscriptions"},cO={sagas:function*(){yield Ua(ES.loadVendorPublicInfo,IS)},storeName:Dt,initialState:bS,reducer:TS,actions:ES};const{reducer:uO}=yt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Na.setContext(t),U({},e,{context:t}))}}}),dO=(e,t,n=!1,o,i,a=!1,r="path")=>{const l="undefined"==typeof window;let s=t;if(l&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(s||(s=window),!s.store){var c,u,d,y,f,p,g,S,v,h;n||a||Na.setContext(e.context);const t=ka(),l=[...st({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=ct({middleware:l,preloadedState:{root:U({},e,{previewMode:n,urlStrategy:r}),[DE.storeName]:U({},DE.initialState,o,null!=(c=null==i?void 0:i.auth)?c:{},{routes:U({},DE.initialState.routes,null!=(u=null==o?void 0:o.routes)?u:{},null!=(d=null==i||null==(y=i.auth)?void 0:y.routes)?d:{})}),[rI.storeName]:U({},rI.initialState,null!=(f=null==i?void 0:i.auditLogs)?f:{},{auditLogsState:U({},rI.initialState.auditLogsState,null!=(p=null==i||null==(g=i.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:U({},rI.initialState.auditsMetadataState,null!=(S=null==i||null==(v=i.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[sI]:U({},lI,null!=(h=null==i?void 0:i.audits)?h:{}),[qI.storeName]:qI.initialState,[sO.storeName]:sO.initialState,[cO.storeName]:cO.initialState},reducer:We({root:uO,[DE.storeName]:DE.reducer,[rI.storeName]:rI.reducer,[sI]:uI,[qI.storeName]:qI.reducer,[sO.storeName]:sO.reducer,[cO.storeName]:cO.reducer})});const m=function*(){yield Ni([Fi(DE.sagas),Fi(rI.sagas),Fi(bI),Fi(qI.sagas),Fi(sO.sagas),Fi(cO.sagas)])},A=function*(){yield Ni([Fi(DE.mockSagas),Fi(rI.mockSagas),Fi(sO.mockSagas)])};n?(s.store.destroy=t.run(A).cancel,s.store.dispatch(Fo.requestAuthorize(!0))):s.store.destroy=t.run(m).cancel,s.store.subscribeStateChanged=e=>{let t=s.store.getState();return s.store.subscribe((()=>{const n=s.store.getState();t!=n&&(t=n,e(n))}))}}return s.store},yO=(e,t)=>((()=>{if(!Na.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")})(),e?e.isEntitled?{isEntitled:!0}:{isEntitled:!1,justification:e.justification}:{isEntitled:!1,justification:t});var fO=n(714),pO=n.n(fO);function gO(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function SO(e){if(e.type)return e;if("#"===e.charAt(0))return SO(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 o=e.substring(t+1,e.length-1);let i,a;if("color"===n){if(a=o.split(" "),i=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(i))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+i)}else a=o.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:i}}function vO(e){const{type:t,colorSpace:n}=e;let{values:o}=e;return-1!==t.indexOf("rgb")?o=o.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(o[1]=`${o[1]}%`,o[2]=`${o[2]}%`),o=-1!==t.indexOf("color")?`${n} ${o.join(" ")}`:`${o.join(", ")}`,`${t}(${o})`}function hO(e){if(0===e.indexOf("#"))return e;const{values:t}=SO(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 mO(e,t){return e=SO(e),t=gO(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,vO(e)}function AO(e,t){if(e=SO(e),t=gO(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 vO(e)}function bO(e,t){if(e=SO(e),t=gO(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 vO(e)}const TO=e=>{if(e)return{main:e,light:hO(bO(e,.4)),dark:hO(AO(e,.15)),hover:hO(AO(e,.15)),active:hO(AO(e,.2))}},kO=e=>{if(e)return{main:e,light:bO(e,.7),dark:AO(e,.2)}},EO=(e,t)=>{var n,o,i,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)?U({},t,{palette:{primary:U({},TO(null==e||null==(o=e.palette)?void 0:o.primary),{contrastText:null!=(i=null==e||null==(a=e.palette)?void 0:a.primaryText)?i:"#000000"}),secondary:U({},TO(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:U({},TO(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:U({},kO(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:U({},kO(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:U({},kO(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:U({},kO(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},IO={theme:{},themeV2:{},localizations:{},navigation:{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"]},provisioning:{visibility:"hidden",permissions:["fe.secure.read.provisioningConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]},allAccounts:{visibility:"byPermissions",permissions:["fe.account-hierarchy.read.subAccount"]},groups:{visibility:"hidden",permissions:["fe.secure.read.groups"]}}};class PO{constructor(){this._theme=IO.theme,this._themeV2=IO.themeV2,this._navigation=IO.navigation,this._localizations=IO.localizations,this._integrations=IO.integrations}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new PO;return n.set(e),PO._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:{}}get integrations(){var e;return null!=(e=this._integrations)?e:{}}set(e){try{var t,n,o,i,a,r,l,s,c;this._navigation=pO().all([null!=(t=IO.navigation)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=pO().all([null!=(o=IO.theme)?o:{},EO(null==e?void 0:e.theme,IO.theme)]),this._themeV2=pO().all([null!=(i=IO.themeV2)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=pO().all([null!=(r=IO.localizations)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}]),this._integrations=pO().all([null!=(s=IO.integrations)?s:{},null!=(c=null==e?void 0:e.integrations)?c:{}])}catch(e){this._navigation=IO.navigation,this._theme=IO.theme,this._themeV2=IO.themeV2,this._localizations=IO.localizations,this._integrations=IO.integrations}}}PO._instances={};var LO=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},OO=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=document.createElement(t);return Object.keys(n).forEach((function(e){return o.setAttribute(e,n[e])})),e.appendChild(o),o},_O=function(e){return new Promise((function(t,n){var o=4e3,i=setInterval((function(){return null!=e.themeSetter?(clearInterval(i),void t(!0)):o<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(i)):void(o-=50)}),50)}))},wO=function(e){var t=e.toString();if(t){var n=new URL(window.location.href);n.search=t,window.history.pushState(null,"",n.toString())}};let CO,UO,RO,DO,NO,MO,FO,GO,$O,VO,xO;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(CO||(CO={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(UO||(UO={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(RO||(RO={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(DO||(DO={})),function(e){e.Invoices="invoices"}(NO||(NO={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(MO||(MO={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(FO||(FO={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(GO||(GO={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}($O||($O={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(VO||(VO={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(xO||(xO={}));const BO={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},jO={hidden:"hidden",edit:"edit"};var WO="6.145.0",KO={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on","show-passkeys-new":"on","groups-admin-box-new":"on","msp-all-accounts-new":"on"},HO=function(){function e(t,n){var o,i=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];P(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(WO),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.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=D(M().mark((function e(){var t,n,o,a,r;return M().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Ir,i.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,i.options.metadata=null!=(n=null==r||null==(o=r.rows)||null==(a=o[0])?void 0:a.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:PO.set(i.options.metadata,i.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=D(M().mark((function e(){var t,n,o;return M().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=null==(t=i.options.authOptions)||null==(n=t.hostedLoginOptions)?void 0:n.loadUserOnFirstLoad,i.options.builderMode||"nextjs"===i.options.framework||(i.options.hostedLoginBox&&!i.options.customLoginBox&&o?i.store.dispatch({type:"auth/requestHostedLoginAuthorizeV2",payload:{shouldRedirectToLogin:!1,firstTime:!0}}):i.store.dispatch({type:"auth/requestAuthorize",payload:!0}));case 2:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=D(M().mark((function e(){var t;return M().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.options.previewMode&&!i.options.builderMode){e.next=4;break}Ul.set(KO,i.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Rl();case 7:t=e.sent,i.options.overrideFeatureFlags&&Object.assign(t,i.options.overrideFeatureFlags),Ul.set(t,i.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.setFeatureFlagsForPreview=function(e){Ul.set(U({},KO,e),i.name)},this.updateLocalizationsSetter=function(e){i.updateLocalizations=e},this.getEntitlementsFromStore=function(){var e;return null==(e=i.store.getState().auth.user)?void 0:e.entitlements};var l=LO(n),s="frontegg-app-".concat(l);this.iframeRendering=a,this.name=l,this.options=U({},t,{contextOptions:U({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=s;var c,u,d=this.options.authOptions?U({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(o=this.options.authOptions)?void 0:o.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=dO({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);C.setInstance(l,this),this.setEntitlementsOptions(t.entitlementsOptions),Na.setAppName(l)}var t,n,o,i;return w(e,[{key:"setEntitlementsOptions",value:function(e){Na.setEntitlementsOptions(U({},e))}},{key:"initContainers",value:(i=D(M().mark((function e(t){return M().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){console.error("Failed to add frontegg-loading to body classList")}return e.next=9,this.loadFeatureFlags();case 9:return e.next=11,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize()]);case 11:this.options.previewMode||this.options.customLoginBox||(this.loadLoginBox(),n=this.name,o=void 0,void 0,a=void 0,null==(a=null==(i=PO.getInstance(n))||null==(o=i.integrations)?void 0:o.gtm)||a.filter((function(e){var t=e.id;return e.enabled&&function(e){return/^GTM-[a-zA-Z0-9]+$/.test(e)}(t)})).forEach((function(e){var t=e.id,n=document.createElement("script");n.innerHTML="\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','".concat(t,"');\n "),document.body.appendChild(n)}))),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 13:case"end":return e.stop()}var n,o,i,a}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;PO.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,o){if(window[e])n(window[e]);else{var i=document.createElement("script");i.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),i.setAttribute("id","".concat(e,"Script")),i.setAttribute("cdn-url",t.cdnUrl),i.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:E,FronteggTypes:I})):n(window[e])},i.onerror=function(e){console.log("Profile page error",e),o(e)},document.body.append(i)}}))}},{key:"loadLoginBox",value:(o=D(M().mark((function e(){return M().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){console.error("Failed to call loadLoginBoxListener",e)}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"showAdminPortal",value:(n=D(M().mark((function e(){var t;return M().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Na.setRequestSource(lo.AdminPortal),e.next=3,this.loadScript("FronteggAdminPortal");case 3:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e,t=new URLSearchParams(window.location.search);null==(e=this.adminPortalRenderer)||e.unmount(),wO(t),Na.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=D(M().mark((function e(t){var n;return M().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,U({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:"getFeatureEntitlements",value:function(e){return((e,t)=>{var n;return yO(null==e||null==(n=e.features)?void 0:n[t],_l.MISSING_FEATURE)})(this.getEntitlementsFromStore(),e)}},{key:"getPermissionEntitlements",value:function(e){return((e,t)=>{var n;return yO(null==e||null==(n=e.permissions)?void 0:n[t],_l.MISSING_PERMISSION)})(this.getEntitlementsFromStore(),e)}},{key:"getEntitlements",value:function(e){return"permissionKey"in e?this.getPermissionEntitlements(e.permissionKey):this.getFeatureEntitlements(e.featureKey)}},{key:"loadEntitlements",value:function(e){this.store.dispatch({type:"auth/loadEntitlements",payload:{callback:e}})}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),zO=function(){function e(){P(this,e)}return w(e,null,[{key:"setAuthentication",value:function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",i=C.getInstance(o);e&&t?(Na.setAccessToken(t),Na.setUser(U({},n,{accessToken:t})),i.store.dispatch(Fo.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(Fo.loadTenants())):(Na.setAccessToken(null),Na.setUser(null),i.store.dispatch(Fo.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),qO=function(){function e(){P(this,e)}return w(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";C.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";C.getInstance(e).hideAdminPortal()}}]),e}(),YO=function(){function e(){P(this,e)}return w(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";C.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";C.getInstance(e).hideCheckoutDialog()}}]),e}(),JO=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},QO=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=dO({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=U({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},i),this.app=new HO(this.options,t,!0),PO.set({},t)}var t;return w(e,[{key:"render",value:(t=D(M().mark((function e(t){var n,o,i,a,r=this;return M().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,o=function(e){r.themeSetter=e},i=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:o,setStaticRouteSetter:i}),this.app.loading=!1,e.next=13,_O(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}(),XO="modern",ZO=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[XO]},e_=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=dO({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=U({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},i),this.app=new HO(this.options,t,!0,a),PO.set({},t)}var t;return w(e,[{key:"render",value:(t=D(M().mark((function e(t){var n,o,i,a,r=this;return M().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,o=function(e){r.themeSetter=e},i=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:o,setStaticRouteSetter:i,staticRoute:"/account/login"}),e.next=12,_O(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 t_(e,t){return t_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},t_(e,t)}function n_(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&&t_(e,t)}function o_(e,t){if(t&&("object"===L(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 i_(e){return i_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},i_(e)}function a_(){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 r_(e,t,n){return r_=a_()?Reflect.construct.bind():function(e,t,n){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return n&&t_(i,n.prototype),i},r_.apply(null,arguments)}function l_(e){var t="function"==typeof Map?new Map:void 0;return l_=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 r_(e,arguments,i_(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),t_(n,e)},l_(e)}function s_(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,o=i_(e);if(t){var i=i_(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return o_(this,n)}}var c_=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new HO(e,t);if("undefined"!=typeof document){var o;if(!e.contextOptions.baseUrl){var i=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(i.message),i}if(!customElements.get("frontegg-app")){var a=function(e){n_(n,e);var t=s_(n);function n(){var e;P(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).app=null,e}return w(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=C.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var o=OO(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=OO(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=OO(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=o.attachShadow({mode:"open"}),l=i.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),c=OO(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=OO(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=OO(s,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:o,loginBoxContainer:i,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(l_(HTMLElement));customElements.define("frontegg-app",a)}null==(o=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||o.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),o}()}));
|
|
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 o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map((function(e){return o(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||i,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=o;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var i={};return n.isMergeableObject(e)&&a(e).forEach((function(t){i[t]=o(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])?i[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):i[a]=o(t[a],n))})),i}(e,n,s):o(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},378:function(e){"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var o,i,a;if(Array.isArray(t)){if((o=t.length)!=n.length)return!1;for(i=o;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((o=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=o;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=o;0!=i--;){var r=a[i];if(!e(t[r],n[r]))return!1}return!0}return t!=t&&n!=n}},609:function(e,t,n){var o=n(425).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},s=l.iterator||"@@iterator",c=l.asyncIterator||"@@asyncIterator",u=l.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,o){var i=t&&t.prototype instanceof g?t:g,a=Object.create(i.prototype),l=new O(o||[]);return r(a,"_invoke",{value:E(e,n,l)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,s,(function(){return this}));var m=Object.getPrototypeOf,A=m&&m(m(_([])));A&&A!==n&&a.call(A,s)&&(h=A);var b=v.prototype=g.prototype=Object.create(h);function T(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(i,r,l,s){var c=f(e[i],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==o(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 i;r(this,"_invoke",{value:function(e,o){function a(){return new t((function(t,i){n(e,o,t,i)}))}return i=i?i.then(a,a):a()}})}function E(e,t,n){var o="suspendedStart";return function(i,a){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var r=n.delegate;if(r){var l=I(r,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var s=f(e,t,n);if("normal"===s.type){if(o=n.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o="completed",n.method="throw",n.arg=s.arg)}}}function I(e,t){var n=t.method,o=e.iterator[n];if(void 0===o)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=f(o,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}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 L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function _(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=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 o.next=o}}return{next:w}}function w(){return{value:void 0,done:!0}}return S.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},T(k.prototype),d(k.prototype,c,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,o,i,a){void 0===a&&(a=Promise);var r=new k(y(e,n,o,i),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},T(b),d(b,u,"Generator"),d(b,s,(function(){return this})),d(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=_,O.prototype={constructor:O,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(L),!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,o){return r.type="throw",r.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],r=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var r=i?i.completion:{};return r.type=e,r.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):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),p},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),L(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:_(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=i,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 o=n(609)();e.exports=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var a=t[o]={exports:{}};return e[o](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 o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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 o={};return function(){"use strict";n.r(o),n.d(o,{AdminPortal:function(){return qO},AdminPortalRenderer:function(){return QO},AppHolder:function(){return C},CheckoutDialog:function(){return YO},FronteggApp:function(){return HO},HostedLogin:function(){return zO},LoginBoxRenderer:function(){return e_},createElement:function(){return OO},defaultTheme:function(){return XO},formatName:function(){return LO},getThemeAdminByName:function(){return JO},getThemeByName:function(){return ZO},initialize:function(){return c_},mockFlagsList:function(){return KO},restoreSearchParams:function(){return wO},waitThemeSetter:function(){return _O}});var e={};n.r(e),n.d(e,{Delete:function(){return _r},Get:function(){return Ir},Patch:function(){return Lr},Post:function(){return Pr},PostDownload:function(){return wr},Put:function(){return Or},extractHeadersFromOptions:function(){return Cr},getBaseUrl:function(){return Tr},getMetadataHeaders:function(){return kr}});var t={};n.r(t),n.d(t,{getHierarchyMetadata:function(){return Vr},getParentTenants:function(){return Mr},getParentTenantsById:function(){return Fr},getSubTenants:function(){return Dr},getSubTenantsAsTree:function(){return Nr},getTenants:function(){return Rr},getTenantsUsersCount:function(){return Gr},searchSubTenants:function(){return $r},switchTenant:function(){return Ur}});var i={};n.r(i),n.d(i,{GetUserJwt:function(){return Al},getCurrentUserTenantsV3:function(){return Il},getUsersGroups:function(){return El},getUsersRoles:function(){return kl},getUsersV2:function(){return bl},getUsersV3:function(){return Tl},sendResetBreachedPasswordEmails:function(){return Pl},updateUserProfileV2:function(){return Ll}});var a={};n.r(a),n.d(a,{loadEntitlements:function(){return Ol}});var r={};n.r(r),n.d(r,{FeatureFlags:function(){return Ul},loadFeatureFlags:function(){return Rl}});var l={};n.r(l),n.d(l,{AuthStrategyEnum:function(){return ko},MachineToMachineAuthStrategy:function(){return Eo},OAuthLogout:function(){return ss},SocialLoginProviders:function(){return To},acceptInvitation:function(){return os},activateAccount:function(){return Xl},activateAccountV2:function(){return Zl},bulkCreateIPRestriction:function(){return ll},changePhoneNumber:function(){return du},changePhoneNumberWithVerification:function(){return cu},checkIfAllowToRememberMfaDevice:function(){return Rc},createDomainRestriction:function(){return tl},createIPRestriction:function(){return rl},createOrUpdateSessionConfigrations:function(){return vc},createSSOConfiguration:function(){return $c},createSSOConfigurationByMetadata:function(){return Bc},createSSOConfigurationByMetadataUrl:function(){return Wc},createSSODomain:function(){return Hc},createSSOGroup:function(){return Qc},createSamlGroup:function(){return tc},createTenantAccessToken:function(){return Ic},createUserAccessToken:function(){return Ec},deleteAllSessionsForUser:function(){return mc},deleteDomainRestriction:function(){return ol},deleteIPRestriction:function(){return cl},deleteSSOConfiguration:function(){return xc},deleteSSODomain:function(){return zc},deleteSSOGroup:function(){return Zc},deleteSamlGroup:function(){return oc},deleteSessionForUser:function(){return hc},deleteTenantAccessToken:function(){return Tc},deleteTenantApiToken:function(){return wc},deleteUserAccessToken:function(){return kc},deleteUserApiToken:function(){return Cc},deleteWebAuthnDevice:function(){return vu},disableMFAAuthenticatorApp:function(){return Ts},disableMFASMS:function(){return Es},disableMFAWebAuthn:function(){return Ps},disableMfa:function(){return bs},enrollMFAAuthenticatorApp:function(){return gs},enrollMFAAuthenticatorAppForLogin:function(){return _s},enrollMFAAuthenticatorAppForLoginV2:function(){return ws},enrollMFASMS:function(){return vs},enrollMFASMSForLogin:function(){return Ms},enrollMFASMSForLoginV2:function(){return Fs},enrollMFAWebAuthn:function(){return ms},enrollMFAWebAuthnForLogin:function(){return Bs},enrollMFAWebAuthnForLoginV2:function(){return js},enrollMfa:function(){return fs},exchangeOAuthTokens:function(){return au},exchangeOAuthTokensV2:function(){return ou},forgotPassword:function(){return cs},generateLoginResponse:function(){return Fl},generateLoginResponseFromOAuthResponse:function(){return Bl},generateLoginResponseFromOAuthResponseV2:function(){return jl},generateLoginResponseV2:function(){return Gl},generateLoginResponseV3:function(){return xl},getActivateAccountStrategy:function(){return es},getCaptchaPolicy:function(){return qr},getCurrentUserSession:function(){return pc},getCurrentUserSessions:function(){return fc},getCustomSocialLoginProvidersV1:function(){return cc},getDomainRestrictions:function(){return Zr},getDomainRestrictionsConfig:function(){return el},getGlobalSecurityPolicy:function(){return xr},getIPRestrictions:function(){return il},getIPRestrictionsConfig:function(){return al},getLockoutPolicy:function(){return Kr},getMFADevices:function(){return Ls},getMFAStrategiesConfig:function(){return bu},getMeAndEntitlements:function(){return Eu},getMeV2:function(){return ku},getMfaPolicy:function(){return Br},getOidcConfiguration:function(){return ic},getPasswordConfigPolicy:function(){return Xr},getPasswordHistoryPolicy:function(){return Yr},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return Au},getSSOConfigurations:function(){return Gc},getSSODefaultRoles:function(){return Yc},getSSOGroups:function(){return eu},getSSOPublicConfiguration:function(){return ac},getSamlConfiguration:function(){return zs},getSamlRoles:function(){return Xs},getSamlRolesGroups:function(){return Zs},getSamlVendorConfiguration:function(){return Ys},getSessionConfigurations:function(){return Sc},getSocialLoginProviders:function(){return rc},getSocialLoginProvidersV2:function(){return lc},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return sc},getTenantAccessTokensData:function(){return bc},getTenantApiTokensData:function(){return Lc},getUserAccessTokensData:function(){return Ac},getUserApiTokensData:function(){return Pc},getUserAuthorization:function(){return Tu},getUserById:function(){return Uc},getVendorConfig:function(){return dc},getVendorLockoutPolicy:function(){return Hr},getVendorMfaPolicy:function(){return jr},getVendorPasswordHistoryPolicy:function(){return Jr},getVendorPublicAuthStrategiesConfig:function(){return mu},getWebAuthnDevices:function(){return Su},loadPasswordConfig:function(){return ds},login:function(){return ql},loginViaSocialLogin:function(){return uc},loginWithMfa:function(){return Jl},loginWithMfaV2:function(){return Ql},loginv2:function(){return Yl},logout:function(){return ls},oidcPostLogin:function(){return zl},oidcPostLoginV2:function(){return nu},passwordlessPostLogin:function(){return Mc},passwordlessPostLoginV2:function(){return Nc},passwordlessPreLogin:function(){return Dc},postLogin:function(){return Hl},preDisableMFASMS:function(){return ks},preDisableMFAWebAuthn:function(){return Is},preEnrollMFAAuthenticatorApp:function(){return ps},preEnrollMFAAuthenticatorAppForLogin:function(){return Os},preEnrollMFASMS:function(){return Ss},preEnrollMFASMSForLogin:function(){return Ns},preEnrollMFAWebAuthn:function(){return hs},preEnrollMFAWebAuthnForLogin:function(){return xs},preLogin:function(){return Wl},preLoginV2:function(){return tu},preLoginWithIdpType:function(){return Kl},preVerifyMFAEmailCode:function(){return Us},preVerifyMFASMSForLogin:function(){return Gs},preVerifyMFAWebAuthnForLogin:function(){return Ws},recoverMfaToken:function(){return ys},refreshToken:function(){return is},refreshTokenV2:function(){return as},refreshTokenV3:function(){return rs},resendActivationEmail:function(){return ts},resendInvitationEmail:function(){return ns},resetPassword:function(){return us},resetPhoneNumber:function(){return lu},revokeSessionsForUser:function(){return gc},saveLockoutPolicy:function(){return zr},saveMfaPolicy:function(){return Wr},savePasswordHistoryPolicy:function(){return Qr},setSSODefaultRoles:function(){return Jc},signUpUser:function(){return yc},silentOAuthRefreshToken:function(){return ru},silentOAuthRefreshTokenV2:function(){return iu},testCurrentIp:function(){return ul},testCurrentIpInAllowList:function(){return dl},updateDomainRestrictionConfig:function(){return nl},updateIPRestrictionConfig:function(){return sl},updateSSOConfiguration:function(){return Vc},updateSSOConfigurationByMetadata:function(){return jc},updateSSOConfigurationByMetadataUrl:function(){return Kc},updateSSOGroup:function(){return Xc},updateSamlConfiguration:function(){return qs},updateSamlGroup:function(){return nc},updateSamlRoles:function(){return ec},updateSamlVendorMetadata:function(){return Js},updateTenantApiTokensData:function(){return _c},updateUserApiTokensData:function(){return Oc},validateSSODomain:function(){return qc},validateSamlDomain:function(){return Qs},verifyChangePhoneNumber:function(){return uu},verifyInviteToken:function(){return Fc},verifyMFAAuthenticatorAppForLogin:function(){return Cs},verifyMFAEmailCode:function(){return Rs},verifyMFAEmailCodeV2:function(){return Ds},verifyMFASMSForLogin:function(){return $s},verifyMFASMSForLoginV2:function(){return Vs},verifyMFAWebAuthnForLogin:function(){return Ks},verifyMFAWebAuthnForLoginV2:function(){return Hs},verifyMfa:function(){return As},verifyNewDeviceSession:function(){return hu},verifyResetPhoneNumber:function(){return su},webAuthnCreateNewDeviceSession:function(){return gu},webAuthnPostLogin:function(){return fu},webAuthnPostLoginV2:function(){return pu},webAuthnPreLogin:function(){return yu}});var s={};n.r(s),n.d(s,{addUser:function(){return wu},changePassword:function(){return Ou},createInviteUserLink:function(){return Ru},deleteInviteUserLink:function(){return Nu},deleteUser:function(){return Cu},getInviteLinkConfiguration:function(){return Fu},getInviteUserLink:function(){return Mu},getProfile:function(){return Iu},loadAvailablePermissions:function(){return $u},loadAvailableRoles:function(){return Gu},loadStats:function(){return Vu},loadUsers:function(){return _u},resendActivationLink:function(){return xu},resendInvitationLink:function(){return Bu},resendInvitationLinkToAllTenants:function(){return ju},updateInviteUserLink:function(){return Du},updateProfile:function(){return Pu},updateProfileImage:function(){return Lu},updateUser:function(){return Uu}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return Ku},getAuditsMetadata:function(){return Ju},getCurrentUserIpMetadata:function(){return zu},getIpAdressMetadata:function(){return Qu},getNotificationsMetadata:function(){return qu},getSamlMetadata:function(){return Yu},updateAdminBoxMetadata:function(){return Hu}});var u={};n.r(u),n.d(u,{downloadReport:function(){return ad},getReport:function(){return nd},getReports:function(){return td},renderReport:function(){return od},scheduleReport:function(){return id},sendReport:function(){return rd}});var d={};n.r(d),n.d(d,{getNotifications:function(){return ld},markAllAsRead:function(){return ud},updateNotificationIsPinned:function(){return cd},updateNotificationStatus:function(){return sd}});var y={};n.r(y),n.d(y,{exportAudits:function(){return pd},getAudits:function(){return yd},getAuditsStats:function(){return fd}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return Od},deleteEmailSubscriptions:function(){return Pd},deleteSMSConfiguration:function(){return Dd},deleteSMSSubscriptions:function(){return Ud},deleteSlackConfiguration:function(){return bd},deleteWebhooksConfiguration:function(){return Fd},getCategories:function(){return xd},getChannelMaps:function(){return Bd},getEmailConfiguration:function(){return kd},getSMSConfiguration:function(){return _d},getSlackChannels:function(){return md},getSlackConfiguration:function(){return vd},getSlackScope:function(){return hd},getWebhookLog:function(){return Gd},getWebhooksConfigurations:function(){return Nd},patchEmailConfiguration:function(){return Id},patchSMSConfiguration:function(){return Cd},postEmailConfiguration:function(){return Ed},postSMSConfiguration:function(){return wd},postSlackCode:function(){return Td},postSlackConfiguration:function(){return Ad},postWebhookRetry:function(){return Vd},postWebhookTest:function(){return $d},postWebhooksConfiguration:function(){return Md},putEmailSubscriptions:function(){return Ld},putSMSSubscriptions:function(){return Rd}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return Kd},getSettings:function(){return Wd},updateSettings:function(){return jd}});var g={};n.r(g),n.d(g,{addRole:function(){return Jd},attachPermissionToRoles:function(){return ty},attachPermissionsToRole:function(){return Zd},deleteRole:function(){return Qd},getPermissionCategories:function(){return ny},getPermissions:function(){return ey},getRoles:function(){return Yd},updateRole:function(){return Xd}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return Dy},ISubscriptionStatus:function(){return Uy},PaymentMethodType:function(){return Ry},ProviderType:function(){return Ny},TenantCreatedAction:function(){return Fy},TrialEndAction:function(){return My},cancelManagedSubscription:function(){return uy},cancelSubscription:function(){return ay},createStripeCustomer:function(){return Ey},createStripePaymentMethodSetupIntentSecret:function(){return Py},createSubscription:function(){return Ty},createTenantConfiguration:function(){return _y},getManagedSubscription:function(){return sy},getManagedSubscriptions:function(){return cy},getPaymentMethod:function(){return Ay},getPaymentMethods:function(){return my},getPaymentProviders:function(){return wy},getStripeCustomer:function(){return ky},getStripePaymentProviderConfiguration:function(){return Iy},getSubscription:function(){return iy},getSubscriptionInvoice:function(){return Sy},getSubscriptionInvoicePdf:function(){return vy},getSubscriptionInvoices:function(){return gy},getSubscriptionPlan:function(){return py},getSubscriptionPlans:function(){return fy},getSubscriptionSummaries:function(){return Ly},getSubscriptions:function(){return oy},getTenantConfiguration:function(){return Oy},getVendorPublicConfigurations:function(){return Cy},renewManagedSubscription:function(){return dy},renewSubscription:function(){return ry},updateManagedSubscription:function(){return yy},updatePaymentMethodBillingDetails:function(){return by},updateSubscription:function(){return ly}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return Gy}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return By},addUserToTenantAndSubTenants:function(){return Vy},addUsersToSubTenant:function(){return Yy},createSubTenant:function(){return Ky},deleteSubTenant:function(){return Hy},loadAllUsers:function(){return $y},removeUserFromTenantAndSubTenants:function(){return xy},removeUserRolesFromSubTenants:function(){return jy},setUserRolesForSubTenants:function(){return Wy},updateSubAccountAccess:function(){return qy},updateSubTenant:function(){return zy}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return ef},createConfiguration:function(){return Xy},deleteConfiguration:function(){return Zy},getConfigs:function(){return Jy},updateConfiguration:function(){return Qy}});var A={};n.r(A),n.d(A,{impersonate:function(){return tf}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return uf},addUsersToGroup:function(){return yf},createGroup:function(){return lf},deleteGroup:function(){return cf},deleteRolesFromGroup:function(){return df},deleteUsersFromGroup:function(){return ff},getGroupById:function(){return of},getGroupConfiguration:function(){return pf},getGroups:function(){return af},getGroupsByIds:function(){return rf},updateGroup:function(){return sf},updateGroupConfiguration:function(){return gf}});var T={};n.r(T),n.d(T,{getInsights:function(){return vf},getRecommendations:function(){return Sf}});var k={};n.r(k),n.d(k,{createPhoneNumber:function(){return mf},deletePhoneNumber:function(){return Af},getUserPhoneNumbers:function(){return hf},preVerifyPhoneNumber:function(){return bf},verifyDeletePhoneNumber:function(){return kf},verifyPhoneNumber:function(){return Tf}});var E={};n.r(E),n.d(E,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return wl},AuthStrategyEnum:function(){return ko},ContextHolder:function(){return Na},FeatureFlags:function(){return Ul},FronteggApiError:function(){return Fa},FronteggContext:function(){return Ma},FronteggFrameworks:function(){return so},GetUsersFilterPreset:function(){return yo},GroupManagedByEnum:function(){return Nf},GroupRelations:function(){return Df},ISubscriptionCancellationPolicy:function(){return Dy},ISubscriptionStatus:function(){return Uy},InsightCode:function(){return Ff},LOAD_AUTHORIZATION_FF:function(){return ml},MFAStrategyEnum:function(){return hl},MachineToMachineAuthStrategy:function(){return Eo},NotEntitledJustification:function(){return _l},PaginationOrderEnum:function(){return co},PaymentMethodType:function(){return Ry},ProviderType:function(){return Ny},RecommendationActionKey:function(){return Gf},RecommendationCode:function(){return Mf},RecommendationSeverity:function(){return $f},RequestSource:function(){return lo},RestrictionType:function(){return Bn},ScimConnectionSource:function(){return Rf},SecondaryAuthStrategy:function(){return Sl},SecurityCategory:function(){return Vf},SocialLoginProviders:function(){return To},SortByEnum:function(){return uo},TenantSortByEnum:function(){return If},TenantType:function(){return Pf},UserManagedByEnum:function(){return Ef},WebAuthnDeviceType:function(){return vl},api:function(){return xf},countConfigurationUsers:function(){return ef},createConfiguration:function(){return Xy},default:function(){return Bf},deleteConfiguration:function(){return Zy},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Lf},fronteggHeaders:function(){return ro},fronteggRefreshTokenUrl:function(){return Of},fronteggSilentRefreshTokenUrl:function(){return _f},fronteggTenantsUrl:function(){return Cf},fronteggTenantsV3Url:function(){return Uf},fronteggUsersUrl:function(){return wf},getConfigs:function(){return Jy},loadFeatureFlags:function(){return Rl},providersArray:function(){return fo},updateConfiguration:function(){return Qy}});var I={};function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e){return L="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},L(e)}function O(e){var t=function(e,t){if("object"!==L(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!==L(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===L(t)?t:String(t)}function _(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,O(o.key),o)}}function w(e,t,n){return t&&_(e.prototype,t),n&&_(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(I),n.d(I,{AccountDetailsPageTabs:function(){return xO},AccountPageFields:function(){return DO},DomainRestrictionsTabFields:function(){return VO},GeneralSettingsTabFields:function(){return GO},InviteUserModalFields:function(){return RO},IpRestrictionsTabFields:function(){return $O},Metadata:function(){return PO},PrivacyPageFields:function(){return UO},ProfilePageFields:function(){return CO},SecurityPageTabs:function(){return MO},SessionManagementTabFields:function(){return FO},SubscriptionsPageFields:function(){return NO},alpha:function(){return mO},fieldAppearance:function(){return BO},tabAppearance:function(){return jO}});var C=function(){function e(){P(this,e)}return w(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 U(){return U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},U.apply(this,arguments)}function R(e,t,n,o,i,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(o,i)}function D(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function r(e){R(a,o,i,r,l,"next",e)}function l(e){R(a,o,i,r,l,"throw",e)}r(void 0)}))}}C._apps={};var N=n(841),M=n.n(N);function F(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];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 G(e){return!!e&&!!e[Ee]}function $(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)===Ie}(e)||Array.isArray(e)||!!e[ke]||!!e.constructor[ke]||K(e)||H(e))}function V(e,t,n){void 0===n&&(n=!1),0===x(e)?(n?Object.keys:Pe)(e).forEach((function(o){n&&"symbol"==typeof o||t(o,e[o],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function x(e){var t=e[Ee];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:K(e)?2:H(e)?3:0}function B(e,t){return 2===x(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function j(e,t,n){var o=x(e);2===o?e.set(t,n):3===o?(e.delete(t),e.add(n)):e[t]=n}function W(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function K(e){return me&&e instanceof Map}function H(e){return Ae&&e instanceof Set}function z(e){return e.o||e.t}function q(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Le(e);delete t[Ee];for(var n=Pe(t),o=0;o<n.length;o++){var i=n[o],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function Y(e,t){return void 0===t&&(t=!1),Q(e)||G(e)||!$(e)||(x(e)>1&&(e.set=e.add=e.clear=e.delete=J),Object.freeze(e),t&&V(e,(function(e,t){return Y(t,!0)}),!0)),e}function J(){F(2)}function Q(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function X(e){var t=Oe[e];return t||F(18,e),t}function Z(){return ve}function ee(e,t){t&&(X("Patches"),e.u=[],e.s=[],e.v=t)}function te(e){ne(e),e.p.forEach(ie),e.p=null}function ne(e){e===ve&&(ve=e.l)}function oe(e){return ve={p:[],l:ve,h:e,m:!0,_:0}}function ie(e){var t=e[Ee];0===t.i||1===t.i?t.j():t.O=!0}function ae(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.g||X("ES5").S(t,e,o),o?(n[Ee].P&&(te(t),F(4)),$(e)&&(e=re(t,e),t.l||se(t,e)),t.u&&X("Patches").M(n[Ee].t,e,t.u,t.s)):e=re(t,n,[]),te(t),t.u&&t.v(t.u,t.s),e!==Te?e:void 0}function re(e,t,n){if(Q(t))return t;var o=t[Ee];if(!o)return V(t,(function(i,a){return le(e,o,t,i,a,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return se(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var i=4===o.i||5===o.i?o.o=q(o.k):o.o;V(3===o.i?new Set(i):i,(function(t,a){return le(e,o,i,t,a,n)})),se(e,i,!1),n&&e.u&&X("Patches").R(o,n,e.u,e.s)}return o.o}function le(e,t,n,o,i,a){if(G(i)){var r=re(e,i,a&&t&&3!==t.i&&!B(t.D,o)?a.concat(o):void 0);if(j(n,o,r),!G(r))return;e.m=!1}if($(i)&&!Q(i)){if(!e.h.F&&e._<1)return;re(e,i),t&&t.A.l||se(e,i)}}function se(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&Y(t,n)}function ce(e,t){var n=e[Ee];return(n?z(n):e)[t]}function ue(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Object.getPrototypeOf(n)}}function de(e){e.P||(e.P=!0,e.l&&de(e.l))}function ye(e){e.o||(e.o=q(e.t))}function fe(e,t,n){var o=K(t)?X("MapSet").N(t,n):H(t)?X("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),o={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},i=o,a=_e;n&&(i=[o],a=we);var r=Proxy.revocable(i,a),l=r.revoke,s=r.proxy;return o.k=s,o.j=l,s}(t,n):X("ES5").J(t,n);return(n?n.A:Z()).p.push(o),o}function pe(e){return G(e)||F(22,e),function e(t){if(!$(t))return t;var n,o=t[Ee],i=x(t);if(o){if(!o.P&&(o.i<4||!X("ES5").K(o)))return o.t;o.I=!0,n=ge(t,i),o.I=!1}else n=ge(t,i);return V(n,(function(t,i){o&&function(e,t){return 2===x(e)?e.get(t):e[t]}(o.t,t)===i||j(n,t,e(i))})),3===i?new Set(n):n}(e)}function ge(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return q(e)}var Se,ve,he="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),me="undefined"!=typeof Map,Ae="undefined"!=typeof Set,be="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Te=he?Symbol.for("immer-nothing"):((Se={})["immer-nothing"]=!0,Se),ke=he?Symbol.for("immer-draftable"):"__$immer_draftable",Ee=he?Symbol.for("immer-state"):"__$immer_state",Ie=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Pe="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Le=Object.getOwnPropertyDescriptors||function(e){var t={};return Pe(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Oe={},_e={get:function(e,t){if(t===Ee)return e;var n=z(e);if(!B(n,t))return function(e,t,n){var o,i=ue(t,n);return i?"value"in i?i.value:null===(o=i.get)||void 0===o?void 0:o.call(e.k):void 0}(e,n,t);var o=n[t];return e.I||!$(o)?o:o===ce(e.t,t)?(ye(e),e.o[t]=fe(e.A.h,o,e)):o},has:function(e,t){return t in z(e)},ownKeys:function(e){return Reflect.ownKeys(z(e))},set:function(e,t,n){var o=ue(z(e),t);if(null==o?void 0:o.set)return o.set.call(e.k,n),!0;if(!e.P){var i=ce(z(e),t),a=null==i?void 0:i[Ee];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(W(n,i)&&(void 0!==n||B(e.t,t)))return!0;ye(e),de(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!==ce(e.t,t)||t in e.t?(e.D[t]=!1,ye(e),de(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=z(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty:function(){F(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){F(12)}},we={};V(_e,(function(e,t){we[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),we.deleteProperty=function(e,t){return we.set.call(this,e,t,void 0)},we.set=function(e,t,n){return _e.set.call(this,e[0],t,n,e[0])};var Ce=function(){function e(e){var t=this;this.g=be,this.F=!0,this.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=i);for(var o=arguments.length,r=Array(o>1?o-1:0),l=1;l<o;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var o;return(o=n).call.apply(o,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&F(6),void 0!==o&&"function"!=typeof o&&F(7),$(e)){var l=oe(t),s=fe(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?te(l):ne(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return ee(l,o),ae(e,l)}),(function(e){throw te(l),e})):(ee(l,o),ae(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===Te&&(r=void 0),t.F&&Y(r,!0),o){var u=[],d=[];X("Patches").M(e,r,u,d),o(u,d)}return r}F(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))};var o,i,a=t.produce(e,n,(function(e,t){o=e,i=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,o,i]})):[a,o,i]},"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){$(e)||F(8),G(e)&&(e=pe(e));var t=oe(this),n=fe(this,e,void 0);return n[Ee].C=!0,ne(t),n},t.finishDraft=function(e,t){var n=(e&&e[Ee]).A;return ee(n,t),ae(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!be&&F(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));var i=X("Patches").$;return G(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Ue=new Ce,Re=Ue.produce,De=(Ue.produceWithPatches.bind(Ue),Ue.setAutoFreeze.bind(Ue),Ue.setUseProxies.bind(Ue),Ue.applyPatches.bind(Ue),Ue.createDraft.bind(Ue),Ue.finishDraft.bind(Ue),Re);function Ne(e,t,n){return(t=O(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(n),!0).forEach((function(t){Ne(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ge(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 $e="function"==typeof Symbol&&Symbol.observable||"@@observable",Ve=function(){return Math.random().toString(36).substring(7).split("").join(".")},xe={INIT:"@@redux/INIT"+Ve(),REPLACE:"@@redux/REPLACE"+Ve(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ve()}};function Be(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 je(e,t,n){var o;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ge(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ge(1));return n(je)(e,t)}if("function"!=typeof e)throw new Error(Ge(2));var i=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(Ge(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ge(4));if(s)throw new Error(Ge(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(Ge(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Be(e))throw new Error(Ge(7));if(void 0===e.type)throw new Error(Ge(8));if(s)throw new Error(Ge(9));try{s=!0,a=i(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(Ge(10));i=e,y({type:xe.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ge(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[$e]=function(){return this},e}return y({type:xe.INIT}),(o={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[$e]=p,o}function We(e){for(var t=Object.keys(e),n={},o=0;o<t.length;o++){var i=t[o];"function"==typeof e[i]&&(n[i]=e[i])}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:xe.INIT}))throw new Error(Ge(12));if(void 0===n(void 0,{type:xe.PROBE_UNKNOWN_ACTION()}))throw new Error(Ge(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var o=!1,i={},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(Ge(14));i[s]=d,o=o||d!==u}return(o=o||r.length!==Object.keys(e).length)?i:e}}function Ke(){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 He(){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),o=function(){throw new Error(Ge(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return o=Ke.apply(void 0,a)(n.dispatch),Fe(Fe({},n),{},{dispatch:o})}}}function ze(e){return function(t){var n=t.dispatch,o=t.getState;return function(t){return function(i){return"function"==typeof i?i(n,o,e):t(i)}}}}var qe=ze();qe.withExtraArgument=ze;var Ye,Je=qe,Qe=(Ye=function(e,t){return Ye=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])},Ye(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}Ye(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Xe=function(e,t){for(var n=0,o=t.length,i=e.length;n<o;n++,i++)e[i]=t[n];return e},Ze=Object.defineProperty,et=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),tt=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable,ot=function(e,t,n){return t in e?Ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},it=function(e,t){for(var n in t||(t={}))tt.call(t,n)&&ot(e,n,t[n]);if(et)for(var o=0,i=et(t);o<i.length;o++)n=i[o],nt.call(t,n)&&ot(e,n,t[n]);return e},at="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Ke:Ke.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var rt=function(e){function t(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=e.apply(this,n)||this;return Object.setPrototypeOf(i,t.prototype),i}return Qe(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,Xe([void 0],e[0].concat(this)))):new(t.bind.apply(t,Xe([void 0],e.concat(this))))},t}(Array);function lt(e){return $(e)?De(e,(function(){})):e}function st(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,o=(e.immutableCheck,e.serializableCheck,new rt);return n&&(function(e){return"boolean"==typeof e}(n)?o.push(Je):o.push(Je.withExtraArgument(n.extraArgument))),o}function ct(e){var t,n=function(e){return st(e)},o=e||{},i=o.reducer,a=void 0===i?void 0:i,r=o.middleware,l=void 0===r?n():r,s=o.devTools,c=void 0===s||s,u=o.preloadedState,d=void 0===u?void 0:u,y=o.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=We(a)}var p=l;"function"==typeof p&&(p=p(n));var g=He.apply(void 0,p),S=Ke;c&&(S=at(it({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=Xe([g],f):"function"==typeof f&&(v=f(v)),je(t,d,S.apply(void 0,v))}function ut(e,t){function n(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(t){var i=t.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return it(it({type:e,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.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 dt(e){var t,n={},o=[],i={addCase:function(e,t){var o="string"==typeof e?e:e.type;if(o in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[o]=t,i},addMatcher:function(e,t){return o.push({matcher:e,reducer:t}),i},addDefaultCase:function(e){return t=e,i}};return e(i),[n,o,t]}function yt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,o="function"==typeof e.initialState?e.initialState:lt(e.initialState),i=e.reducers||{},a=Object.keys(i),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?dt(e.extraReducers):[e.extraReducers],n=t[0],i=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=it(it({},i),l);return function(e,t,n,o){void 0===n&&(n=[]);var i,a="function"==typeof t?dt(t):[t,n,o],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))i=function(){return lt(e())};else{var c=lt(e);i=function(){return c}}function u(e,t){void 0===e&&(e=i());var n=Xe([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 o;if(G(e))return void 0===(o=n(e,t))?e:o;if($(e))return De(e,(function(e){return n(e,t)}));if(void 0===(o=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return o}return e}),e)}return u.getInitialState=i,u}(o,u,r,c)}return a.forEach((function(e){var n,o,a=i[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,o=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=o?ut(c,o):ut(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 ft="listenerMiddleware";ut(ft+"/add"),ut(ft+"/removeAll"),ut(ft+"/remove"),function(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Ee];return _e.get(t,e)},set:function(t){var n=this[Ee];_e.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][Ee];if(!i.P)switch(i.i){case 5:o(i)&&de(i);break;case 4:n(i)&&de(i)}}}function n(e){for(var t=e.t,n=e.k,o=Pe(n),i=o.length-1;i>=0;i--){var a=o[i];if(a!==Ee){var r=t[a];if(void 0===r&&!B(t,a))return!0;var l=n[a],s=l&&l[Ee];if(s?s.t!==r:!W(l,r))return!0}}var c=!!t[Ee];return o.length!==Pe(t).length+(c?0:1)}function o(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 o=0;o<t.length;o++)if(!t.hasOwnProperty(o))return!0;return!1}var i={};!function(e,t){Oe[e]||(Oe[e]=t)}("ES5",{J:function(t,n){var o=Array.isArray(t),i=function(t,n){if(t){for(var o=Array(n.length),i=0;i<n.length;i++)Object.defineProperty(o,""+i,e(i,!0));return o}var a=Le(n);delete a[Ee];for(var r=Pe(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)}(o,t),a={i:o?5:4,A:n?n.A:Z(),P:!1,I:!1,D:{},l:n,t:t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,Ee,{value:a,writable:!0}),i},S:function(e,n,i){i?G(n)&&n[Ee].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Ee];if(n){var i=n.t,a=n.k,r=n.D,l=n.i;if(4===l)V(a,(function(t){t!==Ee&&(void 0!==i[t]||B(i,t)?r[t]||e(a[t]):(r[t]=!0,de(n)))})),V(i,(function(e){void 0!==a[e]||B(a,e)||(r[e]=!1,de(n))}));else if(5===l){if(o(n)&&(de(n),r.length=!0),a.length<i.length)for(var s=a.length;s<i.length;s++)r[s]=!1;else for(var c=i.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,i.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):o(e)}})}();const pt=(e,t)=>n=>U({},n,{[e]:t[e]}),gt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),St=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:o})=>{var i;return U({},n,{[e]:U({},n[e],{[t]:U({},null==n||null==(i=n[e])?void 0:i[t],o)})})}}),vt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o,i;return U({},t,{[e]:U({},t[e],{loaders:U({},null==(o=t[e])?void 0:o.loaders,{[n.key]:null==(i=n.value)||i})})})}}),ht=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o;return U({},t,{[e]:U({},t[e],{errors:U({},t[e].errors,{[n.key]:null==(o=n.value)||o})})})}}),mt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(o,{payload:i})=>{var a;return U({},o,{[e]:U({},o[e],{[t]:U({},null==o||null==(a=o[e])?void 0:a[t],i,n)})})}}),At=(e,t,n)=>o=>{var i;return U({},o,{[e]:U({},o[e],{[t]:U({},null==o||null==(i=o[e])?void 0:i[t],n)})})},bt=(e=500)=>new Promise((t=>setTimeout(t,e))),Tt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",kt=new Uint8Array(256);for(let e=0;e<Tt.length;e++)kt[Tt.charCodeAt(e)]=e;const Et=e=>{const t=.75*e.length,n=e.length;let o,i,a,r,l,s=0;const c=new Uint8Array(t);for(o=0;o<n;o+=4)i=kt[e.charCodeAt(o)],a=kt[e.charCodeAt(o+1)],r=kt[e.charCodeAt(o+2)],l=kt[e.charCodeAt(o+3)],c[s++]=i<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},It=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(It(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let o,i="";for(o=0;o<n;o+=3)i+=Tt[t[o]>>2],i+=Tt[(3&t[o])<<4|t[o+1]>>4],i+=Tt[(15&t[o+1])<<2|t[o+2]>>6],i+=Tt[63&t[o+2]];return n%3==2?i=i.substring(0,i.length-1):n%3==1&&(i=i.substring(0,i.length-2)),i})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=It(e[n]);return t}return e};let Pt,Lt,Ot;!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",e.promptPasskeys="promptPasskeys",e.breachedPassword="breachedPassword",e.breachedPasswordSuccess="breachedPasswordSuccess"}(Pt||(Pt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Lt||(Lt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Ot||(Ot={}));const _t="FRONTEGG_AFTER_AUTH_REDIRECT_URL",wt="HOSTED_LOGIN_VERIFIER_KEY",Ct="auth",Ut="connectivity",Rt="auditLogs",Dt="vendor",Nt={flow:Lt.Login,step:Pt.preLogin,loading:!1,email:"",tenants:[]},Mt={setLoginState:gt("loginState"),resetLoginState:pt("loginState",{loginState:Nt})},Ft={requestAuthorize:ut("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:ut("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:ut("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),requestHostedLoginAuthorizeV2:ut("auth/requestHostedLoginAuthorizeV2",(e=>({payload:e}))),handleHostedLoginCallback:ut("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:ut("auth/afterAuthNavigation"),preLogin:ut("auth/preLogin",(e=>({payload:e}))),postLogin:ut("auth/postLogin",(e=>({payload:e}))),login:ut("auth/login",(e=>({payload:e}))),loginWithMfa:ut("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:ut("auth/recoverMfa",(e=>({payload:e}))),logout:ut("auth/logout",(e=>({payload:e}))),silentLogout:ut("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:ut("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:ut("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:ut("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:ut("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:ut("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:ut("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:ut("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:ut("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:ut("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:ut("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:ut("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:ut("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:ut("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:ut("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:ut("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:ut("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:ut("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:ut("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:ut("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:ut("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:ut("auth/verifyMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAEmailCode:ut("auth/preVerifyMFAEmailCode",(e=>({payload:e}))),verifyMFAEmailCode:ut("auth/verifyMFAEmailCode",(e=>({payload:e}))),resetBreachedPassword:ut("auth/resetBreachedPassword",(e=>({payload:e})))};let Gt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Gt||(Gt={}));const $t={step:Gt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Vt={setActivateState:gt("activateState"),resetActivateState:pt("activateState",{activateState:$t}),setActivateStrategyState:St("activateState","activationStrategy")},xt={activateAccount:ut("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:ut("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:ut("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:ut("auth/resendActivationEmail",(e=>({payload:e})))};let Bt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Bt||(Bt={}));const jt={step:Bt.validate},Wt={setAcceptInvitationState:gt("acceptInvitationState"),resetAcceptInvitationState:pt("acceptInvitationState",{acceptInvitationState:jt})},Kt={acceptInvitation:ut("auth/acceptInvitation",(e=>({payload:e})))};let Ht;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Ht||(Ht={}));const zt={step:Ht.forgotPassword,loading:!1,email:"",passwordConfig:null},qt={setForgotPasswordState:gt("forgotPasswordState"),resetForgotPasswordState:pt("forgotPasswordState",{forgotPasswordState:zt})},Yt={forgotPassword:ut("auth/forgotPassword",(e=>({payload:e}))),resetPassword:ut("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:ut("auth/loadPasswordConfig",(e=>({payload:e})))};let Jt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Jt||(Jt={}));const Qt={step:Jt.ResetPhoneNumber,loading:!1},Xt={setResetPhoneNumberState:gt("resetPhoneNumberState"),resetResetPhoneNumberState:pt("resetPhoneNumberState",{resetPhoneNumberState:Qt})},Zt={resetPhoneNumber:ut("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:ut("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:ut("auth/changePhoneNumber",(e=>({payload:e})))},en={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},tn={setSSOLoader:vt("ssoState"),setSSOError:ht("ssoState"),setSSOState:gt("ssoState"),resetSSOState:pt("ssoState",{ssoState:en})},nn={loadSSOConfigurationsV2:ut("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:ut("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:ut("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:ut("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:ut("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:ut("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:ut("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:ut("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:ut("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:ut("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:ut("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:ut("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:ut("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:ut("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:ut("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:ut("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:ut("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:ut("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:ut("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:ut("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:ut("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:ut("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:ut("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:ut("auth/oidcPostlogin",(e=>({payload:e})))},on={loading:!1,error:null},an={setProfileState:gt("profileState"),resetProfileState:pt("profileState",{profileState:on})},rn={loadProfile:ut("auth/loadProfile"),saveProfile:ut("auth/saveProfile",(e=>({payload:e}))),changePassword:ut("auth/changePassword",(e=>({payload:e})))};let ln;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode"}(ln||(ln={}));const sn={step:ln.verify,loading:!1,saving:!1},cn={setMfaState:gt("mfaState"),resetMfaState:pt("mfaState",{mfaState:sn})},un={enrollMfa:ut("auth/enrollMfa"),getMFADevices:ut("auth/getMFADevices"),getMFAStrategies:ut("auth/getMFAStrategies"),verifyMfa:ut("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:ut("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:ut("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:ut("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:ut("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:ut("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:ut("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:ut("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:ut("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:ut("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:ut("auth/disableMfaWebAuthn",(e=>({payload:e})))},dn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,shouldShowSubTenantUsersIfReseller:!1,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}},yn={setTeamLoader:vt("teamState"),setTeamError:ht("teamState"),setTeamState:gt("teamState"),resetTeamState:pt("teamState",{teamState:dn})},fn={loadUsersV2:ut("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:ut("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:ut("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:ut("auth/loadRoles",(e=>({payload:e}))),addUser:ut("auth/addUser",(e=>({payload:e}))),addUsersBulk:ut("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:ut("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:ut("auth/updateUser",(e=>({payload:e}))),deleteUser:ut("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:ut("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:ut("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:ut("auth/lockUser",(e=>({payload:e}))),resendActivationLink:ut("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:ut("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:ut("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:ut("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:ut("auth/getInvitationLink"),createInvitationLink:ut("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:ut("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:ut("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:ut("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:ut("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:ut("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:ut("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:ut("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:ut("auth/closeLockUserDialog",(e=>({payload:e})))},pn={firstLoad:!0,loading:!1,error:""},gn={setSocialLoginsState:gt("socialLoginState"),resetSocialLoginsState:pt("socialLoginState",{socialLoginState:pn})},Sn={loadSocialLoginsConfiguration:ut("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:ut("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:ut("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:ut("auth/setSocialLoginError",(e=>({payload:e})))};let vn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(vn||(vn={}));const hn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:vn.SignUp},mn={setSignUpState:gt("signUpState"),resetSignUpState:pt("signUpState",{signUpState:hn})},An={signUpUser:ut("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:ut("auth/resetSignUpStateSoft")},bn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},Tn={setApiTokensLoader:vt("apiTokensState"),setApiTokensError:ht("apiTokensState"),setApiTokensState:gt("apiTokensState"),resetApiTokensState:pt("apiTokensState",{apiTokensState:bn})},kn={loadApiTokens:ut("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:ut("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:ut("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:ut("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:ut("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:ut("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:ut("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:ut("auth/deleteTenantApiToken",(e=>({payload:e})))},En={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},In={setSecurityPolicyState:gt("securityPolicyState"),setSecurityPolicyGlobalState:St("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:St("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:St("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:St("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:St("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:St("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:St("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:St("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:St("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:St("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:St("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:pt("securityPolicyState",{securityPolicyState:En})},Pn={loadSecurityPolicy:ut("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:ut("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:ut("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:ut("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:ut("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:ut("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:ut("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:ut("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:ut("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:ut("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:ut("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:ut("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:ut("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:ut("auth/loadPublicAuthStrategiesPolicy")},Ln={loading:!1},On={setAccountSettingsState:gt("accountSettingsState"),resetAccountSettingsState:pt("accountSettingsState",{accountSettingsState:Ln})},_n={loadAccountSettings:ut("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:ut("auth/saveAccountSettings",(e=>({payload:e})))},wn={tenants:[],subTenants:[],loading:!0,tenantTree:null},Cn={setTenantsState:gt("tenantsState"),resetTenantsState:pt("tenantsState",{tenantsState:wn})},Un={switchTenant:ut("auth/switchTenant",(e=>({payload:e}))),loadTenants:ut("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:ut("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:ut("auth/loadSubTenantsTree",(e=>({payload:e})))},Rn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Dn={setRolesState:gt("rolesState"),resetRolesState:pt("rolesState",{rolesState:Rn})},Nn={loadRolesAndPermissions:ut("auth/loadRoles",(e=>({payload:e}))),addRole:ut("auth/addRole",(e=>({payload:e}))),updateRole:ut("auth/updateRole",(e=>({payload:e}))),deleteRole:ut("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:ut("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:ut("auth/attachPermissionToRoles",(e=>({payload:e})))},Mn={loading:!1,sessions:[]},Fn={setSessionsState:gt("sessionsState"),resetSessionsState:pt("sessionsState",{sessionsState:Mn})},Gn={loadUserSessions:ut("auth/loadUserSessions"),loadCurrentUserSession:ut("auth/loadCurrentUserSession"),deleteUserSession:ut("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:ut("auth/deleteAllUserSessions"),revokeUserSessions:ut("auth/revokeUserSessions",(e=>({payload:e})))},$n={loading:!1,configurations:{}},Vn={setSessionsPolicyState:gt("sessionsPolicyState"),resetSessionsPolicyState:pt("sessionsPolicyState",{sessionsPolicyState:$n})},xn={loadSessionsPolicy:ut("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:ut("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Bn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Bn||(Bn={}));const jn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Bn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Wn={setRestrictionsState:gt("restrictionsState"),setIpRestrictionsState:St("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:St("restrictionsState","emailDomainRestrictions")},Kn={checkIfUserIpValid:ut("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:ut("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:ut("auth/loadIpRestrictions"),saveIpRestriction:ut("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:ut("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:ut("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:ut("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:ut("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:ut("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:ut("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Hn={loading:!1},zn={setProvisioningState:gt("provisioningState"),resetProvisioningState:pt("provisioningState",{provisioningState:Hn})},qn={loadProvisionConnections:ut("auth/loadProvisionConnections"),createProvisionConnection:ut("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:ut("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:ut("auth/updateProvisionConnection",(e=>({payload:e})))},Yn={devices:[],loading:!1,error:null},Jn={setPasskeysState:gt("passkeysState"),resetPasskeysState:pt("passkeysState",{passkeysState:Yn})},Qn={loadWebAuthnDevices:ut("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:ut("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Xn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Zn={setUsersGroupsLoader:vt("groupsState"),setUsersGroupsError:ht("groupsState"),setGroupsState:gt("groupsState"),resetUsersGroupsState:pt("groupsState",{groupsState:Xn})},eo={loadGroups:ut("auth/loadUsersGroups"),getGroupById:ut("auth/getGroupById",(e=>({payload:e}))),createGroup:ut("auth/createGroup",(e=>({payload:e}))),updateGroup:ut("auth/updateGroup",(e=>({payload:e}))),deleteGroup:ut("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:ut("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:ut("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:ut("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:ut("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:ut("auth/getGroupConfiguration"),updateGroupConfiguration:ut("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:ut("auth/getUsers",(e=>({payload:e})))},to={addGroupDialogState:{loading:!1,open:!1},editGroupDialogState:{loading:!1,open:!1},deleteGroupDialogState:{loading:!1,open:!1},addMembersToGroupDialogState:{loading:!1,open:!1,userIds:[]},deleteMemberFromGroupDialogState:{loading:!1,open:!1}},no={setGroupsDialogsState:gt("groupsDialogsState"),resetGroupsDialogsState:pt("groupsState",{groupsDialogsState:to}),openAddGroupDialog:At("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:At("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:mt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:At("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:mt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:At("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:At("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:At("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:mt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:At("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},oo={loading:!0,error:null},io={setCustomLoginState:gt("customLoginState"),resetCustomLoginState:pt("customLoginState",{customLoginState:oo})},ao={loadTenantMetadata:ut("auth/loadTenantMetadata"),updateTenantMetadata:ut("auth/updateTenantMetadata",(e=>({payload:e})))},ro={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let lo,so,co,uo,yo;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(lo||(lo={})),function(e){e.Nextjs="nextjs",e.React="react",e.Angular="angular",e.Vuejs="vuejs",e.Flutter="flutter",e.Ios="ios",e.Android="android",e.Vanillajs="vanillajs"}(so||(so={})),function(e){e.ASC="ASC",e.DESC="DESC"}(co||(co={})),function(e){e.createdAt="createdAt",e.name="name",e.email="email",e.id="id",e.verified="verified",e.isLocked="isLocked",e.provider="provider",e.tenantId="tenantId"}(uo||(uo={})),function(e){e.MFA_UNENROLLED="mfa-unenrolled",e.BREACHED_PASSWORDS="breached-passwords",e.INACTIVE="inactive"}(yo||(yo={}));const fo=["local","saml","google","github","facebook","microsoft","scim2","slack"],po={loaders:{},errors:{},accounts:{tenantId:"",children:[]},accountsQueryParams:{_limit:50,_offset:0,_filter:"",_subTenantId:""},searchAccountsData:[],rootAccount:{tenantId:""},selectedAccount:{tenantId:"",userJwt:{accessToken:"",expiresIn:0,expires:""},users:[],usersQueryParams:{_offset:0,_limit:10,_order:co.DESC,_sortBy:uo.name},usersPageOffset:0,accountSettings:{}}},go={setAllAccountsLoader:vt("allAccountsState"),setAllAccountsError:ht("allAccountsState"),setAllAccountsState:gt("allAccountsState"),setSelectedAccountState:St("allAccountsState","selectedAccount"),resetAllAccountsState:pt("allAccountsState",{allAccountsState:po})},So={loadAccounts:ut("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:ut("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:ut("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:ut("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:ut("auth/updateAccount",(e=>({payload:e}))),deleteSubAccount:ut("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:ut("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:ut("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:ut("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:ut("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:ut("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:ut("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setRootAccountData:ut("auth/setRootAccountData"),setSelectedSubAccountData:ut("auth/setSelectedSubAccountData",(e=>({payload:e}))),loadNumberOfUsersForSelectedSubAccount:ut("auth/loadNumberOfUsersForSelectedSubAccount",(e=>({payload:e})))},vo={createSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:"",canSelectParentAccount:!1},updateSubAccountDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1,jwt:""},deleteSubAccountDialog:{accountId:"",accountName:"",isParentAccount:!1,loading:!1,open:!1,error:!1,jwt:""},addUsersToAccountDialog:{loading:!1,open:!1,accountName:"",accountId:"",permissionToGiveAccessToSubAccounts:!1,jwt:""},deleteUserFromAccountDialog:{userId:"",userName:"",accountId:"",loading:!1,open:!1,jwt:""},editUserRolesDialog:{loading:!1,open:!1,jwt:"",accountId:"",userId:"",userName:"",userRoles:[]}},ho={setAllAccountDialogsState:gt("allAccountsDialogsState"),resetAllAccountDialogsState:pt("allAccountsDialogsState",{allAccountsDialogsState:vo}),openCreateSubAccountDialog:mt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:At("allAccountsDialogsState","createSubAccountDialog",vo.createSubAccountDialog),openUpdateSubAccountDialog:mt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:At("allAccountsDialogsState","updateSubAccountDialog",vo.updateSubAccountDialog),openDeleteSubAccountDialog:mt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:At("allAccountsDialogsState","deleteSubAccountDialog",vo.deleteSubAccountDialog),openAddUsersToAccountDialog:mt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:At("allAccountsDialogsState","addUsersToAccountDialog",vo.addUsersToAccountDialog),openDeleteUserFromAccountDialog:mt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:At("allAccountsDialogsState","deleteUserFromAccountDialog",vo.deleteUserFromAccountDialog),openEditUserRolesDialog:mt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:At("allAccountsDialogsState","editUserRolesDialog",vo.editUserRolesDialog)},mo={loaders:{},errors:{},recommendations:void 0,insights:void 0,score:0,breachedPasswordUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},unenrolledMfaUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},inactiveUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10,_maxInactiveSeconds:7776e3}}},Ao={setSecurityCenterState:gt("securityCenterState"),resetSecurityCenterState:pt("securityCenterState",{securityCenterState:mo}),setSecurityCenterStateLoader:vt("securityCenterState"),setSecurityCenterStateError:ht("securityCenterState")},bo={loadRecommendations:ut("auth/loadRecommendations"),loadInsights:ut("auth/loadInsights"),sendResetBreachedPasswordEmail:ut("auth/sendResetBreachedPasswordEmail",(e=>({payload:e}))),sendBulkResetBreachedPasswordEmails:ut("auth/sendBulkResetBreachedPasswordEmails",(e=>({payload:e}))),loadBreachedPasswordUsers:ut("auth/loadBreachedPasswordUsers",(e=>({payload:e}))),loadUnenrolledMfaUsers:ut("auth/loadUnenrolledMfaUsers",(e=>({payload:e}))),loadInactiveUsers:ut("auth/loadInactiveUsers",(e=>({payload:e})))};let To,ko,Eo;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(To||(To={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(ko||(ko={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Eo||(Eo={}));const Io={[ko.Code]:Pt.loginWithOtc,[ko.EmailAndPassword]:Pt.loginWithPassword,[ko.MagicLink]:Pt.magicLinkPreLoginSuccess,[ko.SmsCode]:Pt.loginWithSmsOtc},Po={loading:!1,error:null,phoneNumbers:void 0},Lo={setSmsState:gt("smsState"),resetSmsState:pt("smsState",{smsState:Po})},Oo={loadPhoneNumbers:ut("auth/loadPhoneNumbers"),setUpPhoneNumber:ut("auth/setUpPhoneNumber",(e=>({payload:e}))),verifyPhoneNumber:ut("auth/verifyPhoneNumber",(e=>({payload:e}))),deletePhoneNumber:ut("auth/deletePhoneNumber",(e=>({payload:e}))),verifyDeletePhoneNumber:ut("auth/verifyDeletePhoneNumber",(e=>({payload:e}))),preVerifyPhoneNumber:ut("auth/preVerifyPhoneNumber",(e=>({payload:e})))},_o={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:hn,loginState:Nt,activateState:$t,acceptInvitationState:jt,forgotPasswordState:zt,ssoState:en,profileState:on,customLoginState:oo,mfaState:sn,teamState:dn,groupsState:Xn,groupsDialogsState:to,socialLoginState:pn,apiTokensState:bn,securityPolicyState:En,accountSettingsState:Ln,tenantsState:wn,rolesState:Rn,resetPhoneNumberState:Qt,sessionsState:Mn,sessionsPolicyState:$n,restrictionsState:jn,provisioningState:Hn,passkeysState:Yn,allAccountsState:po,allAccountsDialogsState:vo,securityCenterState:mo,smsState:Po},wo=U({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",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:()=>{}},_o);let Co;!function(e){e.impersonating="impersonating",e.success="success"}(Co||(Co={}));const Uo={step:Co.impersonating,loading:!1},Ro={setImpersonateState:gt("impersonateState"),resetImpersonateState:pt("impersonateState",{impersonateState:Uo})},Do={impersonate:ut("impersonation/impersonate",(e=>({payload:e})))},{reducer:No,actions:Mo}=yt({name:Ct,initialState:wo,reducers:U({resetState:e=>U({},e,_o),setState:(e,{payload:t})=>U({},e,t),setUser:("user",(e,{payload:t})=>U({},e,{user:t})),setEntitlements:St("user","entitlements")},Mt,gn,Vt,Ro,Wt,qt,Xt,mn,an,io,tn,cn,yn,Zn,no,Tn,In,On,Cn,Dn,Fn,Vn,Wn,zn,Jn,go,ho,Ao,Lo)});const Fo=U({loadEntitlements:ut("auth/loadEntitlements",(e=>({payload:e})))},Mo,Ft,Sn,xt,Kt,Yt,Zt,An,rn,ao,nn,un,fn,eo,{},kn,Pn,_n,Un,Nn,Gn,xn,Kn,qn,Do,Qn,So,bo,Oo);var Go=function(e){return"@@redux-saga/"+e},$o=Go("CANCEL_PROMISE"),Vo=Go("CHANNEL_END"),xo=Go("IO"),Bo=Go("MATCH"),jo=Go("MULTICAST"),Wo=Go("SAGA_ACTION"),Ko=Go("SELF_CANCELLATION"),Ho=Go("TASK"),zo=Go("TASK_CANCEL"),qo=Go("TERMINATE"),Yo=Go("LOCATION");function Jo(e,t){if(null==e)return{};var n,o,i={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(i[n]=e[n]);return i}var Qo=function(e){return null==e},Xo=function(e){return null!=e},Zo=function(e){return"function"==typeof e},ei=function(e){return"string"==typeof e},ti=Array.isArray,ni=function(e){return e&&Zo(e.then)},oi=function(e){return e&&Zo(e.next)&&Zo(e.throw)},ii=function e(t){return t&&(ei(t)||li(t)||Zo(t)||ti(t)&&t.every(e))},ai=function(e){return e&&Zo(e.take)&&Zo(e.close)},ri=function(e){return Zo(e)&&e.hasOwnProperty("toString")},li=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},si=function(e,t){var n;void 0===t&&(t=!0);var o=new Promise((function(o){n=setTimeout(o,Math.min(2147483647,e),t)}));return o[$o]=function(){clearTimeout(n)},o},ci=function(e){return function(){return e}},ui=ci(!0),di=function(){},yi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var fi=function(e,t){U(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function pi(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var gi=function(e){throw e},Si=function(e){return{value:e,done:!0}};function vi(e,t,n){void 0===t&&(t=gi),void 0===n&&(n="iterator");var o={meta:{name:n},next:e,throw:t,return:Si,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function hi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var mi=function(e){return Array.apply(null,new Array(e))},Ai=function(e){return function(t){return e(Object.defineProperty(t,Wo,{value:!0}))}},bi=function(e){return e===qo},Ti=function(e){return e===zo},ki=function(e){return bi(e)||Ti(e)};function Ei(e,t){var n,o=Object.keys(e),i=o.length,a=0,r=ti(e)?mi(i):{},l={};return o.forEach((function(e){var o=function(o,l){n||(l||ki(o)?(t.cancel(),t(o,l)):(r[e]=o,++a===i&&(n=!0,t(r))))};o.cancel=di,l[e]=o})),t.cancel=function(){n||(n=!0,o.forEach((function(e){return l[e].cancel()})))},l}function Ii(e){return{name:e.name||"anonymous",location:Pi(e)}}function Pi(e){return e[Yo]}var Li=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),o=0,i=0,a=0,r=function(t){n[i]=t,i=(i+1)%e,o++},l=function(){if(0!=o){var t=n[a];return n[a]=null,o--,a=(a+1)%e,t}},s=function(){for(var e=[];o;)e.push(l());return e};return{isEmpty:function(){return 0==o},put:function(l){var c;if(o<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[i]=l,a=i=(i+1)%e;break;case 4:c=2*e,n=s(),o=n.length,i=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},Oi="TAKE",_i="CALL",wi="FORK",Ci="SELECT",Ui=function(e,t){var n;return(n={})[xo]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Ri(e,t){return void 0===e&&(e="*"),ii(e)?(Xo(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Ui(Oi,{pattern:e})):ai(n=e)&&n[jo]&&Xo(t)&&ii(t)?Ui(Oi,{channel:e,pattern:t}):ai(e)?(Xo(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Ui(Oi,{channel:e})):void 0;var n}function Di(e,t){return Qo(t)&&(t=e,e=void 0),Ui("PUT",{channel:e,action:t})}function Ni(e){var t=Ui("ALL",e);return t.combinator=!0,t}function Mi(e,t){var n,o=null;return Zo(e)?n=e:(ti(e)?(o=e[0],n=e[1]):(o=e.context,n=e.fn),o&&ei(n)&&Zo(o[n])&&(n=o[n])),{context:o,fn:n,args:t}}function Fi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return Ui(_i,Mi(e,n))}function Gi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return Ui(wi,Mi(e,n))}function $i(e){return void 0===e&&(e=Ko),Ui("CANCEL",e)}function Vi(e){void 0===e&&(e=yi);for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return Ui(Ci,{selector:e,args:n})}var xi=Fi.bind(null,si);var Bi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},ji=[],Wi=0;function Ki(e){try{qi(),e()}finally{Yi()}}function Hi(e){ji.push(e),Wi||(qi(),Ji())}function zi(e){try{return qi(),e()}finally{Ji()}}function qi(){Wi++}function Yi(){Wi--}function Ji(){var e;for(Yi();!Wi&&void 0!==(e=ji.shift());)Ki(e)}var Qi=function(e){return function(t){return e.some((function(e){return na(e)(t)}))}},Xi=function(e){return function(t){return e(t)}},Zi=function(e){return function(t){return t.type===String(e)}},ea=function(e){return function(t){return t.type===e}},ta=function(){return ui};function na(e){var t="*"===e?ta:ei(e)?Zi:ti(e)?Qi:ri(e)?Zi:Zo(e)?Xi:li(e)?ea:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var oa={type:Vo},ia=function(e){return e&&e.type===Vo};function aa(){var e,t,n,o,i,a,r=(t=!1,o=n=[],i=function(){o===n&&(o=n.slice())},a=function(){t=!0;var e=n=o;o=[],e.forEach((function(e){e(oa)}))},(e={})[jo]=!0,e.put=function(e){if(!t)if(ia(e))a();else for(var i=n=o,r=0,l=i.length;r<l;r++){var s=i[r];s[Bo](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=ta),t?e(oa):(e[Bo]=n,i(),o.push(e),e.cancel=(a=!1,function(){a||(a=!0,i(),pi(o,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[Wo]?l(e):Hi((function(){l(e)}))},r}function ra(e,t){var n=e[$o];Zo(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var la,sa=0,ca=function(){return++sa};function ua(e){e.isRunning()&&e.cancel()}var da=((la={}).TAKE=function(e,t,n){var o=t.channel,i=void 0===o?e.channel:o,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!ia(e)||r?n(e):n(qo)};try{i.take(l,Xo(a)?na(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},la.PUT=function(e,t,n){var o=t.channel,i=t.action,a=t.resolve;Hi((function(){var t;try{t=(o?o.put:e.dispatch)(i)}catch(e){return void n(e,!0)}a&&ni(t)?ra(t,n):n(t)}))},la.ALL=function(e,t,n,o){var i=o.digestEffect,a=sa,r=Object.keys(t);if(0!==r.length){var l=Ei(t,n);r.forEach((function(e){i(t[e],a,l[e],e)}))}else n(ti(t)?[]:{})},la.RACE=function(e,t,n,o){var i=o.digestEffect,a=sa,r=Object.keys(t),l=ti(t)?mi(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,o){c||(o||ki(t)?(n.cancel(),n(t,o)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=di,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||i(t[e],a,s[e],e)}))},la.CALL=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=o.task;try{var s=a.apply(i,r);if(ni(s))return void ra(s,n);if(oi(s))return void ba(e,s,l.context,sa,Ii(a),!1,n);n(s)}catch(e){n(e,!0)}},la.CPS=function(e,t,n){var o=t.context,i=t.fn,a=t.args;try{var r=function(e,t){Qo(e)?n(t):n(e,!0)};i.apply(o,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},la.FORK=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=t.detached,s=o.task,c=function(e){var t=e.context,n=e.fn,o=e.args;try{var i=n.apply(t,o);if(oi(i))return i;var a=!1;return vi((function(e){return a?{value:e,done:!0}:(a=!0,{value:i,done:!ni(i)})}))}catch(e){return vi((function(){throw e}))}}({context:i,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Ii(t)}(c,a);zi((function(){var t=ba(e,c,s.context,sa,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},la.JOIN=function(e,t,n,o){var i=o.task,a=function(e,t){if(e.isRunning()){var n={task:i,cb:t};t.cancel=function(){e.isRunning()&&pi(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(ti(t)){if(0===t.length)return void n([]);var r=Ei(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},la.CANCEL=function(e,t,n,o){var i=o.task;t===Ko?ua(i):ti(t)?t.forEach(ua):ua(t),n()},la.SELECT=function(e,t,n){var o=t.selector,i=t.args;try{n(o.apply(void 0,[e.getState()].concat(i)))}catch(e){n(e,!0)}},la.ACTION_CHANNEL=function(e,t,n){var o=t.pattern,i=function(e){void 0===e&&(e=Li());var t=!1,n=[];return{take:function(o){t&&e.isEmpty()?o(oa):e.isEmpty()?(n.push(o),o.cancel=function(){pi(n,o)}):o(e.take())},put:function(o){if(!t){if(0===n.length)return e.put(o);n.shift()(o)}},flush:function(n){t&&e.isEmpty()?n(oa):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var o=0,i=e.length;o<i;o++)(0,e[o])(oa)}}}}(t.buffer),a=na(o),r=function t(n){ia(n)||e.channel.take(t,a),i.put(n)},l=i.close;i.close=function(){r.cancel(),l()},e.channel.take(r,a),n(i)},la.CANCELLED=function(e,t,n,o){n(o.task.isCancelled())},la.FLUSH=function(e,t,n){t.flush(n)},la.GET_CONTEXT=function(e,t,n,o){n(o.task.context[t])},la.SET_CONTEXT=function(e,t,n,o){var i=o.task;fi(i.context,t),n()},la);function ya(e,t){return e+"?"+t}function fa(e){var t=e.name,n=e.location;return n?t+" "+ya(n.fileName,n.lineNumber):t}function pa(e){var t,n,o,i=(t=function(e){return e.cancelledTasks},n=e,(o=[]).concat.apply(o,n.map(t)));return i.length?["Tasks cancelled due to error:"].concat(i).join("\n"):""}var ga=null,Sa=[],va=function(e){e.crashedEffect=ga,Sa.push(e)},ha=function(){ga=null,Sa.length=0},ma=function(){var e,t,n=Sa[0],o=Sa.slice(1),i=n.crashedEffect?(e=n.crashedEffect,(t=Pi(e))?t.code+" "+ya(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+fa(n.meta)+(i?" \n when executing effect "+i:"")].concat(o.map((function(e){return" created by "+fa(e.meta)})),[pa(Sa)]).join("\n")};function Aa(e,t,n,o,i,a,r){var l;void 0===r&&(r=di);var s,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var o,i=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){i.push(t),t.cont=function(l,s){a||(pi(i,t),t.cont=di,s?r(l):(t===e&&(o=l),i.length||(a=!0,n(o))))}}function s(){a||(a=!0,i.forEach((function(e){e.cont=di,e.cancel()})),i=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return i}}}(t,0,g);function g(t,n){if(n){if(u=2,va({meta:i,cancelledTasks:y}),S.isRoot){var o=ma();ha(),e.onError(t,{sagaStack:o})}c=t,d&&d.reject(t)}else t===zo?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={})[Ho]=!0,l.id=o,l.meta=i,l.isRoot=a,l.context=f,l.joiners=[],l.queue=p,l.cancel=function(){0===u&&(u=1,p.cancelAll(),g(zo,!1))},l.cont=r,l.end=g,l.setContext=function(e){fi(f,e)},l.toPromise=function(){return d||(d=Bi(),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 ba(e,t,n,o,i,a,r){var l=e.finalizeRunEffect((function(t,n,o){ni(t)?ra(t,o):oi(t)?ba(e,t,c.context,n,i,!1,o):t&&t[xo]?(0,da[t.type])(e,t.payload,o,u):o(t)}));d.cancel=di;var s={meta:i,cancel:function(){0===s.status&&(s.status=1,d(zo))},status:0},c=Aa(e,s,n,o,i,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var i;n?(i=t.throw(e),ha()):Ti(e)?(s.status=1,d.cancel(),i=Zo(t.return)?t.return(zo):{done:!0,value:zo}):i=bi(e)?Zo(t.return)?t.return():{done:!0}:t.next(e),i.done?(1!==s.status&&(s.status=3),s.cont(i.value)):y(i.value,o,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,o,i){void 0===i&&(i="");var a,r=ca();function s(n,i){a||(a=!0,o.cancel=di,e.sagaMonitor&&(i?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),i&&function(e){ga=e}(t),o(n,i))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:i,effect:t}),s.cancel=di,o.cancel=function(){a||(a=!0,s.cancel(),s.cancel=di,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function Ta(e,t){for(var n=e.channel,o=void 0===n?aa():n,i=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?hi:u,y=arguments.length,f=new Array(y>2?y-2:0),p=2;p<y;p++)f[p-2]=arguments[p];var g,S=t.apply(void 0,f),v=ca();if(s&&(s.rootSagaStarted=s.rootSagaStarted||di,s.effectTriggered=s.effectTriggered||di,s.effectResolved=s.effectResolved||di,s.effectRejected=s.effectRejected||di,s.effectCancelled=s.effectCancelled||di,s.actionDispatched=s.actionDispatched||di,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Ke.apply(void 0,c);g=function(e){return function(t,n,o){return h((function(t){return e(t,n,o)}))(t)}}}else g=yi;var m={channel:o,dispatch:Ai(i),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return zi((function(){var e=ba(m,S,l,v,Ii(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var ka=function(e){var t,n=void 0===e?{}:e,o=n.context,i=void 0===o?{}:o,a=n.channel,r=void 0===a?aa():a,l=n.sagaMonitor,s=Jo(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,o=e.dispatch;return t=Ta.bind(null,U({},s,{context:i,channel:r,dispatch:o,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){fi(i,e)},c},Ea=function(e){return{done:!0,value:e}},Ia={};function Pa(e){return ai(e)?"channel":ri(e)?String(e):Zo(e)?e.name:String(e)}function La(e,t,n){var o,i,a,r=t;function l(t,n){if(r===Ia)return Ea(t);if(n&&!i)throw r=Ia,n;o&&o(t);var l=n?e[i](n):e[r]();return r=l.nextState,a=l.effect,o=l.stateUpdater,i=l.errorState,r===Ia?Ea(t):a}return vi(l,(function(e){return l(null,e)}),n)}function Oa(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:Ri(e)},l=function(e){return{done:!1,value:Gi.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return La({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Pa(e)+", "+t.name+")")}function _a(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r,l={done:!1,value:Ri(e)},s=function(e){return{done:!1,value:Gi.apply(void 0,[t].concat(o,[e]))}},c=function(e){return{done:!1,value:$i(e)}},u=function(e){return a=e},d=function(e){return r=e};return La({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("+Pa(e)+", "+t.name+")")}function wa(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:Ri(e)},l=function(e){return{done:!1,value:Fi.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return La({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Pa(e)+", "+t.name+")")}function Ca(e,t,n){for(var o=e,i=arguments.length,a=new Array(i>3?i-3:0),r=3;r<i;r++)a[r-3]=arguments[r];var l={done:!1,value:Fi.apply(void 0,[n].concat(a))},s={done:!1,value:xi(t)};return La({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:Ia}},q10:function(e){if((o-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function Ua(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return Gi.apply(void 0,[Oa,e,t].concat(o))}function Ra(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return Gi.apply(void 0,[_a,e,t].concat(o))}function Da(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return Gi.apply(void 0,[wa,e,t].concat(o))}class Na{constructor(){this.context=null,this.accessToken=null,this.user=null,this.requestSource=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout",this.entitlementsOptions=null,this.appName=null}static getInstance(){return Na.instance||(Na.instance=new Na),Na.instance}static setContext(e){Na.getInstance().context=e}static setAccessToken(e){Na.getInstance().accessToken=e}static setUser(e){Na.getInstance().user=e}static setRequestSource(e){Na.getInstance().requestSource=e}static setOnRedirectTo(e){Na.getInstance().onRedirectTo=e}static setLogout(e,t){Na.getInstance().logout=n=>{n?e(n):Na.onRedirectTo(t)}}static setEntitlementsOptions(e){Na.getInstance().entitlementsOptions=e}static setAppName(e){Na.getInstance().appName=e}static getContext(){var e;return null!=(e=Na.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Na.getInstance().accessToken}static getRequestSource(){return Na.getInstance().requestSource}static getUser(){return Na.getInstance().user}static onRedirectTo(e,t){return Na.getInstance().onRedirectTo(e,t)}static logout(e){return Na.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=Na.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static getAppName(){return Na.getInstance().appName}}Na.instance=void 0;const Ma={getContext:()=>Na.getContext(),getAccessToken:()=>Na.getAccessToken(),getUser:()=>Na.getUser(),onRedirectTo:(e,t)=>Na.onRedirectTo(e,t),logout:e=>Na.logout(e)};class Fa extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Ga={v1:"/identity/resources/users/webauthn/v1/devices"},$a={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Va={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",roles:{v3:"/identity/resources/users/v3/roles"},groups:{v3:"/identity/resources/users/v3/groups"},tenants:{me:{v3:"/identity/resources/users/v3/me/tenants"}},apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-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"}},passwords:{resetBreachedPasswords:{v1:"/identity/resources/users/v1/passwords/breached/reset/bulk"}},authorization:{v1:"/identity/resources/users/v1/me/authorization"}},xa={v1:"/identity/resources/configurations/v1"},Ba={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},ja={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Wa={v1:"/identity/resources/permissions/v1"},Ka={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},accessTokens:{v1:"/identity/resources/tenants/access-tokens/v1"},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"}},users:{v1:"/identity/resources/tenants/users/v1"}},Ha={v1:"/identity/resources/roles/v1"},za={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},qa={v1:"/identity/resources/impersonation/v1"},Ya={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Ja={v1:"/identity/resources/users/phone-numbers/v1"},Qa={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},Xa={v1:"/team/resources/members/v1"},Za={v1:"/team/resources/roles/v1"},er={v1:"/team/resources/stats/v1"},tr={v1:"/team/resources/profile"},nr={v1:"/tenants/resources/account-settings/v1"},or={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"},v2:"/tenants/resources/hierarchy/v2",metadata:{v2:"/tenants/resources/hierarchy/v2/metadata"}},ir={v1:"/tenants/resources/sub-tenants/v1"},ar={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},rr={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"}}}},lr={v1:"/subscriptions/resources/payment-providers/v1"},sr={v1:"/subscriptions/resources/subscriptions/v1"},cr={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},ur={v1:"/reports/engine/resources/triggers/v1"},dr="/notification",yr="/audits",fr={v1:"/event/resources/configurations/v1"},pr="/webhook",gr="/oauth",Sr="/flags",vr="/directory/resources/v1/configurations/scim2",hr="/directory/resources/scim/temp",mr="/entitlements/api/v1/user-entitlements",Ar={v1:"/security-center/resources/recommendations/v1"},br={v1:"/security-center/resources/insights/v1"};function Tr(e,t,n=!0){let o;o="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const i=e.urlPrefix||"frontegg",a="frontegg"===i&&!n;return o.endsWith("/")||(o+="/"),o.endsWith(i)||a||(o+=i),o}function kr(e){var t,n;const o={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(o[ro.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(o[ro.frameWork]=e.metadataHeaders.framework),o}const Er=async e=>{var t,n,o;const i=Na.getContext(),a=await async function(e,t){var n;const o=kr(e),i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Na.getAccessToken)(),a=Na.getRequestSource();t&&(o[ro.contentType]=t),a&&(o[ro.source]=a),i&&(o.Authorization=`Bearer ${i}`);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))o[`${t.key}`]=`${t.value}`;return o}(i,e.contentType),r=await async function(e,t,n){const o=Tr(e,t),i=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 o=Object.keys(t);for(const e of o){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${o}${t}`;const r=Object.keys(i).length>0;return i&&r&&(a+=`?${new URLSearchParams(i)}`),a}(i,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:U({},a,e.headers),credentials:null!=(n=null!=(o=e.credentials)?o:i.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 Fa("Error request is too large",l.status);let e,t=!0;try{e=await l.text(),e=JSON.parse(e)}catch(e){t=!1}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=i.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=i.logLevel)?c:"")&&console.error(e),new Fa(t?e:"We're facing some difficulties, Please try again",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{}}},Ir=async(e,t,n)=>Er(U({url:e,method:"GET",contentType:"application/json",params:t},n)),Pr=async(e,t,n)=>Er(U({url:e,method:"POST",contentType:"application/json",body:t},n)),Lr=async(e,t,n)=>Er(U({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Or=async(e,t,n)=>Er(U({url:e,method:"PUT",contentType:"application/json",body:t},n)),_r=async(e,t,n)=>Er(U({url:e,method:"DELETE",contentType:"application/json",body:t},n)),wr=async(e,t,n,o)=>Er(U({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),Cr=(e={})=>U({},e.jwt?{Authorization:e.jwt}:{});async function Ur(e){return Or(`${Va.v1}/tenant`,e)}async function Rr(){return Ir(`${Va.v2}/me/tenants`)}async function Dr(e){return Ir(or.v1,void 0,{headers:Cr(e)})}async function Nr(e){return Ir(or.tree.v1,void 0,{headers:Cr(e)})}async function Mr(e){return Ir(or.parents.v1,void 0,{headers:Cr(e)})}async function Fr(e,t){return Ir(`${or.parents.v1}/${e}`,void 0,{headers:Cr(t)})}async function Gr(e,t){return Pr(`${Ka.users.v1}/count`,e,{headers:Cr(t)})}async function $r(e,t){return Ir(or.v2,e,{headers:Cr(t)})}async function Vr(e,t){return Ir(or.metadata.v2,U({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Cr(t)})}async function xr(){return Ir(xa.v1)}async function Br(){return Ir(`${xa.v1}/mfa-policy`)}async function jr(){return Ir(`${xa.v1}/mfa-policy/vendor`)}async function Wr(e){return e.id?Lr(`${xa.v1}/mfa-policy`,e):Pr(`${xa.v1}/mfa-policy`,e)}async function Kr(){return Ir(`${xa.v1}/lockout-policy`)}async function Hr(){return Ir(`${xa.v1}/lockout-policy/vendor`)}async function zr(e){return e.id?Lr(`${xa.v1}/lockout-policy`,e):Pr(`${xa.v1}/lockout-policy`,e)}async function qr(){try{return await Ir(`${xa.v1}/captcha-policy/public`)}catch{return null}}async function Yr(){return Ir(`${xa.v1}/password-history-policy`)}async function Jr(){return Ir(`${xa.v1}/password-history-policy/vendor`)}async function Qr(e){return e.id?Lr(`${xa.v1}/password-history-policy`,e):Pr(`${xa.v1}/password-history-policy`,e)}async function Xr(){return Ir(`${xa.v1}/password`)}async function Zr(){return Ir(`${Ba.emailDomain.v1}`)}async function el(){return Ir(`${Ba.emailDomain.v1}/config`)}async function tl(e){return Pr(`${Ba.emailDomain.v1}`,e)}async function nl(e){return Pr(`${Ba.emailDomain.v1}/config`,e)}async function ol(e){return _r(`${Ba.emailDomain.v1}/${e}`)}async function il(e){return Ir(`${Ba.ip.v1}`,e)}async function al(){return Ir(`${Ba.ip.v1}/config`)}async function rl(e){return Pr(`${Ba.ip.v1}`,e)}async function ll(e){return Pr(`${Ba.ip.v1}/bulk`,e)}async function sl(e){return Pr(`${Ba.ip.v1}/config`,e)}async function cl(e){return _r(`${Ba.ip.v1}/${e}`)}async function ul(){return Pr(`${Ba.ip.v1}/verify`)}async function dl(){return Pr(`${Ba.ip.v1}/verify/allow`)}class yl extends Error{constructor(e){super(e)}}const fl="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new yl("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,o,i=0,a=0;o=t.charAt(a++);~o&&(e=i%4?64*e+o:o,i++%4)?n+=String.fromCharCode(255&e>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return n};class pl extends Error{constructor(e){super(e)}}const gl=(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(fl(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 fl(t)}})(e.split(".")[n]))}catch(e){throw new pl("Invalid token specified: "+e.message)}};let Sl,vl,hl;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}(Sl||(Sl={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(vl||(vl={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(hl||(hl={}));const ml="admin_portal_should_load_authorization";async function Al(e){return Pr(`${Va.v3}/me/token`,e)}async function bl(e,t){return Ir(Va.v2,e,{headers:Cr(t)})}async function Tl(e,t){return Ir(Va.v3,e,{headers:Cr(t)})}async function kl(e,t){return Ir(Va.roles.v3,U({},e,{ids:e.ids.join(",")}),{headers:Cr(t)})}async function El(e,t){return Ir(Va.groups.v3,U({},e,{ids:e.ids.join(",")}),{headers:Cr(t)})}async function Il(e){return Ir(Va.tenants.me.v3,void 0,{headers:Cr(e)})}async function Pl(){return Pr(Va.passwords.resetBreachedPasswords.v1)}async function Ll(e){return Or(`${Va.v2}/me`,e)}async function Ol(){return Ir(mr)}let _l;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(_l||(_l={}));const wl="admin_portal_entitlements",Cl={flags:{}};class Ul{constructor(){var e;this._flags={},this._flags=null!=(e=Cl.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Ul;return n.set(e),Ul._instances[t]=n,n}static getFeatureFlags(e,t){const n=this.getInstance(t);return e.map((e=>"on"===(null==n?void 0:n._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t;this._flags=U({},null!=(t=null==Cl?void 0:Cl.flags)?t:{},null!=e?e:{})}}async function Rl(){return Ir(Sr)}Ul._instances={};const Dl=["type"],Nl=["type"],Ml=["type"];async function Fl(e){if(!e.accessToken)return e;Na.setAccessToken(e.accessToken);const t=await Eu(),n=U({},e,e.accessToken?gl(e.accessToken):{},t);return Na.setUser(n),n}async function Gl(e){if(!e.accessToken)return{user:e};Na.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Eu(),Rr()]),o=U({},e,e.accessToken?gl(e.accessToken):{},t);return Na.setUser(o),{user:o,tenants:n}}function $l(){if(!Na.shouldLoadEntitlements())return!1;const[e]=Ul.getFeatureFlags([wl],Na.getAppName()||"");return e}function Vl(){const[e]=Ul.getFeatureFlags([ml],Na.getAppName()||"");return e}async function xl(e){const{accessToken:t}=e;if(!t)return{user:e};Na.setAccessToken(t);const[n,o]=await Promise.all([Eu(),Il()]),i=U({},e,t?gl(t):{},n);return Na.setUser(i),{user:i,tenants:o.tenants,activeTenant:o.activeTenant}}async function Bl(e){Na.setAccessToken(e.id_token);const t=await Eu(),n=e.id_token?gl(e.id_token):{},o=U({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Na.setUser(o),o}async function jl(e){Na.setAccessToken(e.id_token);const[t,n]=await Promise.all([Eu(),Il()]),o=e.id_token?gl(e.id_token):{},i=U({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},o,t,{expiresIn:e.expires_in||300});return Na.setUser(i),{user:i,tenants:n.tenants,activeTenant:n.activeTenant}}async function Wl(e){try{const{address:t}=await Pr(`${$a.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Kl(e){return Pr(`${$a.v1}/user/saml/prelogin`,e)}async function Hl(e){return Fl(await Pr(`${$a.v1}/user/saml/postlogin`,e))}async function zl(e){return Fl(await Pr(`${$a.v1}/user/oidc/postlogin`,e))}async function ql(e){return Fl(await Pr(`${$a.v1}/user`,e))}async function Yl(e){return xl(await Pr(`${$a.v1}/user`,e))}async function Jl(e){return Fl(await Pr(`${$a.v1}/user/mfa/verify`,e))}async function Ql(e){return xl(await Pr(`${$a.v1}/user/mfa/verify`,e))}async function Xl(e){return Pr(`${Va.v1}/activate`,e)}async function Zl(e){return xl(await Pr(`${Va.v1}/activate`,e))}async function es(e){return Ir(`${Va.v1}/activate/strategy`,e)}async function ts(e){return Pr(`${Va.v1}/activate/reset`,e)}async function ns(e){return Pr(`${Va.v1}/invitation/reset`,e)}async function os(e){return Pr(`${Va.v1}/invitation/accept`,e)}async function is(){return Fl(await Pr(`${$a.v1}/user/token/refresh`))}async function as(){return Gl(await Pr(`${$a.v1}/user/token/refresh`))}async function rs(){return xl(await Pr(`${$a.v1}/user/token/refresh`))}async function ls(){return Pr(`${$a.v1}/logout`)}async function ss(e){return Ir(`${gr}/logout`,e)}async function cs(e){return Pr(`${Va.v1}/passwords/reset`,e)}async function us(e){return Pr(`${Va.v1}/passwords/reset/verify`,e)}async function ds(e){return Ir(`${Va.v1}/passwords/config`,e)}async function ys(e){return Pr(`${$a.v1}/user/mfa/recover`,e)}async function fs(){return Pr(`${Va.v1}/mfa/enroll`)}async function ps(){return Pr(`${Va.v1}/mfa/authenticator/enroll`)}async function gs(e){return Pr(`${Va.v1}/mfa/authenticator/enroll/verify`,e)}async function Ss(e){return Pr(`${Va.v1}/mfa/sms/enroll`,e)}async function vs(e){return Pr(`${Va.v1}/mfa/sms/enroll/verify`,e)}async function hs(){return Pr(`${Va.v1}/mfa/webauthn/enroll`)}async function ms(e){return Pr(`${Va.v1}/mfa/webauthn/enroll/verify`,e)}async function As(e){return Pr(`${Va.v1}/mfa/enroll/verify`,e)}async function bs(e){return Pr(`${Va.v1}/mfa/disable`,e)}async function Ts(e,t){return Pr(`${Va.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function ks(e){return Pr(`${Va.v1}/mfa/sms/${e}/disable`)}async function Es(e,t){return Pr(`${Va.v1}/mfa/sms/${e}/disable/verify`,t)}async function Is(e){return Pr(`${Va.v1}/mfa/webauthn/${e}/disable`)}async function Ps(e,t){return Pr(`${Va.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Ls(){return Ir(`${Va.v1}/mfa/devices`)}async function Os(e){return Pr(`${$a.v1}/user/mfa/authenticator/enroll`,e)}async function _s(e){return Pr(`${$a.v1}/user/mfa/authenticator/enroll/verify`,e)}async function ws(e){return xl(await Pr(`${$a.v1}/user/mfa/authenticator/enroll/verify`,e))}async function Cs(e,t){return Pr(`${$a.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Us(e){return Pr(`${$a.v1}/user/mfa/emailcode`,e)}async function Rs(e){return Pr(`${$a.v1}/user/mfa/emailcode/verify`,e)}async function Ds(e){return xl(await Pr(`${$a.v1}/user/mfa/emailcode/verify`,e))}async function Ns(e){return Pr(`${$a.v1}/user/mfa/sms/enroll`,e)}async function Ms(e){return Pr(`${$a.v1}/user/mfa/sms/enroll/verify`,e)}async function Fs(e){return xl(await Pr(`${$a.v1}/user/mfa/sms/enroll/verify`,e))}async function Gs(e,t){return Pr(`${$a.v1}/user/mfa/sms/${e}`,t)}async function $s(e,t){return Pr(`${$a.v1}/user/mfa/sms/${e}/verify`,t)}async function Vs(e,t){return xl(await Pr(`${$a.v1}/user/mfa/sms/${e}/verify`,t))}async function xs(e){return Pr(`${$a.v1}/user/mfa/webauthn/enroll`,e)}async function Bs(e){return Pr(`${$a.v1}/user/mfa/webauthn/enroll/verify`,e)}async function js(e){return xl(await Pr(`${$a.v1}/user/mfa/webauthn/enroll/verify`,e))}async function Ws(e,t){return Pr(`${$a.v1}/user/mfa/webauthn/${e}`,t)}async function Ks(e,t){return Pr(`${$a.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Hs(e,t){return xl(await Pr(`${$a.v1}/user/mfa/webauthn/${e}/verify`,t))}async function zs(){return Ir(`${Qa.v1}/saml/configurations`)}async function qs(e){return Pr(`${Qa.v1}/saml/configurations`,e)}async function Ys(){return Ir(`${Qa.v1}/saml/configurations/vendor-config`)}async function Js(e){return Or(`${Qa.v1}/saml/configurations/metadata`,e)}async function Qs(){return Or(`${Qa.v1}/saml/validations/domain`)}async function Xs(){return Ir(`${Qa.v1}/saml/configurations/roles/default`)}async function Zs(){return Ir(`${Qa.v2}/saml/configurations/groups`)}async function ec({roleIds:e}){return Pr(`${Qa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function tc({roleIds:e,group:t}){return Pr(`${Qa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function nc({roleIds:e,group:t,id:n}){return Lr(`${Qa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function oc({id:e}){return _r(`${Qa.v2}/saml/configurations/groups/${e}`)}async function ic(){return Ir(`${Qa.v1}/oidc/configurations`)}async function ac(){return Ir(`${Qa.v2}/configurations/public`)}async function rc(){return Ir(ja.v1)}async function lc(){return Ir(ja.v2)}async function sc(){return Ir(`${ja.v2}/authenticated`)}async function cc(){return Ir(ja.custom.v1)}async function uc({provider:e,code:t,idToken:n,redirectUri:o,codeVerifier:i,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),o&&(s.redirectUri=o),i&&(s.code_verifier=i),l&&(s.state=l),Pr(`${$a.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function dc(){return Ir(`${xa.v1}/public`)}async function yc(e){const{shouldActivate:t,authResponse:n,userId:o,tenantId:i}=await Pr(`${Va.v1}/signUp`,e),a={shouldActivate:t,userId:o,tenantId:i};if(!t&&n){const{user:e,tenants:t,activeTenant:o}=await xl(n);return U({},a,{user:e,tenants:t,activeTenant:o})}return a}async function fc(){return Ir(Va.sessions.currentUser.v1)}async function pc(){return Ir(`${Va.sessions.currentUser.v1}/current`)}async function gc(e){return Pr(`${Va.sessions.v1}/revoke`,{userId:e})}async function Sc(){return Ir(Va.sessions.configurations.v1)}async function vc(e){await Pr(Va.sessions.configurations.v1,e)}async function hc(e){await _r(`${Va.sessions.currentUser.v1}/${e}`)}async function mc(){await _r(`${Va.sessions.currentUser.v1}/all`)}async function Ac(){return Ir(Va.accessTokens.v1)}async function bc(){return Ir(Ka.accessTokens.v1)}async function Tc({id:e}){return _r(`${Ka.accessTokens.v1}/${e}`)}async function kc({id:e}){return _r(`${Va.accessTokens.v1}/${e}`)}async function Ec(e){return Pr(Va.accessTokens.v1,e)}async function Ic(e){return Pr(Ka.accessTokens.v1,e)}async function Pc(){return Ir(Va.apiTokens.v1)}async function Lc(){return Ir(Ka.apiTokens.v1)}async function Oc(e){return Pr(Va.apiTokens.v1,e)}async function _c(e){return Pr(Ka.apiTokens.v2,e)}async function wc({tokenId:e}){return _r(`${Ka.apiTokens.v1}/${e}`)}async function Cc({tokenId:e}){return _r(`${Va.apiTokens.v1}/${e}`)}async function Uc({userId:e}){return Ir(`${Va.v1}/${e}`)}async function Rc(e){return Ir(`${xa.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Dc(e){let{type:t}=e,n=Jo(e,Dl);return Pr(`${$a.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Nc(e){let{type:t}=e,n=Jo(e,Nl);return xl(await Pr(`${$a.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function Mc(e){let{type:t}=e,n=Jo(e,Ml);return Pr(`${$a.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Fc({token:e}){return Pr(Ka.invites.verify.v1,{token:e})}async function Gc(){return Ir(`${Qa.v1}/configurations`)}async function $c(e){return Pr(`${Qa.v1}/configurations`,e)}async function Vc(e,t){return Lr(`${Qa.v1}/configurations/${e}`,t)}async function xc(e){return _r(`${Qa.v1}/configurations/${e}`)}async function Bc(e){return Pr(`${Qa.v1}/configurations/metadata`,e)}async function jc(e,t){return Or(`${Qa.v1}/configurations/${e}/metadata`,t)}async function Wc(e){return Pr(`${Qa.v1}/configurations/metadata-url`,e)}async function Kc(e,t){return Or(`${Qa.v1}/configurations/${e}/metadata-url`,t)}async function Hc(e,t){return Pr(`${Qa.v1}/configurations/${e}/domains`,t)}async function zc(e,t){return _r(`${Qa.v1}/configurations/${e}/domains/${t}`)}async function qc(e,t){return Or(`${Qa.v1}/configurations/${e}/domains/${t}/validate`)}async function Yc(e){return Ir(`${Qa.v1}/configurations/${e}/roles`)}async function Jc(e,t){return Or(`${Qa.v1}/configurations/${e}/roles`,t)}async function Qc(e,t){return Pr(`${Qa.v1}/configurations/${e}/groups`,t)}async function Xc(e,{roleIds:t,group:n,id:o}){return Lr(`${Qa.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function Zc(e,t){return _r(`${Qa.v1}/configurations/${e}/groups/${t}`)}async function eu(e){return Ir(`${Qa.v1}/configurations/${e}/groups`)}async function tu(e){return Pr(`${$a.v2}/user/sso/prelogin`,e)}async function nu(e){return Fl(await Pr(`${$a.v2}/user/oidc/postlogin`,e))}async function ou(e){return jl(await Pr(`${gr}/token`,e))}async function iu(){return jl(await Pr(`${gr}/authorize/silent`))}async function au(e){return Bl(await Pr(`${gr}/token`,e))}async function ru(){return Bl(await Pr(`${gr}/authorize/silent`))}async function lu(e){return Pr(`${Va.v1}/phone/reset`,e)}async function su(e){return Pr(`${Va.v1}/phone/reset/verify`,e)}async function cu(e){return Pr(`${Va.v1}/phone`,e)}async function uu(e){return Pr(`${Va.v1}/phone/verify`,e)}async function du(e){return Or(`${Va.v1}/phone/change`,e)}async function yu(e){return Pr(`${$a.v1}/webauthn/prelogin`,e)}async function fu(e){return Pr(`${$a.v1}/webauthn/postlogin`,e)}async function pu(e){return xl(await Pr(`${$a.v1}/webauthn/postlogin`,e))}async function gu(){return Pr(Ga.v1)}async function Su(){return Ir(Ga.v1)}async function vu(e){return _r(`${Ga.v1}/${e}`)}async function hu(e){return Pr(`${Ga.v1}/verify`,e)}async function mu(){return Ir(`${xa.v1}/auth/strategies/public`)}async function Au(){return Ir(`${xa.v1}/auth/strategies`)}async function bu(){return Ir(`${xa.v1}/mfa/strategies`)}async function Tu(){return Ir(`${Va.authorization.v1}`)}async function ku(){return Ir(`${Va.v2}/me`)}async function Eu(){const e=[{action:ku,shouldLoad:!0},{action:Ol,shouldLoad:$l()},{action:Tu,shouldLoad:Vl()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[t,n,o]=await Promise.all(e);return U({},t,null!=o?o:{},{entitlements:n})}async function Iu(e){return Ir(`${Va.v2}/me`,null!=e?e:{addRoles:!0})}async function Pu(e){return Or(`${Va.v2}/me`,e)}async function Lu(e){return Or(`${tr.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Ou(e){return Pr(`${Va.v1}/passwords/change`,e)}async function _u(e){var t,n,o,i,a,r;const l=(e.filter||[]).reduce(((e,t)=>U({},e,{[t.id]:t.value})),{}),s=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(o=e.sort)||null==(i=o[0])?void 0:i.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return Ir(Xa.v1,U({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function wu(e){return Pr(Va.v2,U({},e,{provider:"local"}))}async function Cu(e){return _r(`${Xa.v1}/${e.userId}`)}async function Uu(e){return Or(Xa.v1,e)}async function Ru(e){return Pr(Ka.invites.user.v1,U({},e))}async function Du(e){return Lr(Ka.invites.user.v1,U({},e))}async function Nu(){return _r(Ka.invites.user.v1)}async function Mu(){return Ir(Ka.invites.user.v1)}async function Fu(){return Ir(Ka.invites.configuration.v1)}async function Gu(){return Ir(Za.v1)}async function $u(){return Ir(Wa.v1)}async function Vu(){return Ir(`${er.v1}/members`)}async function xu(e){return Pr(`${Xa.v1}/${e.userId}/resendActivationEmail`,{})}async function Bu(e){return Pr(Va.v2,U({},e,{provider:"local"}))}async function ju(e){return Pr(Va.invitation.resendAll.v1,U({},e))}async function Wu(e){var t,n;const o=await Ir("/metadata",e);if(null!=o&&null!=(t=o.rows)&&t[0])return null==o||null==(n=o.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function Ku(){return Ir("/metadata/admin-box")}async function Hu(e){return Pr("/metadata/admin-box",e)}async function zu(){const e=await Ir("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const qu=async()=>Wu({entityName:"notifications"}),Yu=async()=>Wu({entityName:"saml"}),Ju=async()=>Wu({entityName:"audits"}),Qu=async e=>async function(e){const t=await Ir(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Xu=["dataFilters"],Zu=["templateId","dataFilters"],ed=["dataFilters"];async function td(e){return Ir(`${cr.v2}/tenant-reports`,e)}async function nd(e){return Ir(`${cr.v2}/${e.id}/tenant-reports`)}async function od(e){let{dataFilters:t}=e,n=Jo(e,Xu);return{html:await Ir(`${ur.v1}/preview-report`,U({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function id(e){let{templateId:t,dataFilters:n}=e,o=Jo(e,Zu);return Pr(`${cr.v2}/${t}/tenant-reports`,U({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function ad(e){let{dataFilters:t}=e,n=Jo(e,ed);const o=await Ir(`${ur.v1}/preview-report`,U({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let i="text/html",a="html";"pdf"===n.responseType?(i="application/pdf",a="pdf"):"image"===n.responseType&&(i="image/jpeg",a="jpg");const r=new Blob([o],{type:i}),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 rd(e){return Pr(`${ur.v1}/tenant-reports`,e)}async function ld(e){return Ir(dr,{params:e})}async function sd(e){return Or(`${dr}/status`,{params:e})}async function cd(e){const{notificationId:t,pinStatus:n}=e;return Or(`${dr}/${n}`,{notificationId:t})}async function ud(){return Pr(`${dr}/status/mark-all-read`)}const dd=["endpoint","headerProps"];async function yd(e){return Ir(yr,e)}async function fd(e){return Ir(`${yr}/stats`,e)}async function pd(e){const{endpoint:t,headerProps:n}=e,o=Jo(e,dd);return wr(`${yr}/export/${t}`,{properties:n},o)}const gd=["eventKey"],Sd=["eventKey"],vd=()=>Ir(`${ar.v1}/slack`),hd=()=>Ir(`${ar.v1}/slack/applications`),md=()=>Ir(`${ar.v1}/slack/channels`),Ad=e=>e.id?Lr(`${ar.v1}/slack/subscription/${e.id}`,e):Pr(`${ar.v1}/slack/subscriptions`,e),bd=e=>_r(`${ar.v1}/slack/subscriptions/${e.id}`),Td=e=>Pr(`${ar.v1}/slack/applications/registrations`,{code:e}),kd=()=>Ir(`${ar.v1}/emails`),Ed=e=>{let{eventKey:t}=e,n=Jo(e,gd);return Pr(`${ar.v1}/emails/${t}`,n)},Id=({eventKey:e,enabled:t})=>Lr(`${ar.v1}/emails/${e}`,{enabled:t}),Pd=(e,t)=>_r(`${ar.v1}/emails/${e}/subscriptions/${t}`),Ld=(e,t,n)=>Or(`${ar.v1}/emails/${t}/subscriptions/${e}`,n),Od=e=>_r(`${ar.v1}/emails/${e}`),_d=()=>Ir(`${ar.v2}/sms`),wd=e=>{let{eventKey:t}=e,n=Jo(e,Sd);return Pr(`${ar.v2}/sms/${t}`,n)},Cd=({eventKey:e,enabled:t})=>Lr(`${ar.v2}/sms/${e}`,{enabled:t}),Ud=(e,t)=>_r(`${ar.v2}/sms/${e}/subscriptions/${t}`),Rd=(e,t,n)=>Or(`${ar.v2}/sms/${t}/subscriptions/${e}`,n),Dd=e=>_r(`${ar.v2}/sms/${e}`),Nd=()=>Ir(pr),Md=e=>e._id?Lr(`${pr}/${e._id}`,e):Pr(`${pr}/custom`,e),Fd=e=>_r(`${pr}/${e}`),Gd=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Ir(`${pr}/logs/?${o.toString()}`)},$d=e=>Pr(`${pr}/test`,e),Vd=e=>Pr(`${pr}/logs/${e}/retries`),xd=()=>Ir(`${fr.v1}/categories`),Bd=e=>Ir(fr.v1,{channels:e});async function jd(e,t){return Or(nr.v1,e,{headers:Cr(t)})}async function Wd(e){return Ir(nr.v1,void 0,{headers:Cr(e)})}async function Kd(){return Ir(`${nr.v1}/public`)}const Hd=["roleId"],zd=["roleId"],qd=["permissionId"];async function Yd(){return Ir(Ha.v1)}async function Jd(e){return Pr(Ha.v1,e)}async function Qd({roleId:e}){return _r(`${Ha.v1}/${e}`)}async function Xd(e){let{roleId:t}=e,n=Jo(e,Hd);return Lr(`${Ha.v1}/${t}`,n)}async function Zd(e){let{roleId:t}=e,n=Jo(e,zd);return Or(`${Ha.v1}/${t}/permissions`,n)}async function ey(){return Ir(Wa.v1)}async function ty(e){let{permissionId:t}=e,n=Jo(e,qd);return Or(`${Wa.v1}/${t}/roles`,n)}async function ny(){return Ir(`${Wa.v1}/categories`)}async function oy(){return Ir(rr.subscriptions.v1)}async function iy(e){return Ir(`${rr.subscriptions.v1}/${e}`)}async function ay(e){return Or(`${rr.subscriptions.v1}/${e}/cancellations/`,{})}async function ry(e){return Or(`${rr.subscriptions.v1}/${e}/renewals/`,{})}async function ly(e,{paymentMethodId:t,planId:n}){return Or(`${rr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function sy(e){return Ir(`${sr.v1}/${e}`)}async function cy(){return Ir(`${sr.v1}`)}async function uy(e){return Or(`${sr.v1}/${e}/cancellations/`,{})}async function dy(e){return Or(`${sr.v1}/${e}/renewals/`,{})}async function yy(e,{paymentMethodId:t,planId:n}){return Or(`${sr.v1}/${e}`,{paymentMethodId:t,planId:n})}async function fy(){return Ir(rr.plans.v1)}async function py(e){return Ir(`${rr.plans.v1}/${e}`)}async function gy(){return Ir(rr.invoices.v1)}async function Sy(e){return Ir(`${rr.invoices.v1}/${e}`)}async function vy(e,t){return Ir(`${rr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const hy=["email"];async function my(){return Ir(rr.paymentMethods.v1)}async function Ay(e){return Ir(`${rr.paymentMethods.v1}/${e}`)}async function by(e,t){let{email:n}=t,o=Jo(t,hy);return Lr(`${rr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function Ty(e){return Pr(rr.paymentProviders.stripe.subscriptions.v1,e)}async function ky(e){return Ir(`${rr.paymentProviders.stripe.customers.v1}/${e}`)}async function Ey(e){return Pr(`${rr.paymentProviders.stripe.customers.v1}`,e)}async function Iy(){return Ir(`${rr.paymentProviders.stripe.publicConfigurations.v1}`)}async function Py(e){return Pr(`${rr.paymentProviders.stripe.setupIntents.v1}`,e)}async function Ly(e){return Ir(`${rr.summaries.v1}/${e}`)}async function Oy(e){return Ir(`${rr.tenantConfiguration.v1}/${e}`)}async function _y(e){return Pr(`${rr.tenantConfiguration.v1}`,e)}async function wy(){return Ir(lr.v1)}async function Cy(){return Ir(`${rr.configurations.vendorPublicConfigurations.v1}`)}let Uy,Ry,Dy,Ny,My,Fy;async function Gy(){return Ir("/vendors/public")}async function $y(e){return Ir(za.v1,e)}async function Vy(e){return Pr(za.v1,e)}async function xy(e,t){return _r(za.v1,e,{headers:Cr(t)})}async function By(e,t,n){return Pr(`${za.v1}/${e}/roles`,t,{headers:Cr(n)})}async function jy(e,t,n){return _r(`${za.v1}/${e}/roles`,t,{headers:Cr(n)})}async function Wy(e,t,n){return Lr(`${za.v1}/${e}/roles`,t,{headers:Cr(n)})}async function Ky(e,t){return Pr(ir.v1,e,{headers:Cr(t)})}async function Hy(e,t){return _r(`${ir.v1}/${e}`,void 0,{headers:Cr(t)})}async function zy({tenantId:e},t,n){return Lr(`${ir.v1}/${e}`,t,{headers:Cr(n)})}async function qy(e,t,n){return Or(`${za.v1}/${e}/access`,t,{headers:Cr(n)})}async function Yy(e,t){return Pr(`${za.v2}/`,e,{headers:Cr(t)})}async function Jy(){return Ir(`${vr}`)}async function Qy(e,t){return Lr(`${vr}/${e}`,t)}async function Xy(e){return Pr(`${vr}`,e)}async function Zy(e){return _r(`${vr}/${e}`)}async function ef(e){return Ir(`${hr}/${e}/Users/count`)}async function tf(e){return Pr(`${qa.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Uy||(Uy={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Ry||(Ry={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Dy||(Dy={})),(Ny||(Ny={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(My||(My={})),function(e){e.CREATE="create_customer"}(Fy||(Fy={}));const nf=["groupId"];async function of({groupId:e},t){return Ir(`${Ya.v1}/${e}`,U({},t))}async function af(e){return Ir(`${Ya.v1}`,U({},e))}async function rf(e,t){return Pr(`${Ya.getByIds.v1}`,e,{params:t})}async function lf(e){return Pr(`${Ya.v1}`,e)}async function sf(e){let{groupId:t}=e,n=Jo(e,nf);return Lr(`${Ya.v1}/${t}`,n)}async function cf(e){return _r(`${Ya.v1}/${e}`)}async function uf(e,t){return Pr(`${Ya.v1}/${e}/roles`,t)}async function df(e,t){return _r(`${Ya.v1}/${e}/roles`,t)}async function yf(e,t){return Pr(`${Ya.v1}/${e}/users`,t)}async function ff(e,t){return _r(`${Ya.v1}/${e}/users`,t)}async function pf(){return Ir(`${Ya.configurations.v1}`)}async function gf(e){return Pr(`${Ya.configurations.v1}`,e)}async function Sf(){return Ir(Ar.v1)}async function vf(){return Ir(br.v1)}async function hf(e){return Ir(`${Ja.v1}`,e)}async function mf(e){return Pr(`${Ja.v1}`,e)}async function Af(e){return _r(`${Ja.v1}/${e}`)}async function bf(e){return Pr(`${Ja.v1}/preverify`,e)}async function Tf(e){return Pr(`${Ja.v1}/verify`,e)}async function kf(e,t){return Pr(`${Ja.v1}/${e}/delete/verify`,t)}let Ef,If,Pf;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Ef||(Ef={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(If||(If={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Pf||(Pf={}));const Lf=[/^(.*)\/logout$/g,"/logout",/^\/identity\/resources\/auth\/v[0-9]*\/user\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/passwordless\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/webauthn\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/token\/refresh$/g,/^\/identity\/resources\/users\/v[0-9]*$/g,/^\/identity\/resources\/users\/v[0-9]*\/signUp$/g,/^\/identity\/resources\/users\/v[0-9]*\/activate$/g,/^\/identity\/resources\/users\/v[0-9]*\/invitation\/accept$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/verify$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/[^\/]*\/[^\/]*\/verify$/g,/^\/oauth\/token$/g,/^\/oauth\/authorize\/silent$/g],Of=`${$a.v1}/user/token/refresh`,_f=`${gr}/authorize/silent`,wf=`${Va.v2}/me`,Cf=`${Va.v2}/me/tenants`,Uf=`${Va.v3}/me/tenants`;let Rf,Df,Nf,Mf,Ff,Gf,$f,Vf;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Rf||(Rf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Df||(Df={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Nf||(Nf={})),function(e){e.FORCE_MFA="FORCE_MFA",e.BREACHED_PASSWORDS_EXIST="BREACHED_PASSWORDS_EXIST",e.ENABLE_USER_LOCKOUT="ENABLE_USER_LOCKOUT",e.STRENGTHEN_USER_LOCKOUT="STRENGTHEN_USER_LOCKOUT",e.ENABLE_PASSWORD_HISTORY="ENABLE_PASSWORD_HISTORY",e.STRENGTHEN_PASSWORD_HISTORY="STRENGTHEN_PASSWORD_HISTORY",e.ENABLE_FORCE_RELOGIN="ENABLE_FORCE_RELOGIN",e.SET_FORCE_RELOGIN="SET_FORCE_RELOGIN",e.ENABLE_SESSION_CONCURRENCY="ENABLE_SESSION_CONCURRENCY",e.SET_SESSION_CONCURRENCY="SET_SESSION_CONCURRENCY",e.ENABLE_IDLE_SESSION="ENABLE_IDLE_SESSION",e.SET_IDLE_SESSION="SET_IDLE_SESSION",e.ENABLE_IP_RESTRICTIONS="ENABLE_IP_RESTRICTIONS",e.CHANGE_IP_TO_ALLOWLIST="CHANGE_IP_TO_ALLOWLIST",e.ENABLE_DOMAIN_RESTRICTIONS="ENABLE_DOMAIN_RESTRICTIONS",e.CHANGE_DOMAIN_TO_ALLOWLIST="CHANGE_DOMAIN_TO_ALLOWLIST",e.CONFIGURE_SSO="CONFIGURE_SSO"}(Mf||(Mf={})),function(e){e.MFA_FORCED="MFA_FORCED",e.PARTIALLY_FORCED_MFA="PARTIALLY_FORCED_MFA",e.PARTIAL_MFA_USAGE="PARTIAL_MFA_USAGE",e.FULL_MFA_USAGE="FULL_MFA_USAGE",e.BREACHED_PASSWORD_USERS_EXIST="BREACHED_PASSWORD_USERS_EXIST",e.IMPROVE_LOCKOUT_POLICY="IMPROVE_LOCKOUT_POLICY",e.IMPROVE_PASSWORD_HISTORY_POLICY="IMPROVE_PASSWORD_HISTORY_POLICY",e.NO_SESSION_SETTINGS="NO_SESSION_SETTINGS",e.PARTIAL_SESSION_SETTINGS="PARTIAL_SESSION_SETTINGS",e.FULL_SESSION_SETTINGS="FULL_SESSION_SETTINGS",e.NO_IP_RESTRICTIONS="NO_IP_RESTRICTIONS",e.IP_ALLOWLIST="IP_ALLOWLIST",e.IP_DENYLIST="IP_DENYLIST",e.NO_DOMAIN_RESTRICTIONS="NO_DOMAIN_RESTRICTIONS",e.DOMAIN_ALLOWLIST="DOMAIN_ALLOWLIST",e.DOMAIN_DENYLIST="DOMAIN_DENYLIST",e.FULL_PASSWORD_SETTINGS="FULL_PASSWORD_SETTINGS"}(Ff||(Ff={})),function(e){e.SEND_RESET_BREACHED_PASSWORD_EMAIL="SEND_RESET_BREACHED_PASSWORD_EMAIL",e.ADJUST_FORCE_RELOGIN="ADJUST_FORCE_RELOGIN",e.ADJUST_MAX_CONCURRENT_SESSIONS="ADJUST_MAX_CONCURRENT_SESSIONS",e.ADJUST_IDLE_TIMEOUT="ADJUST_IDLE_TIMEOUT"}(Gf||(Gf={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}($f||($f={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(Vf||(Vf={}));const xf={auth:l,teams:s,metadata:c,reports:u,connectivity:f,notifications:d,audits:y,tenants:t,accountSettings:p,roles:g,subscriptions:S,vendor:v,subTenants:h,featureFlags:r,directory:m,impersonate:A,groups:b,users:i,entitlements:a,securityCenter:T,userPhoneNumbers:k};var Bf={fetch:e,ContextHolder:Na,FronteggContext:Ma,api:xf,FronteggApiError:Fa,AuthStrategyEnum:ko,MachineToMachineAuthStrategy:Eo,SocialLoginProviders:To,ISubscriptionCancellationPolicy:Dy,ISubscriptionStatus:Uy,PaymentMethodType:Ry,ProviderType:Ny};let jf,Wf;!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"}(jf||(jf={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Wf||(Wf={}));const Kf="input is invalid type",Hf="undefined"!=typeof ArrayBuffer,zf="0123456789abcdef".split(""),qf=[-2147483648,8388608,32768,128],Yf=[24,16,8,0],Jf=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Qf=["hex","array","digest","arrayBuffer"],Xf=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Hf&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const Zf=function(e){return function(t){const n=new tp(!0).update(t);return null==n?void 0:n[e]()}},ep=function(e){return function(t,n){const o=new np(t,!0).update(n);return null==o?void 0:o[e]()}};class tp{constructor(e=!1){this.blocks=void 0,this.h0=void 0,this.h1=void 0,this.h2=void 0,this.h3=void 0,this.h4=void 0,this.h5=void 0,this.h6=void 0,this.h7=void 0,this.block=void 0,this.start=void 0,this.bytes=void 0,this.hBytes=void 0,this.finalized=void 0,this.hashed=void 0,this.first=void 0,this.lastByteIndex=void 0,this.sharedMemory=!1,this.toString=()=>this.hex(),this.array=()=>tp.prototype.digest(),e?(Xf[0]=Xf[16]=Xf[1]=Xf[2]=Xf[3]=Xf[4]=Xf[5]=Xf[6]=Xf[7]=Xf[8]=Xf[9]=Xf[10]=Xf[11]=Xf[12]=Xf[13]=Xf[14]=Xf[15]=0,this.blocks=Xf):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.sharedMemory=e}update(e){if(this.finalized)return;let t;const n=typeof e;if("string"!==n){if("object"!==n)throw new Error(Kf);if(null===e)throw new Error(Kf);if(Hf&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Hf&&ArrayBuffer.isView(e)))throw new Error(Kf);t=!0}let o,i,a=0;const r=e.length,l=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,l[0]=this.block,l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0),t)for(i=this.start;a<r&&i<64;++a)l[i>>2]|=e[a]<<Yf[3&i++];else for(i=this.start;a<r&&i<64;++a)o=e.charCodeAt(a),o<128?l[i>>2]|=o<<Yf[3&i++]:o<2048?(l[i>>2]|=(192|o>>6)<<Yf[3&i++],l[i>>2]|=(128|63&o)<<Yf[3&i++]):o<55296||o>=57344?(l[i>>2]|=(224|o>>12)<<Yf[3&i++],l[i>>2]|=(128|o>>6&63)<<Yf[3&i++],l[i>>2]|=(128|63&o)<<Yf[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++a)),l[i>>2]|=(240|o>>18)<<Yf[3&i++],l[i>>2]|=(128|o>>12&63)<<Yf[3&i++],l[i>>2]|=(128|o>>6&63)<<Yf[3&i++],l[i>>2]|=(128|63&o)<<Yf[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=l[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}finalize(){if(this.finalized)return;this.finalized=!0;const e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=qf[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,o,i,a,r,l,s,c,u,d=this.h0,y=this.h1,f=this.h2,p=this.h3,g=this.h4,S=this.h5,v=this.h6,h=this.h7;const m=this.blocks;for(e=16;e<64;++e)i=m[e-15],t=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,i=m[e-2],n=(i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(l=704751109,i=m[0]-210244248,h=i-1521486534<<0,p=i+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),l=d&y,o=l^d&f^u,r=g&S^~g&v,i=h+n+r+Jf[e]+m[e],a=t+o,h=p+i<<0,p=i+a<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),s=p&d,o=s^p&y^l,r=h&g^~h&S,i=v+n+r+Jf[e+1]+m[e+1],a=t+o,v=f+i<<0,f=i+a<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&p,o=c^f&d^s,r=v&h^~v&g,i=S+n+r+Jf[e+2]+m[e+2],a=t+o,S=y+i<<0,y=i+a<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),u=y&f,o=u^y&p^c,r=S&v^~S&h,i=g+n+r+Jf[e+3]+m[e+3],a=t+o,g=d+i<<0,d=i+a<<0;this.h0=this.h0+d<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+p<<0,this.h4=this.h4+g<<0,this.h5=this.h5+S<<0,this.h6=this.h6+v<<0,this.h7=this.h7+h<<0}hex(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,o=this.h3,i=this.h4,a=this.h5,r=this.h6,l=this.h7;let s=zf[e>>28&15]+zf[e>>24&15]+zf[e>>20&15]+zf[e>>16&15]+zf[e>>12&15]+zf[e>>8&15]+zf[e>>4&15]+zf[15&e]+zf[t>>28&15]+zf[t>>24&15]+zf[t>>20&15]+zf[t>>16&15]+zf[t>>12&15]+zf[t>>8&15]+zf[t>>4&15]+zf[15&t]+zf[n>>28&15]+zf[n>>24&15]+zf[n>>20&15]+zf[n>>16&15]+zf[n>>12&15]+zf[n>>8&15]+zf[n>>4&15]+zf[15&n]+zf[o>>28&15]+zf[o>>24&15]+zf[o>>20&15]+zf[o>>16&15]+zf[o>>12&15]+zf[o>>8&15]+zf[o>>4&15]+zf[15&o]+zf[i>>28&15]+zf[i>>24&15]+zf[i>>20&15]+zf[i>>16&15]+zf[i>>12&15]+zf[i>>8&15]+zf[i>>4&15]+zf[15&i]+zf[a>>28&15]+zf[a>>24&15]+zf[a>>20&15]+zf[a>>16&15]+zf[a>>12&15]+zf[a>>8&15]+zf[a>>4&15]+zf[15&a]+zf[r>>28&15]+zf[r>>24&15]+zf[r>>20&15]+zf[r>>16&15]+zf[r>>12&15]+zf[r>>8&15]+zf[r>>4&15]+zf[15&r];return s+=zf[l>>28&15]+zf[l>>24&15]+zf[l>>20&15]+zf[l>>16&15]+zf[l>>12&15]+zf[l>>8&15]+zf[l>>4&15]+zf[15&l],s}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,o=this.h3,i=this.h4,a=this.h5,r=this.h6,l=this.h7,s=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return s.push(l>>24&255,l>>16&255,l>>8&255,255&l),s}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class np extends tp{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const o=typeof e;if("string"===o){const t=[],o=e.length;let i,a=0;for(n=0;n<o;++n)i=e.charCodeAt(n),i<128?t[a++]=i:i<2048?(t[a++]=192|i>>6,t[a++]=128|63&i):i<55296||i>=57344?(t[a++]=224|i>>12,t[a++]=128|i>>6&63,t[a++]=128|63&i):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++n)),t[a++]=240|i>>18,t[a++]=128|i>>12&63,t[a++]=128|i>>6&63,t[a++]=128|63&i);e=t}else{if("object"!==o)throw new Error(Kf);if(null===e)throw new Error(Kf);if(Hf&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Hf&&ArrayBuffer.isView(e)))throw new Error(Kf)}var i;e.length>64&&(e=null==(i=new tp(!0).update(e))?void 0:i.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}tp.call(this,t),this.update(r),this.oKeyPad=a,this.inner=!0,this.sharedMemory=t}finalize(){if(super.finalize(),this.inner){this.inner=!1;const e=this.array();tp.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),tp.prototype.finalize.call(this)}}}const op=function(){const e=Zf("hex");e.create=function(){return new tp},e.update=function(t){return e.create().update(t)};for(let t=0;t<Qf.length;++t){const n=Qf[t];e[n]=Zf(n)}return e}();function ip(e,t){const n=U({},e);return t.forEach((e=>{delete n[e]})),n}async function ap(e){var t,n;return null!=(t=window.crypto)&&null!=(n=t.subtle)&&n.digest?async function(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,"_")}(e):(console.warn("Generating CodeChallenge in non-secure domain:",window.location.origin),async function(e){const t=op.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function rp(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let o=0;o<e;o++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=ep("hex");e.create=function(e){return new np(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Qf.length;++t){const n=Qf[t];e[n]=ep(n)}}();const lp=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n}));function*sp(e){const t=yield Vi((e=>e.root.appName));return Ul.getFeatureFlags(e,t)}const cp={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},up=U({},cp,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),dp=[{id:"a040dcf6-b907-4e83-9970-6bd23c88fd40",key:"ReadOnly",name:"Read Only",description:null,isDefault:!1,createdAt:new Date,updatedAt:new Date,permissions:["5b7dafe6-12a1-402b-9082-8eb2777cfcd8","da1d1990-c99c-4086-b845-2d465de3227b"],tenantId:"tenantId",vendorId:"vendorId"},{id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0",key:"Admin",name:"Admin",description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:["502b112e-50fd-4e8d-875e-3abda628d94a","da015508-7cb1-4dcd-9436-d0518a2ecd21"],tenantId:"tenantId",vendorId:"vendorId"}],yp={sub:"",tenants:[],id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!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:"description",categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date,roleIds:[]}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),verified:!1},fp=U({},yp,{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}),pp={loading:!1,error:void 0,saving:!0,profile:yp},gp={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"},Sp={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:ko.EmailAndPassword,machineToMachineAuthStrategy:Eo.ClientCredentials},vp={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},hp={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},mp={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Ap={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},bp={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Tp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],kp={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Ap,roles:Tp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Ep=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Ip={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:[dp[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[dp[0]],managedBy:Nf.FRONTEGG}]},Pp={id:Ip.id,email:Ip.email,name:Ip.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[dp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Lp={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:[dp[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[dp[0]],managedBy:Nf.FRONTEGG}]},Op={id:Lp.id,email:Lp.email,name:Lp.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[dp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},_p={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},wp=[Lp,Ip],Cp=[Op,Pp],Up=[_p],Rp=[{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}],Dp=[{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"}],Np={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Mp={isActive:!0,strategy:Bn.ALLOW},Fp=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Bn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Bn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Bn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Bn.BLOCK,description:"IP 4"}],Gp=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(U({},Lp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},$p=e=>({id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0"+e,key:e,name:e,description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:[],tenantId:"tenantId",vendorId:"vendorId"}),Vp=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Gp(6),roles:[$p("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Nf.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Gp(44),roles:[$p("Editor")],managedBy:Nf.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Gp(8),roles:[$p("Viewer")],managedBy:Nf.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Gp(5),roles:[$p("Admin")],managedBy:Nf.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Gp(21),description:"BDR, AE, and inside sales",roles:[$p("Viewer")],managedBy:Nf.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Gp(23),description:"Dev success and customer success",roles:[$p("Admin")],managedBy:Nf.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Gp(10),description:"The marketing department",roles:[$p("Viewer")],managedBy:Nf.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Gp(4),description:"Human resources",roles:[$p("Viewer")],managedBy:Nf.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Gp(3),roles:[$p("Viewer")],managedBy:Nf.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Gp(8),roles:[$p("Editor")],managedBy:Nf.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Gp(4),roles:[$p("Viewer")],managedBy:Nf.FRONTEGG}],xp={scoring:{score:79},recommendations:{items:[{code:Mf.FORCE_MFA,severity:$f.WARNING,category:Vf.MFA},{code:Mf.ENABLE_FORCE_RELOGIN,severity:$f.WARNING,category:Vf.SESSIONS}]}},Bp={insights:{items:[{category:Vf.MFA,code:Ff.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:Vf.SESSIONS,code:Ff.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:Vf.PASSWORD,code:Ff.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:Vf.DOMAIN,code:Ff.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},jp={users:Cp,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},Wp={users:[Cp[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},Kp={users:[Cp[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0};let Hp,zp,qp;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Hp||(Hp={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(zp||(zp={})),function(e){e.profile="profile",e.privacy="privacy",e.personalApiTokens="personalApiTokens",e.account="account",e.users="users",e.groups="groups",e.security="security",e.sso="sso",e.audits="audits",e.webhooks="webhooks",e.apiTokens="apiTokens",e.roles="roles",e.subscriptions="subscription",e.allAccounts="allAccounts"}(qp||(qp={})),qp.profile,qp.privacy,qp.personalApiTokens,qp.account,qp.users,qp.groups,qp.security,qp.sso,qp.audits,qp.webhooks,qp.apiTokens,qp.roles,qp.subscriptions,qp.allAccounts;const Yp=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Jp=e=>{const{pathname:t}=new URL(e),n=Yp(e);return n?t+n:t},Qp=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},Xp="tenantId",Zp=e=>e.mfaRequired&&e.mfaToken?(Na.setAccessToken(null),Na.setUser(null),!0):(Na.setAccessToken(e.accessToken),Na.setUser(e),!1),eg=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:o}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),o=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:o,totalDevices:t+n+o}})(e);if(1===o){if(n)return ln.authenticatorApp;if(t)return ln.smsVerifyCode}return ln.verify},tg=e=>{if(1===e.length){const[t]=e;if(t===hl.AuthenticatorApp)return ln.authenticatorApp;if(t===hl.SMS)return ln.smsSetPhoneNumber;if(t===hl.EmailCode)return ln.emailVerifyCode}return ln.verify};function*ng(e){let t=Pt.loginWithTwoFactor,n={};const{loginState:o}=yield Vi((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield Fi(xf.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:eg(e.mfaDevices)}:(n={step:tg(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=Pt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:Lt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:U({},o,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:i,mfaDeviceExpiration:a,isBreachedPassword:e.isBreachedPassword})}}const og=(e,t)=>e?(e=>Boolean(null==e?void 0:e.statusCode))(e)?e.message:((e=>e instanceof Error||(null==e?void 0:e.message)&&(null==e?void 0:e.stack)&&"Error"===(null==e?void 0:e.name))(e)?console.error(e.message):"string"==typeof e&&console.error(e),null!=t?t:"We're facing some difficulties, Please try again"):t;let ig;function ag(e,t){var n,o;null==(n=(o=window).onFronteggEvent)||n.call(o,e,t)}!function(e){e.SIGNUP_COMPLETED="signup_completed",e.USER_VERIFIED="user_verified"}(ig||(ig={}));const rg=(e,t=[])=>Object.entries(e).reduce(((e,[n,o])=>"object"==typeof o?[...e,...rg(o,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:o}]),[]),lg=["callback"];function*sg(){yield Di(Fo.setCustomLoginState({loading:!0}));try{const e=yield Fi(xf.metadata.getAdminBoxMetadata);yield Di(Fo.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield Di(Fo.setCustomLoginState({loading:!1,error:og(e)}))}}function*cg(e){let{payload:{callback:t}}=e,n=Jo(e.payload,lg);try{yield Di(Fo.setCustomLoginState({error:null,saving:!0}));const e=rg(n);if(0===e.length)throw new Error("No changes to update");yield Fi(xf.metadata.updateAdminBoxMetadata,{actions:e});const o=yield Fi(xf.metadata.getAdminBoxMetadata);yield Di(Fo.setCustomLoginState({tenantMetadata:o,saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setCustomLoginState({error:og(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*ug(){var e;const[t]=yield Fi(sp,["admin_portal_login_per_tenant"]),n=!(null==(e=Na.getContext())||!e.tenantResolver);if(yield Vi((e=>e.auth.isAuthenticated))){var o;const e=yield null!=(o=Vi((({auth:e})=>{var t;return null==(t=e.tenantsState.activeTenant)?void 0:t.hasCustomLogin})))&&o;return t&&n&&e}return t&&n}function*dg(){try{var e;if(!(yield Fi(ug)))return;const t=yield Vi((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:o}=xf.accountSettings,{applicationUrl:i}=yield Fi(t?n:o);if(!i)return;const{routes:a}=yield Vi((e=>e.auth)),r=null!=(e=Yp(i))?e:"";yield Di(Fo.setState({routes:U({},a,{customLoginAuthenticatedUrl:i,customLoginUrl:a.loginUrl+r})})),yield Di(Fo.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*yg(){yield Da(Fo.loadTenantMetadata,sg),yield Da(Fo.updateTenantMetadata,cg)}let fg;!function(e){e.RECOMMENDATIONS="recommendations",e.INSIGHTS="insights",e.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS="sendBulkResetBreachedPasswordEmails",e.SEND_BREACHED_PASSWORD_EMAIL="sendBreachedPasswordEmail",e.BREACHED_PASSWORD_USERS_TABLE="breachedPasswordUsersTable",e.UNENROLLED_MFA_USERS_TABLE="unenrolledMfaUsersTable",e.INACTIVE_USERS_TABLE="inactiveUsersTable"}(fg||(fg={}));const pg=["callback"];function gg(e){return function*(t){const[n]=yield Fi(sp,["security-center-admin-portal-major-version"]);yield e(t),n&&(yield Sg(),yield vg())}}function*Sg(){const e=fg.RECOMMENDATIONS;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:o}=yield Fi(xf.securityCenter.getRecommendations);yield Di(Fo.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==o?void 0:o.score)?t:0}))}catch(t){yield Di(Fo.setSecurityCenterStateError({key:e,value:og(t)}))}finally{yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*vg(){const e=fg.INSIGHTS;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield Fi(xf.securityCenter.getInsights);yield Di(Fo.setSecurityCenterState({insights:t.items}))}catch(t){yield Di(Fo.setSecurityCenterStateError({key:e,value:og(t)}))}finally{yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*hg(e){let{payload:{callback:t}}=e,n=Jo(e.payload,pg);const o=fg.SEND_BREACHED_PASSWORD_EMAIL;yield Di(Fo.setSecurityCenterStateError({key:o,value:!1})),yield Di(Fo.setSecurityCenterStateLoader({key:o,value:!0}));try{yield Fi(xf.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield Di(Fo.setSecurityCenterStateError({key:o,value:og(e)})),null==t||t(!1,e)}finally{yield Di(Fo.setSecurityCenterStateLoader({key:o,value:!1}))}}function*mg({payload:{callback:e}}){const t=fg.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield Di(Fo.setSecurityCenterStateError({key:t,value:!1})),yield Di(Fo.setSecurityCenterStateLoader({key:t,value:!0}));try{yield Fi(xf.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield Di(Fo.setSecurityCenterStateError({key:t,value:og(n)})),null==e||e(!1)}finally{yield Di(Fo.setSecurityCenterStateLoader({key:t,value:!1}))}}function*Ag({key:e,tableState:t,updateStateKey:n,_offset:o,_limit:i,_preset:a,_email:r,_maxInactiveSeconds:l}){var s,c,u,d;yield Di(Fo.setSecurityCenterStateError({key:e,value:!1})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0}));const y=null!=(s=null!=o?o:null==t||null==(c=t.queryParams)?void 0:c._offset)?s:0,f=null!=(u=null!=i?i:null==t||null==(d=t.queryParams)?void 0:d._limit)?u:10,p=U({_offset:y,_limit:f,_includeSubTenants:!1,_preset:a,_maxInactiveSeconds:l},!!r&&{_email:r});try{const{items:t,_metadata:{totalItems:o,totalPages:i}}=yield Fi(xf.users.getUsersV3,p),a={totalUsersItems:o,totalUsersPages:i,usersPageOffset:y,queryParams:U({_offset:y,_limit:f,_maxInactiveSeconds:l},!!r&&{_email:r})};if(t.length){const e=yield function*(e){const t=e.map((e=>e.id)),n=yield Fi(xf.roles.getRoles),o=yield Fi(xf.users.getUsersRoles,{ids:t});return e.map((e=>{var t,i;const a=null==o||null==(t=o.find((t=>t.userId===e.id)))?void 0:t.roleIds;return U({},e,{roles:null!=(i=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?i:[]})}))}(t);yield Di(Fo.setSecurityCenterState({[n]:U({users:e},a)}))}else yield Di(Fo.setSecurityCenterState({[n]:U({users:[]},a)}))}catch(t){yield Di(Fo.setSecurityCenterStateError({key:e,value:og(t)}))}finally{yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*bg({payload:e}){var t;const n=fg.BREACHED_PASSWORD_USERS_TABLE,o=yield null!=(t=Vi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield Ag(U({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:yo.BREACHED_PASSWORDS,tableState:o},e))}function*Tg({payload:e}){var t;const n=fg.UNENROLLED_MFA_USERS_TABLE,o=yield null!=(t=Vi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield Ag(U({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:yo.MFA_UNENROLLED,tableState:o},e))}function*kg({payload:e}){var t;const n=fg.INACTIVE_USERS_TABLE,o=yield null!=(t=Vi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield Ag(U({key:n,updateStateKey:"inactiveUsersTable",_preset:yo.INACTIVE,tableState:o},e))}function*Eg(){yield Ua(Fo.loadRecommendations,Sg),yield Ua(Fo.loadInsights,vg),yield Ua(Fo.sendResetBreachedPasswordEmail,hg),yield Ua(Fo.sendBulkResetBreachedPasswordEmails,mg),yield Ua(Fo.loadBreachedPasswordUsers,bg),yield Ua(Fo.loadUnenrolledMfaUsers,Tg),yield Ua(Fo.loadInactiveUsers,kg)}function*Ig(){const e=fg.RECOMMENDATIONS;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield xi(500),yield Di(Fo.setSecurityCenterState({recommendations:xp.recommendations.items,score:xp.scoring.score})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*Pg(){const e=fg.INSIGHTS;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield xi(500),yield Di(Fo.setSecurityCenterState({insights:Bp.insights.items})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*Lg(){const e=fg.BREACHED_PASSWORD_USERS_TABLE;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield xi(500),yield Di(Fo.setSecurityCenterState({breachedPasswordUsersTable:jp})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*Og(){const e=fg.UNENROLLED_MFA_USERS_TABLE;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield xi(500),yield Di(Fo.setSecurityCenterState({unenrolledMfaUsersTable:Kp})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*_g(){const e=fg.INACTIVE_USERS_TABLE;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield xi(500),yield Di(Fo.setSecurityCenterState({inactiveUsersTable:Wp})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*wg({payload:{callback:e}}){const t=fg.SEND_BREACHED_PASSWORD_EMAIL;yield Di(Fo.setSecurityCenterStateLoader({key:t,value:!0})),yield xi(500),null==e||e(!0),yield Di(Fo.setSecurityCenterStateLoader({key:t,value:!1}))}function*Cg(){yield Ua(Fo.loadRecommendations,Ig),yield Ua(Fo.loadInsights,Pg),yield Ua(Fo.loadBreachedPasswordUsers,Lg),yield Ua(Fo.loadUnenrolledMfaUsers,Og),yield Ua(Fo.loadInactiveUsers,_g),yield Ua(Fo.sendResetBreachedPasswordEmail,wg)}const Ug=["callback"],Rg=["callback"],Dg=["callback"],Ng=["callback"],Mg=["callback"],Fg=["callback"];function*Gg(){yield Di(Fo.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getGlobalSecurityPolicy);yield Di(Fo.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyGlobalState({error:og(e),loading:!1}))}yield Di(Fo.loadSecurityPolicyMfa()),yield Di(Fo.loadSecurityPolicyVendorMfa()),yield Di(Fo.loadSecurityPolicyLockout()),yield Di(Fo.loadSecurityPolicyVendorLockout()),yield Di(Fo.loadSecurityPolicyVendorPasswordHistory()),yield Di(Fo.loadSecurityPolicyCaptcha()),yield Di(Fo.loadPublicAuthStrategiesPolicy())}function*$g(e){var t,n;if(!(yield Fi(ug)))return e;const o=yield Fi(xg);return null!=o&&null!=(t=o.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?U({},e,{authStrategy:o.mainAuthStrategies[0].strategy}):e}function*Vg(){yield Di(Fo.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getVendorConfig),t=yield $g(e);yield Di(Fo.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyPublicState({error:og(e),loading:!1}))}}function*xg(){const e=yield Vi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Fi(xf.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield Fi(xf.auth.getVendorPublicAuthStrategiesConfig),t}function*Bg(){yield Di(Fo.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield Fi(xg);yield function*(e){const t=yield Fi(ug);if(!e||!t)return;const{policy:n}=yield Vi((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield Di(Fo.setSecurityPolicyPublicState({policy:U({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield Di(Fo.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyAuthStrategyPublicState({error:og(e),loading:!1}))}}function*jg(){yield Di(Fo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getMfaPolicy);yield Di(Fo.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyMfaState({error:og(e),loading:!1}))}}function*Wg(){yield Di(Fo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getVendorMfaPolicy);yield Di(Fo.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyVendorMfaState({error:og(e),loading:!1}))}}function*Kg(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Ug);yield Di(Fo.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Fi(xf.auth.saveMfaPolicy,n);yield Di(Fo.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setSecurityPolicyMfaState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*Hg(){yield Di(Fo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getLockoutPolicy);yield Di(Fo.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyLockoutState({error:og(e),loading:!1}))}}function*zg(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Rg);yield Di(Fo.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Fi(xf.auth.saveLockoutPolicy,n);yield Di(Fo.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setSecurityPolicyLockoutState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*qg(){yield Di(Fo.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getVendorLockoutPolicy);yield Di(Fo.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyVendorLockoutState({error:og(e),loading:!1}))}}function*Yg(){yield Di(Fo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getCaptchaPolicy);yield Di(Fo.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyCaptchaState({error:og(e),loading:!1}))}}function*Jg(){yield Di(Fo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getPasswordHistoryPolicy);yield Di(Fo.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyPasswordHistoryState({error:og(e),loading:!1}))}}function*Qg(){yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getVendorPasswordHistoryPolicy);yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({error:og(e),loading:!1}))}}function*Xg(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Dg);yield Di(Fo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Fi(xf.auth.savePasswordHistoryPolicy,n);yield Di(Fo.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setSecurityPolicyPasswordHistoryState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*Zg(){yield Di(Fo.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getPasswordConfigPolicy);yield Di(Fo.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyPasswordState({error:og(e),loading:!1}))}}function*eS(){yield Da(Fo.loadSecurityPolicy,Gg),yield Ua(Fo.saveSecurityPolicyMfa,gg(Kg)),yield Ua(Fo.loadSecurityPolicyMfa,jg),yield Ua(Fo.loadSecurityPolicyVendorMfa,Wg),yield Ua(Fo.saveSecurityPolicyLockout,gg(zg)),yield Ua(Fo.loadSecurityPolicyLockout,Hg),yield Ua(Fo.loadSecurityPolicyVendorLockout,qg),yield Ua(Fo.loadSecurityPolicyCaptcha,Yg),yield Ua(Fo.saveSecurityPolicyPasswordHistory,gg(Xg)),yield Ua(Fo.loadSecurityPolicyPasswordHistory,Jg),yield Ua(Fo.loadSecurityPolicyVendorPasswordHistory,Qg),yield Ua(Fo.loadVendorPasswordConfig,Zg),yield Ua(Fo.loadPublicSecurityPolicy,Vg),yield Ua(Fo.loadPublicAuthStrategiesPolicy,Bg)}function*tS(){yield Di(Fo.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Di(Fo.setSecurityPolicyPublicState({policy:Sp,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyPublicState({error:og(e),loading:!1}))}}function*nS(){yield Di(Fo.setSecurityPolicyGlobalState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyGlobalState({policy:gp,loading:!1})),yield Di(Fo.loadSecurityPolicyMfa()),yield Di(Fo.loadSecurityPolicyVendorMfa()),yield Di(Fo.loadSecurityPolicyLockout()),yield Di(Fo.loadSecurityPolicyVendorLockout()),yield Di(Fo.loadSecurityPolicyPasswordHistory()),yield Di(Fo.loadSecurityPolicyVendorPasswordHistory()),yield Di(Fo.loadSecurityPolicyCaptcha())}function*oS(){yield Di(Fo.setSecurityPolicyMfaState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyMfaState({policy:vp,loading:!1}))}function*iS(){yield Di(Fo.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyVendorMfaState({policy:vp,loading:!1}))}function*aS(e){var t;let{payload:{callback:n}}=e,o=Jo(e.payload,Ng);yield Di(Fo.setSecurityPolicyMfaState({saving:!0,error:null}));const i=U({},hp,{id:null!=(t=o.id)?t:hp.id,enforceMFAType:o.enforceMFAType});yield bt(),yield Di(Fo.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*rS(){yield Di(Fo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyLockoutState({policy:hp,loading:!1}))}function*lS(){yield Di(Fo.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyVendorLockoutState({policy:hp,loading:!1}))}function*sS(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Mg);yield Di(Fo.setSecurityPolicyLockoutState({saving:!0,error:null})),yield bt();const o=U({},hp,n,{id:n.id?n.id:hp.id});null==t||t(o),yield Di(Fo.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*cS(){yield Di(Fo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyLockoutState({policy:hp,loading:!1}))}function*uS(){yield Di(Fo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyPasswordHistoryState({policy:mp,loading:!1}))}function*dS(){yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({policy:mp,loading:!1}))}function*yS(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Fg);yield Di(Fo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield bt();const o=U({},mp,n,{id:n.id?n.id:mp.id});null==t||t(o),yield Di(Fo.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*fS(){yield Da(Fo.loadSecurityPolicy,nS),yield Ua(Fo.loadPublicSecurityPolicy,tS),yield Ua(Fo.saveSecurityPolicyMfa,aS),yield Ua(Fo.loadSecurityPolicyMfa,oS),yield Ua(Fo.loadSecurityPolicyVendorMfa,iS),yield Ua(Fo.saveSecurityPolicyLockout,sS),yield Ua(Fo.loadSecurityPolicyLockout,rS),yield Ua(Fo.loadSecurityPolicyVendorLockout,lS),yield Ua(Fo.loadSecurityPolicyCaptcha,cS),yield Ua(Fo.saveSecurityPolicyPasswordHistory,yS),yield Ua(Fo.loadSecurityPolicyPasswordHistory,uS),yield Ua(Fo.loadSecurityPolicyVendorPasswordHistory,dS)}const pS=["events","url"];function*gS(){yield Di(Fo.setSignUpState({loading:!0}));try{const e=yield Fi(xf.auth.getVendorConfig),t=yield $g(e),{allowSignups:n,allowNotVerifiedUsersLogin:o}=e;yield Di(Fo.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:o,firstLoad:!1})),yield Di(Fo.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Di(Fo.setSignUpState({loading:!1,error:og(e),firstLoad:!1}))}}function*SS(e){let{payload:{events:t,url:n}}=e,o=Jo(e.payload,pS);yield Di(Fo.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield Vi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c,tenants:u=[],activeTenant:d}=yield Fi(xf.auth.signUpUser,o);if(!o.invitationToken){var i;const{email:e,name:a,companyName:r}=o,l={email:e,name:a,companyName:r,url:n,authenticationType:zp.PASSWORD,id:c,tenantId:s,createdAt:new Date};null==t||null==(i=t.signUpComplete)||i.call(t,l),ag(ig.SIGNUP_COMPLETED,l)}if(!r&&l&&Zp(l)){const t=yield ng(l);yield Di(Fo.setState(t)),a(e.loginUrl)}else{const{tenantsState:e}=yield Vi((e=>e.auth));yield Di(Fo.setSignUpState({loading:!1,shouldActivate:r,stage:vn.SignUpSuccess})),yield Di(Fo.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:U({},e,{tenants:u,activeTenant:d})}))}}catch(e){Na.setAccessToken(null),Na.setUser(null),yield Di(Fo.setSignUpState({loading:!1,error:og(e)}))}yield Di(Fo.setSignUpState({loading:!1}))}function*vS(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Vi((e=>e.auth.signUpState));yield Di(Fo.resetSignUpState()),yield Di(Fo.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*hS(){yield Da(Fo.signUpUser,SS),yield Da(Fo.resetSignUpStateSoft,vS)}const mS={setVendorState:(e,{payload:t})=>U({},e,t)},AS={loadVendorPublicInfo:ut("vendor/loadVendorPublicInfo")},bS={loading:!1},{reducer:TS,actions:kS}=yt({name:Dt,initialState:bS,reducers:U({},mS)}),ES=U({},kS,AS);function*IS(){yield Di(ES.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield xf.vendor.getVendorPublicInfo();yield Di(ES.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Di(ES.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var PS=n(378),LS=n.n(PS);function OS(e,t){return LS()(e,t)}function*_S({payload:e}){const t=null==e?void 0:e.callback;try{const e=yield Fi(xf.entitlements.loadEntitlements);yield function*(e){OS(yield Vi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield Di(Fo.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*wS(){yield Da(Fo.loadEntitlements,_S)}const CS=["callback"],US=["callback"],RS=["callback"],DS=["callback"],NS=["callback","events"],MS=["callback"],FS=["callback"],GS=["callback"],$S=["callback"],VS=["user"],xS=["callback"],BS=["callback"],jS=["callback"],WS=["callback"],KS=["callback"],HS=["callback","deviceId"],zS=["callback"],qS=["callback"],YS=["callback","deviceId"],JS=["callback","deviceId"],QS=["callback","deviceId"];function*XS(e){const t=yield Vi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return OS(t,null==e?void 0:e.entitlements)?U({},e,{entitlements:t}):e}function*ZS({user:e,tenants:t=[],activeTenant:n},o={}){const{tenantsState:i}=yield Vi((e=>e.auth));yield Di(Fo.setState(U({user:e,tenantsState:U({},i,{tenants:t,activeTenant:n,loading:!1})},o)))}function*ev(){const e=Na.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:o=!1,allowedRedirectOrigins:i=[]}=yield Vi((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:l,activateUrl:s}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;u||(yield Fi(dg),u=yield Vi((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})));const d=window.localStorage.getItem(_t);d&&![a,r,l,s].includes(d)&&(c=d),window.localStorage.removeItem(_t),yield bt(200),Di(Fo.resetLoginState());const y=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:o})=>{let i=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),o=new URL(e),i=o.origin===n.origin;return t.includes(o.origin)||i})(a,n)?i=a:console.warn("The redirect url param is not valid, the origin is a different site"):i=a:o&&(i+=window.location.search),i})({authenticatedUrl:u?Jp(u):c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(y,{refresh:y.startsWith("http")})}function*tv(){let e;try{var t;const n=yield Fi(xf.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield Di(Fo.setState({ssoACS:e}))}function*nv(){try{const{isActive:e}=yield Fi(xf.auth.getSSOPublicConfiguration);yield Di(Fo.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*ov(e){var t;const{routes:n,loginState:o}=yield Vi((e=>e.auth)),i=null!=(t=localStorage.getItem("register-quick-login"))?t:o.quickLoginToRegister;return i&&"true"!==localStorage.getItem(`${e.id}-${i}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*iv(){const{hostedLoginBox:e}=yield Vi((e=>e.auth));e?yield Fi(av):yield Fi(lv)}function*av(){const{user:e}=yield Vi((e=>e.auth));if(null==e||!e.refreshToken)return Na.setAccessToken(null),Na.setUser(null),void(yield Di(Fo.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Fi(xf.auth.exchangeOAuthTokensV2,t),o=yield Fi(XS,n.user);yield Fi(ZS,U({},n,{user:o}),{isAuthenticated:!0})}catch(e){Na.setAccessToken(null),Na.setUser(null),yield Di(Fo.setState({user:null,isAuthenticated:!1}))}}function*rv(){const{user:e}=yield Vi((e=>e.auth));if(null==e||!e.refreshToken)return Na.setAccessToken(null),Na.setUser(null),void(yield Di(Fo.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Fi(xf.auth.exchangeOAuthTokensV2,t),o=yield Fi(XS,n.user);yield Fi(ZS,U({},n,{user:o}),{isAuthenticated:!0})}catch(e){Na.setAccessToken(null),Na.setUser(null),yield Di(Fo.setState({user:null,isAuthenticated:!1}))}}function*lv(){try{const t=Na.onRedirectTo,{routes:n,loginState:o}=yield Vi((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Fi(xf.auth.refreshTokenV3);if(Zp(i)){const e=yield ng(i);yield Di(Fo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield ov(i),l=yield Fi(XS,i);yield Fi(ZS,{user:l,tenants:a,activeTenant:r},{loginState:U({},o,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield cv(n)}}catch(e){Na.setAccessToken(null),Na.setUser(null),yield Di(Fo.setState({user:void 0,isAuthenticated:!1}))}}function*sv(){try{const t=Na.onRedirectTo,{routes:n,loginState:o}=yield Vi((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Fi(xf.auth.refreshTokenV3);if(Zp(i)){const e=yield ng(i);yield Di(Fo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const l=yield Fi(XS,i);if(yield Fi(Ev))yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})),yield Fi(ZS,{user:l,tenants:a,activeTenant:r},{isLoading:!1}),t(n.loginUrl,{preserveQueryParams:!0});else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield ov(i);yield Fi(ZS,{user:l,tenants:a,activeTenant:r},{loginState:U({},o,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield cv(n)}}}catch(e){Na.setAccessToken(null),Na.setUser(null),yield Di(Fo.setState({user:void 0,isAuthenticated:!1}))}}function*cv(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=Na.onRedirectTo,{routes:i,loginState:a}=yield Vi((e=>e.auth)),r=n.searchParams.get("invitationToken"),l=[i.socialLoginCallbackUrl,i.oidcRedirectUrl,i.samlCallbackUrl];r||l.push(i.loginUrl,i.signUpUrl),e?o(i.loginUrl):l.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&i.signUpSuccessUrl&&i.socialLoginCallbackUrl===window.location.pathname?o(i.signUpSuccessUrl,{refresh:i.signUpSuccessUrl.startsWith("http")}):yield ev())}function*uv({payload:{callback:e}}){try{const{ip:t}=yield Fi(xf.metadata.getCurrentUserIpMetadata);yield Di(Fo.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*dv({payload:e}){const t=[];(yield Fi(ug))?yield Fi(iv):t.push(Fi(iv)),e&&(yield Di(Fo.setState({isLoading:!0})),yield Di(Fo.loadSocialLoginsConfigurationV2()),t.push(Fi(gS)),t.push(Fi(Bg)),t.push(Fi(nv)),t.push(Fi(IS)),t.push(Fi(tv)),t.push(Fi(dg))),yield Ni(t),yield Di(Fo.setState({isLoading:!1}))}function*yv({accessToken:e,user:t}){if(!e)return void(yield Di(Fo.setState({user:void 0,isAuthenticated:!1})));const n=Na.onRedirectTo,{routes:o}=yield Vi((e=>e.auth));if(Zp(t)){const e=yield ng(t);yield Di(Fo.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*fv({payload:e}){const t=[];yield Di(Fo.loadSocialLoginsConfigurationV2()),t.push(Fi(gS)),t.push(Fi(nv)),t.push(Fi(IS)),t.push(Fi(tv)),t.push(Fi(yv,e)),t.push(Fi(dg)),yield Ni(t)}const pv=e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}};function*gv(){const e=yield Fi(xf.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield Fi(ZS,e,{isAuthenticated:!0,isLoading:!1})}function*Sv({payload:e}){const{disableSilentRefresh:t}=yield Vi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield gv()}catch(t){yield hv(e)}}function*vv({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n}}){if(n){const{urlStrategy:e}=yield Vi((e=>({urlStrategy:e.root.urlStrategy}))),t=pv(e);if(yield Di(Fo.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:o}=yield Vi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(o)throw new Error("silent refresh is disabled");yield gv()}catch(n){if(!t)return void(yield Di(Fo.setState({isLoading:!1})));yield hv(e)}}function*hv(e){const{routes:t,context:n,onRedirectTo:o,urlStrategy:i}=yield Vi((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(pv(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield Di(Fo.setState({isLoading:!0}));const a=rp(),r=rp(),l=yield Fi(ap,r);localStorage.setItem(wt,r);let s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`;yield Fi(dg);const c=yield Vi((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));c&&(s.endsWith("/")&&(s=s.slice(0,-1)),s+=c);const u=`${Tr(n,"/oauth/authorize")}/oauth/authorize`,d=U({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);if(n.tenantResolver){var y;const e=yield null==(y=n.tenantResolver)?void 0:y.call(n);null!=e&&e.tenant&&(d.organization=e.tenant)}const f=Qp(Xp);f&&(d.tenantId=f),o(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*mv({payload:e}){const t=localStorage.getItem(wt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:o}=yield Vi((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let i=`${window.location.origin}${"path"===o?"":"#"}${n.hostedLoginRedirectUrl}`;yield Fi(dg);const a=yield Vi((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));a&&(i.endsWith("/")&&(i=i.slice(0,-1)),i+=a);const r={code:e.code,redirect_uri:i,code_verifier:t,grant_type:"authorization_code"};try{const e=yield Fi(xf.auth.exchangeOAuthTokensV2,r);yield Fi(ZS,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield Di(Fo.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{yield ev()}}function*Av(e){let{payload:{callback:t}}=e,n=Jo(e.payload,CS);try{yield Di(Fo.setLoginState({loading:!0}));const e=yield Fi(xf.auth.changePhoneNumberWithVerification,n);yield Di(Fo.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Pt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:og(e),loading:!1}))}}function*bv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,US);try{yield Di(Fo.setLoginState({loading:!0})),yield Fi(xf.auth.verifyChangePhoneNumber,n),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:og(e),loading:!1}))}}function*Tv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,RS);try{yield Di(Fo.setLoginState({loading:!0}));const e=yield Fi(xf.auth.passwordlessPreLogin,U({},n,{type:ko.SmsCode}));yield Di(Fo.setLoginState({step:Pt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:og(e),loading:!1})),null==t||t(e)}}function*kv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,DS);try{let e;yield Di(Fo.setLoginState({loading:!0})),function(e){return"email"in e}(n)&&(e=n.email);const o=yield Fi(xf.auth.passwordlessPreLogin,n),i=Io[n.type];yield Di(Fo.setLoginState({step:i,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:e,error:void 0})),null==t||t()}catch(e){yield Di(Fo.setLoginState({error:og(e),loading:!1})),null==t||t()}}function*Ev(){const{publicAuthStrategyPolicy:e}=yield Vi((e=>e.auth.securityPolicyState)),{policy:t}=e,n=(e=>{var t;return!(null==e||null==(t=e.secondaryAuthStrategies)||!t.some((({isActive:e,strategy:t})=>e&&t===Sl.Passkeys)))})(t),o="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield Fi(sp,["show-passkeys-new"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield Fi(xf.auth.getWebAuthnDevices);return yield Di(Fo.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*Iv(e){let{payload:{callback:t,events:n}}=e,o=Jo(e.payload,NS);try{yield Di(Fo.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield Fi(xf.auth.passwordlessPostLoginV2,o),l=Na.onRedirectTo,{routes:s}=yield Vi((e=>e.auth));if(Zp(e)){const t=yield ng(e);yield Di(Fo.setState(t)),l(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield Vi((e=>e.auth));if(e.emailVerified){var i;const t={email:e.email,origin:Hp.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name};null==n||null==(i=n.userVerified)||i.call(n,t),ag(ig.USER_VERIFIED,t)}e.id&&localStorage.setItem("userId",e.id),yield Fi(ZS,{user:e,tenants:a,activeTenant:r}),yield Di(Fo.setLoginState({error:void 0})),yield Di(Fo.setState({isLoading:!1})),o.flow===Lt.Login?(yield Fi(Ev))?(yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})),l(s.loginUrl,{preserveQueryParams:!0})):(yield Di(Fo.setState({isAuthenticated:!0})),yield ev()):l(s.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield Di(Fo.setLoginState({error:og(e,"Failed to authenticate")}))}finally{yield Di(Fo.setLoginState({loading:!1}))}}function*Pv({payload:e}){try{yield Di(Fo.setLoginState({loading:!0}));const{name:t}=yield Fi(xf.auth.verifyInviteToken,e);yield Di(Fo.setLoginState({inviteTokenTenantName:t}))}catch(e){yield Di(Fo.setLoginState({inviteTokenError:og(e,"We couldn't verify your invitation")}))}finally{yield Di(Fo.setLoginState({loading:!1}))}}function*Lv({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:o}}){yield Di(Fo.setLoginState({loading:!0}));try{const i=yield Vi((({auth:{onRedirectTo:e}})=>e)),a=Qp(Xp),{address:r,idpType:l}=yield Fi(xf.auth.preLoginV2,{email:e,tenantId:a});if(r){let e=r;if(l===Wf.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield Vi((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield Di(Fo.setLoginState({step:Pt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{i(e,{refresh:!0})}),2e3)}else yield Ov({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield Ov({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*Ov(e){let{callback:t}=e,n=Jo(e,MS);const o=yield Vi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==o||!o.authStrategy)return yield Di(Fo.setLoginState({step:Pt.loginWithPassword,loading:!1})),void(null==t||t());(null==o?void 0:o.authStrategy)===ko.EmailAndPassword?(yield Di(Fo.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t()):[ko.MagicLink,ko.Code,ko.SmsCode].includes(null==o?void 0:o.authStrategy)?yield Di(Fo.passwordlessPreLogin(U({},n,{type:null==o?void 0:o.authStrategy,callback:t}))):(yield Di(Fo.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t())}function*_v({payload:{callback:e}}){try{yield Di(Fo.setLoginState({loading:!0}));const{options:t}=yield Fi(xf.auth.webAuthnCreateNewDeviceSession);t.user.id=Et(t.user.id),t.challenge=Et(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield Di(Fo.setLoginState({error:og(t)})),null==e||e(null)}finally{yield Di(Fo.setLoginState({loading:!1}))}}function*wv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,FS);try{yield Di(Fo.setLoginState({loading:!0}));const e=It(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?vl.Platform:vl.CrossPlatform;yield Fi(xf.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:og(e)})),null==t||t(null)}finally{yield Di(Fo.setLoginState({loading:!1}))}}function*Cv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,GS);try{var o;yield Di(Fo.setPasskeysState({loading:!0})),yield Di(Fo.setLoginState({loading:!0}));const{options:e}=yield Fi(xf.auth.webAuthnPreLogin,n);e.challenge=Et(e.challenge),e.allowCredentials=null==(o=e.allowCredentials)?void 0:o.map((e=>U({},e,{id:Et(e.id)}))),yield Di(Fo.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield Di(Fo.setLoginState({error:og(e)})),null==t||t(null)}finally{yield Di(Fo.setPasskeysState({loading:!1})),yield Di(Fo.setLoginState({loading:!1}))}}function*Uv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,$S);try{var o;yield Di(Fo.setPasskeysState({loading:!0})),yield Di(Fo.setLoginState({loading:!0}));const e=It(n.publicKey),i=yield Fi(xf.auth.webAuthnPostLoginV2,U({},e,{response:U({},e.response,{userHandle:null!=(o=e.response.userHandle)?o:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken})),{user:a}=i,r=Jo(i,VS);if(Zp(a)){const e=Na.onRedirectTo,{routes:t}=yield Vi((e=>e.auth)),n=yield ng(a);yield Di(Fo.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield Fi(ZS,U({user:a},r),{isAuthenticated:!0}),yield Di(Fo.setLoginState({error:void 0})),yield ev(),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:og(e)})),null==t||t(null)}finally{yield Di(Fo.setPasskeysState({loading:!1})),yield Di(Fo.setLoginState({loading:!1}))}}function*Rv({payload:e}){const{onRedirectTo:t,routes:n}=yield Vi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Di(Fo.setLoginState({loading:!0}));try{const t=yield Fi(xf.auth.postLogin,e);yield Di(Fo.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield ev()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Di(Fo.setLoginState({step:Pt.loginWithSSOFailed,loading:!1}))}}function*Dv({payload:{email:e,password:t,recaptchaToken:n,invitationToken:o,callback:i}}){yield Di(Fo.setLoginState({loading:!0}));try{const{user:a,tenants:r=[],activeTenant:l}=yield Fi(xf.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:o}),s=Na.onRedirectTo,{routes:c}=yield Vi((e=>e.auth));if(Zp(a)){const e=yield ng(a);yield Di(Fo.setState(e)),s(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Vi((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield Fi(ZS,{user:a,tenants:r,activeTenant:l},{loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===Lt.Login?Pt.success:t.step,tenants:r,tenantsLoading:!0,isBreachedPassword:a.isBreachedPassword},isAuthenticated:n});const[o]=yield Fi(sp,["security-center-show-login-flows"]);t.flow===Lt.Login&&(o&&a.isBreachedPassword&&!n?yield Di(Fo.setLoginState({step:Pt.breachedPassword,loading:!1})):n&&((yield Fi(Ev))?(yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})),s(c.loginUrl,{preserveQueryParams:!0})):yield ev()))}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){Na.setAccessToken(null),Na.setUser(null),null==i||i(!1,t),yield Di(Fo.setLoginState({email:e,error:og(t),loading:!1}))}}function*Nv({payload:{mfaToken:e,value:t,rememberDevice:n,callback:o}}){yield Di(Fo.setLoginState({loading:!0}));try{const{user:i,tenants:a=[],activeTenant:r}=yield Fi(xf.auth.loginWithMfaV2,{mfaToken:e,value:t,rememberDevice:n}),{loginState:l}=yield Vi((e=>e.auth)),s=l.flow===Lt.Login?Pt.success:l.step,c=!!i.accessToken;yield Fi(ZS,{user:i,tenants:a,activeTenant:r},{loginState:{flow:l.flow,quickLoginToRegister:l.quickLoginToRegister,loading:!1,step:s,error:void 0,tenants:a},isAuthenticated:c}),i.id&&localStorage.setItem("userId",i.id),yield Di(Fo.setLoginState({error:void 0,loading:!1}));const[u]=yield Fi(sp,["security-center-show-login-flows"]);l.flow===Lt.Login&&(u&&l.isBreachedPassword&&!c?yield Di(Fo.setLoginState({step:Pt.breachedPassword,loading:!1})):(yield Fi(Ev))?yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield ev()),null==o||o(!0)}catch(e){yield Di(Fo.setLoginState({error:og(e),loading:!1})),null==o||o(!1,e)}}function*Mv({payload:e}){yield Di(Fo.setLoginState({loading:!0}));try{var t;yield Fi(xf.auth.recoverMfaToken,e),yield Di(Fo.setLoginState({loading:!1,error:void 0,step:Pt.preLogin})),yield Di(Fo.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setLoginState({error:og(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Fv({payload:e}){const{hostedLoginBox:t}=yield Vi((e=>e.auth));yield Di(Fo.setState({isLoading:!0}));try{t?yield Fi(xf.auth.OAuthLogout):yield Fi(xf.auth.logout)}catch{}yield Di(Fo.resetState()),yield Di(Fo.requestAuthorize(!0)),null==e||e()}function*Gv({payload:e}){var t;try{yield Fi(xf.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*$v({user:e,tenants:t,activeTenant:n}){const o={step:ln.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(o.recoveryCode=e.recoveryCode),yield Di(Fo.setMfaState(o)),yield Di(Fo.setUser(e)),yield Di(Fo.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Vv({user:e,tenants:t,activeTenant:n}){const{loginState:o}=yield Vi((e=>e.auth));yield Di(Fo.setUser(e)),yield Di(Fo.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield Vi((e=>e.auth.mfaState)),[a]=yield Fi(sp,["security-center-show-login-flows"]),r=!!e.accessToken;if(o.flow===Lt.Login)if(a&&o.isBreachedPassword&&!r)yield Di(Fo.setLoginState({step:Pt.breachedPassword,loading:!1}));else{const e=yield Fi(Ev);i===ln.smsVerifyCode&&e?yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield ev()}yield Di(Fo.setState({isAuthenticated:r}))}function*xv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,xS);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(xf.auth.preEnrollMFASMSForLogin,n);yield Di(Fo.setMfaState({otcToken:e.otcToken,step:ln.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Bv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,BS);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(xf.auth.enrollMFASMSForLoginV2,n);yield $v(e),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*jv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,jS);yield Di(Fo.setLoginState({loading:!0}));try{var o;const e=yield Fi(xf.auth.preEnrollMFAWebAuthnForLogin,n),i=U({},e.options,{challenge:Et(e.options.challenge),user:U({},e.options.user,{id:Et(e.options.user.id)}),excludeCredentials:null==(o=e.options.excludeCredentials)?void 0:o.map((e=>U({},e,{id:Et(e.id)})))});yield Di(Fo.setLoginState({loading:!1})),null==t||t({options:i,webauthnToken:e.webauthnToken})}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Wv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,WS);yield Di(Fo.setLoginState({loading:!0}));try{const e=It(n.publicKey),o=yield Fi(xf.auth.enrollMFAWebAuthnForLoginV2,U({},n,{options:e}));yield $v(o),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Kv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,KS);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(xf.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield $v(e),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Hv(e){let{payload:{callback:t,deviceId:n}}=e,o=Jo(e.payload,HS);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(xf.auth.preVerifyMFASMSForLogin,n,o);yield Di(Fo.setMfaState({otcToken:e.otcToken,step:ln.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*zv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,zS);try{const e=yield Fi(xf.auth.preVerifyMFAEmailCode,n);yield Di(Fo.setMfaState({otcToken:e.otcToken,step:ln.emailVerifyCode})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:og(e)})),null==t||t(null)}}function*qv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,qS);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(xf.auth.verifyMFAEmailCodeV2,n);yield Vv(e),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Yv(e){let{payload:{callback:t,deviceId:n}}=e,o=Jo(e.payload,YS);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(xf.auth.verifyMFASMSForLoginV2,n,o);yield Vv(e),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Jv(e){let{payload:{callback:t,deviceId:n}}=e,o=Jo(e.payload,JS);yield Di(Fo.setLoginState({loading:!0}));try{var i;const e=yield Fi(xf.auth.preVerifyMFAWebAuthnForLogin,n,o),a=U({},e.options,{challenge:Et(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>U({},e,{id:Et(e.id)})))});yield Di(Fo.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Qv(e){let{payload:{callback:t,deviceId:n}}=e,o=Jo(e.payload,QS);yield Di(Fo.setLoginState({loading:!0}));try{const e=It(o.publicKey),i=yield Fi(xf.auth.verifyMFAWebAuthnForLoginV2,n,U({},o,{options:e}));yield Vv(i),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)})),null==t||t(null)}}function*Xv({payload:e}){yield Di(Fo.setLoginState({loading:!0}));try{yield Fi(xf.auth.forgotPassword,e),yield Di(Fo.setLoginState({loading:!1,error:void 0,step:Pt.breachedPasswordSuccess})),yield Di(Fo.setState({isAuthenticated:!1}))}catch(e){yield Di(Fo.setLoginState({loading:!1,error:og(e)}))}}function*Zv(){yield Da(Fo.requestAuthorize,dv),yield Da(Fo.requestAuthorizeSSR,fv),yield Da(Fo.requestHostedLoginAuthorize,Sv),yield Da(Fo.requestHostedLoginAuthorizeV2,vv),yield Da(Fo.handleHostedLoginCallback,mv),yield Da(Fo.preLogin,Lv),yield Da(Fo.postLogin,Rv),yield Da(Fo.login,Dv),yield Da(Fo.logout,Fv),yield Da(Fo.silentLogout,Gv),yield Da(Fo.loginWithMfa,Nv),yield Da(Fo.recoverMfa,Mv),yield Da(Fo.quickSmsPasswordlessPreLogin,Tv),yield Da(Fo.changePhoneNumberWithVerification,Av),yield Da(Fo.verifyChangePhoneNumber,bv),yield Da(Fo.passwordlessPreLogin,kv),yield Da(Fo.passwordlessPostLogin,Iv),yield Da(Fo.verifyInviteToken,Pv),yield Da(Fo.webAuthnPrelogin,Cv),yield Da(Fo.webAuthnPostLogin,Uv),yield Da(Fo.webAuthnCreateNewDeviceSession,_v),yield Da(Fo.webAuthnVerifyNewDeviceSession,wv),yield Da(Fo.afterAuthNavigation,ev),yield Da(Fo.getUserIP,uv),yield Da(Fo.preEnrollMFASMSForLogin,xv),yield Da(Fo.enrollMFASMSForLogin,Bv),yield Da(Fo.preEnrollMFAWebAuthnForLogin,jv),yield Da(Fo.enrollMFAWebAuthnForLogin,Wv),yield Da(Fo.enrollMFAAuthenticatorAppForLogin,Kv),yield Da(Fo.preVerifyMFASMSForLogin,Hv),yield Da(Fo.verifyMFASMSForLogin,Yv),yield Da(Fo.preVerifyMFAWebAuthnForLogin,Jv),yield Da(Fo.verifyMFAWebAuthnForLogin,Qv),yield Da(Fo.preVerifyMFAEmailCode,zv),yield Da(Fo.verifyMFAEmailCode,qv),yield Da(Fo.resetBreachedPassword,Xv)}function*eh({payload:e}){e&&(yield Di(Fo.setState({isLoading:!0})));const t=fp;yield Di(Fo.loadTenants()),yield Di(Fo.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*th({payload:{callback:e}}){try{const{ip:t}=Fp[0];yield Di(Fo.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*nh(){yield Da(Fo.requestAuthorize,eh),yield Da(Fo.afterAuthNavigation,ev),yield Da(Fo.getUserIP,th)}const oh=["callback","samlVendor"],ih=["callback","samlVendor"];function*ah(){try{var e,t;yield Di(Fo.setSSOState({loading:!0}));const n=yield Fi(xf.auth.getSamlConfiguration),o=yield Fi(xf.auth.getOidcConfiguration),i=yield Fi(xf.metadata.getSamlMetadata);n.acsUrl=null==i||null==(e=i.configuration)?void 0:e.acsUrl,n.spEntityId=null==i||null==(t=i.configuration)?void 0:t.spEntityId,n.isSamlActive=null==i?void 0:i.isActive,yield Di(Fo.setSSOState({samlConfiguration:n,oidcConfiguration:o,loading:!1,firstLoad:!1}))}catch(e){yield Di(Fo.setSSOState({error:og(e),loading:!1}))}}function*rh({payload:e}){const t=yield Vi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield Di(Fo.setSSOState({error:void 0,[n]:!0}));try{const o=yield lp(e[0]),i=yield Fi(xf.auth.updateSamlVendorMetadata,{metadata:o});i.isSamlActive=null==t?void 0:t.isSamlActive,yield Di(Fo.setSSOState({samlConfiguration:i,error:void 0,[n]:!1}))}catch(e){yield Di(Fo.setSSOState({samlConfiguration:t,error:og(e),[n]:!1}))}}function*lh({payload:e}){const{configFile:t,callback:n}=e,o=yield Vi((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield Di(Fo.setSSOState({error:void 0,[i]:!0}));try{const e=yield lp(t),a=yield Fi(xf.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==o?void 0:o.isSamlActive,yield Di(Fo.setSSOState({samlConfiguration:a,error:void 0,[i]:!1})),null==n||n(!0)}catch(e){yield Di(Fo.setSSOState({samlConfiguration:o,error:og(e),[i]:!1})),null==n||n(null,e)}}function*sh({payload:e}){const{callback:t,samlVendor:n}=e,o=Jo(e,oh),i=yield Vi((e=>e.auth.ssoState.samlConfiguration)),a=U({},i,o);let r="saving";(null==a?void 0:a.enabled)!==i.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield Di(Fo.setSSOState({samlConfiguration:U({},i,a)})));if(yield Di(Fo.setSSOState({error:void 0,[r]:!0})),e.type===Wf.Saml){var l,s;const e=yield Fi(xf.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 o=ip(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==i?void 0:i.domain)!==(null==o?void 0:o.domain)&&(o.ssoEndpoint="",o.publicCertificate="",o.signRequest=!1),o.type=null==n?void 0:n.toLowerCase();const c=yield Fi(xf.auth.updateSamlConfiguration,o);c.isSamlActive=null==i?void 0:i.isSamlActive,yield Di(Fo.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setSSOState({samlConfiguration:i,error:og(e),[r]:!1})),null==t||t(null,e)}}function*ch({payload:{callback:e}={}}){const t=yield Vi((e=>e.auth.ssoState.samlConfiguration));try{yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield Fi(xf.auth.validateSamlDomain),yield Di(Fo.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield Di(Fo.setSSOState({samlConfiguration:U({},t,{validated:!1}),error:og(n),saving:!1})),null==e||e(null,n)}}function*uh(){try{const e=yield Fi(xf.auth.getSamlRoles),t=yield Fi(xf.auth.getSamlRolesGroups);yield Di(Fo.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Di(Fo.setSSOState({error:og(e)}))}}function*dh({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield Fi(xf.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Ni(e.map((e=>Fi(xf.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Di(Fo.setSSOState({error:og(e)}))}}(n)),yield uh(),yield Di(Fo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Di(Fo.setSSOState({error:og(t),saving:!1})),null==e||e(null,t)}}function*yh({payload:{callback:e,id:t}}){try{yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield Fi(xf.auth.deleteSamlGroup,{id:t}),yield uh(),yield Di(Fo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Di(Fo.setSSOState({error:og(t),saving:!1})),null==e||e(null,t)}}function*fh({payload:{group:e,roleIds:t,callback:n}}){try{yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield Fi(xf.auth.createSamlGroup,{group:e,roleIds:t}),yield uh(),yield Di(Fo.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield Di(Fo.setSSOState({error:og(e),saving:!1})),null==n||n(null,e)}}function*ph({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Di(Fo.setSSOState({loading:!0})),yield Fi(xf.auth.oidcPostLoginV2,t),yield Fi(iv),yield Di(Fo.setSSOState({loading:!1}))}catch(e){yield Di(Fo.setSSOState({loading:!1,error:og(e,"Failed to authenticate"),firstLoad:!1}))}}function*gh(){yield Ua(Fo.loadSSOConfigurations,ah),yield Ua(Fo.saveSSOConfigurations,sh),yield Ua(Fo.saveSSOConfigurationsFile,rh),yield Ua(Fo.saveSSOConfigurationsFileWithCallback,lh),yield Ua(Fo.validateSSODomain,ch),yield Ua(Fo.loadSSOAuthorizationRoles,uh),yield Ua(Fo.updateSSOAuthorizationRoles,dh),yield Ua(Fo.deleteSamlGroup,yh),yield Ua(Fo.createSamlGroup,fh),yield Ua(Fo.oidcPostlogin,ph)}function*Sh(){yield Di(Fo.setSSOState({loading:!0})),yield bt(),yield Di(Fo.setSSOState({samlConfiguration:Ap,loading:!1,firstLoad:!1}))}function*vh({payload:e}){const t="saving";yield Di(Fo.setSSOState({error:void 0,[t]:!0}));const n=U({},yield Vi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield Di(Fo.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*hh({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Jo(e,ih),r=kp.samlConfiguration,l=U({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield Di(Fo.setSSOState({samlConfiguration:U({},r,l)})));yield Di(Fo.setSSOState({error:void 0,[s]:!0})),yield bt(),l.acsUrl=null==bp||null==(t=bp.configuration)?void 0:t.acsUrl,l.spEntityId=null==bp||null==(n=bp.configuration)?void 0:n.spEntityId;const c=ip(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==i?void 0:i.toLowerCase(),yield bt(),yield Di(Fo.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==o||o(!0)}function*mh({payload:{callback:e}={}}){const t=kp.samlConfiguration;yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield bt(),yield Di(Fo.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Ah(){yield bt(),yield Di(Fo.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*bh({payload:{callback:e,authorizationRoles:t}}){yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield bt(),yield Di(Fo.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Th(){yield Ua(Fo.loadSSOConfigurations,Sh),yield Ua(Fo.saveSSOConfigurations,hh),yield Ua(Fo.saveSSOConfigurationsFile,vh),yield Ua(Fo.validateSSODomain,mh),yield Ua(Fo.loadSSOAuthorizationRoles,Ah),yield Ua(Fo.updateSSOAuthorizationRoles,bh)}const kh=["callback"],Eh=["callback","ssoConfigId"],Ih=["callback","ssoConfigId"],Ph=["callback","ssoConfigId"];function*Lh(){try{return yield Fi(xf.auth.getOidcConfiguration)}catch(e){return null}}function*Oh(){try{return yield Fi(xf.metadata.getSamlMetadata)}catch(e){return null}}function*_h(){try{yield Di(Fo.setSSOLoader({key:jf.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Ni([Fi(Lh),Fi(Oh)]),n=yield Fi(xf.auth.getSSOConfigurations);yield Di(Fo.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Di(Fo.setSSOError({key:jf.LOAD_SSO_CONFIGURATIONS,value:og(e)}))}finally{yield Di(Fo.setSSOLoader({key:jf.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*wh({payload:e}){yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Jo(e,kh),o=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield Fi(xf.auth.createSSOConfiguration,U({},n,{enabled:null!=(i=n.enabled)&&i}));yield Di(Fo.setSSOState({ssoConfigurations:[...o,e]})),null==t||t(e)}catch(e){yield Di(Fo.setSSOError({key:jf.SAVE_SSO_CONFIGURATION,value:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Ch({payload:e}){yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,o=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield lp(t),i=yield Fi(xf.auth.createSSOConfigurationByMetadata,{metadata:e});yield Di(Fo.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield Di(Fo.setSSOError({key:jf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:og(e)})),null==n||n(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Uh({payload:e}){yield Di(Fo.setSSOLoader({key:jf.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Jo(e,Eh),i=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Fi(xf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t));yield Di(Fo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Di(Fo.setSSOError({key:jf.UPDATE_SSO_CONFIGURATION,value:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Rh({payload:e}){yield Di(Fo.setSSOLoader({key:jf.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:o}=e,i=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield lp(o),a=yield Fi(xf.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=i.map((e=>e.id===n?a:e));yield Di(Fo.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield Di(Fo.setSSOError({key:jf.UPDATE_SSO_CONFIGURATION,value:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Dh({payload:e}){yield Di(Fo.setSSOLoader({key:jf.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{yield Fi(xf.auth.deleteSSOConfiguration,t),yield Di(Fo.setSSOState({ssoConfigurations:o.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield Di(Fo.setSSOError({key:jf.DELETE_SSO_CONFIGURATION,value:og(e)})),null==n||n(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Nh({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Jo(e,Ih);yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_DOMAIN,value:!0}));const i=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Fi(xf.auth.createSSODomain,n,o),a=i.map((t=>t.id===n?U({},t,{domains:[...t.domains,e]}):t));yield Di(Fo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Di(Fo.setSSOError({key:jf.SAVE_SSO_DOMAIN,value:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_DOMAIN,value:!1}))}}function*Mh({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield Di(Fo.setSSOLoader({key:jf.DELETE_SSO_DOMAIN,value:!0}));const i=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{yield Fi(xf.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?U({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield Di(Fo.setSSOState({ssoConfigurations:e})),null==o||o(!0)}catch(e){yield Di(Fo.setSSOError({key:jf.DELETE_SSO_DOMAIN,value:og(e)})),null==o||o(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.DELETE_SSO_DOMAIN,value:!1}))}}function*Fh({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield Di(Fo.setSSOLoader({key:jf.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{yield Fi(xf.auth.validateSSODomain,o,n);const e=i.map((e=>e.id===o?U({},e,{domains:e.domains.map((e=>e.id===n?U({},e,{validated:!0}):e))}):e));yield Di(Fo.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield Di(Fo.setSSOError({key:jf.VALIDATE_SSO_DOMAIN,value:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Gh({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Di(Fo.setSSOLoader({key:jf.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{yield Fi(xf.auth.setSSODefaultRoles,t,{roleIds:n});const i=o.map((e=>e.id===t?U({},e,{roleIds:n}):e));yield Di(Fo.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield Di(Fo.setSSOError({key:jf.UPDATE_SSO_DEFAULT_ROLES,value:og(t)})),null==e||e(null,t)}finally{yield Di(Fo.setSSOLoader({key:jf.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*$h({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_GROUPS,value:!0}));const i=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ni(t.map((e=>Fi(xf.auth.deleteSSOGroup,n,e)))),yield Ni(e.map((e=>Fi(xf.auth.createSSOGroup,n,e))));const a=yield Fi(xf.auth.getSSOGroups,n),r=i.map((e=>e.id===n?U({},e,{groups:a}):e));yield Di(Fo.setSSOState({ssoConfigurations:r})),null==o||o(!0)}catch(e){yield Di(Fo.setSSOError({key:jf.SAVE_SSO_GROUPS,value:og(e)})),null==o||o(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_GROUPS,value:!1}))}}function*Vh({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Ni(t.map((t=>Fi(xf.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Di(Fo.setSSOError({key:jf.SAVE_SSO_GROUPS,value:og(e)})),null==n||n(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_GROUPS,value:!1}))}}function*xh({payload:e}){yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:o,callback:i}=e,a=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,l;o?(r=yield Fi(xf.auth.updateSSOConfigurationByMetadataUrl,o,e),l=a.map((e=>e.id===o?r:e))):(r=yield Fi(xf.auth.createSSOConfigurationByMetadataUrl,e),l=[r,...a]),yield Di(Fo.setSSOState({ssoConfigurations:l})),null==i||i(r)}catch(e){null==i||i(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Bh({payload:e}){yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Jo(e,Ph),i=yield Vi((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Fi(xf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t))):(e=yield Fi(xf.auth.createSSOConfiguration,o),a=[e,...i]),yield Di(Fo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:jf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*jh(){yield Ua(Fo.loadSSOConfigurationsV2,_h),yield Ua(Fo.saveSSOConfigurationV2,wh),yield Ua(Fo.saveSSODomain,Nh),yield Ua(Fo.deleteSSODomain,Mh),yield Ua(Fo.validateSSODomainV2,Fh),yield Ua(Fo.updateSSOConfiguration,Uh),yield Ua(Fo.deleteSSOConfiguration,Dh),yield Ua(Fo.setSSOGroups,$h),yield Ua(Fo.updateSSOGroups,Vh),yield Ua(Fo.setSSODefaultRoles,Gh),yield Ua(Fo.saveSSOConfigurationByMetadata,Ch),yield Ua(Fo.updateSSOConfigurationByMetadata,Rh),yield Ua(Fo.saveSSOConfigurationByUrl,xh),yield Ua(Fo.saveSSOConfigurationByData,Bh)}const Wh=["callback","profilePictureUrl"],Kh=["callback","profilePictureUrl"];function*Hh(){yield Di(Fo.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return Fi.apply(void 0,[Ca,e,t,n].concat(i))}(3,2e3,xf.teams.getProfile),t=yield Vi((e=>e.auth.user));Fo.setUser(U({},t,e)),yield Di(Fo.setProfileState({profile:e,loading:!1}))}catch(e){yield Di(Fo.setProfileState({loading:!1,error:og(e)}))}}function*zh(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Jo(e.payload,Wh);yield Di(Fo.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield Vi((e=>e.auth.profileState.profile));let i=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 o=`image/${n[1]}`,i=function(e,t){const n=atob(e),o=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),i=new Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);o.push(new Uint8Array(i))}return new Blob(o,{type:t})}(n[2],o),a=new FormData;return a.append(t,new File([i],t,{type:o})),a}(n,"image");if(e){i=yield Fi(xf.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(i);n.searchParams.set("t",t),i=n.href}}const a=U({},e,o,{profilePictureUrl:i}),r=yield Fi(xf.users.updateUserProfileV2,a),l=yield Vi((e=>e.auth.user));yield Di(Fo.setUser(U({},l,r))),yield Di(Fo.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield Di(Fo.setProfileState({saving:!1,error:og(e),loading:!1})),null==t||t(null,e)}}function*qh({payload:e}){yield Di(Fo.setProfileState({loading:!0}));try{var t;yield Fi(xf.teams.changePassword,e),yield Di(Fo.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setProfileState({loading:!1,error:og(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Yh(){yield Da(Fo.loadProfile,Hh),yield Ua(Fo.saveProfile,zh),yield Ua(Fo.changePassword,qh)}function*Jh(){yield Di(Fo.setProfileState({loading:!0})),yield bt(),yield Di(Fo.setUser(U({},fp,yp))),yield Di(Fo.setProfileState({loading:!1,profile:yp}))}function*Qh(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Jo(e.payload,Kh);yield Di(Fo.setProfileState({saving:!0,error:null}));const i=pp;let a=i.profile.profilePictureUrl;n!==i.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=U({},i.profile,o,{profilePictureUrl:a}),l=fp;yield bt(),yield Di(Fo.setUser(U({},l,r))),yield Di(Fo.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Xh({payload:e}){var t;yield Di(Fo.setProfileState({loading:!0})),yield bt(),yield Di(Fo.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Zh(){yield Da(Fo.loadProfile,Jh),yield Ua(Fo.saveProfile,Qh),yield Ua(Fo.changePassword,Xh)}const em=["callback"],tm=["callback"],nm=["user"],om=["callback"],im=["deviceId","callback"],am=["deviceId","callback"],rm=["callback"],lm=["deviceId"],sm=["deviceId"],cm=["callback"],um=["deviceId"],dm=["callback"];function*ym(e){const{step:t}=yield Vi((e=>e.auth.mfaState));return{step:e.recoveryCode?ln.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*fm(){yield Di(Fo.setMfaState({saving:!0}));try{const{qrCode:e}=yield Fi(xf.auth.enrollMfa);yield Di(Fo.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield Di(Fo.setMfaState({saving:!1,error:og(e)}))}}function*pm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,em);yield Di(Fo.setMfaState({saving:!0}));try{const e=yield Vi((e=>e.auth.user)),o=yield Fi(xf.auth.verifyMfa,n),i=yield Fi(xf.auth.getMFADevices),a=yield ym(o);yield Di(Fo.setMfaState(U({},a,{mfaDevices:i}))),yield Di(Fo.setUser(U({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*gm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,tm);yield Di(Fo.setMfaState({loading:!0}));try{const e=yield Fi(xf.auth.loginWithMfaV2,n),{user:o}=e,i=Jo(e,nm),a={step:ln.recoveryCode,loading:!1,saving:!1,error:void 0};null!=o&&o.recoveryCode&&(a.recoveryCode=o.recoveryCode),yield Di(Fo.setMfaState(a)),yield ZS(U({user:o},i)),null==t||t(a.recoveryCode)}catch(e){yield Di(Fo.setMfaState({loading:!1,error:og(e)})),null==t||t(null,e)}}function*Sm({payload:e}){yield Di(Fo.setMfaState({saving:!0}));try{var t;yield Fi(xf.auth.disableMfa,e);const n=yield Fi(xf.auth.getMFADevices);yield Di(Fo.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setMfaState({saving:!1,error:og(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*vm({payload:e}){yield Di(Fo.setMfaState({saving:!0}));try{var t,n;const o=yield Fi(xf.auth.preEnrollMFAWebAuthn),i=U({},o.options,{challenge:Et(o.options.challenge),user:U({},o.options.user,{id:Et(o.options.user.id)}),excludeCredentials:null==(t=o.options.excludeCredentials)?void 0:t.map((e=>U({},e,{id:Et(e.id)})))});yield Di(Fo.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:i,webauthnToken:o.webauthnToken})}catch(t){var o;yield Di(Fo.setMfaState({saving:!1,error:og(t)})),null==(o=e.callback)||o.call(e,null,t)}}function*hm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,om);yield Di(Fo.setMfaState({saving:!0}));try{const e=It(n.publicKey),o=yield Fi(xf.auth.enrollMFAWebAuthn,U({},n,{options:e})),i=yield Fi(xf.auth.getMFADevices),a=yield ym(o);yield Di(Fo.setMfaState(U({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*mm(e){let{payload:{deviceId:t,callback:n}}=e;Jo(e.payload,im),yield Di(Fo.setMfaState({saving:!0}));try{var o;const e=yield Fi(xf.auth.preDisableMFAWebAuthn,t),i=U({},e.options,{challenge:Et(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>U({},e,{id:Et(e.id)})))});yield Di(Fo.setMfaState({saving:!1})),null==n||n({options:i,webauthnToken:e.webauthnToken})}catch(e){yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==n||n(null,e)}}function*Am(e){let{payload:{deviceId:t,callback:n}}=e,o=Jo(e.payload,am);yield Di(Fo.setMfaState({saving:!0}));try{const e=It(o.publicKey);yield Fi(xf.auth.disableMFAWebAuthn,t,U({},o,{options:e}));const i=yield Fi(xf.auth.getMFADevices);yield Di(Fo.setMfaState({saving:!1,error:void 0,mfaDevices:i})),null==n||n(!0)}catch(e){yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==n||n(!1,e)}}function*bm({payload:e}){yield Di(Fo.setMfaState({saving:!0}));try{var t;const n=yield Fi(xf.auth.preEnrollMFASMS,e);yield Di(Fo.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 Di(Fo.setMfaState({saving:!1,error:og(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Tm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,rm);yield Di(Fo.setMfaState({saving:!0}));try{const e=yield Fi(xf.auth.enrollMFASMS,n),o=yield Fi(xf.auth.getMFADevices),i=yield ym(e);yield Di(Fo.setMfaState(U({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*km(e){let{payload:{deviceId:t}}=e,n=Jo(e.payload,lm);yield Di(Fo.setMfaState({saving:!0}));try{var o;const e=yield Fi(xf.auth.preDisableMFASMS,t);yield Di(Fo.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Em(e){let{payload:{deviceId:t}}=e,n=Jo(e.payload,sm);yield Di(Fo.setMfaState({saving:!0}));try{var o;yield Fi(xf.auth.disableMFASMS,t,n);const e=yield Fi(xf.auth.getMFADevices);yield Di(Fo.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Im(){yield Di(Fo.setMfaState({loading:!0}));try{yield Vi((e=>e.auth.user));const e=yield Fi(xf.auth.getMFADevices);yield Di(Fo.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield Di(Fo.setMfaState({loading:!1,error:og(e)}))}}function*Pm(){yield Di(Fo.setMfaState({loading:!0}));try{const e=(yield Fi(xf.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield Di(Fo.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield Di(Fo.setMfaState({loading:!1,error:og(e)}))}}function*Lm(){yield Ua(Fo.enrollMfa,fm),yield Ua(Fo.getMFADevices,Im),yield Ua(Fo.getMFAStrategies,Pm),yield Ua(Fo.verifyMfa,pm),yield Ua(Fo.disableMfa,Sm),yield Ua(Fo.verifyMfaAfterForce,gm),yield Ua(Fo.preDisableMfaSms,km),yield Ua(Fo.disableMfaSms,Em),yield Ua(Fo.preEnrollMfaSms,bm),yield Ua(Fo.enrollMfaSms,Tm),yield Ua(Fo.preEnrollMfaWebAuthn,vm),yield Ua(Fo.enrollMfaWebAuthn,hm),yield Ua(Fo.preDisableMfaWebAuthn,mm),yield Ua(Fo.disableMfaWebAuthn,Am)}function*Om(){yield Di(Fo.setMfaState({saving:!0})),yield Di(Fo.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*_m({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield Vi((e=>e.auth.mfaState));yield Di(Fo.setMfaState({saving:!0})),yield bt();const n={token:"token",recoveryCode:"recoveryCode"},o={step:ln.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:U({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(o.recoveryCode=n.recoveryCode),yield Di(Fo.setMfaState(o)),yield Di(Fo.setUser(U({},fp,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*wm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,cm);yield Di(Fo.setMfaState({loading:!0})),yield bt();const o=U({},n,{recoveryCode:"recoveryCode"}),i={step:ln.recoveryCode,loading:!1,error:void 0,saving:!1};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield Di(Fo.setMfaState(i)),yield bt(),yield Di(Fo.setUser(U({},fp,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Cm({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Vi((e=>e.auth.mfaState));yield Di(Fo.setMfaState({saving:!0})),yield bt(),yield Di(Fo.setMfaState({saving:!1,error:void 0,mfaDevices:U({},n,{authenticators:[]})})),yield Di(Fo.setUser(U({},fp))),null==(t=e.callback)||t.call(e,!0)}function*Um(e){let{}=e,t=Jo(e.payload,um);yield Di(Fo.setMfaState({saving:!0}));try{var n;yield Di(Fo.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var o;yield Di(Fo.setMfaState({saving:!1,error:og(e)})),null==(o=t.callback)||o.call(t,!1,e)}}function*Rm({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Vi((e=>e.auth.mfaState));yield Di(Fo.setMfaState({saving:!0})),yield bt(),yield Di(Fo.setMfaState({loading:!1,error:void 0,mfaDevices:U({},n,{phones:[]})})),yield Di(Fo.setUser(U({},fp))),null==(t=e.callback)||t.call(e,!0)}function*Dm({payload:e}){var t;yield Di(Fo.setMfaState({saving:!0})),yield bt(),yield Di(Fo.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*Nm(e){let{payload:{callback:t}}=e;Jo(e.payload,dm);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Vi((e=>e.auth.mfaState));yield Di(Fo.setMfaState({saving:!0})),yield bt();const o={token:"token",recoveryCode:"recoveryCode"},i={step:ln.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:U({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield Di(Fo.setMfaState(i)),yield Di(Fo.setUser(U({},fp,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Mm(){yield Ua(Fo.enrollMfa,Om),yield Ua(Fo.verifyMfa,_m),yield Ua(Fo.disableMfa,Cm),yield Ua(Fo.verifyMfaAfterForce,wm),yield Ua(Fo.preDisableMfaSms,Um),yield Ua(Fo.disableMfaSms,Rm),yield Ua(Fo.preEnrollMfaSms,Dm),yield Ua(Fo.enrollMfaSms,Nm)}const Fm=["callback"];function*Gm({payload:e}){yield Di(Fo.setForgotPasswordState({loading:!0}));try{var t;yield Fi(xf.auth.forgotPassword,e),yield Di(Fo.setForgotPasswordState({loading:!1,error:void 0,step:Ht.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setForgotPasswordState({loading:!1,error:og(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*$m(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Fm);yield Di(Fo.setForgotPasswordState({loading:!0}));try{yield Fi(xf.auth.resetPassword,n),yield Di(Fo.setForgotPasswordState({loading:!1,error:void 0,step:Ht.success})),null==t||t(!0)}catch(e){yield Di(Fo.setForgotPasswordState({loading:!1,error:og(e)})),null==t||t(!1,e)}}function*Vm({payload:e}){yield Di(Fo.setForgotPasswordState({loading:!0}));try{const t=yield Fi(xf.auth.loadPasswordConfig,e);yield Di(Fo.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Di(Fo.setForgotPasswordState({loading:!1,error:og(e)}))}}function*xm(){yield Da(Fo.forgotPassword,Gm),yield Da(Fo.resetPassword,$m),yield Da(Fo.loadPasswordConfig,Vm)}let Bm;!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"}(Bm||(Bm={}));const jm=["callback","events"],Wm=["user"],Km=["callback"],Hm=["callback"];function*zm({payload:{userId:e,token:t}}){yield Di(Fo.setActivateState({loading:!0,step:Gt.activating}));try{const{isAuthenticated:n}=yield Vi((e=>e.auth));n&&(yield Di(Fo.silentLogout()));const o=yield Fi(xf.auth.getActivateAccountStrategy,{userId:e,token:t});yield Di(Fo.setActivateStrategyState({strategy:o,loading:!1,error:void 0})),o.shouldSetPassword&&(yield Di(Fo.setActivateState({loading:!1,step:Gt.activatingForm})))}catch(e){yield Di(Fo.setActivateState({loading:!1,error:og(e)}))}}function*qm(e){let{payload:{callback:t,events:n}}=e,o=Jo(e.payload,jm);yield Di(Fo.setActivateState({loading:!0}));try{const e=Na.onRedirectTo,{routes:a}=yield Vi((e=>e.auth)),r=yield Fi(xf.auth.activateAccountV2,o),{user:l}=r,s=Jo(r,Wm);if(l.redirectLocation)return void(window.location.href=l.redirectLocation);if(Zp(l)){yield Di(Fo.setActivateState({step:Gt.success}));const t=yield ng(l);yield Di(Fo.setState(t)),yield xi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var i;yield Di(Fo.setActivateState({step:Gt.success}));const e={email:l.email,origin:Hp.ACTIVATION_LINK,id:l.id,tenantId:l.tenantId,name:l.name,createdAt:new Date};null==n||null==(i=n.userVerified)||i.call(n,e),ag(ig.USER_VERIFIED,e),yield Fi(ZS,U({user:l},s),{isAuthenticated:!0}),yield xi(1e3),yield ev(),yield Di(Fo.resetActivateState())}null==t||t(!0)}catch(e){yield Di(Fo.setActivateState({loading:!1,error:og(e)}))}}function*Ym({payload:e}){const{callback:t}=e,n=Jo(e,Km);yield Di(Fo.setActivateStrategyState({loading:!0}));try{const e=yield Fi(xf.auth.getActivateAccountStrategy,n);yield Di(Fo.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield Di(Fo.setActivateStrategyState({loading:!1,error:og(e)}))}}function*Jm({payload:e}){const{callback:t}=e,n=Jo(e,Hm);yield Di(Fo.setTeamLoader({key:Bm.RESEND_ACTIVATE_LINK,value:n.email})),yield Di(Fo.setActivateState({loading:!0}));try{yield Fi(xf.auth.resendActivationEmail,n),yield Di(Fo.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield Di(Fo.setActivateState({loading:!1,error:og(e)})),yield Di(Fo.setTeamError({key:Bm.RESEND_ACTIVATE_LINK,value:og(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Bm.RESEND_ACTIVATE_LINK,value:!1}))}function*Qm(){yield Da(Fo.activateAccount,qm),yield Da(Fo.preActivateAccount,zm),yield Da(Fo.getActivateAccountStrategy,Ym),yield Da(Fo.resendActivationEmail,Jm)}function*Xm({payload:e}){if(e.token&&e.userId)try{yield Di(Fo.setAcceptInvitationState({error:void 0,step:Bt.pending})),yield Fi(xf.auth.acceptInvitation,e),yield Di(Fo.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Bt.success}}))}catch(e){yield Di(Fo.setAcceptInvitationState({step:Bt.failed,error:og(e)}))}else yield Di(Fo.setAcceptInvitationState({error:void 0,step:Bt.invalid}))}function*Zm(){yield Da(Fo.acceptInvitation,Xm)}var eA,tA=new Uint8Array(16);function nA(){if(!eA&&!(eA="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 eA(tA)}for(var oA=/^(?:[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,iA=function(e){return"string"==typeof e&&oA.test(e)},aA=[],rA=0;rA<256;++rA)aA.push((rA+256).toString(16).substr(1));var lA=function(e,t,n){var o=(e=e||{}).random||(e.rng||nA)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=o[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(aA[e[t+0]]+aA[e[t+1]]+aA[e[t+2]]+aA[e[t+3]]+"-"+aA[e[t+4]]+aA[e[t+5]]+"-"+aA[e[t+6]]+aA[e[t+7]]+"-"+aA[e[t+8]]+aA[e[t+9]]+"-"+aA[e[t+10]]+aA[e[t+11]]+aA[e[t+12]]+aA[e[t+13]]+aA[e[t+14]]+aA[e[t+15]]).toLowerCase();if(!iA(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let sA,cA;!function(e){e.CREATE_GROUP="CREATE_GROUP",e.GET_GROUP="GET_GROUP",e.GET_GROUPS="GET_GROUPS",e.DELETE_GROUP="DELETE_GROUP",e.UPDATE_GROUP="UPDATE_GROUP",e.ADD_USERS_TO_GROUP="ADD_USERS_TO_GROUP",e.DELETE_USERS_FROM_GROUP="DELETE_USERS_FROM_GROUP",e.ADD_ROLES_TO_GROUP="ADD_ROLES_TO_GROUP",e.DELETE_ROLES_FROM_GROUP="DELETE_ROLES_FROM_GROUP",e.GET_GROUP_CONFIGURATION="GET_GROUP_CONFIGURATION",e.UPDATE_GROUP_CONFIGURATION="UPDATE_GROUP_CONFIGURATION",e.GET_TEAM_USERS="GET_TEAM_USERS"}(sA||(sA={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(cA||(cA={}));const uA=["callback"],dA=["roles"],yA=["callback"],fA=["callback","profileImage"],pA=["callback"],gA=["callback","userId"],SA=["callback"],vA=["callback"],hA=["callback"],mA=["callback"],AA=["callback"],bA=["callback"],TA=["callback"],kA=["callback","profileImage"],EA=["callback"],IA=["callback"],PA=["callback"],LA=["callback"],OA=["callback"],_A=["callback"],wA=()=>Vi((e=>e.auth.teamState));function*CA(){try{const{groups:e}=yield Fi(xf.groups.getGroups,{_groupsRelations:cA.roles});return e}catch(e){return[]}}function*UA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield wA(),c=null!=(t=e.pageSize)?t:s.pageSize,u=null!=(n=e.pageOffset)?n:s.pageOffset,d=null!=(o=e.filter)?o:s.filterV2,y=null!=(i=e.sort)?i:s.sortV2,f=null!=(a=null==e?void 0:e.shouldShowSubTenantUsersIfReseller)?a:null==s?void 0:s.shouldShowSubTenantUsersIfReseller;yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!r})),yield Di(Fo.setTeamState({pageSize:c,pageOffset:u,filterV2:d,sortV2:y}));try{const[{items:t,_metadata:{totalPages:n,totalItems:o}},{items:i},{items:a},r]=yield Ni([Fi(xf.users.getUsersV2,U({},(null==d?void 0:d.length)&&{_filter:d},y&&{_sortBy:y},e.order&&{_order:e.order},{_offset:u,_limit:c,_includeSubTenants:f})),Fi(xf.teams.loadAvailableRoles),Fi(xf.teams.loadAvailablePermissions),Fi(CA)]),s=t.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>r.filter((t=>t.id===e.id)))).flat();return U({},e,{groups:n})}));yield Di(Fo.setTeamState({users:s.map((e=>U({},e,{roleIds:e.roles.map((e=>e.id))}))),totalPages:n,totalItems:o,roles:i,permissions:a})),null==l||l(t)}catch(e){yield Di(Fo.setTeamError({key:Bm.USERS,value:og(e)})),yield Di(Fo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!1}))}function*RA({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield wA(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filter,d=null!=(i=e.sort)?i:l.sort;yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!a})),yield Di(Fo.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:o},{items:i}]=yield Ni([Fi(xf.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Fi(xf.teams.loadAvailableRoles),Fi(xf.teams.loadAvailablePermissions)]);yield Di(Fo.setTeamState({users:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==r||r(e)}catch(e){yield Di(Fo.setTeamError({key:Bm.USERS,value:e.message})),yield Di(Fo.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!1}))}function*DA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield wA(),c={_limit:(null!=(t=e._limit)?t:s.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:s.allUsersQueryParams._offset)||0,_filter:(null!=(o=e._filter)?o:s.allUsersQueryParams._filter)||"",_sortBy:(null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:s.allUsersQueryParams._order)||"DESC"};yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!r})),yield Di(Fo.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:o},{items:i}]=yield Ni([Fi(xf.subTenants.loadAllUsers,U({},c)),Fi(xf.teams.loadAvailableRoles),Fi(xf.teams.loadAvailablePermissions)]);yield Di(Fo.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==l||l(e)}catch(e){yield Di(Fo.setTeamError({key:Bm.USERS,value:og(e)})),yield Di(Fo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!1}))}function*NA({payload:e}){yield Di(Fo.setTeamLoader({key:Bm.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield Ni([Fi(xf.teams.loadAvailableRoles),Fi(xf.teams.loadAvailablePermissions)]);yield Di(Fo.setTeamState({roles:n,permissions:o})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:o})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield Di(Fo.setTeamError({key:Bm.ROLES_AND_PERMISSIONS,value:og(t)}))}yield Di(Fo.setTeamLoader({key:Bm.ROLES_AND_PERMISSIONS,value:!0}))}function*MA({payload:e}){const{callback:t}=e,n=Jo(e,uA),o=yield wA();yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield Fi(xf.teams.addUser,n),{roles:a}=e,r=U({},Jo(e,dA),{roleIds:null!=(i=null==a?void 0:a.map((e=>e.id)))?i:[]});null==t||t(r),yield Di(Fo.setTeamState({users:[r,...o.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!1,error:og(e)})})),null==t||t(null,e)}}function*FA({payload:e}){const{callback:t}=e,n=yield wA();yield Di(Fo.setTeamState({addUserDialogState:U({},n.addUserDialogState,{loading:!0})}));const o=[],i=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield Di(Fo.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Fi(xf.teams.addUser,t),o.push(t.email)}catch(e){i.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:"",silentLoading:e.emails.length>0};yield Di(Fo.loadUsersV2(r)),yield Di(Fo.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:i,allowedEmails:o})}function*GA({payload:e}){const{callback:t}=e,n=Jo(e,yA),o=yield wA();yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{yield Fi(xf.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield Fi(xf.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield Di(Fo.setTeamState({allUsers:e,totalPages:o,totalItems:i,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!1,error:og(e)})})),null==t||t(null,e)}}function*$A({payload:e}){const{callback:t}=e,n=Jo(e,fA),{id:o}=n,i=yield wA(),a=i.users.find((e=>e.id===n.id));yield Di(Fo.setTeamLoader({key:Bm.UPDATE_USER,value:o||""})),yield Di(Fo.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})})),yield Di(Fo.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0}),users:i.users.map((e=>e.id===n.id?U({},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 Fi(xf.teams.updateUser,n);null==t||t(e),yield Di(Fo.setTeamState({users:i.users.map((t=>t.id===e.id?U({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield Di(Fo.setTeamLoader({key:Bm.UPDATE_USER,value:!1}))}catch(e){yield Di(Fo.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:og(e)}),users:i.users.map((e=>e.id===n.id?U({},e,a):e))})),yield Di(Fo.setTeamLoader({key:Bm.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*VA({payload:e}){const{callback:t}=e,n=Jo(e,pA),o=yield wA();yield Di(Fo.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Fi(xf.teams.deleteUser,n),null==t||t(!0),yield Di(Fo.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Di(Fo.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!1,error:og(e)})})),null==t||t(null,e)}}function*xA({payload:e}){const{callback:t,userId:n}=e,o=Jo(e,gA),i=yield wA();yield Di(Fo.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})}));try{yield Fi(xf.subTenants.setUserRolesForSubTenants,n,o);const e=i.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return U({},e,{roles:(null==(t=o.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>i.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield Di(Fo.setTeamState({allUsers:[...i.allUsers.filter((e=>e.id!==n)),...e?[U({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield Di(Fo.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:og(e)})})),null==t||t(null,e)}}function*BA({payload:e}){const{callback:t}=e,n=Jo(e,SA),o=yield wA();yield Di(Fo.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Fi(xf.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield Di(Fo.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Di(Fo.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!1,error:og(e)})})),null==t||t(null,e)}}function*jA({payload:e}){const{callback:t}=e,n=Jo(e,vA);yield Di(Fo.setTeamLoader({key:Bm.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Fi(xf.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Bm.RESEND_ACTIVATE_LINK,value:og(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Bm.RESEND_ACTIVATE_LINK,value:!1}))}function*WA({payload:e}){const{callback:t}=e,n=Jo(e,hA);yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:n.email}));try{yield Fi(xf.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Bm.RESEND_INVITATION_LINK,value:og(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:!1}))}function*KA({payload:e}){const{callback:t}=e,n=Jo(e,mA);yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:n.email}));try{yield Fi(xf.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Bm.RESEND_INVITATION_LINK,value:og(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:!1}))}function*HA({payload:e}){const{callback:t}=e,n=Jo(e,AA);yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:n.email}));try{yield Fi(xf.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Bm.RESEND_INVITATION_LINK,value:og(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:!1}))}function*zA(){yield Di(Fo.setTeamError({key:Bm.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Fi(xf.teams.getInviteLinkConfiguration);yield Di(Fo.setTeamState({inviteTokenState:U({},e)}))}catch(e){yield Di(Fo.setTeamError({key:Bm.CONFIG_TOKEN_LINK,value:og(e)}))}}function*qA(){yield Di(Fo.setTeamError({key:Bm.GET_TOKEN_LINK,value:!1}));try{yield Fi(zA);const e=yield Fi(xf.teams.getInviteUserLink),{inviteTokenState:t}=yield wA();yield Di(Fo.setTeamState({inviteTokenState:U({},t,e)}))}catch(e){yield Di(Fo.setTeamError({key:Bm.GET_TOKEN_LINK,value:og(e)}))}}function*YA({payload:{callback:e}}){yield Di(Fo.setTeamError({key:Bm.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield wA();try{const n=yield Fi(xf.teams.createInviteUserLink,{expiresInMinutes:43200});yield Di(Fo.setTeamState({inviteTokenState:U({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield Di(Fo.setTeamError({key:Bm.CREATE_TOKEN_LINK,value:og(t)}))}}function*JA({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield wA();yield Di(Fo.setTeamError({key:Bm.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield Fi(xf.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield Di(Fo.setTeamState({inviteTokenState:U({},o,i)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield Di(Fo.setTeamError({key:Bm.UPDATE_TOKEN_LINK,value:og(t)}))}}function*QA({payload:e}){const{callback:t}=null!=e?e:{};yield Di(Fo.setTeamError({key:Bm.DELETE_TOKEN_LINK,value:!1}));try{yield Fi(xf.teams.deleteInviteUserLink),yield Di(Fo.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Bm.DELETE_TOKEN_LINK,value:og(e)})),null==t||t(!1,e)}}function*XA({payload:e}){yield Di(Fo.setTeamState({addUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*ZA({payload:e}){const t=yield wA(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Di(Fo.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*eb({payload:e}){yield Di(Fo.setTeamState({deleteUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*tb({payload:e}){const t=yield wA(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Di(Fo.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*nb(){yield Ra(Fo.loadUsers,RA),yield Ra(Fo.loadUsersV2,UA),yield Ra(Fo.loadAllSubTenantsUsers,DA),yield Ra(Fo.loadRoles,NA),yield Ua(Fo.addUser,MA),yield Ua(Fo.addUsersBulk,FA),yield Ua(Fo.addUserToSubTenants,GA),yield Ua(Fo.updateUser,$A),yield Ua(Fo.setUserRolesForSubTenants,xA),yield Ua(Fo.deleteUser,VA),yield Ua(Fo.deleteUserFromSubTenants,BA),yield Ua(Fo.resendActivationLink,jA),yield Ua(Fo.resendInvitationLink,WA),yield Ua(Fo.resendInvitationEmail,KA),yield Ua(Fo.resendInvitationLinkToAllSubTenants,HA),yield Ua(Fo.getInvitationLink,qA),yield Ua(Fo.createInvitationLink,YA),yield Ua(Fo.updateInvitationLink,JA),yield Ua(Fo.deleteInvitationLink,QA),yield Ua(Fo.openAddUserDialog,XA),yield Ua(Fo.closeAddUserDialog,ZA),yield Ua(Fo.openDeleteUserDialog,eb),yield Ua(Fo.closeDeleteUserDialog,tb)}function*ob({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield wA(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filterV2,d=null!=(i=e.sort)?i:l.sortV2;yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!a})),yield Di(Fo.setTeamState({pageSize:s,pageOffset:c,filterV2:u,sortV2:d})),yield bt(),yield Di(Fo.setTeamState({users:wp,totalPages:2,totalItems:10,roles:Tp,permissions:Ep})),yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!1})),null==r||r(wp)}function*ib({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield wA(),c=null!=(t=e._limit)?t:s.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:s.allUsersQueryParams._offset,d=null!=(o=e._filter)?o:s.allUsersQueryParams._filter,y=null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:s.allUsersQueryParams._order;yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!r})),yield Di(Fo.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield bt(),yield Di(Fo.setTeamState({allUsers:Up,totalPages:2,totalItems:10,roles:Tp,permissions:Ep})),yield Di(Fo.setTeamLoader({key:Bm.USERS,value:!1})),null==l||l(Up)}function*ab({payload:e}){var t;yield Di(Fo.setTeamLoader({key:Bm.ROLES_AND_PERMISSIONS,value:!0})),yield bt(),yield Di(Fo.setTeamState({roles:Tp,permissions:Ep})),yield Di(Fo.setTeamLoader({key:Bm.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Tp,permissions:Ep})}function*rb({payload:e}){const{callback:t}=e,n=Jo(e,bA),o=yield wA();yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield bt();const i=U({},Lp,{groups:[]},n,{id:`${lA()}`});null==t||t(i),yield Di(Fo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*lb({payload:e}){const{callback:t}=e,n=Jo(e,TA),o=yield wA();yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield bt();const i=U({},Lp,n,{id:`${lA()}`});yield Di(Fo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*sb({payload:e}){var t;const{callback:n}=e,o=Jo(e,kA),{id:i}=o,a=yield wA(),r=a.users.find((e=>e.id===o.id));yield Di(Fo.setTeamLoader({key:Bm.UPDATE_USER,value:i||""})),yield Di(Fo.setTeamState({addUserDialogState:U({},a.addUserDialogState,{loading:!0})})),yield Di(Fo.setTeamState({addUserDialogState:U({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===o.id?U({},e,o):e))})),r.roleIds.length>0&&0===(null==(t=o.roleIds)?void 0:t.length)&&(o.roleIds=[""]),yield bt();const l=U({},r,o);null==n||n(l),yield Di(Fo.setTeamState({users:a.users.map((e=>e.id===l.id?U({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield Di(Fo.setTeamLoader({key:Bm.UPDATE_USER,value:!1}))}function*cb({payload:e}){const{callback:t}=e,n=Jo(e,EA),o=yield wA();yield Di(Fo.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*ub({payload:e}){const{callback:t}=e,n=Jo(e,IA),o=yield wA();yield Di(Fo.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*db({payload:e}){const{callback:t}=e,n=Jo(e,PA);yield Di(Fo.setTeamLoader({key:Bm.RESEND_ACTIVATE_LINK,value:n.userId})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamLoader({key:Bm.RESEND_ACTIVATE_LINK,value:!1}))}function*yb({payload:e}){const{callback:t}=e,n=Jo(e,LA);yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:n.email})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:!1}))}function*fb({payload:e}){const{callback:t}=e,n=Jo(e,OA);yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:n.email})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:!1}))}function*pb({payload:e}){const{callback:t}=e,n=Jo(e,_A);yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:n.email})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamLoader({key:Bm.RESEND_INVITATION_LINK,value:!1}))}function*gb(){yield Ra(Fo.loadUsersV2,ob),yield Ra(Fo.loadAllSubTenantsUsers,ib),yield Ra(Fo.loadRoles,ab),yield Ua(Fo.addUser,rb),yield Ua(Fo.addUserToSubTenants,lb),yield Ua(Fo.updateUser,sb),yield Ua(Fo.deleteUser,cb),yield Ua(Fo.deleteUserFromSubTenants,ub),yield Ua(Fo.resendActivationLink,db),yield Ua(Fo.resendInvitationLink,yb),yield Ua(Fo.resendInvitationEmail,fb),yield Ua(Fo.resendInvitationLinkToAllSubTenants,pb),yield Ua(Fo.openAddUserDialog,XA),yield Ua(Fo.closeAddUserDialog,ZA),yield Ua(Fo.openDeleteUserDialog,eb),yield Ua(Fo.closeDeleteUserDialog,tb)}const Sb=["authorizationUrl"],vb=["events","url"];function*hb(){try{yield Di(Fo.setSocialLoginsState({loading:!0}));const e=yield Fi(xf.auth.getSocialLoginProviders);yield Di(Fo.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield Di(Fo.setSocialLoginsState({error:og(e),loading:!1,firstLoad:!1}))}}function*mb(){const e=yield Vi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Fi(xf.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield Fi(xf.auth.getSocialLoginProvidersV2),t}function*Ab(){try{const e=yield Vi((e=>e.root.context));yield Di(Fo.setSocialLoginsState({loading:!0}));const t=yield Fi(mb),{providers:n}=yield Fi(xf.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Jo(t,Sb);const i=Tr(e,null!=n?n:"");return U({},o,{authorizationUrl:n?`${i}${n}`:null})}));yield Di(Fo.setSocialLoginsState({socialLoginsConfigV2:o,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield Di(Fo.setSocialLoginsState({error:og(e),loading:!1,firstLoad:!1}))}}function*bb(e){let{payload:{events:t,url:n}}=e,o=Jo(e.payload,vb);try{yield Di(Fo.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Fi(xf.auth.loginViaSocialLogin,o);if(r){var i,a;const r={email:e,url:n,createdAt:new Date,id:l,tenantId:s},u=U({},r,{socialProvider:o.provider,authenticationType:zp.SOCIAL_LOGIN});null==t||null==(i=t.signUpComplete)||i.call(t,u),ag(ig.SIGNUP_COMPLETED,u);const d=U({},r,{origin:Hp.SOCIAL_LOGIN,name:c});null==t||null==(a=t.userVerified)||a.call(t,d),ag(ig.USER_VERIFIED,d)}l&&localStorage.setItem("userId",l),yield Di(Fo.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield Vi((e=>e.auth));e?yield Fi(rv):yield Fi(sv)}(),localStorage.removeItem("register-quick-login"),yield Di(Fo.setSocialLoginsState({loading:!1}))}catch(e){yield Di(Fo.setSocialLoginsState({loading:!1,error:og(e,"Failed to authenticate"),firstLoad:!1}))}}function*Tb({payload:e}){yield Di(Fo.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*kb(){yield Da(Fo.loadSocialLoginsConfiguration,hb),yield Da(Fo.loadSocialLoginsConfigurationV2,Ab),yield Da(Fo.loginViaSocialLogin,bb),yield Ra(Fo.setSocialLoginError,Tb)}let Eb;function*Ib({payload:e}){const{description:t,expires:n,callback:o}=e,{apiTokensDataUser:i}=yield Vi((e=>e.auth.apiTokensState));try{let e,a;yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield Fi(xf.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield Fi(xf.auth.updateUserApiTokensData,{description:t}),yield Di(Fo.setApiTokensState({showAddTokenDialog:!1})),yield xi(200),yield Di(Fo.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield Di(Fo.setApiTokensError({key:Eb.ADD_API_TOKEN,value:og(e)})),yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*Pb({payload:e}){const{description:t,roleIds:n,expires:o,callback:i}=e,{apiTokensDataTenant:a}=yield Vi((e=>e.auth.apiTokensState));try{let e,r;yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield Fi(xf.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield Fi(xf.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield Di(Fo.setApiTokensState({showAddTokenDialog:!1})),yield xi(200),yield Di(Fo.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===o?e.clientId:void 0}})),yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Di(Fo.setApiTokensError({key:Eb.ADD_API_TOKEN,value:og(e)})),yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*Lb({payload:e}){const{apiTokensDataUser:t}=yield Vi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!0})),n?(yield Fi(xf.auth.deleteUserAccessToken,{id:e}),yield Di(Fo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Fi(xf.auth.deleteUserApiToken,{tokenId:e}),yield Di(Fo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!1}))}catch(e){yield Di(Fo.setApiTokensError({key:Eb.DELETE_API_TOKEN,value:og(e)})),yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!1}))}}function*Ob({payload:e}){const{apiTokensDataTenant:t}=yield Vi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let o=t;try{yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!0})),n?(yield Fi(xf.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield Fi(xf.auth.deleteTenantApiToken,{tokenId:e}),o=t.filter((t=>t.clientId!==e))),yield Di(Fo.setApiTokensState({apiTokensDataTenant:o,deleteTokenDialog:{open:!1,id:e}})),yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!1}))}catch(e){yield Di(Fo.setApiTokensError({key:Eb.DELETE_API_TOKEN,value:og(e)})),yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!1}))}}function*_b({payload:e}){null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield Ni([Fi(xf.auth.getUserApiTokensData),Fi(xf.auth.getTenantApiTokensData)]);yield Di(Fo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setApiTokensError({key:Eb.LOAD_API_TOKENS,value:og(t)})),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*wb({payload:e}){null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Fi(xf.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=Fi(xf.auth.getUserAccessTokensData))?n:[]).accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Di(Fo.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield Di(Fo.setApiTokensError({key:Eb.LOAD_API_TOKENS,value:og(t)})),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Cb({payload:e}){null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Fi(xf.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Fi(xf.auth.getTenantAccessTokensData))?n:[],l=(null!=(o=null==r?void 0:r.accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Di(Fo.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield Di(Fo.setApiTokensError({key:Eb.LOAD_API_TOKENS,value:og(t)})),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Ub(){yield Da(Fo.loadApiTokens,_b),yield Da(Fo.loadUserApiTokens,wb),yield Da(Fo.loadTenantApiTokens,Cb),yield Ua(Fo.addUserApiToken,Ib),yield Ua(Fo.addTenantApiToken,Pb),yield Ra(Fo.deleteTenantApiToken,Ob),yield Ra(Fo.deleteUserApiToken,Lb)}function*Rb({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield Vi((e=>e.auth.apiTokensState)),a=U({},up,{description:t,roleIds:n,clientId:`CLIENT_ID_${lA()}`});yield Di(Fo.setApiTokensState({showAddTokenDialog:!1})),yield xi(200),yield Di(Fo.setApiTokensState({apiTokensDataTenant:[...i,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield xi(200),yield Di(Fo.setApiTokensLoader({key:Eb.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*Db({payload:e}){yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!0})),yield xi(200);const t=[up];yield Di(Fo.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Di(Fo.setApiTokensLoader({key:Eb.DELETE_API_TOKEN,value:!1}))}function*Nb({payload:e}){var t;null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!0})));const n=[cp],o=[up];yield Di(Fo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield xi(200),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Mb({payload:e}){var t;null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!0})));const n=[cp];yield Di(Fo.setApiTokensState({apiTokensDataUser:n})),yield xi(200),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Fb({payload:e}){var t;null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!0})));const n=[up];yield Di(Fo.setApiTokensState({apiTokensDataTenant:n})),yield xi(200),yield Di(Fo.setApiTokensLoader({key:Eb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Gb(){yield Da(Fo.loadApiTokens,Nb),yield Da(Fo.loadUserApiTokens,Mb),yield Da(Fo.loadTenantApiTokens,Fb),yield Ua(Fo.addTenantApiToken,Rb),yield Ra(Fo.deleteTenantApiToken,Db)}function*$b({payload:e}){try{var t;yield Di(Fo.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Vi((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Fi(xf.accountSettings.updateSettings,U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield Di(Fo.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield Di(Fo.setAccountSettingsState({loading:!1,error:og(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Vb({payload:e}){yield Di(Fo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Fi(xf.accountSettings.getSettings);yield Di(Fo.setAccountSettingsState(U({},e,{loading:!1})))}catch(e){yield Di(Fo.setAccountSettingsState({loading:!1,error:og(e)}))}}function*xb(){yield Da(Fo.saveAccountSettings,$b),yield Da(Fo.loadAccountSettings,Vb)}function*Bb({payload:e}){var t;yield Di(Fo.setAccountSettingsState({loading:!0})),yield bt();const{accountSettingsState:n}=yield Vi((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield Di(Fo.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*jb({payload:e}){yield Di(Fo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield bt(),yield Di(Fo.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Wb(){yield Da(Fo.saveAccountSettings,Bb),yield Da(Fo.loadAccountSettings,jb)}function*Kb({payload:{tenantId:e,callback:t}}){yield Di(Fo.setState({isLoading:!0}));try{yield Fi(xf.tenants.switchTenant,{tenantId:e}),yield Fi(iv),(null==t?void 0:t(!0))||(yield Di(Fo.setState({isLoading:!1})))}catch(e){yield Di(Fo.setState({isLoading:!1})),null==t||t(!1,e)}}function*Hb({payload:e}){yield Di(Fo.setTenantsState({loading:!0}));try{var t;const n=yield Fi(xf.users.getCurrentUserTenantsV3);yield Di(Fo.setTenantsState({tenants:n.tenants,activeTenant:n.activeTenant,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 Di(Fo.setTenantsState({loading:!1}))}}function*zb({payload:e}){yield Di(Fo.setTenantsState({loading:!0}));try{var t;const n=yield Fi(xf.tenants.getSubTenants);yield Di(Fo.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*qb({payload:e}){yield Di(Fo.setTenantsState({loading:!0}));try{var t;const n=yield Fi(xf.tenants.getSubTenantsAsTree);yield Di(Fo.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Yb(){yield Ua(Fo.loadTenants,Hb),yield Ua(Fo.loadSubTenants,zb),yield Ua(Fo.switchTenant,Kb),yield Ua(Fo.loadSubTenantsTree,qb)}function*Jb(){yield Di(Fo.setTenantsState({loading:!0})),yield bt(),yield Di(Fo.setTenantsState({tenants:Rp,activeTenant:Rp[0],loading:!1}))}function*Qb(){yield Ua(Fo.loadTenants,Jb)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(Eb||(Eb={}));const Xb=["callback"],Zb=["callback"],eT=["callback"],tT=["callback"],nT=["callback"];function*oT({payload:e}){var t;yield Di(Fo.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Ni([Fi(xf.roles.getRoles),Fi(xf.roles.getPermissions),Fi(xf.roles.getPermissionCategories)]),[t,n,o]=e;yield Di(Fo.setRolesState({roles:t,permissions:n,permissionCategories:o,loading:!1}))}catch(e){yield Di(Fo.setRolesState({error:og(e),loading:!1}))}}function*iT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Xb);yield Di(Fo.setRolesState({saving:!0}));try{const e=yield Fi(xf.roles.addRole,n),o=yield Fi(xf.roles.getRoles);yield Di(Fo.loadRolesAndPermissions({silentLoading:!0})),yield Di(Fo.setRolesState({roles:o,saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setRolesState({error:og(e),saving:!1})),null==t||t(null,e)}}function*aT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Zb);yield Di(Fo.setRolesState({saving:!0}));try{yield Fi(xf.roles.deleteRole,n),yield Di(Fo.loadRolesAndPermissions({silentLoading:!0})),yield Di(Fo.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setRolesState({error:og(e),saving:!1})),null==t||t(!1,e)}}function*rT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,eT);yield Di(Fo.setRolesState({saving:!0}));try{const e=yield Fi(xf.roles.updateRole,n);yield Di(Fo.loadRolesAndPermissions({silentLoading:!0})),yield Di(Fo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setRolesState({error:og(e),saving:!1})),null==t||t(null,e)}}function*lT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,tT);yield Di(Fo.setRolesState({saving:!0}));try{const e=yield Fi(xf.roles.attachPermissionsToRole,n);yield Di(Fo.loadRolesAndPermissions({silentLoading:!0})),yield Di(Fo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setRolesState({error:og(e),saving:!1})),null==t||t(null,e)}}function*sT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,nT);yield Di(Fo.setRolesState({saving:!0}));try{const e=yield Fi(xf.roles.attachPermissionToRoles,n);yield Di(Fo.loadRolesAndPermissions({silentLoading:!0})),yield Di(Fo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setRolesState({error:og(e),saving:!1})),null==t||t(null,e)}}function*cT(){yield Da(Fo.loadRolesAndPermissions,oT),yield Ua(Fo.addRole,iT),yield Ua(Fo.deleteRole,aT),yield Ua(Fo.updateRole,rT),yield Ua(Fo.attachPermissionsToRole,lT),yield Ua(Fo.attachPermissionToRoles,sT)}function*uT({payload:e}){var t;yield Di(Fo.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield Di(Fo.setRolesState({roles:dp,loading:!1}))}catch(e){yield Di(Fo.setRolesState({error:og(e),loading:!1}))}}function*dT(){yield Da(Fo.loadRolesAndPermissions,uT)}const yT=["callback"],fT=["callback"],pT=["callback"];function*gT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,yT);yield Di(Fo.setResetPhoneNumberState({loading:!0}));try{const e=yield Fi(xf.auth.resetPhoneNumber,n);yield Di(Fo.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Jt.VerifyResetPhoneNumber})),yield Di(Fo.setLoginState({email:n.email}))}catch(e){yield Di(Fo.setResetPhoneNumberState({loading:!1,error:og(e)})),null==t||t(null,e)}}function*ST(e){let{payload:{callback:t}}=e,n=Jo(e.payload,fT);yield Di(Fo.setResetPhoneNumberState({loading:!0}));try{const e=yield Fi(xf.auth.verifyResetPhoneNumber,n);yield Di(Fo.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Jt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield Di(Fo.setResetPhoneNumberState({loading:!1,error:og(e)})),null==t||t(null,e)}}function*vT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,pT);yield Di(Fo.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:o}=yield Vi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Fi(xf.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Di(Fo.setLoginState({step:Pt.loginWithSmsOtc})),yield Di(Fo.passwordlessPreLogin({type:ko.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(o.loginUrl),yield Di(Fo.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setResetPhoneNumberState({loading:!1,error:og(e)})),null==t||t(null,e)}}function*hT(){yield Da(Fo.resetPhoneNumber,gT),yield Da(Fo.verifyResetPhoneNumber,ST),yield Da(Fo.changePhoneNumber,vT)}function*mT(){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getCurrentUserSessions);yield Di(Fo.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*AT(){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getCurrentUserSession);yield Di(Fo.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*bT({payload:{id:e}}){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{yield Fi(xf.auth.deleteSessionForUser,e),yield Di(Fo.loadUserSessions())}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*TT({payload:{callback:e,userId:t}}){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{yield Fi(xf.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Di(Fo.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*kT(){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{yield Fi(xf.auth.deleteAllSessionsForUser),yield Di(Fo.loadUserSessions())}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*ET(){yield Ra(Fo.loadUserSessions,mT),yield Ra(Fo.deleteUserSession,bT),yield Ra(Fo.deleteAllUserSessions,kT),yield Ra(Fo.loadCurrentUserSession,AT),yield Ua(Fo.revokeUserSessions,TT)}function*IT(){yield Di(Fo.setSessionsState({loading:!0,error:null})),yield Di(Fo.setSessionsState({sessions:Dp,loading:!1}))}function*PT({payload:{id:e}}){yield Di(Fo.setSessionsState({loading:!0,error:null}));const t=(yield Vi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield Di(Fo.setSessionsState({sessions:t,loading:!1}))}function*LT(){yield Di(Fo.setSessionsState({loading:!0,error:null}));const e=Dp.filter((e=>e.current));yield Di(Fo.setSessionsState({sessions:e,loading:!1}))}function*OT(){yield Ra(Fo.loadUserSessions,IT),yield Ra(Fo.deleteUserSession,PT),yield Ra(Fo.deleteAllUserSessions,LT)}const _T=["callback"],wT=["callback"];function*CT(){yield Di(Fo.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getSessionConfigurations);yield Di(Fo.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*UT({payload:e}){yield Di(Fo.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Jo(e,_T);yield Fi(xf.auth.createOrUpdateSessionConfigrations,n),yield Di(Fo.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Di(Fo.setSessionsPolicyState({error:e,loading:!1}))}}function*RT(){yield Da(Fo.loadSessionsPolicy,CT),yield Ra(Fo.createOrUpdateSessionsPolicy,gg(UT))}function*DT(){yield Di(Fo.setSessionsPolicyState({loading:!0,error:null}));const e=yield Vi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Np}));yield Di(Fo.setSessionsPolicyState(U({},e,{loading:!1})))}function*NT({payload:e}){yield Di(Fo.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Jo(e,wT);null==t||t(!0),yield Di(Fo.setSessionsPolicyState({configurations:n,loading:!1}))}function*MT(){yield Da(Fo.loadSessionsPolicy,DT),yield Ra(Fo.createOrUpdateSessionsPolicy,NT)}const FT=["callback"],GT=["callback"],$T=["callback"],VT=["callback"],xT=["callback"],BT=["callback"],jT=["callback"],WT=["callback"],KT=()=>Vi((e=>e.auth.restrictionsState.ipRestrictions)),HT=()=>Vi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*zT(){yield Di(Fo.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Fi(xf.auth.getDomainRestrictionsConfig),t=(yield Fi(xf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Di(Fo.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield Di(Fo.setEmailDomainRestrictionsState({error:og(e),loading:!1}))}}function*qT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,FT);yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield HT();try{var i;yield Fi(xf.auth.createDomainRestriction,n);const e=(yield Fi(xf.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=o.data)?void 0:t.config.listType)}));yield Di(Fo.setEmailDomainRestrictionsState({data:{config:(null==(i=o.data)?void 0:i.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setEmailDomainRestrictionsState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*YT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,GT);yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Fi(xf.auth.updateDomainRestrictionConfig,n),o=(yield Fi(xf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Di(Fo.setEmailDomainRestrictionsState({data:{config:e,restrictions:o},saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setEmailDomainRestrictionsState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*JT({payload:{id:e}}){yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield HT();try{var n;yield Fi(xf.auth.deleteDomainRestriction,e);const o=(yield Fi(xf.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield Di(Fo.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Bn.ALLOW},restrictions:o},saving:!1}))}catch(e){yield Di(Fo.setEmailDomainRestrictionsState({saving:!1,error:og(e)}))}}const QT=e=>{var t,n,o;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Bn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(o=null==e?void 0:e._offset)?o:0}};function*XT(){yield Di(Fo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield KT(),t=yield Fi(xf.auth.getIPRestrictionsConfig),n=QT({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield Fi(xf.auth.getIPRestrictions,n);yield Di(Fo.setIpRestrictionsState({data:{restrictions:o,config:t},totalPages:i,pagination:n,loading:!1}))}catch(e){yield Di(Fo.setIpRestrictionsState({error:og(e),loading:!1}))}}function*ZT(){try{const{valid:e}=yield Fi(xf.auth.testCurrentIpInAllowList);yield Di(Fo.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Di(Fo.setIpRestrictionsState({error:og(e)}))}}function*ek({payload:{callback:e}}){yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Vi((e=>e.auth.userIp));yield Ni([Fi(xf.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Bn.ALLOW}),Fi(xf.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield KT(),o=QT(n.pagination),{items:i,_metadata:{totalPages:a}}=yield Fi(xf.auth.getIPRestrictions,o);yield Di(Fo.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Bn.ALLOW},restrictions:i},userIpValid:!0,pagination:o,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield Di(Fo.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*tk(e){let{payload:{callback:t}}=e,n=Jo(e.payload,$T);yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));const o=yield KT();try{var i,a;yield Fi(xf.auth.createIPRestriction,n);const e=yield KT(),r=QT(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Fi(xf.auth.getIPRestrictions,r);yield ZT(),yield Di(Fo.setIpRestrictionsState({data:{config:null!=(i=null==(a=o.data)?void 0:a.config)?i:{isActive:!1,strategy:Bn.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setIpRestrictionsState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*nk(e){let{payload:{callback:t}}=e,n=Jo(e.payload,VT);yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));try{yield Fi(xf.auth.updateIPRestrictionConfig,n);const e=yield KT(),o=yield Fi(xf.auth.getIPRestrictionsConfig),i=QT(U({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield Fi(xf.auth.getIPRestrictions,i);yield ZT(),yield Di(Fo.setIpRestrictionsState({data:{config:o,restrictions:a},pagination:i,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setIpRestrictionsState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*ok({payload:{id:e,callback:t}}){yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));const n=yield KT();try{var o;yield Fi(xf.auth.deleteIPRestriction,e);const i=yield KT(),a=QT(i.pagination),{items:r,_metadata:{totalPages:l}}=yield Fi(xf.auth.getIPRestrictions,a);yield ZT(),yield Di(Fo.setIpRestrictionsState({data:{config:(null==(o=n.data)?void 0:o.config)||{isActive:!1,strategy:Bn.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setIpRestrictionsState({saving:!1,error:og(e)})),null==t||t(null,e)}}function*ik(){yield Da(Fo.loadIpRestrictions,gg(XT)),yield Da(Fo.loadEmailDomainRestrictions,gg(zT)),yield Ua(Fo.saveIpRestriction,gg(tk)),yield Ua(Fo.saveIpRestrictionsConfig,gg(nk)),yield Ua(Fo.deleteIpRestriction,gg(ok)),yield Ua(Fo.checkIfUserIpValid,gg(ZT)),yield Ua(Fo.addCurrentUserIpAndActivate,gg(ek)),yield Ua(Fo.saveEmailDomainRestriction,gg(qT)),yield Ua(Fo.saveEmailDomainRestrictionsConfig,gg(YT)),yield Ua(Fo.deleteEmailDomainRestriction,gg(JT))}function*ak(){yield Di(Fo.setIpRestrictionsState({loading:!0,error:null})),yield Di(Fo.setIpRestrictionsState({data:{restrictions:Fp.filter((e=>e.strategy===Mp.strategy)),config:Mp},totalPages:1,pagination:{_filter:Bn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*rk(){yield Di(Fo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield KT(),t=Fp[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield Di(Fo.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield Di(Fo.setIpRestrictionsState({error:og(e),loading:!1}))}}function*lk(e){var t,n,o;let{payload:{callback:i}}=e,a=Jo(e.payload,xT);yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));const r=yield KT(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield Di(Fo.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Bn.ALLOW},restrictions:[...l,U({},a,{createdAt:new Date,updatedAt:new Date,id:lA(),isActive:null==(o=a.isActive)||o,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Bn.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*sk(e){var t,n,o;let{payload:{callback:i}}=e,a=Jo(e.payload,BT);const r=yield KT();yield Di(Fo.setIpRestrictionsState({saving:!0,error:null})),yield Di(Fo.setIpRestrictionsState({data:{config:U({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(o=r.data)?void 0:o.restrictions)?n:[]},pagination:{_filter:Bn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield Di(Fo.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*ck({payload:{id:e,callback:t}}){var n;yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));const o=yield KT();yield Di(Fo.setIpRestrictionsState({data:{config:(null==(n=o.data)?void 0:n.config)||{isActive:!1,strategy:Bn.ALLOW},restrictions:o.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Bn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*uk(){yield Di(Fo.setEmailDomainRestrictionsState({loading:!0,error:null})),yield Di(Fo.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Bn.ALLOW}],config:{active:!0,listType:Bn.ALLOW,blockPublicDomains:!1}}}))}function*dk(e){var t,n;let{payload:{callback:o}}=e,i=Jo(e.payload,jT);const a=yield HT();yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield bt(),null==o||o(!0),yield Di(Fo.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:i.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],U({},i,{id:Date.now().toString()})]},saving:!1}))}function*yk(e){var t;let{payload:{callback:n}}=e,o=Jo(e.payload,WT);const i=yield HT();yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield bt(),null==n||n(!0),yield Di(Fo.setEmailDomainRestrictionsState({data:{config:{active:o.active,blockPublicDomains:o.blockPublicDomains||!1,listType:o.type||Bn.ALLOW},restrictions:[...(null==(t=i.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*fk({payload:{id:e}}){var t,n;const o=yield HT();yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield bt(),yield Di(Fo.setEmailDomainRestrictionsState({data:{config:(null==(t=o.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Bn.ALLOW},restrictions:((null==(n=o.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*pk(){yield Da(Fo.loadIpRestrictions,ak),yield Da(Fo.loadEmailDomainRestrictions,uk),yield Ua(Fo.saveIpRestriction,lk),yield Ua(Fo.saveIpRestrictionsConfig,sk),yield Ua(Fo.deleteIpRestriction,ck),yield Ua(Fo.checkIfUserIpValid,rk),yield Ua(Fo.saveEmailDomainRestriction,dk),yield Ua(Fo.saveEmailDomainRestrictionsConfig,yk),yield Ua(Fo.deleteEmailDomainRestriction,fk)}const gk=["callback"],Sk=["id"];function*vk(e){const{count:t}=yield Fi(xf.directory.countConfigurationUsers,e.id);return U({},e,{count:t})}function*hk(){yield Di(Fo.setProvisioningState({loading:!0,error:null}));try{const e=yield Fi(xf.directory.getConfigs),t=yield Ni(e.map((e=>vk(e))));yield Di(Fo.setProvisioningState({connections:t,loading:!1}))}catch(e){yield Di(Fo.setProvisioningState({error:og(e),loading:!1}))}}function*mk(e){let{payload:{callback:t}}=e,n=Jo(e.payload,gk);yield Di(Fo.setProvisioningState({loading:!0,error:null}));try{const e=yield Fi(xf.directory.createConfiguration,n),o=yield Fi(xf.directory.getConfigs),i=yield Ni(o.map((e=>vk(e))));yield Di(Fo.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield Di(Fo.setProvisioningState({error:og(e),loading:!1}))}}function*Ak(e){let{payload:{id:t}}=e,n=Jo(e.payload,Sk);yield Di(Fo.setProvisioningState({loading:!0,error:null}));try{yield Fi(xf.directory.updateConfiguration,t,n);const e=yield Fi(xf.directory.getConfigs),o=yield Ni(e.map((e=>vk(e))));yield Di(Fo.setProvisioningState({connections:o,loading:!1}))}catch(e){yield Di(Fo.setProvisioningState({error:og(e),loading:!1}))}}function*bk({payload:{id:e,callback:t}}){yield Di(Fo.setProvisioningState({loading:!0,error:null}));try{yield Fi(xf.directory.deleteConfiguration,e);const n=yield Fi(xf.directory.getConfigs),o=yield Ni(n.map((e=>vk(e))));yield Di(Fo.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setProvisioningState({error:og(e),loading:!1})),null==t||t(!1,e)}}function*Tk(){yield Da(Fo.loadProvisionConnections,hk),yield Ua(Fo.createProvisionConnection,mk),yield Ua(Fo.deleteProvisionConnection,bk),yield Ua(Fo.updateProvisionConnection,Ak)}const kk=["callback","events"];function*Ek(e){let{payload:{callback:t}}=e,n=Jo(e.payload,kk);yield Di(Fo.setImpersonateState({loading:!0}));try{yield Fi(xf.impersonate.impersonate,n),yield Di(Fo.setImpersonateState({step:Co.success})),yield xi(1e3),yield ev(),yield Di(Fo.resetImpersonateState()),null==t||t(!0)}catch(e){yield Di(Fo.setImpersonateState({loading:!1,error:og(e)}))}}function*Ik(){yield Da(Fo.impersonate,Ek)}function*Pk({payload:e}){const{callback:t,deviceId:n}=e;yield Di(Fo.setPasskeysState({loading:!0}));try{yield Fi(xf.auth.deleteWebAuthnDevice,n);const{devices:e}=yield Vi((e=>e.auth.passkeysState)),o=e.filter((e=>e.id!==n));yield Di(Fo.setPasskeysState({devices:o,loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setPasskeysState({loading:!1,error:og(e,null)})),null==t||t(null,e)}}function*Lk(){yield Di(Fo.setPasskeysState({loading:!0}));try{const{devices:e}=yield Fi(xf.auth.getWebAuthnDevices);yield Di(Fo.setPasskeysState({devices:e,loading:!1}))}catch(e){yield Di(Fo.setPasskeysState({loading:!1,error:og(e,null)}))}}function*Ok(){yield Ua(Fo.loadWebAuthnDevices,Lk),yield Ua(Fo.deleteWebAuthnDevice,Pk)}const _k=["roleIds","userIds"],wk=()=>Vi((e=>e.auth.groupsState));function*Ck({payload:e}){const t=sA.GET_TEAM_USERS;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Fi(xf.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield Di(Fo.setGroupsState({teamUsers:n}))}catch(e){yield Di(Fo.setUsersGroupsError({key:t,value:og(e)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Uk({payload:e}){const t=sA.GET_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Fi(xf.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:cA.rolesAndUsers});yield Di(Fo.setGroupsState({selectedGroup:n}))}catch(e){yield Di(Fo.setUsersGroupsError({key:t,value:og(e)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Rk(){const e=sA.GET_GROUPS,t=yield wk();yield Di(Fo.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Fi(xf.groups.getGroups,{_groupsRelations:cA.rolesAndUsers});yield Di(Fo.setGroupsState(U({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield Di(Fo.setUsersGroupsError({key:e,value:og(t)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:e,value:!1}))}}function*Dk({payload:e}){const t=sA.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Jo(e,_k);yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Fi(xf.groups.createGroup,U({name:i.name},!!i.description&&{description:i.description},{color:i.color}));null!=o&&o.length&&(yield Di(Fo.addUsersToGroup({groupId:r.id,userIds:o}))),null!=n&&n.length&&(yield Di(Fo.addRolesToGroup({groupId:r.id,roleIds:n}))),yield Di(Fo.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield Di(Fo.setUsersGroupsError({key:t,value:og(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Nk({payload:e}){const t=sA.UPDATE_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(xf.groups.updateGroup,e),yield Di(Fo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Di(Fo.setUsersGroupsError({key:t,value:og(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Mk({payload:e}){const t=sA.DELETE_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(xf.groups.deleteGroup,e.groupId),yield Di(Fo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Di(Fo.setUsersGroupsError({key:t,value:og(n)})),null==e||null==(o=e.callback)||o.call(e,!1,n)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Fk({payload:e}){const t=sA.ADD_ROLES_TO_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(xf.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield Di(Fo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Di(Fo.setUsersGroupsError({key:t,value:og(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Gk({payload:e}){const t=sA.DELETE_ROLES_FROM_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(xf.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield Di(Fo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Di(Fo.setUsersGroupsError({key:t,value:og(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*$k({payload:e}){const t=sA.ADD_USERS_TO_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(xf.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield Di(Fo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;null==e||null==(o=e.callback)||o.call(e,!1),yield Di(Fo.setUsersGroupsError({key:t,value:og(n)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Vk({payload:e}){const t=sA.DELETE_USERS_FROM_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(xf.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield Di(Fo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Di(Fo.setUsersGroupsError({key:t,value:og(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*xk(){const e=sA.GET_GROUP_CONFIGURATION;yield Di(Fo.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Fi(xf.groups.getGroupConfiguration);yield Di(Fo.setGroupsState({groupsConfiguration:t}))}catch(t){yield Di(Fo.setUsersGroupsError({key:e,value:og(t)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:e,value:!1}))}}function*Bk({payload:e}){const t=sA.UPDATE_GROUP_CONFIGURATION;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{yield Fi(xf.groups.updateGroupConfiguration,e),yield Di(Fo.getGroupConfiguration())}catch(e){yield Di(Fo.setUsersGroupsError({key:t,value:og(e)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*jk(){yield Ra(Fo.loadGroups,Rk),yield Ra(Fo.getGroupById,Uk),yield Ra(Fo.createGroup,Dk),yield Ra(Fo.updateGroup,Nk),yield Ra(Fo.deleteGroup,Mk),yield Ra(Fo.addRolesToGroup,Fk),yield Ra(Fo.deleteRolesFromGroup,Gk),yield Ra(Fo.addUsersToGroup,$k),yield Ra(Fo.deleteUsersFromGroup,Vk),yield Ra(Fo.getGroupConfiguration,xk),yield Ra(Fo.updateGroupConfiguration,Bk),yield Ra(Fo.getTeamUsers,Ck)}function*Wk(){const e=sA.GET_GROUPS;yield Di(Fo.setUsersGroupsLoader({key:e,value:!0}));const t=Vp;yield Di(Fo.setGroupsState({groups:t})),yield Di(Fo.setUsersGroupsLoader({key:e,value:!1}))}function*Kk({payload:e}){var t;const n=sA.CREATE_GROUP,{groups:o}=yield wk();yield Di(Fo.setUsersGroupsLoader({key:n,value:!0})),yield Di(Fo.setGroupsState({groups:[U({},e,{id:`${e.name}ID`,managedBy:Nf.FRONTEGG}),...null!=o?o:[]]})),yield xi(500),null==e||null==(t=e.callback)||t.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:n,value:!1}))}function*Hk({payload:e}){var t,n,o,i,a;const r=sA.UPDATE_GROUP,l=yield wk();yield Di(Fo.setUsersGroupsLoader({key:r,value:!0})),yield Di(Fo.setGroupsState({groups:null==l||null==(t=l.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:Nf.FRONTEGG}):t})),selectedGroup:U({},null==l?void 0:l.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(o=null==e?void 0:e.color)?o:"",description:null!=(i=null==e?void 0:e.description)?i:""})})),yield xi(500),null==e||null==(a=e.callback)||a.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:r,value:!1}))}function*zk({payload:e}){var t,n;const o=sA.DELETE_GROUP,i=yield wk();yield Di(Fo.setUsersGroupsLoader({key:o,value:!0})),yield Di(Fo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield xi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*qk({payload:e}){var t,n;const o=sA.ADD_ROLES_TO_GROUP,i=yield wk();yield Di(Fo.setUsersGroupsLoader({key:o,value:!0})),yield Di(Fo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield xi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*Yk({payload:e}){var t,n;const o=sA.DELETE_ROLES_FROM_GROUP,i=yield wk();yield Di(Fo.setUsersGroupsLoader({key:o,value:!0})),yield Di(Fo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield xi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*Jk({payload:e}){var t,n;const o=sA.ADD_USERS_TO_GROUP,i=yield wk();yield Di(Fo.setUsersGroupsLoader({key:o,value:!0})),yield Di(Fo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield xi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*Qk({payload:e}){var t,n;const o=sA.DELETE_USERS_FROM_GROUP,i=yield wk();yield Di(Fo.setUsersGroupsLoader({key:o,value:!0})),yield Di(Fo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield xi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*Xk(){const e=sA.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield wk();yield Di(Fo.setUsersGroupsLoader({key:e,value:!0})),t&&(yield Di(Fo.setGroupsState({groupsConfiguration:U({},t)}))),yield Di(Fo.setUsersGroupsLoader({key:e,value:!1}))}function*Zk({payload:e}){const t=sA.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield wk();yield Di(Fo.setUsersGroupsLoader({key:t,value:!0})),n&&(yield Di(Fo.setGroupsState({groupsConfiguration:U({},n,e)}))),yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}function*eE(){yield Ra(Fo.loadGroups,Wk),yield Ra(Fo.createGroup,Kk),yield Ra(Fo.updateGroup,Hk),yield Ra(Fo.deleteGroup,zk),yield Ra(Fo.addRolesToGroup,qk),yield Ra(Fo.deleteRolesFromGroup,Yk),yield Ra(Fo.addUsersToGroup,Jk),yield Ra(Fo.deleteUsersFromGroup,Qk),yield Ra(Fo.getGroupConfiguration,Xk),yield Ra(Fo.updateGroupConfiguration,Zk)}let tE;!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.SET_ROOT_ACCOUNT_DATA="SET_ROOT_ACCOUNT_DATA",e.SET_SELECTED_SUB_ACCOUNT_DATA="SET_SELECTED_SUB_ACCOUNT_DATA",e.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT="LOAD_NUMBER_OF_USERS_FOR_ACCOUNT",e.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER="UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER",e.CREATE_SUB_ACCOUNT="CREATE_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT="UPDATE_SUB_ACCOUNT",e.DELETE_SUB_ACCOUNT="DELETE_SUB_ACCOUNT",e.GET_ACCOUNT_USERS="GET_ACCOUNT_USERS",e.ADD_USERS_TO_ACCOUNT="ADD_USERS_TO_ACCOUNT",e.DELETE_USERS_FROM_ACCOUNT="DELETE_USERS_FROM_ACCOUNT",e.SET_USER_ROLES_FOR_SUB_ACCOUNT="SET_USER_ROLES_FOR_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT_SETTINGS="UPDATE_SUB_ACCOUNT_SETTINGS",e.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(tE||(tE={}));const nE=(e,t,n)=>{var o,i;return e.tenantId===t?U({},e,{name:n}):U({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>nE(e,t,n))))?o:[]})};function oE(e,t){var n;return U({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>oE(e,t))):[]})}function iE(e,t,n){var o,i;if(e.tenantId===t){var a;const t=[...null!=(a=null==e?void 0:e.children)?a:[],...n].filter(((e,t,n)=>t===n.findIndex((t=>t.tenantId===e.tenantId))));return U({},e,{children:t})}return U({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>iE(e,t,n))))?o:[]})}const aE=({items:e},t)=>e.map((e=>{var n,o;return{name:e.name,tenantId:e.tenantId,numberOfUsers:null!=(n=null==(o=t.find((t=>t.tenantId===e.tenantId)))?void 0:o.totalUsers)?n:0,createdAt:e.createdAt,metadata:e.metadata}})),rE=()=>Vi((e=>e.auth.allAccountsState));function*lE({payload:e}){const t=tE.GET_ACCOUNTS;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield rE(),{jwt:o,_limit:i,_offset:a}=e,r={_offset:null!=a?a:n._offset,_limit:null!=i?i:n._limit,_subTenantId:null==e?void 0:e._subTenantId};try{if(o){var l;const{selectedAccount:t}=yield rE(),{items:n,_links:i}=yield Fi(xf.tenants.searchSubTenants,r,{jwt:o}),a=yield Fi(xf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:o}),s=aE({items:n},a),c=iE(t.accounts?t.accounts:t,null!=(l=null==e?void 0:e._subTenantId)?l:"",s.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==i?void 0:i.next}))));yield Di(Fo.setSelectedAccountState({accounts:c}))}else{var s;const{accounts:t}=yield rE(),{items:n,_links:o}=yield Fi(xf.tenants.searchSubTenants,r),i=yield Fi(xf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=aE({items:n},i),l=iE(t,null!=(s=null==e?void 0:e._subTenantId)?s:"",a.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==o?void 0:o.next}))));yield Di(Fo.setAllAccountsState({accounts:l}))}}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*sE({payload:e}){const t=tE.SEARCH_ACCOUNTS;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield rE(),{jwt:o}=e;try{if(null!=e&&e._subTenantId){var i;const{items:t}=yield Fi(xf.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(i=null==e?void 0:e._filter)?i:"",_subTenantId:e._subTenantId},{jwt:o});yield Di(Fo.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*cE({payload:e}){const t=tE.GET_USER_JWT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:o}=e;try{const e=yield Fi(xf.users.GetUserJwt,{tenantId:n});yield Di(Fo.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==o||o(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),yield Di(Fo.setSelectedAccountState({accessPermission:!1})),null==o||o(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*uE({payload:e}){const t=tE.CREATE_SUB_ACCOUNT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:o,tenantId:i,jwt:a,callback:r}=e;try{if(a){const{accounts:e}=yield rE(),{selectedAccount:t}=yield rE(),r=yield Fi(xf.subTenants.createSubTenant,{name:n,parentTenantId:o,tenantId:i},{jwt:a}),l=iE(e,null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),s=iE(U({name:"",tenantId:""},null==t?void 0:t.accounts),null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Di(Fo.setAllAccountsState({accounts:l})),yield Di(Fo.setSelectedAccountState({accounts:s}))}else{const{accounts:e}=yield rE(),t=yield Fi(xf.subTenants.createSubTenant,{name:n,tenantId:i,parentTenantId:o}),a=iE(e,null!=o?o:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Di(Fo.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),null==r||r(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*dE({payload:e}){const t=tE.DELETE_SUB_ACCOUNT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:o,callback:i}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield rE();yield Fi(xf.subTenants.deleteSubTenant,o,{jwt:n});const i=oE(t,o),a=oE(null==e?void 0:e.accounts,o);yield Di(Fo.setAllAccountsState({accounts:i})),yield Di(Fo.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield rE();yield Fi(xf.subTenants.deleteSubTenant,o);const t=oE(e,o);yield Di(Fo.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),null==i||i(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*yE({payload:e}){const t=tE.UPDATE_SUB_ACCOUNT_SETTINGS;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:o,callback:i,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield rE();yield Fi(xf.subTenants.updateSubTenant,{tenantId:a},{name:o},{jwt:n});const i=nE(e.accounts,a,o);yield Di(Fo.setSelectedAccountState({name:o,accounts:i}));const r=nE(t,a,o);yield Di(Fo.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield rE();yield Fi(xf.subTenants.updateSubTenant,{tenantId:a},{name:o});const t=nE(e,a,o);yield Di(Fo.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),null==i||i(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*fE({payload:e}){const t=tE.DELETE_USERS_FROM_ACCOUNT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:o,jwt:i,callback:a}=e;try{yield Fi(xf.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:o},{jwt:i}),yield Di(Fo.getAccountUsers({jwt:i,_tenantId:o[0].tenantId})),null==a||a(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),null==a||a(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*pE({payload:e}){const t=tE.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:o,jwt:i,callback:a}=e,{selectedAccount:r}=yield rE();try{yield Fi(xf.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:o},{jwt:i}),yield Di(Fo.getAccountUsers({jwt:i,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),null==a||a(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*gE({payload:e}){const t=tE.ADD_USERS_TO_ACCOUNT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:o,jwt:i,callback:a,allowSubAccountAccess:r=!1,roleIds:l}=e;try{yield Fi(xf.subTenants.addUsersToSubTenant,{users:n,tenantId:o,allowSubAccountAccess:r,roleIds:l},{jwt:i}),yield Di(Fo.getAccountUsers({jwt:i,_tenantId:o})),null==a||a(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),null==a||a(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*SE({payload:e}){const t=tE.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield rE(),{userId:o,allowAccess:i,jwt:a,callback:r}=e;try{var l;yield Fi(xf.subTenants.updateSubAccountAccess,o,{allowAccess:i},{jwt:a}),yield Di(Fo.setSelectedAccountState({users:null==n||null==(l=n.users)?void 0:l.map((e=>e.id===o?U({},e,{subAccountAccessAllowed:i}):e))})),null==r||r(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)})),null==r||r(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*vE({payload:e}){var t,n,o,i,a,r,l,s;const c=tE.GET_ACCOUNT_USERS;yield Di(Fo.setAllAccountsLoader({key:c,value:!0}));const u=yield rE(),{jwt:d,_tenantId:y,_email:f}=e,p=null!=(t=null!=(n=null==e?void 0:e._offset)?n:null==u||null==(o=u.selectedAccount)||null==(i=o.usersQueryParams)?void 0:i._offset)?t:0,g=null!=(a=null!=(r=null==e?void 0:e._limit)?r:null==u||null==(l=u.selectedAccount)||null==(s=l.usersQueryParams)?void 0:s._limit)?a:10,S=U({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield Fi(xf.users.getUsersV3,S,{jwt:d}),o={totalUsersItems:t,totalUsersPages:n,usersQueryParams:U({_offset:null!=p?p:0,_limit:null!=g?g:10},!!f&&{_email:f})};if(e.length){const t=e.map((e=>e.id)),n=yield Fi(xf.roles.getRoles),i=yield Fi(xf.users.getUsersRoles,{ids:t},{jwt:d}),a=e.map((e=>{var t,o;const a=null==i||null==(t=i.find((t=>t.userId===e.id)))?void 0:t.roleIds;return U({},e,{roles:null!=(o=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?o:[]})}));yield Di(Fo.setSelectedAccountState(U({users:a},o)))}else yield Di(Fo.setSelectedAccountState(U({users:[]},o)))}catch(e){yield Di(Fo.setAllAccountsError({key:c,value:og(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:c,value:!1}))}}function*hE({payload:e}){const t=tE.SET_SELECTED_SUB_ACCOUNT_DATA;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var o,i,a,r,l,s,c;const e=yield Fi(xf.accountSettings.getSettings,{jwt:n}),u=yield Fi(xf.tenants.getTenantsUsersCount,{tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n}),d=yield Fi(xf.tenants.getParentTenants,{jwt:n}),y=yield Fi(xf.tenants.getHierarchyMetadata,{_tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n});yield Di(Fo.setSelectedAccountState({tenantId:null!=(a=e.tenantId)?a:"",name:e.name,numberOfUsersObject:u[0],parentsAccounts:d,numberOfSubAccounts:null==(r=y[0])?void 0:r.totalSubTenants,accountSettings:e,accounts:{name:e.name,tenantId:null!=(l=e.tenantId)?l:"",numberOfUsers:null==(s=u[0])?void 0:s.totalUsers,createdAt:void 0,children:[]}})),yield Di(Fo.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*mE(){const e=tE.SET_ROOT_ACCOUNT_DATA;yield Di(Fo.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield Vi((e=>e.auth.tenantsState)),{accounts:n}=yield rE();if(t)try{var o;const i=yield Fi(xf.tenants.getTenantsUsersCount,{tenantIds:[null==t?void 0:t.tenantId]}),a={name:null==t?void 0:t.name,tenantId:null==t?void 0:t.tenantId,numberOfUsers:null==(o=i[0])?void 0:o.totalUsers,createdAt:null==t?void 0:t.createdAt};yield Di(Fo.setAllAccountsState({rootAccount:a,accounts:U({},n,a)}))}catch(t){yield Di(Fo.setAllAccountsError({key:e,value:og(t)}))}finally{yield Di(Fo.setAllAccountsLoader({key:e,value:!1}))}}function*AE({payload:e}){const t=tE.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:o}=e;try{const e=yield Fi(xf.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:o});yield Di(Fo.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:og(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*bE(){yield Ra(Fo.loadAccounts,lE),yield Ra(Fo.searchAccounts,sE),yield Ra(Fo.updateSubAccountAccessForUser,SE),yield Ra(Fo.getUserJwtForSubAccount,cE),yield Ra(Fo.createSubAccount,uE),yield Ra(Fo.deleteSubAccount,dE),yield Ra(Fo.updateSubAccountSettings,yE),yield Ra(Fo.addUsersToAccount,gE),yield Ra(Fo.deleteUsersFromAccount,fE),yield Ra(Fo.setUserRolesForSubAccount,pE),yield Ra(Fo.getAccountUsers,vE),yield Ra(Fo.setRootAccountData,mE),yield Ra(Fo.setSelectedSubAccountData,hE),yield Ra(Fo.loadNumberOfUsersForSelectedSubAccount,AE)}const TE=["callback"],kE=["callback"],EE=["callback","phoneId"],IE=["callback","phoneId"],PE=["callback"];function*LE(){yield Di(Fo.setSmsState({loading:!0}));const e={_limit:10,_offset:0};try{const{items:t}=yield Fi(xf.userPhoneNumbers.getUserPhoneNumbers,e);yield Di(Fo.setSmsState({phoneNumbers:t}))}catch(e){yield Di(Fo.setSmsState({error:og(e)}))}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*OE(e){let{payload:{callback:t}}=e,n=Jo(e.payload,TE);yield Di(Fo.setSmsState({loading:!0}));try{const e=yield Fi(xf.userPhoneNumbers.createPhoneNumber,n);yield Di(Fo.setSmsState({otcToken:e.otcToken})),yield Fi(LE),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*_E(e){let{payload:{callback:t}}=e,n=Jo(e.payload,kE);yield Di(Fo.setSmsState({loading:!0}));try{yield Fi(xf.userPhoneNumbers.verifyPhoneNumber,n),yield Fi(LE),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*wE(e){let{payload:{callback:t,phoneId:n}}=e;Jo(e.payload,EE),yield Di(Fo.setSmsState({loading:!0}));try{const e=yield Fi(xf.userPhoneNumbers.deletePhoneNumber,n);yield Di(Fo.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*CE(e){let{payload:{callback:t,phoneId:n}}=e,o=Jo(e.payload,IE);yield Di(Fo.setSmsState({loading:!0}));try{yield Fi(xf.userPhoneNumbers.verifyDeletePhoneNumber,n,o),yield Fi(LE),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*UE(e){let{payload:{callback:t}}=e,n=Jo(e.payload,PE);yield Di(Fo.setSmsState({loading:!0}));try{const e=yield Fi(xf.userPhoneNumbers.preVerifyPhoneNumber,n);yield Di(Fo.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:og(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*RE(){yield Ua(Fo.loadPhoneNumbers,LE),yield Ua(Fo.setUpPhoneNumber,OE),yield Ua(Fo.verifyPhoneNumber,_E),yield Ua(Fo.deletePhoneNumber,wE),yield Ua(Fo.verifyDeletePhoneNumber,CE),yield Ua(Fo.preVerifyPhoneNumber,UE)}var DE={sagas:function*(){yield Ni([Fi(Zv),Fi(Qm),Fi(Zm),Fi(xm),Fi(hT),Fi(gh),Fi(jh),Fi(Yh),Fi(yg),Fi(Lm),Fi(nb),Fi(jk),Fi(kb),Fi(hS),Fi(Ub),Fi(eS),Fi(xb),Fi(Yb),Fi(cT),Fi(ET),Fi(RT),Fi(ik),Fi(Tk),Fi(Ik),Fi(Ok),Fi(bE),Fi(wS),Fi(Eg),Fi(RE)])},mockSagas:function*(){yield Ni([Fi(nh),Fi(Th),Fi(Zh),Fi(Mm),Fi(gb),Fi(Gb),Fi(fS),Fi(OT),Fi(Wb),Fi(Qb),Fi(MT),Fi(pk),Fi(dT),Fi(eE),Fi(Cg)])},storeName:Ct,initialState:wo,reducer:No,actions:Fo};const NE=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),ME={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},FE={setAuditLogsState:NE("auditLogsState"),resetAuditLogsState:e=>U({},e,{auditLogsState:ME})},GE={exportAuditsCsv:ut("auditLogs/exportAuditsCsv"),loadAuditLogs:ut("auditLogs/loadAuditLogs",(e=>({payload:e})))},$E={loading:!0},VE={setAuditsMetadataState:NE("auditsMetadataState"),resetAuditsMetadataState:e=>U({},e,{auditsMetadataState:$E})},xE={loadAuditsMetadata:ut("auditLogs/loadAuditsMetadata")},BE={auditLogsState:ME,auditsMetadataState:$E},{reducer:jE,actions:WE}=yt({name:Rt,initialState:BE,reducers:U({resetState:e=>U({},e,BE),setState:(e,{payload:t})=>U({},e,t)},FE,VE)}),KE=U({},WE,GE,xE),HE=e=>"createdAt"!==e.id,zE={total:20,data:Array.from(Array(5).keys()).map((e=>U({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`})))},qE={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}]},YE=()=>Vi((e=>e.auditLogs.auditLogsState)),JE=()=>Vi((e=>e.auditLogs.auditsMetadataState));function*QE(){const e=yield YE(),{columns:t}=yield JE();try{const n=e.filter,o=e.sort.reduce(((e,t)=>U({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),i=n.reduce(((e,t)=>U({},e,{[t.id]:t.value})),{});yield Di(KE.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield xf.audits.exportAudits(U({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},o,i))}catch(e){console.error("failed to export audits - ",e)}yield Di(KE.setAuditLogsState({isDownloadingCsv:!1}))}function*XE({payload:e}){yield Di(KE.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield YE(),{columns:n}=yield JE();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield Di(KE.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>U({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>U({},e,{[t.id]:t.value})),{});n||(yield Di(KE.loadAuditsMetadata()));const{data:p,total:g}=yield Fi(xf.audits.getAudits,U({offset:c,count:s},y,f));yield Di(KE.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield Di(KE.setAuditLogsState({loading:!1,error:og(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*ZE(){yield Ua(KE.exportAuditsCsv,QE),yield Ua(KE.loadAuditLogs,XE)}function*eI({payload:e}){yield Di(KE.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield YE(),{columns:n}=yield JE();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield Di(KE.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield Di(KE.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=zE;let o=n.filter((e=>t=>e.filter(HE).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];o=o.sort(((e,t)=>(n,o)=>n[e]>o[e]?t?-1:1:o[e]>n[e]?t?1:-1:0)(e,n))}return{data:o,total:o.length}})(u,d);yield Di(KE.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 Di(KE.setAuditLogsState({loading:!1,error:og(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*tI(){yield Ua(KE.loadAuditLogs,eI)}function*nI(){yield Di(KE.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Fi(xf.metadata.getAuditsMetadata);yield Di(KE.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Di(KE.setAuditsMetadataState({error:e,loading:!1}))}}function*oI(){yield Ua(KE.loadAuditsMetadata,nI)}function*iI(){yield Di(KE.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=qE;yield Di(KE.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Di(KE.setAuditsMetadataState({error:e,loading:!1}))}}function*aI(){yield Ua(KE.loadAuditsMetadata,iI)}var rI={sagas:function*(){yield Ni([Fi(ZE),Fi(oI)])},mockSagas:function*(){yield Ni([Fi(tI),Fi(aI)])},storeName:Rt,initialState:BE,reducer:jE,actions:KE};const lI={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:sI,actions:cI,reducer:uI}=yt({name:"audits",initialState:lI,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=U({},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]})))}}}),dI=U({},cI,{initData:ut(`${sI}/initData`),loadAudits:ut(`${sI}/loadAudits`),removeFilter:ut(`${sI}/removeFilter`),filterData:ut(`${sI}/filterData`),exportCSV:ut(`${sI}/exportCSV`),deleteAudits:ut(`${sI}/deleteAudits`)}),yI=()=>Vi((e=>e[sI]));function*fI(){const{sortBy:e,sortDirection:t}=yield yI();try{const n=yield Fi(xf.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Di(dI.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Di(dI.loadItemFailedAction(t))}}function*pI(){try{const e=yield Fi(xf.metadata.getAuditsMetadata);yield Di(dI.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Di(dI.loadItemFailedAction(t))}}const gI=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*SI({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield yI(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield yI():{rowsData:[]};try{const e=gI(t),{data:l,total:d}=yield Fi(xf.audits.getAudits,U({},r&&{paginationMode:"virtual"},{sortDirection:o,sortBy:n,filter:i},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield Di(dI.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield Di(dI.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Di(dI.loadItemFailedAction(t))}}function*vI(){yield Di(dI.startLoading()),yield Ni([fI(),pI(),SI({payload:{onlyOneLoad:!1},type:""})]),yield Di(dI.finishLoading())}function*hI({payload:e}){const{filters:t}=yield yI(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield Di(dI.setFilterData(o))}function*mI({payload:e}){const{filters:t}=yield yI();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const o=[...t.slice(0,n),e,...t.slice(n+1)];yield Di(dI.setFilterData(o))}function*AI(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield yI(),a=gI(e);yield Di(dI.startDownloadingCsv());try{yield xf.audits.exportAudits(U({endpoint:"csv/v2",headerProps:i,sortDirection:n,sortBy:t,filter:o},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield Di(dI.stopDownloadingCsv())}}function*bI(){yield Ra(dI.initData,vI),yield Ra(dI.removeFilter,hI),yield Ra(dI.filterData,mI),yield Ra([dI.loadAudits,dI.textSearch,dI.onPageChange],SI),yield Ra([dI.setFilterData,dI.setDataSorting,dI.startRefresh],(()=>SI({payload:{appendMode:!1},type:""}))),yield Ra(dI.exportCSV,AI)}const TI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},kI={initData:()=>U({},TI),setConnectivityState:(e,{payload:t})=>U({},e,t),cleanWebhookTestData:e=>U({},e,{testResult:void 0}),cleanWebhookLogsData:e=>U({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return U({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>U({},e,{error:void 0}),cleanSlackData:e=>U({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>U({},e,{retryResult:U({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>U({},e,{retryResult:U({},e.retryResult,t)})}},EI={loadSlackActions:ut("connectivity/loadSlackActions"),loadDataAction:ut("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:ut("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:ut("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:ut("connectivity/loadScope"),deleteWebhookConfigAction:ut("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:ut("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:ut("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},II={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:PI,actions:LI}=yt({name:Ut,initialState:II,reducers:U({},kI)}),OI=U({},LI,EI),_I={slack:xf.connectivity.getSlackConfiguration,email:xf.connectivity.getEmailConfiguration,sms:xf.connectivity.getSMSConfiguration,webhook:xf.connectivity.getWebhooksConfigurations,categories:xf.connectivity.getCategories,channelMap:xf.connectivity.getChannelMaps},wI={slack:xf.connectivity.postSlackConfiguration,email:xf.connectivity.postEmailConfiguration,sms:xf.connectivity.postSMSConfiguration,webhook:xf.connectivity.postWebhooksConfiguration},CI=["email","slack","sms","webhook"],UI={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"}},RI=["id"],DI=["id","enabled"],NI=["categories","channelMap"];function*MI(e){return yield Fi(GI,{payload:{api:e},type:""})}function*FI({payload:e=CI}){yield Di(OI.setConnectivityState({isLoading:!0}));try{const t=yield Ni([...e.map(MI),yield GI({payload:{api:"categories"},type:""}),yield function*(){return(yield Ni(e.map((function*(e){return yield GI({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>U({},t,{[`${e[o]}`]:n})),{})}()]),n=yield GI({payload:{api:"webhook"},type:""}),o=t.reduce(((n,o,i)=>e[i]?t[t.length-1][e[i]].length?U({},n,{[`${e[i]}`]:o,list:[...n.list,{id:i,key:e[i],events:UI[e[i]].events(o),active:UI[e[i]].isActive(o),platform:UI[e[i]].title,image:UI[e[i]].image}]}):n:U({},n,{[`${NI[i-e.length]}`]:o})),{list:[],webhook:n});yield Di(OI.setConnectivityState(U({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Di(OI.setConnectivityState({isLoading:!1}))}}function*GI({payload:{api:e,params:t}}){try{return yield Fi(_I[e],t)}catch(e){return}}function*$I(){try{yield Di(OI.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Fi(xf.connectivity.getSlackChannels);yield Di(OI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Di(OI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*VI(e,t){const{connectivity:{list:n}}=yield Vi(),o=n.find((({key:t})=>t===e));if(!o)return;const i=UI[e].isActive(t);i!==o.active&&(yield Di(OI.setConnectivityState({list:n.map((t=>t.key===e?U({},t,{active:i}):t))})))}function*xI({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield Vi((e=>e.connectivity));try{if(yield Di(OI.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...o]:o})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Vi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:o}=e;yield Ni([...o.reduce(((e,t)=>{var o,i;return!t.id&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length||(null==n?void 0:n.find((e=>{let{id:n}=e,o=Jo(e,RI);return n===t.id&&JSON.stringify(U({id:n},o))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length?[...e,t]:e}),[]).map((function*(e){return yield Fi(wI.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Fi(xf.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Vi(),{processIds:o}=yield Vi((e=>e.connectivity)),i=n[t];if(!i)return;let a=[];try{a=yield Ni([...e.reduce(((e,t)=>!i.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield Fi("email"===t?xf.connectivity.postEmailConfiguration:xf.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:o}=e,i=n[0],{id:a="",enabled:r}=i,l=Jo(i,DI);return yield Ni([yield Fi("email"===t?xf.connectivity.patchEmailConfiguration:xf.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield Fi("email"===t?xf.connectivity.putEmailSubscriptions:xf.connectivity.putSMSSubscriptions,a,o,U({},l,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=i.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 Fi("email"===t?xf.connectivity.deleteEmailSubscriptions:xf.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield GI({payload:{api:t},type:""});yield Di(OI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield VI(t,e)}else yield Di(OI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield Fi(wI[e],t),!["sms","email"].includes(e)){const i=yield GI({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield Di(OI.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield VI(e,i),null==n||n(!0)}}catch(e){yield Di(OI.setConnectivityState({error:og(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*BI({payload:e}){try{yield xf.connectivity.postSlackCode(e)}catch{}yield Di(OI.setConnectivityState({error:void 0,isSaving:!1}))}function*jI(){const{slackChannels:e}=yield Vi((e=>e.connectivity));try{yield Di(OI.setConnectivityState({slackChannels:U({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Fi(xf.connectivity.getSlackScope);yield Di(OI.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Di(OI.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*WI({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield Vi((e=>e.connectivity));try{yield Di(OI.setConnectivityState({isSaving:!0})),yield Fi(xf.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,og(e))}const i=yield GI({payload:{api:"webhook"},type:""});i&&(yield Di(OI.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*KI({payload:e}){try{yield Di(OI.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Fi(xf.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Di(OI.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Di(OI.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Di(OI.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*HI({payload:e}){try{const{statusCode:t}=yield Fi(xf.connectivity.postWebhookRetry,e);yield Di(OI.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Di(OI.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*zI({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield Vi((e=>e.connectivity));try{yield Di(OI.setConnectivityState({webhookLogs:U({},o,{isLoading:!0})}));const i=yield Fi(xf.connectivity.getWebhookLog,e,n,t);yield Di(OI.setConnectivityState({error:void 0,webhookLogs:U({isLoading:!1},i)}))}catch(e){yield Di(OI.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var qI={sagas:function*(){yield Ua(OI.loadDataAction,FI),yield Ra(OI.loadSlackActions,$I),yield Ua(OI.postDataAction,xI),yield Ua(OI.postCodeAction,BI),yield Ua(OI.loadScope,jI),yield Ua(OI.deleteWebhookConfigAction,WI),yield Ua(OI.postWebhookTestAction,KI),yield Ua(OI.postWebhookRetryAction,HI),yield Ra(OI.loadWebhookLogsAction,zI)},storeName:Ut,initialState:II,reducer:PI,actions:OI};function YI(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}}function JI(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>U({},n,{[e]:t(n[e],o)})}}function QI(e){return JI(e,((e,t)=>U({},e,{loading:t.payload})))}function XI(e){return JI(e,((e,t)=>U({},e,{error:t.payload,loading:!1})))}const ZI={loading:!1,error:null,fetching:!0,plans:[]},{actions:eP,reducer:tP,name:nP}=yt({name:"subscriptions/plans",initialState:ZI,reducers:U({},YI())}),oP=U({loadPlans:ut(`${nP}/loadPlans`)},eP),iP={loading:!1,error:null,fetching:!0,config:null},aP=U({},YI()),{actions:rP,reducer:lP,name:sP}=yt({name:"subscriptions/config",initialState:iP,reducers:aP}),cP=U({loadPaymentConfiguration:ut(`${sP}/loadPaymentConfiguration`)},rP),uP={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},dP=U({},YI(),{setCancellationLoading:QI("cancellation"),setCancellationError:XI("cancellation"),setRenewalLoading:QI("renewal"),setRenewalError:XI("renewal")}),{reducer:yP,actions:fP,name:pP}=yt({name:"subscriptions/billing/subscription",initialState:uP,reducers:dP}),gP=U({load:ut(`${pP}/loadSubscription`),cancelSubscription:ut(`${pP}/cancelSubscription`),renewSubscription:ut(`${pP}/renewSubscription`)},fP),SP={loading:!1,error:null,fetching:!0},vP=U({},YI()),{reducer:hP,actions:mP,name:AP}=yt({name:"subscriptions/billing/information",initialState:SP,reducers:vP}),bP=U({loadBillingInformation:ut(`${AP}/loadBillingInformation`),cancelSubscription:gP.cancelSubscription,renewSubscription:gP.renewSubscription},mP),TP={loading:!1,error:null,fetching:!0},kP=U({},YI(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}),{reducer:EP,actions:IP,name:PP}=yt({name:"subscriptions/billing/payment",initialState:TP,reducers:kP}),LP=U({loadPaymentMethod:ut(`${PP}/loadPaymentMethod`),submitPaymentMethod:ut(`${PP}/submitPaymentMethod`),submitPaymentMethodError:ut(`${PP}/submitPaymentMethodError`),submitPaymentMethodSuccess:ut(`${PP}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:ut(`${PP}/updateBillingDetails`,(e=>({payload:e})))},IP),OP={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},_P=U({},YI(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{invoiceDownload:U({},e.invoiceDownload,t.payload)})}}),{reducer:wP,actions:CP,name:UP}=yt({name:"subscriptions/billing/invoices",initialState:OP,reducers:_P}),RP=U({loadInvoices:ut(`${UP}/loadInvoices`),downloadInvoice:ut(`${UP}/downloadInvoice`,(e=>({payload:e})))},CP),DP={information:SP,invoices:OP,paymentMethod:TP,subscription:uP},NP={invoices:RP,information:bP,paymentMethod:LP,subscription:gP},MP=We({invoices:wP,information:hP,paymentMethod:EP,subscription:yP}),FP={fetching:!0,loading:!1,error:null,confirmed:!1},GP=U({},YI()),{actions:$P,reducer:VP,name:xP}=yt({name:"subscriptions/checkout",initialState:FP,reducers:GP}),BP=U({loadCheckout:ut(`${xP}/loadCheckout`),resetCheckout:ut(`${xP}/resetCheckout`),submitCheckout:ut(`${xP}/submitCheckout`),confirmCheckout:ut(`${xP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:ut(`${xP}/errorCheckout`,(e=>({payload:e})))},$P),jP={loading:!1,error:null,cardSetupIntentSecret:null},WP=U({},YI()),{reducer:KP,actions:HP,name:zP}=yt({name:"subscriptions/stripe",initialState:jP,reducers:WP}),qP=U({loadCustomer:ut(`${zP}/loadCustomer`),createCardSetupIntentSecret:ut(`${zP}/createCardSetupIntentSecret`)},HP),YP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:JP,reducer:QP,name:XP}=yt({name:"subscriptions/vendorPublicConfig",initialState:YP,reducers:U({},YI())}),ZP=U({loadVendorPublicConfiguration:ut(`${XP}/loadVendorPublicConfiguration`)},JP),eL={config:iP,plans:ZI,checkout:FP,billing:DP,stripe:jP,vendorPublicConfig:YP},tL={config:cP,billing:NP,plans:oP,checkout:BP,stripe:qP,vendorPublicConfig:ZP},nL=We({config:lP,billing:MP,plans:tP,checkout:VP,stripe:KP,vendorPublicConfig:QP});let oL,iL,aL;function rL({policy:e}){return{policy:aL.AT_PERIOD_END}}function lL(e){switch(e){case Uy.ACTIVE:return iL.ACTIVE;case Uy.INCOMPLETE:return iL.INCOMPLETE;case Uy.CANCELED:return iL.CANCELED;case Uy.EXPIRED:return iL.EXPIRED;case Uy.TRIALING:return iL.TRIALING;default:return iL.EXPIRED}}!function(e){e.STRIPE="Stripe"}(oL||(oL={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(iL||(iL={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(aL||(aL={}));const sL={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Uy.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},cL=[{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"}],uL=[{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:""}],dL=[{id:"id",externalId:"externalId",type:Ry.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],yL={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*fL(){yield Di(gP.setLoading(!0));try{const[e]=yield Fi(xf.subscriptions.getManagedSubscriptions);yield Di(gP.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Di(gP.setError(e))}}function*pL(){yield Ua(bP.loadBillingInformation,gL)}function*gL(){yield function*(e){const t=yield Vi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Vi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield SL(n,!1):yield Di(bP.setError(t?"Not authorized":"Internal feature failure"))}()}function*SL(e,t){yield Di(bP.setLoading(!0));try{var n,o;const i=yield Fi(xf.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield Fi(xf.subscriptions.getSubscriptionPlan,a):([,l]=yield Ni([Fi(fL),Fi(xf.subscriptions.getSubscriptionPlan,a)]),s=yield Vi((e=>e.subscriptions.billing.subscription.subscription||null))),yield Di(bP.setState(U({loading:!1,fetching:!1,summary:i},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?iL.ACTIVE:lL(s.status),cancellation:s.cancellation&&rL(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==(o=l.price)?void 0:o.currency)||"usd",recurringInterval:"month",slug:l.slug}}:{})))}catch(e){yield Di(bP.setError(og(e)))}}function*vL(){yield function*(){var e,t;yield Di(bP.setLoading(!0)),yield xi(500),yield Di(bP.setState({loading:!1,fetching:!1,summary:{subscriptionId:sL.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Ny.Stripe,externallyManaged:!1,currentPlanId:cL[0].id,defaultPlanId:cL[0].id},plan:U({},cL[0],{price:null==(e=cL[0].price)?void 0:e.amount,currency:null==(t=cL[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*hL(){yield Ua(bP.loadBillingInformation,vL)}function*mL(){yield Ua(LP.loadPaymentMethod,AL),yield Ua(LP.submitPaymentMethod,TL),yield Ua(LP.submitPaymentMethodError,kL),yield Ua(LP.submitPaymentMethodSuccess,EL),yield Ua(LP.updatePaymentMethodBillingDetails,bL)}function*AL(){yield Di(LP.setLoading(!0));try{const e=(yield Fi(xf.subscriptions.getPaymentMethods))[0];yield Di(LP.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Di(LP.setError(og(e)))}}function*bL({payload:e}){yield Di(LP.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield Fi(xf.subscriptions.updatePaymentMethodBillingDetails,t,U({email:n},o)),yield Fi(AL),null==i||i(!0)}catch(e){yield Di(LP.setError(og(e))),null==i||i(!1)}yield Di(LP.setLoading(!1))}function*TL(){yield Di(LP.setLoading(!0))}function*kL({payload:e}){yield Di(LP.setError(e))}function*EL(){yield Di(LP.loadPaymentMethod())}function*IL(){yield Di(LP.setLoading(!0)),yield xi(500);const e=dL[0];yield Di(LP.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*PL(){yield Ua(LP.loadPaymentMethod,IL)}function*LL(){yield Ua(RP.loadInvoices,OL),yield Ua(RP.downloadInvoice,_L)}function*OL(){yield Di(RP.setLoading(!0));try{const e=(yield Fi(xf.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 Di(RP.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Di(RP.setError(og(e)))}}function*_L({payload:e}){yield Di(RP.setInvoiceDownloadState({loading:!0,error:null}));try{yield Fi(xf.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Di(RP.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Di(RP.setInvoiceDownloadState({loading:!1,error:og(e,null)}))}}function*wL(){yield Di(RP.setLoading(!0)),yield xi(500),yield Di(RP.setState({loading:!1,fetching:!1,invoices:uL.map((e=>U({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Di(RP.setLoading(!1))}function*CL(){yield Ua(RP.loadInvoices,wL)}function*UL(){yield Ua(gP.load,RL),yield Ua(gP.cancelSubscription,DL),yield Ua(gP.renewSubscription,NL)}function*RL(){const e=yield Vi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield SL(e)}function*DL(){const{subscription:e}=yield Vi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Di(gP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Di(gP.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===Uy.ACTIVE)try{yield Di(gP.setCancellationLoading(!0)),yield Fi(xf.subscriptions.cancelManagedSubscription,t),yield fL(),yield Di(gP.setCancellationLoading(!1))}catch(e){yield Di(gP.setCancellationError(og(e)))}}function*NL(){const{subscription:e}=yield Vi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Di(gP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Di(gP.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Dy.AT_PERIOD_END)try{yield Di(gP.setRenewalLoading(!0)),yield Fi(xf.subscriptions.renewManagedSubscription,t),yield fL(),yield Di(gP.setRenewalLoading(!1))}catch(e){yield Di(gP.setCancellationError(og(e)))}}function*ML(){yield Di(gP.setLoading(!0)),yield xi(500),yield Di(gP.setState({subscription:sL,fetching:!1,loading:!1,error:null}))}function*FL(){yield Ua(gP.load,ML)}function*GL(){yield Ni([Fi(pL),Fi(mL),Fi(LL),Fi(UL)])}function*$L(){yield Ni([Fi(hL),Fi(PL),Fi(CL),Fi(FL)])}function*VL(){yield Ua(BP.loadCheckout,xL),yield Ua(BP.resetCheckout,BL),yield Ua(BP.submitCheckout,jL),yield Ua(BP.confirmCheckout,WL),yield Ua(BP.errorCheckout,HL)}function*xL(){yield Di(BP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*BL(){yield Di(BP.setState({loading:!1,error:null,confirmed:!1}))}function*jL(){yield Di(BP.setState({loading:!0,error:null}))}function*WL({payload:{paymentMethodId:e,planId:t}}){const n=yield Vi((e=>e.subscriptions.billing.subscription.subscription)),o=yield Vi((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===Uy.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield Di(BP.setState({loading:!0,error:null})),i&&a)return yield KL(),void(yield Di(gP.setState({subscription:U({},n,{status:Uy.ACTIVE})})));try{yield Fi(xf.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Ni([gL(),AL(),OL()]),yield KL()}catch(e){yield Di(BP.setState({loading:!1,error:og(e)}))}}else yield Di(BP.setState({loading:!1,error:"Subscription not found"}))}function*KL(){yield Di(BP.setState({loading:!1,error:null,confirmed:!0}))}function*HL({payload:e}){yield Di(BP.setState({loading:!1,error:e}))}function*zL(){yield Ua(BP.resetCheckout,BL)}function*qL(){yield Ua(oP.loadPlans,YL)}function*YL(){yield Di(oP.setLoading(!0));try{const e=(yield Fi(xf.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 Di(oP.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Di(oP.setError(og(e)))}}function*JL(){yield Di(oP.setLoading(!0)),yield xi(500),yield Di(oP.setState({fetching:!1,loading:!1,plans:cL.map((e=>{var t,n;return U({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*QL(){yield Ua(oP.loadPlans,JL)}function*XL(){yield Ua(cP.loadPaymentConfiguration,ZL)}function*ZL(){yield Di(cP.setLoading(!0));try{(yield Fi(xf.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Ny.Stripe))?yield function*(){yield Di(cP.setLoading(!0));try{const e=yield Fi(xf.subscriptions.getStripePaymentProviderConfiguration);yield Di(cP.setState({loading:!1,fetching:!1,config:{paymentProvider:oL.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Di(cP.setError(og(e)))}}():yield Di(cP.setError("Payment provider not configured"))}catch(e){yield Di(cP.setError(og(e)))}}function*eO(){yield Di(cP.setLoading(!0)),yield xi(500),yield Di(cP.setState({loading:!1,fetching:!1,config:{paymentProvider:oL.STRIPE,apiKey:""}}))}function*tO(){yield Ua(cP.loadPaymentConfiguration,eO)}function*nO(){yield Ua(qP.createCardSetupIntentSecret,oO)}function*oO({payload:e}){yield Di(qP.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Fi(xf.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Di(qP.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Di(qP.setError(og(e)))}}function*iO(){yield Ua(ZP.loadVendorPublicConfiguration,aO)}function*aO(){yield Di(ZP.setLoading(!0));try{const e=yield Fi(xf.subscriptions.getVendorPublicConfigurations);yield Di(ZP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Di(ZP.setError(og(e)))}}function*rO(){yield Di(ZP.setLoading(!0)),yield xi(500),yield Di(ZP.setState({fetching:!1,loading:!1,vendorPublicConfig:yL}))}function*lO(){yield Ua(ZP.loadVendorPublicConfiguration,rO)}var sO={sagas:function*(){yield Ni([Fi(GL),Fi(VL),Fi(qL),Fi(XL),Fi(nO),Fi(iO)])},mockSagas:function*(){yield Ni([Fi($L),Fi(zL),Fi(QL),Fi(tO),Fi(lO)])},reducer:nL,actions:tL,initialState:eL,storeName:"subscriptions"},cO={sagas:function*(){yield Ua(ES.loadVendorPublicInfo,IS)},storeName:Dt,initialState:bS,reducer:TS,actions:ES};const{reducer:uO}=yt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Na.setContext(t),U({},e,{context:t}))}}}),dO=(e,t,n=!1,o,i,a=!1,r="path")=>{const l="undefined"==typeof window;let s=t;if(l&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(s||(s=window),!s.store){var c,u,d,y,f,p,g,S,v,h;n||a||Na.setContext(e.context);const t=ka(),l=[...st({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=ct({middleware:l,preloadedState:{root:U({},e,{previewMode:n,urlStrategy:r}),[DE.storeName]:U({},DE.initialState,o,null!=(c=null==i?void 0:i.auth)?c:{},{routes:U({},DE.initialState.routes,null!=(u=null==o?void 0:o.routes)?u:{},null!=(d=null==i||null==(y=i.auth)?void 0:y.routes)?d:{})}),[rI.storeName]:U({},rI.initialState,null!=(f=null==i?void 0:i.auditLogs)?f:{},{auditLogsState:U({},rI.initialState.auditLogsState,null!=(p=null==i||null==(g=i.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:U({},rI.initialState.auditsMetadataState,null!=(S=null==i||null==(v=i.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[sI]:U({},lI,null!=(h=null==i?void 0:i.audits)?h:{}),[qI.storeName]:qI.initialState,[sO.storeName]:sO.initialState,[cO.storeName]:cO.initialState},reducer:We({root:uO,[DE.storeName]:DE.reducer,[rI.storeName]:rI.reducer,[sI]:uI,[qI.storeName]:qI.reducer,[sO.storeName]:sO.reducer,[cO.storeName]:cO.reducer})});const m=function*(){yield Ni([Fi(DE.sagas),Fi(rI.sagas),Fi(bI),Fi(qI.sagas),Fi(sO.sagas),Fi(cO.sagas)])},A=function*(){yield Ni([Fi(DE.mockSagas),Fi(rI.mockSagas),Fi(sO.mockSagas)])};n?(s.store.destroy=t.run(A).cancel,s.store.dispatch(Fo.requestAuthorize(!0))):s.store.destroy=t.run(m).cancel,s.store.subscribeStateChanged=e=>{let t=s.store.getState();return s.store.subscribe((()=>{const n=s.store.getState();t!=n&&(t=n,e(n))}))}}return s.store},yO=(e,t)=>((()=>{if(!Na.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")})(),e?e.isEntitled?{isEntitled:!0}:{isEntitled:!1,justification:e.justification}:{isEntitled:!1,justification:t});var fO=n(714),pO=n.n(fO);function gO(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function SO(e){if(e.type)return e;if("#"===e.charAt(0))return SO(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 o=e.substring(t+1,e.length-1);let i,a;if("color"===n){if(a=o.split(" "),i=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(i))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+i)}else a=o.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:i}}function vO(e){const{type:t,colorSpace:n}=e;let{values:o}=e;return-1!==t.indexOf("rgb")?o=o.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(o[1]=`${o[1]}%`,o[2]=`${o[2]}%`),o=-1!==t.indexOf("color")?`${n} ${o.join(" ")}`:`${o.join(", ")}`,`${t}(${o})`}function hO(e){if(0===e.indexOf("#"))return e;const{values:t}=SO(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 mO(e,t){return e=SO(e),t=gO(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,vO(e)}function AO(e,t){if(e=SO(e),t=gO(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 vO(e)}function bO(e,t){if(e=SO(e),t=gO(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 vO(e)}const TO=e=>{if(e)return{main:e,light:hO(bO(e,.4)),dark:hO(AO(e,.15)),hover:hO(AO(e,.15)),active:hO(AO(e,.2))}},kO=e=>{if(e)return{main:e,light:bO(e,.7),dark:AO(e,.2)}},EO=(e,t)=>{var n,o,i,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)?U({},t,{palette:{primary:U({},TO(null==e||null==(o=e.palette)?void 0:o.primary),{contrastText:null!=(i=null==e||null==(a=e.palette)?void 0:a.primaryText)?i:"#000000"}),secondary:U({},TO(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:U({},TO(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:U({},kO(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:U({},kO(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:U({},kO(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:U({},kO(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},IO={theme:{},themeV2:{},localizations:{},navigation:{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"]},provisioning:{visibility:"hidden",permissions:["fe.secure.read.provisioningConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]},allAccounts:{visibility:"byPermissions",permissions:["fe.account-hierarchy.read.subAccount"]},groups:{visibility:"hidden",permissions:["fe.secure.read.groups"]}}};class PO{constructor(){this._theme=IO.theme,this._themeV2=IO.themeV2,this._navigation=IO.navigation,this._localizations=IO.localizations,this._integrations=IO.integrations}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new PO;return n.set(e),PO._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:{}}get integrations(){var e;return null!=(e=this._integrations)?e:{}}set(e){try{var t,n,o,i,a,r,l,s,c;this._navigation=pO().all([null!=(t=IO.navigation)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=pO().all([null!=(o=IO.theme)?o:{},EO(null==e?void 0:e.theme,IO.theme)]),this._themeV2=pO().all([null!=(i=IO.themeV2)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=pO().all([null!=(r=IO.localizations)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}]),this._integrations=pO().all([null!=(s=IO.integrations)?s:{},null!=(c=null==e?void 0:e.integrations)?c:{}])}catch(e){this._navigation=IO.navigation,this._theme=IO.theme,this._themeV2=IO.themeV2,this._localizations=IO.localizations,this._integrations=IO.integrations}}}PO._instances={};var LO=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},OO=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=document.createElement(t);return Object.keys(n).forEach((function(e){return o.setAttribute(e,n[e])})),e.appendChild(o),o},_O=function(e){return new Promise((function(t,n){var o=4e3,i=setInterval((function(){return null!=e.themeSetter?(clearInterval(i),void t(!0)):o<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(i)):void(o-=50)}),50)}))},wO=function(e){var t=e.toString();if(t){var n=new URL(window.location.href);n.search=t,window.history.pushState(null,"",n.toString())}};let CO,UO,RO,DO,NO,MO,FO,GO,$O,VO,xO;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(CO||(CO={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(UO||(UO={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(RO||(RO={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(DO||(DO={})),function(e){e.Invoices="invoices"}(NO||(NO={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(MO||(MO={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(FO||(FO={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(GO||(GO={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}($O||($O={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(VO||(VO={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(xO||(xO={}));const BO={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},jO={hidden:"hidden",edit:"edit"};var WO="6.146.0",KO={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on","show-passkeys-new":"on","groups-admin-box-new":"on","msp-all-accounts-new":"on"},HO=function(){function e(t,n){var o,i=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];P(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(WO),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.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=D(M().mark((function e(){var t,n,o,a,r;return M().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Ir,i.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,i.options.metadata=null!=(n=null==r||null==(o=r.rows)||null==(a=o[0])?void 0:a.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:PO.set(i.options.metadata,i.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=D(M().mark((function e(){var t,n,o;return M().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=null==(t=i.options.authOptions)||null==(n=t.hostedLoginOptions)?void 0:n.loadUserOnFirstLoad,i.options.builderMode||"nextjs"===i.options.framework||(i.options.hostedLoginBox&&!i.options.customLoginBox&&o?i.store.dispatch({type:"auth/requestHostedLoginAuthorizeV2",payload:{shouldRedirectToLogin:!1,firstTime:!0}}):i.store.dispatch({type:"auth/requestAuthorize",payload:!0}));case 2:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=D(M().mark((function e(){var t;return M().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.options.previewMode&&!i.options.builderMode){e.next=4;break}Ul.set(KO,i.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Rl();case 7:t=e.sent,i.options.overrideFeatureFlags&&Object.assign(t,i.options.overrideFeatureFlags),Ul.set(t,i.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.setFeatureFlagsForPreview=function(e){Ul.set(U({},KO,e),i.name)},this.updateLocalizationsSetter=function(e){i.updateLocalizations=e},this.getEntitlementsFromStore=function(){var e;return null==(e=i.store.getState().auth.user)?void 0:e.entitlements};var l=LO(n),s="frontegg-app-".concat(l);this.iframeRendering=a,this.name=l,this.options=U({},t,{contextOptions:U({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=s;var c,u,d=this.options.authOptions?U({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(o=this.options.authOptions)?void 0:o.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=dO({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);C.setInstance(l,this),this.setEntitlementsOptions(t.entitlementsOptions),Na.setAppName(l)}var t,n,o,i;return w(e,[{key:"setEntitlementsOptions",value:function(e){Na.setEntitlementsOptions(U({},e))}},{key:"initContainers",value:(i=D(M().mark((function e(t){return M().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){console.error("Failed to add frontegg-loading to body classList")}return e.next=9,this.loadFeatureFlags();case 9:return e.next=11,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize()]);case 11:this.options.previewMode||this.options.customLoginBox||(this.loadLoginBox(),n=this.name,o=void 0,void 0,a=void 0,null==(a=null==(i=PO.getInstance(n))||null==(o=i.integrations)?void 0:o.gtm)||a.filter((function(e){var t=e.id;return e.enabled&&function(e){return/^GTM-[a-zA-Z0-9]+$/.test(e)}(t)})).forEach((function(e){var t=e.id,n=document.createElement("script");n.innerHTML="\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','".concat(t,"');\n "),document.body.appendChild(n)}))),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 13:case"end":return e.stop()}var n,o,i,a}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;PO.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,o){if(window[e])n(window[e]);else{var i=document.createElement("script");i.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),i.setAttribute("id","".concat(e,"Script")),i.setAttribute("cdn-url",t.cdnUrl),i.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:E,FronteggTypes:I})):n(window[e])},i.onerror=function(e){console.log("Profile page error",e),o(e)},document.body.append(i)}}))}},{key:"loadLoginBox",value:(o=D(M().mark((function e(){return M().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){console.error("Failed to call loadLoginBoxListener",e)}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"showAdminPortal",value:(n=D(M().mark((function e(){var t;return M().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Na.setRequestSource(lo.AdminPortal),e.next=3,this.loadScript("FronteggAdminPortal");case 3:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e,t=new URLSearchParams(window.location.search);null==(e=this.adminPortalRenderer)||e.unmount(),wO(t),Na.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=D(M().mark((function e(t){var n;return M().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,U({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:"getFeatureEntitlements",value:function(e){return((e,t)=>{var n;return yO(null==e||null==(n=e.features)?void 0:n[t],_l.MISSING_FEATURE)})(this.getEntitlementsFromStore(),e)}},{key:"getPermissionEntitlements",value:function(e){return((e,t)=>{var n;return yO(null==e||null==(n=e.permissions)?void 0:n[t],_l.MISSING_PERMISSION)})(this.getEntitlementsFromStore(),e)}},{key:"getEntitlements",value:function(e){return"permissionKey"in e?this.getPermissionEntitlements(e.permissionKey):this.getFeatureEntitlements(e.featureKey)}},{key:"loadEntitlements",value:function(e){this.store.dispatch({type:"auth/loadEntitlements",payload:{callback:e}})}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),zO=function(){function e(){P(this,e)}return w(e,null,[{key:"setAuthentication",value:function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",i=C.getInstance(o);e&&t?(Na.setAccessToken(t),Na.setUser(U({},n,{accessToken:t})),i.store.dispatch(Fo.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(Fo.loadTenants())):(Na.setAccessToken(null),Na.setUser(null),i.store.dispatch(Fo.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),qO=function(){function e(){P(this,e)}return w(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";C.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";C.getInstance(e).hideAdminPortal()}}]),e}(),YO=function(){function e(){P(this,e)}return w(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";C.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";C.getInstance(e).hideCheckoutDialog()}}]),e}(),JO=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},QO=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=dO({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=U({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},i),this.app=new HO(this.options,t,!0),PO.set({},t)}var t;return w(e,[{key:"render",value:(t=D(M().mark((function e(t){var n,o,i,a,r=this;return M().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,o=function(e){r.themeSetter=e},i=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:o,setStaticRouteSetter:i}),this.app.loading=!1,e.next=13,_O(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}(),XO="modern",ZO=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[XO]},e_=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=dO({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=U({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},i),this.app=new HO(this.options,t,!0,a),PO.set({},t)}var t;return w(e,[{key:"render",value:(t=D(M().mark((function e(t){var n,o,i,a,r=this;return M().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,o=function(e){r.themeSetter=e},i=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:o,setStaticRouteSetter:i,staticRoute:"/account/login"}),e.next=12,_O(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 t_(e,t){return t_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},t_(e,t)}function n_(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&&t_(e,t)}function o_(e,t){if(t&&("object"===L(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 i_(e){return i_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},i_(e)}function a_(){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 r_(e,t,n){return r_=a_()?Reflect.construct.bind():function(e,t,n){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return n&&t_(i,n.prototype),i},r_.apply(null,arguments)}function l_(e){var t="function"==typeof Map?new Map:void 0;return l_=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 r_(e,arguments,i_(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),t_(n,e)},l_(e)}function s_(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,o=i_(e);if(t){var i=i_(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return o_(this,n)}}var c_=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new HO(e,t);if("undefined"!=typeof document){var o;if(!e.contextOptions.baseUrl){var i=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(i.message),i}if(!customElements.get("frontegg-app")){var a=function(e){n_(n,e);var t=s_(n);function n(){var e;P(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).app=null,e}return w(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=C.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var o=OO(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=OO(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=OO(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=o.attachShadow({mode:"open"}),l=i.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),c=OO(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=OO(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=OO(s,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:o,loginBoxContainer:i,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(l_(HTMLElement));customElements.define("frontegg-app",a)}null==(o=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||o.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),o}()}));
|