@frontegg/js 6.79.0 → 6.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FronteggHelpers/index.js +1 -2
- package/index.d.ts +0 -1
- package/index.js +1 -2
- package/node/FronteggHelpers/index.js +1 -2
- package/node/index.js +1 -12
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg-helpers.development.js +1 -2
- package/umd/frontegg-helpers.production.min.js +1 -1
- package/umd/frontegg.development.js +17 -133
- package/umd/frontegg.production.min.js +1 -1
- package/version.js +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see frontegg.production.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map((function(e){return o(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||i,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=o;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var i={};return n.isMergeableObject(e)&&a(e).forEach((function(t){i[t]=o(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?i[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):i[a]=o(t[a],n))})),i}(e,n,s):o(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var o=n(425).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},s=l.iterator||"@@iterator",c=l.asyncIterator||"@@asyncIterator",u=l.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,o){var i=t&&t.prototype instanceof g?t:g,a=Object.create(i.prototype),l=new O(o||[]);return r(a,"_invoke",{value:P(e,n,l)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,s,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(w([])));b&&b!==n&&a.call(b,s)&&(h=b);var A=v.prototype=g.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(i,r,l,s){var c=f(e[i],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==o(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,l,s)}),(function(e){n("throw",e,l,s)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return n("throw",e,l,s)}))}s(c.arg)}var i;r(this,"_invoke",{value:function(e,o){function a(){return new t((function(t,i){n(e,o,t,i)}))}return i=i?i.then(a,a):a()}})}function P(e,t,n){var o="suspendedStart";return function(i,a){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var r=n.delegate;if(r){var l=I(r,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var s=f(e,t,n);if("normal"===s.type){if(o=n.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o="completed",n.method="throw",n.arg=s.arg)}}}function I(e,t){var n=t.method,o=e.iterator[n];if(void 0===o)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=f(o,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function 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[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:D}}function D(){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,o,i,a){void 0===a&&(a=Promise);var r=new T(y(e,n,o,i),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,s,(function(){return this})),d(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=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,o){return r.type="throw",r.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],r=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var r=i?i.completion:{};return r.type=e,r.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;E(n)}return i}}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),p}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var o=n(609)();e.exports=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return function(){"use strict";n.r(o),n.d(o,{AdminPortal:function(){return JP},AdminPortalRenderer:function(){return cI},AppHolder:function(){return E},CheckoutDialog:function(){return YP},FronteggApp:function(){return qP},HostedLogin:function(){return HP},LoginBoxRenderer:function(){return yI},createElement:function(){return DP},defaultTheme:function(){return uI},formatName:function(){return wP},getThemeAdminByName:function(){return sI},getThemeByName:function(){return dI},initialize:function(){return pI},mockFlagsList:function(){return zP},waitThemeSetter:function(){return CP}});var e={};n.r(e),n.d(e,{Delete:function(){return ga},Get:function(){return da},Patch:function(){return fa},Post:function(){return ya},PostDownload:function(){return Sa},Put:function(){return pa},getBaseUrl:function(){return ca}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return Xa},getSubTenantsAsTree:function(){return Za},getTenants:function(){return Qa},switchTenant:function(){return Ya}});var i={};n.r(i),n.d(i,{AuthStrategyEnum:function(){return Lr},MachineToMachineAuthStrategy:function(){return Er},OAuthLogout:function(){return Qr},SocialLoginProviders:function(){return Ir},acceptInvitation:function(){return qr},activateAccount:function(){return jr},bulkCreateIPRestriction:function(){return br},changePhoneNumber:function(){return xs},changePhoneNumberWithVerification:function(){return $s},checkIfAllowToRememberMfaDevice:function(){return fs},createDomainRestriction:function(){return pr},createIPRestriction:function(){return mr},createOrUpdateSessionConfigrations:function(){return Ql},createSSOConfiguration:function(){return hs},createSSOConfigurationByMetadata:function(){return As},createSSODomain:function(){return Ts},createSSOGroup:function(){return Os},createSamlGroup:function(){return Nl},createTenantAccessToken:function(){return as},createUserAccessToken:function(){return is},deleteAllSessionsForUser:function(){return Zl},deleteDomainRestriction:function(){return Sr},deleteIPRestriction:function(){return kr},deleteSSOConfiguration:function(){return bs},deleteSSODomain:function(){return Ps},deleteSSOGroup:function(){return Ds},deleteSamlGroup:function(){return $l},deleteSessionForUser:function(){return Xl},deleteTenantAccessToken:function(){return ns},deleteTenantApiToken:function(){return us},deleteUserAccessToken:function(){return os},deleteUserApiToken:function(){return ds},deleteWebAuthnDevice:function(){return Bs},disableMFAAuthenticatorApp:function(){return dl},disableMFASMS:function(){return fl},disableMFAWebAuthn:function(){return gl},disableMfa:function(){return ul},enrollMFAAuthenticatorApp:function(){return il},enrollMFAAuthenticatorAppForLogin:function(){return hl},enrollMFASMS:function(){return rl},enrollMFASMSForLogin:function(){return Al},enrollMFAWebAuthn:function(){return sl},enrollMFAWebAuthnForLogin:function(){return Il},enrollMfa:function(){return nl},exchangeOAuthTokens:function(){return _s},forgotPassword:function(){return Xr},generateLoginResponse:function(){return _r},generateLoginResponseFromOAuthResponse:function(){return Nr},generateLoginResponseV2:function(){return Mr},getActivateAccountStrategy:function(){return Kr},getCaptchaPolicy:function(){return lr},getCurrentUserSession:function(){return Hl},getCurrentUserSessions:function(){return ql},getCustomSocialLoginProvidersV1:function(){return jl},getDomainRestrictions:function(){return yr},getDomainRestrictionsConfig:function(){return fr},getGlobalSecurityPolicy:function(){return er},getIPRestrictions:function(){return vr},getIPRestrictionsConfig:function(){return hr},getLockoutPolicy:function(){return ir},getMFADevices:function(){return Sl},getMFAStrategiesConfig:function(){return Hs},getMfaPolicy:function(){return tr},getOidcConfiguration:function(){return Gl},getPasswordConfigPolicy:function(){return dr},getPasswordHistoryPolicy:function(){return sr},getSSOConfigurations:function(){return vs},getSSODefaultRoles:function(){return Ls},getSSOGroups:function(){return Cs},getSSOPublicConfiguration:function(){return xl},getSamlConfiguration:function(){return Ol},getSamlRoles:function(){return Ul},getSamlRolesGroups:function(){return _l},getSamlVendorConfiguration:function(){return Dl},getSessionConfigurations:function(){return Yl},getSocialLoginProviders:function(){return Vl},getSocialLoginProvidersV2:function(){return Wl},getTenantAccessTokensData:function(){return ts},getTenantApiTokensData:function(){return ls},getUserAccessTokensData:function(){return es},getUserApiTokensData:function(){return rs},getUserById:function(){return ys},getVendorConfig:function(){return Bl},getVendorLockoutPolicy:function(){return ar},getVendorMfaPolicy:function(){return nr},getVendorPasswordHistoryPolicy:function(){return cr},getVendorPublicAuthStrategiesConfig:function(){return qs},getWebAuthnDevices:function(){return Ks},loadPasswordConfig:function(){return el},login:function(){return Vr},loginViaSocialLogin:function(){return Kl},loginWithMfa:function(){return Wr},logout:function(){return Yr},oidcPostLogin:function(){return xr},oidcPostLoginV2:function(){return Us},passwordlessPostLogin:function(){return gs},passwordlessPreLogin:function(){return ps},postLogin:function(){return Gr},preDisableMFASMS:function(){return yl},preDisableMFAWebAuthn:function(){return pl},preEnrollMFAAuthenticatorApp:function(){return ol},preEnrollMFAAuthenticatorAppForLogin:function(){return vl},preEnrollMFASMS:function(){return al},preEnrollMFASMSForLogin:function(){return bl},preEnrollMFAWebAuthn:function(){return ll},preEnrollMFAWebAuthnForLogin:function(){return Pl},preLogin:function(){return Fr},preLoginV2:function(){return Rs},preLoginWithIdpType:function(){return $r},preVerifyMFASMSForLogin:function(){return kl},preVerifyMFAWebAuthnForLogin:function(){return Ll},recoverMfaToken:function(){return tl},refreshToken:function(){return Hr},refreshTokenV2:function(){return Jr},resendActivationEmail:function(){return Br},resendInvitationEmail:function(){return zr},resetPassword:function(){return Zr},resetPhoneNumber:function(){return Ns},revokeSessionsForUser:function(){return Jl},saveLockoutPolicy:function(){return rr},saveMfaPolicy:function(){return or},savePasswordHistoryPolicy:function(){return ur},setSSODefaultRoles:function(){return Es},signUpUser:function(){return zl},silentOAuthRefreshToken:function(){return Ms},testCurrentIp:function(){return Tr},testCurrentIpInAllowList:function(){return Pr},updateDomainRestrictionConfig:function(){return gr},updateIPRestrictionConfig:function(){return Ar},updateSSOConfiguration:function(){return ms},updateSSOConfigurationByMetadata:function(){return ks},updateSSOGroup:function(){return ws},updateSamlConfiguration:function(){return wl},updateSamlGroup:function(){return Fl},updateSamlRoles:function(){return Ml},updateSamlVendorMetadata:function(){return Cl},updateTenantApiTokensData:function(){return cs},updateUserApiTokensData:function(){return ss},validateSSODomain:function(){return Is},validateSamlDomain:function(){return Rl},verifyChangePhoneNumber:function(){return Gs},verifyInviteToken:function(){return Ss},verifyMFAAuthenticatorAppForLogin:function(){return ml},verifyMFASMSForLogin:function(){return Tl},verifyMFAWebAuthnForLogin:function(){return El},verifyMfa:function(){return cl},verifyNewDeviceSession:function(){return zs},verifyResetPhoneNumber:function(){return Fs},webAuthnCreateNewDeviceSession:function(){return js},webAuthnPostLogin:function(){return Ws},webAuthnPreLogin:function(){return Vs}});var a={};n.r(a),n.d(a,{addUser:function(){return ec},changePassword:function(){return Xs},createInviteUserLink:function(){return oc},deleteInviteUserLink:function(){return ac},deleteUser:function(){return tc},getInviteLinkConfiguration:function(){return lc},getInviteUserLink:function(){return rc},getProfile:function(){return Js},loadAvailablePermissions:function(){return cc},loadAvailableRoles:function(){return sc},loadStats:function(){return uc},loadUsers:function(){return Zs},resendActivationLink:function(){return dc},resendInvitationLink:function(){return yc},resendInvitationLinkToAllTenants:function(){return fc},updateInviteUserLink:function(){return ic},updateProfile:function(){return Ys},updateProfileImage:function(){return Qs},updateUser:function(){return nc}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return hc},getCurrentUserIpMetadata:function(){return gc},getIpAdressMetadata:function(){return mc},getNotificationsMetadata:function(){return Sc},getSamlMetadata:function(){return vc}});var l={};n.r(l),n.d(l,{downloadReport:function(){return Ec},getReport:function(){return Pc},getReports:function(){return Tc},renderReport:function(){return Ic},scheduleReport:function(){return Lc},sendReport:function(){return Oc}});var s={};n.r(s),n.d(s,{getNotifications:function(){return wc},markAllAsRead:function(){return Rc},updateNotificationIsPinned:function(){return Cc},updateNotificationStatus:function(){return Dc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return Nc},getAudits:function(){return _c},getAuditsStats:function(){return Mc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return Yc},deleteEmailSubscriptions:function(){return Hc},deleteSMSConfiguration:function(){return nu},deleteSMSSubscriptions:function(){return eu},deleteSlackConfiguration:function(){return jc},deleteWebhooksConfiguration:function(){return au},getCategories:function(){return cu},getChannelMaps:function(){return uu},getEmailConfiguration:function(){return Bc},getSMSConfiguration:function(){return Qc},getSlackChannels:function(){return Vc},getSlackConfiguration:function(){return Gc},getSlackScope:function(){return xc},getWebhookLog:function(){return ru},getWebhooksConfigurations:function(){return ou},patchEmailConfiguration:function(){return qc},patchSMSConfiguration:function(){return Zc},postEmailConfiguration:function(){return zc},postSMSConfiguration:function(){return Xc},postSlackCode:function(){return Kc},postSlackConfiguration:function(){return Wc},postWebhookRetry:function(){return su},postWebhookTest:function(){return lu},postWebhooksConfiguration:function(){return iu},putEmailSubscriptions:function(){return Jc},putSMSSubscriptions:function(){return tu}});var d={};n.r(d),n.d(d,{getSettings:function(){return yu},updateSettings:function(){return du}});var y={};n.r(y),n.d(y,{addRole:function(){return vu},attachPermissionToRoles:function(){return ku},attachPermissionsToRole:function(){return bu},deleteRole:function(){return hu},getPermissionCategories:function(){return Tu},getPermissions:function(){return Au},getRoles:function(){return Su},updateRole:function(){return mu}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return td},ISubscriptionStatus:function(){return Zu},PaymentMethodType:function(){return ed},ProviderType:function(){return nd},TenantCreatedAction:function(){return id},TrialEndAction:function(){return od},cancelManagedSubscription:function(){return Cu},cancelSubscription:function(){return Lu},createStripeCustomer:function(){return Bu},createStripePaymentMethodSetupIntentSecret:function(){return qu},createSubscription:function(){return ju},createTenantConfiguration:function(){return Yu},getManagedSubscription:function(){return wu},getManagedSubscriptions:function(){return Du},getPaymentMethod:function(){return Vu},getPaymentMethods:function(){return xu},getPaymentProviders:function(){return Qu},getStripeCustomer:function(){return Ku},getStripePaymentProviderConfiguration:function(){return zu},getSubscription:function(){return Iu},getSubscriptionInvoice:function(){return Fu},getSubscriptionInvoicePdf:function(){return $u},getSubscriptionInvoices:function(){return Nu},getSubscriptionPlan:function(){return Mu},getSubscriptionPlans:function(){return _u},getSubscriptionSummaries:function(){return Hu},getSubscriptions:function(){return Pu},getTenantConfiguration:function(){return Ju},getVendorPublicConfigurations:function(){return Xu},renewManagedSubscription:function(){return Ru},renewSubscription:function(){return Eu},updateManagedSubscription:function(){return Uu},updatePaymentMethodBillingDetails:function(){return Wu},updateSubscription:function(){return Ou}});var p={};n.r(p),n.d(p,{getVendorPublicInfo:function(){return ad}});var g={};n.r(g),n.d(g,{addUserRolesForSubTenants:function(){return cd},addUserToTenantAndSubTenants:function(){return ld},loadAllUsers:function(){return rd},removeUserFromTenantAndSubTenants:function(){return sd},removeUserRolesFromSubTenants:function(){return ud},setUserRolesForSubTenants:function(){return dd}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return fd},loadFeatureFlags:function(){return pd}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return md},createConfiguration:function(){return vd},deleteConfiguration:function(){return hd},getConfigs:function(){return gd},updateConfiguration:function(){return Sd}});var h={};n.r(h),n.d(h,{impersonate:function(){return bd}});var m={};n.r(m),n.d(m,{addRolesToGroup:function(){return Ed},addUsersToGroup:function(){return wd},createGroup:function(){return Pd},deleteGroup:function(){return Ld},deleteRolesFromGroup:function(){return Od},deleteUsersFromGroup:function(){return Dd},getGroupById:function(){return kd},getGroupConfiguration:function(){return Cd},getGroups:function(){return Td},updateGroup:function(){return Id},updateGroupConfiguration:function(){return Rd}});var b={};n.r(b),n.d(b,{AuthStrategyEnum:function(){return Lr},ContextHolder:function(){return ra},FeatureFlags:function(){return fd},FronteggApiError:function(){return sa},FronteggContext:function(){return la},ISubscriptionCancellationPolicy:function(){return td},ISubscriptionStatus:function(){return Zu},MFAStrategyEnum:function(){return Md},MachineToMachineAuthStrategy:function(){return Er},PaymentMethodType:function(){return ed},ProviderType:function(){return nd},RestrictionType:function(){return $n},ScimConnectionSource:function(){return Kd},SecondaryAuthStrategy:function(){return Ud},SocialLoginProviders:function(){return Ir},TenantType:function(){return Fd},UserManagedByEnum:function(){return Nd},WebAuthnDeviceType:function(){return _d},api:function(){return Bd},countConfigurationUsers:function(){return md},createConfiguration:function(){return vd},default:function(){return zd},deleteConfiguration:function(){return hd},fetch:function(){return e},fronteggAuthApiRoutes:function(){return Gd},fronteggLogoutApiRoutes:function(){return $d},fronteggRefreshTokenUrl:function(){return xd},fronteggSilentRefreshTokenUrl:function(){return Vd},fronteggTenantsUrl:function(){return jd},fronteggUsersUrl:function(){return Wd},getConfigs:function(){return gd},loadFeatureFlags:function(){return pd},updateConfiguration:function(){return Sd}});var A={};function k(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T(e){return 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},T(e)}function P(e){var t=function(e,t){if("object"!==T(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!==T(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===T(t)?t:String(t)}function I(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,P(o.key),o)}}function L(e,t,n){return t&&I(e.prototype,t),n&&I(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(A),n.d(A,{AccountPageFields:function(){return MP},DomainRestrictionsTabFields:function(){return VP},GeneralSettingsTabFields:function(){return GP},InviteUserModalFields:function(){return _P},IpRestrictionsTabFields:function(){return xP},Metadata:function(){return OP},PrivacyPageFields:function(){return UP},ProfilePageFields:function(){return RP},SecurityPageTabs:function(){return FP},SessionManagementTabFields:function(){return $P},SsoPageTabs:function(){return WP},SubscriptionsPageFields:function(){return NP},alpha:function(){return hP},fieldAppearance:function(){return jP},tabAppearance:function(){return KP}});var E=function(){function e(){k(this,e)}return L(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 O(){return O=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},O.apply(this,arguments)}function w(e,t,n,o,i,a,r){try{var l=e[a](r),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,i)}function D(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function r(e){w(a,o,i,r,l,"next",e)}function l(e){w(a,o,i,r,l,"throw",e)}r(void 0)}))}}E._apps={};var C=n(841),R=n.n(C);function U(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function _(e){return!!e&&!!e[be]}function M(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)===Ae}(e)||Array.isArray(e)||!!e[me]||!!e.constructor[me]||V(e)||W(e))}function N(e,t,n){void 0===n&&(n=!1),0===F(e)?(n?Object.keys:ke)(e).forEach((function(o){n&&"symbol"==typeof o||t(o,e[o],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function F(e){var t=e[be];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:V(e)?2:W(e)?3:0}function $(e,t){return 2===F(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function G(e,t,n){var o=F(e);2===o?e.set(t,n):3===o?(e.delete(t),e.add(n)):e[t]=n}function x(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function V(e){return ge&&e instanceof Map}function W(e){return Se&&e instanceof Set}function j(e){return e.o||e.t}function K(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Te(e);delete t[be];for(var n=ke(t),o=0;o<n.length;o++){var i=n[o],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function B(e,t){return void 0===t&&(t=!1),q(e)||_(e)||!M(e)||(F(e)>1&&(e.set=e.add=e.clear=e.delete=z),Object.freeze(e),t&&N(e,(function(e,t){return B(t,!0)}),!0)),e}function z(){U(2)}function q(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function H(e){var t=Pe[e];return t||U(18,e),t}function J(){return fe}function Y(e,t){t&&(H("Patches"),e.u=[],e.s=[],e.v=t)}function Q(e){X(e),e.p.forEach(ee),e.p=null}function X(e){e===fe&&(fe=e.l)}function Z(e){return fe={p:[],l:fe,h:e,m:!0,_:0}}function ee(e){var t=e[be];0===t.i||1===t.i?t.j():t.O=!0}function te(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.g||H("ES5").S(t,e,o),o?(n[be].P&&(Q(t),U(4)),M(e)&&(e=ne(t,e),t.l||ie(t,e)),t.u&&H("Patches").M(n[be].t,e,t.u,t.s)):e=ne(t,n,[]),Q(t),t.u&&t.v(t.u,t.s),e!==he?e:void 0}function ne(e,t,n){if(q(t))return t;var o=t[be];if(!o)return N(t,(function(i,a){return oe(e,o,t,i,a,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return ie(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var i=4===o.i||5===o.i?o.o=K(o.k):o.o;N(3===o.i?new Set(i):i,(function(t,a){return oe(e,o,i,t,a,n)})),ie(e,i,!1),n&&e.u&&H("Patches").R(o,n,e.u,e.s)}return o.o}function oe(e,t,n,o,i,a){if(_(i)){var r=ne(e,i,a&&t&&3!==t.i&&!$(t.D,o)?a.concat(o):void 0);if(G(n,o,r),!_(r))return;e.m=!1}if(M(i)&&!q(i)){if(!e.h.F&&e._<1)return;ne(e,i),t&&t.A.l||ie(e,i)}}function ie(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&B(t,n)}function ae(e,t){var n=e[be];return(n?j(n):e)[t]}function re(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Object.getPrototypeOf(n)}}function le(e){e.P||(e.P=!0,e.l&&le(e.l))}function se(e){e.o||(e.o=K(e.t))}function ce(e,t,n){var o=V(t)?H("MapSet").N(t,n):W(t)?H("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),o={i:n?1:0,A:t?t.A:J(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=o,a=Ie;n&&(i=[o],a=Le);var r=Proxy.revocable(i,a),l=r.revoke,s=r.proxy;return o.k=s,o.j=l,s}(t,n):H("ES5").J(t,n);return(n?n.A:J()).p.push(o),o}function ue(e){return _(e)||U(22,e),function e(t){if(!M(t))return t;var n,o=t[be],i=F(t);if(o){if(!o.P&&(o.i<4||!H("ES5").K(o)))return o.t;o.I=!0,n=de(t,i),o.I=!1}else n=de(t,i);return N(n,(function(t,i){o&&function(e,t){return 2===F(e)?e.get(t):e[t]}(o.t,t)===i||G(n,t,e(i))})),3===i?new Set(n):n}(e)}function de(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return K(e)}var ye,fe,pe="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ge="undefined"!=typeof Map,Se="undefined"!=typeof Set,ve="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,he=pe?Symbol.for("immer-nothing"):((ye={})["immer-nothing"]=!0,ye),me=pe?Symbol.for("immer-draftable"):"__$immer_draftable",be=pe?Symbol.for("immer-state"):"__$immer_state",Ae=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),ke="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Te=Object.getOwnPropertyDescriptors||function(e){var t={};return ke(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Pe={},Ie={get:function(e,t){if(t===be)return e;var n=j(e);if(!$(n,t))return function(e,t,n){var o,i=re(t,n);return i?"value"in i?i.value:null===(o=i.get)||void 0===o?void 0:o.call(e.k):void 0}(e,n,t);var o=n[t];return e.I||!M(o)?o:o===ae(e.t,t)?(se(e),e.o[t]=ce(e.A.h,o,e)):o},has:function(e,t){return t in j(e)},ownKeys:function(e){return Reflect.ownKeys(j(e))},set:function(e,t,n){var o=re(j(e),t);if(null==o?void 0:o.set)return o.set.call(e.k,n),!0;if(!e.P){var i=ae(j(e),t),a=null==i?void 0:i[be];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(x(n,i)&&(void 0!==n||$(e.t,t)))return!0;se(e),le(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!==ae(e.t,t)||t in e.t?(e.D[t]=!1,se(e),le(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=j(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty:function(){U(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){U(12)}},Le={};N(Ie,(function(e,t){Le[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Le.deleteProperty=function(e,t){return Le.set.call(this,e,t,void 0)},Le.set=function(e,t,n){return Ie.set.call(this,e[0],t,n,e[0])};var Ee=function(){function e(e){var t=this;this.g=ve,this.F=!0,this.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=i);for(var o=arguments.length,r=Array(o>1?o-1:0),l=1;l<o;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var o;return(o=n).call.apply(o,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&U(6),void 0!==o&&"function"!=typeof o&&U(7),M(e)){var l=Z(t),s=ce(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?Q(l):X(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return Y(l,o),te(e,l)}),(function(e){throw Q(l),e})):(Y(l,o),te(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===he&&(r=void 0),t.F&&B(r,!0),o){var u=[],d=[];H("Patches").M(e,r,u,d),o(u,d)}return r}U(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))};var o,i,a=t.produce(e,n,(function(e,t){o=e,i=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,o,i]})):[a,o,i]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){M(e)||U(8),_(e)&&(e=ue(e));var t=Z(this),n=ce(this,e,void 0);return n[be].C=!0,X(t),n},t.finishDraft=function(e,t){var n=(e&&e[be]).A;return Y(n,t),te(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ve&&U(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));var i=H("Patches").$;return _(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Oe=new Ee,we=Oe.produce,De=(Oe.produceWithPatches.bind(Oe),Oe.setAutoFreeze.bind(Oe),Oe.setUseProxies.bind(Oe),Oe.applyPatches.bind(Oe),Oe.createDraft.bind(Oe),Oe.finishDraft.bind(Oe),we);function Ce(e,t,n){return(t=P(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Re(Object(n),!0).forEach((function(t){Ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Re(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _e(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 Me="function"==typeof Symbol&&Symbol.observable||"@@observable",Ne=function(){return Math.random().toString(36).substring(7).split("").join(".")},Fe={INIT:"@@redux/INIT"+Ne(),REPLACE:"@@redux/REPLACE"+Ne(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ne()}};function $e(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 Ge(e,t,n){var o;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(_e(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(_e(1));return n(Ge)(e,t)}if("function"!=typeof e)throw new Error(_e(2));var i=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(_e(3));return a}function d(e){if("function"!=typeof e)throw new Error(_e(4));if(s)throw new Error(_e(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(_e(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!$e(e))throw new Error(_e(7));if(void 0===e.type)throw new Error(_e(8));if(s)throw new Error(_e(9));try{s=!0,a=i(a,e)}finally{s=!1}for(var t=r=l,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(_e(10));i=e,y({type:Fe.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(_e(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Me]=function(){return this},e}return y({type:Fe.INIT}),(o={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Me]=p,o}function xe(e){for(var t=Object.keys(e),n={},o=0;o<t.length;o++){var i=t[o];"function"==typeof e[i]&&(n[i]=e[i])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Fe.INIT}))throw new Error(_e(12));if(void 0===n(void 0,{type:Fe.PROBE_UNKNOWN_ACTION()}))throw new Error(_e(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var o=!1,i={},l=0;l<r.length;l++){var s=r[l],c=n[s],u=e[s],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(_e(14));i[s]=d,o=o||d!==u}return(o=o||r.length!==Object.keys(e).length)?i:e}}function Ve(){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 We(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),o=function(){throw new Error(_e(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return o=Ve.apply(void 0,a)(n.dispatch),Ue(Ue({},n),{},{dispatch:o})}}}function je(e){return function(t){var n=t.dispatch,o=t.getState;return function(t){return function(i){return"function"==typeof i?i(n,o,e):t(i)}}}}var Ke=je();Ke.withExtraArgument=je;var Be,ze=Ke,qe=(Be=function(e,t){return Be=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])},Be(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}Be(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),He=function(e,t){for(var n=0,o=t.length,i=e.length;n<o;n++,i++)e[i]=t[n];return e},Je=Object.defineProperty,Ye=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Qe=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,Ze=function(e,t,n){return t in e?Je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},et=function(e,t){for(var n in t||(t={}))Qe.call(t,n)&&Ze(e,n,t[n]);if(Ye)for(var o=0,i=Ye(t);o<i.length;o++)n=i[o],Xe.call(t,n)&&Ze(e,n,t[n]);return e},tt="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Ve:Ve.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var nt=function(e){function t(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=e.apply(this,n)||this;return Object.setPrototypeOf(i,t.prototype),i}return qe(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,He([void 0],e[0].concat(this)))):new(t.bind.apply(t,He([void 0],e.concat(this))))},t}(Array);function ot(e){return M(e)?De(e,(function(){})):e}function it(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,o=(e.immutableCheck,e.serializableCheck,new nt);return n&&(function(e){return"boolean"==typeof e}(n)?o.push(ze):o.push(ze.withExtraArgument(n.extraArgument))),o}function at(e){var t,n=function(e){return it(e)},o=e||{},i=o.reducer,a=void 0===i?void 0:i,r=o.middleware,l=void 0===r?n():r,s=o.devTools,c=void 0===s||s,u=o.preloadedState,d=void 0===u?void 0:u,y=o.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=xe(a)}var p=l;"function"==typeof p&&(p=p(n));var g=We.apply(void 0,p),S=Ve;c&&(S=tt(et({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=He([g],f):"function"==typeof f&&(v=f(v)),Ge(t,d,S.apply(void 0,v))}function rt(e,t){function n(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(t){var i=t.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return et(et({type:e,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function lt(e){var t,n={},o=[],i={addCase:function(e,t){var o="string"==typeof e?e:e.type;if(o in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[o]=t,i},addMatcher:function(e,t){return o.push({matcher:e,reducer:t}),i},addDefaultCase:function(e){return t=e,i}};return e(i),[n,o,t]}function st(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,o="function"==typeof e.initialState?e.initialState:ot(e.initialState),i=e.reducers||{},a=Object.keys(i),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?lt(e.extraReducers):[e.extraReducers],n=t[0],i=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=et(et({},i),l);return function(e,t,n,o){void 0===n&&(n=[]);var i,a="function"==typeof t?lt(t):[t,n,o],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))i=function(){return ot(e())};else{var c=ot(e);i=function(){return c}}function u(e,t){void 0===e&&(e=i());var n=He([r[t.type]],l.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[s]),n.reduce((function(e,n){if(n){var o;if(_(e))return void 0===(o=n(e,t))?e:o;if(M(e))return De(e,(function(e){return n(e,t)}));if(void 0===(o=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return o}return e}),e)}return u.getInitialState=i,u}(o,u,r,c)}return a.forEach((function(e){var n,o,a=i[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,o=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=o?rt(c,o):rt(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:s,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var ct="listenerMiddleware";rt(ct+"/add"),rt(ct+"/removeAll"),rt(ct+"/remove"),function(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[be];return Ie.get(t,e)},set:function(t){var n=this[be];Ie.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][be];if(!i.P)switch(i.i){case 5:o(i)&&le(i);break;case 4:n(i)&&le(i)}}}function n(e){for(var t=e.t,n=e.k,o=ke(n),i=o.length-1;i>=0;i--){var a=o[i];if(a!==be){var r=t[a];if(void 0===r&&!$(t,a))return!0;var l=n[a],s=l&&l[be];if(s?s.t!==r:!x(l,r))return!0}}var c=!!t[be];return o.length!==ke(t).length+(c?0:1)}function o(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var o=0;o<t.length;o++)if(!t.hasOwnProperty(o))return!0;return!1}var i={};!function(e,t){Pe[e]||(Pe[e]=t)}("ES5",{J:function(t,n){var o=Array.isArray(t),i=function(t,n){if(t){for(var o=Array(n.length),i=0;i<n.length;i++)Object.defineProperty(o,""+i,e(i,!0));return o}var a=Te(n);delete a[be];for(var r=ke(a),l=0;l<r.length;l++){var s=r[l];a[s]=e(s,t||!!a[s].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(o,t),a={i:o?5:4,A:n?n.A:J(),P:!1,I:!1,D:{},l:n,t:t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,be,{value:a,writable:!0}),i},S:function(e,n,i){i?_(n)&&n[be].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[be];if(n){var i=n.t,a=n.k,r=n.D,l=n.i;if(4===l)N(a,(function(t){t!==be&&(void 0!==i[t]||$(i,t)?r[t]||e(a[t]):(r[t]=!0,le(n)))})),N(i,(function(e){void 0!==a[e]||$(a,e)||(r[e]=!1,le(n))}));else if(5===l){if(o(n)&&(le(n),r.length=!0),a.length<i.length)for(var s=a.length;s<i.length;s++)r[s]=!1;else for(var c=i.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,i.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):o(e)}})}();const ut=(e,t)=>n=>O({},n,{[e]:t[e]}),dt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>O({},t,{[e]:O({},t[e],n)})}),yt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:o})=>{var i;return O({},n,{[e]:O({},n[e],{[t]:O({},null==n||null==(i=n[e])?void 0:i[t],o)})})}}),ft=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o;return O({},t,{[e]:O({},t[e],{loaders:O({},t[e].loaders,{[n.key]:null==(o=n.value)||o})})})}}),pt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o;return O({},t,{[e]:O({},t[e],{errors:O({},t[e].errors,{[n.key]:null==(o=n.value)||o})})})}}),gt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(o,{payload:i})=>{var a;return O({},o,{[e]:O({},o[e],{[t]:O({},null==o||null==(a=o[e])?void 0:a[t],i,n)})})}}),St=(e,t,n)=>o=>{var i;return O({},o,{[e]:O({},o[e],{[t]:O({},null==o||null==(i=o[e])?void 0:i[t],n)})})},vt=(e=500)=>new Promise((t=>setTimeout(t,e))),ht="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",mt=new Uint8Array(256);for(let e=0;e<ht.length;e++)mt[ht.charCodeAt(e)]=e;const bt=e=>{const t=.75*e.length,n=e.length;let o,i,a,r,l,s=0;const c=new Uint8Array(t);for(o=0;o<n;o+=4)i=mt[e.charCodeAt(o)],a=mt[e.charCodeAt(o+1)],r=mt[e.charCodeAt(o+2)],l=mt[e.charCodeAt(o+3)],c[s++]=i<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},At=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(At(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let o,i="";for(o=0;o<n;o+=3)i+=ht[t[o]>>2],i+=ht[(3&t[o])<<4|t[o+1]>>4],i+=ht[(15&t[o+1])<<2|t[o+2]>>6],i+=ht[63&t[o+2]];return n%3==2?i=i.substring(0,i.length-1):n%3==1&&(i=i.substring(0,i.length-2)),i})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=At(e[n]);return t}return e};let kt,Tt,Pt;!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"}(kt||(kt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Tt||(Tt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Pt||(Pt={}));const It="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Lt="HOSTED_LOGIN_VERIFIER_KEY",Et="auth",Ot="connectivity",wt="auditLogs",Dt="vendor",Ct={flow:Tt.Login,step:kt.preLogin,loading:!1,email:"",tenants:[]},Rt={setLoginState:dt("loginState"),resetLoginState:ut("loginState",{loginState:Ct})},Ut={requestAuthorize:rt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:rt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:rt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:rt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:rt("auth/afterAuthNavigation"),preLogin:rt("auth/preLogin",(e=>({payload:e}))),postLogin:rt("auth/postLogin",(e=>({payload:e}))),login:rt("auth/login",(e=>({payload:e}))),loginWithMfa:rt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:rt("auth/recoverMfa",(e=>({payload:e}))),logout:rt("auth/logout",(e=>({payload:e}))),silentLogout:rt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:rt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:rt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:rt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:rt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:rt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:rt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:rt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:rt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:rt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:rt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:rt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:rt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:rt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:rt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:rt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:rt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:rt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:rt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:rt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:rt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:rt("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let _t;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(_t||(_t={}));const Mt={step:_t.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Nt={setActivateState:dt("activateState"),resetActivateState:ut("activateState",{activateState:Mt}),setActivateStrategyState:yt("activateState","activationStrategy")},Ft={activateAccount:rt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:rt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:rt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:rt("auth/resendActivationEmail",(e=>({payload:e})))};let $t;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}($t||($t={}));const Gt={step:$t.validate},xt={setAcceptInvitationState:dt("acceptInvitationState"),resetAcceptInvitationState:ut("acceptInvitationState",{acceptInvitationState:Gt})},Vt={acceptInvitation:rt("auth/acceptInvitation",(e=>({payload:e})))};let Wt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Wt||(Wt={}));const jt={step:Wt.forgotPassword,loading:!1,email:"",passwordConfig:null},Kt={setForgotPasswordState:dt("forgotPasswordState"),resetForgotPasswordState:ut("forgotPasswordState",{forgotPasswordState:jt})},Bt={forgotPassword:rt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:rt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:rt("auth/loadPasswordConfig",(e=>({payload:e})))};let zt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(zt||(zt={}));const qt={step:zt.ResetPhoneNumber,loading:!1},Ht={setResetPhoneNumberState:dt("resetPhoneNumberState"),resetResetPhoneNumberState:ut("resetPhoneNumberState",{resetPhoneNumberState:qt})},Jt={resetPhoneNumber:rt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:rt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:rt("auth/changePhoneNumber",(e=>({payload:e})))},Yt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Qt={setSSOLoader:ft("ssoState"),setSSOError:pt("ssoState"),setSSOState:dt("ssoState"),resetSSOState:ut("ssoState",{ssoState:Yt})},Xt={loadSSOConfigurationsV2:rt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:rt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:rt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:rt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:rt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:rt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:rt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:rt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:rt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:rt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:rt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:rt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:rt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:rt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:rt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:rt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:rt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:rt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:rt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:rt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:rt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:rt("auth/oidcPostlogin",(e=>({payload:e})))},Zt={loading:!1,error:null},en={setProfileState:dt("profileState"),resetProfileState:ut("profileState",{profileState:Zt})},tn={loadProfile:rt("auth/loadProfile"),saveProfile:rt("auth/saveProfile",(e=>({payload:e}))),changePassword:rt("auth/changePassword",(e=>({payload:e})))};let nn;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(nn||(nn={}));const on={step:nn.verify,loading:!1,saving:!1},an={setMfaState:dt("mfaState"),resetMfaState:ut("mfaState",{mfaState:on})},rn={enrollMfa:rt("auth/enrollMfa"),getMFADevices:rt("auth/getMFADevices"),getMFAStrategies:rt("auth/getMFAStrategies"),verifyMfa:rt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:rt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:rt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:rt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:rt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:rt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:rt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:rt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:rt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:rt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:rt("auth/disableMfaWebAuthn",(e=>({payload:e})))},ln={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}},sn={setTeamLoader:ft("teamState"),setTeamError:pt("teamState"),setTeamState:dt("teamState"),resetTeamState:ut("teamState",{teamState:ln})},cn={loadUsers:rt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:rt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:rt("auth/loadRoles",(e=>({payload:e}))),addUser:rt("auth/addUser",(e=>({payload:e}))),addUsersBulk:rt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:rt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:rt("auth/updateUser",(e=>({payload:e}))),deleteUser:rt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:rt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:rt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:rt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:rt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:rt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:rt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:rt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:rt("auth/getInvitationLink"),createInvitationLink:rt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:rt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:rt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:rt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:rt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:rt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:rt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:rt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:rt("auth/closeLockUserDialog",(e=>({payload:e})))},un={firstLoad:!0,loading:!1,error:""},dn={setSocialLoginsState:dt("socialLoginState"),resetSocialLoginsState:ut("socialLoginState",{socialLoginState:un})},yn={loadSocialLoginsConfiguration:rt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:rt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:rt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:rt("auth/setSocialLoginError",(e=>({payload:e})))};let fn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(fn||(fn={}));const pn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:fn.SignUp},gn={setSignUpState:dt("signUpState"),resetSignUpState:ut("signUpState",{signUpState:pn})},Sn={signUpUser:rt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:rt("auth/resetSignUpStateSoft")},vn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},hn={setApiTokensLoader:ft("apiTokensState"),setApiTokensError:pt("apiTokensState"),setApiTokensState:dt("apiTokensState"),resetApiTokensState:ut("apiTokensState",{apiTokensState:vn})},mn={loadApiTokens:rt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:rt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:rt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:rt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:rt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:rt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:rt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:rt("auth/deleteTenantApiToken",(e=>({payload:e})))},bn={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}},An={setSecurityPolicyState:dt("securityPolicyState"),setSecurityPolicyGlobalState:yt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:yt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:yt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:yt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:yt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:yt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:yt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:yt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:yt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:yt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:yt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:ut("securityPolicyState",{securityPolicyState:bn})},kn={loadSecurityPolicy:rt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:rt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:rt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:rt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:rt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:rt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:rt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:rt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:rt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:rt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:rt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:rt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:rt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:rt("auth/loadPublicAuthStrategiesPolicy")},Tn={loading:!1},Pn={setAccountSettingsState:dt("accountSettingsState"),resetAccountSettingsState:ut("accountSettingsState",{accountSettingsState:Tn})},In={loadAccountSettings:rt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:rt("auth/saveAccountSettings",(e=>({payload:e})))},Ln={tenants:[],subTenants:[],loading:!0,tenantTree:null},En={setTenantsState:dt("tenantsState"),resetTenantsState:ut("tenantsState",{tenantsState:Ln})},On={switchTenant:rt("auth/switchTenant",(e=>({payload:e}))),loadTenants:rt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:rt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:rt("auth/loadSubTenantsTree",(e=>({payload:e})))},wn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Dn={setRolesState:dt("rolesState"),resetRolesState:ut("rolesState",{rolesState:wn})},Cn={loadRolesAndPermissions:rt("auth/loadRoles",(e=>({payload:e}))),addRole:rt("auth/addRole",(e=>({payload:e}))),updateRole:rt("auth/updateRole",(e=>({payload:e}))),deleteRole:rt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:rt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:rt("auth/attachPermissionToRoles",(e=>({payload:e})))},Rn={loading:!1,sessions:[]},Un={setSessionsState:dt("sessionsState"),resetSessionsState:ut("sessionsState",{sessionsState:Rn})},_n={loadUserSessions:rt("auth/loadUserSessions"),loadCurrentUserSession:rt("auth/loadCurrentUserSession"),deleteUserSession:rt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:rt("auth/deleteAllUserSessions"),revokeUserSessions:rt("auth/revokeUserSessions",(e=>({payload:e})))},Mn={loading:!1,configurations:{}},Nn={setSessionsPolicyState:dt("sessionsPolicyState"),resetSessionsPolicyState:ut("sessionsPolicyState",{sessionsPolicyState:Mn})},Fn={loadSessionsPolicy:rt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:rt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let $n;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}($n||($n={}));const Gn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:$n.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},xn={setRestrictionsState:dt("restrictionsState"),setIpRestrictionsState:yt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:yt("restrictionsState","emailDomainRestrictions")},Vn={checkIfUserIpValid:rt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:rt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:rt("auth/loadIpRestrictions"),saveIpRestriction:rt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:rt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:rt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:rt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:rt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:rt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:rt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Wn={loading:!1},jn={setProvisioningState:dt("provisioningState"),resetProvisioningState:ut("provisioningState",{provisioningState:Wn})},Kn={loadProvisionConnections:rt("auth/loadProvisionConnections"),createProvisionConnection:rt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:rt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:rt("auth/updateProvisionConnection",(e=>({payload:e})))},Bn={devices:[],loading:!1,error:null},zn={setPasskeysState:dt("passkeysState"),resetPasskeysState:ut("passkeysState",{passkeysState:Bn})},qn={loadWebAuthnDevices:rt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:rt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Hn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Jn={setUsersGroupsLoader:ft("groupsState"),setUsersGroupsError:pt("groupsState"),setGroupsState:dt("groupsState"),resetUsersGroupsState:ut("groupsState",{groupsState:Hn})},Yn={loadGroups:rt("auth/loadUsersGroups"),getGroupById:rt("auth/getGroupById",(e=>({payload:e}))),createGroup:rt("auth/createGroup",(e=>({payload:e}))),updateGroup:rt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:rt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:rt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:rt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:rt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:rt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:rt("auth/getGroupConfiguration"),updateGroupConfiguration:rt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:rt("auth/getUsers",(e=>({payload:e})))},Qn={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}},Xn={setGroupsDialogsState:dt("groupsDialogsState"),resetGroupsDialogsState:ut("groupsState",{groupsDialogsState:Qn}),openAddGroupDialog:St("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:St("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:gt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:St("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:gt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:St("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:St("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:St("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:gt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:St("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},Zn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:pn,loginState:Ct,activateState:Mt,acceptInvitationState:Gt,forgotPasswordState:jt,ssoState:Yt,profileState:Zt,mfaState:on,teamState:ln,groupsState:Hn,groupsDialogsState:Qn,socialLoginState:un,apiTokensState:vn,securityPolicyState:bn,accountSettingsState:Tn,tenantsState:Ln,rolesState:wn,resetPhoneNumberState:qt,sessionsState:Rn,sessionsPolicyState:Mn,restrictionsState:Gn,provisioningState:Wn,passkeysState:Bn},eo=O({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:()=>{}},Zn);let to;!function(e){e.impersonating="impersonating",e.success="success"}(to||(to={}));const no={step:to.impersonating,loading:!1},oo={setImpersonateState:dt("impersonateState"),resetImpersonateState:ut("impersonateState",{impersonateState:no})},io={impersonate:rt("impersonation/impersonate",(e=>({payload:e})))},{reducer:ao,actions:ro}=st({name:Et,initialState:eo,reducers:O({resetState:e=>O({},e,Zn),setState:(e,{payload:t})=>O({},e,t),setUser:("user",(e,{payload:t})=>O({},e,{user:t}))},Rt,dn,Nt,oo,xt,Kt,Ht,gn,en,Qt,an,sn,Jn,Xn,hn,An,Pn,En,Dn,Un,Nn,xn,jn,zn)});const lo=O({},ro,Ut,yn,Ft,Vt,Bt,Jt,Sn,tn,Xt,rn,cn,Yn,{},mn,kn,In,On,Cn,_n,Fn,Vn,Kn,io,qn);var so=function(e){return"@@redux-saga/"+e},co=so("CANCEL_PROMISE"),uo=so("CHANNEL_END"),yo=so("IO"),fo=so("MATCH"),po=so("MULTICAST"),go=so("SAGA_ACTION"),So=so("SELF_CANCELLATION"),vo=so("TASK"),ho=so("TASK_CANCEL"),mo=so("TERMINATE"),bo=so("LOCATION");function Ao(e,t){if(null==e)return{};var n,o,i={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(i[n]=e[n]);return i}var ko=function(e){return null==e},To=function(e){return null!=e},Po=function(e){return"function"==typeof e},Io=function(e){return"string"==typeof e},Lo=Array.isArray,Eo=function(e){return e&&Po(e.then)},Oo=function(e){return e&&Po(e.next)&&Po(e.throw)},wo=function e(t){return t&&(Io(t)||Ro(t)||Po(t)||Lo(t)&&t.every(e))},Do=function(e){return e&&Po(e.take)&&Po(e.close)},Co=function(e){return Po(e)&&e.hasOwnProperty("toString")},Ro=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Uo=function(e,t){var n;void 0===t&&(t=!0);var o=new Promise((function(o){n=setTimeout(o,Math.min(2147483647,e),t)}));return o[co]=function(){clearTimeout(n)},o},_o=function(e){return function(){return e}},Mo=_o(!0),No=function(){},Fo=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var $o=function(e,t){O(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Go(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var xo=function(e){throw e},Vo=function(e){return{value:e,done:!0}};function Wo(e,t,n){void 0===t&&(t=xo),void 0===n&&(n="iterator");var o={meta:{name:n},next:e,throw:t,return:Vo,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function jo(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Ko=function(e){return Array.apply(null,new Array(e))},Bo=function(e){return function(t){return e(Object.defineProperty(t,go,{value:!0}))}},zo=function(e){return e===mo},qo=function(e){return e===ho},Ho=function(e){return zo(e)||qo(e)};function Jo(e,t){var n,o=Object.keys(e),i=o.length,a=0,r=Lo(e)?Ko(i):{},l={};return o.forEach((function(e){var o=function(o,l){n||(l||Ho(o)?(t.cancel(),t(o,l)):(r[e]=o,++a===i&&(n=!0,t(r))))};o.cancel=No,l[e]=o})),t.cancel=function(){n||(n=!0,o.forEach((function(e){return l[e].cancel()})))},l}function Yo(e){return{name:e.name||"anonymous",location:Qo(e)}}function Qo(e){return e[bo]}var Xo=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),o=0,i=0,a=0,r=function(t){n[i]=t,i=(i+1)%e,o++},l=function(){if(0!=o){var t=n[a];return n[a]=null,o--,a=(a+1)%e,t}},s=function(){for(var e=[];o;)e.push(l());return e};return{isEmpty:function(){return 0==o},put:function(l){var c;if(o<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[i]=l,a=i=(i+1)%e;break;case 4:c=2*e,n=s(),o=n.length,i=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},Zo="TAKE",ei="CALL",ti="FORK",ni="SELECT",oi=function(e,t){var n;return(n={})[yo]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function ii(e,t){return void 0===e&&(e="*"),wo(e)?(To(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),oi(Zo,{pattern:e})):Do(n=e)&&n[po]&&To(t)&&wo(t)?oi(Zo,{channel:e,pattern:t}):Do(e)?(To(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),oi(Zo,{channel:e})):void 0;var n}function ai(e,t){return ko(t)&&(t=e,e=void 0),oi("PUT",{channel:e,action:t})}function ri(e){var t=oi("ALL",e);return t.combinator=!0,t}function li(e,t){var n,o=null;return Po(e)?n=e:(Lo(e)?(o=e[0],n=e[1]):(o=e.context,n=e.fn),o&&Io(n)&&Po(o[n])&&(n=o[n])),{context:o,fn:n,args:t}}function si(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return oi(ei,li(e,n))}function ci(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return oi(ti,li(e,n))}function ui(e){return void 0===e&&(e=So),oi("CANCEL",e)}function di(e){void 0===e&&(e=Fo);for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return oi(ni,{selector:e,args:n})}var yi=si.bind(null,Uo);var fi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},pi=[],gi=0;function Si(e){try{mi(),e()}finally{bi()}}function vi(e){pi.push(e),gi||(mi(),Ai())}function hi(e){try{return mi(),e()}finally{Ai()}}function mi(){gi++}function bi(){gi--}function Ai(){var e;for(bi();!gi&&void 0!==(e=pi.shift());)Si(e)}var ki=function(e){return function(t){return e.some((function(e){return Ei(e)(t)}))}},Ti=function(e){return function(t){return e(t)}},Pi=function(e){return function(t){return t.type===String(e)}},Ii=function(e){return function(t){return t.type===e}},Li=function(){return Mo};function Ei(e){var t="*"===e?Li:Io(e)?Pi:Lo(e)?ki:Co(e)?Pi:Po(e)?Ti:Ro(e)?Ii:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Oi={type:uo},wi=function(e){return e&&e.type===uo};function Di(){var e,t,n,o,i,a,r=(t=!1,o=n=[],i=function(){o===n&&(o=n.slice())},a=function(){t=!0;var e=n=o;o=[],e.forEach((function(e){e(Oi)}))},(e={})[po]=!0,e.put=function(e){if(!t)if(wi(e))a();else for(var i=n=o,r=0,l=i.length;r<l;r++){var s=i[r];s[fo](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=Li),t?e(Oi):(e[fo]=n,i(),o.push(e),e.cancel=(a=!1,function(){a||(a=!0,i(),Go(o,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[go]?l(e):vi((function(){l(e)}))},r}function Ci(e,t){var n=e[co];Po(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Ri,Ui=0,_i=function(){return++Ui};function Mi(e){e.isRunning()&&e.cancel()}var Ni=((Ri={}).TAKE=function(e,t,n){var o=t.channel,i=void 0===o?e.channel:o,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!wi(e)||r?n(e):n(mo)};try{i.take(l,To(a)?Ei(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},Ri.PUT=function(e,t,n){var o=t.channel,i=t.action,a=t.resolve;vi((function(){var t;try{t=(o?o.put:e.dispatch)(i)}catch(e){return void n(e,!0)}a&&Eo(t)?Ci(t,n):n(t)}))},Ri.ALL=function(e,t,n,o){var i=o.digestEffect,a=Ui,r=Object.keys(t);if(0!==r.length){var l=Jo(t,n);r.forEach((function(e){i(t[e],a,l[e],e)}))}else n(Lo(t)?[]:{})},Ri.RACE=function(e,t,n,o){var i=o.digestEffect,a=Ui,r=Object.keys(t),l=Lo(t)?Ko(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,o){c||(o||Ho(t)?(n.cancel(),n(t,o)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=No,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||i(t[e],a,s[e],e)}))},Ri.CALL=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=o.task;try{var s=a.apply(i,r);if(Eo(s))return void Ci(s,n);if(Oo(s))return void zi(e,s,l.context,Ui,Yo(a),!1,n);n(s)}catch(e){n(e,!0)}},Ri.CPS=function(e,t,n){var o=t.context,i=t.fn,a=t.args;try{var r=function(e,t){ko(e)?n(t):n(e,!0)};i.apply(o,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Ri.FORK=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=t.detached,s=o.task,c=function(e){var t=e.context,n=e.fn,o=e.args;try{var i=n.apply(t,o);if(Oo(i))return i;var a=!1;return Wo((function(e){return a?{value:e,done:!0}:(a=!0,{value:i,done:!Eo(i)})}))}catch(e){return Wo((function(){throw e}))}}({context:i,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Yo(t)}(c,a);hi((function(){var t=zi(e,c,s.context,Ui,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},Ri.JOIN=function(e,t,n,o){var i=o.task,a=function(e,t){if(e.isRunning()){var n={task:i,cb:t};t.cancel=function(){e.isRunning()&&Go(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Lo(t)){if(0===t.length)return void n([]);var r=Jo(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Ri.CANCEL=function(e,t,n,o){var i=o.task;t===So?Mi(i):Lo(t)?t.forEach(Mi):Mi(t),n()},Ri.SELECT=function(e,t,n){var o=t.selector,i=t.args;try{n(o.apply(void 0,[e.getState()].concat(i)))}catch(e){n(e,!0)}},Ri.ACTION_CHANNEL=function(e,t,n){var o=t.pattern,i=function(e){void 0===e&&(e=Xo());var t=!1,n=[];return{take:function(o){t&&e.isEmpty()?o(Oi):e.isEmpty()?(n.push(o),o.cancel=function(){Go(n,o)}):o(e.take())},put:function(o){if(!t){if(0===n.length)return e.put(o);n.shift()(o)}},flush:function(n){t&&e.isEmpty()?n(Oi):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var o=0,i=e.length;o<i;o++)(0,e[o])(Oi)}}}}(t.buffer),a=Ei(o),r=function t(n){wi(n)||e.channel.take(t,a),i.put(n)},l=i.close;i.close=function(){r.cancel(),l()},e.channel.take(r,a),n(i)},Ri.CANCELLED=function(e,t,n,o){n(o.task.isCancelled())},Ri.FLUSH=function(e,t,n){t.flush(n)},Ri.GET_CONTEXT=function(e,t,n,o){n(o.task.context[t])},Ri.SET_CONTEXT=function(e,t,n,o){var i=o.task;$o(i.context,t),n()},Ri);function Fi(e,t){return e+"?"+t}function $i(e){var t=e.name,n=e.location;return n?t+" "+Fi(n.fileName,n.lineNumber):t}function Gi(e){var t,n,o,i=(t=function(e){return e.cancelledTasks},n=e,(o=[]).concat.apply(o,n.map(t)));return i.length?["Tasks cancelled due to error:"].concat(i).join("\n"):""}var xi=null,Vi=[],Wi=function(e){e.crashedEffect=xi,Vi.push(e)},ji=function(){xi=null,Vi.length=0},Ki=function(){var e,t,n=Vi[0],o=Vi.slice(1),i=n.crashedEffect?(e=n.crashedEffect,(t=Qo(e))?t.code+" "+Fi(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+$i(n.meta)+(i?" \n when executing effect "+i:"")].concat(o.map((function(e){return" created by "+$i(e.meta)})),[Gi(Vi)]).join("\n")};function Bi(e,t,n,o,i,a,r){var l;void 0===r&&(r=No);var s,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var o,i=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){i.push(t),t.cont=function(l,s){a||(Go(i,t),t.cont=No,s?r(l):(t===e&&(o=l),i.length||(a=!0,n(o))))}}function s(){a||(a=!0,i.forEach((function(e){e.cont=No,e.cancel()})),i=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return i}}}(t,0,g);function g(t,n){if(n){if(u=2,Wi({meta:i,cancelledTasks:y}),S.isRoot){var o=Ki();ji(),e.onError(t,{sagaStack:o})}c=t,d&&d.reject(t)}else t===ho?u=1:1!==u&&(u=3),s=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((l={})[vo]=!0,l.id=o,l.meta=i,l.isRoot=a,l.context=f,l.joiners=[],l.queue=p,l.cancel=function(){0===u&&(u=1,p.cancelAll(),g(ho,!1))},l.cont=r,l.end=g,l.setContext=function(e){$o(f,e)},l.toPromise=function(){return d||(d=fi(),2===u?d.reject(c):0!==u&&d.resolve(s)),d.promise},l.isRunning=function(){return 0===u},l.isCancelled=function(){return 1===u||0===u&&1===t.status},l.isAborted=function(){return 2===u},l.result=function(){return s},l.error=function(){return c},l);return S}function zi(e,t,n,o,i,a,r){var l=e.finalizeRunEffect((function(t,n,o){Eo(t)?Ci(t,o):Oo(t)?zi(e,t,c.context,n,i,!1,o):t&&t[yo]?(0,Ni[t.type])(e,t.payload,o,u):o(t)}));d.cancel=No;var s={meta:i,cancel:function(){0===s.status&&(s.status=1,d(ho))},status:0},c=Bi(e,s,n,o,i,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var i;n?(i=t.throw(e),ji()):qo(e)?(s.status=1,d.cancel(),i=Po(t.return)?t.return(ho):{done:!0,value:ho}):i=zo(e)?Po(t.return)?t.return():{done:!0}:t.next(e),i.done?(1!==s.status&&(s.status=3),s.cont(i.value)):y(i.value,o,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,o,i){void 0===i&&(i="");var a,r=_i();function s(n,i){a||(a=!0,o.cancel=No,e.sagaMonitor&&(i?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),i&&function(e){xi=e}(t),o(n,i))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:i,effect:t}),s.cancel=No,o.cancel=function(){a||(a=!0,s.cancel(),s.cancel=No,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function qi(e,t){for(var n=e.channel,o=void 0===n?Di():n,i=e.dispatch,a=e.getState,r=e.context,l=void 0===r?{}:r,s=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?jo:u,y=arguments.length,f=new Array(y>2?y-2:0),p=2;p<y;p++)f[p-2]=arguments[p];var g,S=t.apply(void 0,f),v=_i();if(s&&(s.rootSagaStarted=s.rootSagaStarted||No,s.effectTriggered=s.effectTriggered||No,s.effectResolved=s.effectResolved||No,s.effectRejected=s.effectRejected||No,s.effectCancelled=s.effectCancelled||No,s.actionDispatched=s.actionDispatched||No,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Ve.apply(void 0,c);g=function(e){return function(t,n,o){return h((function(t){return e(t,n,o)}))(t)}}}else g=Fo;var m={channel:o,dispatch:Bo(i),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return hi((function(){var e=zi(m,S,l,v,Yo(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var Hi=function(e){var t,n=void 0===e?{}:e,o=n.context,i=void 0===o?{}:o,a=n.channel,r=void 0===a?Di():a,l=n.sagaMonitor,s=Ao(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,o=e.dispatch;return t=qi.bind(null,O({},s,{context:i,channel:r,dispatch:o,getState:n,sagaMonitor:l})),function(e){return function(t){l&&l.actionDispatched&&l.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){$o(i,e)},c},Ji=function(e){return{done:!0,value:e}},Yi={};function Qi(e){return Do(e)?"channel":Co(e)?String(e):Po(e)?e.name:String(e)}function Xi(e,t,n){var o,i,a,r=t;function l(t,n){if(r===Yi)return Ji(t);if(n&&!i)throw r=Yi,n;o&&o(t);var l=n?e[i](n):e[r]();return r=l.nextState,a=l.effect,o=l.stateUpdater,i=l.errorState,r===Yi?Ji(t):a}return Wo(l,(function(e){return l(null,e)}),n)}function Zi(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:ii(e)},l=function(e){return{done:!1,value:ci.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return Xi({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Qi(e)+", "+t.name+")")}function ea(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r,l={done:!1,value:ii(e)},s=function(e){return{done:!1,value:ci.apply(void 0,[t].concat(o,[e]))}},c=function(e){return{done:!1,value:ui(e)}},u=function(e){return a=e},d=function(e){return r=e};return Xi({q1:function(){return{nextState:"q2",effect:l,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:s(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:s(r),stateUpdater:u}}},"q1","takeLatest("+Qi(e)+", "+t.name+")")}function ta(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:ii(e)},l=function(e){return{done:!1,value:si.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return Xi({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Qi(e)+", "+t.name+")")}function na(e,t,n){for(var o=e,i=arguments.length,a=new Array(i>3?i-3:0),r=3;r<i;r++)a[r-3]=arguments[r];var l={done:!1,value:si.apply(void 0,[n].concat(a))},s={done:!1,value:yi(t)};return Xi({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:Yi}},q10:function(e){if((o-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function oa(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return ci.apply(void 0,[Zi,e,t].concat(o))}function ia(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return ci.apply(void 0,[ea,e,t].concat(o))}function aa(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return ci.apply(void 0,[ta,e,t].concat(o))}class ra{constructor(){this.context=null,this.accessToken=null,this.user=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return ra.instance||(ra.instance=new ra),ra.instance}static setContext(e){ra.getInstance().context=e}static setAccessToken(e){ra.getInstance().accessToken=e}static setUser(e){ra.getInstance().user=e}static setOnRedirectTo(e){ra.getInstance().onRedirectTo=e}static setLogout(e,t){ra.getInstance().logout=n=>{n?e(n):ra.onRedirectTo(t)}}static getContext(){var e;return null!=(e=ra.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return ra.getInstance().accessToken}static getUser(){return ra.getInstance().user}static onRedirectTo(e,t){return ra.getInstance().onRedirectTo(e,t)}static logout(e){return ra.getInstance().logout(e)}}ra.instance=void 0;const la={getContext:()=>ra.getContext(),getAccessToken:()=>ra.getAccessToken(),getUser:()=>ra.getUser(),onRedirectTo:(e,t)=>ra.onRedirectTo(e,t),logout:e=>ra.logout(e)};class sa extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function ca(e,t,n=!0){let o;o="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const i=e.urlPrefix||"frontegg",a="frontegg"===i&&!n;return o.endsWith("/")||(o+="/"),o.endsWith(i)||a||(o+=i),o}const ua=async e=>{var t,n,o;const i=ra.getContext(),a=await async function(e,t){var n;const o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:ra.getAccessToken)(),i={};o&&(i.Authorization=`Bearer ${o}`),t&&(i["Content-Type"]=t);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["x-frontegg-source"]="frontegg-react",i}(i,e.contentType),r=await async function(e,t,n){const o=ca(e,t),i=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const o=Object.keys(t);for(const e of o){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${o}${t}`;const r=Object.keys(i).length>0;return i&&r&&(a+=`?${new URLSearchParams(i)}`),a}(i,e.url,e.params),l=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:O({},a,e.headers),credentials:null!=(n=null!=(o=e.credentials)?o:i.requestCredentials)?n:"same-origin"});if(302===l.status)return window.location.href=await l.text(),new Promise((()=>{}));if(!l.ok){var s,c;if(413===l.status)throw new sa("Error request is too large",l.status);let e;try{e=await l.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=i.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=i.logLevel)?c:"")&&console.error(e),new sa(e,l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},da=async(e,t,n)=>ua(O({url:e,method:"GET",contentType:"application/json",params:t},n)),ya=async(e,t,n)=>ua(O({url:e,method:"POST",contentType:"application/json",body:t},n)),fa=async(e,t,n)=>ua(O({url:e,method:"PATCH",contentType:"application/json",body:t},n)),pa=async(e,t,n)=>ua(O({url:e,method:"PUT",contentType:"application/json",body:t},n)),ga=async(e,t,n)=>ua(O({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Sa=async(e,t,n,o)=>ua(O({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),va={v1:"/identity/resources/users/webauthn/v1/devices"},ha={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},ma={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",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"}}},ba={v1:"/identity/resources/configurations/v1"},Aa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},ka={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ta={v1:"/identity/resources/permissions/v1"},Pa={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"}}},Ia={v1:"/identity/resources/roles/v1"},La={v1:"/identity/resources/sub-tenants/users/v1"},Ea={v1:"/identity/resources/impersonation/v1"},Oa={configurations:{v1:"/identity/resources/groups/v1/config"},v1:"/identity/resources/groups/v1",roles:"/roles",users:"/users"},wa={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},Da={v1:"/team/resources/members/v1"},Ca={v1:"/team/resources/roles/v1"},Ra={v1:"/team/resources/stats/v1"},Ua={v1:"/team/resources/profile"},_a={v1:"/tenants/resources/account-settings/v1"},Ma={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},Na={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Fa={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"}}}},$a={v1:"/subscriptions/resources/payment-providers/v1"},Ga={v1:"/subscriptions/resources/subscriptions/v1"},xa={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Va={v1:"/reports/engine/resources/triggers/v1"},Wa="/notification",ja="/audits",Ka={v1:"/event/resources/configurations/v1"},Ba="/webhook",za="/oauth",qa="/flags",Ha="/directory/resources/v1/configurations/scim2",Ja="/directory/resources/scim/temp";async function Ya(e){return pa(`${ma.v1}/tenant`,e)}async function Qa(){return da(`${ma.v2}/me/tenants`)}async function Xa(){return da(Ma.v1)}async function Za(){return da(Ma.tree.v1)}async function er(){return da(ba.v1)}async function tr(){return da(`${ba.v1}/mfa-policy`)}async function nr(){return da(`${ba.v1}/mfa-policy/vendor`)}async function or(e){return e.id?fa(`${ba.v1}/mfa-policy`,e):ya(`${ba.v1}/mfa-policy`,e)}async function ir(){return da(`${ba.v1}/lockout-policy`)}async function ar(){return da(`${ba.v1}/lockout-policy/vendor`)}async function rr(e){return e.id?fa(`${ba.v1}/lockout-policy`,e):ya(`${ba.v1}/lockout-policy`,e)}async function lr(){try{return await da(`${ba.v1}/captcha-policy/public`)}catch{return null}}async function sr(){return da(`${ba.v1}/password-history-policy`)}async function cr(){return da(`${ba.v1}/password-history-policy/vendor`)}async function ur(e){return e.id?fa(`${ba.v1}/password-history-policy`,e):ya(`${ba.v1}/password-history-policy`,e)}async function dr(){return da(`${ba.v1}/password`)}async function yr(){return da(`${Aa.emailDomain.v1}`)}async function fr(){return da(`${Aa.emailDomain.v1}/config`)}async function pr(e){return ya(`${Aa.emailDomain.v1}`,e)}async function gr(e){return ya(`${Aa.emailDomain.v1}/config`,e)}async function Sr(e){return ga(`${Aa.emailDomain.v1}/${e}`)}async function vr(e){return da(`${Aa.ip.v1}`,e)}async function hr(){return da(`${Aa.ip.v1}/config`)}async function mr(e){return ya(`${Aa.ip.v1}`,e)}async function br(e){return ya(`${Aa.ip.v1}/bulk`,e)}async function Ar(e){return ya(`${Aa.ip.v1}/config`,e)}async function kr(e){return ga(`${Aa.ip.v1}/${e}`)}async function Tr(){return ya(`${Aa.ip.v1}/verify`)}async function Pr(){return ya(`${Aa.ip.v1}/verify/allow`)}let Ir,Lr,Er;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Ir||(Ir={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Lr||(Lr={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Er||(Er={}));class Or 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 Or("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,o,i=0,a=0;o=t.charAt(a++);~o&&(e=i%4?64*e+o:o,i++%4)?n+=String.fromCharCode(255&e>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return n};class Dr extends Error{constructor(e){super(e)}}const Cr=(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 Dr("Invalid token specified: "+e.message)}},Rr=["type"],Ur=["type"];async function _r(e){if(!e.accessToken)return e;ra.setAccessToken(e.accessToken);const t=await da(`${ma.v2}/me`),n=O({},e,e.accessToken?Cr(e.accessToken):{},t);return ra.setUser(n),n}async function Mr(e){if(!e.accessToken)return{user:e};ra.setAccessToken(e.accessToken);const[t,n]=await Promise.all([da(`${ma.v2}/me`),Qa()]),o=O({},e,e.accessToken?Cr(e.accessToken):{},t);return ra.setUser(o),{user:o,tenants:n}}async function Nr(e){ra.setAccessToken(e.id_token);const t=await da(`${ma.v2}/me`),n=e.id_token?Cr(e.id_token):{},o=O({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:n.exp?Math.ceil(n.exp-(new Date).getTime()/1e3):300});return ra.setUser(o),o}async function Fr(e){try{const{address:t}=await ya(`${ha.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function $r(e){return ya(`${ha.v1}/user/saml/prelogin`,e)}async function Gr(e){return _r(await ya(`${ha.v1}/user/saml/postlogin`,e))}async function xr(e){return _r(await ya(`${ha.v1}/user/oidc/postlogin`,e))}async function Vr(e){return _r(await ya(`${ha.v1}/user`,e))}async function Wr(e){return _r(await ya(`${ha.v1}/user/mfa/verify`,e))}async function jr(e){return ya(`${ma.v1}/activate`,e)}async function Kr(e){return da(`${ma.v1}/activate/strategy`,e)}async function Br(e){return ya(`${ma.v1}/activate/reset`,e)}async function zr(e){return ya(`${ma.v1}/invitation/reset`,e)}async function qr(e){return ya(`${ma.v1}/invitation/accept`,e)}async function Hr(){return _r(await ya(`${ha.v1}/user/token/refresh`))}async function Jr(){return Mr(await ya(`${ha.v1}/user/token/refresh`))}async function Yr(){return ya(`${ha.v1}/logout`)}async function Qr(e){return da(`${za}/logout`,e)}async function Xr(e){return ya(`${ma.v1}/passwords/reset`,e)}async function Zr(e){return ya(`${ma.v1}/passwords/reset/verify`,e)}async function el(e){return da(`${ma.v1}/passwords/config`,e)}async function tl(e){return ya(`${ha.v1}/user/mfa/recover`,e)}async function nl(){return ya(`${ma.v1}/mfa/enroll`)}async function ol(){return ya(`${ma.v1}/mfa/authenticator/enroll`)}async function il(e){return ya(`${ma.v1}/mfa/authenticator/enroll/verify`,e)}async function al(e){return ya(`${ma.v1}/mfa/sms/enroll`,e)}async function rl(e){return ya(`${ma.v1}/mfa/sms/enroll/verify`,e)}async function ll(){return ya(`${ma.v1}/mfa/webauthn/enroll`)}async function sl(e){return ya(`${ma.v1}/mfa/webauthn/enroll/verify`,e)}async function cl(e){return ya(`${ma.v1}/mfa/enroll/verify`,e)}async function ul(e){return ya(`${ma.v1}/mfa/disable`,e)}async function dl(e,t){return ya(`${ma.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function yl(e){return ya(`${ma.v1}/mfa/sms/${e}/disable`)}async function fl(e,t){return ya(`${ma.v1}/mfa/sms/${e}/disable/verify`,t)}async function pl(e){return ya(`${ma.v1}/mfa/webauthn/${e}/disable`)}async function gl(e,t){return ya(`${ma.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Sl(){return da(`${ma.v1}/mfa/devices`)}async function vl(e){return ya(`${ha.v1}/user/mfa/authenticator/enroll`,e)}async function hl(e){return ya(`${ha.v1}/user/mfa/authenticator/enroll/verify`,e)}async function ml(e,t){return ya(`${ha.v1}/user/mfa/authenticator/${e}/verify`,t)}async function bl(e){return ya(`${ha.v1}/user/mfa/sms/enroll`,e)}async function Al(e){return ya(`${ha.v1}/user/mfa/sms/enroll/verify`,e)}async function kl(e,t){return ya(`${ha.v1}/user/mfa/sms/${e}`,t)}async function Tl(e,t){return ya(`${ha.v1}/user/mfa/sms/${e}/verify`,t)}async function Pl(e){return ya(`${ha.v1}/user/mfa/webauthn/enroll`,e)}async function Il(e){return ya(`${ha.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Ll(e,t){return ya(`${ha.v1}/user/mfa/webauthn/${e}`,t)}async function El(e,t){return ya(`${ha.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Ol(){return da(`${wa.v1}/saml/configurations`)}async function wl(e){return ya(`${wa.v1}/saml/configurations`,e)}async function Dl(){return da(`${wa.v1}/saml/configurations/vendor-config`)}async function Cl(e){return pa(`${wa.v1}/saml/configurations/metadata`,e)}async function Rl(){return pa(`${wa.v1}/saml/validations/domain`)}async function Ul(){return da(`${wa.v1}/saml/configurations/roles/default`)}async function _l(){return da(`${wa.v2}/saml/configurations/groups`)}async function Ml({roleIds:e}){return ya(`${wa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Nl({roleIds:e,group:t}){return ya(`${wa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Fl({roleIds:e,group:t,id:n}){return fa(`${wa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function $l({id:e}){return ga(`${wa.v2}/saml/configurations/groups/${e}`)}async function Gl(){return da(`${wa.v1}/oidc/configurations`)}async function xl(){return da(`${wa.v2}/configurations/public`)}async function Vl(){return da(ka.v1)}async function Wl(){return da(ka.v2)}async function jl(){return da(ka.custom.v1)}async function Kl({provider:e,code:t,idToken:n,redirectUri:o,codeVerifier:i,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),o&&(s.redirectUri=o),i&&(s.code_verifier=i),l&&(s.state=l),ya(`${ha.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function Bl(){return da(`${ba.v1}/public`)}async function zl(e){const{shouldActivate:t,authResponse:n,userId:o,tenantId:i}=await ya(`${ma.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await _r(n):void 0,userId:o,tenantId:i}}async function ql(){return da(ma.sessions.currentUser.v1)}async function Hl(){return da(`${ma.sessions.currentUser.v1}/current`)}async function Jl(e){return ya(`${ma.sessions.v1}/revoke`,{userId:e})}async function Yl(){return da(ma.sessions.configurations.v1)}async function Ql(e){await ya(ma.sessions.configurations.v1,e)}async function Xl(e){await ga(`${ma.sessions.currentUser.v1}/${e}`)}async function Zl(){await ga(`${ma.sessions.currentUser.v1}/all`)}async function es(){return da(ma.accessTokens.v1)}async function ts(){return da(Pa.accessTokens.v1)}async function ns({id:e}){return ga(`${Pa.accessTokens.v1}/${e}`)}async function os({id:e}){return ga(`${ma.accessTokens.v1}/${e}`)}async function is(e){return ya(ma.accessTokens.v1,e)}async function as(e){return ya(Pa.accessTokens.v1,e)}async function rs(){return da(ma.apiTokens.v1)}async function ls(){return da(Pa.apiTokens.v1)}async function ss(e){return ya(ma.apiTokens.v1,e)}async function cs(e){return ya(Pa.apiTokens.v2,e)}async function us({tokenId:e}){return ga(`${Pa.apiTokens.v1}/${e}`)}async function ds({tokenId:e}){return ga(`${ma.apiTokens.v1}/${e}`)}async function ys({userId:e}){return da(`${ma.v1}/${e}`)}async function fs(e){return da(`${ba.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function ps(e){let{type:t}=e,n=Ao(e,Rr);return ya(`${ha.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function gs(e){let{type:t}=e,n=Ao(e,Ur);return ya(`${ha.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Ss({token:e}){return ya(Pa.invites.verify.v1,{token:e})}async function vs(){return da(`${wa.v1}/configurations`)}async function hs(e){return ya(`${wa.v1}/configurations`,e)}async function ms(e,t){return fa(`${wa.v1}/configurations/${e}`,t)}async function bs(e){return ga(`${wa.v1}/configurations/${e}`)}async function As(e){return ya(`${wa.v1}/configurations/metadata`,e)}async function ks(e,t){return pa(`${wa.v1}/configurations/${e}/metadata`,t)}async function Ts(e,t){return ya(`${wa.v1}/configurations/${e}/domains`,t)}async function Ps(e,t){return ga(`${wa.v1}/configurations/${e}/domains/${t}`)}async function Is(e,t){return pa(`${wa.v1}/configurations/${e}/domains/${t}/validate`)}async function Ls(e){return da(`${wa.v1}/configurations/${e}/roles`)}async function Es(e,t){return pa(`${wa.v1}/configurations/${e}/roles`,t)}async function Os(e,t){return ya(`${wa.v1}/configurations/${e}/groups`,t)}async function ws(e,{roleIds:t,group:n,id:o}){return fa(`${wa.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function Ds(e,t){return ga(`${wa.v1}/configurations/${e}/groups/${t}`)}async function Cs(e){return da(`${wa.v1}/configurations/${e}/groups`)}async function Rs(e){return ya(`${ha.v2}/user/sso/prelogin`,e)}async function Us(e){return _r(await ya(`${ha.v2}/user/oidc/postlogin`,e))}async function _s(e){return Nr(await ya(`${za}/token`,e))}async function Ms(){return Nr(await ya(`${za}/authorize/silent`))}async function Ns(e){return ya(`${ma.v1}/phone/reset`,e)}async function Fs(e){return ya(`${ma.v1}/phone/reset/verify`,e)}async function $s(e){return ya(`${ma.v1}/phone`,e)}async function Gs(e){return ya(`${ma.v1}/phone/verify`,e)}async function xs(e){return pa(`${ma.v1}/phone/change`,e)}async function Vs(e){return ya(`${ha.v1}/webauthn/prelogin`,e)}async function Ws(e){return ya(`${ha.v1}/webauthn/postlogin`,e)}async function js(){return ya(va.v1)}async function Ks(){return da(va.v1)}async function Bs(e){return ga(`${va.v1}/${e}`)}async function zs(e){return ya(`${va.v1}/verify`,e)}async function qs(){return da(`${ba.v1}/auth/strategies/public`)}async function Hs(){return da(`${ba.v1}/mfa/strategies`)}async function Js(e){return da(`${ma.v2}/me`,null!=e?e:{addRoles:!0})}async function Ys(e){return pa(`${ma.v2}/me`,e)}async function Qs(e){return pa(`${Ua.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Xs(e){return ya(`${ma.v1}/passwords/change`,e)}async function Zs(e){var t,n,o,i,a,r;const l=(e.filter||[]).reduce(((e,t)=>O({},e,{[t.id]:t.value})),{}),s=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(o=e.sort)||null==(i=o[0])?void 0:i.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return da(Da.v1,O({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function ec(e){return ya(ma.v2,O({},e,{provider:"local"}))}async function tc(e){return ga(`${Da.v1}/${e.userId}`)}async function nc(e){return pa(Da.v1,e)}async function oc(e){return ya(Pa.invites.user.v1,O({},e))}async function ic(e){return fa(Pa.invites.user.v1,O({},e))}async function ac(){return ga(Pa.invites.user.v1)}async function rc(){return da(Pa.invites.user.v1)}async function lc(){return da(Pa.invites.configuration.v1)}async function sc(){return da(Ca.v1)}async function cc(){return da(Ta.v1)}async function uc(){return da(`${Ra.v1}/members`)}async function dc(e){return ya(`${Da.v1}/${e.userId}/resendActivationEmail`,{})}async function yc(e){return ya(ma.v2,O({},e,{provider:"local"}))}async function fc(e){return ya(ma.invitation.resendAll.v1,O({},e))}async function pc(e){var t,n;const o=await da("/metadata",e);if(null!=o&&null!=(t=o.rows)&&t[0])return null==o||null==(n=o.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function gc(){const e=await da("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Sc=async()=>pc({entityName:"notifications"}),vc=async()=>pc({entityName:"saml"}),hc=async()=>pc({entityName:"audits"}),mc=async e=>async function(e){const t=await da(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),bc=["dataFilters"],Ac=["templateId","dataFilters"],kc=["dataFilters"];async function Tc(e){return da(`${xa.v2}/tenant-reports`,e)}async function Pc(e){return da(`${xa.v2}/${e.id}/tenant-reports`)}async function Ic(e){let{dataFilters:t}=e,n=Ao(e,bc);return{html:await da(`${Va.v1}/preview-report`,O({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Lc(e){let{templateId:t,dataFilters:n}=e,o=Ao(e,Ac);return ya(`${xa.v2}/${t}/tenant-reports`,O({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Ec(e){let{dataFilters:t}=e,n=Ao(e,kc);const o=await da(`${Va.v1}/preview-report`,O({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let i="text/html",a="html";"pdf"===n.responseType?(i="application/pdf",a="pdf"):"image"===n.responseType&&(i="image/jpeg",a="jpg");const r=new Blob([o],{type:i}),l=URL.createObjectURL(r),s=document.createElement("a");s.href=l,s.setAttribute("download",`report_${n.name||""}.${a}`),s.click(),setTimeout(s.remove.bind(s))}async function Oc(e){return ya(`${Va.v1}/tenant-reports`,e)}async function wc(e){return da(Wa,{params:e})}async function Dc(e){return pa(`${Wa}/status`,{params:e})}async function Cc(e){const{notificationId:t,pinStatus:n}=e;return pa(`${Wa}/${n}`,{notificationId:t})}async function Rc(){return ya(`${Wa}/status/mark-all-read`)}const Uc=["endpoint","headerProps"];async function _c(e){return da(ja,e)}async function Mc(e){return da(`${ja}/stats`,e)}async function Nc(e){const{endpoint:t,headerProps:n}=e,o=Ao(e,Uc);return Sa(`${ja}/export/${t}`,{properties:n},o)}const Fc=["eventKey"],$c=["eventKey"],Gc=()=>da(`${Na.v1}/slack`),xc=()=>da(`${Na.v1}/slack/applications`),Vc=()=>da(`${Na.v1}/slack/channels`),Wc=e=>e.id?fa(`${Na.v1}/slack/subscription/${e.id}`,e):ya(`${Na.v1}/slack/subscriptions`,e),jc=e=>ga(`${Na.v1}/slack/subscriptions/${e.id}`),Kc=e=>ya(`${Na.v1}/slack/applications/registrations`,{code:e}),Bc=()=>da(`${Na.v1}/emails`),zc=e=>{let{eventKey:t}=e,n=Ao(e,Fc);return ya(`${Na.v1}/emails/${t}`,n)},qc=({eventKey:e,enabled:t})=>fa(`${Na.v1}/emails/${e}`,{enabled:t}),Hc=(e,t)=>ga(`${Na.v1}/emails/${e}/subscriptions/${t}`),Jc=(e,t,n)=>pa(`${Na.v1}/emails/${t}/subscriptions/${e}`,n),Yc=e=>ga(`${Na.v1}/emails/${e}`),Qc=()=>da(`${Na.v2}/sms`),Xc=e=>{let{eventKey:t}=e,n=Ao(e,$c);return ya(`${Na.v2}/sms/${t}`,n)},Zc=({eventKey:e,enabled:t})=>fa(`${Na.v2}/sms/${e}`,{enabled:t}),eu=(e,t)=>ga(`${Na.v2}/sms/${e}/subscriptions/${t}`),tu=(e,t,n)=>pa(`${Na.v2}/sms/${t}/subscriptions/${e}`,n),nu=e=>ga(`${Na.v2}/sms/${e}`),ou=()=>da(Ba),iu=e=>e._id?fa(`${Ba}/${e._id}`,e):ya(`${Ba}/custom`,e),au=e=>ga(`${Ba}/${e}`),ru=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return da(`${Ba}/logs/?${o.toString()}`)},lu=e=>ya(`${Ba}/test`,e),su=e=>ya(`${Ba}/logs/${e}/retries`),cu=()=>da(`${Ka.v1}/categories`),uu=e=>da(Ka.v1,{channels:e});async function du(e){return pa(_a.v1,e)}async function yu(){return da(_a.v1)}const fu=["roleId"],pu=["roleId"],gu=["permissionId"];async function Su(){return da(Ia.v1)}async function vu(e){return ya(Ia.v1,e)}async function hu({roleId:e}){return ga(`${Ia.v1}/${e}`)}async function mu(e){let{roleId:t}=e,n=Ao(e,fu);return fa(`${Ia.v1}/${t}`,n)}async function bu(e){let{roleId:t}=e,n=Ao(e,pu);return pa(`${Ia.v1}/${t}/permissions`,n)}async function Au(){return da(Ta.v1)}async function ku(e){let{permissionId:t}=e,n=Ao(e,gu);return pa(`${Ta.v1}/${t}/roles`,n)}async function Tu(){return da(`${Ta.v1}/categories`)}async function Pu(){return da(Fa.subscriptions.v1)}async function Iu(e){return da(`${Fa.subscriptions.v1}/${e}`)}async function Lu(e){return pa(`${Fa.subscriptions.v1}/${e}/cancellations/`,{})}async function Eu(e){return pa(`${Fa.subscriptions.v1}/${e}/renewals/`,{})}async function Ou(e,{paymentMethodId:t,planId:n}){return pa(`${Fa.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function wu(e){return da(`${Ga.v1}/${e}`)}async function Du(){return da(`${Ga.v1}`)}async function Cu(e){return pa(`${Ga.v1}/${e}/cancellations/`,{})}async function Ru(e){return pa(`${Ga.v1}/${e}/renewals/`,{})}async function Uu(e,{paymentMethodId:t,planId:n}){return pa(`${Ga.v1}/${e}`,{paymentMethodId:t,planId:n})}async function _u(){return da(Fa.plans.v1)}async function Mu(e){return da(`${Fa.plans.v1}/${e}`)}async function Nu(){return da(Fa.invoices.v1)}async function Fu(e){return da(`${Fa.invoices.v1}/${e}`)}async function $u(e,t){return da(`${Fa.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Gu=["email"];async function xu(){return da(Fa.paymentMethods.v1)}async function Vu(e){return da(`${Fa.paymentMethods.v1}/${e}`)}async function Wu(e,t){let{email:n}=t,o=Ao(t,Gu);return fa(`${Fa.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function ju(e){return ya(Fa.paymentProviders.stripe.subscriptions.v1,e)}async function Ku(e){return da(`${Fa.paymentProviders.stripe.customers.v1}/${e}`)}async function Bu(e){return ya(`${Fa.paymentProviders.stripe.customers.v1}`,e)}async function zu(){return da(`${Fa.paymentProviders.stripe.publicConfigurations.v1}`)}async function qu(e){return ya(`${Fa.paymentProviders.stripe.setupIntents.v1}`,e)}async function Hu(e){return da(`${Fa.summaries.v1}/${e}`)}async function Ju(e){return da(`${Fa.tenantConfiguration.v1}/${e}`)}async function Yu(e){return ya(`${Fa.tenantConfiguration.v1}`,e)}async function Qu(){return da($a.v1)}async function Xu(){return da(`${Fa.configurations.vendorPublicConfigurations.v1}`)}let Zu,ed,td,nd,od,id;async function ad(){return da("/vendors/public")}async function rd(e){return da(La.v1,e)}async function ld(e){return ya(La.v1,e)}async function sd(e){return ga(La.v1,e)}async function cd(e,t){return ya(`${La.v1}/${e}/roles`,t)}async function ud(e,t){return ga(`${La.v1}/${e}/roles`,t)}async function dd(e,t){return fa(`${La.v1}/${e}/roles`,t)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Zu||(Zu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(ed||(ed={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(td||(td={})),(nd||(nd={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(od||(od={})),function(e){e.CREATE="create_customer"}(id||(id={}));const yd={flags:{}};class fd{constructor(){this._flags=yd.flags}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new fd;return n.set(e),fd._instances[t]=n,n}static getFeatureFlags(e){const t=this.getInstance();return e.map((e=>"on"===(null==t?void 0:t._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t,n;this._flags=O({},null!=(t=null==yd?void 0:yd.flags)?t:{},null!=(n=null==e?void 0:e.flags)?n:{})}}async function pd(){return da(qa)}async function gd(){return da(`${Ha}`)}async function Sd(e,t){return fa(`${Ha}/${e}`,t)}async function vd(e){return ya(`${Ha}`,e)}async function hd(e){return ga(`${Ha}/${e}`)}async function md(e){return da(`${Ja}/${e}/Users/count`)}async function bd(e){return ya(`${Ea.v1}`,e)}fd._instances={};const Ad=["groupId"];async function kd({groupId:e},t){return da(`${Oa.v1}/${e}`,O({},t))}async function Td(e){return da(`${Oa.v1}`,O({},e))}async function Pd(e){return ya(`${Oa.v1}`,e)}async function Id(e){let{groupId:t}=e,n=Ao(e,Ad);return fa(`${Oa.v1}/${t}`,n)}async function Ld(e){return ga(`${Oa.v1}/${e}`)}async function Ed(e,t){return ya(`${Oa.v1}/${e}${Oa.roles}`,t)}async function Od(e,t){return ga(`${Oa.v1}/${e}${Oa.roles}`,t)}async function wd(e,t){return ya(`${Oa.v1}/${e}${Oa.users}`,t)}async function Dd(e,t){return ga(`${Oa.v1}/${e}${Oa.users}`,t)}async function Cd(){return da(`${Oa.configurations.v1}`)}async function Rd(e){return ya(`${Oa.configurations.v1}`,e)}let Ud,_d,Md,Nd,Fd;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(Ud||(Ud={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(_d||(_d={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Md||(Md={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Nd||(Nd={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Fd||(Fd={}));const $d=[`${ha.v1}/logout`,`${za}/logout`],Gd=[...$d,`${ha.v1}/user/saml/postlogin`,`${ha.v2}/user/oidc/postlogin`,`${ha.v1}/user`,`${ha.v1}/user/mfa/verify`,`${ha.v1}/user/token/refresh`,`${ma.v1}`,`${ma.v1}/signUp`,`${ha.v1}/passwordless/magiclink/postlogin`,`${ha.v1}/passwordless/code/postlogin`,`${ha.v1}/passwordless/smscode/postlogin`,`${ma.v1}/activate`,`${ma.v1}/invitation/accept`,`${za}/token`,`${za}/authorize/silent`],xd=`${ha.v1}/user/token/refresh`,Vd=`${za}/authorize/silent`,Wd=`${ma.v2}/me`,jd=`${ma.v2}/me/tenants`;let Kd;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Kd||(Kd={}));const Bd={auth:i,teams:a,metadata:r,reports:l,connectivity:u,notifications:s,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:p,subTenants:g,featureFlags:S,directory:v,impersonate:h,groups:m};var zd={fetch:e,ContextHolder:ra,FronteggContext:la,api:Bd,FronteggApiError:sa,AuthStrategyEnum:Lr,MachineToMachineAuthStrategy:Er,SocialLoginProviders:Ir,ISubscriptionCancellationPolicy:td,ISubscriptionStatus:Zu,PaymentMethodType:ed,ProviderType:nd};let qd,Hd;function Jd(e,t){const n=O({},e);return t.forEach((e=>{delete n[e]})),n}async function Yd(e){const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Qd(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let o=0;o<e;o++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(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"}(qd||(qd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Hd||(Hd={}));const Xd=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n})),Zd=e=>fd.getFeatureFlags(e),ey={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},ty=O({},ey,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),ny=[{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"}],oy={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},iy=O({},oy,{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}),ay={loading:!1,error:void 0,saving:!0,profile:oy},ry={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"},ly={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Lr.EmailAndPassword,machineToMachineAuthStrategy:Er.ClientCredentials},sy={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},cy={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},uy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},dy={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},yy={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},fy=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],py={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:dy,roles:fy,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},gy=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Sy={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:[ny[0]]},vy={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:[ny[1]]},hy={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},my=[vy,Sy],by=[hy],Ay=[{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}],ky=[{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"}],Ty={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Py={isActive:!0,strategy:$n.ALLOW},Iy=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:$n.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:$n.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:$n.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:$n.BLOCK,description:"IP 4"}],Ly=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(O({},vy,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Ey=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"}),Oy=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Ly(6),roles:[Ey("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}'},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Ly(44),roles:[Ey("Editor")]},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Ly(8),roles:[Ey("Viewer")]},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Ly(5),roles:[Ey("Admin"),Ey("Owner")]},{id:"id5",name:"Sales",color:"#ED8E7C",users:Ly(21),description:"BDR, AE, and inside sales",roles:[Ey("Viewer")]},{id:"id6",name:"Support",color:"#A79D7B",users:Ly(23),description:"Dev success and customer success",roles:[Ey("Admin")]},{id:"id7",name:"Marketing",color:"#2CA744",users:Ly(10),description:"The marketing department",roles:[Ey("Viewer")]},{id:"id8",name:"HR",color:"#EAE1C2",users:Ly(4),description:"Human resources",roles:[Ey("Viewer")]},{id:"id9",name:"Finance",color:"#5587C0",users:Ly(3),roles:[Ey("Viewer")]},{id:"id10",name:"Operations",color:"#B1CAE7",users:Ly(8),roles:[Ey("Editor")]},{id:"id11",name:"Legal",color:"#2CA744",users:Ly(4),roles:[Ey("Viewer")]}];let wy,Dy,Cy;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(wy||(wy={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Dy||(Dy={})),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"}(Cy||(Cy={})),Cy.profile,Cy.privacy,Cy.personalApiTokens,Cy.account,Cy.users,Cy.groups,Cy.security,Cy.sso,Cy.audits,Cy.webhooks,Cy.apiTokens,Cy.roles,Cy.subscriptions;const Ry=["events","url"];function*Uy(){yield ai(lo.setSignUpState({loading:!0}));try{const e=yield si(Bd.auth.getVendorConfig),[t]=(yield si(Bd.auth.getVendorPublicAuthStrategiesConfig),Zd(["admin_portal_login_per_tenant"]));if(t){const t=yield si(Bd.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:o}=e;yield ai(lo.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:o,firstLoad:!1})),yield ai(lo.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*_y(e){let{payload:{events:t,url:n}}=e,o=Ao(e.payload,Ry);yield ai(lo.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield di((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield si(Bd.auth.signUpUser,o);if(!o.invitationToken){var i;const{email:e,name:a,companyName:r}=o;null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:Dy.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(ra.setAccessToken(null==l?void 0:l.accessToken),ra.setUser(l),!r&&l&&qf(l)){const t=yield Yf(l);yield ai(lo.setState(t)),a(e.loginUrl)}else yield ai(lo.setSignUpState({loading:!1,shouldActivate:r,stage:fn.SignUpSuccess})),yield ai(lo.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield ai(lo.loadTenants()))}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setSignUpState({loading:!1,error:e.message}))}yield ai(lo.setSignUpState({loading:!1}))}function*My(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield di((e=>e.auth.signUpState));yield ai(lo.resetSignUpState()),yield ai(lo.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Ny(){yield aa(lo.signUpUser,_y),yield aa(lo.resetSignUpStateSoft,My)}const Fy={setVendorState:(e,{payload:t})=>O({},e,t)},$y={loadVendorPublicInfo:rt("vendor/loadVendorPublicInfo")},Gy={loading:!1},{reducer:xy,actions:Vy}=st({name:Dt,initialState:Gy,reducers:O({},Fy)}),Wy=O({},Vy,$y);function*jy(){yield ai(Wy.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Bd.vendor.getVendorPublicInfo();yield ai(Wy.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield ai(Wy.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Ky=["callback"],By=["callback"],zy=["callback"],qy=["callback"],Hy=["callback"],Jy=["callback"];function*Yy(){yield ai(lo.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getGlobalSecurityPolicy);yield ai(lo.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield ai(lo.loadSecurityPolicyMfa()),yield ai(lo.loadSecurityPolicyVendorMfa()),yield ai(lo.loadSecurityPolicyLockout()),yield ai(lo.loadSecurityPolicyVendorLockout()),yield ai(lo.loadSecurityPolicyVendorPasswordHistory()),yield ai(lo.loadSecurityPolicyCaptcha()),yield ai(lo.loadPublicAuthStrategiesPolicy())}function*Qy(){yield ai(lo.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getVendorConfig),[t]=Zd(["admin_portal_login_per_tenant"]);if(t){const t=yield si(Bd.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield ai(lo.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Xy(){yield ai(lo.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getVendorPublicAuthStrategiesConfig);yield ai(lo.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*Zy(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getMfaPolicy);yield ai(lo.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*ef(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getVendorMfaPolicy);yield ai(lo.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*tf(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Ky);yield ai(lo.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield si(Bd.auth.saveMfaPolicy,n);yield ai(lo.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*nf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getLockoutPolicy);yield ai(lo.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*of(e){let{payload:{callback:t}}=e,n=Ao(e.payload,By);yield ai(lo.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield si(Bd.auth.saveLockoutPolicy,n);yield ai(lo.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*af(){yield ai(lo.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getVendorLockoutPolicy);yield ai(lo.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*rf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getCaptchaPolicy);yield ai(lo.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*lf(){yield ai(lo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getPasswordHistoryPolicy);yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*sf(){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getVendorPasswordHistoryPolicy);yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*cf(e){let{payload:{callback:t}}=e,n=Ao(e.payload,zy);yield ai(lo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield si(Bd.auth.savePasswordHistoryPolicy,n);yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*uf(){yield ai(lo.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getPasswordConfigPolicy);yield ai(lo.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*df(){yield aa(lo.loadSecurityPolicy,Yy),yield oa(lo.saveSecurityPolicyMfa,tf),yield oa(lo.loadSecurityPolicyMfa,Zy),yield oa(lo.loadSecurityPolicyVendorMfa,ef),yield oa(lo.saveSecurityPolicyLockout,of),yield oa(lo.loadSecurityPolicyLockout,nf),yield oa(lo.loadSecurityPolicyVendorLockout,af),yield oa(lo.loadSecurityPolicyCaptcha,rf),yield oa(lo.saveSecurityPolicyPasswordHistory,cf),yield oa(lo.loadSecurityPolicyPasswordHistory,lf),yield oa(lo.loadSecurityPolicyVendorPasswordHistory,sf),yield oa(lo.loadVendorPasswordConfig,uf),yield oa(lo.loadPublicSecurityPolicy,Qy),yield oa(lo.loadPublicAuthStrategiesPolicy,Xy)}function*yf(){yield ai(lo.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield ai(lo.setSecurityPolicyPublicState({policy:ly,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*ff(){yield ai(lo.setSecurityPolicyGlobalState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyGlobalState({policy:ry,loading:!1})),yield ai(lo.loadSecurityPolicyMfa()),yield ai(lo.loadSecurityPolicyVendorMfa()),yield ai(lo.loadSecurityPolicyLockout()),yield ai(lo.loadSecurityPolicyVendorLockout()),yield ai(lo.loadSecurityPolicyPasswordHistory()),yield ai(lo.loadSecurityPolicyVendorPasswordHistory()),yield ai(lo.loadSecurityPolicyCaptcha())}function*pf(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyMfaState({policy:sy,loading:!1}))}function*gf(){yield ai(lo.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorMfaState({policy:sy,loading:!1}))}function*Sf(e){var t;let{payload:{callback:n}}=e,o=Ao(e.payload,qy);yield ai(lo.setSecurityPolicyMfaState({saving:!0,error:null}));const i=O({},cy,{id:null!=(t=o.id)?t:cy.id,enforceMFAType:o.enforceMFAType});yield vt(),yield ai(lo.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*vf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyLockoutState({policy:cy,loading:!1}))}function*hf(){yield ai(lo.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorLockoutState({policy:cy,loading:!1}))}function*mf(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Hy);yield ai(lo.setSecurityPolicyLockoutState({saving:!0,error:null})),yield vt();const o=O({},cy,n,{id:n.id?n.id:cy.id});null==t||t(o),yield ai(lo.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*bf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyLockoutState({policy:cy,loading:!1}))}function*Af(){yield ai(lo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:uy,loading:!1}))}function*kf(){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({policy:uy,loading:!1}))}function*Tf(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Jy);yield ai(lo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield vt();const o=O({},uy,n,{id:n.id?n.id:uy.id});null==t||t(o),yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*Pf(){yield aa(lo.loadSecurityPolicy,ff),yield oa(lo.loadPublicSecurityPolicy,yf),yield oa(lo.saveSecurityPolicyMfa,Sf),yield oa(lo.loadSecurityPolicyMfa,pf),yield oa(lo.loadSecurityPolicyVendorMfa,gf),yield oa(lo.saveSecurityPolicyLockout,mf),yield oa(lo.loadSecurityPolicyLockout,vf),yield oa(lo.loadSecurityPolicyVendorLockout,hf),yield oa(lo.loadSecurityPolicyCaptcha,bf),yield oa(lo.saveSecurityPolicyPasswordHistory,Tf),yield oa(lo.loadSecurityPolicyPasswordHistory,Af),yield oa(lo.loadSecurityPolicyVendorPasswordHistory,kf)}const If=["callback"],Lf=["callback"],Ef=["callback"],Of=["callback"],wf=["callback","events"],Df=["callback"],Cf=["callback"],Rf=["callback"],Uf=["callback"],_f=["callback"],Mf=["callback"],Nf=["callback"],Ff=["callback"],$f=["callback"],Gf=["callback","deviceId"],xf=["callback","deviceId"],Vf=["callback","deviceId"],Wf=["callback","deviceId"],jf={[Lr.Code]:kt.loginWithOtc,[Lr.EmailAndPassword]:kt.loginWithPassword,[Lr.MagicLink]:kt.magicLinkPreLoginSuccess,[Lr.SmsCode]:kt.loginWithSmsOtc};function*Kf(){const e=ra.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:o=!1,allowedRedirectOrigins:i=[]}=yield di((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:l,activateUrl:s}=t;let{authenticatedUrl:c}=t;const u=window.localStorage.getItem(It);u&&![a,r,l,s].includes(u)&&(c=u),window.localStorage.removeItem(It),yield vt(200),ai(lo.resetLoginState());const d=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:o})=>{let i=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),o=new URL(e),i=o.origin===n.origin;return t.includes(o.origin)||i})(a,n)?i=a:console.warn("The redirect url param is not valid, the origin is a different site"):i=a:o&&(i+=window.location.search),i})({authenticatedUrl:c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(d,{refresh:d.startsWith("http")})}function*Bf(){let e;try{var t;const n=yield si(Bd.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield ai(lo.setState({ssoACS:e}))}function*zf(){try{const{isActive:e}=yield si(Bd.auth.getSSOPublicConfiguration);yield ai(lo.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const qf=e=>e.mfaRequired&&e.mfaToken?(ra.setAccessToken(null),ra.setUser(null),!0):(ra.setAccessToken(e.accessToken),ra.setUser(e),!1),Hf=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:o}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),o=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:o,totalDevices:t+n+o}})(e);if(1===o){if(n)return nn.authenticatorApp;if(t)return nn.smsVerifyCode}return nn.verify},Jf=e=>{if(1===e.length){const[t]=e;if(t===Md.AuthenticatorApp)return nn.authenticatorApp;if(t===Md.SMS)return nn.smsSetPhoneNumber}return nn.verify};function*Yf(e){let t=kt.loginWithTwoFactor,n={};const{loginState:o}=yield di((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield si(Bd.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Hf(e.mfaDevices)}:(n={step:Jf(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=kt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:Tt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:O({},o,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:i,mfaDeviceExpiration:a})}}function*Qf(e){var t;const{routes:n,loginState:o}=yield di((e=>e.auth)),i=null!=(t=localStorage.getItem("register-quick-login"))?t:o.quickLoginToRegister;return i&&"true"!==localStorage.getItem(`${e.id}-${i}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*Xf(){const{hostedLoginBox:e}=yield di((e=>e.auth));e?yield si(Zf):yield si(tp)}function*Zf(){const{user:e}=yield di((e=>e.auth));if(null==e||!e.refreshToken)return ra.setAccessToken(null),ra.setUser(null),void(yield ai(lo.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield si(Bd.auth.exchangeOAuthTokens,t);yield ai(lo.setState({user:n,isAuthenticated:!0})),yield ai(lo.loadTenants())}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:null,isAuthenticated:!1}))}}function*ep(){const{user:e}=yield di((e=>e.auth));if(null==e||!e.refreshToken)return ra.setAccessToken(null),ra.setUser(null),void(yield ai(lo.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield si(Bd.auth.exchangeOAuthTokens,t);yield ai(lo.setState({user:n,isAuthenticated:!0})),yield ai(lo.loadTenants())}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:null,isAuthenticated:!1}))}}function*tp(){try{const t=ra.onRedirectTo,{routes:n,loginState:o}=yield di((e=>e.auth)),{user:i,tenants:a}=yield si(Bd.auth.refreshTokenV2);if(qf(i)){const e=yield Yf(i);yield ai(lo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield Qf(i);yield ai(lo.setTenantsState({tenants:a,loading:!1})),yield ai(lo.setState({user:i,isAuthenticated:!0,loginState:O({},o,{quickLoginToRegister:t,flow:n?Tt.RegisterQuickLogin:Tt.Login})})),yield op(n)}}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:void 0,isAuthenticated:!1}))}}function*np(){try{const t=ra.onRedirectTo,{routes:n,loginState:o}=yield di((e=>e.auth)),{user:i,tenants:a}=yield si(Bd.auth.refreshTokenV2);if(qf(i)){const e=yield Yf(i);yield ai(lo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield si(pp))yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})),yield ai(lo.setTenantsState({tenants:a,loading:!1})),yield ai(lo.setState({user:i})),t(n.loginUrl,{preserveQueryParams:!0});else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield Qf(i);yield ai(lo.setTenantsState({tenants:a,loading:!1})),yield ai(lo.setState({user:i,isAuthenticated:!0,loginState:O({},o,{quickLoginToRegister:t,flow:n?Tt.RegisterQuickLogin:Tt.Login})})),yield op(n)}}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:void 0,isAuthenticated:!1}))}}function*op(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=ra.onRedirectTo,{routes:i,loginState:a}=yield di((e=>e.auth)),r=n.searchParams.get("invitationToken"),l=[i.socialLoginCallbackUrl,i.oidcRedirectUrl,i.samlCallbackUrl];r||l.push(i.loginUrl,i.signUpUrl),e?o(i.loginUrl):l.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&i.signUpSuccessUrl&&i.socialLoginCallbackUrl===window.location.pathname?o(i.signUpSuccessUrl,{refresh:i.signUpSuccessUrl.startsWith("http")}):yield Kf())}function*ip({payload:{callback:e}}){try{const{ip:t}=yield si(Bd.metadata.getCurrentUserIpMetadata);yield ai(lo.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*ap({payload:e}){const t=[];e&&(yield ai(lo.setState({isLoading:!0})),yield ai(lo.loadSocialLoginsConfigurationV2()),t.push(si(Uy)),t.push(si(Xy)),t.push(si(zf)),t.push(si(jy)),t.push(si(Bf))),t.push(si(Xf)),yield ri(t),yield ai(lo.setState({isLoading:!1}))}function*rp({accessToken:e,user:t}){if(!e)return void(yield ai(lo.setState({user:void 0,isAuthenticated:!1})));const n=ra.onRedirectTo,{routes:o}=yield di((e=>e.auth));if(qf(t)){const e=yield Yf(t);yield ai(lo.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*lp({payload:e}){const t=[];yield ai(lo.loadSocialLoginsConfigurationV2()),t.push(si(Uy)),t.push(si(zf)),t.push(si(jy)),t.push(si(Bf)),t.push(si(rp,e)),yield ri(t)}function*sp({payload:e}){const{disableSilentRefresh:t}=yield di((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield si(Bd.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield ai(lo.setState({user:e,isAuthenticated:!0})),yield ai(lo.loadTenants()),yield ai(lo.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:o,urlStrategy:i}=yield di((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}})(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield ai(lo.setState({isLoading:!0}));const a=Qd(),r=Qd(),l=yield si(Yd,r);localStorage.setItem(Lt,r);const s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${ca(n,"/oauth/authorize")}/oauth/authorize`,u=O({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:s,code_challenge:l,code_challenge_method:"S256",nonce:a},e);if(n.tenantResolver){var d;const e=yield null==(d=n.tenantResolver)?void 0:d.call(n);null!=e&&e.tenant&&(u.organization=e.tenant)}o(`${c}?${new URLSearchParams(u).toString()}`,{refresh:!0})}(e)}}function*cp({payload:e}){const t=localStorage.getItem(Lt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:o}=yield di((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy}))),i=`${window.location.origin}${"path"===o?"":"#"}${n.hostedLoginRedirectUrl}`,a={code:e.code,redirect_uri:i,code_verifier:t,grant_type:"authorization_code"};try{const e=yield si(Bd.auth.exchangeOAuthTokens,a);yield ai(lo.setState({user:e,isAuthenticated:!0})),yield ai(lo.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Kf()}}function*up(e){let{payload:{callback:t}}=e,n=Ao(e.payload,If);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(Bd.auth.changePhoneNumberWithVerification,n);yield ai(lo.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:kt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1}))}}function*dp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Lf);try{yield ai(lo.setLoginState({loading:!0})),yield si(Bd.auth.verifyChangePhoneNumber,n),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1}))}}function*yp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Ef);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(Bd.auth.passwordlessPreLogin,O({},n,{type:Lr.SmsCode}));yield ai(lo.setLoginState({step:kt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*fp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Of);try{const{onRedirectTo:e,routes:o}=yield di((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ai(lo.setLoginState({loading:!0}));const i=yield si(Bd.auth.passwordlessPreLogin,n),a=jf[n.type];if(a===kt.loginWithSmsOtc&&i.resetPhoneNumberToken)return yield ai(lo.setResetPhoneNumberState({resetPhoneNumberToken:i.resetPhoneNumberToken,step:zt.VerifyResetPhoneNumber})),void e(o.resetPhoneNumberUrl);yield ai(lo.setLoginState({step:a,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*pp(){const{publicAuthStrategyPolicy:e}=yield di((e=>e.auth.securityPolicyState)),{policy:t}=e,n=(e=>!(null==e||!e.secondaryAuthStrategies.some((({isActive:e,strategy:t})=>e&&t===Ud.Passkeys))))(t),o="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=Zd(["show-passkeys"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield si(Bd.auth.getWebAuthnDevices);return yield ai(lo.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*gp(e){let{payload:{callback:t,events:n}}=e,o=Ao(e.payload,wf);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(Bd.auth.passwordlessPostLogin,o),a=ra.onRedirectTo,{routes:r}=yield di((e=>e.auth));if(qf(e)){const t=yield Yf(e);yield ai(lo.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield di((e=>e.auth)),l=yield si(Bd.auth.generateLoginResponse,e);var i;e.emailVerified&&(null==n||null==(i=n.userVerified)||i.call(n,{email:l.email,origin:wy.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield ai(lo.setState({user:l})),yield ai(lo.setLoginState({error:void 0})),yield ai(lo.loadTenants()),yield ai(lo.setState({isLoading:!1})),o.flow===Tt.Login?(yield si(pp))?(yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield ai(lo.setState({isAuthenticated:!0})),yield Kf()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield ai(lo.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield ai(lo.setLoginState({loading:!1}))}}function*Sp({payload:e}){try{yield ai(lo.setLoginState({loading:!0}));const{name:t}=yield si(Bd.auth.verifyInviteToken,e);yield ai(lo.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield ai(lo.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield ai(lo.setLoginState({loading:!1}))}}function*vp({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:o}}){yield ai(lo.setLoginState({loading:!0}));try{const i=yield di((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield si(Bd.auth.preLoginV2,{email:e});if(a){let e=a;if(r===Hd.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield di((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield ai(lo.setLoginState({step:kt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{i(e,{refresh:!0})}),2e3)}else yield hp({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield hp({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*hp(e){let{callback:t}=e,n=Ao(e,Df);const o=yield di((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==o||!o.authStrategy)return yield ai(lo.setLoginState({step:kt.loginWithPassword,loading:!1})),void(null==t||t());(null==o?void 0:o.authStrategy)===Lr.EmailAndPassword?(yield ai(lo.setLoginState({step:kt.loginWithPassword,loading:!1})),null==t||t()):[Lr.MagicLink,Lr.Code,Lr.SmsCode].includes(null==o?void 0:o.authStrategy)?yield ai(lo.passwordlessPreLogin(O({},n,{type:null==o?void 0:o.authStrategy,callback:t}))):(yield ai(lo.setLoginState({step:kt.loginWithPassword,loading:!1})),null==t||t())}function*mp({payload:{callback:e}}){try{yield ai(lo.setLoginState({loading:!0}));const{options:t}=yield si(Bd.auth.webAuthnCreateNewDeviceSession);t.user.id=bt(t.user.id),t.challenge=bt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield ai(lo.setLoginState({error:t.message})),null==e||e(null)}finally{yield ai(lo.setLoginState({loading:!1}))}}function*bp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Cf);try{yield ai(lo.setLoginState({loading:!0}));const e=At(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?_d.Platform:_d.CrossPlatform;yield si(Bd.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({error:e.message})),null==t||t(null)}finally{yield ai(lo.setLoginState({loading:!1}))}}function*Ap(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Rf);try{var o;yield ai(lo.setPasskeysState({loading:!0})),yield ai(lo.setLoginState({loading:!0}));const{options:e}=yield si(Bd.auth.webAuthnPreLogin,n);e.challenge=bt(e.challenge),e.allowCredentials=null==(o=e.allowCredentials)?void 0:o.map((e=>O({},e,{id:bt(e.id)}))),yield ai(lo.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield ai(lo.setLoginState({error:e.message})),null==t||t(null)}finally{yield ai(lo.setPasskeysState({loading:!1})),yield ai(lo.setLoginState({loading:!1}))}}function*kp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Uf);try{var o;yield ai(lo.setPasskeysState({loading:!0})),yield ai(lo.setLoginState({loading:!0}));const e=At(n.publicKey),i=yield si(Bd.auth.webAuthnPostLogin,O({},e,{response:O({},e.response,{userHandle:null!=(o=e.response.userHandle)?o:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(qf(i)){const e=ra.onRedirectTo,{routes:t}=yield di((e=>e.auth)),n=yield Yf(i);yield ai(lo.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield si(Bd.auth.generateLoginResponse,i);e.id&&localStorage.setItem("userId",e.id),yield ai(lo.loadTenants()),yield ai(lo.setState({user:e,isAuthenticated:!0})),yield ai(lo.setLoginState({error:void 0})),yield Kf(),null==t||t(!0)}}catch(e){yield ai(lo.setLoginState({error:e.message})),null==t||t(null)}finally{yield ai(lo.setPasskeysState({loading:!1})),yield ai(lo.setLoginState({loading:!1}))}}function*Tp({payload:e}){const{onRedirectTo:t,routes:n}=yield di((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ai(lo.setLoginState({loading:!0}));try{const t=yield si(Bd.auth.postLogin,e);ra.setAccessToken(t.accessToken),ra.setUser(t),yield ai(lo.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Kf()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield ai(lo.setLoginState({step:kt.loginWithSSOFailed,loading:!1}))}}function*Pp({payload:{email:e,password:t,recaptchaToken:n,invitationToken:o,callback:i}}){yield ai(lo.setLoginState({loading:!0}));try{const a=yield si(Bd.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:o});ra.setAccessToken(a.accessToken),ra.setUser(a);const r=ra.onRedirectTo,{routes:l}=yield di((e=>e.auth));if(qf(a)){const e=yield Yf(a);yield ai(lo.setState(e)),r(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield di((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield ai(lo.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===Tt.Login?kt.success:t.step,tenants:[],tenantsLoading:!0}})),yield ai(lo.loadTenants()),n&&t.flow===Tt.Login&&((yield si(pp))?(yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})),r(l.loginUrl,{preserveQueryParams:!0})):yield Kf())}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){ra.setAccessToken(null),ra.setUser(null),null==i||i(!1,t),yield ai(lo.setLoginState({email:e,error:t.message,loading:!1}))}}function*Ip({payload:{mfaToken:e,value:t,rememberDevice:n,callback:o}}){yield ai(lo.setLoginState({loading:!0}));try{const i=yield si(Bd.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield di((e=>e.auth)),r=a.flow===Tt.Login?kt.success:a.step;yield ai(lo.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:i,isAuthenticated:!0})),i.id&&localStorage.setItem("userId",i.id),yield ai(lo.loadTenants()),yield ai(lo.setLoginState({error:void 0,loading:!1})),a.flow===Tt.Login&&((yield si(pp))?yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})):yield Kf()),null==o||o(!0)}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1})),null==o||o(!1,e)}}function*Lp({payload:e}){yield ai(lo.setLoginState({loading:!0}));try{var t;yield si(Bd.auth.recoverMfaToken,e),yield ai(lo.setLoginState({loading:!1,error:void 0,step:kt.preLogin})),yield ai(lo.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setLoginState({error:t.message,loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Ep({payload:e}){const{hostedLoginBox:t}=yield di((e=>e.auth));yield ai(lo.setState({isLoading:!0}));try{t?yield si(Bd.auth.OAuthLogout):yield si(Bd.auth.logout)}catch{}yield ai(lo.resetState()),yield ai(lo.requestAuthorize(!0)),null==e||e()}function*Op({payload:e}){var t;try{yield si(Bd.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*wp({user:e,tenants:t}){const n={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield ai(lo.setMfaState(n)),yield ai(lo.setUser(e)),yield ai(lo.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Dp({user:e,tenants:t}){const{loginState:n}=yield di((e=>e.auth));yield ai(lo.setUser(e)),yield ai(lo.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:o}=yield di((e=>e.auth.mfaState));if(n.flow===Tt.Login){const e=yield si(pp);o===nn.smsVerifyCode&&e?yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})):yield Kf()}yield ai(lo.setState({isAuthenticated:!0}))}function*Cp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,_f);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(Bd.auth.preEnrollMFASMSForLogin,n);yield ai(lo.setMfaState({otcToken:e.otcToken,step:nn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Rp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Mf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(Bd.auth.enrollMFASMSForLogin,n),o=yield si(Bd.auth.generateLoginResponseV2,e);yield wp(o),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Up(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Nf);yield ai(lo.setLoginState({loading:!0}));try{var o;const e=yield si(Bd.auth.preEnrollMFAWebAuthnForLogin,n),i=O({},e.options,{challenge:bt(e.options.challenge),user:O({},e.options.user,{id:bt(e.options.user.id)}),excludeCredentials:null==(o=e.options.excludeCredentials)?void 0:o.map((e=>O({},e,{id:bt(e.id)})))});yield ai(lo.setLoginState({loading:!1})),null==t||t({options:i,webauthnToken:e.webauthnToken})}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*_p(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Ff);yield ai(lo.setLoginState({loading:!0}));try{const e=At(n.publicKey),o=yield si(Bd.auth.enrollMFAWebAuthnForLogin,O({},n,{options:e})),i=yield si(Bd.auth.generateLoginResponseV2,o);yield wp(i),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Mp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,$f);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(Bd.auth.enrollMFAAuthenticatorAppForLogin,n),o=yield si(Bd.auth.generateLoginResponseV2,e);yield wp(o),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Np(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Gf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(Bd.auth.preVerifyMFASMSForLogin,n,o);yield ai(lo.setMfaState({otcToken:e.otcToken,step:nn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Fp(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,xf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(Bd.auth.verifyMFASMSForLogin,n,o),i=yield si(Bd.auth.generateLoginResponseV2,e);yield Dp(i),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*$p(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Vf);yield ai(lo.setLoginState({loading:!0}));try{var i;const e=yield si(Bd.auth.preVerifyMFAWebAuthnForLogin,n,o),a=O({},e.options,{challenge:bt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>O({},e,{id:bt(e.id)})))});yield ai(lo.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Gp(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Wf);yield ai(lo.setLoginState({loading:!0}));try{const e=At(o.publicKey),i=yield si(Bd.auth.verifyMFAWebAuthnForLogin,n,O({},o,{options:e})),a=yield si(Bd.auth.generateLoginResponseV2,i);yield Dp(a),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*xp(){yield aa(lo.requestAuthorize,ap),yield aa(lo.requestAuthorizeSSR,lp),yield aa(lo.requestHostedLoginAuthorize,sp),yield aa(lo.handleHostedLoginCallback,cp),yield aa(lo.preLogin,vp),yield aa(lo.postLogin,Tp),yield aa(lo.login,Pp),yield aa(lo.logout,Ep),yield aa(lo.silentLogout,Op),yield aa(lo.loginWithMfa,Ip),yield aa(lo.recoverMfa,Lp),yield aa(lo.quickSmsPasswordlessPreLogin,yp),yield aa(lo.changePhoneNumberWithVerification,up),yield aa(lo.verifyChangePhoneNumber,dp),yield aa(lo.passwordlessPreLogin,fp),yield aa(lo.passwordlessPostLogin,gp),yield aa(lo.verifyInviteToken,Sp),yield aa(lo.webAuthnPrelogin,Ap),yield aa(lo.webAuthnPostLogin,kp),yield aa(lo.webAuthnCreateNewDeviceSession,mp),yield aa(lo.webAuthnVerifyNewDeviceSession,bp),yield aa(lo.afterAuthNavigation,Kf),yield aa(lo.getUserIP,ip),yield aa(lo.preEnrollMFASMSForLogin,Cp),yield aa(lo.enrollMFASMSForLogin,Rp),yield aa(lo.preEnrollMFAWebAuthnForLogin,Up),yield aa(lo.enrollMFAWebAuthnForLogin,_p),yield aa(lo.enrollMFAAuthenticatorAppForLogin,Mp),yield aa(lo.preVerifyMFASMSForLogin,Np),yield aa(lo.verifyMFASMSForLogin,Fp),yield aa(lo.preVerifyMFAWebAuthnForLogin,$p),yield aa(lo.verifyMFAWebAuthnForLogin,Gp)}function*Vp({payload:e}){e&&(yield ai(lo.setState({isLoading:!0})));const t=iy;yield ai(lo.loadTenants()),yield ai(lo.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Wp({payload:{callback:e}}){try{const{ip:t}=Iy[0];yield ai(lo.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*jp(){yield aa(lo.requestAuthorize,Vp),yield aa(lo.afterAuthNavigation,Kf),yield aa(lo.getUserIP,Wp)}const Kp=["callback","samlVendor"],Bp=["callback","samlVendor"];function*zp(){try{var e,t;yield ai(lo.setSSOState({loading:!0}));const n=yield si(Bd.auth.getSamlConfiguration),o=yield si(Bd.auth.getOidcConfiguration),i=yield si(Bd.metadata.getSamlMetadata);n.acsUrl=null==i||null==(e=i.configuration)?void 0:e.acsUrl,n.spEntityId=null==i||null==(t=i.configuration)?void 0:t.spEntityId,n.isSamlActive=null==i?void 0:i.isActive,yield ai(lo.setSSOState({samlConfiguration:n,oidcConfiguration:o,loading:!1,firstLoad:!1}))}catch(e){yield ai(lo.setSSOState({error:e.message,loading:!1}))}}function*qp({payload:e}){const t=yield di((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield ai(lo.setSSOState({error:void 0,[n]:!0}));try{const o=yield Xd(e[0]),i=yield si(Bd.auth.updateSamlVendorMetadata,{metadata:o});i.isSamlActive=null==t?void 0:t.isSamlActive,yield ai(lo.setSSOState({samlConfiguration:i,error:void 0,[n]:!1}))}catch(e){yield ai(lo.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Hp({payload:e}){const{configFile:t,callback:n}=e,o=yield di((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield ai(lo.setSSOState({error:void 0,[i]:!0}));try{const e=yield Xd(t),a=yield si(Bd.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==o?void 0:o.isSamlActive,yield ai(lo.setSSOState({samlConfiguration:a,error:void 0,[i]:!1})),null==n||n(!0)}catch(e){yield ai(lo.setSSOState({samlConfiguration:o,error:e.message,[i]:!1})),null==n||n(null,e)}}function*Jp({payload:e}){const{callback:t,samlVendor:n}=e,o=Ao(e,Kp),i=yield di((e=>e.auth.ssoState.samlConfiguration)),a=O({},i,o);let r="saving";(null==a?void 0:a.enabled)!==i.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield ai(lo.setSSOState({samlConfiguration:O({},i,a)})));if(yield ai(lo.setSSOState({error:void 0,[r]:!0})),e.type===Hd.Saml){var l,s;const e=yield si(Bd.metadata.getSamlMetadata);a.acsUrl=null==e||null==(l=e.configuration)?void 0:l.acsUrl,a.spEntityId=null==e||null==(s=e.configuration)?void 0:s.spEntityId}const o=Jd(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==i?void 0:i.domain)!==(null==o?void 0:o.domain)&&(o.ssoEndpoint="",o.publicCertificate="",o.signRequest=!1),o.type=null==n?void 0:n.toLowerCase();const c=yield si(Bd.auth.updateSamlConfiguration,o);c.isSamlActive=null==i?void 0:i.isSamlActive,yield ai(lo.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield ai(lo.setSSOState({samlConfiguration:i,error:e.message,[r]:!1})),null==t||t(null,e)}}function*Yp({payload:{callback:e}={}}){const t=yield di((e=>e.auth.ssoState.samlConfiguration));try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(Bd.auth.validateSamlDomain),yield ai(lo.setSSOState({samlConfiguration:O({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield ai(lo.setSSOState({samlConfiguration:O({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*Qp(){try{const e=yield si(Bd.auth.getSamlRoles),t=yield si(Bd.auth.getSamlRolesGroups);yield ai(lo.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield ai(lo.setSSOState({error:e.message}))}}function*Xp({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(Bd.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield ri(e.map((e=>si(Bd.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield ai(lo.setSSOState({error:e.message}))}}(n)),yield Qp(),yield ai(lo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ai(lo.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Zp({payload:{callback:e,id:t}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(Bd.auth.deleteSamlGroup,{id:t}),yield Qp(),yield ai(lo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ai(lo.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*eg({payload:{group:e,roleIds:t,callback:n}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(Bd.auth.createSamlGroup,{group:e,roleIds:t}),yield Qp(),yield ai(lo.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield ai(lo.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*tg({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield ai(lo.setSSOState({loading:!0})),yield si(Bd.auth.oidcPostLoginV2,t),yield si(Xf),yield ai(lo.setSSOState({loading:!1}))}catch(e){var n;yield ai(lo.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*ng(){yield oa(lo.loadSSOConfigurations,zp),yield oa(lo.saveSSOConfigurations,Jp),yield oa(lo.saveSSOConfigurationsFile,qp),yield oa(lo.saveSSOConfigurationsFileWithCallback,Hp),yield oa(lo.validateSSODomain,Yp),yield oa(lo.loadSSOAuthorizationRoles,Qp),yield oa(lo.updateSSOAuthorizationRoles,Xp),yield oa(lo.deleteSamlGroup,Zp),yield oa(lo.createSamlGroup,eg),yield oa(lo.oidcPostlogin,tg)}function*og(){yield ai(lo.setSSOState({loading:!0})),yield vt(),yield ai(lo.setSSOState({samlConfiguration:dy,loading:!1,firstLoad:!1}))}function*ig({payload:e}){const t="saving";yield ai(lo.setSSOState({error:void 0,[t]:!0}));const n=O({},yield di((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield ai(lo.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*ag({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Ao(e,Bp),r=py.samlConfiguration,l=O({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield ai(lo.setSSOState({samlConfiguration:O({},r,l)})));yield ai(lo.setSSOState({error:void 0,[s]:!0})),yield vt(),l.acsUrl=null==yy||null==(t=yy.configuration)?void 0:t.acsUrl,l.spEntityId=null==yy||null==(n=yy.configuration)?void 0:n.spEntityId;const c=Jd(l,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==i?void 0:i.toLowerCase(),yield vt(),yield ai(lo.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==o||o(!0)}function*rg({payload:{callback:e}={}}){const t=py.samlConfiguration;yield ai(lo.setSSOState({error:void 0,saving:!0})),yield vt(),yield ai(lo.setSSOState({samlConfiguration:O({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*lg(){yield vt(),yield ai(lo.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*sg({payload:{callback:e,authorizationRoles:t}}){yield ai(lo.setSSOState({error:void 0,saving:!0})),yield vt(),yield ai(lo.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*cg(){yield oa(lo.loadSSOConfigurations,og),yield oa(lo.saveSSOConfigurations,ag),yield oa(lo.saveSSOConfigurationsFile,ig),yield oa(lo.validateSSODomain,rg),yield oa(lo.loadSSOAuthorizationRoles,lg),yield oa(lo.updateSSOAuthorizationRoles,sg)}const ug=["callback"],dg=["callback","ssoConfigId"],yg=["callback","ssoConfigId"];function*fg(){try{return yield si(Bd.auth.getOidcConfiguration)}catch(e){return null}}function*pg(){try{return yield si(Bd.metadata.getSamlMetadata)}catch(e){return null}}function*gg(){try{yield ai(lo.setSSOLoader({key:qd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield ri([si(fg),si(pg)]),n=yield si(Bd.auth.getSSOConfigurations);yield ai(lo.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield ai(lo.setSSOError({key:qd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield ai(lo.setSSOLoader({key:qd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Sg({payload:e}){yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ao(e,ug),o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield si(Bd.auth.createSSOConfiguration,O({},n,{enabled:null!=(i=n.enabled)&&i}));yield ai(lo.setSSOState({ssoConfigurations:[...o,e]})),null==t||t(e)}catch(e){yield ai(lo.setSSOError({key:qd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*vg({payload:e}){yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Xd(t),i=yield si(Bd.auth.createSSOConfigurationByMetadata,{metadata:e});yield ai(lo.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield ai(lo.setSSOError({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*hg({payload:e}){yield ai(lo.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Ao(e,dg),i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield si(Bd.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t));yield ai(lo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ai(lo.setSSOError({key:qd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*mg({payload:e}){yield ai(lo.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:o}=e,i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Xd(o),a=yield si(Bd.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=i.map((e=>e.id===n?a:e));yield ai(lo.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield ai(lo.setSSOError({key:qd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*bg({payload:e}){yield ai(lo.setSSOLoader({key:qd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(Bd.auth.deleteSSOConfiguration,t),yield ai(lo.setSSOState({ssoConfigurations:o.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield ai(lo.setSSOError({key:qd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Ag({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Ao(e,yg);yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield si(Bd.auth.createSSODomain,n,o),a=i.map((t=>t.id===n?O({},t,{domains:[...t.domains,e]}):t));yield ai(lo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ai(lo.setSSOError({key:qd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_DOMAIN,value:!1}))}}function*kg({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield ai(lo.setSSOLoader({key:qd.DELETE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(Bd.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?O({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield ai(lo.setSSOState({ssoConfigurations:e})),null==o||o(!0)}catch(e){yield ai(lo.setSSOError({key:qd.DELETE_SSO_DOMAIN,value:e.message})),null==o||o(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.DELETE_SSO_DOMAIN,value:!1}))}}function*Tg({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield ai(lo.setSSOLoader({key:qd.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(Bd.auth.validateSSODomain,o,n);const e=i.map((e=>e.id===o?O({},e,{domains:e.domains.map((e=>e.id===n?O({},e,{validated:!0}):e))}):e));yield ai(lo.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield ai(lo.setSSOError({key:qd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Pg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield ai(lo.setSSOLoader({key:qd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(Bd.auth.setSSODefaultRoles,t,{roleIds:n});const i=o.map((e=>e.id===t?O({},e,{roleIds:n}):e));yield ai(lo.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield ai(lo.setSSOError({key:qd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield ai(lo.setSSOLoader({key:qd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Ig({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_GROUPS,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield ri(t.map((e=>si(Bd.auth.deleteSSOGroup,n,e)))),yield ri(e.map((e=>si(Bd.auth.createSSOGroup,n,e))));const a=yield si(Bd.auth.getSSOGroups,n),r=i.map((e=>e.id===n?O({},e,{groups:a}):e));yield ai(lo.setSSOState({ssoConfigurations:r})),null==o||o(!0)}catch(e){yield ai(lo.setSSOError({key:qd.SAVE_SSO_GROUPS,value:e.message})),null==o||o(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_GROUPS,value:!1}))}}function*Lg({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield ri(t.map((t=>si(Bd.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield ai(lo.setSSOError({key:qd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_GROUPS,value:!1}))}}function*Eg(){yield oa(lo.loadSSOConfigurationsV2,gg),yield oa(lo.saveSSOConfigurationV2,Sg),yield oa(lo.saveSSODomain,Ag),yield oa(lo.deleteSSODomain,kg),yield oa(lo.validateSSODomainV2,Tg),yield oa(lo.updateSSOConfiguration,hg),yield oa(lo.deleteSSOConfiguration,bg),yield oa(lo.setSSOGroups,Ig),yield oa(lo.updateSSOGroups,Lg),yield oa(lo.setSSODefaultRoles,Pg),yield oa(lo.saveSSOConfigurationByMetadata,vg),yield oa(lo.updateSSOConfigurationByMetadata,mg)}const Og=["callback","profilePictureUrl"],wg=["callback","profilePictureUrl"];function*Dg(){yield ai(lo.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return si.apply(void 0,[na,e,t,n].concat(i))}(3,2e3,Bd.teams.getProfile),t=yield di((e=>e.auth.user));lo.setUser(O({},t,e)),yield ai(lo.setProfileState({profile:e,loading:!1}))}catch(e){yield ai(lo.setProfileState({loading:!1,error:e.message}))}}function*Cg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ao(e.payload,Og);yield ai(lo.setProfileState({saving:!0,error:null}));try{const e=yield di((e=>e.auth.profileState.profile));let i=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const o=`image/${n[1]}`,i=function(e,t){const n=atob(e),o=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),i=new Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);o.push(new Uint8Array(i))}return new Blob(o,{type:t})}(n[2],o),a=new FormData;return a.append(t,new File([i],t,{type:o})),a}(n,"image");if(e){i=yield si(Bd.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(i);n.searchParams.set("t",t),i=n.href}}const a=O({},e,o,{profilePictureUrl:i}),r=yield si(Bd.teams.updateProfile,a),l=yield di((e=>e.auth.user));yield ai(lo.setUser(O({},l,r))),yield ai(lo.setProfileState({profile:r,saving:!1})),null==t||t(a)}catch(e){yield ai(lo.setProfileState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Rg({payload:e}){yield ai(lo.setProfileState({loading:!0}));try{var t;yield si(Bd.teams.changePassword,e),yield ai(lo.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Ug(){yield aa(lo.loadProfile,Dg),yield oa(lo.saveProfile,Cg),yield oa(lo.changePassword,Rg)}function*_g(){yield ai(lo.setProfileState({loading:!0})),yield vt(),yield ai(lo.setUser(O({},iy,oy))),yield ai(lo.setProfileState({loading:!1,profile:oy}))}function*Mg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ao(e.payload,wg);yield ai(lo.setProfileState({saving:!0,error:null}));const i=ay;let a=i.profile.profilePictureUrl;n!==i.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=O({},i.profile,o,{profilePictureUrl:a}),l=iy;yield vt(),yield ai(lo.setUser(O({},l,r))),yield ai(lo.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Ng({payload:e}){var t;yield ai(lo.setProfileState({loading:!0})),yield vt(),yield ai(lo.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Fg(){yield aa(lo.loadProfile,_g),yield oa(lo.saveProfile,Mg),yield oa(lo.changePassword,Ng)}const $g=["callback"],Gg=["callback"],xg=["callback"],Vg=["deviceId","callback"],Wg=["deviceId","callback"],jg=["callback"],Kg=["deviceId"],Bg=["deviceId"],zg=["callback"],qg=["deviceId"],Hg=["callback"];function*Jg(e){const{step:t}=yield di((e=>e.auth.mfaState));return{step:e.recoveryCode?nn.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Yg(){yield ai(lo.setMfaState({saving:!0}));try{const{qrCode:e}=yield si(Bd.auth.enrollMfa);yield ai(lo.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message}))}}function*Qg(e){let{payload:{callback:t}}=e,n=Ao(e.payload,$g);yield ai(lo.setMfaState({saving:!0}));try{const e=yield di((e=>e.auth.user)),o=yield si(Bd.auth.verifyMfa,n),i=yield si(Bd.auth.getMFADevices),a=yield Jg(o);yield ai(lo.setMfaState(O({},a,{mfaDevices:i}))),yield ai(lo.setUser(O({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Xg(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Gg);yield ai(lo.setMfaState({loading:!0}));try{const e=yield si(Bd.auth.loginWithMfa,n),o={step:nn.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(o.recoveryCode=e.recoveryCode),yield ai(lo.setMfaState(o)),yield ai(lo.setState({user:e})),yield ai(lo.loadTenants()),null==t||t(o.recoveryCode)}catch(e){yield ai(lo.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Zg({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t;yield si(Bd.auth.disableMfa,e);const n=yield si(Bd.auth.getMFADevices);yield ai(lo.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*eS({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t,n;const o=yield si(Bd.auth.preEnrollMFAWebAuthn),i=O({},o.options,{challenge:bt(o.options.challenge),user:O({},o.options.user,{id:bt(o.options.user.id)}),excludeCredentials:null==(t=o.options.excludeCredentials)?void 0:t.map((e=>O({},e,{id:bt(e.id)})))});yield ai(lo.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:i,webauthnToken:o.webauthnToken})}catch(t){var o;yield ai(lo.setMfaState({saving:!1,error:t.message})),null==(o=e.callback)||o.call(e,null,t)}}function*tS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,xg);yield ai(lo.setMfaState({saving:!0}));try{const e=At(n.publicKey),o=yield si(Bd.auth.enrollMFAWebAuthn,O({},n,{options:e})),i=yield si(Bd.auth.getMFADevices),a=yield Jg(o);yield ai(lo.setMfaState(O({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*nS(e){let{payload:{deviceId:t,callback:n}}=e;Ao(e.payload,Vg),yield ai(lo.setMfaState({saving:!0}));try{var o;const e=yield si(Bd.auth.preDisableMFAWebAuthn,t),i=O({},e.options,{challenge:bt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>O({},e,{id:bt(e.id)})))});yield ai(lo.setMfaState({saving:!1})),null==n||n({options:i,webauthnToken:e.webauthnToken})}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*oS(e){let{payload:{deviceId:t,callback:n}}=e,o=Ao(e.payload,Wg);yield ai(lo.setMfaState({saving:!0}));try{const e=At(o.publicKey);yield si(Bd.auth.disableMFAWebAuthn,t,O({},o,{options:e}));const i=yield si(Bd.auth.getMFADevices);yield ai(lo.setMfaState({saving:!1,error:void 0,mfaDevices:i})),null==n||n(!0)}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*iS({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t;const n=yield si(Bd.auth.preEnrollMFASMS,e);yield ai(lo.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 ai(lo.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*aS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,jg);yield ai(lo.setMfaState({saving:!0}));try{const e=yield si(Bd.auth.enrollMFASMS,n),o=yield si(Bd.auth.getMFADevices),i=yield Jg(e);yield ai(lo.setMfaState(O({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*rS(e){let{payload:{deviceId:t}}=e,n=Ao(e.payload,Kg);yield ai(lo.setMfaState({saving:!0}));try{var o;const e=yield si(Bd.auth.preDisableMFASMS,t);yield ai(lo.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield ai(lo.setMfaState({saving:!1,error:e.message})),null==(i=n.callback)||i.call(n,!1,e)}}function*lS(e){let{payload:{deviceId:t}}=e,n=Ao(e.payload,Bg);yield ai(lo.setMfaState({saving:!0}));try{var o;yield si(Bd.auth.disableMFASMS,t,n);const e=yield si(Bd.auth.getMFADevices);yield ai(lo.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield ai(lo.setMfaState({saving:!1,error:e.message})),null==(i=n.callback)||i.call(n,!1,e)}}function*sS(){yield ai(lo.setMfaState({loading:!0}));try{yield di((e=>e.auth.user));const e=yield si(Bd.auth.getMFADevices);yield ai(lo.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield ai(lo.setMfaState({loading:!1,error:e.message}))}}function*cS(){yield ai(lo.setMfaState({loading:!0}));try{const e=(yield si(Bd.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield ai(lo.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield ai(lo.setMfaState({loading:!1,error:e.message}))}}function*uS(){yield oa(lo.enrollMfa,Yg),yield oa(lo.getMFADevices,sS),yield oa(lo.getMFAStrategies,cS),yield oa(lo.verifyMfa,Qg),yield oa(lo.disableMfa,Zg),yield oa(lo.verifyMfaAfterForce,Xg),yield oa(lo.preDisableMfaSms,rS),yield oa(lo.disableMfaSms,lS),yield oa(lo.preEnrollMfaSms,iS),yield oa(lo.enrollMfaSms,aS),yield oa(lo.preEnrollMfaWebAuthn,eS),yield oa(lo.enrollMfaWebAuthn,tS),yield oa(lo.preDisableMfaWebAuthn,nS),yield oa(lo.disableMfaWebAuthn,oS)}function*dS(){yield ai(lo.setMfaState({saving:!0})),yield ai(lo.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*yS({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield di((e=>e.auth.mfaState));yield ai(lo.setMfaState({saving:!0})),yield vt();const n={token:"token",recoveryCode:"recoveryCode"},o={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:O({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(o.recoveryCode=n.recoveryCode),yield ai(lo.setMfaState(o)),yield ai(lo.setUser(O({},iy,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*fS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,zg);yield ai(lo.setMfaState({loading:!0})),yield vt();const o=O({},n,{recoveryCode:"recoveryCode"}),i={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield ai(lo.setMfaState(i)),yield vt(),yield ai(lo.setUser(O({},iy,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*pS({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield di((e=>e.auth.mfaState));yield ai(lo.setMfaState({saving:!0})),yield vt(),yield ai(lo.setMfaState({saving:!1,error:void 0,mfaDevices:O({},n,{authenticators:[]})})),yield ai(lo.setUser(O({},iy))),null==(t=e.callback)||t.call(e,!0)}function*gS(e){let{}=e,t=Ao(e.payload,qg);yield ai(lo.setMfaState({saving:!0}));try{var n;yield ai(lo.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var o;yield ai(lo.setMfaState({saving:!1,error:e.message})),null==(o=t.callback)||o.call(t,!1,e)}}function*SS({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield di((e=>e.auth.mfaState));yield ai(lo.setMfaState({saving:!0})),yield vt(),yield ai(lo.setMfaState({loading:!1,error:void 0,mfaDevices:O({},n,{phones:[]})})),yield ai(lo.setUser(O({},iy))),null==(t=e.callback)||t.call(e,!0)}function*vS({payload:e}){var t;yield ai(lo.setMfaState({saving:!0})),yield vt(),yield ai(lo.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*hS(e){let{payload:{callback:t}}=e;Ao(e.payload,Hg);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield di((e=>e.auth.mfaState));yield ai(lo.setMfaState({saving:!0})),yield vt();const o={token:"token",recoveryCode:"recoveryCode"},i={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:O({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield ai(lo.setMfaState(i)),yield ai(lo.setUser(O({},iy,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*mS(){yield oa(lo.enrollMfa,dS),yield oa(lo.verifyMfa,yS),yield oa(lo.disableMfa,pS),yield oa(lo.verifyMfaAfterForce,fS),yield oa(lo.preDisableMfaSms,gS),yield oa(lo.disableMfaSms,SS),yield oa(lo.preEnrollMfaSms,vS),yield oa(lo.enrollMfaSms,hS)}const bS=["callback"];function*AS({payload:e}){yield ai(lo.setForgotPasswordState({loading:!0}));try{var t;yield si(Bd.auth.forgotPassword,e),yield ai(lo.setForgotPasswordState({loading:!1,error:void 0,step:Wt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setForgotPasswordState({loading:!1,error:t.message||"Unknown error occurred"})),null==(n=e.callback)||n.call(e,!1,t)}}function*kS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,bS);yield ai(lo.setForgotPasswordState({loading:!0}));try{yield si(Bd.auth.resetPassword,n),yield ai(lo.setForgotPasswordState({loading:!1,error:void 0,step:Wt.success})),null==t||t(!0)}catch(e){yield ai(lo.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1,e)}}function*TS({payload:e}){yield ai(lo.setForgotPasswordState({loading:!0}));try{const t=yield si(Bd.auth.loadPasswordConfig,e);yield ai(lo.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield ai(lo.setForgotPasswordState({loading:!1,error:e.message}))}}function*PS(){yield aa(lo.forgotPassword,AS),yield aa(lo.resetPassword,kS),yield aa(lo.loadPasswordConfig,TS)}let IS;!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"}(IS||(IS={}));const LS=["callback","events"],ES=["callback"],OS=["callback"];function*wS({payload:{userId:e,token:t}}){yield ai(lo.setActivateState({loading:!0,step:_t.activating}));try{const{isAuthenticated:n}=yield di((e=>e.auth));n&&(yield ai(lo.silentLogout()));const o=yield si(Bd.auth.getActivateAccountStrategy,{userId:e,token:t});yield ai(lo.setActivateStrategyState({strategy:o,loading:!1,error:void 0})),o.shouldSetPassword&&(yield ai(lo.setActivateState({loading:!1,step:_t.activatingForm})))}catch(e){yield ai(lo.setActivateState({loading:!1,error:e.message}))}}function*DS(e){let{payload:{callback:t,events:n}}=e,o=Ao(e.payload,LS);yield ai(lo.setActivateState({loading:!0}));try{const e=ra.onRedirectTo,{routes:a}=yield di((e=>e.auth)),r=yield si(Bd.auth.activateAccount,o);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(qf(r)){yield ai(lo.setActivateState({step:_t.success}));const t=yield Yf(r);yield ai(lo.setState(t)),yield yi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var i;yield ai(lo.setActivateState({step:_t.success}));const{user:e,tenants:t}=yield si(Bd.auth.generateLoginResponseV2,r);null==n||null==(i=n.userVerified)||i.call(n,{email:e.email,origin:wy.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield ai(lo.setTenantsState({tenants:t,loading:!1})),yield ai(lo.setState({user:e,isAuthenticated:!0})),yield yi(1e3),yield Kf(),yield ai(lo.resetActivateState())}null==t||t(!0)}catch(e){yield ai(lo.setActivateState({loading:!1,error:e.message}))}}function*CS({payload:e}){const{callback:t}=e,n=Ao(e,ES);yield ai(lo.setActivateStrategyState({loading:!0}));try{const e=yield si(Bd.auth.getActivateAccountStrategy,n);yield ai(lo.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield ai(lo.setActivateStrategyState({loading:!1,error:e.message}))}}function*RS({payload:e}){const{callback:t}=e,n=Ao(e,OS);yield ai(lo.setTeamLoader({key:IS.RESEND_ACTIVATE_LINK,value:n.email})),yield ai(lo.setActivateState({loading:!0}));try{yield si(Bd.auth.resendActivationEmail,n),yield ai(lo.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield ai(lo.setActivateState({loading:!1,error:e.message})),yield ai(lo.setTeamError({key:IS.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:IS.RESEND_ACTIVATE_LINK,value:!1}))}function*US(){yield aa(lo.activateAccount,DS),yield aa(lo.preActivateAccount,wS),yield aa(lo.getActivateAccountStrategy,CS),yield aa(lo.resendActivationEmail,RS)}function*_S({payload:e}){if(e.token&&e.userId)try{yield ai(lo.setAcceptInvitationState({error:void 0,step:$t.pending})),yield si(Bd.auth.acceptInvitation,e),yield ai(lo.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:$t.success}}))}catch(e){yield ai(lo.setAcceptInvitationState({step:$t.failed,error:e.message}))}else yield ai(lo.setAcceptInvitationState({error:void 0,step:$t.invalid}))}function*MS(){yield aa(lo.acceptInvitation,_S)}var NS,FS=new Uint8Array(16);function $S(){if(!NS&&!(NS="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 NS(FS)}for(var GS=/^(?:[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,xS=function(e){return"string"==typeof e&&GS.test(e)},VS=[],WS=0;WS<256;++WS)VS.push((WS+256).toString(16).substr(1));var jS=function(e,t,n){var o=(e=e||{}).random||(e.rng||$S)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=o[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(VS[e[t+0]]+VS[e[t+1]]+VS[e[t+2]]+VS[e[t+3]]+"-"+VS[e[t+4]]+VS[e[t+5]]+"-"+VS[e[t+6]]+VS[e[t+7]]+"-"+VS[e[t+8]]+VS[e[t+9]]+"-"+VS[e[t+10]]+VS[e[t+11]]+VS[e[t+12]]+VS[e[t+13]]+VS[e[t+14]]+VS[e[t+15]]).toLowerCase();if(!xS(n))throw TypeError("Stringified UUID is invalid");return n}(o)};const KS=["callback"],BS=["roles"],zS=["callback"],qS=["callback","profileImage"],HS=["callback"],JS=["callback","userId"],YS=["callback"],QS=["callback"],XS=["callback"],ZS=["callback"],ev=["callback"],tv=["callback"],nv=["callback"],ov=["callback","profileImage"],iv=["callback"],av=["callback"],rv=["callback"],lv=["callback"],sv=["callback"],cv=["callback"],uv=()=>di((e=>e.auth.teamState));function*dv({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield uv(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filter,d=null!=(i=e.sort)?i:l.sort;yield ai(lo.setTeamLoader({key:IS.USERS,value:!a})),yield ai(lo.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:o},{items:i}]=yield ri([si(Bd.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),si(Bd.teams.loadAvailableRoles),si(Bd.teams.loadAvailablePermissions)]);yield ai(lo.setTeamState({users:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==r||r(e)}catch(e){yield ai(lo.setTeamError({key:IS.USERS,value:e.message})),yield ai(lo.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield ai(lo.setTeamLoader({key:IS.USERS,value:!1}))}function*yv({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield uv(),c={_limit:(null!=(t=e._limit)?t:s.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:s.allUsersQueryParams._offset)||0,_filter:(null!=(o=e._filter)?o:s.allUsersQueryParams._filter)||"",_sortBy:(null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:s.allUsersQueryParams._order)||"DESC"};yield ai(lo.setTeamLoader({key:IS.USERS,value:!r})),yield ai(lo.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:o},{items:i}]=yield ri([si(Bd.subTenants.loadAllUsers,O({},c)),si(Bd.teams.loadAvailableRoles),si(Bd.teams.loadAvailablePermissions)]);yield ai(lo.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==l||l(e)}catch(e){yield ai(lo.setTeamError({key:IS.USERS,value:e.message})),yield ai(lo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield ai(lo.setTeamLoader({key:IS.USERS,value:!1}))}function*fv({payload:e}){yield ai(lo.setTeamLoader({key:IS.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield ri([si(Bd.teams.loadAvailableRoles),si(Bd.teams.loadAvailablePermissions)]);yield ai(lo.setTeamState({roles:n,permissions:o})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:o})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield ai(lo.setTeamError({key:IS.ROLES_AND_PERMISSIONS,value:t.message}))}yield ai(lo.setTeamLoader({key:IS.ROLES_AND_PERMISSIONS,value:!0}))}function*pv({payload:e}){const{callback:t}=e,n=Ao(e,KS),o=yield uv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield si(Bd.teams.addUser,n),{roles:a}=e,r=O({},Ao(e,BS),{roleIds:null!=(i=null==a?void 0:a.map((e=>e.id)))?i:[]});null==t||t(r),yield ai(lo.setTeamState({users:[r,...o.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*gv({payload:e}){const{callback:t}=e,n=yield uv();yield ai(lo.setTeamState({addUserDialogState:O({},n.addUserDialogState,{loading:!0})}));const o=[],i=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield ai(lo.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield si(Bd.teams.addUser,t),o.push(t.email)}catch(e){i.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:[],silentLoading:e.emails.length>0};yield ai(lo.loadUsers(r)),yield ai(lo.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:i,allowedEmails:o})}function*Sv({payload:e}){const{callback:t}=e,n=Ao(e,zS),o=yield uv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})}));try{yield si(Bd.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield si(Bd.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield ai(lo.setTeamState({allUsers:e,totalPages:o,totalItems:i,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*vv({payload:e}){const{callback:t}=e,n=Ao(e,qS),{id:o}=n,i=yield uv(),a=i.users.find((e=>e.id===n.id));yield ai(lo.setTeamLoader({key:IS.UPDATE_USER,value:o||""})),yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0})})),yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0}),users:i.users.map((e=>e.id===n.id?O({},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 si(Bd.teams.updateUser,n);null==t||t(e),yield ai(lo.setTeamState({users:i.users.map((t=>t.id===e.id?O({},t,e,{createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield ai(lo.setTeamLoader({key:IS.UPDATE_USER,value:!1}))}catch(e){yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!1,error:e.message}),users:i.users.map((e=>e.id===n.id?O({},e,a):e))})),yield ai(lo.setTeamLoader({key:IS.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*hv({payload:e}){const{callback:t}=e,n=Ao(e,HS),o=yield uv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})}));try{yield si(Bd.teams.deleteUser,n),null==t||t(!0),yield ai(lo.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*mv({payload:e}){const{callback:t,userId:n}=e,o=Ao(e,JS),i=yield uv();yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0})}));try{yield si(Bd.subTenants.setUserRolesForSubTenants,n,o);const e=i.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return O({},e,{roles:(null==(t=o.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>i.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield ai(lo.setTeamState({allUsers:[...i.allUsers.filter((e=>e.id!==n)),...e?[O({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*bv({payload:e}){const{callback:t}=e,n=Ao(e,YS),o=yield uv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})}));try{yield si(Bd.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield ai(lo.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Av({payload:e}){const{callback:t}=e,n=Ao(e,QS);yield ai(lo.setTeamLoader({key:IS.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield si(Bd.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:IS.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:IS.RESEND_ACTIVATE_LINK,value:!1}))}function*kv({payload:e}){const{callback:t}=e,n=Ao(e,XS);yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:n.email}));try{yield si(Bd.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:IS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:!1}))}function*Tv({payload:e}){const{callback:t}=e,n=Ao(e,ZS);yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:n.email}));try{yield si(Bd.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:IS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:!1}))}function*Pv({payload:e}){const{callback:t}=e,n=Ao(e,ev);yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:n.email}));try{yield si(Bd.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:IS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:!1}))}function*Iv(){yield ai(lo.setTeamError({key:IS.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield si(Bd.teams.getInviteLinkConfiguration);yield ai(lo.setTeamState({inviteTokenState:O({},e)}))}catch(e){yield ai(lo.setTeamError({key:IS.CONFIG_TOKEN_LINK,value:e.message}))}}function*Lv(){yield ai(lo.setTeamError({key:IS.GET_TOKEN_LINK,value:!1}));try{yield si(Iv);const e=yield si(Bd.teams.getInviteUserLink),{inviteTokenState:t}=yield uv();yield ai(lo.setTeamState({inviteTokenState:O({},t,e)}))}catch(e){yield ai(lo.setTeamError({key:IS.GET_TOKEN_LINK,value:e.message}))}}function*Ev({payload:{callback:e}}){yield ai(lo.setTeamError({key:IS.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield uv();try{const n=yield si(Bd.teams.createInviteUserLink,{expiresInMinutes:43200});yield ai(lo.setTeamState({inviteTokenState:O({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield ai(lo.setTeamError({key:IS.CREATE_TOKEN_LINK,value:t.message}))}}function*Ov({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield uv();yield ai(lo.setTeamError({key:IS.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield si(Bd.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield ai(lo.setTeamState({inviteTokenState:O({},o,i)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield ai(lo.setTeamError({key:IS.UPDATE_TOKEN_LINK,value:t.message}))}}function*wv({payload:e}){const{callback:t}=null!=e?e:{};yield ai(lo.setTeamError({key:IS.DELETE_TOKEN_LINK,value:!1}));try{yield si(Bd.teams.deleteInviteUserLink),yield ai(lo.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:IS.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Dv({payload:e}){yield ai(lo.setTeamState({addUserDialogState:O({open:!0,loading:!1,error:!1},e)}))}function*Cv({payload:e}){const t=yield uv(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield ai(lo.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Rv({payload:e}){yield ai(lo.setTeamState({deleteUserDialogState:O({open:!0,loading:!1,error:!1},e)}))}function*Uv({payload:e}){const t=yield uv(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield ai(lo.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*_v(){yield ia(lo.loadUsers,dv),yield ia(lo.loadAllSubTenantsUsers,yv),yield ia(lo.loadRoles,fv),yield oa(lo.addUser,pv),yield oa(lo.addUsersBulk,gv),yield oa(lo.addUserToSubTenants,Sv),yield oa(lo.updateUser,vv),yield oa(lo.setUserRolesForSubTenants,mv),yield oa(lo.deleteUser,hv),yield oa(lo.deleteUserFromSubTenants,bv),yield oa(lo.resendActivationLink,Av),yield oa(lo.resendInvitationLink,kv),yield oa(lo.resendInvitationEmail,Tv),yield oa(lo.resendInvitationLinkToAllSubTenants,Pv),yield oa(lo.getInvitationLink,Lv),yield oa(lo.createInvitationLink,Ev),yield oa(lo.updateInvitationLink,Ov),yield oa(lo.deleteInvitationLink,wv),yield oa(lo.openAddUserDialog,Dv),yield oa(lo.closeAddUserDialog,Cv),yield oa(lo.openDeleteUserDialog,Rv),yield oa(lo.closeDeleteUserDialog,Uv)}function*Mv({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield uv(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filter,d=null!=(i=e.sort)?i:l.sort;yield ai(lo.setTeamLoader({key:IS.USERS,value:!a})),yield ai(lo.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield vt(),yield ai(lo.setTeamState({users:my,totalPages:2,totalItems:10,roles:fy,permissions:gy})),yield ai(lo.setTeamLoader({key:IS.USERS,value:!1})),null==r||r(my)}function*Nv({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield uv(),c=null!=(t=e._limit)?t:s.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:s.allUsersQueryParams._offset,d=null!=(o=e._filter)?o:s.allUsersQueryParams._filter,y=null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:s.allUsersQueryParams._order;yield ai(lo.setTeamLoader({key:IS.USERS,value:!r})),yield ai(lo.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield vt(),yield ai(lo.setTeamState({allUsers:by,totalPages:2,totalItems:10,roles:fy,permissions:gy})),yield ai(lo.setTeamLoader({key:IS.USERS,value:!1})),null==l||l(by)}function*Fv({payload:e}){var t;yield ai(lo.setTeamLoader({key:IS.ROLES_AND_PERMISSIONS,value:!0})),yield vt(),yield ai(lo.setTeamState({roles:fy,permissions:gy})),yield ai(lo.setTeamLoader({key:IS.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:fy,permissions:gy})}function*$v({payload:e}){const{callback:t}=e,n=Ao(e,tv),o=yield uv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})})),yield vt();const i=O({},vy,n,{id:`${jS()}`});null==t||t(i),yield ai(lo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*Gv({payload:e}){const{callback:t}=e,n=Ao(e,nv),o=yield uv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})})),yield vt();const i=O({},vy,n,{id:`${jS()}`});yield ai(lo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*xv({payload:e}){var t;const{callback:n}=e,o=Ao(e,ov),{id:i}=o,a=yield uv(),r=a.users.find((e=>e.id===o.id));yield ai(lo.setTeamLoader({key:IS.UPDATE_USER,value:i||""})),yield ai(lo.setTeamState({addUserDialogState:O({},a.addUserDialogState,{loading:!0})})),yield ai(lo.setTeamState({addUserDialogState:O({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===o.id?O({},e,o):e))})),r.roleIds.length>0&&0===(null==(t=o.roleIds)?void 0:t.length)&&(o.roleIds=[""]),yield vt();const l=O({},r,o);null==n||n(l),yield ai(lo.setTeamState({users:a.users.map((e=>e.id===l.id?O({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield ai(lo.setTeamLoader({key:IS.UPDATE_USER,value:!1}))}function*Vv({payload:e}){const{callback:t}=e,n=Ao(e,iv),o=yield uv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})})),yield vt(),null==t||t(!0),yield ai(lo.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Wv({payload:e}){const{callback:t}=e,n=Ao(e,av),o=yield uv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})})),yield vt(),null==t||t(!0),yield ai(lo.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*jv({payload:e}){const{callback:t}=e,n=Ao(e,rv);yield ai(lo.setTeamLoader({key:IS.RESEND_ACTIVATE_LINK,value:n.userId})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:IS.RESEND_ACTIVATE_LINK,value:!1}))}function*Kv({payload:e}){const{callback:t}=e,n=Ao(e,lv);yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:!1}))}function*Bv({payload:e}){const{callback:t}=e,n=Ao(e,sv);yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:!1}))}function*zv({payload:e}){const{callback:t}=e,n=Ao(e,cv);yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:!1}))}function*qv(){yield ia(lo.loadUsers,Mv),yield ia(lo.loadAllSubTenantsUsers,Nv),yield ia(lo.loadRoles,Fv),yield oa(lo.addUser,$v),yield oa(lo.addUserToSubTenants,Gv),yield oa(lo.updateUser,xv),yield oa(lo.deleteUser,Vv),yield oa(lo.deleteUserFromSubTenants,Wv),yield oa(lo.resendActivationLink,jv),yield oa(lo.resendInvitationLink,Kv),yield oa(lo.resendInvitationEmail,Bv),yield oa(lo.resendInvitationLinkToAllSubTenants,zv),yield oa(lo.openAddUserDialog,Dv),yield oa(lo.closeAddUserDialog,Cv),yield oa(lo.openDeleteUserDialog,Rv),yield oa(lo.closeDeleteUserDialog,Uv)}const Hv=["authorizationUrl"],Jv=["events","url"];function*Yv(){try{yield ai(lo.setSocialLoginsState({loading:!0}));const e=yield si(Bd.auth.getSocialLoginProviders);yield ai(lo.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield ai(lo.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Qv(){try{const e=yield di((e=>e.root.context));yield ai(lo.setSocialLoginsState({loading:!0}));const t=yield si(Bd.auth.getSocialLoginProvidersV2),{providers:n}=yield si(Bd.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Ao(t,Hv);const i=ca(e,null!=n?n:"");return O({},o,{authorizationUrl:n?`${i}${n}`:null})}));yield ai(lo.setSocialLoginsState({socialLoginsConfigV2:o,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield ai(lo.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Xv(e){let{payload:{events:t,url:n}}=e,o=Ao(e.payload,Jv);try{yield ai(lo.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield si(Bd.auth.loginViaSocialLogin,o);var i,a;r&&(null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,url:n,authenticationType:Dy.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:o.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:wy.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield ai(lo.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield di((e=>e.auth));e?yield si(ep):yield si(np)}(),localStorage.removeItem("register-quick-login"),yield ai(lo.setSocialLoginsState({loading:!1}))}catch(e){var r;yield ai(lo.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*Zv({payload:e}){yield ai(lo.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*eh(){yield aa(lo.loadSocialLoginsConfiguration,Yv),yield aa(lo.loadSocialLoginsConfigurationV2,Qv),yield aa(lo.loginViaSocialLogin,Xv),yield ia(lo.setSocialLoginError,Zv)}let th;function*nh({payload:e}){const{description:t,expires:n,callback:o}=e,{apiTokensDataUser:i}=yield di((e=>e.auth.apiTokensState));try{let e,a;yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield si(Bd.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield si(Bd.auth.updateUserApiTokensData,{description:t}),yield ai(lo.setApiTokensState({showAddTokenDialog:!1})),yield yi(200),yield ai(lo.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield ai(lo.setApiTokensError({key:th.ADD_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*oh({payload:e}){const{description:t,roleIds:n,expires:o,callback:i}=e,{apiTokensDataTenant:a}=yield di((e=>e.auth.apiTokensState));try{let e,r;yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield si(Bd.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield si(Bd.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield ai(lo.setApiTokensState({showAddTokenDialog:!1})),yield yi(200),yield ai(lo.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===o?e.clientId:void 0}})),yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield ai(lo.setApiTokensError({key:th.ADD_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*ih({payload:e}){const{apiTokensDataUser:t}=yield di((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!0})),n?(yield si(Bd.auth.deleteUserAccessToken,{id:e}),yield ai(lo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield si(Bd.auth.deleteUserApiToken,{tokenId:e}),yield ai(lo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!1}))}catch(e){yield ai(lo.setApiTokensError({key:th.DELETE_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!1}))}}function*ah({payload:e}){const{apiTokensDataTenant:t}=yield di((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let o=t;try{yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!0})),n?(yield si(Bd.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield si(Bd.auth.deleteTenantApiToken,{tokenId:e}),o=t.filter((t=>t.clientId!==e))),yield ai(lo.setApiTokensState({apiTokensDataTenant:o,deleteTokenDialog:{open:!1,id:e}})),yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!1}))}catch(e){yield ai(lo.setApiTokensError({key:th.DELETE_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!1}))}}function*rh({payload:e}){null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield ri([si(Bd.auth.getUserApiTokensData),si(Bd.auth.getTenantApiTokensData)]);yield ai(lo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setApiTokensError({key:th.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*lh({payload:e}){null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=si(Bd.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=si(Bd.auth.getUserAccessTokensData))?n:[]).accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield ai(lo.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield ai(lo.setApiTokensError({key:th.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*sh({payload:e}){null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=si(Bd.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=si(Bd.auth.getTenantAccessTokensData))?n:[],l=(null!=(o=null==r?void 0:r.accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield ai(lo.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield ai(lo.setApiTokensError({key:th.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*ch(){yield aa(lo.loadApiTokens,rh),yield aa(lo.loadUserApiTokens,lh),yield aa(lo.loadTenantApiTokens,sh),yield oa(lo.addUserApiToken,nh),yield oa(lo.addTenantApiToken,oh),yield ia(lo.deleteTenantApiToken,ah),yield ia(lo.deleteUserApiToken,ih)}function*uh({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield di((e=>e.auth.apiTokensState)),a=O({},ty,{description:t,roleIds:n,clientId:`CLIENT_ID_${jS()}`});yield ai(lo.setApiTokensState({showAddTokenDialog:!1})),yield yi(200),yield ai(lo.setApiTokensState({apiTokensDataTenant:[...i,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield yi(200),yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*dh({payload:e}){yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!0})),yield yi(200);const t=[ty];yield ai(lo.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!1}))}function*yh({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!0})));const n=[ey],o=[ty];yield ai(lo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield yi(200),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*fh({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!0})));const n=[ey];yield ai(lo.setApiTokensState({apiTokensDataUser:n})),yield yi(200),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*ph({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!0})));const n=[ty];yield ai(lo.setApiTokensState({apiTokensDataTenant:n})),yield yi(200),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*gh(){yield aa(lo.loadApiTokens,yh),yield aa(lo.loadUserApiTokens,fh),yield aa(lo.loadTenantApiTokens,ph),yield oa(lo.addTenantApiToken,uh),yield ia(lo.deleteTenantApiToken,dh)}function*Sh({payload:e}){try{var t;yield ai(lo.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield di((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield si(Bd.accountSettings.updateSettings,O({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield ai(lo.setAccountSettingsState(O({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield ai(lo.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*vh({payload:e}){yield ai(lo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield si(Bd.accountSettings.getSettings);yield ai(lo.setAccountSettingsState(O({},e,{loading:!1})))}catch(e){yield ai(lo.setAccountSettingsState({loading:!1,error:e.message}))}}function*hh(){yield aa(lo.saveAccountSettings,Sh),yield aa(lo.loadAccountSettings,vh)}function*mh({payload:e}){var t;yield ai(lo.setAccountSettingsState({loading:!0})),yield vt();const{accountSettingsState:n}=yield di((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=O({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield ai(lo.setAccountSettingsState(O({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*bh({payload:e}){yield ai(lo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield vt(),yield ai(lo.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Ah(){yield aa(lo.saveAccountSettings,mh),yield aa(lo.loadAccountSettings,bh)}function*kh({payload:{tenantId:e,callback:t}}){yield ai(lo.setState({isLoading:!0}));try{yield si(Bd.tenants.switchTenant,{tenantId:e}),yield si(Xf),(null==t?void 0:t(!0))||(yield ai(lo.setState({isLoading:!1})))}catch(e){yield ai(lo.setState({isLoading:!1})),null==t||t(!1,e)}}function*Th({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(Bd.tenants.getTenants);yield ai(lo.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 ai(lo.setTenantsState({loading:!1}))}}function*Ph({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(Bd.tenants.getSubTenants);yield ai(lo.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Ih({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(Bd.tenants.getSubTenantsAsTree);yield ai(lo.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Lh(){yield oa(lo.loadTenants,Th),yield oa(lo.loadSubTenants,Ph),yield oa(lo.switchTenant,kh),yield oa(lo.loadSubTenantsTree,Ih)}function*Eh(){yield ai(lo.setTenantsState({loading:!0})),yield vt(),yield ai(lo.setTenantsState({tenants:Ay,loading:!1}))}function*Oh(){yield oa(lo.loadTenants,Eh)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(th||(th={}));const wh=["callback"],Dh=["callback"],Ch=["callback"],Rh=["callback"],Uh=["callback"];function*_h({payload:e}){var t;yield ai(lo.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield ri([si(Bd.roles.getRoles),si(Bd.roles.getPermissions),si(Bd.roles.getPermissionCategories)]),[t,n,o]=e;yield ai(lo.setRolesState({roles:t,permissions:n,permissionCategories:o,loading:!1}))}catch(e){yield ai(lo.setRolesState({error:e.message,loading:!1}))}}function*Mh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,wh);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(Bd.roles.addRole,n),o=yield si(Bd.roles.getRoles);yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({roles:o,saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Nh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Dh);yield ai(lo.setRolesState({saving:!0}));try{yield si(Bd.roles.deleteRole,n),yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*Fh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Ch);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(Bd.roles.updateRole,n);yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*$h(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Rh);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(Bd.roles.attachPermissionsToRole,n);yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Gh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Uh);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(Bd.roles.attachPermissionToRoles,n);yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*xh(){yield aa(lo.loadRolesAndPermissions,_h),yield oa(lo.addRole,Mh),yield oa(lo.deleteRole,Nh),yield oa(lo.updateRole,Fh),yield oa(lo.attachPermissionsToRole,$h),yield oa(lo.attachPermissionToRoles,Gh)}function*Vh({payload:e}){var t;yield ai(lo.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield ai(lo.setRolesState({roles:ny,loading:!1}))}catch(e){yield ai(lo.setRolesState({error:e.message,loading:!1}))}}function*Wh(){yield aa(lo.loadRolesAndPermissions,Vh)}const jh=["callback"],Kh=["callback"],Bh=["callback"];function*zh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,jh);yield ai(lo.setResetPhoneNumberState({loading:!0}));try{const e=yield si(Bd.auth.resetPhoneNumber,n);yield ai(lo.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:zt.VerifyResetPhoneNumber})),yield ai(lo.setLoginState({email:n.email}))}catch(e){yield ai(lo.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*qh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Kh);yield ai(lo.setResetPhoneNumberState({loading:!0}));try{const e=yield si(Bd.auth.verifyResetPhoneNumber,n);yield ai(lo.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:zt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield ai(lo.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Hh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Bh);yield ai(lo.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:o}=yield di((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield si(Bd.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield ai(lo.setLoginState({step:kt.loginWithSmsOtc})),yield ai(lo.passwordlessPreLogin({type:Lr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(o.loginUrl),yield ai(lo.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Jh(){yield aa(lo.resetPhoneNumber,zh),yield aa(lo.verifyResetPhoneNumber,qh),yield aa(lo.changePhoneNumber,Hh)}function*Yh(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getCurrentUserSessions);yield ai(lo.setSessionsState({sessions:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*Qh(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getCurrentUserSession);yield ai(lo.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*Xh({payload:{id:e}}){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(Bd.auth.deleteSessionForUser,e),yield ai(lo.loadUserSessions())}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*Zh({payload:{callback:e,userId:t}}){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(Bd.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield ai(lo.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*em(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(Bd.auth.deleteAllSessionsForUser),yield ai(lo.loadUserSessions())}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*tm(){yield ia(lo.loadUserSessions,Yh),yield ia(lo.deleteUserSession,Xh),yield ia(lo.deleteAllUserSessions,em),yield ia(lo.loadCurrentUserSession,Qh),yield oa(lo.revokeUserSessions,Zh)}function*nm(){yield ai(lo.setSessionsState({loading:!0,error:null})),yield ai(lo.setSessionsState({sessions:ky,loading:!1}))}function*om({payload:{id:e}}){yield ai(lo.setSessionsState({loading:!0,error:null}));const t=(yield di((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield ai(lo.setSessionsState({sessions:t,loading:!1}))}function*im(){yield ai(lo.setSessionsState({loading:!0,error:null}));const e=ky.filter((e=>e.current));yield ai(lo.setSessionsState({sessions:e,loading:!1}))}function*am(){yield ia(lo.loadUserSessions,nm),yield ia(lo.deleteUserSession,om),yield ia(lo.deleteAllUserSessions,im)}const rm=["callback"],lm=["callback"];function*sm(){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getSessionConfigurations);yield ai(lo.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*cm({payload:e}){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ao(e,rm);yield si(Bd.auth.createOrUpdateSessionConfigrations,n),yield ai(lo.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield ai(lo.setSessionsPolicyState({error:e,loading:!1}))}}function*um(){yield aa(lo.loadSessionsPolicy,sm),yield ia(lo.createOrUpdateSessionsPolicy,cm)}function*dm(){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));const e=yield di((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Ty}));yield ai(lo.setSessionsPolicyState(O({},e,{loading:!1})))}function*ym({payload:e}){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ao(e,lm);null==t||t(!0),yield ai(lo.setSessionsPolicyState({configurations:n,loading:!1}))}function*fm(){yield aa(lo.loadSessionsPolicy,dm),yield ia(lo.createOrUpdateSessionsPolicy,ym)}const pm=["callback"],gm=["callback"],Sm=["callback"],vm=["callback"],hm=["callback"],mm=["callback"],bm=["callback"],Am=["callback"],km=()=>di((e=>e.auth.restrictionsState.ipRestrictions)),Tm=()=>di((e=>e.auth.restrictionsState.emailDomainRestrictions));function*Pm(){yield ai(lo.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getDomainRestrictionsConfig),t=(yield si(Bd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ai(lo.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield ai(lo.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*Im(e){let{payload:{callback:t}}=e,n=Ao(e.payload,pm);yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield Tm();try{var i;yield si(Bd.auth.createDomainRestriction,n);const e=(yield si(Bd.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=o.data)?void 0:t.config.listType)}));yield ai(lo.setEmailDomainRestrictionsState({data:{config:(null==(i=o.data)?void 0:i.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Lm(e){let{payload:{callback:t}}=e,n=Ao(e.payload,gm);yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield si(Bd.auth.updateDomainRestrictionConfig,n),o=(yield si(Bd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ai(lo.setEmailDomainRestrictionsState({data:{config:e,restrictions:o},saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Em({payload:{id:e}}){yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Tm();try{var n;yield si(Bd.auth.deleteDomainRestriction,e);const o=(yield si(Bd.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield ai(lo.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:$n.ALLOW},restrictions:o},saving:!1}))}catch(e){yield ai(lo.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Om=e=>{var t,n,o;return{_filter:null!=(t=null==e?void 0:e._filter)?t:$n.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(o=null==e?void 0:e._offset)?o:0}};function*wm(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield km(),t=yield si(Bd.auth.getIPRestrictionsConfig),n=Om({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield si(Bd.auth.getIPRestrictions,n);yield ai(lo.setIpRestrictionsState({data:{restrictions:o,config:t},totalPages:i,pagination:n,loading:!1}))}catch(e){yield ai(lo.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Dm(){try{const{valid:e}=yield si(Bd.auth.testCurrentIpInAllowList);yield ai(lo.setIpRestrictionsState({userIpValid:e}))}catch(e){yield ai(lo.setIpRestrictionsState({error:e.message}))}}function*Cm({payload:{callback:e}}){yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield di((e=>e.auth.userIp));yield ri([si(Bd.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:$n.ALLOW}),si(Bd.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield km(),o=Om(n.pagination),{items:i,_metadata:{totalPages:a}}=yield si(Bd.auth.getIPRestrictions,o);yield ai(lo.setIpRestrictionsState({data:{config:{isActive:!0,strategy:$n.ALLOW},restrictions:i},userIpValid:!0,pagination:o,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield ai(lo.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Rm(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Sm);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const o=yield km();try{var i,a;yield si(Bd.auth.createIPRestriction,n);const e=yield km(),r=Om(e.pagination),{items:l,_metadata:{totalPages:s}}=yield si(Bd.auth.getIPRestrictions,r);yield Dm(),yield ai(lo.setIpRestrictionsState({data:{config:null!=(i=null==(a=o.data)?void 0:a.config)?i:{isActive:!1,strategy:$n.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Um(e){let{payload:{callback:t}}=e,n=Ao(e.payload,vm);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));try{yield si(Bd.auth.updateIPRestrictionConfig,n);const e=yield km(),o=yield si(Bd.auth.getIPRestrictionsConfig),i=Om(O({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield si(Bd.auth.getIPRestrictions,i);yield Dm(),yield ai(lo.setIpRestrictionsState({data:{config:o,restrictions:a},pagination:i,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*_m({payload:{id:e,callback:t}}){yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const n=yield km();try{var o;yield si(Bd.auth.deleteIPRestriction,e);const i=yield km(),a=Om(i.pagination),{items:r,_metadata:{totalPages:l}}=yield si(Bd.auth.getIPRestrictions,a);yield Dm(),yield ai(lo.setIpRestrictionsState({data:{config:(null==(o=n.data)?void 0:o.config)||{isActive:!1,strategy:$n.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Mm(){yield aa(lo.loadIpRestrictions,wm),yield aa(lo.loadEmailDomainRestrictions,Pm),yield oa(lo.saveIpRestriction,Rm),yield oa(lo.saveIpRestrictionsConfig,Um),yield oa(lo.deleteIpRestriction,_m),yield oa(lo.checkIfUserIpValid,Dm),yield oa(lo.addCurrentUserIpAndActivate,Cm),yield oa(lo.saveEmailDomainRestriction,Im),yield oa(lo.saveEmailDomainRestrictionsConfig,Lm),yield oa(lo.deleteEmailDomainRestriction,Em)}function*Nm(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null})),yield ai(lo.setIpRestrictionsState({data:{restrictions:Iy.filter((e=>e.strategy===Py.strategy)),config:Py},totalPages:1,pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Fm(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield km(),t=Iy[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield ai(lo.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield ai(lo.setIpRestrictionsState({error:e.message,loading:!1}))}}function*$m(e){var t,n,o;let{payload:{callback:i}}=e,a=Ao(e.payload,hm);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const r=yield km(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield ai(lo.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:$n.ALLOW},restrictions:[...l,O({},a,{createdAt:new Date,updatedAt:new Date,id:jS(),isActive:null==(o=a.isActive)||o,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*Gm(e){var t,n,o;let{payload:{callback:i}}=e,a=Ao(e.payload,mm);const r=yield km();yield ai(lo.setIpRestrictionsState({saving:!0,error:null})),yield ai(lo.setIpRestrictionsState({data:{config:O({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(o=r.data)?void 0:o.restrictions)?n:[]},pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield ai(lo.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*xm({payload:{id:e,callback:t}}){var n;yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const o=yield km();yield ai(lo.setIpRestrictionsState({data:{config:(null==(n=o.data)?void 0:n.config)||{isActive:!1,strategy:$n.ALLOW},restrictions:o.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*Vm(){yield ai(lo.setEmailDomainRestrictionsState({loading:!0,error:null})),yield ai(lo.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:$n.ALLOW}],config:{active:!0,listType:$n.ALLOW,blockPublicDomains:!1}}}))}function*Wm(e){var t,n;let{payload:{callback:o}}=e,i=Ao(e.payload,bm);const a=yield Tm();yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield vt(),null==o||o(!0),yield ai(lo.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:i.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],O({},i,{id:Date.now().toString()})]},saving:!1}))}function*jm(e){var t;let{payload:{callback:n}}=e,o=Ao(e.payload,Am);const i=yield Tm();yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield vt(),null==n||n(!0),yield ai(lo.setEmailDomainRestrictionsState({data:{config:{active:o.active,blockPublicDomains:o.blockPublicDomains||!1,listType:o.type||$n.ALLOW},restrictions:[...(null==(t=i.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*Km({payload:{id:e}}){var t,n;const o=yield Tm();yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield vt(),yield ai(lo.setEmailDomainRestrictionsState({data:{config:(null==(t=o.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:$n.ALLOW},restrictions:((null==(n=o.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*Bm(){yield aa(lo.loadIpRestrictions,Nm),yield aa(lo.loadEmailDomainRestrictions,Vm),yield oa(lo.saveIpRestriction,$m),yield oa(lo.saveIpRestrictionsConfig,Gm),yield oa(lo.deleteIpRestriction,xm),yield oa(lo.checkIfUserIpValid,Fm),yield oa(lo.saveEmailDomainRestriction,Wm),yield oa(lo.saveEmailDomainRestrictionsConfig,jm),yield oa(lo.deleteEmailDomainRestriction,Km)}const zm=["callback"],qm=["id"];function*Hm(e){const{count:t}=yield si(Bd.directory.countConfigurationUsers,e.id);return O({},e,{count:t})}function*Jm(){yield ai(lo.setProvisioningState({loading:!0,error:null}));try{const e=yield si(Bd.directory.getConfigs),t=yield ri(e.map((e=>Hm(e))));yield ai(lo.setProvisioningState({connections:t,loading:!1}))}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1}))}}function*Ym(e){let{payload:{callback:t}}=e,n=Ao(e.payload,zm);yield ai(lo.setProvisioningState({loading:!0,error:null}));try{const e=yield si(Bd.directory.createConfiguration,n),o=yield si(Bd.directory.getConfigs),i=yield ri(o.map((e=>Hm(e))));yield ai(lo.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1}))}}function*Qm(e){let{payload:{id:t}}=e,n=Ao(e.payload,qm);yield ai(lo.setProvisioningState({loading:!0,error:null}));try{yield si(Bd.directory.updateConfiguration,t,n);const e=yield si(Bd.directory.getConfigs),o=yield ri(e.map((e=>Hm(e))));yield ai(lo.setProvisioningState({connections:o,loading:!1}))}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1}))}}function*Xm({payload:{id:e,callback:t}}){yield ai(lo.setProvisioningState({loading:!0,error:null}));try{yield si(Bd.directory.deleteConfiguration,e);const n=yield si(Bd.directory.getConfigs),o=yield ri(n.map((e=>Hm(e))));yield ai(lo.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*Zm(){yield aa(lo.loadProvisionConnections,Jm),yield oa(lo.createProvisionConnection,Ym),yield oa(lo.deleteProvisionConnection,Xm),yield oa(lo.updateProvisionConnection,Qm)}const eb=["callback","events"];function*tb(e){let{payload:{callback:t}}=e,n=Ao(e.payload,eb);yield ai(lo.setImpersonateState({loading:!0}));try{yield si(Bd.impersonate.impersonate,n),yield ai(lo.setImpersonateState({step:to.success})),yield yi(1e3),yield Kf(),yield ai(lo.resetImpersonateState()),null==t||t(!0)}catch(e){yield ai(lo.setImpersonateState({loading:!1,error:e.message}))}}function*nb(){yield aa(lo.impersonate,tb)}function*ob({payload:e}){const{callback:t,deviceId:n}=e;yield ai(lo.setPasskeysState({loading:!0}));try{yield si(Bd.auth.deleteWebAuthnDevice,n);const{devices:e}=yield di((e=>e.auth.passkeysState)),o=e.filter((e=>e.id!==n));yield ai(lo.setPasskeysState({devices:o,loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setPasskeysState({loading:!1,error:e.message||null})),null==t||t(null,e.message)}}function*ib(){yield ai(lo.setPasskeysState({loading:!0}));try{const{devices:e}=yield si(Bd.auth.getWebAuthnDevices);yield ai(lo.setPasskeysState({devices:e,loading:!1}))}catch(e){yield ai(lo.setPasskeysState({loading:!1,error:e.message||null}))}}function*ab(){yield oa(lo.loadWebAuthnDevices,ib),yield oa(lo.deleteWebAuthnDevice,ob)}let rb,lb;!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"}(rb||(rb={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(lb||(lb={}));const sb=["roleIds","userIds"],cb=()=>di((e=>e.auth.groupsState));function*ub({payload:e}){const t=rb.GET_TEAM_USERS;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield si(Bd.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield ai(lo.setGroupsState({teamUsers:n}))}catch(e){yield ai(lo.setUsersGroupsError({key:t,value:e.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*db({payload:e}){const t=rb.GET_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield si(Bd.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:lb.rolesAndUsers});yield ai(lo.setGroupsState({selectedGroup:n}))}catch(e){yield ai(lo.setUsersGroupsError({key:t,value:e.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*yb(){const e=rb.GET_GROUPS,t=yield cb();yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield si(Bd.groups.getGroups,{_groupsRelations:lb.rolesAndUsers});yield ai(lo.setGroupsState(O({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield ai(lo.setUsersGroupsError({key:e,value:t.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:e,value:!1}))}}function*fb({payload:e}){const t=rb.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Ao(e,sb);yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield si(Bd.groups.createGroup,O({name:i.name},!!i.description&&{description:i.description},{color:i.color}));null!=o&&o.length&&(yield ai(lo.addUsersToGroup({groupId:r.id,userIds:o}))),null!=n&&n.length&&(yield ai(lo.addRolesToGroup({groupId:r.id,roleIds:n}))),yield ai(lo.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*pb({payload:e}){const t=rb.UPDATE_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(Bd.groups.updateGroup,e),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*gb({payload:e}){const t=rb.DELETE_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(Bd.groups.deleteGroup,e.groupId),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1,n.message)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*Sb({payload:e}){const t=rb.ADD_ROLES_TO_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(Bd.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*vb({payload:e}){const t=rb.DELETE_ROLES_FROM_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(Bd.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*hb({payload:e}){const t=rb.ADD_USERS_TO_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(Bd.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;null==e||null==(o=e.callback)||o.call(e,!1),yield ai(lo.setUsersGroupsError({key:t,value:n.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*mb({payload:e}){const t=rb.DELETE_USERS_FROM_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(Bd.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*bb(){const e=rb.GET_GROUP_CONFIGURATION;yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield si(Bd.groups.getGroupConfiguration);yield ai(lo.setGroupsState({groupsConfiguration:t}))}catch(t){yield ai(lo.setUsersGroupsError({key:e,value:t.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:e,value:!1}))}}function*Ab({payload:e}){const t=rb.UPDATE_GROUP_CONFIGURATION;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{yield si(Bd.groups.updateGroupConfiguration,e),yield ai(lo.getGroupConfiguration())}catch(e){yield ai(lo.setUsersGroupsError({key:t,value:e.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*kb(){yield ia(lo.loadGroups,yb),yield ia(lo.getGroupById,db),yield ia(lo.createGroup,fb),yield ia(lo.updateGroup,pb),yield ia(lo.deleteGroup,gb),yield ia(lo.addRolesToGroup,Sb),yield ia(lo.deleteRolesFromGroup,vb),yield ia(lo.addUsersToGroup,hb),yield ia(lo.deleteUsersFromGroup,mb),yield ia(lo.getGroupConfiguration,bb),yield ia(lo.updateGroupConfiguration,Ab),yield ia(lo.getTeamUsers,ub)}function*Tb(){const e=rb.GET_GROUPS;yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));const t=Oy;yield ai(lo.setGroupsState({groups:t})),yield ai(lo.setUsersGroupsLoader({key:e,value:!1}))}function*Pb({payload:e}){var t;const n=rb.CREATE_GROUP,{groups:o}=yield cb();yield ai(lo.setUsersGroupsLoader({key:n,value:!0})),yield ai(lo.setGroupsState({groups:[O({},e,{id:`${e.name}ID`}),...null!=o?o:[]]})),yield yi(500),null==e||null==(t=e.callback)||t.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:n,value:!1}))}function*Ib({payload:e}){var t,n,o,i,a;const r=rb.UPDATE_GROUP,l=yield cb();yield ai(lo.setUsersGroupsLoader({key:r,value:!0})),yield ai(lo.setGroupsState({groups:null==l||null==(t=l.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:""}):t})),selectedGroup:O({},null==l?void 0:l.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(o=null==e?void 0:e.color)?o:"",description:null!=(i=null==e?void 0:e.description)?i:""})})),yield yi(500),null==e||null==(a=e.callback)||a.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:r,value:!1}))}function*Lb({payload:e}){var t,n;const o=rb.DELETE_GROUP,i=yield cb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*Eb({payload:e}){var t,n;const o=rb.ADD_ROLES_TO_GROUP,i=yield cb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*Ob({payload:e}){var t,n;const o=rb.DELETE_ROLES_FROM_GROUP,i=yield cb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*wb({payload:e}){var t,n;const o=rb.ADD_USERS_TO_GROUP,i=yield cb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*Db({payload:e}){var t,n;const o=rb.DELETE_USERS_FROM_GROUP,i=yield cb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*Cb(){const e=rb.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield cb();yield ai(lo.setUsersGroupsLoader({key:e,value:!0})),t&&(yield ai(lo.setGroupsState({groupsConfiguration:O({},t)}))),yield ai(lo.setUsersGroupsLoader({key:e,value:!1}))}function*Rb({payload:e}){const t=rb.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield cb();yield ai(lo.setUsersGroupsLoader({key:t,value:!0})),n&&(yield ai(lo.setGroupsState({groupsConfiguration:O({},n,e)}))),yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}function*Ub(){yield ia(lo.loadGroups,Tb),yield ia(lo.createGroup,Pb),yield ia(lo.updateGroup,Ib),yield ia(lo.deleteGroup,Lb),yield ia(lo.addRolesToGroup,Eb),yield ia(lo.deleteRolesFromGroup,Ob),yield ia(lo.addUsersToGroup,wb),yield ia(lo.deleteUsersFromGroup,Db),yield ia(lo.getGroupConfiguration,Cb),yield ia(lo.updateGroupConfiguration,Rb)}var _b={sagas:function*(){yield ri([si(xp),si(US),si(MS),si(PS),si(Jh),si(ng),si(Eg),si(Ug),si(uS),si(_v),si(kb),si(eh),si(Ny),si(ch),si(df),si(hh),si(Lh),si(xh),si(tm),si(um),si(Mm),si(Zm),si(nb),si(ab)])},mockSagas:function*(){yield ri([si(jp),si(cg),si(Fg),si(mS),si(qv),si(gh),si(Pf),si(am),si(Ah),si(Oh),si(fm),si(Bm),si(Wh),si(Ub)])},storeName:Et,initialState:eo,reducer:ao,actions:lo};const Mb=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>O({},t,{[e]:O({},t[e],n)})}),Nb={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Fb={setAuditLogsState:Mb("auditLogsState"),resetAuditLogsState:e=>O({},e,{auditLogsState:Nb})},$b={exportAuditsCsv:rt("auditLogs/exportAuditsCsv"),loadAuditLogs:rt("auditLogs/loadAuditLogs",(e=>({payload:e})))},Gb={loading:!0},xb={setAuditsMetadataState:Mb("auditsMetadataState"),resetAuditsMetadataState:e=>O({},e,{auditsMetadataState:Gb})},Vb={loadAuditsMetadata:rt("auditLogs/loadAuditsMetadata")},Wb={auditLogsState:Nb,auditsMetadataState:Gb},{reducer:jb,actions:Kb}=st({name:wt,initialState:Wb,reducers:O({resetState:e=>O({},e,Wb),setState:(e,{payload:t})=>O({},e,t)},Fb,xb)}),Bb=O({},Kb,$b,Vb),zb=e=>"createdAt"!==e.id,qb={total:20,data:Array.from(Array(5).keys()).map((e=>O({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`})))},Hb={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}]},Jb=()=>di((e=>e.auditLogs.auditLogsState)),Yb=()=>di((e=>e.auditLogs.auditsMetadataState));function*Qb(){const e=yield Jb(),{columns:t}=yield Yb();try{const n=e.filter,o=e.sort.reduce(((e,t)=>O({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),i=n.reduce(((e,t)=>O({},e,{[t.id]:t.value})),{});yield ai(Bb.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Bd.audits.exportAudits(O({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},o,i))}catch(e){console.error("failed to export audits - ",e)}yield ai(Bb.setAuditLogsState({isDownloadingCsv:!1}))}function*Xb({payload:e}){yield ai(Bb.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Jb(),{columns:n}=yield Yb();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield ai(Bb.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>O({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>O({},e,{[t.id]:t.value})),{});n||(yield ai(Bb.loadAuditsMetadata()));const{data:p,total:g}=yield si(Bd.audits.getAudits,O({offset:c,count:s},y,f));yield ai(Bb.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield ai(Bb.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Zb(){yield oa(Bb.exportAuditsCsv,Qb),yield oa(Bb.loadAuditLogs,Xb)}function*eA({payload:e}){yield ai(Bb.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Jb(),{columns:n}=yield Yb();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield ai(Bb.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield ai(Bb.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=qb;let o=n.filter((e=>t=>e.filter(zb).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];o=o.sort(((e,t)=>(n,o)=>n[e]>o[e]?t?-1:1:o[e]>n[e]?t?1:-1:0)(e,n))}return{data:o,total:o.length}})(u,d);yield ai(Bb.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield ai(Bb.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*tA(){yield oa(Bb.loadAuditLogs,eA)}function*nA(){yield ai(Bb.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield si(Bd.metadata.getAuditsMetadata);yield ai(Bb.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ai(Bb.setAuditsMetadataState({error:e,loading:!1}))}}function*oA(){yield oa(Bb.loadAuditsMetadata,nA)}function*iA(){yield ai(Bb.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Hb;yield ai(Bb.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ai(Bb.setAuditsMetadataState({error:e,loading:!1}))}}function*aA(){yield oa(Bb.loadAuditsMetadata,iA)}var rA={sagas:function*(){yield ri([si(Zb),si(oA)])},mockSagas:function*(){yield ri([si(tA),si(aA)])},storeName:wt,initialState:Wb,reducer:jb,actions:Bb};const lA={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:sA,actions:cA,reducer:uA}=st({name:"audits",initialState:lA,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=O({},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]})))}}}),dA=O({},cA,{initData:rt(`${sA}/initData`),loadAudits:rt(`${sA}/loadAudits`),removeFilter:rt(`${sA}/removeFilter`),filterData:rt(`${sA}/filterData`),exportCSV:rt(`${sA}/exportCSV`),deleteAudits:rt(`${sA}/deleteAudits`)}),yA=()=>di((e=>e[sA]));function*fA(){const{sortBy:e,sortDirection:t}=yield yA();try{const n=yield si(Bd.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield ai(dA.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield ai(dA.loadItemFailedAction(t))}}function*pA(){try{const e=yield si(Bd.metadata.getAuditsMetadata);yield ai(dA.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield ai(dA.loadItemFailedAction(t))}}const gA=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*SA({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield yA(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield yA():{rowsData:[]};try{const e=gA(t),{data:l,total:d}=yield si(Bd.audits.getAudits,O({},r&&{paginationMode:"virtual"},{sortDirection:o,sortBy:n,filter:i},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield ai(dA.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield ai(dA.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield ai(dA.loadItemFailedAction(t))}}function*vA(){yield ai(dA.startLoading()),yield ri([fA(),pA(),SA({payload:{onlyOneLoad:!1},type:""})]),yield ai(dA.finishLoading())}function*hA({payload:e}){const{filters:t}=yield yA(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield ai(dA.setFilterData(o))}function*mA({payload:e}){const{filters:t}=yield yA();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const o=[...t.slice(0,n),e,...t.slice(n+1)];yield ai(dA.setFilterData(o))}function*bA(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield yA(),a=gA(e);yield ai(dA.startDownloadingCsv());try{yield Bd.audits.exportAudits(O({endpoint:"csv/v2",headerProps:i,sortDirection:n,sortBy:t,filter:o},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield ai(dA.stopDownloadingCsv())}}function*AA(){yield ia(dA.initData,vA),yield ia(dA.removeFilter,hA),yield ia(dA.filterData,mA),yield ia([dA.loadAudits,dA.textSearch,dA.onPageChange],SA),yield ia([dA.setFilterData,dA.setDataSorting,dA.startRefresh],(()=>SA({payload:{appendMode:!1},type:""}))),yield ia(dA.exportCSV,bA)}const kA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},TA={initData:()=>O({},kA),setConnectivityState:(e,{payload:t})=>O({},e,t),cleanWebhookTestData:e=>O({},e,{testResult:void 0}),cleanWebhookLogsData:e=>O({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return O({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>O({},e,{error:void 0}),cleanSlackData:e=>O({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>O({},e,{retryResult:O({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>O({},e,{retryResult:O({},e.retryResult,t)})}},PA={loadSlackActions:rt("connectivity/loadSlackActions"),loadDataAction:rt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:rt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:rt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:rt("connectivity/loadScope"),deleteWebhookConfigAction:rt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:rt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:rt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},IA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:LA,actions:EA}=st({name:Ot,initialState:IA,reducers:O({},TA)}),OA=O({},EA,PA),wA={slack:Bd.connectivity.getSlackConfiguration,email:Bd.connectivity.getEmailConfiguration,sms:Bd.connectivity.getSMSConfiguration,webhook:Bd.connectivity.getWebhooksConfigurations,categories:Bd.connectivity.getCategories,channelMap:Bd.connectivity.getChannelMaps},DA={slack:Bd.connectivity.postSlackConfiguration,email:Bd.connectivity.postEmailConfiguration,sms:Bd.connectivity.postSMSConfiguration,webhook:Bd.connectivity.postWebhooksConfiguration},CA=["email","slack","sms","webhook"],RA={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"}},UA=["id"],_A=["id","enabled"],MA=["categories","channelMap"];function*NA(e){return yield si($A,{payload:{api:e},type:""})}function*FA({payload:e=CA}){yield ai(OA.setConnectivityState({isLoading:!0}));try{const t=yield ri([...e.map(NA),yield $A({payload:{api:"categories"},type:""}),yield function*(){return(yield ri(e.map((function*(e){return yield $A({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>O({},t,{[`${e[o]}`]:n})),{})}()]),n=yield $A({payload:{api:"webhook"},type:""}),o=t.reduce(((n,o,i)=>e[i]?t[t.length-1][e[i]].length?O({},n,{[`${e[i]}`]:o,list:[...n.list,{id:i,key:e[i],events:RA[e[i]].events(o),active:RA[e[i]].isActive(o),platform:RA[e[i]].title,image:RA[e[i]].image}]}):n:O({},n,{[`${MA[i-e.length]}`]:o})),{list:[],webhook:n});yield ai(OA.setConnectivityState(O({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield ai(OA.setConnectivityState({isLoading:!1}))}}function*$A({payload:{api:e,params:t}}){try{return yield si(wA[e],t)}catch(e){return}}function*GA(){try{yield ai(OA.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield si(Bd.connectivity.getSlackChannels);yield ai(OA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield ai(OA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*xA(e,t){const{connectivity:{list:n}}=yield di(),o=n.find((({key:t})=>t===e));if(!o)return;const i=RA[e].isActive(t);i!==o.active&&(yield ai(OA.setConnectivityState({list:n.map((t=>t.key===e?O({},t,{active:i}):t))})))}function*VA({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield di((e=>e.connectivity));try{if(yield ai(OA.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...o]:o})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield di();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:o}=e;yield ri([...o.reduce(((e,t)=>{var o,i;return!t.id&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length||(null==n?void 0:n.find((e=>{let{id:n}=e,o=Ao(e,UA);return n===t.id&&JSON.stringify(O({id:n},o))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length?[...e,t]:e}),[]).map((function*(e){return yield si(DA.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield si(Bd.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield di(),{processIds:o}=yield di((e=>e.connectivity)),i=n[t];if(!i)return;let a=[];try{a=yield ri([...e.reduce(((e,t)=>!i.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield si("email"===t?Bd.connectivity.postEmailConfiguration:Bd.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:o}=e,i=n[0],{id:a="",enabled:r}=i,l=Ao(i,_A);return yield ri([yield si("email"===t?Bd.connectivity.patchEmailConfiguration:Bd.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield si("email"===t?Bd.connectivity.putEmailSubscriptions:Bd.connectivity.putSMSSubscriptions,a,o,O({},l,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return si("email"===t?Bd.connectivity.deleteEmailSubscriptions:Bd.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield $A({payload:{api:t},type:""});yield ai(OA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield xA(t,e)}else yield ai(OA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield si(DA[e],t),!["sms","email"].includes(e)){const i=yield $A({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield ai(OA.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield xA(e,i),null==n||n(!0)}}catch(e){var i;yield ai(OA.setConnectivityState({error:null!=(i=e.message)?i:e.toString(),isSaving:!1,isLoading:!1}))}}function*WA({payload:e}){try{yield Bd.connectivity.postSlackCode(e)}catch{}yield ai(OA.setConnectivityState({error:void 0,isSaving:!1}))}function*jA(){const{slackChannels:e}=yield di((e=>e.connectivity));try{yield ai(OA.setConnectivityState({slackChannels:O({},e,{isLoadingScope:!0})}));const{clientId:t}=yield si(Bd.connectivity.getSlackScope);yield ai(OA.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield ai(OA.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*KA({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield di((e=>e.connectivity));try{yield ai(OA.setConnectivityState({isSaving:!0})),yield si(Bd.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const i=yield $A({payload:{api:"webhook"},type:""});i&&(yield ai(OA.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*BA({payload:e}){try{yield ai(OA.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield si(Bd.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield ai(OA.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield ai(OA.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield ai(OA.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*zA({payload:e}){try{const{statusCode:t}=yield si(Bd.connectivity.postWebhookRetry,e);yield ai(OA.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield ai(OA.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*qA({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield di((e=>e.connectivity));try{yield ai(OA.setConnectivityState({webhookLogs:O({},o,{isLoading:!0})}));const i=yield si(Bd.connectivity.getWebhookLog,e,n,t);yield ai(OA.setConnectivityState({error:void 0,webhookLogs:O({isLoading:!1},i)}))}catch(e){yield ai(OA.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var HA={sagas:function*(){yield oa(OA.loadDataAction,FA),yield ia(OA.loadSlackActions,GA),yield oa(OA.postDataAction,VA),yield oa(OA.postCodeAction,WA),yield oa(OA.loadScope,jA),yield oa(OA.deleteWebhookConfigAction,KA),yield oa(OA.postWebhookTestAction,BA),yield oa(OA.postWebhookRetryAction,zA),yield ia(OA.loadWebhookLogsAction,qA)},storeName:Ot,initialState:IA,reducer:LA,actions:OA};function JA(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,t.payload)}}}function YA(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>O({},n,{[e]:t(n[e],o)})}}function QA(e){return YA(e,((e,t)=>O({},e,{loading:t.payload})))}function XA(e){return YA(e,((e,t)=>O({},e,{error:t.payload,loading:!1})))}const ZA={loading:!1,error:null,fetching:!0,plans:[]},{actions:ek,reducer:tk,name:nk}=st({name:"subscriptions/plans",initialState:ZA,reducers:O({},JA())}),ok=O({loadPlans:rt(`${nk}/loadPlans`)},ek),ik={loading:!1,error:null,fetching:!0,config:null},ak=O({},JA()),{actions:rk,reducer:lk,name:sk}=st({name:"subscriptions/config",initialState:ik,reducers:ak}),ck=O({loadPaymentConfiguration:rt(`${sk}/loadPaymentConfiguration`)},rk),uk={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},dk=O({},JA(),{setCancellationLoading:QA("cancellation"),setCancellationError:XA("cancellation"),setRenewalLoading:QA("renewal"),setRenewalError:XA("renewal")}),{reducer:yk,actions:fk,name:pk}=st({name:"subscriptions/billing/subscription",initialState:uk,reducers:dk}),gk=O({load:rt(`${pk}/loadSubscription`),cancelSubscription:rt(`${pk}/cancelSubscription`),renewSubscription:rt(`${pk}/renewSubscription`)},fk),Sk={loading:!1,error:null,fetching:!0},vk=O({},JA()),{reducer:hk,actions:mk,name:bk}=st({name:"subscriptions/billing/information",initialState:Sk,reducers:vk}),Ak=O({loadBillingInformation:rt(`${bk}/loadBillingInformation`),cancelSubscription:gk.cancelSubscription,renewSubscription:gk.renewSubscription},mk),kk={loading:!1,error:null,fetching:!0},Tk=O({},JA(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,t.payload)}}),{reducer:Pk,actions:Ik,name:Lk}=st({name:"subscriptions/billing/payment",initialState:kk,reducers:Tk}),Ek=O({loadPaymentMethod:rt(`${Lk}/loadPaymentMethod`),submitPaymentMethod:rt(`${Lk}/submitPaymentMethod`),submitPaymentMethodError:rt(`${Lk}/submitPaymentMethodError`),submitPaymentMethodSuccess:rt(`${Lk}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:rt(`${Lk}/updateBillingDetails`,(e=>({payload:e})))},Ik),Ok={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},wk=O({},JA(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,{invoiceDownload:O({},e.invoiceDownload,t.payload)})}}),{reducer:Dk,actions:Ck,name:Rk}=st({name:"subscriptions/billing/invoices",initialState:Ok,reducers:wk}),Uk=O({loadInvoices:rt(`${Rk}/loadInvoices`),downloadInvoice:rt(`${Rk}/downloadInvoice`,(e=>({payload:e})))},Ck),_k={information:Sk,invoices:Ok,paymentMethod:kk,subscription:uk},Mk={invoices:Uk,information:Ak,paymentMethod:Ek,subscription:gk},Nk=xe({invoices:Dk,information:hk,paymentMethod:Pk,subscription:yk}),Fk={fetching:!0,loading:!1,error:null,confirmed:!1},$k=O({},JA()),{actions:Gk,reducer:xk,name:Vk}=st({name:"subscriptions/checkout",initialState:Fk,reducers:$k}),Wk=O({loadCheckout:rt(`${Vk}/loadCheckout`),resetCheckout:rt(`${Vk}/resetCheckout`),submitCheckout:rt(`${Vk}/submitCheckout`),confirmCheckout:rt(`${Vk}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:rt(`${Vk}/errorCheckout`,(e=>({payload:e})))},Gk),jk={loading:!1,error:null,cardSetupIntentSecret:null},Kk=O({},JA()),{reducer:Bk,actions:zk,name:qk}=st({name:"subscriptions/stripe",initialState:jk,reducers:Kk}),Hk=O({loadCustomer:rt(`${qk}/loadCustomer`),createCardSetupIntentSecret:rt(`${qk}/createCardSetupIntentSecret`)},zk),Jk={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:Yk,reducer:Qk,name:Xk}=st({name:"subscriptions/vendorPublicConfig",initialState:Jk,reducers:O({},JA())}),Zk=O({loadVendorPublicConfiguration:rt(`${Xk}/loadVendorPublicConfiguration`)},Yk),eT={config:ik,plans:ZA,checkout:Fk,billing:_k,stripe:jk,vendorPublicConfig:Jk},tT={config:ck,billing:Mk,plans:ok,checkout:Wk,stripe:Hk,vendorPublicConfig:Zk},nT=xe({config:lk,billing:Nk,plans:tk,checkout:xk,stripe:Bk,vendorPublicConfig:Qk});let oT,iT,aT;function rT({policy:e}){return{policy:aT.AT_PERIOD_END}}function lT(e){switch(e){case Zu.ACTIVE:return iT.ACTIVE;case Zu.INCOMPLETE:return iT.INCOMPLETE;case Zu.CANCELED:return iT.CANCELED;case Zu.EXPIRED:return iT.EXPIRED;case Zu.TRIALING:return iT.TRIALING;default:return iT.EXPIRED}}!function(e){e.STRIPE="Stripe"}(oT||(oT={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(iT||(iT={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(aT||(aT={}));const sT={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Zu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},cT=[{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"}],uT=[{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:""}],dT=[{id:"id",externalId:"externalId",type:ed.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],yT={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*fT(){yield oa(gk.load,pT),yield oa(gk.cancelSubscription,ST),yield oa(gk.renewSubscription,vT)}function*pT(){const e=yield di((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield kT(e)}function*gT(){yield ai(gk.setLoading(!0));try{const[e]=yield si(Bd.subscriptions.getManagedSubscriptions);yield ai(gk.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield ai(gk.setError(e))}}function*ST(){const{subscription:e}=yield di((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ai(gk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ai(gk.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===Zu.ACTIVE)try{yield ai(gk.setCancellationLoading(!0)),yield si(Bd.subscriptions.cancelManagedSubscription,t),yield gT(),yield ai(gk.setCancellationLoading(!1))}catch(e){yield ai(gk.setCancellationError(e.message))}}function*vT(){const{subscription:e}=yield di((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ai(gk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ai(gk.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===td.AT_PERIOD_END)try{yield ai(gk.setRenewalLoading(!0)),yield si(Bd.subscriptions.renewManagedSubscription,t),yield gT(),yield ai(gk.setRenewalLoading(!1))}catch(e){yield ai(gk.setCancellationError(e.message))}}function*hT(){yield ai(gk.setLoading(!0)),yield yi(500),yield ai(gk.setState({subscription:sT,fetching:!1,loading:!1,error:null}))}function*mT(){yield oa(gk.load,hT)}function*bT(){yield oa(Ak.loadBillingInformation,AT)}function*AT(){yield function*(e){const t=yield di((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield di((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield kT(n,!1):yield ai(Ak.setError(t?"Not authorized":"Internal feature failure"))}()}function*kT(e,t){yield ai(Ak.setLoading(!0));try{var n,o;const i=yield si(Bd.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield si(Bd.subscriptions.getSubscriptionPlan,a):([,l]=yield ri([si(gT),si(Bd.subscriptions.getSubscriptionPlan,a)]),s=yield di((e=>e.subscriptions.billing.subscription.subscription||null))),yield ai(Ak.setState(O({loading:!1,fetching:!1,summary:i},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?iT.ACTIVE:lT(s.status),cancellation:s.cancellation&&rT(s.cancellation),trialEnd:s.trialEnd?s.trialEnd:null}}:{},l?{plan:{id:l.id,name:l.name,description:l.description,price:(null==(n=l.price)?void 0:n.amount)||0,currency:(null==(o=l.price)?void 0:o.currency)||"usd",recurringInterval:"month",slug:l.slug}}:{})))}catch(e){yield ai(Ak.setError(e.message))}}function*TT(){yield function*(){var e,t;yield ai(Ak.setLoading(!0)),yield yi(500),yield ai(Ak.setState({loading:!1,fetching:!1,summary:{subscriptionId:sT.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:nd.Stripe,externallyManaged:!1,currentPlanId:cT[0].id,defaultPlanId:cT[0].id},plan:O({},cT[0],{price:null==(e=cT[0].price)?void 0:e.amount,currency:null==(t=cT[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*PT(){yield oa(Ak.loadBillingInformation,TT)}function*IT(){yield oa(Ek.loadPaymentMethod,LT),yield oa(Ek.submitPaymentMethod,OT),yield oa(Ek.submitPaymentMethodError,wT),yield oa(Ek.submitPaymentMethodSuccess,DT),yield oa(Ek.updatePaymentMethodBillingDetails,ET)}function*LT(){yield ai(Ek.setLoading(!0));try{const e=(yield si(Bd.subscriptions.getPaymentMethods))[0];yield ai(Ek.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield ai(Ek.setError(e.message))}}function*ET({payload:e}){yield ai(Ek.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield si(Bd.subscriptions.updatePaymentMethodBillingDetails,t,O({email:n},o)),yield si(LT),null==i||i(!0)}catch(e){yield ai(Ek.setError(e.message)),null==i||i(!1)}yield ai(Ek.setLoading(!1))}function*OT(){yield ai(Ek.setLoading(!0))}function*wT({payload:e}){yield ai(Ek.setError(e))}function*DT(){yield ai(Ek.loadPaymentMethod())}function*CT(){yield ai(Ek.setLoading(!0)),yield yi(500);const e=dT[0];yield ai(Ek.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*RT(){yield oa(Ek.loadPaymentMethod,CT)}function*UT(){yield oa(Uk.loadInvoices,_T),yield oa(Uk.downloadInvoice,MT)}function*_T(){yield ai(Uk.setLoading(!0));try{const e=(yield si(Bd.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 ai(Uk.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield ai(Uk.setError(e.message))}}function*MT({payload:e}){yield ai(Uk.setInvoiceDownloadState({loading:!0,error:null}));try{yield si(Bd.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield ai(Uk.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield ai(Uk.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*NT(){yield ai(Uk.setLoading(!0)),yield yi(500),yield ai(Uk.setState({loading:!1,fetching:!1,invoices:uT.map((e=>O({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield ai(Uk.setLoading(!1))}function*FT(){yield oa(Uk.loadInvoices,NT)}function*$T(){yield ri([si(bT),si(IT),si(UT),si(fT)])}function*GT(){yield ri([si(PT),si(RT),si(FT),si(mT)])}function*xT(){yield oa(Wk.loadCheckout,VT),yield oa(Wk.resetCheckout,WT),yield oa(Wk.submitCheckout,jT),yield oa(Wk.confirmCheckout,KT),yield oa(Wk.errorCheckout,zT)}function*VT(){yield ai(Wk.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*WT(){yield ai(Wk.setState({loading:!1,error:null,confirmed:!1}))}function*jT(){yield ai(Wk.setState({loading:!0,error:null}))}function*KT({payload:{paymentMethodId:e,planId:t}}){const n=yield di((e=>e.subscriptions.billing.subscription.subscription)),o=yield di((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===Zu.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield ai(Wk.setState({loading:!0,error:null})),i&&a)return yield BT(),void(yield ai(gk.setState({subscription:O({},n,{status:Zu.ACTIVE})})));try{yield si(Bd.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield ri([AT(),LT(),_T()]),yield BT()}catch(e){yield ai(Wk.setState({loading:!1,error:e.message}))}}else yield ai(Wk.setState({loading:!1,error:"Subscription not found"}))}function*BT(){yield ai(Wk.setState({loading:!1,error:null,confirmed:!0}))}function*zT({payload:e}){yield ai(Wk.setState({loading:!1,error:e}))}function*qT(){yield oa(Wk.resetCheckout,WT)}function*HT(){yield oa(ok.loadPlans,JT)}function*JT(){yield ai(ok.setLoading(!0));try{const e=(yield si(Bd.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 ai(ok.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield ai(ok.setError(e.message))}}function*YT(){yield ai(ok.setLoading(!0)),yield yi(500),yield ai(ok.setState({fetching:!1,loading:!1,plans:cT.map((e=>{var t,n;return O({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*QT(){yield oa(ok.loadPlans,YT)}function*XT(){yield oa(ck.loadPaymentConfiguration,ZT)}function*ZT(){yield ai(ck.setLoading(!0));try{(yield si(Bd.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===nd.Stripe))?yield function*(){yield ai(ck.setLoading(!0));try{const e=yield si(Bd.subscriptions.getStripePaymentProviderConfiguration);yield ai(ck.setState({loading:!1,fetching:!1,config:{paymentProvider:oT.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield ai(ck.setError(e.message))}}():yield ai(ck.setError("Payment provider not configured"))}catch(e){yield ai(ck.setError(e.message))}}function*eP(){yield ai(ck.setLoading(!0)),yield yi(500),yield ai(ck.setState({loading:!1,fetching:!1,config:{paymentProvider:oT.STRIPE,apiKey:""}}))}function*tP(){yield oa(ck.loadPaymentConfiguration,eP)}function*nP(){yield oa(Hk.createCardSetupIntentSecret,oP)}function*oP({payload:e}){yield ai(Hk.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield si(Bd.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield ai(Hk.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield ai(Hk.setError(e.message))}}function*iP(){yield oa(Zk.loadVendorPublicConfiguration,aP)}function*aP(){yield ai(Zk.setLoading(!0));try{const e=yield si(Bd.subscriptions.getVendorPublicConfigurations);yield ai(Zk.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield ai(Zk.setError(e.message))}}function*rP(){yield ai(Zk.setLoading(!0)),yield yi(500),yield ai(Zk.setState({fetching:!1,loading:!1,vendorPublicConfig:yT}))}function*lP(){yield oa(Zk.loadVendorPublicConfiguration,rP)}var sP={sagas:function*(){yield ri([si($T),si(xT),si(HT),si(XT),si(nP),si(iP)])},mockSagas:function*(){yield ri([si(GT),si(qT),si(QT),si(tP),si(lP)])},reducer:nT,actions:tT,initialState:eT,storeName:"subscriptions"},cP={sagas:function*(){yield oa(Wy.loadVendorPublicInfo,jy)},storeName:Dt,initialState:Gy,reducer:xy,actions:Wy};const{reducer:uP}=st({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(ra.setContext(t),O({},e,{context:t}))}}}),dP=(e,t,n=!1,o,i,a=!1,r="path")=>{let l=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var s,c,u,d,y,f,p,g,S,v;n||a||ra.setContext(e.context);const t=Hi(),h=[...it({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=at({middleware:h,preloadedState:{root:O({},e,{previewMode:n,urlStrategy:r}),[_b.storeName]:O({},_b.initialState,o,null!=(s=null==i?void 0:i.auth)?s:{},{routes:O({},_b.initialState.routes,null!=(c=null==o?void 0:o.routes)?c:{},null!=(u=null==i||null==(d=i.auth)?void 0:d.routes)?u:{})}),[rA.storeName]:O({},rA.initialState,null!=(y=null==i?void 0:i.auditLogs)?y:{},{auditLogsState:O({},rA.initialState.auditLogsState,null!=(f=null==i||null==(p=i.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:O({},rA.initialState.auditsMetadataState,null!=(g=null==i||null==(S=i.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[sA]:O({},lA,null!=(v=null==i?void 0:i.audits)?v:{}),[HA.storeName]:HA.initialState,[sP.storeName]:sP.initialState,[cP.storeName]:cP.initialState},reducer:xe({root:uP,[_b.storeName]:_b.reducer,[rA.storeName]:rA.reducer,[sA]:uA,[HA.storeName]:HA.reducer,[sP.storeName]:sP.reducer,[cP.storeName]:cP.reducer})});const m=function*(){yield ri([si(_b.sagas),si(rA.sagas),si(AA),si(HA.sagas),si(sP.sagas),si(cP.sagas)])},b=function*(){yield ri([si(_b.mockSagas),si(rA.mockSagas),si(sP.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(lo.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var yP=n(714),fP=n.n(yP);function pP(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function gP(e){if(e.type)return e;if("#"===e.charAt(0))return gP(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const o=e.substring(t+1,e.length-1);let i,a;if("color"===n){if(a=o.split(" "),i=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(i))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+i)}else a=o.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:i}}function SP(e){const{type:t,colorSpace:n}=e;let{values:o}=e;return-1!==t.indexOf("rgb")?o=o.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(o[1]=`${o[1]}%`,o[2]=`${o[2]}%`),o=-1!==t.indexOf("color")?`${n} ${o.join(" ")}`:`${o.join(", ")}`,`${t}(${o})`}function vP(e){if(0===e.indexOf("#"))return e;const{values:t}=gP(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 hP(e,t){return e=gP(e),t=pP(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,SP(e)}function mP(e,t){if(e=gP(e),t=pP(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 SP(e)}function bP(e,t){if(e=gP(e),t=pP(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 SP(e)}const AP=e=>{if(e)return{main:e,light:vP(bP(e,.4)),dark:vP(mP(e,.15)),hover:vP(mP(e,.15)),active:vP(mP(e,.2))}},kP=e=>{if(e)return{main:e,light:bP(e,.7),dark:mP(e,.2)}},TP=(e,t)=>{var n,o,i,a,r,l,s,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?O({},t,{palette:{primary:O({},AP(null==e||null==(o=e.palette)?void 0:o.primary),{contrastText:null!=(i=null==e||null==(a=e.palette)?void 0:a.primaryText)?i:"#000000"}),secondary:O({},AP(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(l=null==e||null==(s=e.palette)?void 0:s.secondaryText)?l:"#000000"}),danger:O({},AP(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:O({},kP(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:O({},kP(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:O({},kP(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:O({},kP(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},PP={},IP={},LP={},EP={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},multipleSSO:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class OP{constructor(){this._theme=PP,this._themeV2=IP,this._navigation=EP,this._localizations=LP}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new OP;return n.set(e),OP._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,o,i,a,r,l;this._navigation=fP().all([null!=(t=EP)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=fP().all([null!=(o=PP)?o:{},TP(null==e?void 0:e.theme,PP)]),this._themeV2=fP().all([null!=(i=IP)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=fP().all([null!=(r=LP)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=EP,this._theme=PP,this._themeV2=IP,this._localizations=LP}}}OP._instances={};var wP=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},DP=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=document.createElement(t);return Object.keys(n).forEach((function(e){return o.setAttribute(e,n[e])})),e.appendChild(o),o},CP=function(e){return new Promise((function(t,n){var o=4e3,i=setInterval((function(){return null!=e.themeSetter?(clearInterval(i),void t(!0)):o<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(i)):void(o-=50)}),50)}))};let RP,UP,_P,MP,NP,FP,$P,GP,xP,VP,WP;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(RP||(RP={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(UP||(UP={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(_P||(_P={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(MP||(MP={})),function(e){e.Invoices="invoices"}(NP||(NP={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(FP||(FP={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}($P||($P={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(GP||(GP={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(xP||(xP={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(VP||(VP={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(WP||(WP={}));const jP={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},KP={hidden:"hidden",edit:"edit"};var BP="6.79.0",zP={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on"},qP=function(){function e(t,n){var o,i,a,r,l=this,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];k(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(BP),this.customElementName="",this.adminPortalEl=void 0,this.adminPortalRenderer=void 0,this.loginBoxEl=void 0,this.checkoutDialogEl=void 0,this.checkoutDialogRenderer=void 0,this.adminPortalContainer=void 0,this.loginBoxContainer=void 0,this.checkoutDialogContainer=void 0,this.loginBoxRenderer=void 0,this.store=void 0,this.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=D(R().mark((function e(){var t,n,o,i,a;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=da,l.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:a=e.sent,l.options.metadata=null!=(n=null==a||null==(o=a.rows)||null==(i=o[0])?void 0:i.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:OP.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=D(R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l.options.hostedLoginBox||l.options.builderMode||"nextjs"===l.options.framework||l.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=D(R().mark((function e(){var t;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l.options.previewMode&&!l.options.builderMode){e.next=4;break}fd.set({flags:zP}),e.next=14;break;case 4:return e.prev=4,e.next=7,pd();case 7:t=e.sent,fd.set({flags:t}),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 14:case"end":return e.stop()}}),e,null,[[4,11]])}))),this.updateLocalizationsSetter=function(e){l.updateLocalizations=e};var c=wP(n),u="frontegg-app-".concat(c);this.iframeRendering=s,this.name=c,this.options=O({},t,{contextOptions:O({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=u;var d=this.options.authOptions?O({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};d.disableSilentRefresh=null==(o=this.options.authOptions)?void 0:o.disableSilentRefresh,this.store=null!=(i=this.options.store)?i:dP({context:this.options.contextOptions},this,this.options.previewMode,d,{auth:null!=(a=this.options.authOptions)?a:{},audits:null!=(r=this.options.auditsOptions)?r:{}},!1,this.options.urlStrategy),E.setInstance(c,this)}var t,n,o,i;return L(e,[{key:"initContainers",value:(i=D(R().mark((function e(t){return R().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 i.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;OP.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,o){if(window[e])n(window[e]);else{var i=document.createElement("script");i.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),i.setAttribute("id","".concat(e,"Script")),i.setAttribute("cdn-url",t.cdnUrl),i.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:b,FronteggTypes:A})):n(window[e])},i.onerror=function(e){console.log("Profile page error",e),o(e)},document.body.append(i)}}))}},{key:"loadLoginBox",value:(o=D(R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){console.error("Failed to call loadLoginBoxListener",e)}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"showAdminPortal",value:(n=D(R().mark((function e(){var t;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=D(R().mark((function e(t){var n;return R().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,O({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}(),HP=function(){function e(){k(this,e)}return L(e,null,[{key:"setAuthentication",value:function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",i=E.getInstance(o);e&&t?(ra.setAccessToken(t),ra.setUser(O({},n,{accessToken:t})),i.store.dispatch(lo.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(lo.loadTenants())):(ra.setAccessToken(null),ra.setUser(null),i.store.dispatch(lo.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),JP=function(){function e(){k(this,e)}return L(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";E.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";E.getInstance(e).hideAdminPortal()}}]),e}(),YP=function(){function e(){k(this,e)}return L(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";E.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";E.getInstance(e).hideCheckoutDialog()}}]),e}();function QP(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function XP(e,t){return XP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},XP(e,t)}function ZP(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&&XP(e,t)}function eI(e,t){if(t&&("object"===T(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return QP(e)}function tI(e){return tI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},tI(e)}function nI(){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 oI(e,t,n){return oI=nI()?Reflect.construct.bind():function(e,t,n){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return n&&XP(i,n.prototype),i},oI.apply(null,arguments)}function iI(e){var t="function"==typeof Map?new Map:void 0;return iI=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 oI(e,arguments,tI(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),XP(n,e)},iI(e)}var aI,rI="app-url",lI=function(e){ZP(i,e);var t,n,o=(t=i,n=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}}(),function(){var e,o=tI(t);if(n){var i=tI(this).constructor;e=Reflect.construct(o,arguments,i)}else e=o.apply(this,arguments);return eI(this,e)});function i(){var e;return k(this,i),(e=o.call(this)).appUrl=null,e.events=["mousemove","scroll","keydown"],e.postMessageId="FE_CLEAR_IDLE_TIMEOUT",e.sendPostMessage=e.sendPostMessage.bind(QP(e)),e}return L(i,[{key:"sendPostMessage",value:function(){var e;this.appUrl&&null!=(e=window)&&e.parent&&window.parent.postMessage(this.postMessageId,this.appUrl)}},{key:"addEventListeners",value:function(){var e=this;this.events.forEach((function(t){window.addEventListener(t,e.sendPostMessage)}))}},{key:"removeEventListeners",value:function(){var e=this;this.events.forEach((function(t){window.removeEventListener(t,e.sendPostMessage)}))}},{key:"connectedCallback",value:function(){var e;this.appUrl=this.getAttribute(rI),this.postMessageId=null!=(e=this.getAttribute("message-id"))?e:this.postMessageId,this.addEventListeners()}},{key:"disconnectedCallback",value:function(){this.removeEventListeners()}},{key:"attributeChangedCallback",value:function(e,t,n){e===rI&&t!==n&&(this.appUrl=n,this.removeEventListeners(),this.addEventListeners())}}]),i}(iI(HTMLElement));null!=(aI=window)&&aI.customElements&&customElements.define("fe-idle-session-plugin",lI);var sI=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},cI=function(){function e(t,n,o,i){k(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=o?o:dP({context:a},this,!0,void 0,void 0,!0),this.options=O({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a},i),this.app=new qP(this.options,t,!0),OP.set({},t)}var t;return L(e,[{key:"render",value:(t=D(R().mark((function e(t){var n,o,i,a,r=this;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,o=function(e){r.themeSetter=e},i=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:o,setStaticRouteSetter:i}),this.app.loading=!1,e.next=13,CP(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}(),uI="modern",dI=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[uI]},yI=function(){function e(t,n,o,i){k(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=o?o:dP({context:a},this,!0,void 0,void 0,!0),this.options=O({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a,onRedirectTo:function(){console.debug("path")}},i),this.app=new qP(this.options,t,!0),OP.set({},t)}var t;return L(e,[{key:"render",value:(t=D(R().mark((function e(t){var n,o,i,a,r=this;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,o=function(e){r.themeSetter=e},i=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:o,setStaticRouteSetter:i,staticRoute:"/account/login"}),e.next=12,CP(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 fI(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=tI(e);if(t){var i=tI(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return eI(this,n)}}var pI=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new qP(e,t);if("undefined"!=typeof document){var o;if(!e.contextOptions.baseUrl){var i=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(i.message),i}if(!customElements.get("frontegg-app")){var a=function(e){ZP(n,e);var t=fI(n);function n(){var e;k(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).app=null,e}return L(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=E.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var o=DP(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=DP(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=DP(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=o.attachShadow({mode:"open"}),l=i.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),c=DP(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=DP(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=DP(s,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:o,loginBoxContainer:i,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(iI(HTMLElement));customElements.define("frontegg-app",a)}null==(o=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||o.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),o}()}));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map((function(e){return o(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||i,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=o;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var i={};return n.isMergeableObject(e)&&a(e).forEach((function(t){i[t]=o(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?i[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):i[a]=o(t[a],n))})),i}(e,n,s):o(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var o=n(425).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},s=l.iterator||"@@iterator",c=l.asyncIterator||"@@asyncIterator",u=l.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,o){var i=t&&t.prototype instanceof g?t:g,a=Object.create(i.prototype),l=new O(o||[]);return r(a,"_invoke",{value:P(e,n,l)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,s,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(w([])));b&&b!==n&&a.call(b,s)&&(h=b);var A=v.prototype=g.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(i,r,l,s){var c=f(e[i],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==o(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,l,s)}),(function(e){n("throw",e,l,s)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return n("throw",e,l,s)}))}s(c.arg)}var i;r(this,"_invoke",{value:function(e,o){function a(){return new t((function(t,i){n(e,o,t,i)}))}return i=i?i.then(a,a):a()}})}function P(e,t,n){var o="suspendedStart";return function(i,a){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var r=n.delegate;if(r){var l=I(r,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var s=f(e,t,n);if("normal"===s.type){if(o=n.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o="completed",n.method="throw",n.arg=s.arg)}}}function I(e,t){var n=t.method,o=e.iterator[n];if(void 0===o)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=f(o,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function 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[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:D}}function D(){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,o,i,a){void 0===a&&(a=Promise);var r=new T(y(e,n,o,i),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,s,(function(){return this})),d(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=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,o){return r.type="throw",r.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],r=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var r=i?i.completion:{};return r.type=e,r.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;E(n)}return i}}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),p}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var o=n(609)();e.exports=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return function(){"use strict";n.r(o),n.d(o,{AdminPortal:function(){return JP},AdminPortalRenderer:function(){return XP},AppHolder:function(){return E},CheckoutDialog:function(){return YP},FronteggApp:function(){return qP},HostedLogin:function(){return HP},LoginBoxRenderer:function(){return tI},createElement:function(){return DP},defaultTheme:function(){return ZP},formatName:function(){return wP},getThemeAdminByName:function(){return QP},getThemeByName:function(){return eI},initialize:function(){return uI},mockFlagsList:function(){return zP},waitThemeSetter:function(){return CP}});var e={};n.r(e),n.d(e,{Delete:function(){return ga},Get:function(){return da},Patch:function(){return fa},Post:function(){return ya},PostDownload:function(){return Sa},Put:function(){return pa},getBaseUrl:function(){return ca}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return Xa},getSubTenantsAsTree:function(){return Za},getTenants:function(){return Qa},switchTenant:function(){return Ya}});var i={};n.r(i),n.d(i,{AuthStrategyEnum:function(){return Lr},MachineToMachineAuthStrategy:function(){return Er},OAuthLogout:function(){return Qr},SocialLoginProviders:function(){return Ir},acceptInvitation:function(){return qr},activateAccount:function(){return jr},bulkCreateIPRestriction:function(){return br},changePhoneNumber:function(){return xs},changePhoneNumberWithVerification:function(){return $s},checkIfAllowToRememberMfaDevice:function(){return fs},createDomainRestriction:function(){return pr},createIPRestriction:function(){return mr},createOrUpdateSessionConfigrations:function(){return Ql},createSSOConfiguration:function(){return hs},createSSOConfigurationByMetadata:function(){return As},createSSODomain:function(){return Ts},createSSOGroup:function(){return Os},createSamlGroup:function(){return Nl},createTenantAccessToken:function(){return as},createUserAccessToken:function(){return is},deleteAllSessionsForUser:function(){return Zl},deleteDomainRestriction:function(){return Sr},deleteIPRestriction:function(){return kr},deleteSSOConfiguration:function(){return bs},deleteSSODomain:function(){return Ps},deleteSSOGroup:function(){return Ds},deleteSamlGroup:function(){return $l},deleteSessionForUser:function(){return Xl},deleteTenantAccessToken:function(){return ns},deleteTenantApiToken:function(){return us},deleteUserAccessToken:function(){return os},deleteUserApiToken:function(){return ds},deleteWebAuthnDevice:function(){return Bs},disableMFAAuthenticatorApp:function(){return dl},disableMFASMS:function(){return fl},disableMFAWebAuthn:function(){return gl},disableMfa:function(){return ul},enrollMFAAuthenticatorApp:function(){return il},enrollMFAAuthenticatorAppForLogin:function(){return hl},enrollMFASMS:function(){return rl},enrollMFASMSForLogin:function(){return Al},enrollMFAWebAuthn:function(){return sl},enrollMFAWebAuthnForLogin:function(){return Il},enrollMfa:function(){return nl},exchangeOAuthTokens:function(){return _s},forgotPassword:function(){return Xr},generateLoginResponse:function(){return _r},generateLoginResponseFromOAuthResponse:function(){return Nr},generateLoginResponseV2:function(){return Mr},getActivateAccountStrategy:function(){return Kr},getCaptchaPolicy:function(){return lr},getCurrentUserSession:function(){return Hl},getCurrentUserSessions:function(){return ql},getCustomSocialLoginProvidersV1:function(){return jl},getDomainRestrictions:function(){return yr},getDomainRestrictionsConfig:function(){return fr},getGlobalSecurityPolicy:function(){return er},getIPRestrictions:function(){return vr},getIPRestrictionsConfig:function(){return hr},getLockoutPolicy:function(){return ir},getMFADevices:function(){return Sl},getMFAStrategiesConfig:function(){return Hs},getMfaPolicy:function(){return tr},getOidcConfiguration:function(){return Gl},getPasswordConfigPolicy:function(){return dr},getPasswordHistoryPolicy:function(){return sr},getSSOConfigurations:function(){return vs},getSSODefaultRoles:function(){return Ls},getSSOGroups:function(){return Cs},getSSOPublicConfiguration:function(){return xl},getSamlConfiguration:function(){return Ol},getSamlRoles:function(){return Ul},getSamlRolesGroups:function(){return _l},getSamlVendorConfiguration:function(){return Dl},getSessionConfigurations:function(){return Yl},getSocialLoginProviders:function(){return Vl},getSocialLoginProvidersV2:function(){return Wl},getTenantAccessTokensData:function(){return ts},getTenantApiTokensData:function(){return ls},getUserAccessTokensData:function(){return es},getUserApiTokensData:function(){return rs},getUserById:function(){return ys},getVendorConfig:function(){return Bl},getVendorLockoutPolicy:function(){return ar},getVendorMfaPolicy:function(){return nr},getVendorPasswordHistoryPolicy:function(){return cr},getVendorPublicAuthStrategiesConfig:function(){return qs},getWebAuthnDevices:function(){return Ks},loadPasswordConfig:function(){return el},login:function(){return Vr},loginViaSocialLogin:function(){return Kl},loginWithMfa:function(){return Wr},logout:function(){return Yr},oidcPostLogin:function(){return xr},oidcPostLoginV2:function(){return Us},passwordlessPostLogin:function(){return gs},passwordlessPreLogin:function(){return ps},postLogin:function(){return Gr},preDisableMFASMS:function(){return yl},preDisableMFAWebAuthn:function(){return pl},preEnrollMFAAuthenticatorApp:function(){return ol},preEnrollMFAAuthenticatorAppForLogin:function(){return vl},preEnrollMFASMS:function(){return al},preEnrollMFASMSForLogin:function(){return bl},preEnrollMFAWebAuthn:function(){return ll},preEnrollMFAWebAuthnForLogin:function(){return Pl},preLogin:function(){return Fr},preLoginV2:function(){return Rs},preLoginWithIdpType:function(){return $r},preVerifyMFASMSForLogin:function(){return kl},preVerifyMFAWebAuthnForLogin:function(){return Ll},recoverMfaToken:function(){return tl},refreshToken:function(){return Hr},refreshTokenV2:function(){return Jr},resendActivationEmail:function(){return Br},resendInvitationEmail:function(){return zr},resetPassword:function(){return Zr},resetPhoneNumber:function(){return Ns},revokeSessionsForUser:function(){return Jl},saveLockoutPolicy:function(){return rr},saveMfaPolicy:function(){return or},savePasswordHistoryPolicy:function(){return ur},setSSODefaultRoles:function(){return Es},signUpUser:function(){return zl},silentOAuthRefreshToken:function(){return Ms},testCurrentIp:function(){return Tr},testCurrentIpInAllowList:function(){return Pr},updateDomainRestrictionConfig:function(){return gr},updateIPRestrictionConfig:function(){return Ar},updateSSOConfiguration:function(){return ms},updateSSOConfigurationByMetadata:function(){return ks},updateSSOGroup:function(){return ws},updateSamlConfiguration:function(){return wl},updateSamlGroup:function(){return Fl},updateSamlRoles:function(){return Ml},updateSamlVendorMetadata:function(){return Cl},updateTenantApiTokensData:function(){return cs},updateUserApiTokensData:function(){return ss},validateSSODomain:function(){return Is},validateSamlDomain:function(){return Rl},verifyChangePhoneNumber:function(){return Gs},verifyInviteToken:function(){return Ss},verifyMFAAuthenticatorAppForLogin:function(){return ml},verifyMFASMSForLogin:function(){return Tl},verifyMFAWebAuthnForLogin:function(){return El},verifyMfa:function(){return cl},verifyNewDeviceSession:function(){return zs},verifyResetPhoneNumber:function(){return Fs},webAuthnCreateNewDeviceSession:function(){return js},webAuthnPostLogin:function(){return Ws},webAuthnPreLogin:function(){return Vs}});var a={};n.r(a),n.d(a,{addUser:function(){return ec},changePassword:function(){return Xs},createInviteUserLink:function(){return oc},deleteInviteUserLink:function(){return ac},deleteUser:function(){return tc},getInviteLinkConfiguration:function(){return lc},getInviteUserLink:function(){return rc},getProfile:function(){return Js},loadAvailablePermissions:function(){return cc},loadAvailableRoles:function(){return sc},loadStats:function(){return uc},loadUsers:function(){return Zs},resendActivationLink:function(){return dc},resendInvitationLink:function(){return yc},resendInvitationLinkToAllTenants:function(){return fc},updateInviteUserLink:function(){return ic},updateProfile:function(){return Ys},updateProfileImage:function(){return Qs},updateUser:function(){return nc}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return hc},getCurrentUserIpMetadata:function(){return gc},getIpAdressMetadata:function(){return mc},getNotificationsMetadata:function(){return Sc},getSamlMetadata:function(){return vc}});var l={};n.r(l),n.d(l,{downloadReport:function(){return Ec},getReport:function(){return Pc},getReports:function(){return Tc},renderReport:function(){return Ic},scheduleReport:function(){return Lc},sendReport:function(){return Oc}});var s={};n.r(s),n.d(s,{getNotifications:function(){return wc},markAllAsRead:function(){return Rc},updateNotificationIsPinned:function(){return Cc},updateNotificationStatus:function(){return Dc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return Nc},getAudits:function(){return _c},getAuditsStats:function(){return Mc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return Yc},deleteEmailSubscriptions:function(){return Hc},deleteSMSConfiguration:function(){return nu},deleteSMSSubscriptions:function(){return eu},deleteSlackConfiguration:function(){return jc},deleteWebhooksConfiguration:function(){return au},getCategories:function(){return cu},getChannelMaps:function(){return uu},getEmailConfiguration:function(){return Bc},getSMSConfiguration:function(){return Qc},getSlackChannels:function(){return Vc},getSlackConfiguration:function(){return Gc},getSlackScope:function(){return xc},getWebhookLog:function(){return ru},getWebhooksConfigurations:function(){return ou},patchEmailConfiguration:function(){return qc},patchSMSConfiguration:function(){return Zc},postEmailConfiguration:function(){return zc},postSMSConfiguration:function(){return Xc},postSlackCode:function(){return Kc},postSlackConfiguration:function(){return Wc},postWebhookRetry:function(){return su},postWebhookTest:function(){return lu},postWebhooksConfiguration:function(){return iu},putEmailSubscriptions:function(){return Jc},putSMSSubscriptions:function(){return tu}});var d={};n.r(d),n.d(d,{getSettings:function(){return yu},updateSettings:function(){return du}});var y={};n.r(y),n.d(y,{addRole:function(){return vu},attachPermissionToRoles:function(){return ku},attachPermissionsToRole:function(){return bu},deleteRole:function(){return hu},getPermissionCategories:function(){return Tu},getPermissions:function(){return Au},getRoles:function(){return Su},updateRole:function(){return mu}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return td},ISubscriptionStatus:function(){return Zu},PaymentMethodType:function(){return ed},ProviderType:function(){return nd},TenantCreatedAction:function(){return id},TrialEndAction:function(){return od},cancelManagedSubscription:function(){return Cu},cancelSubscription:function(){return Lu},createStripeCustomer:function(){return Bu},createStripePaymentMethodSetupIntentSecret:function(){return qu},createSubscription:function(){return ju},createTenantConfiguration:function(){return Yu},getManagedSubscription:function(){return wu},getManagedSubscriptions:function(){return Du},getPaymentMethod:function(){return Vu},getPaymentMethods:function(){return xu},getPaymentProviders:function(){return Qu},getStripeCustomer:function(){return Ku},getStripePaymentProviderConfiguration:function(){return zu},getSubscription:function(){return Iu},getSubscriptionInvoice:function(){return Fu},getSubscriptionInvoicePdf:function(){return $u},getSubscriptionInvoices:function(){return Nu},getSubscriptionPlan:function(){return Mu},getSubscriptionPlans:function(){return _u},getSubscriptionSummaries:function(){return Hu},getSubscriptions:function(){return Pu},getTenantConfiguration:function(){return Ju},getVendorPublicConfigurations:function(){return Xu},renewManagedSubscription:function(){return Ru},renewSubscription:function(){return Eu},updateManagedSubscription:function(){return Uu},updatePaymentMethodBillingDetails:function(){return Wu},updateSubscription:function(){return Ou}});var p={};n.r(p),n.d(p,{getVendorPublicInfo:function(){return ad}});var g={};n.r(g),n.d(g,{addUserRolesForSubTenants:function(){return cd},addUserToTenantAndSubTenants:function(){return ld},loadAllUsers:function(){return rd},removeUserFromTenantAndSubTenants:function(){return sd},removeUserRolesFromSubTenants:function(){return ud},setUserRolesForSubTenants:function(){return dd}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return fd},loadFeatureFlags:function(){return pd}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return md},createConfiguration:function(){return vd},deleteConfiguration:function(){return hd},getConfigs:function(){return gd},updateConfiguration:function(){return Sd}});var h={};n.r(h),n.d(h,{impersonate:function(){return bd}});var m={};n.r(m),n.d(m,{addRolesToGroup:function(){return Ed},addUsersToGroup:function(){return wd},createGroup:function(){return Pd},deleteGroup:function(){return Ld},deleteRolesFromGroup:function(){return Od},deleteUsersFromGroup:function(){return Dd},getGroupById:function(){return kd},getGroupConfiguration:function(){return Cd},getGroups:function(){return Td},updateGroup:function(){return Id},updateGroupConfiguration:function(){return Rd}});var b={};n.r(b),n.d(b,{AuthStrategyEnum:function(){return Lr},ContextHolder:function(){return ra},FeatureFlags:function(){return fd},FronteggApiError:function(){return sa},FronteggContext:function(){return la},ISubscriptionCancellationPolicy:function(){return td},ISubscriptionStatus:function(){return Zu},MFAStrategyEnum:function(){return Md},MachineToMachineAuthStrategy:function(){return Er},PaymentMethodType:function(){return ed},ProviderType:function(){return nd},RestrictionType:function(){return $n},ScimConnectionSource:function(){return Kd},SecondaryAuthStrategy:function(){return Ud},SocialLoginProviders:function(){return Ir},TenantType:function(){return Fd},UserManagedByEnum:function(){return Nd},WebAuthnDeviceType:function(){return _d},api:function(){return Bd},countConfigurationUsers:function(){return md},createConfiguration:function(){return vd},default:function(){return zd},deleteConfiguration:function(){return hd},fetch:function(){return e},fronteggAuthApiRoutes:function(){return Gd},fronteggLogoutApiRoutes:function(){return $d},fronteggRefreshTokenUrl:function(){return xd},fronteggSilentRefreshTokenUrl:function(){return Vd},fronteggTenantsUrl:function(){return jd},fronteggUsersUrl:function(){return Wd},getConfigs:function(){return gd},loadFeatureFlags:function(){return pd},updateConfiguration:function(){return Sd}});var A={};function k(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T(e){return 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},T(e)}function P(e){var t=function(e,t){if("object"!==T(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!==T(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===T(t)?t:String(t)}function I(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,P(o.key),o)}}function L(e,t,n){return t&&I(e.prototype,t),n&&I(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(A),n.d(A,{AccountPageFields:function(){return MP},DomainRestrictionsTabFields:function(){return VP},GeneralSettingsTabFields:function(){return GP},InviteUserModalFields:function(){return _P},IpRestrictionsTabFields:function(){return xP},Metadata:function(){return OP},PrivacyPageFields:function(){return UP},ProfilePageFields:function(){return RP},SecurityPageTabs:function(){return FP},SessionManagementTabFields:function(){return $P},SsoPageTabs:function(){return WP},SubscriptionsPageFields:function(){return NP},alpha:function(){return hP},fieldAppearance:function(){return jP},tabAppearance:function(){return KP}});var E=function(){function e(){k(this,e)}return L(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 O(){return O=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},O.apply(this,arguments)}function w(e,t,n,o,i,a,r){try{var l=e[a](r),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,i)}function D(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function r(e){w(a,o,i,r,l,"next",e)}function l(e){w(a,o,i,r,l,"throw",e)}r(void 0)}))}}E._apps={};var C=n(841),R=n.n(C);function U(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function _(e){return!!e&&!!e[be]}function M(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)===Ae}(e)||Array.isArray(e)||!!e[me]||!!e.constructor[me]||V(e)||W(e))}function N(e,t,n){void 0===n&&(n=!1),0===F(e)?(n?Object.keys:ke)(e).forEach((function(o){n&&"symbol"==typeof o||t(o,e[o],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function F(e){var t=e[be];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:V(e)?2:W(e)?3:0}function $(e,t){return 2===F(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function G(e,t,n){var o=F(e);2===o?e.set(t,n):3===o?(e.delete(t),e.add(n)):e[t]=n}function x(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function V(e){return ge&&e instanceof Map}function W(e){return Se&&e instanceof Set}function j(e){return e.o||e.t}function K(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Te(e);delete t[be];for(var n=ke(t),o=0;o<n.length;o++){var i=n[o],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function B(e,t){return void 0===t&&(t=!1),q(e)||_(e)||!M(e)||(F(e)>1&&(e.set=e.add=e.clear=e.delete=z),Object.freeze(e),t&&N(e,(function(e,t){return B(t,!0)}),!0)),e}function z(){U(2)}function q(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function H(e){var t=Pe[e];return t||U(18,e),t}function J(){return fe}function Y(e,t){t&&(H("Patches"),e.u=[],e.s=[],e.v=t)}function Q(e){X(e),e.p.forEach(ee),e.p=null}function X(e){e===fe&&(fe=e.l)}function Z(e){return fe={p:[],l:fe,h:e,m:!0,_:0}}function ee(e){var t=e[be];0===t.i||1===t.i?t.j():t.O=!0}function te(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.g||H("ES5").S(t,e,o),o?(n[be].P&&(Q(t),U(4)),M(e)&&(e=ne(t,e),t.l||ie(t,e)),t.u&&H("Patches").M(n[be].t,e,t.u,t.s)):e=ne(t,n,[]),Q(t),t.u&&t.v(t.u,t.s),e!==he?e:void 0}function ne(e,t,n){if(q(t))return t;var o=t[be];if(!o)return N(t,(function(i,a){return oe(e,o,t,i,a,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return ie(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var i=4===o.i||5===o.i?o.o=K(o.k):o.o;N(3===o.i?new Set(i):i,(function(t,a){return oe(e,o,i,t,a,n)})),ie(e,i,!1),n&&e.u&&H("Patches").R(o,n,e.u,e.s)}return o.o}function oe(e,t,n,o,i,a){if(_(i)){var r=ne(e,i,a&&t&&3!==t.i&&!$(t.D,o)?a.concat(o):void 0);if(G(n,o,r),!_(r))return;e.m=!1}if(M(i)&&!q(i)){if(!e.h.F&&e._<1)return;ne(e,i),t&&t.A.l||ie(e,i)}}function ie(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&B(t,n)}function ae(e,t){var n=e[be];return(n?j(n):e)[t]}function re(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Object.getPrototypeOf(n)}}function le(e){e.P||(e.P=!0,e.l&&le(e.l))}function se(e){e.o||(e.o=K(e.t))}function ce(e,t,n){var o=V(t)?H("MapSet").N(t,n):W(t)?H("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),o={i:n?1:0,A:t?t.A:J(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=o,a=Ie;n&&(i=[o],a=Le);var r=Proxy.revocable(i,a),l=r.revoke,s=r.proxy;return o.k=s,o.j=l,s}(t,n):H("ES5").J(t,n);return(n?n.A:J()).p.push(o),o}function ue(e){return _(e)||U(22,e),function e(t){if(!M(t))return t;var n,o=t[be],i=F(t);if(o){if(!o.P&&(o.i<4||!H("ES5").K(o)))return o.t;o.I=!0,n=de(t,i),o.I=!1}else n=de(t,i);return N(n,(function(t,i){o&&function(e,t){return 2===F(e)?e.get(t):e[t]}(o.t,t)===i||G(n,t,e(i))})),3===i?new Set(n):n}(e)}function de(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return K(e)}var ye,fe,pe="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ge="undefined"!=typeof Map,Se="undefined"!=typeof Set,ve="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,he=pe?Symbol.for("immer-nothing"):((ye={})["immer-nothing"]=!0,ye),me=pe?Symbol.for("immer-draftable"):"__$immer_draftable",be=pe?Symbol.for("immer-state"):"__$immer_state",Ae=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),ke="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Te=Object.getOwnPropertyDescriptors||function(e){var t={};return ke(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Pe={},Ie={get:function(e,t){if(t===be)return e;var n=j(e);if(!$(n,t))return function(e,t,n){var o,i=re(t,n);return i?"value"in i?i.value:null===(o=i.get)||void 0===o?void 0:o.call(e.k):void 0}(e,n,t);var o=n[t];return e.I||!M(o)?o:o===ae(e.t,t)?(se(e),e.o[t]=ce(e.A.h,o,e)):o},has:function(e,t){return t in j(e)},ownKeys:function(e){return Reflect.ownKeys(j(e))},set:function(e,t,n){var o=re(j(e),t);if(null==o?void 0:o.set)return o.set.call(e.k,n),!0;if(!e.P){var i=ae(j(e),t),a=null==i?void 0:i[be];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(x(n,i)&&(void 0!==n||$(e.t,t)))return!0;se(e),le(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!==ae(e.t,t)||t in e.t?(e.D[t]=!1,se(e),le(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=j(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty:function(){U(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){U(12)}},Le={};N(Ie,(function(e,t){Le[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Le.deleteProperty=function(e,t){return Le.set.call(this,e,t,void 0)},Le.set=function(e,t,n){return Ie.set.call(this,e[0],t,n,e[0])};var Ee=function(){function e(e){var t=this;this.g=ve,this.F=!0,this.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=i);for(var o=arguments.length,r=Array(o>1?o-1:0),l=1;l<o;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var o;return(o=n).call.apply(o,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&U(6),void 0!==o&&"function"!=typeof o&&U(7),M(e)){var l=Z(t),s=ce(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?Q(l):X(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return Y(l,o),te(e,l)}),(function(e){throw Q(l),e})):(Y(l,o),te(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===he&&(r=void 0),t.F&&B(r,!0),o){var u=[],d=[];H("Patches").M(e,r,u,d),o(u,d)}return r}U(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))};var o,i,a=t.produce(e,n,(function(e,t){o=e,i=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,o,i]})):[a,o,i]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){M(e)||U(8),_(e)&&(e=ue(e));var t=Z(this),n=ce(this,e,void 0);return n[be].C=!0,X(t),n},t.finishDraft=function(e,t){var n=(e&&e[be]).A;return Y(n,t),te(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ve&&U(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));var i=H("Patches").$;return _(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Oe=new Ee,we=Oe.produce,De=(Oe.produceWithPatches.bind(Oe),Oe.setAutoFreeze.bind(Oe),Oe.setUseProxies.bind(Oe),Oe.applyPatches.bind(Oe),Oe.createDraft.bind(Oe),Oe.finishDraft.bind(Oe),we);function Ce(e,t,n){return(t=P(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Re(Object(n),!0).forEach((function(t){Ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Re(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _e(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 Me="function"==typeof Symbol&&Symbol.observable||"@@observable",Ne=function(){return Math.random().toString(36).substring(7).split("").join(".")},Fe={INIT:"@@redux/INIT"+Ne(),REPLACE:"@@redux/REPLACE"+Ne(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ne()}};function $e(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 Ge(e,t,n){var o;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(_e(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(_e(1));return n(Ge)(e,t)}if("function"!=typeof e)throw new Error(_e(2));var i=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(_e(3));return a}function d(e){if("function"!=typeof e)throw new Error(_e(4));if(s)throw new Error(_e(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(_e(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!$e(e))throw new Error(_e(7));if(void 0===e.type)throw new Error(_e(8));if(s)throw new Error(_e(9));try{s=!0,a=i(a,e)}finally{s=!1}for(var t=r=l,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(_e(10));i=e,y({type:Fe.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(_e(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Me]=function(){return this},e}return y({type:Fe.INIT}),(o={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Me]=p,o}function xe(e){for(var t=Object.keys(e),n={},o=0;o<t.length;o++){var i=t[o];"function"==typeof e[i]&&(n[i]=e[i])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Fe.INIT}))throw new Error(_e(12));if(void 0===n(void 0,{type:Fe.PROBE_UNKNOWN_ACTION()}))throw new Error(_e(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var o=!1,i={},l=0;l<r.length;l++){var s=r[l],c=n[s],u=e[s],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(_e(14));i[s]=d,o=o||d!==u}return(o=o||r.length!==Object.keys(e).length)?i:e}}function Ve(){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 We(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),o=function(){throw new Error(_e(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return o=Ve.apply(void 0,a)(n.dispatch),Ue(Ue({},n),{},{dispatch:o})}}}function je(e){return function(t){var n=t.dispatch,o=t.getState;return function(t){return function(i){return"function"==typeof i?i(n,o,e):t(i)}}}}var Ke=je();Ke.withExtraArgument=je;var Be,ze=Ke,qe=(Be=function(e,t){return Be=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])},Be(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}Be(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),He=function(e,t){for(var n=0,o=t.length,i=e.length;n<o;n++,i++)e[i]=t[n];return e},Je=Object.defineProperty,Ye=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Qe=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,Ze=function(e,t,n){return t in e?Je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},et=function(e,t){for(var n in t||(t={}))Qe.call(t,n)&&Ze(e,n,t[n]);if(Ye)for(var o=0,i=Ye(t);o<i.length;o++)n=i[o],Xe.call(t,n)&&Ze(e,n,t[n]);return e},tt="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Ve:Ve.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var nt=function(e){function t(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=e.apply(this,n)||this;return Object.setPrototypeOf(i,t.prototype),i}return qe(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,He([void 0],e[0].concat(this)))):new(t.bind.apply(t,He([void 0],e.concat(this))))},t}(Array);function ot(e){return M(e)?De(e,(function(){})):e}function it(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,o=(e.immutableCheck,e.serializableCheck,new nt);return n&&(function(e){return"boolean"==typeof e}(n)?o.push(ze):o.push(ze.withExtraArgument(n.extraArgument))),o}function at(e){var t,n=function(e){return it(e)},o=e||{},i=o.reducer,a=void 0===i?void 0:i,r=o.middleware,l=void 0===r?n():r,s=o.devTools,c=void 0===s||s,u=o.preloadedState,d=void 0===u?void 0:u,y=o.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=xe(a)}var p=l;"function"==typeof p&&(p=p(n));var g=We.apply(void 0,p),S=Ve;c&&(S=tt(et({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=He([g],f):"function"==typeof f&&(v=f(v)),Ge(t,d,S.apply(void 0,v))}function rt(e,t){function n(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(t){var i=t.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return et(et({type:e,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function lt(e){var t,n={},o=[],i={addCase:function(e,t){var o="string"==typeof e?e:e.type;if(o in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[o]=t,i},addMatcher:function(e,t){return o.push({matcher:e,reducer:t}),i},addDefaultCase:function(e){return t=e,i}};return e(i),[n,o,t]}function st(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,o="function"==typeof e.initialState?e.initialState:ot(e.initialState),i=e.reducers||{},a=Object.keys(i),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?lt(e.extraReducers):[e.extraReducers],n=t[0],i=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=et(et({},i),l);return function(e,t,n,o){void 0===n&&(n=[]);var i,a="function"==typeof t?lt(t):[t,n,o],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))i=function(){return ot(e())};else{var c=ot(e);i=function(){return c}}function u(e,t){void 0===e&&(e=i());var n=He([r[t.type]],l.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[s]),n.reduce((function(e,n){if(n){var o;if(_(e))return void 0===(o=n(e,t))?e:o;if(M(e))return De(e,(function(e){return n(e,t)}));if(void 0===(o=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return o}return e}),e)}return u.getInitialState=i,u}(o,u,r,c)}return a.forEach((function(e){var n,o,a=i[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,o=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=o?rt(c,o):rt(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:s,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var ct="listenerMiddleware";rt(ct+"/add"),rt(ct+"/removeAll"),rt(ct+"/remove"),function(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[be];return Ie.get(t,e)},set:function(t){var n=this[be];Ie.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][be];if(!i.P)switch(i.i){case 5:o(i)&&le(i);break;case 4:n(i)&&le(i)}}}function n(e){for(var t=e.t,n=e.k,o=ke(n),i=o.length-1;i>=0;i--){var a=o[i];if(a!==be){var r=t[a];if(void 0===r&&!$(t,a))return!0;var l=n[a],s=l&&l[be];if(s?s.t!==r:!x(l,r))return!0}}var c=!!t[be];return o.length!==ke(t).length+(c?0:1)}function o(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var o=0;o<t.length;o++)if(!t.hasOwnProperty(o))return!0;return!1}var i={};!function(e,t){Pe[e]||(Pe[e]=t)}("ES5",{J:function(t,n){var o=Array.isArray(t),i=function(t,n){if(t){for(var o=Array(n.length),i=0;i<n.length;i++)Object.defineProperty(o,""+i,e(i,!0));return o}var a=Te(n);delete a[be];for(var r=ke(a),l=0;l<r.length;l++){var s=r[l];a[s]=e(s,t||!!a[s].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(o,t),a={i:o?5:4,A:n?n.A:J(),P:!1,I:!1,D:{},l:n,t:t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,be,{value:a,writable:!0}),i},S:function(e,n,i){i?_(n)&&n[be].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[be];if(n){var i=n.t,a=n.k,r=n.D,l=n.i;if(4===l)N(a,(function(t){t!==be&&(void 0!==i[t]||$(i,t)?r[t]||e(a[t]):(r[t]=!0,le(n)))})),N(i,(function(e){void 0!==a[e]||$(a,e)||(r[e]=!1,le(n))}));else if(5===l){if(o(n)&&(le(n),r.length=!0),a.length<i.length)for(var s=a.length;s<i.length;s++)r[s]=!1;else for(var c=i.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,i.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):o(e)}})}();const ut=(e,t)=>n=>O({},n,{[e]:t[e]}),dt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>O({},t,{[e]:O({},t[e],n)})}),yt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:o})=>{var i;return O({},n,{[e]:O({},n[e],{[t]:O({},null==n||null==(i=n[e])?void 0:i[t],o)})})}}),ft=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o;return O({},t,{[e]:O({},t[e],{loaders:O({},t[e].loaders,{[n.key]:null==(o=n.value)||o})})})}}),pt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o;return O({},t,{[e]:O({},t[e],{errors:O({},t[e].errors,{[n.key]:null==(o=n.value)||o})})})}}),gt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(o,{payload:i})=>{var a;return O({},o,{[e]:O({},o[e],{[t]:O({},null==o||null==(a=o[e])?void 0:a[t],i,n)})})}}),St=(e,t,n)=>o=>{var i;return O({},o,{[e]:O({},o[e],{[t]:O({},null==o||null==(i=o[e])?void 0:i[t],n)})})},vt=(e=500)=>new Promise((t=>setTimeout(t,e))),ht="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",mt=new Uint8Array(256);for(let e=0;e<ht.length;e++)mt[ht.charCodeAt(e)]=e;const bt=e=>{const t=.75*e.length,n=e.length;let o,i,a,r,l,s=0;const c=new Uint8Array(t);for(o=0;o<n;o+=4)i=mt[e.charCodeAt(o)],a=mt[e.charCodeAt(o+1)],r=mt[e.charCodeAt(o+2)],l=mt[e.charCodeAt(o+3)],c[s++]=i<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},At=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(At(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let o,i="";for(o=0;o<n;o+=3)i+=ht[t[o]>>2],i+=ht[(3&t[o])<<4|t[o+1]>>4],i+=ht[(15&t[o+1])<<2|t[o+2]>>6],i+=ht[63&t[o+2]];return n%3==2?i=i.substring(0,i.length-1):n%3==1&&(i=i.substring(0,i.length-2)),i})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=At(e[n]);return t}return e};let kt,Tt,Pt;!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"}(kt||(kt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Tt||(Tt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Pt||(Pt={}));const It="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Lt="HOSTED_LOGIN_VERIFIER_KEY",Et="auth",Ot="connectivity",wt="auditLogs",Dt="vendor",Ct={flow:Tt.Login,step:kt.preLogin,loading:!1,email:"",tenants:[]},Rt={setLoginState:dt("loginState"),resetLoginState:ut("loginState",{loginState:Ct})},Ut={requestAuthorize:rt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:rt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:rt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:rt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:rt("auth/afterAuthNavigation"),preLogin:rt("auth/preLogin",(e=>({payload:e}))),postLogin:rt("auth/postLogin",(e=>({payload:e}))),login:rt("auth/login",(e=>({payload:e}))),loginWithMfa:rt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:rt("auth/recoverMfa",(e=>({payload:e}))),logout:rt("auth/logout",(e=>({payload:e}))),silentLogout:rt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:rt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:rt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:rt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:rt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:rt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:rt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:rt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:rt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:rt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:rt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:rt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:rt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:rt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:rt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:rt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:rt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:rt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:rt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:rt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:rt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:rt("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let _t;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(_t||(_t={}));const Mt={step:_t.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Nt={setActivateState:dt("activateState"),resetActivateState:ut("activateState",{activateState:Mt}),setActivateStrategyState:yt("activateState","activationStrategy")},Ft={activateAccount:rt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:rt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:rt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:rt("auth/resendActivationEmail",(e=>({payload:e})))};let $t;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}($t||($t={}));const Gt={step:$t.validate},xt={setAcceptInvitationState:dt("acceptInvitationState"),resetAcceptInvitationState:ut("acceptInvitationState",{acceptInvitationState:Gt})},Vt={acceptInvitation:rt("auth/acceptInvitation",(e=>({payload:e})))};let Wt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Wt||(Wt={}));const jt={step:Wt.forgotPassword,loading:!1,email:"",passwordConfig:null},Kt={setForgotPasswordState:dt("forgotPasswordState"),resetForgotPasswordState:ut("forgotPasswordState",{forgotPasswordState:jt})},Bt={forgotPassword:rt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:rt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:rt("auth/loadPasswordConfig",(e=>({payload:e})))};let zt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(zt||(zt={}));const qt={step:zt.ResetPhoneNumber,loading:!1},Ht={setResetPhoneNumberState:dt("resetPhoneNumberState"),resetResetPhoneNumberState:ut("resetPhoneNumberState",{resetPhoneNumberState:qt})},Jt={resetPhoneNumber:rt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:rt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:rt("auth/changePhoneNumber",(e=>({payload:e})))},Yt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Qt={setSSOLoader:ft("ssoState"),setSSOError:pt("ssoState"),setSSOState:dt("ssoState"),resetSSOState:ut("ssoState",{ssoState:Yt})},Xt={loadSSOConfigurationsV2:rt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:rt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:rt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:rt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:rt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:rt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:rt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:rt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:rt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:rt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:rt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:rt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:rt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:rt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:rt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:rt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:rt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:rt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:rt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:rt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:rt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:rt("auth/oidcPostlogin",(e=>({payload:e})))},Zt={loading:!1,error:null},en={setProfileState:dt("profileState"),resetProfileState:ut("profileState",{profileState:Zt})},tn={loadProfile:rt("auth/loadProfile"),saveProfile:rt("auth/saveProfile",(e=>({payload:e}))),changePassword:rt("auth/changePassword",(e=>({payload:e})))};let nn;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(nn||(nn={}));const on={step:nn.verify,loading:!1,saving:!1},an={setMfaState:dt("mfaState"),resetMfaState:ut("mfaState",{mfaState:on})},rn={enrollMfa:rt("auth/enrollMfa"),getMFADevices:rt("auth/getMFADevices"),getMFAStrategies:rt("auth/getMFAStrategies"),verifyMfa:rt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:rt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:rt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:rt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:rt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:rt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:rt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:rt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:rt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:rt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:rt("auth/disableMfaWebAuthn",(e=>({payload:e})))},ln={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}},sn={setTeamLoader:ft("teamState"),setTeamError:pt("teamState"),setTeamState:dt("teamState"),resetTeamState:ut("teamState",{teamState:ln})},cn={loadUsers:rt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:rt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:rt("auth/loadRoles",(e=>({payload:e}))),addUser:rt("auth/addUser",(e=>({payload:e}))),addUsersBulk:rt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:rt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:rt("auth/updateUser",(e=>({payload:e}))),deleteUser:rt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:rt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:rt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:rt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:rt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:rt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:rt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:rt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:rt("auth/getInvitationLink"),createInvitationLink:rt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:rt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:rt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:rt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:rt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:rt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:rt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:rt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:rt("auth/closeLockUserDialog",(e=>({payload:e})))},un={firstLoad:!0,loading:!1,error:""},dn={setSocialLoginsState:dt("socialLoginState"),resetSocialLoginsState:ut("socialLoginState",{socialLoginState:un})},yn={loadSocialLoginsConfiguration:rt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:rt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:rt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:rt("auth/setSocialLoginError",(e=>({payload:e})))};let fn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(fn||(fn={}));const pn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:fn.SignUp},gn={setSignUpState:dt("signUpState"),resetSignUpState:ut("signUpState",{signUpState:pn})},Sn={signUpUser:rt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:rt("auth/resetSignUpStateSoft")},vn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},hn={setApiTokensLoader:ft("apiTokensState"),setApiTokensError:pt("apiTokensState"),setApiTokensState:dt("apiTokensState"),resetApiTokensState:ut("apiTokensState",{apiTokensState:vn})},mn={loadApiTokens:rt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:rt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:rt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:rt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:rt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:rt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:rt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:rt("auth/deleteTenantApiToken",(e=>({payload:e})))},bn={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}},An={setSecurityPolicyState:dt("securityPolicyState"),setSecurityPolicyGlobalState:yt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:yt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:yt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:yt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:yt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:yt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:yt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:yt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:yt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:yt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:yt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:ut("securityPolicyState",{securityPolicyState:bn})},kn={loadSecurityPolicy:rt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:rt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:rt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:rt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:rt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:rt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:rt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:rt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:rt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:rt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:rt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:rt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:rt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:rt("auth/loadPublicAuthStrategiesPolicy")},Tn={loading:!1},Pn={setAccountSettingsState:dt("accountSettingsState"),resetAccountSettingsState:ut("accountSettingsState",{accountSettingsState:Tn})},In={loadAccountSettings:rt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:rt("auth/saveAccountSettings",(e=>({payload:e})))},Ln={tenants:[],subTenants:[],loading:!0,tenantTree:null},En={setTenantsState:dt("tenantsState"),resetTenantsState:ut("tenantsState",{tenantsState:Ln})},On={switchTenant:rt("auth/switchTenant",(e=>({payload:e}))),loadTenants:rt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:rt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:rt("auth/loadSubTenantsTree",(e=>({payload:e})))},wn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Dn={setRolesState:dt("rolesState"),resetRolesState:ut("rolesState",{rolesState:wn})},Cn={loadRolesAndPermissions:rt("auth/loadRoles",(e=>({payload:e}))),addRole:rt("auth/addRole",(e=>({payload:e}))),updateRole:rt("auth/updateRole",(e=>({payload:e}))),deleteRole:rt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:rt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:rt("auth/attachPermissionToRoles",(e=>({payload:e})))},Rn={loading:!1,sessions:[]},Un={setSessionsState:dt("sessionsState"),resetSessionsState:ut("sessionsState",{sessionsState:Rn})},_n={loadUserSessions:rt("auth/loadUserSessions"),loadCurrentUserSession:rt("auth/loadCurrentUserSession"),deleteUserSession:rt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:rt("auth/deleteAllUserSessions"),revokeUserSessions:rt("auth/revokeUserSessions",(e=>({payload:e})))},Mn={loading:!1,configurations:{}},Nn={setSessionsPolicyState:dt("sessionsPolicyState"),resetSessionsPolicyState:ut("sessionsPolicyState",{sessionsPolicyState:Mn})},Fn={loadSessionsPolicy:rt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:rt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let $n;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}($n||($n={}));const Gn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:$n.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},xn={setRestrictionsState:dt("restrictionsState"),setIpRestrictionsState:yt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:yt("restrictionsState","emailDomainRestrictions")},Vn={checkIfUserIpValid:rt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:rt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:rt("auth/loadIpRestrictions"),saveIpRestriction:rt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:rt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:rt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:rt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:rt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:rt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:rt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Wn={loading:!1},jn={setProvisioningState:dt("provisioningState"),resetProvisioningState:ut("provisioningState",{provisioningState:Wn})},Kn={loadProvisionConnections:rt("auth/loadProvisionConnections"),createProvisionConnection:rt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:rt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:rt("auth/updateProvisionConnection",(e=>({payload:e})))},Bn={devices:[],loading:!1,error:null},zn={setPasskeysState:dt("passkeysState"),resetPasskeysState:ut("passkeysState",{passkeysState:Bn})},qn={loadWebAuthnDevices:rt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:rt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Hn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Jn={setUsersGroupsLoader:ft("groupsState"),setUsersGroupsError:pt("groupsState"),setGroupsState:dt("groupsState"),resetUsersGroupsState:ut("groupsState",{groupsState:Hn})},Yn={loadGroups:rt("auth/loadUsersGroups"),getGroupById:rt("auth/getGroupById",(e=>({payload:e}))),createGroup:rt("auth/createGroup",(e=>({payload:e}))),updateGroup:rt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:rt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:rt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:rt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:rt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:rt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:rt("auth/getGroupConfiguration"),updateGroupConfiguration:rt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:rt("auth/getUsers",(e=>({payload:e})))},Qn={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}},Xn={setGroupsDialogsState:dt("groupsDialogsState"),resetGroupsDialogsState:ut("groupsState",{groupsDialogsState:Qn}),openAddGroupDialog:St("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:St("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:gt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:St("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:gt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:St("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:St("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:St("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:gt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:St("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},Zn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:pn,loginState:Ct,activateState:Mt,acceptInvitationState:Gt,forgotPasswordState:jt,ssoState:Yt,profileState:Zt,mfaState:on,teamState:ln,groupsState:Hn,groupsDialogsState:Qn,socialLoginState:un,apiTokensState:vn,securityPolicyState:bn,accountSettingsState:Tn,tenantsState:Ln,rolesState:wn,resetPhoneNumberState:qt,sessionsState:Rn,sessionsPolicyState:Mn,restrictionsState:Gn,provisioningState:Wn,passkeysState:Bn},eo=O({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:()=>{}},Zn);let to;!function(e){e.impersonating="impersonating",e.success="success"}(to||(to={}));const no={step:to.impersonating,loading:!1},oo={setImpersonateState:dt("impersonateState"),resetImpersonateState:ut("impersonateState",{impersonateState:no})},io={impersonate:rt("impersonation/impersonate",(e=>({payload:e})))},{reducer:ao,actions:ro}=st({name:Et,initialState:eo,reducers:O({resetState:e=>O({},e,Zn),setState:(e,{payload:t})=>O({},e,t),setUser:("user",(e,{payload:t})=>O({},e,{user:t}))},Rt,dn,Nt,oo,xt,Kt,Ht,gn,en,Qt,an,sn,Jn,Xn,hn,An,Pn,En,Dn,Un,Nn,xn,jn,zn)});const lo=O({},ro,Ut,yn,Ft,Vt,Bt,Jt,Sn,tn,Xt,rn,cn,Yn,{},mn,kn,In,On,Cn,_n,Fn,Vn,Kn,io,qn);var so=function(e){return"@@redux-saga/"+e},co=so("CANCEL_PROMISE"),uo=so("CHANNEL_END"),yo=so("IO"),fo=so("MATCH"),po=so("MULTICAST"),go=so("SAGA_ACTION"),So=so("SELF_CANCELLATION"),vo=so("TASK"),ho=so("TASK_CANCEL"),mo=so("TERMINATE"),bo=so("LOCATION");function Ao(e,t){if(null==e)return{};var n,o,i={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(i[n]=e[n]);return i}var ko=function(e){return null==e},To=function(e){return null!=e},Po=function(e){return"function"==typeof e},Io=function(e){return"string"==typeof e},Lo=Array.isArray,Eo=function(e){return e&&Po(e.then)},Oo=function(e){return e&&Po(e.next)&&Po(e.throw)},wo=function e(t){return t&&(Io(t)||Ro(t)||Po(t)||Lo(t)&&t.every(e))},Do=function(e){return e&&Po(e.take)&&Po(e.close)},Co=function(e){return Po(e)&&e.hasOwnProperty("toString")},Ro=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Uo=function(e,t){var n;void 0===t&&(t=!0);var o=new Promise((function(o){n=setTimeout(o,Math.min(2147483647,e),t)}));return o[co]=function(){clearTimeout(n)},o},_o=function(e){return function(){return e}},Mo=_o(!0),No=function(){},Fo=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var $o=function(e,t){O(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Go(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var xo=function(e){throw e},Vo=function(e){return{value:e,done:!0}};function Wo(e,t,n){void 0===t&&(t=xo),void 0===n&&(n="iterator");var o={meta:{name:n},next:e,throw:t,return:Vo,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function jo(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Ko=function(e){return Array.apply(null,new Array(e))},Bo=function(e){return function(t){return e(Object.defineProperty(t,go,{value:!0}))}},zo=function(e){return e===mo},qo=function(e){return e===ho},Ho=function(e){return zo(e)||qo(e)};function Jo(e,t){var n,o=Object.keys(e),i=o.length,a=0,r=Lo(e)?Ko(i):{},l={};return o.forEach((function(e){var o=function(o,l){n||(l||Ho(o)?(t.cancel(),t(o,l)):(r[e]=o,++a===i&&(n=!0,t(r))))};o.cancel=No,l[e]=o})),t.cancel=function(){n||(n=!0,o.forEach((function(e){return l[e].cancel()})))},l}function Yo(e){return{name:e.name||"anonymous",location:Qo(e)}}function Qo(e){return e[bo]}var Xo=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),o=0,i=0,a=0,r=function(t){n[i]=t,i=(i+1)%e,o++},l=function(){if(0!=o){var t=n[a];return n[a]=null,o--,a=(a+1)%e,t}},s=function(){for(var e=[];o;)e.push(l());return e};return{isEmpty:function(){return 0==o},put:function(l){var c;if(o<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[i]=l,a=i=(i+1)%e;break;case 4:c=2*e,n=s(),o=n.length,i=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},Zo="TAKE",ei="CALL",ti="FORK",ni="SELECT",oi=function(e,t){var n;return(n={})[yo]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function ii(e,t){return void 0===e&&(e="*"),wo(e)?(To(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),oi(Zo,{pattern:e})):Do(n=e)&&n[po]&&To(t)&&wo(t)?oi(Zo,{channel:e,pattern:t}):Do(e)?(To(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),oi(Zo,{channel:e})):void 0;var n}function ai(e,t){return ko(t)&&(t=e,e=void 0),oi("PUT",{channel:e,action:t})}function ri(e){var t=oi("ALL",e);return t.combinator=!0,t}function li(e,t){var n,o=null;return Po(e)?n=e:(Lo(e)?(o=e[0],n=e[1]):(o=e.context,n=e.fn),o&&Io(n)&&Po(o[n])&&(n=o[n])),{context:o,fn:n,args:t}}function si(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return oi(ei,li(e,n))}function ci(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return oi(ti,li(e,n))}function ui(e){return void 0===e&&(e=So),oi("CANCEL",e)}function di(e){void 0===e&&(e=Fo);for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return oi(ni,{selector:e,args:n})}var yi=si.bind(null,Uo);var fi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},pi=[],gi=0;function Si(e){try{mi(),e()}finally{bi()}}function vi(e){pi.push(e),gi||(mi(),Ai())}function hi(e){try{return mi(),e()}finally{Ai()}}function mi(){gi++}function bi(){gi--}function Ai(){var e;for(bi();!gi&&void 0!==(e=pi.shift());)Si(e)}var ki=function(e){return function(t){return e.some((function(e){return Ei(e)(t)}))}},Ti=function(e){return function(t){return e(t)}},Pi=function(e){return function(t){return t.type===String(e)}},Ii=function(e){return function(t){return t.type===e}},Li=function(){return Mo};function Ei(e){var t="*"===e?Li:Io(e)?Pi:Lo(e)?ki:Co(e)?Pi:Po(e)?Ti:Ro(e)?Ii:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Oi={type:uo},wi=function(e){return e&&e.type===uo};function Di(){var e,t,n,o,i,a,r=(t=!1,o=n=[],i=function(){o===n&&(o=n.slice())},a=function(){t=!0;var e=n=o;o=[],e.forEach((function(e){e(Oi)}))},(e={})[po]=!0,e.put=function(e){if(!t)if(wi(e))a();else for(var i=n=o,r=0,l=i.length;r<l;r++){var s=i[r];s[fo](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=Li),t?e(Oi):(e[fo]=n,i(),o.push(e),e.cancel=(a=!1,function(){a||(a=!0,i(),Go(o,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[go]?l(e):vi((function(){l(e)}))},r}function Ci(e,t){var n=e[co];Po(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Ri,Ui=0,_i=function(){return++Ui};function Mi(e){e.isRunning()&&e.cancel()}var Ni=((Ri={}).TAKE=function(e,t,n){var o=t.channel,i=void 0===o?e.channel:o,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!wi(e)||r?n(e):n(mo)};try{i.take(l,To(a)?Ei(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},Ri.PUT=function(e,t,n){var o=t.channel,i=t.action,a=t.resolve;vi((function(){var t;try{t=(o?o.put:e.dispatch)(i)}catch(e){return void n(e,!0)}a&&Eo(t)?Ci(t,n):n(t)}))},Ri.ALL=function(e,t,n,o){var i=o.digestEffect,a=Ui,r=Object.keys(t);if(0!==r.length){var l=Jo(t,n);r.forEach((function(e){i(t[e],a,l[e],e)}))}else n(Lo(t)?[]:{})},Ri.RACE=function(e,t,n,o){var i=o.digestEffect,a=Ui,r=Object.keys(t),l=Lo(t)?Ko(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,o){c||(o||Ho(t)?(n.cancel(),n(t,o)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=No,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||i(t[e],a,s[e],e)}))},Ri.CALL=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=o.task;try{var s=a.apply(i,r);if(Eo(s))return void Ci(s,n);if(Oo(s))return void zi(e,s,l.context,Ui,Yo(a),!1,n);n(s)}catch(e){n(e,!0)}},Ri.CPS=function(e,t,n){var o=t.context,i=t.fn,a=t.args;try{var r=function(e,t){ko(e)?n(t):n(e,!0)};i.apply(o,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Ri.FORK=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=t.detached,s=o.task,c=function(e){var t=e.context,n=e.fn,o=e.args;try{var i=n.apply(t,o);if(Oo(i))return i;var a=!1;return Wo((function(e){return a?{value:e,done:!0}:(a=!0,{value:i,done:!Eo(i)})}))}catch(e){return Wo((function(){throw e}))}}({context:i,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Yo(t)}(c,a);hi((function(){var t=zi(e,c,s.context,Ui,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},Ri.JOIN=function(e,t,n,o){var i=o.task,a=function(e,t){if(e.isRunning()){var n={task:i,cb:t};t.cancel=function(){e.isRunning()&&Go(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Lo(t)){if(0===t.length)return void n([]);var r=Jo(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Ri.CANCEL=function(e,t,n,o){var i=o.task;t===So?Mi(i):Lo(t)?t.forEach(Mi):Mi(t),n()},Ri.SELECT=function(e,t,n){var o=t.selector,i=t.args;try{n(o.apply(void 0,[e.getState()].concat(i)))}catch(e){n(e,!0)}},Ri.ACTION_CHANNEL=function(e,t,n){var o=t.pattern,i=function(e){void 0===e&&(e=Xo());var t=!1,n=[];return{take:function(o){t&&e.isEmpty()?o(Oi):e.isEmpty()?(n.push(o),o.cancel=function(){Go(n,o)}):o(e.take())},put:function(o){if(!t){if(0===n.length)return e.put(o);n.shift()(o)}},flush:function(n){t&&e.isEmpty()?n(Oi):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var o=0,i=e.length;o<i;o++)(0,e[o])(Oi)}}}}(t.buffer),a=Ei(o),r=function t(n){wi(n)||e.channel.take(t,a),i.put(n)},l=i.close;i.close=function(){r.cancel(),l()},e.channel.take(r,a),n(i)},Ri.CANCELLED=function(e,t,n,o){n(o.task.isCancelled())},Ri.FLUSH=function(e,t,n){t.flush(n)},Ri.GET_CONTEXT=function(e,t,n,o){n(o.task.context[t])},Ri.SET_CONTEXT=function(e,t,n,o){var i=o.task;$o(i.context,t),n()},Ri);function Fi(e,t){return e+"?"+t}function $i(e){var t=e.name,n=e.location;return n?t+" "+Fi(n.fileName,n.lineNumber):t}function Gi(e){var t,n,o,i=(t=function(e){return e.cancelledTasks},n=e,(o=[]).concat.apply(o,n.map(t)));return i.length?["Tasks cancelled due to error:"].concat(i).join("\n"):""}var xi=null,Vi=[],Wi=function(e){e.crashedEffect=xi,Vi.push(e)},ji=function(){xi=null,Vi.length=0},Ki=function(){var e,t,n=Vi[0],o=Vi.slice(1),i=n.crashedEffect?(e=n.crashedEffect,(t=Qo(e))?t.code+" "+Fi(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+$i(n.meta)+(i?" \n when executing effect "+i:"")].concat(o.map((function(e){return" created by "+$i(e.meta)})),[Gi(Vi)]).join("\n")};function Bi(e,t,n,o,i,a,r){var l;void 0===r&&(r=No);var s,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var o,i=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){i.push(t),t.cont=function(l,s){a||(Go(i,t),t.cont=No,s?r(l):(t===e&&(o=l),i.length||(a=!0,n(o))))}}function s(){a||(a=!0,i.forEach((function(e){e.cont=No,e.cancel()})),i=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return i}}}(t,0,g);function g(t,n){if(n){if(u=2,Wi({meta:i,cancelledTasks:y}),S.isRoot){var o=Ki();ji(),e.onError(t,{sagaStack:o})}c=t,d&&d.reject(t)}else t===ho?u=1:1!==u&&(u=3),s=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((l={})[vo]=!0,l.id=o,l.meta=i,l.isRoot=a,l.context=f,l.joiners=[],l.queue=p,l.cancel=function(){0===u&&(u=1,p.cancelAll(),g(ho,!1))},l.cont=r,l.end=g,l.setContext=function(e){$o(f,e)},l.toPromise=function(){return d||(d=fi(),2===u?d.reject(c):0!==u&&d.resolve(s)),d.promise},l.isRunning=function(){return 0===u},l.isCancelled=function(){return 1===u||0===u&&1===t.status},l.isAborted=function(){return 2===u},l.result=function(){return s},l.error=function(){return c},l);return S}function zi(e,t,n,o,i,a,r){var l=e.finalizeRunEffect((function(t,n,o){Eo(t)?Ci(t,o):Oo(t)?zi(e,t,c.context,n,i,!1,o):t&&t[yo]?(0,Ni[t.type])(e,t.payload,o,u):o(t)}));d.cancel=No;var s={meta:i,cancel:function(){0===s.status&&(s.status=1,d(ho))},status:0},c=Bi(e,s,n,o,i,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var i;n?(i=t.throw(e),ji()):qo(e)?(s.status=1,d.cancel(),i=Po(t.return)?t.return(ho):{done:!0,value:ho}):i=zo(e)?Po(t.return)?t.return():{done:!0}:t.next(e),i.done?(1!==s.status&&(s.status=3),s.cont(i.value)):y(i.value,o,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,o,i){void 0===i&&(i="");var a,r=_i();function s(n,i){a||(a=!0,o.cancel=No,e.sagaMonitor&&(i?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),i&&function(e){xi=e}(t),o(n,i))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:i,effect:t}),s.cancel=No,o.cancel=function(){a||(a=!0,s.cancel(),s.cancel=No,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function qi(e,t){for(var n=e.channel,o=void 0===n?Di():n,i=e.dispatch,a=e.getState,r=e.context,l=void 0===r?{}:r,s=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?jo:u,y=arguments.length,f=new Array(y>2?y-2:0),p=2;p<y;p++)f[p-2]=arguments[p];var g,S=t.apply(void 0,f),v=_i();if(s&&(s.rootSagaStarted=s.rootSagaStarted||No,s.effectTriggered=s.effectTriggered||No,s.effectResolved=s.effectResolved||No,s.effectRejected=s.effectRejected||No,s.effectCancelled=s.effectCancelled||No,s.actionDispatched=s.actionDispatched||No,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Ve.apply(void 0,c);g=function(e){return function(t,n,o){return h((function(t){return e(t,n,o)}))(t)}}}else g=Fo;var m={channel:o,dispatch:Bo(i),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return hi((function(){var e=zi(m,S,l,v,Yo(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var Hi=function(e){var t,n=void 0===e?{}:e,o=n.context,i=void 0===o?{}:o,a=n.channel,r=void 0===a?Di():a,l=n.sagaMonitor,s=Ao(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,o=e.dispatch;return t=qi.bind(null,O({},s,{context:i,channel:r,dispatch:o,getState:n,sagaMonitor:l})),function(e){return function(t){l&&l.actionDispatched&&l.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){$o(i,e)},c},Ji=function(e){return{done:!0,value:e}},Yi={};function Qi(e){return Do(e)?"channel":Co(e)?String(e):Po(e)?e.name:String(e)}function Xi(e,t,n){var o,i,a,r=t;function l(t,n){if(r===Yi)return Ji(t);if(n&&!i)throw r=Yi,n;o&&o(t);var l=n?e[i](n):e[r]();return r=l.nextState,a=l.effect,o=l.stateUpdater,i=l.errorState,r===Yi?Ji(t):a}return Wo(l,(function(e){return l(null,e)}),n)}function Zi(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:ii(e)},l=function(e){return{done:!1,value:ci.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return Xi({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Qi(e)+", "+t.name+")")}function ea(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r,l={done:!1,value:ii(e)},s=function(e){return{done:!1,value:ci.apply(void 0,[t].concat(o,[e]))}},c=function(e){return{done:!1,value:ui(e)}},u=function(e){return a=e},d=function(e){return r=e};return Xi({q1:function(){return{nextState:"q2",effect:l,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:s(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:s(r),stateUpdater:u}}},"q1","takeLatest("+Qi(e)+", "+t.name+")")}function ta(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:ii(e)},l=function(e){return{done:!1,value:si.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return Xi({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Qi(e)+", "+t.name+")")}function na(e,t,n){for(var o=e,i=arguments.length,a=new Array(i>3?i-3:0),r=3;r<i;r++)a[r-3]=arguments[r];var l={done:!1,value:si.apply(void 0,[n].concat(a))},s={done:!1,value:yi(t)};return Xi({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:Yi}},q10:function(e){if((o-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function oa(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return ci.apply(void 0,[Zi,e,t].concat(o))}function ia(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return ci.apply(void 0,[ea,e,t].concat(o))}function aa(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return ci.apply(void 0,[ta,e,t].concat(o))}class ra{constructor(){this.context=null,this.accessToken=null,this.user=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return ra.instance||(ra.instance=new ra),ra.instance}static setContext(e){ra.getInstance().context=e}static setAccessToken(e){ra.getInstance().accessToken=e}static setUser(e){ra.getInstance().user=e}static setOnRedirectTo(e){ra.getInstance().onRedirectTo=e}static setLogout(e,t){ra.getInstance().logout=n=>{n?e(n):ra.onRedirectTo(t)}}static getContext(){var e;return null!=(e=ra.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return ra.getInstance().accessToken}static getUser(){return ra.getInstance().user}static onRedirectTo(e,t){return ra.getInstance().onRedirectTo(e,t)}static logout(e){return ra.getInstance().logout(e)}}ra.instance=void 0;const la={getContext:()=>ra.getContext(),getAccessToken:()=>ra.getAccessToken(),getUser:()=>ra.getUser(),onRedirectTo:(e,t)=>ra.onRedirectTo(e,t),logout:e=>ra.logout(e)};class sa extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function ca(e,t,n=!0){let o;o="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const i=e.urlPrefix||"frontegg",a="frontegg"===i&&!n;return o.endsWith("/")||(o+="/"),o.endsWith(i)||a||(o+=i),o}const ua=async e=>{var t,n,o;const i=ra.getContext(),a=await async function(e,t){var n;const o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:ra.getAccessToken)(),i={};o&&(i.Authorization=`Bearer ${o}`),t&&(i["Content-Type"]=t);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["x-frontegg-source"]="frontegg-react",i}(i,e.contentType),r=await async function(e,t,n){const o=ca(e,t),i=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const o=Object.keys(t);for(const e of o){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${o}${t}`;const r=Object.keys(i).length>0;return i&&r&&(a+=`?${new URLSearchParams(i)}`),a}(i,e.url,e.params),l=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:O({},a,e.headers),credentials:null!=(n=null!=(o=e.credentials)?o:i.requestCredentials)?n:"same-origin"});if(302===l.status)return window.location.href=await l.text(),new Promise((()=>{}));if(!l.ok){var s,c;if(413===l.status)throw new sa("Error request is too large",l.status);let e;try{e=await l.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=i.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=i.logLevel)?c:"")&&console.error(e),new sa(e,l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},da=async(e,t,n)=>ua(O({url:e,method:"GET",contentType:"application/json",params:t},n)),ya=async(e,t,n)=>ua(O({url:e,method:"POST",contentType:"application/json",body:t},n)),fa=async(e,t,n)=>ua(O({url:e,method:"PATCH",contentType:"application/json",body:t},n)),pa=async(e,t,n)=>ua(O({url:e,method:"PUT",contentType:"application/json",body:t},n)),ga=async(e,t,n)=>ua(O({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Sa=async(e,t,n,o)=>ua(O({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),va={v1:"/identity/resources/users/webauthn/v1/devices"},ha={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},ma={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",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"}}},ba={v1:"/identity/resources/configurations/v1"},Aa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},ka={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ta={v1:"/identity/resources/permissions/v1"},Pa={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"}}},Ia={v1:"/identity/resources/roles/v1"},La={v1:"/identity/resources/sub-tenants/users/v1"},Ea={v1:"/identity/resources/impersonation/v1"},Oa={configurations:{v1:"/identity/resources/groups/v1/config"},v1:"/identity/resources/groups/v1",roles:"/roles",users:"/users"},wa={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},Da={v1:"/team/resources/members/v1"},Ca={v1:"/team/resources/roles/v1"},Ra={v1:"/team/resources/stats/v1"},Ua={v1:"/team/resources/profile"},_a={v1:"/tenants/resources/account-settings/v1"},Ma={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},Na={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Fa={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"}}}},$a={v1:"/subscriptions/resources/payment-providers/v1"},Ga={v1:"/subscriptions/resources/subscriptions/v1"},xa={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Va={v1:"/reports/engine/resources/triggers/v1"},Wa="/notification",ja="/audits",Ka={v1:"/event/resources/configurations/v1"},Ba="/webhook",za="/oauth",qa="/flags",Ha="/directory/resources/v1/configurations/scim2",Ja="/directory/resources/scim/temp";async function Ya(e){return pa(`${ma.v1}/tenant`,e)}async function Qa(){return da(`${ma.v2}/me/tenants`)}async function Xa(){return da(Ma.v1)}async function Za(){return da(Ma.tree.v1)}async function er(){return da(ba.v1)}async function tr(){return da(`${ba.v1}/mfa-policy`)}async function nr(){return da(`${ba.v1}/mfa-policy/vendor`)}async function or(e){return e.id?fa(`${ba.v1}/mfa-policy`,e):ya(`${ba.v1}/mfa-policy`,e)}async function ir(){return da(`${ba.v1}/lockout-policy`)}async function ar(){return da(`${ba.v1}/lockout-policy/vendor`)}async function rr(e){return e.id?fa(`${ba.v1}/lockout-policy`,e):ya(`${ba.v1}/lockout-policy`,e)}async function lr(){try{return await da(`${ba.v1}/captcha-policy/public`)}catch{return null}}async function sr(){return da(`${ba.v1}/password-history-policy`)}async function cr(){return da(`${ba.v1}/password-history-policy/vendor`)}async function ur(e){return e.id?fa(`${ba.v1}/password-history-policy`,e):ya(`${ba.v1}/password-history-policy`,e)}async function dr(){return da(`${ba.v1}/password`)}async function yr(){return da(`${Aa.emailDomain.v1}`)}async function fr(){return da(`${Aa.emailDomain.v1}/config`)}async function pr(e){return ya(`${Aa.emailDomain.v1}`,e)}async function gr(e){return ya(`${Aa.emailDomain.v1}/config`,e)}async function Sr(e){return ga(`${Aa.emailDomain.v1}/${e}`)}async function vr(e){return da(`${Aa.ip.v1}`,e)}async function hr(){return da(`${Aa.ip.v1}/config`)}async function mr(e){return ya(`${Aa.ip.v1}`,e)}async function br(e){return ya(`${Aa.ip.v1}/bulk`,e)}async function Ar(e){return ya(`${Aa.ip.v1}/config`,e)}async function kr(e){return ga(`${Aa.ip.v1}/${e}`)}async function Tr(){return ya(`${Aa.ip.v1}/verify`)}async function Pr(){return ya(`${Aa.ip.v1}/verify/allow`)}let Ir,Lr,Er;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Ir||(Ir={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Lr||(Lr={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Er||(Er={}));class Or 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 Or("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,o,i=0,a=0;o=t.charAt(a++);~o&&(e=i%4?64*e+o:o,i++%4)?n+=String.fromCharCode(255&e>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return n};class Dr extends Error{constructor(e){super(e)}}const Cr=(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 Dr("Invalid token specified: "+e.message)}},Rr=["type"],Ur=["type"];async function _r(e){if(!e.accessToken)return e;ra.setAccessToken(e.accessToken);const t=await da(`${ma.v2}/me`),n=O({},e,e.accessToken?Cr(e.accessToken):{},t);return ra.setUser(n),n}async function Mr(e){if(!e.accessToken)return{user:e};ra.setAccessToken(e.accessToken);const[t,n]=await Promise.all([da(`${ma.v2}/me`),Qa()]),o=O({},e,e.accessToken?Cr(e.accessToken):{},t);return ra.setUser(o),{user:o,tenants:n}}async function Nr(e){ra.setAccessToken(e.id_token);const t=await da(`${ma.v2}/me`),n=e.id_token?Cr(e.id_token):{},o=O({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:n.exp?Math.ceil(n.exp-(new Date).getTime()/1e3):300});return ra.setUser(o),o}async function Fr(e){try{const{address:t}=await ya(`${ha.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function $r(e){return ya(`${ha.v1}/user/saml/prelogin`,e)}async function Gr(e){return _r(await ya(`${ha.v1}/user/saml/postlogin`,e))}async function xr(e){return _r(await ya(`${ha.v1}/user/oidc/postlogin`,e))}async function Vr(e){return _r(await ya(`${ha.v1}/user`,e))}async function Wr(e){return _r(await ya(`${ha.v1}/user/mfa/verify`,e))}async function jr(e){return ya(`${ma.v1}/activate`,e)}async function Kr(e){return da(`${ma.v1}/activate/strategy`,e)}async function Br(e){return ya(`${ma.v1}/activate/reset`,e)}async function zr(e){return ya(`${ma.v1}/invitation/reset`,e)}async function qr(e){return ya(`${ma.v1}/invitation/accept`,e)}async function Hr(){return _r(await ya(`${ha.v1}/user/token/refresh`))}async function Jr(){return Mr(await ya(`${ha.v1}/user/token/refresh`))}async function Yr(){return ya(`${ha.v1}/logout`)}async function Qr(e){return da(`${za}/logout`,e)}async function Xr(e){return ya(`${ma.v1}/passwords/reset`,e)}async function Zr(e){return ya(`${ma.v1}/passwords/reset/verify`,e)}async function el(e){return da(`${ma.v1}/passwords/config`,e)}async function tl(e){return ya(`${ha.v1}/user/mfa/recover`,e)}async function nl(){return ya(`${ma.v1}/mfa/enroll`)}async function ol(){return ya(`${ma.v1}/mfa/authenticator/enroll`)}async function il(e){return ya(`${ma.v1}/mfa/authenticator/enroll/verify`,e)}async function al(e){return ya(`${ma.v1}/mfa/sms/enroll`,e)}async function rl(e){return ya(`${ma.v1}/mfa/sms/enroll/verify`,e)}async function ll(){return ya(`${ma.v1}/mfa/webauthn/enroll`)}async function sl(e){return ya(`${ma.v1}/mfa/webauthn/enroll/verify`,e)}async function cl(e){return ya(`${ma.v1}/mfa/enroll/verify`,e)}async function ul(e){return ya(`${ma.v1}/mfa/disable`,e)}async function dl(e,t){return ya(`${ma.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function yl(e){return ya(`${ma.v1}/mfa/sms/${e}/disable`)}async function fl(e,t){return ya(`${ma.v1}/mfa/sms/${e}/disable/verify`,t)}async function pl(e){return ya(`${ma.v1}/mfa/webauthn/${e}/disable`)}async function gl(e,t){return ya(`${ma.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Sl(){return da(`${ma.v1}/mfa/devices`)}async function vl(e){return ya(`${ha.v1}/user/mfa/authenticator/enroll`,e)}async function hl(e){return ya(`${ha.v1}/user/mfa/authenticator/enroll/verify`,e)}async function ml(e,t){return ya(`${ha.v1}/user/mfa/authenticator/${e}/verify`,t)}async function bl(e){return ya(`${ha.v1}/user/mfa/sms/enroll`,e)}async function Al(e){return ya(`${ha.v1}/user/mfa/sms/enroll/verify`,e)}async function kl(e,t){return ya(`${ha.v1}/user/mfa/sms/${e}`,t)}async function Tl(e,t){return ya(`${ha.v1}/user/mfa/sms/${e}/verify`,t)}async function Pl(e){return ya(`${ha.v1}/user/mfa/webauthn/enroll`,e)}async function Il(e){return ya(`${ha.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Ll(e,t){return ya(`${ha.v1}/user/mfa/webauthn/${e}`,t)}async function El(e,t){return ya(`${ha.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Ol(){return da(`${wa.v1}/saml/configurations`)}async function wl(e){return ya(`${wa.v1}/saml/configurations`,e)}async function Dl(){return da(`${wa.v1}/saml/configurations/vendor-config`)}async function Cl(e){return pa(`${wa.v1}/saml/configurations/metadata`,e)}async function Rl(){return pa(`${wa.v1}/saml/validations/domain`)}async function Ul(){return da(`${wa.v1}/saml/configurations/roles/default`)}async function _l(){return da(`${wa.v2}/saml/configurations/groups`)}async function Ml({roleIds:e}){return ya(`${wa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Nl({roleIds:e,group:t}){return ya(`${wa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Fl({roleIds:e,group:t,id:n}){return fa(`${wa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function $l({id:e}){return ga(`${wa.v2}/saml/configurations/groups/${e}`)}async function Gl(){return da(`${wa.v1}/oidc/configurations`)}async function xl(){return da(`${wa.v2}/configurations/public`)}async function Vl(){return da(ka.v1)}async function Wl(){return da(ka.v2)}async function jl(){return da(ka.custom.v1)}async function Kl({provider:e,code:t,idToken:n,redirectUri:o,codeVerifier:i,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),o&&(s.redirectUri=o),i&&(s.code_verifier=i),l&&(s.state=l),ya(`${ha.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function Bl(){return da(`${ba.v1}/public`)}async function zl(e){const{shouldActivate:t,authResponse:n,userId:o,tenantId:i}=await ya(`${ma.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await _r(n):void 0,userId:o,tenantId:i}}async function ql(){return da(ma.sessions.currentUser.v1)}async function Hl(){return da(`${ma.sessions.currentUser.v1}/current`)}async function Jl(e){return ya(`${ma.sessions.v1}/revoke`,{userId:e})}async function Yl(){return da(ma.sessions.configurations.v1)}async function Ql(e){await ya(ma.sessions.configurations.v1,e)}async function Xl(e){await ga(`${ma.sessions.currentUser.v1}/${e}`)}async function Zl(){await ga(`${ma.sessions.currentUser.v1}/all`)}async function es(){return da(ma.accessTokens.v1)}async function ts(){return da(Pa.accessTokens.v1)}async function ns({id:e}){return ga(`${Pa.accessTokens.v1}/${e}`)}async function os({id:e}){return ga(`${ma.accessTokens.v1}/${e}`)}async function is(e){return ya(ma.accessTokens.v1,e)}async function as(e){return ya(Pa.accessTokens.v1,e)}async function rs(){return da(ma.apiTokens.v1)}async function ls(){return da(Pa.apiTokens.v1)}async function ss(e){return ya(ma.apiTokens.v1,e)}async function cs(e){return ya(Pa.apiTokens.v2,e)}async function us({tokenId:e}){return ga(`${Pa.apiTokens.v1}/${e}`)}async function ds({tokenId:e}){return ga(`${ma.apiTokens.v1}/${e}`)}async function ys({userId:e}){return da(`${ma.v1}/${e}`)}async function fs(e){return da(`${ba.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function ps(e){let{type:t}=e,n=Ao(e,Rr);return ya(`${ha.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function gs(e){let{type:t}=e,n=Ao(e,Ur);return ya(`${ha.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Ss({token:e}){return ya(Pa.invites.verify.v1,{token:e})}async function vs(){return da(`${wa.v1}/configurations`)}async function hs(e){return ya(`${wa.v1}/configurations`,e)}async function ms(e,t){return fa(`${wa.v1}/configurations/${e}`,t)}async function bs(e){return ga(`${wa.v1}/configurations/${e}`)}async function As(e){return ya(`${wa.v1}/configurations/metadata`,e)}async function ks(e,t){return pa(`${wa.v1}/configurations/${e}/metadata`,t)}async function Ts(e,t){return ya(`${wa.v1}/configurations/${e}/domains`,t)}async function Ps(e,t){return ga(`${wa.v1}/configurations/${e}/domains/${t}`)}async function Is(e,t){return pa(`${wa.v1}/configurations/${e}/domains/${t}/validate`)}async function Ls(e){return da(`${wa.v1}/configurations/${e}/roles`)}async function Es(e,t){return pa(`${wa.v1}/configurations/${e}/roles`,t)}async function Os(e,t){return ya(`${wa.v1}/configurations/${e}/groups`,t)}async function ws(e,{roleIds:t,group:n,id:o}){return fa(`${wa.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function Ds(e,t){return ga(`${wa.v1}/configurations/${e}/groups/${t}`)}async function Cs(e){return da(`${wa.v1}/configurations/${e}/groups`)}async function Rs(e){return ya(`${ha.v2}/user/sso/prelogin`,e)}async function Us(e){return _r(await ya(`${ha.v2}/user/oidc/postlogin`,e))}async function _s(e){return Nr(await ya(`${za}/token`,e))}async function Ms(){return Nr(await ya(`${za}/authorize/silent`))}async function Ns(e){return ya(`${ma.v1}/phone/reset`,e)}async function Fs(e){return ya(`${ma.v1}/phone/reset/verify`,e)}async function $s(e){return ya(`${ma.v1}/phone`,e)}async function Gs(e){return ya(`${ma.v1}/phone/verify`,e)}async function xs(e){return pa(`${ma.v1}/phone/change`,e)}async function Vs(e){return ya(`${ha.v1}/webauthn/prelogin`,e)}async function Ws(e){return ya(`${ha.v1}/webauthn/postlogin`,e)}async function js(){return ya(va.v1)}async function Ks(){return da(va.v1)}async function Bs(e){return ga(`${va.v1}/${e}`)}async function zs(e){return ya(`${va.v1}/verify`,e)}async function qs(){return da(`${ba.v1}/auth/strategies/public`)}async function Hs(){return da(`${ba.v1}/mfa/strategies`)}async function Js(e){return da(`${ma.v2}/me`,null!=e?e:{addRoles:!0})}async function Ys(e){return pa(`${ma.v2}/me`,e)}async function Qs(e){return pa(`${Ua.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Xs(e){return ya(`${ma.v1}/passwords/change`,e)}async function Zs(e){var t,n,o,i,a,r;const l=(e.filter||[]).reduce(((e,t)=>O({},e,{[t.id]:t.value})),{}),s=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(o=e.sort)||null==(i=o[0])?void 0:i.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return da(Da.v1,O({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function ec(e){return ya(ma.v2,O({},e,{provider:"local"}))}async function tc(e){return ga(`${Da.v1}/${e.userId}`)}async function nc(e){return pa(Da.v1,e)}async function oc(e){return ya(Pa.invites.user.v1,O({},e))}async function ic(e){return fa(Pa.invites.user.v1,O({},e))}async function ac(){return ga(Pa.invites.user.v1)}async function rc(){return da(Pa.invites.user.v1)}async function lc(){return da(Pa.invites.configuration.v1)}async function sc(){return da(Ca.v1)}async function cc(){return da(Ta.v1)}async function uc(){return da(`${Ra.v1}/members`)}async function dc(e){return ya(`${Da.v1}/${e.userId}/resendActivationEmail`,{})}async function yc(e){return ya(ma.v2,O({},e,{provider:"local"}))}async function fc(e){return ya(ma.invitation.resendAll.v1,O({},e))}async function pc(e){var t,n;const o=await da("/metadata",e);if(null!=o&&null!=(t=o.rows)&&t[0])return null==o||null==(n=o.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function gc(){const e=await da("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Sc=async()=>pc({entityName:"notifications"}),vc=async()=>pc({entityName:"saml"}),hc=async()=>pc({entityName:"audits"}),mc=async e=>async function(e){const t=await da(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),bc=["dataFilters"],Ac=["templateId","dataFilters"],kc=["dataFilters"];async function Tc(e){return da(`${xa.v2}/tenant-reports`,e)}async function Pc(e){return da(`${xa.v2}/${e.id}/tenant-reports`)}async function Ic(e){let{dataFilters:t}=e,n=Ao(e,bc);return{html:await da(`${Va.v1}/preview-report`,O({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Lc(e){let{templateId:t,dataFilters:n}=e,o=Ao(e,Ac);return ya(`${xa.v2}/${t}/tenant-reports`,O({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Ec(e){let{dataFilters:t}=e,n=Ao(e,kc);const o=await da(`${Va.v1}/preview-report`,O({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let i="text/html",a="html";"pdf"===n.responseType?(i="application/pdf",a="pdf"):"image"===n.responseType&&(i="image/jpeg",a="jpg");const r=new Blob([o],{type:i}),l=URL.createObjectURL(r),s=document.createElement("a");s.href=l,s.setAttribute("download",`report_${n.name||""}.${a}`),s.click(),setTimeout(s.remove.bind(s))}async function Oc(e){return ya(`${Va.v1}/tenant-reports`,e)}async function wc(e){return da(Wa,{params:e})}async function Dc(e){return pa(`${Wa}/status`,{params:e})}async function Cc(e){const{notificationId:t,pinStatus:n}=e;return pa(`${Wa}/${n}`,{notificationId:t})}async function Rc(){return ya(`${Wa}/status/mark-all-read`)}const Uc=["endpoint","headerProps"];async function _c(e){return da(ja,e)}async function Mc(e){return da(`${ja}/stats`,e)}async function Nc(e){const{endpoint:t,headerProps:n}=e,o=Ao(e,Uc);return Sa(`${ja}/export/${t}`,{properties:n},o)}const Fc=["eventKey"],$c=["eventKey"],Gc=()=>da(`${Na.v1}/slack`),xc=()=>da(`${Na.v1}/slack/applications`),Vc=()=>da(`${Na.v1}/slack/channels`),Wc=e=>e.id?fa(`${Na.v1}/slack/subscription/${e.id}`,e):ya(`${Na.v1}/slack/subscriptions`,e),jc=e=>ga(`${Na.v1}/slack/subscriptions/${e.id}`),Kc=e=>ya(`${Na.v1}/slack/applications/registrations`,{code:e}),Bc=()=>da(`${Na.v1}/emails`),zc=e=>{let{eventKey:t}=e,n=Ao(e,Fc);return ya(`${Na.v1}/emails/${t}`,n)},qc=({eventKey:e,enabled:t})=>fa(`${Na.v1}/emails/${e}`,{enabled:t}),Hc=(e,t)=>ga(`${Na.v1}/emails/${e}/subscriptions/${t}`),Jc=(e,t,n)=>pa(`${Na.v1}/emails/${t}/subscriptions/${e}`,n),Yc=e=>ga(`${Na.v1}/emails/${e}`),Qc=()=>da(`${Na.v2}/sms`),Xc=e=>{let{eventKey:t}=e,n=Ao(e,$c);return ya(`${Na.v2}/sms/${t}`,n)},Zc=({eventKey:e,enabled:t})=>fa(`${Na.v2}/sms/${e}`,{enabled:t}),eu=(e,t)=>ga(`${Na.v2}/sms/${e}/subscriptions/${t}`),tu=(e,t,n)=>pa(`${Na.v2}/sms/${t}/subscriptions/${e}`,n),nu=e=>ga(`${Na.v2}/sms/${e}`),ou=()=>da(Ba),iu=e=>e._id?fa(`${Ba}/${e._id}`,e):ya(`${Ba}/custom`,e),au=e=>ga(`${Ba}/${e}`),ru=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return da(`${Ba}/logs/?${o.toString()}`)},lu=e=>ya(`${Ba}/test`,e),su=e=>ya(`${Ba}/logs/${e}/retries`),cu=()=>da(`${Ka.v1}/categories`),uu=e=>da(Ka.v1,{channels:e});async function du(e){return pa(_a.v1,e)}async function yu(){return da(_a.v1)}const fu=["roleId"],pu=["roleId"],gu=["permissionId"];async function Su(){return da(Ia.v1)}async function vu(e){return ya(Ia.v1,e)}async function hu({roleId:e}){return ga(`${Ia.v1}/${e}`)}async function mu(e){let{roleId:t}=e,n=Ao(e,fu);return fa(`${Ia.v1}/${t}`,n)}async function bu(e){let{roleId:t}=e,n=Ao(e,pu);return pa(`${Ia.v1}/${t}/permissions`,n)}async function Au(){return da(Ta.v1)}async function ku(e){let{permissionId:t}=e,n=Ao(e,gu);return pa(`${Ta.v1}/${t}/roles`,n)}async function Tu(){return da(`${Ta.v1}/categories`)}async function Pu(){return da(Fa.subscriptions.v1)}async function Iu(e){return da(`${Fa.subscriptions.v1}/${e}`)}async function Lu(e){return pa(`${Fa.subscriptions.v1}/${e}/cancellations/`,{})}async function Eu(e){return pa(`${Fa.subscriptions.v1}/${e}/renewals/`,{})}async function Ou(e,{paymentMethodId:t,planId:n}){return pa(`${Fa.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function wu(e){return da(`${Ga.v1}/${e}`)}async function Du(){return da(`${Ga.v1}`)}async function Cu(e){return pa(`${Ga.v1}/${e}/cancellations/`,{})}async function Ru(e){return pa(`${Ga.v1}/${e}/renewals/`,{})}async function Uu(e,{paymentMethodId:t,planId:n}){return pa(`${Ga.v1}/${e}`,{paymentMethodId:t,planId:n})}async function _u(){return da(Fa.plans.v1)}async function Mu(e){return da(`${Fa.plans.v1}/${e}`)}async function Nu(){return da(Fa.invoices.v1)}async function Fu(e){return da(`${Fa.invoices.v1}/${e}`)}async function $u(e,t){return da(`${Fa.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Gu=["email"];async function xu(){return da(Fa.paymentMethods.v1)}async function Vu(e){return da(`${Fa.paymentMethods.v1}/${e}`)}async function Wu(e,t){let{email:n}=t,o=Ao(t,Gu);return fa(`${Fa.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function ju(e){return ya(Fa.paymentProviders.stripe.subscriptions.v1,e)}async function Ku(e){return da(`${Fa.paymentProviders.stripe.customers.v1}/${e}`)}async function Bu(e){return ya(`${Fa.paymentProviders.stripe.customers.v1}`,e)}async function zu(){return da(`${Fa.paymentProviders.stripe.publicConfigurations.v1}`)}async function qu(e){return ya(`${Fa.paymentProviders.stripe.setupIntents.v1}`,e)}async function Hu(e){return da(`${Fa.summaries.v1}/${e}`)}async function Ju(e){return da(`${Fa.tenantConfiguration.v1}/${e}`)}async function Yu(e){return ya(`${Fa.tenantConfiguration.v1}`,e)}async function Qu(){return da($a.v1)}async function Xu(){return da(`${Fa.configurations.vendorPublicConfigurations.v1}`)}let Zu,ed,td,nd,od,id;async function ad(){return da("/vendors/public")}async function rd(e){return da(La.v1,e)}async function ld(e){return ya(La.v1,e)}async function sd(e){return ga(La.v1,e)}async function cd(e,t){return ya(`${La.v1}/${e}/roles`,t)}async function ud(e,t){return ga(`${La.v1}/${e}/roles`,t)}async function dd(e,t){return fa(`${La.v1}/${e}/roles`,t)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Zu||(Zu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(ed||(ed={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(td||(td={})),(nd||(nd={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(od||(od={})),function(e){e.CREATE="create_customer"}(id||(id={}));const yd={flags:{}};class fd{constructor(){this._flags=yd.flags}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new fd;return n.set(e),fd._instances[t]=n,n}static getFeatureFlags(e){const t=this.getInstance();return e.map((e=>"on"===(null==t?void 0:t._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t,n;this._flags=O({},null!=(t=null==yd?void 0:yd.flags)?t:{},null!=(n=null==e?void 0:e.flags)?n:{})}}async function pd(){return da(qa)}async function gd(){return da(`${Ha}`)}async function Sd(e,t){return fa(`${Ha}/${e}`,t)}async function vd(e){return ya(`${Ha}`,e)}async function hd(e){return ga(`${Ha}/${e}`)}async function md(e){return da(`${Ja}/${e}/Users/count`)}async function bd(e){return ya(`${Ea.v1}`,e)}fd._instances={};const Ad=["groupId"];async function kd({groupId:e},t){return da(`${Oa.v1}/${e}`,O({},t))}async function Td(e){return da(`${Oa.v1}`,O({},e))}async function Pd(e){return ya(`${Oa.v1}`,e)}async function Id(e){let{groupId:t}=e,n=Ao(e,Ad);return fa(`${Oa.v1}/${t}`,n)}async function Ld(e){return ga(`${Oa.v1}/${e}`)}async function Ed(e,t){return ya(`${Oa.v1}/${e}${Oa.roles}`,t)}async function Od(e,t){return ga(`${Oa.v1}/${e}${Oa.roles}`,t)}async function wd(e,t){return ya(`${Oa.v1}/${e}${Oa.users}`,t)}async function Dd(e,t){return ga(`${Oa.v1}/${e}${Oa.users}`,t)}async function Cd(){return da(`${Oa.configurations.v1}`)}async function Rd(e){return ya(`${Oa.configurations.v1}`,e)}let Ud,_d,Md,Nd,Fd;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(Ud||(Ud={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(_d||(_d={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Md||(Md={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Nd||(Nd={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Fd||(Fd={}));const $d=[`${ha.v1}/logout`,`${za}/logout`],Gd=[...$d,`${ha.v1}/user/saml/postlogin`,`${ha.v2}/user/oidc/postlogin`,`${ha.v1}/user`,`${ha.v1}/user/mfa/verify`,`${ha.v1}/user/token/refresh`,`${ma.v1}`,`${ma.v1}/signUp`,`${ha.v1}/passwordless/magiclink/postlogin`,`${ha.v1}/passwordless/code/postlogin`,`${ha.v1}/passwordless/smscode/postlogin`,`${ma.v1}/activate`,`${ma.v1}/invitation/accept`,`${za}/token`,`${za}/authorize/silent`],xd=`${ha.v1}/user/token/refresh`,Vd=`${za}/authorize/silent`,Wd=`${ma.v2}/me`,jd=`${ma.v2}/me/tenants`;let Kd;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Kd||(Kd={}));const Bd={auth:i,teams:a,metadata:r,reports:l,connectivity:u,notifications:s,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:p,subTenants:g,featureFlags:S,directory:v,impersonate:h,groups:m};var zd={fetch:e,ContextHolder:ra,FronteggContext:la,api:Bd,FronteggApiError:sa,AuthStrategyEnum:Lr,MachineToMachineAuthStrategy:Er,SocialLoginProviders:Ir,ISubscriptionCancellationPolicy:td,ISubscriptionStatus:Zu,PaymentMethodType:ed,ProviderType:nd};let qd,Hd;function Jd(e,t){const n=O({},e);return t.forEach((e=>{delete n[e]})),n}async function Yd(e){const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Qd(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let o=0;o<e;o++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(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"}(qd||(qd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Hd||(Hd={}));const Xd=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n})),Zd=e=>fd.getFeatureFlags(e),ey={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},ty=O({},ey,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),ny=[{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"}],oy={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},iy=O({},oy,{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}),ay={loading:!1,error:void 0,saving:!0,profile:oy},ry={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"},ly={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Lr.EmailAndPassword,machineToMachineAuthStrategy:Er.ClientCredentials},sy={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},cy={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},uy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},dy={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},yy={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},fy=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],py={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:dy,roles:fy,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},gy=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Sy={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:[ny[0]]},vy={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:[ny[1]]},hy={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},my=[vy,Sy],by=[hy],Ay=[{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}],ky=[{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"}],Ty={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Py={isActive:!0,strategy:$n.ALLOW},Iy=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:$n.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:$n.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:$n.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:$n.BLOCK,description:"IP 4"}],Ly=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(O({},vy,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Ey=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"}),Oy=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Ly(6),roles:[Ey("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}'},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Ly(44),roles:[Ey("Editor")]},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Ly(8),roles:[Ey("Viewer")]},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Ly(5),roles:[Ey("Admin"),Ey("Owner")]},{id:"id5",name:"Sales",color:"#ED8E7C",users:Ly(21),description:"BDR, AE, and inside sales",roles:[Ey("Viewer")]},{id:"id6",name:"Support",color:"#A79D7B",users:Ly(23),description:"Dev success and customer success",roles:[Ey("Admin")]},{id:"id7",name:"Marketing",color:"#2CA744",users:Ly(10),description:"The marketing department",roles:[Ey("Viewer")]},{id:"id8",name:"HR",color:"#EAE1C2",users:Ly(4),description:"Human resources",roles:[Ey("Viewer")]},{id:"id9",name:"Finance",color:"#5587C0",users:Ly(3),roles:[Ey("Viewer")]},{id:"id10",name:"Operations",color:"#B1CAE7",users:Ly(8),roles:[Ey("Editor")]},{id:"id11",name:"Legal",color:"#2CA744",users:Ly(4),roles:[Ey("Viewer")]}];let wy,Dy,Cy;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(wy||(wy={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Dy||(Dy={})),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"}(Cy||(Cy={})),Cy.profile,Cy.privacy,Cy.personalApiTokens,Cy.account,Cy.users,Cy.groups,Cy.security,Cy.sso,Cy.audits,Cy.webhooks,Cy.apiTokens,Cy.roles,Cy.subscriptions;const Ry=["events","url"];function*Uy(){yield ai(lo.setSignUpState({loading:!0}));try{const e=yield si(Bd.auth.getVendorConfig),[t]=(yield si(Bd.auth.getVendorPublicAuthStrategiesConfig),Zd(["admin_portal_login_per_tenant"]));if(t){const t=yield si(Bd.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:o}=e;yield ai(lo.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:o,firstLoad:!1})),yield ai(lo.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*_y(e){let{payload:{events:t,url:n}}=e,o=Ao(e.payload,Ry);yield ai(lo.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield di((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield si(Bd.auth.signUpUser,o);if(!o.invitationToken){var i;const{email:e,name:a,companyName:r}=o;null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:Dy.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(ra.setAccessToken(null==l?void 0:l.accessToken),ra.setUser(l),!r&&l&&qf(l)){const t=yield Yf(l);yield ai(lo.setState(t)),a(e.loginUrl)}else yield ai(lo.setSignUpState({loading:!1,shouldActivate:r,stage:fn.SignUpSuccess})),yield ai(lo.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield ai(lo.loadTenants()))}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setSignUpState({loading:!1,error:e.message}))}yield ai(lo.setSignUpState({loading:!1}))}function*My(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield di((e=>e.auth.signUpState));yield ai(lo.resetSignUpState()),yield ai(lo.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Ny(){yield aa(lo.signUpUser,_y),yield aa(lo.resetSignUpStateSoft,My)}const Fy={setVendorState:(e,{payload:t})=>O({},e,t)},$y={loadVendorPublicInfo:rt("vendor/loadVendorPublicInfo")},Gy={loading:!1},{reducer:xy,actions:Vy}=st({name:Dt,initialState:Gy,reducers:O({},Fy)}),Wy=O({},Vy,$y);function*jy(){yield ai(Wy.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Bd.vendor.getVendorPublicInfo();yield ai(Wy.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield ai(Wy.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Ky=["callback"],By=["callback"],zy=["callback"],qy=["callback"],Hy=["callback"],Jy=["callback"];function*Yy(){yield ai(lo.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getGlobalSecurityPolicy);yield ai(lo.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield ai(lo.loadSecurityPolicyMfa()),yield ai(lo.loadSecurityPolicyVendorMfa()),yield ai(lo.loadSecurityPolicyLockout()),yield ai(lo.loadSecurityPolicyVendorLockout()),yield ai(lo.loadSecurityPolicyVendorPasswordHistory()),yield ai(lo.loadSecurityPolicyCaptcha()),yield ai(lo.loadPublicAuthStrategiesPolicy())}function*Qy(){yield ai(lo.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getVendorConfig),[t]=Zd(["admin_portal_login_per_tenant"]);if(t){const t=yield si(Bd.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield ai(lo.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Xy(){yield ai(lo.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getVendorPublicAuthStrategiesConfig);yield ai(lo.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*Zy(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getMfaPolicy);yield ai(lo.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*ef(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getVendorMfaPolicy);yield ai(lo.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*tf(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Ky);yield ai(lo.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield si(Bd.auth.saveMfaPolicy,n);yield ai(lo.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*nf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getLockoutPolicy);yield ai(lo.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*of(e){let{payload:{callback:t}}=e,n=Ao(e.payload,By);yield ai(lo.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield si(Bd.auth.saveLockoutPolicy,n);yield ai(lo.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*af(){yield ai(lo.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getVendorLockoutPolicy);yield ai(lo.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*rf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getCaptchaPolicy);yield ai(lo.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*lf(){yield ai(lo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getPasswordHistoryPolicy);yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*sf(){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getVendorPasswordHistoryPolicy);yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*cf(e){let{payload:{callback:t}}=e,n=Ao(e.payload,zy);yield ai(lo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield si(Bd.auth.savePasswordHistoryPolicy,n);yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*uf(){yield ai(lo.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getPasswordConfigPolicy);yield ai(lo.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*df(){yield aa(lo.loadSecurityPolicy,Yy),yield oa(lo.saveSecurityPolicyMfa,tf),yield oa(lo.loadSecurityPolicyMfa,Zy),yield oa(lo.loadSecurityPolicyVendorMfa,ef),yield oa(lo.saveSecurityPolicyLockout,of),yield oa(lo.loadSecurityPolicyLockout,nf),yield oa(lo.loadSecurityPolicyVendorLockout,af),yield oa(lo.loadSecurityPolicyCaptcha,rf),yield oa(lo.saveSecurityPolicyPasswordHistory,cf),yield oa(lo.loadSecurityPolicyPasswordHistory,lf),yield oa(lo.loadSecurityPolicyVendorPasswordHistory,sf),yield oa(lo.loadVendorPasswordConfig,uf),yield oa(lo.loadPublicSecurityPolicy,Qy),yield oa(lo.loadPublicAuthStrategiesPolicy,Xy)}function*yf(){yield ai(lo.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield ai(lo.setSecurityPolicyPublicState({policy:ly,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*ff(){yield ai(lo.setSecurityPolicyGlobalState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyGlobalState({policy:ry,loading:!1})),yield ai(lo.loadSecurityPolicyMfa()),yield ai(lo.loadSecurityPolicyVendorMfa()),yield ai(lo.loadSecurityPolicyLockout()),yield ai(lo.loadSecurityPolicyVendorLockout()),yield ai(lo.loadSecurityPolicyPasswordHistory()),yield ai(lo.loadSecurityPolicyVendorPasswordHistory()),yield ai(lo.loadSecurityPolicyCaptcha())}function*pf(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyMfaState({policy:sy,loading:!1}))}function*gf(){yield ai(lo.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorMfaState({policy:sy,loading:!1}))}function*Sf(e){var t;let{payload:{callback:n}}=e,o=Ao(e.payload,qy);yield ai(lo.setSecurityPolicyMfaState({saving:!0,error:null}));const i=O({},cy,{id:null!=(t=o.id)?t:cy.id,enforceMFAType:o.enforceMFAType});yield vt(),yield ai(lo.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*vf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyLockoutState({policy:cy,loading:!1}))}function*hf(){yield ai(lo.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorLockoutState({policy:cy,loading:!1}))}function*mf(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Hy);yield ai(lo.setSecurityPolicyLockoutState({saving:!0,error:null})),yield vt();const o=O({},cy,n,{id:n.id?n.id:cy.id});null==t||t(o),yield ai(lo.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*bf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyLockoutState({policy:cy,loading:!1}))}function*Af(){yield ai(lo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:uy,loading:!1}))}function*kf(){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({policy:uy,loading:!1}))}function*Tf(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Jy);yield ai(lo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield vt();const o=O({},uy,n,{id:n.id?n.id:uy.id});null==t||t(o),yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*Pf(){yield aa(lo.loadSecurityPolicy,ff),yield oa(lo.loadPublicSecurityPolicy,yf),yield oa(lo.saveSecurityPolicyMfa,Sf),yield oa(lo.loadSecurityPolicyMfa,pf),yield oa(lo.loadSecurityPolicyVendorMfa,gf),yield oa(lo.saveSecurityPolicyLockout,mf),yield oa(lo.loadSecurityPolicyLockout,vf),yield oa(lo.loadSecurityPolicyVendorLockout,hf),yield oa(lo.loadSecurityPolicyCaptcha,bf),yield oa(lo.saveSecurityPolicyPasswordHistory,Tf),yield oa(lo.loadSecurityPolicyPasswordHistory,Af),yield oa(lo.loadSecurityPolicyVendorPasswordHistory,kf)}const If=["callback"],Lf=["callback"],Ef=["callback"],Of=["callback"],wf=["callback","events"],Df=["callback"],Cf=["callback"],Rf=["callback"],Uf=["callback"],_f=["callback"],Mf=["callback"],Nf=["callback"],Ff=["callback"],$f=["callback"],Gf=["callback","deviceId"],xf=["callback","deviceId"],Vf=["callback","deviceId"],Wf=["callback","deviceId"],jf={[Lr.Code]:kt.loginWithOtc,[Lr.EmailAndPassword]:kt.loginWithPassword,[Lr.MagicLink]:kt.magicLinkPreLoginSuccess,[Lr.SmsCode]:kt.loginWithSmsOtc};function*Kf(){const e=ra.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:o=!1,allowedRedirectOrigins:i=[]}=yield di((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:l,activateUrl:s}=t;let{authenticatedUrl:c}=t;const u=window.localStorage.getItem(It);u&&![a,r,l,s].includes(u)&&(c=u),window.localStorage.removeItem(It),yield vt(200),ai(lo.resetLoginState());const d=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:o})=>{let i=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),o=new URL(e),i=o.origin===n.origin;return t.includes(o.origin)||i})(a,n)?i=a:console.warn("The redirect url param is not valid, the origin is a different site"):i=a:o&&(i+=window.location.search),i})({authenticatedUrl:c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(d,{refresh:d.startsWith("http")})}function*Bf(){let e;try{var t;const n=yield si(Bd.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield ai(lo.setState({ssoACS:e}))}function*zf(){try{const{isActive:e}=yield si(Bd.auth.getSSOPublicConfiguration);yield ai(lo.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const qf=e=>e.mfaRequired&&e.mfaToken?(ra.setAccessToken(null),ra.setUser(null),!0):(ra.setAccessToken(e.accessToken),ra.setUser(e),!1),Hf=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:o}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),o=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:o,totalDevices:t+n+o}})(e);if(1===o){if(n)return nn.authenticatorApp;if(t)return nn.smsVerifyCode}return nn.verify},Jf=e=>{if(1===e.length){const[t]=e;if(t===Md.AuthenticatorApp)return nn.authenticatorApp;if(t===Md.SMS)return nn.smsSetPhoneNumber}return nn.verify};function*Yf(e){let t=kt.loginWithTwoFactor,n={};const{loginState:o}=yield di((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield si(Bd.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Hf(e.mfaDevices)}:(n={step:Jf(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=kt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:Tt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:O({},o,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:i,mfaDeviceExpiration:a})}}function*Qf(e){var t;const{routes:n,loginState:o}=yield di((e=>e.auth)),i=null!=(t=localStorage.getItem("register-quick-login"))?t:o.quickLoginToRegister;return i&&"true"!==localStorage.getItem(`${e.id}-${i}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*Xf(){const{hostedLoginBox:e}=yield di((e=>e.auth));e?yield si(Zf):yield si(tp)}function*Zf(){const{user:e}=yield di((e=>e.auth));if(null==e||!e.refreshToken)return ra.setAccessToken(null),ra.setUser(null),void(yield ai(lo.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield si(Bd.auth.exchangeOAuthTokens,t);yield ai(lo.setState({user:n,isAuthenticated:!0})),yield ai(lo.loadTenants())}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:null,isAuthenticated:!1}))}}function*ep(){const{user:e}=yield di((e=>e.auth));if(null==e||!e.refreshToken)return ra.setAccessToken(null),ra.setUser(null),void(yield ai(lo.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield si(Bd.auth.exchangeOAuthTokens,t);yield ai(lo.setState({user:n,isAuthenticated:!0})),yield ai(lo.loadTenants())}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:null,isAuthenticated:!1}))}}function*tp(){try{const t=ra.onRedirectTo,{routes:n,loginState:o}=yield di((e=>e.auth)),{user:i,tenants:a}=yield si(Bd.auth.refreshTokenV2);if(qf(i)){const e=yield Yf(i);yield ai(lo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield Qf(i);yield ai(lo.setTenantsState({tenants:a,loading:!1})),yield ai(lo.setState({user:i,isAuthenticated:!0,loginState:O({},o,{quickLoginToRegister:t,flow:n?Tt.RegisterQuickLogin:Tt.Login})})),yield op(n)}}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:void 0,isAuthenticated:!1}))}}function*np(){try{const t=ra.onRedirectTo,{routes:n,loginState:o}=yield di((e=>e.auth)),{user:i,tenants:a}=yield si(Bd.auth.refreshTokenV2);if(qf(i)){const e=yield Yf(i);yield ai(lo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield si(pp))yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})),yield ai(lo.setTenantsState({tenants:a,loading:!1})),yield ai(lo.setState({user:i})),t(n.loginUrl,{preserveQueryParams:!0});else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield Qf(i);yield ai(lo.setTenantsState({tenants:a,loading:!1})),yield ai(lo.setState({user:i,isAuthenticated:!0,loginState:O({},o,{quickLoginToRegister:t,flow:n?Tt.RegisterQuickLogin:Tt.Login})})),yield op(n)}}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:void 0,isAuthenticated:!1}))}}function*op(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=ra.onRedirectTo,{routes:i,loginState:a}=yield di((e=>e.auth)),r=n.searchParams.get("invitationToken"),l=[i.socialLoginCallbackUrl,i.oidcRedirectUrl,i.samlCallbackUrl];r||l.push(i.loginUrl,i.signUpUrl),e?o(i.loginUrl):l.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&i.signUpSuccessUrl&&i.socialLoginCallbackUrl===window.location.pathname?o(i.signUpSuccessUrl,{refresh:i.signUpSuccessUrl.startsWith("http")}):yield Kf())}function*ip({payload:{callback:e}}){try{const{ip:t}=yield si(Bd.metadata.getCurrentUserIpMetadata);yield ai(lo.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*ap({payload:e}){const t=[];e&&(yield ai(lo.setState({isLoading:!0})),yield ai(lo.loadSocialLoginsConfigurationV2()),t.push(si(Uy)),t.push(si(Xy)),t.push(si(zf)),t.push(si(jy)),t.push(si(Bf))),t.push(si(Xf)),yield ri(t),yield ai(lo.setState({isLoading:!1}))}function*rp({accessToken:e,user:t}){if(!e)return void(yield ai(lo.setState({user:void 0,isAuthenticated:!1})));const n=ra.onRedirectTo,{routes:o}=yield di((e=>e.auth));if(qf(t)){const e=yield Yf(t);yield ai(lo.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*lp({payload:e}){const t=[];yield ai(lo.loadSocialLoginsConfigurationV2()),t.push(si(Uy)),t.push(si(zf)),t.push(si(jy)),t.push(si(Bf)),t.push(si(rp,e)),yield ri(t)}function*sp({payload:e}){const{disableSilentRefresh:t}=yield di((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield si(Bd.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield ai(lo.setState({user:e,isAuthenticated:!0})),yield ai(lo.loadTenants()),yield ai(lo.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:o,urlStrategy:i}=yield di((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}})(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield ai(lo.setState({isLoading:!0}));const a=Qd(),r=Qd(),l=yield si(Yd,r);localStorage.setItem(Lt,r);const s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${ca(n,"/oauth/authorize")}/oauth/authorize`,u=O({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:s,code_challenge:l,code_challenge_method:"S256",nonce:a},e);if(n.tenantResolver){var d;const e=yield null==(d=n.tenantResolver)?void 0:d.call(n);null!=e&&e.tenant&&(u.organization=e.tenant)}o(`${c}?${new URLSearchParams(u).toString()}`,{refresh:!0})}(e)}}function*cp({payload:e}){const t=localStorage.getItem(Lt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:o}=yield di((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy}))),i=`${window.location.origin}${"path"===o?"":"#"}${n.hostedLoginRedirectUrl}`,a={code:e.code,redirect_uri:i,code_verifier:t,grant_type:"authorization_code"};try{const e=yield si(Bd.auth.exchangeOAuthTokens,a);yield ai(lo.setState({user:e,isAuthenticated:!0})),yield ai(lo.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Kf()}}function*up(e){let{payload:{callback:t}}=e,n=Ao(e.payload,If);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(Bd.auth.changePhoneNumberWithVerification,n);yield ai(lo.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:kt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1}))}}function*dp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Lf);try{yield ai(lo.setLoginState({loading:!0})),yield si(Bd.auth.verifyChangePhoneNumber,n),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1}))}}function*yp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Ef);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(Bd.auth.passwordlessPreLogin,O({},n,{type:Lr.SmsCode}));yield ai(lo.setLoginState({step:kt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*fp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Of);try{const{onRedirectTo:e,routes:o}=yield di((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ai(lo.setLoginState({loading:!0}));const i=yield si(Bd.auth.passwordlessPreLogin,n),a=jf[n.type];if(a===kt.loginWithSmsOtc&&i.resetPhoneNumberToken)return yield ai(lo.setResetPhoneNumberState({resetPhoneNumberToken:i.resetPhoneNumberToken,step:zt.VerifyResetPhoneNumber})),void e(o.resetPhoneNumberUrl);yield ai(lo.setLoginState({step:a,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*pp(){const{publicAuthStrategyPolicy:e}=yield di((e=>e.auth.securityPolicyState)),{policy:t}=e,n=(e=>!(null==e||!e.secondaryAuthStrategies.some((({isActive:e,strategy:t})=>e&&t===Ud.Passkeys))))(t),o="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=Zd(["show-passkeys"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield si(Bd.auth.getWebAuthnDevices);return yield ai(lo.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*gp(e){let{payload:{callback:t,events:n}}=e,o=Ao(e.payload,wf);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(Bd.auth.passwordlessPostLogin,o),a=ra.onRedirectTo,{routes:r}=yield di((e=>e.auth));if(qf(e)){const t=yield Yf(e);yield ai(lo.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield di((e=>e.auth)),l=yield si(Bd.auth.generateLoginResponse,e);var i;e.emailVerified&&(null==n||null==(i=n.userVerified)||i.call(n,{email:l.email,origin:wy.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield ai(lo.setState({user:l})),yield ai(lo.setLoginState({error:void 0})),yield ai(lo.loadTenants()),yield ai(lo.setState({isLoading:!1})),o.flow===Tt.Login?(yield si(pp))?(yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield ai(lo.setState({isAuthenticated:!0})),yield Kf()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield ai(lo.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield ai(lo.setLoginState({loading:!1}))}}function*Sp({payload:e}){try{yield ai(lo.setLoginState({loading:!0}));const{name:t}=yield si(Bd.auth.verifyInviteToken,e);yield ai(lo.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield ai(lo.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield ai(lo.setLoginState({loading:!1}))}}function*vp({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:o}}){yield ai(lo.setLoginState({loading:!0}));try{const i=yield di((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield si(Bd.auth.preLoginV2,{email:e});if(a){let e=a;if(r===Hd.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield di((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield ai(lo.setLoginState({step:kt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{i(e,{refresh:!0})}),2e3)}else yield hp({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield hp({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*hp(e){let{callback:t}=e,n=Ao(e,Df);const o=yield di((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==o||!o.authStrategy)return yield ai(lo.setLoginState({step:kt.loginWithPassword,loading:!1})),void(null==t||t());(null==o?void 0:o.authStrategy)===Lr.EmailAndPassword?(yield ai(lo.setLoginState({step:kt.loginWithPassword,loading:!1})),null==t||t()):[Lr.MagicLink,Lr.Code,Lr.SmsCode].includes(null==o?void 0:o.authStrategy)?yield ai(lo.passwordlessPreLogin(O({},n,{type:null==o?void 0:o.authStrategy,callback:t}))):(yield ai(lo.setLoginState({step:kt.loginWithPassword,loading:!1})),null==t||t())}function*mp({payload:{callback:e}}){try{yield ai(lo.setLoginState({loading:!0}));const{options:t}=yield si(Bd.auth.webAuthnCreateNewDeviceSession);t.user.id=bt(t.user.id),t.challenge=bt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield ai(lo.setLoginState({error:t.message})),null==e||e(null)}finally{yield ai(lo.setLoginState({loading:!1}))}}function*bp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Cf);try{yield ai(lo.setLoginState({loading:!0}));const e=At(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?_d.Platform:_d.CrossPlatform;yield si(Bd.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({error:e.message})),null==t||t(null)}finally{yield ai(lo.setLoginState({loading:!1}))}}function*Ap(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Rf);try{var o;yield ai(lo.setPasskeysState({loading:!0})),yield ai(lo.setLoginState({loading:!0}));const{options:e}=yield si(Bd.auth.webAuthnPreLogin,n);e.challenge=bt(e.challenge),e.allowCredentials=null==(o=e.allowCredentials)?void 0:o.map((e=>O({},e,{id:bt(e.id)}))),yield ai(lo.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield ai(lo.setLoginState({error:e.message})),null==t||t(null)}finally{yield ai(lo.setPasskeysState({loading:!1})),yield ai(lo.setLoginState({loading:!1}))}}function*kp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Uf);try{var o;yield ai(lo.setPasskeysState({loading:!0})),yield ai(lo.setLoginState({loading:!0}));const e=At(n.publicKey),i=yield si(Bd.auth.webAuthnPostLogin,O({},e,{response:O({},e.response,{userHandle:null!=(o=e.response.userHandle)?o:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(qf(i)){const e=ra.onRedirectTo,{routes:t}=yield di((e=>e.auth)),n=yield Yf(i);yield ai(lo.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield si(Bd.auth.generateLoginResponse,i);e.id&&localStorage.setItem("userId",e.id),yield ai(lo.loadTenants()),yield ai(lo.setState({user:e,isAuthenticated:!0})),yield ai(lo.setLoginState({error:void 0})),yield Kf(),null==t||t(!0)}}catch(e){yield ai(lo.setLoginState({error:e.message})),null==t||t(null)}finally{yield ai(lo.setPasskeysState({loading:!1})),yield ai(lo.setLoginState({loading:!1}))}}function*Tp({payload:e}){const{onRedirectTo:t,routes:n}=yield di((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ai(lo.setLoginState({loading:!0}));try{const t=yield si(Bd.auth.postLogin,e);ra.setAccessToken(t.accessToken),ra.setUser(t),yield ai(lo.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Kf()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield ai(lo.setLoginState({step:kt.loginWithSSOFailed,loading:!1}))}}function*Pp({payload:{email:e,password:t,recaptchaToken:n,invitationToken:o,callback:i}}){yield ai(lo.setLoginState({loading:!0}));try{const a=yield si(Bd.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:o});ra.setAccessToken(a.accessToken),ra.setUser(a);const r=ra.onRedirectTo,{routes:l}=yield di((e=>e.auth));if(qf(a)){const e=yield Yf(a);yield ai(lo.setState(e)),r(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield di((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield ai(lo.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===Tt.Login?kt.success:t.step,tenants:[],tenantsLoading:!0}})),yield ai(lo.loadTenants()),n&&t.flow===Tt.Login&&((yield si(pp))?(yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})),r(l.loginUrl,{preserveQueryParams:!0})):yield Kf())}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){ra.setAccessToken(null),ra.setUser(null),null==i||i(!1,t),yield ai(lo.setLoginState({email:e,error:t.message,loading:!1}))}}function*Ip({payload:{mfaToken:e,value:t,rememberDevice:n,callback:o}}){yield ai(lo.setLoginState({loading:!0}));try{const i=yield si(Bd.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield di((e=>e.auth)),r=a.flow===Tt.Login?kt.success:a.step;yield ai(lo.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:i,isAuthenticated:!0})),i.id&&localStorage.setItem("userId",i.id),yield ai(lo.loadTenants()),yield ai(lo.setLoginState({error:void 0,loading:!1})),a.flow===Tt.Login&&((yield si(pp))?yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})):yield Kf()),null==o||o(!0)}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1})),null==o||o(!1,e)}}function*Lp({payload:e}){yield ai(lo.setLoginState({loading:!0}));try{var t;yield si(Bd.auth.recoverMfaToken,e),yield ai(lo.setLoginState({loading:!1,error:void 0,step:kt.preLogin})),yield ai(lo.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setLoginState({error:t.message,loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Ep({payload:e}){const{hostedLoginBox:t}=yield di((e=>e.auth));yield ai(lo.setState({isLoading:!0}));try{t?yield si(Bd.auth.OAuthLogout):yield si(Bd.auth.logout)}catch{}yield ai(lo.resetState()),yield ai(lo.requestAuthorize(!0)),null==e||e()}function*Op({payload:e}){var t;try{yield si(Bd.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*wp({user:e,tenants:t}){const n={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield ai(lo.setMfaState(n)),yield ai(lo.setUser(e)),yield ai(lo.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Dp({user:e,tenants:t}){const{loginState:n}=yield di((e=>e.auth));yield ai(lo.setUser(e)),yield ai(lo.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:o}=yield di((e=>e.auth.mfaState));if(n.flow===Tt.Login){const e=yield si(pp);o===nn.smsVerifyCode&&e?yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})):yield Kf()}yield ai(lo.setState({isAuthenticated:!0}))}function*Cp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,_f);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(Bd.auth.preEnrollMFASMSForLogin,n);yield ai(lo.setMfaState({otcToken:e.otcToken,step:nn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Rp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Mf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(Bd.auth.enrollMFASMSForLogin,n),o=yield si(Bd.auth.generateLoginResponseV2,e);yield wp(o),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Up(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Nf);yield ai(lo.setLoginState({loading:!0}));try{var o;const e=yield si(Bd.auth.preEnrollMFAWebAuthnForLogin,n),i=O({},e.options,{challenge:bt(e.options.challenge),user:O({},e.options.user,{id:bt(e.options.user.id)}),excludeCredentials:null==(o=e.options.excludeCredentials)?void 0:o.map((e=>O({},e,{id:bt(e.id)})))});yield ai(lo.setLoginState({loading:!1})),null==t||t({options:i,webauthnToken:e.webauthnToken})}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*_p(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Ff);yield ai(lo.setLoginState({loading:!0}));try{const e=At(n.publicKey),o=yield si(Bd.auth.enrollMFAWebAuthnForLogin,O({},n,{options:e})),i=yield si(Bd.auth.generateLoginResponseV2,o);yield wp(i),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Mp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,$f);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(Bd.auth.enrollMFAAuthenticatorAppForLogin,n),o=yield si(Bd.auth.generateLoginResponseV2,e);yield wp(o),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Np(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Gf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(Bd.auth.preVerifyMFASMSForLogin,n,o);yield ai(lo.setMfaState({otcToken:e.otcToken,step:nn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Fp(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,xf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(Bd.auth.verifyMFASMSForLogin,n,o),i=yield si(Bd.auth.generateLoginResponseV2,e);yield Dp(i),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*$p(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Vf);yield ai(lo.setLoginState({loading:!0}));try{var i;const e=yield si(Bd.auth.preVerifyMFAWebAuthnForLogin,n,o),a=O({},e.options,{challenge:bt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>O({},e,{id:bt(e.id)})))});yield ai(lo.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Gp(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Wf);yield ai(lo.setLoginState({loading:!0}));try{const e=At(o.publicKey),i=yield si(Bd.auth.verifyMFAWebAuthnForLogin,n,O({},o,{options:e})),a=yield si(Bd.auth.generateLoginResponseV2,i);yield Dp(a),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*xp(){yield aa(lo.requestAuthorize,ap),yield aa(lo.requestAuthorizeSSR,lp),yield aa(lo.requestHostedLoginAuthorize,sp),yield aa(lo.handleHostedLoginCallback,cp),yield aa(lo.preLogin,vp),yield aa(lo.postLogin,Tp),yield aa(lo.login,Pp),yield aa(lo.logout,Ep),yield aa(lo.silentLogout,Op),yield aa(lo.loginWithMfa,Ip),yield aa(lo.recoverMfa,Lp),yield aa(lo.quickSmsPasswordlessPreLogin,yp),yield aa(lo.changePhoneNumberWithVerification,up),yield aa(lo.verifyChangePhoneNumber,dp),yield aa(lo.passwordlessPreLogin,fp),yield aa(lo.passwordlessPostLogin,gp),yield aa(lo.verifyInviteToken,Sp),yield aa(lo.webAuthnPrelogin,Ap),yield aa(lo.webAuthnPostLogin,kp),yield aa(lo.webAuthnCreateNewDeviceSession,mp),yield aa(lo.webAuthnVerifyNewDeviceSession,bp),yield aa(lo.afterAuthNavigation,Kf),yield aa(lo.getUserIP,ip),yield aa(lo.preEnrollMFASMSForLogin,Cp),yield aa(lo.enrollMFASMSForLogin,Rp),yield aa(lo.preEnrollMFAWebAuthnForLogin,Up),yield aa(lo.enrollMFAWebAuthnForLogin,_p),yield aa(lo.enrollMFAAuthenticatorAppForLogin,Mp),yield aa(lo.preVerifyMFASMSForLogin,Np),yield aa(lo.verifyMFASMSForLogin,Fp),yield aa(lo.preVerifyMFAWebAuthnForLogin,$p),yield aa(lo.verifyMFAWebAuthnForLogin,Gp)}function*Vp({payload:e}){e&&(yield ai(lo.setState({isLoading:!0})));const t=iy;yield ai(lo.loadTenants()),yield ai(lo.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Wp({payload:{callback:e}}){try{const{ip:t}=Iy[0];yield ai(lo.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*jp(){yield aa(lo.requestAuthorize,Vp),yield aa(lo.afterAuthNavigation,Kf),yield aa(lo.getUserIP,Wp)}const Kp=["callback","samlVendor"],Bp=["callback","samlVendor"];function*zp(){try{var e,t;yield ai(lo.setSSOState({loading:!0}));const n=yield si(Bd.auth.getSamlConfiguration),o=yield si(Bd.auth.getOidcConfiguration),i=yield si(Bd.metadata.getSamlMetadata);n.acsUrl=null==i||null==(e=i.configuration)?void 0:e.acsUrl,n.spEntityId=null==i||null==(t=i.configuration)?void 0:t.spEntityId,n.isSamlActive=null==i?void 0:i.isActive,yield ai(lo.setSSOState({samlConfiguration:n,oidcConfiguration:o,loading:!1,firstLoad:!1}))}catch(e){yield ai(lo.setSSOState({error:e.message,loading:!1}))}}function*qp({payload:e}){const t=yield di((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield ai(lo.setSSOState({error:void 0,[n]:!0}));try{const o=yield Xd(e[0]),i=yield si(Bd.auth.updateSamlVendorMetadata,{metadata:o});i.isSamlActive=null==t?void 0:t.isSamlActive,yield ai(lo.setSSOState({samlConfiguration:i,error:void 0,[n]:!1}))}catch(e){yield ai(lo.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Hp({payload:e}){const{configFile:t,callback:n}=e,o=yield di((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield ai(lo.setSSOState({error:void 0,[i]:!0}));try{const e=yield Xd(t),a=yield si(Bd.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==o?void 0:o.isSamlActive,yield ai(lo.setSSOState({samlConfiguration:a,error:void 0,[i]:!1})),null==n||n(!0)}catch(e){yield ai(lo.setSSOState({samlConfiguration:o,error:e.message,[i]:!1})),null==n||n(null,e)}}function*Jp({payload:e}){const{callback:t,samlVendor:n}=e,o=Ao(e,Kp),i=yield di((e=>e.auth.ssoState.samlConfiguration)),a=O({},i,o);let r="saving";(null==a?void 0:a.enabled)!==i.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield ai(lo.setSSOState({samlConfiguration:O({},i,a)})));if(yield ai(lo.setSSOState({error:void 0,[r]:!0})),e.type===Hd.Saml){var l,s;const e=yield si(Bd.metadata.getSamlMetadata);a.acsUrl=null==e||null==(l=e.configuration)?void 0:l.acsUrl,a.spEntityId=null==e||null==(s=e.configuration)?void 0:s.spEntityId}const o=Jd(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==i?void 0:i.domain)!==(null==o?void 0:o.domain)&&(o.ssoEndpoint="",o.publicCertificate="",o.signRequest=!1),o.type=null==n?void 0:n.toLowerCase();const c=yield si(Bd.auth.updateSamlConfiguration,o);c.isSamlActive=null==i?void 0:i.isSamlActive,yield ai(lo.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield ai(lo.setSSOState({samlConfiguration:i,error:e.message,[r]:!1})),null==t||t(null,e)}}function*Yp({payload:{callback:e}={}}){const t=yield di((e=>e.auth.ssoState.samlConfiguration));try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(Bd.auth.validateSamlDomain),yield ai(lo.setSSOState({samlConfiguration:O({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield ai(lo.setSSOState({samlConfiguration:O({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*Qp(){try{const e=yield si(Bd.auth.getSamlRoles),t=yield si(Bd.auth.getSamlRolesGroups);yield ai(lo.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield ai(lo.setSSOState({error:e.message}))}}function*Xp({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(Bd.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield ri(e.map((e=>si(Bd.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield ai(lo.setSSOState({error:e.message}))}}(n)),yield Qp(),yield ai(lo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ai(lo.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Zp({payload:{callback:e,id:t}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(Bd.auth.deleteSamlGroup,{id:t}),yield Qp(),yield ai(lo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ai(lo.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*eg({payload:{group:e,roleIds:t,callback:n}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(Bd.auth.createSamlGroup,{group:e,roleIds:t}),yield Qp(),yield ai(lo.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield ai(lo.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*tg({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield ai(lo.setSSOState({loading:!0})),yield si(Bd.auth.oidcPostLoginV2,t),yield si(Xf),yield ai(lo.setSSOState({loading:!1}))}catch(e){var n;yield ai(lo.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*ng(){yield oa(lo.loadSSOConfigurations,zp),yield oa(lo.saveSSOConfigurations,Jp),yield oa(lo.saveSSOConfigurationsFile,qp),yield oa(lo.saveSSOConfigurationsFileWithCallback,Hp),yield oa(lo.validateSSODomain,Yp),yield oa(lo.loadSSOAuthorizationRoles,Qp),yield oa(lo.updateSSOAuthorizationRoles,Xp),yield oa(lo.deleteSamlGroup,Zp),yield oa(lo.createSamlGroup,eg),yield oa(lo.oidcPostlogin,tg)}function*og(){yield ai(lo.setSSOState({loading:!0})),yield vt(),yield ai(lo.setSSOState({samlConfiguration:dy,loading:!1,firstLoad:!1}))}function*ig({payload:e}){const t="saving";yield ai(lo.setSSOState({error:void 0,[t]:!0}));const n=O({},yield di((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield ai(lo.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*ag({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Ao(e,Bp),r=py.samlConfiguration,l=O({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield ai(lo.setSSOState({samlConfiguration:O({},r,l)})));yield ai(lo.setSSOState({error:void 0,[s]:!0})),yield vt(),l.acsUrl=null==yy||null==(t=yy.configuration)?void 0:t.acsUrl,l.spEntityId=null==yy||null==(n=yy.configuration)?void 0:n.spEntityId;const c=Jd(l,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==i?void 0:i.toLowerCase(),yield vt(),yield ai(lo.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==o||o(!0)}function*rg({payload:{callback:e}={}}){const t=py.samlConfiguration;yield ai(lo.setSSOState({error:void 0,saving:!0})),yield vt(),yield ai(lo.setSSOState({samlConfiguration:O({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*lg(){yield vt(),yield ai(lo.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*sg({payload:{callback:e,authorizationRoles:t}}){yield ai(lo.setSSOState({error:void 0,saving:!0})),yield vt(),yield ai(lo.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*cg(){yield oa(lo.loadSSOConfigurations,og),yield oa(lo.saveSSOConfigurations,ag),yield oa(lo.saveSSOConfigurationsFile,ig),yield oa(lo.validateSSODomain,rg),yield oa(lo.loadSSOAuthorizationRoles,lg),yield oa(lo.updateSSOAuthorizationRoles,sg)}const ug=["callback"],dg=["callback","ssoConfigId"],yg=["callback","ssoConfigId"];function*fg(){try{return yield si(Bd.auth.getOidcConfiguration)}catch(e){return null}}function*pg(){try{return yield si(Bd.metadata.getSamlMetadata)}catch(e){return null}}function*gg(){try{yield ai(lo.setSSOLoader({key:qd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield ri([si(fg),si(pg)]),n=yield si(Bd.auth.getSSOConfigurations);yield ai(lo.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield ai(lo.setSSOError({key:qd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield ai(lo.setSSOLoader({key:qd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Sg({payload:e}){yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ao(e,ug),o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield si(Bd.auth.createSSOConfiguration,O({},n,{enabled:null!=(i=n.enabled)&&i}));yield ai(lo.setSSOState({ssoConfigurations:[...o,e]})),null==t||t(e)}catch(e){yield ai(lo.setSSOError({key:qd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*vg({payload:e}){yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Xd(t),i=yield si(Bd.auth.createSSOConfigurationByMetadata,{metadata:e});yield ai(lo.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield ai(lo.setSSOError({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*hg({payload:e}){yield ai(lo.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Ao(e,dg),i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield si(Bd.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t));yield ai(lo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ai(lo.setSSOError({key:qd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*mg({payload:e}){yield ai(lo.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:o}=e,i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Xd(o),a=yield si(Bd.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=i.map((e=>e.id===n?a:e));yield ai(lo.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield ai(lo.setSSOError({key:qd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*bg({payload:e}){yield ai(lo.setSSOLoader({key:qd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(Bd.auth.deleteSSOConfiguration,t),yield ai(lo.setSSOState({ssoConfigurations:o.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield ai(lo.setSSOError({key:qd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Ag({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Ao(e,yg);yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield si(Bd.auth.createSSODomain,n,o),a=i.map((t=>t.id===n?O({},t,{domains:[...t.domains,e]}):t));yield ai(lo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ai(lo.setSSOError({key:qd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_DOMAIN,value:!1}))}}function*kg({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield ai(lo.setSSOLoader({key:qd.DELETE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(Bd.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?O({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield ai(lo.setSSOState({ssoConfigurations:e})),null==o||o(!0)}catch(e){yield ai(lo.setSSOError({key:qd.DELETE_SSO_DOMAIN,value:e.message})),null==o||o(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.DELETE_SSO_DOMAIN,value:!1}))}}function*Tg({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield ai(lo.setSSOLoader({key:qd.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(Bd.auth.validateSSODomain,o,n);const e=i.map((e=>e.id===o?O({},e,{domains:e.domains.map((e=>e.id===n?O({},e,{validated:!0}):e))}):e));yield ai(lo.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield ai(lo.setSSOError({key:qd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Pg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield ai(lo.setSSOLoader({key:qd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(Bd.auth.setSSODefaultRoles,t,{roleIds:n});const i=o.map((e=>e.id===t?O({},e,{roleIds:n}):e));yield ai(lo.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield ai(lo.setSSOError({key:qd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield ai(lo.setSSOLoader({key:qd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Ig({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_GROUPS,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield ri(t.map((e=>si(Bd.auth.deleteSSOGroup,n,e)))),yield ri(e.map((e=>si(Bd.auth.createSSOGroup,n,e))));const a=yield si(Bd.auth.getSSOGroups,n),r=i.map((e=>e.id===n?O({},e,{groups:a}):e));yield ai(lo.setSSOState({ssoConfigurations:r})),null==o||o(!0)}catch(e){yield ai(lo.setSSOError({key:qd.SAVE_SSO_GROUPS,value:e.message})),null==o||o(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_GROUPS,value:!1}))}}function*Lg({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield ri(t.map((t=>si(Bd.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield ai(lo.setSSOError({key:qd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:qd.SAVE_SSO_GROUPS,value:!1}))}}function*Eg(){yield oa(lo.loadSSOConfigurationsV2,gg),yield oa(lo.saveSSOConfigurationV2,Sg),yield oa(lo.saveSSODomain,Ag),yield oa(lo.deleteSSODomain,kg),yield oa(lo.validateSSODomainV2,Tg),yield oa(lo.updateSSOConfiguration,hg),yield oa(lo.deleteSSOConfiguration,bg),yield oa(lo.setSSOGroups,Ig),yield oa(lo.updateSSOGroups,Lg),yield oa(lo.setSSODefaultRoles,Pg),yield oa(lo.saveSSOConfigurationByMetadata,vg),yield oa(lo.updateSSOConfigurationByMetadata,mg)}const Og=["callback","profilePictureUrl"],wg=["callback","profilePictureUrl"];function*Dg(){yield ai(lo.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return si.apply(void 0,[na,e,t,n].concat(i))}(3,2e3,Bd.teams.getProfile),t=yield di((e=>e.auth.user));lo.setUser(O({},t,e)),yield ai(lo.setProfileState({profile:e,loading:!1}))}catch(e){yield ai(lo.setProfileState({loading:!1,error:e.message}))}}function*Cg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ao(e.payload,Og);yield ai(lo.setProfileState({saving:!0,error:null}));try{const e=yield di((e=>e.auth.profileState.profile));let i=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const o=`image/${n[1]}`,i=function(e,t){const n=atob(e),o=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),i=new Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);o.push(new Uint8Array(i))}return new Blob(o,{type:t})}(n[2],o),a=new FormData;return a.append(t,new File([i],t,{type:o})),a}(n,"image");if(e){i=yield si(Bd.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(i);n.searchParams.set("t",t),i=n.href}}const a=O({},e,o,{profilePictureUrl:i}),r=yield si(Bd.teams.updateProfile,a),l=yield di((e=>e.auth.user));yield ai(lo.setUser(O({},l,r))),yield ai(lo.setProfileState({profile:r,saving:!1})),null==t||t(a)}catch(e){yield ai(lo.setProfileState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Rg({payload:e}){yield ai(lo.setProfileState({loading:!0}));try{var t;yield si(Bd.teams.changePassword,e),yield ai(lo.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Ug(){yield aa(lo.loadProfile,Dg),yield oa(lo.saveProfile,Cg),yield oa(lo.changePassword,Rg)}function*_g(){yield ai(lo.setProfileState({loading:!0})),yield vt(),yield ai(lo.setUser(O({},iy,oy))),yield ai(lo.setProfileState({loading:!1,profile:oy}))}function*Mg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ao(e.payload,wg);yield ai(lo.setProfileState({saving:!0,error:null}));const i=ay;let a=i.profile.profilePictureUrl;n!==i.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=O({},i.profile,o,{profilePictureUrl:a}),l=iy;yield vt(),yield ai(lo.setUser(O({},l,r))),yield ai(lo.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Ng({payload:e}){var t;yield ai(lo.setProfileState({loading:!0})),yield vt(),yield ai(lo.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Fg(){yield aa(lo.loadProfile,_g),yield oa(lo.saveProfile,Mg),yield oa(lo.changePassword,Ng)}const $g=["callback"],Gg=["callback"],xg=["callback"],Vg=["deviceId","callback"],Wg=["deviceId","callback"],jg=["callback"],Kg=["deviceId"],Bg=["deviceId"],zg=["callback"],qg=["deviceId"],Hg=["callback"];function*Jg(e){const{step:t}=yield di((e=>e.auth.mfaState));return{step:e.recoveryCode?nn.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Yg(){yield ai(lo.setMfaState({saving:!0}));try{const{qrCode:e}=yield si(Bd.auth.enrollMfa);yield ai(lo.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message}))}}function*Qg(e){let{payload:{callback:t}}=e,n=Ao(e.payload,$g);yield ai(lo.setMfaState({saving:!0}));try{const e=yield di((e=>e.auth.user)),o=yield si(Bd.auth.verifyMfa,n),i=yield si(Bd.auth.getMFADevices),a=yield Jg(o);yield ai(lo.setMfaState(O({},a,{mfaDevices:i}))),yield ai(lo.setUser(O({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Xg(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Gg);yield ai(lo.setMfaState({loading:!0}));try{const e=yield si(Bd.auth.loginWithMfa,n),o={step:nn.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(o.recoveryCode=e.recoveryCode),yield ai(lo.setMfaState(o)),yield ai(lo.setState({user:e})),yield ai(lo.loadTenants()),null==t||t(o.recoveryCode)}catch(e){yield ai(lo.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Zg({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t;yield si(Bd.auth.disableMfa,e);const n=yield si(Bd.auth.getMFADevices);yield ai(lo.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*eS({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t,n;const o=yield si(Bd.auth.preEnrollMFAWebAuthn),i=O({},o.options,{challenge:bt(o.options.challenge),user:O({},o.options.user,{id:bt(o.options.user.id)}),excludeCredentials:null==(t=o.options.excludeCredentials)?void 0:t.map((e=>O({},e,{id:bt(e.id)})))});yield ai(lo.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:i,webauthnToken:o.webauthnToken})}catch(t){var o;yield ai(lo.setMfaState({saving:!1,error:t.message})),null==(o=e.callback)||o.call(e,null,t)}}function*tS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,xg);yield ai(lo.setMfaState({saving:!0}));try{const e=At(n.publicKey),o=yield si(Bd.auth.enrollMFAWebAuthn,O({},n,{options:e})),i=yield si(Bd.auth.getMFADevices),a=yield Jg(o);yield ai(lo.setMfaState(O({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*nS(e){let{payload:{deviceId:t,callback:n}}=e;Ao(e.payload,Vg),yield ai(lo.setMfaState({saving:!0}));try{var o;const e=yield si(Bd.auth.preDisableMFAWebAuthn,t),i=O({},e.options,{challenge:bt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>O({},e,{id:bt(e.id)})))});yield ai(lo.setMfaState({saving:!1})),null==n||n({options:i,webauthnToken:e.webauthnToken})}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*oS(e){let{payload:{deviceId:t,callback:n}}=e,o=Ao(e.payload,Wg);yield ai(lo.setMfaState({saving:!0}));try{const e=At(o.publicKey);yield si(Bd.auth.disableMFAWebAuthn,t,O({},o,{options:e}));const i=yield si(Bd.auth.getMFADevices);yield ai(lo.setMfaState({saving:!1,error:void 0,mfaDevices:i})),null==n||n(!0)}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*iS({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t;const n=yield si(Bd.auth.preEnrollMFASMS,e);yield ai(lo.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 ai(lo.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*aS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,jg);yield ai(lo.setMfaState({saving:!0}));try{const e=yield si(Bd.auth.enrollMFASMS,n),o=yield si(Bd.auth.getMFADevices),i=yield Jg(e);yield ai(lo.setMfaState(O({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*rS(e){let{payload:{deviceId:t}}=e,n=Ao(e.payload,Kg);yield ai(lo.setMfaState({saving:!0}));try{var o;const e=yield si(Bd.auth.preDisableMFASMS,t);yield ai(lo.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield ai(lo.setMfaState({saving:!1,error:e.message})),null==(i=n.callback)||i.call(n,!1,e)}}function*lS(e){let{payload:{deviceId:t}}=e,n=Ao(e.payload,Bg);yield ai(lo.setMfaState({saving:!0}));try{var o;yield si(Bd.auth.disableMFASMS,t,n);const e=yield si(Bd.auth.getMFADevices);yield ai(lo.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield ai(lo.setMfaState({saving:!1,error:e.message})),null==(i=n.callback)||i.call(n,!1,e)}}function*sS(){yield ai(lo.setMfaState({loading:!0}));try{yield di((e=>e.auth.user));const e=yield si(Bd.auth.getMFADevices);yield ai(lo.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield ai(lo.setMfaState({loading:!1,error:e.message}))}}function*cS(){yield ai(lo.setMfaState({loading:!0}));try{const e=(yield si(Bd.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield ai(lo.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield ai(lo.setMfaState({loading:!1,error:e.message}))}}function*uS(){yield oa(lo.enrollMfa,Yg),yield oa(lo.getMFADevices,sS),yield oa(lo.getMFAStrategies,cS),yield oa(lo.verifyMfa,Qg),yield oa(lo.disableMfa,Zg),yield oa(lo.verifyMfaAfterForce,Xg),yield oa(lo.preDisableMfaSms,rS),yield oa(lo.disableMfaSms,lS),yield oa(lo.preEnrollMfaSms,iS),yield oa(lo.enrollMfaSms,aS),yield oa(lo.preEnrollMfaWebAuthn,eS),yield oa(lo.enrollMfaWebAuthn,tS),yield oa(lo.preDisableMfaWebAuthn,nS),yield oa(lo.disableMfaWebAuthn,oS)}function*dS(){yield ai(lo.setMfaState({saving:!0})),yield ai(lo.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*yS({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield di((e=>e.auth.mfaState));yield ai(lo.setMfaState({saving:!0})),yield vt();const n={token:"token",recoveryCode:"recoveryCode"},o={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:O({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(o.recoveryCode=n.recoveryCode),yield ai(lo.setMfaState(o)),yield ai(lo.setUser(O({},iy,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*fS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,zg);yield ai(lo.setMfaState({loading:!0})),yield vt();const o=O({},n,{recoveryCode:"recoveryCode"}),i={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield ai(lo.setMfaState(i)),yield vt(),yield ai(lo.setUser(O({},iy,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*pS({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield di((e=>e.auth.mfaState));yield ai(lo.setMfaState({saving:!0})),yield vt(),yield ai(lo.setMfaState({saving:!1,error:void 0,mfaDevices:O({},n,{authenticators:[]})})),yield ai(lo.setUser(O({},iy))),null==(t=e.callback)||t.call(e,!0)}function*gS(e){let{}=e,t=Ao(e.payload,qg);yield ai(lo.setMfaState({saving:!0}));try{var n;yield ai(lo.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var o;yield ai(lo.setMfaState({saving:!1,error:e.message})),null==(o=t.callback)||o.call(t,!1,e)}}function*SS({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield di((e=>e.auth.mfaState));yield ai(lo.setMfaState({saving:!0})),yield vt(),yield ai(lo.setMfaState({loading:!1,error:void 0,mfaDevices:O({},n,{phones:[]})})),yield ai(lo.setUser(O({},iy))),null==(t=e.callback)||t.call(e,!0)}function*vS({payload:e}){var t;yield ai(lo.setMfaState({saving:!0})),yield vt(),yield ai(lo.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*hS(e){let{payload:{callback:t}}=e;Ao(e.payload,Hg);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield di((e=>e.auth.mfaState));yield ai(lo.setMfaState({saving:!0})),yield vt();const o={token:"token",recoveryCode:"recoveryCode"},i={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:O({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield ai(lo.setMfaState(i)),yield ai(lo.setUser(O({},iy,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*mS(){yield oa(lo.enrollMfa,dS),yield oa(lo.verifyMfa,yS),yield oa(lo.disableMfa,pS),yield oa(lo.verifyMfaAfterForce,fS),yield oa(lo.preDisableMfaSms,gS),yield oa(lo.disableMfaSms,SS),yield oa(lo.preEnrollMfaSms,vS),yield oa(lo.enrollMfaSms,hS)}const bS=["callback"];function*AS({payload:e}){yield ai(lo.setForgotPasswordState({loading:!0}));try{var t;yield si(Bd.auth.forgotPassword,e),yield ai(lo.setForgotPasswordState({loading:!1,error:void 0,step:Wt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setForgotPasswordState({loading:!1,error:t.message||"Unknown error occurred"})),null==(n=e.callback)||n.call(e,!1,t)}}function*kS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,bS);yield ai(lo.setForgotPasswordState({loading:!0}));try{yield si(Bd.auth.resetPassword,n),yield ai(lo.setForgotPasswordState({loading:!1,error:void 0,step:Wt.success})),null==t||t(!0)}catch(e){yield ai(lo.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1,e)}}function*TS({payload:e}){yield ai(lo.setForgotPasswordState({loading:!0}));try{const t=yield si(Bd.auth.loadPasswordConfig,e);yield ai(lo.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield ai(lo.setForgotPasswordState({loading:!1,error:e.message}))}}function*PS(){yield aa(lo.forgotPassword,AS),yield aa(lo.resetPassword,kS),yield aa(lo.loadPasswordConfig,TS)}let IS;!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"}(IS||(IS={}));const LS=["callback","events"],ES=["callback"],OS=["callback"];function*wS({payload:{userId:e,token:t}}){yield ai(lo.setActivateState({loading:!0,step:_t.activating}));try{const{isAuthenticated:n}=yield di((e=>e.auth));n&&(yield ai(lo.silentLogout()));const o=yield si(Bd.auth.getActivateAccountStrategy,{userId:e,token:t});yield ai(lo.setActivateStrategyState({strategy:o,loading:!1,error:void 0})),o.shouldSetPassword&&(yield ai(lo.setActivateState({loading:!1,step:_t.activatingForm})))}catch(e){yield ai(lo.setActivateState({loading:!1,error:e.message}))}}function*DS(e){let{payload:{callback:t,events:n}}=e,o=Ao(e.payload,LS);yield ai(lo.setActivateState({loading:!0}));try{const e=ra.onRedirectTo,{routes:a}=yield di((e=>e.auth)),r=yield si(Bd.auth.activateAccount,o);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(qf(r)){yield ai(lo.setActivateState({step:_t.success}));const t=yield Yf(r);yield ai(lo.setState(t)),yield yi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var i;yield ai(lo.setActivateState({step:_t.success}));const{user:e,tenants:t}=yield si(Bd.auth.generateLoginResponseV2,r);null==n||null==(i=n.userVerified)||i.call(n,{email:e.email,origin:wy.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield ai(lo.setTenantsState({tenants:t,loading:!1})),yield ai(lo.setState({user:e,isAuthenticated:!0})),yield yi(1e3),yield Kf(),yield ai(lo.resetActivateState())}null==t||t(!0)}catch(e){yield ai(lo.setActivateState({loading:!1,error:e.message}))}}function*CS({payload:e}){const{callback:t}=e,n=Ao(e,ES);yield ai(lo.setActivateStrategyState({loading:!0}));try{const e=yield si(Bd.auth.getActivateAccountStrategy,n);yield ai(lo.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield ai(lo.setActivateStrategyState({loading:!1,error:e.message}))}}function*RS({payload:e}){const{callback:t}=e,n=Ao(e,OS);yield ai(lo.setTeamLoader({key:IS.RESEND_ACTIVATE_LINK,value:n.email})),yield ai(lo.setActivateState({loading:!0}));try{yield si(Bd.auth.resendActivationEmail,n),yield ai(lo.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield ai(lo.setActivateState({loading:!1,error:e.message})),yield ai(lo.setTeamError({key:IS.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:IS.RESEND_ACTIVATE_LINK,value:!1}))}function*US(){yield aa(lo.activateAccount,DS),yield aa(lo.preActivateAccount,wS),yield aa(lo.getActivateAccountStrategy,CS),yield aa(lo.resendActivationEmail,RS)}function*_S({payload:e}){if(e.token&&e.userId)try{yield ai(lo.setAcceptInvitationState({error:void 0,step:$t.pending})),yield si(Bd.auth.acceptInvitation,e),yield ai(lo.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:$t.success}}))}catch(e){yield ai(lo.setAcceptInvitationState({step:$t.failed,error:e.message}))}else yield ai(lo.setAcceptInvitationState({error:void 0,step:$t.invalid}))}function*MS(){yield aa(lo.acceptInvitation,_S)}var NS,FS=new Uint8Array(16);function $S(){if(!NS&&!(NS="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 NS(FS)}for(var GS=/^(?:[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,xS=function(e){return"string"==typeof e&&GS.test(e)},VS=[],WS=0;WS<256;++WS)VS.push((WS+256).toString(16).substr(1));var jS=function(e,t,n){var o=(e=e||{}).random||(e.rng||$S)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=o[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(VS[e[t+0]]+VS[e[t+1]]+VS[e[t+2]]+VS[e[t+3]]+"-"+VS[e[t+4]]+VS[e[t+5]]+"-"+VS[e[t+6]]+VS[e[t+7]]+"-"+VS[e[t+8]]+VS[e[t+9]]+"-"+VS[e[t+10]]+VS[e[t+11]]+VS[e[t+12]]+VS[e[t+13]]+VS[e[t+14]]+VS[e[t+15]]).toLowerCase();if(!xS(n))throw TypeError("Stringified UUID is invalid");return n}(o)};const KS=["callback"],BS=["roles"],zS=["callback"],qS=["callback","profileImage"],HS=["callback"],JS=["callback","userId"],YS=["callback"],QS=["callback"],XS=["callback"],ZS=["callback"],ev=["callback"],tv=["callback"],nv=["callback"],ov=["callback","profileImage"],iv=["callback"],av=["callback"],rv=["callback"],lv=["callback"],sv=["callback"],cv=["callback"],uv=()=>di((e=>e.auth.teamState));function*dv({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield uv(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filter,d=null!=(i=e.sort)?i:l.sort;yield ai(lo.setTeamLoader({key:IS.USERS,value:!a})),yield ai(lo.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:o},{items:i}]=yield ri([si(Bd.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),si(Bd.teams.loadAvailableRoles),si(Bd.teams.loadAvailablePermissions)]);yield ai(lo.setTeamState({users:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==r||r(e)}catch(e){yield ai(lo.setTeamError({key:IS.USERS,value:e.message})),yield ai(lo.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield ai(lo.setTeamLoader({key:IS.USERS,value:!1}))}function*yv({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield uv(),c={_limit:(null!=(t=e._limit)?t:s.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:s.allUsersQueryParams._offset)||0,_filter:(null!=(o=e._filter)?o:s.allUsersQueryParams._filter)||"",_sortBy:(null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:s.allUsersQueryParams._order)||"DESC"};yield ai(lo.setTeamLoader({key:IS.USERS,value:!r})),yield ai(lo.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:o},{items:i}]=yield ri([si(Bd.subTenants.loadAllUsers,O({},c)),si(Bd.teams.loadAvailableRoles),si(Bd.teams.loadAvailablePermissions)]);yield ai(lo.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==l||l(e)}catch(e){yield ai(lo.setTeamError({key:IS.USERS,value:e.message})),yield ai(lo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield ai(lo.setTeamLoader({key:IS.USERS,value:!1}))}function*fv({payload:e}){yield ai(lo.setTeamLoader({key:IS.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield ri([si(Bd.teams.loadAvailableRoles),si(Bd.teams.loadAvailablePermissions)]);yield ai(lo.setTeamState({roles:n,permissions:o})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:o})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield ai(lo.setTeamError({key:IS.ROLES_AND_PERMISSIONS,value:t.message}))}yield ai(lo.setTeamLoader({key:IS.ROLES_AND_PERMISSIONS,value:!0}))}function*pv({payload:e}){const{callback:t}=e,n=Ao(e,KS),o=yield uv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield si(Bd.teams.addUser,n),{roles:a}=e,r=O({},Ao(e,BS),{roleIds:null!=(i=null==a?void 0:a.map((e=>e.id)))?i:[]});null==t||t(r),yield ai(lo.setTeamState({users:[r,...o.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*gv({payload:e}){const{callback:t}=e,n=yield uv();yield ai(lo.setTeamState({addUserDialogState:O({},n.addUserDialogState,{loading:!0})}));const o=[],i=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield ai(lo.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield si(Bd.teams.addUser,t),o.push(t.email)}catch(e){i.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:[],silentLoading:e.emails.length>0};yield ai(lo.loadUsers(r)),yield ai(lo.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:i,allowedEmails:o})}function*Sv({payload:e}){const{callback:t}=e,n=Ao(e,zS),o=yield uv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})}));try{yield si(Bd.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield si(Bd.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield ai(lo.setTeamState({allUsers:e,totalPages:o,totalItems:i,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*vv({payload:e}){const{callback:t}=e,n=Ao(e,qS),{id:o}=n,i=yield uv(),a=i.users.find((e=>e.id===n.id));yield ai(lo.setTeamLoader({key:IS.UPDATE_USER,value:o||""})),yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0})})),yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0}),users:i.users.map((e=>e.id===n.id?O({},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 si(Bd.teams.updateUser,n);null==t||t(e),yield ai(lo.setTeamState({users:i.users.map((t=>t.id===e.id?O({},t,e,{createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield ai(lo.setTeamLoader({key:IS.UPDATE_USER,value:!1}))}catch(e){yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!1,error:e.message}),users:i.users.map((e=>e.id===n.id?O({},e,a):e))})),yield ai(lo.setTeamLoader({key:IS.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*hv({payload:e}){const{callback:t}=e,n=Ao(e,HS),o=yield uv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})}));try{yield si(Bd.teams.deleteUser,n),null==t||t(!0),yield ai(lo.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*mv({payload:e}){const{callback:t,userId:n}=e,o=Ao(e,JS),i=yield uv();yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0})}));try{yield si(Bd.subTenants.setUserRolesForSubTenants,n,o);const e=i.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return O({},e,{roles:(null==(t=o.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>i.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield ai(lo.setTeamState({allUsers:[...i.allUsers.filter((e=>e.id!==n)),...e?[O({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*bv({payload:e}){const{callback:t}=e,n=Ao(e,YS),o=yield uv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})}));try{yield si(Bd.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield ai(lo.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Av({payload:e}){const{callback:t}=e,n=Ao(e,QS);yield ai(lo.setTeamLoader({key:IS.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield si(Bd.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:IS.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:IS.RESEND_ACTIVATE_LINK,value:!1}))}function*kv({payload:e}){const{callback:t}=e,n=Ao(e,XS);yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:n.email}));try{yield si(Bd.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:IS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:!1}))}function*Tv({payload:e}){const{callback:t}=e,n=Ao(e,ZS);yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:n.email}));try{yield si(Bd.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:IS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:!1}))}function*Pv({payload:e}){const{callback:t}=e,n=Ao(e,ev);yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:n.email}));try{yield si(Bd.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:IS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:!1}))}function*Iv(){yield ai(lo.setTeamError({key:IS.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield si(Bd.teams.getInviteLinkConfiguration);yield ai(lo.setTeamState({inviteTokenState:O({},e)}))}catch(e){yield ai(lo.setTeamError({key:IS.CONFIG_TOKEN_LINK,value:e.message}))}}function*Lv(){yield ai(lo.setTeamError({key:IS.GET_TOKEN_LINK,value:!1}));try{yield si(Iv);const e=yield si(Bd.teams.getInviteUserLink),{inviteTokenState:t}=yield uv();yield ai(lo.setTeamState({inviteTokenState:O({},t,e)}))}catch(e){yield ai(lo.setTeamError({key:IS.GET_TOKEN_LINK,value:e.message}))}}function*Ev({payload:{callback:e}}){yield ai(lo.setTeamError({key:IS.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield uv();try{const n=yield si(Bd.teams.createInviteUserLink,{expiresInMinutes:43200});yield ai(lo.setTeamState({inviteTokenState:O({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield ai(lo.setTeamError({key:IS.CREATE_TOKEN_LINK,value:t.message}))}}function*Ov({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield uv();yield ai(lo.setTeamError({key:IS.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield si(Bd.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield ai(lo.setTeamState({inviteTokenState:O({},o,i)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield ai(lo.setTeamError({key:IS.UPDATE_TOKEN_LINK,value:t.message}))}}function*wv({payload:e}){const{callback:t}=null!=e?e:{};yield ai(lo.setTeamError({key:IS.DELETE_TOKEN_LINK,value:!1}));try{yield si(Bd.teams.deleteInviteUserLink),yield ai(lo.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:IS.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Dv({payload:e}){yield ai(lo.setTeamState({addUserDialogState:O({open:!0,loading:!1,error:!1},e)}))}function*Cv({payload:e}){const t=yield uv(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield ai(lo.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Rv({payload:e}){yield ai(lo.setTeamState({deleteUserDialogState:O({open:!0,loading:!1,error:!1},e)}))}function*Uv({payload:e}){const t=yield uv(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield ai(lo.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*_v(){yield ia(lo.loadUsers,dv),yield ia(lo.loadAllSubTenantsUsers,yv),yield ia(lo.loadRoles,fv),yield oa(lo.addUser,pv),yield oa(lo.addUsersBulk,gv),yield oa(lo.addUserToSubTenants,Sv),yield oa(lo.updateUser,vv),yield oa(lo.setUserRolesForSubTenants,mv),yield oa(lo.deleteUser,hv),yield oa(lo.deleteUserFromSubTenants,bv),yield oa(lo.resendActivationLink,Av),yield oa(lo.resendInvitationLink,kv),yield oa(lo.resendInvitationEmail,Tv),yield oa(lo.resendInvitationLinkToAllSubTenants,Pv),yield oa(lo.getInvitationLink,Lv),yield oa(lo.createInvitationLink,Ev),yield oa(lo.updateInvitationLink,Ov),yield oa(lo.deleteInvitationLink,wv),yield oa(lo.openAddUserDialog,Dv),yield oa(lo.closeAddUserDialog,Cv),yield oa(lo.openDeleteUserDialog,Rv),yield oa(lo.closeDeleteUserDialog,Uv)}function*Mv({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield uv(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filter,d=null!=(i=e.sort)?i:l.sort;yield ai(lo.setTeamLoader({key:IS.USERS,value:!a})),yield ai(lo.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield vt(),yield ai(lo.setTeamState({users:my,totalPages:2,totalItems:10,roles:fy,permissions:gy})),yield ai(lo.setTeamLoader({key:IS.USERS,value:!1})),null==r||r(my)}function*Nv({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield uv(),c=null!=(t=e._limit)?t:s.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:s.allUsersQueryParams._offset,d=null!=(o=e._filter)?o:s.allUsersQueryParams._filter,y=null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:s.allUsersQueryParams._order;yield ai(lo.setTeamLoader({key:IS.USERS,value:!r})),yield ai(lo.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield vt(),yield ai(lo.setTeamState({allUsers:by,totalPages:2,totalItems:10,roles:fy,permissions:gy})),yield ai(lo.setTeamLoader({key:IS.USERS,value:!1})),null==l||l(by)}function*Fv({payload:e}){var t;yield ai(lo.setTeamLoader({key:IS.ROLES_AND_PERMISSIONS,value:!0})),yield vt(),yield ai(lo.setTeamState({roles:fy,permissions:gy})),yield ai(lo.setTeamLoader({key:IS.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:fy,permissions:gy})}function*$v({payload:e}){const{callback:t}=e,n=Ao(e,tv),o=yield uv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})})),yield vt();const i=O({},vy,n,{id:`${jS()}`});null==t||t(i),yield ai(lo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*Gv({payload:e}){const{callback:t}=e,n=Ao(e,nv),o=yield uv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})})),yield vt();const i=O({},vy,n,{id:`${jS()}`});yield ai(lo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*xv({payload:e}){var t;const{callback:n}=e,o=Ao(e,ov),{id:i}=o,a=yield uv(),r=a.users.find((e=>e.id===o.id));yield ai(lo.setTeamLoader({key:IS.UPDATE_USER,value:i||""})),yield ai(lo.setTeamState({addUserDialogState:O({},a.addUserDialogState,{loading:!0})})),yield ai(lo.setTeamState({addUserDialogState:O({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===o.id?O({},e,o):e))})),r.roleIds.length>0&&0===(null==(t=o.roleIds)?void 0:t.length)&&(o.roleIds=[""]),yield vt();const l=O({},r,o);null==n||n(l),yield ai(lo.setTeamState({users:a.users.map((e=>e.id===l.id?O({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield ai(lo.setTeamLoader({key:IS.UPDATE_USER,value:!1}))}function*Vv({payload:e}){const{callback:t}=e,n=Ao(e,iv),o=yield uv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})})),yield vt(),null==t||t(!0),yield ai(lo.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Wv({payload:e}){const{callback:t}=e,n=Ao(e,av),o=yield uv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})})),yield vt(),null==t||t(!0),yield ai(lo.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*jv({payload:e}){const{callback:t}=e,n=Ao(e,rv);yield ai(lo.setTeamLoader({key:IS.RESEND_ACTIVATE_LINK,value:n.userId})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:IS.RESEND_ACTIVATE_LINK,value:!1}))}function*Kv({payload:e}){const{callback:t}=e,n=Ao(e,lv);yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:!1}))}function*Bv({payload:e}){const{callback:t}=e,n=Ao(e,sv);yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:!1}))}function*zv({payload:e}){const{callback:t}=e,n=Ao(e,cv);yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:IS.RESEND_INVITATION_LINK,value:!1}))}function*qv(){yield ia(lo.loadUsers,Mv),yield ia(lo.loadAllSubTenantsUsers,Nv),yield ia(lo.loadRoles,Fv),yield oa(lo.addUser,$v),yield oa(lo.addUserToSubTenants,Gv),yield oa(lo.updateUser,xv),yield oa(lo.deleteUser,Vv),yield oa(lo.deleteUserFromSubTenants,Wv),yield oa(lo.resendActivationLink,jv),yield oa(lo.resendInvitationLink,Kv),yield oa(lo.resendInvitationEmail,Bv),yield oa(lo.resendInvitationLinkToAllSubTenants,zv),yield oa(lo.openAddUserDialog,Dv),yield oa(lo.closeAddUserDialog,Cv),yield oa(lo.openDeleteUserDialog,Rv),yield oa(lo.closeDeleteUserDialog,Uv)}const Hv=["authorizationUrl"],Jv=["events","url"];function*Yv(){try{yield ai(lo.setSocialLoginsState({loading:!0}));const e=yield si(Bd.auth.getSocialLoginProviders);yield ai(lo.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield ai(lo.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Qv(){try{const e=yield di((e=>e.root.context));yield ai(lo.setSocialLoginsState({loading:!0}));const t=yield si(Bd.auth.getSocialLoginProvidersV2),{providers:n}=yield si(Bd.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Ao(t,Hv);const i=ca(e,null!=n?n:"");return O({},o,{authorizationUrl:n?`${i}${n}`:null})}));yield ai(lo.setSocialLoginsState({socialLoginsConfigV2:o,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield ai(lo.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Xv(e){let{payload:{events:t,url:n}}=e,o=Ao(e.payload,Jv);try{yield ai(lo.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield si(Bd.auth.loginViaSocialLogin,o);var i,a;r&&(null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,url:n,authenticationType:Dy.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:o.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:wy.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield ai(lo.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield di((e=>e.auth));e?yield si(ep):yield si(np)}(),localStorage.removeItem("register-quick-login"),yield ai(lo.setSocialLoginsState({loading:!1}))}catch(e){var r;yield ai(lo.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*Zv({payload:e}){yield ai(lo.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*eh(){yield aa(lo.loadSocialLoginsConfiguration,Yv),yield aa(lo.loadSocialLoginsConfigurationV2,Qv),yield aa(lo.loginViaSocialLogin,Xv),yield ia(lo.setSocialLoginError,Zv)}let th;function*nh({payload:e}){const{description:t,expires:n,callback:o}=e,{apiTokensDataUser:i}=yield di((e=>e.auth.apiTokensState));try{let e,a;yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield si(Bd.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield si(Bd.auth.updateUserApiTokensData,{description:t}),yield ai(lo.setApiTokensState({showAddTokenDialog:!1})),yield yi(200),yield ai(lo.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield ai(lo.setApiTokensError({key:th.ADD_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*oh({payload:e}){const{description:t,roleIds:n,expires:o,callback:i}=e,{apiTokensDataTenant:a}=yield di((e=>e.auth.apiTokensState));try{let e,r;yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield si(Bd.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield si(Bd.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield ai(lo.setApiTokensState({showAddTokenDialog:!1})),yield yi(200),yield ai(lo.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===o?e.clientId:void 0}})),yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield ai(lo.setApiTokensError({key:th.ADD_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*ih({payload:e}){const{apiTokensDataUser:t}=yield di((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!0})),n?(yield si(Bd.auth.deleteUserAccessToken,{id:e}),yield ai(lo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield si(Bd.auth.deleteUserApiToken,{tokenId:e}),yield ai(lo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!1}))}catch(e){yield ai(lo.setApiTokensError({key:th.DELETE_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!1}))}}function*ah({payload:e}){const{apiTokensDataTenant:t}=yield di((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let o=t;try{yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!0})),n?(yield si(Bd.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield si(Bd.auth.deleteTenantApiToken,{tokenId:e}),o=t.filter((t=>t.clientId!==e))),yield ai(lo.setApiTokensState({apiTokensDataTenant:o,deleteTokenDialog:{open:!1,id:e}})),yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!1}))}catch(e){yield ai(lo.setApiTokensError({key:th.DELETE_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!1}))}}function*rh({payload:e}){null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield ri([si(Bd.auth.getUserApiTokensData),si(Bd.auth.getTenantApiTokensData)]);yield ai(lo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setApiTokensError({key:th.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*lh({payload:e}){null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=si(Bd.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=si(Bd.auth.getUserAccessTokensData))?n:[]).accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield ai(lo.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield ai(lo.setApiTokensError({key:th.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*sh({payload:e}){null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=si(Bd.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=si(Bd.auth.getTenantAccessTokensData))?n:[],l=(null!=(o=null==r?void 0:r.accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield ai(lo.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield ai(lo.setApiTokensError({key:th.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*ch(){yield aa(lo.loadApiTokens,rh),yield aa(lo.loadUserApiTokens,lh),yield aa(lo.loadTenantApiTokens,sh),yield oa(lo.addUserApiToken,nh),yield oa(lo.addTenantApiToken,oh),yield ia(lo.deleteTenantApiToken,ah),yield ia(lo.deleteUserApiToken,ih)}function*uh({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield di((e=>e.auth.apiTokensState)),a=O({},ty,{description:t,roleIds:n,clientId:`CLIENT_ID_${jS()}`});yield ai(lo.setApiTokensState({showAddTokenDialog:!1})),yield yi(200),yield ai(lo.setApiTokensState({apiTokensDataTenant:[...i,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield yi(200),yield ai(lo.setApiTokensLoader({key:th.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*dh({payload:e}){yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!0})),yield yi(200);const t=[ty];yield ai(lo.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ai(lo.setApiTokensLoader({key:th.DELETE_API_TOKEN,value:!1}))}function*yh({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!0})));const n=[ey],o=[ty];yield ai(lo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield yi(200),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*fh({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!0})));const n=[ey];yield ai(lo.setApiTokensState({apiTokensDataUser:n})),yield yi(200),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*ph({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!0})));const n=[ty];yield ai(lo.setApiTokensState({apiTokensDataTenant:n})),yield yi(200),yield ai(lo.setApiTokensLoader({key:th.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*gh(){yield aa(lo.loadApiTokens,yh),yield aa(lo.loadUserApiTokens,fh),yield aa(lo.loadTenantApiTokens,ph),yield oa(lo.addTenantApiToken,uh),yield ia(lo.deleteTenantApiToken,dh)}function*Sh({payload:e}){try{var t;yield ai(lo.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield di((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield si(Bd.accountSettings.updateSettings,O({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield ai(lo.setAccountSettingsState(O({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield ai(lo.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*vh({payload:e}){yield ai(lo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield si(Bd.accountSettings.getSettings);yield ai(lo.setAccountSettingsState(O({},e,{loading:!1})))}catch(e){yield ai(lo.setAccountSettingsState({loading:!1,error:e.message}))}}function*hh(){yield aa(lo.saveAccountSettings,Sh),yield aa(lo.loadAccountSettings,vh)}function*mh({payload:e}){var t;yield ai(lo.setAccountSettingsState({loading:!0})),yield vt();const{accountSettingsState:n}=yield di((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=O({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield ai(lo.setAccountSettingsState(O({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*bh({payload:e}){yield ai(lo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield vt(),yield ai(lo.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Ah(){yield aa(lo.saveAccountSettings,mh),yield aa(lo.loadAccountSettings,bh)}function*kh({payload:{tenantId:e,callback:t}}){yield ai(lo.setState({isLoading:!0}));try{yield si(Bd.tenants.switchTenant,{tenantId:e}),yield si(Xf),(null==t?void 0:t(!0))||(yield ai(lo.setState({isLoading:!1})))}catch(e){yield ai(lo.setState({isLoading:!1})),null==t||t(!1,e)}}function*Th({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(Bd.tenants.getTenants);yield ai(lo.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 ai(lo.setTenantsState({loading:!1}))}}function*Ph({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(Bd.tenants.getSubTenants);yield ai(lo.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Ih({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(Bd.tenants.getSubTenantsAsTree);yield ai(lo.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Lh(){yield oa(lo.loadTenants,Th),yield oa(lo.loadSubTenants,Ph),yield oa(lo.switchTenant,kh),yield oa(lo.loadSubTenantsTree,Ih)}function*Eh(){yield ai(lo.setTenantsState({loading:!0})),yield vt(),yield ai(lo.setTenantsState({tenants:Ay,loading:!1}))}function*Oh(){yield oa(lo.loadTenants,Eh)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(th||(th={}));const wh=["callback"],Dh=["callback"],Ch=["callback"],Rh=["callback"],Uh=["callback"];function*_h({payload:e}){var t;yield ai(lo.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield ri([si(Bd.roles.getRoles),si(Bd.roles.getPermissions),si(Bd.roles.getPermissionCategories)]),[t,n,o]=e;yield ai(lo.setRolesState({roles:t,permissions:n,permissionCategories:o,loading:!1}))}catch(e){yield ai(lo.setRolesState({error:e.message,loading:!1}))}}function*Mh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,wh);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(Bd.roles.addRole,n),o=yield si(Bd.roles.getRoles);yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({roles:o,saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Nh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Dh);yield ai(lo.setRolesState({saving:!0}));try{yield si(Bd.roles.deleteRole,n),yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*Fh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Ch);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(Bd.roles.updateRole,n);yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*$h(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Rh);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(Bd.roles.attachPermissionsToRole,n);yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Gh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Uh);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(Bd.roles.attachPermissionToRoles,n);yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*xh(){yield aa(lo.loadRolesAndPermissions,_h),yield oa(lo.addRole,Mh),yield oa(lo.deleteRole,Nh),yield oa(lo.updateRole,Fh),yield oa(lo.attachPermissionsToRole,$h),yield oa(lo.attachPermissionToRoles,Gh)}function*Vh({payload:e}){var t;yield ai(lo.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield ai(lo.setRolesState({roles:ny,loading:!1}))}catch(e){yield ai(lo.setRolesState({error:e.message,loading:!1}))}}function*Wh(){yield aa(lo.loadRolesAndPermissions,Vh)}const jh=["callback"],Kh=["callback"],Bh=["callback"];function*zh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,jh);yield ai(lo.setResetPhoneNumberState({loading:!0}));try{const e=yield si(Bd.auth.resetPhoneNumber,n);yield ai(lo.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:zt.VerifyResetPhoneNumber})),yield ai(lo.setLoginState({email:n.email}))}catch(e){yield ai(lo.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*qh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Kh);yield ai(lo.setResetPhoneNumberState({loading:!0}));try{const e=yield si(Bd.auth.verifyResetPhoneNumber,n);yield ai(lo.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:zt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield ai(lo.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Hh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Bh);yield ai(lo.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:o}=yield di((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield si(Bd.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield ai(lo.setLoginState({step:kt.loginWithSmsOtc})),yield ai(lo.passwordlessPreLogin({type:Lr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(o.loginUrl),yield ai(lo.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Jh(){yield aa(lo.resetPhoneNumber,zh),yield aa(lo.verifyResetPhoneNumber,qh),yield aa(lo.changePhoneNumber,Hh)}function*Yh(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getCurrentUserSessions);yield ai(lo.setSessionsState({sessions:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*Qh(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getCurrentUserSession);yield ai(lo.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*Xh({payload:{id:e}}){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(Bd.auth.deleteSessionForUser,e),yield ai(lo.loadUserSessions())}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*Zh({payload:{callback:e,userId:t}}){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(Bd.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield ai(lo.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*em(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(Bd.auth.deleteAllSessionsForUser),yield ai(lo.loadUserSessions())}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*tm(){yield ia(lo.loadUserSessions,Yh),yield ia(lo.deleteUserSession,Xh),yield ia(lo.deleteAllUserSessions,em),yield ia(lo.loadCurrentUserSession,Qh),yield oa(lo.revokeUserSessions,Zh)}function*nm(){yield ai(lo.setSessionsState({loading:!0,error:null})),yield ai(lo.setSessionsState({sessions:ky,loading:!1}))}function*om({payload:{id:e}}){yield ai(lo.setSessionsState({loading:!0,error:null}));const t=(yield di((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield ai(lo.setSessionsState({sessions:t,loading:!1}))}function*im(){yield ai(lo.setSessionsState({loading:!0,error:null}));const e=ky.filter((e=>e.current));yield ai(lo.setSessionsState({sessions:e,loading:!1}))}function*am(){yield ia(lo.loadUserSessions,nm),yield ia(lo.deleteUserSession,om),yield ia(lo.deleteAllUserSessions,im)}const rm=["callback"],lm=["callback"];function*sm(){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getSessionConfigurations);yield ai(lo.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*cm({payload:e}){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ao(e,rm);yield si(Bd.auth.createOrUpdateSessionConfigrations,n),yield ai(lo.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield ai(lo.setSessionsPolicyState({error:e,loading:!1}))}}function*um(){yield aa(lo.loadSessionsPolicy,sm),yield ia(lo.createOrUpdateSessionsPolicy,cm)}function*dm(){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));const e=yield di((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Ty}));yield ai(lo.setSessionsPolicyState(O({},e,{loading:!1})))}function*ym({payload:e}){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ao(e,lm);null==t||t(!0),yield ai(lo.setSessionsPolicyState({configurations:n,loading:!1}))}function*fm(){yield aa(lo.loadSessionsPolicy,dm),yield ia(lo.createOrUpdateSessionsPolicy,ym)}const pm=["callback"],gm=["callback"],Sm=["callback"],vm=["callback"],hm=["callback"],mm=["callback"],bm=["callback"],Am=["callback"],km=()=>di((e=>e.auth.restrictionsState.ipRestrictions)),Tm=()=>di((e=>e.auth.restrictionsState.emailDomainRestrictions));function*Pm(){yield ai(lo.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield si(Bd.auth.getDomainRestrictionsConfig),t=(yield si(Bd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ai(lo.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield ai(lo.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*Im(e){let{payload:{callback:t}}=e,n=Ao(e.payload,pm);yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield Tm();try{var i;yield si(Bd.auth.createDomainRestriction,n);const e=(yield si(Bd.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=o.data)?void 0:t.config.listType)}));yield ai(lo.setEmailDomainRestrictionsState({data:{config:(null==(i=o.data)?void 0:i.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Lm(e){let{payload:{callback:t}}=e,n=Ao(e.payload,gm);yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield si(Bd.auth.updateDomainRestrictionConfig,n),o=(yield si(Bd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ai(lo.setEmailDomainRestrictionsState({data:{config:e,restrictions:o},saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Em({payload:{id:e}}){yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Tm();try{var n;yield si(Bd.auth.deleteDomainRestriction,e);const o=(yield si(Bd.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield ai(lo.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:$n.ALLOW},restrictions:o},saving:!1}))}catch(e){yield ai(lo.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Om=e=>{var t,n,o;return{_filter:null!=(t=null==e?void 0:e._filter)?t:$n.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(o=null==e?void 0:e._offset)?o:0}};function*wm(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield km(),t=yield si(Bd.auth.getIPRestrictionsConfig),n=Om({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield si(Bd.auth.getIPRestrictions,n);yield ai(lo.setIpRestrictionsState({data:{restrictions:o,config:t},totalPages:i,pagination:n,loading:!1}))}catch(e){yield ai(lo.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Dm(){try{const{valid:e}=yield si(Bd.auth.testCurrentIpInAllowList);yield ai(lo.setIpRestrictionsState({userIpValid:e}))}catch(e){yield ai(lo.setIpRestrictionsState({error:e.message}))}}function*Cm({payload:{callback:e}}){yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield di((e=>e.auth.userIp));yield ri([si(Bd.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:$n.ALLOW}),si(Bd.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield km(),o=Om(n.pagination),{items:i,_metadata:{totalPages:a}}=yield si(Bd.auth.getIPRestrictions,o);yield ai(lo.setIpRestrictionsState({data:{config:{isActive:!0,strategy:$n.ALLOW},restrictions:i},userIpValid:!0,pagination:o,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield ai(lo.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Rm(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Sm);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const o=yield km();try{var i,a;yield si(Bd.auth.createIPRestriction,n);const e=yield km(),r=Om(e.pagination),{items:l,_metadata:{totalPages:s}}=yield si(Bd.auth.getIPRestrictions,r);yield Dm(),yield ai(lo.setIpRestrictionsState({data:{config:null!=(i=null==(a=o.data)?void 0:a.config)?i:{isActive:!1,strategy:$n.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Um(e){let{payload:{callback:t}}=e,n=Ao(e.payload,vm);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));try{yield si(Bd.auth.updateIPRestrictionConfig,n);const e=yield km(),o=yield si(Bd.auth.getIPRestrictionsConfig),i=Om(O({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield si(Bd.auth.getIPRestrictions,i);yield Dm(),yield ai(lo.setIpRestrictionsState({data:{config:o,restrictions:a},pagination:i,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*_m({payload:{id:e,callback:t}}){yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const n=yield km();try{var o;yield si(Bd.auth.deleteIPRestriction,e);const i=yield km(),a=Om(i.pagination),{items:r,_metadata:{totalPages:l}}=yield si(Bd.auth.getIPRestrictions,a);yield Dm(),yield ai(lo.setIpRestrictionsState({data:{config:(null==(o=n.data)?void 0:o.config)||{isActive:!1,strategy:$n.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Mm(){yield aa(lo.loadIpRestrictions,wm),yield aa(lo.loadEmailDomainRestrictions,Pm),yield oa(lo.saveIpRestriction,Rm),yield oa(lo.saveIpRestrictionsConfig,Um),yield oa(lo.deleteIpRestriction,_m),yield oa(lo.checkIfUserIpValid,Dm),yield oa(lo.addCurrentUserIpAndActivate,Cm),yield oa(lo.saveEmailDomainRestriction,Im),yield oa(lo.saveEmailDomainRestrictionsConfig,Lm),yield oa(lo.deleteEmailDomainRestriction,Em)}function*Nm(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null})),yield ai(lo.setIpRestrictionsState({data:{restrictions:Iy.filter((e=>e.strategy===Py.strategy)),config:Py},totalPages:1,pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Fm(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield km(),t=Iy[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield ai(lo.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield ai(lo.setIpRestrictionsState({error:e.message,loading:!1}))}}function*$m(e){var t,n,o;let{payload:{callback:i}}=e,a=Ao(e.payload,hm);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const r=yield km(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield ai(lo.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:$n.ALLOW},restrictions:[...l,O({},a,{createdAt:new Date,updatedAt:new Date,id:jS(),isActive:null==(o=a.isActive)||o,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*Gm(e){var t,n,o;let{payload:{callback:i}}=e,a=Ao(e.payload,mm);const r=yield km();yield ai(lo.setIpRestrictionsState({saving:!0,error:null})),yield ai(lo.setIpRestrictionsState({data:{config:O({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(o=r.data)?void 0:o.restrictions)?n:[]},pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield ai(lo.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*xm({payload:{id:e,callback:t}}){var n;yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const o=yield km();yield ai(lo.setIpRestrictionsState({data:{config:(null==(n=o.data)?void 0:n.config)||{isActive:!1,strategy:$n.ALLOW},restrictions:o.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*Vm(){yield ai(lo.setEmailDomainRestrictionsState({loading:!0,error:null})),yield ai(lo.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:$n.ALLOW}],config:{active:!0,listType:$n.ALLOW,blockPublicDomains:!1}}}))}function*Wm(e){var t,n;let{payload:{callback:o}}=e,i=Ao(e.payload,bm);const a=yield Tm();yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield vt(),null==o||o(!0),yield ai(lo.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:i.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],O({},i,{id:Date.now().toString()})]},saving:!1}))}function*jm(e){var t;let{payload:{callback:n}}=e,o=Ao(e.payload,Am);const i=yield Tm();yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield vt(),null==n||n(!0),yield ai(lo.setEmailDomainRestrictionsState({data:{config:{active:o.active,blockPublicDomains:o.blockPublicDomains||!1,listType:o.type||$n.ALLOW},restrictions:[...(null==(t=i.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*Km({payload:{id:e}}){var t,n;const o=yield Tm();yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield vt(),yield ai(lo.setEmailDomainRestrictionsState({data:{config:(null==(t=o.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:$n.ALLOW},restrictions:((null==(n=o.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*Bm(){yield aa(lo.loadIpRestrictions,Nm),yield aa(lo.loadEmailDomainRestrictions,Vm),yield oa(lo.saveIpRestriction,$m),yield oa(lo.saveIpRestrictionsConfig,Gm),yield oa(lo.deleteIpRestriction,xm),yield oa(lo.checkIfUserIpValid,Fm),yield oa(lo.saveEmailDomainRestriction,Wm),yield oa(lo.saveEmailDomainRestrictionsConfig,jm),yield oa(lo.deleteEmailDomainRestriction,Km)}const zm=["callback"],qm=["id"];function*Hm(e){const{count:t}=yield si(Bd.directory.countConfigurationUsers,e.id);return O({},e,{count:t})}function*Jm(){yield ai(lo.setProvisioningState({loading:!0,error:null}));try{const e=yield si(Bd.directory.getConfigs),t=yield ri(e.map((e=>Hm(e))));yield ai(lo.setProvisioningState({connections:t,loading:!1}))}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1}))}}function*Ym(e){let{payload:{callback:t}}=e,n=Ao(e.payload,zm);yield ai(lo.setProvisioningState({loading:!0,error:null}));try{const e=yield si(Bd.directory.createConfiguration,n),o=yield si(Bd.directory.getConfigs),i=yield ri(o.map((e=>Hm(e))));yield ai(lo.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1}))}}function*Qm(e){let{payload:{id:t}}=e,n=Ao(e.payload,qm);yield ai(lo.setProvisioningState({loading:!0,error:null}));try{yield si(Bd.directory.updateConfiguration,t,n);const e=yield si(Bd.directory.getConfigs),o=yield ri(e.map((e=>Hm(e))));yield ai(lo.setProvisioningState({connections:o,loading:!1}))}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1}))}}function*Xm({payload:{id:e,callback:t}}){yield ai(lo.setProvisioningState({loading:!0,error:null}));try{yield si(Bd.directory.deleteConfiguration,e);const n=yield si(Bd.directory.getConfigs),o=yield ri(n.map((e=>Hm(e))));yield ai(lo.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*Zm(){yield aa(lo.loadProvisionConnections,Jm),yield oa(lo.createProvisionConnection,Ym),yield oa(lo.deleteProvisionConnection,Xm),yield oa(lo.updateProvisionConnection,Qm)}const eb=["callback","events"];function*tb(e){let{payload:{callback:t}}=e,n=Ao(e.payload,eb);yield ai(lo.setImpersonateState({loading:!0}));try{yield si(Bd.impersonate.impersonate,n),yield ai(lo.setImpersonateState({step:to.success})),yield yi(1e3),yield Kf(),yield ai(lo.resetImpersonateState()),null==t||t(!0)}catch(e){yield ai(lo.setImpersonateState({loading:!1,error:e.message}))}}function*nb(){yield aa(lo.impersonate,tb)}function*ob({payload:e}){const{callback:t,deviceId:n}=e;yield ai(lo.setPasskeysState({loading:!0}));try{yield si(Bd.auth.deleteWebAuthnDevice,n);const{devices:e}=yield di((e=>e.auth.passkeysState)),o=e.filter((e=>e.id!==n));yield ai(lo.setPasskeysState({devices:o,loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setPasskeysState({loading:!1,error:e.message||null})),null==t||t(null,e.message)}}function*ib(){yield ai(lo.setPasskeysState({loading:!0}));try{const{devices:e}=yield si(Bd.auth.getWebAuthnDevices);yield ai(lo.setPasskeysState({devices:e,loading:!1}))}catch(e){yield ai(lo.setPasskeysState({loading:!1,error:e.message||null}))}}function*ab(){yield oa(lo.loadWebAuthnDevices,ib),yield oa(lo.deleteWebAuthnDevice,ob)}let rb,lb;!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"}(rb||(rb={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(lb||(lb={}));const sb=["roleIds","userIds"],cb=()=>di((e=>e.auth.groupsState));function*ub({payload:e}){const t=rb.GET_TEAM_USERS;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield si(Bd.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield ai(lo.setGroupsState({teamUsers:n}))}catch(e){yield ai(lo.setUsersGroupsError({key:t,value:e.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*db({payload:e}){const t=rb.GET_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield si(Bd.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:lb.rolesAndUsers});yield ai(lo.setGroupsState({selectedGroup:n}))}catch(e){yield ai(lo.setUsersGroupsError({key:t,value:e.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*yb(){const e=rb.GET_GROUPS,t=yield cb();yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield si(Bd.groups.getGroups,{_groupsRelations:lb.rolesAndUsers});yield ai(lo.setGroupsState(O({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield ai(lo.setUsersGroupsError({key:e,value:t.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:e,value:!1}))}}function*fb({payload:e}){const t=rb.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Ao(e,sb);yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield si(Bd.groups.createGroup,O({name:i.name},!!i.description&&{description:i.description},{color:i.color}));null!=o&&o.length&&(yield ai(lo.addUsersToGroup({groupId:r.id,userIds:o}))),null!=n&&n.length&&(yield ai(lo.addRolesToGroup({groupId:r.id,roleIds:n}))),yield ai(lo.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*pb({payload:e}){const t=rb.UPDATE_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(Bd.groups.updateGroup,e),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*gb({payload:e}){const t=rb.DELETE_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(Bd.groups.deleteGroup,e.groupId),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1,n.message)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*Sb({payload:e}){const t=rb.ADD_ROLES_TO_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(Bd.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*vb({payload:e}){const t=rb.DELETE_ROLES_FROM_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(Bd.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*hb({payload:e}){const t=rb.ADD_USERS_TO_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(Bd.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;null==e||null==(o=e.callback)||o.call(e,!1),yield ai(lo.setUsersGroupsError({key:t,value:n.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*mb({payload:e}){const t=rb.DELETE_USERS_FROM_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(Bd.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*bb(){const e=rb.GET_GROUP_CONFIGURATION;yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield si(Bd.groups.getGroupConfiguration);yield ai(lo.setGroupsState({groupsConfiguration:t}))}catch(t){yield ai(lo.setUsersGroupsError({key:e,value:t.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:e,value:!1}))}}function*Ab({payload:e}){const t=rb.UPDATE_GROUP_CONFIGURATION;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{yield si(Bd.groups.updateGroupConfiguration,e),yield ai(lo.getGroupConfiguration())}catch(e){yield ai(lo.setUsersGroupsError({key:t,value:e.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*kb(){yield ia(lo.loadGroups,yb),yield ia(lo.getGroupById,db),yield ia(lo.createGroup,fb),yield ia(lo.updateGroup,pb),yield ia(lo.deleteGroup,gb),yield ia(lo.addRolesToGroup,Sb),yield ia(lo.deleteRolesFromGroup,vb),yield ia(lo.addUsersToGroup,hb),yield ia(lo.deleteUsersFromGroup,mb),yield ia(lo.getGroupConfiguration,bb),yield ia(lo.updateGroupConfiguration,Ab),yield ia(lo.getTeamUsers,ub)}function*Tb(){const e=rb.GET_GROUPS;yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));const t=Oy;yield ai(lo.setGroupsState({groups:t})),yield ai(lo.setUsersGroupsLoader({key:e,value:!1}))}function*Pb({payload:e}){var t;const n=rb.CREATE_GROUP,{groups:o}=yield cb();yield ai(lo.setUsersGroupsLoader({key:n,value:!0})),yield ai(lo.setGroupsState({groups:[O({},e,{id:`${e.name}ID`}),...null!=o?o:[]]})),yield yi(500),null==e||null==(t=e.callback)||t.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:n,value:!1}))}function*Ib({payload:e}){var t,n,o,i,a;const r=rb.UPDATE_GROUP,l=yield cb();yield ai(lo.setUsersGroupsLoader({key:r,value:!0})),yield ai(lo.setGroupsState({groups:null==l||null==(t=l.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:""}):t})),selectedGroup:O({},null==l?void 0:l.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(o=null==e?void 0:e.color)?o:"",description:null!=(i=null==e?void 0:e.description)?i:""})})),yield yi(500),null==e||null==(a=e.callback)||a.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:r,value:!1}))}function*Lb({payload:e}){var t,n;const o=rb.DELETE_GROUP,i=yield cb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*Eb({payload:e}){var t,n;const o=rb.ADD_ROLES_TO_GROUP,i=yield cb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*Ob({payload:e}){var t,n;const o=rb.DELETE_ROLES_FROM_GROUP,i=yield cb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*wb({payload:e}){var t,n;const o=rb.ADD_USERS_TO_GROUP,i=yield cb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*Db({payload:e}){var t,n;const o=rb.DELETE_USERS_FROM_GROUP,i=yield cb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*Cb(){const e=rb.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield cb();yield ai(lo.setUsersGroupsLoader({key:e,value:!0})),t&&(yield ai(lo.setGroupsState({groupsConfiguration:O({},t)}))),yield ai(lo.setUsersGroupsLoader({key:e,value:!1}))}function*Rb({payload:e}){const t=rb.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield cb();yield ai(lo.setUsersGroupsLoader({key:t,value:!0})),n&&(yield ai(lo.setGroupsState({groupsConfiguration:O({},n,e)}))),yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}function*Ub(){yield ia(lo.loadGroups,Tb),yield ia(lo.createGroup,Pb),yield ia(lo.updateGroup,Ib),yield ia(lo.deleteGroup,Lb),yield ia(lo.addRolesToGroup,Eb),yield ia(lo.deleteRolesFromGroup,Ob),yield ia(lo.addUsersToGroup,wb),yield ia(lo.deleteUsersFromGroup,Db),yield ia(lo.getGroupConfiguration,Cb),yield ia(lo.updateGroupConfiguration,Rb)}var _b={sagas:function*(){yield ri([si(xp),si(US),si(MS),si(PS),si(Jh),si(ng),si(Eg),si(Ug),si(uS),si(_v),si(kb),si(eh),si(Ny),si(ch),si(df),si(hh),si(Lh),si(xh),si(tm),si(um),si(Mm),si(Zm),si(nb),si(ab)])},mockSagas:function*(){yield ri([si(jp),si(cg),si(Fg),si(mS),si(qv),si(gh),si(Pf),si(am),si(Ah),si(Oh),si(fm),si(Bm),si(Wh),si(Ub)])},storeName:Et,initialState:eo,reducer:ao,actions:lo};const Mb=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>O({},t,{[e]:O({},t[e],n)})}),Nb={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Fb={setAuditLogsState:Mb("auditLogsState"),resetAuditLogsState:e=>O({},e,{auditLogsState:Nb})},$b={exportAuditsCsv:rt("auditLogs/exportAuditsCsv"),loadAuditLogs:rt("auditLogs/loadAuditLogs",(e=>({payload:e})))},Gb={loading:!0},xb={setAuditsMetadataState:Mb("auditsMetadataState"),resetAuditsMetadataState:e=>O({},e,{auditsMetadataState:Gb})},Vb={loadAuditsMetadata:rt("auditLogs/loadAuditsMetadata")},Wb={auditLogsState:Nb,auditsMetadataState:Gb},{reducer:jb,actions:Kb}=st({name:wt,initialState:Wb,reducers:O({resetState:e=>O({},e,Wb),setState:(e,{payload:t})=>O({},e,t)},Fb,xb)}),Bb=O({},Kb,$b,Vb),zb=e=>"createdAt"!==e.id,qb={total:20,data:Array.from(Array(5).keys()).map((e=>O({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`})))},Hb={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}]},Jb=()=>di((e=>e.auditLogs.auditLogsState)),Yb=()=>di((e=>e.auditLogs.auditsMetadataState));function*Qb(){const e=yield Jb(),{columns:t}=yield Yb();try{const n=e.filter,o=e.sort.reduce(((e,t)=>O({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),i=n.reduce(((e,t)=>O({},e,{[t.id]:t.value})),{});yield ai(Bb.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Bd.audits.exportAudits(O({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},o,i))}catch(e){console.error("failed to export audits - ",e)}yield ai(Bb.setAuditLogsState({isDownloadingCsv:!1}))}function*Xb({payload:e}){yield ai(Bb.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Jb(),{columns:n}=yield Yb();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield ai(Bb.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>O({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>O({},e,{[t.id]:t.value})),{});n||(yield ai(Bb.loadAuditsMetadata()));const{data:p,total:g}=yield si(Bd.audits.getAudits,O({offset:c,count:s},y,f));yield ai(Bb.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield ai(Bb.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Zb(){yield oa(Bb.exportAuditsCsv,Qb),yield oa(Bb.loadAuditLogs,Xb)}function*eA({payload:e}){yield ai(Bb.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Jb(),{columns:n}=yield Yb();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield ai(Bb.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield ai(Bb.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=qb;let o=n.filter((e=>t=>e.filter(zb).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];o=o.sort(((e,t)=>(n,o)=>n[e]>o[e]?t?-1:1:o[e]>n[e]?t?1:-1:0)(e,n))}return{data:o,total:o.length}})(u,d);yield ai(Bb.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield ai(Bb.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*tA(){yield oa(Bb.loadAuditLogs,eA)}function*nA(){yield ai(Bb.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield si(Bd.metadata.getAuditsMetadata);yield ai(Bb.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ai(Bb.setAuditsMetadataState({error:e,loading:!1}))}}function*oA(){yield oa(Bb.loadAuditsMetadata,nA)}function*iA(){yield ai(Bb.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Hb;yield ai(Bb.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ai(Bb.setAuditsMetadataState({error:e,loading:!1}))}}function*aA(){yield oa(Bb.loadAuditsMetadata,iA)}var rA={sagas:function*(){yield ri([si(Zb),si(oA)])},mockSagas:function*(){yield ri([si(tA),si(aA)])},storeName:wt,initialState:Wb,reducer:jb,actions:Bb};const lA={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:sA,actions:cA,reducer:uA}=st({name:"audits",initialState:lA,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=O({},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]})))}}}),dA=O({},cA,{initData:rt(`${sA}/initData`),loadAudits:rt(`${sA}/loadAudits`),removeFilter:rt(`${sA}/removeFilter`),filterData:rt(`${sA}/filterData`),exportCSV:rt(`${sA}/exportCSV`),deleteAudits:rt(`${sA}/deleteAudits`)}),yA=()=>di((e=>e[sA]));function*fA(){const{sortBy:e,sortDirection:t}=yield yA();try{const n=yield si(Bd.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield ai(dA.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield ai(dA.loadItemFailedAction(t))}}function*pA(){try{const e=yield si(Bd.metadata.getAuditsMetadata);yield ai(dA.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield ai(dA.loadItemFailedAction(t))}}const gA=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*SA({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield yA(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield yA():{rowsData:[]};try{const e=gA(t),{data:l,total:d}=yield si(Bd.audits.getAudits,O({},r&&{paginationMode:"virtual"},{sortDirection:o,sortBy:n,filter:i},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield ai(dA.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield ai(dA.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield ai(dA.loadItemFailedAction(t))}}function*vA(){yield ai(dA.startLoading()),yield ri([fA(),pA(),SA({payload:{onlyOneLoad:!1},type:""})]),yield ai(dA.finishLoading())}function*hA({payload:e}){const{filters:t}=yield yA(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield ai(dA.setFilterData(o))}function*mA({payload:e}){const{filters:t}=yield yA();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const o=[...t.slice(0,n),e,...t.slice(n+1)];yield ai(dA.setFilterData(o))}function*bA(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield yA(),a=gA(e);yield ai(dA.startDownloadingCsv());try{yield Bd.audits.exportAudits(O({endpoint:"csv/v2",headerProps:i,sortDirection:n,sortBy:t,filter:o},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield ai(dA.stopDownloadingCsv())}}function*AA(){yield ia(dA.initData,vA),yield ia(dA.removeFilter,hA),yield ia(dA.filterData,mA),yield ia([dA.loadAudits,dA.textSearch,dA.onPageChange],SA),yield ia([dA.setFilterData,dA.setDataSorting,dA.startRefresh],(()=>SA({payload:{appendMode:!1},type:""}))),yield ia(dA.exportCSV,bA)}const kA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},TA={initData:()=>O({},kA),setConnectivityState:(e,{payload:t})=>O({},e,t),cleanWebhookTestData:e=>O({},e,{testResult:void 0}),cleanWebhookLogsData:e=>O({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return O({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>O({},e,{error:void 0}),cleanSlackData:e=>O({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>O({},e,{retryResult:O({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>O({},e,{retryResult:O({},e.retryResult,t)})}},PA={loadSlackActions:rt("connectivity/loadSlackActions"),loadDataAction:rt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:rt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:rt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:rt("connectivity/loadScope"),deleteWebhookConfigAction:rt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:rt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:rt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},IA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:LA,actions:EA}=st({name:Ot,initialState:IA,reducers:O({},TA)}),OA=O({},EA,PA),wA={slack:Bd.connectivity.getSlackConfiguration,email:Bd.connectivity.getEmailConfiguration,sms:Bd.connectivity.getSMSConfiguration,webhook:Bd.connectivity.getWebhooksConfigurations,categories:Bd.connectivity.getCategories,channelMap:Bd.connectivity.getChannelMaps},DA={slack:Bd.connectivity.postSlackConfiguration,email:Bd.connectivity.postEmailConfiguration,sms:Bd.connectivity.postSMSConfiguration,webhook:Bd.connectivity.postWebhooksConfiguration},CA=["email","slack","sms","webhook"],RA={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"}},UA=["id"],_A=["id","enabled"],MA=["categories","channelMap"];function*NA(e){return yield si($A,{payload:{api:e},type:""})}function*FA({payload:e=CA}){yield ai(OA.setConnectivityState({isLoading:!0}));try{const t=yield ri([...e.map(NA),yield $A({payload:{api:"categories"},type:""}),yield function*(){return(yield ri(e.map((function*(e){return yield $A({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>O({},t,{[`${e[o]}`]:n})),{})}()]),n=yield $A({payload:{api:"webhook"},type:""}),o=t.reduce(((n,o,i)=>e[i]?t[t.length-1][e[i]].length?O({},n,{[`${e[i]}`]:o,list:[...n.list,{id:i,key:e[i],events:RA[e[i]].events(o),active:RA[e[i]].isActive(o),platform:RA[e[i]].title,image:RA[e[i]].image}]}):n:O({},n,{[`${MA[i-e.length]}`]:o})),{list:[],webhook:n});yield ai(OA.setConnectivityState(O({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield ai(OA.setConnectivityState({isLoading:!1}))}}function*$A({payload:{api:e,params:t}}){try{return yield si(wA[e],t)}catch(e){return}}function*GA(){try{yield ai(OA.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield si(Bd.connectivity.getSlackChannels);yield ai(OA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield ai(OA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*xA(e,t){const{connectivity:{list:n}}=yield di(),o=n.find((({key:t})=>t===e));if(!o)return;const i=RA[e].isActive(t);i!==o.active&&(yield ai(OA.setConnectivityState({list:n.map((t=>t.key===e?O({},t,{active:i}):t))})))}function*VA({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield di((e=>e.connectivity));try{if(yield ai(OA.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...o]:o})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield di();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:o}=e;yield ri([...o.reduce(((e,t)=>{var o,i;return!t.id&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length||(null==n?void 0:n.find((e=>{let{id:n}=e,o=Ao(e,UA);return n===t.id&&JSON.stringify(O({id:n},o))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length?[...e,t]:e}),[]).map((function*(e){return yield si(DA.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield si(Bd.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield di(),{processIds:o}=yield di((e=>e.connectivity)),i=n[t];if(!i)return;let a=[];try{a=yield ri([...e.reduce(((e,t)=>!i.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield si("email"===t?Bd.connectivity.postEmailConfiguration:Bd.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:o}=e,i=n[0],{id:a="",enabled:r}=i,l=Ao(i,_A);return yield ri([yield si("email"===t?Bd.connectivity.patchEmailConfiguration:Bd.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield si("email"===t?Bd.connectivity.putEmailSubscriptions:Bd.connectivity.putSMSSubscriptions,a,o,O({},l,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return si("email"===t?Bd.connectivity.deleteEmailSubscriptions:Bd.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield $A({payload:{api:t},type:""});yield ai(OA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield xA(t,e)}else yield ai(OA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield si(DA[e],t),!["sms","email"].includes(e)){const i=yield $A({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield ai(OA.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield xA(e,i),null==n||n(!0)}}catch(e){var i;yield ai(OA.setConnectivityState({error:null!=(i=e.message)?i:e.toString(),isSaving:!1,isLoading:!1}))}}function*WA({payload:e}){try{yield Bd.connectivity.postSlackCode(e)}catch{}yield ai(OA.setConnectivityState({error:void 0,isSaving:!1}))}function*jA(){const{slackChannels:e}=yield di((e=>e.connectivity));try{yield ai(OA.setConnectivityState({slackChannels:O({},e,{isLoadingScope:!0})}));const{clientId:t}=yield si(Bd.connectivity.getSlackScope);yield ai(OA.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield ai(OA.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*KA({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield di((e=>e.connectivity));try{yield ai(OA.setConnectivityState({isSaving:!0})),yield si(Bd.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const i=yield $A({payload:{api:"webhook"},type:""});i&&(yield ai(OA.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*BA({payload:e}){try{yield ai(OA.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield si(Bd.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield ai(OA.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield ai(OA.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield ai(OA.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*zA({payload:e}){try{const{statusCode:t}=yield si(Bd.connectivity.postWebhookRetry,e);yield ai(OA.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield ai(OA.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*qA({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield di((e=>e.connectivity));try{yield ai(OA.setConnectivityState({webhookLogs:O({},o,{isLoading:!0})}));const i=yield si(Bd.connectivity.getWebhookLog,e,n,t);yield ai(OA.setConnectivityState({error:void 0,webhookLogs:O({isLoading:!1},i)}))}catch(e){yield ai(OA.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var HA={sagas:function*(){yield oa(OA.loadDataAction,FA),yield ia(OA.loadSlackActions,GA),yield oa(OA.postDataAction,VA),yield oa(OA.postCodeAction,WA),yield oa(OA.loadScope,jA),yield oa(OA.deleteWebhookConfigAction,KA),yield oa(OA.postWebhookTestAction,BA),yield oa(OA.postWebhookRetryAction,zA),yield ia(OA.loadWebhookLogsAction,qA)},storeName:Ot,initialState:IA,reducer:LA,actions:OA};function JA(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,t.payload)}}}function YA(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>O({},n,{[e]:t(n[e],o)})}}function QA(e){return YA(e,((e,t)=>O({},e,{loading:t.payload})))}function XA(e){return YA(e,((e,t)=>O({},e,{error:t.payload,loading:!1})))}const ZA={loading:!1,error:null,fetching:!0,plans:[]},{actions:ek,reducer:tk,name:nk}=st({name:"subscriptions/plans",initialState:ZA,reducers:O({},JA())}),ok=O({loadPlans:rt(`${nk}/loadPlans`)},ek),ik={loading:!1,error:null,fetching:!0,config:null},ak=O({},JA()),{actions:rk,reducer:lk,name:sk}=st({name:"subscriptions/config",initialState:ik,reducers:ak}),ck=O({loadPaymentConfiguration:rt(`${sk}/loadPaymentConfiguration`)},rk),uk={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},dk=O({},JA(),{setCancellationLoading:QA("cancellation"),setCancellationError:XA("cancellation"),setRenewalLoading:QA("renewal"),setRenewalError:XA("renewal")}),{reducer:yk,actions:fk,name:pk}=st({name:"subscriptions/billing/subscription",initialState:uk,reducers:dk}),gk=O({load:rt(`${pk}/loadSubscription`),cancelSubscription:rt(`${pk}/cancelSubscription`),renewSubscription:rt(`${pk}/renewSubscription`)},fk),Sk={loading:!1,error:null,fetching:!0},vk=O({},JA()),{reducer:hk,actions:mk,name:bk}=st({name:"subscriptions/billing/information",initialState:Sk,reducers:vk}),Ak=O({loadBillingInformation:rt(`${bk}/loadBillingInformation`),cancelSubscription:gk.cancelSubscription,renewSubscription:gk.renewSubscription},mk),kk={loading:!1,error:null,fetching:!0},Tk=O({},JA(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,t.payload)}}),{reducer:Pk,actions:Ik,name:Lk}=st({name:"subscriptions/billing/payment",initialState:kk,reducers:Tk}),Ek=O({loadPaymentMethod:rt(`${Lk}/loadPaymentMethod`),submitPaymentMethod:rt(`${Lk}/submitPaymentMethod`),submitPaymentMethodError:rt(`${Lk}/submitPaymentMethodError`),submitPaymentMethodSuccess:rt(`${Lk}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:rt(`${Lk}/updateBillingDetails`,(e=>({payload:e})))},Ik),Ok={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},wk=O({},JA(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,{invoiceDownload:O({},e.invoiceDownload,t.payload)})}}),{reducer:Dk,actions:Ck,name:Rk}=st({name:"subscriptions/billing/invoices",initialState:Ok,reducers:wk}),Uk=O({loadInvoices:rt(`${Rk}/loadInvoices`),downloadInvoice:rt(`${Rk}/downloadInvoice`,(e=>({payload:e})))},Ck),_k={information:Sk,invoices:Ok,paymentMethod:kk,subscription:uk},Mk={invoices:Uk,information:Ak,paymentMethod:Ek,subscription:gk},Nk=xe({invoices:Dk,information:hk,paymentMethod:Pk,subscription:yk}),Fk={fetching:!0,loading:!1,error:null,confirmed:!1},$k=O({},JA()),{actions:Gk,reducer:xk,name:Vk}=st({name:"subscriptions/checkout",initialState:Fk,reducers:$k}),Wk=O({loadCheckout:rt(`${Vk}/loadCheckout`),resetCheckout:rt(`${Vk}/resetCheckout`),submitCheckout:rt(`${Vk}/submitCheckout`),confirmCheckout:rt(`${Vk}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:rt(`${Vk}/errorCheckout`,(e=>({payload:e})))},Gk),jk={loading:!1,error:null,cardSetupIntentSecret:null},Kk=O({},JA()),{reducer:Bk,actions:zk,name:qk}=st({name:"subscriptions/stripe",initialState:jk,reducers:Kk}),Hk=O({loadCustomer:rt(`${qk}/loadCustomer`),createCardSetupIntentSecret:rt(`${qk}/createCardSetupIntentSecret`)},zk),Jk={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:Yk,reducer:Qk,name:Xk}=st({name:"subscriptions/vendorPublicConfig",initialState:Jk,reducers:O({},JA())}),Zk=O({loadVendorPublicConfiguration:rt(`${Xk}/loadVendorPublicConfiguration`)},Yk),eT={config:ik,plans:ZA,checkout:Fk,billing:_k,stripe:jk,vendorPublicConfig:Jk},tT={config:ck,billing:Mk,plans:ok,checkout:Wk,stripe:Hk,vendorPublicConfig:Zk},nT=xe({config:lk,billing:Nk,plans:tk,checkout:xk,stripe:Bk,vendorPublicConfig:Qk});let oT,iT,aT;function rT({policy:e}){return{policy:aT.AT_PERIOD_END}}function lT(e){switch(e){case Zu.ACTIVE:return iT.ACTIVE;case Zu.INCOMPLETE:return iT.INCOMPLETE;case Zu.CANCELED:return iT.CANCELED;case Zu.EXPIRED:return iT.EXPIRED;case Zu.TRIALING:return iT.TRIALING;default:return iT.EXPIRED}}!function(e){e.STRIPE="Stripe"}(oT||(oT={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(iT||(iT={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(aT||(aT={}));const sT={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Zu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},cT=[{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"}],uT=[{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:""}],dT=[{id:"id",externalId:"externalId",type:ed.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],yT={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*fT(){yield oa(gk.load,pT),yield oa(gk.cancelSubscription,ST),yield oa(gk.renewSubscription,vT)}function*pT(){const e=yield di((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield kT(e)}function*gT(){yield ai(gk.setLoading(!0));try{const[e]=yield si(Bd.subscriptions.getManagedSubscriptions);yield ai(gk.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield ai(gk.setError(e))}}function*ST(){const{subscription:e}=yield di((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ai(gk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ai(gk.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===Zu.ACTIVE)try{yield ai(gk.setCancellationLoading(!0)),yield si(Bd.subscriptions.cancelManagedSubscription,t),yield gT(),yield ai(gk.setCancellationLoading(!1))}catch(e){yield ai(gk.setCancellationError(e.message))}}function*vT(){const{subscription:e}=yield di((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ai(gk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ai(gk.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===td.AT_PERIOD_END)try{yield ai(gk.setRenewalLoading(!0)),yield si(Bd.subscriptions.renewManagedSubscription,t),yield gT(),yield ai(gk.setRenewalLoading(!1))}catch(e){yield ai(gk.setCancellationError(e.message))}}function*hT(){yield ai(gk.setLoading(!0)),yield yi(500),yield ai(gk.setState({subscription:sT,fetching:!1,loading:!1,error:null}))}function*mT(){yield oa(gk.load,hT)}function*bT(){yield oa(Ak.loadBillingInformation,AT)}function*AT(){yield function*(e){const t=yield di((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield di((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield kT(n,!1):yield ai(Ak.setError(t?"Not authorized":"Internal feature failure"))}()}function*kT(e,t){yield ai(Ak.setLoading(!0));try{var n,o;const i=yield si(Bd.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield si(Bd.subscriptions.getSubscriptionPlan,a):([,l]=yield ri([si(gT),si(Bd.subscriptions.getSubscriptionPlan,a)]),s=yield di((e=>e.subscriptions.billing.subscription.subscription||null))),yield ai(Ak.setState(O({loading:!1,fetching:!1,summary:i},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?iT.ACTIVE:lT(s.status),cancellation:s.cancellation&&rT(s.cancellation),trialEnd:s.trialEnd?s.trialEnd:null}}:{},l?{plan:{id:l.id,name:l.name,description:l.description,price:(null==(n=l.price)?void 0:n.amount)||0,currency:(null==(o=l.price)?void 0:o.currency)||"usd",recurringInterval:"month",slug:l.slug}}:{})))}catch(e){yield ai(Ak.setError(e.message))}}function*TT(){yield function*(){var e,t;yield ai(Ak.setLoading(!0)),yield yi(500),yield ai(Ak.setState({loading:!1,fetching:!1,summary:{subscriptionId:sT.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:nd.Stripe,externallyManaged:!1,currentPlanId:cT[0].id,defaultPlanId:cT[0].id},plan:O({},cT[0],{price:null==(e=cT[0].price)?void 0:e.amount,currency:null==(t=cT[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*PT(){yield oa(Ak.loadBillingInformation,TT)}function*IT(){yield oa(Ek.loadPaymentMethod,LT),yield oa(Ek.submitPaymentMethod,OT),yield oa(Ek.submitPaymentMethodError,wT),yield oa(Ek.submitPaymentMethodSuccess,DT),yield oa(Ek.updatePaymentMethodBillingDetails,ET)}function*LT(){yield ai(Ek.setLoading(!0));try{const e=(yield si(Bd.subscriptions.getPaymentMethods))[0];yield ai(Ek.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield ai(Ek.setError(e.message))}}function*ET({payload:e}){yield ai(Ek.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield si(Bd.subscriptions.updatePaymentMethodBillingDetails,t,O({email:n},o)),yield si(LT),null==i||i(!0)}catch(e){yield ai(Ek.setError(e.message)),null==i||i(!1)}yield ai(Ek.setLoading(!1))}function*OT(){yield ai(Ek.setLoading(!0))}function*wT({payload:e}){yield ai(Ek.setError(e))}function*DT(){yield ai(Ek.loadPaymentMethod())}function*CT(){yield ai(Ek.setLoading(!0)),yield yi(500);const e=dT[0];yield ai(Ek.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*RT(){yield oa(Ek.loadPaymentMethod,CT)}function*UT(){yield oa(Uk.loadInvoices,_T),yield oa(Uk.downloadInvoice,MT)}function*_T(){yield ai(Uk.setLoading(!0));try{const e=(yield si(Bd.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 ai(Uk.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield ai(Uk.setError(e.message))}}function*MT({payload:e}){yield ai(Uk.setInvoiceDownloadState({loading:!0,error:null}));try{yield si(Bd.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield ai(Uk.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield ai(Uk.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*NT(){yield ai(Uk.setLoading(!0)),yield yi(500),yield ai(Uk.setState({loading:!1,fetching:!1,invoices:uT.map((e=>O({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield ai(Uk.setLoading(!1))}function*FT(){yield oa(Uk.loadInvoices,NT)}function*$T(){yield ri([si(bT),si(IT),si(UT),si(fT)])}function*GT(){yield ri([si(PT),si(RT),si(FT),si(mT)])}function*xT(){yield oa(Wk.loadCheckout,VT),yield oa(Wk.resetCheckout,WT),yield oa(Wk.submitCheckout,jT),yield oa(Wk.confirmCheckout,KT),yield oa(Wk.errorCheckout,zT)}function*VT(){yield ai(Wk.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*WT(){yield ai(Wk.setState({loading:!1,error:null,confirmed:!1}))}function*jT(){yield ai(Wk.setState({loading:!0,error:null}))}function*KT({payload:{paymentMethodId:e,planId:t}}){const n=yield di((e=>e.subscriptions.billing.subscription.subscription)),o=yield di((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===Zu.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield ai(Wk.setState({loading:!0,error:null})),i&&a)return yield BT(),void(yield ai(gk.setState({subscription:O({},n,{status:Zu.ACTIVE})})));try{yield si(Bd.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield ri([AT(),LT(),_T()]),yield BT()}catch(e){yield ai(Wk.setState({loading:!1,error:e.message}))}}else yield ai(Wk.setState({loading:!1,error:"Subscription not found"}))}function*BT(){yield ai(Wk.setState({loading:!1,error:null,confirmed:!0}))}function*zT({payload:e}){yield ai(Wk.setState({loading:!1,error:e}))}function*qT(){yield oa(Wk.resetCheckout,WT)}function*HT(){yield oa(ok.loadPlans,JT)}function*JT(){yield ai(ok.setLoading(!0));try{const e=(yield si(Bd.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 ai(ok.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield ai(ok.setError(e.message))}}function*YT(){yield ai(ok.setLoading(!0)),yield yi(500),yield ai(ok.setState({fetching:!1,loading:!1,plans:cT.map((e=>{var t,n;return O({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*QT(){yield oa(ok.loadPlans,YT)}function*XT(){yield oa(ck.loadPaymentConfiguration,ZT)}function*ZT(){yield ai(ck.setLoading(!0));try{(yield si(Bd.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===nd.Stripe))?yield function*(){yield ai(ck.setLoading(!0));try{const e=yield si(Bd.subscriptions.getStripePaymentProviderConfiguration);yield ai(ck.setState({loading:!1,fetching:!1,config:{paymentProvider:oT.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield ai(ck.setError(e.message))}}():yield ai(ck.setError("Payment provider not configured"))}catch(e){yield ai(ck.setError(e.message))}}function*eP(){yield ai(ck.setLoading(!0)),yield yi(500),yield ai(ck.setState({loading:!1,fetching:!1,config:{paymentProvider:oT.STRIPE,apiKey:""}}))}function*tP(){yield oa(ck.loadPaymentConfiguration,eP)}function*nP(){yield oa(Hk.createCardSetupIntentSecret,oP)}function*oP({payload:e}){yield ai(Hk.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield si(Bd.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield ai(Hk.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield ai(Hk.setError(e.message))}}function*iP(){yield oa(Zk.loadVendorPublicConfiguration,aP)}function*aP(){yield ai(Zk.setLoading(!0));try{const e=yield si(Bd.subscriptions.getVendorPublicConfigurations);yield ai(Zk.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield ai(Zk.setError(e.message))}}function*rP(){yield ai(Zk.setLoading(!0)),yield yi(500),yield ai(Zk.setState({fetching:!1,loading:!1,vendorPublicConfig:yT}))}function*lP(){yield oa(Zk.loadVendorPublicConfiguration,rP)}var sP={sagas:function*(){yield ri([si($T),si(xT),si(HT),si(XT),si(nP),si(iP)])},mockSagas:function*(){yield ri([si(GT),si(qT),si(QT),si(tP),si(lP)])},reducer:nT,actions:tT,initialState:eT,storeName:"subscriptions"},cP={sagas:function*(){yield oa(Wy.loadVendorPublicInfo,jy)},storeName:Dt,initialState:Gy,reducer:xy,actions:Wy};const{reducer:uP}=st({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(ra.setContext(t),O({},e,{context:t}))}}}),dP=(e,t,n=!1,o,i,a=!1,r="path")=>{let l=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var s,c,u,d,y,f,p,g,S,v;n||a||ra.setContext(e.context);const t=Hi(),h=[...it({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=at({middleware:h,preloadedState:{root:O({},e,{previewMode:n,urlStrategy:r}),[_b.storeName]:O({},_b.initialState,o,null!=(s=null==i?void 0:i.auth)?s:{},{routes:O({},_b.initialState.routes,null!=(c=null==o?void 0:o.routes)?c:{},null!=(u=null==i||null==(d=i.auth)?void 0:d.routes)?u:{})}),[rA.storeName]:O({},rA.initialState,null!=(y=null==i?void 0:i.auditLogs)?y:{},{auditLogsState:O({},rA.initialState.auditLogsState,null!=(f=null==i||null==(p=i.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:O({},rA.initialState.auditsMetadataState,null!=(g=null==i||null==(S=i.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[sA]:O({},lA,null!=(v=null==i?void 0:i.audits)?v:{}),[HA.storeName]:HA.initialState,[sP.storeName]:sP.initialState,[cP.storeName]:cP.initialState},reducer:xe({root:uP,[_b.storeName]:_b.reducer,[rA.storeName]:rA.reducer,[sA]:uA,[HA.storeName]:HA.reducer,[sP.storeName]:sP.reducer,[cP.storeName]:cP.reducer})});const m=function*(){yield ri([si(_b.sagas),si(rA.sagas),si(AA),si(HA.sagas),si(sP.sagas),si(cP.sagas)])},b=function*(){yield ri([si(_b.mockSagas),si(rA.mockSagas),si(sP.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(lo.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var yP=n(714),fP=n.n(yP);function pP(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function gP(e){if(e.type)return e;if("#"===e.charAt(0))return gP(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const o=e.substring(t+1,e.length-1);let i,a;if("color"===n){if(a=o.split(" "),i=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(i))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+i)}else a=o.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:i}}function SP(e){const{type:t,colorSpace:n}=e;let{values:o}=e;return-1!==t.indexOf("rgb")?o=o.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(o[1]=`${o[1]}%`,o[2]=`${o[2]}%`),o=-1!==t.indexOf("color")?`${n} ${o.join(" ")}`:`${o.join(", ")}`,`${t}(${o})`}function vP(e){if(0===e.indexOf("#"))return e;const{values:t}=gP(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 hP(e,t){return e=gP(e),t=pP(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,SP(e)}function mP(e,t){if(e=gP(e),t=pP(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 SP(e)}function bP(e,t){if(e=gP(e),t=pP(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 SP(e)}const AP=e=>{if(e)return{main:e,light:vP(bP(e,.4)),dark:vP(mP(e,.15)),hover:vP(mP(e,.15)),active:vP(mP(e,.2))}},kP=e=>{if(e)return{main:e,light:bP(e,.7),dark:mP(e,.2)}},TP=(e,t)=>{var n,o,i,a,r,l,s,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?O({},t,{palette:{primary:O({},AP(null==e||null==(o=e.palette)?void 0:o.primary),{contrastText:null!=(i=null==e||null==(a=e.palette)?void 0:a.primaryText)?i:"#000000"}),secondary:O({},AP(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(l=null==e||null==(s=e.palette)?void 0:s.secondaryText)?l:"#000000"}),danger:O({},AP(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:O({},kP(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:O({},kP(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:O({},kP(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:O({},kP(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},PP={},IP={},LP={},EP={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},multipleSSO:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class OP{constructor(){this._theme=PP,this._themeV2=IP,this._navigation=EP,this._localizations=LP}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new OP;return n.set(e),OP._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,o,i,a,r,l;this._navigation=fP().all([null!=(t=EP)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=fP().all([null!=(o=PP)?o:{},TP(null==e?void 0:e.theme,PP)]),this._themeV2=fP().all([null!=(i=IP)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=fP().all([null!=(r=LP)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=EP,this._theme=PP,this._themeV2=IP,this._localizations=LP}}}OP._instances={};var wP=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},DP=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=document.createElement(t);return Object.keys(n).forEach((function(e){return o.setAttribute(e,n[e])})),e.appendChild(o),o},CP=function(e){return new Promise((function(t,n){var o=4e3,i=setInterval((function(){return null!=e.themeSetter?(clearInterval(i),void t(!0)):o<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(i)):void(o-=50)}),50)}))};let RP,UP,_P,MP,NP,FP,$P,GP,xP,VP,WP;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(RP||(RP={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(UP||(UP={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(_P||(_P={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(MP||(MP={})),function(e){e.Invoices="invoices"}(NP||(NP={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(FP||(FP={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}($P||($P={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(GP||(GP={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(xP||(xP={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(VP||(VP={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(WP||(WP={}));const jP={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},KP={hidden:"hidden",edit:"edit"};var BP="6.80.0",zP={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on"},qP=function(){function e(t,n){var o,i,a,r,l=this,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];k(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(BP),this.customElementName="",this.adminPortalEl=void 0,this.adminPortalRenderer=void 0,this.loginBoxEl=void 0,this.checkoutDialogEl=void 0,this.checkoutDialogRenderer=void 0,this.adminPortalContainer=void 0,this.loginBoxContainer=void 0,this.checkoutDialogContainer=void 0,this.loginBoxRenderer=void 0,this.store=void 0,this.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=D(R().mark((function e(){var t,n,o,i,a;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=da,l.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:a=e.sent,l.options.metadata=null!=(n=null==a||null==(o=a.rows)||null==(i=o[0])?void 0:i.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:OP.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=D(R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l.options.hostedLoginBox||l.options.builderMode||"nextjs"===l.options.framework||l.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=D(R().mark((function e(){var t;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l.options.previewMode&&!l.options.builderMode){e.next=4;break}fd.set({flags:zP}),e.next=14;break;case 4:return e.prev=4,e.next=7,pd();case 7:t=e.sent,fd.set({flags:t}),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 14:case"end":return e.stop()}}),e,null,[[4,11]])}))),this.updateLocalizationsSetter=function(e){l.updateLocalizations=e};var c=wP(n),u="frontegg-app-".concat(c);this.iframeRendering=s,this.name=c,this.options=O({},t,{contextOptions:O({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=u;var d=this.options.authOptions?O({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};d.disableSilentRefresh=null==(o=this.options.authOptions)?void 0:o.disableSilentRefresh,this.store=null!=(i=this.options.store)?i:dP({context:this.options.contextOptions},this,this.options.previewMode,d,{auth:null!=(a=this.options.authOptions)?a:{},audits:null!=(r=this.options.auditsOptions)?r:{}},!1,this.options.urlStrategy),E.setInstance(c,this)}var t,n,o,i;return L(e,[{key:"initContainers",value:(i=D(R().mark((function e(t){return R().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 i.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;OP.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,o){if(window[e])n(window[e]);else{var i=document.createElement("script");i.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),i.setAttribute("id","".concat(e,"Script")),i.setAttribute("cdn-url",t.cdnUrl),i.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:b,FronteggTypes:A})):n(window[e])},i.onerror=function(e){console.log("Profile page error",e),o(e)},document.body.append(i)}}))}},{key:"loadLoginBox",value:(o=D(R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){console.error("Failed to call loadLoginBoxListener",e)}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"showAdminPortal",value:(n=D(R().mark((function e(){var t;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=D(R().mark((function e(t){var n;return R().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,O({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}(),HP=function(){function e(){k(this,e)}return L(e,null,[{key:"setAuthentication",value:function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",i=E.getInstance(o);e&&t?(ra.setAccessToken(t),ra.setUser(O({},n,{accessToken:t})),i.store.dispatch(lo.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(lo.loadTenants())):(ra.setAccessToken(null),ra.setUser(null),i.store.dispatch(lo.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),JP=function(){function e(){k(this,e)}return L(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";E.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";E.getInstance(e).hideAdminPortal()}}]),e}(),YP=function(){function e(){k(this,e)}return L(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";E.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";E.getInstance(e).hideCheckoutDialog()}}]),e}(),QP=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},XP=function(){function e(t,n,o,i){k(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=o?o:dP({context:a},this,!0,void 0,void 0,!0),this.options=O({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a},i),this.app=new qP(this.options,t,!0),OP.set({},t)}var t;return L(e,[{key:"render",value:(t=D(R().mark((function e(t){var n,o,i,a,r=this;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,o=function(e){r.themeSetter=e},i=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:o,setStaticRouteSetter:i}),this.app.loading=!1,e.next=13,CP(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}(),ZP="modern",eI=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[ZP]},tI=function(){function e(t,n,o,i){k(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=o?o:dP({context:a},this,!0,void 0,void 0,!0),this.options=O({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a,onRedirectTo:function(){console.debug("path")}},i),this.app=new qP(this.options,t,!0),OP.set({},t)}var t;return L(e,[{key:"render",value:(t=D(R().mark((function e(t){var n,o,i,a,r=this;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,o=function(e){r.themeSetter=e},i=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:o,setStaticRouteSetter:i,staticRoute:"/account/login"}),e.next=12,CP(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 nI(e,t){return nI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},nI(e,t)}function oI(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&&nI(e,t)}function iI(e,t){if(t&&("object"===T(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 aI(e){return aI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},aI(e)}function rI(){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 lI(e,t,n){return lI=rI()?Reflect.construct.bind():function(e,t,n){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return n&&nI(i,n.prototype),i},lI.apply(null,arguments)}function sI(e){var t="function"==typeof Map?new Map:void 0;return sI=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 lI(e,arguments,aI(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),nI(n,e)},sI(e)}function cI(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=aI(e);if(t){var i=aI(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return iI(this,n)}}var uI=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new qP(e,t);if("undefined"!=typeof document){var o;if(!e.contextOptions.baseUrl){var i=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(i.message),i}if(!customElements.get("frontegg-app")){var a=function(e){oI(n,e);var t=cI(n);function n(){var e;k(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).app=null,e}return L(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=E.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var o=DP(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=DP(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=DP(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=o.attachShadow({mode:"open"}),l=i.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),c=DP(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=DP(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=DP(s,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:o,loginBoxContainer:i,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(sI(HTMLElement));customElements.define("frontegg-app",a)}null==(o=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||o.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),o}()}));
|