@frontegg/js 6.98.0 → 6.99.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see frontegg.production.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?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},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 p?t:p,a=Object.create(o.prototype),s=new O(i||[]);return r(a,"_invoke",{value:P(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 g={};function p(){}function S(){}function v(){}var h={};d(h,l,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(w([])));b&&b!==n&&a.call(b,l)&&(h=b);var A=v.prototype=p.prototype=Object.create(h);function k(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function T(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 P(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=I(r,n);if(s){if(s===g)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===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function I(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,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var o=f(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,g;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,g):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,g)}function L(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 E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function w(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:C}}function C(){return{value:void 0,done:!0}}return S.prototype=v,r(A,"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(A),e},t.awrap=function(e){return{__await:e}},k(T.prototype),d(T.prototype,c,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new T(y(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},k(A),d(A,u,"Generator"),d(A,l,(function(){return this})),d(A,"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=w,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(E),!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,g):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),g},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),E(n),g}},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;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),g}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return JI},AdminPortalRenderer:function(){return XI},AppHolder:function(){return w},CheckoutDialog:function(){return YI},FronteggApp:function(){return qI},HostedLogin:function(){return HI},LoginBoxRenderer:function(){return tL},createElement:function(){return CI},defaultTheme:function(){return ZI},formatName:function(){return wI},getThemeAdminByName:function(){return QI},getThemeByName:function(){return eL},initialize:function(){return uL},mockFlagsList:function(){return zI},waitThemeSetter:function(){return DI}});var e={};n.r(e),n.d(e,{Delete:function(){return Pa},Get:function(){return ba},Patch:function(){return ka},Post:function(){return Aa},PostDownload:function(){return Ia},Put:function(){return Ta},extractHeadersFromOptions:function(){return La},getBaseUrl:function(){return va},getMetaDataHeaders:function(){return ha}});var t={};n.r(t),n.d(t,{getParentTenants:function(){return yr},getSubTenants:function(){return ur},getSubTenantsAsTree:function(){return dr},getTenants:function(){return cr},getTenantsUsersCount:function(){return fr},switchTenant:function(){return lr}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return xr},MachineToMachineAuthStrategy:function(){return Vr},OAuthLogout:function(){return ds},SocialLoginProviders:function(){return Gr},acceptInvitation:function(){return ss},activateAccount:function(){return is},bulkCreateIPRestriction:function(){return _r},changePhoneNumber:function(){return ec},changePhoneNumberWithVerification:function(){return Xl},checkIfAllowToRememberMfaDevice:function(){return El},createDomainRestriction:function(){return Or},createIPRestriction:function(){return Ur},createOrUpdateSessionConfigrations:function(){return dl},createSSOConfiguration:function(){return Rl},createSSOConfigurationByMetadata:function(){return Ml},createSSODomain:function(){return Fl},createSSOGroup:function(){return jl},createSamlGroup:function(){return Ys},createTenantAccessToken:function(){return ml},createUserAccessToken:function(){return hl},deleteAllSessionsForUser:function(){return fl},deleteDomainRestriction:function(){return Cr},deleteIPRestriction:function(){return Nr},deleteSSOConfiguration:function(){return _l},deleteSSODomain:function(){return $l},deleteSSOGroup:function(){return Bl},deleteSamlGroup:function(){return Xs},deleteSessionForUser:function(){return yl},deleteTenantAccessToken:function(){return Sl},deleteTenantApiToken:function(){return Pl},deleteUserAccessToken:function(){return vl},deleteUserApiToken:function(){return Il},deleteWebAuthnDevice:function(){return ac},disableMFAAuthenticatorApp:function(){return Is},disableMFASMS:function(){return Es},disableMFAWebAuthn:function(){return ws},disableMfa:function(){return Ps},enrollMFAAuthenticatorApp:function(){return hs},enrollMFAAuthenticatorAppForLogin:function(){return Rs},enrollMFASMS:function(){return bs},enrollMFASMSForLogin:function(){return Ms},enrollMFAWebAuthn:function(){return ks},enrollMFAWebAuthnForLogin:function(){return Gs},enrollMfa:function(){return Ss},exchangeOAuthTokens:function(){return Hl},forgotPassword:function(){return ys},generateLoginResponse:function(){return Hr},generateLoginResponseFromOAuthResponse:function(){return Yr},generateLoginResponseV2:function(){return Jr},getActivateAccountStrategy:function(){return os},getCaptchaPolicy:function(){return Ar},getCurrentUserSession:function(){return ll},getCurrentUserSessions:function(){return sl},getCustomSocialLoginProvidersV1:function(){return il},getDomainRestrictions:function(){return Lr},getDomainRestrictionsConfig:function(){return Er},getGlobalSecurityPolicy:function(){return gr},getIPRestrictions:function(){return Dr},getIPRestrictionsConfig:function(){return Rr},getLockoutPolicy:function(){return hr},getMFADevices:function(){return Cs},getMFAStrategiesConfig:function(){return lc},getMfaPolicy:function(){return pr},getOidcConfiguration:function(){return Zs},getPasswordConfigPolicy:function(){return Ir},getPasswordHistoryPolicy:function(){return kr},getSSOConfigurations:function(){return Dl},getSSODefaultRoles:function(){return xl},getSSOGroups:function(){return Kl},getSSOPublicConfiguration:function(){return el},getSamlConfiguration:function(){return js},getSamlRoles:function(){return qs},getSamlRolesGroups:function(){return Hs},getSamlVendorConfiguration:function(){return Bs},getSessionConfigurations:function(){return ul},getSocialLoginProviders:function(){return tl},getSocialLoginProvidersV2:function(){return nl},getTenantAccessTokensData:function(){return pl},getTenantApiTokensData:function(){return Al},getUserAccessTokensData:function(){return gl},getUserApiTokensData:function(){return bl},getUserById:function(){return Ll},getVendorConfig:function(){return al},getVendorLockoutPolicy:function(){return mr},getVendorMfaPolicy:function(){return Sr},getVendorPasswordHistoryPolicy:function(){return Tr},getVendorPublicAuthStrategiesConfig:function(){return sc},getWebAuthnDevices:function(){return oc},loadPasswordConfig:function(){return gs},login:function(){return ts},loginViaSocialLogin:function(){return ol},loginWithMfa:function(){return ns},logout:function(){return us},oidcPostLogin:function(){return es},oidcPostLoginV2:function(){return ql},passwordlessPostLogin:function(){return wl},passwordlessPreLogin:function(){return Ol},postLogin:function(){return Zr},preDisableMFASMS:function(){return Ls},preDisableMFAWebAuthn:function(){return Os},preEnrollMFAAuthenticatorApp:function(){return vs},preEnrollMFAAuthenticatorAppForLogin:function(){return Ds},preEnrollMFASMS:function(){return ms},preEnrollMFASMSForLogin:function(){return _s},preEnrollMFAWebAuthn:function(){return As},preEnrollMFAWebAuthnForLogin:function(){return $s},preLogin:function(){return Qr},preLoginV2:function(){return zl},preLoginWithIdpType:function(){return Xr},preVerifyMFASMSForLogin:function(){return Ns},preVerifyMFAWebAuthnForLogin:function(){return xs},recoverMfaToken:function(){return ps},refreshToken:function(){return ls},refreshTokenV2:function(){return cs},resendActivationEmail:function(){return as},resendInvitationEmail:function(){return rs},resetPassword:function(){return fs},resetPhoneNumber:function(){return Yl},revokeSessionsForUser:function(){return cl},saveLockoutPolicy:function(){return br},saveMfaPolicy:function(){return vr},savePasswordHistoryPolicy:function(){return Pr},setSSODefaultRoles:function(){return Vl},signUpUser:function(){return rl},silentOAuthRefreshToken:function(){return Jl},testCurrentIp:function(){return Fr},testCurrentIpInAllowList:function(){return $r},updateDomainRestrictionConfig:function(){return wr},updateIPRestrictionConfig:function(){return Mr},updateSSOConfiguration:function(){return Ul},updateSSOConfigurationByMetadata:function(){return Nl},updateSSOGroup:function(){return Wl},updateSamlConfiguration:function(){return Ws},updateSamlGroup:function(){return Qs},updateSamlRoles:function(){return Js},updateSamlVendorMetadata:function(){return Ks},updateTenantApiTokensData:function(){return Tl},updateUserApiTokensData:function(){return kl},validateSSODomain:function(){return Gl},validateSamlDomain:function(){return zs},verifyChangePhoneNumber:function(){return Zl},verifyInviteToken:function(){return Cl},verifyMFAAuthenticatorAppForLogin:function(){return Us},verifyMFASMSForLogin:function(){return Fs},verifyMFAWebAuthnForLogin:function(){return Vs},verifyMfa:function(){return Ts},verifyNewDeviceSession:function(){return rc},verifyResetPhoneNumber:function(){return Ql},webAuthnCreateNewDeviceSession:function(){return ic},webAuthnPostLogin:function(){return nc},webAuthnPreLogin:function(){return tc}});var a={};n.r(a),n.d(a,{addUser:function(){return gc},changePassword:function(){return yc},createInviteUserLink:function(){return vc},deleteInviteUserLink:function(){return mc},deleteUser:function(){return pc},getInviteLinkConfiguration:function(){return Ac},getInviteUserLink:function(){return bc},getProfile:function(){return cc},loadAvailablePermissions:function(){return Tc},loadAvailableRoles:function(){return kc},loadStats:function(){return Pc},loadUsers:function(){return fc},resendActivationLink:function(){return Ic},resendInvitationLink:function(){return Lc},resendInvitationLinkToAllTenants:function(){return Ec},updateInviteUserLink:function(){return hc},updateProfile:function(){return uc},updateProfileImage:function(){return dc},updateUser:function(){return Sc}});var r={};n.r(r),n.d(r,{getAdminBoxMetadata:function(){return wc},getAuditsMetadata:function(){return _c},getCurrentUserIpMetadata:function(){return Dc},getIpAdressMetadata:function(){return Mc},getNotificationsMetadata:function(){return Rc},getSamlMetadata:function(){return Uc},updateAdminBoxMetadata:function(){return Cc}});var s={};n.r(s),n.d(s,{downloadReport:function(){return Wc},getReport:function(){return xc},getReports:function(){return Gc},renderReport:function(){return Vc},scheduleReport:function(){return jc},sendReport:function(){return Bc}});var l={};n.r(l),n.d(l,{getNotifications:function(){return Kc},markAllAsRead:function(){return Hc},updateNotificationIsPinned:function(){return qc},updateNotificationStatus:function(){return zc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return Xc},getAudits:function(){return Yc},getAuditsStats:function(){return Qc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return yu},deleteEmailSubscriptions:function(){return uu},deleteSMSConfiguration:function(){return hu},deleteSMSSubscriptions:function(){return Su},deleteSlackConfiguration:function(){return au},deleteWebhooksConfiguration:function(){return Au},getCategories:function(){return Iu},getChannelMaps:function(){return Lu},getEmailConfiguration:function(){return su},getSMSConfiguration:function(){return fu},getSlackChannels:function(){return iu},getSlackConfiguration:function(){return tu},getSlackScope:function(){return nu},getWebhookLog:function(){return ku},getWebhooksConfigurations:function(){return mu},patchEmailConfiguration:function(){return cu},patchSMSConfiguration:function(){return pu},postEmailConfiguration:function(){return lu},postSMSConfiguration:function(){return gu},postSlackCode:function(){return ru},postSlackConfiguration:function(){return ou},postWebhookRetry:function(){return Pu},postWebhookTest:function(){return Tu},postWebhooksConfiguration:function(){return bu},putEmailSubscriptions:function(){return du},putSMSSubscriptions:function(){return vu}});var d={};n.r(d),n.d(d,{getPublicSettings:function(){return wu},getSettings:function(){return Ou},updateSettings:function(){return Eu}});var y={};n.r(y),n.d(y,{addRole:function(){return _u},attachPermissionToRoles:function(){return Gu},attachPermissionsToRole:function(){return Fu},deleteRole:function(){return Mu},getPermissionCategories:function(){return xu},getPermissions:function(){return $u},getRoles:function(){return Uu},updateRole:function(){return Nu}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return hd},ISubscriptionStatus:function(){return Sd},PaymentMethodType:function(){return vd},ProviderType:function(){return md},TenantCreatedAction:function(){return Ad},TrialEndAction:function(){return bd},cancelManagedSubscription:function(){return Hu},cancelSubscription:function(){return Wu},createStripeCustomer:function(){return ld},createStripePaymentMethodSetupIntentSecret:function(){return ud},createSubscription:function(){return rd},createTenantConfiguration:function(){return fd},getManagedSubscription:function(){return zu},getManagedSubscriptions:function(){return qu},getPaymentMethod:function(){return od},getPaymentMethods:function(){return id},getPaymentProviders:function(){return gd},getStripeCustomer:function(){return sd},getStripePaymentProviderConfiguration:function(){return cd},getSubscription:function(){return ju},getSubscriptionInvoice:function(){return ed},getSubscriptionInvoicePdf:function(){return td},getSubscriptionInvoices:function(){return Zu},getSubscriptionPlan:function(){return Xu},getSubscriptionPlans:function(){return Qu},getSubscriptionSummaries:function(){return dd},getSubscriptions:function(){return Vu},getTenantConfiguration:function(){return yd},getVendorPublicConfigurations:function(){return pd},renewManagedSubscription:function(){return Ju},renewSubscription:function(){return Bu},updateManagedSubscription:function(){return Yu},updatePaymentMethodBillingDetails:function(){return ad},updateSubscription:function(){return Ku}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return kd}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return Ld},addUserToTenantAndSubTenants:function(){return Pd},addUsersToSubTenant:function(){return Rd},createSubTenant:function(){return wd},deleteSubTenant:function(){return Cd},loadAllUsers:function(){return Td},removeUserFromTenantAndSubTenants:function(){return Id},removeUserRolesFromSubTenants:function(){return Ed},setUserRolesForSubTenants:function(){return Od},updateSubAccountAccess:function(){return Dd}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return _d},loadFeatureFlags:function(){return Md}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return xd},createConfiguration:function(){return $d},deleteConfiguration:function(){return Gd},getConfigs:function(){return Nd},updateConfiguration:function(){return Fd}});var h={};n.r(h),n.d(h,{impersonate:function(){return Vd}});var m={};n.r(m),n.d(m,{addRolesToGroup:function(){return Jd},addUsersToGroup:function(){return Qd},createGroup:function(){return zd},deleteGroup:function(){return Hd},deleteRolesFromGroup:function(){return Yd},deleteUsersFromGroup:function(){return Xd},getGroupById:function(){return Wd},getGroupConfiguration:function(){return Zd},getGroups:function(){return Bd},getGroupsByIds:function(){return Kd},updateGroup:function(){return qd},updateGroupConfiguration:function(){return ey}});var b={};n.r(b),n.d(b,{GetUserJwt:function(){return ty},getUsersV3:function(){return ny}});var A={};n.r(A),n.d(A,{loadEntitlements:function(){return iy}});var k={};n.r(k),n.d(k,{AuthStrategyEnum:function(){return xr},ContextHolder:function(){return da},FeatureFlags:function(){return _d},FronteggApiError:function(){return Sa},FronteggContext:function(){return ya},FronteggFrameworks:function(){return pa},GroupManagedByEnum:function(){return Sy},GroupRelations:function(){return py},ISubscriptionCancellationPolicy:function(){return hd},ISubscriptionStatus:function(){return Sd},MFAStrategyEnum:function(){return ry},MachineToMachineAuthStrategy:function(){return Vr},PaginationOrderEnum:function(){return hy},PaymentMethodType:function(){return vd},ProviderType:function(){return md},RequestSource:function(){return ga},RestrictionType:function(){return xn},ScimConnectionSource:function(){return gy},SecondaryAuthStrategy:function(){return oy},SocialLoginProviders:function(){return Gr},SortByEnum:function(){return vy},TenantType:function(){return ly},UserManagedByEnum:function(){return sy},WebAuthnDeviceType:function(){return ay},api:function(){return my},countConfigurationUsers:function(){return xd},createConfiguration:function(){return $d},default:function(){return by},deleteConfiguration:function(){return Gd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return cy},fronteggHeaders:function(){return fa},fronteggRefreshTokenUrl:function(){return uy},fronteggSilentRefreshTokenUrl:function(){return dy},fronteggTenantsUrl:function(){return fy},fronteggUsersUrl:function(){return yy},getConfigs:function(){return Nd},loadFeatureFlags:function(){return Md},updateConfiguration:function(){return Fd}});var T={};function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e){return I="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},I(e)}function L(e){var t=function(e,t){if("object"!==I(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==I(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===I(t)?t:String(t)}function E(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,L(i.key),i)}}function O(e,t,n){return t&&E(e.prototype,t),n&&E(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(T),n.d(T,{AccountDetailsPageTabs:function(){return jI},AccountPageFields:function(){return MI},DomainRestrictionsTabFields:function(){return VI},GeneralSettingsTabFields:function(){return GI},InviteUserModalFields:function(){return _I},IpRestrictionsTabFields:function(){return xI},Metadata:function(){return OI},PrivacyPageFields:function(){return UI},ProfilePageFields:function(){return RI},SecurityPageTabs:function(){return FI},SessionManagementTabFields:function(){return $I},SubscriptionsPageFields:function(){return NI},alpha:function(){return hI},fieldAppearance:function(){return WI},tabAppearance:function(){return BI}});var w=function(){function e(){P(this,e)}return O(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 C(){return C=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},C.apply(this,arguments)}function D(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 R(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){D(a,i,o,r,s,"next",e)}function s(e){D(a,i,o,r,s,"throw",e)}r(void 0)}))}}w._apps={};var U=n(841),_=n.n(U);function M(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 N(e){return!!e&&!!e[ke]}function F(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)===Te}(e)||Array.isArray(e)||!!e[Ae]||!!e.constructor[Ae]||W(e)||B(e))}function $(e,t,n){void 0===n&&(n=!1),0===G(e)?(n?Object.keys:Pe)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function G(e){var t=e[ke];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:W(e)?2:B(e)?3:0}function x(e,t){return 2===G(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function V(e,t,n){var i=G(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function j(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function W(e){return ve&&e instanceof Map}function B(e){return he&&e instanceof Set}function K(e){return e.o||e.t}function z(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Ie(e);delete t[ke];for(var n=Pe(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),J(e)||N(e)||!F(e)||(G(e)>1&&(e.set=e.add=e.clear=e.delete=H),Object.freeze(e),t&&$(e,(function(e,t){return q(t,!0)}),!0)),e}function H(){M(2)}function J(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Y(e){var t=Le[e];return t||M(18,e),t}function Q(){return pe}function X(e,t){t&&(Y("Patches"),e.u=[],e.s=[],e.v=t)}function Z(e){ee(e),e.p.forEach(ne),e.p=null}function ee(e){e===pe&&(pe=e.l)}function te(e){return pe={p:[],l:pe,h:e,m:!0,_:0}}function ne(e){var t=e[ke];0===t.i||1===t.i?t.j():t.O=!0}function ie(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||Y("ES5").S(t,e,i),i?(n[ke].P&&(Z(t),M(4)),F(e)&&(e=oe(t,e),t.l||re(t,e)),t.u&&Y("Patches").M(n[ke].t,e,t.u,t.s)):e=oe(t,n,[]),Z(t),t.u&&t.v(t.u,t.s),e!==be?e:void 0}function oe(e,t,n){if(J(t))return t;var i=t[ke];if(!i)return $(t,(function(o,a){return ae(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return re(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=z(i.k):i.o;$(3===i.i?new Set(o):o,(function(t,a){return ae(e,i,o,t,a,n)})),re(e,o,!1),n&&e.u&&Y("Patches").R(i,n,e.u,e.s)}return i.o}function ae(e,t,n,i,o,a){if(N(o)){var r=oe(e,o,a&&t&&3!==t.i&&!x(t.D,i)?a.concat(i):void 0);if(V(n,i,r),!N(r))return;e.m=!1}if(F(o)&&!J(o)){if(!e.h.F&&e._<1)return;oe(e,o),t&&t.A.l||re(e,o)}}function re(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&q(t,n)}function se(e,t){var n=e[ke];return(n?K(n):e)[t]}function le(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 ce(e){e.P||(e.P=!0,e.l&&ce(e.l))}function ue(e){e.o||(e.o=z(e.t))}function de(e,t,n){var i=W(t)?Y("MapSet").N(t,n):B(t)?Y("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:Q(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Ee;n&&(o=[i],a=Oe);var r=Proxy.revocable(o,a),s=r.revoke,l=r.proxy;return i.k=l,i.j=s,l}(t,n):Y("ES5").J(t,n);return(n?n.A:Q()).p.push(i),i}function ye(e){return N(e)||M(22,e),function e(t){if(!F(t))return t;var n,i=t[ke],o=G(t);if(i){if(!i.P&&(i.i<4||!Y("ES5").K(i)))return i.t;i.I=!0,n=fe(t,o),i.I=!1}else n=fe(t,o);return $(n,(function(t,o){i&&function(e,t){return 2===G(e)?e.get(t):e[t]}(i.t,t)===o||V(n,t,e(o))})),3===o?new Set(n):n}(e)}function fe(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return z(e)}var ge,pe,Se="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ve="undefined"!=typeof Map,he="undefined"!=typeof Set,me="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,be=Se?Symbol.for("immer-nothing"):((ge={})["immer-nothing"]=!0,ge),Ae=Se?Symbol.for("immer-draftable"):"__$immer_draftable",ke=Se?Symbol.for("immer-state"):"__$immer_state",Te=("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,Ie=Object.getOwnPropertyDescriptors||function(e){var t={};return Pe(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Le={},Ee={get:function(e,t){if(t===ke)return e;var n=K(e);if(!x(n,t))return function(e,t,n){var i,o=le(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||!F(i)?i:i===se(e.t,t)?(ue(e),e.o[t]=de(e.A.h,i,e)):i},has:function(e,t){return t in K(e)},ownKeys:function(e){return Reflect.ownKeys(K(e))},set:function(e,t,n){var i=le(K(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=se(K(e),t),a=null==o?void 0:o[ke];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(j(n,o)&&(void 0!==n||x(e.t,t)))return!0;ue(e),ce(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!==se(e.t,t)||t in e.t?(e.D[t]=!1,ue(e),ce(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=K(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(){M(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){M(12)}},Oe={};$(Ee,(function(e,t){Oe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Oe.deleteProperty=function(e,t){return Oe.set.call(this,e,t,void 0)},Oe.set=function(e,t,n){return Ee.set.call(this,e[0],t,n,e[0])};var we=function(){function e(e){var t=this;this.g=me,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&&M(6),void 0!==i&&"function"!=typeof i&&M(7),F(e)){var s=te(t),l=de(t,e,void 0),c=!0;try{r=n(l),c=!1}finally{c?Z(s):ee(s)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return X(s,i),ie(e,s)}),(function(e){throw Z(s),e})):(X(s,i),ie(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===be&&(r=void 0),t.F&&q(r,!0),i){var u=[],d=[];Y("Patches").M(e,r,u,d),i(u,d)}return r}M(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){F(e)||M(8),N(e)&&(e=ye(e));var t=te(this),n=de(this,e,void 0);return n[ke].C=!0,ee(t),n},t.finishDraft=function(e,t){var n=(e&&e[ke]).A;return X(n,t),ie(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!me&&M(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=Y("Patches").$;return N(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Ce=new we,De=Ce.produce,Re=(Ce.produceWithPatches.bind(Ce),Ce.setAutoFreeze.bind(Ce),Ce.setUseProxies.bind(Ce),Ce.applyPatches.bind(Ce),Ce.createDraft.bind(Ce),Ce.finishDraft.bind(Ce),De);function Ue(e,t,n){return(t=L(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _e(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 Me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(n),!0).forEach((function(t){Ue(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ne(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 Fe="function"==typeof Symbol&&Symbol.observable||"@@observable",$e=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ge={INIT:"@@redux/INIT"+$e(),REPLACE:"@@redux/REPLACE"+$e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+$e()}};function xe(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 Ve(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ne(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ne(1));return n(Ve)(e,t)}if("function"!=typeof e)throw new Error(Ne(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(Ne(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ne(4));if(l)throw new Error(Ne(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(Ne(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!xe(e))throw new Error(Ne(7));if(void 0===e.type)throw new Error(Ne(8));if(l)throw new Error(Ne(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(Ne(10));o=e,y({type:Ge.REPLACE})}function g(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ne(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Fe]=function(){return this},e}return y({type:Ge.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Fe]=g,i}function je(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:Ge.INIT}))throw new Error(Ne(12));if(void 0===n(void 0,{type:Ge.PROBE_UNKNOWN_ACTION()}))throw new Error(Ne(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(Ne(14));o[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function We(){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 Be(){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(Ne(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=We.apply(void 0,a)(n.dispatch),Me(Me({},n),{},{dispatch:i})}}}function Ke(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 ze=Ke();ze.withExtraArgument=Ke;var qe,He=ze,Je=(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)}),Ye=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},Qe=Object.defineProperty,Xe=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Ze=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable,tt=function(e,t,n){return t in e?Qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},nt=function(e,t){for(var n in t||(t={}))Ze.call(t,n)&&tt(e,n,t[n]);if(Xe)for(var i=0,o=Xe(t);i<o.length;i++)n=o[i],et.call(t,n)&&tt(e,n,t[n]);return e},it="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?We:We.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var ot=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 Je(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,Ye([void 0],e[0].concat(this)))):new(t.bind.apply(t,Ye([void 0],e.concat(this))))},t}(Array);function at(e){return F(e)?Re(e,(function(){})):e}function rt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new ot);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(He):i.push(He.withExtraArgument(n.extraArgument))),i}function st(e){var t,n=function(e){return rt(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=je(a)}var g=s;"function"==typeof g&&(g=g(n));var p=Be.apply(void 0,g),S=We;c&&(S=it(nt({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(f)?v=Ye([p],f):"function"==typeof f&&(v=f(v)),Ve(t,d,S.apply(void 0,v))}function lt(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 nt(nt({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 ct(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 ut(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:at(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?ct(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=nt(nt({},o),s);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?ct(t):[t,n,i],r=a[0],s=a[1],l=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return at(e())};else{var c=at(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Ye([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(N(e))return void 0===(i=n(e,t))?e:i;if(F(e))return Re(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?lt(c,i):lt(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 dt="listenerMiddleware";lt(dt+"/add"),lt(dt+"/removeAll"),lt(dt+"/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[ke];return Ee.get(t,e)},set:function(t){var n=this[ke];Ee.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ke];if(!o.P)switch(o.i){case 5:i(o)&&ce(o);break;case 4:n(o)&&ce(o)}}}function n(e){for(var t=e.t,n=e.k,i=Pe(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==ke){var r=t[a];if(void 0===r&&!x(t,a))return!0;var s=n[a],l=s&&s[ke];if(l?l.t!==r:!j(s,r))return!0}}var c=!!t[ke];return i.length!==Pe(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){Le[e]||(Le[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=Ie(n);delete a[ke];for(var r=Pe(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:Q(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ke,{value:a,writable:!0}),o},S:function(e,n,o){o?N(n)&&n[ke].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ke];if(n){var o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)$(a,(function(t){t!==ke&&(void 0!==o[t]||x(o,t)?r[t]||e(a[t]):(r[t]=!0,ce(n)))})),$(o,(function(e){void 0!==a[e]||x(a,e)||(r[e]=!1,ce(n))}));else if(5===s){if(i(n)&&(ce(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 yt=(e,t)=>n=>C({},n,{[e]:t[e]}),ft=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),gt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return C({},n,{[e]:C({},n[e],{[t]:C({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),pt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return C({},t,{[e]:C({},t[e],{loaders:C({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),St=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return C({},t,{[e]:C({},t[e],{errors:C({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),vt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:o})=>{var a;return C({},i,{[e]:C({},i[e],{[t]:C({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),ht=(e,t,n)=>i=>{var o;return C({},i,{[e]:C({},i[e],{[t]:C({},null==i||null==(o=i[e])?void 0:o[t],n)})})},mt=(e=500)=>new Promise((t=>setTimeout(t,e))),bt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",At=new Uint8Array(256);for(let e=0;e<bt.length;e++)At[bt.charCodeAt(e)]=e;const kt=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=At[e.charCodeAt(i)],a=At[e.charCodeAt(i+1)],r=At[e.charCodeAt(i+2)],s=At[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},Tt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(Tt(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+=bt[t[i]>>2],o+=bt[(3&t[i])<<4|t[i+1]>>4],o+=bt[(15&t[i+1])<<2|t[i+2]>>6],o+=bt[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]=Tt(e[n]);return t}return e};let Pt,It,Lt;!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"}(Pt||(Pt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(It||(It={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Lt||(Lt={}));const Et="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Ot="HOSTED_LOGIN_VERIFIER_KEY",wt="auth",Ct="connectivity",Dt="auditLogs",Rt="vendor",Ut={flow:It.Login,step:Pt.preLogin,loading:!1,email:"",tenants:[]},_t={setLoginState:ft("loginState"),resetLoginState:yt("loginState",{loginState:Ut})},Mt={requestAuthorize:lt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:lt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:lt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:lt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:lt("auth/afterAuthNavigation"),preLogin:lt("auth/preLogin",(e=>({payload:e}))),postLogin:lt("auth/postLogin",(e=>({payload:e}))),login:lt("auth/login",(e=>({payload:e}))),loginWithMfa:lt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:lt("auth/recoverMfa",(e=>({payload:e}))),logout:lt("auth/logout",(e=>({payload:e}))),silentLogout:lt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:lt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:lt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:lt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:lt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:lt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:lt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:lt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:lt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:lt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:lt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:lt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:lt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:lt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:lt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:lt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:lt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:lt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:lt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:lt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:lt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:lt("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Nt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Nt||(Nt={}));const Ft={step:Nt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},$t={setActivateState:ft("activateState"),resetActivateState:yt("activateState",{activateState:Ft}),setActivateStrategyState:gt("activateState","activationStrategy")},Gt={activateAccount:lt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:lt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:lt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:lt("auth/resendActivationEmail",(e=>({payload:e})))};let xt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(xt||(xt={}));const Vt={step:xt.validate},jt={setAcceptInvitationState:ft("acceptInvitationState"),resetAcceptInvitationState:yt("acceptInvitationState",{acceptInvitationState:Vt})},Wt={acceptInvitation:lt("auth/acceptInvitation",(e=>({payload:e})))};let Bt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Bt||(Bt={}));const Kt={step:Bt.forgotPassword,loading:!1,email:"",passwordConfig:null},zt={setForgotPasswordState:ft("forgotPasswordState"),resetForgotPasswordState:yt("forgotPasswordState",{forgotPasswordState:Kt})},qt={forgotPassword:lt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:lt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:lt("auth/loadPasswordConfig",(e=>({payload:e})))};let Ht;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Ht||(Ht={}));const Jt={step:Ht.ResetPhoneNumber,loading:!1},Yt={setResetPhoneNumberState:ft("resetPhoneNumberState"),resetResetPhoneNumberState:yt("resetPhoneNumberState",{resetPhoneNumberState:Jt})},Qt={resetPhoneNumber:lt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:lt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:lt("auth/changePhoneNumber",(e=>({payload:e})))},Xt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Zt={setSSOLoader:pt("ssoState"),setSSOError:St("ssoState"),setSSOState:ft("ssoState"),resetSSOState:yt("ssoState",{ssoState:Xt})},en={loadSSOConfigurationsV2:lt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:lt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:lt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:lt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:lt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:lt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:lt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:lt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:lt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:lt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:lt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:lt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:lt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:lt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:lt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:lt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:lt("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:lt("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:lt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:lt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:lt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:lt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:lt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:lt("auth/oidcPostlogin",(e=>({payload:e})))},tn={loading:!1,error:null},nn={setProfileState:ft("profileState"),resetProfileState:yt("profileState",{profileState:tn})},on={loadProfile:lt("auth/loadProfile"),saveProfile:lt("auth/saveProfile",(e=>({payload:e}))),changePassword:lt("auth/changePassword",(e=>({payload:e})))};let an;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(an||(an={}));const rn={step:an.verify,loading:!1,saving:!1},sn={setMfaState:ft("mfaState"),resetMfaState:yt("mfaState",{mfaState:rn})},ln={enrollMfa:lt("auth/enrollMfa"),getMFADevices:lt("auth/getMFADevices"),getMFAStrategies:lt("auth/getMFAStrategies"),verifyMfa:lt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:lt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:lt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:lt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:lt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:lt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:lt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:lt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:lt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:lt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:lt("auth/disableMfaWebAuthn",(e=>({payload:e})))},cn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},un={setTeamLoader:pt("teamState"),setTeamError:St("teamState"),setTeamState:ft("teamState"),resetTeamState:yt("teamState",{teamState:cn})},dn={loadUsers:lt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:lt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:lt("auth/loadRoles",(e=>({payload:e}))),addUser:lt("auth/addUser",(e=>({payload:e}))),addUsersBulk:lt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:lt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:lt("auth/updateUser",(e=>({payload:e}))),deleteUser:lt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:lt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:lt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:lt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:lt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:lt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:lt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:lt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:lt("auth/getInvitationLink"),createInvitationLink:lt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:lt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:lt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:lt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:lt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:lt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:lt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:lt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:lt("auth/closeLockUserDialog",(e=>({payload:e})))},yn={firstLoad:!0,loading:!1,error:""},fn={setSocialLoginsState:ft("socialLoginState"),resetSocialLoginsState:yt("socialLoginState",{socialLoginState:yn})},gn={loadSocialLoginsConfiguration:lt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:lt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:lt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:lt("auth/setSocialLoginError",(e=>({payload:e})))};let pn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(pn||(pn={}));const Sn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:pn.SignUp},vn={setSignUpState:ft("signUpState"),resetSignUpState:yt("signUpState",{signUpState:Sn})},hn={signUpUser:lt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:lt("auth/resetSignUpStateSoft")},mn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},bn={setApiTokensLoader:pt("apiTokensState"),setApiTokensError:St("apiTokensState"),setApiTokensState:ft("apiTokensState"),resetApiTokensState:yt("apiTokensState",{apiTokensState:mn})},An={loadApiTokens:lt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:lt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:lt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:lt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:lt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:lt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:lt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:lt("auth/deleteTenantApiToken",(e=>({payload:e})))},kn={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}},Tn={setSecurityPolicyState:ft("securityPolicyState"),setSecurityPolicyGlobalState:gt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:gt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:gt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:gt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:gt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:gt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:gt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:gt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:gt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:gt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:gt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:yt("securityPolicyState",{securityPolicyState:kn})},Pn={loadSecurityPolicy:lt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:lt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:lt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:lt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:lt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:lt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:lt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:lt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:lt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:lt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:lt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:lt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:lt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:lt("auth/loadPublicAuthStrategiesPolicy")},In={loading:!1},Ln={setAccountSettingsState:ft("accountSettingsState"),resetAccountSettingsState:yt("accountSettingsState",{accountSettingsState:In})},En={loadAccountSettings:lt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:lt("auth/saveAccountSettings",(e=>({payload:e})))},On={tenants:[],subTenants:[],loading:!0,tenantTree:null},wn={setTenantsState:ft("tenantsState"),resetTenantsState:yt("tenantsState",{tenantsState:On})},Cn={switchTenant:lt("auth/switchTenant",(e=>({payload:e}))),loadTenants:lt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:lt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:lt("auth/loadSubTenantsTree",(e=>({payload:e})))},Dn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Rn={setRolesState:ft("rolesState"),resetRolesState:yt("rolesState",{rolesState:Dn})},Un={loadRolesAndPermissions:lt("auth/loadRoles",(e=>({payload:e}))),addRole:lt("auth/addRole",(e=>({payload:e}))),updateRole:lt("auth/updateRole",(e=>({payload:e}))),deleteRole:lt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:lt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:lt("auth/attachPermissionToRoles",(e=>({payload:e})))},_n={loading:!1,sessions:[]},Mn={setSessionsState:ft("sessionsState"),resetSessionsState:yt("sessionsState",{sessionsState:_n})},Nn={loadUserSessions:lt("auth/loadUserSessions"),loadCurrentUserSession:lt("auth/loadCurrentUserSession"),deleteUserSession:lt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:lt("auth/deleteAllUserSessions"),revokeUserSessions:lt("auth/revokeUserSessions",(e=>({payload:e})))},Fn={loading:!1,configurations:{}},$n={setSessionsPolicyState:ft("sessionsPolicyState"),resetSessionsPolicyState:yt("sessionsPolicyState",{sessionsPolicyState:Fn})},Gn={loadSessionsPolicy:lt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:lt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let xn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(xn||(xn={}));const Vn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:xn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},jn={setRestrictionsState:ft("restrictionsState"),setIpRestrictionsState:gt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:gt("restrictionsState","emailDomainRestrictions")},Wn={checkIfUserIpValid:lt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:lt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:lt("auth/loadIpRestrictions"),saveIpRestriction:lt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:lt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:lt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:lt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:lt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:lt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:lt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Bn={loading:!1},Kn={setProvisioningState:ft("provisioningState"),resetProvisioningState:yt("provisioningState",{provisioningState:Bn})},zn={loadProvisionConnections:lt("auth/loadProvisionConnections"),createProvisionConnection:lt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:lt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:lt("auth/updateProvisionConnection",(e=>({payload:e})))},qn={devices:[],loading:!1,error:null},Hn={setPasskeysState:ft("passkeysState"),resetPasskeysState:yt("passkeysState",{passkeysState:qn})},Jn={loadWebAuthnDevices:lt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:lt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Yn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Qn={setUsersGroupsLoader:pt("groupsState"),setUsersGroupsError:St("groupsState"),setGroupsState:ft("groupsState"),resetUsersGroupsState:yt("groupsState",{groupsState:Yn})},Xn={loadGroups:lt("auth/loadUsersGroups"),getGroupById:lt("auth/getGroupById",(e=>({payload:e}))),createGroup:lt("auth/createGroup",(e=>({payload:e}))),updateGroup:lt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:lt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:lt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:lt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:lt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:lt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:lt("auth/getGroupConfiguration"),updateGroupConfiguration:lt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:lt("auth/getUsers",(e=>({payload:e})))},Zn={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}},ei={setGroupsDialogsState:ft("groupsDialogsState"),resetGroupsDialogsState:yt("groupsState",{groupsDialogsState:Zn}),openAddGroupDialog:ht("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:ht("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:vt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:ht("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:vt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:ht("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:ht("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:ht("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:vt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:ht("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},ti={loading:!0,error:null},ni={setCustomLoginState:ft("customLoginState"),resetCustomLoginState:yt("customLoginState",{customLoginState:ti})},ii={loadTenantMetadata:lt("auth/loadTenantMetadata"),updateTenantMetadata:lt("auth/updateTenantMetadata",(e=>({payload:e})))},oi={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:Sn,loginState:Ut,activateState:Ft,acceptInvitationState:Vt,forgotPasswordState:Kt,ssoState:Xt,profileState:tn,customLoginState:ti,mfaState:rn,teamState:cn,groupsState:Yn,groupsDialogsState:Zn,socialLoginState:yn,apiTokensState:mn,securityPolicyState:kn,accountSettingsState:In,tenantsState:On,rolesState:Dn,resetPhoneNumberState:Jt,sessionsState:_n,sessionsPolicyState:Fn,restrictionsState:Vn,provisioningState:Bn,passkeysState:qn},ai=C({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:()=>{}},oi);let ri;!function(e){e.impersonating="impersonating",e.success="success"}(ri||(ri={}));const si={step:ri.impersonating,loading:!1},li={setImpersonateState:ft("impersonateState"),resetImpersonateState:yt("impersonateState",{impersonateState:si})},ci={impersonate:lt("impersonation/impersonate",(e=>({payload:e})))},{reducer:ui,actions:di}=ut({name:wt,initialState:ai,reducers:C({resetState:e=>C({},e,oi),setState:(e,{payload:t})=>C({},e,t),setUser:("user",(e,{payload:t})=>C({},e,{user:t}))},_t,fn,$t,li,jt,zt,Yt,vn,nn,ni,Zt,sn,un,Qn,ei,bn,Tn,Ln,wn,Rn,Mn,$n,jn,Kn,Hn)});const yi=C({},di,Mt,gn,Gt,Wt,qt,Qt,hn,on,ii,en,ln,dn,Xn,{},An,Pn,En,Cn,Un,Nn,Gn,Wn,zn,ci,Jn);var fi=function(e){return"@@redux-saga/"+e},gi=fi("CANCEL_PROMISE"),pi=fi("CHANNEL_END"),Si=fi("IO"),vi=fi("MATCH"),hi=fi("MULTICAST"),mi=fi("SAGA_ACTION"),bi=fi("SELF_CANCELLATION"),Ai=fi("TASK"),ki=fi("TASK_CANCEL"),Ti=fi("TERMINATE"),Pi=fi("LOCATION");function Ii(e,t){if(null==e)return{};var n,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var Li=function(e){return null==e},Ei=function(e){return null!=e},Oi=function(e){return"function"==typeof e},wi=function(e){return"string"==typeof e},Ci=Array.isArray,Di=function(e){return e&&Oi(e.then)},Ri=function(e){return e&&Oi(e.next)&&Oi(e.throw)},Ui=function e(t){return t&&(wi(t)||Ni(t)||Oi(t)||Ci(t)&&t.every(e))},_i=function(e){return e&&Oi(e.take)&&Oi(e.close)},Mi=function(e){return Oi(e)&&e.hasOwnProperty("toString")},Ni=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Fi=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[gi]=function(){clearTimeout(n)},i},$i=function(e){return function(){return e}},Gi=$i(!0),xi=function(){},Vi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var ji=function(e,t){C(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Wi(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Bi=function(e){throw e},Ki=function(e){return{value:e,done:!0}};function zi(e,t,n){void 0===t&&(t=Bi),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:Ki,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function qi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Hi=function(e){return Array.apply(null,new Array(e))},Ji=function(e){return function(t){return e(Object.defineProperty(t,mi,{value:!0}))}},Yi=function(e){return e===Ti},Qi=function(e){return e===ki},Xi=function(e){return Yi(e)||Qi(e)};function Zi(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=Ci(e)?Hi(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||Xi(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=xi,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function eo(e){return{name:e.name||"anonymous",location:to(e)}}function to(e){return e[Pi]}var no=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)},io="TAKE",oo="CALL",ao="FORK",ro="SELECT",so=function(e,t){var n;return(n={})[Si]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function lo(e,t){return void 0===e&&(e="*"),Ui(e)?(Ei(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),so(io,{pattern:e})):_i(n=e)&&n[hi]&&Ei(t)&&Ui(t)?so(io,{channel:e,pattern:t}):_i(e)?(Ei(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),so(io,{channel:e})):void 0;var n}function co(e,t){return Li(t)&&(t=e,e=void 0),so("PUT",{channel:e,action:t})}function uo(e){var t=so("ALL",e);return t.combinator=!0,t}function yo(e,t){var n,i=null;return Oi(e)?n=e:(Ci(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&wi(n)&&Oi(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function fo(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 so(oo,yo(e,n))}function go(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 so(ao,yo(e,n))}function po(e){return void 0===e&&(e=bi),so("CANCEL",e)}function So(e){void 0===e&&(e=Vi);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return so(ro,{selector:e,args:n})}var vo=fo.bind(null,Fi);var ho=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},mo=[],bo=0;function Ao(e){try{Po(),e()}finally{Io()}}function ko(e){mo.push(e),bo||(Po(),Lo())}function To(e){try{return Po(),e()}finally{Lo()}}function Po(){bo++}function Io(){bo--}function Lo(){var e;for(Io();!bo&&void 0!==(e=mo.shift());)Ao(e)}var Eo=function(e){return function(t){return e.some((function(e){return Ro(e)(t)}))}},Oo=function(e){return function(t){return e(t)}},wo=function(e){return function(t){return t.type===String(e)}},Co=function(e){return function(t){return t.type===e}},Do=function(){return Gi};function Ro(e){var t="*"===e?Do:wi(e)?wo:Ci(e)?Eo:Mi(e)?wo:Oi(e)?Oo:Ni(e)?Co:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Uo={type:pi},_o=function(e){return e&&e.type===pi};function Mo(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(Uo)}))},(e={})[hi]=!0,e.put=function(e){if(!t)if(_o(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[vi](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=Do),t?e(Uo):(e[vi]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Wi(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[mi]?s(e):ko((function(){s(e)}))},r}function No(e,t){var n=e[gi];Oi(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Fo,$o=0,Go=function(){return++$o};function xo(e){e.isRunning()&&e.cancel()}var Vo=((Fo={}).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):!_o(e)||r?n(e):n(Ti)};try{o.take(s,Ei(a)?Ro(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},Fo.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;ko((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&Di(t)?No(t,n):n(t)}))},Fo.ALL=function(e,t,n,i){var o=i.digestEffect,a=$o,r=Object.keys(t);if(0!==r.length){var s=Zi(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(Ci(t)?[]:{})},Fo.RACE=function(e,t,n,i){var o=i.digestEffect,a=$o,r=Object.keys(t),s=Ci(t)?Hi(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Xi(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=xi,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)}))},Fo.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(Di(l))return void No(l,n);if(Ri(l))return void Qo(e,l,s.context,$o,eo(a),!1,n);n(l)}catch(e){n(e,!0)}},Fo.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){Li(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Fo.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(Ri(o))return o;var a=!1;return zi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!Di(o)})}))}catch(e){return zi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:eo(t)}(c,a);To((function(){var t=Qo(e,c,l.context,$o,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},Fo.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()&&Wi(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Ci(t)){if(0===t.length)return void n([]);var r=Zi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Fo.CANCEL=function(e,t,n,i){var o=i.task;t===bi?xo(o):Ci(t)?t.forEach(xo):xo(t),n()},Fo.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)}},Fo.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=no());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(Uo):e.isEmpty()?(n.push(i),i.cancel=function(){Wi(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(Uo):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(Uo)}}}}(t.buffer),a=Ro(i),r=function t(n){_o(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)},Fo.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},Fo.FLUSH=function(e,t,n){t.flush(n)},Fo.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},Fo.SET_CONTEXT=function(e,t,n,i){var o=i.task;ji(o.context,t),n()},Fo);function jo(e,t){return e+"?"+t}function Wo(e){var t=e.name,n=e.location;return n?t+" "+jo(n.fileName,n.lineNumber):t}function Bo(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 Ko=null,zo=[],qo=function(e){e.crashedEffect=Ko,zo.push(e)},Ho=function(){Ko=null,zo.length=0},Jo=function(){var e,t,n=zo[0],i=zo.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=to(e))?t.code+" "+jo(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Wo(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+Wo(e.meta)})),[Bo(zo)]).join("\n")};function Yo(e,t,n,i,o,a,r){var s;void 0===r&&(r=xi);var l,c,u=0,d=null,y=[],f=Object.create(n),g=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,g.getTasks().map((function(e){return e.meta.name}))),l(),n(e,!0)}function s(t){o.push(t),t.cont=function(s,l){a||(Wi(o,t),t.cont=xi,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=xi,e.cancel()})),o=[])}return s(e),{addTask:s,cancelAll:l,abort:r,getTasks:function(){return o}}}(t,0,p);function p(t,n){if(n){if(u=2,qo({meta:o,cancelledTasks:y}),S.isRoot){var i=Jo();Ho(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===ki?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={})[Ai]=!0,s.id=i,s.meta=o,s.isRoot=a,s.context=f,s.joiners=[],s.queue=g,s.cancel=function(){0===u&&(u=1,g.cancelAll(),p(ki,!1))},s.cont=r,s.end=p,s.setContext=function(e){ji(f,e)},s.toPromise=function(){return d||(d=ho(),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 Qo(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){Di(t)?No(t,i):Ri(t)?Qo(e,t,c.context,n,o,!1,i):t&&t[Si]?(0,Vo[t.type])(e,t.payload,i,u):i(t)}));d.cancel=xi;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(ki))},status:0},c=Yo(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),Ho()):Qi(e)?(l.status=1,d.cancel(),o=Oi(t.return)?t.return(ki):{done:!0,value:ki}):o=Yi(e)?Oi(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=Go();function l(n,o){a||(a=!0,i.cancel=xi,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){Ko=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=xi,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=xi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function Xo(e,t){for(var n=e.channel,i=void 0===n?Mo():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?qi:u,y=arguments.length,f=new Array(y>2?y-2:0),g=2;g<y;g++)f[g-2]=arguments[g];var p,S=t.apply(void 0,f),v=Go();if(l&&(l.rootSagaStarted=l.rootSagaStarted||xi,l.effectTriggered=l.effectTriggered||xi,l.effectResolved=l.effectResolved||xi,l.effectRejected=l.effectRejected||xi,l.effectCancelled=l.effectCancelled||xi,l.actionDispatched=l.actionDispatched||xi,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=We.apply(void 0,c);p=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else p=Vi;var m={channel:i,dispatch:Ji(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:p};return To((function(){var e=Qo(m,S,s,v,eo(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var Zo=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?Mo():a,s=n.sagaMonitor,l=Ii(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Xo.bind(null,C({},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){ji(o,e)},c},ea=function(e){return{done:!0,value:e}},ta={};function na(e){return _i(e)?"channel":Mi(e)?String(e):Oi(e)?e.name:String(e)}function ia(e,t,n){var i,o,a,r=t;function s(t,n){if(r===ta)return ea(t);if(n&&!o)throw r=ta,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===ta?ea(t):a}return zi(s,(function(e){return s(null,e)}),n)}function oa(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:lo(e)},s=function(e){return{done:!1,value:go.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return ia({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+na(e)+", "+t.name+")")}function aa(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:lo(e)},l=function(e){return{done:!1,value:go.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:po(e)}},u=function(e){return a=e},d=function(e){return r=e};return ia({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("+na(e)+", "+t.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];var a,r={done:!1,value:lo(e)},s=function(e){return{done:!1,value:fo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return ia({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+na(e)+", "+t.name+")")}function sa(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:fo.apply(void 0,[n].concat(a))},l={done:!1,value:vo(t)};return ia({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:ta}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function la(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 go.apply(void 0,[oa,e,t].concat(i))}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];return go.apply(void 0,[aa,e,t].concat(i))}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];return go.apply(void 0,[ra,e,t].concat(i))}class da{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"}static getInstance(){return da.instance||(da.instance=new da),da.instance}static setContext(e){da.getInstance().context=e}static setAccessToken(e){da.getInstance().accessToken=e}static setUser(e){da.getInstance().user=e}static setRequestSource(e){da.getInstance().requestSource=e}static setOnRedirectTo(e){da.getInstance().onRedirectTo=e}static setLogout(e,t){da.getInstance().logout=n=>{n?e(n):da.onRedirectTo(t)}}static getContext(){var e;return null!=(e=da.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return da.getInstance().accessToken}static getRequestSource(){return da.getInstance().requestSource}static getUser(){return da.getInstance().user}static onRedirectTo(e,t){return da.getInstance().onRedirectTo(e,t)}static logout(e){return da.getInstance().logout(e)}}da.instance=void 0;const ya={getContext:()=>da.getContext(),getAccessToken:()=>da.getAccessToken(),getUser:()=>da.getUser(),onRedirectTo:(e,t)=>da.onRedirectTo(e,t),logout:e=>da.logout(e)},fa={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let ga,pa;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ga||(ga={})),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"}(pa||(pa={}));class Sa extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function va(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 ha(e){var t,n;const i={};return null!=e&&null!=(t=e.metaDataHeaders)&&t.fronteggSdkVersion&&(i[fa.fronteggSdkVersion]=e.metaDataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metaDataHeaders)&&n.framework&&(i[fa.frameWork]=e.metaDataHeaders.framework),i}const ma=async e=>{var t,n,i;const o=da.getContext(),a=await async function(e,t){var n;const i=ha(e),o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:da.getAccessToken)(),a=da.getRequestSource();t&&(i[fa.contentType]=t),a&&(i[fa.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=va(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:C({},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 Sa("Error request is too large",s.status);let e;try{e=await s.text(),e=JSON.parse(e)}catch(e){}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 Sa(e,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{}}},ba=async(e,t,n)=>ma(C({url:e,method:"GET",contentType:"application/json",params:t},n)),Aa=async(e,t,n)=>ma(C({url:e,method:"POST",contentType:"application/json",body:t},n)),ka=async(e,t,n)=>ma(C({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Ta=async(e,t,n)=>ma(C({url:e,method:"PUT",contentType:"application/json",body:t},n)),Pa=async(e,t,n)=>ma(C({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Ia=async(e,t,n,i)=>ma(C({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),La=(e={})=>C({},e.jwt?{Authorization:e.jwt}:{}),Ea={v1:"/identity/resources/users/webauthn/v1/devices"},Oa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},wa={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",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"}}},Ca={v1:"/identity/resources/configurations/v1"},Da={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Ra={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ua={v1:"/identity/resources/permissions/v1"},_a={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"}},Ma={v1:"/identity/resources/roles/v1"},Na={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Fa={v1:"/identity/resources/impersonation/v1"},$a={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Ga={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},xa={v1:"/team/resources/members/v1"},Va={v1:"/team/resources/roles/v1"},ja={v1:"/team/resources/stats/v1"},Wa={v1:"/team/resources/profile"},Ba={v1:"/tenants/resources/account-settings/v1"},Ka={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"}},za={v1:"/tenants/resources/sub-tenants/v1"},qa={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Ha={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"}}}},Ja={v1:"/subscriptions/resources/payment-providers/v1"},Ya={v1:"/subscriptions/resources/subscriptions/v1"},Qa={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Xa={v1:"/reports/engine/resources/triggers/v1"},Za="/notification",er="/audits",tr={v1:"/event/resources/configurations/v1"},nr="/webhook",ir="/oauth",or="/flags",ar="/directory/resources/v1/configurations/scim2",rr="/directory/resources/scim/temp",sr="/entitlements";async function lr(e){return Ta(`${wa.v1}/tenant`,e)}async function cr(){return ba(`${wa.v2}/me/tenants`)}async function ur(e){return ba(Ka.v1,void 0,{headers:La(e)})}async function dr(e){return ba(Ka.tree.v1,void 0,{headers:La(e)})}async function yr(e){return ba(Ka.parents.v1,void 0,{headers:La(e)})}async function fr(e,t){return Aa(`${_a.users.v1}/count`,e,{headers:La(t)})}async function gr(){return ba(Ca.v1)}async function pr(){return ba(`${Ca.v1}/mfa-policy`)}async function Sr(){return ba(`${Ca.v1}/mfa-policy/vendor`)}async function vr(e){return e.id?ka(`${Ca.v1}/mfa-policy`,e):Aa(`${Ca.v1}/mfa-policy`,e)}async function hr(){return ba(`${Ca.v1}/lockout-policy`)}async function mr(){return ba(`${Ca.v1}/lockout-policy/vendor`)}async function br(e){return e.id?ka(`${Ca.v1}/lockout-policy`,e):Aa(`${Ca.v1}/lockout-policy`,e)}async function Ar(){try{return await ba(`${Ca.v1}/captcha-policy/public`)}catch{return null}}async function kr(){return ba(`${Ca.v1}/password-history-policy`)}async function Tr(){return ba(`${Ca.v1}/password-history-policy/vendor`)}async function Pr(e){return e.id?ka(`${Ca.v1}/password-history-policy`,e):Aa(`${Ca.v1}/password-history-policy`,e)}async function Ir(){return ba(`${Ca.v1}/password`)}async function Lr(){return ba(`${Da.emailDomain.v1}`)}async function Er(){return ba(`${Da.emailDomain.v1}/config`)}async function Or(e){return Aa(`${Da.emailDomain.v1}`,e)}async function wr(e){return Aa(`${Da.emailDomain.v1}/config`,e)}async function Cr(e){return Pa(`${Da.emailDomain.v1}/${e}`)}async function Dr(e){return ba(`${Da.ip.v1}`,e)}async function Rr(){return ba(`${Da.ip.v1}/config`)}async function Ur(e){return Aa(`${Da.ip.v1}`,e)}async function _r(e){return Aa(`${Da.ip.v1}/bulk`,e)}async function Mr(e){return Aa(`${Da.ip.v1}/config`,e)}async function Nr(e){return Pa(`${Da.ip.v1}/${e}`)}async function Fr(){return Aa(`${Da.ip.v1}/verify`)}async function $r(){return Aa(`${Da.ip.v1}/verify/allow`)}let Gr,xr,Vr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Gr||(Gr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(xr||(xr={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Vr||(Vr={}));class jr extends Error{constructor(e){super(e)}}const Wr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new jr("'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 Br extends Error{constructor(e){super(e)}}const Kr=(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(Wr(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 Wr(t)}})(e.split(".")[n]))}catch(e){throw new Br("Invalid token specified: "+e.message)}},zr=["type"],qr=["type"];async function Hr(e){if(!e.accessToken)return e;da.setAccessToken(e.accessToken);const t=await ba(`${wa.v2}/me`),n=C({},e,e.accessToken?Kr(e.accessToken):{},t);return da.setUser(n),n}async function Jr(e){if(!e.accessToken)return{user:e};da.setAccessToken(e.accessToken);const[t,n]=await Promise.all([ba(`${wa.v2}/me`),cr()]),i=C({},e,e.accessToken?Kr(e.accessToken):{},t);return da.setUser(i),{user:i,tenants:n}}async function Yr(e){da.setAccessToken(e.id_token);const t=await ba(`${wa.v2}/me`),n=e.id_token?Kr(e.id_token):{},i=C({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return da.setUser(i),i}async function Qr(e){try{const{address:t}=await Aa(`${Oa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Xr(e){return Aa(`${Oa.v1}/user/saml/prelogin`,e)}async function Zr(e){return Hr(await Aa(`${Oa.v1}/user/saml/postlogin`,e))}async function es(e){return Hr(await Aa(`${Oa.v1}/user/oidc/postlogin`,e))}async function ts(e){return Hr(await Aa(`${Oa.v1}/user`,e))}async function ns(e){return Hr(await Aa(`${Oa.v1}/user/mfa/verify`,e))}async function is(e){return Aa(`${wa.v1}/activate`,e)}async function os(e){return ba(`${wa.v1}/activate/strategy`,e)}async function as(e){return Aa(`${wa.v1}/activate/reset`,e)}async function rs(e){return Aa(`${wa.v1}/invitation/reset`,e)}async function ss(e){return Aa(`${wa.v1}/invitation/accept`,e)}async function ls(){return Hr(await Aa(`${Oa.v1}/user/token/refresh`))}async function cs(){return Jr(await Aa(`${Oa.v1}/user/token/refresh`))}async function us(){return Aa(`${Oa.v1}/logout`)}async function ds(e){return ba(`${ir}/logout`,e)}async function ys(e){return Aa(`${wa.v1}/passwords/reset`,e)}async function fs(e){return Aa(`${wa.v1}/passwords/reset/verify`,e)}async function gs(e){return ba(`${wa.v1}/passwords/config`,e)}async function ps(e){return Aa(`${Oa.v1}/user/mfa/recover`,e)}async function Ss(){return Aa(`${wa.v1}/mfa/enroll`)}async function vs(){return Aa(`${wa.v1}/mfa/authenticator/enroll`)}async function hs(e){return Aa(`${wa.v1}/mfa/authenticator/enroll/verify`,e)}async function ms(e){return Aa(`${wa.v1}/mfa/sms/enroll`,e)}async function bs(e){return Aa(`${wa.v1}/mfa/sms/enroll/verify`,e)}async function As(){return Aa(`${wa.v1}/mfa/webauthn/enroll`)}async function ks(e){return Aa(`${wa.v1}/mfa/webauthn/enroll/verify`,e)}async function Ts(e){return Aa(`${wa.v1}/mfa/enroll/verify`,e)}async function Ps(e){return Aa(`${wa.v1}/mfa/disable`,e)}async function Is(e,t){return Aa(`${wa.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Ls(e){return Aa(`${wa.v1}/mfa/sms/${e}/disable`)}async function Es(e,t){return Aa(`${wa.v1}/mfa/sms/${e}/disable/verify`,t)}async function Os(e){return Aa(`${wa.v1}/mfa/webauthn/${e}/disable`)}async function ws(e,t){return Aa(`${wa.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Cs(){return ba(`${wa.v1}/mfa/devices`)}async function Ds(e){return Aa(`${Oa.v1}/user/mfa/authenticator/enroll`,e)}async function Rs(e){return Aa(`${Oa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Us(e,t){return Aa(`${Oa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function _s(e){return Aa(`${Oa.v1}/user/mfa/sms/enroll`,e)}async function Ms(e){return Aa(`${Oa.v1}/user/mfa/sms/enroll/verify`,e)}async function Ns(e,t){return Aa(`${Oa.v1}/user/mfa/sms/${e}`,t)}async function Fs(e,t){return Aa(`${Oa.v1}/user/mfa/sms/${e}/verify`,t)}async function $s(e){return Aa(`${Oa.v1}/user/mfa/webauthn/enroll`,e)}async function Gs(e){return Aa(`${Oa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function xs(e,t){return Aa(`${Oa.v1}/user/mfa/webauthn/${e}`,t)}async function Vs(e,t){return Aa(`${Oa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function js(){return ba(`${Ga.v1}/saml/configurations`)}async function Ws(e){return Aa(`${Ga.v1}/saml/configurations`,e)}async function Bs(){return ba(`${Ga.v1}/saml/configurations/vendor-config`)}async function Ks(e){return Ta(`${Ga.v1}/saml/configurations/metadata`,e)}async function zs(){return Ta(`${Ga.v1}/saml/validations/domain`)}async function qs(){return ba(`${Ga.v1}/saml/configurations/roles/default`)}async function Hs(){return ba(`${Ga.v2}/saml/configurations/groups`)}async function Js({roleIds:e}){return Aa(`${Ga.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Ys({roleIds:e,group:t}){return Aa(`${Ga.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Qs({roleIds:e,group:t,id:n}){return ka(`${Ga.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Xs({id:e}){return Pa(`${Ga.v2}/saml/configurations/groups/${e}`)}async function Zs(){return ba(`${Ga.v1}/oidc/configurations`)}async function el(){return ba(`${Ga.v2}/configurations/public`)}async function tl(){return ba(Ra.v1)}async function nl(){return ba(Ra.v2)}async function il(){return ba(Ra.custom.v1)}async function ol({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),Aa(`${Oa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function al(){return ba(`${Ca.v1}/public`)}async function rl(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Aa(`${wa.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await Hr(n):void 0,userId:i,tenantId:o}}async function sl(){return ba(wa.sessions.currentUser.v1)}async function ll(){return ba(`${wa.sessions.currentUser.v1}/current`)}async function cl(e){return Aa(`${wa.sessions.v1}/revoke`,{userId:e})}async function ul(){return ba(wa.sessions.configurations.v1)}async function dl(e){await Aa(wa.sessions.configurations.v1,e)}async function yl(e){await Pa(`${wa.sessions.currentUser.v1}/${e}`)}async function fl(){await Pa(`${wa.sessions.currentUser.v1}/all`)}async function gl(){return ba(wa.accessTokens.v1)}async function pl(){return ba(_a.accessTokens.v1)}async function Sl({id:e}){return Pa(`${_a.accessTokens.v1}/${e}`)}async function vl({id:e}){return Pa(`${wa.accessTokens.v1}/${e}`)}async function hl(e){return Aa(wa.accessTokens.v1,e)}async function ml(e){return Aa(_a.accessTokens.v1,e)}async function bl(){return ba(wa.apiTokens.v1)}async function Al(){return ba(_a.apiTokens.v1)}async function kl(e){return Aa(wa.apiTokens.v1,e)}async function Tl(e){return Aa(_a.apiTokens.v2,e)}async function Pl({tokenId:e}){return Pa(`${_a.apiTokens.v1}/${e}`)}async function Il({tokenId:e}){return Pa(`${wa.apiTokens.v1}/${e}`)}async function Ll({userId:e}){return ba(`${wa.v1}/${e}`)}async function El(e){return ba(`${Ca.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Ol(e){let{type:t}=e,n=Ii(e,zr);return Aa(`${Oa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function wl(e){let{type:t}=e,n=Ii(e,qr);return Aa(`${Oa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Cl({token:e}){return Aa(_a.invites.verify.v1,{token:e})}async function Dl(){return ba(`${Ga.v1}/configurations`)}async function Rl(e){return Aa(`${Ga.v1}/configurations`,e)}async function Ul(e,t){return ka(`${Ga.v1}/configurations/${e}`,t)}async function _l(e){return Pa(`${Ga.v1}/configurations/${e}`)}async function Ml(e){return Aa(`${Ga.v1}/configurations/metadata`,e)}async function Nl(e,t){return Ta(`${Ga.v1}/configurations/${e}/metadata`,t)}async function Fl(e,t){return Aa(`${Ga.v1}/configurations/${e}/domains`,t)}async function $l(e,t){return Pa(`${Ga.v1}/configurations/${e}/domains/${t}`)}async function Gl(e,t){return Ta(`${Ga.v1}/configurations/${e}/domains/${t}/validate`)}async function xl(e){return ba(`${Ga.v1}/configurations/${e}/roles`)}async function Vl(e,t){return Ta(`${Ga.v1}/configurations/${e}/roles`,t)}async function jl(e,t){return Aa(`${Ga.v1}/configurations/${e}/groups`,t)}async function Wl(e,{roleIds:t,group:n,id:i}){return ka(`${Ga.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function Bl(e,t){return Pa(`${Ga.v1}/configurations/${e}/groups/${t}`)}async function Kl(e){return ba(`${Ga.v1}/configurations/${e}/groups`)}async function zl(e){return Aa(`${Oa.v2}/user/sso/prelogin`,e)}async function ql(e){return Hr(await Aa(`${Oa.v2}/user/oidc/postlogin`,e))}async function Hl(e){return Yr(await Aa(`${ir}/token`,e))}async function Jl(){return Yr(await Aa(`${ir}/authorize/silent`))}async function Yl(e){return Aa(`${wa.v1}/phone/reset`,e)}async function Ql(e){return Aa(`${wa.v1}/phone/reset/verify`,e)}async function Xl(e){return Aa(`${wa.v1}/phone`,e)}async function Zl(e){return Aa(`${wa.v1}/phone/verify`,e)}async function ec(e){return Ta(`${wa.v1}/phone/change`,e)}async function tc(e){return Aa(`${Oa.v1}/webauthn/prelogin`,e)}async function nc(e){return Aa(`${Oa.v1}/webauthn/postlogin`,e)}async function ic(){return Aa(Ea.v1)}async function oc(){return ba(Ea.v1)}async function ac(e){return Pa(`${Ea.v1}/${e}`)}async function rc(e){return Aa(`${Ea.v1}/verify`,e)}async function sc(){return ba(`${Ca.v1}/auth/strategies/public`)}async function lc(){return ba(`${Ca.v1}/mfa/strategies`)}async function cc(e){return ba(`${wa.v2}/me`,null!=e?e:{addRoles:!0})}async function uc(e){return Ta(`${wa.v2}/me`,e)}async function dc(e){return Ta(`${Wa.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function yc(e){return Aa(`${wa.v1}/passwords/change`,e)}async function fc(e){var t,n,i,o,a,r;const s=(e.filter||[]).reduce(((e,t)=>C({},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 ba(xa.v1,C({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function gc(e){return Aa(wa.v2,C({},e,{provider:"local"}))}async function pc(e){return Pa(`${xa.v1}/${e.userId}`)}async function Sc(e){return Ta(xa.v1,e)}async function vc(e){return Aa(_a.invites.user.v1,C({},e))}async function hc(e){return ka(_a.invites.user.v1,C({},e))}async function mc(){return Pa(_a.invites.user.v1)}async function bc(){return ba(_a.invites.user.v1)}async function Ac(){return ba(_a.invites.configuration.v1)}async function kc(){return ba(Va.v1)}async function Tc(){return ba(Ua.v1)}async function Pc(){return ba(`${ja.v1}/members`)}async function Ic(e){return Aa(`${xa.v1}/${e.userId}/resendActivationEmail`,{})}async function Lc(e){return Aa(wa.v2,C({},e,{provider:"local"}))}async function Ec(e){return Aa(wa.invitation.resendAll.v1,C({},e))}async function Oc(e){var t,n;const i=await ba("/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 wc(){return ba("/metadata/admin-box")}async function Cc(e){return Aa("/metadata/admin-box",e)}async function Dc(){const e=await ba("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Rc=async()=>Oc({entityName:"notifications"}),Uc=async()=>Oc({entityName:"saml"}),_c=async()=>Oc({entityName:"audits"}),Mc=async e=>async function(e){const t=await ba(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Nc=["dataFilters"],Fc=["templateId","dataFilters"],$c=["dataFilters"];async function Gc(e){return ba(`${Qa.v2}/tenant-reports`,e)}async function xc(e){return ba(`${Qa.v2}/${e.id}/tenant-reports`)}async function Vc(e){let{dataFilters:t}=e,n=Ii(e,Nc);return{html:await ba(`${Xa.v1}/preview-report`,C({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function jc(e){let{templateId:t,dataFilters:n}=e,i=Ii(e,Fc);return Aa(`${Qa.v2}/${t}/tenant-reports`,C({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Wc(e){let{dataFilters:t}=e,n=Ii(e,$c);const i=await ba(`${Xa.v1}/preview-report`,C({},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 Bc(e){return Aa(`${Xa.v1}/tenant-reports`,e)}async function Kc(e){return ba(Za,{params:e})}async function zc(e){return Ta(`${Za}/status`,{params:e})}async function qc(e){const{notificationId:t,pinStatus:n}=e;return Ta(`${Za}/${n}`,{notificationId:t})}async function Hc(){return Aa(`${Za}/status/mark-all-read`)}const Jc=["endpoint","headerProps"];async function Yc(e){return ba(er,e)}async function Qc(e){return ba(`${er}/stats`,e)}async function Xc(e){const{endpoint:t,headerProps:n}=e,i=Ii(e,Jc);return Ia(`${er}/export/${t}`,{properties:n},i)}const Zc=["eventKey"],eu=["eventKey"],tu=()=>ba(`${qa.v1}/slack`),nu=()=>ba(`${qa.v1}/slack/applications`),iu=()=>ba(`${qa.v1}/slack/channels`),ou=e=>e.id?ka(`${qa.v1}/slack/subscription/${e.id}`,e):Aa(`${qa.v1}/slack/subscriptions`,e),au=e=>Pa(`${qa.v1}/slack/subscriptions/${e.id}`),ru=e=>Aa(`${qa.v1}/slack/applications/registrations`,{code:e}),su=()=>ba(`${qa.v1}/emails`),lu=e=>{let{eventKey:t}=e,n=Ii(e,Zc);return Aa(`${qa.v1}/emails/${t}`,n)},cu=({eventKey:e,enabled:t})=>ka(`${qa.v1}/emails/${e}`,{enabled:t}),uu=(e,t)=>Pa(`${qa.v1}/emails/${e}/subscriptions/${t}`),du=(e,t,n)=>Ta(`${qa.v1}/emails/${t}/subscriptions/${e}`,n),yu=e=>Pa(`${qa.v1}/emails/${e}`),fu=()=>ba(`${qa.v2}/sms`),gu=e=>{let{eventKey:t}=e,n=Ii(e,eu);return Aa(`${qa.v2}/sms/${t}`,n)},pu=({eventKey:e,enabled:t})=>ka(`${qa.v2}/sms/${e}`,{enabled:t}),Su=(e,t)=>Pa(`${qa.v2}/sms/${e}/subscriptions/${t}`),vu=(e,t,n)=>Ta(`${qa.v2}/sms/${t}/subscriptions/${e}`,n),hu=e=>Pa(`${qa.v2}/sms/${e}`),mu=()=>ba(nr),bu=e=>e._id?ka(`${nr}/${e._id}`,e):Aa(`${nr}/custom`,e),Au=e=>Pa(`${nr}/${e}`),ku=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return ba(`${nr}/logs/?${i.toString()}`)},Tu=e=>Aa(`${nr}/test`,e),Pu=e=>Aa(`${nr}/logs/${e}/retries`),Iu=()=>ba(`${tr.v1}/categories`),Lu=e=>ba(tr.v1,{channels:e});async function Eu(e,t){return Ta(Ba.v1,e,{headers:La(t)})}async function Ou(e){return ba(Ba.v1,void 0,{headers:La(e)})}async function wu(){return ba(`${Ba.v1}/public`)}const Cu=["roleId"],Du=["roleId"],Ru=["permissionId"];async function Uu(){return ba(Ma.v1)}async function _u(e){return Aa(Ma.v1,e)}async function Mu({roleId:e}){return Pa(`${Ma.v1}/${e}`)}async function Nu(e){let{roleId:t}=e,n=Ii(e,Cu);return ka(`${Ma.v1}/${t}`,n)}async function Fu(e){let{roleId:t}=e,n=Ii(e,Du);return Ta(`${Ma.v1}/${t}/permissions`,n)}async function $u(){return ba(Ua.v1)}async function Gu(e){let{permissionId:t}=e,n=Ii(e,Ru);return Ta(`${Ua.v1}/${t}/roles`,n)}async function xu(){return ba(`${Ua.v1}/categories`)}async function Vu(){return ba(Ha.subscriptions.v1)}async function ju(e){return ba(`${Ha.subscriptions.v1}/${e}`)}async function Wu(e){return Ta(`${Ha.subscriptions.v1}/${e}/cancellations/`,{})}async function Bu(e){return Ta(`${Ha.subscriptions.v1}/${e}/renewals/`,{})}async function Ku(e,{paymentMethodId:t,planId:n}){return Ta(`${Ha.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function zu(e){return ba(`${Ya.v1}/${e}`)}async function qu(){return ba(`${Ya.v1}`)}async function Hu(e){return Ta(`${Ya.v1}/${e}/cancellations/`,{})}async function Ju(e){return Ta(`${Ya.v1}/${e}/renewals/`,{})}async function Yu(e,{paymentMethodId:t,planId:n}){return Ta(`${Ya.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Qu(){return ba(Ha.plans.v1)}async function Xu(e){return ba(`${Ha.plans.v1}/${e}`)}async function Zu(){return ba(Ha.invoices.v1)}async function ed(e){return ba(`${Ha.invoices.v1}/${e}`)}async function td(e,t){return ba(`${Ha.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const nd=["email"];async function id(){return ba(Ha.paymentMethods.v1)}async function od(e){return ba(`${Ha.paymentMethods.v1}/${e}`)}async function ad(e,t){let{email:n}=t,i=Ii(t,nd);return ka(`${Ha.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function rd(e){return Aa(Ha.paymentProviders.stripe.subscriptions.v1,e)}async function sd(e){return ba(`${Ha.paymentProviders.stripe.customers.v1}/${e}`)}async function ld(e){return Aa(`${Ha.paymentProviders.stripe.customers.v1}`,e)}async function cd(){return ba(`${Ha.paymentProviders.stripe.publicConfigurations.v1}`)}async function ud(e){return Aa(`${Ha.paymentProviders.stripe.setupIntents.v1}`,e)}async function dd(e){return ba(`${Ha.summaries.v1}/${e}`)}async function yd(e){return ba(`${Ha.tenantConfiguration.v1}/${e}`)}async function fd(e){return Aa(`${Ha.tenantConfiguration.v1}`,e)}async function gd(){return ba(Ja.v1)}async function pd(){return ba(`${Ha.configurations.vendorPublicConfigurations.v1}`)}let Sd,vd,hd,md,bd,Ad;async function kd(){return ba("/vendors/public")}async function Td(e){return ba(Na.v1,e)}async function Pd(e){return Aa(Na.v1,e)}async function Id(e,t){return Pa(Na.v1,e,{headers:La(t)})}async function Ld(e,t,n){return Aa(`${Na.v1}/${e}/roles`,t,{headers:La(n)})}async function Ed(e,t,n){return Pa(`${Na.v1}/${e}/roles`,t,{headers:La(n)})}async function Od(e,t,n){return ka(`${Na.v1}/${e}/roles`,t,{headers:La(n)})}async function wd(e,t){return Aa(za.v1,e,{headers:La(t)})}async function Cd(e,t){return Pa(`${za.v1}/${e}`,void 0,{headers:La(t)})}async function Dd(e,t,n){return Ta(`${Na.v1}/${e}/access`,t,{headers:La(n)})}async function Rd(e,t){return Aa(`${Na.v2}/`,e,{headers:La(t)})}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Sd||(Sd={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(vd||(vd={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(hd||(hd={})),(md||(md={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(bd||(bd={})),function(e){e.CREATE="create_customer"}(Ad||(Ad={}));const Ud={flags:{}};class _d{constructor(){var e;this._flags={},this._flags=null!=(e=Ud.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new _d;return n.set(e),_d._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=C({},null!=(t=null==Ud?void 0:Ud.flags)?t:{},null!=e?e:{})}}async function Md(){return ba(or)}async function Nd(){return ba(`${ar}`)}async function Fd(e,t){return ka(`${ar}/${e}`,t)}async function $d(e){return Aa(`${ar}`,e)}async function Gd(e){return Pa(`${ar}/${e}`)}async function xd(e){return ba(`${rr}/${e}/Users/count`)}async function Vd(e){return Aa(`${Fa.v1}`,e)}_d._instances={};const jd=["groupId"];async function Wd({groupId:e},t){return ba(`${$a.v1}/${e}`,C({},t))}async function Bd(e){return ba(`${$a.v1}`,C({},e))}async function Kd(e,t){return Aa(`${$a.getByIds.v1}`,e,{params:t})}async function zd(e){return Aa(`${$a.v1}`,e)}async function qd(e){let{groupId:t}=e,n=Ii(e,jd);return ka(`${$a.v1}/${t}`,n)}async function Hd(e){return Pa(`${$a.v1}/${e}`)}async function Jd(e,t){return Aa(`${$a.v1}/${e}/roles`,t)}async function Yd(e,t){return Pa(`${$a.v1}/${e}/roles`,t)}async function Qd(e,t){return Aa(`${$a.v1}/${e}/users`,t)}async function Xd(e,t){return Pa(`${$a.v1}/${e}/users`,t)}async function Zd(){return ba(`${$a.configurations.v1}`)}async function ey(e){return Aa(`${$a.configurations.v1}`,e)}async function ty(e){return Aa(`${wa.v3}/me/token`,e)}async function ny(e,t){return ba(wa.v3,e,{headers:La(t)})}async function iy(){return ba(sr)}let oy,ay,ry,sy,ly;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(oy||(oy={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(ay||(ay={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(ry||(ry={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(sy||(sy={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(ly||(ly={}));const cy=[/^(.*)\/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],uy=`${Oa.v1}/user/token/refresh`,dy=`${ir}/authorize/silent`,yy=`${wa.v2}/me`,fy=`${wa.v2}/me/tenants`;let gy,py,Sy,vy,hy;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(gy||(gy={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(py||(py={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Sy||(Sy={})),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"}(vy||(vy={})),function(e){e.ASC="ASC",e.DESC="DESC"}(hy||(hy={}));const my={auth:o,teams:a,metadata:r,reports:s,connectivity:u,notifications:l,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:g,subTenants:p,featureFlags:S,directory:v,impersonate:h,groups:m,users:b,entitlements:A};var by={fetch:e,ContextHolder:da,FronteggContext:ya,api:my,FronteggApiError:Sa,AuthStrategyEnum:xr,MachineToMachineAuthStrategy:Vr,SocialLoginProviders:Gr,ISubscriptionCancellationPolicy:hd,ISubscriptionStatus:Sd,PaymentMethodType:vd,ProviderType:md};let Ay,ky;!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"}(Ay||(Ay={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(ky||(ky={}));const Ty="input is invalid type",Py="undefined"!=typeof ArrayBuffer,Iy="0123456789abcdef".split(""),Ly=[-2147483648,8388608,32768,128],Ey=[24,16,8,0],Oy=[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],wy=["hex","array","digest","arrayBuffer"],Cy=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Py&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const Dy=function(e){return function(t){const n=new Uy(!0).update(t);return null==n?void 0:n[e]()}},Ry=function(e){return function(t,n){const i=new _y(t,!0).update(n);return null==i?void 0:i[e]()}};class Uy{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=()=>Uy.prototype.digest(),e?(Cy[0]=Cy[16]=Cy[1]=Cy[2]=Cy[3]=Cy[4]=Cy[5]=Cy[6]=Cy[7]=Cy[8]=Cy[9]=Cy[10]=Cy[11]=Cy[12]=Cy[13]=Cy[14]=Cy[15]=0,this.blocks=Cy):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(Ty);if(null===e)throw new Error(Ty);if(Py&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Py&&ArrayBuffer.isView(e)))throw new Error(Ty);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]<<Ey[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<Ey[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<Ey[3&o++],s[o>>2]|=(128|63&i)<<Ey[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<Ey[3&o++],s[o>>2]|=(128|i>>6&63)<<Ey[3&o++],s[o>>2]|=(128|63&i)<<Ey[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<Ey[3&o++],s[o>>2]|=(128|i>>12&63)<<Ey[3&o++],s[o>>2]|=(128|i>>6&63)<<Ey[3&o++],s[o>>2]|=(128|63&i)<<Ey[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]|=Ly[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,g=this.h3,p=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,g=o+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7),s=d&y,i=s^d&f^u,r=p&S^~p&v,o=h+n+r+Oy[e]+m[e],a=t+i,h=g+o<<0,g=o+a<<0),t=(g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),l=g&d,i=l^g&y^s,r=h&p^~h&S,o=v+n+r+Oy[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&g,i=c^f&d^l,r=v&h^~v&p,o=S+n+r+Oy[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&g^c,r=S&v^~S&h,o=p+n+r+Oy[e+3]+m[e+3],a=t+i,p=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+g<<0,this.h4=this.h4+p<<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=Iy[e>>28&15]+Iy[e>>24&15]+Iy[e>>20&15]+Iy[e>>16&15]+Iy[e>>12&15]+Iy[e>>8&15]+Iy[e>>4&15]+Iy[15&e]+Iy[t>>28&15]+Iy[t>>24&15]+Iy[t>>20&15]+Iy[t>>16&15]+Iy[t>>12&15]+Iy[t>>8&15]+Iy[t>>4&15]+Iy[15&t]+Iy[n>>28&15]+Iy[n>>24&15]+Iy[n>>20&15]+Iy[n>>16&15]+Iy[n>>12&15]+Iy[n>>8&15]+Iy[n>>4&15]+Iy[15&n]+Iy[i>>28&15]+Iy[i>>24&15]+Iy[i>>20&15]+Iy[i>>16&15]+Iy[i>>12&15]+Iy[i>>8&15]+Iy[i>>4&15]+Iy[15&i]+Iy[o>>28&15]+Iy[o>>24&15]+Iy[o>>20&15]+Iy[o>>16&15]+Iy[o>>12&15]+Iy[o>>8&15]+Iy[o>>4&15]+Iy[15&o]+Iy[a>>28&15]+Iy[a>>24&15]+Iy[a>>20&15]+Iy[a>>16&15]+Iy[a>>12&15]+Iy[a>>8&15]+Iy[a>>4&15]+Iy[15&a]+Iy[r>>28&15]+Iy[r>>24&15]+Iy[r>>20&15]+Iy[r>>16&15]+Iy[r>>12&15]+Iy[r>>8&15]+Iy[r>>4&15]+Iy[15&r];return l+=Iy[s>>28&15]+Iy[s>>24&15]+Iy[s>>20&15]+Iy[s>>16&15]+Iy[s>>12&15]+Iy[s>>8&15]+Iy[s>>4&15]+Iy[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 _y extends Uy{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(Ty);if(null===e)throw new Error(Ty);if(Py&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Py&&ArrayBuffer.isView(e)))throw new Error(Ty)}var o;e.length>64&&(e=null==(o=new Uy(!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}Uy.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();Uy.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Uy.prototype.finalize.call(this)}}}const My=function(){const e=Dy("hex");e.create=function(){return new Uy},e.update=function(t){return e.create().update(t)};for(let t=0;t<wy.length;++t){const n=wy[t];e[n]=Dy(n)}return e}();function Ny(e,t){const n=C({},e);return t.forEach((e=>{delete n[e]})),n}async function Fy(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=My.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function $y(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=Ry("hex");e.create=function(e){return new _y(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<wy.length;++t){const n=wy[t];e[n]=Ry(n)}}();const Gy=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*xy(e){const t=yield So((e=>e.root.appName));return _d.getFeatureFlags(e,t)}const Vy={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},jy=C({},Vy,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Wy=[{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"}],By={id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!0,profileImage:void 0,profilePictureUrl:"https://www.gravatar.com/avatar/42b2ad2bad6fc9b9db5086dfcf8072ac?d=https://ui-avatars.com/api/fe/128/random?t=1617261890875?t=1617261917434",roles:[{id:"roleId",key:"admin",isDefault:!1,name:"Admin",description:null,permissions:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",key:"fe.*",name:"General Admin",description:void 0,categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),roleIds:void 0,verified:void 0},Ky=C({},By,{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}),zy={loading:!1,error:void 0,saving:!0,profile:By},qy={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"},Hy={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:xr.EmailAndPassword,machineToMachineAuthStrategy:Vr.ClientCredentials},Jy={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Yy={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Qy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Xy={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},Zy={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},ef=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],tf={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Xy,roles:ef,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},nf=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],of={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:[Wy[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[Wy[0]],managedBy:Sy.FRONTEGG}]},af={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:[Wy[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[Wy[0]],managedBy:Sy.FRONTEGG}]},rf={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},sf=[af,of],lf=[rf],cf=[{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}],uf=[{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"}],df={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},yf={isActive:!0,strategy:xn.ALLOW},ff=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:xn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:xn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:xn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:xn.BLOCK,description:"IP 4"}],gf=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(C({},af,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},pf=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"}),Sf=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:gf(6),roles:[pf("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Sy.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:gf(44),roles:[pf("Editor")],managedBy:Sy.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:gf(8),roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:gf(5),roles:[pf("Admin")],managedBy:Sy.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:gf(21),description:"BDR, AE, and inside sales",roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:gf(23),description:"Dev success and customer success",roles:[pf("Admin")],managedBy:Sy.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:gf(10),description:"The marketing department",roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:gf(4),description:"Human resources",roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:gf(3),roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:gf(8),roles:[pf("Editor")],managedBy:Sy.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:gf(4),roles:[pf("Viewer")],managedBy:Sy.FRONTEGG}];let vf,hf,mf;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(vf||(vf={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(hf||(hf={})),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"}(mf||(mf={})),mf.profile,mf.privacy,mf.personalApiTokens,mf.account,mf.users,mf.groups,mf.security,mf.sso,mf.audits,mf.webhooks,mf.apiTokens,mf.roles,mf.subscriptions;const bf=["events","url"];function*Af(){yield co(yi.setSignUpState({loading:!0}));try{const e=yield fo(my.auth.getVendorConfig),[t]=(yield fo(my.auth.getVendorPublicAuthStrategiesConfig),yield fo(xy,["admin_portal_login_per_tenant"]));if(t){const t=yield fo(my.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield co(yi.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield co(yi.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield co(yi.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*kf(e){let{payload:{events:t,url:n}}=e,i=Ii(e.payload,bf);yield co(yi.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield So((e=>e.auth)),{shouldActivate:r,user:s,tenantId:l,userId:c}=yield fo(my.auth.signUpUser,i);if(!i.invitationToken){var o;const{email:e,name:a,companyName:r}=i;null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:hf.PASSWORD,id:c,tenantId:l,createdAt:new Date})}if(da.setAccessToken(null==s?void 0:s.accessToken),da.setUser(s),!r&&s&&Ng(s)){const t=yield Gg(s);yield co(yi.setState(t)),a(e.loginUrl)}else yield co(yi.setSignUpState({loading:!1,shouldActivate:r,stage:pn.SignUpSuccess})),yield co(yi.setState({user:s,isAuthenticated:!(null==s||!s.accessToken)})),r||(yield co(yi.loadTenants()))}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setSignUpState({loading:!1,error:e.message}))}yield co(yi.setSignUpState({loading:!1}))}function*Tf(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield So((e=>e.auth.signUpState));yield co(yi.resetSignUpState()),yield co(yi.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Pf(){yield ua(yi.signUpUser,kf),yield ua(yi.resetSignUpStateSoft,Tf)}const If={setVendorState:(e,{payload:t})=>C({},e,t)},Lf={loadVendorPublicInfo:lt("vendor/loadVendorPublicInfo")},Ef={loading:!1},{reducer:Of,actions:wf}=ut({name:Rt,initialState:Ef,reducers:C({},If)}),Cf=C({},wf,Lf);function*Df(){yield co(Cf.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield my.vendor.getVendorPublicInfo();yield co(Cf.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield co(Cf.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Rf=["callback"],Uf=["callback"],_f=["callback"],Mf=["callback"],Nf=["callback"],Ff=["callback"];function*$f(){yield co(yi.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield fo(my.auth.getGlobalSecurityPolicy);yield co(yi.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield co(yi.loadSecurityPolicyMfa()),yield co(yi.loadSecurityPolicyVendorMfa()),yield co(yi.loadSecurityPolicyLockout()),yield co(yi.loadSecurityPolicyVendorLockout()),yield co(yi.loadSecurityPolicyVendorPasswordHistory()),yield co(yi.loadSecurityPolicyCaptcha()),yield co(yi.loadPublicAuthStrategiesPolicy())}function*Gf(){yield co(yi.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorConfig),[t]=yield fo(xy,["admin_portal_login_per_tenant"]);if(t){const t=yield fo(my.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield co(yi.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*xf(){yield co(yi.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorPublicAuthStrategiesConfig);yield co(yi.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*Vf(){yield co(yi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield fo(my.auth.getMfaPolicy);yield co(yi.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*jf(){yield co(yi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorMfaPolicy);yield co(yi.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*Wf(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Rf);yield co(yi.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield fo(my.auth.saveMfaPolicy,n);yield co(yi.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Bf(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield fo(my.auth.getLockoutPolicy);yield co(yi.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*Kf(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Uf);yield co(yi.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield fo(my.auth.saveLockoutPolicy,n);yield co(yi.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*zf(){yield co(yi.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorLockoutPolicy);yield co(yi.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*qf(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield fo(my.auth.getCaptchaPolicy);yield co(yi.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*Hf(){yield co(yi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield fo(my.auth.getPasswordHistoryPolicy);yield co(yi.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*Jf(){yield co(yi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorPasswordHistoryPolicy);yield co(yi.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*Yf(e){let{payload:{callback:t}}=e,n=Ii(e.payload,_f);yield co(yi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield fo(my.auth.savePasswordHistoryPolicy,n);yield co(yi.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Qf(){yield co(yi.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield fo(my.auth.getPasswordConfigPolicy);yield co(yi.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*Xf(){yield ua(yi.loadSecurityPolicy,$f),yield la(yi.saveSecurityPolicyMfa,Wf),yield la(yi.loadSecurityPolicyMfa,Vf),yield la(yi.loadSecurityPolicyVendorMfa,jf),yield la(yi.saveSecurityPolicyLockout,Kf),yield la(yi.loadSecurityPolicyLockout,Bf),yield la(yi.loadSecurityPolicyVendorLockout,zf),yield la(yi.loadSecurityPolicyCaptcha,qf),yield la(yi.saveSecurityPolicyPasswordHistory,Yf),yield la(yi.loadSecurityPolicyPasswordHistory,Hf),yield la(yi.loadSecurityPolicyVendorPasswordHistory,Jf),yield la(yi.loadVendorPasswordConfig,Qf),yield la(yi.loadPublicSecurityPolicy,Gf),yield la(yi.loadPublicAuthStrategiesPolicy,xf)}function*Zf(){yield co(yi.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield co(yi.setSecurityPolicyPublicState({policy:Hy,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*eg(){yield co(yi.setSecurityPolicyGlobalState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyGlobalState({policy:qy,loading:!1})),yield co(yi.loadSecurityPolicyMfa()),yield co(yi.loadSecurityPolicyVendorMfa()),yield co(yi.loadSecurityPolicyLockout()),yield co(yi.loadSecurityPolicyVendorLockout()),yield co(yi.loadSecurityPolicyPasswordHistory()),yield co(yi.loadSecurityPolicyVendorPasswordHistory()),yield co(yi.loadSecurityPolicyCaptcha())}function*tg(){yield co(yi.setSecurityPolicyMfaState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyMfaState({policy:Jy,loading:!1}))}function*ng(){yield co(yi.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyVendorMfaState({policy:Jy,loading:!1}))}function*ig(e){var t;let{payload:{callback:n}}=e,i=Ii(e.payload,Mf);yield co(yi.setSecurityPolicyMfaState({saving:!0,error:null}));const o=C({},Yy,{id:null!=(t=i.id)?t:Yy.id,enforceMFAType:i.enforceMFAType});yield mt(),yield co(yi.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*og(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyLockoutState({policy:Yy,loading:!1}))}function*ag(){yield co(yi.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyVendorLockoutState({policy:Yy,loading:!1}))}function*rg(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Nf);yield co(yi.setSecurityPolicyLockoutState({saving:!0,error:null})),yield mt();const i=C({},Yy,n,{id:n.id?n.id:Yy.id});null==t||t(i),yield co(yi.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*sg(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyLockoutState({policy:Yy,loading:!1}))}function*lg(){yield co(yi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyPasswordHistoryState({policy:Qy,loading:!1}))}function*cg(){yield co(yi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyVendorPasswordHistoryState({policy:Qy,loading:!1}))}function*ug(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Ff);yield co(yi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield mt();const i=C({},Qy,n,{id:n.id?n.id:Qy.id});null==t||t(i),yield co(yi.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*dg(){yield ua(yi.loadSecurityPolicy,eg),yield la(yi.loadPublicSecurityPolicy,Zf),yield la(yi.saveSecurityPolicyMfa,ig),yield la(yi.loadSecurityPolicyMfa,tg),yield la(yi.loadSecurityPolicyVendorMfa,ng),yield la(yi.saveSecurityPolicyLockout,rg),yield la(yi.loadSecurityPolicyLockout,og),yield la(yi.loadSecurityPolicyVendorLockout,ag),yield la(yi.loadSecurityPolicyCaptcha,sg),yield la(yi.saveSecurityPolicyPasswordHistory,ug),yield la(yi.loadSecurityPolicyPasswordHistory,lg),yield la(yi.loadSecurityPolicyVendorPasswordHistory,cg)}const yg=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},fg=e=>{const{pathname:t}=new URL(e),n=yg(e);return n?t+n:t},gg=["callback"],pg=["callback"],Sg=["callback"],vg=["callback"],hg=["callback","events"],mg=["callback"],bg=["callback"],Ag=["callback"],kg=["callback"],Tg=["callback"],Pg=["callback"],Ig=["callback"],Lg=["callback"],Eg=["callback"],Og=["callback","deviceId"],wg=["callback","deviceId"],Cg=["callback","deviceId"],Dg=["callback","deviceId"],Rg={[xr.Code]:Pt.loginWithOtc,[xr.EmailAndPassword]:Pt.loginWithPassword,[xr.MagicLink]:Pt.magicLinkPreLoginSuccess,[xr.SmsCode]:Pt.loginWithSmsOtc};function*Ug(){const e=da.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield So((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:s,activateUrl:l}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;try{var d,y;!u&&null!=(d=(y=da.getContext()).tenantResolver)&&d.call(y)&&(yield fo(Hg),u=yield So((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})))}catch{}const f=window.localStorage.getItem(Et);f&&![a,r,s,l].includes(f)&&(c=f),window.localStorage.removeItem(Et),yield mt(200),co(yi.resetLoginState());const g=(({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?fg(u):c,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});e(g,{refresh:g.startsWith("http")})}function*_g(){let e;try{var t;const n=yield fo(my.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield co(yi.setState({ssoACS:e}))}function*Mg(){try{const{isActive:e}=yield fo(my.auth.getSSOPublicConfiguration);yield co(yi.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const Ng=e=>e.mfaRequired&&e.mfaToken?(da.setAccessToken(null),da.setUser(null),!0):(da.setAccessToken(e.accessToken),da.setUser(e),!1),Fg=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 an.authenticatorApp;if(t)return an.smsVerifyCode}return an.verify},$g=e=>{if(1===e.length){const[t]=e;if(t===ry.AuthenticatorApp)return an.authenticatorApp;if(t===ry.SMS)return an.smsSetPhoneNumber}return an.verify};function*Gg(e){let t=Pt.loginWithTwoFactor,n={};const{loginState:i}=yield So((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield fo(my.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Fg(e.mfaDevices)}:(n={step:$g(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=Pt.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:It.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:C({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a})}}function*xg(e){var t;const{routes:n,loginState:i}=yield So((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*Vg(){const{hostedLoginBox:e}=yield So((e=>e.auth));e?yield fo(jg):yield fo(Bg)}function*jg(){const{user:e}=yield So((e=>e.auth));if(null==e||!e.refreshToken)return da.setAccessToken(null),da.setUser(null),void(yield co(yi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield fo(my.auth.exchangeOAuthTokens,t);yield co(yi.setState({user:n,isAuthenticated:!0})),yield co(yi.loadTenants())}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:null,isAuthenticated:!1}))}}function*Wg(){const{user:e}=yield So((e=>e.auth));if(null==e||!e.refreshToken)return da.setAccessToken(null),da.setUser(null),void(yield co(yi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield fo(my.auth.exchangeOAuthTokens,t);yield co(yi.setState({user:n,isAuthenticated:!0})),yield co(yi.loadTenants())}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:null,isAuthenticated:!1}))}}function*Bg(){try{const t=da.onRedirectTo,{routes:n,loginState:i}=yield So((e=>e.auth)),{user:o,tenants:a}=yield fo(my.auth.refreshTokenV2);if(Ng(o)){const e=yield Gg(o);yield co(yi.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 xg(o);yield co(yi.setTenantsState({tenants:a,loading:!1})),yield co(yi.setState({user:o,isAuthenticated:!0,loginState:C({},i,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield zg(n)}}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:void 0,isAuthenticated:!1}))}}function*Kg(){try{const t=da.onRedirectTo,{routes:n,loginState:i}=yield So((e=>e.auth)),{user:o,tenants:a}=yield fo(my.auth.refreshTokenV2);if(Ng(o)){const e=yield Gg(o);yield co(yi.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield fo(ap))yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})),yield co(yi.setTenantsState({tenants:a,loading:!1})),yield co(yi.setState({user:o})),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 xg(o);yield co(yi.setTenantsState({tenants:a,loading:!1})),yield co(yi.setState({user:o,isAuthenticated:!0,loginState:C({},i,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield zg(n)}}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:void 0,isAuthenticated:!1}))}}function*zg(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=da.onRedirectTo,{routes:o,loginState:a}=yield So((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 Ug())}function*qg({payload:{callback:e}}){try{const{ip:t}=yield fo(my.metadata.getCurrentUserIpMetadata);yield co(yi.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*Hg(){try{var e,t;if(null!=(e=da.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){const{routes:e}=yield So((e=>e.auth)),{applicationUrl:t,loginUrl:i}=yield fo(wu);var n;t&&i&&(yield co(yi.setState({customLoginState:{customLoginEnabled:!0},routes:C({},e,{customLoginAuthenticatedUrl:i,customLoginUrl:null!=(n=e.loginUrl+yg(t))?n:""})})))}}catch{}}function*Jg({payload:e}){const t=[];e&&(yield co(yi.setState({isLoading:!0})),yield co(yi.loadSocialLoginsConfigurationV2()),t.push(fo(Af)),t.push(fo(xf)),t.push(fo(Mg)),t.push(fo(Df)),t.push(fo(_g)),t.push(fo(Hg))),t.push(fo(Vg)),yield uo(t),yield co(yi.setState({isLoading:!1}))}function*Yg({accessToken:e,user:t}){if(!e)return void(yield co(yi.setState({user:void 0,isAuthenticated:!1})));const n=da.onRedirectTo,{routes:i}=yield So((e=>e.auth));if(Ng(t)){const e=yield Gg(t);yield co(yi.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*Qg({payload:e}){const t=[];yield co(yi.loadSocialLoginsConfigurationV2()),t.push(fo(Af)),t.push(fo(Mg)),t.push(fo(Df)),t.push(fo(_g)),t.push(fo(Yg,e)),t.push(fo(Hg)),yield uo(t)}function*Xg({payload:e}){const{disableSilentRefresh:t}=yield So((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield fo(my.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield co(yi.setState({user:e,isAuthenticated:!0})),yield co(yi.loadTenants()),yield co(yi.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield So((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if((e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield co(yi.setState({isLoading:!0}));const a=$y(),r=$y(),s=yield fo(Fy,r);localStorage.setItem(Ot,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;const c=yield Zg();c&&(l.endsWith("/")&&(l=l.slice(0,-1)),l+=c);const u=`${va(n,"/oauth/authorize")}/oauth/authorize`,d=C({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)}i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}(e)}}function*Zg(){try{var e,t;if(null!=(e=da.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){yield fo(Hg);const e=yield So((e=>e.auth.routes.customLoginAuthenticatedUrl));if(e)return yg(e)}}catch{}}function*ep({payload:e}){const t=localStorage.getItem(Ot)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield So((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;const a=yield Zg();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 fo(my.auth.exchangeOAuthTokens,r);yield co(yi.setState({user:e,isAuthenticated:!0})),yield co(yi.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Ug()}}function*tp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,gg);try{yield co(yi.setLoginState({loading:!0}));const e=yield fo(my.auth.changePhoneNumberWithVerification,n);yield co(yi.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Pt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1}))}}function*np(e){let{payload:{callback:t}}=e,n=Ii(e.payload,pg);try{yield co(yi.setLoginState({loading:!0})),yield fo(my.auth.verifyChangePhoneNumber,n),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1}))}}function*ip(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Sg);try{yield co(yi.setLoginState({loading:!0}));const e=yield fo(my.auth.passwordlessPreLogin,C({},n,{type:xr.SmsCode}));yield co(yi.setLoginState({step:Pt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*op(e){let{payload:{callback:t}}=e,n=Ii(e.payload,vg);try{const{onRedirectTo:e,routes:i}=yield So((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield co(yi.setLoginState({loading:!0}));const o=yield fo(my.auth.passwordlessPreLogin,n),a=Rg[n.type];if(a===Pt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield co(yi.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield co(yi.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*ap(){const{publicAuthStrategyPolicy:e}=yield So((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===oy.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield fo(xy,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield fo(my.auth.getWebAuthnDevices);return yield co(yi.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*rp(e){let{payload:{callback:t,events:n}}=e,i=Ii(e.payload,hg);try{yield co(yi.setLoginState({loading:!0}));const e=yield fo(my.auth.passwordlessPostLogin,i),a=da.onRedirectTo,{routes:r}=yield So((e=>e.auth));if(Ng(e)){const t=yield Gg(e);yield co(yi.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield So((e=>e.auth)),s=yield fo(my.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:s.email,origin:vf.PASSWORDLESS,id:s.id,tenantId:s.tenantId,createdAt:new Date,name:s.name})),s.id&&localStorage.setItem("userId",s.id),yield co(yi.setState({user:s})),yield co(yi.setLoginState({error:void 0})),yield co(yi.loadTenants()),yield co(yi.setState({isLoading:!1})),i.flow===It.Login?(yield fo(ap))?(yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield co(yi.setState({isAuthenticated:!0})),yield Ug()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield co(yi.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield co(yi.setLoginState({loading:!1}))}}function*sp({payload:e}){try{yield co(yi.setLoginState({loading:!0}));const{name:t}=yield fo(my.auth.verifyInviteToken,e);yield co(yi.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield co(yi.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield co(yi.setLoginState({loading:!1}))}}function*lp({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield co(yi.setLoginState({loading:!0}));try{const o=yield So((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield fo(my.auth.preLoginV2,{email:e});if(a){let e=a;if(r===ky.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield So((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield co(yi.setLoginState({step:Pt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{o(e,{refresh:!0})}),2e3)}else yield cp({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield cp({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*cp(e){let{callback:t}=e,n=Ii(e,mg);const i=yield So((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield co(yi.setLoginState({step:Pt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===xr.EmailAndPassword?(yield co(yi.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t()):[xr.MagicLink,xr.Code,xr.SmsCode].includes(null==i?void 0:i.authStrategy)?yield co(yi.passwordlessPreLogin(C({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield co(yi.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t())}function*up({payload:{callback:e}}){try{yield co(yi.setLoginState({loading:!0}));const{options:t}=yield fo(my.auth.webAuthnCreateNewDeviceSession);t.user.id=kt(t.user.id),t.challenge=kt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield co(yi.setLoginState({error:t.message})),null==e||e(null)}finally{yield co(yi.setLoginState({loading:!1}))}}function*dp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,bg);try{yield co(yi.setLoginState({loading:!0}));const e=Tt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?ay.Platform:ay.CrossPlatform;yield fo(my.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message})),null==t||t(null)}finally{yield co(yi.setLoginState({loading:!1}))}}function*yp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Ag);try{var i;yield co(yi.setPasskeysState({loading:!0})),yield co(yi.setLoginState({loading:!0}));const{options:e}=yield fo(my.auth.webAuthnPreLogin,n);e.challenge=kt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)}))),yield co(yi.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield co(yi.setLoginState({error:e.message})),null==t||t(null)}finally{yield co(yi.setPasskeysState({loading:!1})),yield co(yi.setLoginState({loading:!1}))}}function*fp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,kg);try{var i;yield co(yi.setPasskeysState({loading:!0})),yield co(yi.setLoginState({loading:!0}));const e=Tt(n.publicKey),o=yield fo(my.auth.webAuthnPostLogin,C({},e,{response:C({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(Ng(o)){const e=da.onRedirectTo,{routes:t}=yield So((e=>e.auth)),n=yield Gg(o);yield co(yi.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield fo(my.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield co(yi.loadTenants()),yield co(yi.setState({user:e,isAuthenticated:!0})),yield co(yi.setLoginState({error:void 0})),yield Ug(),null==t||t(!0)}}catch(e){yield co(yi.setLoginState({error:e.message})),null==t||t(null)}finally{yield co(yi.setPasskeysState({loading:!1})),yield co(yi.setLoginState({loading:!1}))}}function*gp({payload:e}){const{onRedirectTo:t,routes:n}=yield So((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield co(yi.setLoginState({loading:!0}));try{const t=yield fo(my.auth.postLogin,e);da.setAccessToken(t.accessToken),da.setUser(t),yield co(yi.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Ug()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield co(yi.setLoginState({step:Pt.loginWithSSOFailed,loading:!1}))}}function*pp({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield co(yi.setLoginState({loading:!0}));try{const a=yield fo(my.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});da.setAccessToken(a.accessToken),da.setUser(a);const r=da.onRedirectTo,{routes:s}=yield So((e=>e.auth));if(Ng(a)){const e=yield Gg(a);yield co(yi.setState(e)),r(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield So((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield co(yi.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===It.Login?Pt.success:t.step,tenants:[],tenantsLoading:!0}})),yield co(yi.loadTenants()),n&&t.flow===It.Login&&((yield fo(ap))?(yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})),r(s.loginUrl,{preserveQueryParams:!0})):yield Ug())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){da.setAccessToken(null),da.setUser(null),null==o||o(!1,t),yield co(yi.setLoginState({email:e,error:t.message,loading:!1}))}}function*Sp({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield co(yi.setLoginState({loading:!0}));try{const o=yield fo(my.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield So((e=>e.auth)),r=a.flow===It.Login?Pt.success:a.step;yield co(yi.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:o,isAuthenticated:!0})),o.id&&localStorage.setItem("userId",o.id),yield co(yi.loadTenants()),yield co(yi.setLoginState({error:void 0,loading:!1})),a.flow===It.Login&&((yield fo(ap))?yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield Ug()),null==i||i(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*vp({payload:e}){yield co(yi.setLoginState({loading:!0}));try{var t;yield fo(my.auth.recoverMfaToken,e),yield co(yi.setLoginState({loading:!1,error:void 0,step:Pt.preLogin})),yield co(yi.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setLoginState({error:t.message,loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*hp({payload:e}){const{hostedLoginBox:t}=yield So((e=>e.auth));yield co(yi.setState({isLoading:!0}));try{t?yield fo(my.auth.OAuthLogout):yield fo(my.auth.logout)}catch{}yield co(yi.resetState()),yield co(yi.requestAuthorize(!0)),null==e||e()}function*mp({payload:e}){var t;try{yield fo(my.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*bp({user:e,tenants:t}){const n={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield co(yi.setMfaState(n)),yield co(yi.setUser(e)),yield co(yi.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Ap({user:e,tenants:t}){const{loginState:n}=yield So((e=>e.auth));yield co(yi.setUser(e)),yield co(yi.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield So((e=>e.auth.mfaState));if(n.flow===It.Login){const e=yield fo(ap);i===an.smsVerifyCode&&e?yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield Ug()}yield co(yi.setState({isAuthenticated:!0}))}function*kp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Tg);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.preEnrollMFASMSForLogin,n);yield co(yi.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Tp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Pg);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.enrollMFASMSForLogin,n),i=yield fo(my.auth.generateLoginResponseV2,e);yield bp(i),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Pp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Ig);yield co(yi.setLoginState({loading:!0}));try{var i;const e=yield fo(my.auth.preEnrollMFAWebAuthnForLogin,n),o=C({},e.options,{challenge:kt(e.options.challenge),user:C({},e.options.user,{id:kt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Ip(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Lg);yield co(yi.setLoginState({loading:!0}));try{const e=Tt(n.publicKey),i=yield fo(my.auth.enrollMFAWebAuthnForLogin,C({},n,{options:e})),o=yield fo(my.auth.generateLoginResponseV2,i);yield bp(o),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Lp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Eg);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield fo(my.auth.generateLoginResponseV2,e);yield bp(i),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Ep(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,Og);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.preVerifyMFASMSForLogin,n,i);yield co(yi.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Op(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,wg);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.verifyMFASMSForLogin,n,i),o=yield fo(my.auth.generateLoginResponseV2,e);yield Ap(o),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*wp(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,Cg);yield co(yi.setLoginState({loading:!0}));try{var o;const e=yield fo(my.auth.preVerifyMFAWebAuthnForLogin,n,i),a=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Cp(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,Dg);yield co(yi.setLoginState({loading:!0}));try{const e=Tt(i.publicKey),o=yield fo(my.auth.verifyMFAWebAuthnForLogin,n,C({},i,{options:e})),a=yield fo(my.auth.generateLoginResponseV2,o);yield Ap(a),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Dp(){yield ua(yi.requestAuthorize,Jg),yield ua(yi.requestAuthorizeSSR,Qg),yield ua(yi.requestHostedLoginAuthorize,Xg),yield ua(yi.handleHostedLoginCallback,ep),yield ua(yi.preLogin,lp),yield ua(yi.postLogin,gp),yield ua(yi.login,pp),yield ua(yi.logout,hp),yield ua(yi.silentLogout,mp),yield ua(yi.loginWithMfa,Sp),yield ua(yi.recoverMfa,vp),yield ua(yi.quickSmsPasswordlessPreLogin,ip),yield ua(yi.changePhoneNumberWithVerification,tp),yield ua(yi.verifyChangePhoneNumber,np),yield ua(yi.passwordlessPreLogin,op),yield ua(yi.passwordlessPostLogin,rp),yield ua(yi.verifyInviteToken,sp),yield ua(yi.webAuthnPrelogin,yp),yield ua(yi.webAuthnPostLogin,fp),yield ua(yi.webAuthnCreateNewDeviceSession,up),yield ua(yi.webAuthnVerifyNewDeviceSession,dp),yield ua(yi.afterAuthNavigation,Ug),yield ua(yi.getUserIP,qg),yield ua(yi.preEnrollMFASMSForLogin,kp),yield ua(yi.enrollMFASMSForLogin,Tp),yield ua(yi.preEnrollMFAWebAuthnForLogin,Pp),yield ua(yi.enrollMFAWebAuthnForLogin,Ip),yield ua(yi.enrollMFAAuthenticatorAppForLogin,Lp),yield ua(yi.preVerifyMFASMSForLogin,Ep),yield ua(yi.verifyMFASMSForLogin,Op),yield ua(yi.preVerifyMFAWebAuthnForLogin,wp),yield ua(yi.verifyMFAWebAuthnForLogin,Cp)}function*Rp({payload:e}){e&&(yield co(yi.setState({isLoading:!0})));const t=Ky;yield co(yi.loadTenants()),yield co(yi.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Up({payload:{callback:e}}){try{const{ip:t}=ff[0];yield co(yi.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*_p(){yield ua(yi.requestAuthorize,Rp),yield ua(yi.afterAuthNavigation,Ug),yield ua(yi.getUserIP,Up)}const Mp=["callback","samlVendor"],Np=["callback","samlVendor"];function*Fp(){try{var e,t;yield co(yi.setSSOState({loading:!0}));const n=yield fo(my.auth.getSamlConfiguration),i=yield fo(my.auth.getOidcConfiguration),o=yield fo(my.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 co(yi.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield co(yi.setSSOState({error:e.message,loading:!1}))}}function*$p({payload:e}){const t=yield So((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield co(yi.setSSOState({error:void 0,[n]:!0}));try{const i=yield Gy(e[0]),o=yield fo(my.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield co(yi.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield co(yi.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Gp({payload:e}){const{configFile:t,callback:n}=e,i=yield So((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield co(yi.setSSOState({error:void 0,[o]:!0}));try{const e=yield Gy(t),a=yield fo(my.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield co(yi.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield co(yi.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*xp({payload:e}){const{callback:t,samlVendor:n}=e,i=Ii(e,Mp),o=yield So((e=>e.auth.ssoState.samlConfiguration)),a=C({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield co(yi.setSSOState({samlConfiguration:C({},o,a)})));if(yield co(yi.setSSOState({error:void 0,[r]:!0})),e.type===ky.Saml){var s,l;const e=yield fo(my.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=Ny(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 fo(my.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield co(yi.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield co(yi.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*Vp({payload:{callback:e}={}}){const t=yield So((e=>e.auth.ssoState.samlConfiguration));try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(my.auth.validateSamlDomain),yield co(yi.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield co(yi.setSSOState({samlConfiguration:C({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*jp(){try{const e=yield fo(my.auth.getSamlRoles),t=yield fo(my.auth.getSamlRolesGroups);yield co(yi.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield co(yi.setSSOState({error:e.message}))}}function*Wp({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(my.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield uo(e.map((e=>fo(my.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield co(yi.setSSOState({error:e.message}))}}(n)),yield jp(),yield co(yi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield co(yi.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Bp({payload:{callback:e,id:t}}){try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(my.auth.deleteSamlGroup,{id:t}),yield jp(),yield co(yi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield co(yi.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Kp({payload:{group:e,roleIds:t,callback:n}}){try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(my.auth.createSamlGroup,{group:e,roleIds:t}),yield jp(),yield co(yi.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield co(yi.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*zp({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield co(yi.setSSOState({loading:!0})),yield fo(my.auth.oidcPostLoginV2,t),yield fo(Vg),yield co(yi.setSSOState({loading:!1}))}catch(e){var n;yield co(yi.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*qp(){yield la(yi.loadSSOConfigurations,Fp),yield la(yi.saveSSOConfigurations,xp),yield la(yi.saveSSOConfigurationsFile,$p),yield la(yi.saveSSOConfigurationsFileWithCallback,Gp),yield la(yi.validateSSODomain,Vp),yield la(yi.loadSSOAuthorizationRoles,jp),yield la(yi.updateSSOAuthorizationRoles,Wp),yield la(yi.deleteSamlGroup,Bp),yield la(yi.createSamlGroup,Kp),yield la(yi.oidcPostlogin,zp)}function*Hp(){yield co(yi.setSSOState({loading:!0})),yield mt(),yield co(yi.setSSOState({samlConfiguration:Xy,loading:!1,firstLoad:!1}))}function*Jp({payload:e}){const t="saving";yield co(yi.setSSOState({error:void 0,[t]:!0}));const n=C({},yield So((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield co(yi.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Yp({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=Ii(e,Np),r=tf.samlConfiguration,s=C({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield co(yi.setSSOState({samlConfiguration:C({},r,s)})));yield co(yi.setSSOState({error:void 0,[l]:!0})),yield mt(),s.acsUrl=null==Zy||null==(t=Zy.configuration)?void 0:t.acsUrl,s.spEntityId=null==Zy||null==(n=Zy.configuration)?void 0:n.spEntityId;const c=Ny(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 mt(),yield co(yi.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*Qp({payload:{callback:e}={}}){const t=tf.samlConfiguration;yield co(yi.setSSOState({error:void 0,saving:!0})),yield mt(),yield co(yi.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Xp(){yield mt(),yield co(yi.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Zp({payload:{callback:e,authorizationRoles:t}}){yield co(yi.setSSOState({error:void 0,saving:!0})),yield mt(),yield co(yi.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*eS(){yield la(yi.loadSSOConfigurations,Hp),yield la(yi.saveSSOConfigurations,Yp),yield la(yi.saveSSOConfigurationsFile,Jp),yield la(yi.validateSSODomain,Qp),yield la(yi.loadSSOAuthorizationRoles,Xp),yield la(yi.updateSSOAuthorizationRoles,Zp)}const tS=["callback"],nS=["callback","ssoConfigId"],iS=["callback","ssoConfigId"],oS=["callback","ssoConfigId"];function*aS(){try{return yield fo(my.auth.getOidcConfiguration)}catch(e){return null}}function*rS(){try{return yield fo(my.metadata.getSamlMetadata)}catch(e){return null}}function*sS(){try{yield co(yi.setSSOLoader({key:Ay.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield uo([fo(aS),fo(rS)]),n=yield fo(my.auth.getSSOConfigurations);yield co(yi.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield co(yi.setSSOError({key:Ay.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield co(yi.setSSOLoader({key:Ay.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*lS({payload:e}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ii(e,tS),i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield fo(my.auth.createSSOConfiguration,C({},n,{enabled:null!=(o=n.enabled)&&o}));yield co(yi.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION,value:!1}))}}function*cS({payload:e}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Gy(t),o=yield fo(my.auth.createSSOConfigurationByMetadata,{metadata:e});yield co(yi.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*uS({payload:e}){yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Ii(e,nS),o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield fo(my.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield co(yi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield co(yi.setSSOError({key:Ay.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*dS({payload:e}){yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Gy(i),a=yield fo(my.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield co(yi.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield co(yi.setSSOError({key:Ay.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*yS({payload:e}){yield co(yi.setSSOLoader({key:Ay.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(my.auth.deleteSSOConfiguration,t),yield co(yi.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield co(yi.setSSOError({key:Ay.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.DELETE_SSO_CONFIGURATION,value:!1}))}}function*fS({payload:e}){const{callback:t,ssoConfigId:n}=e,i=Ii(e,iS);yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_DOMAIN,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield fo(my.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?C({},t,{domains:[...t.domains,e]}):t));yield co(yi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_DOMAIN,value:!1}))}}function*gS({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield co(yi.setSSOLoader({key:Ay.DELETE_SSO_DOMAIN,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(my.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?C({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield co(yi.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield co(yi.setSSOError({key:Ay.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.DELETE_SSO_DOMAIN,value:!1}))}}function*pS({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield co(yi.setSSOLoader({key:Ay.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(my.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?C({},e,{domains:e.domains.map((e=>e.id===n?C({},e,{validated:!0}):e))}):e));yield co(yi.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield co(yi.setSSOError({key:Ay.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.VALIDATE_SSO_DOMAIN,value:!1}))}}function*SS({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(my.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?C({},e,{roleIds:n}):e));yield co(yi.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield co(yi.setSSOError({key:Ay.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*vS({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_GROUPS,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield uo(t.map((e=>fo(my.auth.deleteSSOGroup,n,e)))),yield uo(e.map((e=>fo(my.auth.createSSOGroup,n,e))));const a=yield fo(my.auth.getSSOGroups,n),r=o.map((e=>e.id===n?C({},e,{groups:a}):e));yield co(yi.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_GROUPS,value:!1}))}}function*hS({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield uo(t.map((t=>fo(my.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_GROUPS,value:!1}))}}function*mS({payload:e}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield fo(ba,t,void 0,{responseType:"plain"}),configMetadata:n};let r,s;i?(r=yield fo(my.auth.updateSSOConfigurationByMetadata,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield fo(my.auth.createSSOConfigurationByMetadata,e),s=[r,...a]),yield co(yi.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*bS({payload:e}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Ii(e,oS),o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield fo(my.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield fo(my.auth.createSSOConfiguration,i),a=[e,...o]),yield co(yi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*AS(){yield la(yi.loadSSOConfigurationsV2,sS),yield la(yi.saveSSOConfigurationV2,lS),yield la(yi.saveSSODomain,fS),yield la(yi.deleteSSODomain,gS),yield la(yi.validateSSODomainV2,pS),yield la(yi.updateSSOConfiguration,uS),yield la(yi.deleteSSOConfiguration,yS),yield la(yi.setSSOGroups,vS),yield la(yi.updateSSOGroups,hS),yield la(yi.setSSODefaultRoles,SS),yield la(yi.saveSSOConfigurationByMetadata,cS),yield la(yi.updateSSOConfigurationByMetadata,dS),yield la(yi.saveSSOConfigurationByUrl,mS),yield la(yi.saveSSOConfigurationByData,bS)}const kS=["callback","profilePictureUrl"],TS=["callback","profilePictureUrl"];function*PS(){yield co(yi.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 fo.apply(void 0,[sa,e,t,n].concat(o))}(3,2e3,my.teams.getProfile),t=yield So((e=>e.auth.user));yi.setUser(C({},t,e)),yield co(yi.setProfileState({profile:e,loading:!1}))}catch(e){yield co(yi.setProfileState({loading:!1,error:e.message}))}}function*IS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Ii(e.payload,kS);yield co(yi.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield So((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 fo(my.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=C({},e,i,{profilePictureUrl:o}),r=yield fo(my.teams.updateProfile,a),s=yield So((e=>e.auth.user));yield co(yi.setUser(C({},s,r))),yield co(yi.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield co(yi.setProfileState({saving:!1,error:e.message,loading:!1})),null==t||t(null,e)}}function*LS({payload:e}){yield co(yi.setProfileState({loading:!0}));try{var t;yield fo(my.teams.changePassword,e),yield co(yi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*ES(){yield ua(yi.loadProfile,PS),yield la(yi.saveProfile,IS),yield la(yi.changePassword,LS)}function*OS(){yield co(yi.setProfileState({loading:!0})),yield mt(),yield co(yi.setUser(C({},Ky,By))),yield co(yi.setProfileState({loading:!1,profile:By}))}function*wS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Ii(e.payload,TS);yield co(yi.setProfileState({saving:!0,error:null}));const o=zy;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=C({},o.profile,i,{profilePictureUrl:a}),s=Ky;yield mt(),yield co(yi.setUser(C({},s,r))),yield co(yi.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*CS({payload:e}){var t;yield co(yi.setProfileState({loading:!0})),yield mt(),yield co(yi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*DS(){yield ua(yi.loadProfile,OS),yield la(yi.saveProfile,wS),yield la(yi.changePassword,CS)}const RS=["callback"],US=["callback"],_S=["callback"],MS=["deviceId","callback"],NS=["deviceId","callback"],FS=["callback"],$S=["deviceId"],GS=["deviceId"],xS=["callback"],VS=["deviceId"],jS=["callback"];function*WS(e){const{step:t}=yield So((e=>e.auth.mfaState));return{step:e.recoveryCode?an.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*BS(){yield co(yi.setMfaState({saving:!0}));try{const{qrCode:e}=yield fo(my.auth.enrollMfa);yield co(yi.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message}))}}function*KS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,RS);yield co(yi.setMfaState({saving:!0}));try{const e=yield So((e=>e.auth.user)),i=yield fo(my.auth.verifyMfa,n),o=yield fo(my.auth.getMFADevices),a=yield WS(i);yield co(yi.setMfaState(C({},a,{mfaDevices:o}))),yield co(yi.setUser(C({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*zS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,US);yield co(yi.setMfaState({loading:!0}));try{const e=yield fo(my.auth.loginWithMfa,n),i={step:an.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield co(yi.setMfaState(i)),yield co(yi.setState({user:e})),yield co(yi.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield co(yi.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*qS({payload:e}){yield co(yi.setMfaState({saving:!0}));try{var t;yield fo(my.auth.disableMfa,e);const n=yield fo(my.auth.getMFADevices);yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*HS({payload:e}){yield co(yi.setMfaState({saving:!0}));try{var t,n;const i=yield fo(my.auth.preEnrollMFAWebAuthn),o=C({},i.options,{challenge:kt(i.options.challenge),user:C({},i.options.user,{id:kt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield co(yi.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*JS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,_S);yield co(yi.setMfaState({saving:!0}));try{const e=Tt(n.publicKey),i=yield fo(my.auth.enrollMFAWebAuthn,C({},n,{options:e})),o=yield fo(my.auth.getMFADevices),a=yield WS(i);yield co(yi.setMfaState(C({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*YS(e){let{payload:{deviceId:t,callback:n}}=e;Ii(e.payload,MS),yield co(yi.setMfaState({saving:!0}));try{var i;const e=yield fo(my.auth.preDisableMFAWebAuthn,t),o=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*QS(e){let{payload:{deviceId:t,callback:n}}=e,i=Ii(e.payload,NS);yield co(yi.setMfaState({saving:!0}));try{const e=Tt(i.publicKey);yield fo(my.auth.disableMFAWebAuthn,t,C({},i,{options:e}));const o=yield fo(my.auth.getMFADevices);yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*XS({payload:e}){yield co(yi.setMfaState({saving:!0}));try{var t;const n=yield fo(my.auth.preEnrollMFASMS,e);yield co(yi.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 co(yi.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*ZS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,FS);yield co(yi.setMfaState({saving:!0}));try{const e=yield fo(my.auth.enrollMFASMS,n),i=yield fo(my.auth.getMFADevices),o=yield WS(e);yield co(yi.setMfaState(C({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*ev(e){let{payload:{deviceId:t}}=e,n=Ii(e.payload,$S);yield co(yi.setMfaState({saving:!0}));try{var i;const e=yield fo(my.auth.preDisableMFASMS,t);yield co(yi.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 co(yi.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*tv(e){let{payload:{deviceId:t}}=e,n=Ii(e.payload,GS);yield co(yi.setMfaState({saving:!0}));try{var i;yield fo(my.auth.disableMFASMS,t,n);const e=yield fo(my.auth.getMFADevices);yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield co(yi.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*nv(){yield co(yi.setMfaState({loading:!0}));try{yield So((e=>e.auth.user));const e=yield fo(my.auth.getMFADevices);yield co(yi.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield co(yi.setMfaState({loading:!1,error:e.message}))}}function*iv(){yield co(yi.setMfaState({loading:!0}));try{const e=(yield fo(my.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield co(yi.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield co(yi.setMfaState({loading:!1,error:e.message}))}}function*ov(){yield la(yi.enrollMfa,BS),yield la(yi.getMFADevices,nv),yield la(yi.getMFAStrategies,iv),yield la(yi.verifyMfa,KS),yield la(yi.disableMfa,qS),yield la(yi.verifyMfaAfterForce,zS),yield la(yi.preDisableMfaSms,ev),yield la(yi.disableMfaSms,tv),yield la(yi.preEnrollMfaSms,XS),yield la(yi.enrollMfaSms,ZS),yield la(yi.preEnrollMfaWebAuthn,HS),yield la(yi.enrollMfaWebAuthn,JS),yield la(yi.preDisableMfaWebAuthn,YS),yield la(yi.disableMfaWebAuthn,QS)}function*av(){yield co(yi.setMfaState({saving:!0})),yield co(yi.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*rv({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt();const n={token:"token",recoveryCode:"recoveryCode"},i={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield co(yi.setMfaState(i)),yield co(yi.setUser(C({},Ky,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*sv(e){let{payload:{callback:t}}=e,n=Ii(e.payload,xS);yield co(yi.setMfaState({loading:!0})),yield mt();const i=C({},n,{recoveryCode:"recoveryCode"}),o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield co(yi.setMfaState(o)),yield mt(),yield co(yi.setUser(C({},Ky,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*lv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt(),yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:C({},n,{authenticators:[]})})),yield co(yi.setUser(C({},Ky))),null==(t=e.callback)||t.call(e,!0)}function*cv(e){let{}=e,t=Ii(e.payload,VS);yield co(yi.setMfaState({saving:!0}));try{var n;yield co(yi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield co(yi.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*uv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt(),yield co(yi.setMfaState({loading:!1,error:void 0,mfaDevices:C({},n,{phones:[]})})),yield co(yi.setUser(C({},Ky))),null==(t=e.callback)||t.call(e,!0)}function*dv({payload:e}){var t;yield co(yi.setMfaState({saving:!0})),yield mt(),yield co(yi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*yv(e){let{payload:{callback:t}}=e;Ii(e.payload,jS);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt();const i={token:"token",recoveryCode:"recoveryCode"},o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield co(yi.setMfaState(o)),yield co(yi.setUser(C({},Ky,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*fv(){yield la(yi.enrollMfa,av),yield la(yi.verifyMfa,rv),yield la(yi.disableMfa,lv),yield la(yi.verifyMfaAfterForce,sv),yield la(yi.preDisableMfaSms,cv),yield la(yi.disableMfaSms,uv),yield la(yi.preEnrollMfaSms,dv),yield la(yi.enrollMfaSms,yv)}const gv=["callback"];function*pv({payload:e}){yield co(yi.setForgotPasswordState({loading:!0}));try{var t;yield fo(my.auth.forgotPassword,e),yield co(yi.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setForgotPasswordState({loading:!1,error:t.message||"Unknown error occurred"})),null==(n=e.callback)||n.call(e,!1,t)}}function*Sv(e){let{payload:{callback:t}}=e,n=Ii(e.payload,gv);yield co(yi.setForgotPasswordState({loading:!0}));try{yield fo(my.auth.resetPassword,n),yield co(yi.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==t||t(!0)}catch(e){yield co(yi.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1,e)}}function*vv({payload:e}){yield co(yi.setForgotPasswordState({loading:!0}));try{const t=yield fo(my.auth.loadPasswordConfig,e);yield co(yi.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield co(yi.setForgotPasswordState({loading:!1,error:e.message}))}}function*hv(){yield ua(yi.forgotPassword,pv),yield ua(yi.resetPassword,Sv),yield ua(yi.loadPasswordConfig,vv)}let mv;!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"}(mv||(mv={}));const bv=["callback","events"],Av=["callback"],kv=["callback"];function*Tv({payload:{userId:e,token:t}}){yield co(yi.setActivateState({loading:!0,step:Nt.activating}));try{const{isAuthenticated:n}=yield So((e=>e.auth));n&&(yield co(yi.silentLogout()));const i=yield fo(my.auth.getActivateAccountStrategy,{userId:e,token:t});yield co(yi.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield co(yi.setActivateState({loading:!1,step:Nt.activatingForm})))}catch(e){yield co(yi.setActivateState({loading:!1,error:e.message}))}}function*Pv(e){let{payload:{callback:t,events:n}}=e,i=Ii(e.payload,bv);yield co(yi.setActivateState({loading:!0}));try{const e=da.onRedirectTo,{routes:a}=yield So((e=>e.auth)),r=yield fo(my.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(Ng(r)){yield co(yi.setActivateState({step:Nt.success}));const t=yield Gg(r);yield co(yi.setState(t)),yield vo(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield co(yi.setActivateState({step:Nt.success}));const{user:e,tenants:t}=yield fo(my.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:vf.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield co(yi.setTenantsState({tenants:t,loading:!1})),yield co(yi.setState({user:e,isAuthenticated:!0})),yield vo(1e3),yield Ug(),yield co(yi.resetActivateState())}null==t||t(!0)}catch(e){yield co(yi.setActivateState({loading:!1,error:e.message}))}}function*Iv({payload:e}){const{callback:t}=e,n=Ii(e,Av);yield co(yi.setActivateStrategyState({loading:!0}));try{const e=yield fo(my.auth.getActivateAccountStrategy,n);yield co(yi.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield co(yi.setActivateStrategyState({loading:!1,error:e.message}))}}function*Lv({payload:e}){const{callback:t}=e,n=Ii(e,kv);yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:n.email})),yield co(yi.setActivateState({loading:!0}));try{yield fo(my.auth.resendActivationEmail,n),yield co(yi.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield co(yi.setActivateState({loading:!1,error:e.message})),yield co(yi.setTeamError({key:mv.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:!1}))}function*Ev(){yield ua(yi.activateAccount,Pv),yield ua(yi.preActivateAccount,Tv),yield ua(yi.getActivateAccountStrategy,Iv),yield ua(yi.resendActivationEmail,Lv)}function*Ov({payload:e}){if(e.token&&e.userId)try{yield co(yi.setAcceptInvitationState({error:void 0,step:xt.pending})),yield fo(my.auth.acceptInvitation,e),yield co(yi.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:xt.success}}))}catch(e){yield co(yi.setAcceptInvitationState({step:xt.failed,error:e.message}))}else yield co(yi.setAcceptInvitationState({error:void 0,step:xt.invalid}))}function*wv(){yield ua(yi.acceptInvitation,Ov)}var Cv,Dv=new Uint8Array(16);function Rv(){if(!Cv&&!(Cv="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 Cv(Dv)}for(var Uv=/^(?:[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,_v=function(e){return"string"==typeof e&&Uv.test(e)},Mv=[],Nv=0;Nv<256;++Nv)Mv.push((Nv+256).toString(16).substr(1));var Fv=function(e,t,n){var i=(e=e||{}).random||(e.rng||Rv)();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=(Mv[e[t+0]]+Mv[e[t+1]]+Mv[e[t+2]]+Mv[e[t+3]]+"-"+Mv[e[t+4]]+Mv[e[t+5]]+"-"+Mv[e[t+6]]+Mv[e[t+7]]+"-"+Mv[e[t+8]]+Mv[e[t+9]]+"-"+Mv[e[t+10]]+Mv[e[t+11]]+Mv[e[t+12]]+Mv[e[t+13]]+Mv[e[t+14]]+Mv[e[t+15]]).toLowerCase();if(!_v(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let $v,Gv;!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"}($v||($v={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Gv||(Gv={}));const xv=["callback"],Vv=["roles"],jv=["callback"],Wv=["callback","profileImage"],Bv=["callback"],Kv=["callback","userId"],zv=["callback"],qv=["callback"],Hv=["callback"],Jv=["callback"],Yv=["callback"],Qv=["callback"],Xv=["callback"],Zv=["callback","profileImage"],eh=["callback"],th=["callback"],nh=["callback"],ih=["callback"],oh=["callback"],ah=["callback"],rh=()=>So((e=>e.auth.teamState));function*sh(){try{const{groups:e}=yield fo(my.groups.getGroups,{_groupsRelations:Gv.roles});return e}catch(e){return[]}}function*lh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield rh(),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 co(yi.setTeamLoader({key:mv.USERS,value:!a})),yield co(yi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o},a]=yield uo([fo(my.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),fo(my.teams.loadAvailableRoles),fo(my.teams.loadAvailablePermissions),fo(sh)]),s=e.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>a.filter((t=>t.id===e.id)))).flat();return C({},e,{groups:n})}));yield co(yi.setTeamState({users:s,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield co(yi.setTeamError({key:mv.USERS,value:e.message})),yield co(yi.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield co(yi.setTeamLoader({key:mv.USERS,value:!1}))}function*ch({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield rh(),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 co(yi.setTeamLoader({key:mv.USERS,value:!r})),yield co(yi.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield uo([fo(my.subTenants.loadAllUsers,C({},c)),fo(my.teams.loadAvailableRoles),fo(my.teams.loadAvailablePermissions)]);yield co(yi.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield co(yi.setTeamError({key:mv.USERS,value:e.message})),yield co(yi.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield co(yi.setTeamLoader({key:mv.USERS,value:!1}))}function*uh({payload:e}){yield co(yi.setTeamLoader({key:mv.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield uo([fo(my.teams.loadAvailableRoles),fo(my.teams.loadAvailablePermissions)]);yield co(yi.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 co(yi.setTeamError({key:mv.ROLES_AND_PERMISSIONS,value:t.message}))}yield co(yi.setTeamLoader({key:mv.ROLES_AND_PERMISSIONS,value:!0}))}function*dh({payload:e}){const{callback:t}=e,n=Ii(e,xv),i=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield fo(my.teams.addUser,n),{roles:a}=e,r=C({},Ii(e,Vv),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield co(yi.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*yh({payload:e}){const{callback:t}=e,n=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield co(yi.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield fo(my.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 co(yi.loadUsers(r)),yield co(yi.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*fh({payload:e}){const{callback:t}=e,n=Ii(e,jv),i=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{yield fo(my.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield fo(my.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield co(yi.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*gh({payload:e}){const{callback:t}=e,n=Ii(e,Wv),{id:i}=n,o=yield rh(),a=o.users.find((e=>e.id===n.id));yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:i||""})),yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})})),yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?C({},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 fo(my.teams.updateUser,n);null==t||t(e),yield co(yi.setTeamState({users:o.users.map((t=>t.id===e.id?C({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:!1}))}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?C({},e,a):e))})),yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*ph({payload:e}){const{callback:t}=e,n=Ii(e,Bv),i=yield rh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})}));try{yield fo(my.teams.deleteUser,n),null==t||t(!0),yield co(yi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Sh({payload:e}){const{callback:t,userId:n}=e,i=Ii(e,Kv),o=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})}));try{yield fo(my.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return C({},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 co(yi.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[C({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*vh({payload:e}){const{callback:t}=e,n=Ii(e,zv),i=yield rh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})}));try{yield fo(my.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield co(yi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*hh({payload:e}){const{callback:t}=e,n=Ii(e,qv);yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield fo(my.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:!1}))}function*mh({payload:e}){const{callback:t}=e,n=Ii(e,Hv);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email}));try{yield fo(my.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*bh({payload:e}){const{callback:t}=e,n=Ii(e,Jv);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email}));try{yield fo(my.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*Ah({payload:e}){const{callback:t}=e,n=Ii(e,Yv);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email}));try{yield fo(my.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*kh(){yield co(yi.setTeamError({key:mv.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield fo(my.teams.getInviteLinkConfiguration);yield co(yi.setTeamState({inviteTokenState:C({},e)}))}catch(e){yield co(yi.setTeamError({key:mv.CONFIG_TOKEN_LINK,value:e.message}))}}function*Th(){yield co(yi.setTeamError({key:mv.GET_TOKEN_LINK,value:!1}));try{yield fo(kh);const e=yield fo(my.teams.getInviteUserLink),{inviteTokenState:t}=yield rh();yield co(yi.setTeamState({inviteTokenState:C({},t,e)}))}catch(e){yield co(yi.setTeamError({key:mv.GET_TOKEN_LINK,value:e.message}))}}function*Ph({payload:{callback:e}}){yield co(yi.setTeamError({key:mv.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield rh();try{const n=yield fo(my.teams.createInviteUserLink,{expiresInMinutes:43200});yield co(yi.setTeamState({inviteTokenState:C({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield co(yi.setTeamError({key:mv.CREATE_TOKEN_LINK,value:t.message}))}}function*Ih({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield rh();yield co(yi.setTeamError({key:mv.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield fo(my.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield co(yi.setTeamState({inviteTokenState:C({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield co(yi.setTeamError({key:mv.UPDATE_TOKEN_LINK,value:t.message}))}}function*Lh({payload:e}){const{callback:t}=null!=e?e:{};yield co(yi.setTeamError({key:mv.DELETE_TOKEN_LINK,value:!1}));try{yield fo(my.teams.deleteInviteUserLink),yield co(yi.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Eh({payload:e}){yield co(yi.setTeamState({addUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*Oh({payload:e}){const t=yield rh(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield co(yi.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*wh({payload:e}){yield co(yi.setTeamState({deleteUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*Ch({payload:e}){const t=yield rh(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield co(yi.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Dh(){yield ca(yi.loadUsers,lh),yield ca(yi.loadAllSubTenantsUsers,ch),yield ca(yi.loadRoles,uh),yield la(yi.addUser,dh),yield la(yi.addUsersBulk,yh),yield la(yi.addUserToSubTenants,fh),yield la(yi.updateUser,gh),yield la(yi.setUserRolesForSubTenants,Sh),yield la(yi.deleteUser,ph),yield la(yi.deleteUserFromSubTenants,vh),yield la(yi.resendActivationLink,hh),yield la(yi.resendInvitationLink,mh),yield la(yi.resendInvitationEmail,bh),yield la(yi.resendInvitationLinkToAllSubTenants,Ah),yield la(yi.getInvitationLink,Th),yield la(yi.createInvitationLink,Ph),yield la(yi.updateInvitationLink,Ih),yield la(yi.deleteInvitationLink,Lh),yield la(yi.openAddUserDialog,Eh),yield la(yi.closeAddUserDialog,Oh),yield la(yi.openDeleteUserDialog,wh),yield la(yi.closeDeleteUserDialog,Ch)}function*Rh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield rh(),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 co(yi.setTeamLoader({key:mv.USERS,value:!a})),yield co(yi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d})),yield mt(),yield co(yi.setTeamState({users:sf,totalPages:2,totalItems:10,roles:ef,permissions:nf})),yield co(yi.setTeamLoader({key:mv.USERS,value:!1})),null==r||r(sf)}function*Uh({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield rh(),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 co(yi.setTeamLoader({key:mv.USERS,value:!r})),yield co(yi.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield mt(),yield co(yi.setTeamState({allUsers:lf,totalPages:2,totalItems:10,roles:ef,permissions:nf})),yield co(yi.setTeamLoader({key:mv.USERS,value:!1})),null==s||s(lf)}function*_h({payload:e}){var t;yield co(yi.setTeamLoader({key:mv.ROLES_AND_PERMISSIONS,value:!0})),yield mt(),yield co(yi.setTeamState({roles:ef,permissions:nf})),yield co(yi.setTeamLoader({key:mv.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:ef,permissions:nf})}function*Mh({payload:e}){const{callback:t}=e,n=Ii(e,Qv),i=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield mt();const o=C({},af,{groups:[]},n,{id:`${Fv()}`});null==t||t(o),yield co(yi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Nh({payload:e}){const{callback:t}=e,n=Ii(e,Xv),i=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield mt();const o=C({},af,n,{id:`${Fv()}`});yield co(yi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*Fh({payload:e}){var t;const{callback:n}=e,i=Ii(e,Zv),{id:o}=i,a=yield rh(),r=a.users.find((e=>e.id===i.id));yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:o||""})),yield co(yi.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0})})),yield co(yi.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?C({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield mt();const s=C({},r,i);null==n||n(s),yield co(yi.setTeamState({users:a.users.map((e=>e.id===s.id?C({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:!1}))}function*$h({payload:e}){const{callback:t}=e,n=Ii(e,eh),i=yield rh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield co(yi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Gh({payload:e}){const{callback:t}=e,n=Ii(e,th),i=yield rh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield co(yi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*xh({payload:e}){const{callback:t}=e,n=Ii(e,nh);yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:n.userId})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:!1}))}function*Vh({payload:e}){const{callback:t}=e,n=Ii(e,ih);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*jh({payload:e}){const{callback:t}=e,n=Ii(e,oh);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*Wh({payload:e}){const{callback:t}=e,n=Ii(e,ah);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*Bh(){yield ca(yi.loadUsers,Rh),yield ca(yi.loadAllSubTenantsUsers,Uh),yield ca(yi.loadRoles,_h),yield la(yi.addUser,Mh),yield la(yi.addUserToSubTenants,Nh),yield la(yi.updateUser,Fh),yield la(yi.deleteUser,$h),yield la(yi.deleteUserFromSubTenants,Gh),yield la(yi.resendActivationLink,xh),yield la(yi.resendInvitationLink,Vh),yield la(yi.resendInvitationEmail,jh),yield la(yi.resendInvitationLinkToAllSubTenants,Wh),yield la(yi.openAddUserDialog,Eh),yield la(yi.closeAddUserDialog,Oh),yield la(yi.openDeleteUserDialog,wh),yield la(yi.closeDeleteUserDialog,Ch)}const Kh=["authorizationUrl"],zh=["events","url"];function*qh(){try{yield co(yi.setSocialLoginsState({loading:!0}));const e=yield fo(my.auth.getSocialLoginProviders);yield co(yi.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield co(yi.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Hh(){try{const e=yield So((e=>e.root.context));yield co(yi.setSocialLoginsState({loading:!0}));const t=yield fo(my.auth.getSocialLoginProvidersV2),{providers:n}=yield fo(my.auth.getCustomSocialLoginProvidersV1),i=t.map((t=>{let{authorizationUrl:n}=t,i=Ii(t,Kh);const o=va(e,null!=n?n:"");return C({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield co(yi.setSocialLoginsState({socialLoginsConfigV2:i,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield co(yi.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Jh(e){let{payload:{events:t,url:n}}=e,i=Ii(e.payload,zh);try{yield co(yi.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield fo(my.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:hf.SOCIAL_LOGIN,createdAt:new Date,id:s,socialProvider:i.provider,tenantId:l}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:vf.SOCIAL_LOGIN,createdAt:new Date,id:s,url:n,tenantId:l,name:c})),s&&localStorage.setItem("userId",s),yield co(yi.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield So((e=>e.auth));e?yield fo(Wg):yield fo(Kg)}(),localStorage.removeItem("register-quick-login"),yield co(yi.setSocialLoginsState({loading:!1}))}catch(e){var r;yield co(yi.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*Yh({payload:e}){yield co(yi.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*Qh(){yield ua(yi.loadSocialLoginsConfiguration,qh),yield ua(yi.loadSocialLoginsConfigurationV2,Hh),yield ua(yi.loginViaSocialLogin,Jh),yield ca(yi.setSocialLoginError,Yh)}let Xh;function*Zh({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield So((e=>e.auth.apiTokensState));try{let e,a;yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield fo(my.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield fo(my.auth.updateUserApiTokensData,{description:t}),yield co(yi.setApiTokensState({showAddTokenDialog:!1})),yield vo(200),yield co(yi.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield co(yi.setApiTokensError({key:Xh.ADD_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*em({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield So((e=>e.auth.apiTokensState));try{let e,r;yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield fo(my.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield fo(my.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield co(yi.setApiTokensState({showAddTokenDialog:!1})),yield vo(200),yield co(yi.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===i?e.clientId:void 0}})),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield co(yi.setApiTokensError({key:Xh.ADD_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*tm({payload:e}){const{apiTokensDataUser:t}=yield So((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!0})),n?(yield fo(my.auth.deleteUserAccessToken,{id:e}),yield co(yi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield fo(my.auth.deleteUserApiToken,{tokenId:e}),yield co(yi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}catch(e){yield co(yi.setApiTokensError({key:Xh.DELETE_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}}function*nm({payload:e}){const{apiTokensDataTenant:t}=yield So((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!0})),n?(yield fo(my.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield fo(my.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield co(yi.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}catch(e){yield co(yi.setApiTokensError({key:Xh.DELETE_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}}function*im({payload:e}){null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield uo([fo(my.auth.getUserApiTokensData),fo(my.auth.getTenantApiTokensData)]);yield co(yi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setApiTokensError({key:Xh.LOAD_API_TOKENS,value:t.message})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*om({payload:e}){null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=fo(my.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=fo(my.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield co(yi.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield co(yi.setApiTokensError({key:Xh.LOAD_API_TOKENS,value:t.message})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*am({payload:e}){null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=fo(my.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=fo(my.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 co(yi.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield co(yi.setApiTokensError({key:Xh.LOAD_API_TOKENS,value:t.message})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*rm(){yield ua(yi.loadApiTokens,im),yield ua(yi.loadUserApiTokens,om),yield ua(yi.loadTenantApiTokens,am),yield la(yi.addUserApiToken,Zh),yield la(yi.addTenantApiToken,em),yield ca(yi.deleteTenantApiToken,nm),yield ca(yi.deleteUserApiToken,tm)}function*sm({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield So((e=>e.auth.apiTokensState)),a=C({},jy,{description:t,roleIds:n,clientId:`CLIENT_ID_${Fv()}`});yield co(yi.setApiTokensState({showAddTokenDialog:!1})),yield vo(200),yield co(yi.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield vo(200),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*lm({payload:e}){yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!0})),yield vo(200);const t=[jy];yield co(yi.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}function*cm({payload:e}){var t;null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));const n=[Vy],i=[jy];yield co(yi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield vo(200),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*um({payload:e}){var t;null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));const n=[Vy];yield co(yi.setApiTokensState({apiTokensDataUser:n})),yield vo(200),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*dm({payload:e}){var t;null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));const n=[jy];yield co(yi.setApiTokensState({apiTokensDataTenant:n})),yield vo(200),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*ym(){yield ua(yi.loadApiTokens,cm),yield ua(yi.loadUserApiTokens,um),yield ua(yi.loadTenantApiTokens,dm),yield la(yi.addTenantApiToken,sm),yield ca(yi.deleteTenantApiToken,lm)}function*fm({payload:e}){try{var t;yield co(yi.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield So((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield fo(my.accountSettings.updateSettings,C({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield co(yi.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield co(yi.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*gm({payload:e}){yield co(yi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield fo(my.accountSettings.getSettings);yield co(yi.setAccountSettingsState(C({},e,{loading:!1})))}catch(e){yield co(yi.setAccountSettingsState({loading:!1,error:e.message}))}}function*pm(){yield ua(yi.saveAccountSettings,fm),yield ua(yi.loadAccountSettings,gm)}function*Sm({payload:e}){var t;yield co(yi.setAccountSettingsState({loading:!0})),yield mt();const{accountSettingsState:n}=yield So((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=C({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield co(yi.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*vm({payload:e}){yield co(yi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield mt(),yield co(yi.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*hm(){yield ua(yi.saveAccountSettings,Sm),yield ua(yi.loadAccountSettings,vm)}function*mm({payload:{tenantId:e,callback:t}}){yield co(yi.setState({isLoading:!0}));try{yield fo(my.tenants.switchTenant,{tenantId:e}),yield fo(Vg),(null==t?void 0:t(!0))||(yield co(yi.setState({isLoading:!1})))}catch(e){yield co(yi.setState({isLoading:!1})),null==t||t(!1,e)}}function*bm({payload:e}){yield co(yi.setTenantsState({loading:!0}));try{var t;const n=yield fo(my.tenants.getTenants);yield co(yi.setTenantsState({tenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield co(yi.setTenantsState({loading:!1}))}}function*Am({payload:e}){yield co(yi.setTenantsState({loading:!0}));try{var t;const n=yield fo(my.tenants.getSubTenants);yield co(yi.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*km({payload:e}){yield co(yi.setTenantsState({loading:!0}));try{var t;const n=yield fo(my.tenants.getSubTenantsAsTree);yield co(yi.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Tm(){yield la(yi.loadTenants,bm),yield la(yi.loadSubTenants,Am),yield la(yi.switchTenant,mm),yield la(yi.loadSubTenantsTree,km)}function*Pm(){yield co(yi.setTenantsState({loading:!0})),yield mt(),yield co(yi.setTenantsState({tenants:cf,loading:!1}))}function*Im(){yield la(yi.loadTenants,Pm)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(Xh||(Xh={}));const Lm=["callback"],Em=["callback"],Om=["callback"],wm=["callback"],Cm=["callback"];function*Dm({payload:e}){var t;yield co(yi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield uo([fo(my.roles.getRoles),fo(my.roles.getPermissions),fo(my.roles.getPermissionCategories)]),[t,n,i]=e;yield co(yi.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield co(yi.setRolesState({error:e.message,loading:!1}))}}function*Rm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Lm);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(my.roles.addRole,n),i=yield fo(my.roles.getRoles);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Um(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Em);yield co(yi.setRolesState({saving:!0}));try{yield fo(my.roles.deleteRole,n),yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*_m(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Om);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(my.roles.updateRole,n);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Mm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,wm);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(my.roles.attachPermissionsToRole,n);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Nm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Cm);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(my.roles.attachPermissionToRoles,n);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Fm(){yield ua(yi.loadRolesAndPermissions,Dm),yield la(yi.addRole,Rm),yield la(yi.deleteRole,Um),yield la(yi.updateRole,_m),yield la(yi.attachPermissionsToRole,Mm),yield la(yi.attachPermissionToRoles,Nm)}function*$m({payload:e}){var t;yield co(yi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield co(yi.setRolesState({roles:Wy,loading:!1}))}catch(e){yield co(yi.setRolesState({error:e.message,loading:!1}))}}function*Gm(){yield ua(yi.loadRolesAndPermissions,$m)}const xm=["callback"],Vm=["callback"],jm=["callback"];function*Wm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,xm);yield co(yi.setResetPhoneNumberState({loading:!0}));try{const e=yield fo(my.auth.resetPhoneNumber,n);yield co(yi.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),yield co(yi.setLoginState({email:n.email}))}catch(e){yield co(yi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Bm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Vm);yield co(yi.setResetPhoneNumberState({loading:!0}));try{const e=yield fo(my.auth.verifyResetPhoneNumber,n);yield co(yi.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Ht.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield co(yi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Km(e){let{payload:{callback:t}}=e,n=Ii(e.payload,jm);yield co(yi.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield So((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield fo(my.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield co(yi.setLoginState({step:Pt.loginWithSmsOtc})),yield co(yi.passwordlessPreLogin({type:xr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield co(yi.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*zm(){yield ua(yi.resetPhoneNumber,Wm),yield ua(yi.verifyResetPhoneNumber,Bm),yield ua(yi.changePhoneNumber,Km)}function*qm(){yield co(yi.setSessionsState({loading:!0,error:null}));try{const e=yield fo(my.auth.getCurrentUserSessions);yield co(yi.setSessionsState({sessions:e,loading:!1}))}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Hm(){yield co(yi.setSessionsState({loading:!0,error:null}));try{const e=yield fo(my.auth.getCurrentUserSession);yield co(yi.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Jm({payload:{id:e}}){yield co(yi.setSessionsState({loading:!0,error:null}));try{yield fo(my.auth.deleteSessionForUser,e),yield co(yi.loadUserSessions())}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Ym({payload:{callback:e,userId:t}}){yield co(yi.setSessionsState({loading:!0,error:null}));try{yield fo(my.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield co(yi.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Qm(){yield co(yi.setSessionsState({loading:!0,error:null}));try{yield fo(my.auth.deleteAllSessionsForUser),yield co(yi.loadUserSessions())}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Xm(){yield ca(yi.loadUserSessions,qm),yield ca(yi.deleteUserSession,Jm),yield ca(yi.deleteAllUserSessions,Qm),yield ca(yi.loadCurrentUserSession,Hm),yield la(yi.revokeUserSessions,Ym)}function*Zm(){yield co(yi.setSessionsState({loading:!0,error:null})),yield co(yi.setSessionsState({sessions:uf,loading:!1}))}function*eb({payload:{id:e}}){yield co(yi.setSessionsState({loading:!0,error:null}));const t=(yield So((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield co(yi.setSessionsState({sessions:t,loading:!1}))}function*tb(){yield co(yi.setSessionsState({loading:!0,error:null}));const e=uf.filter((e=>e.current));yield co(yi.setSessionsState({sessions:e,loading:!1}))}function*nb(){yield ca(yi.loadUserSessions,Zm),yield ca(yi.deleteUserSession,eb),yield ca(yi.deleteAllUserSessions,tb)}const ib=["callback"],ob=["callback"];function*ab(){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield fo(my.auth.getSessionConfigurations);yield co(yi.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*rb({payload:e}){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ii(e,ib);yield fo(my.auth.createOrUpdateSessionConfigrations,n),yield co(yi.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield co(yi.setSessionsPolicyState({error:e,loading:!1}))}}function*sb(){yield ua(yi.loadSessionsPolicy,ab),yield ca(yi.createOrUpdateSessionsPolicy,rb)}function*lb(){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));const e=yield So((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:df}));yield co(yi.setSessionsPolicyState(C({},e,{loading:!1})))}function*cb({payload:e}){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ii(e,ob);null==t||t(!0),yield co(yi.setSessionsPolicyState({configurations:n,loading:!1}))}function*ub(){yield ua(yi.loadSessionsPolicy,lb),yield ca(yi.createOrUpdateSessionsPolicy,cb)}const db=["callback"],yb=["callback"],fb=["callback"],gb=["callback"],pb=["callback"],Sb=["callback"],vb=["callback"],hb=["callback"],mb=()=>So((e=>e.auth.restrictionsState.ipRestrictions)),bb=()=>So((e=>e.auth.restrictionsState.emailDomainRestrictions));function*Ab(){yield co(yi.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield fo(my.auth.getDomainRestrictionsConfig),t=(yield fo(my.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield co(yi.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield co(yi.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*kb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,db);yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield bb();try{var o;yield fo(my.auth.createDomainRestriction,n);const e=(yield fo(my.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield co(yi.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 co(yi.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Tb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,yb);yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield fo(my.auth.updateDomainRestrictionConfig,n),i=(yield fo(my.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield co(yi.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Pb({payload:{id:e}}){yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield bb();try{var n;yield fo(my.auth.deleteDomainRestriction,e);const i=(yield fo(my.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield co(yi.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield co(yi.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Ib=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:xn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*Lb(){yield co(yi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield mb(),t=yield fo(my.auth.getIPRestrictionsConfig),n=Ib({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield fo(my.auth.getIPRestrictions,n);yield co(yi.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield co(yi.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Eb(){try{const{valid:e}=yield fo(my.auth.testCurrentIpInAllowList);yield co(yi.setIpRestrictionsState({userIpValid:e}))}catch(e){yield co(yi.setIpRestrictionsState({error:e.message}))}}function*Ob({payload:{callback:e}}){yield co(yi.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield So((e=>e.auth.userIp));yield uo([fo(my.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:xn.ALLOW}),fo(my.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield mb(),i=Ib(n.pagination),{items:o,_metadata:{totalPages:a}}=yield fo(my.auth.getIPRestrictions,i);yield co(yi.setIpRestrictionsState({data:{config:{isActive:!0,strategy:xn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield co(yi.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*wb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,fb);yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const i=yield mb();try{var o,a;yield fo(my.auth.createIPRestriction,n);const e=yield mb(),r=Ib(e.pagination),{items:s,_metadata:{totalPages:l}}=yield fo(my.auth.getIPRestrictions,r);yield Eb(),yield co(yi.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:xn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Cb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,gb);yield co(yi.setIpRestrictionsState({saving:!0,error:null}));try{yield fo(my.auth.updateIPRestrictionConfig,n);const e=yield mb(),i=yield fo(my.auth.getIPRestrictionsConfig),o=Ib(C({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield fo(my.auth.getIPRestrictions,o);yield Eb(),yield co(yi.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Db({payload:{id:e,callback:t}}){yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const n=yield mb();try{var i;yield fo(my.auth.deleteIPRestriction,e);const o=yield mb(),a=Ib(o.pagination),{items:r,_metadata:{totalPages:s}}=yield fo(my.auth.getIPRestrictions,a);yield Eb(),yield co(yi.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Rb(){yield ua(yi.loadIpRestrictions,Lb),yield ua(yi.loadEmailDomainRestrictions,Ab),yield la(yi.saveIpRestriction,wb),yield la(yi.saveIpRestrictionsConfig,Cb),yield la(yi.deleteIpRestriction,Db),yield la(yi.checkIfUserIpValid,Eb),yield la(yi.addCurrentUserIpAndActivate,Ob),yield la(yi.saveEmailDomainRestriction,kb),yield la(yi.saveEmailDomainRestrictionsConfig,Tb),yield la(yi.deleteEmailDomainRestriction,Pb)}function*Ub(){yield co(yi.setIpRestrictionsState({loading:!0,error:null})),yield co(yi.setIpRestrictionsState({data:{restrictions:ff.filter((e=>e.strategy===yf.strategy)),config:yf},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*_b(){yield co(yi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield mb(),t=ff[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield co(yi.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield co(yi.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Mb(e){var t,n,i;let{payload:{callback:o}}=e,a=Ii(e.payload,pb);yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const r=yield mb(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield co(yi.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:xn.ALLOW},restrictions:[...s,C({},a,{createdAt:new Date,updatedAt:new Date,id:Fv(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*Nb(e){var t,n,i;let{payload:{callback:o}}=e,a=Ii(e.payload,Sb);const r=yield mb();yield co(yi.setIpRestrictionsState({saving:!0,error:null})),yield co(yi.setIpRestrictionsState({data:{config:C({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield co(yi.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*Fb({payload:{id:e,callback:t}}){var n;yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const i=yield mb();yield co(yi.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*$b(){yield co(yi.setEmailDomainRestrictionsState({loading:!0,error:null})),yield co(yi.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:xn.ALLOW}],config:{active:!0,listType:xn.ALLOW,blockPublicDomains:!1}}}))}function*Gb(e){var t,n;let{payload:{callback:i}}=e,o=Ii(e.payload,vb);const a=yield bb();yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==i||i(!0),yield co(yi.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)||[],C({},o,{id:Date.now().toString()})]},saving:!1}))}function*xb(e){var t;let{payload:{callback:n}}=e,i=Ii(e.payload,hb);const o=yield bb();yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==n||n(!0),yield co(yi.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||xn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*Vb({payload:{id:e}}){var t,n;const i=yield bb();yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),yield co(yi.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*jb(){yield ua(yi.loadIpRestrictions,Ub),yield ua(yi.loadEmailDomainRestrictions,$b),yield la(yi.saveIpRestriction,Mb),yield la(yi.saveIpRestrictionsConfig,Nb),yield la(yi.deleteIpRestriction,Fb),yield la(yi.checkIfUserIpValid,_b),yield la(yi.saveEmailDomainRestriction,Gb),yield la(yi.saveEmailDomainRestrictionsConfig,xb),yield la(yi.deleteEmailDomainRestriction,Vb)}const Wb=["callback"],Bb=["id"];function*Kb(e){const{count:t}=yield fo(my.directory.countConfigurationUsers,e.id);return C({},e,{count:t})}function*zb(){yield co(yi.setProvisioningState({loading:!0,error:null}));try{const e=yield fo(my.directory.getConfigs),t=yield uo(e.map((e=>Kb(e))));yield co(yi.setProvisioningState({connections:t,loading:!1}))}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1}))}}function*qb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Wb);yield co(yi.setProvisioningState({loading:!0,error:null}));try{const e=yield fo(my.directory.createConfiguration,n),i=yield fo(my.directory.getConfigs),o=yield uo(i.map((e=>Kb(e))));yield co(yi.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1}))}}function*Hb(e){let{payload:{id:t}}=e,n=Ii(e.payload,Bb);yield co(yi.setProvisioningState({loading:!0,error:null}));try{yield fo(my.directory.updateConfiguration,t,n);const e=yield fo(my.directory.getConfigs),i=yield uo(e.map((e=>Kb(e))));yield co(yi.setProvisioningState({connections:i,loading:!1}))}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1}))}}function*Jb({payload:{id:e,callback:t}}){yield co(yi.setProvisioningState({loading:!0,error:null}));try{yield fo(my.directory.deleteConfiguration,e);const n=yield fo(my.directory.getConfigs),i=yield uo(n.map((e=>Kb(e))));yield co(yi.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*Yb(){yield ua(yi.loadProvisionConnections,zb),yield la(yi.createProvisionConnection,qb),yield la(yi.deleteProvisionConnection,Jb),yield la(yi.updateProvisionConnection,Hb)}const Qb=["callback","events"];function*Xb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Qb);yield co(yi.setImpersonateState({loading:!0}));try{yield fo(my.impersonate.impersonate,n),yield co(yi.setImpersonateState({step:ri.success})),yield vo(1e3),yield Ug(),yield co(yi.resetImpersonateState()),null==t||t(!0)}catch(e){yield co(yi.setImpersonateState({loading:!1,error:e.message}))}}function*Zb(){yield ua(yi.impersonate,Xb)}function*eA({payload:e}){const{callback:t,deviceId:n}=e;yield co(yi.setPasskeysState({loading:!0}));try{yield fo(my.auth.deleteWebAuthnDevice,n);const{devices:e}=yield So((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield co(yi.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setPasskeysState({loading:!1,error:e.message||null})),null==t||t(null,e.message)}}function*tA(){yield co(yi.setPasskeysState({loading:!0}));try{const{devices:e}=yield fo(my.auth.getWebAuthnDevices);yield co(yi.setPasskeysState({devices:e,loading:!1}))}catch(e){yield co(yi.setPasskeysState({loading:!1,error:e.message||null}))}}function*nA(){yield la(yi.loadWebAuthnDevices,tA),yield la(yi.deleteWebAuthnDevice,eA)}const iA=["roleIds","userIds"],oA=()=>So((e=>e.auth.groupsState));function*aA({payload:e}){const t=$v.GET_TEAM_USERS;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield fo(my.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield co(yi.setGroupsState({teamUsers:n}))}catch(e){yield co(yi.setUsersGroupsError({key:t,value:e.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*rA({payload:e}){const t=$v.GET_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield fo(my.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:Gv.rolesAndUsers});yield co(yi.setGroupsState({selectedGroup:n}))}catch(e){yield co(yi.setUsersGroupsError({key:t,value:e.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*sA(){const e=$v.GET_GROUPS,t=yield oA();yield co(yi.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield fo(my.groups.getGroups,{_groupsRelations:Gv.rolesAndUsers});yield co(yi.setGroupsState(C({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield co(yi.setUsersGroupsError({key:e,value:t.message}))}finally{yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}}function*lA({payload:e}){const t=$v.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=Ii(e,iA);yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield fo(my.groups.createGroup,C({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield co(yi.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield co(yi.addRolesToGroup({groupId:r.id,roleIds:n}))),yield co(yi.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*cA({payload:e}){const t=$v.UPDATE_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.updateGroup,e),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*uA({payload:e}){const t=$v.DELETE_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.deleteGroup,e.groupId),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1,n.message)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*dA({payload:e}){const t=$v.ADD_ROLES_TO_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*yA({payload:e}){const t=$v.DELETE_ROLES_FROM_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*fA({payload:e}){const t=$v.ADD_USERS_TO_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield co(yi.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 co(yi.setUsersGroupsError({key:t,value:n.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*gA({payload:e}){const t=$v.DELETE_USERS_FROM_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*pA(){const e=$v.GET_GROUP_CONFIGURATION;yield co(yi.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield fo(my.groups.getGroupConfiguration);yield co(yi.setGroupsState({groupsConfiguration:t}))}catch(t){yield co(yi.setUsersGroupsError({key:e,value:t.message}))}finally{yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}}function*SA({payload:e}){const t=$v.UPDATE_GROUP_CONFIGURATION;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{yield fo(my.groups.updateGroupConfiguration,e),yield co(yi.getGroupConfiguration())}catch(e){yield co(yi.setUsersGroupsError({key:t,value:e.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*vA(){yield ca(yi.loadGroups,sA),yield ca(yi.getGroupById,rA),yield ca(yi.createGroup,lA),yield ca(yi.updateGroup,cA),yield ca(yi.deleteGroup,uA),yield ca(yi.addRolesToGroup,dA),yield ca(yi.deleteRolesFromGroup,yA),yield ca(yi.addUsersToGroup,fA),yield ca(yi.deleteUsersFromGroup,gA),yield ca(yi.getGroupConfiguration,pA),yield ca(yi.updateGroupConfiguration,SA),yield ca(yi.getTeamUsers,aA)}function*hA(){const e=$v.GET_GROUPS;yield co(yi.setUsersGroupsLoader({key:e,value:!0}));const t=Sf;yield co(yi.setGroupsState({groups:t})),yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}function*mA({payload:e}){var t;const n=$v.CREATE_GROUP,{groups:i}=yield oA();yield co(yi.setUsersGroupsLoader({key:n,value:!0})),yield co(yi.setGroupsState({groups:[C({},e,{id:`${e.name}ID`,managedBy:Sy.FRONTEGG}),...null!=i?i:[]]})),yield vo(500),null==e||null==(t=e.callback)||t.call(e,!0),yield co(yi.setUsersGroupsLoader({key:n,value:!1}))}function*bA({payload:e}){var t,n,i,o,a;const r=$v.UPDATE_GROUP,s=yield oA();yield co(yi.setUsersGroupsLoader({key:r,value:!0})),yield co(yi.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:Sy.FRONTEGG}):t})),selectedGroup:C({},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 vo(500),null==e||null==(a=e.callback)||a.call(e,!0),yield co(yi.setUsersGroupsLoader({key:r,value:!1}))}function*AA({payload:e}){var t,n;const i=$v.DELETE_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*kA({payload:e}){var t,n;const i=$v.ADD_ROLES_TO_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*TA({payload:e}){var t,n;const i=$v.DELETE_ROLES_FROM_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*PA({payload:e}){var t,n;const i=$v.ADD_USERS_TO_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*IA({payload:e}){var t,n;const i=$v.DELETE_USERS_FROM_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*LA(){const e=$v.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield oA();yield co(yi.setUsersGroupsLoader({key:e,value:!0})),t&&(yield co(yi.setGroupsState({groupsConfiguration:C({},t)}))),yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}function*EA({payload:e}){const t=$v.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield oA();yield co(yi.setUsersGroupsLoader({key:t,value:!0})),n&&(yield co(yi.setGroupsState({groupsConfiguration:C({},n,e)}))),yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}function*OA(){yield ca(yi.loadGroups,hA),yield ca(yi.createGroup,mA),yield ca(yi.updateGroup,bA),yield ca(yi.deleteGroup,AA),yield ca(yi.addRolesToGroup,kA),yield ca(yi.deleteRolesFromGroup,TA),yield ca(yi.addUsersToGroup,PA),yield ca(yi.deleteUsersFromGroup,IA),yield ca(yi.getGroupConfiguration,LA),yield ca(yi.updateGroupConfiguration,EA)}const wA=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,...wA(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),CA=["callback"];function*DA(){yield co(yi.setCustomLoginState({loading:!0}));try{const e=yield fo(wc);yield co(yi.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield co(yi.setCustomLoginState({loading:!1,error:e.message}))}}function*RA(e){let{payload:{callback:t}}=e,n=Ii(e.payload,CA);try{if(yield co(yi.setCustomLoginState({error:null,saving:!0})),!n.loginBox)throw new Error("no changes to update");const e=wA(n);if(0===e.length)throw new Error("no changes to update");yield fo(Cc,{actions:e});const i=yield fo(wc);yield co(yi.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setCustomLoginState({error:e.message,saving:!1})),null==t||t(null,e)}}function*UA(){yield ua(yi.loadTenantMetadata,DA),yield ua(yi.updateTenantMetadata,RA)}var _A={sagas:function*(){yield uo([fo(Dp),fo(Ev),fo(wv),fo(hv),fo(zm),fo(qp),fo(AS),fo(ES),fo(UA),fo(ov),fo(Dh),fo(vA),fo(Qh),fo(Pf),fo(rm),fo(Xf),fo(pm),fo(Tm),fo(Fm),fo(Xm),fo(sb),fo(Rb),fo(Yb),fo(Zb),fo(nA)])},mockSagas:function*(){yield uo([fo(_p),fo(eS),fo(DS),fo(fv),fo(Bh),fo(ym),fo(dg),fo(nb),fo(hm),fo(Im),fo(ub),fo(jb),fo(Gm),fo(OA)])},storeName:wt,initialState:ai,reducer:ui,actions:yi};const MA=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),NA={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},FA={setAuditLogsState:MA("auditLogsState"),resetAuditLogsState:e=>C({},e,{auditLogsState:NA})},$A={exportAuditsCsv:lt("auditLogs/exportAuditsCsv"),loadAuditLogs:lt("auditLogs/loadAuditLogs",(e=>({payload:e})))},GA={loading:!0},xA={setAuditsMetadataState:MA("auditsMetadataState"),resetAuditsMetadataState:e=>C({},e,{auditsMetadataState:GA})},VA={loadAuditsMetadata:lt("auditLogs/loadAuditsMetadata")},jA={auditLogsState:NA,auditsMetadataState:GA},{reducer:WA,actions:BA}=ut({name:Dt,initialState:jA,reducers:C({resetState:e=>C({},e,jA),setState:(e,{payload:t})=>C({},e,t)},FA,xA)}),KA=C({},BA,$A,VA),zA=e=>"createdAt"!==e.id,qA={total:20,data:Array.from(Array(5).keys()).map((e=>C({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`})))},HA={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}]},JA=()=>So((e=>e.auditLogs.auditLogsState)),YA=()=>So((e=>e.auditLogs.auditsMetadataState));function*QA(){const e=yield JA(),{columns:t}=yield YA();try{const n=e.filter,i=e.sort.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});yield co(KA.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield my.audits.exportAudits(C({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield co(KA.setAuditLogsState({isDownloadingCsv:!1}))}function*XA({payload:e}){yield co(KA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield JA(),{columns:n}=yield YA();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 co(KA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});n||(yield co(KA.loadAuditsMetadata()));const{data:g,total:p}=yield fo(my.audits.getAudits,C({offset:c,count:l},y,f));yield co(KA.setAuditLogsState({loading:!1,logs:null!=g?g:[],totalPages:+Math.ceil(p/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield co(KA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*ZA(){yield la(KA.exportAuditsCsv,QA),yield la(KA.loadAuditLogs,XA)}function*ek({payload:e}){yield co(KA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield JA(),{columns:n}=yield YA();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 co(KA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield co(KA.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=qA;let i=n.filter((e=>t=>e.filter(zA).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 co(KA.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 co(KA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*tk(){yield la(KA.loadAuditLogs,ek)}function*nk(){yield co(KA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield fo(my.metadata.getAuditsMetadata);yield co(KA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield co(KA.setAuditsMetadataState({error:e,loading:!1}))}}function*ik(){yield la(KA.loadAuditsMetadata,nk)}function*ok(){yield co(KA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=HA;yield co(KA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield co(KA.setAuditsMetadataState({error:e,loading:!1}))}}function*ak(){yield la(KA.loadAuditsMetadata,ok)}var rk={sagas:function*(){yield uo([fo(ZA),fo(ik)])},mockSagas:function*(){yield uo([fo(tk),fo(ak)])},storeName:Dt,initialState:jA,reducer:WA,actions:KA};const sk={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:lk,actions:ck,reducer:uk}=ut({name:"audits",initialState:sk,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=C({},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]})))}}}),dk=C({},ck,{initData:lt(`${lk}/initData`),loadAudits:lt(`${lk}/loadAudits`),removeFilter:lt(`${lk}/removeFilter`),filterData:lt(`${lk}/filterData`),exportCSV:lt(`${lk}/exportCSV`),deleteAudits:lt(`${lk}/deleteAudits`)}),yk=()=>So((e=>e[lk]));function*fk(){const{sortBy:e,sortDirection:t}=yield yk();try{const n=yield fo(my.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield co(dk.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield co(dk.loadItemFailedAction(t))}}function*gk(){try{const e=yield fo(my.metadata.getAuditsMetadata);yield co(dk.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield co(dk.loadItemFailedAction(t))}}const pk=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Sk({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield yk(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield yk():{rowsData:[]};try{const e=pk(t),{data:s,total:d}=yield fo(my.audits.getAudits,C({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield co(dk.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield co(dk.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield co(dk.loadItemFailedAction(t))}}function*vk(){yield co(dk.startLoading()),yield uo([fk(),gk(),Sk({payload:{onlyOneLoad:!1},type:""})]),yield co(dk.finishLoading())}function*hk({payload:e}){const{filters:t}=yield yk(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield co(dk.setFilterData(i))}function*mk({payload:e}){const{filters:t}=yield yk();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 co(dk.setFilterData(i))}function*bk(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield yk(),a=pk(e);yield co(dk.startDownloadingCsv());try{yield my.audits.exportAudits(C({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 co(dk.stopDownloadingCsv())}}function*Ak(){yield ca(dk.initData,vk),yield ca(dk.removeFilter,hk),yield ca(dk.filterData,mk),yield ca([dk.loadAudits,dk.textSearch,dk.onPageChange],Sk),yield ca([dk.setFilterData,dk.setDataSorting,dk.startRefresh],(()=>Sk({payload:{appendMode:!1},type:""}))),yield ca(dk.exportCSV,bk)}const kk={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},Tk={initData:()=>C({},kk),setConnectivityState:(e,{payload:t})=>C({},e,t),cleanWebhookTestData:e=>C({},e,{testResult:void 0}),cleanWebhookLogsData:e=>C({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return C({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>C({},e,{error:void 0}),cleanSlackData:e=>C({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>C({},e,{retryResult:C({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>C({},e,{retryResult:C({},e.retryResult,t)})}},Pk={loadSlackActions:lt("connectivity/loadSlackActions"),loadDataAction:lt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:lt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:lt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:lt("connectivity/loadScope"),deleteWebhookConfigAction:lt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:lt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:lt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},Ik={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:Lk,actions:Ek}=ut({name:Ct,initialState:Ik,reducers:C({},Tk)}),Ok=C({},Ek,Pk),wk={slack:my.connectivity.getSlackConfiguration,email:my.connectivity.getEmailConfiguration,sms:my.connectivity.getSMSConfiguration,webhook:my.connectivity.getWebhooksConfigurations,categories:my.connectivity.getCategories,channelMap:my.connectivity.getChannelMaps},Ck={slack:my.connectivity.postSlackConfiguration,email:my.connectivity.postEmailConfiguration,sms:my.connectivity.postSMSConfiguration,webhook:my.connectivity.postWebhooksConfiguration},Dk=["email","slack","sms","webhook"],Rk={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"}},Uk=["id"],_k=["id","enabled"],Mk=["categories","channelMap"];function*Nk(e){return yield fo($k,{payload:{api:e},type:""})}function*Fk({payload:e=Dk}){yield co(Ok.setConnectivityState({isLoading:!0}));try{const t=yield uo([...e.map(Nk),yield $k({payload:{api:"categories"},type:""}),yield function*(){return(yield uo(e.map((function*(e){return yield $k({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>C({},t,{[`${e[i]}`]:n})),{})}()]),n=yield $k({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?C({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:Rk[e[o]].events(i),active:Rk[e[o]].isActive(i),platform:Rk[e[o]].title,image:Rk[e[o]].image}]}):n:C({},n,{[`${Mk[o-e.length]}`]:i})),{list:[],webhook:n});yield co(Ok.setConnectivityState(C({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield co(Ok.setConnectivityState({isLoading:!1}))}}function*$k({payload:{api:e,params:t}}){try{return yield fo(wk[e],t)}catch(e){return}}function*Gk(){try{yield co(Ok.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield fo(my.connectivity.getSlackChannels);yield co(Ok.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield co(Ok.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*xk(e,t){const{connectivity:{list:n}}=yield So(),i=n.find((({key:t})=>t===e));if(!i)return;const o=Rk[e].isActive(t);o!==i.active&&(yield co(Ok.setConnectivityState({list:n.map((t=>t.key===e?C({},t,{active:o}):t))})))}function*Vk({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield So((e=>e.connectivity));try{if(yield co(Ok.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield So();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield uo([...i.reduce(((e,t)=>{var i,o;return!t.id&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length||(null==n?void 0:n.find((e=>{let{id:n}=e,i=Ii(e,Uk);return n===t.id&&JSON.stringify(C({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield fo(Ck.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield fo(my.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield So(),{processIds:i}=yield So((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield uo([...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 fo("email"===t?my.connectivity.postEmailConfiguration:my.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=Ii(o,_k);return yield uo([yield fo("email"===t?my.connectivity.patchEmailConfiguration:my.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield fo("email"===t?my.connectivity.putEmailSubscriptions:my.connectivity.putSMSSubscriptions,a,i,C({},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 fo("email"===t?my.connectivity.deleteEmailSubscriptions:my.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield $k({payload:{api:t},type:""});yield co(Ok.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield xk(t,e)}else yield co(Ok.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield fo(Ck[e],t),!["sms","email"].includes(e)){const o=yield $k({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield co(Ok.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield xk(e,o),null==n||n(!0)}}catch(e){var o;yield co(Ok.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*jk({payload:e}){try{yield my.connectivity.postSlackCode(e)}catch{}yield co(Ok.setConnectivityState({error:void 0,isSaving:!1}))}function*Wk(){const{slackChannels:e}=yield So((e=>e.connectivity));try{yield co(Ok.setConnectivityState({slackChannels:C({},e,{isLoadingScope:!0})}));const{clientId:t}=yield fo(my.connectivity.getSlackScope);yield co(Ok.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield co(Ok.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*Bk({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield So((e=>e.connectivity));try{yield co(Ok.setConnectivityState({isSaving:!0})),yield fo(my.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield $k({payload:{api:"webhook"},type:""});o&&(yield co(Ok.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*Kk({payload:e}){try{yield co(Ok.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield fo(my.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield co(Ok.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield co(Ok.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield co(Ok.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*zk({payload:e}){try{const{statusCode:t}=yield fo(my.connectivity.postWebhookRetry,e);yield co(Ok.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield co(Ok.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*qk({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield So((e=>e.connectivity));try{yield co(Ok.setConnectivityState({webhookLogs:C({},i,{isLoading:!0})}));const o=yield fo(my.connectivity.getWebhookLog,e,n,t);yield co(Ok.setConnectivityState({error:void 0,webhookLogs:C({isLoading:!1},o)}))}catch(e){yield co(Ok.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var Hk={sagas:function*(){yield la(Ok.loadDataAction,Fk),yield ca(Ok.loadSlackActions,Gk),yield la(Ok.postDataAction,Vk),yield la(Ok.postCodeAction,jk),yield la(Ok.loadScope,Wk),yield la(Ok.deleteWebhookConfigAction,Bk),yield la(Ok.postWebhookTestAction,Kk),yield la(Ok.postWebhookRetryAction,zk),yield ca(Ok.loadWebhookLogsAction,qk)},storeName:Ct,initialState:Ik,reducer:Lk,actions:Ok};function Jk(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}}function Yk(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>C({},n,{[e]:t(n[e],i)})}}function Qk(e){return Yk(e,((e,t)=>C({},e,{loading:t.payload})))}function Xk(e){return Yk(e,((e,t)=>C({},e,{error:t.payload,loading:!1})))}const Zk={loading:!1,error:null,fetching:!0,plans:[]},{actions:eT,reducer:tT,name:nT}=ut({name:"subscriptions/plans",initialState:Zk,reducers:C({},Jk())}),iT=C({loadPlans:lt(`${nT}/loadPlans`)},eT),oT={loading:!1,error:null,fetching:!0,config:null},aT=C({},Jk()),{actions:rT,reducer:sT,name:lT}=ut({name:"subscriptions/config",initialState:oT,reducers:aT}),cT=C({loadPaymentConfiguration:lt(`${lT}/loadPaymentConfiguration`)},rT),uT={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},dT=C({},Jk(),{setCancellationLoading:Qk("cancellation"),setCancellationError:Xk("cancellation"),setRenewalLoading:Qk("renewal"),setRenewalError:Xk("renewal")}),{reducer:yT,actions:fT,name:gT}=ut({name:"subscriptions/billing/subscription",initialState:uT,reducers:dT}),pT=C({load:lt(`${gT}/loadSubscription`),cancelSubscription:lt(`${gT}/cancelSubscription`),renewSubscription:lt(`${gT}/renewSubscription`)},fT),ST={loading:!1,error:null,fetching:!0},vT=C({},Jk()),{reducer:hT,actions:mT,name:bT}=ut({name:"subscriptions/billing/information",initialState:ST,reducers:vT}),AT=C({loadBillingInformation:lt(`${bT}/loadBillingInformation`),cancelSubscription:pT.cancelSubscription,renewSubscription:pT.renewSubscription},mT),kT={loading:!1,error:null,fetching:!0},TT=C({},Jk(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}),{reducer:PT,actions:IT,name:LT}=ut({name:"subscriptions/billing/payment",initialState:kT,reducers:TT}),ET=C({loadPaymentMethod:lt(`${LT}/loadPaymentMethod`),submitPaymentMethod:lt(`${LT}/submitPaymentMethod`),submitPaymentMethodError:lt(`${LT}/submitPaymentMethodError`),submitPaymentMethodSuccess:lt(`${LT}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:lt(`${LT}/updateBillingDetails`,(e=>({payload:e})))},IT),OT={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},wT=C({},Jk(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{invoiceDownload:C({},e.invoiceDownload,t.payload)})}}),{reducer:CT,actions:DT,name:RT}=ut({name:"subscriptions/billing/invoices",initialState:OT,reducers:wT}),UT=C({loadInvoices:lt(`${RT}/loadInvoices`),downloadInvoice:lt(`${RT}/downloadInvoice`,(e=>({payload:e})))},DT),_T={information:ST,invoices:OT,paymentMethod:kT,subscription:uT},MT={invoices:UT,information:AT,paymentMethod:ET,subscription:pT},NT=je({invoices:CT,information:hT,paymentMethod:PT,subscription:yT}),FT={fetching:!0,loading:!1,error:null,confirmed:!1},$T=C({},Jk()),{actions:GT,reducer:xT,name:VT}=ut({name:"subscriptions/checkout",initialState:FT,reducers:$T}),jT=C({loadCheckout:lt(`${VT}/loadCheckout`),resetCheckout:lt(`${VT}/resetCheckout`),submitCheckout:lt(`${VT}/submitCheckout`),confirmCheckout:lt(`${VT}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:lt(`${VT}/errorCheckout`,(e=>({payload:e})))},GT),WT={loading:!1,error:null,cardSetupIntentSecret:null},BT=C({},Jk()),{reducer:KT,actions:zT,name:qT}=ut({name:"subscriptions/stripe",initialState:WT,reducers:BT}),HT=C({loadCustomer:lt(`${qT}/loadCustomer`),createCardSetupIntentSecret:lt(`${qT}/createCardSetupIntentSecret`)},zT),JT={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:YT,reducer:QT,name:XT}=ut({name:"subscriptions/vendorPublicConfig",initialState:JT,reducers:C({},Jk())}),ZT=C({loadVendorPublicConfiguration:lt(`${XT}/loadVendorPublicConfiguration`)},YT),eP={config:oT,plans:Zk,checkout:FT,billing:_T,stripe:WT,vendorPublicConfig:JT},tP={config:cT,billing:MT,plans:iT,checkout:jT,stripe:HT,vendorPublicConfig:ZT},nP=je({config:sT,billing:NT,plans:tT,checkout:xT,stripe:KT,vendorPublicConfig:QT});let iP,oP,aP;function rP({policy:e}){return{policy:aP.AT_PERIOD_END}}function sP(e){switch(e){case Sd.ACTIVE:return oP.ACTIVE;case Sd.INCOMPLETE:return oP.INCOMPLETE;case Sd.CANCELED:return oP.CANCELED;case Sd.EXPIRED:return oP.EXPIRED;case Sd.TRIALING:return oP.TRIALING;default:return oP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(iP||(iP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(oP||(oP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(aP||(aP={}));const lP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Sd.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},cP=[{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"}],uP=[{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:""}],dP=[{id:"id",externalId:"externalId",type:vd.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],yP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*fP(){yield la(pT.load,gP),yield la(pT.cancelSubscription,SP),yield la(pT.renewSubscription,vP)}function*gP(){const e=yield So((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield kP(e)}function*pP(){yield co(pT.setLoading(!0));try{const[e]=yield fo(my.subscriptions.getManagedSubscriptions);yield co(pT.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield co(pT.setError(e))}}function*SP(){const{subscription:e}=yield So((e=>e.subscriptions.billing.subscription));if(!e)return void(yield co(pT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield co(pT.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Sd.ACTIVE)try{yield co(pT.setCancellationLoading(!0)),yield fo(my.subscriptions.cancelManagedSubscription,t),yield pP(),yield co(pT.setCancellationLoading(!1))}catch(e){yield co(pT.setCancellationError(e.message))}}function*vP(){const{subscription:e}=yield So((e=>e.subscriptions.billing.subscription));if(!e)return void(yield co(pT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield co(pT.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===hd.AT_PERIOD_END)try{yield co(pT.setRenewalLoading(!0)),yield fo(my.subscriptions.renewManagedSubscription,t),yield pP(),yield co(pT.setRenewalLoading(!1))}catch(e){yield co(pT.setCancellationError(e.message))}}function*hP(){yield co(pT.setLoading(!0)),yield vo(500),yield co(pT.setState({subscription:lP,fetching:!1,loading:!1,error:null}))}function*mP(){yield la(pT.load,hP)}function*bP(){yield la(AT.loadBillingInformation,AP)}function*AP(){yield function*(e){const t=yield So((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield So((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield kP(n,!1):yield co(AT.setError(t?"Not authorized":"Internal feature failure"))}()}function*kP(e,t){yield co(AT.setLoading(!0));try{var n,i;const o=yield fo(my.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield fo(my.subscriptions.getSubscriptionPlan,a):([,s]=yield uo([fo(pP),fo(my.subscriptions.getSubscriptionPlan,a)]),l=yield So((e=>e.subscriptions.billing.subscription.subscription||null))),yield co(AT.setState(C({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?oP.ACTIVE:sP(l.status),cancellation:l.cancellation&&rP(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 co(AT.setError(e.message))}}function*TP(){yield function*(){var e,t;yield co(AT.setLoading(!0)),yield vo(500),yield co(AT.setState({loading:!1,fetching:!1,summary:{subscriptionId:lP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:md.Stripe,externallyManaged:!1,currentPlanId:cP[0].id,defaultPlanId:cP[0].id},plan:C({},cP[0],{price:null==(e=cP[0].price)?void 0:e.amount,currency:null==(t=cP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*PP(){yield la(AT.loadBillingInformation,TP)}function*IP(){yield la(ET.loadPaymentMethod,LP),yield la(ET.submitPaymentMethod,OP),yield la(ET.submitPaymentMethodError,wP),yield la(ET.submitPaymentMethodSuccess,CP),yield la(ET.updatePaymentMethodBillingDetails,EP)}function*LP(){yield co(ET.setLoading(!0));try{const e=(yield fo(my.subscriptions.getPaymentMethods))[0];yield co(ET.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield co(ET.setError(e.message))}}function*EP({payload:e}){yield co(ET.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield fo(my.subscriptions.updatePaymentMethodBillingDetails,t,C({email:n},i)),yield fo(LP),null==o||o(!0)}catch(e){yield co(ET.setError(e.message)),null==o||o(!1)}yield co(ET.setLoading(!1))}function*OP(){yield co(ET.setLoading(!0))}function*wP({payload:e}){yield co(ET.setError(e))}function*CP(){yield co(ET.loadPaymentMethod())}function*DP(){yield co(ET.setLoading(!0)),yield vo(500);const e=dP[0];yield co(ET.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*RP(){yield la(ET.loadPaymentMethod,DP)}function*UP(){yield la(UT.loadInvoices,_P),yield la(UT.downloadInvoice,MP)}function*_P(){yield co(UT.setLoading(!0));try{const e=(yield fo(my.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 co(UT.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield co(UT.setError(e.message))}}function*MP({payload:e}){yield co(UT.setInvoiceDownloadState({loading:!0,error:null}));try{yield fo(my.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield co(UT.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield co(UT.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*NP(){yield co(UT.setLoading(!0)),yield vo(500),yield co(UT.setState({loading:!1,fetching:!1,invoices:uP.map((e=>C({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield co(UT.setLoading(!1))}function*FP(){yield la(UT.loadInvoices,NP)}function*$P(){yield uo([fo(bP),fo(IP),fo(UP),fo(fP)])}function*GP(){yield uo([fo(PP),fo(RP),fo(FP),fo(mP)])}function*xP(){yield la(jT.loadCheckout,VP),yield la(jT.resetCheckout,jP),yield la(jT.submitCheckout,WP),yield la(jT.confirmCheckout,BP),yield la(jT.errorCheckout,zP)}function*VP(){yield co(jT.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*jP(){yield co(jT.setState({loading:!1,error:null,confirmed:!1}))}function*WP(){yield co(jT.setState({loading:!0,error:null}))}function*BP({payload:{paymentMethodId:e,planId:t}}){const n=yield So((e=>e.subscriptions.billing.subscription.subscription)),i=yield So((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Sd.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield co(jT.setState({loading:!0,error:null})),o&&a)return yield KP(),void(yield co(pT.setState({subscription:C({},n,{status:Sd.ACTIVE})})));try{yield fo(my.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield uo([AP(),LP(),_P()]),yield KP()}catch(e){yield co(jT.setState({loading:!1,error:e.message}))}}else yield co(jT.setState({loading:!1,error:"Subscription not found"}))}function*KP(){yield co(jT.setState({loading:!1,error:null,confirmed:!0}))}function*zP({payload:e}){yield co(jT.setState({loading:!1,error:e}))}function*qP(){yield la(jT.resetCheckout,jP)}function*HP(){yield la(iT.loadPlans,JP)}function*JP(){yield co(iT.setLoading(!0));try{const e=(yield fo(my.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 co(iT.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield co(iT.setError(e.message))}}function*YP(){yield co(iT.setLoading(!0)),yield vo(500),yield co(iT.setState({fetching:!1,loading:!1,plans:cP.map((e=>{var t,n;return C({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*QP(){yield la(iT.loadPlans,YP)}function*XP(){yield la(cT.loadPaymentConfiguration,ZP)}function*ZP(){yield co(cT.setLoading(!0));try{(yield fo(my.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===md.Stripe))?yield function*(){yield co(cT.setLoading(!0));try{const e=yield fo(my.subscriptions.getStripePaymentProviderConfiguration);yield co(cT.setState({loading:!1,fetching:!1,config:{paymentProvider:iP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield co(cT.setError(e.message))}}():yield co(cT.setError("Payment provider not configured"))}catch(e){yield co(cT.setError(e.message))}}function*eI(){yield co(cT.setLoading(!0)),yield vo(500),yield co(cT.setState({loading:!1,fetching:!1,config:{paymentProvider:iP.STRIPE,apiKey:""}}))}function*tI(){yield la(cT.loadPaymentConfiguration,eI)}function*nI(){yield la(HT.createCardSetupIntentSecret,iI)}function*iI({payload:e}){yield co(HT.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield fo(my.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield co(HT.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield co(HT.setError(e.message))}}function*oI(){yield la(ZT.loadVendorPublicConfiguration,aI)}function*aI(){yield co(ZT.setLoading(!0));try{const e=yield fo(my.subscriptions.getVendorPublicConfigurations);yield co(ZT.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield co(ZT.setError(e.message))}}function*rI(){yield co(ZT.setLoading(!0)),yield vo(500),yield co(ZT.setState({fetching:!1,loading:!1,vendorPublicConfig:yP}))}function*sI(){yield la(ZT.loadVendorPublicConfiguration,rI)}var lI={sagas:function*(){yield uo([fo($P),fo(xP),fo(HP),fo(XP),fo(nI),fo(oI)])},mockSagas:function*(){yield uo([fo(GP),fo(qP),fo(QP),fo(tI),fo(sI)])},reducer:nP,actions:tP,initialState:eP,storeName:"subscriptions"},cI={sagas:function*(){yield la(Cf.loadVendorPublicInfo,Df)},storeName:Rt,initialState:Ef,reducer:Of,actions:Cf};const{reducer:uI}=ut({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(da.setContext(t),C({},e,{context:t}))}}}),dI=(e,t,n=!1,i,o,a=!1,r="path")=>{let s=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(s||(s=window),!s.store){var l,c,u,d,y,f,g,p,S,v;n||a||da.setContext(e.context);const t=Zo(),h=[...rt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=st({middleware:h,preloadedState:{root:C({},e,{previewMode:n,urlStrategy:r}),[_A.storeName]:C({},_A.initialState,i,null!=(l=null==o?void 0:o.auth)?l:{},{routes:C({},_A.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[rk.storeName]:C({},rk.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:C({},rk.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:C({},rk.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[lk]:C({},sk,null!=(v=null==o?void 0:o.audits)?v:{}),[Hk.storeName]:Hk.initialState,[lI.storeName]:lI.initialState,[cI.storeName]:cI.initialState},reducer:je({root:uI,[_A.storeName]:_A.reducer,[rk.storeName]:rk.reducer,[lk]:uk,[Hk.storeName]:Hk.reducer,[lI.storeName]:lI.reducer,[cI.storeName]:cI.reducer})});const m=function*(){yield uo([fo(_A.sagas),fo(rk.sagas),fo(Ak),fo(Hk.sagas),fo(lI.sagas),fo(cI.sagas)])},b=function*(){yield uo([fo(_A.mockSagas),fo(rk.mockSagas),fo(lI.mockSagas)])};n?(s.store.destroy=t.run(b).cancel,s.store.dispatch(yi.requestAuthorize(!0))):s.store.destroy=t.run(m).cancel}return s.store};var yI=n(714),fI=n.n(yI);function gI(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function pI(e){if(e.type)return e;if("#"===e.charAt(0))return pI(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 SI(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 vI(e){if(0===e.indexOf("#"))return e;const{values:t}=pI(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 hI(e,t){return e=pI(e),t=gI(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,SI(e)}function mI(e,t){if(e=pI(e),t=gI(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 SI(e)}function bI(e,t){if(e=pI(e),t=gI(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 SI(e)}const AI=e=>{if(e)return{main:e,light:vI(bI(e,.4)),dark:vI(mI(e,.15)),hover:vI(mI(e,.15)),active:vI(mI(e,.2))}},kI=e=>{if(e)return{main:e,light:bI(e,.7),dark:mI(e,.2)}},TI=(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)?C({},t,{palette:{primary:C({},AI(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:C({},AI(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:C({},AI(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:C({},kI(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:C({},kI(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:C({},kI(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:C({},kI(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},PI={},II={},LI={},EI={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.*"]}};class OI{constructor(){this._theme=PI,this._themeV2=II,this._navigation=EI,this._localizations=LI}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new OI;return n.set(e),OI._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}set(e){try{var t,n,i,o,a,r,s;this._navigation=fI().all([null!=(t=EI)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=fI().all([null!=(i=PI)?i:{},TI(null==e?void 0:e.theme,PI)]),this._themeV2=fI().all([null!=(o=II)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=fI().all([null!=(r=LI)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}])}catch(e){this._navigation=EI,this._theme=PI,this._themeV2=II,this._localizations=LI}}}OI._instances={};var wI=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},CI=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},DI=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))};let RI,UI,_I,MI,NI,FI,$I,GI,xI,VI,jI;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(RI||(RI={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(UI||(UI={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(_I||(_I={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(MI||(MI={})),function(e){e.Invoices="invoices"}(NI||(NI={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(FI||(FI={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}($I||($I={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(GI||(GI={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(xI||(xI={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(VI||(VI={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(jI||(jI={}));const WI={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},BI={hidden:"hidden",edit:"edit"};var KI="6.98.0",zI={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":"on"},qI=function(){function e(t,n){var i,o=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];P(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(KI),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=R(_().mark((function e(){var t,n,i,a,r;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=ba,o.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,o.options.metadata=null!=(n=null==r||null==(i=r.rows)||null==(a=i[0])?void 0:a.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:OI.set(o.options.metadata,o.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=R(_().mark((function e(){return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o.options.hostedLoginBox||o.options.builderMode||"nextjs"===o.options.framework||o.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=R(_().mark((function e(){var t;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.options.previewMode&&!o.options.builderMode){e.next=4;break}_d.set(zI,o.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Md();case 7:t=e.sent,o.options.overrideFeatureFlags&&Object.assign(t,o.options.overrideFeatureFlags),_d.set(t,o.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.updateLocalizationsSetter=function(e){o.updateLocalizations=e};var s=wI(n),l="frontegg-app-".concat(s);this.iframeRendering=a,this.name=s,this.options=C({},t,{contextOptions:C({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=l;var c,u,d=this.options.authOptions?C({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=dI({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);w.setInstance(s,this)}var t,n,i,o;return O(e,[{key:"initContainers",value:(o=R(_().mark((function e(t){return _().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,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;OI.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:T})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=R(_().mark((function e(){return _().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=R(_().mark((function e(){var t;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return da.setRequestSource(ga.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;null==(e=this.adminPortalRenderer)||e.unmount(),da.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=R(_().mark((function e(t){var n;return _().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,C({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),HI=function(){function e(){P(this,e)}return O(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=w.getInstance(i);e&&t?(da.setAccessToken(t),da.setUser(C({},n,{accessToken:t})),o.store.dispatch(yi.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(yi.loadTenants())):(da.setAccessToken(null),da.setUser(null),o.store.dispatch(yi.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),JI=function(){function e(){P(this,e)}return O(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideAdminPortal()}}]),e}(),YI=function(){function e(){P(this,e)}return O(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";w.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideCheckoutDialog()}}]),e}(),QI=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},XI=function(){function e(t,n,i,o){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(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=dI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=C({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},o),this.app=new qI(this.options,t,!0),OI.set({},t)}var t;return O(e,[{key:"render",value:(t=R(_().mark((function e(t){var n,i,o,a,r=this;return _().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,DI(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}(),ZI="modern",eL=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[ZI]},tL=function(){function e(t,n,i,o){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(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=dI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=C({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},o),this.app=new qI(this.options,t,!0,a),OI.set({},t)}var t;return O(e,[{key:"render",value:(t=R(_().mark((function e(t){var n,i,o,a,r=this;return _().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,DI(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 nL(e,t){return nL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},nL(e,t)}function iL(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&&nL(e,t)}function oL(e,t){if(t&&("object"===I(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 aL(e){return aL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},aL(e)}function rL(){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 sL(e,t,n){return sL=rL()?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&&nL(o,n.prototype),o},sL.apply(null,arguments)}function lL(e){var t="function"==typeof Map?new Map:void 0;return lL=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 sL(e,arguments,aL(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),nL(n,e)},lL(e)}function cL(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=aL(e);if(t){var o=aL(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return oL(this,n)}}var uL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new qI(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){iL(n,e);var t=cL(n);function n(){var e;P(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 O(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=w.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=CI(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=CI(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=CI(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=CI(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=CI(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=CI(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}(lL(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?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},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 p?t:p,a=Object.create(o.prototype),s=new O(i||[]);return r(a,"_invoke",{value:P(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 g={};function p(){}function S(){}function v(){}var h={};d(h,l,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(w([])));b&&b!==n&&a.call(b,l)&&(h=b);var A=v.prototype=p.prototype=Object.create(h);function k(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function T(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 P(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=I(r,n);if(s){if(s===g)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===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function I(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,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var o=f(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,g;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,g):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,g)}function L(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 E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function w(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:C}}function C(){return{value:void 0,done:!0}}return S.prototype=v,r(A,"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(A),e},t.awrap=function(e){return{__await:e}},k(T.prototype),d(T.prototype,c,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new T(y(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},k(A),d(A,u,"Generator"),d(A,l,(function(){return this})),d(A,"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=w,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(E),!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,g):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),g},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),E(n),g}},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;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),g}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return JI},AdminPortalRenderer:function(){return XI},AppHolder:function(){return w},CheckoutDialog:function(){return YI},FronteggApp:function(){return qI},HostedLogin:function(){return HI},LoginBoxRenderer:function(){return tL},createElement:function(){return CI},defaultTheme:function(){return ZI},formatName:function(){return wI},getThemeAdminByName:function(){return QI},getThemeByName:function(){return eL},initialize:function(){return uL},mockFlagsList:function(){return zI},waitThemeSetter:function(){return DI}});var e={};n.r(e),n.d(e,{Delete:function(){return Pa},Get:function(){return ba},Patch:function(){return ka},Post:function(){return Aa},PostDownload:function(){return Ia},Put:function(){return Ta},extractHeadersFromOptions:function(){return La},getBaseUrl:function(){return va},getMetadataHeaders:function(){return ha}});var t={};n.r(t),n.d(t,{getParentTenants:function(){return yr},getSubTenants:function(){return ur},getSubTenantsAsTree:function(){return dr},getTenants:function(){return cr},getTenantsUsersCount:function(){return fr},switchTenant:function(){return lr}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return xr},MachineToMachineAuthStrategy:function(){return Vr},OAuthLogout:function(){return ds},SocialLoginProviders:function(){return Gr},acceptInvitation:function(){return ss},activateAccount:function(){return is},bulkCreateIPRestriction:function(){return _r},changePhoneNumber:function(){return ec},changePhoneNumberWithVerification:function(){return Xl},checkIfAllowToRememberMfaDevice:function(){return El},createDomainRestriction:function(){return Or},createIPRestriction:function(){return Ur},createOrUpdateSessionConfigrations:function(){return dl},createSSOConfiguration:function(){return Rl},createSSOConfigurationByMetadata:function(){return Ml},createSSODomain:function(){return Fl},createSSOGroup:function(){return jl},createSamlGroup:function(){return Ys},createTenantAccessToken:function(){return ml},createUserAccessToken:function(){return hl},deleteAllSessionsForUser:function(){return fl},deleteDomainRestriction:function(){return Cr},deleteIPRestriction:function(){return Nr},deleteSSOConfiguration:function(){return _l},deleteSSODomain:function(){return $l},deleteSSOGroup:function(){return Bl},deleteSamlGroup:function(){return Xs},deleteSessionForUser:function(){return yl},deleteTenantAccessToken:function(){return Sl},deleteTenantApiToken:function(){return Pl},deleteUserAccessToken:function(){return vl},deleteUserApiToken:function(){return Il},deleteWebAuthnDevice:function(){return ac},disableMFAAuthenticatorApp:function(){return Is},disableMFASMS:function(){return Es},disableMFAWebAuthn:function(){return ws},disableMfa:function(){return Ps},enrollMFAAuthenticatorApp:function(){return hs},enrollMFAAuthenticatorAppForLogin:function(){return Rs},enrollMFASMS:function(){return bs},enrollMFASMSForLogin:function(){return Ms},enrollMFAWebAuthn:function(){return ks},enrollMFAWebAuthnForLogin:function(){return Gs},enrollMfa:function(){return Ss},exchangeOAuthTokens:function(){return Hl},forgotPassword:function(){return ys},generateLoginResponse:function(){return Hr},generateLoginResponseFromOAuthResponse:function(){return Yr},generateLoginResponseV2:function(){return Jr},getActivateAccountStrategy:function(){return os},getCaptchaPolicy:function(){return Ar},getCurrentUserSession:function(){return ll},getCurrentUserSessions:function(){return sl},getCustomSocialLoginProvidersV1:function(){return il},getDomainRestrictions:function(){return Lr},getDomainRestrictionsConfig:function(){return Er},getGlobalSecurityPolicy:function(){return gr},getIPRestrictions:function(){return Dr},getIPRestrictionsConfig:function(){return Rr},getLockoutPolicy:function(){return hr},getMFADevices:function(){return Cs},getMFAStrategiesConfig:function(){return lc},getMfaPolicy:function(){return pr},getOidcConfiguration:function(){return Zs},getPasswordConfigPolicy:function(){return Ir},getPasswordHistoryPolicy:function(){return kr},getSSOConfigurations:function(){return Dl},getSSODefaultRoles:function(){return xl},getSSOGroups:function(){return Kl},getSSOPublicConfiguration:function(){return el},getSamlConfiguration:function(){return js},getSamlRoles:function(){return qs},getSamlRolesGroups:function(){return Hs},getSamlVendorConfiguration:function(){return Bs},getSessionConfigurations:function(){return ul},getSocialLoginProviders:function(){return tl},getSocialLoginProvidersV2:function(){return nl},getTenantAccessTokensData:function(){return pl},getTenantApiTokensData:function(){return Al},getUserAccessTokensData:function(){return gl},getUserApiTokensData:function(){return bl},getUserById:function(){return Ll},getVendorConfig:function(){return al},getVendorLockoutPolicy:function(){return mr},getVendorMfaPolicy:function(){return Sr},getVendorPasswordHistoryPolicy:function(){return Tr},getVendorPublicAuthStrategiesConfig:function(){return sc},getWebAuthnDevices:function(){return oc},loadPasswordConfig:function(){return gs},login:function(){return ts},loginViaSocialLogin:function(){return ol},loginWithMfa:function(){return ns},logout:function(){return us},oidcPostLogin:function(){return es},oidcPostLoginV2:function(){return ql},passwordlessPostLogin:function(){return wl},passwordlessPreLogin:function(){return Ol},postLogin:function(){return Zr},preDisableMFASMS:function(){return Ls},preDisableMFAWebAuthn:function(){return Os},preEnrollMFAAuthenticatorApp:function(){return vs},preEnrollMFAAuthenticatorAppForLogin:function(){return Ds},preEnrollMFASMS:function(){return ms},preEnrollMFASMSForLogin:function(){return _s},preEnrollMFAWebAuthn:function(){return As},preEnrollMFAWebAuthnForLogin:function(){return $s},preLogin:function(){return Qr},preLoginV2:function(){return zl},preLoginWithIdpType:function(){return Xr},preVerifyMFASMSForLogin:function(){return Ns},preVerifyMFAWebAuthnForLogin:function(){return xs},recoverMfaToken:function(){return ps},refreshToken:function(){return ls},refreshTokenV2:function(){return cs},resendActivationEmail:function(){return as},resendInvitationEmail:function(){return rs},resetPassword:function(){return fs},resetPhoneNumber:function(){return Yl},revokeSessionsForUser:function(){return cl},saveLockoutPolicy:function(){return br},saveMfaPolicy:function(){return vr},savePasswordHistoryPolicy:function(){return Pr},setSSODefaultRoles:function(){return Vl},signUpUser:function(){return rl},silentOAuthRefreshToken:function(){return Jl},testCurrentIp:function(){return Fr},testCurrentIpInAllowList:function(){return $r},updateDomainRestrictionConfig:function(){return wr},updateIPRestrictionConfig:function(){return Mr},updateSSOConfiguration:function(){return Ul},updateSSOConfigurationByMetadata:function(){return Nl},updateSSOGroup:function(){return Wl},updateSamlConfiguration:function(){return Ws},updateSamlGroup:function(){return Qs},updateSamlRoles:function(){return Js},updateSamlVendorMetadata:function(){return Ks},updateTenantApiTokensData:function(){return Tl},updateUserApiTokensData:function(){return kl},validateSSODomain:function(){return Gl},validateSamlDomain:function(){return zs},verifyChangePhoneNumber:function(){return Zl},verifyInviteToken:function(){return Cl},verifyMFAAuthenticatorAppForLogin:function(){return Us},verifyMFASMSForLogin:function(){return Fs},verifyMFAWebAuthnForLogin:function(){return Vs},verifyMfa:function(){return Ts},verifyNewDeviceSession:function(){return rc},verifyResetPhoneNumber:function(){return Ql},webAuthnCreateNewDeviceSession:function(){return ic},webAuthnPostLogin:function(){return nc},webAuthnPreLogin:function(){return tc}});var a={};n.r(a),n.d(a,{addUser:function(){return gc},changePassword:function(){return yc},createInviteUserLink:function(){return vc},deleteInviteUserLink:function(){return mc},deleteUser:function(){return pc},getInviteLinkConfiguration:function(){return Ac},getInviteUserLink:function(){return bc},getProfile:function(){return cc},loadAvailablePermissions:function(){return Tc},loadAvailableRoles:function(){return kc},loadStats:function(){return Pc},loadUsers:function(){return fc},resendActivationLink:function(){return Ic},resendInvitationLink:function(){return Lc},resendInvitationLinkToAllTenants:function(){return Ec},updateInviteUserLink:function(){return hc},updateProfile:function(){return uc},updateProfileImage:function(){return dc},updateUser:function(){return Sc}});var r={};n.r(r),n.d(r,{getAdminBoxMetadata:function(){return wc},getAuditsMetadata:function(){return _c},getCurrentUserIpMetadata:function(){return Dc},getIpAdressMetadata:function(){return Mc},getNotificationsMetadata:function(){return Rc},getSamlMetadata:function(){return Uc},updateAdminBoxMetadata:function(){return Cc}});var s={};n.r(s),n.d(s,{downloadReport:function(){return Wc},getReport:function(){return xc},getReports:function(){return Gc},renderReport:function(){return Vc},scheduleReport:function(){return jc},sendReport:function(){return Bc}});var l={};n.r(l),n.d(l,{getNotifications:function(){return Kc},markAllAsRead:function(){return Hc},updateNotificationIsPinned:function(){return qc},updateNotificationStatus:function(){return zc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return Xc},getAudits:function(){return Yc},getAuditsStats:function(){return Qc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return yu},deleteEmailSubscriptions:function(){return uu},deleteSMSConfiguration:function(){return hu},deleteSMSSubscriptions:function(){return Su},deleteSlackConfiguration:function(){return au},deleteWebhooksConfiguration:function(){return Au},getCategories:function(){return Iu},getChannelMaps:function(){return Lu},getEmailConfiguration:function(){return su},getSMSConfiguration:function(){return fu},getSlackChannels:function(){return iu},getSlackConfiguration:function(){return tu},getSlackScope:function(){return nu},getWebhookLog:function(){return ku},getWebhooksConfigurations:function(){return mu},patchEmailConfiguration:function(){return cu},patchSMSConfiguration:function(){return pu},postEmailConfiguration:function(){return lu},postSMSConfiguration:function(){return gu},postSlackCode:function(){return ru},postSlackConfiguration:function(){return ou},postWebhookRetry:function(){return Pu},postWebhookTest:function(){return Tu},postWebhooksConfiguration:function(){return bu},putEmailSubscriptions:function(){return du},putSMSSubscriptions:function(){return vu}});var d={};n.r(d),n.d(d,{getPublicSettings:function(){return wu},getSettings:function(){return Ou},updateSettings:function(){return Eu}});var y={};n.r(y),n.d(y,{addRole:function(){return _u},attachPermissionToRoles:function(){return Gu},attachPermissionsToRole:function(){return Fu},deleteRole:function(){return Mu},getPermissionCategories:function(){return xu},getPermissions:function(){return $u},getRoles:function(){return Uu},updateRole:function(){return Nu}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return hd},ISubscriptionStatus:function(){return Sd},PaymentMethodType:function(){return vd},ProviderType:function(){return md},TenantCreatedAction:function(){return Ad},TrialEndAction:function(){return bd},cancelManagedSubscription:function(){return Hu},cancelSubscription:function(){return Wu},createStripeCustomer:function(){return ld},createStripePaymentMethodSetupIntentSecret:function(){return ud},createSubscription:function(){return rd},createTenantConfiguration:function(){return fd},getManagedSubscription:function(){return zu},getManagedSubscriptions:function(){return qu},getPaymentMethod:function(){return od},getPaymentMethods:function(){return id},getPaymentProviders:function(){return gd},getStripeCustomer:function(){return sd},getStripePaymentProviderConfiguration:function(){return cd},getSubscription:function(){return ju},getSubscriptionInvoice:function(){return ed},getSubscriptionInvoicePdf:function(){return td},getSubscriptionInvoices:function(){return Zu},getSubscriptionPlan:function(){return Xu},getSubscriptionPlans:function(){return Qu},getSubscriptionSummaries:function(){return dd},getSubscriptions:function(){return Vu},getTenantConfiguration:function(){return yd},getVendorPublicConfigurations:function(){return pd},renewManagedSubscription:function(){return Ju},renewSubscription:function(){return Bu},updateManagedSubscription:function(){return Yu},updatePaymentMethodBillingDetails:function(){return ad},updateSubscription:function(){return Ku}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return kd}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return Ld},addUserToTenantAndSubTenants:function(){return Pd},addUsersToSubTenant:function(){return Rd},createSubTenant:function(){return wd},deleteSubTenant:function(){return Cd},loadAllUsers:function(){return Td},removeUserFromTenantAndSubTenants:function(){return Id},removeUserRolesFromSubTenants:function(){return Ed},setUserRolesForSubTenants:function(){return Od},updateSubAccountAccess:function(){return Dd}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return _d},loadFeatureFlags:function(){return Md}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return xd},createConfiguration:function(){return $d},deleteConfiguration:function(){return Gd},getConfigs:function(){return Nd},updateConfiguration:function(){return Fd}});var h={};n.r(h),n.d(h,{impersonate:function(){return Vd}});var m={};n.r(m),n.d(m,{addRolesToGroup:function(){return Jd},addUsersToGroup:function(){return Qd},createGroup:function(){return zd},deleteGroup:function(){return Hd},deleteRolesFromGroup:function(){return Yd},deleteUsersFromGroup:function(){return Xd},getGroupById:function(){return Wd},getGroupConfiguration:function(){return Zd},getGroups:function(){return Bd},getGroupsByIds:function(){return Kd},updateGroup:function(){return qd},updateGroupConfiguration:function(){return ey}});var b={};n.r(b),n.d(b,{GetUserJwt:function(){return ty},getUsersV3:function(){return ny}});var A={};n.r(A),n.d(A,{loadEntitlements:function(){return iy}});var k={};n.r(k),n.d(k,{AuthStrategyEnum:function(){return xr},ContextHolder:function(){return da},FeatureFlags:function(){return _d},FronteggApiError:function(){return Sa},FronteggContext:function(){return ya},FronteggFrameworks:function(){return pa},GroupManagedByEnum:function(){return Sy},GroupRelations:function(){return py},ISubscriptionCancellationPolicy:function(){return hd},ISubscriptionStatus:function(){return Sd},MFAStrategyEnum:function(){return ry},MachineToMachineAuthStrategy:function(){return Vr},PaginationOrderEnum:function(){return hy},PaymentMethodType:function(){return vd},ProviderType:function(){return md},RequestSource:function(){return ga},RestrictionType:function(){return xn},ScimConnectionSource:function(){return gy},SecondaryAuthStrategy:function(){return oy},SocialLoginProviders:function(){return Gr},SortByEnum:function(){return vy},TenantType:function(){return ly},UserManagedByEnum:function(){return sy},WebAuthnDeviceType:function(){return ay},api:function(){return my},countConfigurationUsers:function(){return xd},createConfiguration:function(){return $d},default:function(){return by},deleteConfiguration:function(){return Gd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return cy},fronteggHeaders:function(){return fa},fronteggRefreshTokenUrl:function(){return uy},fronteggSilentRefreshTokenUrl:function(){return dy},fronteggTenantsUrl:function(){return fy},fronteggUsersUrl:function(){return yy},getConfigs:function(){return Nd},loadFeatureFlags:function(){return Md},updateConfiguration:function(){return Fd}});var T={};function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e){return I="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},I(e)}function L(e){var t=function(e,t){if("object"!==I(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==I(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===I(t)?t:String(t)}function E(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,L(i.key),i)}}function O(e,t,n){return t&&E(e.prototype,t),n&&E(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(T),n.d(T,{AccountDetailsPageTabs:function(){return jI},AccountPageFields:function(){return MI},DomainRestrictionsTabFields:function(){return VI},GeneralSettingsTabFields:function(){return GI},InviteUserModalFields:function(){return _I},IpRestrictionsTabFields:function(){return xI},Metadata:function(){return OI},PrivacyPageFields:function(){return UI},ProfilePageFields:function(){return RI},SecurityPageTabs:function(){return FI},SessionManagementTabFields:function(){return $I},SubscriptionsPageFields:function(){return NI},alpha:function(){return hI},fieldAppearance:function(){return WI},tabAppearance:function(){return BI}});var w=function(){function e(){P(this,e)}return O(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 C(){return C=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},C.apply(this,arguments)}function D(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 R(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){D(a,i,o,r,s,"next",e)}function s(e){D(a,i,o,r,s,"throw",e)}r(void 0)}))}}w._apps={};var U=n(841),_=n.n(U);function M(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 N(e){return!!e&&!!e[ke]}function F(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)===Te}(e)||Array.isArray(e)||!!e[Ae]||!!e.constructor[Ae]||W(e)||B(e))}function $(e,t,n){void 0===n&&(n=!1),0===G(e)?(n?Object.keys:Pe)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function G(e){var t=e[ke];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:W(e)?2:B(e)?3:0}function x(e,t){return 2===G(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function V(e,t,n){var i=G(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function j(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function W(e){return ve&&e instanceof Map}function B(e){return he&&e instanceof Set}function K(e){return e.o||e.t}function z(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Ie(e);delete t[ke];for(var n=Pe(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),J(e)||N(e)||!F(e)||(G(e)>1&&(e.set=e.add=e.clear=e.delete=H),Object.freeze(e),t&&$(e,(function(e,t){return q(t,!0)}),!0)),e}function H(){M(2)}function J(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Y(e){var t=Le[e];return t||M(18,e),t}function Q(){return pe}function X(e,t){t&&(Y("Patches"),e.u=[],e.s=[],e.v=t)}function Z(e){ee(e),e.p.forEach(ne),e.p=null}function ee(e){e===pe&&(pe=e.l)}function te(e){return pe={p:[],l:pe,h:e,m:!0,_:0}}function ne(e){var t=e[ke];0===t.i||1===t.i?t.j():t.O=!0}function ie(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||Y("ES5").S(t,e,i),i?(n[ke].P&&(Z(t),M(4)),F(e)&&(e=oe(t,e),t.l||re(t,e)),t.u&&Y("Patches").M(n[ke].t,e,t.u,t.s)):e=oe(t,n,[]),Z(t),t.u&&t.v(t.u,t.s),e!==be?e:void 0}function oe(e,t,n){if(J(t))return t;var i=t[ke];if(!i)return $(t,(function(o,a){return ae(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return re(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=z(i.k):i.o;$(3===i.i?new Set(o):o,(function(t,a){return ae(e,i,o,t,a,n)})),re(e,o,!1),n&&e.u&&Y("Patches").R(i,n,e.u,e.s)}return i.o}function ae(e,t,n,i,o,a){if(N(o)){var r=oe(e,o,a&&t&&3!==t.i&&!x(t.D,i)?a.concat(i):void 0);if(V(n,i,r),!N(r))return;e.m=!1}if(F(o)&&!J(o)){if(!e.h.F&&e._<1)return;oe(e,o),t&&t.A.l||re(e,o)}}function re(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&q(t,n)}function se(e,t){var n=e[ke];return(n?K(n):e)[t]}function le(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 ce(e){e.P||(e.P=!0,e.l&&ce(e.l))}function ue(e){e.o||(e.o=z(e.t))}function de(e,t,n){var i=W(t)?Y("MapSet").N(t,n):B(t)?Y("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:Q(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Ee;n&&(o=[i],a=Oe);var r=Proxy.revocable(o,a),s=r.revoke,l=r.proxy;return i.k=l,i.j=s,l}(t,n):Y("ES5").J(t,n);return(n?n.A:Q()).p.push(i),i}function ye(e){return N(e)||M(22,e),function e(t){if(!F(t))return t;var n,i=t[ke],o=G(t);if(i){if(!i.P&&(i.i<4||!Y("ES5").K(i)))return i.t;i.I=!0,n=fe(t,o),i.I=!1}else n=fe(t,o);return $(n,(function(t,o){i&&function(e,t){return 2===G(e)?e.get(t):e[t]}(i.t,t)===o||V(n,t,e(o))})),3===o?new Set(n):n}(e)}function fe(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return z(e)}var ge,pe,Se="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ve="undefined"!=typeof Map,he="undefined"!=typeof Set,me="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,be=Se?Symbol.for("immer-nothing"):((ge={})["immer-nothing"]=!0,ge),Ae=Se?Symbol.for("immer-draftable"):"__$immer_draftable",ke=Se?Symbol.for("immer-state"):"__$immer_state",Te=("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,Ie=Object.getOwnPropertyDescriptors||function(e){var t={};return Pe(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Le={},Ee={get:function(e,t){if(t===ke)return e;var n=K(e);if(!x(n,t))return function(e,t,n){var i,o=le(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||!F(i)?i:i===se(e.t,t)?(ue(e),e.o[t]=de(e.A.h,i,e)):i},has:function(e,t){return t in K(e)},ownKeys:function(e){return Reflect.ownKeys(K(e))},set:function(e,t,n){var i=le(K(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=se(K(e),t),a=null==o?void 0:o[ke];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(j(n,o)&&(void 0!==n||x(e.t,t)))return!0;ue(e),ce(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!==se(e.t,t)||t in e.t?(e.D[t]=!1,ue(e),ce(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=K(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(){M(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){M(12)}},Oe={};$(Ee,(function(e,t){Oe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Oe.deleteProperty=function(e,t){return Oe.set.call(this,e,t,void 0)},Oe.set=function(e,t,n){return Ee.set.call(this,e[0],t,n,e[0])};var we=function(){function e(e){var t=this;this.g=me,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&&M(6),void 0!==i&&"function"!=typeof i&&M(7),F(e)){var s=te(t),l=de(t,e,void 0),c=!0;try{r=n(l),c=!1}finally{c?Z(s):ee(s)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return X(s,i),ie(e,s)}),(function(e){throw Z(s),e})):(X(s,i),ie(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===be&&(r=void 0),t.F&&q(r,!0),i){var u=[],d=[];Y("Patches").M(e,r,u,d),i(u,d)}return r}M(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){F(e)||M(8),N(e)&&(e=ye(e));var t=te(this),n=de(this,e,void 0);return n[ke].C=!0,ee(t),n},t.finishDraft=function(e,t){var n=(e&&e[ke]).A;return X(n,t),ie(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!me&&M(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=Y("Patches").$;return N(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Ce=new we,De=Ce.produce,Re=(Ce.produceWithPatches.bind(Ce),Ce.setAutoFreeze.bind(Ce),Ce.setUseProxies.bind(Ce),Ce.applyPatches.bind(Ce),Ce.createDraft.bind(Ce),Ce.finishDraft.bind(Ce),De);function Ue(e,t,n){return(t=L(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _e(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 Me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(n),!0).forEach((function(t){Ue(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ne(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 Fe="function"==typeof Symbol&&Symbol.observable||"@@observable",$e=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ge={INIT:"@@redux/INIT"+$e(),REPLACE:"@@redux/REPLACE"+$e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+$e()}};function xe(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 Ve(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ne(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ne(1));return n(Ve)(e,t)}if("function"!=typeof e)throw new Error(Ne(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(Ne(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ne(4));if(l)throw new Error(Ne(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(Ne(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!xe(e))throw new Error(Ne(7));if(void 0===e.type)throw new Error(Ne(8));if(l)throw new Error(Ne(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(Ne(10));o=e,y({type:Ge.REPLACE})}function g(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ne(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Fe]=function(){return this},e}return y({type:Ge.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Fe]=g,i}function je(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:Ge.INIT}))throw new Error(Ne(12));if(void 0===n(void 0,{type:Ge.PROBE_UNKNOWN_ACTION()}))throw new Error(Ne(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(Ne(14));o[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function We(){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 Be(){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(Ne(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=We.apply(void 0,a)(n.dispatch),Me(Me({},n),{},{dispatch:i})}}}function Ke(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 ze=Ke();ze.withExtraArgument=Ke;var qe,He=ze,Je=(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)}),Ye=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},Qe=Object.defineProperty,Xe=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Ze=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable,tt=function(e,t,n){return t in e?Qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},nt=function(e,t){for(var n in t||(t={}))Ze.call(t,n)&&tt(e,n,t[n]);if(Xe)for(var i=0,o=Xe(t);i<o.length;i++)n=o[i],et.call(t,n)&&tt(e,n,t[n]);return e},it="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?We:We.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var ot=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 Je(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,Ye([void 0],e[0].concat(this)))):new(t.bind.apply(t,Ye([void 0],e.concat(this))))},t}(Array);function at(e){return F(e)?Re(e,(function(){})):e}function rt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new ot);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(He):i.push(He.withExtraArgument(n.extraArgument))),i}function st(e){var t,n=function(e){return rt(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=je(a)}var g=s;"function"==typeof g&&(g=g(n));var p=Be.apply(void 0,g),S=We;c&&(S=it(nt({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(f)?v=Ye([p],f):"function"==typeof f&&(v=f(v)),Ve(t,d,S.apply(void 0,v))}function lt(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 nt(nt({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 ct(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 ut(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:at(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?ct(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=nt(nt({},o),s);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?ct(t):[t,n,i],r=a[0],s=a[1],l=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return at(e())};else{var c=at(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Ye([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(N(e))return void 0===(i=n(e,t))?e:i;if(F(e))return Re(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?lt(c,i):lt(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 dt="listenerMiddleware";lt(dt+"/add"),lt(dt+"/removeAll"),lt(dt+"/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[ke];return Ee.get(t,e)},set:function(t){var n=this[ke];Ee.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ke];if(!o.P)switch(o.i){case 5:i(o)&&ce(o);break;case 4:n(o)&&ce(o)}}}function n(e){for(var t=e.t,n=e.k,i=Pe(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==ke){var r=t[a];if(void 0===r&&!x(t,a))return!0;var s=n[a],l=s&&s[ke];if(l?l.t!==r:!j(s,r))return!0}}var c=!!t[ke];return i.length!==Pe(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){Le[e]||(Le[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=Ie(n);delete a[ke];for(var r=Pe(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:Q(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ke,{value:a,writable:!0}),o},S:function(e,n,o){o?N(n)&&n[ke].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ke];if(n){var o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)$(a,(function(t){t!==ke&&(void 0!==o[t]||x(o,t)?r[t]||e(a[t]):(r[t]=!0,ce(n)))})),$(o,(function(e){void 0!==a[e]||x(a,e)||(r[e]=!1,ce(n))}));else if(5===s){if(i(n)&&(ce(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 yt=(e,t)=>n=>C({},n,{[e]:t[e]}),ft=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),gt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return C({},n,{[e]:C({},n[e],{[t]:C({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),pt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return C({},t,{[e]:C({},t[e],{loaders:C({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),St=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return C({},t,{[e]:C({},t[e],{errors:C({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),vt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:o})=>{var a;return C({},i,{[e]:C({},i[e],{[t]:C({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),ht=(e,t,n)=>i=>{var o;return C({},i,{[e]:C({},i[e],{[t]:C({},null==i||null==(o=i[e])?void 0:o[t],n)})})},mt=(e=500)=>new Promise((t=>setTimeout(t,e))),bt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",At=new Uint8Array(256);for(let e=0;e<bt.length;e++)At[bt.charCodeAt(e)]=e;const kt=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=At[e.charCodeAt(i)],a=At[e.charCodeAt(i+1)],r=At[e.charCodeAt(i+2)],s=At[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},Tt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(Tt(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+=bt[t[i]>>2],o+=bt[(3&t[i])<<4|t[i+1]>>4],o+=bt[(15&t[i+1])<<2|t[i+2]>>6],o+=bt[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]=Tt(e[n]);return t}return e};let Pt,It,Lt;!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"}(Pt||(Pt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(It||(It={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Lt||(Lt={}));const Et="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Ot="HOSTED_LOGIN_VERIFIER_KEY",wt="auth",Ct="connectivity",Dt="auditLogs",Rt="vendor",Ut={flow:It.Login,step:Pt.preLogin,loading:!1,email:"",tenants:[]},_t={setLoginState:ft("loginState"),resetLoginState:yt("loginState",{loginState:Ut})},Mt={requestAuthorize:lt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:lt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:lt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:lt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:lt("auth/afterAuthNavigation"),preLogin:lt("auth/preLogin",(e=>({payload:e}))),postLogin:lt("auth/postLogin",(e=>({payload:e}))),login:lt("auth/login",(e=>({payload:e}))),loginWithMfa:lt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:lt("auth/recoverMfa",(e=>({payload:e}))),logout:lt("auth/logout",(e=>({payload:e}))),silentLogout:lt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:lt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:lt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:lt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:lt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:lt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:lt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:lt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:lt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:lt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:lt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:lt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:lt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:lt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:lt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:lt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:lt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:lt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:lt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:lt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:lt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:lt("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Nt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Nt||(Nt={}));const Ft={step:Nt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},$t={setActivateState:ft("activateState"),resetActivateState:yt("activateState",{activateState:Ft}),setActivateStrategyState:gt("activateState","activationStrategy")},Gt={activateAccount:lt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:lt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:lt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:lt("auth/resendActivationEmail",(e=>({payload:e})))};let xt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(xt||(xt={}));const Vt={step:xt.validate},jt={setAcceptInvitationState:ft("acceptInvitationState"),resetAcceptInvitationState:yt("acceptInvitationState",{acceptInvitationState:Vt})},Wt={acceptInvitation:lt("auth/acceptInvitation",(e=>({payload:e})))};let Bt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Bt||(Bt={}));const Kt={step:Bt.forgotPassword,loading:!1,email:"",passwordConfig:null},zt={setForgotPasswordState:ft("forgotPasswordState"),resetForgotPasswordState:yt("forgotPasswordState",{forgotPasswordState:Kt})},qt={forgotPassword:lt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:lt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:lt("auth/loadPasswordConfig",(e=>({payload:e})))};let Ht;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Ht||(Ht={}));const Jt={step:Ht.ResetPhoneNumber,loading:!1},Yt={setResetPhoneNumberState:ft("resetPhoneNumberState"),resetResetPhoneNumberState:yt("resetPhoneNumberState",{resetPhoneNumberState:Jt})},Qt={resetPhoneNumber:lt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:lt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:lt("auth/changePhoneNumber",(e=>({payload:e})))},Xt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Zt={setSSOLoader:pt("ssoState"),setSSOError:St("ssoState"),setSSOState:ft("ssoState"),resetSSOState:yt("ssoState",{ssoState:Xt})},en={loadSSOConfigurationsV2:lt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:lt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:lt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:lt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:lt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:lt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:lt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:lt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:lt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:lt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:lt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:lt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:lt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:lt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:lt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:lt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:lt("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:lt("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:lt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:lt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:lt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:lt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:lt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:lt("auth/oidcPostlogin",(e=>({payload:e})))},tn={loading:!1,error:null},nn={setProfileState:ft("profileState"),resetProfileState:yt("profileState",{profileState:tn})},on={loadProfile:lt("auth/loadProfile"),saveProfile:lt("auth/saveProfile",(e=>({payload:e}))),changePassword:lt("auth/changePassword",(e=>({payload:e})))};let an;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(an||(an={}));const rn={step:an.verify,loading:!1,saving:!1},sn={setMfaState:ft("mfaState"),resetMfaState:yt("mfaState",{mfaState:rn})},ln={enrollMfa:lt("auth/enrollMfa"),getMFADevices:lt("auth/getMFADevices"),getMFAStrategies:lt("auth/getMFAStrategies"),verifyMfa:lt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:lt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:lt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:lt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:lt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:lt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:lt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:lt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:lt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:lt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:lt("auth/disableMfaWebAuthn",(e=>({payload:e})))},cn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},un={setTeamLoader:pt("teamState"),setTeamError:St("teamState"),setTeamState:ft("teamState"),resetTeamState:yt("teamState",{teamState:cn})},dn={loadUsers:lt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:lt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:lt("auth/loadRoles",(e=>({payload:e}))),addUser:lt("auth/addUser",(e=>({payload:e}))),addUsersBulk:lt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:lt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:lt("auth/updateUser",(e=>({payload:e}))),deleteUser:lt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:lt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:lt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:lt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:lt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:lt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:lt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:lt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:lt("auth/getInvitationLink"),createInvitationLink:lt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:lt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:lt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:lt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:lt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:lt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:lt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:lt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:lt("auth/closeLockUserDialog",(e=>({payload:e})))},yn={firstLoad:!0,loading:!1,error:""},fn={setSocialLoginsState:ft("socialLoginState"),resetSocialLoginsState:yt("socialLoginState",{socialLoginState:yn})},gn={loadSocialLoginsConfiguration:lt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:lt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:lt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:lt("auth/setSocialLoginError",(e=>({payload:e})))};let pn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(pn||(pn={}));const Sn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:pn.SignUp},vn={setSignUpState:ft("signUpState"),resetSignUpState:yt("signUpState",{signUpState:Sn})},hn={signUpUser:lt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:lt("auth/resetSignUpStateSoft")},mn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},bn={setApiTokensLoader:pt("apiTokensState"),setApiTokensError:St("apiTokensState"),setApiTokensState:ft("apiTokensState"),resetApiTokensState:yt("apiTokensState",{apiTokensState:mn})},An={loadApiTokens:lt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:lt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:lt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:lt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:lt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:lt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:lt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:lt("auth/deleteTenantApiToken",(e=>({payload:e})))},kn={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}},Tn={setSecurityPolicyState:ft("securityPolicyState"),setSecurityPolicyGlobalState:gt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:gt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:gt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:gt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:gt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:gt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:gt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:gt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:gt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:gt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:gt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:yt("securityPolicyState",{securityPolicyState:kn})},Pn={loadSecurityPolicy:lt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:lt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:lt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:lt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:lt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:lt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:lt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:lt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:lt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:lt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:lt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:lt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:lt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:lt("auth/loadPublicAuthStrategiesPolicy")},In={loading:!1},Ln={setAccountSettingsState:ft("accountSettingsState"),resetAccountSettingsState:yt("accountSettingsState",{accountSettingsState:In})},En={loadAccountSettings:lt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:lt("auth/saveAccountSettings",(e=>({payload:e})))},On={tenants:[],subTenants:[],loading:!0,tenantTree:null},wn={setTenantsState:ft("tenantsState"),resetTenantsState:yt("tenantsState",{tenantsState:On})},Cn={switchTenant:lt("auth/switchTenant",(e=>({payload:e}))),loadTenants:lt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:lt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:lt("auth/loadSubTenantsTree",(e=>({payload:e})))},Dn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Rn={setRolesState:ft("rolesState"),resetRolesState:yt("rolesState",{rolesState:Dn})},Un={loadRolesAndPermissions:lt("auth/loadRoles",(e=>({payload:e}))),addRole:lt("auth/addRole",(e=>({payload:e}))),updateRole:lt("auth/updateRole",(e=>({payload:e}))),deleteRole:lt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:lt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:lt("auth/attachPermissionToRoles",(e=>({payload:e})))},_n={loading:!1,sessions:[]},Mn={setSessionsState:ft("sessionsState"),resetSessionsState:yt("sessionsState",{sessionsState:_n})},Nn={loadUserSessions:lt("auth/loadUserSessions"),loadCurrentUserSession:lt("auth/loadCurrentUserSession"),deleteUserSession:lt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:lt("auth/deleteAllUserSessions"),revokeUserSessions:lt("auth/revokeUserSessions",(e=>({payload:e})))},Fn={loading:!1,configurations:{}},$n={setSessionsPolicyState:ft("sessionsPolicyState"),resetSessionsPolicyState:yt("sessionsPolicyState",{sessionsPolicyState:Fn})},Gn={loadSessionsPolicy:lt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:lt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let xn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(xn||(xn={}));const Vn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:xn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},jn={setRestrictionsState:ft("restrictionsState"),setIpRestrictionsState:gt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:gt("restrictionsState","emailDomainRestrictions")},Wn={checkIfUserIpValid:lt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:lt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:lt("auth/loadIpRestrictions"),saveIpRestriction:lt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:lt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:lt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:lt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:lt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:lt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:lt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Bn={loading:!1},Kn={setProvisioningState:ft("provisioningState"),resetProvisioningState:yt("provisioningState",{provisioningState:Bn})},zn={loadProvisionConnections:lt("auth/loadProvisionConnections"),createProvisionConnection:lt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:lt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:lt("auth/updateProvisionConnection",(e=>({payload:e})))},qn={devices:[],loading:!1,error:null},Hn={setPasskeysState:ft("passkeysState"),resetPasskeysState:yt("passkeysState",{passkeysState:qn})},Jn={loadWebAuthnDevices:lt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:lt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Yn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Qn={setUsersGroupsLoader:pt("groupsState"),setUsersGroupsError:St("groupsState"),setGroupsState:ft("groupsState"),resetUsersGroupsState:yt("groupsState",{groupsState:Yn})},Xn={loadGroups:lt("auth/loadUsersGroups"),getGroupById:lt("auth/getGroupById",(e=>({payload:e}))),createGroup:lt("auth/createGroup",(e=>({payload:e}))),updateGroup:lt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:lt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:lt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:lt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:lt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:lt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:lt("auth/getGroupConfiguration"),updateGroupConfiguration:lt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:lt("auth/getUsers",(e=>({payload:e})))},Zn={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}},ei={setGroupsDialogsState:ft("groupsDialogsState"),resetGroupsDialogsState:yt("groupsState",{groupsDialogsState:Zn}),openAddGroupDialog:ht("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:ht("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:vt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:ht("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:vt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:ht("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:ht("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:ht("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:vt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:ht("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},ti={loading:!0,error:null},ni={setCustomLoginState:ft("customLoginState"),resetCustomLoginState:yt("customLoginState",{customLoginState:ti})},ii={loadTenantMetadata:lt("auth/loadTenantMetadata"),updateTenantMetadata:lt("auth/updateTenantMetadata",(e=>({payload:e})))},oi={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:Sn,loginState:Ut,activateState:Ft,acceptInvitationState:Vt,forgotPasswordState:Kt,ssoState:Xt,profileState:tn,customLoginState:ti,mfaState:rn,teamState:cn,groupsState:Yn,groupsDialogsState:Zn,socialLoginState:yn,apiTokensState:mn,securityPolicyState:kn,accountSettingsState:In,tenantsState:On,rolesState:Dn,resetPhoneNumberState:Jt,sessionsState:_n,sessionsPolicyState:Fn,restrictionsState:Vn,provisioningState:Bn,passkeysState:qn},ai=C({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:()=>{}},oi);let ri;!function(e){e.impersonating="impersonating",e.success="success"}(ri||(ri={}));const si={step:ri.impersonating,loading:!1},li={setImpersonateState:ft("impersonateState"),resetImpersonateState:yt("impersonateState",{impersonateState:si})},ci={impersonate:lt("impersonation/impersonate",(e=>({payload:e})))},{reducer:ui,actions:di}=ut({name:wt,initialState:ai,reducers:C({resetState:e=>C({},e,oi),setState:(e,{payload:t})=>C({},e,t),setUser:("user",(e,{payload:t})=>C({},e,{user:t}))},_t,fn,$t,li,jt,zt,Yt,vn,nn,ni,Zt,sn,un,Qn,ei,bn,Tn,Ln,wn,Rn,Mn,$n,jn,Kn,Hn)});const yi=C({},di,Mt,gn,Gt,Wt,qt,Qt,hn,on,ii,en,ln,dn,Xn,{},An,Pn,En,Cn,Un,Nn,Gn,Wn,zn,ci,Jn);var fi=function(e){return"@@redux-saga/"+e},gi=fi("CANCEL_PROMISE"),pi=fi("CHANNEL_END"),Si=fi("IO"),vi=fi("MATCH"),hi=fi("MULTICAST"),mi=fi("SAGA_ACTION"),bi=fi("SELF_CANCELLATION"),Ai=fi("TASK"),ki=fi("TASK_CANCEL"),Ti=fi("TERMINATE"),Pi=fi("LOCATION");function Ii(e,t){if(null==e)return{};var n,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var Li=function(e){return null==e},Ei=function(e){return null!=e},Oi=function(e){return"function"==typeof e},wi=function(e){return"string"==typeof e},Ci=Array.isArray,Di=function(e){return e&&Oi(e.then)},Ri=function(e){return e&&Oi(e.next)&&Oi(e.throw)},Ui=function e(t){return t&&(wi(t)||Ni(t)||Oi(t)||Ci(t)&&t.every(e))},_i=function(e){return e&&Oi(e.take)&&Oi(e.close)},Mi=function(e){return Oi(e)&&e.hasOwnProperty("toString")},Ni=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Fi=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[gi]=function(){clearTimeout(n)},i},$i=function(e){return function(){return e}},Gi=$i(!0),xi=function(){},Vi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var ji=function(e,t){C(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Wi(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Bi=function(e){throw e},Ki=function(e){return{value:e,done:!0}};function zi(e,t,n){void 0===t&&(t=Bi),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:Ki,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function qi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Hi=function(e){return Array.apply(null,new Array(e))},Ji=function(e){return function(t){return e(Object.defineProperty(t,mi,{value:!0}))}},Yi=function(e){return e===Ti},Qi=function(e){return e===ki},Xi=function(e){return Yi(e)||Qi(e)};function Zi(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=Ci(e)?Hi(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||Xi(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=xi,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function eo(e){return{name:e.name||"anonymous",location:to(e)}}function to(e){return e[Pi]}var no=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)},io="TAKE",oo="CALL",ao="FORK",ro="SELECT",so=function(e,t){var n;return(n={})[Si]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function lo(e,t){return void 0===e&&(e="*"),Ui(e)?(Ei(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),so(io,{pattern:e})):_i(n=e)&&n[hi]&&Ei(t)&&Ui(t)?so(io,{channel:e,pattern:t}):_i(e)?(Ei(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),so(io,{channel:e})):void 0;var n}function co(e,t){return Li(t)&&(t=e,e=void 0),so("PUT",{channel:e,action:t})}function uo(e){var t=so("ALL",e);return t.combinator=!0,t}function yo(e,t){var n,i=null;return Oi(e)?n=e:(Ci(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&wi(n)&&Oi(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function fo(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 so(oo,yo(e,n))}function go(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 so(ao,yo(e,n))}function po(e){return void 0===e&&(e=bi),so("CANCEL",e)}function So(e){void 0===e&&(e=Vi);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return so(ro,{selector:e,args:n})}var vo=fo.bind(null,Fi);var ho=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},mo=[],bo=0;function Ao(e){try{Po(),e()}finally{Io()}}function ko(e){mo.push(e),bo||(Po(),Lo())}function To(e){try{return Po(),e()}finally{Lo()}}function Po(){bo++}function Io(){bo--}function Lo(){var e;for(Io();!bo&&void 0!==(e=mo.shift());)Ao(e)}var Eo=function(e){return function(t){return e.some((function(e){return Ro(e)(t)}))}},Oo=function(e){return function(t){return e(t)}},wo=function(e){return function(t){return t.type===String(e)}},Co=function(e){return function(t){return t.type===e}},Do=function(){return Gi};function Ro(e){var t="*"===e?Do:wi(e)?wo:Ci(e)?Eo:Mi(e)?wo:Oi(e)?Oo:Ni(e)?Co:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Uo={type:pi},_o=function(e){return e&&e.type===pi};function Mo(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(Uo)}))},(e={})[hi]=!0,e.put=function(e){if(!t)if(_o(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[vi](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=Do),t?e(Uo):(e[vi]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Wi(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[mi]?s(e):ko((function(){s(e)}))},r}function No(e,t){var n=e[gi];Oi(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Fo,$o=0,Go=function(){return++$o};function xo(e){e.isRunning()&&e.cancel()}var Vo=((Fo={}).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):!_o(e)||r?n(e):n(Ti)};try{o.take(s,Ei(a)?Ro(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},Fo.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;ko((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&Di(t)?No(t,n):n(t)}))},Fo.ALL=function(e,t,n,i){var o=i.digestEffect,a=$o,r=Object.keys(t);if(0!==r.length){var s=Zi(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(Ci(t)?[]:{})},Fo.RACE=function(e,t,n,i){var o=i.digestEffect,a=$o,r=Object.keys(t),s=Ci(t)?Hi(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Xi(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=xi,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)}))},Fo.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(Di(l))return void No(l,n);if(Ri(l))return void Qo(e,l,s.context,$o,eo(a),!1,n);n(l)}catch(e){n(e,!0)}},Fo.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){Li(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Fo.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(Ri(o))return o;var a=!1;return zi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!Di(o)})}))}catch(e){return zi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:eo(t)}(c,a);To((function(){var t=Qo(e,c,l.context,$o,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},Fo.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()&&Wi(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Ci(t)){if(0===t.length)return void n([]);var r=Zi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Fo.CANCEL=function(e,t,n,i){var o=i.task;t===bi?xo(o):Ci(t)?t.forEach(xo):xo(t),n()},Fo.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)}},Fo.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=no());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(Uo):e.isEmpty()?(n.push(i),i.cancel=function(){Wi(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(Uo):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(Uo)}}}}(t.buffer),a=Ro(i),r=function t(n){_o(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)},Fo.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},Fo.FLUSH=function(e,t,n){t.flush(n)},Fo.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},Fo.SET_CONTEXT=function(e,t,n,i){var o=i.task;ji(o.context,t),n()},Fo);function jo(e,t){return e+"?"+t}function Wo(e){var t=e.name,n=e.location;return n?t+" "+jo(n.fileName,n.lineNumber):t}function Bo(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 Ko=null,zo=[],qo=function(e){e.crashedEffect=Ko,zo.push(e)},Ho=function(){Ko=null,zo.length=0},Jo=function(){var e,t,n=zo[0],i=zo.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=to(e))?t.code+" "+jo(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Wo(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+Wo(e.meta)})),[Bo(zo)]).join("\n")};function Yo(e,t,n,i,o,a,r){var s;void 0===r&&(r=xi);var l,c,u=0,d=null,y=[],f=Object.create(n),g=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,g.getTasks().map((function(e){return e.meta.name}))),l(),n(e,!0)}function s(t){o.push(t),t.cont=function(s,l){a||(Wi(o,t),t.cont=xi,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=xi,e.cancel()})),o=[])}return s(e),{addTask:s,cancelAll:l,abort:r,getTasks:function(){return o}}}(t,0,p);function p(t,n){if(n){if(u=2,qo({meta:o,cancelledTasks:y}),S.isRoot){var i=Jo();Ho(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===ki?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={})[Ai]=!0,s.id=i,s.meta=o,s.isRoot=a,s.context=f,s.joiners=[],s.queue=g,s.cancel=function(){0===u&&(u=1,g.cancelAll(),p(ki,!1))},s.cont=r,s.end=p,s.setContext=function(e){ji(f,e)},s.toPromise=function(){return d||(d=ho(),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 Qo(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){Di(t)?No(t,i):Ri(t)?Qo(e,t,c.context,n,o,!1,i):t&&t[Si]?(0,Vo[t.type])(e,t.payload,i,u):i(t)}));d.cancel=xi;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(ki))},status:0},c=Yo(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),Ho()):Qi(e)?(l.status=1,d.cancel(),o=Oi(t.return)?t.return(ki):{done:!0,value:ki}):o=Yi(e)?Oi(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=Go();function l(n,o){a||(a=!0,i.cancel=xi,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){Ko=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=xi,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=xi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function Xo(e,t){for(var n=e.channel,i=void 0===n?Mo():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?qi:u,y=arguments.length,f=new Array(y>2?y-2:0),g=2;g<y;g++)f[g-2]=arguments[g];var p,S=t.apply(void 0,f),v=Go();if(l&&(l.rootSagaStarted=l.rootSagaStarted||xi,l.effectTriggered=l.effectTriggered||xi,l.effectResolved=l.effectResolved||xi,l.effectRejected=l.effectRejected||xi,l.effectCancelled=l.effectCancelled||xi,l.actionDispatched=l.actionDispatched||xi,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=We.apply(void 0,c);p=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else p=Vi;var m={channel:i,dispatch:Ji(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:p};return To((function(){var e=Qo(m,S,s,v,eo(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var Zo=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?Mo():a,s=n.sagaMonitor,l=Ii(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Xo.bind(null,C({},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){ji(o,e)},c},ea=function(e){return{done:!0,value:e}},ta={};function na(e){return _i(e)?"channel":Mi(e)?String(e):Oi(e)?e.name:String(e)}function ia(e,t,n){var i,o,a,r=t;function s(t,n){if(r===ta)return ea(t);if(n&&!o)throw r=ta,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===ta?ea(t):a}return zi(s,(function(e){return s(null,e)}),n)}function oa(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:lo(e)},s=function(e){return{done:!1,value:go.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return ia({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+na(e)+", "+t.name+")")}function aa(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:lo(e)},l=function(e){return{done:!1,value:go.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:po(e)}},u=function(e){return a=e},d=function(e){return r=e};return ia({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("+na(e)+", "+t.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];var a,r={done:!1,value:lo(e)},s=function(e){return{done:!1,value:fo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return ia({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+na(e)+", "+t.name+")")}function sa(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:fo.apply(void 0,[n].concat(a))},l={done:!1,value:vo(t)};return ia({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:ta}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function la(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 go.apply(void 0,[oa,e,t].concat(i))}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];return go.apply(void 0,[aa,e,t].concat(i))}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];return go.apply(void 0,[ra,e,t].concat(i))}class da{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"}static getInstance(){return da.instance||(da.instance=new da),da.instance}static setContext(e){da.getInstance().context=e}static setAccessToken(e){da.getInstance().accessToken=e}static setUser(e){da.getInstance().user=e}static setRequestSource(e){da.getInstance().requestSource=e}static setOnRedirectTo(e){da.getInstance().onRedirectTo=e}static setLogout(e,t){da.getInstance().logout=n=>{n?e(n):da.onRedirectTo(t)}}static getContext(){var e;return null!=(e=da.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return da.getInstance().accessToken}static getRequestSource(){return da.getInstance().requestSource}static getUser(){return da.getInstance().user}static onRedirectTo(e,t){return da.getInstance().onRedirectTo(e,t)}static logout(e){return da.getInstance().logout(e)}}da.instance=void 0;const ya={getContext:()=>da.getContext(),getAccessToken:()=>da.getAccessToken(),getUser:()=>da.getUser(),onRedirectTo:(e,t)=>da.onRedirectTo(e,t),logout:e=>da.logout(e)},fa={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let ga,pa;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ga||(ga={})),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"}(pa||(pa={}));class Sa extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function va(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 ha(e){var t,n;const i={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(i[fa.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(i[fa.frameWork]=e.metadataHeaders.framework),i}const ma=async e=>{var t,n,i;const o=da.getContext(),a=await async function(e,t){var n;const i=ha(e),o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:da.getAccessToken)(),a=da.getRequestSource();t&&(i[fa.contentType]=t),a&&(i[fa.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=va(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:C({},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 Sa("Error request is too large",s.status);let e;try{e=await s.text(),e=JSON.parse(e)}catch(e){}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 Sa(e,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{}}},ba=async(e,t,n)=>ma(C({url:e,method:"GET",contentType:"application/json",params:t},n)),Aa=async(e,t,n)=>ma(C({url:e,method:"POST",contentType:"application/json",body:t},n)),ka=async(e,t,n)=>ma(C({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Ta=async(e,t,n)=>ma(C({url:e,method:"PUT",contentType:"application/json",body:t},n)),Pa=async(e,t,n)=>ma(C({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Ia=async(e,t,n,i)=>ma(C({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),La=(e={})=>C({},e.jwt?{Authorization:e.jwt}:{}),Ea={v1:"/identity/resources/users/webauthn/v1/devices"},Oa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},wa={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",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"}}},Ca={v1:"/identity/resources/configurations/v1"},Da={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Ra={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ua={v1:"/identity/resources/permissions/v1"},_a={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"}},Ma={v1:"/identity/resources/roles/v1"},Na={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Fa={v1:"/identity/resources/impersonation/v1"},$a={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Ga={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},xa={v1:"/team/resources/members/v1"},Va={v1:"/team/resources/roles/v1"},ja={v1:"/team/resources/stats/v1"},Wa={v1:"/team/resources/profile"},Ba={v1:"/tenants/resources/account-settings/v1"},Ka={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"}},za={v1:"/tenants/resources/sub-tenants/v1"},qa={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Ha={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"}}}},Ja={v1:"/subscriptions/resources/payment-providers/v1"},Ya={v1:"/subscriptions/resources/subscriptions/v1"},Qa={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Xa={v1:"/reports/engine/resources/triggers/v1"},Za="/notification",er="/audits",tr={v1:"/event/resources/configurations/v1"},nr="/webhook",ir="/oauth",or="/flags",ar="/directory/resources/v1/configurations/scim2",rr="/directory/resources/scim/temp",sr="/entitlements";async function lr(e){return Ta(`${wa.v1}/tenant`,e)}async function cr(){return ba(`${wa.v2}/me/tenants`)}async function ur(e){return ba(Ka.v1,void 0,{headers:La(e)})}async function dr(e){return ba(Ka.tree.v1,void 0,{headers:La(e)})}async function yr(e){return ba(Ka.parents.v1,void 0,{headers:La(e)})}async function fr(e,t){return Aa(`${_a.users.v1}/count`,e,{headers:La(t)})}async function gr(){return ba(Ca.v1)}async function pr(){return ba(`${Ca.v1}/mfa-policy`)}async function Sr(){return ba(`${Ca.v1}/mfa-policy/vendor`)}async function vr(e){return e.id?ka(`${Ca.v1}/mfa-policy`,e):Aa(`${Ca.v1}/mfa-policy`,e)}async function hr(){return ba(`${Ca.v1}/lockout-policy`)}async function mr(){return ba(`${Ca.v1}/lockout-policy/vendor`)}async function br(e){return e.id?ka(`${Ca.v1}/lockout-policy`,e):Aa(`${Ca.v1}/lockout-policy`,e)}async function Ar(){try{return await ba(`${Ca.v1}/captcha-policy/public`)}catch{return null}}async function kr(){return ba(`${Ca.v1}/password-history-policy`)}async function Tr(){return ba(`${Ca.v1}/password-history-policy/vendor`)}async function Pr(e){return e.id?ka(`${Ca.v1}/password-history-policy`,e):Aa(`${Ca.v1}/password-history-policy`,e)}async function Ir(){return ba(`${Ca.v1}/password`)}async function Lr(){return ba(`${Da.emailDomain.v1}`)}async function Er(){return ba(`${Da.emailDomain.v1}/config`)}async function Or(e){return Aa(`${Da.emailDomain.v1}`,e)}async function wr(e){return Aa(`${Da.emailDomain.v1}/config`,e)}async function Cr(e){return Pa(`${Da.emailDomain.v1}/${e}`)}async function Dr(e){return ba(`${Da.ip.v1}`,e)}async function Rr(){return ba(`${Da.ip.v1}/config`)}async function Ur(e){return Aa(`${Da.ip.v1}`,e)}async function _r(e){return Aa(`${Da.ip.v1}/bulk`,e)}async function Mr(e){return Aa(`${Da.ip.v1}/config`,e)}async function Nr(e){return Pa(`${Da.ip.v1}/${e}`)}async function Fr(){return Aa(`${Da.ip.v1}/verify`)}async function $r(){return Aa(`${Da.ip.v1}/verify/allow`)}let Gr,xr,Vr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Gr||(Gr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(xr||(xr={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Vr||(Vr={}));class jr extends Error{constructor(e){super(e)}}const Wr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new jr("'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 Br extends Error{constructor(e){super(e)}}const Kr=(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(Wr(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 Wr(t)}})(e.split(".")[n]))}catch(e){throw new Br("Invalid token specified: "+e.message)}},zr=["type"],qr=["type"];async function Hr(e){if(!e.accessToken)return e;da.setAccessToken(e.accessToken);const t=await ba(`${wa.v2}/me`),n=C({},e,e.accessToken?Kr(e.accessToken):{},t);return da.setUser(n),n}async function Jr(e){if(!e.accessToken)return{user:e};da.setAccessToken(e.accessToken);const[t,n]=await Promise.all([ba(`${wa.v2}/me`),cr()]),i=C({},e,e.accessToken?Kr(e.accessToken):{},t);return da.setUser(i),{user:i,tenants:n}}async function Yr(e){da.setAccessToken(e.id_token);const t=await ba(`${wa.v2}/me`),n=e.id_token?Kr(e.id_token):{},i=C({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return da.setUser(i),i}async function Qr(e){try{const{address:t}=await Aa(`${Oa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Xr(e){return Aa(`${Oa.v1}/user/saml/prelogin`,e)}async function Zr(e){return Hr(await Aa(`${Oa.v1}/user/saml/postlogin`,e))}async function es(e){return Hr(await Aa(`${Oa.v1}/user/oidc/postlogin`,e))}async function ts(e){return Hr(await Aa(`${Oa.v1}/user`,e))}async function ns(e){return Hr(await Aa(`${Oa.v1}/user/mfa/verify`,e))}async function is(e){return Aa(`${wa.v1}/activate`,e)}async function os(e){return ba(`${wa.v1}/activate/strategy`,e)}async function as(e){return Aa(`${wa.v1}/activate/reset`,e)}async function rs(e){return Aa(`${wa.v1}/invitation/reset`,e)}async function ss(e){return Aa(`${wa.v1}/invitation/accept`,e)}async function ls(){return Hr(await Aa(`${Oa.v1}/user/token/refresh`))}async function cs(){return Jr(await Aa(`${Oa.v1}/user/token/refresh`))}async function us(){return Aa(`${Oa.v1}/logout`)}async function ds(e){return ba(`${ir}/logout`,e)}async function ys(e){return Aa(`${wa.v1}/passwords/reset`,e)}async function fs(e){return Aa(`${wa.v1}/passwords/reset/verify`,e)}async function gs(e){return ba(`${wa.v1}/passwords/config`,e)}async function ps(e){return Aa(`${Oa.v1}/user/mfa/recover`,e)}async function Ss(){return Aa(`${wa.v1}/mfa/enroll`)}async function vs(){return Aa(`${wa.v1}/mfa/authenticator/enroll`)}async function hs(e){return Aa(`${wa.v1}/mfa/authenticator/enroll/verify`,e)}async function ms(e){return Aa(`${wa.v1}/mfa/sms/enroll`,e)}async function bs(e){return Aa(`${wa.v1}/mfa/sms/enroll/verify`,e)}async function As(){return Aa(`${wa.v1}/mfa/webauthn/enroll`)}async function ks(e){return Aa(`${wa.v1}/mfa/webauthn/enroll/verify`,e)}async function Ts(e){return Aa(`${wa.v1}/mfa/enroll/verify`,e)}async function Ps(e){return Aa(`${wa.v1}/mfa/disable`,e)}async function Is(e,t){return Aa(`${wa.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Ls(e){return Aa(`${wa.v1}/mfa/sms/${e}/disable`)}async function Es(e,t){return Aa(`${wa.v1}/mfa/sms/${e}/disable/verify`,t)}async function Os(e){return Aa(`${wa.v1}/mfa/webauthn/${e}/disable`)}async function ws(e,t){return Aa(`${wa.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Cs(){return ba(`${wa.v1}/mfa/devices`)}async function Ds(e){return Aa(`${Oa.v1}/user/mfa/authenticator/enroll`,e)}async function Rs(e){return Aa(`${Oa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Us(e,t){return Aa(`${Oa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function _s(e){return Aa(`${Oa.v1}/user/mfa/sms/enroll`,e)}async function Ms(e){return Aa(`${Oa.v1}/user/mfa/sms/enroll/verify`,e)}async function Ns(e,t){return Aa(`${Oa.v1}/user/mfa/sms/${e}`,t)}async function Fs(e,t){return Aa(`${Oa.v1}/user/mfa/sms/${e}/verify`,t)}async function $s(e){return Aa(`${Oa.v1}/user/mfa/webauthn/enroll`,e)}async function Gs(e){return Aa(`${Oa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function xs(e,t){return Aa(`${Oa.v1}/user/mfa/webauthn/${e}`,t)}async function Vs(e,t){return Aa(`${Oa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function js(){return ba(`${Ga.v1}/saml/configurations`)}async function Ws(e){return Aa(`${Ga.v1}/saml/configurations`,e)}async function Bs(){return ba(`${Ga.v1}/saml/configurations/vendor-config`)}async function Ks(e){return Ta(`${Ga.v1}/saml/configurations/metadata`,e)}async function zs(){return Ta(`${Ga.v1}/saml/validations/domain`)}async function qs(){return ba(`${Ga.v1}/saml/configurations/roles/default`)}async function Hs(){return ba(`${Ga.v2}/saml/configurations/groups`)}async function Js({roleIds:e}){return Aa(`${Ga.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Ys({roleIds:e,group:t}){return Aa(`${Ga.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Qs({roleIds:e,group:t,id:n}){return ka(`${Ga.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Xs({id:e}){return Pa(`${Ga.v2}/saml/configurations/groups/${e}`)}async function Zs(){return ba(`${Ga.v1}/oidc/configurations`)}async function el(){return ba(`${Ga.v2}/configurations/public`)}async function tl(){return ba(Ra.v1)}async function nl(){return ba(Ra.v2)}async function il(){return ba(Ra.custom.v1)}async function ol({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),Aa(`${Oa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function al(){return ba(`${Ca.v1}/public`)}async function rl(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Aa(`${wa.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await Hr(n):void 0,userId:i,tenantId:o}}async function sl(){return ba(wa.sessions.currentUser.v1)}async function ll(){return ba(`${wa.sessions.currentUser.v1}/current`)}async function cl(e){return Aa(`${wa.sessions.v1}/revoke`,{userId:e})}async function ul(){return ba(wa.sessions.configurations.v1)}async function dl(e){await Aa(wa.sessions.configurations.v1,e)}async function yl(e){await Pa(`${wa.sessions.currentUser.v1}/${e}`)}async function fl(){await Pa(`${wa.sessions.currentUser.v1}/all`)}async function gl(){return ba(wa.accessTokens.v1)}async function pl(){return ba(_a.accessTokens.v1)}async function Sl({id:e}){return Pa(`${_a.accessTokens.v1}/${e}`)}async function vl({id:e}){return Pa(`${wa.accessTokens.v1}/${e}`)}async function hl(e){return Aa(wa.accessTokens.v1,e)}async function ml(e){return Aa(_a.accessTokens.v1,e)}async function bl(){return ba(wa.apiTokens.v1)}async function Al(){return ba(_a.apiTokens.v1)}async function kl(e){return Aa(wa.apiTokens.v1,e)}async function Tl(e){return Aa(_a.apiTokens.v2,e)}async function Pl({tokenId:e}){return Pa(`${_a.apiTokens.v1}/${e}`)}async function Il({tokenId:e}){return Pa(`${wa.apiTokens.v1}/${e}`)}async function Ll({userId:e}){return ba(`${wa.v1}/${e}`)}async function El(e){return ba(`${Ca.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Ol(e){let{type:t}=e,n=Ii(e,zr);return Aa(`${Oa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function wl(e){let{type:t}=e,n=Ii(e,qr);return Aa(`${Oa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Cl({token:e}){return Aa(_a.invites.verify.v1,{token:e})}async function Dl(){return ba(`${Ga.v1}/configurations`)}async function Rl(e){return Aa(`${Ga.v1}/configurations`,e)}async function Ul(e,t){return ka(`${Ga.v1}/configurations/${e}`,t)}async function _l(e){return Pa(`${Ga.v1}/configurations/${e}`)}async function Ml(e){return Aa(`${Ga.v1}/configurations/metadata`,e)}async function Nl(e,t){return Ta(`${Ga.v1}/configurations/${e}/metadata`,t)}async function Fl(e,t){return Aa(`${Ga.v1}/configurations/${e}/domains`,t)}async function $l(e,t){return Pa(`${Ga.v1}/configurations/${e}/domains/${t}`)}async function Gl(e,t){return Ta(`${Ga.v1}/configurations/${e}/domains/${t}/validate`)}async function xl(e){return ba(`${Ga.v1}/configurations/${e}/roles`)}async function Vl(e,t){return Ta(`${Ga.v1}/configurations/${e}/roles`,t)}async function jl(e,t){return Aa(`${Ga.v1}/configurations/${e}/groups`,t)}async function Wl(e,{roleIds:t,group:n,id:i}){return ka(`${Ga.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function Bl(e,t){return Pa(`${Ga.v1}/configurations/${e}/groups/${t}`)}async function Kl(e){return ba(`${Ga.v1}/configurations/${e}/groups`)}async function zl(e){return Aa(`${Oa.v2}/user/sso/prelogin`,e)}async function ql(e){return Hr(await Aa(`${Oa.v2}/user/oidc/postlogin`,e))}async function Hl(e){return Yr(await Aa(`${ir}/token`,e))}async function Jl(){return Yr(await Aa(`${ir}/authorize/silent`))}async function Yl(e){return Aa(`${wa.v1}/phone/reset`,e)}async function Ql(e){return Aa(`${wa.v1}/phone/reset/verify`,e)}async function Xl(e){return Aa(`${wa.v1}/phone`,e)}async function Zl(e){return Aa(`${wa.v1}/phone/verify`,e)}async function ec(e){return Ta(`${wa.v1}/phone/change`,e)}async function tc(e){return Aa(`${Oa.v1}/webauthn/prelogin`,e)}async function nc(e){return Aa(`${Oa.v1}/webauthn/postlogin`,e)}async function ic(){return Aa(Ea.v1)}async function oc(){return ba(Ea.v1)}async function ac(e){return Pa(`${Ea.v1}/${e}`)}async function rc(e){return Aa(`${Ea.v1}/verify`,e)}async function sc(){return ba(`${Ca.v1}/auth/strategies/public`)}async function lc(){return ba(`${Ca.v1}/mfa/strategies`)}async function cc(e){return ba(`${wa.v2}/me`,null!=e?e:{addRoles:!0})}async function uc(e){return Ta(`${wa.v2}/me`,e)}async function dc(e){return Ta(`${Wa.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function yc(e){return Aa(`${wa.v1}/passwords/change`,e)}async function fc(e){var t,n,i,o,a,r;const s=(e.filter||[]).reduce(((e,t)=>C({},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 ba(xa.v1,C({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function gc(e){return Aa(wa.v2,C({},e,{provider:"local"}))}async function pc(e){return Pa(`${xa.v1}/${e.userId}`)}async function Sc(e){return Ta(xa.v1,e)}async function vc(e){return Aa(_a.invites.user.v1,C({},e))}async function hc(e){return ka(_a.invites.user.v1,C({},e))}async function mc(){return Pa(_a.invites.user.v1)}async function bc(){return ba(_a.invites.user.v1)}async function Ac(){return ba(_a.invites.configuration.v1)}async function kc(){return ba(Va.v1)}async function Tc(){return ba(Ua.v1)}async function Pc(){return ba(`${ja.v1}/members`)}async function Ic(e){return Aa(`${xa.v1}/${e.userId}/resendActivationEmail`,{})}async function Lc(e){return Aa(wa.v2,C({},e,{provider:"local"}))}async function Ec(e){return Aa(wa.invitation.resendAll.v1,C({},e))}async function Oc(e){var t,n;const i=await ba("/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 wc(){return ba("/metadata/admin-box")}async function Cc(e){return Aa("/metadata/admin-box",e)}async function Dc(){const e=await ba("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Rc=async()=>Oc({entityName:"notifications"}),Uc=async()=>Oc({entityName:"saml"}),_c=async()=>Oc({entityName:"audits"}),Mc=async e=>async function(e){const t=await ba(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Nc=["dataFilters"],Fc=["templateId","dataFilters"],$c=["dataFilters"];async function Gc(e){return ba(`${Qa.v2}/tenant-reports`,e)}async function xc(e){return ba(`${Qa.v2}/${e.id}/tenant-reports`)}async function Vc(e){let{dataFilters:t}=e,n=Ii(e,Nc);return{html:await ba(`${Xa.v1}/preview-report`,C({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function jc(e){let{templateId:t,dataFilters:n}=e,i=Ii(e,Fc);return Aa(`${Qa.v2}/${t}/tenant-reports`,C({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Wc(e){let{dataFilters:t}=e,n=Ii(e,$c);const i=await ba(`${Xa.v1}/preview-report`,C({},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 Bc(e){return Aa(`${Xa.v1}/tenant-reports`,e)}async function Kc(e){return ba(Za,{params:e})}async function zc(e){return Ta(`${Za}/status`,{params:e})}async function qc(e){const{notificationId:t,pinStatus:n}=e;return Ta(`${Za}/${n}`,{notificationId:t})}async function Hc(){return Aa(`${Za}/status/mark-all-read`)}const Jc=["endpoint","headerProps"];async function Yc(e){return ba(er,e)}async function Qc(e){return ba(`${er}/stats`,e)}async function Xc(e){const{endpoint:t,headerProps:n}=e,i=Ii(e,Jc);return Ia(`${er}/export/${t}`,{properties:n},i)}const Zc=["eventKey"],eu=["eventKey"],tu=()=>ba(`${qa.v1}/slack`),nu=()=>ba(`${qa.v1}/slack/applications`),iu=()=>ba(`${qa.v1}/slack/channels`),ou=e=>e.id?ka(`${qa.v1}/slack/subscription/${e.id}`,e):Aa(`${qa.v1}/slack/subscriptions`,e),au=e=>Pa(`${qa.v1}/slack/subscriptions/${e.id}`),ru=e=>Aa(`${qa.v1}/slack/applications/registrations`,{code:e}),su=()=>ba(`${qa.v1}/emails`),lu=e=>{let{eventKey:t}=e,n=Ii(e,Zc);return Aa(`${qa.v1}/emails/${t}`,n)},cu=({eventKey:e,enabled:t})=>ka(`${qa.v1}/emails/${e}`,{enabled:t}),uu=(e,t)=>Pa(`${qa.v1}/emails/${e}/subscriptions/${t}`),du=(e,t,n)=>Ta(`${qa.v1}/emails/${t}/subscriptions/${e}`,n),yu=e=>Pa(`${qa.v1}/emails/${e}`),fu=()=>ba(`${qa.v2}/sms`),gu=e=>{let{eventKey:t}=e,n=Ii(e,eu);return Aa(`${qa.v2}/sms/${t}`,n)},pu=({eventKey:e,enabled:t})=>ka(`${qa.v2}/sms/${e}`,{enabled:t}),Su=(e,t)=>Pa(`${qa.v2}/sms/${e}/subscriptions/${t}`),vu=(e,t,n)=>Ta(`${qa.v2}/sms/${t}/subscriptions/${e}`,n),hu=e=>Pa(`${qa.v2}/sms/${e}`),mu=()=>ba(nr),bu=e=>e._id?ka(`${nr}/${e._id}`,e):Aa(`${nr}/custom`,e),Au=e=>Pa(`${nr}/${e}`),ku=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return ba(`${nr}/logs/?${i.toString()}`)},Tu=e=>Aa(`${nr}/test`,e),Pu=e=>Aa(`${nr}/logs/${e}/retries`),Iu=()=>ba(`${tr.v1}/categories`),Lu=e=>ba(tr.v1,{channels:e});async function Eu(e,t){return Ta(Ba.v1,e,{headers:La(t)})}async function Ou(e){return ba(Ba.v1,void 0,{headers:La(e)})}async function wu(){return ba(`${Ba.v1}/public`)}const Cu=["roleId"],Du=["roleId"],Ru=["permissionId"];async function Uu(){return ba(Ma.v1)}async function _u(e){return Aa(Ma.v1,e)}async function Mu({roleId:e}){return Pa(`${Ma.v1}/${e}`)}async function Nu(e){let{roleId:t}=e,n=Ii(e,Cu);return ka(`${Ma.v1}/${t}`,n)}async function Fu(e){let{roleId:t}=e,n=Ii(e,Du);return Ta(`${Ma.v1}/${t}/permissions`,n)}async function $u(){return ba(Ua.v1)}async function Gu(e){let{permissionId:t}=e,n=Ii(e,Ru);return Ta(`${Ua.v1}/${t}/roles`,n)}async function xu(){return ba(`${Ua.v1}/categories`)}async function Vu(){return ba(Ha.subscriptions.v1)}async function ju(e){return ba(`${Ha.subscriptions.v1}/${e}`)}async function Wu(e){return Ta(`${Ha.subscriptions.v1}/${e}/cancellations/`,{})}async function Bu(e){return Ta(`${Ha.subscriptions.v1}/${e}/renewals/`,{})}async function Ku(e,{paymentMethodId:t,planId:n}){return Ta(`${Ha.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function zu(e){return ba(`${Ya.v1}/${e}`)}async function qu(){return ba(`${Ya.v1}`)}async function Hu(e){return Ta(`${Ya.v1}/${e}/cancellations/`,{})}async function Ju(e){return Ta(`${Ya.v1}/${e}/renewals/`,{})}async function Yu(e,{paymentMethodId:t,planId:n}){return Ta(`${Ya.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Qu(){return ba(Ha.plans.v1)}async function Xu(e){return ba(`${Ha.plans.v1}/${e}`)}async function Zu(){return ba(Ha.invoices.v1)}async function ed(e){return ba(`${Ha.invoices.v1}/${e}`)}async function td(e,t){return ba(`${Ha.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const nd=["email"];async function id(){return ba(Ha.paymentMethods.v1)}async function od(e){return ba(`${Ha.paymentMethods.v1}/${e}`)}async function ad(e,t){let{email:n}=t,i=Ii(t,nd);return ka(`${Ha.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function rd(e){return Aa(Ha.paymentProviders.stripe.subscriptions.v1,e)}async function sd(e){return ba(`${Ha.paymentProviders.stripe.customers.v1}/${e}`)}async function ld(e){return Aa(`${Ha.paymentProviders.stripe.customers.v1}`,e)}async function cd(){return ba(`${Ha.paymentProviders.stripe.publicConfigurations.v1}`)}async function ud(e){return Aa(`${Ha.paymentProviders.stripe.setupIntents.v1}`,e)}async function dd(e){return ba(`${Ha.summaries.v1}/${e}`)}async function yd(e){return ba(`${Ha.tenantConfiguration.v1}/${e}`)}async function fd(e){return Aa(`${Ha.tenantConfiguration.v1}`,e)}async function gd(){return ba(Ja.v1)}async function pd(){return ba(`${Ha.configurations.vendorPublicConfigurations.v1}`)}let Sd,vd,hd,md,bd,Ad;async function kd(){return ba("/vendors/public")}async function Td(e){return ba(Na.v1,e)}async function Pd(e){return Aa(Na.v1,e)}async function Id(e,t){return Pa(Na.v1,e,{headers:La(t)})}async function Ld(e,t,n){return Aa(`${Na.v1}/${e}/roles`,t,{headers:La(n)})}async function Ed(e,t,n){return Pa(`${Na.v1}/${e}/roles`,t,{headers:La(n)})}async function Od(e,t,n){return ka(`${Na.v1}/${e}/roles`,t,{headers:La(n)})}async function wd(e,t){return Aa(za.v1,e,{headers:La(t)})}async function Cd(e,t){return Pa(`${za.v1}/${e}`,void 0,{headers:La(t)})}async function Dd(e,t,n){return Ta(`${Na.v1}/${e}/access`,t,{headers:La(n)})}async function Rd(e,t){return Aa(`${Na.v2}/`,e,{headers:La(t)})}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Sd||(Sd={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(vd||(vd={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(hd||(hd={})),(md||(md={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(bd||(bd={})),function(e){e.CREATE="create_customer"}(Ad||(Ad={}));const Ud={flags:{}};class _d{constructor(){var e;this._flags={},this._flags=null!=(e=Ud.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new _d;return n.set(e),_d._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=C({},null!=(t=null==Ud?void 0:Ud.flags)?t:{},null!=e?e:{})}}async function Md(){return ba(or)}async function Nd(){return ba(`${ar}`)}async function Fd(e,t){return ka(`${ar}/${e}`,t)}async function $d(e){return Aa(`${ar}`,e)}async function Gd(e){return Pa(`${ar}/${e}`)}async function xd(e){return ba(`${rr}/${e}/Users/count`)}async function Vd(e){return Aa(`${Fa.v1}`,e)}_d._instances={};const jd=["groupId"];async function Wd({groupId:e},t){return ba(`${$a.v1}/${e}`,C({},t))}async function Bd(e){return ba(`${$a.v1}`,C({},e))}async function Kd(e,t){return Aa(`${$a.getByIds.v1}`,e,{params:t})}async function zd(e){return Aa(`${$a.v1}`,e)}async function qd(e){let{groupId:t}=e,n=Ii(e,jd);return ka(`${$a.v1}/${t}`,n)}async function Hd(e){return Pa(`${$a.v1}/${e}`)}async function Jd(e,t){return Aa(`${$a.v1}/${e}/roles`,t)}async function Yd(e,t){return Pa(`${$a.v1}/${e}/roles`,t)}async function Qd(e,t){return Aa(`${$a.v1}/${e}/users`,t)}async function Xd(e,t){return Pa(`${$a.v1}/${e}/users`,t)}async function Zd(){return ba(`${$a.configurations.v1}`)}async function ey(e){return Aa(`${$a.configurations.v1}`,e)}async function ty(e){return Aa(`${wa.v3}/me/token`,e)}async function ny(e,t){return ba(wa.v3,e,{headers:La(t)})}async function iy(){return ba(sr)}let oy,ay,ry,sy,ly;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(oy||(oy={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(ay||(ay={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(ry||(ry={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(sy||(sy={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(ly||(ly={}));const cy=[/^(.*)\/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],uy=`${Oa.v1}/user/token/refresh`,dy=`${ir}/authorize/silent`,yy=`${wa.v2}/me`,fy=`${wa.v2}/me/tenants`;let gy,py,Sy,vy,hy;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(gy||(gy={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(py||(py={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Sy||(Sy={})),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"}(vy||(vy={})),function(e){e.ASC="ASC",e.DESC="DESC"}(hy||(hy={}));const my={auth:o,teams:a,metadata:r,reports:s,connectivity:u,notifications:l,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:g,subTenants:p,featureFlags:S,directory:v,impersonate:h,groups:m,users:b,entitlements:A};var by={fetch:e,ContextHolder:da,FronteggContext:ya,api:my,FronteggApiError:Sa,AuthStrategyEnum:xr,MachineToMachineAuthStrategy:Vr,SocialLoginProviders:Gr,ISubscriptionCancellationPolicy:hd,ISubscriptionStatus:Sd,PaymentMethodType:vd,ProviderType:md};let Ay,ky;!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"}(Ay||(Ay={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(ky||(ky={}));const Ty="input is invalid type",Py="undefined"!=typeof ArrayBuffer,Iy="0123456789abcdef".split(""),Ly=[-2147483648,8388608,32768,128],Ey=[24,16,8,0],Oy=[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],wy=["hex","array","digest","arrayBuffer"],Cy=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Py&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const Dy=function(e){return function(t){const n=new Uy(!0).update(t);return null==n?void 0:n[e]()}},Ry=function(e){return function(t,n){const i=new _y(t,!0).update(n);return null==i?void 0:i[e]()}};class Uy{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=()=>Uy.prototype.digest(),e?(Cy[0]=Cy[16]=Cy[1]=Cy[2]=Cy[3]=Cy[4]=Cy[5]=Cy[6]=Cy[7]=Cy[8]=Cy[9]=Cy[10]=Cy[11]=Cy[12]=Cy[13]=Cy[14]=Cy[15]=0,this.blocks=Cy):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(Ty);if(null===e)throw new Error(Ty);if(Py&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Py&&ArrayBuffer.isView(e)))throw new Error(Ty);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]<<Ey[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<Ey[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<Ey[3&o++],s[o>>2]|=(128|63&i)<<Ey[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<Ey[3&o++],s[o>>2]|=(128|i>>6&63)<<Ey[3&o++],s[o>>2]|=(128|63&i)<<Ey[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<Ey[3&o++],s[o>>2]|=(128|i>>12&63)<<Ey[3&o++],s[o>>2]|=(128|i>>6&63)<<Ey[3&o++],s[o>>2]|=(128|63&i)<<Ey[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]|=Ly[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,g=this.h3,p=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,g=o+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7),s=d&y,i=s^d&f^u,r=p&S^~p&v,o=h+n+r+Oy[e]+m[e],a=t+i,h=g+o<<0,g=o+a<<0),t=(g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),l=g&d,i=l^g&y^s,r=h&p^~h&S,o=v+n+r+Oy[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&g,i=c^f&d^l,r=v&h^~v&p,o=S+n+r+Oy[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&g^c,r=S&v^~S&h,o=p+n+r+Oy[e+3]+m[e+3],a=t+i,p=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+g<<0,this.h4=this.h4+p<<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=Iy[e>>28&15]+Iy[e>>24&15]+Iy[e>>20&15]+Iy[e>>16&15]+Iy[e>>12&15]+Iy[e>>8&15]+Iy[e>>4&15]+Iy[15&e]+Iy[t>>28&15]+Iy[t>>24&15]+Iy[t>>20&15]+Iy[t>>16&15]+Iy[t>>12&15]+Iy[t>>8&15]+Iy[t>>4&15]+Iy[15&t]+Iy[n>>28&15]+Iy[n>>24&15]+Iy[n>>20&15]+Iy[n>>16&15]+Iy[n>>12&15]+Iy[n>>8&15]+Iy[n>>4&15]+Iy[15&n]+Iy[i>>28&15]+Iy[i>>24&15]+Iy[i>>20&15]+Iy[i>>16&15]+Iy[i>>12&15]+Iy[i>>8&15]+Iy[i>>4&15]+Iy[15&i]+Iy[o>>28&15]+Iy[o>>24&15]+Iy[o>>20&15]+Iy[o>>16&15]+Iy[o>>12&15]+Iy[o>>8&15]+Iy[o>>4&15]+Iy[15&o]+Iy[a>>28&15]+Iy[a>>24&15]+Iy[a>>20&15]+Iy[a>>16&15]+Iy[a>>12&15]+Iy[a>>8&15]+Iy[a>>4&15]+Iy[15&a]+Iy[r>>28&15]+Iy[r>>24&15]+Iy[r>>20&15]+Iy[r>>16&15]+Iy[r>>12&15]+Iy[r>>8&15]+Iy[r>>4&15]+Iy[15&r];return l+=Iy[s>>28&15]+Iy[s>>24&15]+Iy[s>>20&15]+Iy[s>>16&15]+Iy[s>>12&15]+Iy[s>>8&15]+Iy[s>>4&15]+Iy[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 _y extends Uy{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(Ty);if(null===e)throw new Error(Ty);if(Py&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Py&&ArrayBuffer.isView(e)))throw new Error(Ty)}var o;e.length>64&&(e=null==(o=new Uy(!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}Uy.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();Uy.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Uy.prototype.finalize.call(this)}}}const My=function(){const e=Dy("hex");e.create=function(){return new Uy},e.update=function(t){return e.create().update(t)};for(let t=0;t<wy.length;++t){const n=wy[t];e[n]=Dy(n)}return e}();function Ny(e,t){const n=C({},e);return t.forEach((e=>{delete n[e]})),n}async function Fy(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=My.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function $y(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=Ry("hex");e.create=function(e){return new _y(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<wy.length;++t){const n=wy[t];e[n]=Ry(n)}}();const Gy=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*xy(e){const t=yield So((e=>e.root.appName));return _d.getFeatureFlags(e,t)}const Vy={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},jy=C({},Vy,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Wy=[{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"}],By={id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!0,profileImage:void 0,profilePictureUrl:"https://www.gravatar.com/avatar/42b2ad2bad6fc9b9db5086dfcf8072ac?d=https://ui-avatars.com/api/fe/128/random?t=1617261890875?t=1617261917434",roles:[{id:"roleId",key:"admin",isDefault:!1,name:"Admin",description:null,permissions:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",key:"fe.*",name:"General Admin",description:void 0,categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),roleIds:void 0,verified:void 0},Ky=C({},By,{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}),zy={loading:!1,error:void 0,saving:!0,profile:By},qy={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"},Hy={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:xr.EmailAndPassword,machineToMachineAuthStrategy:Vr.ClientCredentials},Jy={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Yy={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Qy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Xy={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},Zy={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},ef=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],tf={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Xy,roles:ef,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},nf=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],of={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:[Wy[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[Wy[0]],managedBy:Sy.FRONTEGG}]},af={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:[Wy[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[Wy[0]],managedBy:Sy.FRONTEGG}]},rf={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},sf=[af,of],lf=[rf],cf=[{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}],uf=[{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"}],df={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},yf={isActive:!0,strategy:xn.ALLOW},ff=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:xn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:xn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:xn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:xn.BLOCK,description:"IP 4"}],gf=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(C({},af,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},pf=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"}),Sf=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:gf(6),roles:[pf("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Sy.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:gf(44),roles:[pf("Editor")],managedBy:Sy.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:gf(8),roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:gf(5),roles:[pf("Admin")],managedBy:Sy.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:gf(21),description:"BDR, AE, and inside sales",roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:gf(23),description:"Dev success and customer success",roles:[pf("Admin")],managedBy:Sy.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:gf(10),description:"The marketing department",roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:gf(4),description:"Human resources",roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:gf(3),roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:gf(8),roles:[pf("Editor")],managedBy:Sy.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:gf(4),roles:[pf("Viewer")],managedBy:Sy.FRONTEGG}];let vf,hf,mf;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(vf||(vf={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(hf||(hf={})),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"}(mf||(mf={})),mf.profile,mf.privacy,mf.personalApiTokens,mf.account,mf.users,mf.groups,mf.security,mf.sso,mf.audits,mf.webhooks,mf.apiTokens,mf.roles,mf.subscriptions;const bf=["events","url"];function*Af(){yield co(yi.setSignUpState({loading:!0}));try{const e=yield fo(my.auth.getVendorConfig),[t]=(yield fo(my.auth.getVendorPublicAuthStrategiesConfig),yield fo(xy,["admin_portal_login_per_tenant"]));if(t){const t=yield fo(my.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield co(yi.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield co(yi.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield co(yi.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*kf(e){let{payload:{events:t,url:n}}=e,i=Ii(e.payload,bf);yield co(yi.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield So((e=>e.auth)),{shouldActivate:r,user:s,tenantId:l,userId:c}=yield fo(my.auth.signUpUser,i);if(!i.invitationToken){var o;const{email:e,name:a,companyName:r}=i;null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:hf.PASSWORD,id:c,tenantId:l,createdAt:new Date})}if(da.setAccessToken(null==s?void 0:s.accessToken),da.setUser(s),!r&&s&&Ng(s)){const t=yield Gg(s);yield co(yi.setState(t)),a(e.loginUrl)}else yield co(yi.setSignUpState({loading:!1,shouldActivate:r,stage:pn.SignUpSuccess})),yield co(yi.setState({user:s,isAuthenticated:!(null==s||!s.accessToken)})),r||(yield co(yi.loadTenants()))}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setSignUpState({loading:!1,error:e.message}))}yield co(yi.setSignUpState({loading:!1}))}function*Tf(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield So((e=>e.auth.signUpState));yield co(yi.resetSignUpState()),yield co(yi.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Pf(){yield ua(yi.signUpUser,kf),yield ua(yi.resetSignUpStateSoft,Tf)}const If={setVendorState:(e,{payload:t})=>C({},e,t)},Lf={loadVendorPublicInfo:lt("vendor/loadVendorPublicInfo")},Ef={loading:!1},{reducer:Of,actions:wf}=ut({name:Rt,initialState:Ef,reducers:C({},If)}),Cf=C({},wf,Lf);function*Df(){yield co(Cf.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield my.vendor.getVendorPublicInfo();yield co(Cf.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield co(Cf.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Rf=["callback"],Uf=["callback"],_f=["callback"],Mf=["callback"],Nf=["callback"],Ff=["callback"];function*$f(){yield co(yi.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield fo(my.auth.getGlobalSecurityPolicy);yield co(yi.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield co(yi.loadSecurityPolicyMfa()),yield co(yi.loadSecurityPolicyVendorMfa()),yield co(yi.loadSecurityPolicyLockout()),yield co(yi.loadSecurityPolicyVendorLockout()),yield co(yi.loadSecurityPolicyVendorPasswordHistory()),yield co(yi.loadSecurityPolicyCaptcha()),yield co(yi.loadPublicAuthStrategiesPolicy())}function*Gf(){yield co(yi.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorConfig),[t]=yield fo(xy,["admin_portal_login_per_tenant"]);if(t){const t=yield fo(my.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield co(yi.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*xf(){yield co(yi.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorPublicAuthStrategiesConfig);yield co(yi.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*Vf(){yield co(yi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield fo(my.auth.getMfaPolicy);yield co(yi.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*jf(){yield co(yi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorMfaPolicy);yield co(yi.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*Wf(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Rf);yield co(yi.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield fo(my.auth.saveMfaPolicy,n);yield co(yi.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Bf(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield fo(my.auth.getLockoutPolicy);yield co(yi.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*Kf(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Uf);yield co(yi.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield fo(my.auth.saveLockoutPolicy,n);yield co(yi.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*zf(){yield co(yi.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorLockoutPolicy);yield co(yi.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*qf(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield fo(my.auth.getCaptchaPolicy);yield co(yi.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*Hf(){yield co(yi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield fo(my.auth.getPasswordHistoryPolicy);yield co(yi.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*Jf(){yield co(yi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorPasswordHistoryPolicy);yield co(yi.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*Yf(e){let{payload:{callback:t}}=e,n=Ii(e.payload,_f);yield co(yi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield fo(my.auth.savePasswordHistoryPolicy,n);yield co(yi.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Qf(){yield co(yi.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield fo(my.auth.getPasswordConfigPolicy);yield co(yi.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*Xf(){yield ua(yi.loadSecurityPolicy,$f),yield la(yi.saveSecurityPolicyMfa,Wf),yield la(yi.loadSecurityPolicyMfa,Vf),yield la(yi.loadSecurityPolicyVendorMfa,jf),yield la(yi.saveSecurityPolicyLockout,Kf),yield la(yi.loadSecurityPolicyLockout,Bf),yield la(yi.loadSecurityPolicyVendorLockout,zf),yield la(yi.loadSecurityPolicyCaptcha,qf),yield la(yi.saveSecurityPolicyPasswordHistory,Yf),yield la(yi.loadSecurityPolicyPasswordHistory,Hf),yield la(yi.loadSecurityPolicyVendorPasswordHistory,Jf),yield la(yi.loadVendorPasswordConfig,Qf),yield la(yi.loadPublicSecurityPolicy,Gf),yield la(yi.loadPublicAuthStrategiesPolicy,xf)}function*Zf(){yield co(yi.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield co(yi.setSecurityPolicyPublicState({policy:Hy,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*eg(){yield co(yi.setSecurityPolicyGlobalState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyGlobalState({policy:qy,loading:!1})),yield co(yi.loadSecurityPolicyMfa()),yield co(yi.loadSecurityPolicyVendorMfa()),yield co(yi.loadSecurityPolicyLockout()),yield co(yi.loadSecurityPolicyVendorLockout()),yield co(yi.loadSecurityPolicyPasswordHistory()),yield co(yi.loadSecurityPolicyVendorPasswordHistory()),yield co(yi.loadSecurityPolicyCaptcha())}function*tg(){yield co(yi.setSecurityPolicyMfaState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyMfaState({policy:Jy,loading:!1}))}function*ng(){yield co(yi.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyVendorMfaState({policy:Jy,loading:!1}))}function*ig(e){var t;let{payload:{callback:n}}=e,i=Ii(e.payload,Mf);yield co(yi.setSecurityPolicyMfaState({saving:!0,error:null}));const o=C({},Yy,{id:null!=(t=i.id)?t:Yy.id,enforceMFAType:i.enforceMFAType});yield mt(),yield co(yi.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*og(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyLockoutState({policy:Yy,loading:!1}))}function*ag(){yield co(yi.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyVendorLockoutState({policy:Yy,loading:!1}))}function*rg(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Nf);yield co(yi.setSecurityPolicyLockoutState({saving:!0,error:null})),yield mt();const i=C({},Yy,n,{id:n.id?n.id:Yy.id});null==t||t(i),yield co(yi.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*sg(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyLockoutState({policy:Yy,loading:!1}))}function*lg(){yield co(yi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyPasswordHistoryState({policy:Qy,loading:!1}))}function*cg(){yield co(yi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyVendorPasswordHistoryState({policy:Qy,loading:!1}))}function*ug(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Ff);yield co(yi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield mt();const i=C({},Qy,n,{id:n.id?n.id:Qy.id});null==t||t(i),yield co(yi.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*dg(){yield ua(yi.loadSecurityPolicy,eg),yield la(yi.loadPublicSecurityPolicy,Zf),yield la(yi.saveSecurityPolicyMfa,ig),yield la(yi.loadSecurityPolicyMfa,tg),yield la(yi.loadSecurityPolicyVendorMfa,ng),yield la(yi.saveSecurityPolicyLockout,rg),yield la(yi.loadSecurityPolicyLockout,og),yield la(yi.loadSecurityPolicyVendorLockout,ag),yield la(yi.loadSecurityPolicyCaptcha,sg),yield la(yi.saveSecurityPolicyPasswordHistory,ug),yield la(yi.loadSecurityPolicyPasswordHistory,lg),yield la(yi.loadSecurityPolicyVendorPasswordHistory,cg)}const yg=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},fg=e=>{const{pathname:t}=new URL(e),n=yg(e);return n?t+n:t},gg=["callback"],pg=["callback"],Sg=["callback"],vg=["callback"],hg=["callback","events"],mg=["callback"],bg=["callback"],Ag=["callback"],kg=["callback"],Tg=["callback"],Pg=["callback"],Ig=["callback"],Lg=["callback"],Eg=["callback"],Og=["callback","deviceId"],wg=["callback","deviceId"],Cg=["callback","deviceId"],Dg=["callback","deviceId"],Rg={[xr.Code]:Pt.loginWithOtc,[xr.EmailAndPassword]:Pt.loginWithPassword,[xr.MagicLink]:Pt.magicLinkPreLoginSuccess,[xr.SmsCode]:Pt.loginWithSmsOtc};function*Ug(){const e=da.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield So((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:s,activateUrl:l}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;try{var d,y;!u&&null!=(d=(y=da.getContext()).tenantResolver)&&d.call(y)&&(yield fo(Hg),u=yield So((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})))}catch{}const f=window.localStorage.getItem(Et);f&&![a,r,s,l].includes(f)&&(c=f),window.localStorage.removeItem(Et),yield mt(200),co(yi.resetLoginState());const g=(({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?fg(u):c,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});e(g,{refresh:g.startsWith("http")})}function*_g(){let e;try{var t;const n=yield fo(my.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield co(yi.setState({ssoACS:e}))}function*Mg(){try{const{isActive:e}=yield fo(my.auth.getSSOPublicConfiguration);yield co(yi.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const Ng=e=>e.mfaRequired&&e.mfaToken?(da.setAccessToken(null),da.setUser(null),!0):(da.setAccessToken(e.accessToken),da.setUser(e),!1),Fg=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 an.authenticatorApp;if(t)return an.smsVerifyCode}return an.verify},$g=e=>{if(1===e.length){const[t]=e;if(t===ry.AuthenticatorApp)return an.authenticatorApp;if(t===ry.SMS)return an.smsSetPhoneNumber}return an.verify};function*Gg(e){let t=Pt.loginWithTwoFactor,n={};const{loginState:i}=yield So((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield fo(my.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Fg(e.mfaDevices)}:(n={step:$g(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=Pt.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:It.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:C({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a})}}function*xg(e){var t;const{routes:n,loginState:i}=yield So((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*Vg(){const{hostedLoginBox:e}=yield So((e=>e.auth));e?yield fo(jg):yield fo(Bg)}function*jg(){const{user:e}=yield So((e=>e.auth));if(null==e||!e.refreshToken)return da.setAccessToken(null),da.setUser(null),void(yield co(yi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield fo(my.auth.exchangeOAuthTokens,t);yield co(yi.setState({user:n,isAuthenticated:!0})),yield co(yi.loadTenants())}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:null,isAuthenticated:!1}))}}function*Wg(){const{user:e}=yield So((e=>e.auth));if(null==e||!e.refreshToken)return da.setAccessToken(null),da.setUser(null),void(yield co(yi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield fo(my.auth.exchangeOAuthTokens,t);yield co(yi.setState({user:n,isAuthenticated:!0})),yield co(yi.loadTenants())}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:null,isAuthenticated:!1}))}}function*Bg(){try{const t=da.onRedirectTo,{routes:n,loginState:i}=yield So((e=>e.auth)),{user:o,tenants:a}=yield fo(my.auth.refreshTokenV2);if(Ng(o)){const e=yield Gg(o);yield co(yi.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 xg(o);yield co(yi.setTenantsState({tenants:a,loading:!1})),yield co(yi.setState({user:o,isAuthenticated:!0,loginState:C({},i,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield zg(n)}}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:void 0,isAuthenticated:!1}))}}function*Kg(){try{const t=da.onRedirectTo,{routes:n,loginState:i}=yield So((e=>e.auth)),{user:o,tenants:a}=yield fo(my.auth.refreshTokenV2);if(Ng(o)){const e=yield Gg(o);yield co(yi.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield fo(ap))yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})),yield co(yi.setTenantsState({tenants:a,loading:!1})),yield co(yi.setState({user:o})),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 xg(o);yield co(yi.setTenantsState({tenants:a,loading:!1})),yield co(yi.setState({user:o,isAuthenticated:!0,loginState:C({},i,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield zg(n)}}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:void 0,isAuthenticated:!1}))}}function*zg(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=da.onRedirectTo,{routes:o,loginState:a}=yield So((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 Ug())}function*qg({payload:{callback:e}}){try{const{ip:t}=yield fo(my.metadata.getCurrentUserIpMetadata);yield co(yi.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*Hg(){try{var e,t;if(null!=(e=da.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){const{routes:e}=yield So((e=>e.auth)),{applicationUrl:t,loginUrl:i}=yield fo(wu);var n;t&&i&&(yield co(yi.setState({customLoginState:{customLoginEnabled:!0},routes:C({},e,{customLoginAuthenticatedUrl:i,customLoginUrl:null!=(n=e.loginUrl+yg(t))?n:""})})))}}catch{}}function*Jg({payload:e}){const t=[];e&&(yield co(yi.setState({isLoading:!0})),yield co(yi.loadSocialLoginsConfigurationV2()),t.push(fo(Af)),t.push(fo(xf)),t.push(fo(Mg)),t.push(fo(Df)),t.push(fo(_g)),t.push(fo(Hg))),t.push(fo(Vg)),yield uo(t),yield co(yi.setState({isLoading:!1}))}function*Yg({accessToken:e,user:t}){if(!e)return void(yield co(yi.setState({user:void 0,isAuthenticated:!1})));const n=da.onRedirectTo,{routes:i}=yield So((e=>e.auth));if(Ng(t)){const e=yield Gg(t);yield co(yi.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*Qg({payload:e}){const t=[];yield co(yi.loadSocialLoginsConfigurationV2()),t.push(fo(Af)),t.push(fo(Mg)),t.push(fo(Df)),t.push(fo(_g)),t.push(fo(Yg,e)),t.push(fo(Hg)),yield uo(t)}function*Xg({payload:e}){const{disableSilentRefresh:t}=yield So((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield fo(my.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield co(yi.setState({user:e,isAuthenticated:!0})),yield co(yi.loadTenants()),yield co(yi.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield So((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if((e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield co(yi.setState({isLoading:!0}));const a=$y(),r=$y(),s=yield fo(Fy,r);localStorage.setItem(Ot,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;const c=yield Zg();c&&(l.endsWith("/")&&(l=l.slice(0,-1)),l+=c);const u=`${va(n,"/oauth/authorize")}/oauth/authorize`,d=C({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)}i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}(e)}}function*Zg(){try{var e,t;if(null!=(e=da.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){yield fo(Hg);const e=yield So((e=>e.auth.routes.customLoginAuthenticatedUrl));if(e)return yg(e)}}catch{}}function*ep({payload:e}){const t=localStorage.getItem(Ot)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield So((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;const a=yield Zg();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 fo(my.auth.exchangeOAuthTokens,r);yield co(yi.setState({user:e,isAuthenticated:!0})),yield co(yi.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Ug()}}function*tp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,gg);try{yield co(yi.setLoginState({loading:!0}));const e=yield fo(my.auth.changePhoneNumberWithVerification,n);yield co(yi.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Pt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1}))}}function*np(e){let{payload:{callback:t}}=e,n=Ii(e.payload,pg);try{yield co(yi.setLoginState({loading:!0})),yield fo(my.auth.verifyChangePhoneNumber,n),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1}))}}function*ip(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Sg);try{yield co(yi.setLoginState({loading:!0}));const e=yield fo(my.auth.passwordlessPreLogin,C({},n,{type:xr.SmsCode}));yield co(yi.setLoginState({step:Pt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*op(e){let{payload:{callback:t}}=e,n=Ii(e.payload,vg);try{const{onRedirectTo:e,routes:i}=yield So((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield co(yi.setLoginState({loading:!0}));const o=yield fo(my.auth.passwordlessPreLogin,n),a=Rg[n.type];if(a===Pt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield co(yi.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield co(yi.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*ap(){const{publicAuthStrategyPolicy:e}=yield So((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===oy.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield fo(xy,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield fo(my.auth.getWebAuthnDevices);return yield co(yi.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*rp(e){let{payload:{callback:t,events:n}}=e,i=Ii(e.payload,hg);try{yield co(yi.setLoginState({loading:!0}));const e=yield fo(my.auth.passwordlessPostLogin,i),a=da.onRedirectTo,{routes:r}=yield So((e=>e.auth));if(Ng(e)){const t=yield Gg(e);yield co(yi.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield So((e=>e.auth)),s=yield fo(my.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:s.email,origin:vf.PASSWORDLESS,id:s.id,tenantId:s.tenantId,createdAt:new Date,name:s.name})),s.id&&localStorage.setItem("userId",s.id),yield co(yi.setState({user:s})),yield co(yi.setLoginState({error:void 0})),yield co(yi.loadTenants()),yield co(yi.setState({isLoading:!1})),i.flow===It.Login?(yield fo(ap))?(yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield co(yi.setState({isAuthenticated:!0})),yield Ug()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield co(yi.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield co(yi.setLoginState({loading:!1}))}}function*sp({payload:e}){try{yield co(yi.setLoginState({loading:!0}));const{name:t}=yield fo(my.auth.verifyInviteToken,e);yield co(yi.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield co(yi.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield co(yi.setLoginState({loading:!1}))}}function*lp({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield co(yi.setLoginState({loading:!0}));try{const o=yield So((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield fo(my.auth.preLoginV2,{email:e});if(a){let e=a;if(r===ky.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield So((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield co(yi.setLoginState({step:Pt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{o(e,{refresh:!0})}),2e3)}else yield cp({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield cp({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*cp(e){let{callback:t}=e,n=Ii(e,mg);const i=yield So((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield co(yi.setLoginState({step:Pt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===xr.EmailAndPassword?(yield co(yi.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t()):[xr.MagicLink,xr.Code,xr.SmsCode].includes(null==i?void 0:i.authStrategy)?yield co(yi.passwordlessPreLogin(C({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield co(yi.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t())}function*up({payload:{callback:e}}){try{yield co(yi.setLoginState({loading:!0}));const{options:t}=yield fo(my.auth.webAuthnCreateNewDeviceSession);t.user.id=kt(t.user.id),t.challenge=kt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield co(yi.setLoginState({error:t.message})),null==e||e(null)}finally{yield co(yi.setLoginState({loading:!1}))}}function*dp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,bg);try{yield co(yi.setLoginState({loading:!0}));const e=Tt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?ay.Platform:ay.CrossPlatform;yield fo(my.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message})),null==t||t(null)}finally{yield co(yi.setLoginState({loading:!1}))}}function*yp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Ag);try{var i;yield co(yi.setPasskeysState({loading:!0})),yield co(yi.setLoginState({loading:!0}));const{options:e}=yield fo(my.auth.webAuthnPreLogin,n);e.challenge=kt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)}))),yield co(yi.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield co(yi.setLoginState({error:e.message})),null==t||t(null)}finally{yield co(yi.setPasskeysState({loading:!1})),yield co(yi.setLoginState({loading:!1}))}}function*fp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,kg);try{var i;yield co(yi.setPasskeysState({loading:!0})),yield co(yi.setLoginState({loading:!0}));const e=Tt(n.publicKey),o=yield fo(my.auth.webAuthnPostLogin,C({},e,{response:C({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(Ng(o)){const e=da.onRedirectTo,{routes:t}=yield So((e=>e.auth)),n=yield Gg(o);yield co(yi.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield fo(my.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield co(yi.loadTenants()),yield co(yi.setState({user:e,isAuthenticated:!0})),yield co(yi.setLoginState({error:void 0})),yield Ug(),null==t||t(!0)}}catch(e){yield co(yi.setLoginState({error:e.message})),null==t||t(null)}finally{yield co(yi.setPasskeysState({loading:!1})),yield co(yi.setLoginState({loading:!1}))}}function*gp({payload:e}){const{onRedirectTo:t,routes:n}=yield So((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield co(yi.setLoginState({loading:!0}));try{const t=yield fo(my.auth.postLogin,e);da.setAccessToken(t.accessToken),da.setUser(t),yield co(yi.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Ug()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield co(yi.setLoginState({step:Pt.loginWithSSOFailed,loading:!1}))}}function*pp({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield co(yi.setLoginState({loading:!0}));try{const a=yield fo(my.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});da.setAccessToken(a.accessToken),da.setUser(a);const r=da.onRedirectTo,{routes:s}=yield So((e=>e.auth));if(Ng(a)){const e=yield Gg(a);yield co(yi.setState(e)),r(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield So((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield co(yi.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===It.Login?Pt.success:t.step,tenants:[],tenantsLoading:!0}})),yield co(yi.loadTenants()),n&&t.flow===It.Login&&((yield fo(ap))?(yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})),r(s.loginUrl,{preserveQueryParams:!0})):yield Ug())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){da.setAccessToken(null),da.setUser(null),null==o||o(!1,t),yield co(yi.setLoginState({email:e,error:t.message,loading:!1}))}}function*Sp({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield co(yi.setLoginState({loading:!0}));try{const o=yield fo(my.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield So((e=>e.auth)),r=a.flow===It.Login?Pt.success:a.step;yield co(yi.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:o,isAuthenticated:!0})),o.id&&localStorage.setItem("userId",o.id),yield co(yi.loadTenants()),yield co(yi.setLoginState({error:void 0,loading:!1})),a.flow===It.Login&&((yield fo(ap))?yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield Ug()),null==i||i(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*vp({payload:e}){yield co(yi.setLoginState({loading:!0}));try{var t;yield fo(my.auth.recoverMfaToken,e),yield co(yi.setLoginState({loading:!1,error:void 0,step:Pt.preLogin})),yield co(yi.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setLoginState({error:t.message,loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*hp({payload:e}){const{hostedLoginBox:t}=yield So((e=>e.auth));yield co(yi.setState({isLoading:!0}));try{t?yield fo(my.auth.OAuthLogout):yield fo(my.auth.logout)}catch{}yield co(yi.resetState()),yield co(yi.requestAuthorize(!0)),null==e||e()}function*mp({payload:e}){var t;try{yield fo(my.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*bp({user:e,tenants:t}){const n={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield co(yi.setMfaState(n)),yield co(yi.setUser(e)),yield co(yi.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Ap({user:e,tenants:t}){const{loginState:n}=yield So((e=>e.auth));yield co(yi.setUser(e)),yield co(yi.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield So((e=>e.auth.mfaState));if(n.flow===It.Login){const e=yield fo(ap);i===an.smsVerifyCode&&e?yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield Ug()}yield co(yi.setState({isAuthenticated:!0}))}function*kp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Tg);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.preEnrollMFASMSForLogin,n);yield co(yi.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Tp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Pg);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.enrollMFASMSForLogin,n),i=yield fo(my.auth.generateLoginResponseV2,e);yield bp(i),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Pp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Ig);yield co(yi.setLoginState({loading:!0}));try{var i;const e=yield fo(my.auth.preEnrollMFAWebAuthnForLogin,n),o=C({},e.options,{challenge:kt(e.options.challenge),user:C({},e.options.user,{id:kt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Ip(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Lg);yield co(yi.setLoginState({loading:!0}));try{const e=Tt(n.publicKey),i=yield fo(my.auth.enrollMFAWebAuthnForLogin,C({},n,{options:e})),o=yield fo(my.auth.generateLoginResponseV2,i);yield bp(o),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Lp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Eg);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield fo(my.auth.generateLoginResponseV2,e);yield bp(i),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Ep(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,Og);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.preVerifyMFASMSForLogin,n,i);yield co(yi.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Op(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,wg);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.verifyMFASMSForLogin,n,i),o=yield fo(my.auth.generateLoginResponseV2,e);yield Ap(o),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*wp(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,Cg);yield co(yi.setLoginState({loading:!0}));try{var o;const e=yield fo(my.auth.preVerifyMFAWebAuthnForLogin,n,i),a=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Cp(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,Dg);yield co(yi.setLoginState({loading:!0}));try{const e=Tt(i.publicKey),o=yield fo(my.auth.verifyMFAWebAuthnForLogin,n,C({},i,{options:e})),a=yield fo(my.auth.generateLoginResponseV2,o);yield Ap(a),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Dp(){yield ua(yi.requestAuthorize,Jg),yield ua(yi.requestAuthorizeSSR,Qg),yield ua(yi.requestHostedLoginAuthorize,Xg),yield ua(yi.handleHostedLoginCallback,ep),yield ua(yi.preLogin,lp),yield ua(yi.postLogin,gp),yield ua(yi.login,pp),yield ua(yi.logout,hp),yield ua(yi.silentLogout,mp),yield ua(yi.loginWithMfa,Sp),yield ua(yi.recoverMfa,vp),yield ua(yi.quickSmsPasswordlessPreLogin,ip),yield ua(yi.changePhoneNumberWithVerification,tp),yield ua(yi.verifyChangePhoneNumber,np),yield ua(yi.passwordlessPreLogin,op),yield ua(yi.passwordlessPostLogin,rp),yield ua(yi.verifyInviteToken,sp),yield ua(yi.webAuthnPrelogin,yp),yield ua(yi.webAuthnPostLogin,fp),yield ua(yi.webAuthnCreateNewDeviceSession,up),yield ua(yi.webAuthnVerifyNewDeviceSession,dp),yield ua(yi.afterAuthNavigation,Ug),yield ua(yi.getUserIP,qg),yield ua(yi.preEnrollMFASMSForLogin,kp),yield ua(yi.enrollMFASMSForLogin,Tp),yield ua(yi.preEnrollMFAWebAuthnForLogin,Pp),yield ua(yi.enrollMFAWebAuthnForLogin,Ip),yield ua(yi.enrollMFAAuthenticatorAppForLogin,Lp),yield ua(yi.preVerifyMFASMSForLogin,Ep),yield ua(yi.verifyMFASMSForLogin,Op),yield ua(yi.preVerifyMFAWebAuthnForLogin,wp),yield ua(yi.verifyMFAWebAuthnForLogin,Cp)}function*Rp({payload:e}){e&&(yield co(yi.setState({isLoading:!0})));const t=Ky;yield co(yi.loadTenants()),yield co(yi.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Up({payload:{callback:e}}){try{const{ip:t}=ff[0];yield co(yi.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*_p(){yield ua(yi.requestAuthorize,Rp),yield ua(yi.afterAuthNavigation,Ug),yield ua(yi.getUserIP,Up)}const Mp=["callback","samlVendor"],Np=["callback","samlVendor"];function*Fp(){try{var e,t;yield co(yi.setSSOState({loading:!0}));const n=yield fo(my.auth.getSamlConfiguration),i=yield fo(my.auth.getOidcConfiguration),o=yield fo(my.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 co(yi.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield co(yi.setSSOState({error:e.message,loading:!1}))}}function*$p({payload:e}){const t=yield So((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield co(yi.setSSOState({error:void 0,[n]:!0}));try{const i=yield Gy(e[0]),o=yield fo(my.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield co(yi.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield co(yi.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Gp({payload:e}){const{configFile:t,callback:n}=e,i=yield So((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield co(yi.setSSOState({error:void 0,[o]:!0}));try{const e=yield Gy(t),a=yield fo(my.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield co(yi.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield co(yi.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*xp({payload:e}){const{callback:t,samlVendor:n}=e,i=Ii(e,Mp),o=yield So((e=>e.auth.ssoState.samlConfiguration)),a=C({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield co(yi.setSSOState({samlConfiguration:C({},o,a)})));if(yield co(yi.setSSOState({error:void 0,[r]:!0})),e.type===ky.Saml){var s,l;const e=yield fo(my.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=Ny(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 fo(my.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield co(yi.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield co(yi.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*Vp({payload:{callback:e}={}}){const t=yield So((e=>e.auth.ssoState.samlConfiguration));try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(my.auth.validateSamlDomain),yield co(yi.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield co(yi.setSSOState({samlConfiguration:C({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*jp(){try{const e=yield fo(my.auth.getSamlRoles),t=yield fo(my.auth.getSamlRolesGroups);yield co(yi.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield co(yi.setSSOState({error:e.message}))}}function*Wp({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(my.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield uo(e.map((e=>fo(my.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield co(yi.setSSOState({error:e.message}))}}(n)),yield jp(),yield co(yi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield co(yi.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Bp({payload:{callback:e,id:t}}){try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(my.auth.deleteSamlGroup,{id:t}),yield jp(),yield co(yi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield co(yi.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Kp({payload:{group:e,roleIds:t,callback:n}}){try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(my.auth.createSamlGroup,{group:e,roleIds:t}),yield jp(),yield co(yi.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield co(yi.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*zp({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield co(yi.setSSOState({loading:!0})),yield fo(my.auth.oidcPostLoginV2,t),yield fo(Vg),yield co(yi.setSSOState({loading:!1}))}catch(e){var n;yield co(yi.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*qp(){yield la(yi.loadSSOConfigurations,Fp),yield la(yi.saveSSOConfigurations,xp),yield la(yi.saveSSOConfigurationsFile,$p),yield la(yi.saveSSOConfigurationsFileWithCallback,Gp),yield la(yi.validateSSODomain,Vp),yield la(yi.loadSSOAuthorizationRoles,jp),yield la(yi.updateSSOAuthorizationRoles,Wp),yield la(yi.deleteSamlGroup,Bp),yield la(yi.createSamlGroup,Kp),yield la(yi.oidcPostlogin,zp)}function*Hp(){yield co(yi.setSSOState({loading:!0})),yield mt(),yield co(yi.setSSOState({samlConfiguration:Xy,loading:!1,firstLoad:!1}))}function*Jp({payload:e}){const t="saving";yield co(yi.setSSOState({error:void 0,[t]:!0}));const n=C({},yield So((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield co(yi.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Yp({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=Ii(e,Np),r=tf.samlConfiguration,s=C({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield co(yi.setSSOState({samlConfiguration:C({},r,s)})));yield co(yi.setSSOState({error:void 0,[l]:!0})),yield mt(),s.acsUrl=null==Zy||null==(t=Zy.configuration)?void 0:t.acsUrl,s.spEntityId=null==Zy||null==(n=Zy.configuration)?void 0:n.spEntityId;const c=Ny(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 mt(),yield co(yi.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*Qp({payload:{callback:e}={}}){const t=tf.samlConfiguration;yield co(yi.setSSOState({error:void 0,saving:!0})),yield mt(),yield co(yi.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Xp(){yield mt(),yield co(yi.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Zp({payload:{callback:e,authorizationRoles:t}}){yield co(yi.setSSOState({error:void 0,saving:!0})),yield mt(),yield co(yi.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*eS(){yield la(yi.loadSSOConfigurations,Hp),yield la(yi.saveSSOConfigurations,Yp),yield la(yi.saveSSOConfigurationsFile,Jp),yield la(yi.validateSSODomain,Qp),yield la(yi.loadSSOAuthorizationRoles,Xp),yield la(yi.updateSSOAuthorizationRoles,Zp)}const tS=["callback"],nS=["callback","ssoConfigId"],iS=["callback","ssoConfigId"],oS=["callback","ssoConfigId"];function*aS(){try{return yield fo(my.auth.getOidcConfiguration)}catch(e){return null}}function*rS(){try{return yield fo(my.metadata.getSamlMetadata)}catch(e){return null}}function*sS(){try{yield co(yi.setSSOLoader({key:Ay.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield uo([fo(aS),fo(rS)]),n=yield fo(my.auth.getSSOConfigurations);yield co(yi.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield co(yi.setSSOError({key:Ay.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield co(yi.setSSOLoader({key:Ay.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*lS({payload:e}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ii(e,tS),i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield fo(my.auth.createSSOConfiguration,C({},n,{enabled:null!=(o=n.enabled)&&o}));yield co(yi.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION,value:!1}))}}function*cS({payload:e}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Gy(t),o=yield fo(my.auth.createSSOConfigurationByMetadata,{metadata:e});yield co(yi.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*uS({payload:e}){yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Ii(e,nS),o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield fo(my.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield co(yi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield co(yi.setSSOError({key:Ay.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*dS({payload:e}){yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Gy(i),a=yield fo(my.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield co(yi.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield co(yi.setSSOError({key:Ay.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*yS({payload:e}){yield co(yi.setSSOLoader({key:Ay.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(my.auth.deleteSSOConfiguration,t),yield co(yi.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield co(yi.setSSOError({key:Ay.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.DELETE_SSO_CONFIGURATION,value:!1}))}}function*fS({payload:e}){const{callback:t,ssoConfigId:n}=e,i=Ii(e,iS);yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_DOMAIN,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield fo(my.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?C({},t,{domains:[...t.domains,e]}):t));yield co(yi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_DOMAIN,value:!1}))}}function*gS({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield co(yi.setSSOLoader({key:Ay.DELETE_SSO_DOMAIN,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(my.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?C({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield co(yi.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield co(yi.setSSOError({key:Ay.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.DELETE_SSO_DOMAIN,value:!1}))}}function*pS({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield co(yi.setSSOLoader({key:Ay.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(my.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?C({},e,{domains:e.domains.map((e=>e.id===n?C({},e,{validated:!0}):e))}):e));yield co(yi.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield co(yi.setSSOError({key:Ay.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.VALIDATE_SSO_DOMAIN,value:!1}))}}function*SS({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(my.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?C({},e,{roleIds:n}):e));yield co(yi.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield co(yi.setSSOError({key:Ay.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*vS({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_GROUPS,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield uo(t.map((e=>fo(my.auth.deleteSSOGroup,n,e)))),yield uo(e.map((e=>fo(my.auth.createSSOGroup,n,e))));const a=yield fo(my.auth.getSSOGroups,n),r=o.map((e=>e.id===n?C({},e,{groups:a}):e));yield co(yi.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_GROUPS,value:!1}))}}function*hS({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield uo(t.map((t=>fo(my.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_GROUPS,value:!1}))}}function*mS({payload:e}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield fo(ba,t,void 0,{responseType:"plain"}),configMetadata:n};let r,s;i?(r=yield fo(my.auth.updateSSOConfigurationByMetadata,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield fo(my.auth.createSSOConfigurationByMetadata,e),s=[r,...a]),yield co(yi.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*bS({payload:e}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Ii(e,oS),o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield fo(my.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield fo(my.auth.createSSOConfiguration,i),a=[e,...o]),yield co(yi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*AS(){yield la(yi.loadSSOConfigurationsV2,sS),yield la(yi.saveSSOConfigurationV2,lS),yield la(yi.saveSSODomain,fS),yield la(yi.deleteSSODomain,gS),yield la(yi.validateSSODomainV2,pS),yield la(yi.updateSSOConfiguration,uS),yield la(yi.deleteSSOConfiguration,yS),yield la(yi.setSSOGroups,vS),yield la(yi.updateSSOGroups,hS),yield la(yi.setSSODefaultRoles,SS),yield la(yi.saveSSOConfigurationByMetadata,cS),yield la(yi.updateSSOConfigurationByMetadata,dS),yield la(yi.saveSSOConfigurationByUrl,mS),yield la(yi.saveSSOConfigurationByData,bS)}const kS=["callback","profilePictureUrl"],TS=["callback","profilePictureUrl"];function*PS(){yield co(yi.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 fo.apply(void 0,[sa,e,t,n].concat(o))}(3,2e3,my.teams.getProfile),t=yield So((e=>e.auth.user));yi.setUser(C({},t,e)),yield co(yi.setProfileState({profile:e,loading:!1}))}catch(e){yield co(yi.setProfileState({loading:!1,error:e.message}))}}function*IS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Ii(e.payload,kS);yield co(yi.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield So((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 fo(my.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=C({},e,i,{profilePictureUrl:o}),r=yield fo(my.teams.updateProfile,a),s=yield So((e=>e.auth.user));yield co(yi.setUser(C({},s,r))),yield co(yi.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield co(yi.setProfileState({saving:!1,error:e.message,loading:!1})),null==t||t(null,e)}}function*LS({payload:e}){yield co(yi.setProfileState({loading:!0}));try{var t;yield fo(my.teams.changePassword,e),yield co(yi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*ES(){yield ua(yi.loadProfile,PS),yield la(yi.saveProfile,IS),yield la(yi.changePassword,LS)}function*OS(){yield co(yi.setProfileState({loading:!0})),yield mt(),yield co(yi.setUser(C({},Ky,By))),yield co(yi.setProfileState({loading:!1,profile:By}))}function*wS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Ii(e.payload,TS);yield co(yi.setProfileState({saving:!0,error:null}));const o=zy;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=C({},o.profile,i,{profilePictureUrl:a}),s=Ky;yield mt(),yield co(yi.setUser(C({},s,r))),yield co(yi.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*CS({payload:e}){var t;yield co(yi.setProfileState({loading:!0})),yield mt(),yield co(yi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*DS(){yield ua(yi.loadProfile,OS),yield la(yi.saveProfile,wS),yield la(yi.changePassword,CS)}const RS=["callback"],US=["callback"],_S=["callback"],MS=["deviceId","callback"],NS=["deviceId","callback"],FS=["callback"],$S=["deviceId"],GS=["deviceId"],xS=["callback"],VS=["deviceId"],jS=["callback"];function*WS(e){const{step:t}=yield So((e=>e.auth.mfaState));return{step:e.recoveryCode?an.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*BS(){yield co(yi.setMfaState({saving:!0}));try{const{qrCode:e}=yield fo(my.auth.enrollMfa);yield co(yi.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message}))}}function*KS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,RS);yield co(yi.setMfaState({saving:!0}));try{const e=yield So((e=>e.auth.user)),i=yield fo(my.auth.verifyMfa,n),o=yield fo(my.auth.getMFADevices),a=yield WS(i);yield co(yi.setMfaState(C({},a,{mfaDevices:o}))),yield co(yi.setUser(C({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*zS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,US);yield co(yi.setMfaState({loading:!0}));try{const e=yield fo(my.auth.loginWithMfa,n),i={step:an.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield co(yi.setMfaState(i)),yield co(yi.setState({user:e})),yield co(yi.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield co(yi.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*qS({payload:e}){yield co(yi.setMfaState({saving:!0}));try{var t;yield fo(my.auth.disableMfa,e);const n=yield fo(my.auth.getMFADevices);yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*HS({payload:e}){yield co(yi.setMfaState({saving:!0}));try{var t,n;const i=yield fo(my.auth.preEnrollMFAWebAuthn),o=C({},i.options,{challenge:kt(i.options.challenge),user:C({},i.options.user,{id:kt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield co(yi.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*JS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,_S);yield co(yi.setMfaState({saving:!0}));try{const e=Tt(n.publicKey),i=yield fo(my.auth.enrollMFAWebAuthn,C({},n,{options:e})),o=yield fo(my.auth.getMFADevices),a=yield WS(i);yield co(yi.setMfaState(C({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*YS(e){let{payload:{deviceId:t,callback:n}}=e;Ii(e.payload,MS),yield co(yi.setMfaState({saving:!0}));try{var i;const e=yield fo(my.auth.preDisableMFAWebAuthn,t),o=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*QS(e){let{payload:{deviceId:t,callback:n}}=e,i=Ii(e.payload,NS);yield co(yi.setMfaState({saving:!0}));try{const e=Tt(i.publicKey);yield fo(my.auth.disableMFAWebAuthn,t,C({},i,{options:e}));const o=yield fo(my.auth.getMFADevices);yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*XS({payload:e}){yield co(yi.setMfaState({saving:!0}));try{var t;const n=yield fo(my.auth.preEnrollMFASMS,e);yield co(yi.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 co(yi.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*ZS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,FS);yield co(yi.setMfaState({saving:!0}));try{const e=yield fo(my.auth.enrollMFASMS,n),i=yield fo(my.auth.getMFADevices),o=yield WS(e);yield co(yi.setMfaState(C({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*ev(e){let{payload:{deviceId:t}}=e,n=Ii(e.payload,$S);yield co(yi.setMfaState({saving:!0}));try{var i;const e=yield fo(my.auth.preDisableMFASMS,t);yield co(yi.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 co(yi.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*tv(e){let{payload:{deviceId:t}}=e,n=Ii(e.payload,GS);yield co(yi.setMfaState({saving:!0}));try{var i;yield fo(my.auth.disableMFASMS,t,n);const e=yield fo(my.auth.getMFADevices);yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield co(yi.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*nv(){yield co(yi.setMfaState({loading:!0}));try{yield So((e=>e.auth.user));const e=yield fo(my.auth.getMFADevices);yield co(yi.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield co(yi.setMfaState({loading:!1,error:e.message}))}}function*iv(){yield co(yi.setMfaState({loading:!0}));try{const e=(yield fo(my.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield co(yi.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield co(yi.setMfaState({loading:!1,error:e.message}))}}function*ov(){yield la(yi.enrollMfa,BS),yield la(yi.getMFADevices,nv),yield la(yi.getMFAStrategies,iv),yield la(yi.verifyMfa,KS),yield la(yi.disableMfa,qS),yield la(yi.verifyMfaAfterForce,zS),yield la(yi.preDisableMfaSms,ev),yield la(yi.disableMfaSms,tv),yield la(yi.preEnrollMfaSms,XS),yield la(yi.enrollMfaSms,ZS),yield la(yi.preEnrollMfaWebAuthn,HS),yield la(yi.enrollMfaWebAuthn,JS),yield la(yi.preDisableMfaWebAuthn,YS),yield la(yi.disableMfaWebAuthn,QS)}function*av(){yield co(yi.setMfaState({saving:!0})),yield co(yi.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*rv({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt();const n={token:"token",recoveryCode:"recoveryCode"},i={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield co(yi.setMfaState(i)),yield co(yi.setUser(C({},Ky,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*sv(e){let{payload:{callback:t}}=e,n=Ii(e.payload,xS);yield co(yi.setMfaState({loading:!0})),yield mt();const i=C({},n,{recoveryCode:"recoveryCode"}),o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield co(yi.setMfaState(o)),yield mt(),yield co(yi.setUser(C({},Ky,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*lv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt(),yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:C({},n,{authenticators:[]})})),yield co(yi.setUser(C({},Ky))),null==(t=e.callback)||t.call(e,!0)}function*cv(e){let{}=e,t=Ii(e.payload,VS);yield co(yi.setMfaState({saving:!0}));try{var n;yield co(yi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield co(yi.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*uv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt(),yield co(yi.setMfaState({loading:!1,error:void 0,mfaDevices:C({},n,{phones:[]})})),yield co(yi.setUser(C({},Ky))),null==(t=e.callback)||t.call(e,!0)}function*dv({payload:e}){var t;yield co(yi.setMfaState({saving:!0})),yield mt(),yield co(yi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*yv(e){let{payload:{callback:t}}=e;Ii(e.payload,jS);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt();const i={token:"token",recoveryCode:"recoveryCode"},o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield co(yi.setMfaState(o)),yield co(yi.setUser(C({},Ky,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*fv(){yield la(yi.enrollMfa,av),yield la(yi.verifyMfa,rv),yield la(yi.disableMfa,lv),yield la(yi.verifyMfaAfterForce,sv),yield la(yi.preDisableMfaSms,cv),yield la(yi.disableMfaSms,uv),yield la(yi.preEnrollMfaSms,dv),yield la(yi.enrollMfaSms,yv)}const gv=["callback"];function*pv({payload:e}){yield co(yi.setForgotPasswordState({loading:!0}));try{var t;yield fo(my.auth.forgotPassword,e),yield co(yi.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setForgotPasswordState({loading:!1,error:t.message||"Unknown error occurred"})),null==(n=e.callback)||n.call(e,!1,t)}}function*Sv(e){let{payload:{callback:t}}=e,n=Ii(e.payload,gv);yield co(yi.setForgotPasswordState({loading:!0}));try{yield fo(my.auth.resetPassword,n),yield co(yi.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==t||t(!0)}catch(e){yield co(yi.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1,e)}}function*vv({payload:e}){yield co(yi.setForgotPasswordState({loading:!0}));try{const t=yield fo(my.auth.loadPasswordConfig,e);yield co(yi.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield co(yi.setForgotPasswordState({loading:!1,error:e.message}))}}function*hv(){yield ua(yi.forgotPassword,pv),yield ua(yi.resetPassword,Sv),yield ua(yi.loadPasswordConfig,vv)}let mv;!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"}(mv||(mv={}));const bv=["callback","events"],Av=["callback"],kv=["callback"];function*Tv({payload:{userId:e,token:t}}){yield co(yi.setActivateState({loading:!0,step:Nt.activating}));try{const{isAuthenticated:n}=yield So((e=>e.auth));n&&(yield co(yi.silentLogout()));const i=yield fo(my.auth.getActivateAccountStrategy,{userId:e,token:t});yield co(yi.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield co(yi.setActivateState({loading:!1,step:Nt.activatingForm})))}catch(e){yield co(yi.setActivateState({loading:!1,error:e.message}))}}function*Pv(e){let{payload:{callback:t,events:n}}=e,i=Ii(e.payload,bv);yield co(yi.setActivateState({loading:!0}));try{const e=da.onRedirectTo,{routes:a}=yield So((e=>e.auth)),r=yield fo(my.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(Ng(r)){yield co(yi.setActivateState({step:Nt.success}));const t=yield Gg(r);yield co(yi.setState(t)),yield vo(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield co(yi.setActivateState({step:Nt.success}));const{user:e,tenants:t}=yield fo(my.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:vf.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield co(yi.setTenantsState({tenants:t,loading:!1})),yield co(yi.setState({user:e,isAuthenticated:!0})),yield vo(1e3),yield Ug(),yield co(yi.resetActivateState())}null==t||t(!0)}catch(e){yield co(yi.setActivateState({loading:!1,error:e.message}))}}function*Iv({payload:e}){const{callback:t}=e,n=Ii(e,Av);yield co(yi.setActivateStrategyState({loading:!0}));try{const e=yield fo(my.auth.getActivateAccountStrategy,n);yield co(yi.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield co(yi.setActivateStrategyState({loading:!1,error:e.message}))}}function*Lv({payload:e}){const{callback:t}=e,n=Ii(e,kv);yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:n.email})),yield co(yi.setActivateState({loading:!0}));try{yield fo(my.auth.resendActivationEmail,n),yield co(yi.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield co(yi.setActivateState({loading:!1,error:e.message})),yield co(yi.setTeamError({key:mv.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:!1}))}function*Ev(){yield ua(yi.activateAccount,Pv),yield ua(yi.preActivateAccount,Tv),yield ua(yi.getActivateAccountStrategy,Iv),yield ua(yi.resendActivationEmail,Lv)}function*Ov({payload:e}){if(e.token&&e.userId)try{yield co(yi.setAcceptInvitationState({error:void 0,step:xt.pending})),yield fo(my.auth.acceptInvitation,e),yield co(yi.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:xt.success}}))}catch(e){yield co(yi.setAcceptInvitationState({step:xt.failed,error:e.message}))}else yield co(yi.setAcceptInvitationState({error:void 0,step:xt.invalid}))}function*wv(){yield ua(yi.acceptInvitation,Ov)}var Cv,Dv=new Uint8Array(16);function Rv(){if(!Cv&&!(Cv="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 Cv(Dv)}for(var Uv=/^(?:[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,_v=function(e){return"string"==typeof e&&Uv.test(e)},Mv=[],Nv=0;Nv<256;++Nv)Mv.push((Nv+256).toString(16).substr(1));var Fv=function(e,t,n){var i=(e=e||{}).random||(e.rng||Rv)();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=(Mv[e[t+0]]+Mv[e[t+1]]+Mv[e[t+2]]+Mv[e[t+3]]+"-"+Mv[e[t+4]]+Mv[e[t+5]]+"-"+Mv[e[t+6]]+Mv[e[t+7]]+"-"+Mv[e[t+8]]+Mv[e[t+9]]+"-"+Mv[e[t+10]]+Mv[e[t+11]]+Mv[e[t+12]]+Mv[e[t+13]]+Mv[e[t+14]]+Mv[e[t+15]]).toLowerCase();if(!_v(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let $v,Gv;!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"}($v||($v={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Gv||(Gv={}));const xv=["callback"],Vv=["roles"],jv=["callback"],Wv=["callback","profileImage"],Bv=["callback"],Kv=["callback","userId"],zv=["callback"],qv=["callback"],Hv=["callback"],Jv=["callback"],Yv=["callback"],Qv=["callback"],Xv=["callback"],Zv=["callback","profileImage"],eh=["callback"],th=["callback"],nh=["callback"],ih=["callback"],oh=["callback"],ah=["callback"],rh=()=>So((e=>e.auth.teamState));function*sh(){try{const{groups:e}=yield fo(my.groups.getGroups,{_groupsRelations:Gv.roles});return e}catch(e){return[]}}function*lh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield rh(),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 co(yi.setTeamLoader({key:mv.USERS,value:!a})),yield co(yi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o},a]=yield uo([fo(my.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),fo(my.teams.loadAvailableRoles),fo(my.teams.loadAvailablePermissions),fo(sh)]),s=e.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>a.filter((t=>t.id===e.id)))).flat();return C({},e,{groups:n})}));yield co(yi.setTeamState({users:s,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield co(yi.setTeamError({key:mv.USERS,value:e.message})),yield co(yi.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield co(yi.setTeamLoader({key:mv.USERS,value:!1}))}function*ch({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield rh(),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 co(yi.setTeamLoader({key:mv.USERS,value:!r})),yield co(yi.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield uo([fo(my.subTenants.loadAllUsers,C({},c)),fo(my.teams.loadAvailableRoles),fo(my.teams.loadAvailablePermissions)]);yield co(yi.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield co(yi.setTeamError({key:mv.USERS,value:e.message})),yield co(yi.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield co(yi.setTeamLoader({key:mv.USERS,value:!1}))}function*uh({payload:e}){yield co(yi.setTeamLoader({key:mv.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield uo([fo(my.teams.loadAvailableRoles),fo(my.teams.loadAvailablePermissions)]);yield co(yi.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 co(yi.setTeamError({key:mv.ROLES_AND_PERMISSIONS,value:t.message}))}yield co(yi.setTeamLoader({key:mv.ROLES_AND_PERMISSIONS,value:!0}))}function*dh({payload:e}){const{callback:t}=e,n=Ii(e,xv),i=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield fo(my.teams.addUser,n),{roles:a}=e,r=C({},Ii(e,Vv),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield co(yi.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*yh({payload:e}){const{callback:t}=e,n=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield co(yi.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield fo(my.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 co(yi.loadUsers(r)),yield co(yi.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*fh({payload:e}){const{callback:t}=e,n=Ii(e,jv),i=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{yield fo(my.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield fo(my.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield co(yi.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*gh({payload:e}){const{callback:t}=e,n=Ii(e,Wv),{id:i}=n,o=yield rh(),a=o.users.find((e=>e.id===n.id));yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:i||""})),yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})})),yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?C({},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 fo(my.teams.updateUser,n);null==t||t(e),yield co(yi.setTeamState({users:o.users.map((t=>t.id===e.id?C({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:!1}))}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?C({},e,a):e))})),yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*ph({payload:e}){const{callback:t}=e,n=Ii(e,Bv),i=yield rh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})}));try{yield fo(my.teams.deleteUser,n),null==t||t(!0),yield co(yi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Sh({payload:e}){const{callback:t,userId:n}=e,i=Ii(e,Kv),o=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})}));try{yield fo(my.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return C({},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 co(yi.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[C({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*vh({payload:e}){const{callback:t}=e,n=Ii(e,zv),i=yield rh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})}));try{yield fo(my.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield co(yi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*hh({payload:e}){const{callback:t}=e,n=Ii(e,qv);yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield fo(my.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:!1}))}function*mh({payload:e}){const{callback:t}=e,n=Ii(e,Hv);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email}));try{yield fo(my.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*bh({payload:e}){const{callback:t}=e,n=Ii(e,Jv);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email}));try{yield fo(my.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*Ah({payload:e}){const{callback:t}=e,n=Ii(e,Yv);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email}));try{yield fo(my.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*kh(){yield co(yi.setTeamError({key:mv.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield fo(my.teams.getInviteLinkConfiguration);yield co(yi.setTeamState({inviteTokenState:C({},e)}))}catch(e){yield co(yi.setTeamError({key:mv.CONFIG_TOKEN_LINK,value:e.message}))}}function*Th(){yield co(yi.setTeamError({key:mv.GET_TOKEN_LINK,value:!1}));try{yield fo(kh);const e=yield fo(my.teams.getInviteUserLink),{inviteTokenState:t}=yield rh();yield co(yi.setTeamState({inviteTokenState:C({},t,e)}))}catch(e){yield co(yi.setTeamError({key:mv.GET_TOKEN_LINK,value:e.message}))}}function*Ph({payload:{callback:e}}){yield co(yi.setTeamError({key:mv.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield rh();try{const n=yield fo(my.teams.createInviteUserLink,{expiresInMinutes:43200});yield co(yi.setTeamState({inviteTokenState:C({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield co(yi.setTeamError({key:mv.CREATE_TOKEN_LINK,value:t.message}))}}function*Ih({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield rh();yield co(yi.setTeamError({key:mv.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield fo(my.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield co(yi.setTeamState({inviteTokenState:C({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield co(yi.setTeamError({key:mv.UPDATE_TOKEN_LINK,value:t.message}))}}function*Lh({payload:e}){const{callback:t}=null!=e?e:{};yield co(yi.setTeamError({key:mv.DELETE_TOKEN_LINK,value:!1}));try{yield fo(my.teams.deleteInviteUserLink),yield co(yi.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Eh({payload:e}){yield co(yi.setTeamState({addUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*Oh({payload:e}){const t=yield rh(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield co(yi.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*wh({payload:e}){yield co(yi.setTeamState({deleteUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*Ch({payload:e}){const t=yield rh(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield co(yi.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Dh(){yield ca(yi.loadUsers,lh),yield ca(yi.loadAllSubTenantsUsers,ch),yield ca(yi.loadRoles,uh),yield la(yi.addUser,dh),yield la(yi.addUsersBulk,yh),yield la(yi.addUserToSubTenants,fh),yield la(yi.updateUser,gh),yield la(yi.setUserRolesForSubTenants,Sh),yield la(yi.deleteUser,ph),yield la(yi.deleteUserFromSubTenants,vh),yield la(yi.resendActivationLink,hh),yield la(yi.resendInvitationLink,mh),yield la(yi.resendInvitationEmail,bh),yield la(yi.resendInvitationLinkToAllSubTenants,Ah),yield la(yi.getInvitationLink,Th),yield la(yi.createInvitationLink,Ph),yield la(yi.updateInvitationLink,Ih),yield la(yi.deleteInvitationLink,Lh),yield la(yi.openAddUserDialog,Eh),yield la(yi.closeAddUserDialog,Oh),yield la(yi.openDeleteUserDialog,wh),yield la(yi.closeDeleteUserDialog,Ch)}function*Rh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield rh(),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 co(yi.setTeamLoader({key:mv.USERS,value:!a})),yield co(yi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d})),yield mt(),yield co(yi.setTeamState({users:sf,totalPages:2,totalItems:10,roles:ef,permissions:nf})),yield co(yi.setTeamLoader({key:mv.USERS,value:!1})),null==r||r(sf)}function*Uh({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield rh(),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 co(yi.setTeamLoader({key:mv.USERS,value:!r})),yield co(yi.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield mt(),yield co(yi.setTeamState({allUsers:lf,totalPages:2,totalItems:10,roles:ef,permissions:nf})),yield co(yi.setTeamLoader({key:mv.USERS,value:!1})),null==s||s(lf)}function*_h({payload:e}){var t;yield co(yi.setTeamLoader({key:mv.ROLES_AND_PERMISSIONS,value:!0})),yield mt(),yield co(yi.setTeamState({roles:ef,permissions:nf})),yield co(yi.setTeamLoader({key:mv.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:ef,permissions:nf})}function*Mh({payload:e}){const{callback:t}=e,n=Ii(e,Qv),i=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield mt();const o=C({},af,{groups:[]},n,{id:`${Fv()}`});null==t||t(o),yield co(yi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Nh({payload:e}){const{callback:t}=e,n=Ii(e,Xv),i=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield mt();const o=C({},af,n,{id:`${Fv()}`});yield co(yi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*Fh({payload:e}){var t;const{callback:n}=e,i=Ii(e,Zv),{id:o}=i,a=yield rh(),r=a.users.find((e=>e.id===i.id));yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:o||""})),yield co(yi.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0})})),yield co(yi.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?C({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield mt();const s=C({},r,i);null==n||n(s),yield co(yi.setTeamState({users:a.users.map((e=>e.id===s.id?C({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:!1}))}function*$h({payload:e}){const{callback:t}=e,n=Ii(e,eh),i=yield rh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield co(yi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Gh({payload:e}){const{callback:t}=e,n=Ii(e,th),i=yield rh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield co(yi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*xh({payload:e}){const{callback:t}=e,n=Ii(e,nh);yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:n.userId})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:!1}))}function*Vh({payload:e}){const{callback:t}=e,n=Ii(e,ih);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*jh({payload:e}){const{callback:t}=e,n=Ii(e,oh);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*Wh({payload:e}){const{callback:t}=e,n=Ii(e,ah);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*Bh(){yield ca(yi.loadUsers,Rh),yield ca(yi.loadAllSubTenantsUsers,Uh),yield ca(yi.loadRoles,_h),yield la(yi.addUser,Mh),yield la(yi.addUserToSubTenants,Nh),yield la(yi.updateUser,Fh),yield la(yi.deleteUser,$h),yield la(yi.deleteUserFromSubTenants,Gh),yield la(yi.resendActivationLink,xh),yield la(yi.resendInvitationLink,Vh),yield la(yi.resendInvitationEmail,jh),yield la(yi.resendInvitationLinkToAllSubTenants,Wh),yield la(yi.openAddUserDialog,Eh),yield la(yi.closeAddUserDialog,Oh),yield la(yi.openDeleteUserDialog,wh),yield la(yi.closeDeleteUserDialog,Ch)}const Kh=["authorizationUrl"],zh=["events","url"];function*qh(){try{yield co(yi.setSocialLoginsState({loading:!0}));const e=yield fo(my.auth.getSocialLoginProviders);yield co(yi.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield co(yi.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Hh(){try{const e=yield So((e=>e.root.context));yield co(yi.setSocialLoginsState({loading:!0}));const t=yield fo(my.auth.getSocialLoginProvidersV2),{providers:n}=yield fo(my.auth.getCustomSocialLoginProvidersV1),i=t.map((t=>{let{authorizationUrl:n}=t,i=Ii(t,Kh);const o=va(e,null!=n?n:"");return C({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield co(yi.setSocialLoginsState({socialLoginsConfigV2:i,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield co(yi.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Jh(e){let{payload:{events:t,url:n}}=e,i=Ii(e.payload,zh);try{yield co(yi.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield fo(my.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:hf.SOCIAL_LOGIN,createdAt:new Date,id:s,socialProvider:i.provider,tenantId:l}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:vf.SOCIAL_LOGIN,createdAt:new Date,id:s,url:n,tenantId:l,name:c})),s&&localStorage.setItem("userId",s),yield co(yi.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield So((e=>e.auth));e?yield fo(Wg):yield fo(Kg)}(),localStorage.removeItem("register-quick-login"),yield co(yi.setSocialLoginsState({loading:!1}))}catch(e){var r;yield co(yi.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*Yh({payload:e}){yield co(yi.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*Qh(){yield ua(yi.loadSocialLoginsConfiguration,qh),yield ua(yi.loadSocialLoginsConfigurationV2,Hh),yield ua(yi.loginViaSocialLogin,Jh),yield ca(yi.setSocialLoginError,Yh)}let Xh;function*Zh({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield So((e=>e.auth.apiTokensState));try{let e,a;yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield fo(my.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield fo(my.auth.updateUserApiTokensData,{description:t}),yield co(yi.setApiTokensState({showAddTokenDialog:!1})),yield vo(200),yield co(yi.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield co(yi.setApiTokensError({key:Xh.ADD_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*em({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield So((e=>e.auth.apiTokensState));try{let e,r;yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield fo(my.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield fo(my.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield co(yi.setApiTokensState({showAddTokenDialog:!1})),yield vo(200),yield co(yi.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===i?e.clientId:void 0}})),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield co(yi.setApiTokensError({key:Xh.ADD_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*tm({payload:e}){const{apiTokensDataUser:t}=yield So((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!0})),n?(yield fo(my.auth.deleteUserAccessToken,{id:e}),yield co(yi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield fo(my.auth.deleteUserApiToken,{tokenId:e}),yield co(yi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}catch(e){yield co(yi.setApiTokensError({key:Xh.DELETE_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}}function*nm({payload:e}){const{apiTokensDataTenant:t}=yield So((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!0})),n?(yield fo(my.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield fo(my.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield co(yi.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}catch(e){yield co(yi.setApiTokensError({key:Xh.DELETE_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}}function*im({payload:e}){null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield uo([fo(my.auth.getUserApiTokensData),fo(my.auth.getTenantApiTokensData)]);yield co(yi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setApiTokensError({key:Xh.LOAD_API_TOKENS,value:t.message})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*om({payload:e}){null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=fo(my.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=fo(my.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield co(yi.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield co(yi.setApiTokensError({key:Xh.LOAD_API_TOKENS,value:t.message})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*am({payload:e}){null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=fo(my.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=fo(my.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 co(yi.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield co(yi.setApiTokensError({key:Xh.LOAD_API_TOKENS,value:t.message})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*rm(){yield ua(yi.loadApiTokens,im),yield ua(yi.loadUserApiTokens,om),yield ua(yi.loadTenantApiTokens,am),yield la(yi.addUserApiToken,Zh),yield la(yi.addTenantApiToken,em),yield ca(yi.deleteTenantApiToken,nm),yield ca(yi.deleteUserApiToken,tm)}function*sm({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield So((e=>e.auth.apiTokensState)),a=C({},jy,{description:t,roleIds:n,clientId:`CLIENT_ID_${Fv()}`});yield co(yi.setApiTokensState({showAddTokenDialog:!1})),yield vo(200),yield co(yi.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield vo(200),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*lm({payload:e}){yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!0})),yield vo(200);const t=[jy];yield co(yi.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}function*cm({payload:e}){var t;null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));const n=[Vy],i=[jy];yield co(yi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield vo(200),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*um({payload:e}){var t;null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));const n=[Vy];yield co(yi.setApiTokensState({apiTokensDataUser:n})),yield vo(200),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*dm({payload:e}){var t;null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));const n=[jy];yield co(yi.setApiTokensState({apiTokensDataTenant:n})),yield vo(200),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*ym(){yield ua(yi.loadApiTokens,cm),yield ua(yi.loadUserApiTokens,um),yield ua(yi.loadTenantApiTokens,dm),yield la(yi.addTenantApiToken,sm),yield ca(yi.deleteTenantApiToken,lm)}function*fm({payload:e}){try{var t;yield co(yi.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield So((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield fo(my.accountSettings.updateSettings,C({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield co(yi.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield co(yi.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*gm({payload:e}){yield co(yi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield fo(my.accountSettings.getSettings);yield co(yi.setAccountSettingsState(C({},e,{loading:!1})))}catch(e){yield co(yi.setAccountSettingsState({loading:!1,error:e.message}))}}function*pm(){yield ua(yi.saveAccountSettings,fm),yield ua(yi.loadAccountSettings,gm)}function*Sm({payload:e}){var t;yield co(yi.setAccountSettingsState({loading:!0})),yield mt();const{accountSettingsState:n}=yield So((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=C({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield co(yi.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*vm({payload:e}){yield co(yi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield mt(),yield co(yi.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*hm(){yield ua(yi.saveAccountSettings,Sm),yield ua(yi.loadAccountSettings,vm)}function*mm({payload:{tenantId:e,callback:t}}){yield co(yi.setState({isLoading:!0}));try{yield fo(my.tenants.switchTenant,{tenantId:e}),yield fo(Vg),(null==t?void 0:t(!0))||(yield co(yi.setState({isLoading:!1})))}catch(e){yield co(yi.setState({isLoading:!1})),null==t||t(!1,e)}}function*bm({payload:e}){yield co(yi.setTenantsState({loading:!0}));try{var t;const n=yield fo(my.tenants.getTenants);yield co(yi.setTenantsState({tenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield co(yi.setTenantsState({loading:!1}))}}function*Am({payload:e}){yield co(yi.setTenantsState({loading:!0}));try{var t;const n=yield fo(my.tenants.getSubTenants);yield co(yi.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*km({payload:e}){yield co(yi.setTenantsState({loading:!0}));try{var t;const n=yield fo(my.tenants.getSubTenantsAsTree);yield co(yi.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Tm(){yield la(yi.loadTenants,bm),yield la(yi.loadSubTenants,Am),yield la(yi.switchTenant,mm),yield la(yi.loadSubTenantsTree,km)}function*Pm(){yield co(yi.setTenantsState({loading:!0})),yield mt(),yield co(yi.setTenantsState({tenants:cf,loading:!1}))}function*Im(){yield la(yi.loadTenants,Pm)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(Xh||(Xh={}));const Lm=["callback"],Em=["callback"],Om=["callback"],wm=["callback"],Cm=["callback"];function*Dm({payload:e}){var t;yield co(yi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield uo([fo(my.roles.getRoles),fo(my.roles.getPermissions),fo(my.roles.getPermissionCategories)]),[t,n,i]=e;yield co(yi.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield co(yi.setRolesState({error:e.message,loading:!1}))}}function*Rm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Lm);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(my.roles.addRole,n),i=yield fo(my.roles.getRoles);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Um(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Em);yield co(yi.setRolesState({saving:!0}));try{yield fo(my.roles.deleteRole,n),yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*_m(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Om);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(my.roles.updateRole,n);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Mm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,wm);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(my.roles.attachPermissionsToRole,n);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Nm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Cm);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(my.roles.attachPermissionToRoles,n);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Fm(){yield ua(yi.loadRolesAndPermissions,Dm),yield la(yi.addRole,Rm),yield la(yi.deleteRole,Um),yield la(yi.updateRole,_m),yield la(yi.attachPermissionsToRole,Mm),yield la(yi.attachPermissionToRoles,Nm)}function*$m({payload:e}){var t;yield co(yi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield co(yi.setRolesState({roles:Wy,loading:!1}))}catch(e){yield co(yi.setRolesState({error:e.message,loading:!1}))}}function*Gm(){yield ua(yi.loadRolesAndPermissions,$m)}const xm=["callback"],Vm=["callback"],jm=["callback"];function*Wm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,xm);yield co(yi.setResetPhoneNumberState({loading:!0}));try{const e=yield fo(my.auth.resetPhoneNumber,n);yield co(yi.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),yield co(yi.setLoginState({email:n.email}))}catch(e){yield co(yi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Bm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Vm);yield co(yi.setResetPhoneNumberState({loading:!0}));try{const e=yield fo(my.auth.verifyResetPhoneNumber,n);yield co(yi.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Ht.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield co(yi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Km(e){let{payload:{callback:t}}=e,n=Ii(e.payload,jm);yield co(yi.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield So((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield fo(my.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield co(yi.setLoginState({step:Pt.loginWithSmsOtc})),yield co(yi.passwordlessPreLogin({type:xr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield co(yi.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*zm(){yield ua(yi.resetPhoneNumber,Wm),yield ua(yi.verifyResetPhoneNumber,Bm),yield ua(yi.changePhoneNumber,Km)}function*qm(){yield co(yi.setSessionsState({loading:!0,error:null}));try{const e=yield fo(my.auth.getCurrentUserSessions);yield co(yi.setSessionsState({sessions:e,loading:!1}))}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Hm(){yield co(yi.setSessionsState({loading:!0,error:null}));try{const e=yield fo(my.auth.getCurrentUserSession);yield co(yi.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Jm({payload:{id:e}}){yield co(yi.setSessionsState({loading:!0,error:null}));try{yield fo(my.auth.deleteSessionForUser,e),yield co(yi.loadUserSessions())}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Ym({payload:{callback:e,userId:t}}){yield co(yi.setSessionsState({loading:!0,error:null}));try{yield fo(my.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield co(yi.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Qm(){yield co(yi.setSessionsState({loading:!0,error:null}));try{yield fo(my.auth.deleteAllSessionsForUser),yield co(yi.loadUserSessions())}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Xm(){yield ca(yi.loadUserSessions,qm),yield ca(yi.deleteUserSession,Jm),yield ca(yi.deleteAllUserSessions,Qm),yield ca(yi.loadCurrentUserSession,Hm),yield la(yi.revokeUserSessions,Ym)}function*Zm(){yield co(yi.setSessionsState({loading:!0,error:null})),yield co(yi.setSessionsState({sessions:uf,loading:!1}))}function*eb({payload:{id:e}}){yield co(yi.setSessionsState({loading:!0,error:null}));const t=(yield So((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield co(yi.setSessionsState({sessions:t,loading:!1}))}function*tb(){yield co(yi.setSessionsState({loading:!0,error:null}));const e=uf.filter((e=>e.current));yield co(yi.setSessionsState({sessions:e,loading:!1}))}function*nb(){yield ca(yi.loadUserSessions,Zm),yield ca(yi.deleteUserSession,eb),yield ca(yi.deleteAllUserSessions,tb)}const ib=["callback"],ob=["callback"];function*ab(){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield fo(my.auth.getSessionConfigurations);yield co(yi.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*rb({payload:e}){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ii(e,ib);yield fo(my.auth.createOrUpdateSessionConfigrations,n),yield co(yi.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield co(yi.setSessionsPolicyState({error:e,loading:!1}))}}function*sb(){yield ua(yi.loadSessionsPolicy,ab),yield ca(yi.createOrUpdateSessionsPolicy,rb)}function*lb(){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));const e=yield So((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:df}));yield co(yi.setSessionsPolicyState(C({},e,{loading:!1})))}function*cb({payload:e}){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ii(e,ob);null==t||t(!0),yield co(yi.setSessionsPolicyState({configurations:n,loading:!1}))}function*ub(){yield ua(yi.loadSessionsPolicy,lb),yield ca(yi.createOrUpdateSessionsPolicy,cb)}const db=["callback"],yb=["callback"],fb=["callback"],gb=["callback"],pb=["callback"],Sb=["callback"],vb=["callback"],hb=["callback"],mb=()=>So((e=>e.auth.restrictionsState.ipRestrictions)),bb=()=>So((e=>e.auth.restrictionsState.emailDomainRestrictions));function*Ab(){yield co(yi.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield fo(my.auth.getDomainRestrictionsConfig),t=(yield fo(my.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield co(yi.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield co(yi.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*kb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,db);yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield bb();try{var o;yield fo(my.auth.createDomainRestriction,n);const e=(yield fo(my.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield co(yi.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 co(yi.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Tb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,yb);yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield fo(my.auth.updateDomainRestrictionConfig,n),i=(yield fo(my.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield co(yi.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Pb({payload:{id:e}}){yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield bb();try{var n;yield fo(my.auth.deleteDomainRestriction,e);const i=(yield fo(my.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield co(yi.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield co(yi.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Ib=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:xn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*Lb(){yield co(yi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield mb(),t=yield fo(my.auth.getIPRestrictionsConfig),n=Ib({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield fo(my.auth.getIPRestrictions,n);yield co(yi.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield co(yi.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Eb(){try{const{valid:e}=yield fo(my.auth.testCurrentIpInAllowList);yield co(yi.setIpRestrictionsState({userIpValid:e}))}catch(e){yield co(yi.setIpRestrictionsState({error:e.message}))}}function*Ob({payload:{callback:e}}){yield co(yi.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield So((e=>e.auth.userIp));yield uo([fo(my.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:xn.ALLOW}),fo(my.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield mb(),i=Ib(n.pagination),{items:o,_metadata:{totalPages:a}}=yield fo(my.auth.getIPRestrictions,i);yield co(yi.setIpRestrictionsState({data:{config:{isActive:!0,strategy:xn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield co(yi.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*wb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,fb);yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const i=yield mb();try{var o,a;yield fo(my.auth.createIPRestriction,n);const e=yield mb(),r=Ib(e.pagination),{items:s,_metadata:{totalPages:l}}=yield fo(my.auth.getIPRestrictions,r);yield Eb(),yield co(yi.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:xn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Cb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,gb);yield co(yi.setIpRestrictionsState({saving:!0,error:null}));try{yield fo(my.auth.updateIPRestrictionConfig,n);const e=yield mb(),i=yield fo(my.auth.getIPRestrictionsConfig),o=Ib(C({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield fo(my.auth.getIPRestrictions,o);yield Eb(),yield co(yi.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Db({payload:{id:e,callback:t}}){yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const n=yield mb();try{var i;yield fo(my.auth.deleteIPRestriction,e);const o=yield mb(),a=Ib(o.pagination),{items:r,_metadata:{totalPages:s}}=yield fo(my.auth.getIPRestrictions,a);yield Eb(),yield co(yi.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Rb(){yield ua(yi.loadIpRestrictions,Lb),yield ua(yi.loadEmailDomainRestrictions,Ab),yield la(yi.saveIpRestriction,wb),yield la(yi.saveIpRestrictionsConfig,Cb),yield la(yi.deleteIpRestriction,Db),yield la(yi.checkIfUserIpValid,Eb),yield la(yi.addCurrentUserIpAndActivate,Ob),yield la(yi.saveEmailDomainRestriction,kb),yield la(yi.saveEmailDomainRestrictionsConfig,Tb),yield la(yi.deleteEmailDomainRestriction,Pb)}function*Ub(){yield co(yi.setIpRestrictionsState({loading:!0,error:null})),yield co(yi.setIpRestrictionsState({data:{restrictions:ff.filter((e=>e.strategy===yf.strategy)),config:yf},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*_b(){yield co(yi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield mb(),t=ff[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield co(yi.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield co(yi.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Mb(e){var t,n,i;let{payload:{callback:o}}=e,a=Ii(e.payload,pb);yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const r=yield mb(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield co(yi.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:xn.ALLOW},restrictions:[...s,C({},a,{createdAt:new Date,updatedAt:new Date,id:Fv(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*Nb(e){var t,n,i;let{payload:{callback:o}}=e,a=Ii(e.payload,Sb);const r=yield mb();yield co(yi.setIpRestrictionsState({saving:!0,error:null})),yield co(yi.setIpRestrictionsState({data:{config:C({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield co(yi.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*Fb({payload:{id:e,callback:t}}){var n;yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const i=yield mb();yield co(yi.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*$b(){yield co(yi.setEmailDomainRestrictionsState({loading:!0,error:null})),yield co(yi.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:xn.ALLOW}],config:{active:!0,listType:xn.ALLOW,blockPublicDomains:!1}}}))}function*Gb(e){var t,n;let{payload:{callback:i}}=e,o=Ii(e.payload,vb);const a=yield bb();yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==i||i(!0),yield co(yi.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)||[],C({},o,{id:Date.now().toString()})]},saving:!1}))}function*xb(e){var t;let{payload:{callback:n}}=e,i=Ii(e.payload,hb);const o=yield bb();yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==n||n(!0),yield co(yi.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||xn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*Vb({payload:{id:e}}){var t,n;const i=yield bb();yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),yield co(yi.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*jb(){yield ua(yi.loadIpRestrictions,Ub),yield ua(yi.loadEmailDomainRestrictions,$b),yield la(yi.saveIpRestriction,Mb),yield la(yi.saveIpRestrictionsConfig,Nb),yield la(yi.deleteIpRestriction,Fb),yield la(yi.checkIfUserIpValid,_b),yield la(yi.saveEmailDomainRestriction,Gb),yield la(yi.saveEmailDomainRestrictionsConfig,xb),yield la(yi.deleteEmailDomainRestriction,Vb)}const Wb=["callback"],Bb=["id"];function*Kb(e){const{count:t}=yield fo(my.directory.countConfigurationUsers,e.id);return C({},e,{count:t})}function*zb(){yield co(yi.setProvisioningState({loading:!0,error:null}));try{const e=yield fo(my.directory.getConfigs),t=yield uo(e.map((e=>Kb(e))));yield co(yi.setProvisioningState({connections:t,loading:!1}))}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1}))}}function*qb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Wb);yield co(yi.setProvisioningState({loading:!0,error:null}));try{const e=yield fo(my.directory.createConfiguration,n),i=yield fo(my.directory.getConfigs),o=yield uo(i.map((e=>Kb(e))));yield co(yi.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1}))}}function*Hb(e){let{payload:{id:t}}=e,n=Ii(e.payload,Bb);yield co(yi.setProvisioningState({loading:!0,error:null}));try{yield fo(my.directory.updateConfiguration,t,n);const e=yield fo(my.directory.getConfigs),i=yield uo(e.map((e=>Kb(e))));yield co(yi.setProvisioningState({connections:i,loading:!1}))}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1}))}}function*Jb({payload:{id:e,callback:t}}){yield co(yi.setProvisioningState({loading:!0,error:null}));try{yield fo(my.directory.deleteConfiguration,e);const n=yield fo(my.directory.getConfigs),i=yield uo(n.map((e=>Kb(e))));yield co(yi.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*Yb(){yield ua(yi.loadProvisionConnections,zb),yield la(yi.createProvisionConnection,qb),yield la(yi.deleteProvisionConnection,Jb),yield la(yi.updateProvisionConnection,Hb)}const Qb=["callback","events"];function*Xb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Qb);yield co(yi.setImpersonateState({loading:!0}));try{yield fo(my.impersonate.impersonate,n),yield co(yi.setImpersonateState({step:ri.success})),yield vo(1e3),yield Ug(),yield co(yi.resetImpersonateState()),null==t||t(!0)}catch(e){yield co(yi.setImpersonateState({loading:!1,error:e.message}))}}function*Zb(){yield ua(yi.impersonate,Xb)}function*eA({payload:e}){const{callback:t,deviceId:n}=e;yield co(yi.setPasskeysState({loading:!0}));try{yield fo(my.auth.deleteWebAuthnDevice,n);const{devices:e}=yield So((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield co(yi.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setPasskeysState({loading:!1,error:e.message||null})),null==t||t(null,e.message)}}function*tA(){yield co(yi.setPasskeysState({loading:!0}));try{const{devices:e}=yield fo(my.auth.getWebAuthnDevices);yield co(yi.setPasskeysState({devices:e,loading:!1}))}catch(e){yield co(yi.setPasskeysState({loading:!1,error:e.message||null}))}}function*nA(){yield la(yi.loadWebAuthnDevices,tA),yield la(yi.deleteWebAuthnDevice,eA)}const iA=["roleIds","userIds"],oA=()=>So((e=>e.auth.groupsState));function*aA({payload:e}){const t=$v.GET_TEAM_USERS;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield fo(my.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield co(yi.setGroupsState({teamUsers:n}))}catch(e){yield co(yi.setUsersGroupsError({key:t,value:e.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*rA({payload:e}){const t=$v.GET_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield fo(my.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:Gv.rolesAndUsers});yield co(yi.setGroupsState({selectedGroup:n}))}catch(e){yield co(yi.setUsersGroupsError({key:t,value:e.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*sA(){const e=$v.GET_GROUPS,t=yield oA();yield co(yi.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield fo(my.groups.getGroups,{_groupsRelations:Gv.rolesAndUsers});yield co(yi.setGroupsState(C({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield co(yi.setUsersGroupsError({key:e,value:t.message}))}finally{yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}}function*lA({payload:e}){const t=$v.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=Ii(e,iA);yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield fo(my.groups.createGroup,C({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield co(yi.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield co(yi.addRolesToGroup({groupId:r.id,roleIds:n}))),yield co(yi.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*cA({payload:e}){const t=$v.UPDATE_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.updateGroup,e),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*uA({payload:e}){const t=$v.DELETE_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.deleteGroup,e.groupId),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1,n.message)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*dA({payload:e}){const t=$v.ADD_ROLES_TO_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*yA({payload:e}){const t=$v.DELETE_ROLES_FROM_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*fA({payload:e}){const t=$v.ADD_USERS_TO_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield co(yi.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 co(yi.setUsersGroupsError({key:t,value:n.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*gA({payload:e}){const t=$v.DELETE_USERS_FROM_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*pA(){const e=$v.GET_GROUP_CONFIGURATION;yield co(yi.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield fo(my.groups.getGroupConfiguration);yield co(yi.setGroupsState({groupsConfiguration:t}))}catch(t){yield co(yi.setUsersGroupsError({key:e,value:t.message}))}finally{yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}}function*SA({payload:e}){const t=$v.UPDATE_GROUP_CONFIGURATION;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{yield fo(my.groups.updateGroupConfiguration,e),yield co(yi.getGroupConfiguration())}catch(e){yield co(yi.setUsersGroupsError({key:t,value:e.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*vA(){yield ca(yi.loadGroups,sA),yield ca(yi.getGroupById,rA),yield ca(yi.createGroup,lA),yield ca(yi.updateGroup,cA),yield ca(yi.deleteGroup,uA),yield ca(yi.addRolesToGroup,dA),yield ca(yi.deleteRolesFromGroup,yA),yield ca(yi.addUsersToGroup,fA),yield ca(yi.deleteUsersFromGroup,gA),yield ca(yi.getGroupConfiguration,pA),yield ca(yi.updateGroupConfiguration,SA),yield ca(yi.getTeamUsers,aA)}function*hA(){const e=$v.GET_GROUPS;yield co(yi.setUsersGroupsLoader({key:e,value:!0}));const t=Sf;yield co(yi.setGroupsState({groups:t})),yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}function*mA({payload:e}){var t;const n=$v.CREATE_GROUP,{groups:i}=yield oA();yield co(yi.setUsersGroupsLoader({key:n,value:!0})),yield co(yi.setGroupsState({groups:[C({},e,{id:`${e.name}ID`,managedBy:Sy.FRONTEGG}),...null!=i?i:[]]})),yield vo(500),null==e||null==(t=e.callback)||t.call(e,!0),yield co(yi.setUsersGroupsLoader({key:n,value:!1}))}function*bA({payload:e}){var t,n,i,o,a;const r=$v.UPDATE_GROUP,s=yield oA();yield co(yi.setUsersGroupsLoader({key:r,value:!0})),yield co(yi.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:Sy.FRONTEGG}):t})),selectedGroup:C({},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 vo(500),null==e||null==(a=e.callback)||a.call(e,!0),yield co(yi.setUsersGroupsLoader({key:r,value:!1}))}function*AA({payload:e}){var t,n;const i=$v.DELETE_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*kA({payload:e}){var t,n;const i=$v.ADD_ROLES_TO_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*TA({payload:e}){var t,n;const i=$v.DELETE_ROLES_FROM_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*PA({payload:e}){var t,n;const i=$v.ADD_USERS_TO_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*IA({payload:e}){var t,n;const i=$v.DELETE_USERS_FROM_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*LA(){const e=$v.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield oA();yield co(yi.setUsersGroupsLoader({key:e,value:!0})),t&&(yield co(yi.setGroupsState({groupsConfiguration:C({},t)}))),yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}function*EA({payload:e}){const t=$v.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield oA();yield co(yi.setUsersGroupsLoader({key:t,value:!0})),n&&(yield co(yi.setGroupsState({groupsConfiguration:C({},n,e)}))),yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}function*OA(){yield ca(yi.loadGroups,hA),yield ca(yi.createGroup,mA),yield ca(yi.updateGroup,bA),yield ca(yi.deleteGroup,AA),yield ca(yi.addRolesToGroup,kA),yield ca(yi.deleteRolesFromGroup,TA),yield ca(yi.addUsersToGroup,PA),yield ca(yi.deleteUsersFromGroup,IA),yield ca(yi.getGroupConfiguration,LA),yield ca(yi.updateGroupConfiguration,EA)}const wA=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,...wA(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),CA=["callback"];function*DA(){yield co(yi.setCustomLoginState({loading:!0}));try{const e=yield fo(wc);yield co(yi.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield co(yi.setCustomLoginState({loading:!1,error:e.message}))}}function*RA(e){let{payload:{callback:t}}=e,n=Ii(e.payload,CA);try{if(yield co(yi.setCustomLoginState({error:null,saving:!0})),!n.loginBox)throw new Error("no changes to update");const e=wA(n);if(0===e.length)throw new Error("no changes to update");yield fo(Cc,{actions:e});const i=yield fo(wc);yield co(yi.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setCustomLoginState({error:e.message,saving:!1})),null==t||t(null,e)}}function*UA(){yield ua(yi.loadTenantMetadata,DA),yield ua(yi.updateTenantMetadata,RA)}var _A={sagas:function*(){yield uo([fo(Dp),fo(Ev),fo(wv),fo(hv),fo(zm),fo(qp),fo(AS),fo(ES),fo(UA),fo(ov),fo(Dh),fo(vA),fo(Qh),fo(Pf),fo(rm),fo(Xf),fo(pm),fo(Tm),fo(Fm),fo(Xm),fo(sb),fo(Rb),fo(Yb),fo(Zb),fo(nA)])},mockSagas:function*(){yield uo([fo(_p),fo(eS),fo(DS),fo(fv),fo(Bh),fo(ym),fo(dg),fo(nb),fo(hm),fo(Im),fo(ub),fo(jb),fo(Gm),fo(OA)])},storeName:wt,initialState:ai,reducer:ui,actions:yi};const MA=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),NA={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},FA={setAuditLogsState:MA("auditLogsState"),resetAuditLogsState:e=>C({},e,{auditLogsState:NA})},$A={exportAuditsCsv:lt("auditLogs/exportAuditsCsv"),loadAuditLogs:lt("auditLogs/loadAuditLogs",(e=>({payload:e})))},GA={loading:!0},xA={setAuditsMetadataState:MA("auditsMetadataState"),resetAuditsMetadataState:e=>C({},e,{auditsMetadataState:GA})},VA={loadAuditsMetadata:lt("auditLogs/loadAuditsMetadata")},jA={auditLogsState:NA,auditsMetadataState:GA},{reducer:WA,actions:BA}=ut({name:Dt,initialState:jA,reducers:C({resetState:e=>C({},e,jA),setState:(e,{payload:t})=>C({},e,t)},FA,xA)}),KA=C({},BA,$A,VA),zA=e=>"createdAt"!==e.id,qA={total:20,data:Array.from(Array(5).keys()).map((e=>C({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`})))},HA={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}]},JA=()=>So((e=>e.auditLogs.auditLogsState)),YA=()=>So((e=>e.auditLogs.auditsMetadataState));function*QA(){const e=yield JA(),{columns:t}=yield YA();try{const n=e.filter,i=e.sort.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});yield co(KA.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield my.audits.exportAudits(C({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield co(KA.setAuditLogsState({isDownloadingCsv:!1}))}function*XA({payload:e}){yield co(KA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield JA(),{columns:n}=yield YA();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 co(KA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});n||(yield co(KA.loadAuditsMetadata()));const{data:g,total:p}=yield fo(my.audits.getAudits,C({offset:c,count:l},y,f));yield co(KA.setAuditLogsState({loading:!1,logs:null!=g?g:[],totalPages:+Math.ceil(p/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield co(KA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*ZA(){yield la(KA.exportAuditsCsv,QA),yield la(KA.loadAuditLogs,XA)}function*ek({payload:e}){yield co(KA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield JA(),{columns:n}=yield YA();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 co(KA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield co(KA.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=qA;let i=n.filter((e=>t=>e.filter(zA).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 co(KA.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 co(KA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*tk(){yield la(KA.loadAuditLogs,ek)}function*nk(){yield co(KA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield fo(my.metadata.getAuditsMetadata);yield co(KA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield co(KA.setAuditsMetadataState({error:e,loading:!1}))}}function*ik(){yield la(KA.loadAuditsMetadata,nk)}function*ok(){yield co(KA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=HA;yield co(KA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield co(KA.setAuditsMetadataState({error:e,loading:!1}))}}function*ak(){yield la(KA.loadAuditsMetadata,ok)}var rk={sagas:function*(){yield uo([fo(ZA),fo(ik)])},mockSagas:function*(){yield uo([fo(tk),fo(ak)])},storeName:Dt,initialState:jA,reducer:WA,actions:KA};const sk={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:lk,actions:ck,reducer:uk}=ut({name:"audits",initialState:sk,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=C({},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]})))}}}),dk=C({},ck,{initData:lt(`${lk}/initData`),loadAudits:lt(`${lk}/loadAudits`),removeFilter:lt(`${lk}/removeFilter`),filterData:lt(`${lk}/filterData`),exportCSV:lt(`${lk}/exportCSV`),deleteAudits:lt(`${lk}/deleteAudits`)}),yk=()=>So((e=>e[lk]));function*fk(){const{sortBy:e,sortDirection:t}=yield yk();try{const n=yield fo(my.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield co(dk.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield co(dk.loadItemFailedAction(t))}}function*gk(){try{const e=yield fo(my.metadata.getAuditsMetadata);yield co(dk.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield co(dk.loadItemFailedAction(t))}}const pk=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Sk({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield yk(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield yk():{rowsData:[]};try{const e=pk(t),{data:s,total:d}=yield fo(my.audits.getAudits,C({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield co(dk.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield co(dk.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield co(dk.loadItemFailedAction(t))}}function*vk(){yield co(dk.startLoading()),yield uo([fk(),gk(),Sk({payload:{onlyOneLoad:!1},type:""})]),yield co(dk.finishLoading())}function*hk({payload:e}){const{filters:t}=yield yk(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield co(dk.setFilterData(i))}function*mk({payload:e}){const{filters:t}=yield yk();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 co(dk.setFilterData(i))}function*bk(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield yk(),a=pk(e);yield co(dk.startDownloadingCsv());try{yield my.audits.exportAudits(C({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 co(dk.stopDownloadingCsv())}}function*Ak(){yield ca(dk.initData,vk),yield ca(dk.removeFilter,hk),yield ca(dk.filterData,mk),yield ca([dk.loadAudits,dk.textSearch,dk.onPageChange],Sk),yield ca([dk.setFilterData,dk.setDataSorting,dk.startRefresh],(()=>Sk({payload:{appendMode:!1},type:""}))),yield ca(dk.exportCSV,bk)}const kk={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},Tk={initData:()=>C({},kk),setConnectivityState:(e,{payload:t})=>C({},e,t),cleanWebhookTestData:e=>C({},e,{testResult:void 0}),cleanWebhookLogsData:e=>C({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return C({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>C({},e,{error:void 0}),cleanSlackData:e=>C({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>C({},e,{retryResult:C({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>C({},e,{retryResult:C({},e.retryResult,t)})}},Pk={loadSlackActions:lt("connectivity/loadSlackActions"),loadDataAction:lt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:lt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:lt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:lt("connectivity/loadScope"),deleteWebhookConfigAction:lt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:lt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:lt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},Ik={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:Lk,actions:Ek}=ut({name:Ct,initialState:Ik,reducers:C({},Tk)}),Ok=C({},Ek,Pk),wk={slack:my.connectivity.getSlackConfiguration,email:my.connectivity.getEmailConfiguration,sms:my.connectivity.getSMSConfiguration,webhook:my.connectivity.getWebhooksConfigurations,categories:my.connectivity.getCategories,channelMap:my.connectivity.getChannelMaps},Ck={slack:my.connectivity.postSlackConfiguration,email:my.connectivity.postEmailConfiguration,sms:my.connectivity.postSMSConfiguration,webhook:my.connectivity.postWebhooksConfiguration},Dk=["email","slack","sms","webhook"],Rk={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"}},Uk=["id"],_k=["id","enabled"],Mk=["categories","channelMap"];function*Nk(e){return yield fo($k,{payload:{api:e},type:""})}function*Fk({payload:e=Dk}){yield co(Ok.setConnectivityState({isLoading:!0}));try{const t=yield uo([...e.map(Nk),yield $k({payload:{api:"categories"},type:""}),yield function*(){return(yield uo(e.map((function*(e){return yield $k({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>C({},t,{[`${e[i]}`]:n})),{})}()]),n=yield $k({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?C({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:Rk[e[o]].events(i),active:Rk[e[o]].isActive(i),platform:Rk[e[o]].title,image:Rk[e[o]].image}]}):n:C({},n,{[`${Mk[o-e.length]}`]:i})),{list:[],webhook:n});yield co(Ok.setConnectivityState(C({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield co(Ok.setConnectivityState({isLoading:!1}))}}function*$k({payload:{api:e,params:t}}){try{return yield fo(wk[e],t)}catch(e){return}}function*Gk(){try{yield co(Ok.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield fo(my.connectivity.getSlackChannels);yield co(Ok.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield co(Ok.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*xk(e,t){const{connectivity:{list:n}}=yield So(),i=n.find((({key:t})=>t===e));if(!i)return;const o=Rk[e].isActive(t);o!==i.active&&(yield co(Ok.setConnectivityState({list:n.map((t=>t.key===e?C({},t,{active:o}):t))})))}function*Vk({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield So((e=>e.connectivity));try{if(yield co(Ok.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield So();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield uo([...i.reduce(((e,t)=>{var i,o;return!t.id&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length||(null==n?void 0:n.find((e=>{let{id:n}=e,i=Ii(e,Uk);return n===t.id&&JSON.stringify(C({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield fo(Ck.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield fo(my.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield So(),{processIds:i}=yield So((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield uo([...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 fo("email"===t?my.connectivity.postEmailConfiguration:my.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=Ii(o,_k);return yield uo([yield fo("email"===t?my.connectivity.patchEmailConfiguration:my.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield fo("email"===t?my.connectivity.putEmailSubscriptions:my.connectivity.putSMSSubscriptions,a,i,C({},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 fo("email"===t?my.connectivity.deleteEmailSubscriptions:my.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield $k({payload:{api:t},type:""});yield co(Ok.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield xk(t,e)}else yield co(Ok.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield fo(Ck[e],t),!["sms","email"].includes(e)){const o=yield $k({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield co(Ok.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield xk(e,o),null==n||n(!0)}}catch(e){var o;yield co(Ok.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*jk({payload:e}){try{yield my.connectivity.postSlackCode(e)}catch{}yield co(Ok.setConnectivityState({error:void 0,isSaving:!1}))}function*Wk(){const{slackChannels:e}=yield So((e=>e.connectivity));try{yield co(Ok.setConnectivityState({slackChannels:C({},e,{isLoadingScope:!0})}));const{clientId:t}=yield fo(my.connectivity.getSlackScope);yield co(Ok.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield co(Ok.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*Bk({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield So((e=>e.connectivity));try{yield co(Ok.setConnectivityState({isSaving:!0})),yield fo(my.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield $k({payload:{api:"webhook"},type:""});o&&(yield co(Ok.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*Kk({payload:e}){try{yield co(Ok.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield fo(my.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield co(Ok.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield co(Ok.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield co(Ok.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*zk({payload:e}){try{const{statusCode:t}=yield fo(my.connectivity.postWebhookRetry,e);yield co(Ok.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield co(Ok.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*qk({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield So((e=>e.connectivity));try{yield co(Ok.setConnectivityState({webhookLogs:C({},i,{isLoading:!0})}));const o=yield fo(my.connectivity.getWebhookLog,e,n,t);yield co(Ok.setConnectivityState({error:void 0,webhookLogs:C({isLoading:!1},o)}))}catch(e){yield co(Ok.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var Hk={sagas:function*(){yield la(Ok.loadDataAction,Fk),yield ca(Ok.loadSlackActions,Gk),yield la(Ok.postDataAction,Vk),yield la(Ok.postCodeAction,jk),yield la(Ok.loadScope,Wk),yield la(Ok.deleteWebhookConfigAction,Bk),yield la(Ok.postWebhookTestAction,Kk),yield la(Ok.postWebhookRetryAction,zk),yield ca(Ok.loadWebhookLogsAction,qk)},storeName:Ct,initialState:Ik,reducer:Lk,actions:Ok};function Jk(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}}function Yk(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>C({},n,{[e]:t(n[e],i)})}}function Qk(e){return Yk(e,((e,t)=>C({},e,{loading:t.payload})))}function Xk(e){return Yk(e,((e,t)=>C({},e,{error:t.payload,loading:!1})))}const Zk={loading:!1,error:null,fetching:!0,plans:[]},{actions:eT,reducer:tT,name:nT}=ut({name:"subscriptions/plans",initialState:Zk,reducers:C({},Jk())}),iT=C({loadPlans:lt(`${nT}/loadPlans`)},eT),oT={loading:!1,error:null,fetching:!0,config:null},aT=C({},Jk()),{actions:rT,reducer:sT,name:lT}=ut({name:"subscriptions/config",initialState:oT,reducers:aT}),cT=C({loadPaymentConfiguration:lt(`${lT}/loadPaymentConfiguration`)},rT),uT={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},dT=C({},Jk(),{setCancellationLoading:Qk("cancellation"),setCancellationError:Xk("cancellation"),setRenewalLoading:Qk("renewal"),setRenewalError:Xk("renewal")}),{reducer:yT,actions:fT,name:gT}=ut({name:"subscriptions/billing/subscription",initialState:uT,reducers:dT}),pT=C({load:lt(`${gT}/loadSubscription`),cancelSubscription:lt(`${gT}/cancelSubscription`),renewSubscription:lt(`${gT}/renewSubscription`)},fT),ST={loading:!1,error:null,fetching:!0},vT=C({},Jk()),{reducer:hT,actions:mT,name:bT}=ut({name:"subscriptions/billing/information",initialState:ST,reducers:vT}),AT=C({loadBillingInformation:lt(`${bT}/loadBillingInformation`),cancelSubscription:pT.cancelSubscription,renewSubscription:pT.renewSubscription},mT),kT={loading:!1,error:null,fetching:!0},TT=C({},Jk(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}),{reducer:PT,actions:IT,name:LT}=ut({name:"subscriptions/billing/payment",initialState:kT,reducers:TT}),ET=C({loadPaymentMethod:lt(`${LT}/loadPaymentMethod`),submitPaymentMethod:lt(`${LT}/submitPaymentMethod`),submitPaymentMethodError:lt(`${LT}/submitPaymentMethodError`),submitPaymentMethodSuccess:lt(`${LT}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:lt(`${LT}/updateBillingDetails`,(e=>({payload:e})))},IT),OT={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},wT=C({},Jk(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{invoiceDownload:C({},e.invoiceDownload,t.payload)})}}),{reducer:CT,actions:DT,name:RT}=ut({name:"subscriptions/billing/invoices",initialState:OT,reducers:wT}),UT=C({loadInvoices:lt(`${RT}/loadInvoices`),downloadInvoice:lt(`${RT}/downloadInvoice`,(e=>({payload:e})))},DT),_T={information:ST,invoices:OT,paymentMethod:kT,subscription:uT},MT={invoices:UT,information:AT,paymentMethod:ET,subscription:pT},NT=je({invoices:CT,information:hT,paymentMethod:PT,subscription:yT}),FT={fetching:!0,loading:!1,error:null,confirmed:!1},$T=C({},Jk()),{actions:GT,reducer:xT,name:VT}=ut({name:"subscriptions/checkout",initialState:FT,reducers:$T}),jT=C({loadCheckout:lt(`${VT}/loadCheckout`),resetCheckout:lt(`${VT}/resetCheckout`),submitCheckout:lt(`${VT}/submitCheckout`),confirmCheckout:lt(`${VT}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:lt(`${VT}/errorCheckout`,(e=>({payload:e})))},GT),WT={loading:!1,error:null,cardSetupIntentSecret:null},BT=C({},Jk()),{reducer:KT,actions:zT,name:qT}=ut({name:"subscriptions/stripe",initialState:WT,reducers:BT}),HT=C({loadCustomer:lt(`${qT}/loadCustomer`),createCardSetupIntentSecret:lt(`${qT}/createCardSetupIntentSecret`)},zT),JT={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:YT,reducer:QT,name:XT}=ut({name:"subscriptions/vendorPublicConfig",initialState:JT,reducers:C({},Jk())}),ZT=C({loadVendorPublicConfiguration:lt(`${XT}/loadVendorPublicConfiguration`)},YT),eP={config:oT,plans:Zk,checkout:FT,billing:_T,stripe:WT,vendorPublicConfig:JT},tP={config:cT,billing:MT,plans:iT,checkout:jT,stripe:HT,vendorPublicConfig:ZT},nP=je({config:sT,billing:NT,plans:tT,checkout:xT,stripe:KT,vendorPublicConfig:QT});let iP,oP,aP;function rP({policy:e}){return{policy:aP.AT_PERIOD_END}}function sP(e){switch(e){case Sd.ACTIVE:return oP.ACTIVE;case Sd.INCOMPLETE:return oP.INCOMPLETE;case Sd.CANCELED:return oP.CANCELED;case Sd.EXPIRED:return oP.EXPIRED;case Sd.TRIALING:return oP.TRIALING;default:return oP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(iP||(iP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(oP||(oP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(aP||(aP={}));const lP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Sd.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},cP=[{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"}],uP=[{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:""}],dP=[{id:"id",externalId:"externalId",type:vd.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],yP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*fP(){yield la(pT.load,gP),yield la(pT.cancelSubscription,SP),yield la(pT.renewSubscription,vP)}function*gP(){const e=yield So((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield kP(e)}function*pP(){yield co(pT.setLoading(!0));try{const[e]=yield fo(my.subscriptions.getManagedSubscriptions);yield co(pT.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield co(pT.setError(e))}}function*SP(){const{subscription:e}=yield So((e=>e.subscriptions.billing.subscription));if(!e)return void(yield co(pT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield co(pT.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Sd.ACTIVE)try{yield co(pT.setCancellationLoading(!0)),yield fo(my.subscriptions.cancelManagedSubscription,t),yield pP(),yield co(pT.setCancellationLoading(!1))}catch(e){yield co(pT.setCancellationError(e.message))}}function*vP(){const{subscription:e}=yield So((e=>e.subscriptions.billing.subscription));if(!e)return void(yield co(pT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield co(pT.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===hd.AT_PERIOD_END)try{yield co(pT.setRenewalLoading(!0)),yield fo(my.subscriptions.renewManagedSubscription,t),yield pP(),yield co(pT.setRenewalLoading(!1))}catch(e){yield co(pT.setCancellationError(e.message))}}function*hP(){yield co(pT.setLoading(!0)),yield vo(500),yield co(pT.setState({subscription:lP,fetching:!1,loading:!1,error:null}))}function*mP(){yield la(pT.load,hP)}function*bP(){yield la(AT.loadBillingInformation,AP)}function*AP(){yield function*(e){const t=yield So((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield So((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield kP(n,!1):yield co(AT.setError(t?"Not authorized":"Internal feature failure"))}()}function*kP(e,t){yield co(AT.setLoading(!0));try{var n,i;const o=yield fo(my.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield fo(my.subscriptions.getSubscriptionPlan,a):([,s]=yield uo([fo(pP),fo(my.subscriptions.getSubscriptionPlan,a)]),l=yield So((e=>e.subscriptions.billing.subscription.subscription||null))),yield co(AT.setState(C({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?oP.ACTIVE:sP(l.status),cancellation:l.cancellation&&rP(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 co(AT.setError(e.message))}}function*TP(){yield function*(){var e,t;yield co(AT.setLoading(!0)),yield vo(500),yield co(AT.setState({loading:!1,fetching:!1,summary:{subscriptionId:lP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:md.Stripe,externallyManaged:!1,currentPlanId:cP[0].id,defaultPlanId:cP[0].id},plan:C({},cP[0],{price:null==(e=cP[0].price)?void 0:e.amount,currency:null==(t=cP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*PP(){yield la(AT.loadBillingInformation,TP)}function*IP(){yield la(ET.loadPaymentMethod,LP),yield la(ET.submitPaymentMethod,OP),yield la(ET.submitPaymentMethodError,wP),yield la(ET.submitPaymentMethodSuccess,CP),yield la(ET.updatePaymentMethodBillingDetails,EP)}function*LP(){yield co(ET.setLoading(!0));try{const e=(yield fo(my.subscriptions.getPaymentMethods))[0];yield co(ET.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield co(ET.setError(e.message))}}function*EP({payload:e}){yield co(ET.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield fo(my.subscriptions.updatePaymentMethodBillingDetails,t,C({email:n},i)),yield fo(LP),null==o||o(!0)}catch(e){yield co(ET.setError(e.message)),null==o||o(!1)}yield co(ET.setLoading(!1))}function*OP(){yield co(ET.setLoading(!0))}function*wP({payload:e}){yield co(ET.setError(e))}function*CP(){yield co(ET.loadPaymentMethod())}function*DP(){yield co(ET.setLoading(!0)),yield vo(500);const e=dP[0];yield co(ET.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*RP(){yield la(ET.loadPaymentMethod,DP)}function*UP(){yield la(UT.loadInvoices,_P),yield la(UT.downloadInvoice,MP)}function*_P(){yield co(UT.setLoading(!0));try{const e=(yield fo(my.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 co(UT.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield co(UT.setError(e.message))}}function*MP({payload:e}){yield co(UT.setInvoiceDownloadState({loading:!0,error:null}));try{yield fo(my.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield co(UT.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield co(UT.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*NP(){yield co(UT.setLoading(!0)),yield vo(500),yield co(UT.setState({loading:!1,fetching:!1,invoices:uP.map((e=>C({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield co(UT.setLoading(!1))}function*FP(){yield la(UT.loadInvoices,NP)}function*$P(){yield uo([fo(bP),fo(IP),fo(UP),fo(fP)])}function*GP(){yield uo([fo(PP),fo(RP),fo(FP),fo(mP)])}function*xP(){yield la(jT.loadCheckout,VP),yield la(jT.resetCheckout,jP),yield la(jT.submitCheckout,WP),yield la(jT.confirmCheckout,BP),yield la(jT.errorCheckout,zP)}function*VP(){yield co(jT.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*jP(){yield co(jT.setState({loading:!1,error:null,confirmed:!1}))}function*WP(){yield co(jT.setState({loading:!0,error:null}))}function*BP({payload:{paymentMethodId:e,planId:t}}){const n=yield So((e=>e.subscriptions.billing.subscription.subscription)),i=yield So((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Sd.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield co(jT.setState({loading:!0,error:null})),o&&a)return yield KP(),void(yield co(pT.setState({subscription:C({},n,{status:Sd.ACTIVE})})));try{yield fo(my.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield uo([AP(),LP(),_P()]),yield KP()}catch(e){yield co(jT.setState({loading:!1,error:e.message}))}}else yield co(jT.setState({loading:!1,error:"Subscription not found"}))}function*KP(){yield co(jT.setState({loading:!1,error:null,confirmed:!0}))}function*zP({payload:e}){yield co(jT.setState({loading:!1,error:e}))}function*qP(){yield la(jT.resetCheckout,jP)}function*HP(){yield la(iT.loadPlans,JP)}function*JP(){yield co(iT.setLoading(!0));try{const e=(yield fo(my.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 co(iT.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield co(iT.setError(e.message))}}function*YP(){yield co(iT.setLoading(!0)),yield vo(500),yield co(iT.setState({fetching:!1,loading:!1,plans:cP.map((e=>{var t,n;return C({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*QP(){yield la(iT.loadPlans,YP)}function*XP(){yield la(cT.loadPaymentConfiguration,ZP)}function*ZP(){yield co(cT.setLoading(!0));try{(yield fo(my.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===md.Stripe))?yield function*(){yield co(cT.setLoading(!0));try{const e=yield fo(my.subscriptions.getStripePaymentProviderConfiguration);yield co(cT.setState({loading:!1,fetching:!1,config:{paymentProvider:iP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield co(cT.setError(e.message))}}():yield co(cT.setError("Payment provider not configured"))}catch(e){yield co(cT.setError(e.message))}}function*eI(){yield co(cT.setLoading(!0)),yield vo(500),yield co(cT.setState({loading:!1,fetching:!1,config:{paymentProvider:iP.STRIPE,apiKey:""}}))}function*tI(){yield la(cT.loadPaymentConfiguration,eI)}function*nI(){yield la(HT.createCardSetupIntentSecret,iI)}function*iI({payload:e}){yield co(HT.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield fo(my.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield co(HT.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield co(HT.setError(e.message))}}function*oI(){yield la(ZT.loadVendorPublicConfiguration,aI)}function*aI(){yield co(ZT.setLoading(!0));try{const e=yield fo(my.subscriptions.getVendorPublicConfigurations);yield co(ZT.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield co(ZT.setError(e.message))}}function*rI(){yield co(ZT.setLoading(!0)),yield vo(500),yield co(ZT.setState({fetching:!1,loading:!1,vendorPublicConfig:yP}))}function*sI(){yield la(ZT.loadVendorPublicConfiguration,rI)}var lI={sagas:function*(){yield uo([fo($P),fo(xP),fo(HP),fo(XP),fo(nI),fo(oI)])},mockSagas:function*(){yield uo([fo(GP),fo(qP),fo(QP),fo(tI),fo(sI)])},reducer:nP,actions:tP,initialState:eP,storeName:"subscriptions"},cI={sagas:function*(){yield la(Cf.loadVendorPublicInfo,Df)},storeName:Rt,initialState:Ef,reducer:Of,actions:Cf};const{reducer:uI}=ut({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(da.setContext(t),C({},e,{context:t}))}}}),dI=(e,t,n=!1,i,o,a=!1,r="path")=>{let s=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(s||(s=window),!s.store){var l,c,u,d,y,f,g,p,S,v;n||a||da.setContext(e.context);const t=Zo(),h=[...rt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=st({middleware:h,preloadedState:{root:C({},e,{previewMode:n,urlStrategy:r}),[_A.storeName]:C({},_A.initialState,i,null!=(l=null==o?void 0:o.auth)?l:{},{routes:C({},_A.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[rk.storeName]:C({},rk.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:C({},rk.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:C({},rk.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[lk]:C({},sk,null!=(v=null==o?void 0:o.audits)?v:{}),[Hk.storeName]:Hk.initialState,[lI.storeName]:lI.initialState,[cI.storeName]:cI.initialState},reducer:je({root:uI,[_A.storeName]:_A.reducer,[rk.storeName]:rk.reducer,[lk]:uk,[Hk.storeName]:Hk.reducer,[lI.storeName]:lI.reducer,[cI.storeName]:cI.reducer})});const m=function*(){yield uo([fo(_A.sagas),fo(rk.sagas),fo(Ak),fo(Hk.sagas),fo(lI.sagas),fo(cI.sagas)])},b=function*(){yield uo([fo(_A.mockSagas),fo(rk.mockSagas),fo(lI.mockSagas)])};n?(s.store.destroy=t.run(b).cancel,s.store.dispatch(yi.requestAuthorize(!0))):s.store.destroy=t.run(m).cancel}return s.store};var yI=n(714),fI=n.n(yI);function gI(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function pI(e){if(e.type)return e;if("#"===e.charAt(0))return pI(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 SI(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 vI(e){if(0===e.indexOf("#"))return e;const{values:t}=pI(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 hI(e,t){return e=pI(e),t=gI(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,SI(e)}function mI(e,t){if(e=pI(e),t=gI(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 SI(e)}function bI(e,t){if(e=pI(e),t=gI(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 SI(e)}const AI=e=>{if(e)return{main:e,light:vI(bI(e,.4)),dark:vI(mI(e,.15)),hover:vI(mI(e,.15)),active:vI(mI(e,.2))}},kI=e=>{if(e)return{main:e,light:bI(e,.7),dark:mI(e,.2)}},TI=(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)?C({},t,{palette:{primary:C({},AI(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:C({},AI(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:C({},AI(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:C({},kI(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:C({},kI(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:C({},kI(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:C({},kI(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},PI={},II={},LI={},EI={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.*"]}};class OI{constructor(){this._theme=PI,this._themeV2=II,this._navigation=EI,this._localizations=LI}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new OI;return n.set(e),OI._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}set(e){try{var t,n,i,o,a,r,s;this._navigation=fI().all([null!=(t=EI)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=fI().all([null!=(i=PI)?i:{},TI(null==e?void 0:e.theme,PI)]),this._themeV2=fI().all([null!=(o=II)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=fI().all([null!=(r=LI)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}])}catch(e){this._navigation=EI,this._theme=PI,this._themeV2=II,this._localizations=LI}}}OI._instances={};var wI=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},CI=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},DI=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))};let RI,UI,_I,MI,NI,FI,$I,GI,xI,VI,jI;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(RI||(RI={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(UI||(UI={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(_I||(_I={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(MI||(MI={})),function(e){e.Invoices="invoices"}(NI||(NI={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(FI||(FI={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}($I||($I={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(GI||(GI={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(xI||(xI={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(VI||(VI={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(jI||(jI={}));const WI={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},BI={hidden:"hidden",edit:"edit"};var KI="6.99.0",zI={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":"on"},qI=function(){function e(t,n){var i,o=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];P(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(KI),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=R(_().mark((function e(){var t,n,i,a,r;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=ba,o.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,o.options.metadata=null!=(n=null==r||null==(i=r.rows)||null==(a=i[0])?void 0:a.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:OI.set(o.options.metadata,o.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=R(_().mark((function e(){return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o.options.hostedLoginBox||o.options.builderMode||"nextjs"===o.options.framework||o.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=R(_().mark((function e(){var t;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.options.previewMode&&!o.options.builderMode){e.next=4;break}_d.set(zI,o.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Md();case 7:t=e.sent,o.options.overrideFeatureFlags&&Object.assign(t,o.options.overrideFeatureFlags),_d.set(t,o.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.updateLocalizationsSetter=function(e){o.updateLocalizations=e};var s=wI(n),l="frontegg-app-".concat(s);this.iframeRendering=a,this.name=s,this.options=C({},t,{contextOptions:C({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=l;var c,u,d=this.options.authOptions?C({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=dI({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);w.setInstance(s,this)}var t,n,i,o;return O(e,[{key:"initContainers",value:(o=R(_().mark((function e(t){return _().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,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;OI.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:T})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=R(_().mark((function e(){return _().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=R(_().mark((function e(){var t;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return da.setRequestSource(ga.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;null==(e=this.adminPortalRenderer)||e.unmount(),da.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=R(_().mark((function e(t){var n;return _().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,C({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),HI=function(){function e(){P(this,e)}return O(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=w.getInstance(i);e&&t?(da.setAccessToken(t),da.setUser(C({},n,{accessToken:t})),o.store.dispatch(yi.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(yi.loadTenants())):(da.setAccessToken(null),da.setUser(null),o.store.dispatch(yi.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),JI=function(){function e(){P(this,e)}return O(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideAdminPortal()}}]),e}(),YI=function(){function e(){P(this,e)}return O(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";w.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideCheckoutDialog()}}]),e}(),QI=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},XI=function(){function e(t,n,i,o){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(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=dI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=C({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},o),this.app=new qI(this.options,t,!0),OI.set({},t)}var t;return O(e,[{key:"render",value:(t=R(_().mark((function e(t){var n,i,o,a,r=this;return _().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,DI(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}(),ZI="modern",eL=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[ZI]},tL=function(){function e(t,n,i,o){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(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=dI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=C({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},o),this.app=new qI(this.options,t,!0,a),OI.set({},t)}var t;return O(e,[{key:"render",value:(t=R(_().mark((function e(t){var n,i,o,a,r=this;return _().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,DI(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 nL(e,t){return nL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},nL(e,t)}function iL(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&&nL(e,t)}function oL(e,t){if(t&&("object"===I(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 aL(e){return aL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},aL(e)}function rL(){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 sL(e,t,n){return sL=rL()?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&&nL(o,n.prototype),o},sL.apply(null,arguments)}function lL(e){var t="function"==typeof Map?new Map:void 0;return lL=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 sL(e,arguments,aL(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),nL(n,e)},lL(e)}function cL(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=aL(e);if(t){var o=aL(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return oL(this,n)}}var uL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new qI(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){iL(n,e);var t=cL(n);function n(){var e;P(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 O(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=w.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=CI(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=CI(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=CI(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=CI(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=CI(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=CI(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}(lL(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}()}));