@frontegg/js 6.149.0 → 6.150.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see frontegg.production.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function 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 n_},AdminPortalRenderer:function(){return a_},AppHolder:function(){return C},CheckoutDialog:function(){return o_},FronteggApp:function(){return e_},HostedLogin:function(){return t_},LoginBoxRenderer:function(){return s_},createElement:function(){return MO},defaultTheme:function(){return r_},formatName:function(){return NO},getThemeAdminByName:function(){return i_},getThemeByName:function(){return l_},initialize:function(){return v_},mockFlagsList:function(){return ZO},restoreSearchParams:function(){return GO},waitThemeSetter:function(){return FO}});var e={};n.r(e),n.d(e,{Delete:function(){return wr},Get:function(){return Pr},Patch:function(){return Or},Post:function(){return Lr},PostDownload:function(){return Cr},Put:function(){return _r},extractHeadersFromOptions:function(){return Ur},getBaseUrl:function(){return kr},getMetadataHeaders:function(){return Er}});var t={};n.r(t),n.d(t,{FeatureFlags:function(){return Mr},loadFeatureFlags:function(){return Fr}});var i={};n.r(i),n.d(i,{GetUserJwt:function(){return Gr},getCurrentUserTenantsV1:function(){return Wr},getCurrentUserTenantsV3:function(){return jr},getUsersGroups:function(){return Br},getUsersRoles:function(){return Vr},getUsersV2:function(){return $r},getUsersV3:function(){return xr},sendResetBreachedPasswordEmails:function(){return Kr},updateUserProfileV2:function(){return Hr}});var a={};n.r(a),n.d(a,{getHierarchyMetadata:function(){return il},getParentTenants:function(){return el},getParentTenantsById:function(){return tl},getSubTenants:function(){return Xr},getSubTenantsAsTree:function(){return Zr},getTenants:function(){return Qr},getTenantsUsersCount:function(){return nl},searchSubTenants:function(){return ol},switchTenant:function(){return Jr}});var r={};n.r(r),n.d(r,{loadEntitlements:function(){return Gl},loadEntitlementsV2:function(){return $l}});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 ds},activateAccount:function(){return rs},activateAccountV2:function(){return ls},bulkCreateIPRestriction:function(){return Il},changePhoneNumber:function(){return mu},changePhoneNumberWithVerification:function(){return vu},checkIfAllowToRememberMfaDevice:function(){return Vc},createDomainRestriction:function(){return ml},createIPRestriction:function(){return El},createOrUpdateSessionConfigrations:function(){return Ic},createSSOConfiguration:function(){return zc},createSSOConfigurationByMetadata:function(){return Jc},createSSOConfigurationByMetadataUrl:function(){return Xc},createSSODomain:function(){return eu},createSSOGroup:function(){return au},createSamlGroup:function(){return cc},createTenantAccessToken:function(){return Rc},createUserAccessToken:function(){return Uc},deleteAllSessionsForUser:function(){return Lc},deleteDomainRestriction:function(){return bl},deleteIPRestriction:function(){return Ll},deleteSSOConfiguration:function(){return Yc},deleteSSODomain:function(){return tu},deleteSSOGroup:function(){return lu},deleteSamlGroup:function(){return dc},deleteSessionForUser:function(){return Pc},deleteTenantAccessToken:function(){return wc},deleteTenantApiToken:function(){return Gc},deleteUserAccessToken:function(){return Cc},deleteUserApiToken:function(){return $c},deleteWebAuthnDevice:function(){return Iu},disableMFAAuthenticatorApp:function(){return ws},disableMFASMS:function(){return Us},disableMFAWebAuthn:function(){return Ds},disableMfa:function(){return _s},enrollMFAAuthenticatorApp:function(){return ks},enrollMFAAuthenticatorAppForLogin:function(){return Fs},enrollMFAAuthenticatorAppForLoginV2:function(){return Gs},enrollMFASMS:function(){return Is},enrollMFASMSForLogin:function(){return Ws},enrollMFASMSForLoginV2:function(){return Ks},enrollMFAWebAuthn:function(){return Ls},enrollMFAWebAuthnForLogin:function(){return Js},enrollMFAWebAuthnForLoginV2:function(){return Qs},enrollMfa:function(){return bs},exchangeOAuthTokens:function(){return fu},exchangeOAuthTokensV2:function(){return du},forgotPassword:function(){return vs},generateLoginResponse:function(){return Kl},generateLoginResponseFromOAuthResponse:function(){return Jl},generateLoginResponseFromOAuthResponseV2:function(){return Ql},generateLoginResponseV2:function(){return Hl},generateLoginResponseV3:function(){return Yl},getActivateAccountStrategy:function(){return ss},getCaptchaPolicy:function(){return yl},getCurrentUserSession:function(){return Tc},getCurrentUserSessions:function(){return bc},getCurrentUserTenantsFunction:function(){return Yr},getCustomSocialLoginProvidersV1:function(){return vc},getDomainRestrictions:function(){return vl},getDomainRestrictionsConfig:function(){return hl},getGlobalSecurityPolicy:function(){return al},getIPRestrictions:function(){return Tl},getIPRestrictionsConfig:function(){return kl},getLockoutPolicy:function(){return cl},getMFADevices:function(){return Ns},getMFAStrategiesConfig:function(){return _u},getMeAndEntitlements:function(){return Uu},getMeV2:function(){return Cu},getMfaPolicy:function(){return rl},getOidcConfiguration:function(){return yc},getPasswordConfigPolicy:function(){return Sl},getPasswordHistoryPolicy:function(){return fl},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return Ou},getSSOConfigurations:function(){return Hc},getSSODefaultRoles:function(){return ou},getSSOGroups:function(){return su},getSSOPublicConfiguration:function(){return fc},getSamlConfiguration:function(){return tc},getSamlRoles:function(){return rc},getSamlRolesGroups:function(){return lc},getSamlVendorConfiguration:function(){return oc},getSessionConfigurations:function(){return Ec},getSocialLoginProviders:function(){return pc},getSocialLoginProvidersV2:function(){return gc},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return Sc},getTabTenantFromSessionStorage:function(){return qr},getTenantAccessTokensData:function(){return _c},getTenantApiTokensData:function(){return Nc},getUserAccessTokensData:function(){return Oc},getUserApiTokensData:function(){return Dc},getUserAuthorization:function(){return wu},getUserById:function(){return xc},getVendorConfig:function(){return mc},getVendorLockoutPolicy:function(){return ul},getVendorMfaPolicy:function(){return ll},getVendorPasswordHistoryPolicy:function(){return pl},getVendorPublicAuthStrategiesConfig:function(){return Lu},getWebAuthnDevices:function(){return Eu},loadPasswordConfig:function(){return ms},login:function(){return ns},loginViaSocialLogin:function(){return hc},loginWithMfa:function(){return is},loginWithMfaV2:function(){return as},loginv2:function(){return os},logout:function(){return gs},oidcPostLogin:function(){return ts},oidcPostLoginV2:function(){return uu},passwordlessPostLogin:function(){return Wc},passwordlessPostLoginV2:function(){return jc},passwordlessPreLogin:function(){return Bc},postLogin:function(){return es},preDisableMFASMS:function(){return Cs},preDisableMFAWebAuthn:function(){return Rs},preEnrollMFAAuthenticatorApp:function(){return Ts},preEnrollMFAAuthenticatorAppForLogin:function(){return Ms},preEnrollMFASMS:function(){return Es},preEnrollMFASMSForLogin:function(){return js},preEnrollMFAWebAuthn:function(){return Ps},preEnrollMFAWebAuthnForLogin:function(){return Ys},preLogin:function(){return Xl},preLoginV2:function(){return cu},preLoginWithIdpType:function(){return Zl},preVerifyMFAEmailCode:function(){return xs},preVerifyMFASMSForLogin:function(){return Hs},preVerifyMFAWebAuthnForLogin:function(){return Xs},recoverMfaToken:function(){return As},refreshToken:function(){return ys},refreshTokenV2:function(){return fs},refreshTokenV3:function(){return ps},resendActivationEmail:function(){return cs},resendInvitationEmail:function(){return us},resetPassword:function(){return hs},resetPhoneNumber:function(){return gu},revokeSessionsForUser:function(){return kc},saveLockoutPolicy:function(){return dl},saveMfaPolicy:function(){return sl},savePasswordHistoryPolicy:function(){return gl},setSSODefaultRoles:function(){return iu},setTabTenantInSessionStorage:function(){return zr},signUpUser:function(){return Ac},silentOAuthRefreshToken:function(){return pu},silentOAuthRefreshTokenV2:function(){return yu},testCurrentIp:function(){return Ol},testCurrentIpInAllowList:function(){return _l},updateDomainRestrictionConfig:function(){return Al},updateIPRestrictionConfig:function(){return Pl},updateSSOConfiguration:function(){return qc},updateSSOConfigurationByMetadata:function(){return Qc},updateSSOConfigurationByMetadataUrl:function(){return Zc},updateSSOGroup:function(){return ru},updateSamlConfiguration:function(){return nc},updateSamlGroup:function(){return uc},updateSamlRoles:function(){return sc},updateSamlVendorMetadata:function(){return ic},updateTenantApiTokensData:function(){return Fc},updateUserApiTokensData:function(){return Mc},validateSSODomain:function(){return nu},validateSamlDomain:function(){return ac},verifyChangePhoneNumber:function(){return hu},verifyInviteToken:function(){return Kc},verifyMFAAuthenticatorAppForLogin:function(){return $s},verifyMFAEmailCode:function(){return Vs},verifyMFAEmailCodeV2:function(){return Bs},verifyMFASMSForLogin:function(){return zs},verifyMFASMSForLoginV2:function(){return qs},verifyMFAWebAuthnForLogin:function(){return Zs},verifyMFAWebAuthnForLoginV2:function(){return ec},verifyMfa:function(){return Os},verifyNewDeviceSession:function(){return Pu},verifyResetPhoneNumber:function(){return Su},webAuthnCreateNewDeviceSession:function(){return ku},webAuthnPostLogin:function(){return bu},webAuthnPostLoginV2:function(){return Tu},webAuthnPreLogin:function(){return Au}});var s={};n.r(s),n.d(s,{addUser:function(){return Gu},changePassword:function(){return Mu},createInviteUserLink:function(){return Vu},deleteInviteUserLink:function(){return ju},deleteUser:function(){return $u},getInviteLinkConfiguration:function(){return Ku},getInviteUserLink:function(){return Wu},getProfile:function(){return Ru},loadAvailablePermissions:function(){return zu},loadAvailableRoles:function(){return Hu},loadStats:function(){return qu},loadUsers:function(){return Fu},resendActivationLink:function(){return Yu},resendInvitationLink:function(){return Ju},resendInvitationLinkToAllTenants:function(){return Qu},updateInviteUserLink:function(){return Bu},updateProfile:function(){return Du},updateProfileImage:function(){return Nu},updateUser:function(){return xu}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return Zu},getAuditsMetadata:function(){return id},getCurrentUserIpMetadata:function(){return td},getIpAdressMetadata:function(){return ad},getNotificationsMetadata:function(){return nd},getSamlMetadata:function(){return od},updateAdminBoxMetadata:function(){return ed}});var u={};n.r(u),n.d(u,{downloadReport:function(){return fd},getReport:function(){return ud},getReports:function(){return cd},renderReport:function(){return dd},scheduleReport:function(){return yd},sendReport:function(){return pd}});var d={};n.r(d),n.d(d,{getNotifications:function(){return gd},markAllAsRead:function(){return hd},updateNotificationIsPinned:function(){return vd},updateNotificationStatus:function(){return Sd}});var y={};n.r(y),n.d(y,{exportAudits:function(){return Td},getAudits:function(){return Ad},getAuditsStats:function(){return bd}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return Md},deleteEmailSubscriptions:function(){return Dd},deleteSMSConfiguration:function(){return Bd},deleteSMSSubscriptions:function(){return xd},deleteSlackConfiguration:function(){return _d},deleteWebhooksConfiguration:function(){return Kd},getCategories:function(){return Yd},getChannelMaps:function(){return Jd},getEmailConfiguration:function(){return Cd},getSMSConfiguration:function(){return Fd},getSlackChannels:function(){return Ld},getSlackConfiguration:function(){return Id},getSlackScope:function(){return Pd},getWebhookLog:function(){return Hd},getWebhooksConfigurations:function(){return jd},patchEmailConfiguration:function(){return Rd},patchSMSConfiguration:function(){return $d},postEmailConfiguration:function(){return Ud},postSMSConfiguration:function(){return Gd},postSlackCode:function(){return wd},postSlackConfiguration:function(){return Od},postWebhookRetry:function(){return qd},postWebhookTest:function(){return zd},postWebhooksConfiguration:function(){return Wd},putEmailSubscriptions:function(){return Nd},putSMSSubscriptions:function(){return Vd}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return Zd},getSettings:function(){return Xd},updateSettings:function(){return Qd}});var g={};n.r(g),n.d(g,{addRole:function(){return iy},attachPermissionToRoles:function(){return cy},attachPermissionsToRole:function(){return ly},deleteRole:function(){return ay},getPermissionCategories:function(){return uy},getPermissions:function(){return sy},getRoles:function(){return oy},updateRole:function(){return ry}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return By},ISubscriptionStatus:function(){return xy},PaymentMethodType:function(){return Vy},ProviderType:function(){return jy},TenantCreatedAction:function(){return Ky},TrialEndAction:function(){return Wy},cancelManagedSubscription:function(){return hy},cancelSubscription:function(){return fy},createStripeCustomer:function(){return Uy},createStripePaymentMethodSetupIntentSecret:function(){return Dy},createSubscription:function(){return wy},createTenantConfiguration:function(){return Fy},getManagedSubscription:function(){return Sy},getManagedSubscriptions:function(){return vy},getPaymentMethod:function(){return Oy},getPaymentMethods:function(){return Ly},getPaymentProviders:function(){return Gy},getStripeCustomer:function(){return Cy},getStripePaymentProviderConfiguration:function(){return Ry},getSubscription:function(){return yy},getSubscriptionInvoice:function(){return Ey},getSubscriptionInvoicePdf:function(){return Iy},getSubscriptionInvoices:function(){return ky},getSubscriptionPlan:function(){return Ty},getSubscriptionPlans:function(){return by},getSubscriptionSummaries:function(){return Ny},getSubscriptions:function(){return dy},getTenantConfiguration:function(){return My},getVendorPublicConfigurations:function(){return $y},renewManagedSubscription:function(){return my},renewSubscription:function(){return py},updateManagedSubscription:function(){return Ay},updatePaymentMethodBillingDetails:function(){return _y},updateSubscription:function(){return gy}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return Hy}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return Jy},addUserToTenantAndSubTenants:function(){return qy},addUsersToSubTenant:function(){return of},createSubTenant:function(){return Zy},deleteSubTenant:function(){return ef},loadAllUsers:function(){return zy},removeUserFromTenantAndSubTenants:function(){return Yy},removeUserRolesFromSubTenants:function(){return Qy},setUserRolesForSubTenants:function(){return Xy},updateSubAccountAccess:function(){return nf},updateSubTenant:function(){return tf}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return cf},createConfiguration:function(){return lf},deleteConfiguration:function(){return sf},getConfigs:function(){return af},updateConfiguration:function(){return rf}});var A={};n.r(A),n.d(A,{impersonate:function(){return uf}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return hf},addUsersToGroup:function(){return Af},createGroup:function(){return gf},deleteGroup:function(){return vf},deleteRolesFromGroup:function(){return mf},deleteUsersFromGroup:function(){return bf},getGroupById:function(){return yf},getGroupConfiguration:function(){return Tf},getGroups:function(){return ff},getGroupsByIds:function(){return pf},updateGroup:function(){return Sf},updateGroupConfiguration:function(){return kf}});var T={};n.r(T),n.d(T,{getInsights:function(){return If},getRecommendations:function(){return Ef}});var k={};n.r(k),n.d(k,{createPhoneNumber:function(){return Lf},deletePhoneNumber:function(){return Of},getUserPhoneNumbers:function(){return Pf},preVerifyPhoneNumber:function(){return _f},verifyDeletePhoneNumber:function(){return Cf},verifyPhoneNumber:function(){return wf}});var E={};n.r(E),n.d(E,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return Vl},AuthStrategyEnum:function(){return ko},ContextHolder:function(){return Na},FeatureFlags:function(){return Mr},FronteggApiError:function(){return Fa},FronteggContext:function(){return Ma},FronteggFrameworks:function(){return so},GetUsersFilterPreset:function(){return yo},GroupManagedByEnum:function(){return jf},GroupRelations:function(){return Bf},ISubscriptionCancellationPolicy:function(){return By},ISubscriptionStatus:function(){return xy},InsightCode:function(){return Kf},LOAD_AUTHORIZATION_FF:function(){return Fl},MFAStrategyEnum:function(){return Ml},MachineToMachineAuthStrategy:function(){return Eo},NotEntitledJustification:function(){return xl},PaginationOrderEnum:function(){return co},PaymentMethodType:function(){return Vy},ProviderType:function(){return jy},RecommendationActionKey:function(){return Hf},RecommendationCode:function(){return Wf},RecommendationSeverity:function(){return zf},RequestSource:function(){return lo},RestrictionType:function(){return Bn},ScimConnectionSource:function(){return Vf},SecondaryAuthStrategy:function(){return Dl},SecurityCategory:function(){return qf},SocialLoginProviders:function(){return To},SortByEnum:function(){return uo},TenantSortByEnum:function(){return Rf},TenantType:function(){return Df},USE_ENTITLEMENTS_V2_ENDPOINT_FF:function(){return Dr},UserManagedByEnum:function(){return Uf},WebAuthnDeviceType:function(){return Nl},api:function(){return Yf},countConfigurationUsers:function(){return cf},createConfiguration:function(){return lf},default:function(){return Jf},deleteConfiguration:function(){return sf},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Nf},fronteggHeaders:function(){return ro},fronteggRefreshTokenUrl:function(){return Mf},fronteggSilentRefreshTokenUrl:function(){return Ff},fronteggTenantsUrl:function(){return $f},fronteggTenantsV3Url:function(){return xf},fronteggUsersUrl:function(){return Gf},getConfigs:function(){return af},getCurrentUserTenantsFunction:function(){return Yr},getTabTenantFromSessionStorage:function(){return qr},loadFeatureFlags:function(){return Fr},providersArray:function(){return fo},setTabTenantInSessionStorage:function(){return zr},updateConfiguration:function(){return rf}});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 YO},AccountPageFields:function(){return BO},DomainRestrictionsTabFields:function(){return qO},GeneralSettingsTabFields:function(){return HO},InviteUserModalFields:function(){return VO},IpRestrictionsTabFields:function(){return zO},Metadata:function(){return DO},PrivacyPageFields:function(){return xO},ProfilePageFields:function(){return $O},SecurityPageTabs:function(){return WO},SessionManagementTabFields:function(){return KO},SubscriptionsPageFields:function(){return jO},alpha:function(){return LO},fieldAppearance:function(){return JO},tabAppearance:function(){return QO}});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 x(e,t,n){void 0===n&&(n=!1),0===V(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 V(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===V(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function j(e,t,n){var o=V(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)||(V(e)>1&&(e.set=e.add=e.clear=e.delete=J),Object.freeze(e),t&&x(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 x(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;x(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=V(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 x(n,(function(t,i){o&&function(e,t){return 2===V(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={};x(_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",xe=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ve={INIT:"@@redux/INIT"+xe(),REPLACE:"@@redux/REPLACE"+xe(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+xe()}};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:Ve.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:Ve.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:Ve.INIT}))throw new Error(Ge(12));if(void 0===n(void 0,{type:Ve.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)x(a,(function(t){t!==Ee&&(void 0!==i[t]||B(i,t)?r[t]||e(a[t]):(r[t]=!0,de(n)))})),x(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}},xt={setActivateState:gt("activateState"),resetActivateState:pt("activateState",{activateState:$t}),setActivateStrategyState:St("activateState","activationStrategy")},Vt={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:{}},xn={setSessionsPolicyState:gt("sessionsPolicyState"),resetSessionsPolicyState:pt("sessionsPolicyState",{sessionsPolicyState:$n})},Vn={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,xt,Ro,Wt,qt,Xt,mn,an,io,tn,cn,yn,Zn,no,Tn,In,On,Cn,Dn,Fn,xn,Wn,zn,Jn,go,ho,Ao,Lo)});const Fo=U({loadEntitlements:ut("auth/loadEntitlements",(e=>({payload:e})))},Mo,Ft,Sn,Vt,Kt,Yt,Zt,An,rn,ao,nn,un,fn,eo,{},kn,Pn,_n,Un,Nn,Gn,Vn,Kn,qn,Do,Qn,So,bo,Oo);var Go=function(e){return"@@redux-saga/"+e},$o=Go("CANCEL_PROMISE"),xo=Go("CHANNEL_END"),Vo=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={})[Vo]=!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 xi(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 Vi=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:xo},ia=function(e){return e&&e.type===xo};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[Vo]?(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:Vi(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,this.sessionContext=void 0}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 setSessionContext(e){Na.getInstance().sessionContext=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 isSessionPerTenantEnabled(){var e;return(null==(e=Na.getInstance().sessionContext)?void 0:e.enableSessionPerTenant)||!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"},xa={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:{v1:"/identity/resources/users/v1/me/tenants",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"}},Va={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="/entitlements/api/v2/user-entitlements",br={v1:"/security-center/resources/recommendations/v1"},Tr={v1:"/security-center/resources/insights/v1"};function kr(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 Er(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 Ir=async e=>{var t,n,o;const i=Na.getContext(),a=await async function(e,t){var n;const o=Er(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=kr(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{}}},Pr=async(e,t,n)=>Ir(U({url:e,method:"GET",contentType:"application/json",params:t},n)),Lr=async(e,t,n)=>Ir(U({url:e,method:"POST",contentType:"application/json",body:t},n)),Or=async(e,t,n)=>Ir(U({url:e,method:"PATCH",contentType:"application/json",body:t},n)),_r=async(e,t,n)=>Ir(U({url:e,method:"PUT",contentType:"application/json",body:t},n)),wr=async(e,t,n)=>Ir(U({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Cr=async(e,t,n,o)=>Ir(U({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),Ur=(e={})=>U({},e.jwt?{Authorization:e.jwt}:{}),Rr="FRONTEGG_SEPARATE_TABS_BY_TENANT",Dr="admin_portal_use_entitlements_v2_endpoint",Nr={flags:{}};class Mr{constructor(){var e;this._flags={},this._flags=null!=(e=Nr.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Mr;return n.set(e),Mr._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==Nr?void 0:Nr.flags)?t:{},null!=e?e:{})}}async function Fr(){return Pr(Sr)}async function Gr(e){return Lr(`${xa.v3}/me/token`,e)}async function $r(e,t){return Pr(xa.v2,e,{headers:Ur(t)})}async function xr(e,t){return Pr(xa.v3,e,{headers:Ur(t)})}async function Vr(e,t){return Pr(xa.roles.v3,U({},e,{ids:e.ids.join(",")}),{headers:Ur(t)})}async function Br(e,t){return Pr(xa.groups.v3,U({},e,{ids:e.ids.join(",")}),{headers:Ur(t)})}async function jr(e){return Pr(xa.tenants.me.v3,void 0,{headers:Ur(e)})}async function Wr(e){return Pr(xa.tenants.me.v1,void 0,{headers:Ur(e)})}async function Kr(){return Lr(xa.passwords.resetBreachedPasswords.v1)}async function Hr(e){return _r(`${xa.v2}/me`,e)}function zr(e){e&&sessionStorage.setItem(Rr,e)}function qr(){return Na.isSessionPerTenantEnabled()?sessionStorage.getItem(Rr):null}function Yr(){const[e]=Mr.getFeatureFlags(["admin_portal_use_current_user_tenants_v1_endpoint"],Na.getAppName()||"");return Na.isSessionPerTenantEnabled()||e?Wr:jr}async function Jr(e){return Na.isSessionPerTenantEnabled()&&zr(e.tenantId),_r(`${xa.v1}/tenant`,e)}async function Qr(){return Pr(`${xa.v2}/me/tenants`)}async function Xr(e){return Pr(or.v1,void 0,{headers:Ur(e)})}async function Zr(e){return Pr(or.tree.v1,void 0,{headers:Ur(e)})}async function el(e){return Pr(or.parents.v1,void 0,{headers:Ur(e)})}async function tl(e,t){return Pr(`${or.parents.v1}/${e}`,void 0,{headers:Ur(t)})}async function nl(e,t){return Lr(`${Ka.users.v1}/count`,e,{headers:Ur(t)})}async function ol(e,t){return Pr(or.v2,e,{headers:Ur(t)})}async function il(e,t){return Pr(or.metadata.v2,U({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Ur(t)})}async function al(){return Pr(Va.v1)}async function rl(){return Pr(`${Va.v1}/mfa-policy`)}async function ll(){return Pr(`${Va.v1}/mfa-policy/vendor`)}async function sl(e){return e.id?Or(`${Va.v1}/mfa-policy`,e):Lr(`${Va.v1}/mfa-policy`,e)}async function cl(){return Pr(`${Va.v1}/lockout-policy`)}async function ul(){return Pr(`${Va.v1}/lockout-policy/vendor`)}async function dl(e){return e.id?Or(`${Va.v1}/lockout-policy`,e):Lr(`${Va.v1}/lockout-policy`,e)}async function yl(){try{return await Pr(`${Va.v1}/captcha-policy/public`)}catch{return null}}async function fl(){return Pr(`${Va.v1}/password-history-policy`)}async function pl(){return Pr(`${Va.v1}/password-history-policy/vendor`)}async function gl(e){return e.id?Or(`${Va.v1}/password-history-policy`,e):Lr(`${Va.v1}/password-history-policy`,e)}async function Sl(){return Pr(`${Va.v1}/password`)}async function vl(){return Pr(`${Ba.emailDomain.v1}`)}async function hl(){return Pr(`${Ba.emailDomain.v1}/config`)}async function ml(e){return Lr(`${Ba.emailDomain.v1}`,e)}async function Al(e){return Lr(`${Ba.emailDomain.v1}/config`,e)}async function bl(e){return wr(`${Ba.emailDomain.v1}/${e}`)}async function Tl(e){return Pr(`${Ba.ip.v1}`,e)}async function kl(){return Pr(`${Ba.ip.v1}/config`)}async function El(e){return Lr(`${Ba.ip.v1}`,e)}async function Il(e){return Lr(`${Ba.ip.v1}/bulk`,e)}async function Pl(e){return Lr(`${Ba.ip.v1}/config`,e)}async function Ll(e){return wr(`${Ba.ip.v1}/${e}`)}async function Ol(){return Lr(`${Ba.ip.v1}/verify`)}async function _l(){return Lr(`${Ba.ip.v1}/verify/allow`)}Mr._instances={};class wl extends Error{constructor(e){super(e)}}const Cl="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new wl("'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 Ul extends Error{constructor(e){super(e)}}const Rl=(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(Cl(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 Cl(t)}})(e.split(".")[n]))}catch(e){throw new Ul("Invalid token specified: "+e.message)}};let Dl,Nl,Ml;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}(Dl||(Dl={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Nl||(Nl={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(Ml||(Ml={}));const Fl="admin_portal_should_load_authorization";async function Gl(){return Pr(mr)}async function $l(){return Pr(Ar)}let xl;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(xl||(xl={}));const Vl="admin_portal_entitlements",Bl=["type"],jl=["type"],Wl=["type"];async function Kl(e){if(!e.accessToken)return e;Na.setAccessToken(e.accessToken);const t=await Uu(),n=U({},e,e.accessToken?Rl(e.accessToken):{},t);return Na.setUser(n),n}async function Hl(e){if(!e.accessToken)return{user:e};Na.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Uu(),Qr()]),o=U({},e,e.accessToken?Rl(e.accessToken):{},t);return Na.setUser(o),{user:o,tenants:n}}function zl(){if(!Na.shouldLoadEntitlements())return!1;const[e]=Mr.getFeatureFlags([Vl],Na.getAppName()||"");return e}function ql(){const[e]=Mr.getFeatureFlags([Fl],Na.getAppName()||"");return e}async function Yl(e){const{accessToken:t}=e;if(!t)return{user:e};Na.setAccessToken(t);const[n,o]=await Promise.all([Uu(),Yr()()]),i=U({},e,t?Rl(t):{},n);return Na.isSessionPerTenantEnabled()&&zr(i.tenantId),Na.setUser(i),{user:i,tenants:o.tenants,activeTenant:o.activeTenant}}async function Jl(e){Na.setAccessToken(e.id_token);const t=await Uu(),n=e.id_token?Rl(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 Ql(e){Na.setAccessToken(e.id_token);const[t,n]=await Promise.all([Uu(),Yr()()]),o=e.id_token?Rl(e.id_token):{},i=U({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},o,t,{expiresIn:e.expires_in||300});return Na.isSessionPerTenantEnabled()&&zr(i.tenantId),Na.setUser(i),{user:i,tenants:n.tenants,activeTenant:n.activeTenant}}async function Xl(e){try{const{address:t}=await Lr(`${$a.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Zl(e){return Lr(`${$a.v1}/user/saml/prelogin`,e)}async function es(e){return Kl(await Lr(`${$a.v1}/user/saml/postlogin`,e))}async function ts(e){return Kl(await Lr(`${$a.v1}/user/oidc/postlogin`,e))}async function ns(e){return Kl(await Lr(`${$a.v1}/user`,e))}async function os(e){return Yl(await Lr(`${$a.v1}/user`,e))}async function is(e){return Kl(await Lr(`${$a.v1}/user/mfa/verify`,e))}async function as(e){return Yl(await Lr(`${$a.v1}/user/mfa/verify`,e))}async function rs(e){return Lr(`${xa.v1}/activate`,e)}async function ls(e){return Yl(await Lr(`${xa.v1}/activate`,e))}async function ss(e){return Pr(`${xa.v1}/activate/strategy`,e)}async function cs(e){return Lr(`${xa.v1}/activate/reset`,e)}async function us(e){return Lr(`${xa.v1}/invitation/reset`,e)}async function ds(e){return Lr(`${xa.v1}/invitation/accept`,e)}async function ys(){const e=qr();return Kl(await Lr(`${$a.v1}/user/token/refresh`,{tenantId:e}))}async function fs(){const e=qr();return Hl(await Lr(`${$a.v1}/user/token/refresh`,{tenantId:e}))}async function ps(){const e=qr();return Yl(await Lr(`${$a.v1}/user/token/refresh`,{tenantId:e}))}async function gs(){return Lr(`${$a.v1}/logout`)}async function Ss(e){return Pr(`${gr}/logout`,e)}async function vs(e){return Lr(`${xa.v1}/passwords/reset`,e)}async function hs(e){return Lr(`${xa.v1}/passwords/reset/verify`,e)}async function ms(e){return Pr(`${xa.v1}/passwords/config`,e)}async function As(e){return Lr(`${$a.v1}/user/mfa/recover`,e)}async function bs(){return Lr(`${xa.v1}/mfa/enroll`)}async function Ts(){return Lr(`${xa.v1}/mfa/authenticator/enroll`)}async function ks(e){return Lr(`${xa.v1}/mfa/authenticator/enroll/verify`,e)}async function Es(e){return Lr(`${xa.v1}/mfa/sms/enroll`,e)}async function Is(e){return Lr(`${xa.v1}/mfa/sms/enroll/verify`,e)}async function Ps(){return Lr(`${xa.v1}/mfa/webauthn/enroll`)}async function Ls(e){return Lr(`${xa.v1}/mfa/webauthn/enroll/verify`,e)}async function Os(e){return Lr(`${xa.v1}/mfa/enroll/verify`,e)}async function _s(e){return Lr(`${xa.v1}/mfa/disable`,e)}async function ws(e,t){return Lr(`${xa.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Cs(e){return Lr(`${xa.v1}/mfa/sms/${e}/disable`)}async function Us(e,t){return Lr(`${xa.v1}/mfa/sms/${e}/disable/verify`,t)}async function Rs(e){return Lr(`${xa.v1}/mfa/webauthn/${e}/disable`)}async function Ds(e,t){return Lr(`${xa.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Ns(){return Pr(`${xa.v1}/mfa/devices`)}async function Ms(e){return Lr(`${$a.v1}/user/mfa/authenticator/enroll`,e)}async function Fs(e){return Lr(`${$a.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Gs(e){return Yl(await Lr(`${$a.v1}/user/mfa/authenticator/enroll/verify`,e))}async function $s(e,t){return Lr(`${$a.v1}/user/mfa/authenticator/${e}/verify`,t)}async function xs(e){return Lr(`${$a.v1}/user/mfa/emailcode`,e)}async function Vs(e){return Lr(`${$a.v1}/user/mfa/emailcode/verify`,e)}async function Bs(e){return Yl(await Lr(`${$a.v1}/user/mfa/emailcode/verify`,e))}async function js(e){return Lr(`${$a.v1}/user/mfa/sms/enroll`,e)}async function Ws(e){return Lr(`${$a.v1}/user/mfa/sms/enroll/verify`,e)}async function Ks(e){return Yl(await Lr(`${$a.v1}/user/mfa/sms/enroll/verify`,e))}async function Hs(e,t){return Lr(`${$a.v1}/user/mfa/sms/${e}`,t)}async function zs(e,t){return Lr(`${$a.v1}/user/mfa/sms/${e}/verify`,t)}async function qs(e,t){return Yl(await Lr(`${$a.v1}/user/mfa/sms/${e}/verify`,t))}async function Ys(e){return Lr(`${$a.v1}/user/mfa/webauthn/enroll`,e)}async function Js(e){return Lr(`${$a.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Qs(e){return Yl(await Lr(`${$a.v1}/user/mfa/webauthn/enroll/verify`,e))}async function Xs(e,t){return Lr(`${$a.v1}/user/mfa/webauthn/${e}`,t)}async function Zs(e,t){return Lr(`${$a.v1}/user/mfa/webauthn/${e}/verify`,t)}async function ec(e,t){return Yl(await Lr(`${$a.v1}/user/mfa/webauthn/${e}/verify`,t))}async function tc(){return Pr(`${Qa.v1}/saml/configurations`)}async function nc(e){return Lr(`${Qa.v1}/saml/configurations`,e)}async function oc(){return Pr(`${Qa.v1}/saml/configurations/vendor-config`)}async function ic(e){return _r(`${Qa.v1}/saml/configurations/metadata`,e)}async function ac(){return _r(`${Qa.v1}/saml/validations/domain`)}async function rc(){return Pr(`${Qa.v1}/saml/configurations/roles/default`)}async function lc(){return Pr(`${Qa.v2}/saml/configurations/groups`)}async function sc({roleIds:e}){return Lr(`${Qa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function cc({roleIds:e,group:t}){return Lr(`${Qa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function uc({roleIds:e,group:t,id:n}){return Or(`${Qa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function dc({id:e}){return wr(`${Qa.v2}/saml/configurations/groups/${e}`)}async function yc(){return Pr(`${Qa.v1}/oidc/configurations`)}async function fc(){return Pr(`${Qa.v2}/configurations/public`)}async function pc(){return Pr(ja.v1)}async function gc(){return Pr(ja.v2)}async function Sc(){return Pr(`${ja.v2}/authenticated`)}async function vc(){return Pr(ja.custom.v1)}async function hc({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),Lr(`${$a.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function mc(){return Pr(`${Va.v1}/public`)}async function Ac(e){const{shouldActivate:t,authResponse:n,userId:o,tenantId:i}=await Lr(`${xa.v1}/signUp`,e),a={shouldActivate:t,userId:o,tenantId:i};if(!t&&n){const{user:e,tenants:t,activeTenant:o}=await Yl(n);return U({},a,{user:e,tenants:t,activeTenant:o})}return a}async function bc(){return Pr(xa.sessions.currentUser.v1)}async function Tc(){return Pr(`${xa.sessions.currentUser.v1}/current`)}async function kc(e){return Lr(`${xa.sessions.v1}/revoke`,{userId:e})}async function Ec(){return Pr(xa.sessions.configurations.v1)}async function Ic(e){await Lr(xa.sessions.configurations.v1,e)}async function Pc(e){await wr(`${xa.sessions.currentUser.v1}/${e}`)}async function Lc(){await wr(`${xa.sessions.currentUser.v1}/all`)}async function Oc(){return Pr(xa.accessTokens.v1)}async function _c(){return Pr(Ka.accessTokens.v1)}async function wc({id:e}){return wr(`${Ka.accessTokens.v1}/${e}`)}async function Cc({id:e}){return wr(`${xa.accessTokens.v1}/${e}`)}async function Uc(e){return Lr(xa.accessTokens.v1,e)}async function Rc(e){return Lr(Ka.accessTokens.v1,e)}async function Dc(){return Pr(xa.apiTokens.v1)}async function Nc(){return Pr(Ka.apiTokens.v1)}async function Mc(e){return Lr(xa.apiTokens.v1,e)}async function Fc(e){return Lr(Ka.apiTokens.v2,e)}async function Gc({tokenId:e}){return wr(`${Ka.apiTokens.v1}/${e}`)}async function $c({tokenId:e}){return wr(`${xa.apiTokens.v1}/${e}`)}async function xc({userId:e}){return Pr(`${xa.v1}/${e}`)}async function Vc(e){return Pr(`${Va.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Bc(e){let{type:t}=e,n=Jo(e,Bl);return Lr(`${$a.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function jc(e){let{type:t}=e,n=Jo(e,jl);return Yl(await Lr(`${$a.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function Wc(e){let{type:t}=e,n=Jo(e,Wl);return Lr(`${$a.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Kc({token:e}){return Lr(Ka.invites.verify.v1,{token:e})}async function Hc(){return Pr(`${Qa.v1}/configurations`)}async function zc(e){return Lr(`${Qa.v1}/configurations`,e)}async function qc(e,t){return Or(`${Qa.v1}/configurations/${e}`,t)}async function Yc(e){return wr(`${Qa.v1}/configurations/${e}`)}async function Jc(e){return Lr(`${Qa.v1}/configurations/metadata`,e)}async function Qc(e,t){return _r(`${Qa.v1}/configurations/${e}/metadata`,t)}async function Xc(e){return Lr(`${Qa.v1}/configurations/metadata-url`,e)}async function Zc(e,t){return _r(`${Qa.v1}/configurations/${e}/metadata-url`,t)}async function eu(e,t){return Lr(`${Qa.v1}/configurations/${e}/domains`,t)}async function tu(e,t){return wr(`${Qa.v1}/configurations/${e}/domains/${t}`)}async function nu(e,t){return _r(`${Qa.v1}/configurations/${e}/domains/${t}/validate`)}async function ou(e){return Pr(`${Qa.v1}/configurations/${e}/roles`)}async function iu(e,t){return _r(`${Qa.v1}/configurations/${e}/roles`,t)}async function au(e,t){return Lr(`${Qa.v1}/configurations/${e}/groups`,t)}async function ru(e,{roleIds:t,group:n,id:o}){return Or(`${Qa.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function lu(e,t){return wr(`${Qa.v1}/configurations/${e}/groups/${t}`)}async function su(e){return Pr(`${Qa.v1}/configurations/${e}/groups`)}async function cu(e){return Lr(`${$a.v2}/user/sso/prelogin`,e)}async function uu(e){return Kl(await Lr(`${$a.v2}/user/oidc/postlogin`,e))}async function du(e){return Ql(await Lr(`${gr}/token`,e))}async function yu(){const e=qr();return Ql(await Lr(`${gr}/authorize/silent`,{tenantId:e}))}async function fu(e){return Jl(await Lr(`${gr}/token`,e))}async function pu(){const e=qr();return Jl(await Lr(`${gr}/authorize/silent`,{tenantId:e}))}async function gu(e){return Lr(`${xa.v1}/phone/reset`,e)}async function Su(e){return Lr(`${xa.v1}/phone/reset/verify`,e)}async function vu(e){return Lr(`${xa.v1}/phone`,e)}async function hu(e){return Lr(`${xa.v1}/phone/verify`,e)}async function mu(e){return _r(`${xa.v1}/phone/change`,e)}async function Au(e){return Lr(`${$a.v1}/webauthn/prelogin`,e)}async function bu(e){return Lr(`${$a.v1}/webauthn/postlogin`,e)}async function Tu(e){return Yl(await Lr(`${$a.v1}/webauthn/postlogin`,e))}async function ku(){return Lr(Ga.v1)}async function Eu(){return Pr(Ga.v1)}async function Iu(e){return wr(`${Ga.v1}/${e}`)}async function Pu(e){return Lr(`${Ga.v1}/verify`,e)}async function Lu(){return Pr(`${Va.v1}/auth/strategies/public`)}async function Ou(){return Pr(`${Va.v1}/auth/strategies`)}async function _u(){return Pr(`${Va.v1}/mfa/strategies`)}async function wu(){return Pr(`${xa.authorization.v1}`)}async function Cu(){return Pr(`${xa.v2}/me`)}async function Uu(){const e=[{action:Cu,shouldLoad:!0},{action:Gl,shouldLoad:zl()},{action:wu,shouldLoad:ql()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[t,n,o]=await Promise.all(e),i=qr();return i&&(t.tenantId=i),U({},t,null!=o?o:{},{entitlements:n})}async function Ru(e){return Pr(`${xa.v2}/me`,null!=e?e:{addRoles:!0})}async function Du(e){return _r(`${xa.v2}/me`,e)}async function Nu(e){return _r(`${tr.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Mu(e){return Lr(`${xa.v1}/passwords/change`,e)}async function Fu(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 Pr(Xa.v1,U({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function Gu(e){return Lr(xa.v2,U({},e,{provider:"local"}))}async function $u(e){return wr(`${Xa.v1}/${e.userId}`)}async function xu(e){return _r(Xa.v1,e)}async function Vu(e){return Lr(Ka.invites.user.v1,U({},e))}async function Bu(e){return Or(Ka.invites.user.v1,U({},e))}async function ju(){return wr(Ka.invites.user.v1)}async function Wu(){return Pr(Ka.invites.user.v1)}async function Ku(){return Pr(Ka.invites.configuration.v1)}async function Hu(){return Pr(Za.v1)}async function zu(){return Pr(Wa.v1)}async function qu(){return Pr(`${er.v1}/members`)}async function Yu(e){return Lr(`${Xa.v1}/${e.userId}/resendActivationEmail`,{})}async function Ju(e){return Lr(xa.v2,U({},e,{provider:"local"}))}async function Qu(e){return Lr(xa.invitation.resendAll.v1,U({},e))}async function Xu(e){var t,n;const o=await Pr("/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 Zu(){return Pr("/metadata/admin-box")}async function ed(e){return Lr("/metadata/admin-box",e)}async function td(){const e=await Pr("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const nd=async()=>Xu({entityName:"notifications"}),od=async()=>Xu({entityName:"saml"}),id=async()=>Xu({entityName:"audits"}),ad=async e=>async function(e){const t=await Pr(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),rd=["dataFilters"],ld=["templateId","dataFilters"],sd=["dataFilters"];async function cd(e){return Pr(`${cr.v2}/tenant-reports`,e)}async function ud(e){return Pr(`${cr.v2}/${e.id}/tenant-reports`)}async function dd(e){let{dataFilters:t}=e,n=Jo(e,rd);return{html:await Pr(`${ur.v1}/preview-report`,U({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function yd(e){let{templateId:t,dataFilters:n}=e,o=Jo(e,ld);return Lr(`${cr.v2}/${t}/tenant-reports`,U({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function fd(e){let{dataFilters:t}=e,n=Jo(e,sd);const o=await Pr(`${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 pd(e){return Lr(`${ur.v1}/tenant-reports`,e)}async function gd(e){return Pr(dr,{params:e})}async function Sd(e){return _r(`${dr}/status`,{params:e})}async function vd(e){const{notificationId:t,pinStatus:n}=e;return _r(`${dr}/${n}`,{notificationId:t})}async function hd(){return Lr(`${dr}/status/mark-all-read`)}const md=["endpoint","headerProps"];async function Ad(e){return Pr(yr,e)}async function bd(e){return Pr(`${yr}/stats`,e)}async function Td(e){const{endpoint:t,headerProps:n}=e,o=Jo(e,md);return Cr(`${yr}/export/${t}`,{properties:n},o)}const kd=["eventKey"],Ed=["eventKey"],Id=()=>Pr(`${ar.v1}/slack`),Pd=()=>Pr(`${ar.v1}/slack/applications`),Ld=()=>Pr(`${ar.v1}/slack/channels`),Od=e=>e.id?Or(`${ar.v1}/slack/subscription/${e.id}`,e):Lr(`${ar.v1}/slack/subscriptions`,e),_d=e=>wr(`${ar.v1}/slack/subscriptions/${e.id}`),wd=e=>Lr(`${ar.v1}/slack/applications/registrations`,{code:e}),Cd=()=>Pr(`${ar.v1}/emails`),Ud=e=>{let{eventKey:t}=e,n=Jo(e,kd);return Lr(`${ar.v1}/emails/${t}`,n)},Rd=({eventKey:e,enabled:t})=>Or(`${ar.v1}/emails/${e}`,{enabled:t}),Dd=(e,t)=>wr(`${ar.v1}/emails/${e}/subscriptions/${t}`),Nd=(e,t,n)=>_r(`${ar.v1}/emails/${t}/subscriptions/${e}`,n),Md=e=>wr(`${ar.v1}/emails/${e}`),Fd=()=>Pr(`${ar.v2}/sms`),Gd=e=>{let{eventKey:t}=e,n=Jo(e,Ed);return Lr(`${ar.v2}/sms/${t}`,n)},$d=({eventKey:e,enabled:t})=>Or(`${ar.v2}/sms/${e}`,{enabled:t}),xd=(e,t)=>wr(`${ar.v2}/sms/${e}/subscriptions/${t}`),Vd=(e,t,n)=>_r(`${ar.v2}/sms/${t}/subscriptions/${e}`,n),Bd=e=>wr(`${ar.v2}/sms/${e}`),jd=()=>Pr(pr),Wd=e=>e._id?Or(`${pr}/${e._id}`,e):Lr(`${pr}/custom`,e),Kd=e=>wr(`${pr}/${e}`),Hd=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Pr(`${pr}/logs/?${o.toString()}`)},zd=e=>Lr(`${pr}/test`,e),qd=e=>Lr(`${pr}/logs/${e}/retries`),Yd=()=>Pr(`${fr.v1}/categories`),Jd=e=>Pr(fr.v1,{channels:e});async function Qd(e,t){return _r(nr.v1,e,{headers:Ur(t)})}async function Xd(e){return Pr(nr.v1,void 0,{headers:Ur(e)})}async function Zd(){return Pr(`${nr.v1}/public`)}const ey=["roleId"],ty=["roleId"],ny=["permissionId"];async function oy(){return Pr(Ha.v1)}async function iy(e){return Lr(Ha.v1,e)}async function ay({roleId:e}){return wr(`${Ha.v1}/${e}`)}async function ry(e){let{roleId:t}=e,n=Jo(e,ey);return Or(`${Ha.v1}/${t}`,n)}async function ly(e){let{roleId:t}=e,n=Jo(e,ty);return _r(`${Ha.v1}/${t}/permissions`,n)}async function sy(){return Pr(Wa.v1)}async function cy(e){let{permissionId:t}=e,n=Jo(e,ny);return _r(`${Wa.v1}/${t}/roles`,n)}async function uy(){return Pr(`${Wa.v1}/categories`)}async function dy(){return Pr(rr.subscriptions.v1)}async function yy(e){return Pr(`${rr.subscriptions.v1}/${e}`)}async function fy(e){return _r(`${rr.subscriptions.v1}/${e}/cancellations/`,{})}async function py(e){return _r(`${rr.subscriptions.v1}/${e}/renewals/`,{})}async function gy(e,{paymentMethodId:t,planId:n}){return _r(`${rr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Sy(e){return Pr(`${sr.v1}/${e}`)}async function vy(){return Pr(`${sr.v1}`)}async function hy(e){return _r(`${sr.v1}/${e}/cancellations/`,{})}async function my(e){return _r(`${sr.v1}/${e}/renewals/`,{})}async function Ay(e,{paymentMethodId:t,planId:n}){return _r(`${sr.v1}/${e}`,{paymentMethodId:t,planId:n})}async function by(){return Pr(rr.plans.v1)}async function Ty(e){return Pr(`${rr.plans.v1}/${e}`)}async function ky(){return Pr(rr.invoices.v1)}async function Ey(e){return Pr(`${rr.invoices.v1}/${e}`)}async function Iy(e,t){return Pr(`${rr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Py=["email"];async function Ly(){return Pr(rr.paymentMethods.v1)}async function Oy(e){return Pr(`${rr.paymentMethods.v1}/${e}`)}async function _y(e,t){let{email:n}=t,o=Jo(t,Py);return Or(`${rr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function wy(e){return Lr(rr.paymentProviders.stripe.subscriptions.v1,e)}async function Cy(e){return Pr(`${rr.paymentProviders.stripe.customers.v1}/${e}`)}async function Uy(e){return Lr(`${rr.paymentProviders.stripe.customers.v1}`,e)}async function Ry(){return Pr(`${rr.paymentProviders.stripe.publicConfigurations.v1}`)}async function Dy(e){return Lr(`${rr.paymentProviders.stripe.setupIntents.v1}`,e)}async function Ny(e){return Pr(`${rr.summaries.v1}/${e}`)}async function My(e){return Pr(`${rr.tenantConfiguration.v1}/${e}`)}async function Fy(e){return Lr(`${rr.tenantConfiguration.v1}`,e)}async function Gy(){return Pr(lr.v1)}async function $y(){return Pr(`${rr.configurations.vendorPublicConfigurations.v1}`)}let xy,Vy,By,jy,Wy,Ky;async function Hy(){return Pr("/vendors/public")}async function zy(e){return Pr(za.v1,e)}async function qy(e){return Lr(za.v1,e)}async function Yy(e,t){return wr(za.v1,e,{headers:Ur(t)})}async function Jy(e,t,n){return Lr(`${za.v1}/${e}/roles`,t,{headers:Ur(n)})}async function Qy(e,t,n){return wr(`${za.v1}/${e}/roles`,t,{headers:Ur(n)})}async function Xy(e,t,n){return Or(`${za.v1}/${e}/roles`,t,{headers:Ur(n)})}async function Zy(e,t){return Lr(ir.v1,e,{headers:Ur(t)})}async function ef(e,t){return wr(`${ir.v1}/${e}`,void 0,{headers:Ur(t)})}async function tf({tenantId:e},t,n){return Or(`${ir.v1}/${e}`,t,{headers:Ur(n)})}async function nf(e,t,n){return _r(`${za.v1}/${e}/access`,t,{headers:Ur(n)})}async function of(e,t){return Lr(`${za.v2}/`,e,{headers:Ur(t)})}async function af(){return Pr(`${vr}`)}async function rf(e,t){return Or(`${vr}/${e}`,t)}async function lf(e){return Lr(`${vr}`,e)}async function sf(e){return wr(`${vr}/${e}`)}async function cf(e){return Pr(`${hr}/${e}/Users/count`)}async function uf(e){return Lr(`${qa.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(xy||(xy={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Vy||(Vy={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(By||(By={})),(jy||(jy={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Wy||(Wy={})),function(e){e.CREATE="create_customer"}(Ky||(Ky={}));const df=["groupId"];async function yf({groupId:e},t){return Pr(`${Ya.v1}/${e}`,U({},t))}async function ff(e){return Pr(`${Ya.v1}`,U({},e))}async function pf(e,t){return Lr(`${Ya.getByIds.v1}`,e,{params:t})}async function gf(e){return Lr(`${Ya.v1}`,e)}async function Sf(e){let{groupId:t}=e,n=Jo(e,df);return Or(`${Ya.v1}/${t}`,n)}async function vf(e){return wr(`${Ya.v1}/${e}`)}async function hf(e,t){return Lr(`${Ya.v1}/${e}/roles`,t)}async function mf(e,t){return wr(`${Ya.v1}/${e}/roles`,t)}async function Af(e,t){return Lr(`${Ya.v1}/${e}/users`,t)}async function bf(e,t){return wr(`${Ya.v1}/${e}/users`,t)}async function Tf(){return Pr(`${Ya.configurations.v1}`)}async function kf(e){return Lr(`${Ya.configurations.v1}`,e)}async function Ef(){return Pr(br.v1)}async function If(){return Pr(Tr.v1)}async function Pf(e){return Pr(`${Ja.v1}`,e)}async function Lf(e){return Lr(`${Ja.v1}`,e)}async function Of(e){return wr(`${Ja.v1}/${e}`)}async function _f(e){return Lr(`${Ja.v1}/preverify`,e)}async function wf(e){return Lr(`${Ja.v1}/verify`,e)}async function Cf(e,t){return Lr(`${Ja.v1}/${e}/delete/verify`,t)}let Uf,Rf,Df;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Uf||(Uf={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(Rf||(Rf={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Df||(Df={}));const Nf=[/^(.*)\/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],Mf=`${$a.v1}/user/token/refresh`,Ff=`${gr}/authorize/silent`,Gf=`${xa.v2}/me`,$f=`${xa.v2}/me/tenants`,xf=`${xa.v3}/me/tenants`;let Vf,Bf,jf,Wf,Kf,Hf,zf,qf;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Vf||(Vf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Bf||(Bf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(jf||(jf={})),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"}(Wf||(Wf={})),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"}(Kf||(Kf={})),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"}(Hf||(Hf={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(zf||(zf={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(qf||(qf={}));const Yf={auth:l,teams:s,metadata:c,reports:u,connectivity:f,notifications:d,audits:y,tenants:a,accountSettings:p,roles:g,subscriptions:S,vendor:v,subTenants:h,featureFlags:t,directory:m,impersonate:A,groups:b,users:i,entitlements:r,securityCenter:T,userPhoneNumbers:k};var Jf={fetch:e,ContextHolder:Na,FronteggContext:Ma,api:Yf,FronteggApiError:Fa,AuthStrategyEnum:ko,MachineToMachineAuthStrategy:Eo,SocialLoginProviders:To,ISubscriptionCancellationPolicy:By,ISubscriptionStatus:xy,PaymentMethodType:Vy,ProviderType:jy};let Qf,Xf;!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"}(Qf||(Qf={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Xf||(Xf={}));const Zf="input is invalid type",ep="undefined"!=typeof ArrayBuffer,tp="0123456789abcdef".split(""),np=[-2147483648,8388608,32768,128],op=[24,16,8,0],ip=[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],ap=["hex","array","digest","arrayBuffer"],rp=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),ep&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const lp=function(e){return function(t){const n=new cp(!0).update(t);return null==n?void 0:n[e]()}},sp=function(e){return function(t,n){const o=new up(t,!0).update(n);return null==o?void 0:o[e]()}};class cp{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=()=>cp.prototype.digest(),e?(rp[0]=rp[16]=rp[1]=rp[2]=rp[3]=rp[4]=rp[5]=rp[6]=rp[7]=rp[8]=rp[9]=rp[10]=rp[11]=rp[12]=rp[13]=rp[14]=rp[15]=0,this.blocks=rp):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(Zf);if(null===e)throw new Error(Zf);if(ep&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||ep&&ArrayBuffer.isView(e)))throw new Error(Zf);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]<<op[3&i++];else for(i=this.start;a<r&&i<64;++a)o=e.charCodeAt(a),o<128?l[i>>2]|=o<<op[3&i++]:o<2048?(l[i>>2]|=(192|o>>6)<<op[3&i++],l[i>>2]|=(128|63&o)<<op[3&i++]):o<55296||o>=57344?(l[i>>2]|=(224|o>>12)<<op[3&i++],l[i>>2]|=(128|o>>6&63)<<op[3&i++],l[i>>2]|=(128|63&o)<<op[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++a)),l[i>>2]|=(240|o>>18)<<op[3&i++],l[i>>2]|=(128|o>>12&63)<<op[3&i++],l[i>>2]|=(128|o>>6&63)<<op[3&i++],l[i>>2]|=(128|63&o)<<op[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]|=np[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+ip[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+ip[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+ip[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+ip[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=tp[e>>28&15]+tp[e>>24&15]+tp[e>>20&15]+tp[e>>16&15]+tp[e>>12&15]+tp[e>>8&15]+tp[e>>4&15]+tp[15&e]+tp[t>>28&15]+tp[t>>24&15]+tp[t>>20&15]+tp[t>>16&15]+tp[t>>12&15]+tp[t>>8&15]+tp[t>>4&15]+tp[15&t]+tp[n>>28&15]+tp[n>>24&15]+tp[n>>20&15]+tp[n>>16&15]+tp[n>>12&15]+tp[n>>8&15]+tp[n>>4&15]+tp[15&n]+tp[o>>28&15]+tp[o>>24&15]+tp[o>>20&15]+tp[o>>16&15]+tp[o>>12&15]+tp[o>>8&15]+tp[o>>4&15]+tp[15&o]+tp[i>>28&15]+tp[i>>24&15]+tp[i>>20&15]+tp[i>>16&15]+tp[i>>12&15]+tp[i>>8&15]+tp[i>>4&15]+tp[15&i]+tp[a>>28&15]+tp[a>>24&15]+tp[a>>20&15]+tp[a>>16&15]+tp[a>>12&15]+tp[a>>8&15]+tp[a>>4&15]+tp[15&a]+tp[r>>28&15]+tp[r>>24&15]+tp[r>>20&15]+tp[r>>16&15]+tp[r>>12&15]+tp[r>>8&15]+tp[r>>4&15]+tp[15&r];return s+=tp[l>>28&15]+tp[l>>24&15]+tp[l>>20&15]+tp[l>>16&15]+tp[l>>12&15]+tp[l>>8&15]+tp[l>>4&15]+tp[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 up extends cp{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(Zf);if(null===e)throw new Error(Zf);if(ep&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||ep&&ArrayBuffer.isView(e)))throw new Error(Zf)}var i;e.length>64&&(e=null==(i=new cp(!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}cp.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();cp.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),cp.prototype.finalize.call(this)}}}const dp=function(){const e=lp("hex");e.create=function(){return new cp},e.update=function(t){return e.create().update(t)};for(let t=0;t<ap.length;++t){const n=ap[t];e[n]=lp(n)}return e}();function yp(e,t){const n=U({},e);return t.forEach((e=>{delete n[e]})),n}async function fp(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=dp.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function pp(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=sp("hex");e.create=function(e){return new up(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<ap.length;++t){const n=ap[t];e[n]=sp(n)}}();const gp=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 xi((e=>e.root.appName));return Mr.getFeatureFlags(e,t)}const vp={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},hp=U({},vp,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),mp=[{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"}],Ap={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},bp=U({},Ap,{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}),Tp={loading:!1,error:void 0,saving:!0,profile:Ap},kp={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"},Ep={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:ko.EmailAndPassword,machineToMachineAuthStrategy:Eo.ClientCredentials},Ip={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Pp={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Lp={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Op={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},_p={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},wp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Cp={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Op,roles:wp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Up=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Rp={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:[mp[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[mp[0]],managedBy:jf.FRONTEGG}]},Dp={id:Rp.id,email:Rp.email,name:Rp.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:[mp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Np={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:[mp[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[mp[0]],managedBy:jf.FRONTEGG}]},Mp={id:Np.id,email:Np.email,name:Np.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:[mp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Fp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Gp=[Np,Rp],$p=[Mp,Dp],xp=[Fp],Vp=[{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}],Bp=[{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"}],jp={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Wp={isActive:!0,strategy:Bn.ALLOW},Kp=[{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"}],Hp=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(U({},Np,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},zp=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"}),qp=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Hp(6),roles:[zp("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:jf.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Hp(44),roles:[zp("Editor")],managedBy:jf.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Hp(8),roles:[zp("Viewer")],managedBy:jf.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Hp(5),roles:[zp("Admin")],managedBy:jf.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Hp(21),description:"BDR, AE, and inside sales",roles:[zp("Viewer")],managedBy:jf.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Hp(23),description:"Dev success and customer success",roles:[zp("Admin")],managedBy:jf.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Hp(10),description:"The marketing department",roles:[zp("Viewer")],managedBy:jf.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Hp(4),description:"Human resources",roles:[zp("Viewer")],managedBy:jf.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Hp(3),roles:[zp("Viewer")],managedBy:jf.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Hp(8),roles:[zp("Editor")],managedBy:jf.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Hp(4),roles:[zp("Viewer")],managedBy:jf.FRONTEGG}],Yp={scoring:{score:79},recommendations:{items:[{code:Wf.FORCE_MFA,severity:zf.WARNING,category:qf.MFA},{code:Wf.ENABLE_FORCE_RELOGIN,severity:zf.WARNING,category:qf.SESSIONS}]}},Jp={insights:{items:[{category:qf.MFA,code:Kf.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:qf.SESSIONS,code:Kf.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:qf.PASSWORD,code:Kf.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:qf.DOMAIN,code:Kf.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},Qp={users:$p,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},Xp={users:[$p[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},Zp={users:[$p[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0};let eg,tg,ng;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(eg||(eg={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(tg||(tg={})),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"}(ng||(ng={})),ng.profile,ng.privacy,ng.personalApiTokens,ng.account,ng.users,ng.groups,ng.security,ng.sso,ng.audits,ng.webhooks,ng.apiTokens,ng.roles,ng.subscriptions,ng.allAccounts;const og=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},ig=e=>{const{pathname:t}=new URL(e),n=og(e);return n?t+n:t},ag=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},rg="tenantId",lg=e=>e.mfaRequired&&e.mfaToken?(Na.setAccessToken(null),Na.setUser(null),!0):(Na.setAccessToken(e.accessToken),Na.setUser(e),!1),sg=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},cg=e=>{if(1===e.length){const[t]=e;if(t===Ml.AuthenticatorApp)return ln.authenticatorApp;if(t===Ml.SMS)return ln.smsSetPhoneNumber;if(t===Ml.EmailCode)return ln.emailVerifyCode}return ln.verify};function*ug(e){let t=Pt.loginWithTwoFactor,n={};const{loginState:o}=yield xi((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield Fi(Yf.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:sg(e.mfaDevices)}:(n={step:cg(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 dg=(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 yg;function fg(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"}(yg||(yg={}));const pg=(e,t=[])=>Object.entries(e).reduce(((e,[n,o])=>"object"==typeof o?[...e,...pg(o,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:o}]),[]),gg=["callback"];function*Sg(){yield Di(Fo.setCustomLoginState({loading:!0}));try{const e=yield Fi(Yf.metadata.getAdminBoxMetadata);yield Di(Fo.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield Di(Fo.setCustomLoginState({loading:!1,error:dg(e)}))}}function*vg(e){let{payload:{callback:t}}=e,n=Jo(e.payload,gg);try{yield Di(Fo.setCustomLoginState({error:null,saving:!0}));const e=pg(n);if(0===e.length)throw new Error("No changes to update");yield Fi(Yf.metadata.updateAdminBoxMetadata,{actions:e});const o=yield Fi(Yf.metadata.getAdminBoxMetadata);yield Di(Fo.setCustomLoginState({tenantMetadata:o,saving:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setCustomLoginState({error:dg(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*hg(){var e;const[t]=yield Fi(Sp,["admin_portal_login_per_tenant"]),n=!(null==(e=Na.getContext())||!e.tenantResolver);if(yield xi((e=>e.auth.isAuthenticated))){var o;const e=yield null!=(o=xi((({auth:e})=>{var t;return null==(t=e.tenantsState.activeTenant)?void 0:t.hasCustomLogin})))&&o;return t&&n&&e}return t&&n}function*mg(){try{var e;if(!(yield Fi(hg)))return;const t=yield xi((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:o}=Yf.accountSettings,{applicationUrl:i}=yield Fi(t?n:o);if(!i)return;const{routes:a}=yield xi((e=>e.auth)),r=null!=(e=og(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*Ag(){yield Da(Fo.loadTenantMetadata,Sg),yield Da(Fo.updateTenantMetadata,vg)}let bg;!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"}(bg||(bg={}));const Tg=["callback"];function kg(e){return function*(t){const[n]=yield Fi(Sp,["security-center-admin-portal-major-version"]);yield e(t),n&&(yield Eg(),yield Ig())}}function*Eg(){const e=bg.RECOMMENDATIONS;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:o}=yield Fi(Yf.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:dg(t)}))}finally{yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Ig(){const e=bg.INSIGHTS;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield Fi(Yf.securityCenter.getInsights);yield Di(Fo.setSecurityCenterState({insights:t.items}))}catch(t){yield Di(Fo.setSecurityCenterStateError({key:e,value:dg(t)}))}finally{yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Pg(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Tg);const o=bg.SEND_BREACHED_PASSWORD_EMAIL;yield Di(Fo.setSecurityCenterStateError({key:o,value:!1})),yield Di(Fo.setSecurityCenterStateLoader({key:o,value:!0}));try{yield Fi(Yf.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield Di(Fo.setSecurityCenterStateError({key:o,value:dg(e)})),null==t||t(!1,e)}finally{yield Di(Fo.setSecurityCenterStateLoader({key:o,value:!1}))}}function*Lg({payload:{callback:e}}){const t=bg.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(Yf.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield Di(Fo.setSecurityCenterStateError({key:t,value:dg(n)})),null==e||e(!1)}finally{yield Di(Fo.setSecurityCenterStateLoader({key:t,value:!1}))}}function*Og({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(Yf.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(Yf.roles.getRoles),o=yield Fi(Yf.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:dg(t)}))}finally{yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*_g({payload:e}){var t;const n=bg.BREACHED_PASSWORD_USERS_TABLE,o=yield null!=(t=xi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield Og(U({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:yo.BREACHED_PASSWORDS,tableState:o},e))}function*wg({payload:e}){var t;const n=bg.UNENROLLED_MFA_USERS_TABLE,o=yield null!=(t=xi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield Og(U({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:yo.MFA_UNENROLLED,tableState:o},e))}function*Cg({payload:e}){var t;const n=bg.INACTIVE_USERS_TABLE,o=yield null!=(t=xi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield Og(U({key:n,updateStateKey:"inactiveUsersTable",_preset:yo.INACTIVE,tableState:o},e))}function*Ug(){yield Ua(Fo.loadRecommendations,Eg),yield Ua(Fo.loadInsights,Ig),yield Ua(Fo.sendResetBreachedPasswordEmail,Pg),yield Ua(Fo.sendBulkResetBreachedPasswordEmails,Lg),yield Ua(Fo.loadBreachedPasswordUsers,_g),yield Ua(Fo.loadUnenrolledMfaUsers,wg),yield Ua(Fo.loadInactiveUsers,Cg)}function*Rg(){const e=bg.RECOMMENDATIONS;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield Vi(500),yield Di(Fo.setSecurityCenterState({recommendations:Yp.recommendations.items,score:Yp.scoring.score})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*Dg(){const e=bg.INSIGHTS;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield Vi(500),yield Di(Fo.setSecurityCenterState({insights:Jp.insights.items})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*Ng(){const e=bg.BREACHED_PASSWORD_USERS_TABLE;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield Vi(500),yield Di(Fo.setSecurityCenterState({breachedPasswordUsersTable:Qp})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*Mg(){const e=bg.UNENROLLED_MFA_USERS_TABLE;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield Vi(500),yield Di(Fo.setSecurityCenterState({unenrolledMfaUsersTable:Zp})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*Fg(){const e=bg.INACTIVE_USERS_TABLE;yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!0})),yield Vi(500),yield Di(Fo.setSecurityCenterState({inactiveUsersTable:Xp})),yield Di(Fo.setSecurityCenterStateLoader({key:e,value:!1}))}function*Gg({payload:{callback:e}}){const t=bg.SEND_BREACHED_PASSWORD_EMAIL;yield Di(Fo.setSecurityCenterStateLoader({key:t,value:!0})),yield Vi(500),null==e||e(!0),yield Di(Fo.setSecurityCenterStateLoader({key:t,value:!1}))}function*$g(){yield Ua(Fo.loadRecommendations,Rg),yield Ua(Fo.loadInsights,Dg),yield Ua(Fo.loadBreachedPasswordUsers,Ng),yield Ua(Fo.loadUnenrolledMfaUsers,Mg),yield Ua(Fo.loadInactiveUsers,Fg),yield Ua(Fo.sendResetBreachedPasswordEmail,Gg)}const xg=["callback"],Vg=["callback"],Bg=["callback"],jg=["callback"],Wg=["callback"],Kg=["callback"];function*Hg(){yield Di(Fo.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Fi(Yf.auth.getGlobalSecurityPolicy);yield Di(Fo.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyGlobalState({error:dg(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*zg(e){var t,n;if(!(yield Fi(hg)))return e;const o=yield Fi(Yg);return null!=o&&null!=(t=o.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?U({},e,{authStrategy:o.mainAuthStrategies[0].strategy}):e}function*qg(){yield Di(Fo.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Fi(Yf.auth.getVendorConfig),t=yield zg(e);yield Di(Fo.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyPublicState({error:dg(e),loading:!1}))}}function*Yg(){const e=yield xi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Fi(Yf.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield Fi(Yf.auth.getVendorPublicAuthStrategiesConfig),t}function*Jg(){yield Di(Fo.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield Fi(Yg);yield function*(e){const t=yield Fi(hg);if(!e||!t)return;const{policy:n}=yield xi((({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:dg(e),loading:!1}))}}function*Qg(){yield Di(Fo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Fi(Yf.auth.getMfaPolicy);yield Di(Fo.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyMfaState({error:dg(e),loading:!1}))}}function*Xg(){yield Di(Fo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Fi(Yf.auth.getVendorMfaPolicy);yield Di(Fo.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyVendorMfaState({error:dg(e),loading:!1}))}}function*Zg(e){let{payload:{callback:t}}=e,n=Jo(e.payload,xg);yield Di(Fo.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Fi(Yf.auth.saveMfaPolicy,n);yield Di(Fo.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setSecurityPolicyMfaState({saving:!1,error:dg(e)})),null==t||t(null,e)}}function*eS(){yield Di(Fo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Fi(Yf.auth.getLockoutPolicy);yield Di(Fo.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyLockoutState({error:dg(e),loading:!1}))}}function*tS(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Vg);yield Di(Fo.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Fi(Yf.auth.saveLockoutPolicy,n);yield Di(Fo.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setSecurityPolicyLockoutState({saving:!1,error:dg(e)})),null==t||t(null,e)}}function*nS(){yield Di(Fo.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Fi(Yf.auth.getVendorLockoutPolicy);yield Di(Fo.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyVendorLockoutState({error:dg(e),loading:!1}))}}function*oS(){yield Di(Fo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Fi(Yf.auth.getCaptchaPolicy);yield Di(Fo.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyCaptchaState({error:dg(e),loading:!1}))}}function*iS(){yield Di(Fo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Fi(Yf.auth.getPasswordHistoryPolicy);yield Di(Fo.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyPasswordHistoryState({error:dg(e),loading:!1}))}}function*aS(){yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Fi(Yf.auth.getVendorPasswordHistoryPolicy);yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({error:dg(e),loading:!1}))}}function*rS(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Bg);yield Di(Fo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Fi(Yf.auth.savePasswordHistoryPolicy,n);yield Di(Fo.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Di(Fo.setSecurityPolicyPasswordHistoryState({saving:!1,error:dg(e)})),null==t||t(null,e)}}function*lS(){yield Di(Fo.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Fi(Yf.auth.getPasswordConfigPolicy);yield Di(Fo.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyPasswordState({error:dg(e),loading:!1}))}}function*sS(){yield Da(Fo.loadSecurityPolicy,Hg),yield Ua(Fo.saveSecurityPolicyMfa,kg(Zg)),yield Ua(Fo.loadSecurityPolicyMfa,Qg),yield Ua(Fo.loadSecurityPolicyVendorMfa,Xg),yield Ua(Fo.saveSecurityPolicyLockout,kg(tS)),yield Ua(Fo.loadSecurityPolicyLockout,eS),yield Ua(Fo.loadSecurityPolicyVendorLockout,nS),yield Ua(Fo.loadSecurityPolicyCaptcha,oS),yield Ua(Fo.saveSecurityPolicyPasswordHistory,kg(rS)),yield Ua(Fo.loadSecurityPolicyPasswordHistory,iS),yield Ua(Fo.loadSecurityPolicyVendorPasswordHistory,aS),yield Ua(Fo.loadVendorPasswordConfig,lS),yield Ua(Fo.loadPublicSecurityPolicy,qg),yield Ua(Fo.loadPublicAuthStrategiesPolicy,Jg)}function*cS(){yield Di(Fo.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Di(Fo.setSecurityPolicyPublicState({policy:Ep,loading:!1}))}catch(e){yield Di(Fo.setSecurityPolicyPublicState({error:dg(e),loading:!1}))}}function*uS(){yield Di(Fo.setSecurityPolicyGlobalState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyGlobalState({policy:kp,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*dS(){yield Di(Fo.setSecurityPolicyMfaState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyMfaState({policy:Ip,loading:!1}))}function*yS(){yield Di(Fo.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyVendorMfaState({policy:Ip,loading:!1}))}function*fS(e){var t;let{payload:{callback:n}}=e,o=Jo(e.payload,jg);yield Di(Fo.setSecurityPolicyMfaState({saving:!0,error:null}));const i=U({},Pp,{id:null!=(t=o.id)?t:Pp.id,enforceMFAType:o.enforceMFAType});yield bt(),yield Di(Fo.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*pS(){yield Di(Fo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyLockoutState({policy:Pp,loading:!1}))}function*gS(){yield Di(Fo.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyVendorLockoutState({policy:Pp,loading:!1}))}function*SS(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Wg);yield Di(Fo.setSecurityPolicyLockoutState({saving:!0,error:null})),yield bt();const o=U({},Pp,n,{id:n.id?n.id:Pp.id});null==t||t(o),yield Di(Fo.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*vS(){yield Di(Fo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyLockoutState({policy:Pp,loading:!1}))}function*hS(){yield Di(Fo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyPasswordHistoryState({policy:Lp,loading:!1}))}function*mS(){yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield bt(),yield Di(Fo.setSecurityPolicyVendorPasswordHistoryState({policy:Lp,loading:!1}))}function*AS(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Kg);yield Di(Fo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield bt();const o=U({},Lp,n,{id:n.id?n.id:Lp.id});null==t||t(o),yield Di(Fo.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*bS(){yield Da(Fo.loadSecurityPolicy,uS),yield Ua(Fo.loadPublicSecurityPolicy,cS),yield Ua(Fo.saveSecurityPolicyMfa,fS),yield Ua(Fo.loadSecurityPolicyMfa,dS),yield Ua(Fo.loadSecurityPolicyVendorMfa,yS),yield Ua(Fo.saveSecurityPolicyLockout,SS),yield Ua(Fo.loadSecurityPolicyLockout,pS),yield Ua(Fo.loadSecurityPolicyVendorLockout,gS),yield Ua(Fo.loadSecurityPolicyCaptcha,vS),yield Ua(Fo.saveSecurityPolicyPasswordHistory,AS),yield Ua(Fo.loadSecurityPolicyPasswordHistory,hS),yield Ua(Fo.loadSecurityPolicyVendorPasswordHistory,mS)}const TS=["events","url"];function*kS(){yield Di(Fo.setSignUpState({loading:!0}));try{const e=yield Fi(Yf.auth.getVendorConfig),t=yield zg(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:dg(e),firstLoad:!1}))}}function*ES(e){let{payload:{events:t,url:n}}=e,o=Jo(e.payload,TS);yield Di(Fo.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield xi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c,tenants:u=[],activeTenant:d}=yield Fi(Yf.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:tg.PASSWORD,id:c,tenantId:s,createdAt:new Date};null==t||null==(i=t.signUpComplete)||i.call(t,l),fg(yg.SIGNUP_COMPLETED,l)}if(!r&&l&&lg(l)){const t=yield ug(l);yield Di(Fo.setState(t)),a(e.loginUrl)}else{const{tenantsState:e}=yield xi((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:dg(e)}))}yield Di(Fo.setSignUpState({loading:!1}))}function*IS(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield xi((e=>e.auth.signUpState));yield Di(Fo.resetSignUpState()),yield Di(Fo.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*PS(){yield Da(Fo.signUpUser,ES),yield Da(Fo.resetSignUpStateSoft,IS)}const LS={setVendorState:(e,{payload:t})=>U({},e,t)},OS={loadVendorPublicInfo:ut("vendor/loadVendorPublicInfo")},_S={loading:!1},{reducer:wS,actions:CS}=yt({name:Dt,initialState:_S,reducers:U({},LS)}),US=U({},CS,OS);function*RS(){yield Di(US.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Yf.vendor.getVendorPublicInfo();yield Di(US.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Di(US.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var DS=n(378),NS=n.n(DS);function MS(e,t){return NS()(e,t)}function*FS({payload:e}){const t=null==e?void 0:e.callback;try{const e=yield Fi(Yf.entitlements.loadEntitlements);yield function*(e){MS(yield xi((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*GS(){yield Da(Fo.loadEntitlements,FS)}const $S=["callback"],xS=["callback"],VS=["callback"],BS=["callback"],jS=["callback","events"],WS=["callback"],KS=["callback"],HS=["callback"],zS=["callback"],qS=["user"],YS=["callback"],JS=["callback"],QS=["callback"],XS=["callback"],ZS=["callback"],ev=["callback","deviceId"],tv=["callback"],nv=["callback"],ov=["callback","deviceId"],iv=["callback","deviceId"],av=["callback","deviceId"];function*rv(e){const t=yield xi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return MS(t,null==e?void 0:e.entitlements)?U({},e,{entitlements:t}):e}function*lv({user:e,tenants:t=[],activeTenant:n},o={}){const{tenantsState:i}=yield xi((e=>e.auth));yield Di(Fo.setState(U({user:e,tenantsState:U({},i,{tenants:t,activeTenant:n,loading:!1})},o)))}function*sv(){const e=Na.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:o=!1,allowedRedirectOrigins:i=[]}=yield xi((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:l,activateUrl:s}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;u||(yield Fi(mg),u=yield xi((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?ig(u):c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(y,{refresh:y.startsWith("http")})}function*cv(){let e;try{var t;const n=yield Fi(Yf.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*uv(){try{const{isActive:e}=yield Fi(Yf.auth.getSSOPublicConfiguration);yield Di(Fo.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*dv(e){var t;const{routes:n,loginState:o}=yield xi((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*yv(){const{hostedLoginBox:e}=yield xi((e=>e.auth));e?yield Fi(fv):yield Fi(gv)}function*fv(){const{user:e}=yield xi((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(Yf.auth.exchangeOAuthTokensV2,t),o=yield Fi(rv,n.user);yield Fi(lv,U({},n,{user:o}),{isAuthenticated:!0})}catch(e){Na.setAccessToken(null),Na.setUser(null),yield Di(Fo.setState({user:null,isAuthenticated:!1}))}}function*pv(){const{user:e}=yield xi((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(Yf.auth.exchangeOAuthTokensV2,t),o=yield Fi(rv,n.user);yield Fi(lv,U({},n,{user:o}),{isAuthenticated:!0})}catch(e){Na.setAccessToken(null),Na.setUser(null),yield Di(Fo.setState({user:null,isAuthenticated:!1}))}}function*gv(){try{const t=Na.onRedirectTo,{routes:n,loginState:o}=yield xi((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Fi(Yf.auth.refreshTokenV3);if(lg(i)){const e=yield ug(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 dv(i),l=yield Fi(rv,i);yield Fi(lv,{user:l,tenants:a,activeTenant:r},{loginState:U({},o,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield vv(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 xi((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Fi(Yf.auth.refreshTokenV3);if(lg(i)){const e=yield ug(i);yield Di(Fo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const l=yield Fi(rv,i);if(yield Fi(Uv))yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})),yield Fi(lv,{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 dv(i);yield Fi(lv,{user:l,tenants:a,activeTenant:r},{loginState:U({},o,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield vv(n)}}}catch(e){Na.setAccessToken(null),Na.setUser(null),yield Di(Fo.setState({user:void 0,isAuthenticated:!1}))}}function*vv(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=Na.onRedirectTo,{routes:i,loginState:a}=yield xi((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 sv())}function*hv({payload:{callback:e}}){try{const{ip:t}=yield Fi(Yf.metadata.getCurrentUserIpMetadata);yield Di(Fo.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*mv({payload:e}){const t=[];(yield Fi(hg))?yield Fi(yv):t.push(Fi(yv)),e&&(yield Di(Fo.setState({isLoading:!0})),yield Di(Fo.loadSocialLoginsConfigurationV2()),t.push(Fi(kS)),t.push(Fi(Jg)),t.push(Fi(uv)),t.push(Fi(RS)),t.push(Fi(cv)),t.push(Fi(mg))),yield Ni(t),yield Di(Fo.setState({isLoading:!1}))}function*Av({accessToken:e,user:t}){if(!e)return void(yield Di(Fo.setState({user:void 0,isAuthenticated:!1})));const n=Na.onRedirectTo,{routes:o}=yield xi((e=>e.auth));if(lg(t)){const e=yield ug(t);yield Di(Fo.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*bv({payload:e}){const t=[];yield Di(Fo.loadSocialLoginsConfigurationV2()),t.push(Fi(kS)),t.push(Fi(uv)),t.push(Fi(RS)),t.push(Fi(cv)),t.push(Fi(Av,e)),t.push(Fi(mg)),yield Ni(t)}const Tv=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*kv(){const e=yield Fi(Yf.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield Fi(lv,e,{isAuthenticated:!0,isLoading:!1})}function*Ev({payload:e}){const{disableSilentRefresh:t}=yield xi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield kv()}catch(t){yield Pv(e)}}function*Iv({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n}}){if(n){const{urlStrategy:e}=yield xi((e=>({urlStrategy:e.root.urlStrategy}))),t=Tv(e);if(yield Di(Fo.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:o}=yield xi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(o)throw new Error("silent refresh is disabled");yield kv()}catch(n){if(!t)return void(yield Di(Fo.setState({isLoading:!1})));yield Pv(e)}}function*Pv(e){const{routes:t,context:n,onRedirectTo:o,urlStrategy:i}=yield xi((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(Tv(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield Di(Fo.setState({isLoading:!0}));const a=pp(),r=pp(),l=yield Fi(fp,r);localStorage.setItem(wt,r);let s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`;yield Fi(mg);const c=yield xi((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=`${kr(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=ag(rg);f&&(d.tenantId=f),o(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*Lv({payload:e}){const t=localStorage.getItem(wt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:o}=yield xi((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let i=`${window.location.origin}${"path"===o?"":"#"}${n.hostedLoginRedirectUrl}`;yield Fi(mg);const a=yield xi((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(Yf.auth.exchangeOAuthTokensV2,r);yield Fi(lv,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield Di(Fo.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{yield sv()}}function*Ov(e){let{payload:{callback:t}}=e,n=Jo(e.payload,$S);try{yield Di(Fo.setLoginState({loading:!0}));const e=yield Fi(Yf.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:dg(e),loading:!1}))}}function*_v(e){let{payload:{callback:t}}=e,n=Jo(e.payload,xS);try{yield Di(Fo.setLoginState({loading:!0})),yield Fi(Yf.auth.verifyChangePhoneNumber,n),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:dg(e),loading:!1}))}}function*wv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,VS);try{yield Di(Fo.setLoginState({loading:!0}));const e=yield Fi(Yf.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:dg(e),loading:!1})),null==t||t(e)}}function*Cv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,BS);try{let e;yield Di(Fo.setLoginState({loading:!0})),function(e){return"email"in e}(n)&&(e=n.email);const o=yield Fi(Yf.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:dg(e),loading:!1})),null==t||t()}}function*Uv(){const{publicAuthStrategyPolicy:e}=yield xi((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===Dl.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(Yf.auth.getWebAuthnDevices);return yield Di(Fo.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*Rv(e){let{payload:{callback:t,events:n}}=e,o=Jo(e.payload,jS);try{yield Di(Fo.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield Fi(Yf.auth.passwordlessPostLoginV2,o),l=Na.onRedirectTo,{routes:s}=yield xi((e=>e.auth));if(lg(e)){const t=yield ug(e);yield Di(Fo.setState(t)),l(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield xi((e=>e.auth));if(e.emailVerified){var i;const t={email:e.email,origin:eg.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name};null==n||null==(i=n.userVerified)||i.call(n,t),fg(yg.USER_VERIFIED,t)}e.id&&localStorage.setItem("userId",e.id),yield Fi(lv,{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(Uv))?(yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})),l(s.loginUrl,{preserveQueryParams:!0})):(yield Di(Fo.setState({isAuthenticated:!0})),yield sv()):l(s.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield Di(Fo.setLoginState({error:dg(e,"Failed to authenticate")}))}finally{yield Di(Fo.setLoginState({loading:!1}))}}function*Dv({payload:e}){try{yield Di(Fo.setLoginState({loading:!0}));const{name:t}=yield Fi(Yf.auth.verifyInviteToken,e);yield Di(Fo.setLoginState({inviteTokenTenantName:t}))}catch(e){yield Di(Fo.setLoginState({inviteTokenError:dg(e,"We couldn't verify your invitation")}))}finally{yield Di(Fo.setLoginState({loading:!1}))}}function*Nv({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:o}}){yield Di(Fo.setLoginState({loading:!0}));try{const i=yield xi((({auth:{onRedirectTo:e}})=>e)),a=ag(rg),{address:r,idpType:l}=yield Fi(Yf.auth.preLoginV2,{email:e,tenantId:a});if(r){let e=r;if(l===Xf.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield xi((({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 Mv({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield Mv({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*Mv(e){let{callback:t}=e,n=Jo(e,WS);const o=yield xi((({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*Fv({payload:{callback:e}}){try{yield Di(Fo.setLoginState({loading:!0}));const{options:t}=yield Fi(Yf.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:dg(t)})),null==e||e(null)}finally{yield Di(Fo.setLoginState({loading:!1}))}}function*Gv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,KS);try{yield Di(Fo.setLoginState({loading:!0}));const e=It(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?Nl.Platform:Nl.CrossPlatform;yield Fi(Yf.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:dg(e)})),null==t||t(null)}finally{yield Di(Fo.setLoginState({loading:!1}))}}function*$v(e){let{payload:{callback:t}}=e,n=Jo(e.payload,HS);try{var o;yield Di(Fo.setPasskeysState({loading:!0})),yield Di(Fo.setLoginState({loading:!0}));const{options:e}=yield Fi(Yf.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:dg(e)})),null==t||t(null)}finally{yield Di(Fo.setPasskeysState({loading:!1})),yield Di(Fo.setLoginState({loading:!1}))}}function*xv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,zS);try{var o;yield Di(Fo.setPasskeysState({loading:!0})),yield Di(Fo.setLoginState({loading:!0}));const e=It(n.publicKey),i=yield Fi(Yf.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,qS);if(lg(a)){const e=Na.onRedirectTo,{routes:t}=yield xi((e=>e.auth)),n=yield ug(a);yield Di(Fo.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield Fi(lv,U({user:a},r),{isAuthenticated:!0}),yield Di(Fo.setLoginState({error:void 0})),yield sv(),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:dg(e)})),null==t||t(null)}finally{yield Di(Fo.setPasskeysState({loading:!1})),yield Di(Fo.setLoginState({loading:!1}))}}function*Vv({payload:e}){const{onRedirectTo:t,routes:n}=yield xi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Di(Fo.setLoginState({loading:!0}));try{const t=yield Fi(Yf.auth.postLogin,e);yield Di(Fo.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield sv()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Di(Fo.setLoginState({step:Pt.loginWithSSOFailed,loading:!1}))}}function*Bv({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(Yf.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:o}),s=Na.onRedirectTo,{routes:c}=yield xi((e=>e.auth));if(lg(a)){const e=yield ug(a);yield Di(Fo.setState(e)),s(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield xi((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield Fi(lv,{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(Uv))?(yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})),s(c.loginUrl,{preserveQueryParams:!0})):yield sv()))}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:dg(t),loading:!1}))}}function*jv({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(Yf.auth.loginWithMfaV2,{mfaToken:e,value:t,rememberDevice:n}),{loginState:l}=yield xi((e=>e.auth)),s=l.flow===Lt.Login?Pt.success:l.step,c=!!i.accessToken;yield Fi(lv,{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(Uv))?yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield sv()),null==o||o(!0)}catch(e){yield Di(Fo.setLoginState({error:dg(e),loading:!1})),null==o||o(!1,e)}}function*Wv({payload:e}){yield Di(Fo.setLoginState({loading:!0}));try{var t;yield Fi(Yf.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:dg(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Kv({payload:e}){const{hostedLoginBox:t}=yield xi((e=>e.auth));yield Di(Fo.setState({isLoading:!0}));try{t?yield Fi(Yf.auth.OAuthLogout):yield Fi(Yf.auth.logout)}catch{}yield Di(Fo.resetState()),yield Di(Fo.requestAuthorize(!0)),null==e||e()}function*Hv({payload:e}){var t;try{yield Fi(Yf.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*zv({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*qv({user:e,tenants:t,activeTenant:n}){const{loginState:o}=yield xi((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 xi((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(Uv);i===ln.smsVerifyCode&&e?yield Di(Fo.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield sv()}yield Di(Fo.setState({isAuthenticated:r}))}function*Yv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,YS);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(Yf.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:dg(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{const e=yield Fi(Yf.auth.enrollMFASMSForLoginV2,n);yield zv(e),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:dg(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{var o;const e=yield Fi(Yf.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:dg(e)})),null==t||t(null)}}function*Xv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,XS);yield Di(Fo.setLoginState({loading:!0}));try{const e=It(n.publicKey),o=yield Fi(Yf.auth.enrollMFAWebAuthnForLoginV2,U({},n,{options:e}));yield zv(o),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:dg(e)})),null==t||t(null)}}function*Zv(e){let{payload:{callback:t}}=e,n=Jo(e.payload,ZS);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(Yf.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield zv(e),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:dg(e)})),null==t||t(null)}}function*eh(e){let{payload:{callback:t,deviceId:n}}=e,o=Jo(e.payload,ev);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(Yf.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:dg(e)})),null==t||t(null)}}function*th(e){let{payload:{callback:t}}=e,n=Jo(e.payload,tv);try{const e=yield Fi(Yf.auth.preVerifyMFAEmailCode,n);yield Di(Fo.setMfaState({otcToken:e.otcToken,step:ln.emailVerifyCode})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({error:dg(e)})),null==t||t(null)}}function*nh(e){let{payload:{callback:t}}=e,n=Jo(e.payload,nv);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(Yf.auth.verifyMFAEmailCodeV2,n);yield qv(e),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:dg(e)})),null==t||t(null)}}function*oh(e){let{payload:{callback:t,deviceId:n}}=e,o=Jo(e.payload,ov);yield Di(Fo.setLoginState({loading:!0}));try{const e=yield Fi(Yf.auth.verifyMFASMSForLoginV2,n,o);yield qv(e),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:dg(e)})),null==t||t(null)}}function*ih(e){let{payload:{callback:t,deviceId:n}}=e,o=Jo(e.payload,iv);yield Di(Fo.setLoginState({loading:!0}));try{var i;const e=yield Fi(Yf.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:dg(e)})),null==t||t(null)}}function*ah(e){let{payload:{callback:t,deviceId:n}}=e,o=Jo(e.payload,av);yield Di(Fo.setLoginState({loading:!0}));try{const e=It(o.publicKey),i=yield Fi(Yf.auth.verifyMFAWebAuthnForLoginV2,n,U({},o,{options:e}));yield qv(i),yield Di(Fo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setLoginState({loading:!1,error:dg(e)})),null==t||t(null)}}function*rh({payload:e}){yield Di(Fo.setLoginState({loading:!0}));try{yield Fi(Yf.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:dg(e)}))}}function*lh(){yield Da(Fo.requestAuthorize,mv),yield Da(Fo.requestAuthorizeSSR,bv),yield Da(Fo.requestHostedLoginAuthorize,Ev),yield Da(Fo.requestHostedLoginAuthorizeV2,Iv),yield Da(Fo.handleHostedLoginCallback,Lv),yield Da(Fo.preLogin,Nv),yield Da(Fo.postLogin,Vv),yield Da(Fo.login,Bv),yield Da(Fo.logout,Kv),yield Da(Fo.silentLogout,Hv),yield Da(Fo.loginWithMfa,jv),yield Da(Fo.recoverMfa,Wv),yield Da(Fo.quickSmsPasswordlessPreLogin,wv),yield Da(Fo.changePhoneNumberWithVerification,Ov),yield Da(Fo.verifyChangePhoneNumber,_v),yield Da(Fo.passwordlessPreLogin,Cv),yield Da(Fo.passwordlessPostLogin,Rv),yield Da(Fo.verifyInviteToken,Dv),yield Da(Fo.webAuthnPrelogin,$v),yield Da(Fo.webAuthnPostLogin,xv),yield Da(Fo.webAuthnCreateNewDeviceSession,Fv),yield Da(Fo.webAuthnVerifyNewDeviceSession,Gv),yield Da(Fo.afterAuthNavigation,sv),yield Da(Fo.getUserIP,hv),yield Da(Fo.preEnrollMFASMSForLogin,Yv),yield Da(Fo.enrollMFASMSForLogin,Jv),yield Da(Fo.preEnrollMFAWebAuthnForLogin,Qv),yield Da(Fo.enrollMFAWebAuthnForLogin,Xv),yield Da(Fo.enrollMFAAuthenticatorAppForLogin,Zv),yield Da(Fo.preVerifyMFASMSForLogin,eh),yield Da(Fo.verifyMFASMSForLogin,oh),yield Da(Fo.preVerifyMFAWebAuthnForLogin,ih),yield Da(Fo.verifyMFAWebAuthnForLogin,ah),yield Da(Fo.preVerifyMFAEmailCode,th),yield Da(Fo.verifyMFAEmailCode,nh),yield Da(Fo.resetBreachedPassword,rh)}function*sh({payload:e}){e&&(yield Di(Fo.setState({isLoading:!0})));const t=bp;yield Di(Fo.loadTenants()),yield Di(Fo.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*ch({payload:{callback:e}}){try{const{ip:t}=Kp[0];yield Di(Fo.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*uh(){yield Da(Fo.requestAuthorize,sh),yield Da(Fo.afterAuthNavigation,sv),yield Da(Fo.getUserIP,ch)}const dh=["callback","samlVendor"],yh=["callback","samlVendor"];function*fh(){try{var e,t;yield Di(Fo.setSSOState({loading:!0}));const n=yield Fi(Yf.auth.getSamlConfiguration),o=yield Fi(Yf.auth.getOidcConfiguration),i=yield Fi(Yf.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:dg(e),loading:!1}))}}function*ph({payload:e}){const t=yield xi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield Di(Fo.setSSOState({error:void 0,[n]:!0}));try{const o=yield gp(e[0]),i=yield Fi(Yf.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:dg(e),[n]:!1}))}}function*gh({payload:e}){const{configFile:t,callback:n}=e,o=yield xi((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield Di(Fo.setSSOState({error:void 0,[i]:!0}));try{const e=yield gp(t),a=yield Fi(Yf.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:dg(e),[i]:!1})),null==n||n(null,e)}}function*Sh({payload:e}){const{callback:t,samlVendor:n}=e,o=Jo(e,dh),i=yield xi((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===Xf.Saml){var l,s;const e=yield Fi(Yf.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=yp(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(Yf.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:dg(e),[r]:!1})),null==t||t(null,e)}}function*vh({payload:{callback:e}={}}){const t=yield xi((e=>e.auth.ssoState.samlConfiguration));try{yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield Fi(Yf.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:dg(n),saving:!1})),null==e||e(null,n)}}function*hh(){try{const e=yield Fi(Yf.auth.getSamlRoles),t=yield Fi(Yf.auth.getSamlRolesGroups);yield Di(Fo.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Di(Fo.setSSOState({error:dg(e)}))}}function*mh({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield Fi(Yf.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Ni(e.map((e=>Fi(Yf.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Di(Fo.setSSOState({error:dg(e)}))}}(n)),yield hh(),yield Di(Fo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Di(Fo.setSSOState({error:dg(t),saving:!1})),null==e||e(null,t)}}function*Ah({payload:{callback:e,id:t}}){try{yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield Fi(Yf.auth.deleteSamlGroup,{id:t}),yield hh(),yield Di(Fo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Di(Fo.setSSOState({error:dg(t),saving:!1})),null==e||e(null,t)}}function*bh({payload:{group:e,roleIds:t,callback:n}}){try{yield Di(Fo.setSSOState({error:void 0,saving:!0})),yield Fi(Yf.auth.createSamlGroup,{group:e,roleIds:t}),yield hh(),yield Di(Fo.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield Di(Fo.setSSOState({error:dg(e),saving:!1})),null==n||n(null,e)}}function*Th({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Di(Fo.setSSOState({loading:!0})),yield Fi(Yf.auth.oidcPostLoginV2,t),yield Fi(yv),yield Di(Fo.setSSOState({loading:!1}))}catch(e){yield Di(Fo.setSSOState({loading:!1,error:dg(e,"Failed to authenticate"),firstLoad:!1}))}}function*kh(){yield Ua(Fo.loadSSOConfigurations,fh),yield Ua(Fo.saveSSOConfigurations,Sh),yield Ua(Fo.saveSSOConfigurationsFile,ph),yield Ua(Fo.saveSSOConfigurationsFileWithCallback,gh),yield Ua(Fo.validateSSODomain,vh),yield Ua(Fo.loadSSOAuthorizationRoles,hh),yield Ua(Fo.updateSSOAuthorizationRoles,mh),yield Ua(Fo.deleteSamlGroup,Ah),yield Ua(Fo.createSamlGroup,bh),yield Ua(Fo.oidcPostlogin,Th)}function*Eh(){yield Di(Fo.setSSOState({loading:!0})),yield bt(),yield Di(Fo.setSSOState({samlConfiguration:Op,loading:!1,firstLoad:!1}))}function*Ih({payload:e}){const t="saving";yield Di(Fo.setSSOState({error:void 0,[t]:!0}));const n=U({},yield xi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield Di(Fo.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Ph({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Jo(e,yh),r=Cp.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==_p||null==(t=_p.configuration)?void 0:t.acsUrl,l.spEntityId=null==_p||null==(n=_p.configuration)?void 0:n.spEntityId;const c=yp(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*Lh({payload:{callback:e}={}}){const t=Cp.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*Oh(){yield bt(),yield Di(Fo.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*_h({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*wh(){yield Ua(Fo.loadSSOConfigurations,Eh),yield Ua(Fo.saveSSOConfigurations,Ph),yield Ua(Fo.saveSSOConfigurationsFile,Ih),yield Ua(Fo.validateSSODomain,Lh),yield Ua(Fo.loadSSOAuthorizationRoles,Oh),yield Ua(Fo.updateSSOAuthorizationRoles,_h)}const Ch=["callback"],Uh=["callback","ssoConfigId"],Rh=["callback","ssoConfigId"],Dh=["callback","ssoConfigId"];function*Nh(){try{return yield Fi(Yf.auth.getOidcConfiguration)}catch(e){return null}}function*Mh(){try{return yield Fi(Yf.metadata.getSamlMetadata)}catch(e){return null}}function*Fh(){try{yield Di(Fo.setSSOLoader({key:Qf.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Ni([Fi(Nh),Fi(Mh)]),n=yield Fi(Yf.auth.getSSOConfigurations);yield Di(Fo.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Di(Fo.setSSOError({key:Qf.LOAD_SSO_CONFIGURATIONS,value:dg(e)}))}finally{yield Di(Fo.setSSOLoader({key:Qf.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Gh({payload:e}){yield Di(Fo.setSSOLoader({key:Qf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Jo(e,Ch),o=yield xi((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield Fi(Yf.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:Qf.SAVE_SSO_CONFIGURATION,value:dg(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:Qf.SAVE_SSO_CONFIGURATION,value:!1}))}}function*$h({payload:e}){yield Di(Fo.setSSOLoader({key:Qf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,o=yield xi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield gp(t),i=yield Fi(Yf.auth.createSSOConfigurationByMetadata,{metadata:e});yield Di(Fo.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield Di(Fo.setSSOError({key:Qf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:dg(e)})),null==n||n(null,e)}finally{yield Di(Fo.setSSOLoader({key:Qf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*xh({payload:e}){yield Di(Fo.setSSOLoader({key:Qf.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Jo(e,Uh),i=yield xi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Fi(Yf.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:Qf.UPDATE_SSO_CONFIGURATION,value:dg(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:Qf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Vh({payload:e}){yield Di(Fo.setSSOLoader({key:Qf.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:o}=e,i=yield xi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield gp(o),a=yield Fi(Yf.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:Qf.UPDATE_SSO_CONFIGURATION,value:dg(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:Qf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Bh({payload:e}){yield Di(Fo.setSSOLoader({key:Qf.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield xi((e=>e.auth.ssoState.ssoConfigurations));try{yield Fi(Yf.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:Qf.DELETE_SSO_CONFIGURATION,value:dg(e)})),null==n||n(null,e)}finally{yield Di(Fo.setSSOLoader({key:Qf.DELETE_SSO_CONFIGURATION,value:!1}))}}function*jh({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Jo(e,Rh);yield Di(Fo.setSSOLoader({key:Qf.SAVE_SSO_DOMAIN,value:!0}));const i=yield xi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Fi(Yf.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:Qf.SAVE_SSO_DOMAIN,value:dg(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:Qf.SAVE_SSO_DOMAIN,value:!1}))}}function*Wh({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield Di(Fo.setSSOLoader({key:Qf.DELETE_SSO_DOMAIN,value:!0}));const i=yield xi((e=>e.auth.ssoState.ssoConfigurations));try{yield Fi(Yf.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:Qf.DELETE_SSO_DOMAIN,value:dg(e)})),null==o||o(null,e)}finally{yield Di(Fo.setSSOLoader({key:Qf.DELETE_SSO_DOMAIN,value:!1}))}}function*Kh({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield Di(Fo.setSSOLoader({key:Qf.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield xi((e=>e.auth.ssoState.ssoConfigurations));try{yield Fi(Yf.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:Qf.VALIDATE_SSO_DOMAIN,value:dg(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSSOLoader({key:Qf.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Hh({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Di(Fo.setSSOLoader({key:Qf.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield xi((e=>e.auth.ssoState.ssoConfigurations));try{yield Fi(Yf.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:Qf.UPDATE_SSO_DEFAULT_ROLES,value:dg(t)})),null==e||e(null,t)}finally{yield Di(Fo.setSSOLoader({key:Qf.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*zh({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield Di(Fo.setSSOLoader({key:Qf.SAVE_SSO_GROUPS,value:!0}));const i=yield xi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ni(t.map((e=>Fi(Yf.auth.deleteSSOGroup,n,e)))),yield Ni(e.map((e=>Fi(Yf.auth.createSSOGroup,n,e))));const a=yield Fi(Yf.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:Qf.SAVE_SSO_GROUPS,value:dg(e)})),null==o||o(null,e)}finally{yield Di(Fo.setSSOLoader({key:Qf.SAVE_SSO_GROUPS,value:!1}))}}function*qh({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Ni(t.map((t=>Fi(Yf.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Di(Fo.setSSOError({key:Qf.SAVE_SSO_GROUPS,value:dg(e)})),null==n||n(null,e)}finally{yield Di(Fo.setSSOLoader({key:Qf.SAVE_SSO_GROUPS,value:!1}))}}function*Yh({payload:e}){yield Di(Fo.setSSOLoader({key:Qf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:o,callback:i}=e,a=yield xi((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,l;o?(r=yield Fi(Yf.auth.updateSSOConfigurationByMetadataUrl,o,e),l=a.map((e=>e.id===o?r:e))):(r=yield Fi(Yf.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:Qf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Jh({payload:e}){yield Di(Fo.setSSOLoader({key:Qf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Jo(e,Dh),i=yield xi((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Fi(Yf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t))):(e=yield Fi(Yf.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:Qf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Qh(){yield Ua(Fo.loadSSOConfigurationsV2,Fh),yield Ua(Fo.saveSSOConfigurationV2,Gh),yield Ua(Fo.saveSSODomain,jh),yield Ua(Fo.deleteSSODomain,Wh),yield Ua(Fo.validateSSODomainV2,Kh),yield Ua(Fo.updateSSOConfiguration,xh),yield Ua(Fo.deleteSSOConfiguration,Bh),yield Ua(Fo.setSSOGroups,zh),yield Ua(Fo.updateSSOGroups,qh),yield Ua(Fo.setSSODefaultRoles,Hh),yield Ua(Fo.saveSSOConfigurationByMetadata,$h),yield Ua(Fo.updateSSOConfigurationByMetadata,Vh),yield Ua(Fo.saveSSOConfigurationByUrl,Yh),yield Ua(Fo.saveSSOConfigurationByData,Jh)}const Xh=["callback","profilePictureUrl"],Zh=["callback","profilePictureUrl"];function*em(){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,Yf.teams.getProfile),t=yield xi((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:dg(e)}))}}function*tm(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Jo(e.payload,Xh);yield Di(Fo.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield xi((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(Yf.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(Yf.users.updateUserProfileV2,a),l=yield xi((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:dg(e),loading:!1})),null==t||t(null,e)}}function*nm({payload:e}){yield Di(Fo.setProfileState({loading:!0}));try{var t;yield Fi(Yf.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:dg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*om(){yield Da(Fo.loadProfile,em),yield Ua(Fo.saveProfile,tm),yield Ua(Fo.changePassword,nm)}function*im(){yield Di(Fo.setProfileState({loading:!0})),yield bt(),yield Di(Fo.setUser(U({},bp,Ap))),yield Di(Fo.setProfileState({loading:!1,profile:Ap}))}function*am(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Jo(e.payload,Zh);yield Di(Fo.setProfileState({saving:!0,error:null}));const i=Tp;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=bp;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*rm({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*lm(){yield Da(Fo.loadProfile,im),yield Ua(Fo.saveProfile,am),yield Ua(Fo.changePassword,rm)}const sm=["callback"],cm=["callback"],um=["user"],dm=["callback"],ym=["deviceId","callback"],fm=["deviceId","callback"],pm=["callback"],gm=["deviceId"],Sm=["deviceId"],vm=["callback"],hm=["deviceId"],mm=["callback"];function*Am(e){const{step:t}=yield xi((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*bm(){yield Di(Fo.setMfaState({saving:!0}));try{const{qrCode:e}=yield Fi(Yf.auth.enrollMfa);yield Di(Fo.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield Di(Fo.setMfaState({saving:!1,error:dg(e)}))}}function*Tm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,sm);yield Di(Fo.setMfaState({saving:!0}));try{const e=yield xi((e=>e.auth.user)),o=yield Fi(Yf.auth.verifyMfa,n),i=yield Fi(Yf.auth.getMFADevices),a=yield Am(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:dg(e)})),null==t||t(null,e)}}function*km(e){let{payload:{callback:t}}=e,n=Jo(e.payload,cm);yield Di(Fo.setMfaState({loading:!0}));try{const e=yield Fi(Yf.auth.loginWithMfaV2,n),{user:o}=e,i=Jo(e,um),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 lv(U({user:o},i)),null==t||t(a.recoveryCode)}catch(e){yield Di(Fo.setMfaState({loading:!1,error:dg(e)})),null==t||t(null,e)}}function*Em({payload:e}){yield Di(Fo.setMfaState({saving:!0}));try{var t;yield Fi(Yf.auth.disableMfa,e);const n=yield Fi(Yf.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:dg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Im({payload:e}){yield Di(Fo.setMfaState({saving:!0}));try{var t,n;const o=yield Fi(Yf.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:dg(t)})),null==(o=e.callback)||o.call(e,null,t)}}function*Pm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,dm);yield Di(Fo.setMfaState({saving:!0}));try{const e=It(n.publicKey),o=yield Fi(Yf.auth.enrollMFAWebAuthn,U({},n,{options:e})),i=yield Fi(Yf.auth.getMFADevices),a=yield Am(o);yield Di(Fo.setMfaState(U({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield Di(Fo.setMfaState({saving:!1,error:dg(e)})),null==t||t(null,e)}}function*Lm(e){let{payload:{deviceId:t,callback:n}}=e;Jo(e.payload,ym),yield Di(Fo.setMfaState({saving:!0}));try{var o;const e=yield Fi(Yf.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:dg(e)})),null==n||n(null,e)}}function*Om(e){let{payload:{deviceId:t,callback:n}}=e,o=Jo(e.payload,fm);yield Di(Fo.setMfaState({saving:!0}));try{const e=It(o.publicKey);yield Fi(Yf.auth.disableMFAWebAuthn,t,U({},o,{options:e}));const i=yield Fi(Yf.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:dg(e)})),null==n||n(!1,e)}}function*_m({payload:e}){yield Di(Fo.setMfaState({saving:!0}));try{var t;const n=yield Fi(Yf.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:dg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*wm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,pm);yield Di(Fo.setMfaState({saving:!0}));try{const e=yield Fi(Yf.auth.enrollMFASMS,n),o=yield Fi(Yf.auth.getMFADevices),i=yield Am(e);yield Di(Fo.setMfaState(U({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield Di(Fo.setMfaState({saving:!1,error:dg(e)})),null==t||t(null,e)}}function*Cm(e){let{payload:{deviceId:t}}=e,n=Jo(e.payload,gm);yield Di(Fo.setMfaState({saving:!0}));try{var o;const e=yield Fi(Yf.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:dg(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Um(e){let{payload:{deviceId:t}}=e,n=Jo(e.payload,Sm);yield Di(Fo.setMfaState({saving:!0}));try{var o;yield Fi(Yf.auth.disableMFASMS,t,n);const e=yield Fi(Yf.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:dg(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Rm(){yield Di(Fo.setMfaState({loading:!0}));try{yield xi((e=>e.auth.user));const e=yield Fi(Yf.auth.getMFADevices);yield Di(Fo.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield Di(Fo.setMfaState({loading:!1,error:dg(e)}))}}function*Dm(){yield Di(Fo.setMfaState({loading:!0}));try{const e=(yield Fi(Yf.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:dg(e)}))}}function*Nm(){yield Ua(Fo.enrollMfa,bm),yield Ua(Fo.getMFADevices,Rm),yield Ua(Fo.getMFAStrategies,Dm),yield Ua(Fo.verifyMfa,Tm),yield Ua(Fo.disableMfa,Em),yield Ua(Fo.verifyMfaAfterForce,km),yield Ua(Fo.preDisableMfaSms,Cm),yield Ua(Fo.disableMfaSms,Um),yield Ua(Fo.preEnrollMfaSms,_m),yield Ua(Fo.enrollMfaSms,wm),yield Ua(Fo.preEnrollMfaWebAuthn,Im),yield Ua(Fo.enrollMfaWebAuthn,Pm),yield Ua(Fo.preDisableMfaWebAuthn,Lm),yield Ua(Fo.disableMfaWebAuthn,Om)}function*Mm(){yield Di(Fo.setMfaState({saving:!0})),yield Di(Fo.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*Fm({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield xi((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({},bp,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*Gm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,vm);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({},bp,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*$m({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield xi((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({},bp))),null==(t=e.callback)||t.call(e,!0)}function*xm(e){let{}=e,t=Jo(e.payload,hm);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:dg(e)})),null==(o=t.callback)||o.call(t,!1,e)}}function*Vm({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield xi((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({},bp))),null==(t=e.callback)||t.call(e,!0)}function*Bm({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*jm(e){let{payload:{callback:t}}=e;Jo(e.payload,mm);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield xi((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({},bp,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Wm(){yield Ua(Fo.enrollMfa,Mm),yield Ua(Fo.verifyMfa,Fm),yield Ua(Fo.disableMfa,$m),yield Ua(Fo.verifyMfaAfterForce,Gm),yield Ua(Fo.preDisableMfaSms,xm),yield Ua(Fo.disableMfaSms,Vm),yield Ua(Fo.preEnrollMfaSms,Bm),yield Ua(Fo.enrollMfaSms,jm)}const Km=["callback"];function*Hm({payload:e}){yield Di(Fo.setForgotPasswordState({loading:!0}));try{var t;yield Fi(Yf.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:dg(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*zm(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Km);yield Di(Fo.setForgotPasswordState({loading:!0}));try{yield Fi(Yf.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:dg(e)})),null==t||t(!1,e)}}function*qm({payload:e}){yield Di(Fo.setForgotPasswordState({loading:!0}));try{const t=yield Fi(Yf.auth.loadPasswordConfig,e);yield Di(Fo.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Di(Fo.setForgotPasswordState({loading:!1,error:dg(e)}))}}function*Ym(){yield Da(Fo.forgotPassword,Hm),yield Da(Fo.resetPassword,zm),yield Da(Fo.loadPasswordConfig,qm)}let Jm;!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"}(Jm||(Jm={}));const Qm=["callback","events"],Xm=["user"],Zm=["callback"],eA=["callback"];function*tA({payload:{userId:e,token:t}}){yield Di(Fo.setActivateState({loading:!0,step:Gt.activating}));try{const{isAuthenticated:n}=yield xi((e=>e.auth));n&&(yield Di(Fo.silentLogout()));const o=yield Fi(Yf.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:dg(e)}))}}function*nA(e){let{payload:{callback:t,events:n}}=e,o=Jo(e.payload,Qm);yield Di(Fo.setActivateState({loading:!0}));try{const e=Na.onRedirectTo,{routes:a}=yield xi((e=>e.auth)),r=yield Fi(Yf.auth.activateAccountV2,o),{user:l}=r,s=Jo(r,Xm);if(l.redirectLocation)return void(window.location.href=l.redirectLocation);if(lg(l)){yield Di(Fo.setActivateState({step:Gt.success}));const t=yield ug(l);yield Di(Fo.setState(t)),yield Vi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var i;yield Di(Fo.setActivateState({step:Gt.success}));const e={email:l.email,origin:eg.ACTIVATION_LINK,id:l.id,tenantId:l.tenantId,name:l.name,createdAt:new Date};null==n||null==(i=n.userVerified)||i.call(n,e),fg(yg.USER_VERIFIED,e),yield Fi(lv,U({user:l},s),{isAuthenticated:!0}),yield Vi(1e3),yield sv(),yield Di(Fo.resetActivateState())}null==t||t(!0)}catch(e){yield Di(Fo.setActivateState({loading:!1,error:dg(e)}))}}function*oA({payload:e}){const{callback:t}=e,n=Jo(e,Zm);yield Di(Fo.setActivateStrategyState({loading:!0}));try{const e=yield Fi(Yf.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:dg(e)}))}}function*iA({payload:e}){const{callback:t}=e,n=Jo(e,eA);yield Di(Fo.setTeamLoader({key:Jm.RESEND_ACTIVATE_LINK,value:n.email})),yield Di(Fo.setActivateState({loading:!0}));try{yield Fi(Yf.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:dg(e)})),yield Di(Fo.setTeamError({key:Jm.RESEND_ACTIVATE_LINK,value:dg(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Jm.RESEND_ACTIVATE_LINK,value:!1}))}function*aA(){yield Da(Fo.activateAccount,nA),yield Da(Fo.preActivateAccount,tA),yield Da(Fo.getActivateAccountStrategy,oA),yield Da(Fo.resendActivationEmail,iA)}function*rA({payload:e}){if(e.token&&e.userId)try{yield Di(Fo.setAcceptInvitationState({error:void 0,step:Bt.pending})),yield Fi(Yf.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:dg(e)}))}else yield Di(Fo.setAcceptInvitationState({error:void 0,step:Bt.invalid}))}function*lA(){yield Da(Fo.acceptInvitation,rA)}var sA,cA=new Uint8Array(16);function uA(){if(!sA&&!(sA="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 sA(cA)}for(var dA=/^(?:[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,yA=function(e){return"string"==typeof e&&dA.test(e)},fA=[],pA=0;pA<256;++pA)fA.push((pA+256).toString(16).substr(1));var gA=function(e,t,n){var o=(e=e||{}).random||(e.rng||uA)();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=(fA[e[t+0]]+fA[e[t+1]]+fA[e[t+2]]+fA[e[t+3]]+"-"+fA[e[t+4]]+fA[e[t+5]]+"-"+fA[e[t+6]]+fA[e[t+7]]+"-"+fA[e[t+8]]+fA[e[t+9]]+"-"+fA[e[t+10]]+fA[e[t+11]]+fA[e[t+12]]+fA[e[t+13]]+fA[e[t+14]]+fA[e[t+15]]).toLowerCase();if(!yA(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let SA,vA;!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"}(vA||(vA={}));const hA=["callback"],mA=["roles"],AA=["callback"],bA=["callback","profileImage"],TA=["callback"],kA=["callback","userId"],EA=["callback"],IA=["callback"],PA=["callback"],LA=["callback"],OA=["callback"],_A=["callback"],wA=["callback"],CA=["callback","profileImage"],UA=["callback"],RA=["callback"],DA=["callback"],NA=["callback"],MA=["callback"],FA=["callback"],GA=()=>xi((e=>e.auth.teamState));function*$A(){try{const{groups:e}=yield Fi(Yf.groups.getGroups,{_groupsRelations:vA.roles});return e}catch(e){return[]}}function*xA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield GA(),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:Jm.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(Yf.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(Yf.teams.loadAvailableRoles),Fi(Yf.teams.loadAvailablePermissions),Fi($A)]),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:Jm.USERS,value:dg(e)})),yield Di(Fo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Di(Fo.setTeamLoader({key:Jm.USERS,value:!1}))}function*VA({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield GA(),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:Jm.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(Yf.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Fi(Yf.teams.loadAvailableRoles),Fi(Yf.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:Jm.USERS,value:e.message})),yield Di(Fo.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Di(Fo.setTeamLoader({key:Jm.USERS,value:!1}))}function*BA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield GA(),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:Jm.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(Yf.subTenants.loadAllUsers,U({},c)),Fi(Yf.teams.loadAvailableRoles),Fi(Yf.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:Jm.USERS,value:dg(e)})),yield Di(Fo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Di(Fo.setTeamLoader({key:Jm.USERS,value:!1}))}function*jA({payload:e}){yield Di(Fo.setTeamLoader({key:Jm.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield Ni([Fi(Yf.teams.loadAvailableRoles),Fi(Yf.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:Jm.ROLES_AND_PERMISSIONS,value:dg(t)}))}yield Di(Fo.setTeamLoader({key:Jm.ROLES_AND_PERMISSIONS,value:!0}))}function*WA({payload:e}){const{callback:t}=e,n=Jo(e,hA),o=yield GA();yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield Fi(Yf.teams.addUser,n),{roles:a}=e,r=U({},Jo(e,mA),{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:dg(e)})})),null==t||t(null,e)}}function*KA({payload:e}){const{callback:t}=e,n=yield GA();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(Yf.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*HA({payload:e}){const{callback:t}=e,n=Jo(e,AA),o=yield GA();yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{yield Fi(Yf.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield Fi(Yf.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:dg(e)})})),null==t||t(null,e)}}function*zA({payload:e}){const{callback:t}=e,n=Jo(e,bA),{id:o}=n,i=yield GA(),a=i.users.find((e=>e.id===n.id));yield Di(Fo.setTeamLoader({key:Jm.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(Yf.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:Jm.UPDATE_USER,value:!1}))}catch(e){yield Di(Fo.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:dg(e)}),users:i.users.map((e=>e.id===n.id?U({},e,a):e))})),yield Di(Fo.setTeamLoader({key:Jm.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*qA({payload:e}){const{callback:t}=e,n=Jo(e,TA),o=yield GA();yield Di(Fo.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Fi(Yf.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:dg(e)})})),null==t||t(null,e)}}function*YA({payload:e}){const{callback:t,userId:n}=e,o=Jo(e,kA),i=yield GA();yield Di(Fo.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})}));try{yield Fi(Yf.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:dg(e)})})),null==t||t(null,e)}}function*JA({payload:e}){const{callback:t}=e,n=Jo(e,EA),o=yield GA();yield Di(Fo.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Fi(Yf.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:dg(e)})})),null==t||t(null,e)}}function*QA({payload:e}){const{callback:t}=e,n=Jo(e,IA);yield Di(Fo.setTeamLoader({key:Jm.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Fi(Yf.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Jm.RESEND_ACTIVATE_LINK,value:dg(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Jm.RESEND_ACTIVATE_LINK,value:!1}))}function*XA({payload:e}){const{callback:t}=e,n=Jo(e,PA);yield Di(Fo.setTeamLoader({key:Jm.RESEND_INVITATION_LINK,value:n.email}));try{yield Fi(Yf.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Jm.RESEND_INVITATION_LINK,value:dg(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Jm.RESEND_INVITATION_LINK,value:!1}))}function*ZA({payload:e}){const{callback:t}=e,n=Jo(e,LA);yield Di(Fo.setTeamLoader({key:Jm.RESEND_INVITATION_LINK,value:n.email}));try{yield Fi(Yf.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Jm.RESEND_INVITATION_LINK,value:dg(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Jm.RESEND_INVITATION_LINK,value:!1}))}function*eb({payload:e}){const{callback:t}=e,n=Jo(e,OA);yield Di(Fo.setTeamLoader({key:Jm.RESEND_INVITATION_LINK,value:n.email}));try{yield Fi(Yf.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Jm.RESEND_INVITATION_LINK,value:dg(e)})),null==t||t(null,e)}yield Di(Fo.setTeamLoader({key:Jm.RESEND_INVITATION_LINK,value:!1}))}function*tb(){yield Di(Fo.setTeamError({key:Jm.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Fi(Yf.teams.getInviteLinkConfiguration);yield Di(Fo.setTeamState({inviteTokenState:U({},e)}))}catch(e){yield Di(Fo.setTeamError({key:Jm.CONFIG_TOKEN_LINK,value:dg(e)}))}}function*nb(){yield Di(Fo.setTeamError({key:Jm.GET_TOKEN_LINK,value:!1}));try{yield Fi(tb);const e=yield Fi(Yf.teams.getInviteUserLink),{inviteTokenState:t}=yield GA();yield Di(Fo.setTeamState({inviteTokenState:U({},t,e)}))}catch(e){yield Di(Fo.setTeamError({key:Jm.GET_TOKEN_LINK,value:dg(e)}))}}function*ob({payload:{callback:e}}){yield Di(Fo.setTeamError({key:Jm.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield GA();try{const n=yield Fi(Yf.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:Jm.CREATE_TOKEN_LINK,value:dg(t)}))}}function*ib({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield GA();yield Di(Fo.setTeamError({key:Jm.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield Fi(Yf.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:Jm.UPDATE_TOKEN_LINK,value:dg(t)}))}}function*ab({payload:e}){const{callback:t}=null!=e?e:{};yield Di(Fo.setTeamError({key:Jm.DELETE_TOKEN_LINK,value:!1}));try{yield Fi(Yf.teams.deleteInviteUserLink),yield Di(Fo.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Di(Fo.setTeamError({key:Jm.DELETE_TOKEN_LINK,value:dg(e)})),null==t||t(!1,e)}}function*rb({payload:e}){yield Di(Fo.setTeamState({addUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*lb({payload:e}){const t=yield GA(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Di(Fo.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*sb({payload:e}){yield Di(Fo.setTeamState({deleteUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*cb({payload:e}){const t=yield GA(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Di(Fo.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*ub(){yield Ra(Fo.loadUsers,VA),yield Ra(Fo.loadUsersV2,xA),yield Ra(Fo.loadAllSubTenantsUsers,BA),yield Ra(Fo.loadRoles,jA),yield Ua(Fo.addUser,WA),yield Ua(Fo.addUsersBulk,KA),yield Ua(Fo.addUserToSubTenants,HA),yield Ua(Fo.updateUser,zA),yield Ua(Fo.setUserRolesForSubTenants,YA),yield Ua(Fo.deleteUser,qA),yield Ua(Fo.deleteUserFromSubTenants,JA),yield Ua(Fo.resendActivationLink,QA),yield Ua(Fo.resendInvitationLink,XA),yield Ua(Fo.resendInvitationEmail,ZA),yield Ua(Fo.resendInvitationLinkToAllSubTenants,eb),yield Ua(Fo.getInvitationLink,nb),yield Ua(Fo.createInvitationLink,ob),yield Ua(Fo.updateInvitationLink,ib),yield Ua(Fo.deleteInvitationLink,ab),yield Ua(Fo.openAddUserDialog,rb),yield Ua(Fo.closeAddUserDialog,lb),yield Ua(Fo.openDeleteUserDialog,sb),yield Ua(Fo.closeDeleteUserDialog,cb)}function*db({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield GA(),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:Jm.USERS,value:!a})),yield Di(Fo.setTeamState({pageSize:s,pageOffset:c,filterV2:u,sortV2:d})),yield bt(),yield Di(Fo.setTeamState({users:Gp,totalPages:2,totalItems:10,roles:wp,permissions:Up})),yield Di(Fo.setTeamLoader({key:Jm.USERS,value:!1})),null==r||r(Gp)}function*yb({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield GA(),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:Jm.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:xp,totalPages:2,totalItems:10,roles:wp,permissions:Up})),yield Di(Fo.setTeamLoader({key:Jm.USERS,value:!1})),null==l||l(xp)}function*fb({payload:e}){var t;yield Di(Fo.setTeamLoader({key:Jm.ROLES_AND_PERMISSIONS,value:!0})),yield bt(),yield Di(Fo.setTeamState({roles:wp,permissions:Up})),yield Di(Fo.setTeamLoader({key:Jm.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:wp,permissions:Up})}function*pb({payload:e}){const{callback:t}=e,n=Jo(e,_A),o=yield GA();yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield bt();const i=U({},Np,{groups:[]},n,{id:`${gA()}`});null==t||t(i),yield Di(Fo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*gb({payload:e}){const{callback:t}=e,n=Jo(e,wA),o=yield GA();yield Di(Fo.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield bt();const i=U({},Np,n,{id:`${gA()}`});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,CA),{id:i}=o,a=yield GA(),r=a.users.find((e=>e.id===o.id));yield Di(Fo.setTeamLoader({key:Jm.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:Jm.UPDATE_USER,value:!1}))}function*vb({payload:e}){const{callback:t}=e,n=Jo(e,UA),o=yield GA();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*hb({payload:e}){const{callback:t}=e,n=Jo(e,RA),o=yield GA();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*mb({payload:e}){const{callback:t}=e,n=Jo(e,DA);yield Di(Fo.setTeamLoader({key:Jm.RESEND_ACTIVATE_LINK,value:n.userId})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamLoader({key:Jm.RESEND_ACTIVATE_LINK,value:!1}))}function*Ab({payload:e}){const{callback:t}=e,n=Jo(e,NA);yield Di(Fo.setTeamLoader({key:Jm.RESEND_INVITATION_LINK,value:n.email})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamLoader({key:Jm.RESEND_INVITATION_LINK,value:!1}))}function*bb({payload:e}){const{callback:t}=e,n=Jo(e,MA);yield Di(Fo.setTeamLoader({key:Jm.RESEND_INVITATION_LINK,value:n.email})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamLoader({key:Jm.RESEND_INVITATION_LINK,value:!1}))}function*Tb({payload:e}){const{callback:t}=e,n=Jo(e,FA);yield Di(Fo.setTeamLoader({key:Jm.RESEND_INVITATION_LINK,value:n.email})),yield bt(),null==t||t(!0),yield Di(Fo.setTeamLoader({key:Jm.RESEND_INVITATION_LINK,value:!1}))}function*kb(){yield Ra(Fo.loadUsersV2,db),yield Ra(Fo.loadAllSubTenantsUsers,yb),yield Ra(Fo.loadRoles,fb),yield Ua(Fo.addUser,pb),yield Ua(Fo.addUserToSubTenants,gb),yield Ua(Fo.updateUser,Sb),yield Ua(Fo.deleteUser,vb),yield Ua(Fo.deleteUserFromSubTenants,hb),yield Ua(Fo.resendActivationLink,mb),yield Ua(Fo.resendInvitationLink,Ab),yield Ua(Fo.resendInvitationEmail,bb),yield Ua(Fo.resendInvitationLinkToAllSubTenants,Tb),yield Ua(Fo.openAddUserDialog,rb),yield Ua(Fo.closeAddUserDialog,lb),yield Ua(Fo.openDeleteUserDialog,sb),yield Ua(Fo.closeDeleteUserDialog,cb)}const Eb=["authorizationUrl"],Ib=["events","url"];function*Pb(){try{yield Di(Fo.setSocialLoginsState({loading:!0}));const e=yield Fi(Yf.auth.getSocialLoginProviders);yield Di(Fo.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield Di(Fo.setSocialLoginsState({error:dg(e),loading:!1,firstLoad:!1}))}}function*Lb(){const e=yield xi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Fi(Yf.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield Fi(Yf.auth.getSocialLoginProvidersV2),t}function*Ob(){try{const e=yield xi((e=>e.root.context));yield Di(Fo.setSocialLoginsState({loading:!0}));const t=yield Fi(Lb),{providers:n}=yield Fi(Yf.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Jo(t,Eb);const i=kr(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:dg(e),loading:!1,firstLoad:!1}))}}function*_b(e){let{payload:{events:t,url:n}}=e,o=Jo(e.payload,Ib);try{yield Di(Fo.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Fi(Yf.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:tg.SOCIAL_LOGIN});null==t||null==(i=t.signUpComplete)||i.call(t,u),fg(yg.SIGNUP_COMPLETED,u);const d=U({},r,{origin:eg.SOCIAL_LOGIN,name:c});null==t||null==(a=t.userVerified)||a.call(t,d),fg(yg.USER_VERIFIED,d)}l&&localStorage.setItem("userId",l),yield Di(Fo.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield xi((e=>e.auth));e?yield Fi(pv):yield Fi(Sv)}(),localStorage.removeItem("register-quick-login"),yield Di(Fo.setSocialLoginsState({loading:!1}))}catch(e){yield Di(Fo.setSocialLoginsState({loading:!1,error:dg(e,"Failed to authenticate"),firstLoad:!1}))}}function*wb({payload:e}){yield Di(Fo.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*Cb(){yield Da(Fo.loadSocialLoginsConfiguration,Pb),yield Da(Fo.loadSocialLoginsConfigurationV2,Ob),yield Da(Fo.loginViaSocialLogin,_b),yield Ra(Fo.setSocialLoginError,wb)}let Ub;function*Rb({payload:e}){const{description:t,expires:n,callback:o}=e,{apiTokensDataUser:i}=yield xi((e=>e.auth.apiTokensState));try{let e,a;yield Di(Fo.setApiTokensLoader({key:Ub.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield Fi(Yf.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield Fi(Yf.auth.updateUserApiTokensData,{description:t}),yield Di(Fo.setApiTokensState({showAddTokenDialog:!1})),yield Vi(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:Ub.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield Di(Fo.setApiTokensError({key:Ub.ADD_API_TOKEN,value:dg(e)})),yield Di(Fo.setApiTokensLoader({key:Ub.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*Db({payload:e}){const{description:t,roleIds:n,expires:o,callback:i}=e,{apiTokensDataTenant:a}=yield xi((e=>e.auth.apiTokensState));try{let e,r;yield Di(Fo.setApiTokensLoader({key:Ub.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield Fi(Yf.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield Fi(Yf.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield Di(Fo.setApiTokensState({showAddTokenDialog:!1})),yield Vi(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:Ub.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Di(Fo.setApiTokensError({key:Ub.ADD_API_TOKEN,value:dg(e)})),yield Di(Fo.setApiTokensLoader({key:Ub.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*Nb({payload:e}){const{apiTokensDataUser:t}=yield xi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield Di(Fo.setApiTokensLoader({key:Ub.DELETE_API_TOKEN,value:!0})),n?(yield Fi(Yf.auth.deleteUserAccessToken,{id:e}),yield Di(Fo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Fi(Yf.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:Ub.DELETE_API_TOKEN,value:!1}))}catch(e){yield Di(Fo.setApiTokensError({key:Ub.DELETE_API_TOKEN,value:dg(e)})),yield Di(Fo.setApiTokensLoader({key:Ub.DELETE_API_TOKEN,value:!1}))}}function*Mb({payload:e}){const{apiTokensDataTenant:t}=yield xi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let o=t;try{yield Di(Fo.setApiTokensLoader({key:Ub.DELETE_API_TOKEN,value:!0})),n?(yield Fi(Yf.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield Fi(Yf.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:Ub.DELETE_API_TOKEN,value:!1}))}catch(e){yield Di(Fo.setApiTokensError({key:Ub.DELETE_API_TOKEN,value:dg(e)})),yield Di(Fo.setApiTokensLoader({key:Ub.DELETE_API_TOKEN,value:!1}))}}function*Fb({payload:e}){null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Ub.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield Ni([Fi(Yf.auth.getUserApiTokensData),Fi(Yf.auth.getTenantApiTokensData)]);yield Di(Fo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield Di(Fo.setApiTokensLoader({key:Ub.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Di(Fo.setApiTokensError({key:Ub.LOAD_API_TOKENS,value:dg(t)})),yield Di(Fo.setApiTokensLoader({key:Ub.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Gb({payload:e}){null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Ub.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Fi(Yf.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=Fi(Yf.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:Ub.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield Di(Fo.setApiTokensError({key:Ub.LOAD_API_TOKENS,value:dg(t)})),yield Di(Fo.setApiTokensLoader({key:Ub.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*$b({payload:e}){null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Ub.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Fi(Yf.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Fi(Yf.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:Ub.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield Di(Fo.setApiTokensError({key:Ub.LOAD_API_TOKENS,value:dg(t)})),yield Di(Fo.setApiTokensLoader({key:Ub.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*xb(){yield Da(Fo.loadApiTokens,Fb),yield Da(Fo.loadUserApiTokens,Gb),yield Da(Fo.loadTenantApiTokens,$b),yield Ua(Fo.addUserApiToken,Rb),yield Ua(Fo.addTenantApiToken,Db),yield Ra(Fo.deleteTenantApiToken,Mb),yield Ra(Fo.deleteUserApiToken,Nb)}function*Vb({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield Di(Fo.setApiTokensLoader({key:Ub.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield xi((e=>e.auth.apiTokensState)),a=U({},hp,{description:t,roleIds:n,clientId:`CLIENT_ID_${gA()}`});yield Di(Fo.setApiTokensState({showAddTokenDialog:!1})),yield Vi(200),yield Di(Fo.setApiTokensState({apiTokensDataTenant:[...i,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Vi(200),yield Di(Fo.setApiTokensLoader({key:Ub.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*Bb({payload:e}){yield Di(Fo.setApiTokensLoader({key:Ub.DELETE_API_TOKEN,value:!0})),yield Vi(200);const t=[hp];yield Di(Fo.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Di(Fo.setApiTokensLoader({key:Ub.DELETE_API_TOKEN,value:!1}))}function*jb({payload:e}){var t;null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Ub.LOAD_API_TOKENS,value:!0})));const n=[vp],o=[hp];yield Di(Fo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield Vi(200),yield Di(Fo.setApiTokensLoader({key:Ub.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Wb({payload:e}){var t;null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Ub.LOAD_API_TOKENS,value:!0})));const n=[vp];yield Di(Fo.setApiTokensState({apiTokensDataUser:n})),yield Vi(200),yield Di(Fo.setApiTokensLoader({key:Ub.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Kb({payload:e}){var t;null!=e&&e.silentLoading||(yield Di(Fo.setApiTokensLoader({key:Ub.LOAD_API_TOKENS,value:!0})));const n=[hp];yield Di(Fo.setApiTokensState({apiTokensDataTenant:n})),yield Vi(200),yield Di(Fo.setApiTokensLoader({key:Ub.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Hb(){yield Da(Fo.loadApiTokens,jb),yield Da(Fo.loadUserApiTokens,Wb),yield Da(Fo.loadTenantApiTokens,Kb),yield Ua(Fo.addTenantApiToken,Vb),yield Ra(Fo.deleteTenantApiToken,Bb)}function*zb({payload:e}){try{var t;yield Di(Fo.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield xi((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Fi(Yf.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:dg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*qb({payload:e}){yield Di(Fo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Fi(Yf.accountSettings.getSettings);yield Di(Fo.setAccountSettingsState(U({},e,{loading:!1})))}catch(e){yield Di(Fo.setAccountSettingsState({loading:!1,error:dg(e)}))}}function*Yb(){yield Da(Fo.saveAccountSettings,zb),yield Da(Fo.loadAccountSettings,qb)}function*Jb({payload:e}){var t;yield Di(Fo.setAccountSettingsState({loading:!0})),yield bt();const{accountSettingsState:n}=yield xi((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*Qb({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*Xb(){yield Da(Fo.saveAccountSettings,Jb),yield Da(Fo.loadAccountSettings,Qb)}function*Zb({payload:{tenantId:e,callback:t}}){yield Di(Fo.setState({isLoading:!0}));try{yield Fi(Yf.tenants.switchTenant,{tenantId:e}),yield Fi(yv),(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*eT({payload:e}){yield Di(Fo.setTenantsState({loading:!0}));try{var t;const n=yield Fi(Yr());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*tT({payload:e}){yield Di(Fo.setTenantsState({loading:!0}));try{var t;const n=yield Fi(Yf.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*nT({payload:e}){yield Di(Fo.setTenantsState({loading:!0}));try{var t;const n=yield Fi(Yf.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*oT(){yield Ua(Fo.loadTenants,eT),yield Ua(Fo.loadSubTenants,tT),yield Ua(Fo.switchTenant,Zb),yield Ua(Fo.loadSubTenantsTree,nT)}function*iT(){yield Di(Fo.setTenantsState({loading:!0})),yield bt(),yield Di(Fo.setTenantsState({tenants:Vp,activeTenant:Vp[0],loading:!1}))}function*aT(){yield Ua(Fo.loadTenants,iT)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(Ub||(Ub={}));const rT=["callback"],lT=["callback"],sT=["callback"],cT=["callback"],uT=["callback"];function*dT({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(Yf.roles.getRoles),Fi(Yf.roles.getPermissions),Fi(Yf.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:dg(e),loading:!1}))}}function*yT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,rT);yield Di(Fo.setRolesState({saving:!0}));try{const e=yield Fi(Yf.roles.addRole,n),o=yield Fi(Yf.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:dg(e),saving:!1})),null==t||t(null,e)}}function*fT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,lT);yield Di(Fo.setRolesState({saving:!0}));try{yield Fi(Yf.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:dg(e),saving:!1})),null==t||t(!1,e)}}function*pT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,sT);yield Di(Fo.setRolesState({saving:!0}));try{const e=yield Fi(Yf.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:dg(e),saving:!1})),null==t||t(null,e)}}function*gT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,cT);yield Di(Fo.setRolesState({saving:!0}));try{const e=yield Fi(Yf.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:dg(e),saving:!1})),null==t||t(null,e)}}function*ST(e){let{payload:{callback:t}}=e,n=Jo(e.payload,uT);yield Di(Fo.setRolesState({saving:!0}));try{const e=yield Fi(Yf.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:dg(e),saving:!1})),null==t||t(null,e)}}function*vT(){yield Da(Fo.loadRolesAndPermissions,dT),yield Ua(Fo.addRole,yT),yield Ua(Fo.deleteRole,fT),yield Ua(Fo.updateRole,pT),yield Ua(Fo.attachPermissionsToRole,gT),yield Ua(Fo.attachPermissionToRoles,ST)}function*hT({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:mp,loading:!1}))}catch(e){yield Di(Fo.setRolesState({error:dg(e),loading:!1}))}}function*mT(){yield Da(Fo.loadRolesAndPermissions,hT)}const AT=["callback"],bT=["callback"],TT=["callback"];function*kT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,AT);yield Di(Fo.setResetPhoneNumberState({loading:!0}));try{const e=yield Fi(Yf.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:dg(e)})),null==t||t(null,e)}}function*ET(e){let{payload:{callback:t}}=e,n=Jo(e.payload,bT);yield Di(Fo.setResetPhoneNumberState({loading:!0}));try{const e=yield Fi(Yf.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:dg(e)})),null==t||t(null,e)}}function*IT(e){let{payload:{callback:t}}=e,n=Jo(e.payload,TT);yield Di(Fo.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:o}=yield xi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Fi(Yf.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:dg(e)})),null==t||t(null,e)}}function*PT(){yield Da(Fo.resetPhoneNumber,kT),yield Da(Fo.verifyResetPhoneNumber,ET),yield Da(Fo.changePhoneNumber,IT)}function*LT(){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{const e=yield Fi(Yf.auth.getCurrentUserSessions);yield Di(Fo.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*OT(){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{const e=yield Fi(Yf.auth.getCurrentUserSession);yield Di(Fo.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*_T({payload:{id:e}}){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{yield Fi(Yf.auth.deleteSessionForUser,e),yield Di(Fo.loadUserSessions())}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*wT({payload:{callback:e,userId:t}}){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{yield Fi(Yf.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Di(Fo.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*CT(){yield Di(Fo.setSessionsState({loading:!0,error:null}));try{yield Fi(Yf.auth.deleteAllSessionsForUser),yield Di(Fo.loadUserSessions())}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*UT(){yield Ra(Fo.loadUserSessions,LT),yield Ra(Fo.deleteUserSession,_T),yield Ra(Fo.deleteAllUserSessions,CT),yield Ra(Fo.loadCurrentUserSession,OT),yield Ua(Fo.revokeUserSessions,wT)}function*RT(){yield Di(Fo.setSessionsState({loading:!0,error:null})),yield Di(Fo.setSessionsState({sessions:Bp,loading:!1}))}function*DT({payload:{id:e}}){yield Di(Fo.setSessionsState({loading:!0,error:null}));const t=(yield xi((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*NT(){yield Di(Fo.setSessionsState({loading:!0,error:null}));const e=Bp.filter((e=>e.current));yield Di(Fo.setSessionsState({sessions:e,loading:!1}))}function*MT(){yield Ra(Fo.loadUserSessions,RT),yield Ra(Fo.deleteUserSession,DT),yield Ra(Fo.deleteAllUserSessions,NT)}const FT=["callback"],GT=["callback"];function*$T(){yield Di(Fo.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Fi(Yf.auth.getSessionConfigurations);yield Di(Fo.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Di(Fo.setSessionsState({error:e,loading:!1}))}}function*xT({payload:e}){yield Di(Fo.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Jo(e,FT);yield Fi(Yf.auth.createOrUpdateSessionConfigrations,n),yield Di(Fo.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Di(Fo.setSessionsPolicyState({error:e,loading:!1}))}}function*VT(){yield Da(Fo.loadSessionsPolicy,$T),yield Ra(Fo.createOrUpdateSessionsPolicy,kg(xT))}function*BT(){yield Di(Fo.setSessionsPolicyState({loading:!0,error:null}));const e=yield xi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:jp}));yield Di(Fo.setSessionsPolicyState(U({},e,{loading:!1})))}function*jT({payload:e}){yield Di(Fo.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Jo(e,GT);null==t||t(!0),yield Di(Fo.setSessionsPolicyState({configurations:n,loading:!1}))}function*WT(){yield Da(Fo.loadSessionsPolicy,BT),yield Ra(Fo.createOrUpdateSessionsPolicy,jT)}const KT=["callback"],HT=["callback"],zT=["callback"],qT=["callback"],YT=["callback"],JT=["callback"],QT=["callback"],XT=["callback"],ZT=()=>xi((e=>e.auth.restrictionsState.ipRestrictions)),ek=()=>xi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*tk(){yield Di(Fo.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Fi(Yf.auth.getDomainRestrictionsConfig),t=(yield Fi(Yf.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:dg(e),loading:!1}))}}function*nk(e){let{payload:{callback:t}}=e,n=Jo(e.payload,KT);yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield ek();try{var i;yield Fi(Yf.auth.createDomainRestriction,n);const e=(yield Fi(Yf.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:dg(e)})),null==t||t(null,e)}}function*ok(e){let{payload:{callback:t}}=e,n=Jo(e.payload,HT);yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Fi(Yf.auth.updateDomainRestrictionConfig,n),o=(yield Fi(Yf.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:dg(e)})),null==t||t(null,e)}}function*ik({payload:{id:e}}){yield Di(Fo.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield ek();try{var n;yield Fi(Yf.auth.deleteDomainRestriction,e);const o=(yield Fi(Yf.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:dg(e)}))}}const ak=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*rk(){yield Di(Fo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield ZT(),t=yield Fi(Yf.auth.getIPRestrictionsConfig),n=ak({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield Fi(Yf.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:dg(e),loading:!1}))}}function*lk(){try{const{valid:e}=yield Fi(Yf.auth.testCurrentIpInAllowList);yield Di(Fo.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Di(Fo.setIpRestrictionsState({error:dg(e)}))}}function*sk({payload:{callback:e}}){yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield xi((e=>e.auth.userIp));yield Ni([Fi(Yf.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Bn.ALLOW}),Fi(Yf.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield ZT(),o=ak(n.pagination),{items:i,_metadata:{totalPages:a}}=yield Fi(Yf.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*ck(e){let{payload:{callback:t}}=e,n=Jo(e.payload,zT);yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));const o=yield ZT();try{var i,a;yield Fi(Yf.auth.createIPRestriction,n);const e=yield ZT(),r=ak(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Fi(Yf.auth.getIPRestrictions,r);yield lk(),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:dg(e)})),null==t||t(null,e)}}function*uk(e){let{payload:{callback:t}}=e,n=Jo(e.payload,qT);yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));try{yield Fi(Yf.auth.updateIPRestrictionConfig,n);const e=yield ZT(),o=yield Fi(Yf.auth.getIPRestrictionsConfig),i=ak(U({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield Fi(Yf.auth.getIPRestrictions,i);yield lk(),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:dg(e)})),null==t||t(null,e)}}function*dk({payload:{id:e,callback:t}}){yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));const n=yield ZT();try{var o;yield Fi(Yf.auth.deleteIPRestriction,e);const i=yield ZT(),a=ak(i.pagination),{items:r,_metadata:{totalPages:l}}=yield Fi(Yf.auth.getIPRestrictions,a);yield lk(),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:dg(e)})),null==t||t(null,e)}}function*yk(){yield Da(Fo.loadIpRestrictions,kg(rk)),yield Da(Fo.loadEmailDomainRestrictions,kg(tk)),yield Ua(Fo.saveIpRestriction,kg(ck)),yield Ua(Fo.saveIpRestrictionsConfig,kg(uk)),yield Ua(Fo.deleteIpRestriction,kg(dk)),yield Ua(Fo.checkIfUserIpValid,kg(lk)),yield Ua(Fo.addCurrentUserIpAndActivate,kg(sk)),yield Ua(Fo.saveEmailDomainRestriction,kg(nk)),yield Ua(Fo.saveEmailDomainRestrictionsConfig,kg(ok)),yield Ua(Fo.deleteEmailDomainRestriction,kg(ik))}function*fk(){yield Di(Fo.setIpRestrictionsState({loading:!0,error:null})),yield Di(Fo.setIpRestrictionsState({data:{restrictions:Kp.filter((e=>e.strategy===Wp.strategy)),config:Wp},totalPages:1,pagination:{_filter:Bn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*pk(){yield Di(Fo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield ZT(),t=Kp[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:dg(e),loading:!1}))}}function*gk(e){var t,n,o;let{payload:{callback:i}}=e,a=Jo(e.payload,YT);yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));const r=yield ZT(),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:gA(),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,JT);const r=yield ZT();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*vk({payload:{id:e,callback:t}}){var n;yield Di(Fo.setIpRestrictionsState({saving:!0,error:null}));const o=yield ZT();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*hk(){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*mk(e){var t,n;let{payload:{callback:o}}=e,i=Jo(e.payload,QT);const a=yield ek();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*Ak(e){var t;let{payload:{callback:n}}=e,o=Jo(e.payload,XT);const i=yield ek();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*bk({payload:{id:e}}){var t,n;const o=yield ek();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*Tk(){yield Da(Fo.loadIpRestrictions,fk),yield Da(Fo.loadEmailDomainRestrictions,hk),yield Ua(Fo.saveIpRestriction,gk),yield Ua(Fo.saveIpRestrictionsConfig,Sk),yield Ua(Fo.deleteIpRestriction,vk),yield Ua(Fo.checkIfUserIpValid,pk),yield Ua(Fo.saveEmailDomainRestriction,mk),yield Ua(Fo.saveEmailDomainRestrictionsConfig,Ak),yield Ua(Fo.deleteEmailDomainRestriction,bk)}const kk=["callback"],Ek=["id"];function*Ik(e){const{count:t}=yield Fi(Yf.directory.countConfigurationUsers,e.id);return U({},e,{count:t})}function*Pk(){yield Di(Fo.setProvisioningState({loading:!0,error:null}));try{const e=yield Fi(Yf.directory.getConfigs),t=yield Ni(e.map((e=>Ik(e))));yield Di(Fo.setProvisioningState({connections:t,loading:!1}))}catch(e){yield Di(Fo.setProvisioningState({error:dg(e),loading:!1}))}}function*Lk(e){let{payload:{callback:t}}=e,n=Jo(e.payload,kk);yield Di(Fo.setProvisioningState({loading:!0,error:null}));try{const e=yield Fi(Yf.directory.createConfiguration,n),o=yield Fi(Yf.directory.getConfigs),i=yield Ni(o.map((e=>Ik(e))));yield Di(Fo.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield Di(Fo.setProvisioningState({error:dg(e),loading:!1}))}}function*Ok(e){let{payload:{id:t}}=e,n=Jo(e.payload,Ek);yield Di(Fo.setProvisioningState({loading:!0,error:null}));try{yield Fi(Yf.directory.updateConfiguration,t,n);const e=yield Fi(Yf.directory.getConfigs),o=yield Ni(e.map((e=>Ik(e))));yield Di(Fo.setProvisioningState({connections:o,loading:!1}))}catch(e){yield Di(Fo.setProvisioningState({error:dg(e),loading:!1}))}}function*_k({payload:{id:e,callback:t}}){yield Di(Fo.setProvisioningState({loading:!0,error:null}));try{yield Fi(Yf.directory.deleteConfiguration,e);const n=yield Fi(Yf.directory.getConfigs),o=yield Ni(n.map((e=>Ik(e))));yield Di(Fo.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield Di(Fo.setProvisioningState({error:dg(e),loading:!1})),null==t||t(!1,e)}}function*wk(){yield Da(Fo.loadProvisionConnections,Pk),yield Ua(Fo.createProvisionConnection,Lk),yield Ua(Fo.deleteProvisionConnection,_k),yield Ua(Fo.updateProvisionConnection,Ok)}const Ck=["callback","events"];function*Uk(e){let{payload:{callback:t}}=e,n=Jo(e.payload,Ck);yield Di(Fo.setImpersonateState({loading:!0}));try{yield Fi(Yf.impersonate.impersonate,n),yield Di(Fo.setImpersonateState({step:Co.success})),yield Vi(1e3),yield sv(),yield Di(Fo.resetImpersonateState()),null==t||t(!0)}catch(e){yield Di(Fo.setImpersonateState({loading:!1,error:dg(e)}))}}function*Rk(){yield Da(Fo.impersonate,Uk)}function*Dk({payload:e}){const{callback:t,deviceId:n}=e;yield Di(Fo.setPasskeysState({loading:!0}));try{yield Fi(Yf.auth.deleteWebAuthnDevice,n);const{devices:e}=yield xi((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:dg(e,null)})),null==t||t(null,e)}}function*Nk(){yield Di(Fo.setPasskeysState({loading:!0}));try{const{devices:e}=yield Fi(Yf.auth.getWebAuthnDevices);yield Di(Fo.setPasskeysState({devices:e,loading:!1}))}catch(e){yield Di(Fo.setPasskeysState({loading:!1,error:dg(e,null)}))}}function*Mk(){yield Ua(Fo.loadWebAuthnDevices,Nk),yield Ua(Fo.deleteWebAuthnDevice,Dk)}const Fk=["roleIds","userIds"],Gk=()=>xi((e=>e.auth.groupsState));function*$k({payload:e}){const t=SA.GET_TEAM_USERS;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Fi(Yf.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:dg(e)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*xk({payload:e}){const t=SA.GET_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Fi(Yf.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:vA.rolesAndUsers});yield Di(Fo.setGroupsState({selectedGroup:n}))}catch(e){yield Di(Fo.setUsersGroupsError({key:t,value:dg(e)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Vk(){const e=SA.GET_GROUPS,t=yield Gk();yield Di(Fo.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Fi(Yf.groups.getGroups,{_groupsRelations:vA.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:dg(t)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:e,value:!1}))}}function*Bk({payload:e}){const t=SA.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Jo(e,Fk);yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Fi(Yf.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:dg(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*jk({payload:e}){const t=SA.UPDATE_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(Yf.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:dg(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Wk({payload:e}){const t=SA.DELETE_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(Yf.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:dg(n)})),null==e||null==(o=e.callback)||o.call(e,!1,n)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Kk({payload:e}){const t=SA.ADD_ROLES_TO_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(Yf.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:dg(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Hk({payload:e}){const t=SA.DELETE_ROLES_FROM_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(Yf.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:dg(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*zk({payload:e}){const t=SA.ADD_USERS_TO_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(Yf.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:dg(n)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*qk({payload:e}){const t=SA.DELETE_USERS_FROM_GROUP;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Fi(Yf.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:dg(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Yk(){const e=SA.GET_GROUP_CONFIGURATION;yield Di(Fo.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Fi(Yf.groups.getGroupConfiguration);yield Di(Fo.setGroupsState({groupsConfiguration:t}))}catch(t){yield Di(Fo.setUsersGroupsError({key:e,value:dg(t)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:e,value:!1}))}}function*Jk({payload:e}){const t=SA.UPDATE_GROUP_CONFIGURATION;yield Di(Fo.setUsersGroupsLoader({key:t,value:!0}));try{yield Fi(Yf.groups.updateGroupConfiguration,e),yield Di(Fo.getGroupConfiguration())}catch(e){yield Di(Fo.setUsersGroupsError({key:t,value:dg(e)}))}finally{yield Di(Fo.setUsersGroupsLoader({key:t,value:!1}))}}function*Qk(){yield Ra(Fo.loadGroups,Vk),yield Ra(Fo.getGroupById,xk),yield Ra(Fo.createGroup,Bk),yield Ra(Fo.updateGroup,jk),yield Ra(Fo.deleteGroup,Wk),yield Ra(Fo.addRolesToGroup,Kk),yield Ra(Fo.deleteRolesFromGroup,Hk),yield Ra(Fo.addUsersToGroup,zk),yield Ra(Fo.deleteUsersFromGroup,qk),yield Ra(Fo.getGroupConfiguration,Yk),yield Ra(Fo.updateGroupConfiguration,Jk),yield Ra(Fo.getTeamUsers,$k)}function*Xk(){const e=SA.GET_GROUPS;yield Di(Fo.setUsersGroupsLoader({key:e,value:!0}));const t=qp;yield Di(Fo.setGroupsState({groups:t})),yield Di(Fo.setUsersGroupsLoader({key:e,value:!1}))}function*Zk({payload:e}){var t;const n=SA.CREATE_GROUP,{groups:o}=yield Gk();yield Di(Fo.setUsersGroupsLoader({key:n,value:!0})),yield Di(Fo.setGroupsState({groups:[U({},e,{id:`${e.name}ID`,managedBy:jf.FRONTEGG}),...null!=o?o:[]]})),yield Vi(500),null==e||null==(t=e.callback)||t.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:n,value:!1}))}function*eE({payload:e}){var t,n,o,i,a;const r=SA.UPDATE_GROUP,l=yield Gk();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:jf.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 Vi(500),null==e||null==(a=e.callback)||a.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:r,value:!1}))}function*tE({payload:e}){var t,n;const o=SA.DELETE_GROUP,i=yield Gk();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 Vi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*nE({payload:e}){var t,n;const o=SA.ADD_ROLES_TO_GROUP,i=yield Gk();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 Vi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*oE({payload:e}){var t,n;const o=SA.DELETE_ROLES_FROM_GROUP,i=yield Gk();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 Vi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*iE({payload:e}){var t,n;const o=SA.ADD_USERS_TO_GROUP,i=yield Gk();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 Vi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*aE({payload:e}){var t,n;const o=SA.DELETE_USERS_FROM_GROUP,i=yield Gk();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 Vi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Di(Fo.setUsersGroupsLoader({key:o,value:!1}))}function*rE(){const e=SA.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield Gk();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*lE({payload:e}){const t=SA.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield Gk();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*sE(){yield Ra(Fo.loadGroups,Xk),yield Ra(Fo.createGroup,Zk),yield Ra(Fo.updateGroup,eE),yield Ra(Fo.deleteGroup,tE),yield Ra(Fo.addRolesToGroup,nE),yield Ra(Fo.deleteRolesFromGroup,oE),yield Ra(Fo.addUsersToGroup,iE),yield Ra(Fo.deleteUsersFromGroup,aE),yield Ra(Fo.getGroupConfiguration,rE),yield Ra(Fo.updateGroupConfiguration,lE)}let cE;!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"}(cE||(cE={}));const uE=(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=>uE(e,t,n))))?o:[]})};function dE(e,t){var n;return U({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>dE(e,t))):[]})}function yE(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=>yE(e,t,n))))?o:[]})}const fE=({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}})),pE=()=>xi((e=>e.auth.allAccountsState));function*gE({payload:e}){const t=cE.GET_ACCOUNTS;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield pE(),{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 pE(),{items:n,_links:i}=yield Fi(Yf.tenants.searchSubTenants,r,{jwt:o}),a=yield Fi(Yf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:o}),s=fE({items:n},a),c=yE(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 pE(),{items:n,_links:o}=yield Fi(Yf.tenants.searchSubTenants,r),i=yield Fi(Yf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=fE({items:n},i),l=yE(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:dg(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*SE({payload:e}){const t=cE.SEARCH_ACCOUNTS;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield pE(),{jwt:o}=e;try{if(null!=e&&e._subTenantId){var i;const{items:t}=yield Fi(Yf.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:dg(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*vE({payload:e}){const t=cE.GET_USER_JWT;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:o}=e;try{const e=yield Fi(Yf.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:dg(e)})),yield Di(Fo.setSelectedAccountState({accessPermission:!1})),null==o||o(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*hE({payload:e}){const t=cE.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 pE(),{selectedAccount:t}=yield pE(),r=yield Fi(Yf.subTenants.createSubTenant,{name:n,parentTenantId:o,tenantId:i},{jwt:a}),l=yE(e,null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),s=yE(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 pE(),t=yield Fi(Yf.subTenants.createSubTenant,{name:n,tenantId:i,parentTenantId:o}),a=yE(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:dg(e)})),null==r||r(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*mE({payload:e}){const t=cE.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 pE();yield Fi(Yf.subTenants.deleteSubTenant,o,{jwt:n});const i=dE(t,o),a=dE(null==e?void 0:e.accounts,o);yield Di(Fo.setAllAccountsState({accounts:i})),yield Di(Fo.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield pE();yield Fi(Yf.subTenants.deleteSubTenant,o);const t=dE(e,o);yield Di(Fo.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:dg(e)})),null==i||i(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*AE({payload:e}){const t=cE.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 pE();yield Fi(Yf.subTenants.updateSubTenant,{tenantId:a},{name:o},{jwt:n});const i=uE(e.accounts,a,o);yield Di(Fo.setSelectedAccountState({name:o,accounts:i}));const r=uE(t,a,o);yield Di(Fo.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield pE();yield Fi(Yf.subTenants.updateSubTenant,{tenantId:a},{name:o});const t=uE(e,a,o);yield Di(Fo.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:dg(e)})),null==i||i(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*bE({payload:e}){const t=cE.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(Yf.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:dg(e)})),null==a||a(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*TE({payload:e}){const t=cE.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 pE();try{yield Fi(Yf.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:dg(e)})),null==a||a(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*kE({payload:e}){const t=cE.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(Yf.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:dg(e)})),null==a||a(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*EE({payload:e}){const t=cE.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield Di(Fo.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield pE(),{userId:o,allowAccess:i,jwt:a,callback:r}=e;try{var l;yield Fi(Yf.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:dg(e)})),null==r||r(!1)}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*IE({payload:e}){var t,n,o,i,a,r,l,s;const c=cE.GET_ACCOUNT_USERS;yield Di(Fo.setAllAccountsLoader({key:c,value:!0}));const u=yield pE(),{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(Yf.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(Yf.roles.getRoles),i=yield Fi(Yf.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:dg(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:c,value:!1}))}}function*PE({payload:e}){const t=cE.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(Yf.accountSettings.getSettings,{jwt:n}),u=yield Fi(Yf.tenants.getTenantsUsersCount,{tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n}),d=yield Fi(Yf.tenants.getParentTenants,{jwt:n}),y=yield Fi(Yf.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:dg(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*LE(){const e=cE.SET_ROOT_ACCOUNT_DATA;yield Di(Fo.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield xi((e=>e.auth.tenantsState)),{accounts:n}=yield pE();if(t)try{var o;const i=yield Fi(Yf.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:dg(t)}))}finally{yield Di(Fo.setAllAccountsLoader({key:e,value:!1}))}}function*OE({payload:e}){const t=cE.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(Yf.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:o});yield Di(Fo.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield Di(Fo.setAllAccountsError({key:t,value:dg(e)}))}finally{yield Di(Fo.setAllAccountsLoader({key:t,value:!1}))}}function*_E(){yield Ra(Fo.loadAccounts,gE),yield Ra(Fo.searchAccounts,SE),yield Ra(Fo.updateSubAccountAccessForUser,EE),yield Ra(Fo.getUserJwtForSubAccount,vE),yield Ra(Fo.createSubAccount,hE),yield Ra(Fo.deleteSubAccount,mE),yield Ra(Fo.updateSubAccountSettings,AE),yield Ra(Fo.addUsersToAccount,kE),yield Ra(Fo.deleteUsersFromAccount,bE),yield Ra(Fo.setUserRolesForSubAccount,TE),yield Ra(Fo.getAccountUsers,IE),yield Ra(Fo.setRootAccountData,LE),yield Ra(Fo.setSelectedSubAccountData,PE),yield Ra(Fo.loadNumberOfUsersForSelectedSubAccount,OE)}const wE=["callback"],CE=["callback"],UE=["callback","phoneId"],RE=["callback","phoneId"],DE=["callback"];function*NE(){yield Di(Fo.setSmsState({loading:!0}));const e={_limit:10,_offset:0};try{const{items:t}=yield Fi(Yf.userPhoneNumbers.getUserPhoneNumbers,e);yield Di(Fo.setSmsState({phoneNumbers:t}))}catch(e){yield Di(Fo.setSmsState({error:dg(e)}))}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*ME(e){let{payload:{callback:t}}=e,n=Jo(e.payload,wE);yield Di(Fo.setSmsState({loading:!0}));try{const e=yield Fi(Yf.userPhoneNumbers.createPhoneNumber,n);yield Di(Fo.setSmsState({otcToken:e.otcToken})),yield Fi(NE),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:dg(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*FE(e){let{payload:{callback:t}}=e,n=Jo(e.payload,CE);yield Di(Fo.setSmsState({loading:!0}));try{yield Fi(Yf.userPhoneNumbers.verifyPhoneNumber,n),yield Fi(NE),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:dg(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*GE(e){let{payload:{callback:t,phoneId:n}}=e;Jo(e.payload,UE),yield Di(Fo.setSmsState({loading:!0}));try{const e=yield Fi(Yf.userPhoneNumbers.deletePhoneNumber,n);yield Di(Fo.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:dg(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*$E(e){let{payload:{callback:t,phoneId:n}}=e,o=Jo(e.payload,RE);yield Di(Fo.setSmsState({loading:!0}));try{yield Fi(Yf.userPhoneNumbers.verifyDeletePhoneNumber,n,o),yield Fi(NE),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:dg(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*xE(e){let{payload:{callback:t}}=e,n=Jo(e.payload,DE);yield Di(Fo.setSmsState({loading:!0}));try{const e=yield Fi(Yf.userPhoneNumbers.preVerifyPhoneNumber,n);yield Di(Fo.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield Di(Fo.setSmsState({error:dg(e)})),null==t||t(null,e)}finally{yield Di(Fo.setSmsState({loading:!1}))}}function*VE(){yield Ua(Fo.loadPhoneNumbers,NE),yield Ua(Fo.setUpPhoneNumber,ME),yield Ua(Fo.verifyPhoneNumber,FE),yield Ua(Fo.deletePhoneNumber,GE),yield Ua(Fo.verifyDeletePhoneNumber,$E),yield Ua(Fo.preVerifyPhoneNumber,xE)}var BE={sagas:function*(){yield Ni([Fi(lh),Fi(aA),Fi(lA),Fi(Ym),Fi(PT),Fi(kh),Fi(Qh),Fi(om),Fi(Ag),Fi(Nm),Fi(ub),Fi(Qk),Fi(Cb),Fi(PS),Fi(xb),Fi(sS),Fi(Yb),Fi(oT),Fi(vT),Fi(UT),Fi(VT),Fi(yk),Fi(wk),Fi(Rk),Fi(Mk),Fi(_E),Fi(GS),Fi(Ug),Fi(VE)])},mockSagas:function*(){yield Ni([Fi(uh),Fi(wh),Fi(lm),Fi(Wm),Fi(kb),Fi(Hb),Fi(bS),Fi(MT),Fi(Xb),Fi(aT),Fi(WT),Fi(Tk),Fi(mT),Fi(sE),Fi($g)])},storeName:Ct,initialState:wo,reducer:No,actions:Fo};const jE=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),WE={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},KE={setAuditLogsState:jE("auditLogsState"),resetAuditLogsState:e=>U({},e,{auditLogsState:WE})},HE={exportAuditsCsv:ut("auditLogs/exportAuditsCsv"),loadAuditLogs:ut("auditLogs/loadAuditLogs",(e=>({payload:e})))},zE={loading:!0},qE={setAuditsMetadataState:jE("auditsMetadataState"),resetAuditsMetadataState:e=>U({},e,{auditsMetadataState:zE})},YE={loadAuditsMetadata:ut("auditLogs/loadAuditsMetadata")},JE={auditLogsState:WE,auditsMetadataState:zE},{reducer:QE,actions:XE}=yt({name:Rt,initialState:JE,reducers:U({resetState:e=>U({},e,JE),setState:(e,{payload:t})=>U({},e,t)},KE,qE)}),ZE=U({},XE,HE,YE),eI=e=>"createdAt"!==e.id,tI={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`})))},nI={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}]},oI=()=>xi((e=>e.auditLogs.auditLogsState)),iI=()=>xi((e=>e.auditLogs.auditsMetadataState));function*aI(){const e=yield oI(),{columns:t}=yield iI();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(ZE.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Yf.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(ZE.setAuditLogsState({isDownloadingCsv:!1}))}function*rI({payload:e}){yield Di(ZE.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield oI(),{columns:n}=yield iI();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(ZE.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(ZE.loadAuditsMetadata()));const{data:p,total:g}=yield Fi(Yf.audits.getAudits,U({offset:c,count:s},y,f));yield Di(ZE.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(ZE.setAuditLogsState({loading:!1,error:dg(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*lI(){yield Ua(ZE.exportAuditsCsv,aI),yield Ua(ZE.loadAuditLogs,rI)}function*sI({payload:e}){yield Di(ZE.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield oI(),{columns:n}=yield iI();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(ZE.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield Di(ZE.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=tI;let o=n.filter((e=>t=>e.filter(eI).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(ZE.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(ZE.setAuditLogsState({loading:!1,error:dg(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*cI(){yield Ua(ZE.loadAuditLogs,sI)}function*uI(){yield Di(ZE.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Fi(Yf.metadata.getAuditsMetadata);yield Di(ZE.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Di(ZE.setAuditsMetadataState({error:e,loading:!1}))}}function*dI(){yield Ua(ZE.loadAuditsMetadata,uI)}function*yI(){yield Di(ZE.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=nI;yield Di(ZE.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Di(ZE.setAuditsMetadataState({error:e,loading:!1}))}}function*fI(){yield Ua(ZE.loadAuditsMetadata,yI)}var pI={sagas:function*(){yield Ni([Fi(lI),Fi(dI)])},mockSagas:function*(){yield Ni([Fi(cI),Fi(fI)])},storeName:Rt,initialState:JE,reducer:QE,actions:ZE};const gI={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:vI,reducer:hI}=yt({name:"audits",initialState:gI,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]})))}}}),mI=U({},vI,{initData:ut(`${SI}/initData`),loadAudits:ut(`${SI}/loadAudits`),removeFilter:ut(`${SI}/removeFilter`),filterData:ut(`${SI}/filterData`),exportCSV:ut(`${SI}/exportCSV`),deleteAudits:ut(`${SI}/deleteAudits`)}),AI=()=>xi((e=>e[SI]));function*bI(){const{sortBy:e,sortDirection:t}=yield AI();try{const n=yield Fi(Yf.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Di(mI.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Di(mI.loadItemFailedAction(t))}}function*TI(){try{const e=yield Fi(Yf.metadata.getAuditsMetadata);yield Di(mI.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Di(mI.loadItemFailedAction(t))}}const kI=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*EI({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield AI(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield AI():{rowsData:[]};try{const e=kI(t),{data:l,total:d}=yield Fi(Yf.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(mI.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield Di(mI.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Di(mI.loadItemFailedAction(t))}}function*II(){yield Di(mI.startLoading()),yield Ni([bI(),TI(),EI({payload:{onlyOneLoad:!1},type:""})]),yield Di(mI.finishLoading())}function*PI({payload:e}){const{filters:t}=yield AI(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield Di(mI.setFilterData(o))}function*LI({payload:e}){const{filters:t}=yield AI();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(mI.setFilterData(o))}function*OI(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield AI(),a=kI(e);yield Di(mI.startDownloadingCsv());try{yield Yf.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(mI.stopDownloadingCsv())}}function*_I(){yield Ra(mI.initData,II),yield Ra(mI.removeFilter,PI),yield Ra(mI.filterData,LI),yield Ra([mI.loadAudits,mI.textSearch,mI.onPageChange],EI),yield Ra([mI.setFilterData,mI.setDataSorting,mI.startRefresh],(()=>EI({payload:{appendMode:!1},type:""}))),yield Ra(mI.exportCSV,OI)}const wI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},CI={initData:()=>U({},wI),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)})}},UI={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}})))},RI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:DI,actions:NI}=yt({name:Ut,initialState:RI,reducers:U({},CI)}),MI=U({},NI,UI),FI={slack:Yf.connectivity.getSlackConfiguration,email:Yf.connectivity.getEmailConfiguration,sms:Yf.connectivity.getSMSConfiguration,webhook:Yf.connectivity.getWebhooksConfigurations,categories:Yf.connectivity.getCategories,channelMap:Yf.connectivity.getChannelMaps},GI={slack:Yf.connectivity.postSlackConfiguration,email:Yf.connectivity.postEmailConfiguration,sms:Yf.connectivity.postSMSConfiguration,webhook:Yf.connectivity.postWebhooksConfiguration},$I=["email","slack","sms","webhook"],xI={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"}},VI=["id"],BI=["id","enabled"],jI=["categories","channelMap"];function*WI(e){return yield Fi(HI,{payload:{api:e},type:""})}function*KI({payload:e=$I}){yield Di(MI.setConnectivityState({isLoading:!0}));try{const t=yield Ni([...e.map(WI),yield HI({payload:{api:"categories"},type:""}),yield function*(){return(yield Ni(e.map((function*(e){return yield HI({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>U({},t,{[`${e[o]}`]:n})),{})}()]),n=yield HI({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:xI[e[i]].events(o),active:xI[e[i]].isActive(o),platform:xI[e[i]].title,image:xI[e[i]].image}]}):n:U({},n,{[`${jI[i-e.length]}`]:o})),{list:[],webhook:n});yield Di(MI.setConnectivityState(U({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Di(MI.setConnectivityState({isLoading:!1}))}}function*HI({payload:{api:e,params:t}}){try{return yield Fi(FI[e],t)}catch(e){return}}function*zI(){try{yield Di(MI.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Fi(Yf.connectivity.getSlackChannels);yield Di(MI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Di(MI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*qI(e,t){const{connectivity:{list:n}}=yield xi(),o=n.find((({key:t})=>t===e));if(!o)return;const i=xI[e].isActive(t);i!==o.active&&(yield Di(MI.setConnectivityState({list:n.map((t=>t.key===e?U({},t,{active:i}):t))})))}function*YI({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield xi((e=>e.connectivity));try{if(yield Di(MI.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...o]:o})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield xi();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,VI);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(GI.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Fi(Yf.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield xi(),{processIds:o}=yield xi((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?Yf.connectivity.postEmailConfiguration:Yf.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,BI);return yield Ni([yield Fi("email"===t?Yf.connectivity.patchEmailConfiguration:Yf.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield Fi("email"===t?Yf.connectivity.putEmailSubscriptions:Yf.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?Yf.connectivity.deleteEmailSubscriptions:Yf.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield HI({payload:{api:t},type:""});yield Di(MI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield qI(t,e)}else yield Di(MI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield Fi(GI[e],t),!["sms","email"].includes(e)){const i=yield HI({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield Di(MI.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield qI(e,i),null==n||n(!0)}}catch(e){yield Di(MI.setConnectivityState({error:dg(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*JI({payload:e}){try{yield Yf.connectivity.postSlackCode(e)}catch{}yield Di(MI.setConnectivityState({error:void 0,isSaving:!1}))}function*QI(){const{slackChannels:e}=yield xi((e=>e.connectivity));try{yield Di(MI.setConnectivityState({slackChannels:U({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Fi(Yf.connectivity.getSlackScope);yield Di(MI.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Di(MI.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*XI({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield xi((e=>e.connectivity));try{yield Di(MI.setConnectivityState({isSaving:!0})),yield Fi(Yf.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,dg(e))}const i=yield HI({payload:{api:"webhook"},type:""});i&&(yield Di(MI.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*ZI({payload:e}){try{yield Di(MI.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Fi(Yf.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Di(MI.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Di(MI.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Di(MI.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*eP({payload:e}){try{const{statusCode:t}=yield Fi(Yf.connectivity.postWebhookRetry,e);yield Di(MI.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Di(MI.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*tP({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield xi((e=>e.connectivity));try{yield Di(MI.setConnectivityState({webhookLogs:U({},o,{isLoading:!0})}));const i=yield Fi(Yf.connectivity.getWebhookLog,e,n,t);yield Di(MI.setConnectivityState({error:void 0,webhookLogs:U({isLoading:!1},i)}))}catch(e){yield Di(MI.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var nP={sagas:function*(){yield Ua(MI.loadDataAction,KI),yield Ra(MI.loadSlackActions,zI),yield Ua(MI.postDataAction,YI),yield Ua(MI.postCodeAction,JI),yield Ua(MI.loadScope,QI),yield Ua(MI.deleteWebhookConfigAction,XI),yield Ua(MI.postWebhookTestAction,ZI),yield Ua(MI.postWebhookRetryAction,eP),yield Ra(MI.loadWebhookLogsAction,tP)},storeName:Ut,initialState:RI,reducer:DI,actions:MI};function oP(){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 iP(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>U({},n,{[e]:t(n[e],o)})}}function aP(e){return iP(e,((e,t)=>U({},e,{loading:t.payload})))}function rP(e){return iP(e,((e,t)=>U({},e,{error:t.payload,loading:!1})))}const lP={loading:!1,error:null,fetching:!0,plans:[]},{actions:sP,reducer:cP,name:uP}=yt({name:"subscriptions/plans",initialState:lP,reducers:U({},oP())}),dP=U({loadPlans:ut(`${uP}/loadPlans`)},sP),yP={loading:!1,error:null,fetching:!0,config:null},fP=U({},oP()),{actions:pP,reducer:gP,name:SP}=yt({name:"subscriptions/config",initialState:yP,reducers:fP}),vP=U({loadPaymentConfiguration:ut(`${SP}/loadPaymentConfiguration`)},pP),hP={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},mP=U({},oP(),{setCancellationLoading:aP("cancellation"),setCancellationError:rP("cancellation"),setRenewalLoading:aP("renewal"),setRenewalError:rP("renewal")}),{reducer:AP,actions:bP,name:TP}=yt({name:"subscriptions/billing/subscription",initialState:hP,reducers:mP}),kP=U({load:ut(`${TP}/loadSubscription`),cancelSubscription:ut(`${TP}/cancelSubscription`),renewSubscription:ut(`${TP}/renewSubscription`)},bP),EP={loading:!1,error:null,fetching:!0},IP=U({},oP()),{reducer:PP,actions:LP,name:OP}=yt({name:"subscriptions/billing/information",initialState:EP,reducers:IP}),_P=U({loadBillingInformation:ut(`${OP}/loadBillingInformation`),cancelSubscription:kP.cancelSubscription,renewSubscription:kP.renewSubscription},LP),wP={loading:!1,error:null,fetching:!0},CP=U({},oP(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}),{reducer:UP,actions:RP,name:DP}=yt({name:"subscriptions/billing/payment",initialState:wP,reducers:CP}),NP=U({loadPaymentMethod:ut(`${DP}/loadPaymentMethod`),submitPaymentMethod:ut(`${DP}/submitPaymentMethod`),submitPaymentMethodError:ut(`${DP}/submitPaymentMethodError`),submitPaymentMethodSuccess:ut(`${DP}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:ut(`${DP}/updateBillingDetails`,(e=>({payload:e})))},RP),MP={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},FP=U({},oP(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{invoiceDownload:U({},e.invoiceDownload,t.payload)})}}),{reducer:GP,actions:$P,name:xP}=yt({name:"subscriptions/billing/invoices",initialState:MP,reducers:FP}),VP=U({loadInvoices:ut(`${xP}/loadInvoices`),downloadInvoice:ut(`${xP}/downloadInvoice`,(e=>({payload:e})))},$P),BP={information:EP,invoices:MP,paymentMethod:wP,subscription:hP},jP={invoices:VP,information:_P,paymentMethod:NP,subscription:kP},WP=We({invoices:GP,information:PP,paymentMethod:UP,subscription:AP}),KP={fetching:!0,loading:!1,error:null,confirmed:!1},HP=U({},oP()),{actions:zP,reducer:qP,name:YP}=yt({name:"subscriptions/checkout",initialState:KP,reducers:HP}),JP=U({loadCheckout:ut(`${YP}/loadCheckout`),resetCheckout:ut(`${YP}/resetCheckout`),submitCheckout:ut(`${YP}/submitCheckout`),confirmCheckout:ut(`${YP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:ut(`${YP}/errorCheckout`,(e=>({payload:e})))},zP),QP={loading:!1,error:null,cardSetupIntentSecret:null},XP=U({},oP()),{reducer:ZP,actions:eL,name:tL}=yt({name:"subscriptions/stripe",initialState:QP,reducers:XP}),nL=U({loadCustomer:ut(`${tL}/loadCustomer`),createCardSetupIntentSecret:ut(`${tL}/createCardSetupIntentSecret`)},eL),oL={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:iL,reducer:aL,name:rL}=yt({name:"subscriptions/vendorPublicConfig",initialState:oL,reducers:U({},oP())}),lL=U({loadVendorPublicConfiguration:ut(`${rL}/loadVendorPublicConfiguration`)},iL),sL={config:yP,plans:lP,checkout:KP,billing:BP,stripe:QP,vendorPublicConfig:oL},cL={config:vP,billing:jP,plans:dP,checkout:JP,stripe:nL,vendorPublicConfig:lL},uL=We({config:gP,billing:WP,plans:cP,checkout:qP,stripe:ZP,vendorPublicConfig:aL});let dL,yL,fL;function pL({policy:e}){return{policy:fL.AT_PERIOD_END}}function gL(e){switch(e){case xy.ACTIVE:return yL.ACTIVE;case xy.INCOMPLETE:return yL.INCOMPLETE;case xy.CANCELED:return yL.CANCELED;case xy.EXPIRED:return yL.EXPIRED;case xy.TRIALING:return yL.TRIALING;default:return yL.EXPIRED}}!function(e){e.STRIPE="Stripe"}(dL||(dL={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(yL||(yL={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(fL||(fL={}));const SL={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:xy.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},vL=[{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"}],hL=[{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:""}],mL=[{id:"id",externalId:"externalId",type:Vy.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],AL={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*bL(){yield Di(kP.setLoading(!0));try{const[e]=yield Fi(Yf.subscriptions.getManagedSubscriptions);yield Di(kP.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Di(kP.setError(e))}}function*TL(){yield Ua(_P.loadBillingInformation,kL)}function*kL(){yield function*(e){const t=yield xi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield xi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield EL(n,!1):yield Di(_P.setError(t?"Not authorized":"Internal feature failure"))}()}function*EL(e,t){yield Di(_P.setLoading(!0));try{var n,o;const i=yield Fi(Yf.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield Fi(Yf.subscriptions.getSubscriptionPlan,a):([,l]=yield Ni([Fi(bL),Fi(Yf.subscriptions.getSubscriptionPlan,a)]),s=yield xi((e=>e.subscriptions.billing.subscription.subscription||null))),yield Di(_P.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?yL.ACTIVE:gL(s.status),cancellation:s.cancellation&&pL(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(_P.setError(dg(e)))}}function*IL(){yield function*(){var e,t;yield Di(_P.setLoading(!0)),yield Vi(500),yield Di(_P.setState({loading:!1,fetching:!1,summary:{subscriptionId:SL.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:jy.Stripe,externallyManaged:!1,currentPlanId:vL[0].id,defaultPlanId:vL[0].id},plan:U({},vL[0],{price:null==(e=vL[0].price)?void 0:e.amount,currency:null==(t=vL[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*PL(){yield Ua(_P.loadBillingInformation,IL)}function*LL(){yield Ua(NP.loadPaymentMethod,OL),yield Ua(NP.submitPaymentMethod,wL),yield Ua(NP.submitPaymentMethodError,CL),yield Ua(NP.submitPaymentMethodSuccess,UL),yield Ua(NP.updatePaymentMethodBillingDetails,_L)}function*OL(){yield Di(NP.setLoading(!0));try{const e=(yield Fi(Yf.subscriptions.getPaymentMethods))[0];yield Di(NP.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Di(NP.setError(dg(e)))}}function*_L({payload:e}){yield Di(NP.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield Fi(Yf.subscriptions.updatePaymentMethodBillingDetails,t,U({email:n},o)),yield Fi(OL),null==i||i(!0)}catch(e){yield Di(NP.setError(dg(e))),null==i||i(!1)}yield Di(NP.setLoading(!1))}function*wL(){yield Di(NP.setLoading(!0))}function*CL({payload:e}){yield Di(NP.setError(e))}function*UL(){yield Di(NP.loadPaymentMethod())}function*RL(){yield Di(NP.setLoading(!0)),yield Vi(500);const e=mL[0];yield Di(NP.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*DL(){yield Ua(NP.loadPaymentMethod,RL)}function*NL(){yield Ua(VP.loadInvoices,ML),yield Ua(VP.downloadInvoice,FL)}function*ML(){yield Di(VP.setLoading(!0));try{const e=(yield Fi(Yf.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(VP.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Di(VP.setError(dg(e)))}}function*FL({payload:e}){yield Di(VP.setInvoiceDownloadState({loading:!0,error:null}));try{yield Fi(Yf.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Di(VP.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Di(VP.setInvoiceDownloadState({loading:!1,error:dg(e,null)}))}}function*GL(){yield Di(VP.setLoading(!0)),yield Vi(500),yield Di(VP.setState({loading:!1,fetching:!1,invoices:hL.map((e=>U({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Di(VP.setLoading(!1))}function*$L(){yield Ua(VP.loadInvoices,GL)}function*xL(){yield Ua(kP.load,VL),yield Ua(kP.cancelSubscription,BL),yield Ua(kP.renewSubscription,jL)}function*VL(){const e=yield xi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield EL(e)}function*BL(){const{subscription:e}=yield xi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Di(kP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Di(kP.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===xy.ACTIVE)try{yield Di(kP.setCancellationLoading(!0)),yield Fi(Yf.subscriptions.cancelManagedSubscription,t),yield bL(),yield Di(kP.setCancellationLoading(!1))}catch(e){yield Di(kP.setCancellationError(dg(e)))}}function*jL(){const{subscription:e}=yield xi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Di(kP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Di(kP.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===By.AT_PERIOD_END)try{yield Di(kP.setRenewalLoading(!0)),yield Fi(Yf.subscriptions.renewManagedSubscription,t),yield bL(),yield Di(kP.setRenewalLoading(!1))}catch(e){yield Di(kP.setCancellationError(dg(e)))}}function*WL(){yield Di(kP.setLoading(!0)),yield Vi(500),yield Di(kP.setState({subscription:SL,fetching:!1,loading:!1,error:null}))}function*KL(){yield Ua(kP.load,WL)}function*HL(){yield Ni([Fi(TL),Fi(LL),Fi(NL),Fi(xL)])}function*zL(){yield Ni([Fi(PL),Fi(DL),Fi($L),Fi(KL)])}function*qL(){yield Ua(JP.loadCheckout,YL),yield Ua(JP.resetCheckout,JL),yield Ua(JP.submitCheckout,QL),yield Ua(JP.confirmCheckout,XL),yield Ua(JP.errorCheckout,eO)}function*YL(){yield Di(JP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*JL(){yield Di(JP.setState({loading:!1,error:null,confirmed:!1}))}function*QL(){yield Di(JP.setState({loading:!0,error:null}))}function*XL({payload:{paymentMethodId:e,planId:t}}){const n=yield xi((e=>e.subscriptions.billing.subscription.subscription)),o=yield xi((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===xy.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield Di(JP.setState({loading:!0,error:null})),i&&a)return yield ZL(),void(yield Di(kP.setState({subscription:U({},n,{status:xy.ACTIVE})})));try{yield Fi(Yf.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Ni([kL(),OL(),ML()]),yield ZL()}catch(e){yield Di(JP.setState({loading:!1,error:dg(e)}))}}else yield Di(JP.setState({loading:!1,error:"Subscription not found"}))}function*ZL(){yield Di(JP.setState({loading:!1,error:null,confirmed:!0}))}function*eO({payload:e}){yield Di(JP.setState({loading:!1,error:e}))}function*tO(){yield Ua(JP.resetCheckout,JL)}function*nO(){yield Ua(dP.loadPlans,oO)}function*oO(){yield Di(dP.setLoading(!0));try{const e=(yield Fi(Yf.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(dP.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Di(dP.setError(dg(e)))}}function*iO(){yield Di(dP.setLoading(!0)),yield Vi(500),yield Di(dP.setState({fetching:!1,loading:!1,plans:vL.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*aO(){yield Ua(dP.loadPlans,iO)}function*rO(){yield Ua(vP.loadPaymentConfiguration,lO)}function*lO(){yield Di(vP.setLoading(!0));try{(yield Fi(Yf.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===jy.Stripe))?yield function*(){yield Di(vP.setLoading(!0));try{const e=yield Fi(Yf.subscriptions.getStripePaymentProviderConfiguration);yield Di(vP.setState({loading:!1,fetching:!1,config:{paymentProvider:dL.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Di(vP.setError(dg(e)))}}():yield Di(vP.setError("Payment provider not configured"))}catch(e){yield Di(vP.setError(dg(e)))}}function*sO(){yield Di(vP.setLoading(!0)),yield Vi(500),yield Di(vP.setState({loading:!1,fetching:!1,config:{paymentProvider:dL.STRIPE,apiKey:""}}))}function*cO(){yield Ua(vP.loadPaymentConfiguration,sO)}function*uO(){yield Ua(nL.createCardSetupIntentSecret,dO)}function*dO({payload:e}){yield Di(nL.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Fi(Yf.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Di(nL.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Di(nL.setError(dg(e)))}}function*yO(){yield Ua(lL.loadVendorPublicConfiguration,fO)}function*fO(){yield Di(lL.setLoading(!0));try{const e=yield Fi(Yf.subscriptions.getVendorPublicConfigurations);yield Di(lL.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Di(lL.setError(dg(e)))}}function*pO(){yield Di(lL.setLoading(!0)),yield Vi(500),yield Di(lL.setState({fetching:!1,loading:!1,vendorPublicConfig:AL}))}function*gO(){yield Ua(lL.loadVendorPublicConfiguration,pO)}var SO={sagas:function*(){yield Ni([Fi(HL),Fi(qL),Fi(nO),Fi(rO),Fi(uO),Fi(yO)])},mockSagas:function*(){yield Ni([Fi(zL),Fi(tO),Fi(aO),Fi(cO),Fi(gO)])},reducer:uL,actions:cL,initialState:sL,storeName:"subscriptions"},vO={sagas:function*(){yield Ua(US.loadVendorPublicInfo,RS)},storeName:Dt,initialState:_S,reducer:wS,actions:US};const{reducer:hO}=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}))}}}),mO=(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}),[BE.storeName]:U({},BE.initialState,o,null!=(c=null==i?void 0:i.auth)?c:{},{routes:U({},BE.initialState.routes,null!=(u=null==o?void 0:o.routes)?u:{},null!=(d=null==i||null==(y=i.auth)?void 0:y.routes)?d:{})}),[pI.storeName]:U({},pI.initialState,null!=(f=null==i?void 0:i.auditLogs)?f:{},{auditLogsState:U({},pI.initialState.auditLogsState,null!=(p=null==i||null==(g=i.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:U({},pI.initialState.auditsMetadataState,null!=(S=null==i||null==(v=i.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[SI]:U({},gI,null!=(h=null==i?void 0:i.audits)?h:{}),[nP.storeName]:nP.initialState,[SO.storeName]:SO.initialState,[vO.storeName]:vO.initialState},reducer:We({root:hO,[BE.storeName]:BE.reducer,[pI.storeName]:pI.reducer,[SI]:hI,[nP.storeName]:nP.reducer,[SO.storeName]:SO.reducer,[vO.storeName]:vO.reducer})});const m=function*(){yield Ni([Fi(BE.sagas),Fi(pI.sagas),Fi(_I),Fi(nP.sagas),Fi(SO.sagas),Fi(vO.sagas)])},A=function*(){yield Ni([Fi(BE.mockSagas),Fi(pI.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},AO=(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 bO=n(714),TO=n.n(bO);function kO(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function EO(e){if(e.type)return e;if("#"===e.charAt(0))return EO(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 IO(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 PO(e){if(0===e.indexOf("#"))return e;const{values:t}=EO(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 LO(e,t){return e=EO(e),t=kO(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,IO(e)}function OO(e,t){if(e=EO(e),t=kO(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 IO(e)}function _O(e,t){if(e=EO(e),t=kO(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 IO(e)}const wO=e=>{if(e)return{main:e,light:PO(_O(e,.4)),dark:PO(OO(e,.15)),hover:PO(OO(e,.15)),active:PO(OO(e,.2))}},CO=e=>{if(e)return{main:e,light:_O(e,.7),dark:OO(e,.2)}},UO=(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({},wO(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({},wO(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({},wO(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:U({},CO(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:U({},CO(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:U({},CO(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:U({},CO(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},RO={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 DO{constructor(){this._theme=RO.theme,this._themeV2=RO.themeV2,this._navigation=RO.navigation,this._localizations=RO.localizations,this._integrations=RO.integrations}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new DO;return n.set(e),DO._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=TO().all([null!=(t=RO.navigation)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=TO().all([null!=(o=RO.theme)?o:{},UO(null==e?void 0:e.theme,RO.theme)]),this._themeV2=TO().all([null!=(i=RO.themeV2)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=TO().all([null!=(r=RO.localizations)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}]),this._integrations=TO().all([null!=(s=RO.integrations)?s:{},null!=(c=null==e?void 0:e.integrations)?c:{}])}catch(e){this._navigation=RO.navigation,this._theme=RO.theme,this._themeV2=RO.themeV2,this._localizations=RO.localizations,this._integrations=RO.integrations}}}DO._instances={};var NO=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},MO=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},FO=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)}))},GO=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 $O,xO,VO,BO,jO,WO,KO,HO,zO,qO,YO;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}($O||($O={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(xO||(xO={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(VO||(VO={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(BO||(BO={})),function(e){e.Invoices="invoices"}(jO||(jO={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(WO||(WO={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(KO||(KO={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(HO||(HO={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(zO||(zO={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(qO||(qO={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(YO||(YO={}));const JO={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},QO={hidden:"hidden",edit:"edit"};var XO="6.149.0",ZO={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"},e_=function(){function e(t,n){var o,i,a=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],l=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(XO),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,i,r;return M().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Pr,a.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,a.options.metadata=null!=(n=null==r||null==(o=r.rows)||null==(i=o[0])?void 0:i.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:DO.set(a.options.metadata,a.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=a.options.authOptions)||null==(n=t.hostedLoginOptions)?void 0:n.loadUserOnFirstLoad,a.options.builderMode||"nextjs"===a.options.framework||(a.options.hostedLoginBox&&!a.options.customLoginBox&&o?a.store.dispatch({type:"auth/requestHostedLoginAuthorizeV2",payload:{shouldRedirectToLogin:!1,firstTime:!0}}):a.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(!a.options.previewMode&&!a.options.builderMode){e.next=4;break}Mr.set(ZO,a.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Fr();case 7:t=e.sent,a.options.overrideFeatureFlags&&Object.assign(t,a.options.overrideFeatureFlags),Mr.set(t,a.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){Mr.set(U({},ZO,e),a.name)},this.updateLocalizationsSetter=function(e){a.updateLocalizations=e},this.getEntitlementsFromStore=function(){var e;return null==(e=a.store.getState().auth.user)?void 0:e.entitlements};var s=NO(n),c="frontegg-app-".concat(s);this.iframeRendering=r,this.name=s,this.options=U({},t,{contextOptions:U({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=c;var u,d,y=this.options.authOptions?U({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(y.disableSilentRefresh=null==(o=this.options.authOptions)?void 0:o.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!l&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=mO({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,y,{auth:null!=(u=this.options.authOptions)?u:{},audits:null!=(d=this.options.auditsOptions)?d:{}},!1,this.options.urlStrategy);C.setInstance(s,this),this.setEntitlementsOptions(t.entitlementsOptions),this.setSessionContext({enableSessionPerTenant:null==(i=t.authOptions)?void 0:i.enableSessionPerTenant}),Na.setAppName(s)}var t,n,o,i;return w(e,[{key:"setEntitlementsOptions",value:function(e){Na.setEntitlementsOptions(U({},e))}},{key:"setSessionContext",value:function(e){Na.setSessionContext(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=DO.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;DO.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(),GO(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 AO(null==e||null==(n=e.features)?void 0:n[t],xl.MISSING_FEATURE)})(this.getEntitlementsFromStore(),e)}},{key:"getPermissionEntitlements",value:function(e){return((e,t)=>{var n;return AO(null==e||null==(n=e.permissions)?void 0:n[t],xl.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}(),t_=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}(),n_=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}(),o_=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}(),i_=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},a_=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=mO({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 e_(this.options,t,!0),DO.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,FO(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}(),r_="modern",l_=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[r_]},s_=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=mO({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 e_(this.options,t,!0,a),DO.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,FO(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 c_(e,t){return c_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c_(e,t)}function u_(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&&c_(e,t)}function d_(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 y_(e){return y_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y_(e)}function f_(){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 p_(e,t,n){return p_=f_()?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&&c_(i,n.prototype),i},p_.apply(null,arguments)}function g_(e){var t="function"==typeof Map?new Map:void 0;return g_=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 p_(e,arguments,y_(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c_(n,e)},g_(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=y_(e);if(t){var i=y_(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return d_(this,n)}}var v_=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new e_(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){u_(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=MO(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=MO(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=MO(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=MO(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=MO(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=MO(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}(g_(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={987:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createConditionEvaluator=void 0;const i=n(651),o=n(82);t.createConditionEvaluator=function(e){const t=(0,o.useSanitizer)(e.condition.op);if(!t)return()=>!1;const{isSanitized:n,sanitizedValue:a}=t(e.condition.value);if(!n||void 0===a)return()=>!1;const r=(0,i.useOperation)(e.condition.op,a);return t=>{const n=t[e.condition.attribute],{isValid:i}=void 0!==n&&r?r(n):{isValid:!1};return e.condition.negate?!i:i}}},898:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(987),t),o(n(371),t)},371:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},840:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateFeatureFlag=void 0;const i=n(380);t.evaluateFeatureFlag=function(e,t){if(!e.on)return{treatment:e.offTreatment};const n=function(e,t){var n;return null===(n=e.rules)||void 0===n?void 0:n.find((e=>(0,i.createRuleEvaluator)({rule:e})(t)===i.RuleEvaluationResultEnum.Treatable))}(e,t);return n?{treatment:n.treatment}:{treatment:e.defaultTreatment}}},95:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(840),t)},314:function(e,t,n){"use strict";t.wJ=t.tE=void 0;n(95),n(380),n(379);var i=n(535);Object.defineProperty(t,"tE",{enumerable:!0,get:function(){return i.evaluateIsEntitledToFeature}}),Object.defineProperty(t,"wJ",{enumerable:!0,get:function(){return i.evaluateIsEntitledToPermissions}})},195:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanOperationsMapper=void 0;const a=n(379),r=n(615);o(n(615),t),o(n(226),t),t.BooleanOperationsMapper={[a.OperationEnum.Is]:e=>(0,r.useIsOperation)(e)}},615:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useIsOperation=void 0,t.useIsOperation=function(e){return t=>({isValid:t===e.boolean})}},226:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanSanitizersMapper=t.singleBooleanSanitizer=void 0;const i=n(379);t.singleBooleanSanitizer=e=>{const t=void 0!==e.boolean&&(e=>"boolean"==typeof e)(e.boolean)?{boolean:e.boolean}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.BooleanSanitizersMapper={[i.OperationEnum.Is]:t.singleBooleanSanitizer}},651:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useOperation=void 0;const i=n(943),o=n(610),a=n(4),r=n(195),s={...i.StringOperationsMapper,...o.NumericOperationsMapper,...a.DateOperationsMapper,...r.BooleanOperationsMapper};t.useOperation=function(e,t){const n=s[e];return n?n(t):void 0}},82:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useSanitizer=void 0;const i=n(195),o=n(903),a=n(886),r=n(610),s={...o.StringSanitizersMapper,...r.NumericSanitizersMapper,...a.DateSanitizersMapper,...i.BooleanSanitizersMapper};t.useSanitizer=function(e){return s[e]}},4:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.DateOperationsMapper=void 0;const a=n(379),r=n(569);o(n(569),t),o(n(931),t),t.DateOperationsMapper={[a.OperationEnum.On]:e=>(0,r.useDateOnOperation)(e),[a.OperationEnum.OnOrAfter]:e=>(0,r.useDateOnOrAfterOperation)(e),[a.OperationEnum.OnOrBefore]:e=>(0,r.useDateOnOrBeforeOperation)(e),[a.OperationEnum.BetweenDate]:e=>(0,r.useDateBetweenOperation)(e)}},569:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useDateBetweenOperation=t.useDateOnOrBeforeOperation=t.useDateOnOrAfterOperation=t.useDateOnOperation=void 0,t.useDateOnOperation=function(e){return t=>({isValid:t.getTime()===e.date.getTime()})},t.useDateOnOrAfterOperation=function(e){return t=>({isValid:t.getTime()>=e.date.getTime()})},t.useDateOnOrBeforeOperation=function(e){return t=>({isValid:t.getTime()<=e.date.getTime()})},t.useDateBetweenOperation=function(e){return t=>({isValid:t.getTime()>=e.start.getTime()&&t.getTime()<=e.end.getTime()})}},886:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DateSanitizersMapper=t.sanitizeDateRange=t.sanitizeSingleDate=t.isValidDate=t.sanitizeDateValue=void 0;const i=n(379);t.sanitizeDateValue=e=>new Date(e),t.isValidDate=e=>e instanceof Date&&!isNaN(e),t.sanitizeSingleDate=e=>{const n=e.date?(0,t.sanitizeDateValue)(e.date):void 0,i=n&&(0,t.isValidDate)(n)?{date:n}:void 0;return{isSanitized:!!i,sanitizedValue:i}},t.sanitizeDateRange=e=>{const n=e.start?(0,t.sanitizeDateValue)(e.start):void 0,i=e.end?(0,t.sanitizeDateValue)(e.end):void 0,o=n&&i&&(0,t.isValidDate)(n)&&(0,t.isValidDate)(i)?{start:n,end:i}:void 0;return{isSanitized:!!o,sanitizedValue:o}},t.DateSanitizersMapper={[i.OperationEnum.On]:t.sanitizeSingleDate,[i.OperationEnum.OnOrAfter]:t.sanitizeSingleDate,[i.OperationEnum.OnOrBefore]:t.sanitizeSingleDate,[i.OperationEnum.BetweenDate]:t.sanitizeDateRange}},931:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},610:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.NumericOperationsMapper=void 0;const a=n(379),r=n(217);t.NumericOperationsMapper={[a.OperationEnum.Equal]:e=>(0,r.useEqualsOperation)(e),[a.OperationEnum.GreaterThan]:e=>(0,r.useGreaterThanOperation)(e),[a.OperationEnum.GreaterThanEqual]:e=>(0,r.useGreaterThanEqualOperation)(e),[a.OperationEnum.LesserThan]:e=>(0,r.useLesserThanOperation)(e),[a.OperationEnum.LesserThanEqual]:e=>(0,r.useLesserThanEqualOperation)(e),[a.OperationEnum.BetweenNumeric]:e=>(0,r.useBetweenNumericOperation)(e)},o(n(217),t),o(n(326),t),o(n(764),t)},217:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useBetweenNumericOperation=t.useLesserThanEqualOperation=t.useLesserThanOperation=t.useGreaterThanEqualOperation=t.useGreaterThanOperation=t.useEqualsOperation=void 0,t.useEqualsOperation=function(e){return t=>({isValid:t===e.number})},t.useGreaterThanOperation=function(e){return t=>({isValid:t>e.number})},t.useGreaterThanEqualOperation=function(e){return t=>({isValid:t>=e.number})},t.useLesserThanOperation=function(e){return t=>({isValid:t<e.number})},t.useLesserThanEqualOperation=function(e){return t=>({isValid:t<=e.number})},t.useBetweenNumericOperation=function(e){return t=>({isValid:t>=e.start&&t<=e.end})}},326:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NumericSanitizersMapper=t.sanitizeNumericRange=t.sanitizeSingleNumber=void 0;const i=n(379),o=e=>"number"==typeof e;t.sanitizeSingleNumber=e=>{const t=void 0!==e.number&&o(e.number)?{number:e.number}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.sanitizeNumericRange=e=>{const t=void 0!==e.start&&void 0!==e.end&&o(e.start)&&o(e.end)?{start:e.start,end:e.end}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.NumericSanitizersMapper={[i.OperationEnum.Equal]:t.sanitizeSingleNumber,[i.OperationEnum.GreaterThan]:t.sanitizeSingleNumber,[i.OperationEnum.GreaterThanEqual]:t.sanitizeSingleNumber,[i.OperationEnum.LesserThan]:t.sanitizeSingleNumber,[i.OperationEnum.LesserThanEqual]:t.sanitizeSingleNumber,[i.OperationEnum.BetweenNumeric]:t.sanitizeNumericRange}},764:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},943:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.StringOperationsMapper=void 0;const a=n(379),r=n(431);o(n(431),t),o(n(97),t),t.StringOperationsMapper={[a.OperationEnum.StartsWith]:e=>(0,r.useStartsWithOperation)(e),[a.OperationEnum.EndsWith]:e=>(0,r.useEndsWithOperation)(e),[a.OperationEnum.Contains]:e=>(0,r.useContainsOperation)(e),[a.OperationEnum.InList]:e=>(0,r.useInListOperation)(e),[a.OperationEnum.Matches]:e=>(0,r.useMatchesOperation)(e)}},431:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useMatchesOperation=t.useInListOperation=t.useContainsOperation=t.useEndsWithOperation=t.useStartsWithOperation=void 0,t.useStartsWithOperation=function(e){return t=>({isValid:e.list.some((e=>t.startsWith(e)))})},t.useEndsWithOperation=function(e){return t=>({isValid:e.list.some((e=>t.endsWith(e)))})},t.useContainsOperation=function(e){return t=>({isValid:e.list.some((e=>t.includes(e)))})},t.useInListOperation=function(e){return t=>({isValid:e.list.includes(t)})},t.useMatchesOperation=function(e){return t=>{let n;try{n=new RegExp(e.string)}catch(e){return{isValid:!1}}return{isValid:n.test(t)}}}},903:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringSanitizersMapper=t.sanitizeListString=t.sanitizeSingleString=void 0;const i=n(379),o=e=>"string"==typeof e;t.sanitizeSingleString=e=>{const t=void 0!==e.string&&o(e.string)?{string:e.string}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.sanitizeListString=e=>{const t=void 0!==e.list&&e.list.every((e=>o(e)))?{list:e.list}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.StringSanitizersMapper={[i.OperationEnum.Matches]:t.sanitizeSingleString,[i.OperationEnum.Contains]:t.sanitizeListString,[i.OperationEnum.StartsWith]:t.sanitizeListString,[i.OperationEnum.EndsWith]:t.sanitizeListString,[i.OperationEnum.InList]:t.sanitizeListString}},97:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},379:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(982),t)},982:function(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.OperationEnum=void 0,(n=t.OperationEnum||(t.OperationEnum={})).InList="in_list",n.StartsWith="starts_with",n.EndsWith="ends_with",n.Contains="contains",n.Matches="matches",n.Equal="equal",n.GreaterThan="greater_than",n.GreaterThanEqual="greater_than_equal",n.LesserThan="lower_than",n.LesserThanEqual="lower_than_equal",n.BetweenNumeric="between_numeric",n.Is="is",n.On="on",n.BetweenDate="between_date",n.OnOrAfter="on_or_after",n.OnOrBefore="on_or_before"},380:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(930),t),o(n(304),t)},304:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createRuleEvaluator=void 0;const i=n(930),o=n(898);t.createRuleEvaluator=function(e){return t=>e.rule.conditions.every((e=>(0,o.createConditionEvaluator)({condition:e})(t)))?i.RuleEvaluationResultEnum.Treatable:i.RuleEvaluationResultEnum.Insufficient}},930:function(e,t){"use strict";var n,i;Object.defineProperty(t,"__esModule",{value:!0}),t.RuleEvaluationResultEnum=t.TreatmentEnum=t.ConditionLogicEnum=void 0,(t.ConditionLogicEnum||(t.ConditionLogicEnum={})).And="and",(i=t.TreatmentEnum||(t.TreatmentEnum={})).True="true",i.False="false",(n=t.RuleEvaluationResultEnum||(t.RuleEvaluationResultEnum={})).Treatable="treatable",n.Insufficient="insufficient"},950:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.modifyObjectKeysWithPrefix=t.defaultFronteggAttributesMapper=t.prepareAttributes=void 0;const i=n(137);function o(e){return{email:e.email,emailVerified:e.email_verified,tenantId:e.tenantId,userId:e.userId}}function a(e,t){return Object.keys(e).reduce(((n,i)=>(n[`${t}${i}`]=e[i],n)),{})}t.prepareAttributes=function(e={},t){const{custom:n={},jwt:r={}}=e,s=(0,i.flatten)(r);return{...n,...a(t?t(r):o(r),"frontegg."),...a(s,"jwt.")}},t.defaultFronteggAttributesMapper=o,t.modifyObjectKeysWithPrefix=a},137:function(e,t){"use strict";function n(e){return e}Object.defineProperty(t,"__esModule",{value:!0}),t.flatten=void 0,t.flatten=function(e,t){const i=(null==(t=t||{})?void 0:t.delimiter)||".",o=null==t?void 0:t.maxDepth,a=(null==t?void 0:t.transformKey)||n,r={};return function e(n,s,l){l=l||1,Object.keys(n).forEach((function(c){const u=n[c],d=(null==t?void 0:t.safe)&&Array.isArray(u),y=Object.prototype.toString.call(u),f=(p=u)&&p.constructor&&"function"==typeof p.constructor.isBuffer&&p.constructor.isBuffer(p);var p;const g="[object Object]"===y||"[object Array]"===y,S=s?s+i+a(c):a(c);if(!d&&!f&&g&&Object.keys(u).length&&(!(null==t?void 0:t.maxDepth)||o&&l<o))return e(u,S,l+1);r[S]=u}))}(e),r}},535:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(405),t),o(n(113),t),o(n(950),t)},405:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateIsEntitledToPermissions=t.evaluateIsEntitledToFeature=void 0;const i=n(113),o=n(95),a=n(950),r=n(380);function s(e,t,n={}){const s=t.features[e];let l=!1;if(s&&null!==s.expireTime&&(l=s.expireTime!==i.NO_EXPIRATION_TIME&&s.expireTime<Date.now(),!l))return{isEntitled:!0};if(s&&s.featureFlag){const e=(0,a.prepareAttributes)(n),{treatment:t}=(0,o.evaluateFeatureFlag)(s.featureFlag,e);if(t===r.TreatmentEnum.True)return{isEntitled:!0}}return{isEntitled:!1,justification:l?i.NotEntitledJustification.BUNDLE_EXPIRED:i.NotEntitledJustification.MISSING_FEATURE}}t.evaluateIsEntitledToFeature=s,t.evaluateIsEntitledToPermissions=function(e,t,n){if(!t.permissions[e])return{isEntitled:!1,justification:i.NotEntitledJustification.MISSING_PERMISSION};const o=function(e,t){return Object.keys(t.features).filter((n=>t.features[n].linkedPermissions.includes(e)))}(e,t);if(!o.length)return{isEntitled:!0};let a=!1;for(const e of o){const{isEntitled:o,justification:r}=s(e,t,n);if(o)return{isEntitled:!0};r===i.NotEntitledJustification.BUNDLE_EXPIRED&&(a=!0)}return{isEntitled:!1,justification:a?i.NotEntitledJustification.BUNDLE_EXPIRED:i.NotEntitledJustification.MISSING_FEATURE}}},113:function(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.NO_EXPIRATION_TIME=t.NotEntitledJustification=void 0,(n=t.NotEntitledJustification||(t.NotEntitledJustification={})).MISSING_FEATURE="MISSING_FEATURE",n.MISSING_PERMISSION="MISSING_PERMISSION",n.BUNDLE_EXPIRED="BUNDLE_EXPIRED",t.NO_EXPIRATION_TIME=-1},714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function s(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||o,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?l.arrayMerge(e,n,l):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,l):i(n,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})};var l=s;e.exports=l},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 i,o,a;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(o=i;0!=o--;)if(!e(t[o],n[o]))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((i=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=i;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,a[o]))return!1;for(o=i;0!=o--;){var r=a[o];if(!e(t[r],n[r]))return!1}return!0}return t!=t&&n!=n}},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.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,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),s=new _(i||[]);return r(a,"_invoke",{value:k(e,n,s)}),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,l,(function(){return this}));var m=Object.getPrototypeOf,A=m&&m(m(L([])));A&&A!==n&&a.call(A,l)&&(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 E(e,t){function n(o,r,s,l){var c=f(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var o;r(this,"_invoke",{value:function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}})}function k(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var s=O(r,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=f(e,t,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function O(e,t){var n=t.method,i=e.iterator[n];if(void 0===i)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,O(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var o=f(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,p;var a=o.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 I(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 P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function L(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next: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(E.prototype),d(E.prototype,c,(function(){return this})),t.AsyncIterator=E,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new E(y(e,n,i,o),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,l,(function(){return this})),d(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=L,_.prototype={constructor:_,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(P),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=a.call(o,"catchLoc"),l=a.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,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),P(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 i=n.completion;if("throw"===i.type){var o=i.arg;P(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:L(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i].call(a.exports,a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return rL},AdminPortalRenderer:function(){return cL},AppHolder:function(){return C},CheckoutDialog:function(){return sL},FronteggApp:function(){return oL},HostedLogin:function(){return aL},LoginBoxRenderer:function(){return yL},createElement:function(){return V_},defaultTheme:function(){return uL},formatName:function(){return $_},getThemeAdminByName:function(){return lL},getThemeByName:function(){return dL},initialize:function(){return bL},mockFlagsList:function(){return iL},restoreSearchParams:function(){return j_},waitThemeSetter:function(){return x_}});var e={};n.r(e),n.d(e,{Delete:function(){return Ur},Get:function(){return _r},Patch:function(){return wr},Post:function(){return Lr},PostDownload:function(){return Dr},Put:function(){return Cr},extractHeadersFromOptions:function(){return Rr},getBaseUrl:function(){return Or},getMetadataHeaders:function(){return Ir}});var t={};n.r(t),n.d(t,{FeatureFlags:function(){return Gr},loadFeatureFlags:function(){return $r}});var o={};n.r(o),n.d(o,{GetUserJwt:function(){return Vr},getCurrentUserTenantsV1:function(){return Kr},getCurrentUserTenantsV3:function(){return zr},getUsersGroups:function(){return Wr},getUsersRoles:function(){return Br},getUsersV2:function(){return xr},getUsersV3:function(){return jr},sendResetBreachedPasswordEmails:function(){return qr},updateUserProfileV2:function(){return Hr}});var a={};n.r(a),n.d(a,{getHierarchyMetadata:function(){return rs},getParentTenants:function(){return ns},getParentTenantsById:function(){return is},getSubTenants:function(){return es},getSubTenantsAsTree:function(){return ts},getTenants:function(){return Zr},getTenantsUsersCount:function(){return os},searchSubTenants:function(){return as},switchTenant:function(){return Xr}});var r={};n.r(r),n.d(r,{loadEntitlements:function(){return Vs},loadEntitlementsV2:function(){return xs}});var s={};n.r(s),n.d(s,{AuthStrategyEnum:function(){return ki},MachineToMachineAuthStrategy:function(){return Oi},OAuthLogout:function(){return hl},SocialLoginProviders:function(){return Ei},acceptInvitation:function(){return fl},activateAccount:function(){return ll},activateAccountV2:function(){return cl},bulkCreateIPRestriction:function(){return Ps},changePhoneNumber:function(){return bu},changePhoneNumberWithVerification:function(){return mu},checkIfAllowToRememberMfaDevice:function(){return Bc},createDomainRestriction:function(){return bs},createIPRestriction:function(){return Is},createOrUpdateSessionConfigrations:function(){return Pc},createSSOConfiguration:function(){return Jc},createSSOConfigurationByMetadata:function(){return Xc},createSSOConfigurationByMetadataUrl:function(){return eu},createSSODomain:function(){return nu},createSSOGroup:function(){return su},createSamlGroup:function(){return dc},createTenantAccessToken:function(){return Nc},createUserAccessToken:function(){return Rc},deleteAllSessionsForUser:function(){return Lc},deleteDomainRestriction:function(){return Es},deleteIPRestriction:function(){return Ls},deleteSSOConfiguration:function(){return Qc},deleteSSODomain:function(){return iu},deleteSSOGroup:function(){return cu},deleteSamlGroup:function(){return fc},deleteSessionForUser:function(){return _c},deleteTenantAccessToken:function(){return Uc},deleteTenantApiToken:function(){return Vc},deleteUserAccessToken:function(){return Dc},deleteUserApiToken:function(){return xc},deleteWebAuthnDevice:function(){return Pu},disableMFAAuthenticatorApp:function(){return Ul},disableMFASMS:function(){return Rl},disableMFAWebAuthn:function(){return Ml},disableMfa:function(){return Cl},enrollMFAAuthenticatorApp:function(){return Ol},enrollMFAAuthenticatorAppForLogin:function(){return $l},enrollMFAAuthenticatorAppForLoginV2:function(){return Vl},enrollMFASMS:function(){return Pl},enrollMFASMSForLogin:function(){return Kl},enrollMFASMSForLoginV2:function(){return ql},enrollMFAWebAuthn:function(){return Ll},enrollMFAWebAuthnForLogin:function(){return Xl},enrollMFAWebAuthnForLoginV2:function(){return Zl},enrollMfa:function(){return El},exchangeOAuthTokens:function(){return gu},exchangeOAuthTokensV2:function(){return fu},forgotPassword:function(){return ml},generateLoginResponse:function(){return qs},generateLoginResponseFromOAuthResponse:function(){return Xs},generateLoginResponseFromOAuthResponseV2:function(){return Zs},generateLoginResponseV2:function(){return Hs},generateLoginResponseV3:function(){return Qs},getActivateAccountStrategy:function(){return ul},getCaptchaPolicy:function(){return ps},getCurrentUserSession:function(){return kc},getCurrentUserSessions:function(){return Ec},getCurrentUserTenantsFunction:function(){return Qr},getCustomSocialLoginProvidersV1:function(){return mc},getDomainRestrictions:function(){return ms},getDomainRestrictionsConfig:function(){return As},getGlobalSecurityPolicy:function(){return ss},getIPRestrictions:function(){return ks},getIPRestrictionsConfig:function(){return Os},getLockoutPolicy:function(){return ds},getMFADevices:function(){return Fl},getMFAStrategiesConfig:function(){return Cu},getMeAndEntitlements:function(){return Ru},getMeV2:function(){return Du},getMfaPolicy:function(){return ls},getOidcConfiguration:function(){return pc},getPasswordConfigPolicy:function(){return hs},getPasswordHistoryPolicy:function(){return gs},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return wu},getSSOConfigurations:function(){return Hc},getSSODefaultRoles:function(){return au},getSSOGroups:function(){return uu},getSSOPublicConfiguration:function(){return gc},getSamlConfiguration:function(){return ic},getSamlRoles:function(){return lc},getSamlRolesGroups:function(){return cc},getSamlVendorConfiguration:function(){return ac},getSessionConfigurations:function(){return Ic},getSocialLoginProviders:function(){return Sc},getSocialLoginProvidersV2:function(){return vc},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return hc},getTabTenantFromSessionStorage:function(){return Yr},getTenantAccessTokensData:function(){return Cc},getTenantApiTokensData:function(){return Fc},getUserAccessTokensData:function(){return wc},getUserApiTokensData:function(){return Mc},getUserAuthorization:function(){return Uu},getUserById:function(){return jc},getVendorConfig:function(){return bc},getVendorLockoutPolicy:function(){return ys},getVendorMfaPolicy:function(){return cs},getVendorPasswordHistoryPolicy:function(){return Ss},getVendorPublicAuthStrategiesConfig:function(){return Lu},getWebAuthnDevices:function(){return Iu},loadPasswordConfig:function(){return bl},login:function(){return ol},loginViaSocialLogin:function(){return Ac},loginWithMfa:function(){return rl},loginWithMfaV2:function(){return sl},loginv2:function(){return al},logout:function(){return vl},oidcPostLogin:function(){return il},oidcPostLoginV2:function(){return yu},passwordlessPostLogin:function(){return Kc},passwordlessPostLoginV2:function(){return zc},passwordlessPreLogin:function(){return Wc},postLogin:function(){return nl},preDisableMFASMS:function(){return Dl},preDisableMFAWebAuthn:function(){return Nl},preEnrollMFAAuthenticatorApp:function(){return kl},preEnrollMFAAuthenticatorAppForLogin:function(){return Gl},preEnrollMFASMS:function(){return Il},preEnrollMFASMSForLogin:function(){return zl},preEnrollMFAWebAuthn:function(){return _l},preEnrollMFAWebAuthnForLogin:function(){return Ql},preLogin:function(){return el},preLoginV2:function(){return du},preLoginWithIdpType:function(){return tl},preVerifyMFAEmailCode:function(){return jl},preVerifyMFASMSForLogin:function(){return Hl},preVerifyMFAWebAuthnForLogin:function(){return ec},recoverMfaToken:function(){return Tl},refreshToken:function(){return pl},refreshTokenV2:function(){return gl},refreshTokenV3:function(){return Sl},resendActivationEmail:function(){return dl},resendInvitationEmail:function(){return yl},resetPassword:function(){return Al},resetPhoneNumber:function(){return vu},revokeSessionsForUser:function(){return Oc},saveLockoutPolicy:function(){return fs},saveMfaPolicy:function(){return us},savePasswordHistoryPolicy:function(){return vs},setSSODefaultRoles:function(){return ru},setTabTenantInSessionStorage:function(){return Jr},signUpUser:function(){return Tc},silentOAuthRefreshToken:function(){return Su},silentOAuthRefreshTokenV2:function(){return pu},testCurrentIp:function(){return ws},testCurrentIpInAllowList:function(){return Cs},updateDomainRestrictionConfig:function(){return Ts},updateIPRestrictionConfig:function(){return _s},updateSSOConfiguration:function(){return Yc},updateSSOConfigurationByMetadata:function(){return Zc},updateSSOConfigurationByMetadataUrl:function(){return tu},updateSSOGroup:function(){return lu},updateSamlConfiguration:function(){return oc},updateSamlGroup:function(){return yc},updateSamlRoles:function(){return uc},updateSamlVendorMetadata:function(){return rc},updateTenantApiTokensData:function(){return $c},updateUserApiTokensData:function(){return Gc},validateSSODomain:function(){return ou},validateSamlDomain:function(){return sc},verifyChangePhoneNumber:function(){return Au},verifyInviteToken:function(){return qc},verifyMFAAuthenticatorAppForLogin:function(){return xl},verifyMFAEmailCode:function(){return Bl},verifyMFAEmailCodeV2:function(){return Wl},verifyMFASMSForLogin:function(){return Jl},verifyMFASMSForLoginV2:function(){return Yl},verifyMFAWebAuthnForLogin:function(){return tc},verifyMFAWebAuthnForLoginV2:function(){return nc},verifyMfa:function(){return wl},verifyNewDeviceSession:function(){return _u},verifyResetPhoneNumber:function(){return hu},webAuthnCreateNewDeviceSession:function(){return Ou},webAuthnPostLogin:function(){return Eu},webAuthnPostLoginV2:function(){return ku},webAuthnPreLogin:function(){return Tu}});var l={};n.r(l),n.d(l,{addUser:function(){return Vu},changePassword:function(){return Gu},createInviteUserLink:function(){return Bu},deleteInviteUserLink:function(){return zu},deleteUser:function(){return xu},getInviteLinkConfiguration:function(){return qu},getInviteUserLink:function(){return Ku},getProfile:function(){return Nu},loadAvailablePermissions:function(){return Ju},loadAvailableRoles:function(){return Hu},loadStats:function(){return Yu},loadUsers:function(){return $u},resendActivationLink:function(){return Qu},resendInvitationLink:function(){return Xu},resendInvitationLinkToAllTenants:function(){return Zu},updateInviteUserLink:function(){return Wu},updateProfile:function(){return Mu},updateProfileImage:function(){return Fu},updateUser:function(){return ju}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return td},getAuditsMetadata:function(){return rd},getCurrentUserIpMetadata:function(){return id},getIpAdressMetadata:function(){return sd},getNotificationsMetadata:function(){return od},getSamlMetadata:function(){return ad},updateAdminBoxMetadata:function(){return nd}});var u={};n.r(u),n.d(u,{downloadReport:function(){return gd},getReport:function(){return yd},getReports:function(){return dd},renderReport:function(){return fd},scheduleReport:function(){return pd},sendReport:function(){return Sd}});var d={};n.r(d),n.d(d,{getNotifications:function(){return vd},markAllAsRead:function(){return Ad},updateNotificationIsPinned:function(){return md},updateNotificationStatus:function(){return hd}});var y={};n.r(y),n.d(y,{exportAudits:function(){return kd},getAudits:function(){return Td},getAuditsStats:function(){return Ed}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return Gd},deleteEmailSubscriptions:function(){return Md},deleteSMSConfiguration:function(){return Wd},deleteSMSSubscriptions:function(){return jd},deleteSlackConfiguration:function(){return Cd},deleteWebhooksConfiguration:function(){return qd},getCategories:function(){return Qd},getChannelMaps:function(){return Xd},getEmailConfiguration:function(){return Dd},getSMSConfiguration:function(){return $d},getSlackChannels:function(){return Ld},getSlackConfiguration:function(){return Pd},getSlackScope:function(){return _d},getWebhookLog:function(){return Hd},getWebhooksConfigurations:function(){return zd},patchEmailConfiguration:function(){return Nd},patchSMSConfiguration:function(){return xd},postEmailConfiguration:function(){return Rd},postSMSConfiguration:function(){return Vd},postSlackCode:function(){return Ud},postSlackConfiguration:function(){return wd},postWebhookRetry:function(){return Yd},postWebhookTest:function(){return Jd},postWebhooksConfiguration:function(){return Kd},putEmailSubscriptions:function(){return Fd},putSMSSubscriptions:function(){return Bd}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return ty},getSettings:function(){return ey},updateSettings:function(){return Zd}});var g={};n.r(g),n.d(g,{addRole:function(){return ry},attachPermissionToRoles:function(){return dy},attachPermissionsToRole:function(){return cy},deleteRole:function(){return sy},getPermissionCategories:function(){return yy},getPermissions:function(){return uy},getRoles:function(){return ay},updateRole:function(){return ly}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return Wy},ISubscriptionStatus:function(){return jy},PaymentMethodType:function(){return By},ProviderType:function(){return zy},TenantCreatedAction:function(){return qy},TrialEndAction:function(){return Ky},cancelManagedSubscription:function(){return Ay},cancelSubscription:function(){return gy},createStripeCustomer:function(){return Ry},createStripePaymentMethodSetupIntentSecret:function(){return My},createSubscription:function(){return Uy},createTenantConfiguration:function(){return $y},getManagedSubscription:function(){return hy},getManagedSubscriptions:function(){return my},getPaymentMethod:function(){return wy},getPaymentMethods:function(){return Ly},getPaymentProviders:function(){return Vy},getStripeCustomer:function(){return Dy},getStripePaymentProviderConfiguration:function(){return Ny},getSubscription:function(){return py},getSubscriptionInvoice:function(){return Iy},getSubscriptionInvoicePdf:function(){return Py},getSubscriptionInvoices:function(){return Oy},getSubscriptionPlan:function(){return ky},getSubscriptionPlans:function(){return Ey},getSubscriptionSummaries:function(){return Fy},getSubscriptions:function(){return fy},getTenantConfiguration:function(){return Gy},getVendorPublicConfigurations:function(){return xy},renewManagedSubscription:function(){return by},renewSubscription:function(){return Sy},updateManagedSubscription:function(){return Ty},updatePaymentMethodBillingDetails:function(){return Cy},updateSubscription:function(){return vy}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return Hy}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return Xy},addUserToTenantAndSubTenants:function(){return Yy},addUsersToSubTenant:function(){return rf},createSubTenant:function(){return tf},deleteSubTenant:function(){return nf},loadAllUsers:function(){return Jy},removeUserFromTenantAndSubTenants:function(){return Qy},removeUserRolesFromSubTenants:function(){return Zy},setUserRolesForSubTenants:function(){return ef},updateSubAccountAccess:function(){return af},updateSubTenant:function(){return of}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return df},createConfiguration:function(){return cf},deleteConfiguration:function(){return uf},getConfigs:function(){return sf},updateConfiguration:function(){return lf}});var A={};n.r(A),n.d(A,{impersonate:function(){return yf}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return Af},addUsersToGroup:function(){return Tf},createGroup:function(){return vf},deleteGroup:function(){return mf},deleteRolesFromGroup:function(){return bf},deleteUsersFromGroup:function(){return Ef},getGroupById:function(){return pf},getGroupConfiguration:function(){return kf},getGroups:function(){return gf},getGroupsByIds:function(){return Sf},updateGroup:function(){return hf},updateGroupConfiguration:function(){return Of}});var T={};n.r(T),n.d(T,{getInsights:function(){return Pf},getRecommendations:function(){return If}});var E={};n.r(E),n.d(E,{createPhoneNumber:function(){return Lf},deletePhoneNumber:function(){return wf},getUserPhoneNumbers:function(){return _f},preVerifyPhoneNumber:function(){return Cf},verifyDeletePhoneNumber:function(){return Df},verifyPhoneNumber:function(){return Uf}});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return Bs},AuthStrategyEnum:function(){return ki},ContextHolder:function(){return Fa},FeatureFlags:function(){return Gr},FronteggApiError:function(){return $a},FronteggContext:function(){return Ga},FronteggFrameworks:function(){return ui},GetUsersFilterPreset:function(){return fi},GroupManagedByEnum:function(){return zf},GroupRelations:function(){return Wf},ISubscriptionCancellationPolicy:function(){return Wy},ISubscriptionStatus:function(){return jy},InsightCode:function(){return qf},LOAD_AUTHORIZATION_FF:function(){return $s},MFAStrategyEnum:function(){return Gs},MachineToMachineAuthStrategy:function(){return Oi},NotEntitledJustification:function(){return js},PaginationOrderEnum:function(){return di},PaymentMethodType:function(){return By},ProviderType:function(){return zy},RecommendationActionKey:function(){return Hf},RecommendationCode:function(){return Kf},RecommendationSeverity:function(){return Jf},RequestSource:function(){return ci},RestrictionType:function(){return Wn},ScimConnectionSource:function(){return Bf},SecondaryAuthStrategy:function(){return Ms},SecurityCategory:function(){return Yf},SocialLoginProviders:function(){return Ei},SortByEnum:function(){return yi},TenantSortByEnum:function(){return Nf},TenantType:function(){return Mf},USE_ENTITLEMENTS_V2_ENDPOINT_FF:function(){return Mr},UserManagedByEnum:function(){return Rf},WebAuthnDeviceType:function(){return Fs},api:function(){return Qf},countConfigurationUsers:function(){return df},createConfiguration:function(){return cf},default:function(){return Xf},deleteConfiguration:function(){return uf},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Ff},fronteggHeaders:function(){return li},fronteggRefreshTokenUrl:function(){return Gf},fronteggSilentRefreshTokenUrl:function(){return $f},fronteggTenantsUrl:function(){return xf},fronteggTenantsV3Url:function(){return jf},fronteggUsersUrl:function(){return Vf},getConfigs:function(){return sf},getCurrentUserTenantsFunction:function(){return Qr},getTabTenantFromSessionStorage:function(){return Yr},loadFeatureFlags:function(){return $r},providersArray:function(){return pi},setTabTenantInSessionStorage:function(){return Jr},updateConfiguration:function(){return lf}});var O={};function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e){return P="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},P(e)}function _(e){var t=function(e,t){if("object"!==P(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==P(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===P(t)?t:String(t)}function L(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,_(i.key),i)}}function w(e,t,n){return t&&L(e.prototype,t),n&&L(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(O),n.d(O,{AccountDetailsPageTabs:function(){return Z_},AccountPageFields:function(){return K_},DomainRestrictionsTabFields:function(){return X_},GeneralSettingsTabFields:function(){return Y_},InviteUserModalFields:function(){return z_},IpRestrictionsTabFields:function(){return Q_},Metadata:function(){return G_},PrivacyPageFields:function(){return W_},ProfilePageFields:function(){return B_},SecurityPageTabs:function(){return H_},SessionManagementTabFields:function(){return J_},SubscriptionsPageFields:function(){return q_},alpha:function(){return C_},fieldAppearance:function(){return eL},tabAppearance:function(){return tL}});var C=function(){function e(){I(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(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,o,a,r,s=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=a.call(n)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return U(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?U(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(){return R=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},R.apply(this,arguments)}function N(e,t,n,i,o,a,r){try{var s=e[a](r),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,o)}function M(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){N(a,i,o,r,s,"next",e)}function s(e){N(a,i,o,r,s,"throw",e)}r(void 0)}))}}C._apps={};var F=n(841),G=n.n(F);function $(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function V(e){return!!e&&!!e[Ie]}function x(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)===Pe}(e)||Array.isArray(e)||!!e[Oe]||!!e.constructor[Oe]||q(e)||H(e))}function j(e,t,n){void 0===n&&(n=!1),0===B(e)?(n?Object.keys:_e)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function B(e){var t=e[Ie];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:q(e)?2:H(e)?3:0}function W(e,t){return 2===B(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function z(e,t,n){var i=B(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function K(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function q(e){return be&&e instanceof Map}function H(e){return Te&&e instanceof Set}function J(e){return e.o||e.t}function Y(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Le(e);delete t[Ie];for(var n=_e(t),i=0;i<n.length;i++){var o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function Q(e,t){return void 0===t&&(t=!1),Z(e)||V(e)||!x(e)||(B(e)>1&&(e.set=e.add=e.clear=e.delete=X),Object.freeze(e),t&&j(e,(function(e,t){return Q(t,!0)}),!0)),e}function X(){$(2)}function Z(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function ee(e){var t=we[e];return t||$(18,e),t}function te(){return me}function ne(e,t){t&&(ee("Patches"),e.u=[],e.s=[],e.v=t)}function ie(e){oe(e),e.p.forEach(re),e.p=null}function oe(e){e===me&&(me=e.l)}function ae(e){return me={p:[],l:me,h:e,m:!0,_:0}}function re(e){var t=e[Ie];0===t.i||1===t.i?t.j():t.O=!0}function se(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||ee("ES5").S(t,e,i),i?(n[Ie].P&&(ie(t),$(4)),x(e)&&(e=le(t,e),t.l||ue(t,e)),t.u&&ee("Patches").M(n[Ie].t,e,t.u,t.s)):e=le(t,n,[]),ie(t),t.u&&t.v(t.u,t.s),e!==ke?e:void 0}function le(e,t,n){if(Z(t))return t;var i=t[Ie];if(!i)return j(t,(function(o,a){return ce(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return ue(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=Y(i.k):i.o;j(3===i.i?new Set(o):o,(function(t,a){return ce(e,i,o,t,a,n)})),ue(e,o,!1),n&&e.u&&ee("Patches").R(i,n,e.u,e.s)}return i.o}function ce(e,t,n,i,o,a){if(V(o)){var r=le(e,o,a&&t&&3!==t.i&&!W(t.D,i)?a.concat(i):void 0);if(z(n,i,r),!V(r))return;e.m=!1}if(x(o)&&!Z(o)){if(!e.h.F&&e._<1)return;le(e,o),t&&t.A.l||ue(e,o)}}function ue(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&Q(t,n)}function de(e,t){var n=e[Ie];return(n?J(n):e)[t]}function ye(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=Object.getPrototypeOf(n)}}function fe(e){e.P||(e.P=!0,e.l&&fe(e.l))}function pe(e){e.o||(e.o=Y(e.t))}function ge(e,t,n){var i=q(t)?ee("MapSet").N(t,n):H(t)?ee("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:te(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Ce;n&&(o=[i],a=Ue);var r=Proxy.revocable(o,a),s=r.revoke,l=r.proxy;return i.k=l,i.j=s,l}(t,n):ee("ES5").J(t,n);return(n?n.A:te()).p.push(i),i}function Se(e){return V(e)||$(22,e),function e(t){if(!x(t))return t;var n,i=t[Ie],o=B(t);if(i){if(!i.P&&(i.i<4||!ee("ES5").K(i)))return i.t;i.I=!0,n=ve(t,o),i.I=!1}else n=ve(t,o);return j(n,(function(t,o){i&&function(e,t){return 2===B(e)?e.get(t):e[t]}(i.t,t)===o||z(n,t,e(o))})),3===o?new Set(n):n}(e)}function ve(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Y(e)}var he,me,Ae="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),be="undefined"!=typeof Map,Te="undefined"!=typeof Set,Ee="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,ke=Ae?Symbol.for("immer-nothing"):((he={})["immer-nothing"]=!0,he),Oe=Ae?Symbol.for("immer-draftable"):"__$immer_draftable",Ie=Ae?Symbol.for("immer-state"):"__$immer_state",Pe=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),_e="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 _e(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},we={},Ce={get:function(e,t){if(t===Ie)return e;var n=J(e);if(!W(n,t))return function(e,t,n){var i,o=ye(t,n);return o?"value"in o?o.value:null===(i=o.get)||void 0===i?void 0:i.call(e.k):void 0}(e,n,t);var i=n[t];return e.I||!x(i)?i:i===de(e.t,t)?(pe(e),e.o[t]=ge(e.A.h,i,e)):i},has:function(e,t){return t in J(e)},ownKeys:function(e){return Reflect.ownKeys(J(e))},set:function(e,t,n){var i=ye(J(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=de(J(e),t),a=null==o?void 0:o[Ie];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(K(n,o)&&(void 0!==n||W(e.t,t)))return!0;pe(e),fe(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!==de(e.t,t)||t in e.t?(e.D[t]=!1,pe(e),fe(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=J(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){$(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){$(12)}},Ue={};j(Ce,(function(e,t){Ue[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ue.deleteProperty=function(e,t){return Ue.set.call(this,e,t,void 0)},Ue.set=function(e,t,n){return Ce.set.call(this,e[0],t,n,e[0])};var De=function(){function e(e){var t=this;this.g=Ee,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&$(6),void 0!==i&&"function"!=typeof i&&$(7),x(e)){var s=ae(t),l=ge(t,e,void 0),c=!0;try{r=n(l),c=!1}finally{c?ie(s):oe(s)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return ne(s,i),se(e,s)}),(function(e){throw ie(s),e})):(ne(s,i),se(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===ke&&(r=void 0),t.F&&Q(r,!0),i){var u=[],d=[];ee("Patches").M(e,r,u,d),i(u,d)}return r}$(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){x(e)||$(8),V(e)&&(e=Se(e));var t=ae(this),n=ge(this,e,void 0);return n[Ie].C=!0,oe(t),n},t.finishDraft=function(e,t){var n=(e&&e[Ie]).A;return ne(n,t),se(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Ee&&$(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=ee("Patches").$;return V(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Re=new De,Ne=Re.produce,Me=(Re.produceWithPatches.bind(Re),Re.setAutoFreeze.bind(Re),Re.setUseProxies.bind(Re),Re.applyPatches.bind(Re),Re.createDraft.bind(Re),Re.finishDraft.bind(Re),Ne);function Fe(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function $e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach((function(t){Fe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ve(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 xe="function"==typeof Symbol&&Symbol.observable||"@@observable",je=function(){return Math.random().toString(36).substring(7).split("").join(".")},Be={INIT:"@@redux/INIT"+je(),REPLACE:"@@redux/REPLACE"+je(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+je()}};function We(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 ze(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ve(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ve(1));return n(ze)(e,t)}if("function"!=typeof e)throw new Error(Ve(2));var o=e,a=t,r=[],s=r,l=!1;function c(){s===r&&(s=r.slice())}function u(){if(l)throw new Error(Ve(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ve(4));if(l)throw new Error(Ve(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(Ve(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!We(e))throw new Error(Ve(7));if(void 0===e.type)throw new Error(Ve(8));if(l)throw new Error(Ve(9));try{l=!0,a=o(a,e)}finally{l=!1}for(var t=r=s,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(Ve(10));o=e,y({type:Be.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ve(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[xe]=function(){return this},e}return y({type:Be.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[xe]=p,i}function Ke(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Be.INIT}))throw new Error(Ve(12));if(void 0===n(void 0,{type:Be.PROBE_UNKNOWN_ACTION()}))throw new Error(Ve(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},s=0;s<r.length;s++){var l=r[s],c=n[l],u=e[l],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(Ve(14));o[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function qe(){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),i=function(){throw new Error(Ve(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=qe.apply(void 0,a)(n.dispatch),$e($e({},n),{},{dispatch:i})}}}function Je(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var Ye=Je();Ye.withExtraArgument=Je;var Qe,Xe=Ye,Ze=(Qe=function(e,t){return Qe=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])},Qe(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}Qe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),et=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},tt=Object.defineProperty,nt=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),it=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable,at=function(e,t,n){return t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},rt=function(e,t){for(var n in t||(t={}))it.call(t,n)&&at(e,n,t[n]);if(nt)for(var i=0,o=nt(t);i<o.length;i++)n=o[i],ot.call(t,n)&&at(e,n,t[n]);return e},st="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?qe:qe.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var lt=function(e){function t(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Ze(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,et([void 0],e[0].concat(this)))):new(t.bind.apply(t,et([void 0],e.concat(this))))},t}(Array);function ct(e){return x(e)?Me(e,(function(){})):e}function ut(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new lt);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(Xe):i.push(Xe.withExtraArgument(n.extraArgument))),i}function dt(e){var t,n=function(e){return ut(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,s=void 0===r?n():r,l=i.devTools,c=void 0===l||l,u=i.preloadedState,d=void 0===u?void 0:u,y=i.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Ke(a)}var p=s;"function"==typeof p&&(p=p(n));var g=He.apply(void 0,p),S=qe;c&&(S=st(rt({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=et([g],f):"function"==typeof f&&(v=f(v)),ze(t,d,S.apply(void 0,v))}function yt(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return rt(rt({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ft(e){var t,n={},i=[],o={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,o},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,i,t]}function pt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:ct(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?ft(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,l=t[2],c=void 0===l?void 0:l,u=rt(rt({},o),s);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?ft(t):[t,n,i],r=a[0],s=a[1],l=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return ct(e())};else{var c=ct(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=et([r[t.type]],s.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[l]),n.reduce((function(e,n){if(n){var i;if(V(e))return void 0===(i=n(e,t))?e:i;if(x(e))return Me(e,(function(e){return n(e,t)}));if(void 0===(i=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}return e}),e)}return u.getInitialState=o,u}(i,u,r,c)}return a.forEach((function(e){var n,i,a=o[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,i=a.prepare):n=a,r[e]=n,s[c]=n,l[e]=i?yt(c,i):yt(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:l,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var gt="listenerMiddleware";yt(gt+"/add"),yt(gt+"/removeAll"),yt(gt+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Ie];return Ce.get(t,e)},set:function(t){var n=this[Ie];Ce.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][Ie];if(!o.P)switch(o.i){case 5:i(o)&&fe(o);break;case 4:n(o)&&fe(o)}}}function n(e){for(var t=e.t,n=e.k,i=_e(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==Ie){var r=t[a];if(void 0===r&&!W(t,a))return!0;var s=n[a],l=s&&s[Ie];if(l?l.t!==r:!K(s,r))return!0}}var c=!!t[Ie];return i.length!==_e(t).length+(c?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var i=0;i<t.length;i++)if(!t.hasOwnProperty(i))return!0;return!1}var o={};!function(e,t){we[e]||(we[e]=t)}("ES5",{J:function(t,n){var i=Array.isArray(t),o=function(t,n){if(t){for(var i=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(i,""+o,e(o,!0));return i}var a=Le(n);delete a[Ie];for(var r=_e(a),s=0;s<r.length;s++){var l=r[s];a[l]=e(l,t||!!a[l].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(i,t),a={i:i?5:4,A:n?n.A:te(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,Ie,{value:a,writable:!0}),o},S:function(e,n,o){o?V(n)&&n[Ie].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Ie];if(n){var o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)j(a,(function(t){t!==Ie&&(void 0!==o[t]||W(o,t)?r[t]||e(a[t]):(r[t]=!0,fe(n)))})),j(o,(function(e){void 0!==a[e]||W(a,e)||(r[e]=!1,fe(n))}));else if(5===s){if(i(n)&&(fe(n),r.length=!0),a.length<o.length)for(var l=a.length;l<o.length;l++)r[l]=!1;else for(var c=o.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,o.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}();const St=(e,t)=>n=>R({},n,{[e]:t[e]}),vt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>R({},t,{[e]:R({},t[e],n)})}),ht=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return R({},n,{[e]:R({},n[e],{[t]:R({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),mt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i,o;return R({},t,{[e]:R({},t[e],{loaders:R({},null==(i=t[e])?void 0:i.loaders,{[n.key]:null==(o=n.value)||o})})})}}),At=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return R({},t,{[e]:R({},t[e],{errors:R({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),bt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:o})=>{var a;return R({},i,{[e]:R({},i[e],{[t]:R({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),Tt=(e,t,n)=>i=>{var o;return R({},i,{[e]:R({},i[e],{[t]:R({},null==i||null==(o=i[e])?void 0:o[t],n)})})},Et=(e=500)=>new Promise((t=>setTimeout(t,e))),kt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Ot=new Uint8Array(256);for(let e=0;e<kt.length;e++)Ot[kt.charCodeAt(e)]=e;const It=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,s,l=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=Ot[e.charCodeAt(i)],a=Ot[e.charCodeAt(i+1)],r=Ot[e.charCodeAt(i+2)],s=Ot[e.charCodeAt(i+3)],c[l++]=o<<2|a>>4,c[l++]=(15&a)<<4|r>>2,c[l++]=(3&r)<<6|63&s;return c.buffer},Pt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(Pt(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let i,o="";for(i=0;i<n;i+=3)o+=kt[t[i]>>2],o+=kt[(3&t[i])<<4|t[i+1]>>4],o+=kt[(15&t[i+1])<<2|t[i+2]>>6],o+=kt[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1):n%3==1&&(o=o.substring(0,o.length-2)),o})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=Pt(e[n]);return t}return e};let _t,Lt,wt;!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"}(_t||(_t={})),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"}(wt||(wt={}));const Ct="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Ut="HOSTED_LOGIN_VERIFIER_KEY",Dt="auth",Rt="connectivity",Nt="auditLogs",Mt="vendor",Ft={flow:Lt.Login,step:_t.preLogin,loading:!1,email:"",tenants:[]},Gt={setLoginState:vt("loginState"),resetLoginState:St("loginState",{loginState:Ft})},$t={requestAuthorize:yt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:yt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:yt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),requestHostedLoginAuthorizeV2:yt("auth/requestHostedLoginAuthorizeV2",(e=>({payload:e}))),handleHostedLoginCallback:yt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:yt("auth/afterAuthNavigation"),preLogin:yt("auth/preLogin",(e=>({payload:e}))),postLogin:yt("auth/postLogin",(e=>({payload:e}))),login:yt("auth/login",(e=>({payload:e}))),loginWithMfa:yt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:yt("auth/recoverMfa",(e=>({payload:e}))),logout:yt("auth/logout",(e=>({payload:e}))),silentLogout:yt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:yt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:yt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:yt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:yt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:yt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:yt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:yt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:yt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:yt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:yt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:yt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:yt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:yt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:yt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:yt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:yt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:yt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:yt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:yt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:yt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:yt("auth/verifyMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAEmailCode:yt("auth/preVerifyMFAEmailCode",(e=>({payload:e}))),verifyMFAEmailCode:yt("auth/verifyMFAEmailCode",(e=>({payload:e}))),resetBreachedPassword:yt("auth/resetBreachedPassword",(e=>({payload:e})))};let Vt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Vt||(Vt={}));const xt={step:Vt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},jt={setActivateState:vt("activateState"),resetActivateState:St("activateState",{activateState:xt}),setActivateStrategyState:ht("activateState","activationStrategy")},Bt={activateAccount:yt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:yt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:yt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:yt("auth/resendActivationEmail",(e=>({payload:e})))};let Wt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Wt||(Wt={}));const zt={step:Wt.validate},Kt={setAcceptInvitationState:vt("acceptInvitationState"),resetAcceptInvitationState:St("acceptInvitationState",{acceptInvitationState:zt})},qt={acceptInvitation:yt("auth/acceptInvitation",(e=>({payload:e})))};let Ht;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Ht||(Ht={}));const Jt={step:Ht.forgotPassword,loading:!1,email:"",passwordConfig:null},Yt={setForgotPasswordState:vt("forgotPasswordState"),resetForgotPasswordState:St("forgotPasswordState",{forgotPasswordState:Jt})},Qt={forgotPassword:yt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:yt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:yt("auth/loadPasswordConfig",(e=>({payload:e})))};let Xt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Xt||(Xt={}));const Zt={step:Xt.ResetPhoneNumber,loading:!1},en={setResetPhoneNumberState:vt("resetPhoneNumberState"),resetResetPhoneNumberState:St("resetPhoneNumberState",{resetPhoneNumberState:Zt})},tn={resetPhoneNumber:yt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:yt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:yt("auth/changePhoneNumber",(e=>({payload:e})))},nn={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},on={setSSOLoader:mt("ssoState"),setSSOError:At("ssoState"),setSSOState:vt("ssoState"),resetSSOState:St("ssoState",{ssoState:nn})},an={loadSSOConfigurationsV2:yt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:yt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:yt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:yt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:yt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:yt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:yt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:yt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:yt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:yt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:yt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:yt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:yt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:yt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:yt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:yt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:yt("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:yt("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:yt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:yt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:yt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:yt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:yt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:yt("auth/oidcPostlogin",(e=>({payload:e})))},rn={loading:!1,error:null},sn={setProfileState:vt("profileState"),resetProfileState:St("profileState",{profileState:rn})},ln={loadProfile:yt("auth/loadProfile"),saveProfile:yt("auth/saveProfile",(e=>({payload:e}))),changePassword:yt("auth/changePassword",(e=>({payload:e})))};let cn;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode"}(cn||(cn={}));const un={step:cn.verify,loading:!1,saving:!1},dn={setMfaState:vt("mfaState"),resetMfaState:St("mfaState",{mfaState:un})},yn={enrollMfa:yt("auth/enrollMfa"),getMFADevices:yt("auth/getMFADevices"),getMFAStrategies:yt("auth/getMFAStrategies"),verifyMfa:yt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:yt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:yt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:yt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:yt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:yt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:yt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:yt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:yt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:yt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:yt("auth/disableMfaWebAuthn",(e=>({payload:e})))},fn={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}},pn={setTeamLoader:mt("teamState"),setTeamError:At("teamState"),setTeamState:vt("teamState"),resetTeamState:St("teamState",{teamState:fn})},gn={loadUsersV2:yt("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:yt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:yt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:yt("auth/loadRoles",(e=>({payload:e}))),addUser:yt("auth/addUser",(e=>({payload:e}))),addUsersBulk:yt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:yt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:yt("auth/updateUser",(e=>({payload:e}))),deleteUser:yt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:yt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:yt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:yt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:yt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:yt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:yt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:yt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:yt("auth/getInvitationLink"),createInvitationLink:yt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:yt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:yt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:yt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:yt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:yt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:yt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:yt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:yt("auth/closeLockUserDialog",(e=>({payload:e})))},Sn={firstLoad:!0,loading:!1,error:""},vn={setSocialLoginsState:vt("socialLoginState"),resetSocialLoginsState:St("socialLoginState",{socialLoginState:Sn})},hn={loadSocialLoginsConfiguration:yt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:yt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:yt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:yt("auth/setSocialLoginError",(e=>({payload:e})))};let mn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(mn||(mn={}));const An={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:mn.SignUp},bn={setSignUpState:vt("signUpState"),resetSignUpState:St("signUpState",{signUpState:An})},Tn={signUpUser:yt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:yt("auth/resetSignUpStateSoft")},En={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},kn={setApiTokensLoader:mt("apiTokensState"),setApiTokensError:At("apiTokensState"),setApiTokensState:vt("apiTokensState"),resetApiTokensState:St("apiTokensState",{apiTokensState:En})},On={loadApiTokens:yt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:yt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:yt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:yt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:yt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:yt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:yt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:yt("auth/deleteTenantApiToken",(e=>({payload:e})))},In={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}},Pn={setSecurityPolicyState:vt("securityPolicyState"),setSecurityPolicyGlobalState:ht("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:ht("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:ht("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:ht("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:ht("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:ht("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:ht("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:ht("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:ht("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:ht("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:ht("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:St("securityPolicyState",{securityPolicyState:In})},_n={loadSecurityPolicy:yt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:yt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:yt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:yt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:yt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:yt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:yt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:yt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:yt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:yt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:yt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:yt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:yt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:yt("auth/loadPublicAuthStrategiesPolicy")},Ln={loading:!1},wn={setAccountSettingsState:vt("accountSettingsState"),resetAccountSettingsState:St("accountSettingsState",{accountSettingsState:Ln})},Cn={loadAccountSettings:yt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:yt("auth/saveAccountSettings",(e=>({payload:e})))},Un={tenants:[],subTenants:[],loading:!0,tenantTree:null},Dn={setTenantsState:vt("tenantsState"),resetTenantsState:St("tenantsState",{tenantsState:Un})},Rn={switchTenant:yt("auth/switchTenant",(e=>({payload:e}))),loadTenants:yt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:yt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:yt("auth/loadSubTenantsTree",(e=>({payload:e})))},Nn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Mn={setRolesState:vt("rolesState"),resetRolesState:St("rolesState",{rolesState:Nn})},Fn={loadRolesAndPermissions:yt("auth/loadRoles",(e=>({payload:e}))),addRole:yt("auth/addRole",(e=>({payload:e}))),updateRole:yt("auth/updateRole",(e=>({payload:e}))),deleteRole:yt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:yt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:yt("auth/attachPermissionToRoles",(e=>({payload:e})))},Gn={loading:!1,sessions:[]},$n={setSessionsState:vt("sessionsState"),resetSessionsState:St("sessionsState",{sessionsState:Gn})},Vn={loadUserSessions:yt("auth/loadUserSessions"),loadCurrentUserSession:yt("auth/loadCurrentUserSession"),deleteUserSession:yt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:yt("auth/deleteAllUserSessions"),revokeUserSessions:yt("auth/revokeUserSessions",(e=>({payload:e})))},xn={loading:!1,configurations:{}},jn={setSessionsPolicyState:vt("sessionsPolicyState"),resetSessionsPolicyState:St("sessionsPolicyState",{sessionsPolicyState:xn})},Bn={loadSessionsPolicy:yt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:yt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Wn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Wn||(Wn={}));const zn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Wn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Kn={setRestrictionsState:vt("restrictionsState"),setIpRestrictionsState:ht("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:ht("restrictionsState","emailDomainRestrictions")},qn={checkIfUserIpValid:yt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:yt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:yt("auth/loadIpRestrictions"),saveIpRestriction:yt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:yt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:yt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:yt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:yt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:yt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:yt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Hn={loading:!1},Jn={setProvisioningState:vt("provisioningState"),resetProvisioningState:St("provisioningState",{provisioningState:Hn})},Yn={loadProvisionConnections:yt("auth/loadProvisionConnections"),createProvisionConnection:yt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:yt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:yt("auth/updateProvisionConnection",(e=>({payload:e})))},Qn={devices:[],loading:!1,error:null},Xn={setPasskeysState:vt("passkeysState"),resetPasskeysState:St("passkeysState",{passkeysState:Qn})},Zn={loadWebAuthnDevices:yt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:yt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},ei={loaders:{},errors:{},groups:[],groupsConfiguration:{}},ti={setUsersGroupsLoader:mt("groupsState"),setUsersGroupsError:At("groupsState"),setGroupsState:vt("groupsState"),resetUsersGroupsState:St("groupsState",{groupsState:ei})},ni={loadGroups:yt("auth/loadUsersGroups"),getGroupById:yt("auth/getGroupById",(e=>({payload:e}))),createGroup:yt("auth/createGroup",(e=>({payload:e}))),updateGroup:yt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:yt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:yt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:yt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:yt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:yt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:yt("auth/getGroupConfiguration"),updateGroupConfiguration:yt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:yt("auth/getUsers",(e=>({payload:e})))},ii={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}},oi={setGroupsDialogsState:vt("groupsDialogsState"),resetGroupsDialogsState:St("groupsState",{groupsDialogsState:ii}),openAddGroupDialog:Tt("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:Tt("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:bt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:Tt("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:bt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:Tt("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:Tt("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:Tt("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:bt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:Tt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},ai={loading:!0,error:null},ri={setCustomLoginState:vt("customLoginState"),resetCustomLoginState:St("customLoginState",{customLoginState:ai})},si={loadTenantMetadata:yt("auth/loadTenantMetadata"),updateTenantMetadata:yt("auth/updateTenantMetadata",(e=>({payload:e})))},li={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let ci,ui,di,yi,fi;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ci||(ci={})),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"}(ui||(ui={})),function(e){e.ASC="ASC",e.DESC="DESC"}(di||(di={})),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"}(yi||(yi={})),function(e){e.MFA_UNENROLLED="mfa-unenrolled",e.BREACHED_PASSWORDS="breached-passwords",e.INACTIVE="inactive"}(fi||(fi={}));const pi=["local","saml","google","github","facebook","microsoft","scim2","slack"],gi={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:di.DESC,_sortBy:yi.name},usersPageOffset:0,accountSettings:{}}},Si={setAllAccountsLoader:mt("allAccountsState"),setAllAccountsError:At("allAccountsState"),setAllAccountsState:vt("allAccountsState"),setSelectedAccountState:ht("allAccountsState","selectedAccount"),resetAllAccountsState:St("allAccountsState",{allAccountsState:gi})},vi={loadAccounts:yt("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:yt("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:yt("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:yt("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:yt("auth/updateAccount",(e=>({payload:e}))),deleteSubAccount:yt("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:yt("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:yt("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:yt("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:yt("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:yt("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:yt("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setRootAccountData:yt("auth/setRootAccountData"),setSelectedSubAccountData:yt("auth/setSelectedSubAccountData",(e=>({payload:e}))),loadNumberOfUsersForSelectedSubAccount:yt("auth/loadNumberOfUsersForSelectedSubAccount",(e=>({payload:e})))},hi={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:[]}},mi={setAllAccountDialogsState:vt("allAccountsDialogsState"),resetAllAccountDialogsState:St("allAccountsDialogsState",{allAccountsDialogsState:hi}),openCreateSubAccountDialog:bt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:Tt("allAccountsDialogsState","createSubAccountDialog",hi.createSubAccountDialog),openUpdateSubAccountDialog:bt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:Tt("allAccountsDialogsState","updateSubAccountDialog",hi.updateSubAccountDialog),openDeleteSubAccountDialog:bt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:Tt("allAccountsDialogsState","deleteSubAccountDialog",hi.deleteSubAccountDialog),openAddUsersToAccountDialog:bt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:Tt("allAccountsDialogsState","addUsersToAccountDialog",hi.addUsersToAccountDialog),openDeleteUserFromAccountDialog:bt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:Tt("allAccountsDialogsState","deleteUserFromAccountDialog",hi.deleteUserFromAccountDialog),openEditUserRolesDialog:bt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:Tt("allAccountsDialogsState","editUserRolesDialog",hi.editUserRolesDialog)},Ai={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}}},bi={setSecurityCenterState:vt("securityCenterState"),resetSecurityCenterState:St("securityCenterState",{securityCenterState:Ai}),setSecurityCenterStateLoader:mt("securityCenterState"),setSecurityCenterStateError:At("securityCenterState")},Ti={loadRecommendations:yt("auth/loadRecommendations"),loadInsights:yt("auth/loadInsights"),sendResetBreachedPasswordEmail:yt("auth/sendResetBreachedPasswordEmail",(e=>({payload:e}))),sendBulkResetBreachedPasswordEmails:yt("auth/sendBulkResetBreachedPasswordEmails",(e=>({payload:e}))),loadBreachedPasswordUsers:yt("auth/loadBreachedPasswordUsers",(e=>({payload:e}))),loadUnenrolledMfaUsers:yt("auth/loadUnenrolledMfaUsers",(e=>({payload:e}))),loadInactiveUsers:yt("auth/loadInactiveUsers",(e=>({payload:e})))};let Ei,ki,Oi;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Ei||(Ei={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(ki||(ki={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Oi||(Oi={}));const Ii={[ki.Code]:_t.loginWithOtc,[ki.EmailAndPassword]:_t.loginWithPassword,[ki.MagicLink]:_t.magicLinkPreLoginSuccess,[ki.SmsCode]:_t.loginWithSmsOtc},Pi={loading:!1,error:null,phoneNumbers:void 0},_i={setSmsState:vt("smsState"),resetSmsState:St("smsState",{smsState:Pi})},Li={loadPhoneNumbers:yt("auth/loadPhoneNumbers"),setUpPhoneNumber:yt("auth/setUpPhoneNumber",(e=>({payload:e}))),verifyPhoneNumber:yt("auth/verifyPhoneNumber",(e=>({payload:e}))),deletePhoneNumber:yt("auth/deletePhoneNumber",(e=>({payload:e}))),verifyDeletePhoneNumber:yt("auth/verifyDeletePhoneNumber",(e=>({payload:e}))),preVerifyPhoneNumber:yt("auth/preVerifyPhoneNumber",(e=>({payload:e})))},wi={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:An,loginState:Ft,activateState:xt,acceptInvitationState:zt,forgotPasswordState:Jt,ssoState:nn,profileState:rn,customLoginState:ai,mfaState:un,teamState:fn,groupsState:ei,groupsDialogsState:ii,socialLoginState:Sn,apiTokensState:En,securityPolicyState:In,accountSettingsState:Ln,tenantsState:Un,rolesState:Nn,resetPhoneNumberState:Zt,sessionsState:Gn,sessionsPolicyState:xn,restrictionsState:zn,provisioningState:Hn,passkeysState:Qn,allAccountsState:gi,allAccountsDialogsState:hi,securityCenterState:Ai,smsState:Pi},Ci=R({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:()=>{}},wi);let Ui;!function(e){e.impersonating="impersonating",e.success="success"}(Ui||(Ui={}));const Di={step:Ui.impersonating,loading:!1},Ri={setImpersonateState:vt("impersonateState"),resetImpersonateState:St("impersonateState",{impersonateState:Di})},Ni={impersonate:yt("impersonation/impersonate",(e=>({payload:e})))},{reducer:Mi,actions:Fi}=pt({name:Dt,initialState:Ci,reducers:R({resetState:e=>R({},e,wi),setState:(e,{payload:t})=>R({},e,t),setUser:("user",(e,{payload:t})=>R({},e,{user:t})),setEntitlements:ht("user","entitlements")},Gt,vn,jt,Ri,Kt,Yt,en,bn,sn,ri,on,dn,pn,ti,oi,kn,Pn,wn,Dn,Mn,$n,jn,Kn,Jn,Xn,Si,mi,bi,_i)});const Gi=R({loadEntitlements:yt("auth/loadEntitlements",(e=>({payload:e})))},Fi,$t,hn,Bt,qt,Qt,tn,Tn,ln,si,an,yn,gn,ni,{},On,_n,Cn,Rn,Fn,Vn,Bn,qn,Yn,Ni,Zn,vi,Ti,Li);var $i=function(e){return"@@redux-saga/"+e},Vi=$i("CANCEL_PROMISE"),xi=$i("CHANNEL_END"),ji=$i("IO"),Bi=$i("MATCH"),Wi=$i("MULTICAST"),zi=$i("SAGA_ACTION"),Ki=$i("SELF_CANCELLATION"),qi=$i("TASK"),Hi=$i("TASK_CANCEL"),Ji=$i("TERMINATE"),Yi=$i("LOCATION");function Qi(e,t){if(null==e)return{};var n,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var Xi=function(e){return null==e},Zi=function(e){return null!=e},eo=function(e){return"function"==typeof e},to=function(e){return"string"==typeof e},no=Array.isArray,io=function(e){return e&&eo(e.then)},oo=function(e){return e&&eo(e.next)&&eo(e.throw)},ao=function e(t){return t&&(to(t)||lo(t)||eo(t)||no(t)&&t.every(e))},ro=function(e){return e&&eo(e.take)&&eo(e.close)},so=function(e){return eo(e)&&e.hasOwnProperty("toString")},lo=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},co=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[Vi]=function(){clearTimeout(n)},i},uo=function(e){return function(){return e}},yo=uo(!0),fo=function(){},po=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var go=function(e,t){R(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function So(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var vo=function(e){throw e},ho=function(e){return{value:e,done:!0}};function mo(e,t,n){void 0===t&&(t=vo),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:ho,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Ao(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var bo=function(e){return Array.apply(null,new Array(e))},To=function(e){return function(t){return e(Object.defineProperty(t,zi,{value:!0}))}},Eo=function(e){return e===Ji},ko=function(e){return e===Hi},Oo=function(e){return Eo(e)||ko(e)};function Io(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=no(e)?bo(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||Oo(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=fo,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function Po(e){return{name:e.name||"anonymous",location:_o(e)}}function _o(e){return e[Yi]}var Lo=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),i=0,o=0,a=0,r=function(t){n[o]=t,o=(o+1)%e,i++},s=function(){if(0!=i){var t=n[a];return n[a]=null,i--,a=(a+1)%e,t}},l=function(){for(var e=[];i;)e.push(s());return e};return{isEmpty:function(){return 0==i},put:function(s){var c;if(i<e)r(s);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=s,a=o=(o+1)%e;break;case 4:c=2*e,n=l(),i=n.length,o=n.length,a=0,n.length=c,e=c,r(s)}},take:s,flush:l}}(e,4)},wo="TAKE",Co="CALL",Uo="FORK",Do="SELECT",Ro=function(e,t){var n;return(n={})[ji]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function No(e,t){return void 0===e&&(e="*"),ao(e)?(Zi(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Ro(wo,{pattern:e})):ro(n=e)&&n[Wi]&&Zi(t)&&ao(t)?Ro(wo,{channel:e,pattern:t}):ro(e)?(Zi(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Ro(wo,{channel:e})):void 0;var n}function Mo(e,t){return Xi(t)&&(t=e,e=void 0),Ro("PUT",{channel:e,action:t})}function Fo(e){var t=Ro("ALL",e);return t.combinator=!0,t}function Go(e,t){var n,i=null;return eo(e)?n=e:(no(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&to(n)&&eo(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function $o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Ro(Co,Go(e,n))}function Vo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Ro(Uo,Go(e,n))}function xo(e){return void 0===e&&(e=Ki),Ro("CANCEL",e)}function jo(e){void 0===e&&(e=po);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Ro(Do,{selector:e,args:n})}var Bo=$o.bind(null,co);var Wo=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},zo=[],Ko=0;function qo(e){try{Yo(),e()}finally{Qo()}}function Ho(e){zo.push(e),Ko||(Yo(),Xo())}function Jo(e){try{return Yo(),e()}finally{Xo()}}function Yo(){Ko++}function Qo(){Ko--}function Xo(){var e;for(Qo();!Ko&&void 0!==(e=zo.shift());)qo(e)}var Zo=function(e){return function(t){return e.some((function(e){return oa(e)(t)}))}},ea=function(e){return function(t){return e(t)}},ta=function(e){return function(t){return t.type===String(e)}},na=function(e){return function(t){return t.type===e}},ia=function(){return yo};function oa(e){var t="*"===e?ia:to(e)?ta:no(e)?Zo:so(e)?ta:eo(e)?ea:lo(e)?na:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var aa={type:xi},ra=function(e){return e&&e.type===xi};function sa(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(aa)}))},(e={})[Wi]=!0,e.put=function(e){if(!t)if(ra(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[Bi](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=ia),t?e(aa):(e[Bi]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),So(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[zi]?s(e):Ho((function(){s(e)}))},r}function la(e,t){var n=e[Vi];eo(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var ca,ua=0,da=function(){return++ua};function ya(e){e.isRunning()&&e.cancel()}var fa=((ca={}).TAKE=function(e,t,n){var i=t.channel,o=void 0===i?e.channel:i,a=t.pattern,r=t.maybe,s=function(e){e instanceof Error?n(e,!0):!ra(e)||r?n(e):n(Ji)};try{o.take(s,Zi(a)?oa(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},ca.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Ho((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&io(t)?la(t,n):n(t)}))},ca.ALL=function(e,t,n,i){var o=i.digestEffect,a=ua,r=Object.keys(t);if(0!==r.length){var s=Io(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(no(t)?[]:{})},ca.RACE=function(e,t,n,i){var o=i.digestEffect,a=ua,r=Object.keys(t),s=no(t)?bo(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Oo(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=fo,l[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return l[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,l[e],e)}))},ca.CALL=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,s=i.task;try{var l=a.apply(o,r);if(io(l))return void la(l,n);if(oo(l))return void Ea(e,l,s.context,ua,Po(a),!1,n);n(l)}catch(e){n(e,!0)}},ca.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){Xi(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},ca.FORK=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,s=t.detached,l=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var o=n.apply(t,i);if(oo(o))return o;var a=!1;return mo((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!io(o)})}))}catch(e){return mo((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Po(t)}(c,a);Jo((function(){var t=Ea(e,c,l.context,ua,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},ca.JOIN=function(e,t,n,i){var o=i.task,a=function(e,t){if(e.isRunning()){var n={task:o,cb:t};t.cancel=function(){e.isRunning()&&So(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(no(t)){if(0===t.length)return void n([]);var r=Io(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},ca.CANCEL=function(e,t,n,i){var o=i.task;t===Ki?ya(o):no(t)?t.forEach(ya):ya(t),n()},ca.SELECT=function(e,t,n){var i=t.selector,o=t.args;try{n(i.apply(void 0,[e.getState()].concat(o)))}catch(e){n(e,!0)}},ca.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Lo());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(aa):e.isEmpty()?(n.push(i),i.cancel=function(){So(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(aa):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(aa)}}}}(t.buffer),a=oa(i),r=function t(n){ra(n)||e.channel.take(t,a),o.put(n)},s=o.close;o.close=function(){r.cancel(),s()},e.channel.take(r,a),n(o)},ca.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},ca.FLUSH=function(e,t,n){t.flush(n)},ca.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},ca.SET_CONTEXT=function(e,t,n,i){var o=i.task;go(o.context,t),n()},ca);function pa(e,t){return e+"?"+t}function ga(e){var t=e.name,n=e.location;return n?t+" "+pa(n.fileName,n.lineNumber):t}function Sa(e){var t,n,i,o=(t=function(e){return e.cancelledTasks},n=e,(i=[]).concat.apply(i,n.map(t)));return o.length?["Tasks cancelled due to error:"].concat(o).join("\n"):""}var va=null,ha=[],ma=function(e){e.crashedEffect=va,ha.push(e)},Aa=function(){va=null,ha.length=0},ba=function(){var e,t,n=ha[0],i=ha.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=_o(e))?t.code+" "+pa(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+ga(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+ga(e.meta)})),[Sa(ha)]).join("\n")};function Ta(e,t,n,i,o,a,r){var s;void 0===r&&(r=fo);var l,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),l(),n(e,!0)}function s(t){o.push(t),t.cont=function(s,l){a||(So(o,t),t.cont=fo,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=fo,e.cancel()})),o=[])}return s(e),{addTask:s,cancelAll:l,abort:r,getTasks:function(){return o}}}(t,0,g);function g(t,n){if(n){if(u=2,ma({meta:o,cancelledTasks:y}),S.isRoot){var i=ba();Aa(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Hi?u=1:1!==u&&(u=3),l=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((s={})[qi]=!0,s.id=i,s.meta=o,s.isRoot=a,s.context=f,s.joiners=[],s.queue=p,s.cancel=function(){0===u&&(u=1,p.cancelAll(),g(Hi,!1))},s.cont=r,s.end=g,s.setContext=function(e){go(f,e)},s.toPromise=function(){return d||(d=Wo(),2===u?d.reject(c):0!==u&&d.resolve(l)),d.promise},s.isRunning=function(){return 0===u},s.isCancelled=function(){return 1===u||0===u&&1===t.status},s.isAborted=function(){return 2===u},s.result=function(){return l},s.error=function(){return c},s);return S}function Ea(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){io(t)?la(t,i):oo(t)?Ea(e,t,c.context,n,o,!1,i):t&&t[ji]?(0,fa[t.type])(e,t.payload,i,u):i(t)}));d.cancel=fo;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(Hi))},status:0},c=Ta(e,l,n,i,o,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var o;n?(o=t.throw(e),Aa()):ko(e)?(l.status=1,d.cancel(),o=eo(t.return)?t.return(Hi):{done:!0,value:Hi}):o=Eo(e)?eo(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==l.status&&(l.status=3),l.cont(o.value)):y(o.value,i,d)}catch(e){if(1===l.status)throw e;l.status=2,l.cont(e,!0)}}function y(t,n,i,o){void 0===o&&(o="");var a,r=da();function l(n,o){a||(a=!0,i.cancel=fo,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){va=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=fo,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=fo,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function ka(e,t){for(var n=e.channel,i=void 0===n?sa():n,o=e.dispatch,a=e.getState,r=e.context,s=void 0===r?{}:r,l=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?Ao: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=da();if(l&&(l.rootSagaStarted=l.rootSagaStarted||fo,l.effectTriggered=l.effectTriggered||fo,l.effectResolved=l.effectResolved||fo,l.effectRejected=l.effectRejected||fo,l.effectCancelled=l.effectCancelled||fo,l.actionDispatched=l.actionDispatched||fo,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=qe.apply(void 0,c);g=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else g=po;var m={channel:i,dispatch:To(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:g};return Jo((function(){var e=Ea(m,S,s,v,Po(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var Oa=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?sa():a,s=n.sagaMonitor,l=Qi(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=ka.bind(null,R({},l,{context:o,channel:r,dispatch:i,getState:n,sagaMonitor:s})),function(e){return function(t){s&&s.actionDispatched&&s.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){go(o,e)},c},Ia=function(e){return{done:!0,value:e}},Pa={};function _a(e){return ro(e)?"channel":so(e)?String(e):eo(e)?e.name:String(e)}function La(e,t,n){var i,o,a,r=t;function s(t,n){if(r===Pa)return Ia(t);if(n&&!o)throw r=Pa,n;i&&i(t);var s=n?e[o](n):e[r]();return r=s.nextState,a=s.effect,i=s.stateUpdater,o=s.errorState,r===Pa?Ia(t):a}return mo(s,(function(e){return s(null,e)}),n)}function wa(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:No(e)},s=function(e){return{done:!1,value:Vo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return La({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+_a(e)+", "+t.name+")")}function Ca(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,s={done:!1,value:No(e)},l=function(e){return{done:!1,value:Vo.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:xo(e)}},u=function(e){return a=e},d=function(e){return r=e};return La({q1:function(){return{nextState:"q2",effect:s,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:l(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:l(r),stateUpdater:u}}},"q1","takeLatest("+_a(e)+", "+t.name+")")}function Ua(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:No(e)},s=function(e){return{done:!1,value:$o.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return La({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+_a(e)+", "+t.name+")")}function Da(e,t,n){for(var i=e,o=arguments.length,a=new Array(o>3?o-3:0),r=3;r<o;r++)a[r-3]=arguments[r];var s={done:!1,value:$o.apply(void 0,[n].concat(a))},l={done:!1,value:Bo(t)};return La({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:Pa}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function Ra(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Vo.apply(void 0,[wa,e,t].concat(i))}function Na(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Vo.apply(void 0,[Ca,e,t].concat(i))}function Ma(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Vo.apply(void 0,[Ua,e,t].concat(i))}class Fa{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,this.sessionContext=void 0}static getInstance(){return Fa.instance||(Fa.instance=new Fa),Fa.instance}static setContext(e){Fa.getInstance().context=e}static setAccessToken(e){Fa.getInstance().accessToken=e}static setUser(e){Fa.getInstance().user=e}static setRequestSource(e){Fa.getInstance().requestSource=e}static setOnRedirectTo(e){Fa.getInstance().onRedirectTo=e}static setLogout(e,t){Fa.getInstance().logout=n=>{n?e(n):Fa.onRedirectTo(t)}}static setEntitlementsOptions(e){Fa.getInstance().entitlementsOptions=e}static setSessionContext(e){Fa.getInstance().sessionContext=e}static setAppName(e){Fa.getInstance().appName=e}static getContext(){var e;return null!=(e=Fa.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Fa.getInstance().accessToken}static getRequestSource(){return Fa.getInstance().requestSource}static getUser(){return Fa.getInstance().user}static onRedirectTo(e,t){return Fa.getInstance().onRedirectTo(e,t)}static logout(e){return Fa.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=Fa.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static isSessionPerTenantEnabled(){var e;return(null==(e=Fa.getInstance().sessionContext)?void 0:e.enableSessionPerTenant)||!1}static getAppName(){return Fa.getInstance().appName}}Fa.instance=void 0;const Ga={getContext:()=>Fa.getContext(),getAccessToken:()=>Fa.getAccessToken(),getUser:()=>Fa.getUser(),onRedirectTo:(e,t)=>Fa.onRedirectTo(e,t),logout:e=>Fa.logout(e)};class $a extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Va={v1:"/identity/resources/users/webauthn/v1/devices"},xa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},ja={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:{v1:"/identity/resources/users/v1/me/tenants",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"}},Ba={v1:"/identity/resources/configurations/v1"},Wa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},za={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ka={v1:"/identity/resources/permissions/v1"},qa={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"},Ja={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Ya={v1:"/identity/resources/impersonation/v1"},Qa={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Xa={v1:"/identity/resources/users/phone-numbers/v1"},Za={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},er={v1:"/team/resources/members/v1"},tr={v1:"/team/resources/roles/v1"},nr={v1:"/team/resources/stats/v1"},ir={v1:"/team/resources/profile"},or={v1:"/tenants/resources/account-settings/v1"},ar={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"}},rr={v1:"/tenants/resources/sub-tenants/v1"},sr={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},lr={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"}}}},cr={v1:"/subscriptions/resources/payment-providers/v1"},ur={v1:"/subscriptions/resources/subscriptions/v1"},dr={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},yr={v1:"/reports/engine/resources/triggers/v1"},fr="/notification",pr="/audits",gr={v1:"/event/resources/configurations/v1"},Sr="/webhook",vr="/oauth",hr="/flags",mr="/directory/resources/v1/configurations/scim2",Ar="/directory/resources/scim/temp",br="/entitlements/api/v1/user-entitlements",Tr="/entitlements/api/v2/user-entitlements",Er={v1:"/security-center/resources/recommendations/v1"},kr={v1:"/security-center/resources/insights/v1"};function Or(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}function Ir(e){var t,n;const i={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(i[li.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(i[li.frameWork]=e.metadataHeaders.framework),i}const Pr=async e=>{var t,n,i;const o=Fa.getContext(),a=await async function(e,t){var n;const i=Ir(e),o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Fa.getAccessToken)(),a=Fa.getRequestSource();t&&(i[li.contentType]=t),a&&(i[li.source]=a),o&&(i.Authorization=`Bearer ${o}`);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))i[`${t.key}`]=`${t.value}`;return i}(o,e.contentType),r=await async function(e,t,n){const i=Or(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),s=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:R({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===s.status)return window.location.href=await s.text(),new Promise((()=>{}));if(!s.ok){var l,c;if(413===s.status)throw new $a("Error request is too large",s.status);let e,t=!0;try{e=await s.text(),e=JSON.parse(e)}catch(e){t=!1}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${s.status} - ${s.statusText}`),s.status>=400&&s.status<500&&["warn"].includes(null!=(l=o.logLevel)?l:"")?console.warn(e):500===s.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new $a(t?e:"We're facing some difficulties, Please try again",s.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await s.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 s.text()}try{return await s.json()}catch(e){return{}}},_r=async(e,t,n)=>Pr(R({url:e,method:"GET",contentType:"application/json",params:t},n)),Lr=async(e,t,n)=>Pr(R({url:e,method:"POST",contentType:"application/json",body:t},n)),wr=async(e,t,n)=>Pr(R({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Cr=async(e,t,n)=>Pr(R({url:e,method:"PUT",contentType:"application/json",body:t},n)),Ur=async(e,t,n)=>Pr(R({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Dr=async(e,t,n,i)=>Pr(R({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),Rr=(e={})=>R({},e.jwt?{Authorization:e.jwt}:{}),Nr="FRONTEGG_SEPARATE_TABS_BY_TENANT",Mr="admin_portal_use_entitlements_v2_endpoint",Fr={flags:{}};class Gr{constructor(){var e;this._flags={},this._flags=null!=(e=Fr.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Gr;return n.set(e),Gr._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=R({},null!=(t=null==Fr?void 0:Fr.flags)?t:{},null!=e?e:{})}}async function $r(){return _r(hr)}async function Vr(e){return Lr(`${ja.v3}/me/token`,e)}async function xr(e,t){return _r(ja.v2,e,{headers:Rr(t)})}async function jr(e,t){return _r(ja.v3,e,{headers:Rr(t)})}async function Br(e,t){return _r(ja.roles.v3,R({},e,{ids:e.ids.join(",")}),{headers:Rr(t)})}async function Wr(e,t){return _r(ja.groups.v3,R({},e,{ids:e.ids.join(",")}),{headers:Rr(t)})}async function zr(e){return _r(ja.tenants.me.v3,void 0,{headers:Rr(e)})}async function Kr(e){return _r(ja.tenants.me.v1,void 0,{headers:Rr(e)})}async function qr(){return Lr(ja.passwords.resetBreachedPasswords.v1)}async function Hr(e){return Cr(`${ja.v2}/me`,e)}function Jr(e){e&&sessionStorage.setItem(Nr,e)}function Yr(){return Fa.isSessionPerTenantEnabled()?sessionStorage.getItem(Nr):null}function Qr(){const[e]=Gr.getFeatureFlags(["admin_portal_use_current_user_tenants_v1_endpoint"],Fa.getAppName()||"");return Fa.isSessionPerTenantEnabled()||e?Kr:zr}async function Xr(e){return Fa.isSessionPerTenantEnabled()&&Jr(e.tenantId),Cr(`${ja.v1}/tenant`,e)}async function Zr(){return _r(`${ja.v2}/me/tenants`)}async function es(e){return _r(ar.v1,void 0,{headers:Rr(e)})}async function ts(e){return _r(ar.tree.v1,void 0,{headers:Rr(e)})}async function ns(e){return _r(ar.parents.v1,void 0,{headers:Rr(e)})}async function is(e,t){return _r(`${ar.parents.v1}/${e}`,void 0,{headers:Rr(t)})}async function os(e,t){return Lr(`${qa.users.v1}/count`,e,{headers:Rr(t)})}async function as(e,t){return _r(ar.v2,e,{headers:Rr(t)})}async function rs(e,t){return _r(ar.metadata.v2,R({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Rr(t)})}async function ss(){return _r(Ba.v1)}async function ls(){return _r(`${Ba.v1}/mfa-policy`)}async function cs(){return _r(`${Ba.v1}/mfa-policy/vendor`)}async function us(e){return e.id?wr(`${Ba.v1}/mfa-policy`,e):Lr(`${Ba.v1}/mfa-policy`,e)}async function ds(){return _r(`${Ba.v1}/lockout-policy`)}async function ys(){return _r(`${Ba.v1}/lockout-policy/vendor`)}async function fs(e){return e.id?wr(`${Ba.v1}/lockout-policy`,e):Lr(`${Ba.v1}/lockout-policy`,e)}async function ps(){try{return await _r(`${Ba.v1}/captcha-policy/public`)}catch{return null}}async function gs(){return _r(`${Ba.v1}/password-history-policy`)}async function Ss(){return _r(`${Ba.v1}/password-history-policy/vendor`)}async function vs(e){return e.id?wr(`${Ba.v1}/password-history-policy`,e):Lr(`${Ba.v1}/password-history-policy`,e)}async function hs(){return _r(`${Ba.v1}/password`)}async function ms(){return _r(`${Wa.emailDomain.v1}`)}async function As(){return _r(`${Wa.emailDomain.v1}/config`)}async function bs(e){return Lr(`${Wa.emailDomain.v1}`,e)}async function Ts(e){return Lr(`${Wa.emailDomain.v1}/config`,e)}async function Es(e){return Ur(`${Wa.emailDomain.v1}/${e}`)}async function ks(e){return _r(`${Wa.ip.v1}`,e)}async function Os(){return _r(`${Wa.ip.v1}/config`)}async function Is(e){return Lr(`${Wa.ip.v1}`,e)}async function Ps(e){return Lr(`${Wa.ip.v1}/bulk`,e)}async function _s(e){return Lr(`${Wa.ip.v1}/config`,e)}async function Ls(e){return Ur(`${Wa.ip.v1}/${e}`)}async function ws(){return Lr(`${Wa.ip.v1}/verify`)}async function Cs(){return Lr(`${Wa.ip.v1}/verify/allow`)}Gr._instances={};class Us extends Error{constructor(e){super(e)}}const Ds="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Us("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,i,o=0,a=0;i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?n+=String.fromCharCode(255&e>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};class Rs extends Error{constructor(e){super(e)}}const Ns=(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(Ds(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 Ds(t)}})(e.split(".")[n]))}catch(e){throw new Rs("Invalid token specified: "+e.message)}};let Ms,Fs,Gs;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}(Ms||(Ms={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Fs||(Fs={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(Gs||(Gs={}));const $s="admin_portal_should_load_authorization";async function Vs(){return _r(br)}async function xs(){return _r(Tr)}let js;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(js||(js={}));const Bs="admin_portal_entitlements",Ws=["type"],zs=["type"],Ks=["type"];async function qs(e){if(!e.accessToken)return e;Fa.setAccessToken(e.accessToken);const t=await Ru(),n=R({},e,e.accessToken?Ns(e.accessToken):{},t);return Fa.setUser(n),n}async function Hs(e){if(!e.accessToken)return{user:e};Fa.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Ru(),Zr()]),i=R({},e,e.accessToken?Ns(e.accessToken):{},t);return Fa.setUser(i),{user:i,tenants:n}}function Js(){if(!Fa.shouldLoadEntitlements())return!1;const[e]=Gr.getFeatureFlags([Bs],Fa.getAppName()||"");return e}function Ys(){const[e]=Gr.getFeatureFlags([$s],Fa.getAppName()||"");return e}async function Qs(e){const{accessToken:t}=e;if(!t)return{user:e};Fa.setAccessToken(t);const[n,i]=await Promise.all([Ru(),Qr()()]),o=R({},e,t?Ns(t):{},n);return Fa.isSessionPerTenantEnabled()&&Jr(o.tenantId),Fa.setUser(o),{user:o,tenants:i.tenants,activeTenant:i.activeTenant}}async function Xs(e){Fa.setAccessToken(e.id_token);const t=await Ru(),n=e.id_token?Ns(e.id_token):{},i=R({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Fa.setUser(i),i}async function Zs(e){Fa.setAccessToken(e.id_token);const[t,n]=await Promise.all([Ru(),Qr()()]),i=e.id_token?Ns(e.id_token):{},o=R({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},i,t,{expiresIn:e.expires_in||300});return Fa.isSessionPerTenantEnabled()&&Jr(o.tenantId),Fa.setUser(o),{user:o,tenants:n.tenants,activeTenant:n.activeTenant}}async function el(e){try{const{address:t}=await Lr(`${xa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function tl(e){return Lr(`${xa.v1}/user/saml/prelogin`,e)}async function nl(e){return qs(await Lr(`${xa.v1}/user/saml/postlogin`,e))}async function il(e){return qs(await Lr(`${xa.v1}/user/oidc/postlogin`,e))}async function ol(e){return qs(await Lr(`${xa.v1}/user`,e))}async function al(e){return Qs(await Lr(`${xa.v1}/user`,e))}async function rl(e){return qs(await Lr(`${xa.v1}/user/mfa/verify`,e))}async function sl(e){return Qs(await Lr(`${xa.v1}/user/mfa/verify`,e))}async function ll(e){return Lr(`${ja.v1}/activate`,e)}async function cl(e){return Qs(await Lr(`${ja.v1}/activate`,e))}async function ul(e){return _r(`${ja.v1}/activate/strategy`,e)}async function dl(e){return Lr(`${ja.v1}/activate/reset`,e)}async function yl(e){return Lr(`${ja.v1}/invitation/reset`,e)}async function fl(e){return Lr(`${ja.v1}/invitation/accept`,e)}async function pl(){const e=Yr();return qs(await Lr(`${xa.v1}/user/token/refresh`,{tenantId:e}))}async function gl(){const e=Yr();return Hs(await Lr(`${xa.v1}/user/token/refresh`,{tenantId:e}))}async function Sl(){const e=Yr();return Qs(await Lr(`${xa.v1}/user/token/refresh`,{tenantId:e}))}async function vl(){return Lr(`${xa.v1}/logout`)}async function hl(e){return _r(`${vr}/logout`,e)}async function ml(e){return Lr(`${ja.v1}/passwords/reset`,e)}async function Al(e){return Lr(`${ja.v1}/passwords/reset/verify`,e)}async function bl(e){return _r(`${ja.v1}/passwords/config`,e)}async function Tl(e){return Lr(`${xa.v1}/user/mfa/recover`,e)}async function El(){return Lr(`${ja.v1}/mfa/enroll`)}async function kl(){return Lr(`${ja.v1}/mfa/authenticator/enroll`)}async function Ol(e){return Lr(`${ja.v1}/mfa/authenticator/enroll/verify`,e)}async function Il(e){return Lr(`${ja.v1}/mfa/sms/enroll`,e)}async function Pl(e){return Lr(`${ja.v1}/mfa/sms/enroll/verify`,e)}async function _l(){return Lr(`${ja.v1}/mfa/webauthn/enroll`)}async function Ll(e){return Lr(`${ja.v1}/mfa/webauthn/enroll/verify`,e)}async function wl(e){return Lr(`${ja.v1}/mfa/enroll/verify`,e)}async function Cl(e){return Lr(`${ja.v1}/mfa/disable`,e)}async function Ul(e,t){return Lr(`${ja.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Dl(e){return Lr(`${ja.v1}/mfa/sms/${e}/disable`)}async function Rl(e,t){return Lr(`${ja.v1}/mfa/sms/${e}/disable/verify`,t)}async function Nl(e){return Lr(`${ja.v1}/mfa/webauthn/${e}/disable`)}async function Ml(e,t){return Lr(`${ja.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Fl(){return _r(`${ja.v1}/mfa/devices`)}async function Gl(e){return Lr(`${xa.v1}/user/mfa/authenticator/enroll`,e)}async function $l(e){return Lr(`${xa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Vl(e){return Qs(await Lr(`${xa.v1}/user/mfa/authenticator/enroll/verify`,e))}async function xl(e,t){return Lr(`${xa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function jl(e){return Lr(`${xa.v1}/user/mfa/emailcode`,e)}async function Bl(e){return Lr(`${xa.v1}/user/mfa/emailcode/verify`,e)}async function Wl(e){return Qs(await Lr(`${xa.v1}/user/mfa/emailcode/verify`,e))}async function zl(e){return Lr(`${xa.v1}/user/mfa/sms/enroll`,e)}async function Kl(e){return Lr(`${xa.v1}/user/mfa/sms/enroll/verify`,e)}async function ql(e){return Qs(await Lr(`${xa.v1}/user/mfa/sms/enroll/verify`,e))}async function Hl(e,t){return Lr(`${xa.v1}/user/mfa/sms/${e}`,t)}async function Jl(e,t){return Lr(`${xa.v1}/user/mfa/sms/${e}/verify`,t)}async function Yl(e,t){return Qs(await Lr(`${xa.v1}/user/mfa/sms/${e}/verify`,t))}async function Ql(e){return Lr(`${xa.v1}/user/mfa/webauthn/enroll`,e)}async function Xl(e){return Lr(`${xa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Zl(e){return Qs(await Lr(`${xa.v1}/user/mfa/webauthn/enroll/verify`,e))}async function ec(e,t){return Lr(`${xa.v1}/user/mfa/webauthn/${e}`,t)}async function tc(e,t){return Lr(`${xa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function nc(e,t){return Qs(await Lr(`${xa.v1}/user/mfa/webauthn/${e}/verify`,t))}async function ic(){return _r(`${Za.v1}/saml/configurations`)}async function oc(e){return Lr(`${Za.v1}/saml/configurations`,e)}async function ac(){return _r(`${Za.v1}/saml/configurations/vendor-config`)}async function rc(e){return Cr(`${Za.v1}/saml/configurations/metadata`,e)}async function sc(){return Cr(`${Za.v1}/saml/validations/domain`)}async function lc(){return _r(`${Za.v1}/saml/configurations/roles/default`)}async function cc(){return _r(`${Za.v2}/saml/configurations/groups`)}async function uc({roleIds:e}){return Lr(`${Za.v1}/saml/configurations/roles/default`,{roleIds:e})}async function dc({roleIds:e,group:t}){return Lr(`${Za.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function yc({roleIds:e,group:t,id:n}){return wr(`${Za.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function fc({id:e}){return Ur(`${Za.v2}/saml/configurations/groups/${e}`)}async function pc(){return _r(`${Za.v1}/oidc/configurations`)}async function gc(){return _r(`${Za.v2}/configurations/public`)}async function Sc(){return _r(za.v1)}async function vc(){return _r(za.v2)}async function hc(){return _r(`${za.v2}/authenticated`)}async function mc(){return _r(za.custom.v1)}async function Ac({provider:e,code:t,idToken:n,redirectUri:i,codeVerifier:o,metadata:a,invitationToken:r,state:s}){const l={};return t&&(l.code=t),n&&(l.id_token=n),i&&(l.redirectUri=i),o&&(l.code_verifier=o),s&&(l.state=s),Lr(`${xa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function bc(){return _r(`${Ba.v1}/public`)}async function Tc(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Lr(`${ja.v1}/signUp`,e),a={shouldActivate:t,userId:i,tenantId:o};if(!t&&n){const{user:e,tenants:t,activeTenant:i}=await Qs(n);return R({},a,{user:e,tenants:t,activeTenant:i})}return a}async function Ec(){return _r(ja.sessions.currentUser.v1)}async function kc(){return _r(`${ja.sessions.currentUser.v1}/current`)}async function Oc(e){return Lr(`${ja.sessions.v1}/revoke`,{userId:e})}async function Ic(){return _r(ja.sessions.configurations.v1)}async function Pc(e){await Lr(ja.sessions.configurations.v1,e)}async function _c(e){await Ur(`${ja.sessions.currentUser.v1}/${e}`)}async function Lc(){await Ur(`${ja.sessions.currentUser.v1}/all`)}async function wc(){return _r(ja.accessTokens.v1)}async function Cc(){return _r(qa.accessTokens.v1)}async function Uc({id:e}){return Ur(`${qa.accessTokens.v1}/${e}`)}async function Dc({id:e}){return Ur(`${ja.accessTokens.v1}/${e}`)}async function Rc(e){return Lr(ja.accessTokens.v1,e)}async function Nc(e){return Lr(qa.accessTokens.v1,e)}async function Mc(){return _r(ja.apiTokens.v1)}async function Fc(){return _r(qa.apiTokens.v1)}async function Gc(e){return Lr(ja.apiTokens.v1,e)}async function $c(e){return Lr(qa.apiTokens.v2,e)}async function Vc({tokenId:e}){return Ur(`${qa.apiTokens.v1}/${e}`)}async function xc({tokenId:e}){return Ur(`${ja.apiTokens.v1}/${e}`)}async function jc({userId:e}){return _r(`${ja.v1}/${e}`)}async function Bc(e){return _r(`${Ba.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Wc(e){let{type:t}=e,n=Qi(e,Ws);return Lr(`${xa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function zc(e){let{type:t}=e,n=Qi(e,zs);return Qs(await Lr(`${xa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function Kc(e){let{type:t}=e,n=Qi(e,Ks);return Lr(`${xa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function qc({token:e}){return Lr(qa.invites.verify.v1,{token:e})}async function Hc(){return _r(`${Za.v1}/configurations`)}async function Jc(e){return Lr(`${Za.v1}/configurations`,e)}async function Yc(e,t){return wr(`${Za.v1}/configurations/${e}`,t)}async function Qc(e){return Ur(`${Za.v1}/configurations/${e}`)}async function Xc(e){return Lr(`${Za.v1}/configurations/metadata`,e)}async function Zc(e,t){return Cr(`${Za.v1}/configurations/${e}/metadata`,t)}async function eu(e){return Lr(`${Za.v1}/configurations/metadata-url`,e)}async function tu(e,t){return Cr(`${Za.v1}/configurations/${e}/metadata-url`,t)}async function nu(e,t){return Lr(`${Za.v1}/configurations/${e}/domains`,t)}async function iu(e,t){return Ur(`${Za.v1}/configurations/${e}/domains/${t}`)}async function ou(e,t){return Cr(`${Za.v1}/configurations/${e}/domains/${t}/validate`)}async function au(e){return _r(`${Za.v1}/configurations/${e}/roles`)}async function ru(e,t){return Cr(`${Za.v1}/configurations/${e}/roles`,t)}async function su(e,t){return Lr(`${Za.v1}/configurations/${e}/groups`,t)}async function lu(e,{roleIds:t,group:n,id:i}){return wr(`${Za.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function cu(e,t){return Ur(`${Za.v1}/configurations/${e}/groups/${t}`)}async function uu(e){return _r(`${Za.v1}/configurations/${e}/groups`)}async function du(e){return Lr(`${xa.v2}/user/sso/prelogin`,e)}async function yu(e){return qs(await Lr(`${xa.v2}/user/oidc/postlogin`,e))}async function fu(e){return Zs(await Lr(`${vr}/token`,e))}async function pu(){const e=Yr();return Zs(await Lr(`${vr}/authorize/silent`,{tenantId:e}))}async function gu(e){return Xs(await Lr(`${vr}/token`,e))}async function Su(){const e=Yr();return Xs(await Lr(`${vr}/authorize/silent`,{tenantId:e}))}async function vu(e){return Lr(`${ja.v1}/phone/reset`,e)}async function hu(e){return Lr(`${ja.v1}/phone/reset/verify`,e)}async function mu(e){return Lr(`${ja.v1}/phone`,e)}async function Au(e){return Lr(`${ja.v1}/phone/verify`,e)}async function bu(e){return Cr(`${ja.v1}/phone/change`,e)}async function Tu(e){return Lr(`${xa.v1}/webauthn/prelogin`,e)}async function Eu(e){return Lr(`${xa.v1}/webauthn/postlogin`,e)}async function ku(e){return Qs(await Lr(`${xa.v1}/webauthn/postlogin`,e))}async function Ou(){return Lr(Va.v1)}async function Iu(){return _r(Va.v1)}async function Pu(e){return Ur(`${Va.v1}/${e}`)}async function _u(e){return Lr(`${Va.v1}/verify`,e)}async function Lu(){return _r(`${Ba.v1}/auth/strategies/public`)}async function wu(){return _r(`${Ba.v1}/auth/strategies`)}async function Cu(){return _r(`${Ba.v1}/mfa/strategies`)}async function Uu(){return _r(`${ja.authorization.v1}`)}async function Du(){return _r(`${ja.v2}/me`)}async function Ru(){const[e]=Gr.getFeatureFlags([Mr],Fa.getAppName()||""),t=[{action:Du,shouldLoad:!0},{action:e?xs:Vs,shouldLoad:Js()},{action:Uu,shouldLoad:Ys()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[n,i,o]=await Promise.all(t),a=Yr();return a&&(n.tenantId=a),R({},n,null!=o?o:{},{entitlements:i})}async function Nu(e){return _r(`${ja.v2}/me`,null!=e?e:{addRoles:!0})}async function Mu(e){return Cr(`${ja.v2}/me`,e)}async function Fu(e){return Cr(`${ir.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Gu(e){return Lr(`${ja.v1}/passwords/change`,e)}async function $u(e){var t,n,i,o,a,r;const s=(e.filter||[]).reduce(((e,t)=>R({},e,{[t.id]:t.value})),{}),l=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(i=e.sort)||null==(o=i[0])?void 0:o.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return _r(er.v1,R({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function Vu(e){return Lr(ja.v2,R({},e,{provider:"local"}))}async function xu(e){return Ur(`${er.v1}/${e.userId}`)}async function ju(e){return Cr(er.v1,e)}async function Bu(e){return Lr(qa.invites.user.v1,R({},e))}async function Wu(e){return wr(qa.invites.user.v1,R({},e))}async function zu(){return Ur(qa.invites.user.v1)}async function Ku(){return _r(qa.invites.user.v1)}async function qu(){return _r(qa.invites.configuration.v1)}async function Hu(){return _r(tr.v1)}async function Ju(){return _r(Ka.v1)}async function Yu(){return _r(`${nr.v1}/members`)}async function Qu(e){return Lr(`${er.v1}/${e.userId}/resendActivationEmail`,{})}async function Xu(e){return Lr(ja.v2,R({},e,{provider:"local"}))}async function Zu(e){return Lr(ja.invitation.resendAll.v1,R({},e))}async function ed(e){var t,n;const i=await _r("/metadata",e);if(null!=i&&null!=(t=i.rows)&&t[0])return null==i||null==(n=i.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function td(){return _r("/metadata/admin-box")}async function nd(e){return Lr("/metadata/admin-box",e)}async function id(){const e=await _r("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const od=async()=>ed({entityName:"notifications"}),ad=async()=>ed({entityName:"saml"}),rd=async()=>ed({entityName:"audits"}),sd=async e=>async function(e){const t=await _r(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),ld=["dataFilters"],cd=["templateId","dataFilters"],ud=["dataFilters"];async function dd(e){return _r(`${dr.v2}/tenant-reports`,e)}async function yd(e){return _r(`${dr.v2}/${e.id}/tenant-reports`)}async function fd(e){let{dataFilters:t}=e,n=Qi(e,ld);return{html:await _r(`${yr.v1}/preview-report`,R({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function pd(e){let{templateId:t,dataFilters:n}=e,i=Qi(e,cd);return Lr(`${dr.v2}/${t}/tenant-reports`,R({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function gd(e){let{dataFilters:t}=e,n=Qi(e,ud);const i=await _r(`${yr.v1}/preview-report`,R({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),s=URL.createObjectURL(r),l=document.createElement("a");l.href=s,l.setAttribute("download",`report_${n.name||""}.${a}`),l.click(),setTimeout(l.remove.bind(l))}async function Sd(e){return Lr(`${yr.v1}/tenant-reports`,e)}async function vd(e){return _r(fr,{params:e})}async function hd(e){return Cr(`${fr}/status`,{params:e})}async function md(e){const{notificationId:t,pinStatus:n}=e;return Cr(`${fr}/${n}`,{notificationId:t})}async function Ad(){return Lr(`${fr}/status/mark-all-read`)}const bd=["endpoint","headerProps"];async function Td(e){return _r(pr,e)}async function Ed(e){return _r(`${pr}/stats`,e)}async function kd(e){const{endpoint:t,headerProps:n}=e,i=Qi(e,bd);return Dr(`${pr}/export/${t}`,{properties:n},i)}const Od=["eventKey"],Id=["eventKey"],Pd=()=>_r(`${sr.v1}/slack`),_d=()=>_r(`${sr.v1}/slack/applications`),Ld=()=>_r(`${sr.v1}/slack/channels`),wd=e=>e.id?wr(`${sr.v1}/slack/subscription/${e.id}`,e):Lr(`${sr.v1}/slack/subscriptions`,e),Cd=e=>Ur(`${sr.v1}/slack/subscriptions/${e.id}`),Ud=e=>Lr(`${sr.v1}/slack/applications/registrations`,{code:e}),Dd=()=>_r(`${sr.v1}/emails`),Rd=e=>{let{eventKey:t}=e,n=Qi(e,Od);return Lr(`${sr.v1}/emails/${t}`,n)},Nd=({eventKey:e,enabled:t})=>wr(`${sr.v1}/emails/${e}`,{enabled:t}),Md=(e,t)=>Ur(`${sr.v1}/emails/${e}/subscriptions/${t}`),Fd=(e,t,n)=>Cr(`${sr.v1}/emails/${t}/subscriptions/${e}`,n),Gd=e=>Ur(`${sr.v1}/emails/${e}`),$d=()=>_r(`${sr.v2}/sms`),Vd=e=>{let{eventKey:t}=e,n=Qi(e,Id);return Lr(`${sr.v2}/sms/${t}`,n)},xd=({eventKey:e,enabled:t})=>wr(`${sr.v2}/sms/${e}`,{enabled:t}),jd=(e,t)=>Ur(`${sr.v2}/sms/${e}/subscriptions/${t}`),Bd=(e,t,n)=>Cr(`${sr.v2}/sms/${t}/subscriptions/${e}`,n),Wd=e=>Ur(`${sr.v2}/sms/${e}`),zd=()=>_r(Sr),Kd=e=>e._id?wr(`${Sr}/${e._id}`,e):Lr(`${Sr}/custom`,e),qd=e=>Ur(`${Sr}/${e}`),Hd=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return _r(`${Sr}/logs/?${i.toString()}`)},Jd=e=>Lr(`${Sr}/test`,e),Yd=e=>Lr(`${Sr}/logs/${e}/retries`),Qd=()=>_r(`${gr.v1}/categories`),Xd=e=>_r(gr.v1,{channels:e});async function Zd(e,t){return Cr(or.v1,e,{headers:Rr(t)})}async function ey(e){return _r(or.v1,void 0,{headers:Rr(e)})}async function ty(){return _r(`${or.v1}/public`)}const ny=["roleId"],iy=["roleId"],oy=["permissionId"];async function ay(){return _r(Ha.v1)}async function ry(e){return Lr(Ha.v1,e)}async function sy({roleId:e}){return Ur(`${Ha.v1}/${e}`)}async function ly(e){let{roleId:t}=e,n=Qi(e,ny);return wr(`${Ha.v1}/${t}`,n)}async function cy(e){let{roleId:t}=e,n=Qi(e,iy);return Cr(`${Ha.v1}/${t}/permissions`,n)}async function uy(){return _r(Ka.v1)}async function dy(e){let{permissionId:t}=e,n=Qi(e,oy);return Cr(`${Ka.v1}/${t}/roles`,n)}async function yy(){return _r(`${Ka.v1}/categories`)}async function fy(){return _r(lr.subscriptions.v1)}async function py(e){return _r(`${lr.subscriptions.v1}/${e}`)}async function gy(e){return Cr(`${lr.subscriptions.v1}/${e}/cancellations/`,{})}async function Sy(e){return Cr(`${lr.subscriptions.v1}/${e}/renewals/`,{})}async function vy(e,{paymentMethodId:t,planId:n}){return Cr(`${lr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function hy(e){return _r(`${ur.v1}/${e}`)}async function my(){return _r(`${ur.v1}`)}async function Ay(e){return Cr(`${ur.v1}/${e}/cancellations/`,{})}async function by(e){return Cr(`${ur.v1}/${e}/renewals/`,{})}async function Ty(e,{paymentMethodId:t,planId:n}){return Cr(`${ur.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Ey(){return _r(lr.plans.v1)}async function ky(e){return _r(`${lr.plans.v1}/${e}`)}async function Oy(){return _r(lr.invoices.v1)}async function Iy(e){return _r(`${lr.invoices.v1}/${e}`)}async function Py(e,t){return _r(`${lr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const _y=["email"];async function Ly(){return _r(lr.paymentMethods.v1)}async function wy(e){return _r(`${lr.paymentMethods.v1}/${e}`)}async function Cy(e,t){let{email:n}=t,i=Qi(t,_y);return wr(`${lr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function Uy(e){return Lr(lr.paymentProviders.stripe.subscriptions.v1,e)}async function Dy(e){return _r(`${lr.paymentProviders.stripe.customers.v1}/${e}`)}async function Ry(e){return Lr(`${lr.paymentProviders.stripe.customers.v1}`,e)}async function Ny(){return _r(`${lr.paymentProviders.stripe.publicConfigurations.v1}`)}async function My(e){return Lr(`${lr.paymentProviders.stripe.setupIntents.v1}`,e)}async function Fy(e){return _r(`${lr.summaries.v1}/${e}`)}async function Gy(e){return _r(`${lr.tenantConfiguration.v1}/${e}`)}async function $y(e){return Lr(`${lr.tenantConfiguration.v1}`,e)}async function Vy(){return _r(cr.v1)}async function xy(){return _r(`${lr.configurations.vendorPublicConfigurations.v1}`)}let jy,By,Wy,zy,Ky,qy;async function Hy(){return _r("/vendors/public")}async function Jy(e){return _r(Ja.v1,e)}async function Yy(e){return Lr(Ja.v1,e)}async function Qy(e,t){return Ur(Ja.v1,e,{headers:Rr(t)})}async function Xy(e,t,n){return Lr(`${Ja.v1}/${e}/roles`,t,{headers:Rr(n)})}async function Zy(e,t,n){return Ur(`${Ja.v1}/${e}/roles`,t,{headers:Rr(n)})}async function ef(e,t,n){return wr(`${Ja.v1}/${e}/roles`,t,{headers:Rr(n)})}async function tf(e,t){return Lr(rr.v1,e,{headers:Rr(t)})}async function nf(e,t){return Ur(`${rr.v1}/${e}`,void 0,{headers:Rr(t)})}async function of({tenantId:e},t,n){return wr(`${rr.v1}/${e}`,t,{headers:Rr(n)})}async function af(e,t,n){return Cr(`${Ja.v1}/${e}/access`,t,{headers:Rr(n)})}async function rf(e,t){return Lr(`${Ja.v2}/`,e,{headers:Rr(t)})}async function sf(){return _r(`${mr}`)}async function lf(e,t){return wr(`${mr}/${e}`,t)}async function cf(e){return Lr(`${mr}`,e)}async function uf(e){return Ur(`${mr}/${e}`)}async function df(e){return _r(`${Ar}/${e}/Users/count`)}async function yf(e){return Lr(`${Ya.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(jy||(jy={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(By||(By={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Wy||(Wy={})),(zy||(zy={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Ky||(Ky={})),function(e){e.CREATE="create_customer"}(qy||(qy={}));const ff=["groupId"];async function pf({groupId:e},t){return _r(`${Qa.v1}/${e}`,R({},t))}async function gf(e){return _r(`${Qa.v1}`,R({},e))}async function Sf(e,t){return Lr(`${Qa.getByIds.v1}`,e,{params:t})}async function vf(e){return Lr(`${Qa.v1}`,e)}async function hf(e){let{groupId:t}=e,n=Qi(e,ff);return wr(`${Qa.v1}/${t}`,n)}async function mf(e){return Ur(`${Qa.v1}/${e}`)}async function Af(e,t){return Lr(`${Qa.v1}/${e}/roles`,t)}async function bf(e,t){return Ur(`${Qa.v1}/${e}/roles`,t)}async function Tf(e,t){return Lr(`${Qa.v1}/${e}/users`,t)}async function Ef(e,t){return Ur(`${Qa.v1}/${e}/users`,t)}async function kf(){return _r(`${Qa.configurations.v1}`)}async function Of(e){return Lr(`${Qa.configurations.v1}`,e)}async function If(){return _r(Er.v1)}async function Pf(){return _r(kr.v1)}async function _f(e){return _r(`${Xa.v1}`,e)}async function Lf(e){return Lr(`${Xa.v1}`,e)}async function wf(e){return Ur(`${Xa.v1}/${e}`)}async function Cf(e){return Lr(`${Xa.v1}/preverify`,e)}async function Uf(e){return Lr(`${Xa.v1}/verify`,e)}async function Df(e,t){return Lr(`${Xa.v1}/${e}/delete/verify`,t)}let Rf,Nf,Mf;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Rf||(Rf={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(Nf||(Nf={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Mf||(Mf={}));const Ff=[/^(.*)\/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],Gf=`${xa.v1}/user/token/refresh`,$f=`${vr}/authorize/silent`,Vf=`${ja.v2}/me`,xf=`${ja.v2}/me/tenants`,jf=`${ja.v3}/me/tenants`;let Bf,Wf,zf,Kf,qf,Hf,Jf,Yf;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Bf||(Bf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Wf||(Wf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(zf||(zf={})),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"}(Kf||(Kf={})),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"}(qf||(qf={})),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"}(Hf||(Hf={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(Jf||(Jf={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(Yf||(Yf={}));const Qf={auth:s,teams:l,metadata:c,reports:u,connectivity:f,notifications:d,audits:y,tenants:a,accountSettings:p,roles:g,subscriptions:S,vendor:v,subTenants:h,featureFlags:t,directory:m,impersonate:A,groups:b,users:o,entitlements:r,securityCenter:T,userPhoneNumbers:E};var Xf={fetch:e,ContextHolder:Fa,FronteggContext:Ga,api:Qf,FronteggApiError:$a,AuthStrategyEnum:ki,MachineToMachineAuthStrategy:Oi,SocialLoginProviders:Ei,ISubscriptionCancellationPolicy:Wy,ISubscriptionStatus:jy,PaymentMethodType:By,ProviderType:zy};let Zf,ep;!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"}(Zf||(Zf={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(ep||(ep={}));const tp="input is invalid type",np="undefined"!=typeof ArrayBuffer,ip="0123456789abcdef".split(""),op=[-2147483648,8388608,32768,128],ap=[24,16,8,0],rp=[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],sp=["hex","array","digest","arrayBuffer"],lp=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),np&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const cp=function(e){return function(t){const n=new dp(!0).update(t);return null==n?void 0:n[e]()}},up=function(e){return function(t,n){const i=new yp(t,!0).update(n);return null==i?void 0:i[e]()}};class dp{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=()=>dp.prototype.digest(),e?(lp[0]=lp[16]=lp[1]=lp[2]=lp[3]=lp[4]=lp[5]=lp[6]=lp[7]=lp[8]=lp[9]=lp[10]=lp[11]=lp[12]=lp[13]=lp[14]=lp[15]=0,this.blocks=lp):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(tp);if(null===e)throw new Error(tp);if(np&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||np&&ArrayBuffer.isView(e)))throw new Error(tp);t=!0}let i,o,a=0;const r=e.length,s=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)for(o=this.start;a<r&&o<64;++a)s[o>>2]|=e[a]<<ap[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<ap[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<ap[3&o++],s[o>>2]|=(128|63&i)<<ap[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<ap[3&o++],s[o>>2]|=(128|i>>6&63)<<ap[3&o++],s[o>>2]|=(128|63&i)<<ap[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<ap[3&o++],s[o>>2]|=(128|i>>12&63)<<ap[3&o++],s[o>>2]|=(128|i>>6&63)<<ap[3&o++],s[o>>2]|=(128|63&i)<<ap[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=s[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}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]|=op[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,i,o,a,r,s,l,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)o=m[e-15],t=(o>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,o=m[e-2],n=(o>>>17|o<<15)^(o>>>19|o<<13)^o>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(s=704751109,o=m[0]-210244248,h=o-1521486534<<0,p=o+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),s=d&y,i=s^d&f^u,r=g&S^~g&v,o=h+n+r+rp[e]+m[e],a=t+i,h=p+o<<0,p=o+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),l=p&d,i=l^p&y^s,r=h&g^~h&S,o=v+n+r+rp[e+1]+m[e+1],a=t+i,v=f+o<<0,f=o+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,i=c^f&d^l,r=v&h^~v&g,o=S+n+r+rp[e+2]+m[e+2],a=t+i,S=y+o<<0,y=o+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,i=u^y&p^c,r=S&v^~S&h,o=g+n+r+rp[e+3]+m[e+3],a=t+i,g=d+o<<0,d=o+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,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7;let l=ip[e>>28&15]+ip[e>>24&15]+ip[e>>20&15]+ip[e>>16&15]+ip[e>>12&15]+ip[e>>8&15]+ip[e>>4&15]+ip[15&e]+ip[t>>28&15]+ip[t>>24&15]+ip[t>>20&15]+ip[t>>16&15]+ip[t>>12&15]+ip[t>>8&15]+ip[t>>4&15]+ip[15&t]+ip[n>>28&15]+ip[n>>24&15]+ip[n>>20&15]+ip[n>>16&15]+ip[n>>12&15]+ip[n>>8&15]+ip[n>>4&15]+ip[15&n]+ip[i>>28&15]+ip[i>>24&15]+ip[i>>20&15]+ip[i>>16&15]+ip[i>>12&15]+ip[i>>8&15]+ip[i>>4&15]+ip[15&i]+ip[o>>28&15]+ip[o>>24&15]+ip[o>>20&15]+ip[o>>16&15]+ip[o>>12&15]+ip[o>>8&15]+ip[o>>4&15]+ip[15&o]+ip[a>>28&15]+ip[a>>24&15]+ip[a>>20&15]+ip[a>>16&15]+ip[a>>12&15]+ip[a>>8&15]+ip[a>>4&15]+ip[15&a]+ip[r>>28&15]+ip[r>>24&15]+ip[r>>20&15]+ip[r>>16&15]+ip[r>>12&15]+ip[r>>8&15]+ip[r>>4&15]+ip[15&r];return l+=ip[s>>28&15]+ip[s>>24&15]+ip[s>>20&15]+ip[s>>16&15]+ip[s>>12&15]+ip[s>>8&15]+ip[s>>4&15]+ip[15&s],l}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7,l=[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,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return l.push(s>>24&255,s>>16&255,s>>8&255,255&s),l}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 yp extends dp{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const i=typeof e;if("string"===i){const t=[],i=e.length;let o,a=0;for(n=0;n<i;++n)o=e.charCodeAt(n),o<128?t[a++]=o:o<2048?(t[a++]=192|o>>6,t[a++]=128|63&o):o<55296||o>=57344?(t[a++]=224|o>>12,t[a++]=128|o>>6&63,t[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++n)),t[a++]=240|o>>18,t[a++]=128|o>>12&63,t[a++]=128|o>>6&63,t[a++]=128|63&o);e=t}else{if("object"!==i)throw new Error(tp);if(null===e)throw new Error(tp);if(np&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||np&&ArrayBuffer.isView(e)))throw new Error(tp)}var o;e.length>64&&(e=null==(o=new dp(!0).update(e))?void 0:o.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}dp.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();dp.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),dp.prototype.finalize.call(this)}}}const fp=function(){const e=cp("hex");e.create=function(){return new dp},e.update=function(t){return e.create().update(t)};for(let t=0;t<sp.length;++t){const n=sp[t];e[n]=cp(n)}return e}();function pp(e,t){const n=R({},e);return t.forEach((e=>{delete n[e]})),n}async function gp(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=fp.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Sp(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=up("hex");e.create=function(e){return new yp(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<sp.length;++t){const n=sp[t];e[n]=up(n)}}();const vp=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*hp(e){const t=yield jo((e=>e.root.appName));return Gr.getFeatureFlags(e,t)}const mp={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Ap=R({},mp,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),bp=[{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"}],Tp={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},Ep=R({},Tp,{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}),kp={loading:!1,error:void 0,saving:!0,profile:Tp},Op={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"},Ip={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:ki.EmailAndPassword,machineToMachineAuthStrategy:Oi.ClientCredentials},Pp={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},_p={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Lp={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},wp={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},Cp={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Up=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Dp={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:wp,roles:Up,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Rp=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Np={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:[bp[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[bp[0]],managedBy:zf.FRONTEGG}]},Mp={id:Np.id,email:Np.email,name:Np.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:[bp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Fp={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:[bp[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[bp[0]],managedBy:zf.FRONTEGG}]},Gp={id:Fp.id,email:Fp.email,name:Fp.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:[bp[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},Vp=[Fp,Np],xp=[Gp,Mp],jp=[$p],Bp=[{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}],Wp=[{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"}],zp={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Kp={isActive:!0,strategy:Wn.ALLOW},qp=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Wn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Wn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Wn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Wn.BLOCK,description:"IP 4"}],Hp=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(R({},Fp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Jp=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"}),Yp=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Hp(6),roles:[Jp("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:zf.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Hp(44),roles:[Jp("Editor")],managedBy:zf.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Hp(8),roles:[Jp("Viewer")],managedBy:zf.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Hp(5),roles:[Jp("Admin")],managedBy:zf.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Hp(21),description:"BDR, AE, and inside sales",roles:[Jp("Viewer")],managedBy:zf.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Hp(23),description:"Dev success and customer success",roles:[Jp("Admin")],managedBy:zf.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Hp(10),description:"The marketing department",roles:[Jp("Viewer")],managedBy:zf.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Hp(4),description:"Human resources",roles:[Jp("Viewer")],managedBy:zf.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Hp(3),roles:[Jp("Viewer")],managedBy:zf.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Hp(8),roles:[Jp("Editor")],managedBy:zf.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Hp(4),roles:[Jp("Viewer")],managedBy:zf.FRONTEGG}],Qp={scoring:{score:79},recommendations:{items:[{code:Kf.FORCE_MFA,severity:Jf.WARNING,category:Yf.MFA},{code:Kf.ENABLE_FORCE_RELOGIN,severity:Jf.WARNING,category:Yf.SESSIONS}]}},Xp={insights:{items:[{category:Yf.MFA,code:qf.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:Yf.SESSIONS,code:qf.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:Yf.PASSWORD,code:qf.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:Yf.DOMAIN,code:qf.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},Zp={users:xp,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},eg={users:[xp[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},tg={users:[xp[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0};let ng,ig,og;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(ng||(ng={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(ig||(ig={})),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"}(og||(og={})),og.profile,og.privacy,og.personalApiTokens,og.account,og.users,og.groups,og.security,og.sso,og.audits,og.webhooks,og.apiTokens,og.roles,og.subscriptions,og.allAccounts;const ag=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},rg=e=>{const{pathname:t}=new URL(e),n=ag(e);return n?t+n:t},sg=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},lg="tenantId",cg=e=>e.mfaRequired&&e.mfaToken?(Fa.setAccessToken(null),Fa.setUser(null),!0):(Fa.setAccessToken(e.accessToken),Fa.setUser(e),!1),ug=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return cn.authenticatorApp;if(t)return cn.smsVerifyCode}return cn.verify},dg=e=>{if(1===e.length){const[t]=e;if(t===Gs.AuthenticatorApp)return cn.authenticatorApp;if(t===Gs.SMS)return cn.smsSetPhoneNumber;if(t===Gs.EmailCode)return cn.emailVerifyCode}return cn.verify};function*yg(e){let t=_t.loginWithTwoFactor,n={};const{loginState:i}=yield jo((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield $o(Qf.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:ug(e.mfaDevices)}:(n={step:dg(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=_t.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:Lt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:R({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a,isBreachedPassword:e.isBreachedPassword})}}const fg=(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 pg;function gg(e,t){var n,i;null==(n=(i=window).onFronteggEvent)||n.call(i,e,t)}!function(e){e.SIGNUP_COMPLETED="signup_completed",e.USER_VERIFIED="user_verified"}(pg||(pg={}));const Sg=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,...Sg(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),vg=["callback"];function*hg(){yield Mo(Gi.setCustomLoginState({loading:!0}));try{const e=yield $o(Qf.metadata.getAdminBoxMetadata);yield Mo(Gi.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield Mo(Gi.setCustomLoginState({loading:!1,error:fg(e)}))}}function*mg(e){let{payload:{callback:t}}=e,n=Qi(e.payload,vg);try{yield Mo(Gi.setCustomLoginState({error:null,saving:!0}));const e=Sg(n);if(0===e.length)throw new Error("No changes to update");yield $o(Qf.metadata.updateAdminBoxMetadata,{actions:e});const i=yield $o(Qf.metadata.getAdminBoxMetadata);yield Mo(Gi.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setCustomLoginState({error:fg(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Ag(){var e;const[t]=yield $o(hp,["admin_portal_login_per_tenant"]),n=!(null==(e=Fa.getContext())||!e.tenantResolver);if(yield jo((e=>e.auth.isAuthenticated))){var i;const e=yield null!=(i=jo((({auth:e})=>{var t;return null==(t=e.tenantsState.activeTenant)?void 0:t.hasCustomLogin})))&&i;return t&&n&&e}return t&&n}function*bg(){try{var e;if(!(yield $o(Ag)))return;const t=yield jo((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:i}=Qf.accountSettings,{applicationUrl:o}=yield $o(t?n:i);if(!o)return;const{routes:a}=yield jo((e=>e.auth)),r=null!=(e=ag(o))?e:"";yield Mo(Gi.setState({routes:R({},a,{customLoginAuthenticatedUrl:o,customLoginUrl:a.loginUrl+r})})),yield Mo(Gi.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*Tg(){yield Ma(Gi.loadTenantMetadata,hg),yield Ma(Gi.updateTenantMetadata,mg)}let Eg;!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"}(Eg||(Eg={}));const kg=["callback"];function Og(e){return function*(t){const[n]=yield $o(hp,["security-center-admin-portal-major-version"]);yield e(t),n&&(yield Ig(),yield Pg())}}function*Ig(){const e=Eg.RECOMMENDATIONS;yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:i}=yield $o(Qf.securityCenter.getRecommendations);yield Mo(Gi.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==i?void 0:i.score)?t:0}))}catch(t){yield Mo(Gi.setSecurityCenterStateError({key:e,value:fg(t)}))}finally{yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Pg(){const e=Eg.INSIGHTS;yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield $o(Qf.securityCenter.getInsights);yield Mo(Gi.setSecurityCenterState({insights:t.items}))}catch(t){yield Mo(Gi.setSecurityCenterStateError({key:e,value:fg(t)}))}finally{yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}}function*_g(e){let{payload:{callback:t}}=e,n=Qi(e.payload,kg);const i=Eg.SEND_BREACHED_PASSWORD_EMAIL;yield Mo(Gi.setSecurityCenterStateError({key:i,value:!1})),yield Mo(Gi.setSecurityCenterStateLoader({key:i,value:!0}));try{yield $o(Qf.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield Mo(Gi.setSecurityCenterStateError({key:i,value:fg(e)})),null==t||t(!1,e)}finally{yield Mo(Gi.setSecurityCenterStateLoader({key:i,value:!1}))}}function*Lg({payload:{callback:e}}){const t=Eg.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield Mo(Gi.setSecurityCenterStateError({key:t,value:!1})),yield Mo(Gi.setSecurityCenterStateLoader({key:t,value:!0}));try{yield $o(Qf.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield Mo(Gi.setSecurityCenterStateError({key:t,value:fg(n)})),null==e||e(!1)}finally{yield Mo(Gi.setSecurityCenterStateLoader({key:t,value:!1}))}}function*wg({key:e,tableState:t,updateStateKey:n,_offset:i,_limit:o,_preset:a,_email:r,_maxInactiveSeconds:s}){var l,c,u,d;yield Mo(Gi.setSecurityCenterStateError({key:e,value:!1})),yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0}));const y=null!=(l=null!=i?i:null==t||null==(c=t.queryParams)?void 0:c._offset)?l:0,f=null!=(u=null!=o?o:null==t||null==(d=t.queryParams)?void 0:d._limit)?u:10,p=R({_offset:y,_limit:f,_includeSubTenants:!1,_preset:a,_maxInactiveSeconds:s},!!r&&{_email:r});try{const{items:t,_metadata:{totalItems:i,totalPages:o}}=yield $o(Qf.users.getUsersV3,p),a={totalUsersItems:i,totalUsersPages:o,usersPageOffset:y,queryParams:R({_offset:y,_limit:f,_maxInactiveSeconds:s},!!r&&{_email:r})};if(t.length){const e=yield function*(e){const t=e.map((e=>e.id)),n=yield $o(Qf.roles.getRoles),i=yield $o(Qf.users.getUsersRoles,{ids:t});return e.map((e=>{var t,o;const a=null==i||null==(t=i.find((t=>t.userId===e.id)))?void 0:t.roleIds;return R({},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:[]})}))}(t);yield Mo(Gi.setSecurityCenterState({[n]:R({users:e},a)}))}else yield Mo(Gi.setSecurityCenterState({[n]:R({users:[]},a)}))}catch(t){yield Mo(Gi.setSecurityCenterStateError({key:e,value:fg(t)}))}finally{yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Cg({payload:e}){var t;const n=Eg.BREACHED_PASSWORD_USERS_TABLE,i=yield null!=(t=jo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield wg(R({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:fi.BREACHED_PASSWORDS,tableState:i},e))}function*Ug({payload:e}){var t;const n=Eg.UNENROLLED_MFA_USERS_TABLE,i=yield null!=(t=jo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield wg(R({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:fi.MFA_UNENROLLED,tableState:i},e))}function*Dg({payload:e}){var t;const n=Eg.INACTIVE_USERS_TABLE,i=yield null!=(t=jo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield wg(R({key:n,updateStateKey:"inactiveUsersTable",_preset:fi.INACTIVE,tableState:i},e))}function*Rg(){yield Ra(Gi.loadRecommendations,Ig),yield Ra(Gi.loadInsights,Pg),yield Ra(Gi.sendResetBreachedPasswordEmail,_g),yield Ra(Gi.sendBulkResetBreachedPasswordEmails,Lg),yield Ra(Gi.loadBreachedPasswordUsers,Cg),yield Ra(Gi.loadUnenrolledMfaUsers,Ug),yield Ra(Gi.loadInactiveUsers,Dg)}function*Ng(){const e=Eg.RECOMMENDATIONS;yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0})),yield Bo(500),yield Mo(Gi.setSecurityCenterState({recommendations:Qp.recommendations.items,score:Qp.scoring.score})),yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}function*Mg(){const e=Eg.INSIGHTS;yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0})),yield Bo(500),yield Mo(Gi.setSecurityCenterState({insights:Xp.insights.items})),yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}function*Fg(){const e=Eg.BREACHED_PASSWORD_USERS_TABLE;yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0})),yield Bo(500),yield Mo(Gi.setSecurityCenterState({breachedPasswordUsersTable:Zp})),yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}function*Gg(){const e=Eg.UNENROLLED_MFA_USERS_TABLE;yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0})),yield Bo(500),yield Mo(Gi.setSecurityCenterState({unenrolledMfaUsersTable:tg})),yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}function*$g(){const e=Eg.INACTIVE_USERS_TABLE;yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0})),yield Bo(500),yield Mo(Gi.setSecurityCenterState({inactiveUsersTable:eg})),yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}function*Vg({payload:{callback:e}}){const t=Eg.SEND_BREACHED_PASSWORD_EMAIL;yield Mo(Gi.setSecurityCenterStateLoader({key:t,value:!0})),yield Bo(500),null==e||e(!0),yield Mo(Gi.setSecurityCenterStateLoader({key:t,value:!1}))}function*xg(){yield Ra(Gi.loadRecommendations,Ng),yield Ra(Gi.loadInsights,Mg),yield Ra(Gi.loadBreachedPasswordUsers,Fg),yield Ra(Gi.loadUnenrolledMfaUsers,Gg),yield Ra(Gi.loadInactiveUsers,$g),yield Ra(Gi.sendResetBreachedPasswordEmail,Vg)}const jg=["callback"],Bg=["callback"],Wg=["callback"],zg=["callback"],Kg=["callback"],qg=["callback"];function*Hg(){yield Mo(Gi.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield $o(Qf.auth.getGlobalSecurityPolicy);yield Mo(Gi.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyGlobalState({error:fg(e),loading:!1}))}yield Mo(Gi.loadSecurityPolicyMfa()),yield Mo(Gi.loadSecurityPolicyVendorMfa()),yield Mo(Gi.loadSecurityPolicyLockout()),yield Mo(Gi.loadSecurityPolicyVendorLockout()),yield Mo(Gi.loadSecurityPolicyVendorPasswordHistory()),yield Mo(Gi.loadSecurityPolicyCaptcha()),yield Mo(Gi.loadPublicAuthStrategiesPolicy())}function*Jg(e){var t,n;if(!(yield $o(Ag)))return e;const i=yield $o(Qg);return null!=i&&null!=(t=i.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?R({},e,{authStrategy:i.mainAuthStrategies[0].strategy}):e}function*Yg(){yield Mo(Gi.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield $o(Qf.auth.getVendorConfig),t=yield Jg(e);yield Mo(Gi.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyPublicState({error:fg(e),loading:!1}))}}function*Qg(){const e=yield jo((({auth:e})=>e.isAuthenticated));let t;return t=e?yield $o(Qf.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield $o(Qf.auth.getVendorPublicAuthStrategiesConfig),t}function*Xg(){yield Mo(Gi.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield $o(Qg);yield function*(e){const t=yield $o(Ag);if(!e||!t)return;const{policy:n}=yield jo((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield Mo(Gi.setSecurityPolicyPublicState({policy:R({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield Mo(Gi.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyAuthStrategyPublicState({error:fg(e),loading:!1}))}}function*Zg(){yield Mo(Gi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield $o(Qf.auth.getMfaPolicy);yield Mo(Gi.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyMfaState({error:fg(e),loading:!1}))}}function*eS(){yield Mo(Gi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield $o(Qf.auth.getVendorMfaPolicy);yield Mo(Gi.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyVendorMfaState({error:fg(e),loading:!1}))}}function*tS(e){let{payload:{callback:t}}=e,n=Qi(e.payload,jg);yield Mo(Gi.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield $o(Qf.auth.saveMfaPolicy,n);yield Mo(Gi.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setSecurityPolicyMfaState({saving:!1,error:fg(e)})),null==t||t(null,e)}}function*nS(){yield Mo(Gi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield $o(Qf.auth.getLockoutPolicy);yield Mo(Gi.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyLockoutState({error:fg(e),loading:!1}))}}function*iS(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Bg);yield Mo(Gi.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield $o(Qf.auth.saveLockoutPolicy,n);yield Mo(Gi.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setSecurityPolicyLockoutState({saving:!1,error:fg(e)})),null==t||t(null,e)}}function*oS(){yield Mo(Gi.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield $o(Qf.auth.getVendorLockoutPolicy);yield Mo(Gi.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyVendorLockoutState({error:fg(e),loading:!1}))}}function*aS(){yield Mo(Gi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield $o(Qf.auth.getCaptchaPolicy);yield Mo(Gi.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyCaptchaState({error:fg(e),loading:!1}))}}function*rS(){yield Mo(Gi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield $o(Qf.auth.getPasswordHistoryPolicy);yield Mo(Gi.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyPasswordHistoryState({error:fg(e),loading:!1}))}}function*sS(){yield Mo(Gi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield $o(Qf.auth.getVendorPasswordHistoryPolicy);yield Mo(Gi.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyVendorPasswordHistoryState({error:fg(e),loading:!1}))}}function*lS(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Wg);yield Mo(Gi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield $o(Qf.auth.savePasswordHistoryPolicy,n);yield Mo(Gi.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setSecurityPolicyPasswordHistoryState({saving:!1,error:fg(e)})),null==t||t(null,e)}}function*cS(){yield Mo(Gi.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield $o(Qf.auth.getPasswordConfigPolicy);yield Mo(Gi.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyPasswordState({error:fg(e),loading:!1}))}}function*uS(){yield Ma(Gi.loadSecurityPolicy,Hg),yield Ra(Gi.saveSecurityPolicyMfa,Og(tS)),yield Ra(Gi.loadSecurityPolicyMfa,Zg),yield Ra(Gi.loadSecurityPolicyVendorMfa,eS),yield Ra(Gi.saveSecurityPolicyLockout,Og(iS)),yield Ra(Gi.loadSecurityPolicyLockout,nS),yield Ra(Gi.loadSecurityPolicyVendorLockout,oS),yield Ra(Gi.loadSecurityPolicyCaptcha,aS),yield Ra(Gi.saveSecurityPolicyPasswordHistory,Og(lS)),yield Ra(Gi.loadSecurityPolicyPasswordHistory,rS),yield Ra(Gi.loadSecurityPolicyVendorPasswordHistory,sS),yield Ra(Gi.loadVendorPasswordConfig,cS),yield Ra(Gi.loadPublicSecurityPolicy,Yg),yield Ra(Gi.loadPublicAuthStrategiesPolicy,Xg)}function*dS(){yield Mo(Gi.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Mo(Gi.setSecurityPolicyPublicState({policy:Ip,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyPublicState({error:fg(e),loading:!1}))}}function*yS(){yield Mo(Gi.setSecurityPolicyGlobalState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyGlobalState({policy:Op,loading:!1})),yield Mo(Gi.loadSecurityPolicyMfa()),yield Mo(Gi.loadSecurityPolicyVendorMfa()),yield Mo(Gi.loadSecurityPolicyLockout()),yield Mo(Gi.loadSecurityPolicyVendorLockout()),yield Mo(Gi.loadSecurityPolicyPasswordHistory()),yield Mo(Gi.loadSecurityPolicyVendorPasswordHistory()),yield Mo(Gi.loadSecurityPolicyCaptcha())}function*fS(){yield Mo(Gi.setSecurityPolicyMfaState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyMfaState({policy:Pp,loading:!1}))}function*pS(){yield Mo(Gi.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyVendorMfaState({policy:Pp,loading:!1}))}function*gS(e){var t;let{payload:{callback:n}}=e,i=Qi(e.payload,zg);yield Mo(Gi.setSecurityPolicyMfaState({saving:!0,error:null}));const o=R({},_p,{id:null!=(t=i.id)?t:_p.id,enforceMFAType:i.enforceMFAType});yield Et(),yield Mo(Gi.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*SS(){yield Mo(Gi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyLockoutState({policy:_p,loading:!1}))}function*vS(){yield Mo(Gi.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyVendorLockoutState({policy:_p,loading:!1}))}function*hS(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Kg);yield Mo(Gi.setSecurityPolicyLockoutState({saving:!0,error:null})),yield Et();const i=R({},_p,n,{id:n.id?n.id:_p.id});null==t||t(i),yield Mo(Gi.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*mS(){yield Mo(Gi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyLockoutState({policy:_p,loading:!1}))}function*AS(){yield Mo(Gi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyPasswordHistoryState({policy:Lp,loading:!1}))}function*bS(){yield Mo(Gi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyVendorPasswordHistoryState({policy:Lp,loading:!1}))}function*TS(e){let{payload:{callback:t}}=e,n=Qi(e.payload,qg);yield Mo(Gi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield Et();const i=R({},Lp,n,{id:n.id?n.id:Lp.id});null==t||t(i),yield Mo(Gi.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*ES(){yield Ma(Gi.loadSecurityPolicy,yS),yield Ra(Gi.loadPublicSecurityPolicy,dS),yield Ra(Gi.saveSecurityPolicyMfa,gS),yield Ra(Gi.loadSecurityPolicyMfa,fS),yield Ra(Gi.loadSecurityPolicyVendorMfa,pS),yield Ra(Gi.saveSecurityPolicyLockout,hS),yield Ra(Gi.loadSecurityPolicyLockout,SS),yield Ra(Gi.loadSecurityPolicyVendorLockout,vS),yield Ra(Gi.loadSecurityPolicyCaptcha,mS),yield Ra(Gi.saveSecurityPolicyPasswordHistory,TS),yield Ra(Gi.loadSecurityPolicyPasswordHistory,AS),yield Ra(Gi.loadSecurityPolicyVendorPasswordHistory,bS)}const kS=["events","url"];function*OS(){yield Mo(Gi.setSignUpState({loading:!0}));try{const e=yield $o(Qf.auth.getVendorConfig),t=yield Jg(e),{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield Mo(Gi.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield Mo(Gi.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Mo(Gi.setSignUpState({loading:!1,error:fg(e),firstLoad:!1}))}}function*IS(e){let{payload:{events:t,url:n}}=e,i=Qi(e.payload,kS);yield Mo(Gi.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield jo((e=>e.auth)),{shouldActivate:r,user:s,tenantId:l,userId:c,tenants:u=[],activeTenant:d}=yield $o(Qf.auth.signUpUser,i);if(!i.invitationToken){var o;const{email:e,name:a,companyName:r}=i,s={email:e,name:a,companyName:r,url:n,authenticationType:ig.PASSWORD,id:c,tenantId:l,createdAt:new Date};null==t||null==(o=t.signUpComplete)||o.call(t,s),gg(pg.SIGNUP_COMPLETED,s)}if(!r&&s&&cg(s)){const t=yield yg(s);yield Mo(Gi.setState(t)),a(e.loginUrl)}else{const{tenantsState:e}=yield jo((e=>e.auth));yield Mo(Gi.setSignUpState({loading:!1,shouldActivate:r,stage:mn.SignUpSuccess})),yield Mo(Gi.setState({user:s,isAuthenticated:!(null==s||!s.accessToken),tenantsState:R({},e,{tenants:u,activeTenant:d})}))}}catch(e){Fa.setAccessToken(null),Fa.setUser(null),yield Mo(Gi.setSignUpState({loading:!1,error:fg(e)}))}yield Mo(Gi.setSignUpState({loading:!1}))}function*PS(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield jo((e=>e.auth.signUpState));yield Mo(Gi.resetSignUpState()),yield Mo(Gi.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*_S(){yield Ma(Gi.signUpUser,IS),yield Ma(Gi.resetSignUpStateSoft,PS)}const LS={setVendorState:(e,{payload:t})=>R({},e,t)},wS={loadVendorPublicInfo:yt("vendor/loadVendorPublicInfo")},CS={loading:!1},{reducer:US,actions:DS}=pt({name:Mt,initialState:CS,reducers:R({},LS)}),RS=R({},DS,wS);function*NS(){yield Mo(RS.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Qf.vendor.getVendorPublicInfo();yield Mo(RS.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Mo(RS.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var MS=n(378),FS=n.n(MS);function GS(e,t){return FS()(e,t)}function*$S({payload:e}){const t=null==e?void 0:e.callback,[n]=yield $o(hp,[Mr]);try{const e=yield $o(n?Qf.entitlements.loadEntitlementsV2:Qf.entitlements.loadEntitlements);yield function*(e){GS(yield jo((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield Mo(Gi.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*VS(){yield Ma(Gi.loadEntitlements,$S)}const xS=["callback"],jS=["callback"],BS=["callback"],WS=["callback"],zS=["callback","events"],KS=["callback"],qS=["callback"],HS=["callback"],JS=["callback"],YS=["user"],QS=["callback"],XS=["callback"],ZS=["callback"],ev=["callback"],tv=["callback"],nv=["callback","deviceId"],iv=["callback"],ov=["callback"],av=["callback","deviceId"],rv=["callback","deviceId"],sv=["callback","deviceId"];function*lv(e){const t=yield jo((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return GS(t,null==e?void 0:e.entitlements)?R({},e,{entitlements:t}):e}function*cv({user:e,tenants:t=[],activeTenant:n},i={}){const{tenantsState:o}=yield jo((e=>e.auth));yield Mo(Gi.setState(R({user:e,tenantsState:R({},o,{tenants:t,activeTenant:n,loading:!1})},i)))}function*uv(){const e=Fa.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield jo((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:s,activateUrl:l}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;u||(yield $o(bg),u=yield jo((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})));const d=window.localStorage.getItem(Ct);d&&![a,r,s,l].includes(d)&&(c=d),window.localStorage.removeItem(Ct),yield Et(200),Mo(Gi.resetLoginState());const y=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:i})=>{let o=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),i=new URL(e),o=i.origin===n.origin;return t.includes(i.origin)||o})(a,n)?o=a:console.warn("The redirect url param is not valid, the origin is a different site"):o=a:i&&(o+=window.location.search),o})({authenticatedUrl:u?rg(u):c,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});e(y,{refresh:y.startsWith("http")})}function*dv(){let e;try{var t;const n=yield $o(Qf.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield Mo(Gi.setState({ssoACS:e}))}function*yv(){try{const{isActive:e}=yield $o(Qf.auth.getSSOPublicConfiguration);yield Mo(Gi.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*fv(e){var t;const{routes:n,loginState:i}=yield jo((e=>e.auth)),o=null!=(t=localStorage.getItem("register-quick-login"))?t:i.quickLoginToRegister;return o&&"true"!==localStorage.getItem(`${e.id}-${o}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*pv(){const{hostedLoginBox:e}=yield jo((e=>e.auth));e?yield $o(gv):yield $o(vv)}function*gv(){const{user:e}=yield jo((e=>e.auth));if(null==e||!e.refreshToken)return Fa.setAccessToken(null),Fa.setUser(null),void(yield Mo(Gi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield $o(Qf.auth.exchangeOAuthTokensV2,t),i=yield $o(lv,n.user);yield $o(cv,R({},n,{user:i}),{isAuthenticated:!0})}catch(e){Fa.setAccessToken(null),Fa.setUser(null),yield Mo(Gi.setState({user:null,isAuthenticated:!1}))}}function*Sv(){const{user:e}=yield jo((e=>e.auth));if(null==e||!e.refreshToken)return Fa.setAccessToken(null),Fa.setUser(null),void(yield Mo(Gi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield $o(Qf.auth.exchangeOAuthTokensV2,t),i=yield $o(lv,n.user);yield $o(cv,R({},n,{user:i}),{isAuthenticated:!0})}catch(e){Fa.setAccessToken(null),Fa.setUser(null),yield Mo(Gi.setState({user:null,isAuthenticated:!1}))}}function*vv(){try{const t=Fa.onRedirectTo,{routes:n,loginState:i}=yield jo((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield $o(Qf.auth.refreshTokenV3);if(cg(o)){const e=yield yg(o);yield Mo(Gi.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield fv(o),s=yield $o(lv,o);yield $o(cv,{user:s,tenants:a,activeTenant:r},{loginState:R({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield mv(n)}}catch(e){Fa.setAccessToken(null),Fa.setUser(null),yield Mo(Gi.setState({user:void 0,isAuthenticated:!1}))}}function*hv(){try{const t=Fa.onRedirectTo,{routes:n,loginState:i}=yield jo((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield $o(Qf.auth.refreshTokenV3);if(cg(o)){const e=yield yg(o);yield Mo(Gi.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const s=yield $o(lv,o);if(yield $o(Rv))yield Mo(Gi.setLoginState({step:_t.promptPasskeys,loading:!1})),yield $o(cv,{user:s,tenants:a,activeTenant:r},{isLoading:!1}),t(n.loginUrl,{preserveQueryParams:!0});else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield fv(o);yield $o(cv,{user:s,tenants:a,activeTenant:r},{loginState:R({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield mv(n)}}}catch(e){Fa.setAccessToken(null),Fa.setUser(null),yield Mo(Gi.setState({user:void 0,isAuthenticated:!1}))}}function*mv(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=Fa.onRedirectTo,{routes:o,loginState:a}=yield jo((e=>e.auth)),r=n.searchParams.get("invitationToken"),s=[o.socialLoginCallbackUrl,o.oidcRedirectUrl,o.samlCallbackUrl];r||s.push(o.loginUrl,o.signUpUrl),e?i(o.loginUrl):s.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&o.signUpSuccessUrl&&o.socialLoginCallbackUrl===window.location.pathname?i(o.signUpSuccessUrl,{refresh:o.signUpSuccessUrl.startsWith("http")}):yield uv())}function*Av({payload:{callback:e}}){try{const{ip:t}=yield $o(Qf.metadata.getCurrentUserIpMetadata);yield Mo(Gi.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*bv({payload:e}){const t=[];(yield $o(Ag))?yield $o(pv):t.push($o(pv)),e&&(yield Mo(Gi.setState({isLoading:!0})),yield Mo(Gi.loadSocialLoginsConfigurationV2()),t.push($o(OS)),t.push($o(Xg)),t.push($o(yv)),t.push($o(NS)),t.push($o(dv)),t.push($o(bg))),yield Fo(t),yield Mo(Gi.setState({isLoading:!1}))}function*Tv({accessToken:e,user:t}){if(!e)return void(yield Mo(Gi.setState({user:void 0,isAuthenticated:!1})));const n=Fa.onRedirectTo,{routes:i}=yield jo((e=>e.auth));if(cg(t)){const e=yield yg(t);yield Mo(Gi.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*Ev({payload:e}){const t=[];yield Mo(Gi.loadSocialLoginsConfigurationV2()),t.push($o(OS)),t.push($o(yv)),t.push($o(NS)),t.push($o(dv)),t.push($o(Tv,e)),t.push($o(bg)),yield Fo(t)}const kv=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*Ov(){const e=yield $o(Qf.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield $o(cv,e,{isAuthenticated:!0,isLoading:!1})}function*Iv({payload:e}){const{disableSilentRefresh:t}=yield jo((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield Ov()}catch(t){yield _v(e)}}function*Pv({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n}}){if(n){const{urlStrategy:e}=yield jo((e=>({urlStrategy:e.root.urlStrategy}))),t=kv(e);if(yield Mo(Gi.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:i}=yield jo((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(i)throw new Error("silent refresh is disabled");yield Ov()}catch(n){if(!t)return void(yield Mo(Gi.setState({isLoading:!1})));yield _v(e)}}function*_v(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield jo((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(kv(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield Mo(Gi.setState({isLoading:!0}));const a=Sp(),r=Sp(),s=yield $o(gp,r);localStorage.setItem(Ut,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;yield $o(bg);const c=yield jo((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));c&&(l.endsWith("/")&&(l=l.slice(0,-1)),l+=c);const u=`${Or(n,"/oauth/authorize")}/oauth/authorize`,d=R({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:l,code_challenge:s,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=sg(lg);f&&(d.tenantId=f),i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*Lv({payload:e}){const t=localStorage.getItem(Ut)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield jo((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;yield $o(bg);const a=yield jo((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));a&&(o.endsWith("/")&&(o=o.slice(0,-1)),o+=a);const r={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield $o(Qf.auth.exchangeOAuthTokensV2,r);yield $o(cv,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield Mo(Gi.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{yield uv()}}function*wv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,xS);try{yield Mo(Gi.setLoginState({loading:!0}));const e=yield $o(Qf.auth.changePhoneNumberWithVerification,n);yield Mo(Gi.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:_t.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({error:fg(e),loading:!1}))}}function*Cv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,jS);try{yield Mo(Gi.setLoginState({loading:!0})),yield $o(Qf.auth.verifyChangePhoneNumber,n),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({error:fg(e),loading:!1}))}}function*Uv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,BS);try{yield Mo(Gi.setLoginState({loading:!0}));const e=yield $o(Qf.auth.passwordlessPreLogin,R({},n,{type:ki.SmsCode}));yield Mo(Gi.setLoginState({step:_t.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({error:fg(e),loading:!1})),null==t||t(e)}}function*Dv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,WS);try{let e;yield Mo(Gi.setLoginState({loading:!0})),function(e){return"email"in e}(n)&&(e=n.email);const i=yield $o(Qf.auth.passwordlessPreLogin,n),o=Ii[n.type];yield Mo(Gi.setLoginState({step:o,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:e,error:void 0})),null==t||t()}catch(e){yield Mo(Gi.setLoginState({error:fg(e),loading:!1})),null==t||t()}}function*Rv(){const{publicAuthStrategyPolicy:e}=yield jo((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===Ms.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield $o(hp,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield $o(Qf.auth.getWebAuthnDevices);return yield Mo(Gi.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*Nv(e){let{payload:{callback:t,events:n}}=e,i=Qi(e.payload,zS);try{yield Mo(Gi.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield $o(Qf.auth.passwordlessPostLoginV2,i),s=Fa.onRedirectTo,{routes:l}=yield jo((e=>e.auth));if(cg(e)){const t=yield yg(e);yield Mo(Gi.setState(t)),s(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield jo((e=>e.auth));if(e.emailVerified){var o;const t={email:e.email,origin:ng.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name};null==n||null==(o=n.userVerified)||o.call(n,t),gg(pg.USER_VERIFIED,t)}e.id&&localStorage.setItem("userId",e.id),yield $o(cv,{user:e,tenants:a,activeTenant:r}),yield Mo(Gi.setLoginState({error:void 0})),yield Mo(Gi.setState({isLoading:!1})),i.flow===Lt.Login?(yield $o(Rv))?(yield Mo(Gi.setLoginState({step:_t.promptPasskeys,loading:!1})),s(l.loginUrl,{preserveQueryParams:!0})):(yield Mo(Gi.setState({isAuthenticated:!0})),yield uv()):s(l.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield Mo(Gi.setLoginState({error:fg(e,"Failed to authenticate")}))}finally{yield Mo(Gi.setLoginState({loading:!1}))}}function*Mv({payload:e}){try{yield Mo(Gi.setLoginState({loading:!0}));const{name:t}=yield $o(Qf.auth.verifyInviteToken,e);yield Mo(Gi.setLoginState({inviteTokenTenantName:t}))}catch(e){yield Mo(Gi.setLoginState({inviteTokenError:fg(e,"We couldn't verify your invitation")}))}finally{yield Mo(Gi.setLoginState({loading:!1}))}}function*Fv({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield Mo(Gi.setLoginState({loading:!0}));try{const o=yield jo((({auth:{onRedirectTo:e}})=>e)),a=sg(lg),{address:r,idpType:s}=yield $o(Qf.auth.preLoginV2,{email:e,tenantId:a});if(r){let e=r;if(s===ep.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield jo((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield Mo(Gi.setLoginState({step:_t.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{o(e,{refresh:!0})}),2e3)}else yield Gv({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield Gv({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*Gv(e){let{callback:t}=e,n=Qi(e,KS);const i=yield jo((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield Mo(Gi.setLoginState({step:_t.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===ki.EmailAndPassword?(yield Mo(Gi.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t()):[ki.MagicLink,ki.Code,ki.SmsCode].includes(null==i?void 0:i.authStrategy)?yield Mo(Gi.passwordlessPreLogin(R({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield Mo(Gi.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t())}function*$v({payload:{callback:e}}){try{yield Mo(Gi.setLoginState({loading:!0}));const{options:t}=yield $o(Qf.auth.webAuthnCreateNewDeviceSession);t.user.id=It(t.user.id),t.challenge=It(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield Mo(Gi.setLoginState({error:fg(t)})),null==e||e(null)}finally{yield Mo(Gi.setLoginState({loading:!1}))}}function*Vv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,qS);try{yield Mo(Gi.setLoginState({loading:!0}));const e=Pt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?Fs.Platform:Fs.CrossPlatform;yield $o(Qf.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({error:fg(e)})),null==t||t(null)}finally{yield Mo(Gi.setLoginState({loading:!1}))}}function*xv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,HS);try{var i;yield Mo(Gi.setPasskeysState({loading:!0})),yield Mo(Gi.setLoginState({loading:!0}));const{options:e}=yield $o(Qf.auth.webAuthnPreLogin,n);e.challenge=It(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>R({},e,{id:It(e.id)}))),yield Mo(Gi.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield Mo(Gi.setLoginState({error:fg(e)})),null==t||t(null)}finally{yield Mo(Gi.setPasskeysState({loading:!1})),yield Mo(Gi.setLoginState({loading:!1}))}}function*jv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,JS);try{var i;yield Mo(Gi.setPasskeysState({loading:!0})),yield Mo(Gi.setLoginState({loading:!0}));const e=Pt(n.publicKey),o=yield $o(Qf.auth.webAuthnPostLoginV2,R({},e,{response:R({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken})),{user:a}=o,r=Qi(o,YS);if(cg(a)){const e=Fa.onRedirectTo,{routes:t}=yield jo((e=>e.auth)),n=yield yg(a);yield Mo(Gi.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield $o(cv,R({user:a},r),{isAuthenticated:!0}),yield Mo(Gi.setLoginState({error:void 0})),yield uv(),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({error:fg(e)})),null==t||t(null)}finally{yield Mo(Gi.setPasskeysState({loading:!1})),yield Mo(Gi.setLoginState({loading:!1}))}}function*Bv({payload:e}){const{onRedirectTo:t,routes:n}=yield jo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Mo(Gi.setLoginState({loading:!0}));try{const t=yield $o(Qf.auth.postLogin,e);yield Mo(Gi.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield uv()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Mo(Gi.setLoginState({step:_t.loginWithSSOFailed,loading:!1}))}}function*Wv({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield Mo(Gi.setLoginState({loading:!0}));try{const{user:a,tenants:r=[],activeTenant:s}=yield $o(Qf.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:i}),l=Fa.onRedirectTo,{routes:c}=yield jo((e=>e.auth));if(cg(a)){const e=yield yg(a);yield Mo(Gi.setState(e)),l(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield jo((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield $o(cv,{user:a,tenants:r,activeTenant:s},{loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===Lt.Login?_t.success:t.step,tenants:r,tenantsLoading:!0,isBreachedPassword:a.isBreachedPassword},isAuthenticated:n});const[i]=yield $o(hp,["security-center-show-login-flows"]);t.flow===Lt.Login&&(i&&a.isBreachedPassword&&!n?yield Mo(Gi.setLoginState({step:_t.breachedPassword,loading:!1})):n&&((yield $o(Rv))?(yield Mo(Gi.setLoginState({step:_t.promptPasskeys,loading:!1})),l(c.loginUrl,{preserveQueryParams:!0})):yield uv()))}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){Fa.setAccessToken(null),Fa.setUser(null),null==o||o(!1,t),yield Mo(Gi.setLoginState({email:e,error:fg(t),loading:!1}))}}function*zv({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield Mo(Gi.setLoginState({loading:!0}));try{const{user:o,tenants:a=[],activeTenant:r}=yield $o(Qf.auth.loginWithMfaV2,{mfaToken:e,value:t,rememberDevice:n}),{loginState:s}=yield jo((e=>e.auth)),l=s.flow===Lt.Login?_t.success:s.step,c=!!o.accessToken;yield $o(cv,{user:o,tenants:a,activeTenant:r},{loginState:{flow:s.flow,quickLoginToRegister:s.quickLoginToRegister,loading:!1,step:l,error:void 0,tenants:a},isAuthenticated:c}),o.id&&localStorage.setItem("userId",o.id),yield Mo(Gi.setLoginState({error:void 0,loading:!1}));const[u]=yield $o(hp,["security-center-show-login-flows"]);s.flow===Lt.Login&&(u&&s.isBreachedPassword&&!c?yield Mo(Gi.setLoginState({step:_t.breachedPassword,loading:!1})):(yield $o(Rv))?yield Mo(Gi.setLoginState({step:_t.promptPasskeys,loading:!1})):yield uv()),null==i||i(!0)}catch(e){yield Mo(Gi.setLoginState({error:fg(e),loading:!1})),null==i||i(!1,e)}}function*Kv({payload:e}){yield Mo(Gi.setLoginState({loading:!0}));try{var t;yield $o(Qf.auth.recoverMfaToken,e),yield Mo(Gi.setLoginState({loading:!1,error:void 0,step:_t.preLogin})),yield Mo(Gi.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mo(Gi.setLoginState({error:fg(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*qv({payload:e}){const{hostedLoginBox:t}=yield jo((e=>e.auth));yield Mo(Gi.setState({isLoading:!0}));try{t?yield $o(Qf.auth.OAuthLogout):yield $o(Qf.auth.logout)}catch{}yield Mo(Gi.resetState()),yield Mo(Gi.requestAuthorize(!0)),null==e||e()}function*Hv({payload:e}){var t;try{yield $o(Qf.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*Jv({user:e,tenants:t,activeTenant:n}){const i={step:cn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield Mo(Gi.setMfaState(i)),yield Mo(Gi.setUser(e)),yield Mo(Gi.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Yv({user:e,tenants:t,activeTenant:n}){const{loginState:i}=yield jo((e=>e.auth));yield Mo(Gi.setUser(e)),yield Mo(Gi.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:o}=yield jo((e=>e.auth.mfaState)),[a]=yield $o(hp,["security-center-show-login-flows"]),r=!!e.accessToken;if(i.flow===Lt.Login)if(a&&i.isBreachedPassword&&!r)yield Mo(Gi.setLoginState({step:_t.breachedPassword,loading:!1}));else{const e=yield $o(Rv);o===cn.smsVerifyCode&&e?yield Mo(Gi.setLoginState({step:_t.promptPasskeys,loading:!1})):yield uv()}yield Mo(Gi.setState({isAuthenticated:r}))}function*Qv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,QS);yield Mo(Gi.setLoginState({loading:!0}));try{const e=yield $o(Qf.auth.preEnrollMFASMSForLogin,n);yield Mo(Gi.setMfaState({otcToken:e.otcToken,step:cn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:fg(e)})),null==t||t(null)}}function*Xv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,XS);yield Mo(Gi.setLoginState({loading:!0}));try{const e=yield $o(Qf.auth.enrollMFASMSForLoginV2,n);yield Jv(e),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:fg(e)})),null==t||t(null)}}function*Zv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,ZS);yield Mo(Gi.setLoginState({loading:!0}));try{var i;const e=yield $o(Qf.auth.preEnrollMFAWebAuthnForLogin,n),o=R({},e.options,{challenge:It(e.options.challenge),user:R({},e.options.user,{id:It(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>R({},e,{id:It(e.id)})))});yield Mo(Gi.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:fg(e)})),null==t||t(null)}}function*eh(e){let{payload:{callback:t}}=e,n=Qi(e.payload,ev);yield Mo(Gi.setLoginState({loading:!0}));try{const e=Pt(n.publicKey),i=yield $o(Qf.auth.enrollMFAWebAuthnForLoginV2,R({},n,{options:e}));yield Jv(i),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:fg(e)})),null==t||t(null)}}function*th(e){let{payload:{callback:t}}=e,n=Qi(e.payload,tv);yield Mo(Gi.setLoginState({loading:!0}));try{const e=yield $o(Qf.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield Jv(e),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:fg(e)})),null==t||t(null)}}function*nh(e){let{payload:{callback:t,deviceId:n}}=e,i=Qi(e.payload,nv);yield Mo(Gi.setLoginState({loading:!0}));try{const e=yield $o(Qf.auth.preVerifyMFASMSForLogin,n,i);yield Mo(Gi.setMfaState({otcToken:e.otcToken,step:cn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:fg(e)})),null==t||t(null)}}function*ih(e){let{payload:{callback:t}}=e,n=Qi(e.payload,iv);try{const e=yield $o(Qf.auth.preVerifyMFAEmailCode,n);yield Mo(Gi.setMfaState({otcToken:e.otcToken,step:cn.emailVerifyCode})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({error:fg(e)})),null==t||t(null)}}function*oh(e){let{payload:{callback:t}}=e,n=Qi(e.payload,ov);yield Mo(Gi.setLoginState({loading:!0}));try{const e=yield $o(Qf.auth.verifyMFAEmailCodeV2,n);yield Yv(e),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:fg(e)})),null==t||t(null)}}function*ah(e){let{payload:{callback:t,deviceId:n}}=e,i=Qi(e.payload,av);yield Mo(Gi.setLoginState({loading:!0}));try{const e=yield $o(Qf.auth.verifyMFASMSForLoginV2,n,i);yield Yv(e),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:fg(e)})),null==t||t(null)}}function*rh(e){let{payload:{callback:t,deviceId:n}}=e,i=Qi(e.payload,rv);yield Mo(Gi.setLoginState({loading:!0}));try{var o;const e=yield $o(Qf.auth.preVerifyMFAWebAuthnForLogin,n,i),a=R({},e.options,{challenge:It(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>R({},e,{id:It(e.id)})))});yield Mo(Gi.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:fg(e)})),null==t||t(null)}}function*sh(e){let{payload:{callback:t,deviceId:n}}=e,i=Qi(e.payload,sv);yield Mo(Gi.setLoginState({loading:!0}));try{const e=Pt(i.publicKey),o=yield $o(Qf.auth.verifyMFAWebAuthnForLoginV2,n,R({},i,{options:e}));yield Yv(o),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:fg(e)})),null==t||t(null)}}function*lh({payload:e}){yield Mo(Gi.setLoginState({loading:!0}));try{yield $o(Qf.auth.forgotPassword,e),yield Mo(Gi.setLoginState({loading:!1,error:void 0,step:_t.breachedPasswordSuccess})),yield Mo(Gi.setState({isAuthenticated:!1}))}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:fg(e)}))}}function*ch(){yield Ma(Gi.requestAuthorize,bv),yield Ma(Gi.requestAuthorizeSSR,Ev),yield Ma(Gi.requestHostedLoginAuthorize,Iv),yield Ma(Gi.requestHostedLoginAuthorizeV2,Pv),yield Ma(Gi.handleHostedLoginCallback,Lv),yield Ma(Gi.preLogin,Fv),yield Ma(Gi.postLogin,Bv),yield Ma(Gi.login,Wv),yield Ma(Gi.logout,qv),yield Ma(Gi.silentLogout,Hv),yield Ma(Gi.loginWithMfa,zv),yield Ma(Gi.recoverMfa,Kv),yield Ma(Gi.quickSmsPasswordlessPreLogin,Uv),yield Ma(Gi.changePhoneNumberWithVerification,wv),yield Ma(Gi.verifyChangePhoneNumber,Cv),yield Ma(Gi.passwordlessPreLogin,Dv),yield Ma(Gi.passwordlessPostLogin,Nv),yield Ma(Gi.verifyInviteToken,Mv),yield Ma(Gi.webAuthnPrelogin,xv),yield Ma(Gi.webAuthnPostLogin,jv),yield Ma(Gi.webAuthnCreateNewDeviceSession,$v),yield Ma(Gi.webAuthnVerifyNewDeviceSession,Vv),yield Ma(Gi.afterAuthNavigation,uv),yield Ma(Gi.getUserIP,Av),yield Ma(Gi.preEnrollMFASMSForLogin,Qv),yield Ma(Gi.enrollMFASMSForLogin,Xv),yield Ma(Gi.preEnrollMFAWebAuthnForLogin,Zv),yield Ma(Gi.enrollMFAWebAuthnForLogin,eh),yield Ma(Gi.enrollMFAAuthenticatorAppForLogin,th),yield Ma(Gi.preVerifyMFASMSForLogin,nh),yield Ma(Gi.verifyMFASMSForLogin,ah),yield Ma(Gi.preVerifyMFAWebAuthnForLogin,rh),yield Ma(Gi.verifyMFAWebAuthnForLogin,sh),yield Ma(Gi.preVerifyMFAEmailCode,ih),yield Ma(Gi.verifyMFAEmailCode,oh),yield Ma(Gi.resetBreachedPassword,lh)}function*uh({payload:e}){e&&(yield Mo(Gi.setState({isLoading:!0})));const t=Ep;yield Mo(Gi.loadTenants()),yield Mo(Gi.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*dh({payload:{callback:e}}){try{const{ip:t}=qp[0];yield Mo(Gi.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*yh(){yield Ma(Gi.requestAuthorize,uh),yield Ma(Gi.afterAuthNavigation,uv),yield Ma(Gi.getUserIP,dh)}const fh=["callback","samlVendor"],ph=["callback","samlVendor"];function*gh(){try{var e,t;yield Mo(Gi.setSSOState({loading:!0}));const n=yield $o(Qf.auth.getSamlConfiguration),i=yield $o(Qf.auth.getOidcConfiguration),o=yield $o(Qf.metadata.getSamlMetadata);n.acsUrl=null==o||null==(e=o.configuration)?void 0:e.acsUrl,n.spEntityId=null==o||null==(t=o.configuration)?void 0:t.spEntityId,n.isSamlActive=null==o?void 0:o.isActive,yield Mo(Gi.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield Mo(Gi.setSSOState({error:fg(e),loading:!1}))}}function*Sh({payload:e}){const t=yield jo((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield Mo(Gi.setSSOState({error:void 0,[n]:!0}));try{const i=yield vp(e[0]),o=yield $o(Qf.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield Mo(Gi.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield Mo(Gi.setSSOState({samlConfiguration:t,error:fg(e),[n]:!1}))}}function*vh({payload:e}){const{configFile:t,callback:n}=e,i=yield jo((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield Mo(Gi.setSSOState({error:void 0,[o]:!0}));try{const e=yield vp(t),a=yield $o(Qf.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield Mo(Gi.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield Mo(Gi.setSSOState({samlConfiguration:i,error:fg(e),[o]:!1})),null==n||n(null,e)}}function*hh({payload:e}){const{callback:t,samlVendor:n}=e,i=Qi(e,fh),o=yield jo((e=>e.auth.ssoState.samlConfiguration)),a=R({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield Mo(Gi.setSSOState({samlConfiguration:R({},o,a)})));if(yield Mo(Gi.setSSOState({error:void 0,[r]:!0})),e.type===ep.Saml){var s,l;const e=yield $o(Qf.metadata.getSamlMetadata);a.acsUrl=null==e||null==(s=e.configuration)?void 0:s.acsUrl,a.spEntityId=null==e||null==(l=e.configuration)?void 0:l.spEntityId}const i=pp(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==o?void 0:o.domain)!==(null==i?void 0:i.domain)&&(i.ssoEndpoint="",i.publicCertificate="",i.signRequest=!1),i.type=null==n?void 0:n.toLowerCase();const c=yield $o(Qf.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield Mo(Gi.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setSSOState({samlConfiguration:o,error:fg(e),[r]:!1})),null==t||t(null,e)}}function*mh({payload:{callback:e}={}}){const t=yield jo((e=>e.auth.ssoState.samlConfiguration));try{yield Mo(Gi.setSSOState({error:void 0,saving:!0})),yield $o(Qf.auth.validateSamlDomain),yield Mo(Gi.setSSOState({samlConfiguration:R({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield Mo(Gi.setSSOState({samlConfiguration:R({},t,{validated:!1}),error:fg(n),saving:!1})),null==e||e(null,n)}}function*Ah(){try{const e=yield $o(Qf.auth.getSamlRoles),t=yield $o(Qf.auth.getSamlRolesGroups);yield Mo(Gi.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Mo(Gi.setSSOState({error:fg(e)}))}}function*bh({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Mo(Gi.setSSOState({error:void 0,saving:!0})),yield $o(Qf.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Fo(e.map((e=>$o(Qf.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Mo(Gi.setSSOState({error:fg(e)}))}}(n)),yield Ah(),yield Mo(Gi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Mo(Gi.setSSOState({error:fg(t),saving:!1})),null==e||e(null,t)}}function*Th({payload:{callback:e,id:t}}){try{yield Mo(Gi.setSSOState({error:void 0,saving:!0})),yield $o(Qf.auth.deleteSamlGroup,{id:t}),yield Ah(),yield Mo(Gi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Mo(Gi.setSSOState({error:fg(t),saving:!1})),null==e||e(null,t)}}function*Eh({payload:{group:e,roleIds:t,callback:n}}){try{yield Mo(Gi.setSSOState({error:void 0,saving:!0})),yield $o(Qf.auth.createSamlGroup,{group:e,roleIds:t}),yield Ah(),yield Mo(Gi.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield Mo(Gi.setSSOState({error:fg(e),saving:!1})),null==n||n(null,e)}}function*kh({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Mo(Gi.setSSOState({loading:!0})),yield $o(Qf.auth.oidcPostLoginV2,t),yield $o(pv),yield Mo(Gi.setSSOState({loading:!1}))}catch(e){yield Mo(Gi.setSSOState({loading:!1,error:fg(e,"Failed to authenticate"),firstLoad:!1}))}}function*Oh(){yield Ra(Gi.loadSSOConfigurations,gh),yield Ra(Gi.saveSSOConfigurations,hh),yield Ra(Gi.saveSSOConfigurationsFile,Sh),yield Ra(Gi.saveSSOConfigurationsFileWithCallback,vh),yield Ra(Gi.validateSSODomain,mh),yield Ra(Gi.loadSSOAuthorizationRoles,Ah),yield Ra(Gi.updateSSOAuthorizationRoles,bh),yield Ra(Gi.deleteSamlGroup,Th),yield Ra(Gi.createSamlGroup,Eh),yield Ra(Gi.oidcPostlogin,kh)}function*Ih(){yield Mo(Gi.setSSOState({loading:!0})),yield Et(),yield Mo(Gi.setSSOState({samlConfiguration:wp,loading:!1,firstLoad:!1}))}function*Ph({payload:e}){const t="saving";yield Mo(Gi.setSSOState({error:void 0,[t]:!0}));const n=R({},yield jo((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield Mo(Gi.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*_h({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=Qi(e,ph),r=Dp.samlConfiguration,s=R({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield Mo(Gi.setSSOState({samlConfiguration:R({},r,s)})));yield Mo(Gi.setSSOState({error:void 0,[l]:!0})),yield Et(),s.acsUrl=null==Cp||null==(t=Cp.configuration)?void 0:t.acsUrl,s.spEntityId=null==Cp||null==(n=Cp.configuration)?void 0:n.spEntityId;const c=pp(s,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==o?void 0:o.toLowerCase(),yield Et(),yield Mo(Gi.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*Lh({payload:{callback:e}={}}){const t=Dp.samlConfiguration;yield Mo(Gi.setSSOState({error:void 0,saving:!0})),yield Et(),yield Mo(Gi.setSSOState({samlConfiguration:R({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*wh(){yield Et(),yield Mo(Gi.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Ch({payload:{callback:e,authorizationRoles:t}}){yield Mo(Gi.setSSOState({error:void 0,saving:!0})),yield Et(),yield Mo(Gi.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Uh(){yield Ra(Gi.loadSSOConfigurations,Ih),yield Ra(Gi.saveSSOConfigurations,_h),yield Ra(Gi.saveSSOConfigurationsFile,Ph),yield Ra(Gi.validateSSODomain,Lh),yield Ra(Gi.loadSSOAuthorizationRoles,wh),yield Ra(Gi.updateSSOAuthorizationRoles,Ch)}const Dh=["callback"],Rh=["callback","ssoConfigId"],Nh=["callback","ssoConfigId"],Mh=["callback","ssoConfigId"];function*Fh(){try{return yield $o(Qf.auth.getOidcConfiguration)}catch(e){return null}}function*Gh(){try{return yield $o(Qf.metadata.getSamlMetadata)}catch(e){return null}}function*$h(){try{yield Mo(Gi.setSSOLoader({key:Zf.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Fo([$o(Fh),$o(Gh)]),n=yield $o(Qf.auth.getSSOConfigurations);yield Mo(Gi.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Mo(Gi.setSSOError({key:Zf.LOAD_SSO_CONFIGURATIONS,value:fg(e)}))}finally{yield Mo(Gi.setSSOLoader({key:Zf.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Vh({payload:e}){yield Mo(Gi.setSSOLoader({key:Zf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Qi(e,Dh),i=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield $o(Qf.auth.createSSOConfiguration,R({},n,{enabled:null!=(o=n.enabled)&&o}));yield Mo(Gi.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield Mo(Gi.setSSOError({key:Zf.SAVE_SSO_CONFIGURATION,value:fg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSSOLoader({key:Zf.SAVE_SSO_CONFIGURATION,value:!1}))}}function*xh({payload:e}){yield Mo(Gi.setSSOLoader({key:Zf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield vp(t),o=yield $o(Qf.auth.createSSOConfigurationByMetadata,{metadata:e});yield Mo(Gi.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield Mo(Gi.setSSOError({key:Zf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:fg(e)})),null==n||n(null,e)}finally{yield Mo(Gi.setSSOLoader({key:Zf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*jh({payload:e}){yield Mo(Gi.setSSOLoader({key:Zf.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Qi(e,Rh),o=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield $o(Qf.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield Mo(Gi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Mo(Gi.setSSOError({key:Zf.UPDATE_SSO_CONFIGURATION,value:fg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSSOLoader({key:Zf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Bh({payload:e}){yield Mo(Gi.setSSOLoader({key:Zf.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield vp(i),a=yield $o(Qf.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield Mo(Gi.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield Mo(Gi.setSSOError({key:Zf.UPDATE_SSO_CONFIGURATION,value:fg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSSOLoader({key:Zf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Wh({payload:e}){yield Mo(Gi.setSSOLoader({key:Zf.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{yield $o(Qf.auth.deleteSSOConfiguration,t),yield Mo(Gi.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield Mo(Gi.setSSOError({key:Zf.DELETE_SSO_CONFIGURATION,value:fg(e)})),null==n||n(null,e)}finally{yield Mo(Gi.setSSOLoader({key:Zf.DELETE_SSO_CONFIGURATION,value:!1}))}}function*zh({payload:e}){const{callback:t,ssoConfigId:n}=e,i=Qi(e,Nh);yield Mo(Gi.setSSOLoader({key:Zf.SAVE_SSO_DOMAIN,value:!0}));const o=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield $o(Qf.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?R({},t,{domains:[...t.domains,e]}):t));yield Mo(Gi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Mo(Gi.setSSOError({key:Zf.SAVE_SSO_DOMAIN,value:fg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSSOLoader({key:Zf.SAVE_SSO_DOMAIN,value:!1}))}}function*Kh({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield Mo(Gi.setSSOLoader({key:Zf.DELETE_SSO_DOMAIN,value:!0}));const o=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{yield $o(Qf.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?R({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield Mo(Gi.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield Mo(Gi.setSSOError({key:Zf.DELETE_SSO_DOMAIN,value:fg(e)})),null==i||i(null,e)}finally{yield Mo(Gi.setSSOLoader({key:Zf.DELETE_SSO_DOMAIN,value:!1}))}}function*qh({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield Mo(Gi.setSSOLoader({key:Zf.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{yield $o(Qf.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?R({},e,{domains:e.domains.map((e=>e.id===n?R({},e,{validated:!0}):e))}):e));yield Mo(Gi.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield Mo(Gi.setSSOError({key:Zf.VALIDATE_SSO_DOMAIN,value:fg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSSOLoader({key:Zf.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Hh({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Mo(Gi.setSSOLoader({key:Zf.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{yield $o(Qf.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?R({},e,{roleIds:n}):e));yield Mo(Gi.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield Mo(Gi.setSSOError({key:Zf.UPDATE_SSO_DEFAULT_ROLES,value:fg(t)})),null==e||e(null,t)}finally{yield Mo(Gi.setSSOLoader({key:Zf.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Jh({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield Mo(Gi.setSSOLoader({key:Zf.SAVE_SSO_GROUPS,value:!0}));const o=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{yield Fo(t.map((e=>$o(Qf.auth.deleteSSOGroup,n,e)))),yield Fo(e.map((e=>$o(Qf.auth.createSSOGroup,n,e))));const a=yield $o(Qf.auth.getSSOGroups,n),r=o.map((e=>e.id===n?R({},e,{groups:a}):e));yield Mo(Gi.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield Mo(Gi.setSSOError({key:Zf.SAVE_SSO_GROUPS,value:fg(e)})),null==i||i(null,e)}finally{yield Mo(Gi.setSSOLoader({key:Zf.SAVE_SSO_GROUPS,value:!1}))}}function*Yh({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Fo(t.map((t=>$o(Qf.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Mo(Gi.setSSOError({key:Zf.SAVE_SSO_GROUPS,value:fg(e)})),null==n||n(null,e)}finally{yield Mo(Gi.setSSOLoader({key:Zf.SAVE_SSO_GROUPS,value:!1}))}}function*Qh({payload:e}){yield Mo(Gi.setSSOLoader({key:Zf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,s;i?(r=yield $o(Qf.auth.updateSSOConfigurationByMetadataUrl,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield $o(Qf.auth.createSSOConfigurationByMetadataUrl,e),s=[r,...a]),yield Mo(Gi.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield Mo(Gi.setSSOLoader({key:Zf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Xh({payload:e}){yield Mo(Gi.setSSOLoader({key:Zf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Qi(e,Mh),o=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield $o(Qf.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield $o(Qf.auth.createSSOConfiguration,i),a=[e,...o]),yield Mo(Gi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield Mo(Gi.setSSOLoader({key:Zf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Zh(){yield Ra(Gi.loadSSOConfigurationsV2,$h),yield Ra(Gi.saveSSOConfigurationV2,Vh),yield Ra(Gi.saveSSODomain,zh),yield Ra(Gi.deleteSSODomain,Kh),yield Ra(Gi.validateSSODomainV2,qh),yield Ra(Gi.updateSSOConfiguration,jh),yield Ra(Gi.deleteSSOConfiguration,Wh),yield Ra(Gi.setSSOGroups,Jh),yield Ra(Gi.updateSSOGroups,Yh),yield Ra(Gi.setSSODefaultRoles,Hh),yield Ra(Gi.saveSSOConfigurationByMetadata,xh),yield Ra(Gi.updateSSOConfigurationByMetadata,Bh),yield Ra(Gi.saveSSOConfigurationByUrl,Qh),yield Ra(Gi.saveSSOConfigurationByData,Xh)}const em=["callback","profilePictureUrl"],tm=["callback","profilePictureUrl"];function*nm(){yield Mo(Gi.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return $o.apply(void 0,[Da,e,t,n].concat(o))}(3,2e3,Qf.teams.getProfile),t=yield jo((e=>e.auth.user));Gi.setUser(R({},t,e)),yield Mo(Gi.setProfileState({profile:e,loading:!1}))}catch(e){yield Mo(Gi.setProfileState({loading:!1,error:fg(e)}))}}function*im(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Qi(e.payload,em);yield Mo(Gi.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield jo((e=>e.auth.profileState.profile));let o=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const i=`image/${n[1]}`,o=function(e,t){const n=atob(e),i=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),o=new Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);i.push(new Uint8Array(o))}return new Blob(i,{type:t})}(n[2],i),a=new FormData;return a.append(t,new File([o],t,{type:i})),a}(n,"image");if(e){o=yield $o(Qf.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=R({},e,i,{profilePictureUrl:o}),r=yield $o(Qf.users.updateUserProfileV2,a),s=yield jo((e=>e.auth.user));yield Mo(Gi.setUser(R({},s,r))),yield Mo(Gi.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield Mo(Gi.setProfileState({saving:!1,error:fg(e),loading:!1})),null==t||t(null,e)}}function*om({payload:e}){yield Mo(Gi.setProfileState({loading:!0}));try{var t;yield $o(Qf.teams.changePassword,e),yield Mo(Gi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mo(Gi.setProfileState({loading:!1,error:fg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*am(){yield Ma(Gi.loadProfile,nm),yield Ra(Gi.saveProfile,im),yield Ra(Gi.changePassword,om)}function*rm(){yield Mo(Gi.setProfileState({loading:!0})),yield Et(),yield Mo(Gi.setUser(R({},Ep,Tp))),yield Mo(Gi.setProfileState({loading:!1,profile:Tp}))}function*sm(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Qi(e.payload,tm);yield Mo(Gi.setProfileState({saving:!0,error:null}));const o=kp;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=R({},o.profile,i,{profilePictureUrl:a}),s=Ep;yield Et(),yield Mo(Gi.setUser(R({},s,r))),yield Mo(Gi.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*lm({payload:e}){var t;yield Mo(Gi.setProfileState({loading:!0})),yield Et(),yield Mo(Gi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*cm(){yield Ma(Gi.loadProfile,rm),yield Ra(Gi.saveProfile,sm),yield Ra(Gi.changePassword,lm)}const um=["callback"],dm=["callback"],ym=["user"],fm=["callback"],pm=["deviceId","callback"],gm=["deviceId","callback"],Sm=["callback"],vm=["deviceId"],hm=["deviceId"],mm=["callback"],Am=["deviceId"],bm=["callback"];function*Tm(e){const{step:t}=yield jo((e=>e.auth.mfaState));return{step:e.recoveryCode?cn.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Em(){yield Mo(Gi.setMfaState({saving:!0}));try{const{qrCode:e}=yield $o(Qf.auth.enrollMfa);yield Mo(Gi.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield Mo(Gi.setMfaState({saving:!1,error:fg(e)}))}}function*km(e){let{payload:{callback:t}}=e,n=Qi(e.payload,um);yield Mo(Gi.setMfaState({saving:!0}));try{const e=yield jo((e=>e.auth.user)),i=yield $o(Qf.auth.verifyMfa,n),o=yield $o(Qf.auth.getMFADevices),a=yield Tm(i);yield Mo(Gi.setMfaState(R({},a,{mfaDevices:o}))),yield Mo(Gi.setUser(R({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield Mo(Gi.setMfaState({saving:!1,error:fg(e)})),null==t||t(null,e)}}function*Om(e){let{payload:{callback:t}}=e,n=Qi(e.payload,dm);yield Mo(Gi.setMfaState({loading:!0}));try{const e=yield $o(Qf.auth.loginWithMfaV2,n),{user:i}=e,o=Qi(e,ym),a={step:cn.recoveryCode,loading:!1,saving:!1,error:void 0};null!=i&&i.recoveryCode&&(a.recoveryCode=i.recoveryCode),yield Mo(Gi.setMfaState(a)),yield cv(R({user:i},o)),null==t||t(a.recoveryCode)}catch(e){yield Mo(Gi.setMfaState({loading:!1,error:fg(e)})),null==t||t(null,e)}}function*Im({payload:e}){yield Mo(Gi.setMfaState({saving:!0}));try{var t;yield $o(Qf.auth.disableMfa,e);const n=yield $o(Qf.auth.getMFADevices);yield Mo(Gi.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mo(Gi.setMfaState({saving:!1,error:fg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Pm({payload:e}){yield Mo(Gi.setMfaState({saving:!0}));try{var t,n;const i=yield $o(Qf.auth.preEnrollMFAWebAuthn),o=R({},i.options,{challenge:It(i.options.challenge),user:R({},i.options.user,{id:It(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>R({},e,{id:It(e.id)})))});yield Mo(Gi.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield Mo(Gi.setMfaState({saving:!1,error:fg(t)})),null==(i=e.callback)||i.call(e,null,t)}}function*_m(e){let{payload:{callback:t}}=e,n=Qi(e.payload,fm);yield Mo(Gi.setMfaState({saving:!0}));try{const e=Pt(n.publicKey),i=yield $o(Qf.auth.enrollMFAWebAuthn,R({},n,{options:e})),o=yield $o(Qf.auth.getMFADevices),a=yield Tm(i);yield Mo(Gi.setMfaState(R({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield Mo(Gi.setMfaState({saving:!1,error:fg(e)})),null==t||t(null,e)}}function*Lm(e){let{payload:{deviceId:t,callback:n}}=e;Qi(e.payload,pm),yield Mo(Gi.setMfaState({saving:!0}));try{var i;const e=yield $o(Qf.auth.preDisableMFAWebAuthn,t),o=R({},e.options,{challenge:It(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>R({},e,{id:It(e.id)})))});yield Mo(Gi.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Mo(Gi.setMfaState({saving:!1,error:fg(e)})),null==n||n(null,e)}}function*wm(e){let{payload:{deviceId:t,callback:n}}=e,i=Qi(e.payload,gm);yield Mo(Gi.setMfaState({saving:!0}));try{const e=Pt(i.publicKey);yield $o(Qf.auth.disableMFAWebAuthn,t,R({},i,{options:e}));const o=yield $o(Qf.auth.getMFADevices);yield Mo(Gi.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield Mo(Gi.setMfaState({saving:!1,error:fg(e)})),null==n||n(!1,e)}}function*Cm({payload:e}){yield Mo(Gi.setMfaState({saving:!0}));try{var t;const n=yield $o(Qf.auth.preEnrollMFASMS,e);yield Mo(Gi.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 Mo(Gi.setMfaState({saving:!1,error:fg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Um(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Sm);yield Mo(Gi.setMfaState({saving:!0}));try{const e=yield $o(Qf.auth.enrollMFASMS,n),i=yield $o(Qf.auth.getMFADevices),o=yield Tm(e);yield Mo(Gi.setMfaState(R({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield Mo(Gi.setMfaState({saving:!1,error:fg(e)})),null==t||t(null,e)}}function*Dm(e){let{payload:{deviceId:t}}=e,n=Qi(e.payload,vm);yield Mo(Gi.setMfaState({saving:!0}));try{var i;const e=yield $o(Qf.auth.preDisableMFASMS,t);yield Mo(Gi.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield Mo(Gi.setMfaState({saving:!1,error:fg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*Rm(e){let{payload:{deviceId:t}}=e,n=Qi(e.payload,hm);yield Mo(Gi.setMfaState({saving:!0}));try{var i;yield $o(Qf.auth.disableMFASMS,t,n);const e=yield $o(Qf.auth.getMFADevices);yield Mo(Gi.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield Mo(Gi.setMfaState({saving:!1,error:fg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*Nm(){yield Mo(Gi.setMfaState({loading:!0}));try{yield jo((e=>e.auth.user));const e=yield $o(Qf.auth.getMFADevices);yield Mo(Gi.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield Mo(Gi.setMfaState({loading:!1,error:fg(e)}))}}function*Mm(){yield Mo(Gi.setMfaState({loading:!0}));try{const e=(yield $o(Qf.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield Mo(Gi.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield Mo(Gi.setMfaState({loading:!1,error:fg(e)}))}}function*Fm(){yield Ra(Gi.enrollMfa,Em),yield Ra(Gi.getMFADevices,Nm),yield Ra(Gi.getMFAStrategies,Mm),yield Ra(Gi.verifyMfa,km),yield Ra(Gi.disableMfa,Im),yield Ra(Gi.verifyMfaAfterForce,Om),yield Ra(Gi.preDisableMfaSms,Dm),yield Ra(Gi.disableMfaSms,Rm),yield Ra(Gi.preEnrollMfaSms,Cm),yield Ra(Gi.enrollMfaSms,Um),yield Ra(Gi.preEnrollMfaWebAuthn,Pm),yield Ra(Gi.enrollMfaWebAuthn,_m),yield Ra(Gi.preDisableMfaWebAuthn,Lm),yield Ra(Gi.disableMfaWebAuthn,wm)}function*Gm(){yield Mo(Gi.setMfaState({saving:!0})),yield Mo(Gi.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*$m({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield jo((e=>e.auth.mfaState));yield Mo(Gi.setMfaState({saving:!0})),yield Et();const n={token:"token",recoveryCode:"recoveryCode"},i={step:cn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:R({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield Mo(Gi.setMfaState(i)),yield Mo(Gi.setUser(R({},Ep,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*Vm(e){let{payload:{callback:t}}=e,n=Qi(e.payload,mm);yield Mo(Gi.setMfaState({loading:!0})),yield Et();const i=R({},n,{recoveryCode:"recoveryCode"}),o={step:cn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Mo(Gi.setMfaState(o)),yield Et(),yield Mo(Gi.setUser(R({},Ep,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*xm({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield jo((e=>e.auth.mfaState));yield Mo(Gi.setMfaState({saving:!0})),yield Et(),yield Mo(Gi.setMfaState({saving:!1,error:void 0,mfaDevices:R({},n,{authenticators:[]})})),yield Mo(Gi.setUser(R({},Ep))),null==(t=e.callback)||t.call(e,!0)}function*jm(e){let{}=e,t=Qi(e.payload,Am);yield Mo(Gi.setMfaState({saving:!0}));try{var n;yield Mo(Gi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield Mo(Gi.setMfaState({saving:!1,error:fg(e)})),null==(i=t.callback)||i.call(t,!1,e)}}function*Bm({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield jo((e=>e.auth.mfaState));yield Mo(Gi.setMfaState({saving:!0})),yield Et(),yield Mo(Gi.setMfaState({loading:!1,error:void 0,mfaDevices:R({},n,{phones:[]})})),yield Mo(Gi.setUser(R({},Ep))),null==(t=e.callback)||t.call(e,!0)}function*Wm({payload:e}){var t;yield Mo(Gi.setMfaState({saving:!0})),yield Et(),yield Mo(Gi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*zm(e){let{payload:{callback:t}}=e;Qi(e.payload,bm);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield jo((e=>e.auth.mfaState));yield Mo(Gi.setMfaState({saving:!0})),yield Et();const i={token:"token",recoveryCode:"recoveryCode"},o={step:cn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:R({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Mo(Gi.setMfaState(o)),yield Mo(Gi.setUser(R({},Ep,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*Km(){yield Ra(Gi.enrollMfa,Gm),yield Ra(Gi.verifyMfa,$m),yield Ra(Gi.disableMfa,xm),yield Ra(Gi.verifyMfaAfterForce,Vm),yield Ra(Gi.preDisableMfaSms,jm),yield Ra(Gi.disableMfaSms,Bm),yield Ra(Gi.preEnrollMfaSms,Wm),yield Ra(Gi.enrollMfaSms,zm)}const qm=["callback"];function*Hm({payload:e}){yield Mo(Gi.setForgotPasswordState({loading:!0}));try{var t;yield $o(Qf.auth.forgotPassword,e),yield Mo(Gi.setForgotPasswordState({loading:!1,error:void 0,step:Ht.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mo(Gi.setForgotPasswordState({loading:!1,error:fg(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*Jm(e){let{payload:{callback:t}}=e,n=Qi(e.payload,qm);yield Mo(Gi.setForgotPasswordState({loading:!0}));try{yield $o(Qf.auth.resetPassword,n),yield Mo(Gi.setForgotPasswordState({loading:!1,error:void 0,step:Ht.success})),null==t||t(!0)}catch(e){yield Mo(Gi.setForgotPasswordState({loading:!1,error:fg(e)})),null==t||t(!1,e)}}function*Ym({payload:e}){yield Mo(Gi.setForgotPasswordState({loading:!0}));try{const t=yield $o(Qf.auth.loadPasswordConfig,e);yield Mo(Gi.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Mo(Gi.setForgotPasswordState({loading:!1,error:fg(e)}))}}function*Qm(){yield Ma(Gi.forgotPassword,Hm),yield Ma(Gi.resetPassword,Jm),yield Ma(Gi.loadPasswordConfig,Ym)}let Xm;!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"}(Xm||(Xm={}));const Zm=["callback","events"],eA=["user"],tA=["callback"],nA=["callback"];function*iA({payload:{userId:e,token:t}}){yield Mo(Gi.setActivateState({loading:!0,step:Vt.activating}));try{const{isAuthenticated:n}=yield jo((e=>e.auth));n&&(yield Mo(Gi.silentLogout()));const i=yield $o(Qf.auth.getActivateAccountStrategy,{userId:e,token:t});yield Mo(Gi.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield Mo(Gi.setActivateState({loading:!1,step:Vt.activatingForm})))}catch(e){yield Mo(Gi.setActivateState({loading:!1,error:fg(e)}))}}function*oA(e){let{payload:{callback:t,events:n}}=e,i=Qi(e.payload,Zm);yield Mo(Gi.setActivateState({loading:!0}));try{const e=Fa.onRedirectTo,{routes:a}=yield jo((e=>e.auth)),r=yield $o(Qf.auth.activateAccountV2,i),{user:s}=r,l=Qi(r,eA);if(s.redirectLocation)return void(window.location.href=s.redirectLocation);if(cg(s)){yield Mo(Gi.setActivateState({step:Vt.success}));const t=yield yg(s);yield Mo(Gi.setState(t)),yield Bo(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield Mo(Gi.setActivateState({step:Vt.success}));const e={email:s.email,origin:ng.ACTIVATION_LINK,id:s.id,tenantId:s.tenantId,name:s.name,createdAt:new Date};null==n||null==(o=n.userVerified)||o.call(n,e),gg(pg.USER_VERIFIED,e),yield $o(cv,R({user:s},l),{isAuthenticated:!0}),yield Bo(1e3),yield uv(),yield Mo(Gi.resetActivateState())}null==t||t(!0)}catch(e){yield Mo(Gi.setActivateState({loading:!1,error:fg(e)}))}}function*aA({payload:e}){const{callback:t}=e,n=Qi(e,tA);yield Mo(Gi.setActivateStrategyState({loading:!0}));try{const e=yield $o(Qf.auth.getActivateAccountStrategy,n);yield Mo(Gi.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield Mo(Gi.setActivateStrategyState({loading:!1,error:fg(e)}))}}function*rA({payload:e}){const{callback:t}=e,n=Qi(e,nA);yield Mo(Gi.setTeamLoader({key:Xm.RESEND_ACTIVATE_LINK,value:n.email})),yield Mo(Gi.setActivateState({loading:!0}));try{yield $o(Qf.auth.resendActivationEmail,n),yield Mo(Gi.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield Mo(Gi.setActivateState({loading:!1,error:fg(e)})),yield Mo(Gi.setTeamError({key:Xm.RESEND_ACTIVATE_LINK,value:fg(e)})),null==t||t(null,e)}yield Mo(Gi.setTeamLoader({key:Xm.RESEND_ACTIVATE_LINK,value:!1}))}function*sA(){yield Ma(Gi.activateAccount,oA),yield Ma(Gi.preActivateAccount,iA),yield Ma(Gi.getActivateAccountStrategy,aA),yield Ma(Gi.resendActivationEmail,rA)}function*lA({payload:e}){if(e.token&&e.userId)try{yield Mo(Gi.setAcceptInvitationState({error:void 0,step:Wt.pending})),yield $o(Qf.auth.acceptInvitation,e),yield Mo(Gi.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Wt.success}}))}catch(e){yield Mo(Gi.setAcceptInvitationState({step:Wt.failed,error:fg(e)}))}else yield Mo(Gi.setAcceptInvitationState({error:void 0,step:Wt.invalid}))}function*cA(){yield Ma(Gi.acceptInvitation,lA)}var uA,dA=new Uint8Array(16);function yA(){if(!uA&&!(uA="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 uA(dA)}for(var fA=/^(?:[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,pA=function(e){return"string"==typeof e&&fA.test(e)},gA=[],SA=0;SA<256;++SA)gA.push((SA+256).toString(16).substr(1));var vA=function(e,t,n){var i=(e=e||{}).random||(e.rng||yA)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=i[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(gA[e[t+0]]+gA[e[t+1]]+gA[e[t+2]]+gA[e[t+3]]+"-"+gA[e[t+4]]+gA[e[t+5]]+"-"+gA[e[t+6]]+gA[e[t+7]]+"-"+gA[e[t+8]]+gA[e[t+9]]+"-"+gA[e[t+10]]+gA[e[t+11]]+gA[e[t+12]]+gA[e[t+13]]+gA[e[t+14]]+gA[e[t+15]]).toLowerCase();if(!pA(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let hA,mA;!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"}(hA||(hA={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(mA||(mA={}));const AA=["callback"],bA=["roles"],TA=["callback"],EA=["callback","profileImage"],kA=["callback"],OA=["callback","userId"],IA=["callback"],PA=["callback"],_A=["callback"],LA=["callback"],wA=["callback"],CA=["callback"],UA=["callback"],DA=["callback","profileImage"],RA=["callback"],NA=["callback"],MA=["callback"],FA=["callback"],GA=["callback"],$A=["callback"],VA=()=>jo((e=>e.auth.teamState));function*xA(){try{const{groups:e}=yield $o(Qf.groups.getGroups,{_groupsRelations:mA.roles});return e}catch(e){return[]}}function*jA({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield VA(),c=null!=(t=e.pageSize)?t:l.pageSize,u=null!=(n=e.pageOffset)?n:l.pageOffset,d=null!=(i=e.filter)?i:l.filterV2,y=null!=(o=e.sort)?o:l.sortV2,f=null!=(a=null==e?void 0:e.shouldShowSubTenantUsersIfReseller)?a:null==l?void 0:l.shouldShowSubTenantUsersIfReseller;yield Mo(Gi.setTeamLoader({key:Xm.USERS,value:!r})),yield Mo(Gi.setTeamState({pageSize:c,pageOffset:u,filterV2:d,sortV2:y}));try{const[{items:t,_metadata:{totalPages:n,totalItems:i}},{items:o},{items:a},r]=yield Fo([$o(Qf.users.getUsersV2,R({},(null==d?void 0:d.length)&&{_filter:d},y&&{_sortBy:y},e.order&&{_order:e.order},{_offset:u,_limit:c,_includeSubTenants:f})),$o(Qf.teams.loadAvailableRoles),$o(Qf.teams.loadAvailablePermissions),$o(xA)]),l=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 R({},e,{groups:n})}));yield Mo(Gi.setTeamState({users:l.map((e=>R({},e,{roleIds:e.roles.map((e=>e.id))}))),totalPages:n,totalItems:i,roles:o,permissions:a})),null==s||s(t)}catch(e){yield Mo(Gi.setTeamError({key:Xm.USERS,value:fg(e)})),yield Mo(Gi.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield Mo(Gi.setTeamLoader({key:Xm.USERS,value:!1}))}function*BA({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield VA(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filter,d=null!=(o=e.sort)?o:s.sort;yield Mo(Gi.setTeamLoader({key:Xm.USERS,value:!a})),yield Mo(Gi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield Fo([$o(Qf.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),$o(Qf.teams.loadAvailableRoles),$o(Qf.teams.loadAvailablePermissions)]);yield Mo(Gi.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield Mo(Gi.setTeamError({key:Xm.USERS,value:e.message})),yield Mo(Gi.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Mo(Gi.setTeamLoader({key:Xm.USERS,value:!1}))}function*WA({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield VA(),c={_limit:(null!=(t=e._limit)?t:l.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:l.allUsersQueryParams._offset)||0,_filter:(null!=(i=e._filter)?i:l.allUsersQueryParams._filter)||"",_sortBy:(null!=(o=e._sortBy)?o:l.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:l.allUsersQueryParams._order)||"DESC"};yield Mo(Gi.setTeamLoader({key:Xm.USERS,value:!r})),yield Mo(Gi.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield Fo([$o(Qf.subTenants.loadAllUsers,R({},c)),$o(Qf.teams.loadAvailableRoles),$o(Qf.teams.loadAvailablePermissions)]);yield Mo(Gi.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield Mo(Gi.setTeamError({key:Xm.USERS,value:fg(e)})),yield Mo(Gi.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield Mo(Gi.setTeamLoader({key:Xm.USERS,value:!1}))}function*zA({payload:e}){yield Mo(Gi.setTeamLoader({key:Xm.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield Fo([$o(Qf.teams.loadAvailableRoles),$o(Qf.teams.loadAvailablePermissions)]);yield Mo(Gi.setTeamState({roles:n,permissions:i})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:i})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield Mo(Gi.setTeamError({key:Xm.ROLES_AND_PERMISSIONS,value:fg(t)}))}yield Mo(Gi.setTeamLoader({key:Xm.ROLES_AND_PERMISSIONS,value:!0}))}function*KA({payload:e}){const{callback:t}=e,n=Qi(e,AA),i=yield VA();yield Mo(Gi.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield $o(Qf.teams.addUser,n),{roles:a}=e,r=R({},Qi(e,bA),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield Mo(Gi.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Mo(Gi.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!1,error:fg(e)})})),null==t||t(null,e)}}function*qA({payload:e}){const{callback:t}=e,n=yield VA();yield Mo(Gi.setTeamState({addUserDialogState:R({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield Mo(Gi.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield $o(Qf.teams.addUser,t),i.push(t.email)}catch(e){o.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:"",silentLoading:e.emails.length>0};yield Mo(Gi.loadUsersV2(r)),yield Mo(Gi.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*HA({payload:e}){const{callback:t}=e,n=Qi(e,TA),i=yield VA();yield Mo(Gi.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!0})}));try{yield $o(Qf.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield $o(Qf.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield Mo(Gi.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield Mo(Gi.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!1,error:fg(e)})})),null==t||t(null,e)}}function*JA({payload:e}){const{callback:t}=e,n=Qi(e,EA),{id:i}=n,o=yield VA(),a=o.users.find((e=>e.id===n.id));yield Mo(Gi.setTeamLoader({key:Xm.UPDATE_USER,value:i||""})),yield Mo(Gi.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!0})})),yield Mo(Gi.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?R({},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 $o(Qf.teams.updateUser,n);null==t||t(e),yield Mo(Gi.setTeamState({users:o.users.map((t=>t.id===e.id?R({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield Mo(Gi.setTeamLoader({key:Xm.UPDATE_USER,value:!1}))}catch(e){yield Mo(Gi.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!1,error:fg(e)}),users:o.users.map((e=>e.id===n.id?R({},e,a):e))})),yield Mo(Gi.setTeamLoader({key:Xm.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*YA({payload:e}){const{callback:t}=e,n=Qi(e,kA),i=yield VA();yield Mo(Gi.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!0})}));try{yield $o(Qf.teams.deleteUser,n),null==t||t(!0),yield Mo(Gi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Mo(Gi.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!1,error:fg(e)})})),null==t||t(null,e)}}function*QA({payload:e}){const{callback:t,userId:n}=e,i=Qi(e,OA),o=yield VA();yield Mo(Gi.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!0})}));try{yield $o(Qf.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return R({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield Mo(Gi.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[R({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield Mo(Gi.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!1,error:fg(e)})})),null==t||t(null,e)}}function*XA({payload:e}){const{callback:t}=e,n=Qi(e,IA),i=yield VA();yield Mo(Gi.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!0})}));try{yield $o(Qf.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield Mo(Gi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Mo(Gi.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!1,error:fg(e)})})),null==t||t(null,e)}}function*ZA({payload:e}){const{callback:t}=e,n=Qi(e,PA);yield Mo(Gi.setTeamLoader({key:Xm.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield $o(Qf.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Mo(Gi.setTeamError({key:Xm.RESEND_ACTIVATE_LINK,value:fg(e)})),null==t||t(null,e)}yield Mo(Gi.setTeamLoader({key:Xm.RESEND_ACTIVATE_LINK,value:!1}))}function*eb({payload:e}){const{callback:t}=e,n=Qi(e,_A);yield Mo(Gi.setTeamLoader({key:Xm.RESEND_INVITATION_LINK,value:n.email}));try{yield $o(Qf.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Mo(Gi.setTeamError({key:Xm.RESEND_INVITATION_LINK,value:fg(e)})),null==t||t(null,e)}yield Mo(Gi.setTeamLoader({key:Xm.RESEND_INVITATION_LINK,value:!1}))}function*tb({payload:e}){const{callback:t}=e,n=Qi(e,LA);yield Mo(Gi.setTeamLoader({key:Xm.RESEND_INVITATION_LINK,value:n.email}));try{yield $o(Qf.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Mo(Gi.setTeamError({key:Xm.RESEND_INVITATION_LINK,value:fg(e)})),null==t||t(null,e)}yield Mo(Gi.setTeamLoader({key:Xm.RESEND_INVITATION_LINK,value:!1}))}function*nb({payload:e}){const{callback:t}=e,n=Qi(e,wA);yield Mo(Gi.setTeamLoader({key:Xm.RESEND_INVITATION_LINK,value:n.email}));try{yield $o(Qf.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Mo(Gi.setTeamError({key:Xm.RESEND_INVITATION_LINK,value:fg(e)})),null==t||t(null,e)}yield Mo(Gi.setTeamLoader({key:Xm.RESEND_INVITATION_LINK,value:!1}))}function*ib(){yield Mo(Gi.setTeamError({key:Xm.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield $o(Qf.teams.getInviteLinkConfiguration);yield Mo(Gi.setTeamState({inviteTokenState:R({},e)}))}catch(e){yield Mo(Gi.setTeamError({key:Xm.CONFIG_TOKEN_LINK,value:fg(e)}))}}function*ob(){yield Mo(Gi.setTeamError({key:Xm.GET_TOKEN_LINK,value:!1}));try{yield $o(ib);const e=yield $o(Qf.teams.getInviteUserLink),{inviteTokenState:t}=yield VA();yield Mo(Gi.setTeamState({inviteTokenState:R({},t,e)}))}catch(e){yield Mo(Gi.setTeamError({key:Xm.GET_TOKEN_LINK,value:fg(e)}))}}function*ab({payload:{callback:e}}){yield Mo(Gi.setTeamError({key:Xm.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield VA();try{const n=yield $o(Qf.teams.createInviteUserLink,{expiresInMinutes:43200});yield Mo(Gi.setTeamState({inviteTokenState:R({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield Mo(Gi.setTeamError({key:Xm.CREATE_TOKEN_LINK,value:fg(t)}))}}function*rb({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield VA();yield Mo(Gi.setTeamError({key:Xm.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield $o(Qf.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield Mo(Gi.setTeamState({inviteTokenState:R({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield Mo(Gi.setTeamError({key:Xm.UPDATE_TOKEN_LINK,value:fg(t)}))}}function*sb({payload:e}){const{callback:t}=null!=e?e:{};yield Mo(Gi.setTeamError({key:Xm.DELETE_TOKEN_LINK,value:!1}));try{yield $o(Qf.teams.deleteInviteUserLink),yield Mo(Gi.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Mo(Gi.setTeamError({key:Xm.DELETE_TOKEN_LINK,value:fg(e)})),null==t||t(!1,e)}}function*lb({payload:e}){yield Mo(Gi.setTeamState({addUserDialogState:R({open:!0,loading:!1,error:!1},e)}))}function*cb({payload:e}){const t=yield VA(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Mo(Gi.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*ub({payload:e}){yield Mo(Gi.setTeamState({deleteUserDialogState:R({open:!0,loading:!1,error:!1},e)}))}function*db({payload:e}){const t=yield VA(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Mo(Gi.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*yb(){yield Na(Gi.loadUsers,BA),yield Na(Gi.loadUsersV2,jA),yield Na(Gi.loadAllSubTenantsUsers,WA),yield Na(Gi.loadRoles,zA),yield Ra(Gi.addUser,KA),yield Ra(Gi.addUsersBulk,qA),yield Ra(Gi.addUserToSubTenants,HA),yield Ra(Gi.updateUser,JA),yield Ra(Gi.setUserRolesForSubTenants,QA),yield Ra(Gi.deleteUser,YA),yield Ra(Gi.deleteUserFromSubTenants,XA),yield Ra(Gi.resendActivationLink,ZA),yield Ra(Gi.resendInvitationLink,eb),yield Ra(Gi.resendInvitationEmail,tb),yield Ra(Gi.resendInvitationLinkToAllSubTenants,nb),yield Ra(Gi.getInvitationLink,ob),yield Ra(Gi.createInvitationLink,ab),yield Ra(Gi.updateInvitationLink,rb),yield Ra(Gi.deleteInvitationLink,sb),yield Ra(Gi.openAddUserDialog,lb),yield Ra(Gi.closeAddUserDialog,cb),yield Ra(Gi.openDeleteUserDialog,ub),yield Ra(Gi.closeDeleteUserDialog,db)}function*fb({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield VA(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filterV2,d=null!=(o=e.sort)?o:s.sortV2;yield Mo(Gi.setTeamLoader({key:Xm.USERS,value:!a})),yield Mo(Gi.setTeamState({pageSize:l,pageOffset:c,filterV2:u,sortV2:d})),yield Et(),yield Mo(Gi.setTeamState({users:Vp,totalPages:2,totalItems:10,roles:Up,permissions:Rp})),yield Mo(Gi.setTeamLoader({key:Xm.USERS,value:!1})),null==r||r(Vp)}function*pb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield VA(),c=null!=(t=e._limit)?t:l.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:l.allUsersQueryParams._offset,d=null!=(i=e._filter)?i:l.allUsersQueryParams._filter,y=null!=(o=e._sortBy)?o:l.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:l.allUsersQueryParams._order;yield Mo(Gi.setTeamLoader({key:Xm.USERS,value:!r})),yield Mo(Gi.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield Et(),yield Mo(Gi.setTeamState({allUsers:jp,totalPages:2,totalItems:10,roles:Up,permissions:Rp})),yield Mo(Gi.setTeamLoader({key:Xm.USERS,value:!1})),null==s||s(jp)}function*gb({payload:e}){var t;yield Mo(Gi.setTeamLoader({key:Xm.ROLES_AND_PERMISSIONS,value:!0})),yield Et(),yield Mo(Gi.setTeamState({roles:Up,permissions:Rp})),yield Mo(Gi.setTeamLoader({key:Xm.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Up,permissions:Rp})}function*Sb({payload:e}){const{callback:t}=e,n=Qi(e,CA),i=yield VA();yield Mo(Gi.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!0})})),yield Et();const o=R({},Fp,{groups:[]},n,{id:`${vA()}`});null==t||t(o),yield Mo(Gi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*vb({payload:e}){const{callback:t}=e,n=Qi(e,UA),i=yield VA();yield Mo(Gi.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!0})})),yield Et();const o=R({},Fp,n,{id:`${vA()}`});yield Mo(Gi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*hb({payload:e}){var t;const{callback:n}=e,i=Qi(e,DA),{id:o}=i,a=yield VA(),r=a.users.find((e=>e.id===i.id));yield Mo(Gi.setTeamLoader({key:Xm.UPDATE_USER,value:o||""})),yield Mo(Gi.setTeamState({addUserDialogState:R({},a.addUserDialogState,{loading:!0})})),yield Mo(Gi.setTeamState({addUserDialogState:R({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?R({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield Et();const s=R({},r,i);null==n||n(s),yield Mo(Gi.setTeamState({users:a.users.map((e=>e.id===s.id?R({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield Mo(Gi.setTeamLoader({key:Xm.UPDATE_USER,value:!1}))}function*mb({payload:e}){const{callback:t}=e,n=Qi(e,RA),i=yield VA();yield Mo(Gi.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield Mo(Gi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Ab({payload:e}){const{callback:t}=e,n=Qi(e,NA),i=yield VA();yield Mo(Gi.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield Mo(Gi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*bb({payload:e}){const{callback:t}=e,n=Qi(e,MA);yield Mo(Gi.setTeamLoader({key:Xm.RESEND_ACTIVATE_LINK,value:n.userId})),yield Et(),null==t||t(!0),yield Mo(Gi.setTeamLoader({key:Xm.RESEND_ACTIVATE_LINK,value:!1}))}function*Tb({payload:e}){const{callback:t}=e,n=Qi(e,FA);yield Mo(Gi.setTeamLoader({key:Xm.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield Mo(Gi.setTeamLoader({key:Xm.RESEND_INVITATION_LINK,value:!1}))}function*Eb({payload:e}){const{callback:t}=e,n=Qi(e,GA);yield Mo(Gi.setTeamLoader({key:Xm.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield Mo(Gi.setTeamLoader({key:Xm.RESEND_INVITATION_LINK,value:!1}))}function*kb({payload:e}){const{callback:t}=e,n=Qi(e,$A);yield Mo(Gi.setTeamLoader({key:Xm.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield Mo(Gi.setTeamLoader({key:Xm.RESEND_INVITATION_LINK,value:!1}))}function*Ob(){yield Na(Gi.loadUsersV2,fb),yield Na(Gi.loadAllSubTenantsUsers,pb),yield Na(Gi.loadRoles,gb),yield Ra(Gi.addUser,Sb),yield Ra(Gi.addUserToSubTenants,vb),yield Ra(Gi.updateUser,hb),yield Ra(Gi.deleteUser,mb),yield Ra(Gi.deleteUserFromSubTenants,Ab),yield Ra(Gi.resendActivationLink,bb),yield Ra(Gi.resendInvitationLink,Tb),yield Ra(Gi.resendInvitationEmail,Eb),yield Ra(Gi.resendInvitationLinkToAllSubTenants,kb),yield Ra(Gi.openAddUserDialog,lb),yield Ra(Gi.closeAddUserDialog,cb),yield Ra(Gi.openDeleteUserDialog,ub),yield Ra(Gi.closeDeleteUserDialog,db)}const Ib=["authorizationUrl"],Pb=["events","url"];function*_b(){try{yield Mo(Gi.setSocialLoginsState({loading:!0}));const e=yield $o(Qf.auth.getSocialLoginProviders);yield Mo(Gi.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield Mo(Gi.setSocialLoginsState({error:fg(e),loading:!1,firstLoad:!1}))}}function*Lb(){const e=yield jo((({auth:e})=>e.isAuthenticated));let t;return t=e?yield $o(Qf.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield $o(Qf.auth.getSocialLoginProvidersV2),t}function*wb(){try{const e=yield jo((e=>e.root.context));yield Mo(Gi.setSocialLoginsState({loading:!0}));const t=yield $o(Lb),{providers:n}=yield $o(Qf.auth.getCustomSocialLoginProvidersV1),i=t.map((t=>{let{authorizationUrl:n}=t,i=Qi(t,Ib);const o=Or(e,null!=n?n:"");return R({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield Mo(Gi.setSocialLoginsState({socialLoginsConfigV2:i,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield Mo(Gi.setSocialLoginsState({error:fg(e),loading:!1,firstLoad:!1}))}}function*Cb(e){let{payload:{events:t,url:n}}=e,i=Qi(e.payload,Pb);try{yield Mo(Gi.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield $o(Qf.auth.loginViaSocialLogin,i);if(r){var o,a;const r={email:e,url:n,createdAt:new Date,id:s,tenantId:l},u=R({},r,{socialProvider:i.provider,authenticationType:ig.SOCIAL_LOGIN});null==t||null==(o=t.signUpComplete)||o.call(t,u),gg(pg.SIGNUP_COMPLETED,u);const d=R({},r,{origin:ng.SOCIAL_LOGIN,name:c});null==t||null==(a=t.userVerified)||a.call(t,d),gg(pg.USER_VERIFIED,d)}s&&localStorage.setItem("userId",s),yield Mo(Gi.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield jo((e=>e.auth));e?yield $o(Sv):yield $o(hv)}(),localStorage.removeItem("register-quick-login"),yield Mo(Gi.setSocialLoginsState({loading:!1}))}catch(e){yield Mo(Gi.setSocialLoginsState({loading:!1,error:fg(e,"Failed to authenticate"),firstLoad:!1}))}}function*Ub({payload:e}){yield Mo(Gi.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*Db(){yield Ma(Gi.loadSocialLoginsConfiguration,_b),yield Ma(Gi.loadSocialLoginsConfigurationV2,wb),yield Ma(Gi.loginViaSocialLogin,Cb),yield Na(Gi.setSocialLoginError,Ub)}let Rb;function*Nb({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield jo((e=>e.auth.apiTokensState));try{let e,a;yield Mo(Gi.setApiTokensLoader({key:Rb.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield $o(Qf.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield $o(Qf.auth.updateUserApiTokensData,{description:t}),yield Mo(Gi.setApiTokensState({showAddTokenDialog:!1})),yield Bo(200),yield Mo(Gi.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield Mo(Gi.setApiTokensLoader({key:Rb.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Mo(Gi.setApiTokensError({key:Rb.ADD_API_TOKEN,value:fg(e)})),yield Mo(Gi.setApiTokensLoader({key:Rb.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*Mb({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield jo((e=>e.auth.apiTokensState));try{let e,r;yield Mo(Gi.setApiTokensLoader({key:Rb.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield $o(Qf.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield $o(Qf.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield Mo(Gi.setApiTokensState({showAddTokenDialog:!1})),yield Bo(200),yield Mo(Gi.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===i?e.clientId:void 0}})),yield Mo(Gi.setApiTokensLoader({key:Rb.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield Mo(Gi.setApiTokensError({key:Rb.ADD_API_TOKEN,value:fg(e)})),yield Mo(Gi.setApiTokensLoader({key:Rb.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*Fb({payload:e}){const{apiTokensDataUser:t}=yield jo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield Mo(Gi.setApiTokensLoader({key:Rb.DELETE_API_TOKEN,value:!0})),n?(yield $o(Qf.auth.deleteUserAccessToken,{id:e}),yield Mo(Gi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield $o(Qf.auth.deleteUserApiToken,{tokenId:e}),yield Mo(Gi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield Mo(Gi.setApiTokensLoader({key:Rb.DELETE_API_TOKEN,value:!1}))}catch(e){yield Mo(Gi.setApiTokensError({key:Rb.DELETE_API_TOKEN,value:fg(e)})),yield Mo(Gi.setApiTokensLoader({key:Rb.DELETE_API_TOKEN,value:!1}))}}function*Gb({payload:e}){const{apiTokensDataTenant:t}=yield jo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield Mo(Gi.setApiTokensLoader({key:Rb.DELETE_API_TOKEN,value:!0})),n?(yield $o(Qf.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield $o(Qf.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield Mo(Gi.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield Mo(Gi.setApiTokensLoader({key:Rb.DELETE_API_TOKEN,value:!1}))}catch(e){yield Mo(Gi.setApiTokensError({key:Rb.DELETE_API_TOKEN,value:fg(e)})),yield Mo(Gi.setApiTokensLoader({key:Rb.DELETE_API_TOKEN,value:!1}))}}function*$b({payload:e}){null!=e&&e.silentLoading||(yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield Fo([$o(Qf.auth.getUserApiTokensData),$o(Qf.auth.getTenantApiTokensData)]);yield Mo(Gi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mo(Gi.setApiTokensError({key:Rb.LOAD_API_TOKENS,value:fg(t)})),yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Vb({payload:e}){null!=e&&e.silentLoading||(yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=$o(Qf.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=$o(Qf.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Mo(Gi.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield Mo(Gi.setApiTokensError({key:Rb.LOAD_API_TOKENS,value:fg(t)})),yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*xb({payload:e}){null!=e&&e.silentLoading||(yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=$o(Qf.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=$o(Qf.auth.getTenantAccessTokensData))?n:[],s=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Mo(Gi.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield Mo(Gi.setApiTokensError({key:Rb.LOAD_API_TOKENS,value:fg(t)})),yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*jb(){yield Ma(Gi.loadApiTokens,$b),yield Ma(Gi.loadUserApiTokens,Vb),yield Ma(Gi.loadTenantApiTokens,xb),yield Ra(Gi.addUserApiToken,Nb),yield Ra(Gi.addTenantApiToken,Mb),yield Na(Gi.deleteTenantApiToken,Gb),yield Na(Gi.deleteUserApiToken,Fb)}function*Bb({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield Mo(Gi.setApiTokensLoader({key:Rb.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield jo((e=>e.auth.apiTokensState)),a=R({},Ap,{description:t,roleIds:n,clientId:`CLIENT_ID_${vA()}`});yield Mo(Gi.setApiTokensState({showAddTokenDialog:!1})),yield Bo(200),yield Mo(Gi.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Bo(200),yield Mo(Gi.setApiTokensLoader({key:Rb.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*Wb({payload:e}){yield Mo(Gi.setApiTokensLoader({key:Rb.DELETE_API_TOKEN,value:!0})),yield Bo(200);const t=[Ap];yield Mo(Gi.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Mo(Gi.setApiTokensLoader({key:Rb.DELETE_API_TOKEN,value:!1}))}function*zb({payload:e}){var t;null!=e&&e.silentLoading||(yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!0})));const n=[mp],i=[Ap];yield Mo(Gi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Bo(200),yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Kb({payload:e}){var t;null!=e&&e.silentLoading||(yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!0})));const n=[mp];yield Mo(Gi.setApiTokensState({apiTokensDataUser:n})),yield Bo(200),yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*qb({payload:e}){var t;null!=e&&e.silentLoading||(yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!0})));const n=[Ap];yield Mo(Gi.setApiTokensState({apiTokensDataTenant:n})),yield Bo(200),yield Mo(Gi.setApiTokensLoader({key:Rb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Hb(){yield Ma(Gi.loadApiTokens,zb),yield Ma(Gi.loadUserApiTokens,Kb),yield Ma(Gi.loadTenantApiTokens,qb),yield Ra(Gi.addTenantApiToken,Bb),yield Na(Gi.deleteTenantApiToken,Wb)}function*Jb({payload:e}){try{var t;yield Mo(Gi.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield jo((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield $o(Qf.accountSettings.updateSettings,R({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield Mo(Gi.setAccountSettingsState(R({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield Mo(Gi.setAccountSettingsState({loading:!1,error:fg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Yb({payload:e}){yield Mo(Gi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield $o(Qf.accountSettings.getSettings);yield Mo(Gi.setAccountSettingsState(R({},e,{loading:!1})))}catch(e){yield Mo(Gi.setAccountSettingsState({loading:!1,error:fg(e)}))}}function*Qb(){yield Ma(Gi.saveAccountSettings,Jb),yield Ma(Gi.loadAccountSettings,Yb)}function*Xb({payload:e}){var t;yield Mo(Gi.setAccountSettingsState({loading:!0})),yield Et();const{accountSettingsState:n}=yield jo((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=R({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield Mo(Gi.setAccountSettingsState(R({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*Zb({payload:e}){yield Mo(Gi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield Et(),yield Mo(Gi.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*eT(){yield Ma(Gi.saveAccountSettings,Xb),yield Ma(Gi.loadAccountSettings,Zb)}function*tT({payload:{tenantId:e,callback:t}}){yield Mo(Gi.setState({isLoading:!0}));try{yield $o(Qf.tenants.switchTenant,{tenantId:e}),yield $o(pv),(null==t?void 0:t(!0))||(yield Mo(Gi.setState({isLoading:!1})))}catch(e){yield Mo(Gi.setState({isLoading:!1})),null==t||t(!1,e)}}function*nT({payload:e}){yield Mo(Gi.setTenantsState({loading:!0}));try{var t;const n=yield $o(Qr());yield Mo(Gi.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 Mo(Gi.setTenantsState({loading:!1}))}}function*iT({payload:e}){yield Mo(Gi.setTenantsState({loading:!0}));try{var t;const n=yield $o(Qf.tenants.getSubTenants);yield Mo(Gi.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mo(Gi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*oT({payload:e}){yield Mo(Gi.setTenantsState({loading:!0}));try{var t;const n=yield $o(Qf.tenants.getSubTenantsAsTree);yield Mo(Gi.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mo(Gi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*aT(){yield Ra(Gi.loadTenants,nT),yield Ra(Gi.loadSubTenants,iT),yield Ra(Gi.switchTenant,tT),yield Ra(Gi.loadSubTenantsTree,oT)}function*rT(){yield Mo(Gi.setTenantsState({loading:!0})),yield Et(),yield Mo(Gi.setTenantsState({tenants:Bp,activeTenant:Bp[0],loading:!1}))}function*sT(){yield Ra(Gi.loadTenants,rT)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(Rb||(Rb={}));const lT=["callback"],cT=["callback"],uT=["callback"],dT=["callback"],yT=["callback"];function*fT({payload:e}){var t;yield Mo(Gi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Fo([$o(Qf.roles.getRoles),$o(Qf.roles.getPermissions),$o(Qf.roles.getPermissionCategories)]),[t,n,i]=e;yield Mo(Gi.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield Mo(Gi.setRolesState({error:fg(e),loading:!1}))}}function*pT(e){let{payload:{callback:t}}=e,n=Qi(e.payload,lT);yield Mo(Gi.setRolesState({saving:!0}));try{const e=yield $o(Qf.roles.addRole,n),i=yield $o(Qf.roles.getRoles);yield Mo(Gi.loadRolesAndPermissions({silentLoading:!0})),yield Mo(Gi.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setRolesState({error:fg(e),saving:!1})),null==t||t(null,e)}}function*gT(e){let{payload:{callback:t}}=e,n=Qi(e.payload,cT);yield Mo(Gi.setRolesState({saving:!0}));try{yield $o(Qf.roles.deleteRole,n),yield Mo(Gi.loadRolesAndPermissions({silentLoading:!0})),yield Mo(Gi.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setRolesState({error:fg(e),saving:!1})),null==t||t(!1,e)}}function*ST(e){let{payload:{callback:t}}=e,n=Qi(e.payload,uT);yield Mo(Gi.setRolesState({saving:!0}));try{const e=yield $o(Qf.roles.updateRole,n);yield Mo(Gi.loadRolesAndPermissions({silentLoading:!0})),yield Mo(Gi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setRolesState({error:fg(e),saving:!1})),null==t||t(null,e)}}function*vT(e){let{payload:{callback:t}}=e,n=Qi(e.payload,dT);yield Mo(Gi.setRolesState({saving:!0}));try{const e=yield $o(Qf.roles.attachPermissionsToRole,n);yield Mo(Gi.loadRolesAndPermissions({silentLoading:!0})),yield Mo(Gi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setRolesState({error:fg(e),saving:!1})),null==t||t(null,e)}}function*hT(e){let{payload:{callback:t}}=e,n=Qi(e.payload,yT);yield Mo(Gi.setRolesState({saving:!0}));try{const e=yield $o(Qf.roles.attachPermissionToRoles,n);yield Mo(Gi.loadRolesAndPermissions({silentLoading:!0})),yield Mo(Gi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setRolesState({error:fg(e),saving:!1})),null==t||t(null,e)}}function*mT(){yield Ma(Gi.loadRolesAndPermissions,fT),yield Ra(Gi.addRole,pT),yield Ra(Gi.deleteRole,gT),yield Ra(Gi.updateRole,ST),yield Ra(Gi.attachPermissionsToRole,vT),yield Ra(Gi.attachPermissionToRoles,hT)}function*AT({payload:e}){var t;yield Mo(Gi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield Mo(Gi.setRolesState({roles:bp,loading:!1}))}catch(e){yield Mo(Gi.setRolesState({error:fg(e),loading:!1}))}}function*bT(){yield Ma(Gi.loadRolesAndPermissions,AT)}const TT=["callback"],ET=["callback"],kT=["callback"];function*OT(e){let{payload:{callback:t}}=e,n=Qi(e.payload,TT);yield Mo(Gi.setResetPhoneNumberState({loading:!0}));try{const e=yield $o(Qf.auth.resetPhoneNumber,n);yield Mo(Gi.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Xt.VerifyResetPhoneNumber})),yield Mo(Gi.setLoginState({email:n.email}))}catch(e){yield Mo(Gi.setResetPhoneNumberState({loading:!1,error:fg(e)})),null==t||t(null,e)}}function*IT(e){let{payload:{callback:t}}=e,n=Qi(e.payload,ET);yield Mo(Gi.setResetPhoneNumberState({loading:!0}));try{const e=yield $o(Qf.auth.verifyResetPhoneNumber,n);yield Mo(Gi.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Xt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield Mo(Gi.setResetPhoneNumberState({loading:!1,error:fg(e)})),null==t||t(null,e)}}function*PT(e){let{payload:{callback:t}}=e,n=Qi(e.payload,kT);yield Mo(Gi.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield jo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield $o(Qf.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Mo(Gi.setLoginState({step:_t.loginWithSmsOtc})),yield Mo(Gi.passwordlessPreLogin({type:ki.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield Mo(Gi.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setResetPhoneNumberState({loading:!1,error:fg(e)})),null==t||t(null,e)}}function*_T(){yield Ma(Gi.resetPhoneNumber,OT),yield Ma(Gi.verifyResetPhoneNumber,IT),yield Ma(Gi.changePhoneNumber,PT)}function*LT(){yield Mo(Gi.setSessionsState({loading:!0,error:null}));try{const e=yield $o(Qf.auth.getCurrentUserSessions);yield Mo(Gi.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Mo(Gi.setSessionsState({error:e,loading:!1}))}}function*wT(){yield Mo(Gi.setSessionsState({loading:!0,error:null}));try{const e=yield $o(Qf.auth.getCurrentUserSession);yield Mo(Gi.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Mo(Gi.setSessionsState({error:e,loading:!1}))}}function*CT({payload:{id:e}}){yield Mo(Gi.setSessionsState({loading:!0,error:null}));try{yield $o(Qf.auth.deleteSessionForUser,e),yield Mo(Gi.loadUserSessions())}catch(e){yield Mo(Gi.setSessionsState({error:e,loading:!1}))}}function*UT({payload:{callback:e,userId:t}}){yield Mo(Gi.setSessionsState({loading:!0,error:null}));try{yield $o(Qf.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Mo(Gi.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*DT(){yield Mo(Gi.setSessionsState({loading:!0,error:null}));try{yield $o(Qf.auth.deleteAllSessionsForUser),yield Mo(Gi.loadUserSessions())}catch(e){yield Mo(Gi.setSessionsState({error:e,loading:!1}))}}function*RT(){yield Na(Gi.loadUserSessions,LT),yield Na(Gi.deleteUserSession,CT),yield Na(Gi.deleteAllUserSessions,DT),yield Na(Gi.loadCurrentUserSession,wT),yield Ra(Gi.revokeUserSessions,UT)}function*NT(){yield Mo(Gi.setSessionsState({loading:!0,error:null})),yield Mo(Gi.setSessionsState({sessions:Wp,loading:!1}))}function*MT({payload:{id:e}}){yield Mo(Gi.setSessionsState({loading:!0,error:null}));const t=(yield jo((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield Mo(Gi.setSessionsState({sessions:t,loading:!1}))}function*FT(){yield Mo(Gi.setSessionsState({loading:!0,error:null}));const e=Wp.filter((e=>e.current));yield Mo(Gi.setSessionsState({sessions:e,loading:!1}))}function*GT(){yield Na(Gi.loadUserSessions,NT),yield Na(Gi.deleteUserSession,MT),yield Na(Gi.deleteAllUserSessions,FT)}const $T=["callback"],VT=["callback"];function*xT(){yield Mo(Gi.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield $o(Qf.auth.getSessionConfigurations);yield Mo(Gi.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Mo(Gi.setSessionsState({error:e,loading:!1}))}}function*jT({payload:e}){yield Mo(Gi.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Qi(e,$T);yield $o(Qf.auth.createOrUpdateSessionConfigrations,n),yield Mo(Gi.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Mo(Gi.setSessionsPolicyState({error:e,loading:!1}))}}function*BT(){yield Ma(Gi.loadSessionsPolicy,xT),yield Na(Gi.createOrUpdateSessionsPolicy,Og(jT))}function*WT(){yield Mo(Gi.setSessionsPolicyState({loading:!0,error:null}));const e=yield jo((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:zp}));yield Mo(Gi.setSessionsPolicyState(R({},e,{loading:!1})))}function*zT({payload:e}){yield Mo(Gi.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Qi(e,VT);null==t||t(!0),yield Mo(Gi.setSessionsPolicyState({configurations:n,loading:!1}))}function*KT(){yield Ma(Gi.loadSessionsPolicy,WT),yield Na(Gi.createOrUpdateSessionsPolicy,zT)}const qT=["callback"],HT=["callback"],JT=["callback"],YT=["callback"],QT=["callback"],XT=["callback"],ZT=["callback"],eE=["callback"],tE=()=>jo((e=>e.auth.restrictionsState.ipRestrictions)),nE=()=>jo((e=>e.auth.restrictionsState.emailDomainRestrictions));function*iE(){yield Mo(Gi.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield $o(Qf.auth.getDomainRestrictionsConfig),t=(yield $o(Qf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Mo(Gi.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield Mo(Gi.setEmailDomainRestrictionsState({error:fg(e),loading:!1}))}}function*oE(e){let{payload:{callback:t}}=e,n=Qi(e.payload,qT);yield Mo(Gi.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield nE();try{var o;yield $o(Qf.auth.createDomainRestriction,n);const e=(yield $o(Qf.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield Mo(Gi.setEmailDomainRestrictionsState({data:{config:(null==(o=i.data)?void 0:o.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setEmailDomainRestrictionsState({saving:!1,error:fg(e)})),null==t||t(null,e)}}function*aE(e){let{payload:{callback:t}}=e,n=Qi(e.payload,HT);yield Mo(Gi.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield $o(Qf.auth.updateDomainRestrictionConfig,n),i=(yield $o(Qf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Mo(Gi.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setEmailDomainRestrictionsState({saving:!1,error:fg(e)})),null==t||t(null,e)}}function*rE({payload:{id:e}}){yield Mo(Gi.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield nE();try{var n;yield $o(Qf.auth.deleteDomainRestriction,e);const i=(yield $o(Qf.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield Mo(Gi.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Wn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield Mo(Gi.setEmailDomainRestrictionsState({saving:!1,error:fg(e)}))}}const sE=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Wn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*lE(){yield Mo(Gi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield tE(),t=yield $o(Qf.auth.getIPRestrictionsConfig),n=sE({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield $o(Qf.auth.getIPRestrictions,n);yield Mo(Gi.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield Mo(Gi.setIpRestrictionsState({error:fg(e),loading:!1}))}}function*cE(){try{const{valid:e}=yield $o(Qf.auth.testCurrentIpInAllowList);yield Mo(Gi.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Mo(Gi.setIpRestrictionsState({error:fg(e)}))}}function*uE({payload:{callback:e}}){yield Mo(Gi.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield jo((e=>e.auth.userIp));yield Fo([$o(Qf.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Wn.ALLOW}),$o(Qf.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield tE(),i=sE(n.pagination),{items:o,_metadata:{totalPages:a}}=yield $o(Qf.auth.getIPRestrictions,i);yield Mo(Gi.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Wn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield Mo(Gi.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*dE(e){let{payload:{callback:t}}=e,n=Qi(e.payload,JT);yield Mo(Gi.setIpRestrictionsState({saving:!0,error:null}));const i=yield tE();try{var o,a;yield $o(Qf.auth.createIPRestriction,n);const e=yield tE(),r=sE(e.pagination),{items:s,_metadata:{totalPages:l}}=yield $o(Qf.auth.getIPRestrictions,r);yield cE(),yield Mo(Gi.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:Wn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setIpRestrictionsState({saving:!1,error:fg(e)})),null==t||t(null,e)}}function*yE(e){let{payload:{callback:t}}=e,n=Qi(e.payload,YT);yield Mo(Gi.setIpRestrictionsState({saving:!0,error:null}));try{yield $o(Qf.auth.updateIPRestrictionConfig,n);const e=yield tE(),i=yield $o(Qf.auth.getIPRestrictionsConfig),o=sE(R({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield $o(Qf.auth.getIPRestrictions,o);yield cE(),yield Mo(Gi.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setIpRestrictionsState({saving:!1,error:fg(e)})),null==t||t(null,e)}}function*fE({payload:{id:e,callback:t}}){yield Mo(Gi.setIpRestrictionsState({saving:!0,error:null}));const n=yield tE();try{var i;yield $o(Qf.auth.deleteIPRestriction,e);const o=yield tE(),a=sE(o.pagination),{items:r,_metadata:{totalPages:s}}=yield $o(Qf.auth.getIPRestrictions,a);yield cE(),yield Mo(Gi.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:Wn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setIpRestrictionsState({saving:!1,error:fg(e)})),null==t||t(null,e)}}function*pE(){yield Ma(Gi.loadIpRestrictions,Og(lE)),yield Ma(Gi.loadEmailDomainRestrictions,Og(iE)),yield Ra(Gi.saveIpRestriction,Og(dE)),yield Ra(Gi.saveIpRestrictionsConfig,Og(yE)),yield Ra(Gi.deleteIpRestriction,Og(fE)),yield Ra(Gi.checkIfUserIpValid,Og(cE)),yield Ra(Gi.addCurrentUserIpAndActivate,Og(uE)),yield Ra(Gi.saveEmailDomainRestriction,Og(oE)),yield Ra(Gi.saveEmailDomainRestrictionsConfig,Og(aE)),yield Ra(Gi.deleteEmailDomainRestriction,Og(rE))}function*gE(){yield Mo(Gi.setIpRestrictionsState({loading:!0,error:null})),yield Mo(Gi.setIpRestrictionsState({data:{restrictions:qp.filter((e=>e.strategy===Kp.strategy)),config:Kp},totalPages:1,pagination:{_filter:Wn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*SE(){yield Mo(Gi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield tE(),t=qp[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield Mo(Gi.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield Mo(Gi.setIpRestrictionsState({error:fg(e),loading:!1}))}}function*vE(e){var t,n,i;let{payload:{callback:o}}=e,a=Qi(e.payload,QT);yield Mo(Gi.setIpRestrictionsState({saving:!0,error:null}));const r=yield tE(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield Mo(Gi.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Wn.ALLOW},restrictions:[...s,R({},a,{createdAt:new Date,updatedAt:new Date,id:vA(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Wn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*hE(e){var t,n,i;let{payload:{callback:o}}=e,a=Qi(e.payload,XT);const r=yield tE();yield Mo(Gi.setIpRestrictionsState({saving:!0,error:null})),yield Mo(Gi.setIpRestrictionsState({data:{config:R({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:Wn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield Mo(Gi.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*mE({payload:{id:e,callback:t}}){var n;yield Mo(Gi.setIpRestrictionsState({saving:!0,error:null}));const i=yield tE();yield Mo(Gi.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:Wn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Wn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*AE(){yield Mo(Gi.setEmailDomainRestrictionsState({loading:!0,error:null})),yield Mo(Gi.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Wn.ALLOW}],config:{active:!0,listType:Wn.ALLOW,blockPublicDomains:!1}}}))}function*bE(e){var t,n;let{payload:{callback:i}}=e,o=Qi(e.payload,ZT);const a=yield nE();yield Mo(Gi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==i||i(!0),yield Mo(Gi.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],R({},o,{id:Date.now().toString()})]},saving:!1}))}function*TE(e){var t;let{payload:{callback:n}}=e,i=Qi(e.payload,eE);const o=yield nE();yield Mo(Gi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==n||n(!0),yield Mo(Gi.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||Wn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*EE({payload:{id:e}}){var t,n;const i=yield nE();yield Mo(Gi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),yield Mo(Gi.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Wn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*kE(){yield Ma(Gi.loadIpRestrictions,gE),yield Ma(Gi.loadEmailDomainRestrictions,AE),yield Ra(Gi.saveIpRestriction,vE),yield Ra(Gi.saveIpRestrictionsConfig,hE),yield Ra(Gi.deleteIpRestriction,mE),yield Ra(Gi.checkIfUserIpValid,SE),yield Ra(Gi.saveEmailDomainRestriction,bE),yield Ra(Gi.saveEmailDomainRestrictionsConfig,TE),yield Ra(Gi.deleteEmailDomainRestriction,EE)}const OE=["callback"],IE=["id"];function*PE(e){const{count:t}=yield $o(Qf.directory.countConfigurationUsers,e.id);return R({},e,{count:t})}function*_E(){yield Mo(Gi.setProvisioningState({loading:!0,error:null}));try{const e=yield $o(Qf.directory.getConfigs),t=yield Fo(e.map((e=>PE(e))));yield Mo(Gi.setProvisioningState({connections:t,loading:!1}))}catch(e){yield Mo(Gi.setProvisioningState({error:fg(e),loading:!1}))}}function*LE(e){let{payload:{callback:t}}=e,n=Qi(e.payload,OE);yield Mo(Gi.setProvisioningState({loading:!0,error:null}));try{const e=yield $o(Qf.directory.createConfiguration,n),i=yield $o(Qf.directory.getConfigs),o=yield Fo(i.map((e=>PE(e))));yield Mo(Gi.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setProvisioningState({error:fg(e),loading:!1}))}}function*wE(e){let{payload:{id:t}}=e,n=Qi(e.payload,IE);yield Mo(Gi.setProvisioningState({loading:!0,error:null}));try{yield $o(Qf.directory.updateConfiguration,t,n);const e=yield $o(Qf.directory.getConfigs),i=yield Fo(e.map((e=>PE(e))));yield Mo(Gi.setProvisioningState({connections:i,loading:!1}))}catch(e){yield Mo(Gi.setProvisioningState({error:fg(e),loading:!1}))}}function*CE({payload:{id:e,callback:t}}){yield Mo(Gi.setProvisioningState({loading:!0,error:null}));try{yield $o(Qf.directory.deleteConfiguration,e);const n=yield $o(Qf.directory.getConfigs),i=yield Fo(n.map((e=>PE(e))));yield Mo(Gi.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setProvisioningState({error:fg(e),loading:!1})),null==t||t(!1,e)}}function*UE(){yield Ma(Gi.loadProvisionConnections,_E),yield Ra(Gi.createProvisionConnection,LE),yield Ra(Gi.deleteProvisionConnection,CE),yield Ra(Gi.updateProvisionConnection,wE)}const DE=["callback","events"];function*RE(e){let{payload:{callback:t}}=e,n=Qi(e.payload,DE);yield Mo(Gi.setImpersonateState({loading:!0}));try{yield $o(Qf.impersonate.impersonate,n),yield Mo(Gi.setImpersonateState({step:Ui.success})),yield Bo(1e3),yield uv(),yield Mo(Gi.resetImpersonateState()),null==t||t(!0)}catch(e){yield Mo(Gi.setImpersonateState({loading:!1,error:fg(e)}))}}function*NE(){yield Ma(Gi.impersonate,RE)}function*ME({payload:e}){const{callback:t,deviceId:n}=e;yield Mo(Gi.setPasskeysState({loading:!0}));try{yield $o(Qf.auth.deleteWebAuthnDevice,n);const{devices:e}=yield jo((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield Mo(Gi.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setPasskeysState({loading:!1,error:fg(e,null)})),null==t||t(null,e)}}function*FE(){yield Mo(Gi.setPasskeysState({loading:!0}));try{const{devices:e}=yield $o(Qf.auth.getWebAuthnDevices);yield Mo(Gi.setPasskeysState({devices:e,loading:!1}))}catch(e){yield Mo(Gi.setPasskeysState({loading:!1,error:fg(e,null)}))}}function*GE(){yield Ra(Gi.loadWebAuthnDevices,FE),yield Ra(Gi.deleteWebAuthnDevice,ME)}const $E=["roleIds","userIds"],VE=()=>jo((e=>e.auth.groupsState));function*xE({payload:e}){const t=hA.GET_TEAM_USERS;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield $o(Qf.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield Mo(Gi.setGroupsState({teamUsers:n}))}catch(e){yield Mo(Gi.setUsersGroupsError({key:t,value:fg(e)}))}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*jE({payload:e}){const t=hA.GET_GROUP;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield $o(Qf.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:mA.rolesAndUsers});yield Mo(Gi.setGroupsState({selectedGroup:n}))}catch(e){yield Mo(Gi.setUsersGroupsError({key:t,value:fg(e)}))}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*BE(){const e=hA.GET_GROUPS,t=yield VE();yield Mo(Gi.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield $o(Qf.groups.getGroups,{_groupsRelations:mA.rolesAndUsers});yield Mo(Gi.setGroupsState(R({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield Mo(Gi.setUsersGroupsError({key:e,value:fg(t)}))}finally{yield Mo(Gi.setUsersGroupsLoader({key:e,value:!1}))}}function*WE({payload:e}){const t=hA.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=Qi(e,$E);yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield $o(Qf.groups.createGroup,R({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield Mo(Gi.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield Mo(Gi.addRolesToGroup({groupId:r.id,roleIds:n}))),yield Mo(Gi.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield Mo(Gi.setUsersGroupsError({key:t,value:fg(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*zE({payload:e}){const t=hA.UPDATE_GROUP;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield $o(Qf.groups.updateGroup,e),yield Mo(Gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Mo(Gi.setUsersGroupsError({key:t,value:fg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*KE({payload:e}){const t=hA.DELETE_GROUP;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield $o(Qf.groups.deleteGroup,e.groupId),yield Mo(Gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Mo(Gi.setUsersGroupsError({key:t,value:fg(n)})),null==e||null==(i=e.callback)||i.call(e,!1,n)}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*qE({payload:e}){const t=hA.ADD_ROLES_TO_GROUP;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield $o(Qf.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield Mo(Gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Mo(Gi.setUsersGroupsError({key:t,value:fg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*HE({payload:e}){const t=hA.DELETE_ROLES_FROM_GROUP;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield $o(Qf.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield Mo(Gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Mo(Gi.setUsersGroupsError({key:t,value:fg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*JE({payload:e}){const t=hA.ADD_USERS_TO_GROUP;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield $o(Qf.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield Mo(Gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;null==e||null==(i=e.callback)||i.call(e,!1),yield Mo(Gi.setUsersGroupsError({key:t,value:fg(n)}))}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*YE({payload:e}){const t=hA.DELETE_USERS_FROM_GROUP;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield $o(Qf.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield Mo(Gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Mo(Gi.setUsersGroupsError({key:t,value:fg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*QE(){const e=hA.GET_GROUP_CONFIGURATION;yield Mo(Gi.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield $o(Qf.groups.getGroupConfiguration);yield Mo(Gi.setGroupsState({groupsConfiguration:t}))}catch(t){yield Mo(Gi.setUsersGroupsError({key:e,value:fg(t)}))}finally{yield Mo(Gi.setUsersGroupsLoader({key:e,value:!1}))}}function*XE({payload:e}){const t=hA.UPDATE_GROUP_CONFIGURATION;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{yield $o(Qf.groups.updateGroupConfiguration,e),yield Mo(Gi.getGroupConfiguration())}catch(e){yield Mo(Gi.setUsersGroupsError({key:t,value:fg(e)}))}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*ZE(){yield Na(Gi.loadGroups,BE),yield Na(Gi.getGroupById,jE),yield Na(Gi.createGroup,WE),yield Na(Gi.updateGroup,zE),yield Na(Gi.deleteGroup,KE),yield Na(Gi.addRolesToGroup,qE),yield Na(Gi.deleteRolesFromGroup,HE),yield Na(Gi.addUsersToGroup,JE),yield Na(Gi.deleteUsersFromGroup,YE),yield Na(Gi.getGroupConfiguration,QE),yield Na(Gi.updateGroupConfiguration,XE),yield Na(Gi.getTeamUsers,xE)}function*ek(){const e=hA.GET_GROUPS;yield Mo(Gi.setUsersGroupsLoader({key:e,value:!0}));const t=Yp;yield Mo(Gi.setGroupsState({groups:t})),yield Mo(Gi.setUsersGroupsLoader({key:e,value:!1}))}function*tk({payload:e}){var t;const n=hA.CREATE_GROUP,{groups:i}=yield VE();yield Mo(Gi.setUsersGroupsLoader({key:n,value:!0})),yield Mo(Gi.setGroupsState({groups:[R({},e,{id:`${e.name}ID`,managedBy:zf.FRONTEGG}),...null!=i?i:[]]})),yield Bo(500),null==e||null==(t=e.callback)||t.call(e,!0),yield Mo(Gi.setUsersGroupsLoader({key:n,value:!1}))}function*nk({payload:e}){var t,n,i,o,a;const r=hA.UPDATE_GROUP,s=yield VE();yield Mo(Gi.setUsersGroupsLoader({key:r,value:!0})),yield Mo(Gi.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:zf.FRONTEGG}):t})),selectedGroup:R({},null==s?void 0:s.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(i=null==e?void 0:e.color)?i:"",description:null!=(o=null==e?void 0:e.description)?o:""})})),yield Bo(500),null==e||null==(a=e.callback)||a.call(e,!0),yield Mo(Gi.setUsersGroupsLoader({key:r,value:!1}))}function*ik({payload:e}){var t,n;const i=hA.DELETE_GROUP,o=yield VE();yield Mo(Gi.setUsersGroupsLoader({key:i,value:!0})),yield Mo(Gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Bo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Mo(Gi.setUsersGroupsLoader({key:i,value:!1}))}function*ok({payload:e}){var t,n;const i=hA.ADD_ROLES_TO_GROUP,o=yield VE();yield Mo(Gi.setUsersGroupsLoader({key:i,value:!0})),yield Mo(Gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield Bo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Mo(Gi.setUsersGroupsLoader({key:i,value:!1}))}function*ak({payload:e}){var t,n;const i=hA.DELETE_ROLES_FROM_GROUP,o=yield VE();yield Mo(Gi.setUsersGroupsLoader({key:i,value:!0})),yield Mo(Gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield Bo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Mo(Gi.setUsersGroupsLoader({key:i,value:!1}))}function*rk({payload:e}){var t,n;const i=hA.ADD_USERS_TO_GROUP,o=yield VE();yield Mo(Gi.setUsersGroupsLoader({key:i,value:!0})),yield Mo(Gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield Bo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Mo(Gi.setUsersGroupsLoader({key:i,value:!1}))}function*sk({payload:e}){var t,n;const i=hA.DELETE_USERS_FROM_GROUP,o=yield VE();yield Mo(Gi.setUsersGroupsLoader({key:i,value:!0})),yield Mo(Gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield Bo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Mo(Gi.setUsersGroupsLoader({key:i,value:!1}))}function*lk(){const e=hA.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield VE();yield Mo(Gi.setUsersGroupsLoader({key:e,value:!0})),t&&(yield Mo(Gi.setGroupsState({groupsConfiguration:R({},t)}))),yield Mo(Gi.setUsersGroupsLoader({key:e,value:!1}))}function*ck({payload:e}){const t=hA.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield VE();yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0})),n&&(yield Mo(Gi.setGroupsState({groupsConfiguration:R({},n,e)}))),yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}function*uk(){yield Na(Gi.loadGroups,ek),yield Na(Gi.createGroup,tk),yield Na(Gi.updateGroup,nk),yield Na(Gi.deleteGroup,ik),yield Na(Gi.addRolesToGroup,ok),yield Na(Gi.deleteRolesFromGroup,ak),yield Na(Gi.addUsersToGroup,rk),yield Na(Gi.deleteUsersFromGroup,sk),yield Na(Gi.getGroupConfiguration,lk),yield Na(Gi.updateGroupConfiguration,ck)}let dk;!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"}(dk||(dk={}));const yk=(e,t,n)=>{var i,o;return e.tenantId===t?R({},e,{name:n}):R({},e,{children:null!=(i=null==e||null==(o=e.children)?void 0:o.map((e=>yk(e,t,n))))?i:[]})};function fk(e,t){var n;return R({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>fk(e,t))):[]})}function pk(e,t,n){var i,o;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 R({},e,{children:t})}return R({},e,{children:null!=(i=null==e||null==(o=e.children)?void 0:o.map((e=>pk(e,t,n))))?i:[]})}const gk=({items:e},t)=>e.map((e=>{var n,i;return{name:e.name,tenantId:e.tenantId,numberOfUsers:null!=(n=null==(i=t.find((t=>t.tenantId===e.tenantId)))?void 0:i.totalUsers)?n:0,createdAt:e.createdAt,metadata:e.metadata}})),Sk=()=>jo((e=>e.auth.allAccountsState));function*vk({payload:e}){const t=dk.GET_ACCOUNTS;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield Sk(),{jwt:i,_limit:o,_offset:a}=e,r={_offset:null!=a?a:n._offset,_limit:null!=o?o:n._limit,_subTenantId:null==e?void 0:e._subTenantId};try{if(i){var s;const{selectedAccount:t}=yield Sk(),{items:n,_links:o}=yield $o(Qf.tenants.searchSubTenants,r,{jwt:i}),a=yield $o(Qf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:i}),l=gk({items:n},a),c=pk(t.accounts?t.accounts:t,null!=(s=null==e?void 0:e._subTenantId)?s:"",l.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 Mo(Gi.setSelectedAccountState({accounts:c}))}else{var l;const{accounts:t}=yield Sk(),{items:n,_links:i}=yield $o(Qf.tenants.searchSubTenants,r),o=yield $o(Qf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=gk({items:n},o),s=pk(t,null!=(l=null==e?void 0:e._subTenantId)?l:"",a.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 Mo(Gi.setAllAccountsState({accounts:s}))}}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:fg(e)}))}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*hk({payload:e}){const t=dk.SEARCH_ACCOUNTS;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield Sk(),{jwt:i}=e;try{if(null!=e&&e._subTenantId){var o;const{items:t}=yield $o(Qf.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(o=null==e?void 0:e._filter)?o:"",_subTenantId:e._subTenantId},{jwt:i});yield Mo(Gi.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:fg(e)}))}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*mk({payload:e}){const t=dk.GET_USER_JWT;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:i}=e;try{const e=yield $o(Qf.users.GetUserJwt,{tenantId:n});yield Mo(Gi.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==i||i(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:fg(e)})),yield Mo(Gi.setSelectedAccountState({accessPermission:!1})),null==i||i(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Ak({payload:e}){const t=dk.CREATE_SUB_ACCOUNT;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:i,tenantId:o,jwt:a,callback:r}=e;try{if(a){const{accounts:e}=yield Sk(),{selectedAccount:t}=yield Sk(),r=yield $o(Qf.subTenants.createSubTenant,{name:n,parentTenantId:i,tenantId:o},{jwt:a}),s=pk(e,null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),l=pk(R({name:"",tenantId:""},null==t?void 0:t.accounts),null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Mo(Gi.setAllAccountsState({accounts:s})),yield Mo(Gi.setSelectedAccountState({accounts:l}))}else{const{accounts:e}=yield Sk(),t=yield $o(Qf.subTenants.createSubTenant,{name:n,tenantId:o,parentTenantId:i}),a=pk(e,null!=i?i:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Mo(Gi.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:fg(e)})),null==r||r(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*bk({payload:e}){const t=dk.DELETE_SUB_ACCOUNT;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:i,callback:o}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield Sk();yield $o(Qf.subTenants.deleteSubTenant,i,{jwt:n});const o=fk(t,i),a=fk(null==e?void 0:e.accounts,i);yield Mo(Gi.setAllAccountsState({accounts:o})),yield Mo(Gi.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield Sk();yield $o(Qf.subTenants.deleteSubTenant,i);const t=fk(e,i);yield Mo(Gi.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:fg(e)})),null==o||o(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Tk({payload:e}){const t=dk.UPDATE_SUB_ACCOUNT_SETTINGS;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:i,callback:o,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield Sk();yield $o(Qf.subTenants.updateSubTenant,{tenantId:a},{name:i},{jwt:n});const o=yk(e.accounts,a,i);yield Mo(Gi.setSelectedAccountState({name:i,accounts:o}));const r=yk(t,a,i);yield Mo(Gi.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield Sk();yield $o(Qf.subTenants.updateSubTenant,{tenantId:a},{name:i});const t=yk(e,a,i);yield Mo(Gi.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:fg(e)})),null==o||o(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Ek({payload:e}){const t=dk.DELETE_USERS_FROM_ACCOUNT;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:i,jwt:o,callback:a}=e;try{yield $o(Qf.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:i},{jwt:o}),yield Mo(Gi.getAccountUsers({jwt:o,_tenantId:i[0].tenantId})),null==a||a(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:fg(e)})),null==a||a(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*kk({payload:e}){const t=dk.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:i,jwt:o,callback:a}=e,{selectedAccount:r}=yield Sk();try{yield $o(Qf.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:i},{jwt:o}),yield Mo(Gi.getAccountUsers({jwt:o,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:fg(e)})),null==a||a(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Ok({payload:e}){const t=dk.ADD_USERS_TO_ACCOUNT;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:i,jwt:o,callback:a,allowSubAccountAccess:r=!1,roleIds:s}=e;try{yield $o(Qf.subTenants.addUsersToSubTenant,{users:n,tenantId:i,allowSubAccountAccess:r,roleIds:s},{jwt:o}),yield Mo(Gi.getAccountUsers({jwt:o,_tenantId:i})),null==a||a(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:fg(e)})),null==a||a(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Ik({payload:e}){const t=dk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield Sk(),{userId:i,allowAccess:o,jwt:a,callback:r}=e;try{var s;yield $o(Qf.subTenants.updateSubAccountAccess,i,{allowAccess:o},{jwt:a}),yield Mo(Gi.setSelectedAccountState({users:null==n||null==(s=n.users)?void 0:s.map((e=>e.id===i?R({},e,{subAccountAccessAllowed:o}):e))})),null==r||r(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:fg(e)})),null==r||r(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Pk({payload:e}){var t,n,i,o,a,r,s,l;const c=dk.GET_ACCOUNT_USERS;yield Mo(Gi.setAllAccountsLoader({key:c,value:!0}));const u=yield Sk(),{jwt:d,_tenantId:y,_email:f}=e,p=null!=(t=null!=(n=null==e?void 0:e._offset)?n:null==u||null==(i=u.selectedAccount)||null==(o=i.usersQueryParams)?void 0:o._offset)?t:0,g=null!=(a=null!=(r=null==e?void 0:e._limit)?r:null==u||null==(s=u.selectedAccount)||null==(l=s.usersQueryParams)?void 0:l._limit)?a:10,S=R({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield $o(Qf.users.getUsersV3,S,{jwt:d}),i={totalUsersItems:t,totalUsersPages:n,usersQueryParams:R({_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 $o(Qf.roles.getRoles),o=yield $o(Qf.users.getUsersRoles,{ids:t},{jwt:d}),a=e.map((e=>{var t,i;const a=null==o||null==(t=o.find((t=>t.userId===e.id)))?void 0:t.roleIds;return R({},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:[]})}));yield Mo(Gi.setSelectedAccountState(R({users:a},i)))}else yield Mo(Gi.setSelectedAccountState(R({users:[]},i)))}catch(e){yield Mo(Gi.setAllAccountsError({key:c,value:fg(e)}))}finally{yield Mo(Gi.setAllAccountsLoader({key:c,value:!1}))}}function*_k({payload:e}){const t=dk.SET_SELECTED_SUB_ACCOUNT_DATA;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var i,o,a,r,s,l,c;const e=yield $o(Qf.accountSettings.getSettings,{jwt:n}),u=yield $o(Qf.tenants.getTenantsUsersCount,{tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n}),d=yield $o(Qf.tenants.getParentTenants,{jwt:n}),y=yield $o(Qf.tenants.getHierarchyMetadata,{_tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n});yield Mo(Gi.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!=(s=e.tenantId)?s:"",numberOfUsers:null==(l=u[0])?void 0:l.totalUsers,createdAt:void 0,children:[]}})),yield Mo(Gi.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:fg(e)}))}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Lk(){const e=dk.SET_ROOT_ACCOUNT_DATA;yield Mo(Gi.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield jo((e=>e.auth.tenantsState)),{accounts:n}=yield Sk();if(t)try{var i;const o=yield $o(Qf.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==(i=o[0])?void 0:i.totalUsers,createdAt:null==t?void 0:t.createdAt};yield Mo(Gi.setAllAccountsState({rootAccount:a,accounts:R({},n,a)}))}catch(t){yield Mo(Gi.setAllAccountsError({key:e,value:fg(t)}))}finally{yield Mo(Gi.setAllAccountsLoader({key:e,value:!1}))}}function*wk({payload:e}){const t=dk.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:i}=e;try{const e=yield $o(Qf.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:i});yield Mo(Gi.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:fg(e)}))}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Ck(){yield Na(Gi.loadAccounts,vk),yield Na(Gi.searchAccounts,hk),yield Na(Gi.updateSubAccountAccessForUser,Ik),yield Na(Gi.getUserJwtForSubAccount,mk),yield Na(Gi.createSubAccount,Ak),yield Na(Gi.deleteSubAccount,bk),yield Na(Gi.updateSubAccountSettings,Tk),yield Na(Gi.addUsersToAccount,Ok),yield Na(Gi.deleteUsersFromAccount,Ek),yield Na(Gi.setUserRolesForSubAccount,kk),yield Na(Gi.getAccountUsers,Pk),yield Na(Gi.setRootAccountData,Lk),yield Na(Gi.setSelectedSubAccountData,_k),yield Na(Gi.loadNumberOfUsersForSelectedSubAccount,wk)}const Uk=["callback"],Dk=["callback"],Rk=["callback","phoneId"],Nk=["callback","phoneId"],Mk=["callback"];function*Fk(){yield Mo(Gi.setSmsState({loading:!0}));const e={_limit:10,_offset:0};try{const{items:t}=yield $o(Qf.userPhoneNumbers.getUserPhoneNumbers,e);yield Mo(Gi.setSmsState({phoneNumbers:t}))}catch(e){yield Mo(Gi.setSmsState({error:fg(e)}))}finally{yield Mo(Gi.setSmsState({loading:!1}))}}function*Gk(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Uk);yield Mo(Gi.setSmsState({loading:!0}));try{const e=yield $o(Qf.userPhoneNumbers.createPhoneNumber,n);yield Mo(Gi.setSmsState({otcToken:e.otcToken})),yield $o(Fk),null==t||t(!0)}catch(e){yield Mo(Gi.setSmsState({error:fg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSmsState({loading:!1}))}}function*$k(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Dk);yield Mo(Gi.setSmsState({loading:!0}));try{yield $o(Qf.userPhoneNumbers.verifyPhoneNumber,n),yield $o(Fk),null==t||t(!0)}catch(e){yield Mo(Gi.setSmsState({error:fg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSmsState({loading:!1}))}}function*Vk(e){let{payload:{callback:t,phoneId:n}}=e;Qi(e.payload,Rk),yield Mo(Gi.setSmsState({loading:!0}));try{const e=yield $o(Qf.userPhoneNumbers.deletePhoneNumber,n);yield Mo(Gi.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield Mo(Gi.setSmsState({error:fg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSmsState({loading:!1}))}}function*xk(e){let{payload:{callback:t,phoneId:n}}=e,i=Qi(e.payload,Nk);yield Mo(Gi.setSmsState({loading:!0}));try{yield $o(Qf.userPhoneNumbers.verifyDeletePhoneNumber,n,i),yield $o(Fk),null==t||t(!0)}catch(e){yield Mo(Gi.setSmsState({error:fg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSmsState({loading:!1}))}}function*jk(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Mk);yield Mo(Gi.setSmsState({loading:!0}));try{const e=yield $o(Qf.userPhoneNumbers.preVerifyPhoneNumber,n);yield Mo(Gi.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield Mo(Gi.setSmsState({error:fg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSmsState({loading:!1}))}}function*Bk(){yield Ra(Gi.loadPhoneNumbers,Fk),yield Ra(Gi.setUpPhoneNumber,Gk),yield Ra(Gi.verifyPhoneNumber,$k),yield Ra(Gi.deletePhoneNumber,Vk),yield Ra(Gi.verifyDeletePhoneNumber,xk),yield Ra(Gi.preVerifyPhoneNumber,jk)}var Wk={sagas:function*(){yield Fo([$o(ch),$o(sA),$o(cA),$o(Qm),$o(_T),$o(Oh),$o(Zh),$o(am),$o(Tg),$o(Fm),$o(yb),$o(ZE),$o(Db),$o(_S),$o(jb),$o(uS),$o(Qb),$o(aT),$o(mT),$o(RT),$o(BT),$o(pE),$o(UE),$o(NE),$o(GE),$o(Ck),$o(VS),$o(Rg),$o(Bk)])},mockSagas:function*(){yield Fo([$o(yh),$o(Uh),$o(cm),$o(Km),$o(Ob),$o(Hb),$o(ES),$o(GT),$o(eT),$o(sT),$o(KT),$o(kE),$o(bT),$o(uk),$o(xg)])},storeName:Dt,initialState:Ci,reducer:Mi,actions:Gi};const zk=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>R({},t,{[e]:R({},t[e],n)})}),Kk={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},qk={setAuditLogsState:zk("auditLogsState"),resetAuditLogsState:e=>R({},e,{auditLogsState:Kk})},Hk={exportAuditsCsv:yt("auditLogs/exportAuditsCsv"),loadAuditLogs:yt("auditLogs/loadAuditLogs",(e=>({payload:e})))},Jk={loading:!0},Yk={setAuditsMetadataState:zk("auditsMetadataState"),resetAuditsMetadataState:e=>R({},e,{auditsMetadataState:Jk})},Qk={loadAuditsMetadata:yt("auditLogs/loadAuditsMetadata")},Xk={auditLogsState:Kk,auditsMetadataState:Jk},{reducer:Zk,actions:eO}=pt({name:Nt,initialState:Xk,reducers:R({resetState:e=>R({},e,Xk),setState:(e,{payload:t})=>R({},e,t)},qk,Yk)}),tO=R({},eO,Hk,Qk),nO=e=>"createdAt"!==e.id,iO={total:20,data:Array.from(Array(5).keys()).map((e=>R({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`})))},oO={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}]},aO=()=>jo((e=>e.auditLogs.auditLogsState)),rO=()=>jo((e=>e.auditLogs.auditsMetadataState));function*sO(){const e=yield aO(),{columns:t}=yield rO();try{const n=e.filter,i=e.sort.reduce(((e,t)=>R({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>R({},e,{[t.id]:t.value})),{});yield Mo(tO.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Qf.audits.exportAudits(R({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield Mo(tO.setAuditLogsState({isDownloadingCsv:!1}))}function*lO({payload:e}){yield Mo(tO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield aO(),{columns:n}=yield rO();try{var i,o,a,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield Mo(tO.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>R({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>R({},e,{[t.id]:t.value})),{});n||(yield Mo(tO.loadAuditsMetadata()));const{data:p,total:g}=yield $o(Qf.audits.getAudits,R({offset:c,count:l},y,f));yield Mo(tO.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield Mo(tO.setAuditLogsState({loading:!1,error:fg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*cO(){yield Ra(tO.exportAuditsCsv,sO),yield Ra(tO.loadAuditLogs,lO)}function*uO({payload:e}){yield Mo(tO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield aO(),{columns:n}=yield rO();try{var i,o,a,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield Mo(tO.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield Mo(tO.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=iO;let i=n.filter((e=>t=>e.filter(nO).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];i=i.sort(((e,t)=>(n,i)=>n[e]>i[e]?t?-1:1:i[e]>n[e]?t?1:-1:0)(e,n))}return{data:i,total:i.length}})(u,d);yield Mo(tO.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield Mo(tO.setAuditLogsState({loading:!1,error:fg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*dO(){yield Ra(tO.loadAuditLogs,uO)}function*yO(){yield Mo(tO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield $o(Qf.metadata.getAuditsMetadata);yield Mo(tO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Mo(tO.setAuditsMetadataState({error:e,loading:!1}))}}function*fO(){yield Ra(tO.loadAuditsMetadata,yO)}function*pO(){yield Mo(tO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=oO;yield Mo(tO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Mo(tO.setAuditsMetadataState({error:e,loading:!1}))}}function*gO(){yield Ra(tO.loadAuditsMetadata,pO)}var SO={sagas:function*(){yield Fo([$o(cO),$o(fO)])},mockSagas:function*(){yield Fo([$o(dO),$o(gO)])},storeName:Nt,initialState:Xk,reducer:Zk,actions:tO};const vO={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:hO,actions:mO,reducer:AO}=pt({name:"audits",initialState:vO,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=R({},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]})))}}}),bO=R({},mO,{initData:yt(`${hO}/initData`),loadAudits:yt(`${hO}/loadAudits`),removeFilter:yt(`${hO}/removeFilter`),filterData:yt(`${hO}/filterData`),exportCSV:yt(`${hO}/exportCSV`),deleteAudits:yt(`${hO}/deleteAudits`)}),TO=()=>jo((e=>e[hO]));function*EO(){const{sortBy:e,sortDirection:t}=yield TO();try{const n=yield $o(Qf.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Mo(bO.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Mo(bO.loadItemFailedAction(t))}}function*kO(){try{const e=yield $o(Qf.metadata.getAuditsMetadata);yield Mo(bO.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Mo(bO.loadItemFailedAction(t))}}const OO=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*IO({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield TO(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield TO():{rowsData:[]};try{const e=OO(t),{data:s,total:d}=yield $o(Qf.audits.getAudits,R({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield Mo(bO.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield Mo(bO.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Mo(bO.loadItemFailedAction(t))}}function*PO(){yield Mo(bO.startLoading()),yield Fo([EO(),kO(),IO({payload:{onlyOneLoad:!1},type:""})]),yield Mo(bO.finishLoading())}function*_O({payload:e}){const{filters:t}=yield TO(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield Mo(bO.setFilterData(i))}function*LO({payload:e}){const{filters:t}=yield TO();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const i=[...t.slice(0,n),e,...t.slice(n+1)];yield Mo(bO.setFilterData(i))}function*wO(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield TO(),a=OO(e);yield Mo(bO.startDownloadingCsv());try{yield Qf.audits.exportAudits(R({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield Mo(bO.stopDownloadingCsv())}}function*CO(){yield Na(bO.initData,PO),yield Na(bO.removeFilter,_O),yield Na(bO.filterData,LO),yield Na([bO.loadAudits,bO.textSearch,bO.onPageChange],IO),yield Na([bO.setFilterData,bO.setDataSorting,bO.startRefresh],(()=>IO({payload:{appendMode:!1},type:""}))),yield Na(bO.exportCSV,wO)}const UO={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},DO={initData:()=>R({},UO),setConnectivityState:(e,{payload:t})=>R({},e,t),cleanWebhookTestData:e=>R({},e,{testResult:void 0}),cleanWebhookLogsData:e=>R({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return R({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>R({},e,{error:void 0}),cleanSlackData:e=>R({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>R({},e,{retryResult:R({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>R({},e,{retryResult:R({},e.retryResult,t)})}},RO={loadSlackActions:yt("connectivity/loadSlackActions"),loadDataAction:yt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:yt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:yt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:yt("connectivity/loadScope"),deleteWebhookConfigAction:yt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:yt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:yt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},NO={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:MO,actions:FO}=pt({name:Rt,initialState:NO,reducers:R({},DO)}),GO=R({},FO,RO),$O={slack:Qf.connectivity.getSlackConfiguration,email:Qf.connectivity.getEmailConfiguration,sms:Qf.connectivity.getSMSConfiguration,webhook:Qf.connectivity.getWebhooksConfigurations,categories:Qf.connectivity.getCategories,channelMap:Qf.connectivity.getChannelMaps},VO={slack:Qf.connectivity.postSlackConfiguration,email:Qf.connectivity.postEmailConfiguration,sms:Qf.connectivity.postSMSConfiguration,webhook:Qf.connectivity.postWebhooksConfiguration},xO=["email","slack","sms","webhook"],jO={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"}},BO=["id"],WO=["id","enabled"],zO=["categories","channelMap"];function*KO(e){return yield $o(HO,{payload:{api:e},type:""})}function*qO({payload:e=xO}){yield Mo(GO.setConnectivityState({isLoading:!0}));try{const t=yield Fo([...e.map(KO),yield HO({payload:{api:"categories"},type:""}),yield function*(){return(yield Fo(e.map((function*(e){return yield HO({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>R({},t,{[`${e[i]}`]:n})),{})}()]),n=yield HO({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?R({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:jO[e[o]].events(i),active:jO[e[o]].isActive(i),platform:jO[e[o]].title,image:jO[e[o]].image}]}):n:R({},n,{[`${zO[o-e.length]}`]:i})),{list:[],webhook:n});yield Mo(GO.setConnectivityState(R({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Mo(GO.setConnectivityState({isLoading:!1}))}}function*HO({payload:{api:e,params:t}}){try{return yield $o($O[e],t)}catch(e){return}}function*JO(){try{yield Mo(GO.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield $o(Qf.connectivity.getSlackChannels);yield Mo(GO.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Mo(GO.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*YO(e,t){const{connectivity:{list:n}}=yield jo(),i=n.find((({key:t})=>t===e));if(!i)return;const o=jO[e].isActive(t);o!==i.active&&(yield Mo(GO.setConnectivityState({list:n.map((t=>t.key===e?R({},t,{active:o}):t))})))}function*QO({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield jo((e=>e.connectivity));try{if(yield Mo(GO.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield jo();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield Fo([...i.reduce(((e,t)=>{var i,o;return!t.id&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length||(null==n?void 0:n.find((e=>{let{id:n}=e,i=Qi(e,BO);return n===t.id&&JSON.stringify(R({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield $o(VO.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield $o(Qf.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield jo(),{processIds:i}=yield jo((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield Fo([...e.reduce(((e,t)=>!o.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield $o("email"===t?Qf.connectivity.postEmailConfiguration:Qf.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:i}=e,o=n[0],{id:a="",enabled:r}=o,s=Qi(o,WO);return yield Fo([yield $o("email"===t?Qf.connectivity.patchEmailConfiguration:Qf.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield $o("email"===t?Qf.connectivity.putEmailSubscriptions:Qf.connectivity.putSMSSubscriptions,a,i,R({},s,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return $o("email"===t?Qf.connectivity.deleteEmailSubscriptions:Qf.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield HO({payload:{api:t},type:""});yield Mo(GO.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield YO(t,e)}else yield Mo(GO.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield $o(VO[e],t),!["sms","email"].includes(e)){const o=yield HO({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield Mo(GO.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield YO(e,o),null==n||n(!0)}}catch(e){yield Mo(GO.setConnectivityState({error:fg(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*XO({payload:e}){try{yield Qf.connectivity.postSlackCode(e)}catch{}yield Mo(GO.setConnectivityState({error:void 0,isSaving:!1}))}function*ZO(){const{slackChannels:e}=yield jo((e=>e.connectivity));try{yield Mo(GO.setConnectivityState({slackChannels:R({},e,{isLoadingScope:!0})}));const{clientId:t}=yield $o(Qf.connectivity.getSlackScope);yield Mo(GO.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Mo(GO.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*eI({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield jo((e=>e.connectivity));try{yield Mo(GO.setConnectivityState({isSaving:!0})),yield $o(Qf.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,fg(e))}const o=yield HO({payload:{api:"webhook"},type:""});o&&(yield Mo(GO.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*tI({payload:e}){try{yield Mo(GO.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield $o(Qf.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Mo(GO.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Mo(GO.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Mo(GO.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*nI({payload:e}){try{const{statusCode:t}=yield $o(Qf.connectivity.postWebhookRetry,e);yield Mo(GO.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Mo(GO.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*iI({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield jo((e=>e.connectivity));try{yield Mo(GO.setConnectivityState({webhookLogs:R({},i,{isLoading:!0})}));const o=yield $o(Qf.connectivity.getWebhookLog,e,n,t);yield Mo(GO.setConnectivityState({error:void 0,webhookLogs:R({isLoading:!1},o)}))}catch(e){yield Mo(GO.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var oI={sagas:function*(){yield Ra(GO.loadDataAction,qO),yield Na(GO.loadSlackActions,JO),yield Ra(GO.postDataAction,QO),yield Ra(GO.postCodeAction,XO),yield Ra(GO.loadScope,ZO),yield Ra(GO.deleteWebhookConfigAction,eI),yield Ra(GO.postWebhookTestAction,tI),yield Ra(GO.postWebhookRetryAction,nI),yield Na(GO.loadWebhookLogsAction,iI)},storeName:Rt,initialState:NO,reducer:MO,actions:GO};function aI(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,t.payload)}}}function rI(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>R({},n,{[e]:t(n[e],i)})}}function sI(e){return rI(e,((e,t)=>R({},e,{loading:t.payload})))}function lI(e){return rI(e,((e,t)=>R({},e,{error:t.payload,loading:!1})))}const cI={loading:!1,error:null,fetching:!0,plans:[]},{actions:uI,reducer:dI,name:yI}=pt({name:"subscriptions/plans",initialState:cI,reducers:R({},aI())}),fI=R({loadPlans:yt(`${yI}/loadPlans`)},uI),pI={loading:!1,error:null,fetching:!0,config:null},gI=R({},aI()),{actions:SI,reducer:vI,name:hI}=pt({name:"subscriptions/config",initialState:pI,reducers:gI}),mI=R({loadPaymentConfiguration:yt(`${hI}/loadPaymentConfiguration`)},SI),AI={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},bI=R({},aI(),{setCancellationLoading:sI("cancellation"),setCancellationError:lI("cancellation"),setRenewalLoading:sI("renewal"),setRenewalError:lI("renewal")}),{reducer:TI,actions:EI,name:kI}=pt({name:"subscriptions/billing/subscription",initialState:AI,reducers:bI}),OI=R({load:yt(`${kI}/loadSubscription`),cancelSubscription:yt(`${kI}/cancelSubscription`),renewSubscription:yt(`${kI}/renewSubscription`)},EI),II={loading:!1,error:null,fetching:!0},PI=R({},aI()),{reducer:_I,actions:LI,name:wI}=pt({name:"subscriptions/billing/information",initialState:II,reducers:PI}),CI=R({loadBillingInformation:yt(`${wI}/loadBillingInformation`),cancelSubscription:OI.cancelSubscription,renewSubscription:OI.renewSubscription},LI),UI={loading:!1,error:null,fetching:!0},DI=R({},aI(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,t.payload)}}),{reducer:RI,actions:NI,name:MI}=pt({name:"subscriptions/billing/payment",initialState:UI,reducers:DI}),FI=R({loadPaymentMethod:yt(`${MI}/loadPaymentMethod`),submitPaymentMethod:yt(`${MI}/submitPaymentMethod`),submitPaymentMethodError:yt(`${MI}/submitPaymentMethodError`),submitPaymentMethodSuccess:yt(`${MI}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:yt(`${MI}/updateBillingDetails`,(e=>({payload:e})))},NI),GI={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},$I=R({},aI(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,{invoiceDownload:R({},e.invoiceDownload,t.payload)})}}),{reducer:VI,actions:xI,name:jI}=pt({name:"subscriptions/billing/invoices",initialState:GI,reducers:$I}),BI=R({loadInvoices:yt(`${jI}/loadInvoices`),downloadInvoice:yt(`${jI}/downloadInvoice`,(e=>({payload:e})))},xI),WI={information:II,invoices:GI,paymentMethod:UI,subscription:AI},zI={invoices:BI,information:CI,paymentMethod:FI,subscription:OI},KI=Ke({invoices:VI,information:_I,paymentMethod:RI,subscription:TI}),qI={fetching:!0,loading:!1,error:null,confirmed:!1},HI=R({},aI()),{actions:JI,reducer:YI,name:QI}=pt({name:"subscriptions/checkout",initialState:qI,reducers:HI}),XI=R({loadCheckout:yt(`${QI}/loadCheckout`),resetCheckout:yt(`${QI}/resetCheckout`),submitCheckout:yt(`${QI}/submitCheckout`),confirmCheckout:yt(`${QI}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:yt(`${QI}/errorCheckout`,(e=>({payload:e})))},JI),ZI={loading:!1,error:null,cardSetupIntentSecret:null},eP=R({},aI()),{reducer:tP,actions:nP,name:iP}=pt({name:"subscriptions/stripe",initialState:ZI,reducers:eP}),oP=R({loadCustomer:yt(`${iP}/loadCustomer`),createCardSetupIntentSecret:yt(`${iP}/createCardSetupIntentSecret`)},nP),aP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:rP,reducer:sP,name:lP}=pt({name:"subscriptions/vendorPublicConfig",initialState:aP,reducers:R({},aI())}),cP=R({loadVendorPublicConfiguration:yt(`${lP}/loadVendorPublicConfiguration`)},rP),uP={config:pI,plans:cI,checkout:qI,billing:WI,stripe:ZI,vendorPublicConfig:aP},dP={config:mI,billing:zI,plans:fI,checkout:XI,stripe:oP,vendorPublicConfig:cP},yP=Ke({config:vI,billing:KI,plans:dI,checkout:YI,stripe:tP,vendorPublicConfig:sP});let fP,pP,gP;function SP({policy:e}){return{policy:gP.AT_PERIOD_END}}function vP(e){switch(e){case jy.ACTIVE:return pP.ACTIVE;case jy.INCOMPLETE:return pP.INCOMPLETE;case jy.CANCELED:return pP.CANCELED;case jy.EXPIRED:return pP.EXPIRED;case jy.TRIALING:return pP.TRIALING;default:return pP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(fP||(fP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(pP||(pP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(gP||(gP={}));const hP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:jy.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},mP=[{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"}],AP=[{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:""}],bP=[{id:"id",externalId:"externalId",type:By.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],TP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*EP(){yield Mo(OI.setLoading(!0));try{const[e]=yield $o(Qf.subscriptions.getManagedSubscriptions);yield Mo(OI.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Mo(OI.setError(e))}}function*kP(){yield Ra(CI.loadBillingInformation,OP)}function*OP(){yield function*(e){const t=yield jo((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield jo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield IP(n,!1):yield Mo(CI.setError(t?"Not authorized":"Internal feature failure"))}()}function*IP(e,t){yield Mo(CI.setLoading(!0));try{var n,i;const o=yield $o(Qf.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield $o(Qf.subscriptions.getSubscriptionPlan,a):([,s]=yield Fo([$o(EP),$o(Qf.subscriptions.getSubscriptionPlan,a)]),l=yield jo((e=>e.subscriptions.billing.subscription.subscription||null))),yield Mo(CI.setState(R({loading:!1,fetching:!1,summary:o},l?{subscription:{id:l.id,externalId:l.externalId,startDate:l.startDate,currentPeriodStart:l.currentPeriodStart,currentPeriodEnd:l.currentPeriodEnd,status:t?pP.ACTIVE:vP(l.status),cancellation:l.cancellation&&SP(l.cancellation),trialEnd:l.trialEnd?l.trialEnd:null}}:{},s?{plan:{id:s.id,name:s.name,description:s.description,price:(null==(n=s.price)?void 0:n.amount)||0,currency:(null==(i=s.price)?void 0:i.currency)||"usd",recurringInterval:"month",slug:s.slug}}:{})))}catch(e){yield Mo(CI.setError(fg(e)))}}function*PP(){yield function*(){var e,t;yield Mo(CI.setLoading(!0)),yield Bo(500),yield Mo(CI.setState({loading:!1,fetching:!1,summary:{subscriptionId:hP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:zy.Stripe,externallyManaged:!1,currentPlanId:mP[0].id,defaultPlanId:mP[0].id},plan:R({},mP[0],{price:null==(e=mP[0].price)?void 0:e.amount,currency:null==(t=mP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*_P(){yield Ra(CI.loadBillingInformation,PP)}function*LP(){yield Ra(FI.loadPaymentMethod,wP),yield Ra(FI.submitPaymentMethod,UP),yield Ra(FI.submitPaymentMethodError,DP),yield Ra(FI.submitPaymentMethodSuccess,RP),yield Ra(FI.updatePaymentMethodBillingDetails,CP)}function*wP(){yield Mo(FI.setLoading(!0));try{const e=(yield $o(Qf.subscriptions.getPaymentMethods))[0];yield Mo(FI.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Mo(FI.setError(fg(e)))}}function*CP({payload:e}){yield Mo(FI.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield $o(Qf.subscriptions.updatePaymentMethodBillingDetails,t,R({email:n},i)),yield $o(wP),null==o||o(!0)}catch(e){yield Mo(FI.setError(fg(e))),null==o||o(!1)}yield Mo(FI.setLoading(!1))}function*UP(){yield Mo(FI.setLoading(!0))}function*DP({payload:e}){yield Mo(FI.setError(e))}function*RP(){yield Mo(FI.loadPaymentMethod())}function*NP(){yield Mo(FI.setLoading(!0)),yield Bo(500);const e=bP[0];yield Mo(FI.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*MP(){yield Ra(FI.loadPaymentMethod,NP)}function*FP(){yield Ra(BI.loadInvoices,GP),yield Ra(BI.downloadInvoice,$P)}function*GP(){yield Mo(BI.setLoading(!0));try{const e=(yield $o(Qf.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 Mo(BI.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Mo(BI.setError(fg(e)))}}function*$P({payload:e}){yield Mo(BI.setInvoiceDownloadState({loading:!0,error:null}));try{yield $o(Qf.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Mo(BI.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Mo(BI.setInvoiceDownloadState({loading:!1,error:fg(e,null)}))}}function*VP(){yield Mo(BI.setLoading(!0)),yield Bo(500),yield Mo(BI.setState({loading:!1,fetching:!1,invoices:AP.map((e=>R({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Mo(BI.setLoading(!1))}function*xP(){yield Ra(BI.loadInvoices,VP)}function*jP(){yield Ra(OI.load,BP),yield Ra(OI.cancelSubscription,WP),yield Ra(OI.renewSubscription,zP)}function*BP(){const e=yield jo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield IP(e)}function*WP(){const{subscription:e}=yield jo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Mo(OI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Mo(OI.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===jy.ACTIVE)try{yield Mo(OI.setCancellationLoading(!0)),yield $o(Qf.subscriptions.cancelManagedSubscription,t),yield EP(),yield Mo(OI.setCancellationLoading(!1))}catch(e){yield Mo(OI.setCancellationError(fg(e)))}}function*zP(){const{subscription:e}=yield jo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Mo(OI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Mo(OI.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Wy.AT_PERIOD_END)try{yield Mo(OI.setRenewalLoading(!0)),yield $o(Qf.subscriptions.renewManagedSubscription,t),yield EP(),yield Mo(OI.setRenewalLoading(!1))}catch(e){yield Mo(OI.setCancellationError(fg(e)))}}function*KP(){yield Mo(OI.setLoading(!0)),yield Bo(500),yield Mo(OI.setState({subscription:hP,fetching:!1,loading:!1,error:null}))}function*qP(){yield Ra(OI.load,KP)}function*HP(){yield Fo([$o(kP),$o(LP),$o(FP),$o(jP)])}function*JP(){yield Fo([$o(_P),$o(MP),$o(xP),$o(qP)])}function*YP(){yield Ra(XI.loadCheckout,QP),yield Ra(XI.resetCheckout,XP),yield Ra(XI.submitCheckout,ZP),yield Ra(XI.confirmCheckout,e_),yield Ra(XI.errorCheckout,n_)}function*QP(){yield Mo(XI.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*XP(){yield Mo(XI.setState({loading:!1,error:null,confirmed:!1}))}function*ZP(){yield Mo(XI.setState({loading:!0,error:null}))}function*e_({payload:{paymentMethodId:e,planId:t}}){const n=yield jo((e=>e.subscriptions.billing.subscription.subscription)),i=yield jo((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===jy.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield Mo(XI.setState({loading:!0,error:null})),o&&a)return yield t_(),void(yield Mo(OI.setState({subscription:R({},n,{status:jy.ACTIVE})})));try{yield $o(Qf.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Fo([OP(),wP(),GP()]),yield t_()}catch(e){yield Mo(XI.setState({loading:!1,error:fg(e)}))}}else yield Mo(XI.setState({loading:!1,error:"Subscription not found"}))}function*t_(){yield Mo(XI.setState({loading:!1,error:null,confirmed:!0}))}function*n_({payload:e}){yield Mo(XI.setState({loading:!1,error:e}))}function*i_(){yield Ra(XI.resetCheckout,XP)}function*o_(){yield Ra(fI.loadPlans,a_)}function*a_(){yield Mo(fI.setLoading(!0));try{const e=(yield $o(Qf.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 Mo(fI.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Mo(fI.setError(fg(e)))}}function*r_(){yield Mo(fI.setLoading(!0)),yield Bo(500),yield Mo(fI.setState({fetching:!1,loading:!1,plans:mP.map((e=>{var t,n;return R({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*s_(){yield Ra(fI.loadPlans,r_)}function*l_(){yield Ra(mI.loadPaymentConfiguration,c_)}function*c_(){yield Mo(mI.setLoading(!0));try{(yield $o(Qf.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===zy.Stripe))?yield function*(){yield Mo(mI.setLoading(!0));try{const e=yield $o(Qf.subscriptions.getStripePaymentProviderConfiguration);yield Mo(mI.setState({loading:!1,fetching:!1,config:{paymentProvider:fP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Mo(mI.setError(fg(e)))}}():yield Mo(mI.setError("Payment provider not configured"))}catch(e){yield Mo(mI.setError(fg(e)))}}function*u_(){yield Mo(mI.setLoading(!0)),yield Bo(500),yield Mo(mI.setState({loading:!1,fetching:!1,config:{paymentProvider:fP.STRIPE,apiKey:""}}))}function*d_(){yield Ra(mI.loadPaymentConfiguration,u_)}function*y_(){yield Ra(oP.createCardSetupIntentSecret,f_)}function*f_({payload:e}){yield Mo(oP.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield $o(Qf.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Mo(oP.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Mo(oP.setError(fg(e)))}}function*p_(){yield Ra(cP.loadVendorPublicConfiguration,g_)}function*g_(){yield Mo(cP.setLoading(!0));try{const e=yield $o(Qf.subscriptions.getVendorPublicConfigurations);yield Mo(cP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Mo(cP.setError(fg(e)))}}function*S_(){yield Mo(cP.setLoading(!0)),yield Bo(500),yield Mo(cP.setState({fetching:!1,loading:!1,vendorPublicConfig:TP}))}function*v_(){yield Ra(cP.loadVendorPublicConfiguration,S_)}var h_={sagas:function*(){yield Fo([$o(HP),$o(YP),$o(o_),$o(l_),$o(y_),$o(p_)])},mockSagas:function*(){yield Fo([$o(JP),$o(i_),$o(s_),$o(d_),$o(v_)])},reducer:yP,actions:dP,initialState:uP,storeName:"subscriptions"},m_={sagas:function*(){yield Ra(RS.loadVendorPublicInfo,NS)},storeName:Mt,initialState:CS,reducer:US,actions:RS};const{reducer:A_}=pt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Fa.setContext(t),R({},e,{context:t}))}}}),b_=(e,t,n=!1,i,o,a=!1,r="path")=>{const s="undefined"==typeof window;let l=t;if(s&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var c,u,d,y,f,p,g,S,v,h;n||a||Fa.setContext(e.context);const t=Oa(),s=[...ut({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=dt({middleware:s,preloadedState:{root:R({},e,{previewMode:n,urlStrategy:r}),[Wk.storeName]:R({},Wk.initialState,i,null!=(c=null==o?void 0:o.auth)?c:{},{routes:R({},Wk.initialState.routes,null!=(u=null==i?void 0:i.routes)?u:{},null!=(d=null==o||null==(y=o.auth)?void 0:y.routes)?d:{})}),[SO.storeName]:R({},SO.initialState,null!=(f=null==o?void 0:o.auditLogs)?f:{},{auditLogsState:R({},SO.initialState.auditLogsState,null!=(p=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:R({},SO.initialState.auditsMetadataState,null!=(S=null==o||null==(v=o.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[hO]:R({},vO,null!=(h=null==o?void 0:o.audits)?h:{}),[oI.storeName]:oI.initialState,[h_.storeName]:h_.initialState,[m_.storeName]:m_.initialState},reducer:Ke({root:A_,[Wk.storeName]:Wk.reducer,[SO.storeName]:SO.reducer,[hO]:AO,[oI.storeName]:oI.reducer,[h_.storeName]:h_.reducer,[m_.storeName]:m_.reducer})});const m=function*(){yield Fo([$o(Wk.sagas),$o(SO.sagas),$o(CO),$o(oI.sagas),$o(h_.sagas),$o(m_.sagas)])},A=function*(){yield Fo([$o(Wk.mockSagas),$o(SO.mockSagas),$o(h_.mockSagas)])};n?(l.store.destroy=t.run(A).cancel,l.store.dispatch(Gi.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel,l.store.subscribeStateChanged=e=>{let t=l.store.getState();return l.store.subscribe((()=>{const n=l.store.getState();t!=n&&(t=n,e(n))}))}}return l.store};var T_=n(314);const E_=()=>{if(!Fa.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")},k_=(e,t)=>e?e.isEntitled?{isEntitled:!0}:{isEntitled:!1,justification:e.justification}:{isEntitled:!1,justification:t};var O_=n(714),I_=n.n(O_);function P_(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function __(e){if(e.type)return e;if("#"===e.charAt(0))return __(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const i=e.substring(t+1,e.length-1);let o,a;if("color"===n){if(a=i.split(" "),o=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(o))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+o)}else a=i.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:o}}function L_(e){const{type:t,colorSpace:n}=e;let{values:i}=e;return-1!==t.indexOf("rgb")?i=i.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),i=-1!==t.indexOf("color")?`${n} ${i.join(" ")}`:`${i.join(", ")}`,`${t}(${i})`}function w_(e){if(0===e.indexOf("#"))return e;const{values:t}=__(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 C_(e,t){return e=__(e),t=P_(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,L_(e)}function U_(e,t){if(e=__(e),t=P_(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 L_(e)}function D_(e,t){if(e=__(e),t=P_(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 L_(e)}const R_=e=>{if(e)return{main:e,light:w_(D_(e,.4)),dark:w_(U_(e,.15)),hover:w_(U_(e,.15)),active:w_(U_(e,.2))}},N_=e=>{if(e)return{main:e,light:D_(e,.7),dark:U_(e,.2)}},M_=(e,t)=>{var n,i,o,a,r,s,l,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?R({},t,{palette:{primary:R({},R_(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:R({},R_(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(s=null==e||null==(l=e.palette)?void 0:l.secondaryText)?s:"#000000"}),danger:R({},R_(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:R({},N_(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:R({},N_(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:R({},N_(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:R({},N_(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},F_={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 G_{constructor(){this._theme=F_.theme,this._themeV2=F_.themeV2,this._navigation=F_.navigation,this._localizations=F_.localizations,this._integrations=F_.integrations}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new G_;return n.set(e),G_._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,i,o,a,r,s,l,c;this._navigation=I_().all([null!=(t=F_.navigation)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=I_().all([null!=(i=F_.theme)?i:{},M_(null==e?void 0:e.theme,F_.theme)]),this._themeV2=I_().all([null!=(o=F_.themeV2)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=I_().all([null!=(r=F_.localizations)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}]),this._integrations=I_().all([null!=(l=F_.integrations)?l:{},null!=(c=null==e?void 0:e.integrations)?c:{}])}catch(e){this._navigation=F_.navigation,this._theme=F_.theme,this._themeV2=F_.themeV2,this._localizations=F_.localizations,this._integrations=F_.integrations}}}G_._instances={};var $_=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},V_=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(t);return Object.keys(n).forEach((function(e){return i.setAttribute(e,n[e])})),e.appendChild(i),i},x_=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))},j_=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 B_,W_,z_,K_,q_,H_,J_,Y_,Q_,X_,Z_;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(B_||(B_={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(W_||(W_={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(z_||(z_={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(K_||(K_={})),function(e){e.Invoices="invoices"}(q_||(q_={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(H_||(H_={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(J_||(J_={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(Y_||(Y_={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(Q_||(Q_={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(X_||(X_={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(Z_||(Z_={}));const eL={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},tL={hidden:"hidden",edit:"edit"};var nL="6.150.0",iL={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"},oL=function(){function e(t,n){var i,o,a=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];I(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(nL),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=M(G().mark((function e(){var t,n,i,o,r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=_r,a.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,a.options.metadata=null!=(n=null==r||null==(i=r.rows)||null==(o=i[0])?void 0:o.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:G_.set(a.options.metadata,a.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=M(G().mark((function e(){var t,n,i;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=null==(t=a.options.authOptions)||null==(n=t.hostedLoginOptions)?void 0:n.loadUserOnFirstLoad,a.options.builderMode||"nextjs"===a.options.framework||(a.options.hostedLoginBox&&!a.options.customLoginBox&&i?a.store.dispatch({type:"auth/requestHostedLoginAuthorizeV2",payload:{shouldRedirectToLogin:!1,firstTime:!0}}):a.store.dispatch({type:"auth/requestAuthorize",payload:!0}));case 2:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=M(G().mark((function e(){var t;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.options.previewMode&&!a.options.builderMode){e.next=4;break}Gr.set(iL,a.name),e.next=15;break;case 4:return e.prev=4,e.next=7,$r();case 7:t=e.sent,a.options.overrideFeatureFlags&&Object.assign(t,a.options.overrideFeatureFlags),Gr.set(t,a.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){Gr.set(R({},iL,e),a.name)},this.queryFeatureFlags=function(e){return Gr.getFeatureFlags(e,a.name)},this.updateLocalizationsSetter=function(e){a.updateLocalizations=e},this.getEntitlementsFromStore=function(){var e;return null==(e=a.store.getState().auth.user)?void 0:e.entitlements},this.getUserFromStore=function(){return a.store.getState().auth.user},this.getEntitlementsQueryData=function(e){var t=a.getUserFromStore();return{entitlements:a.getEntitlementsFromStore(),attributes:{custom:e,jwt:t},isV2:D(a.queryFeatureFlags([Mr]),1)[0]}};var l=$_(n),c="frontegg-app-".concat(l);this.iframeRendering=r,this.name=l,this.options=R({},t,{contextOptions:R({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=c;var u,d,y=this.options.authOptions?R({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(y.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!s&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=b_({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,y,{auth:null!=(u=this.options.authOptions)?u:{},audits:null!=(d=this.options.auditsOptions)?d:{}},!1,this.options.urlStrategy);C.setInstance(l,this),this.setEntitlementsOptions(t.entitlementsOptions),this.setSessionContext({enableSessionPerTenant:null==(o=t.authOptions)?void 0:o.enableSessionPerTenant}),Fa.setAppName(l)}var t,n,i,o;return w(e,[{key:"setEntitlementsOptions",value:function(e){Fa.setEntitlementsOptions(R({},e))}},{key:"setSessionContext",value:function(e){Fa.setSessionContext(R({},e))}},{key:"initContainers",value:(o=M(G().mark((function e(t){return G().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,i=void 0,void 0,a=void 0,null==(a=null==(o=G_.getInstance(n))||null==(i=o.integrations)?void 0:i.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,i,o,a}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;G_.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:k,FronteggTypes:O})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=M(G().mark((function e(){return G().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 i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=M(G().mark((function e(){var t;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Fa.setRequestSource(ci.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(),j_(t),Fa.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=M(G().mark((function e(t){var n;return G().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,R({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,t){var n=this.getEntitlementsQueryData(t);return((e,t,n,i)=>{var o;return E_(),i?(0,T_.tE)(t,e,n):k_(null==e||null==(o=e.features)?void 0:o[t],js.MISSING_FEATURE)})(n.entitlements,e,n.attributes,n.isV2)}},{key:"getPermissionEntitlements",value:function(e,t){var n=this.getEntitlementsQueryData(t);return((e,t,n,i)=>{var o;return E_(),i?(0,T_.wJ)(t,e,n):k_(null==e||null==(o=e.permissions)?void 0:o[t],js.MISSING_PERMISSION)})(n.entitlements,e,n.attributes,n.isV2)}},{key:"getEntitlements",value:function(e,t){return"permissionKey"in e?this.getPermissionEntitlements(e.permissionKey,t):this.getFeatureEntitlements(e.featureKey,t)}},{key:"loadEntitlements",value:function(e){this.store.dispatch({type:"auth/loadEntitlements",payload:{callback:e}})}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),aL=function(){function e(){I(this,e)}return w(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=C.getInstance(i);e&&t?(Fa.setAccessToken(t),Fa.setUser(R({},n,{accessToken:t})),o.store.dispatch(Gi.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(Gi.loadTenants())):(Fa.setAccessToken(null),Fa.setUser(null),o.store.dispatch(Gi.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),rL=function(){function e(){I(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}(),sL=function(){function e(){I(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}(),lL=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},cL=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];I(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(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=b_({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=R({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},o),this.app=new oL(this.options,t,!0),G_.set({},t)}var t;return w(e,[{key:"render",value:(t=M(G().mark((function e(t){var n,i,o,a,r=this;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,x_(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}(),uL="modern",dL=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[uL]},yL=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];I(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(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=b_({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=R({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},o),this.app=new oL(this.options,t,!0,a),G_.set({},t)}var t;return w(e,[{key:"render",value:(t=M(G().mark((function e(t){var n,i,o,a,r=this;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,x_(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 fL(e,t){return fL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},fL(e,t)}function pL(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&&fL(e,t)}function gL(e,t){if(t&&("object"===P(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 SL(e){return SL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},SL(e)}function vL(){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 hL(e,t,n){return hL=vL()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&fL(o,n.prototype),o},hL.apply(null,arguments)}function mL(e){var t="function"==typeof Map?new Map:void 0;return mL=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 hL(e,arguments,SL(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),fL(n,e)},mL(e)}function AL(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=SL(e);if(t){var o=SL(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return gL(this,n)}}var bL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new oL(e,t);if("undefined"!=typeof document){var i;if(!e.contextOptions.baseUrl){var o=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(o.message),o}if(!customElements.get("frontegg-app")){var a=function(e){pL(n,e);var t=AL(n);function n(){var e;I(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return(e=t.call.apply(t,[this].concat(o))).app=null,e}return 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 i=V_(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=V_(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=V_(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=i.attachShadow({mode:"open"}),s=o.attachShadow({mode:"open"}),l=a.attachShadow({mode:"open"}),c=V_(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=V_(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=V_(l,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:i,loginBoxContainer:o,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(mL(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));