@frontegg/js 6.82.0 → 6.83.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/node/index.js +1 -1
- package/node/utils/mockFlagsList.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +6 -4
- package/umd/frontegg.production.min.js +1 -1
- package/utils/mockFlagsList.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 XP},AdminPortalRenderer:function(){return tI},AppHolder:function(){return E},CheckoutDialog:function(){return ZP},FronteggApp:function(){return YP},HostedLogin:function(){return QP},LoginBoxRenderer:function(){return iI},createElement:function(){return UP},defaultTheme:function(){return nI},formatName:function(){return RP},getThemeAdminByName:function(){return eI},getThemeByName:function(){return oI},initialize:function(){return fI},mockFlagsList:function(){return JP},waitThemeSetter:function(){return _P}});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 Od},addUsersToGroup:function(){return Dd},createGroup:function(){return Id},deleteGroup:function(){return Ed},deleteRolesFromGroup:function(){return wd},deleteUsersFromGroup:function(){return Cd},getGroupById:function(){return kd},getGroupConfiguration:function(){return Rd},getGroups:function(){return Td},getGroupsByIds:function(){return Pd},updateGroup:function(){return Ld},updateGroupConfiguration:function(){return Ud}});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},GroupManagedByEnum:function(){return zd},GroupRelations:function(){return Bd},ISubscriptionCancellationPolicy:function(){return td},ISubscriptionStatus:function(){return Zu},MFAStrategyEnum:function(){return Nd},MachineToMachineAuthStrategy:function(){return Er},PaymentMethodType:function(){return ed},ProviderType:function(){return nd},RestrictionType:function(){return $n},ScimConnectionSource:function(){return Kd},SecondaryAuthStrategy:function(){return _d},SocialLoginProviders:function(){return Ir},TenantType:function(){return $d},UserManagedByEnum:function(){return Fd},WebAuthnDeviceType:function(){return Md},api:function(){return qd},countConfigurationUsers:function(){return md},createConfiguration:function(){return vd},default:function(){return Hd},deleteConfiguration:function(){return hd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Gd},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 $P},DomainRestrictionsTabFields:function(){return KP},GeneralSettingsTabFields:function(){return WP},InviteUserModalFields:function(){return FP},IpRestrictionsTabFields:function(){return jP},Metadata:function(){return CP},PrivacyPageFields:function(){return NP},ProfilePageFields:function(){return MP},SecurityPageTabs:function(){return xP},SessionManagementTabFields:function(){return VP},SsoPageTabs:function(){return BP},SubscriptionsPageFields:function(){return GP},alpha:function(){return AP},fieldAppearance:function(){return zP},tabAppearance:function(){return qP}});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={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},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(){var e;this._flags={},this._flags=null!=(e=yd.flags)?e:{}}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,t){const n=this.getInstance(t);return e.map((e=>"on"===(null==n?void 0:n._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t;this._flags=O({},null!=(t=null==yd?void 0:yd.flags)?t:{},null!=e?e:{})}}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,t){return ya(`${Oa.getByIds.v1}`,e,{params:t})}async function Id(e){return ya(`${Oa.v1}`,e)}async function Ld(e){let{groupId:t}=e,n=Ao(e,Ad);return fa(`${Oa.v1}/${t}`,n)}async function Ed(e){return ga(`${Oa.v1}/${e}`)}async function Od(e,t){return ya(`${Oa.v1}/${e}/roles`,t)}async function wd(e,t){return ga(`${Oa.v1}/${e}/roles`,t)}async function Dd(e,t){return ya(`${Oa.v1}/${e}/users`,t)}async function Cd(e,t){return ga(`${Oa.v1}/${e}/users`,t)}async function Rd(){return da(`${Oa.configurations.v1}`)}async function Ud(e){return ya(`${Oa.configurations.v1}`,e)}let _d,Md,Nd,Fd,$d;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(_d||(_d={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Md||(Md={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Nd||(Nd={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Fd||(Fd={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}($d||($d={}));const Gd=[/^(.*)\/logout$/g,"/logout",/^\/identity\/resources\/auth\/v[0-9]*\/user\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/passwordless\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/webauthn\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/token\/refresh$/g,/^\/identity\/resources\/users\/v[0-9]*$/g,/^\/identity\/resources\/users\/v[0-9]*\/signUp$/g,/^\/identity\/resources\/users\/v[0-9]*\/activate$/g,/^\/identity\/resources\/users\/v[0-9]*\/invitation\/accept$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/verify$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/[^\/]*\/[^\/]*\/verify$/g,/^\/oauth\/token$/g,/^\/oauth\/authorize\/silent$/g],xd=`${ha.v1}/user/token/refresh`,Vd=`${za}/authorize/silent`,Wd=`${ma.v2}/me`,jd=`${ma.v2}/me/tenants`;let Kd,Bd,zd;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Kd||(Kd={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Bd||(Bd={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(zd||(zd={}));const qd={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 Hd={fetch:e,ContextHolder:ra,FronteggContext:la,api:qd,FronteggApiError:sa,AuthStrategyEnum:Lr,MachineToMachineAuthStrategy:Er,SocialLoginProviders:Ir,ISubscriptionCancellationPolicy:td,ISubscriptionStatus:Zu,PaymentMethodType:ed,ProviderType:nd};let Jd,Yd;function Qd(e,t){const n=O({},e);return t.forEach((e=>{delete n[e]})),n}async function Xd(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 Zd(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"}(Jd||(Jd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Yd||(Yd={}));const ey=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n}));function*ty(e){const t=yield di((e=>e.root.appName));return fd.getFeatureFlags(e,t)}const ny={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},oy=O({},ny,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),iy=[{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"}],ay={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},ry=O({},ay,{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}),ly={loading:!1,error:void 0,saving:!0,profile:ay},sy={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"},cy={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Lr.EmailAndPassword,machineToMachineAuthStrategy:Er.ClientCredentials},uy={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},dy={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},yy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},fy={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},py={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},gy=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Sy={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:fy,roles:gy,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},vy=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],hy={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:[iy[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[iy[0]],managedBy:zd.FRONTEGG}]},my={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:[iy[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[iy[0]],managedBy:zd.FRONTEGG}]},by={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Ay=[my,hy],ky=[by],Ty=[{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}],Py=[{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"}],Iy={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Ly={isActive:!0,strategy:$n.ALLOW},Ey=[{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"}],Oy=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(O({},my,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},wy=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"}),Dy=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Oy(6),roles:[wy("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:zd.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Oy(44),roles:[wy("Editor")],managedBy:zd.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Oy(8),roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Oy(5),roles:[wy("Admin")],managedBy:zd.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Oy(21),description:"BDR, AE, and inside sales",roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Oy(23),description:"Dev success and customer success",roles:[wy("Admin")],managedBy:zd.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Oy(10),description:"The marketing department",roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Oy(4),description:"Human resources",roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Oy(3),roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Oy(8),roles:[wy("Editor")],managedBy:zd.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Oy(4),roles:[wy("Viewer")],managedBy:zd.FRONTEGG}];let Cy,Ry,Uy;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Cy||(Cy={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Ry||(Ry={})),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"}(Uy||(Uy={})),Uy.profile,Uy.privacy,Uy.personalApiTokens,Uy.account,Uy.users,Uy.groups,Uy.security,Uy.sso,Uy.audits,Uy.webhooks,Uy.apiTokens,Uy.roles,Uy.subscriptions;const _y=["events","url"];function*My(){yield ai(lo.setSignUpState({loading:!0}));try{const e=yield si(qd.auth.getVendorConfig),[t]=(yield si(qd.auth.getVendorPublicAuthStrategiesConfig),yield si(ty,["admin_portal_login_per_tenant"]));if(t){const t=yield si(qd.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*Ny(e){let{payload:{events:t,url:n}}=e,o=Ao(e.payload,_y);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(qd.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:Ry.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(ra.setAccessToken(null==l?void 0:l.accessToken),ra.setUser(l),!r&&l&&Jf(l)){const t=yield Xf(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*Fy(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield di((e=>e.auth.signUpState));yield ai(lo.resetSignUpState()),yield ai(lo.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*$y(){yield aa(lo.signUpUser,Ny),yield aa(lo.resetSignUpStateSoft,Fy)}const Gy={setVendorState:(e,{payload:t})=>O({},e,t)},xy={loadVendorPublicInfo:rt("vendor/loadVendorPublicInfo")},Vy={loading:!1},{reducer:Wy,actions:jy}=st({name:Dt,initialState:Vy,reducers:O({},Gy)}),Ky=O({},jy,xy);function*By(){yield ai(Ky.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield qd.vendor.getVendorPublicInfo();yield ai(Ky.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield ai(Ky.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const zy=["callback"],qy=["callback"],Hy=["callback"],Jy=["callback"],Yy=["callback"],Qy=["callback"];function*Xy(){yield ai(lo.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield si(qd.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*Zy(){yield ai(lo.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorConfig),[t]=yield si(ty,["admin_portal_login_per_tenant"]);if(t){const t=yield si(qd.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*ef(){yield ai(lo.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorPublicAuthStrategiesConfig);yield ai(lo.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*tf(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield si(qd.auth.getMfaPolicy);yield ai(lo.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*nf(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorMfaPolicy);yield ai(lo.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*of(e){let{payload:{callback:t}}=e,n=Ao(e.payload,zy);yield ai(lo.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield si(qd.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*af(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield si(qd.auth.getLockoutPolicy);yield ai(lo.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*rf(e){let{payload:{callback:t}}=e,n=Ao(e.payload,qy);yield ai(lo.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield si(qd.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*lf(){yield ai(lo.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorLockoutPolicy);yield ai(lo.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*sf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield si(qd.auth.getCaptchaPolicy);yield ai(lo.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*cf(){yield ai(lo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield si(qd.auth.getPasswordHistoryPolicy);yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*uf(){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorPasswordHistoryPolicy);yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*df(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Hy);yield ai(lo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield si(qd.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*yf(){yield ai(lo.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield si(qd.auth.getPasswordConfigPolicy);yield ai(lo.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*ff(){yield aa(lo.loadSecurityPolicy,Xy),yield oa(lo.saveSecurityPolicyMfa,of),yield oa(lo.loadSecurityPolicyMfa,tf),yield oa(lo.loadSecurityPolicyVendorMfa,nf),yield oa(lo.saveSecurityPolicyLockout,rf),yield oa(lo.loadSecurityPolicyLockout,af),yield oa(lo.loadSecurityPolicyVendorLockout,lf),yield oa(lo.loadSecurityPolicyCaptcha,sf),yield oa(lo.saveSecurityPolicyPasswordHistory,df),yield oa(lo.loadSecurityPolicyPasswordHistory,cf),yield oa(lo.loadSecurityPolicyVendorPasswordHistory,uf),yield oa(lo.loadVendorPasswordConfig,yf),yield oa(lo.loadPublicSecurityPolicy,Zy),yield oa(lo.loadPublicAuthStrategiesPolicy,ef)}function*pf(){yield ai(lo.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield ai(lo.setSecurityPolicyPublicState({policy:cy,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*gf(){yield ai(lo.setSecurityPolicyGlobalState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyGlobalState({policy:sy,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*Sf(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyMfaState({policy:uy,loading:!1}))}function*vf(){yield ai(lo.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorMfaState({policy:uy,loading:!1}))}function*hf(e){var t;let{payload:{callback:n}}=e,o=Ao(e.payload,Jy);yield ai(lo.setSecurityPolicyMfaState({saving:!0,error:null}));const i=O({},dy,{id:null!=(t=o.id)?t:dy.id,enforceMFAType:o.enforceMFAType});yield vt(),yield ai(lo.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*mf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyLockoutState({policy:dy,loading:!1}))}function*bf(){yield ai(lo.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorLockoutState({policy:dy,loading:!1}))}function*Af(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Yy);yield ai(lo.setSecurityPolicyLockoutState({saving:!0,error:null})),yield vt();const o=O({},dy,n,{id:n.id?n.id:dy.id});null==t||t(o),yield ai(lo.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*kf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyLockoutState({policy:dy,loading:!1}))}function*Tf(){yield ai(lo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:yy,loading:!1}))}function*Pf(){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({policy:yy,loading:!1}))}function*If(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Qy);yield ai(lo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield vt();const o=O({},yy,n,{id:n.id?n.id:yy.id});null==t||t(o),yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*Lf(){yield aa(lo.loadSecurityPolicy,gf),yield oa(lo.loadPublicSecurityPolicy,pf),yield oa(lo.saveSecurityPolicyMfa,hf),yield oa(lo.loadSecurityPolicyMfa,Sf),yield oa(lo.loadSecurityPolicyVendorMfa,vf),yield oa(lo.saveSecurityPolicyLockout,Af),yield oa(lo.loadSecurityPolicyLockout,mf),yield oa(lo.loadSecurityPolicyVendorLockout,bf),yield oa(lo.loadSecurityPolicyCaptcha,kf),yield oa(lo.saveSecurityPolicyPasswordHistory,If),yield oa(lo.loadSecurityPolicyPasswordHistory,Tf),yield oa(lo.loadSecurityPolicyVendorPasswordHistory,Pf)}const Ef=["callback"],Of=["callback"],wf=["callback"],Df=["callback"],Cf=["callback","events"],Rf=["callback"],Uf=["callback"],_f=["callback"],Mf=["callback"],Nf=["callback"],Ff=["callback"],$f=["callback"],Gf=["callback"],xf=["callback"],Vf=["callback","deviceId"],Wf=["callback","deviceId"],jf=["callback","deviceId"],Kf=["callback","deviceId"],Bf={[Lr.Code]:kt.loginWithOtc,[Lr.EmailAndPassword]:kt.loginWithPassword,[Lr.MagicLink]:kt.magicLinkPreLoginSuccess,[Lr.SmsCode]:kt.loginWithSmsOtc};function*zf(){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*qf(){let e;try{var t;const n=yield si(qd.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*Hf(){try{const{isActive:e}=yield si(qd.auth.getSSOPublicConfiguration);yield ai(lo.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const Jf=e=>e.mfaRequired&&e.mfaToken?(ra.setAccessToken(null),ra.setUser(null),!0):(ra.setAccessToken(e.accessToken),ra.setUser(e),!1),Yf=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},Qf=e=>{if(1===e.length){const[t]=e;if(t===Nd.AuthenticatorApp)return nn.authenticatorApp;if(t===Nd.SMS)return nn.smsSetPhoneNumber}return nn.verify};function*Xf(e){let t=kt.loginWithTwoFactor,n={};const{loginState:o}=yield di((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield si(qd.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Yf(e.mfaDevices)}:(n={step:Qf(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*Zf(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*ep(){const{hostedLoginBox:e}=yield di((e=>e.auth));e?yield si(tp):yield si(op)}function*tp(){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(qd.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*np(){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(qd.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*op(){try{const t=ra.onRedirectTo,{routes:n,loginState:o}=yield di((e=>e.auth)),{user:i,tenants:a}=yield si(qd.auth.refreshTokenV2);if(Jf(i)){const e=yield Xf(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 Zf(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 ap(n)}}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:void 0,isAuthenticated:!1}))}}function*ip(){try{const t=ra.onRedirectTo,{routes:n,loginState:o}=yield di((e=>e.auth)),{user:i,tenants:a}=yield si(qd.auth.refreshTokenV2);if(Jf(i)){const e=yield Xf(i);yield ai(lo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield si(Sp))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 Zf(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 ap(n)}}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:void 0,isAuthenticated:!1}))}}function*ap(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 zf())}function*rp({payload:{callback:e}}){try{const{ip:t}=yield si(qd.metadata.getCurrentUserIpMetadata);yield ai(lo.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*lp({payload:e}){const t=[];e&&(yield ai(lo.setState({isLoading:!0})),yield ai(lo.loadSocialLoginsConfigurationV2()),t.push(si(My)),t.push(si(ef)),t.push(si(Hf)),t.push(si(By)),t.push(si(qf))),t.push(si(ep)),yield ri(t),yield ai(lo.setState({isLoading:!1}))}function*sp({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(Jf(t)){const e=yield Xf(t);yield ai(lo.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*cp({payload:e}){const t=[];yield ai(lo.loadSocialLoginsConfigurationV2()),t.push(si(My)),t.push(si(Hf)),t.push(si(By)),t.push(si(qf)),t.push(si(sp,e)),yield ri(t)}function*up({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(qd.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=Zd(),r=Zd(),l=yield si(Xd,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*dp({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(qd.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 zf()}}function*yp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Ef);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(qd.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*fp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Of);try{yield ai(lo.setLoginState({loading:!0})),yield si(qd.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*pp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,wf);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(qd.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*gp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Df);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(qd.auth.passwordlessPreLogin,n),a=Bf[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*Sp(){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===_d.Passkeys))))(t),o="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield si(ty,["show-passkeys"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield si(qd.auth.getWebAuthnDevices);return yield ai(lo.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*vp(e){let{payload:{callback:t,events:n}}=e,o=Ao(e.payload,Cf);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(qd.auth.passwordlessPostLogin,o),a=ra.onRedirectTo,{routes:r}=yield di((e=>e.auth));if(Jf(e)){const t=yield Xf(e);yield ai(lo.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield di((e=>e.auth)),l=yield si(qd.auth.generateLoginResponse,e);var i;e.emailVerified&&(null==n||null==(i=n.userVerified)||i.call(n,{email:l.email,origin:Cy.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(Sp))?(yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield ai(lo.setState({isAuthenticated:!0})),yield zf()):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*hp({payload:e}){try{yield ai(lo.setLoginState({loading:!0}));const{name:t}=yield si(qd.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*mp({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(qd.auth.preLoginV2,{email:e});if(a){let e=a;if(r===Yd.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 bp({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield bp({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*bp(e){let{callback:t}=e,n=Ao(e,Rf);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*Ap({payload:{callback:e}}){try{yield ai(lo.setLoginState({loading:!0}));const{options:t}=yield si(qd.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*kp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Uf);try{yield ai(lo.setLoginState({loading:!0}));const e=At(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?Md.Platform:Md.CrossPlatform;yield si(qd.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*Tp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,_f);try{var o;yield ai(lo.setPasskeysState({loading:!0})),yield ai(lo.setLoginState({loading:!0}));const{options:e}=yield si(qd.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*Pp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Mf);try{var o;yield ai(lo.setPasskeysState({loading:!0})),yield ai(lo.setLoginState({loading:!0}));const e=At(n.publicKey),i=yield si(qd.auth.webAuthnPostLogin,O({},e,{response:O({},e.response,{userHandle:null!=(o=e.response.userHandle)?o:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(Jf(i)){const e=ra.onRedirectTo,{routes:t}=yield di((e=>e.auth)),n=yield Xf(i);yield ai(lo.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield si(qd.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 zf(),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*Ip({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(qd.auth.postLogin,e);ra.setAccessToken(t.accessToken),ra.setUser(t),yield ai(lo.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield zf()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield ai(lo.setLoginState({step:kt.loginWithSSOFailed,loading:!1}))}}function*Lp({payload:{email:e,password:t,recaptchaToken:n,invitationToken:o,callback:i}}){yield ai(lo.setLoginState({loading:!0}));try{const a=yield si(qd.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(Jf(a)){const e=yield Xf(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(Sp))?(yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})),r(l.loginUrl,{preserveQueryParams:!0})):yield zf())}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*Ep({payload:{mfaToken:e,value:t,rememberDevice:n,callback:o}}){yield ai(lo.setLoginState({loading:!0}));try{const i=yield si(qd.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(Sp))?yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})):yield zf()),null==o||o(!0)}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1})),null==o||o(!1,e)}}function*Op({payload:e}){yield ai(lo.setLoginState({loading:!0}));try{var t;yield si(qd.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*wp({payload:e}){const{hostedLoginBox:t}=yield di((e=>e.auth));yield ai(lo.setState({isLoading:!0}));try{t?yield si(qd.auth.OAuthLogout):yield si(qd.auth.logout)}catch{}yield ai(lo.resetState()),yield ai(lo.requestAuthorize(!0)),null==e||e()}function*Dp({payload:e}){var t;try{yield si(qd.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*Cp({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*Rp({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(Sp);o===nn.smsVerifyCode&&e?yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})):yield zf()}yield ai(lo.setState({isAuthenticated:!0}))}function*Up(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Nf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.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*_p(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Ff);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.auth.enrollMFASMSForLogin,n),o=yield si(qd.auth.generateLoginResponseV2,e);yield Cp(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*Mp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,$f);yield ai(lo.setLoginState({loading:!0}));try{var o;const e=yield si(qd.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*Np(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Gf);yield ai(lo.setLoginState({loading:!0}));try{const e=At(n.publicKey),o=yield si(qd.auth.enrollMFAWebAuthnForLogin,O({},n,{options:e})),i=yield si(qd.auth.generateLoginResponseV2,o);yield Cp(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*Fp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,xf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.auth.enrollMFAAuthenticatorAppForLogin,n),o=yield si(qd.auth.generateLoginResponseV2,e);yield Cp(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*$p(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Vf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.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*Gp(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Wf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.auth.verifyMFASMSForLogin,n,o),i=yield si(qd.auth.generateLoginResponseV2,e);yield Rp(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*xp(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,jf);yield ai(lo.setLoginState({loading:!0}));try{var i;const e=yield si(qd.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*Vp(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Kf);yield ai(lo.setLoginState({loading:!0}));try{const e=At(o.publicKey),i=yield si(qd.auth.verifyMFAWebAuthnForLogin,n,O({},o,{options:e})),a=yield si(qd.auth.generateLoginResponseV2,i);yield Rp(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*Wp(){yield aa(lo.requestAuthorize,lp),yield aa(lo.requestAuthorizeSSR,cp),yield aa(lo.requestHostedLoginAuthorize,up),yield aa(lo.handleHostedLoginCallback,dp),yield aa(lo.preLogin,mp),yield aa(lo.postLogin,Ip),yield aa(lo.login,Lp),yield aa(lo.logout,wp),yield aa(lo.silentLogout,Dp),yield aa(lo.loginWithMfa,Ep),yield aa(lo.recoverMfa,Op),yield aa(lo.quickSmsPasswordlessPreLogin,pp),yield aa(lo.changePhoneNumberWithVerification,yp),yield aa(lo.verifyChangePhoneNumber,fp),yield aa(lo.passwordlessPreLogin,gp),yield aa(lo.passwordlessPostLogin,vp),yield aa(lo.verifyInviteToken,hp),yield aa(lo.webAuthnPrelogin,Tp),yield aa(lo.webAuthnPostLogin,Pp),yield aa(lo.webAuthnCreateNewDeviceSession,Ap),yield aa(lo.webAuthnVerifyNewDeviceSession,kp),yield aa(lo.afterAuthNavigation,zf),yield aa(lo.getUserIP,rp),yield aa(lo.preEnrollMFASMSForLogin,Up),yield aa(lo.enrollMFASMSForLogin,_p),yield aa(lo.preEnrollMFAWebAuthnForLogin,Mp),yield aa(lo.enrollMFAWebAuthnForLogin,Np),yield aa(lo.enrollMFAAuthenticatorAppForLogin,Fp),yield aa(lo.preVerifyMFASMSForLogin,$p),yield aa(lo.verifyMFASMSForLogin,Gp),yield aa(lo.preVerifyMFAWebAuthnForLogin,xp),yield aa(lo.verifyMFAWebAuthnForLogin,Vp)}function*jp({payload:e}){e&&(yield ai(lo.setState({isLoading:!0})));const t=ry;yield ai(lo.loadTenants()),yield ai(lo.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Kp({payload:{callback:e}}){try{const{ip:t}=Ey[0];yield ai(lo.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Bp(){yield aa(lo.requestAuthorize,jp),yield aa(lo.afterAuthNavigation,zf),yield aa(lo.getUserIP,Kp)}const zp=["callback","samlVendor"],qp=["callback","samlVendor"];function*Hp(){try{var e,t;yield ai(lo.setSSOState({loading:!0}));const n=yield si(qd.auth.getSamlConfiguration),o=yield si(qd.auth.getOidcConfiguration),i=yield si(qd.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*Jp({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 ey(e[0]),i=yield si(qd.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*Yp({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 ey(t),a=yield si(qd.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*Qp({payload:e}){const{callback:t,samlVendor:n}=e,o=Ao(e,zp),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===Yd.Saml){var l,s;const e=yield si(qd.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=Qd(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(qd.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*Xp({payload:{callback:e}={}}){const t=yield di((e=>e.auth.ssoState.samlConfiguration));try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(qd.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*Zp(){try{const e=yield si(qd.auth.getSamlRoles),t=yield si(qd.auth.getSamlRolesGroups);yield ai(lo.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield ai(lo.setSSOState({error:e.message}))}}function*eg({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(qd.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield ri(e.map((e=>si(qd.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield ai(lo.setSSOState({error:e.message}))}}(n)),yield Zp(),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*tg({payload:{callback:e,id:t}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(qd.auth.deleteSamlGroup,{id:t}),yield Zp(),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*ng({payload:{group:e,roleIds:t,callback:n}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(qd.auth.createSamlGroup,{group:e,roleIds:t}),yield Zp(),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*og({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield ai(lo.setSSOState({loading:!0})),yield si(qd.auth.oidcPostLoginV2,t),yield si(ep),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*ig(){yield oa(lo.loadSSOConfigurations,Hp),yield oa(lo.saveSSOConfigurations,Qp),yield oa(lo.saveSSOConfigurationsFile,Jp),yield oa(lo.saveSSOConfigurationsFileWithCallback,Yp),yield oa(lo.validateSSODomain,Xp),yield oa(lo.loadSSOAuthorizationRoles,Zp),yield oa(lo.updateSSOAuthorizationRoles,eg),yield oa(lo.deleteSamlGroup,tg),yield oa(lo.createSamlGroup,ng),yield oa(lo.oidcPostlogin,og)}function*ag(){yield ai(lo.setSSOState({loading:!0})),yield vt(),yield ai(lo.setSSOState({samlConfiguration:fy,loading:!1,firstLoad:!1}))}function*rg({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*lg({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Ao(e,qp),r=Sy.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==py||null==(t=py.configuration)?void 0:t.acsUrl,l.spEntityId=null==py||null==(n=py.configuration)?void 0:n.spEntityId;const c=Qd(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*sg({payload:{callback:e}={}}){const t=Sy.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*cg(){yield vt(),yield ai(lo.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*ug({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*dg(){yield oa(lo.loadSSOConfigurations,ag),yield oa(lo.saveSSOConfigurations,lg),yield oa(lo.saveSSOConfigurationsFile,rg),yield oa(lo.validateSSODomain,sg),yield oa(lo.loadSSOAuthorizationRoles,cg),yield oa(lo.updateSSOAuthorizationRoles,ug)}const yg=["callback"],fg=["callback","ssoConfigId"],pg=["callback","ssoConfigId"];function*gg(){try{return yield si(qd.auth.getOidcConfiguration)}catch(e){return null}}function*Sg(){try{return yield si(qd.metadata.getSamlMetadata)}catch(e){return null}}function*vg(){try{yield ai(lo.setSSOLoader({key:Jd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield ri([si(gg),si(Sg)]),n=yield si(qd.auth.getSSOConfigurations);yield ai(lo.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield ai(lo.setSSOError({key:Jd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield ai(lo.setSSOLoader({key:Jd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*hg({payload:e}){yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ao(e,yg),o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield si(qd.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:Jd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*mg({payload:e}){yield ai(lo.setSSOLoader({key:Jd.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 ey(t),i=yield si(qd.auth.createSSOConfigurationByMetadata,{metadata:e});yield ai(lo.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield ai(lo.setSSOError({key:Jd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*bg({payload:e}){yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Ao(e,fg),i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield si(qd.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:Jd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Ag({payload:e}){yield ai(lo.setSSOLoader({key:Jd.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 ey(o),a=yield si(qd.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:Jd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*kg({payload:e}){yield ai(lo.setSSOLoader({key:Jd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(qd.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:Jd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Tg({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Ao(e,pg);yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield si(qd.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:Jd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_DOMAIN,value:!1}))}}function*Pg({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield ai(lo.setSSOLoader({key:Jd.DELETE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(qd.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:Jd.DELETE_SSO_DOMAIN,value:e.message})),null==o||o(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.DELETE_SSO_DOMAIN,value:!1}))}}function*Ig({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield ai(lo.setSSOLoader({key:Jd.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(qd.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:Jd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Lg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(qd.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:Jd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Eg({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_GROUPS,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield ri(t.map((e=>si(qd.auth.deleteSSOGroup,n,e)))),yield ri(e.map((e=>si(qd.auth.createSSOGroup,n,e))));const a=yield si(qd.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:Jd.SAVE_SSO_GROUPS,value:e.message})),null==o||o(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_GROUPS,value:!1}))}}function*Og({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield ri(t.map((t=>si(qd.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield ai(lo.setSSOError({key:Jd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_GROUPS,value:!1}))}}function*wg(){yield oa(lo.loadSSOConfigurationsV2,vg),yield oa(lo.saveSSOConfigurationV2,hg),yield oa(lo.saveSSODomain,Tg),yield oa(lo.deleteSSODomain,Pg),yield oa(lo.validateSSODomainV2,Ig),yield oa(lo.updateSSOConfiguration,bg),yield oa(lo.deleteSSOConfiguration,kg),yield oa(lo.setSSOGroups,Eg),yield oa(lo.updateSSOGroups,Og),yield oa(lo.setSSODefaultRoles,Lg),yield oa(lo.saveSSOConfigurationByMetadata,mg),yield oa(lo.updateSSOConfigurationByMetadata,Ag)}const Dg=["callback","profilePictureUrl"],Cg=["callback","profilePictureUrl"];function*Rg(){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,qd.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*Ug(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ao(e.payload,Dg);yield ai(lo.setProfileState({saving:!0,error:null,loading:!0}));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(qd.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(qd.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,loading:!1})),null==t||t(a)}catch(e){yield ai(lo.setProfileState({saving:!1,error:e.message,loading:!1})),null==t||t(null,e)}}function*_g({payload:e}){yield ai(lo.setProfileState({loading:!0}));try{var t;yield si(qd.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*Mg(){yield aa(lo.loadProfile,Rg),yield oa(lo.saveProfile,Ug),yield oa(lo.changePassword,_g)}function*Ng(){yield ai(lo.setProfileState({loading:!0})),yield vt(),yield ai(lo.setUser(O({},ry,ay))),yield ai(lo.setProfileState({loading:!1,profile:ay}))}function*Fg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ao(e.payload,Cg);yield ai(lo.setProfileState({saving:!0,error:null}));const i=ly;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=ry;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*$g({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*Gg(){yield aa(lo.loadProfile,Ng),yield oa(lo.saveProfile,Fg),yield oa(lo.changePassword,$g)}const xg=["callback"],Vg=["callback"],Wg=["callback"],jg=["deviceId","callback"],Kg=["deviceId","callback"],Bg=["callback"],zg=["deviceId"],qg=["deviceId"],Hg=["callback"],Jg=["deviceId"],Yg=["callback"];function*Qg(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*Xg(){yield ai(lo.setMfaState({saving:!0}));try{const{qrCode:e}=yield si(qd.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*Zg(e){let{payload:{callback:t}}=e,n=Ao(e.payload,xg);yield ai(lo.setMfaState({saving:!0}));try{const e=yield di((e=>e.auth.user)),o=yield si(qd.auth.verifyMfa,n),i=yield si(qd.auth.getMFADevices),a=yield Qg(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*eS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Vg);yield ai(lo.setMfaState({loading:!0}));try{const e=yield si(qd.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*tS({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t;yield si(qd.auth.disableMfa,e);const n=yield si(qd.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*nS({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t,n;const o=yield si(qd.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*oS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Wg);yield ai(lo.setMfaState({saving:!0}));try{const e=At(n.publicKey),o=yield si(qd.auth.enrollMFAWebAuthn,O({},n,{options:e})),i=yield si(qd.auth.getMFADevices),a=yield Qg(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*iS(e){let{payload:{deviceId:t,callback:n}}=e;Ao(e.payload,jg),yield ai(lo.setMfaState({saving:!0}));try{var o;const e=yield si(qd.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*aS(e){let{payload:{deviceId:t,callback:n}}=e,o=Ao(e.payload,Kg);yield ai(lo.setMfaState({saving:!0}));try{const e=At(o.publicKey);yield si(qd.auth.disableMFAWebAuthn,t,O({},o,{options:e}));const i=yield si(qd.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*rS({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t;const n=yield si(qd.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*lS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Bg);yield ai(lo.setMfaState({saving:!0}));try{const e=yield si(qd.auth.enrollMFASMS,n),o=yield si(qd.auth.getMFADevices),i=yield Qg(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*sS(e){let{payload:{deviceId:t}}=e,n=Ao(e.payload,zg);yield ai(lo.setMfaState({saving:!0}));try{var o;const e=yield si(qd.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*cS(e){let{payload:{deviceId:t}}=e,n=Ao(e.payload,qg);yield ai(lo.setMfaState({saving:!0}));try{var o;yield si(qd.auth.disableMFASMS,t,n);const e=yield si(qd.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*uS(){yield ai(lo.setMfaState({loading:!0}));try{yield di((e=>e.auth.user));const e=yield si(qd.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*dS(){yield ai(lo.setMfaState({loading:!0}));try{const e=(yield si(qd.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*yS(){yield oa(lo.enrollMfa,Xg),yield oa(lo.getMFADevices,uS),yield oa(lo.getMFAStrategies,dS),yield oa(lo.verifyMfa,Zg),yield oa(lo.disableMfa,tS),yield oa(lo.verifyMfaAfterForce,eS),yield oa(lo.preDisableMfaSms,sS),yield oa(lo.disableMfaSms,cS),yield oa(lo.preEnrollMfaSms,rS),yield oa(lo.enrollMfaSms,lS),yield oa(lo.preEnrollMfaWebAuthn,nS),yield oa(lo.enrollMfaWebAuthn,oS),yield oa(lo.preDisableMfaWebAuthn,iS),yield oa(lo.disableMfaWebAuthn,aS)}function*fS(){yield ai(lo.setMfaState({saving:!0})),yield ai(lo.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*pS({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({},ry,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*gS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Hg);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({},ry,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}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({saving:!1,error:void 0,mfaDevices:O({},n,{authenticators:[]})})),yield ai(lo.setUser(O({},ry))),null==(t=e.callback)||t.call(e,!0)}function*vS(e){let{}=e,t=Ao(e.payload,Jg);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*hS({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({},ry))),null==(t=e.callback)||t.call(e,!0)}function*mS({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*bS(e){let{payload:{callback:t}}=e;Ao(e.payload,Yg);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({},ry,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*AS(){yield oa(lo.enrollMfa,fS),yield oa(lo.verifyMfa,pS),yield oa(lo.disableMfa,SS),yield oa(lo.verifyMfaAfterForce,gS),yield oa(lo.preDisableMfaSms,vS),yield oa(lo.disableMfaSms,hS),yield oa(lo.preEnrollMfaSms,mS),yield oa(lo.enrollMfaSms,bS)}const kS=["callback"];function*TS({payload:e}){yield ai(lo.setForgotPasswordState({loading:!0}));try{var t;yield si(qd.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*PS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,kS);yield ai(lo.setForgotPasswordState({loading:!0}));try{yield si(qd.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*IS({payload:e}){yield ai(lo.setForgotPasswordState({loading:!0}));try{const t=yield si(qd.auth.loadPasswordConfig,e);yield ai(lo.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield ai(lo.setForgotPasswordState({loading:!1,error:e.message}))}}function*LS(){yield aa(lo.forgotPassword,TS),yield aa(lo.resetPassword,PS),yield aa(lo.loadPasswordConfig,IS)}let ES;!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"}(ES||(ES={}));const OS=["callback","events"],wS=["callback"],DS=["callback"];function*CS({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(qd.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*RS(e){let{payload:{callback:t,events:n}}=e,o=Ao(e.payload,OS);yield ai(lo.setActivateState({loading:!0}));try{const e=ra.onRedirectTo,{routes:a}=yield di((e=>e.auth)),r=yield si(qd.auth.activateAccount,o);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(Jf(r)){yield ai(lo.setActivateState({step:_t.success}));const t=yield Xf(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(qd.auth.generateLoginResponseV2,r);null==n||null==(i=n.userVerified)||i.call(n,{email:e.email,origin:Cy.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 zf(),yield ai(lo.resetActivateState())}null==t||t(!0)}catch(e){yield ai(lo.setActivateState({loading:!1,error:e.message}))}}function*US({payload:e}){const{callback:t}=e,n=Ao(e,wS);yield ai(lo.setActivateStrategyState({loading:!0}));try{const e=yield si(qd.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*_S({payload:e}){const{callback:t}=e,n=Ao(e,DS);yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:n.email})),yield ai(lo.setActivateState({loading:!0}));try{yield si(qd.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:ES.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:!1}))}function*MS(){yield aa(lo.activateAccount,RS),yield aa(lo.preActivateAccount,CS),yield aa(lo.getActivateAccountStrategy,US),yield aa(lo.resendActivationEmail,_S)}function*NS({payload:e}){if(e.token&&e.userId)try{yield ai(lo.setAcceptInvitationState({error:void 0,step:$t.pending})),yield si(qd.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*FS(){yield aa(lo.acceptInvitation,NS)}var $S,GS=new Uint8Array(16);function xS(){if(!$S&&!($S="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 $S(GS)}for(var VS=/^(?:[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,WS=function(e){return"string"==typeof e&&VS.test(e)},jS=[],KS=0;KS<256;++KS)jS.push((KS+256).toString(16).substr(1));var BS=function(e,t,n){var o=(e=e||{}).random||(e.rng||xS)();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=(jS[e[t+0]]+jS[e[t+1]]+jS[e[t+2]]+jS[e[t+3]]+"-"+jS[e[t+4]]+jS[e[t+5]]+"-"+jS[e[t+6]]+jS[e[t+7]]+"-"+jS[e[t+8]]+jS[e[t+9]]+"-"+jS[e[t+10]]+jS[e[t+11]]+jS[e[t+12]]+jS[e[t+13]]+jS[e[t+14]]+jS[e[t+15]]).toLowerCase();if(!WS(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let zS,qS;!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"}(zS||(zS={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(qS||(qS={}));const HS=["callback"],JS=["roles"],YS=["callback"],QS=["callback","profileImage"],XS=["callback"],ZS=["callback","userId"],ev=["callback"],tv=["callback"],nv=["callback"],ov=["callback"],iv=["callback"],av=["callback"],rv=["callback"],lv=["callback","profileImage"],sv=["callback"],cv=["callback"],uv=["callback"],dv=["callback"],yv=["callback"],fv=["callback"],pv=()=>di((e=>e.auth.teamState));function*gv(){try{const{groups:e}=yield si(qd.groups.getGroups,{_groupsRelations:qS.roles});return e}catch(e){return[]}}function*Sv({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield pv(),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:ES.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},a]=yield ri([si(qd.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),si(qd.teams.loadAvailableRoles),si(qd.teams.loadAvailablePermissions),si(gv)]),l=e.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>a.filter((t=>t.id===e.id)))).flat();return O({},e,{groups:n})}));yield ai(lo.setTeamState({users:l,totalPages:t,totalItems:n,roles:o,permissions:i})),null==r||r(e)}catch(e){yield ai(lo.setTeamError({key:ES.USERS,value:e.message})),yield ai(lo.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield ai(lo.setTeamLoader({key:ES.USERS,value:!1}))}function*vv({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield pv(),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:ES.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(qd.subTenants.loadAllUsers,O({},c)),si(qd.teams.loadAvailableRoles),si(qd.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:ES.USERS,value:e.message})),yield ai(lo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield ai(lo.setTeamLoader({key:ES.USERS,value:!1}))}function*hv({payload:e}){yield ai(lo.setTeamLoader({key:ES.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield ri([si(qd.teams.loadAvailableRoles),si(qd.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:ES.ROLES_AND_PERMISSIONS,value:t.message}))}yield ai(lo.setTeamLoader({key:ES.ROLES_AND_PERMISSIONS,value:!0}))}function*mv({payload:e}){const{callback:t}=e,n=Ao(e,HS),o=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield si(qd.teams.addUser,n),{roles:a}=e,r=O({},Ao(e,JS),{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*bv({payload:e}){const{callback:t}=e,n=yield pv();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(qd.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*Av({payload:e}){const{callback:t}=e,n=Ao(e,YS),o=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})}));try{yield si(qd.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield si(qd.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*kv({payload:e}){const{callback:t}=e,n=Ao(e,QS),{id:o}=n,i=yield pv(),a=i.users.find((e=>e.id===n.id));yield ai(lo.setTeamLoader({key:ES.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(qd.teams.updateUser,n);null==t||t(e),yield ai(lo.setTeamState({users:i.users.map((t=>t.id===e.id?O({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield ai(lo.setTeamLoader({key:ES.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:ES.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*Tv({payload:e}){const{callback:t}=e,n=Ao(e,XS),o=yield pv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})}));try{yield si(qd.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*Pv({payload:e}){const{callback:t,userId:n}=e,o=Ao(e,ZS),i=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0})}));try{yield si(qd.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*Iv({payload:e}){const{callback:t}=e,n=Ao(e,ev),o=yield pv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})}));try{yield si(qd.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*Lv({payload:e}){const{callback:t}=e,n=Ao(e,tv);yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield si(qd.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:!1}))}function*Ev({payload:e}){const{callback:t}=e,n=Ao(e,nv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email}));try{yield si(qd.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Ov({payload:e}){const{callback:t}=e,n=Ao(e,ov);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email}));try{yield si(qd.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*wv({payload:e}){const{callback:t}=e,n=Ao(e,iv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email}));try{yield si(qd.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Dv(){yield ai(lo.setTeamError({key:ES.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield si(qd.teams.getInviteLinkConfiguration);yield ai(lo.setTeamState({inviteTokenState:O({},e)}))}catch(e){yield ai(lo.setTeamError({key:ES.CONFIG_TOKEN_LINK,value:e.message}))}}function*Cv(){yield ai(lo.setTeamError({key:ES.GET_TOKEN_LINK,value:!1}));try{yield si(Dv);const e=yield si(qd.teams.getInviteUserLink),{inviteTokenState:t}=yield pv();yield ai(lo.setTeamState({inviteTokenState:O({},t,e)}))}catch(e){yield ai(lo.setTeamError({key:ES.GET_TOKEN_LINK,value:e.message}))}}function*Rv({payload:{callback:e}}){yield ai(lo.setTeamError({key:ES.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield pv();try{const n=yield si(qd.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:ES.CREATE_TOKEN_LINK,value:t.message}))}}function*Uv({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield pv();yield ai(lo.setTeamError({key:ES.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield si(qd.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:ES.UPDATE_TOKEN_LINK,value:t.message}))}}function*_v({payload:e}){const{callback:t}=null!=e?e:{};yield ai(lo.setTeamError({key:ES.DELETE_TOKEN_LINK,value:!1}));try{yield si(qd.teams.deleteInviteUserLink),yield ai(lo.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Mv({payload:e}){yield ai(lo.setTeamState({addUserDialogState:O({open:!0,loading:!1,error:!1},e)}))}function*Nv({payload:e}){const t=yield pv(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield ai(lo.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Fv({payload:e}){yield ai(lo.setTeamState({deleteUserDialogState:O({open:!0,loading:!1,error:!1},e)}))}function*$v({payload:e}){const t=yield pv(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield ai(lo.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Gv(){yield ia(lo.loadUsers,Sv),yield ia(lo.loadAllSubTenantsUsers,vv),yield ia(lo.loadRoles,hv),yield oa(lo.addUser,mv),yield oa(lo.addUsersBulk,bv),yield oa(lo.addUserToSubTenants,Av),yield oa(lo.updateUser,kv),yield oa(lo.setUserRolesForSubTenants,Pv),yield oa(lo.deleteUser,Tv),yield oa(lo.deleteUserFromSubTenants,Iv),yield oa(lo.resendActivationLink,Lv),yield oa(lo.resendInvitationLink,Ev),yield oa(lo.resendInvitationEmail,Ov),yield oa(lo.resendInvitationLinkToAllSubTenants,wv),yield oa(lo.getInvitationLink,Cv),yield oa(lo.createInvitationLink,Rv),yield oa(lo.updateInvitationLink,Uv),yield oa(lo.deleteInvitationLink,_v),yield oa(lo.openAddUserDialog,Mv),yield oa(lo.closeAddUserDialog,Nv),yield oa(lo.openDeleteUserDialog,Fv),yield oa(lo.closeDeleteUserDialog,$v)}function*xv({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield pv(),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:ES.USERS,value:!a})),yield ai(lo.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield vt(),yield ai(lo.setTeamState({users:Ay,totalPages:2,totalItems:10,roles:gy,permissions:vy})),yield ai(lo.setTeamLoader({key:ES.USERS,value:!1})),null==r||r(Ay)}function*Vv({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield pv(),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:ES.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:ky,totalPages:2,totalItems:10,roles:gy,permissions:vy})),yield ai(lo.setTeamLoader({key:ES.USERS,value:!1})),null==l||l(ky)}function*Wv({payload:e}){var t;yield ai(lo.setTeamLoader({key:ES.ROLES_AND_PERMISSIONS,value:!0})),yield vt(),yield ai(lo.setTeamState({roles:gy,permissions:vy})),yield ai(lo.setTeamLoader({key:ES.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:gy,permissions:vy})}function*jv({payload:e}){const{callback:t}=e,n=Ao(e,av),o=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})})),yield vt();const i=O({},my,n,{id:`${BS()}`});null==t||t(i),yield ai(lo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*Kv({payload:e}){const{callback:t}=e,n=Ao(e,rv),o=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})})),yield vt();const i=O({},my,n,{id:`${BS()}`});yield ai(lo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*Bv({payload:e}){var t;const{callback:n}=e,o=Ao(e,lv),{id:i}=o,a=yield pv(),r=a.users.find((e=>e.id===o.id));yield ai(lo.setTeamLoader({key:ES.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:ES.UPDATE_USER,value:!1}))}function*zv({payload:e}){const{callback:t}=e,n=Ao(e,sv),o=yield pv();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*qv({payload:e}){const{callback:t}=e,n=Ao(e,cv),o=yield pv();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*Hv({payload:e}){const{callback:t}=e,n=Ao(e,uv);yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:n.userId})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:!1}))}function*Jv({payload:e}){const{callback:t}=e,n=Ao(e,dv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Yv({payload:e}){const{callback:t}=e,n=Ao(e,yv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Qv({payload:e}){const{callback:t}=e,n=Ao(e,fv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Xv(){yield ia(lo.loadUsers,xv),yield ia(lo.loadAllSubTenantsUsers,Vv),yield ia(lo.loadRoles,Wv),yield oa(lo.addUser,jv),yield oa(lo.addUserToSubTenants,Kv),yield oa(lo.updateUser,Bv),yield oa(lo.deleteUser,zv),yield oa(lo.deleteUserFromSubTenants,qv),yield oa(lo.resendActivationLink,Hv),yield oa(lo.resendInvitationLink,Jv),yield oa(lo.resendInvitationEmail,Yv),yield oa(lo.resendInvitationLinkToAllSubTenants,Qv),yield oa(lo.openAddUserDialog,Mv),yield oa(lo.closeAddUserDialog,Nv),yield oa(lo.openDeleteUserDialog,Fv),yield oa(lo.closeDeleteUserDialog,$v)}const Zv=["authorizationUrl"],eh=["events","url"];function*th(){try{yield ai(lo.setSocialLoginsState({loading:!0}));const e=yield si(qd.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*nh(){try{const e=yield di((e=>e.root.context));yield ai(lo.setSocialLoginsState({loading:!0}));const t=yield si(qd.auth.getSocialLoginProvidersV2),{providers:n}=yield si(qd.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Ao(t,Zv);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*oh(e){let{payload:{events:t,url:n}}=e,o=Ao(e.payload,eh);try{yield ai(lo.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield si(qd.auth.loginViaSocialLogin,o);var i,a;r&&(null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,url:n,authenticationType:Ry.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:o.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:Cy.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(np):yield si(ip)}(),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*ih({payload:e}){yield ai(lo.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*ah(){yield aa(lo.loadSocialLoginsConfiguration,th),yield aa(lo.loadSocialLoginsConfigurationV2,nh),yield aa(lo.loginViaSocialLogin,oh),yield ia(lo.setSocialLoginError,ih)}let rh;function*lh({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:rh.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield si(qd.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield si(qd.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:rh.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield ai(lo.setApiTokensError({key:rh.ADD_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:rh.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*sh({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:rh.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield si(qd.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield si(qd.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:rh.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield ai(lo.setApiTokensError({key:rh.ADD_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:rh.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*ch({payload:e}){const{apiTokensDataUser:t}=yield di((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!0})),n?(yield si(qd.auth.deleteUserAccessToken,{id:e}),yield ai(lo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield si(qd.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:rh.DELETE_API_TOKEN,value:!1}))}catch(e){yield ai(lo.setApiTokensError({key:rh.DELETE_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!1}))}}function*uh({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:rh.DELETE_API_TOKEN,value:!0})),n?(yield si(qd.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield si(qd.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:rh.DELETE_API_TOKEN,value:!1}))}catch(e){yield ai(lo.setApiTokensError({key:rh.DELETE_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!1}))}}function*dh({payload:e}){null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield ri([si(qd.auth.getUserApiTokensData),si(qd.auth.getTenantApiTokensData)]);yield ai(lo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setApiTokensError({key:rh.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*yh({payload:e}){null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=si(qd.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=si(qd.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:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield ai(lo.setApiTokensError({key:rh.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*fh({payload:e}){null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=si(qd.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=si(qd.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:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield ai(lo.setApiTokensError({key:rh.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*ph(){yield aa(lo.loadApiTokens,dh),yield aa(lo.loadUserApiTokens,yh),yield aa(lo.loadTenantApiTokens,fh),yield oa(lo.addUserApiToken,lh),yield oa(lo.addTenantApiToken,sh),yield ia(lo.deleteTenantApiToken,uh),yield ia(lo.deleteUserApiToken,ch)}function*gh({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield ai(lo.setApiTokensLoader({key:rh.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield di((e=>e.auth.apiTokensState)),a=O({},oy,{description:t,roleIds:n,clientId:`CLIENT_ID_${BS()}`});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:rh.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*Sh({payload:e}){yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!0})),yield yi(200);const t=[oy];yield ai(lo.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!1}))}function*vh({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));const n=[ny],o=[oy];yield ai(lo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield yi(200),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*hh({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));const n=[ny];yield ai(lo.setApiTokensState({apiTokensDataUser:n})),yield yi(200),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*mh({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));const n=[oy];yield ai(lo.setApiTokensState({apiTokensDataTenant:n})),yield yi(200),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*bh(){yield aa(lo.loadApiTokens,vh),yield aa(lo.loadUserApiTokens,hh),yield aa(lo.loadTenantApiTokens,mh),yield oa(lo.addTenantApiToken,gh),yield ia(lo.deleteTenantApiToken,Sh)}function*Ah({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(qd.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*kh({payload:e}){yield ai(lo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield si(qd.accountSettings.getSettings);yield ai(lo.setAccountSettingsState(O({},e,{loading:!1})))}catch(e){yield ai(lo.setAccountSettingsState({loading:!1,error:e.message}))}}function*Th(){yield aa(lo.saveAccountSettings,Ah),yield aa(lo.loadAccountSettings,kh)}function*Ph({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*Ih({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*Lh(){yield aa(lo.saveAccountSettings,Ph),yield aa(lo.loadAccountSettings,Ih)}function*Eh({payload:{tenantId:e,callback:t}}){yield ai(lo.setState({isLoading:!0}));try{yield si(qd.tenants.switchTenant,{tenantId:e}),yield si(ep),(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*Oh({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(qd.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*wh({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(qd.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*Dh({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(qd.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*Ch(){yield oa(lo.loadTenants,Oh),yield oa(lo.loadSubTenants,wh),yield oa(lo.switchTenant,Eh),yield oa(lo.loadSubTenantsTree,Dh)}function*Rh(){yield ai(lo.setTenantsState({loading:!0})),yield vt(),yield ai(lo.setTenantsState({tenants:Ty,loading:!1}))}function*Uh(){yield oa(lo.loadTenants,Rh)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(rh||(rh={}));const _h=["callback"],Mh=["callback"],Nh=["callback"],Fh=["callback"],$h=["callback"];function*Gh({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(qd.roles.getRoles),si(qd.roles.getPermissions),si(qd.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*xh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,_h);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(qd.roles.addRole,n),o=yield si(qd.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*Vh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Mh);yield ai(lo.setRolesState({saving:!0}));try{yield si(qd.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*Wh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Nh);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(qd.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*jh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Fh);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(qd.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*Kh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,$h);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(qd.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*Bh(){yield aa(lo.loadRolesAndPermissions,Gh),yield oa(lo.addRole,xh),yield oa(lo.deleteRole,Vh),yield oa(lo.updateRole,Wh),yield oa(lo.attachPermissionsToRole,jh),yield oa(lo.attachPermissionToRoles,Kh)}function*zh({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:iy,loading:!1}))}catch(e){yield ai(lo.setRolesState({error:e.message,loading:!1}))}}function*qh(){yield aa(lo.loadRolesAndPermissions,zh)}const Hh=["callback"],Jh=["callback"],Yh=["callback"];function*Qh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Hh);yield ai(lo.setResetPhoneNumberState({loading:!0}));try{const e=yield si(qd.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*Xh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Jh);yield ai(lo.setResetPhoneNumberState({loading:!0}));try{const e=yield si(qd.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*Zh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Yh);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(qd.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*em(){yield aa(lo.resetPhoneNumber,Qh),yield aa(lo.verifyResetPhoneNumber,Xh),yield aa(lo.changePhoneNumber,Zh)}function*tm(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{const e=yield si(qd.auth.getCurrentUserSessions);yield ai(lo.setSessionsState({sessions:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*nm(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{const e=yield si(qd.auth.getCurrentUserSession);yield ai(lo.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*om({payload:{id:e}}){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(qd.auth.deleteSessionForUser,e),yield ai(lo.loadUserSessions())}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*im({payload:{callback:e,userId:t}}){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(qd.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield ai(lo.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*am(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(qd.auth.deleteAllSessionsForUser),yield ai(lo.loadUserSessions())}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*rm(){yield ia(lo.loadUserSessions,tm),yield ia(lo.deleteUserSession,om),yield ia(lo.deleteAllUserSessions,am),yield ia(lo.loadCurrentUserSession,nm),yield oa(lo.revokeUserSessions,im)}function*lm(){yield ai(lo.setSessionsState({loading:!0,error:null})),yield ai(lo.setSessionsState({sessions:Py,loading:!1}))}function*sm({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*cm(){yield ai(lo.setSessionsState({loading:!0,error:null}));const e=Py.filter((e=>e.current));yield ai(lo.setSessionsState({sessions:e,loading:!1}))}function*um(){yield ia(lo.loadUserSessions,lm),yield ia(lo.deleteUserSession,sm),yield ia(lo.deleteAllUserSessions,cm)}const dm=["callback"],ym=["callback"];function*fm(){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield si(qd.auth.getSessionConfigurations);yield ai(lo.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*pm({payload:e}){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ao(e,dm);yield si(qd.auth.createOrUpdateSessionConfigrations,n),yield ai(lo.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield ai(lo.setSessionsPolicyState({error:e,loading:!1}))}}function*gm(){yield aa(lo.loadSessionsPolicy,fm),yield ia(lo.createOrUpdateSessionsPolicy,pm)}function*Sm(){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:Iy}));yield ai(lo.setSessionsPolicyState(O({},e,{loading:!1})))}function*vm({payload:e}){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ao(e,ym);null==t||t(!0),yield ai(lo.setSessionsPolicyState({configurations:n,loading:!1}))}function*hm(){yield aa(lo.loadSessionsPolicy,Sm),yield ia(lo.createOrUpdateSessionsPolicy,vm)}const mm=["callback"],bm=["callback"],Am=["callback"],km=["callback"],Tm=["callback"],Pm=["callback"],Im=["callback"],Lm=["callback"],Em=()=>di((e=>e.auth.restrictionsState.ipRestrictions)),Om=()=>di((e=>e.auth.restrictionsState.emailDomainRestrictions));function*wm(){yield ai(lo.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield si(qd.auth.getDomainRestrictionsConfig),t=(yield si(qd.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*Dm(e){let{payload:{callback:t}}=e,n=Ao(e.payload,mm);yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield Om();try{var i;yield si(qd.auth.createDomainRestriction,n);const e=(yield si(qd.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*Cm(e){let{payload:{callback:t}}=e,n=Ao(e.payload,bm);yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield si(qd.auth.updateDomainRestrictionConfig,n),o=(yield si(qd.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*Rm({payload:{id:e}}){yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Om();try{var n;yield si(qd.auth.deleteDomainRestriction,e);const o=(yield si(qd.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 Um=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*_m(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Em(),t=yield si(qd.auth.getIPRestrictionsConfig),n=Um({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield si(qd.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*Mm(){try{const{valid:e}=yield si(qd.auth.testCurrentIpInAllowList);yield ai(lo.setIpRestrictionsState({userIpValid:e}))}catch(e){yield ai(lo.setIpRestrictionsState({error:e.message}))}}function*Nm({payload:{callback:e}}){yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield di((e=>e.auth.userIp));yield ri([si(qd.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:$n.ALLOW}),si(qd.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield Em(),o=Um(n.pagination),{items:i,_metadata:{totalPages:a}}=yield si(qd.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*Fm(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Am);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const o=yield Em();try{var i,a;yield si(qd.auth.createIPRestriction,n);const e=yield Em(),r=Um(e.pagination),{items:l,_metadata:{totalPages:s}}=yield si(qd.auth.getIPRestrictions,r);yield Mm(),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*$m(e){let{payload:{callback:t}}=e,n=Ao(e.payload,km);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));try{yield si(qd.auth.updateIPRestrictionConfig,n);const e=yield Em(),o=yield si(qd.auth.getIPRestrictionsConfig),i=Um(O({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield si(qd.auth.getIPRestrictions,i);yield Mm(),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*Gm({payload:{id:e,callback:t}}){yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const n=yield Em();try{var o;yield si(qd.auth.deleteIPRestriction,e);const i=yield Em(),a=Um(i.pagination),{items:r,_metadata:{totalPages:l}}=yield si(qd.auth.getIPRestrictions,a);yield Mm(),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*xm(){yield aa(lo.loadIpRestrictions,_m),yield aa(lo.loadEmailDomainRestrictions,wm),yield oa(lo.saveIpRestriction,Fm),yield oa(lo.saveIpRestrictionsConfig,$m),yield oa(lo.deleteIpRestriction,Gm),yield oa(lo.checkIfUserIpValid,Mm),yield oa(lo.addCurrentUserIpAndActivate,Nm),yield oa(lo.saveEmailDomainRestriction,Dm),yield oa(lo.saveEmailDomainRestrictionsConfig,Cm),yield oa(lo.deleteEmailDomainRestriction,Rm)}function*Vm(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null})),yield ai(lo.setIpRestrictionsState({data:{restrictions:Ey.filter((e=>e.strategy===Ly.strategy)),config:Ly},totalPages:1,pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Wm(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Em(),t=Ey[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*jm(e){var t,n,o;let{payload:{callback:i}}=e,a=Ao(e.payload,Tm);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const r=yield Em(),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:BS(),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*Km(e){var t,n,o;let{payload:{callback:i}}=e,a=Ao(e.payload,Pm);const r=yield Em();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*Bm({payload:{id:e,callback:t}}){var n;yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const o=yield Em();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*zm(){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*qm(e){var t,n;let{payload:{callback:o}}=e,i=Ao(e.payload,Im);const a=yield Om();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*Hm(e){var t;let{payload:{callback:n}}=e,o=Ao(e.payload,Lm);const i=yield Om();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*Jm({payload:{id:e}}){var t,n;const o=yield Om();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*Ym(){yield aa(lo.loadIpRestrictions,Vm),yield aa(lo.loadEmailDomainRestrictions,zm),yield oa(lo.saveIpRestriction,jm),yield oa(lo.saveIpRestrictionsConfig,Km),yield oa(lo.deleteIpRestriction,Bm),yield oa(lo.checkIfUserIpValid,Wm),yield oa(lo.saveEmailDomainRestriction,qm),yield oa(lo.saveEmailDomainRestrictionsConfig,Hm),yield oa(lo.deleteEmailDomainRestriction,Jm)}const Qm=["callback"],Xm=["id"];function*Zm(e){const{count:t}=yield si(qd.directory.countConfigurationUsers,e.id);return O({},e,{count:t})}function*eb(){yield ai(lo.setProvisioningState({loading:!0,error:null}));try{const e=yield si(qd.directory.getConfigs),t=yield ri(e.map((e=>Zm(e))));yield ai(lo.setProvisioningState({connections:t,loading:!1}))}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1}))}}function*tb(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Qm);yield ai(lo.setProvisioningState({loading:!0,error:null}));try{const e=yield si(qd.directory.createConfiguration,n),o=yield si(qd.directory.getConfigs),i=yield ri(o.map((e=>Zm(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*nb(e){let{payload:{id:t}}=e,n=Ao(e.payload,Xm);yield ai(lo.setProvisioningState({loading:!0,error:null}));try{yield si(qd.directory.updateConfiguration,t,n);const e=yield si(qd.directory.getConfigs),o=yield ri(e.map((e=>Zm(e))));yield ai(lo.setProvisioningState({connections:o,loading:!1}))}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1}))}}function*ob({payload:{id:e,callback:t}}){yield ai(lo.setProvisioningState({loading:!0,error:null}));try{yield si(qd.directory.deleteConfiguration,e);const n=yield si(qd.directory.getConfigs),o=yield ri(n.map((e=>Zm(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*ib(){yield aa(lo.loadProvisionConnections,eb),yield oa(lo.createProvisionConnection,tb),yield oa(lo.deleteProvisionConnection,ob),yield oa(lo.updateProvisionConnection,nb)}const ab=["callback","events"];function*rb(e){let{payload:{callback:t}}=e,n=Ao(e.payload,ab);yield ai(lo.setImpersonateState({loading:!0}));try{yield si(qd.impersonate.impersonate,n),yield ai(lo.setImpersonateState({step:to.success})),yield yi(1e3),yield zf(),yield ai(lo.resetImpersonateState()),null==t||t(!0)}catch(e){yield ai(lo.setImpersonateState({loading:!1,error:e.message}))}}function*lb(){yield aa(lo.impersonate,rb)}function*sb({payload:e}){const{callback:t,deviceId:n}=e;yield ai(lo.setPasskeysState({loading:!0}));try{yield si(qd.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*cb(){yield ai(lo.setPasskeysState({loading:!0}));try{const{devices:e}=yield si(qd.auth.getWebAuthnDevices);yield ai(lo.setPasskeysState({devices:e,loading:!1}))}catch(e){yield ai(lo.setPasskeysState({loading:!1,error:e.message||null}))}}function*ub(){yield oa(lo.loadWebAuthnDevices,cb),yield oa(lo.deleteWebAuthnDevice,sb)}const db=["roleIds","userIds"],yb=()=>di((e=>e.auth.groupsState));function*fb({payload:e}){const t=zS.GET_TEAM_USERS;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield si(qd.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*pb({payload:e}){const t=zS.GET_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield si(qd.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:qS.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*gb(){const e=zS.GET_GROUPS,t=yield yb();yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield si(qd.groups.getGroups,{_groupsRelations:qS.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*Sb({payload:e}){const t=zS.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Ao(e,db);yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield si(qd.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*vb({payload:e}){const t=zS.UPDATE_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.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*hb({payload:e}){const t=zS.DELETE_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.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*mb({payload:e}){const t=zS.ADD_ROLES_TO_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.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*bb({payload:e}){const t=zS.DELETE_ROLES_FROM_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.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*Ab({payload:e}){const t=zS.ADD_USERS_TO_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.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*kb({payload:e}){const t=zS.DELETE_USERS_FROM_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.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*Tb(){const e=zS.GET_GROUP_CONFIGURATION;yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield si(qd.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*Pb({payload:e}){const t=zS.UPDATE_GROUP_CONFIGURATION;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{yield si(qd.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*Ib(){yield ia(lo.loadGroups,gb),yield ia(lo.getGroupById,pb),yield ia(lo.createGroup,Sb),yield ia(lo.updateGroup,vb),yield ia(lo.deleteGroup,hb),yield ia(lo.addRolesToGroup,mb),yield ia(lo.deleteRolesFromGroup,bb),yield ia(lo.addUsersToGroup,Ab),yield ia(lo.deleteUsersFromGroup,kb),yield ia(lo.getGroupConfiguration,Tb),yield ia(lo.updateGroupConfiguration,Pb),yield ia(lo.getTeamUsers,fb)}function*Lb(){const e=zS.GET_GROUPS;yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));const t=Dy;yield ai(lo.setGroupsState({groups:t})),yield ai(lo.setUsersGroupsLoader({key:e,value:!1}))}function*Eb({payload:e}){var t;const n=zS.CREATE_GROUP,{groups:o}=yield yb();yield ai(lo.setUsersGroupsLoader({key:n,value:!0})),yield ai(lo.setGroupsState({groups:[O({},e,{id:`${e.name}ID`,managedBy:zd.FRONTEGG}),...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*Ob({payload:e}){var t,n,o,i,a;const r=zS.UPDATE_GROUP,l=yield yb();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:"",managedBy:zd.FRONTEGG}):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*wb({payload:e}){var t,n;const o=zS.DELETE_GROUP,i=yield yb();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*Db({payload:e}){var t,n;const o=zS.ADD_ROLES_TO_GROUP,i=yield yb();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*Cb({payload:e}){var t,n;const o=zS.DELETE_ROLES_FROM_GROUP,i=yield yb();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*Rb({payload:e}){var t,n;const o=zS.ADD_USERS_TO_GROUP,i=yield yb();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*Ub({payload:e}){var t,n;const o=zS.DELETE_USERS_FROM_GROUP,i=yield yb();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*_b(){const e=zS.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield yb();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*Mb({payload:e}){const t=zS.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield yb();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*Nb(){yield ia(lo.loadGroups,Lb),yield ia(lo.createGroup,Eb),yield ia(lo.updateGroup,Ob),yield ia(lo.deleteGroup,wb),yield ia(lo.addRolesToGroup,Db),yield ia(lo.deleteRolesFromGroup,Cb),yield ia(lo.addUsersToGroup,Rb),yield ia(lo.deleteUsersFromGroup,Ub),yield ia(lo.getGroupConfiguration,_b),yield ia(lo.updateGroupConfiguration,Mb)}var Fb={sagas:function*(){yield ri([si(Wp),si(MS),si(FS),si(LS),si(em),si(ig),si(wg),si(Mg),si(yS),si(Gv),si(Ib),si(ah),si($y),si(ph),si(ff),si(Th),si(Ch),si(Bh),si(rm),si(gm),si(xm),si(ib),si(lb),si(ub)])},mockSagas:function*(){yield ri([si(Bp),si(dg),si(Gg),si(AS),si(Xv),si(bh),si(Lf),si(um),si(Lh),si(Uh),si(hm),si(Ym),si(qh),si(Nb)])},storeName:Et,initialState:eo,reducer:ao,actions:lo};const $b=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>O({},t,{[e]:O({},t[e],n)})}),Gb={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},xb={setAuditLogsState:$b("auditLogsState"),resetAuditLogsState:e=>O({},e,{auditLogsState:Gb})},Vb={exportAuditsCsv:rt("auditLogs/exportAuditsCsv"),loadAuditLogs:rt("auditLogs/loadAuditLogs",(e=>({payload:e})))},Wb={loading:!0},jb={setAuditsMetadataState:$b("auditsMetadataState"),resetAuditsMetadataState:e=>O({},e,{auditsMetadataState:Wb})},Kb={loadAuditsMetadata:rt("auditLogs/loadAuditsMetadata")},Bb={auditLogsState:Gb,auditsMetadataState:Wb},{reducer:zb,actions:qb}=st({name:wt,initialState:Bb,reducers:O({resetState:e=>O({},e,Bb),setState:(e,{payload:t})=>O({},e,t)},xb,jb)}),Hb=O({},qb,Vb,Kb),Jb=e=>"createdAt"!==e.id,Yb={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`})))},Qb={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}]},Xb=()=>di((e=>e.auditLogs.auditLogsState)),Zb=()=>di((e=>e.auditLogs.auditsMetadataState));function*eA(){const e=yield Xb(),{columns:t}=yield Zb();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(Hb.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield qd.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(Hb.setAuditLogsState({isDownloadingCsv:!1}))}function*tA({payload:e}){yield ai(Hb.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Xb(),{columns:n}=yield Zb();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(Hb.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(Hb.loadAuditsMetadata()));const{data:p,total:g}=yield si(qd.audits.getAudits,O({offset:c,count:s},y,f));yield ai(Hb.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(Hb.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*nA(){yield oa(Hb.exportAuditsCsv,eA),yield oa(Hb.loadAuditLogs,tA)}function*oA({payload:e}){yield ai(Hb.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Xb(),{columns:n}=yield Zb();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(Hb.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield ai(Hb.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=Yb;let o=n.filter((e=>t=>e.filter(Jb).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(Hb.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(Hb.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*iA(){yield oa(Hb.loadAuditLogs,oA)}function*aA(){yield ai(Hb.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield si(qd.metadata.getAuditsMetadata);yield ai(Hb.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ai(Hb.setAuditsMetadataState({error:e,loading:!1}))}}function*rA(){yield oa(Hb.loadAuditsMetadata,aA)}function*lA(){yield ai(Hb.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Qb;yield ai(Hb.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ai(Hb.setAuditsMetadataState({error:e,loading:!1}))}}function*sA(){yield oa(Hb.loadAuditsMetadata,lA)}var cA={sagas:function*(){yield ri([si(nA),si(rA)])},mockSagas:function*(){yield ri([si(iA),si(sA)])},storeName:wt,initialState:Bb,reducer:zb,actions:Hb};const uA={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:dA,actions:yA,reducer:fA}=st({name:"audits",initialState:uA,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]})))}}}),pA=O({},yA,{initData:rt(`${dA}/initData`),loadAudits:rt(`${dA}/loadAudits`),removeFilter:rt(`${dA}/removeFilter`),filterData:rt(`${dA}/filterData`),exportCSV:rt(`${dA}/exportCSV`),deleteAudits:rt(`${dA}/deleteAudits`)}),gA=()=>di((e=>e[dA]));function*SA(){const{sortBy:e,sortDirection:t}=yield gA();try{const n=yield si(qd.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield ai(pA.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield ai(pA.loadItemFailedAction(t))}}function*vA(){try{const e=yield si(qd.metadata.getAuditsMetadata);yield ai(pA.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield ai(pA.loadItemFailedAction(t))}}const hA=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*mA({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield gA(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield gA():{rowsData:[]};try{const e=hA(t),{data:l,total:d}=yield si(qd.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(pA.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield ai(pA.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield ai(pA.loadItemFailedAction(t))}}function*bA(){yield ai(pA.startLoading()),yield ri([SA(),vA(),mA({payload:{onlyOneLoad:!1},type:""})]),yield ai(pA.finishLoading())}function*AA({payload:e}){const{filters:t}=yield gA(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield ai(pA.setFilterData(o))}function*kA({payload:e}){const{filters:t}=yield gA();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(pA.setFilterData(o))}function*TA(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield gA(),a=hA(e);yield ai(pA.startDownloadingCsv());try{yield qd.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(pA.stopDownloadingCsv())}}function*PA(){yield ia(pA.initData,bA),yield ia(pA.removeFilter,AA),yield ia(pA.filterData,kA),yield ia([pA.loadAudits,pA.textSearch,pA.onPageChange],mA),yield ia([pA.setFilterData,pA.setDataSorting,pA.startRefresh],(()=>mA({payload:{appendMode:!1},type:""}))),yield ia(pA.exportCSV,TA)}const IA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},LA={initData:()=>O({},IA),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)})}},EA={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}})))},OA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:wA,actions:DA}=st({name:Ot,initialState:OA,reducers:O({},LA)}),CA=O({},DA,EA),RA={slack:qd.connectivity.getSlackConfiguration,email:qd.connectivity.getEmailConfiguration,sms:qd.connectivity.getSMSConfiguration,webhook:qd.connectivity.getWebhooksConfigurations,categories:qd.connectivity.getCategories,channelMap:qd.connectivity.getChannelMaps},UA={slack:qd.connectivity.postSlackConfiguration,email:qd.connectivity.postEmailConfiguration,sms:qd.connectivity.postSMSConfiguration,webhook:qd.connectivity.postWebhooksConfiguration},_A=["email","slack","sms","webhook"],MA={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"}},NA=["id"],FA=["id","enabled"],$A=["categories","channelMap"];function*GA(e){return yield si(VA,{payload:{api:e},type:""})}function*xA({payload:e=_A}){yield ai(CA.setConnectivityState({isLoading:!0}));try{const t=yield ri([...e.map(GA),yield VA({payload:{api:"categories"},type:""}),yield function*(){return(yield ri(e.map((function*(e){return yield VA({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>O({},t,{[`${e[o]}`]:n})),{})}()]),n=yield VA({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:MA[e[i]].events(o),active:MA[e[i]].isActive(o),platform:MA[e[i]].title,image:MA[e[i]].image}]}):n:O({},n,{[`${$A[i-e.length]}`]:o})),{list:[],webhook:n});yield ai(CA.setConnectivityState(O({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield ai(CA.setConnectivityState({isLoading:!1}))}}function*VA({payload:{api:e,params:t}}){try{return yield si(RA[e],t)}catch(e){return}}function*WA(){try{yield ai(CA.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield si(qd.connectivity.getSlackChannels);yield ai(CA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield ai(CA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*jA(e,t){const{connectivity:{list:n}}=yield di(),o=n.find((({key:t})=>t===e));if(!o)return;const i=MA[e].isActive(t);i!==o.active&&(yield ai(CA.setConnectivityState({list:n.map((t=>t.key===e?O({},t,{active:i}):t))})))}function*KA({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield di((e=>e.connectivity));try{if(yield ai(CA.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,NA);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(UA.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield si(qd.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?qd.connectivity.postEmailConfiguration:qd.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,FA);return yield ri([yield si("email"===t?qd.connectivity.patchEmailConfiguration:qd.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield si("email"===t?qd.connectivity.putEmailSubscriptions:qd.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?qd.connectivity.deleteEmailSubscriptions:qd.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield VA({payload:{api:t},type:""});yield ai(CA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield jA(t,e)}else yield ai(CA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield si(UA[e],t),!["sms","email"].includes(e)){const i=yield VA({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield ai(CA.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield jA(e,i),null==n||n(!0)}}catch(e){var i;yield ai(CA.setConnectivityState({error:null!=(i=e.message)?i:e.toString(),isSaving:!1,isLoading:!1}))}}function*BA({payload:e}){try{yield qd.connectivity.postSlackCode(e)}catch{}yield ai(CA.setConnectivityState({error:void 0,isSaving:!1}))}function*zA(){const{slackChannels:e}=yield di((e=>e.connectivity));try{yield ai(CA.setConnectivityState({slackChannels:O({},e,{isLoadingScope:!0})}));const{clientId:t}=yield si(qd.connectivity.getSlackScope);yield ai(CA.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield ai(CA.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*qA({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield di((e=>e.connectivity));try{yield ai(CA.setConnectivityState({isSaving:!0})),yield si(qd.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const i=yield VA({payload:{api:"webhook"},type:""});i&&(yield ai(CA.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*HA({payload:e}){try{yield ai(CA.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield si(qd.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield ai(CA.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield ai(CA.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield ai(CA.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*JA({payload:e}){try{const{statusCode:t}=yield si(qd.connectivity.postWebhookRetry,e);yield ai(CA.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield ai(CA.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*YA({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield di((e=>e.connectivity));try{yield ai(CA.setConnectivityState({webhookLogs:O({},o,{isLoading:!0})}));const i=yield si(qd.connectivity.getWebhookLog,e,n,t);yield ai(CA.setConnectivityState({error:void 0,webhookLogs:O({isLoading:!1},i)}))}catch(e){yield ai(CA.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var QA={sagas:function*(){yield oa(CA.loadDataAction,xA),yield ia(CA.loadSlackActions,WA),yield oa(CA.postDataAction,KA),yield oa(CA.postCodeAction,BA),yield oa(CA.loadScope,zA),yield oa(CA.deleteWebhookConfigAction,qA),yield oa(CA.postWebhookTestAction,HA),yield oa(CA.postWebhookRetryAction,JA),yield ia(CA.loadWebhookLogsAction,YA)},storeName:Ot,initialState:OA,reducer:wA,actions:CA};function XA(){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 ZA(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>O({},n,{[e]:t(n[e],o)})}}function ek(e){return ZA(e,((e,t)=>O({},e,{loading:t.payload})))}function tk(e){return ZA(e,((e,t)=>O({},e,{error:t.payload,loading:!1})))}const nk={loading:!1,error:null,fetching:!0,plans:[]},{actions:ok,reducer:ik,name:ak}=st({name:"subscriptions/plans",initialState:nk,reducers:O({},XA())}),rk=O({loadPlans:rt(`${ak}/loadPlans`)},ok),lk={loading:!1,error:null,fetching:!0,config:null},sk=O({},XA()),{actions:ck,reducer:uk,name:dk}=st({name:"subscriptions/config",initialState:lk,reducers:sk}),yk=O({loadPaymentConfiguration:rt(`${dk}/loadPaymentConfiguration`)},ck),fk={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},pk=O({},XA(),{setCancellationLoading:ek("cancellation"),setCancellationError:tk("cancellation"),setRenewalLoading:ek("renewal"),setRenewalError:tk("renewal")}),{reducer:gk,actions:Sk,name:vk}=st({name:"subscriptions/billing/subscription",initialState:fk,reducers:pk}),hk=O({load:rt(`${vk}/loadSubscription`),cancelSubscription:rt(`${vk}/cancelSubscription`),renewSubscription:rt(`${vk}/renewSubscription`)},Sk),mk={loading:!1,error:null,fetching:!0},bk=O({},XA()),{reducer:Ak,actions:kk,name:Tk}=st({name:"subscriptions/billing/information",initialState:mk,reducers:bk}),Pk=O({loadBillingInformation:rt(`${Tk}/loadBillingInformation`),cancelSubscription:hk.cancelSubscription,renewSubscription:hk.renewSubscription},kk),Ik={loading:!1,error:null,fetching:!0},Lk=O({},XA(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,t.payload)}}),{reducer:Ek,actions:Ok,name:wk}=st({name:"subscriptions/billing/payment",initialState:Ik,reducers:Lk}),Dk=O({loadPaymentMethod:rt(`${wk}/loadPaymentMethod`),submitPaymentMethod:rt(`${wk}/submitPaymentMethod`),submitPaymentMethodError:rt(`${wk}/submitPaymentMethodError`),submitPaymentMethodSuccess:rt(`${wk}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:rt(`${wk}/updateBillingDetails`,(e=>({payload:e})))},Ok),Ck={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},Rk=O({},XA(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,{invoiceDownload:O({},e.invoiceDownload,t.payload)})}}),{reducer:Uk,actions:_k,name:Mk}=st({name:"subscriptions/billing/invoices",initialState:Ck,reducers:Rk}),Nk=O({loadInvoices:rt(`${Mk}/loadInvoices`),downloadInvoice:rt(`${Mk}/downloadInvoice`,(e=>({payload:e})))},_k),Fk={information:mk,invoices:Ck,paymentMethod:Ik,subscription:fk},$k={invoices:Nk,information:Pk,paymentMethod:Dk,subscription:hk},Gk=xe({invoices:Uk,information:Ak,paymentMethod:Ek,subscription:gk}),xk={fetching:!0,loading:!1,error:null,confirmed:!1},Vk=O({},XA()),{actions:Wk,reducer:jk,name:Kk}=st({name:"subscriptions/checkout",initialState:xk,reducers:Vk}),Bk=O({loadCheckout:rt(`${Kk}/loadCheckout`),resetCheckout:rt(`${Kk}/resetCheckout`),submitCheckout:rt(`${Kk}/submitCheckout`),confirmCheckout:rt(`${Kk}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:rt(`${Kk}/errorCheckout`,(e=>({payload:e})))},Wk),zk={loading:!1,error:null,cardSetupIntentSecret:null},qk=O({},XA()),{reducer:Hk,actions:Jk,name:Yk}=st({name:"subscriptions/stripe",initialState:zk,reducers:qk}),Qk=O({loadCustomer:rt(`${Yk}/loadCustomer`),createCardSetupIntentSecret:rt(`${Yk}/createCardSetupIntentSecret`)},Jk),Xk={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:Zk,reducer:eT,name:tT}=st({name:"subscriptions/vendorPublicConfig",initialState:Xk,reducers:O({},XA())}),nT=O({loadVendorPublicConfiguration:rt(`${tT}/loadVendorPublicConfiguration`)},Zk),oT={config:lk,plans:nk,checkout:xk,billing:Fk,stripe:zk,vendorPublicConfig:Xk},iT={config:yk,billing:$k,plans:rk,checkout:Bk,stripe:Qk,vendorPublicConfig:nT},aT=xe({config:uk,billing:Gk,plans:ik,checkout:jk,stripe:Hk,vendorPublicConfig:eT});let rT,lT,sT;function cT({policy:e}){return{policy:sT.AT_PERIOD_END}}function uT(e){switch(e){case Zu.ACTIVE:return lT.ACTIVE;case Zu.INCOMPLETE:return lT.INCOMPLETE;case Zu.CANCELED:return lT.CANCELED;case Zu.EXPIRED:return lT.EXPIRED;case Zu.TRIALING:return lT.TRIALING;default:return lT.EXPIRED}}!function(e){e.STRIPE="Stripe"}(rT||(rT={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(lT||(lT={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(sT||(sT={}));const dT={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"}},yT=[{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"}],fT=[{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:""}],pT=[{id:"id",externalId:"externalId",type:ed.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],gT={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*ST(){yield oa(hk.load,vT),yield oa(hk.cancelSubscription,mT),yield oa(hk.renewSubscription,bT)}function*vT(){const e=yield di((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield IT(e)}function*hT(){yield ai(hk.setLoading(!0));try{const[e]=yield si(qd.subscriptions.getManagedSubscriptions);yield ai(hk.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield ai(hk.setError(e))}}function*mT(){const{subscription:e}=yield di((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ai(hk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ai(hk.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===Zu.ACTIVE)try{yield ai(hk.setCancellationLoading(!0)),yield si(qd.subscriptions.cancelManagedSubscription,t),yield hT(),yield ai(hk.setCancellationLoading(!1))}catch(e){yield ai(hk.setCancellationError(e.message))}}function*bT(){const{subscription:e}=yield di((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ai(hk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ai(hk.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(hk.setRenewalLoading(!0)),yield si(qd.subscriptions.renewManagedSubscription,t),yield hT(),yield ai(hk.setRenewalLoading(!1))}catch(e){yield ai(hk.setCancellationError(e.message))}}function*AT(){yield ai(hk.setLoading(!0)),yield yi(500),yield ai(hk.setState({subscription:dT,fetching:!1,loading:!1,error:null}))}function*kT(){yield oa(hk.load,AT)}function*TT(){yield oa(Pk.loadBillingInformation,PT)}function*PT(){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 IT(n,!1):yield ai(Pk.setError(t?"Not authorized":"Internal feature failure"))}()}function*IT(e,t){yield ai(Pk.setLoading(!0));try{var n,o;const i=yield si(qd.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield si(qd.subscriptions.getSubscriptionPlan,a):([,l]=yield ri([si(hT),si(qd.subscriptions.getSubscriptionPlan,a)]),s=yield di((e=>e.subscriptions.billing.subscription.subscription||null))),yield ai(Pk.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?lT.ACTIVE:uT(s.status),cancellation:s.cancellation&&cT(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(Pk.setError(e.message))}}function*LT(){yield function*(){var e,t;yield ai(Pk.setLoading(!0)),yield yi(500),yield ai(Pk.setState({loading:!1,fetching:!1,summary:{subscriptionId:dT.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:nd.Stripe,externallyManaged:!1,currentPlanId:yT[0].id,defaultPlanId:yT[0].id},plan:O({},yT[0],{price:null==(e=yT[0].price)?void 0:e.amount,currency:null==(t=yT[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*ET(){yield oa(Pk.loadBillingInformation,LT)}function*OT(){yield oa(Dk.loadPaymentMethod,wT),yield oa(Dk.submitPaymentMethod,CT),yield oa(Dk.submitPaymentMethodError,RT),yield oa(Dk.submitPaymentMethodSuccess,UT),yield oa(Dk.updatePaymentMethodBillingDetails,DT)}function*wT(){yield ai(Dk.setLoading(!0));try{const e=(yield si(qd.subscriptions.getPaymentMethods))[0];yield ai(Dk.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield ai(Dk.setError(e.message))}}function*DT({payload:e}){yield ai(Dk.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield si(qd.subscriptions.updatePaymentMethodBillingDetails,t,O({email:n},o)),yield si(wT),null==i||i(!0)}catch(e){yield ai(Dk.setError(e.message)),null==i||i(!1)}yield ai(Dk.setLoading(!1))}function*CT(){yield ai(Dk.setLoading(!0))}function*RT({payload:e}){yield ai(Dk.setError(e))}function*UT(){yield ai(Dk.loadPaymentMethod())}function*_T(){yield ai(Dk.setLoading(!0)),yield yi(500);const e=pT[0];yield ai(Dk.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*MT(){yield oa(Dk.loadPaymentMethod,_T)}function*NT(){yield oa(Nk.loadInvoices,FT),yield oa(Nk.downloadInvoice,$T)}function*FT(){yield ai(Nk.setLoading(!0));try{const e=(yield si(qd.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(Nk.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield ai(Nk.setError(e.message))}}function*$T({payload:e}){yield ai(Nk.setInvoiceDownloadState({loading:!0,error:null}));try{yield si(qd.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield ai(Nk.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield ai(Nk.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*GT(){yield ai(Nk.setLoading(!0)),yield yi(500),yield ai(Nk.setState({loading:!1,fetching:!1,invoices:fT.map((e=>O({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield ai(Nk.setLoading(!1))}function*xT(){yield oa(Nk.loadInvoices,GT)}function*VT(){yield ri([si(TT),si(OT),si(NT),si(ST)])}function*WT(){yield ri([si(ET),si(MT),si(xT),si(kT)])}function*jT(){yield oa(Bk.loadCheckout,KT),yield oa(Bk.resetCheckout,BT),yield oa(Bk.submitCheckout,zT),yield oa(Bk.confirmCheckout,qT),yield oa(Bk.errorCheckout,JT)}function*KT(){yield ai(Bk.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*BT(){yield ai(Bk.setState({loading:!1,error:null,confirmed:!1}))}function*zT(){yield ai(Bk.setState({loading:!0,error:null}))}function*qT({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(Bk.setState({loading:!0,error:null})),i&&a)return yield HT(),void(yield ai(hk.setState({subscription:O({},n,{status:Zu.ACTIVE})})));try{yield si(qd.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield ri([PT(),wT(),FT()]),yield HT()}catch(e){yield ai(Bk.setState({loading:!1,error:e.message}))}}else yield ai(Bk.setState({loading:!1,error:"Subscription not found"}))}function*HT(){yield ai(Bk.setState({loading:!1,error:null,confirmed:!0}))}function*JT({payload:e}){yield ai(Bk.setState({loading:!1,error:e}))}function*YT(){yield oa(Bk.resetCheckout,BT)}function*QT(){yield oa(rk.loadPlans,XT)}function*XT(){yield ai(rk.setLoading(!0));try{const e=(yield si(qd.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(rk.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield ai(rk.setError(e.message))}}function*ZT(){yield ai(rk.setLoading(!0)),yield yi(500),yield ai(rk.setState({fetching:!1,loading:!1,plans:yT.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*eP(){yield oa(rk.loadPlans,ZT)}function*tP(){yield oa(yk.loadPaymentConfiguration,nP)}function*nP(){yield ai(yk.setLoading(!0));try{(yield si(qd.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===nd.Stripe))?yield function*(){yield ai(yk.setLoading(!0));try{const e=yield si(qd.subscriptions.getStripePaymentProviderConfiguration);yield ai(yk.setState({loading:!1,fetching:!1,config:{paymentProvider:rT.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield ai(yk.setError(e.message))}}():yield ai(yk.setError("Payment provider not configured"))}catch(e){yield ai(yk.setError(e.message))}}function*oP(){yield ai(yk.setLoading(!0)),yield yi(500),yield ai(yk.setState({loading:!1,fetching:!1,config:{paymentProvider:rT.STRIPE,apiKey:""}}))}function*iP(){yield oa(yk.loadPaymentConfiguration,oP)}function*aP(){yield oa(Qk.createCardSetupIntentSecret,rP)}function*rP({payload:e}){yield ai(Qk.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield si(qd.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield ai(Qk.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield ai(Qk.setError(e.message))}}function*lP(){yield oa(nT.loadVendorPublicConfiguration,sP)}function*sP(){yield ai(nT.setLoading(!0));try{const e=yield si(qd.subscriptions.getVendorPublicConfigurations);yield ai(nT.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield ai(nT.setError(e.message))}}function*cP(){yield ai(nT.setLoading(!0)),yield yi(500),yield ai(nT.setState({fetching:!1,loading:!1,vendorPublicConfig:gT}))}function*uP(){yield oa(nT.loadVendorPublicConfiguration,cP)}var dP={sagas:function*(){yield ri([si(VT),si(jT),si(QT),si(tP),si(aP),si(lP)])},mockSagas:function*(){yield ri([si(WT),si(YT),si(eP),si(iP),si(uP)])},reducer:aT,actions:iT,initialState:oT,storeName:"subscriptions"},yP={sagas:function*(){yield oa(Ky.loadVendorPublicInfo,By)},storeName:Dt,initialState:Vy,reducer:Wy,actions:Ky};const{reducer:fP}=st({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(ra.setContext(t),O({},e,{context:t}))}}}),pP=(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}),[Fb.storeName]:O({},Fb.initialState,o,null!=(s=null==i?void 0:i.auth)?s:{},{routes:O({},Fb.initialState.routes,null!=(c=null==o?void 0:o.routes)?c:{},null!=(u=null==i||null==(d=i.auth)?void 0:d.routes)?u:{})}),[cA.storeName]:O({},cA.initialState,null!=(y=null==i?void 0:i.auditLogs)?y:{},{auditLogsState:O({},cA.initialState.auditLogsState,null!=(f=null==i||null==(p=i.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:O({},cA.initialState.auditsMetadataState,null!=(g=null==i||null==(S=i.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[dA]:O({},uA,null!=(v=null==i?void 0:i.audits)?v:{}),[QA.storeName]:QA.initialState,[dP.storeName]:dP.initialState,[yP.storeName]:yP.initialState},reducer:xe({root:fP,[Fb.storeName]:Fb.reducer,[cA.storeName]:cA.reducer,[dA]:fA,[QA.storeName]:QA.reducer,[dP.storeName]:dP.reducer,[yP.storeName]:yP.reducer})});const m=function*(){yield ri([si(Fb.sagas),si(cA.sagas),si(PA),si(QA.sagas),si(dP.sagas),si(yP.sagas)])},b=function*(){yield ri([si(Fb.mockSagas),si(cA.mockSagas),si(dP.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 gP=n(714),SP=n.n(gP);function vP(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function hP(e){if(e.type)return e;if("#"===e.charAt(0))return hP(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 mP(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 bP(e){if(0===e.indexOf("#"))return e;const{values:t}=hP(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 AP(e,t){return e=hP(e),t=vP(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,mP(e)}function kP(e,t){if(e=hP(e),t=vP(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 mP(e)}function TP(e,t){if(e=hP(e),t=vP(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 mP(e)}const PP=e=>{if(e)return{main:e,light:bP(TP(e,.4)),dark:bP(kP(e,.15)),hover:bP(kP(e,.15)),active:bP(kP(e,.2))}},IP=e=>{if(e)return{main:e,light:TP(e,.7),dark:kP(e,.2)}},LP=(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({},PP(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({},PP(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({},PP(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:O({},IP(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:O({},IP(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:O({},IP(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:O({},IP(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},EP={},OP={},wP={},DP={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 CP{constructor(){this._theme=EP,this._themeV2=OP,this._navigation=DP,this._localizations=wP}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new CP;return n.set(e),CP._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=SP().all([null!=(t=DP)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=SP().all([null!=(o=EP)?o:{},LP(null==e?void 0:e.theme,EP)]),this._themeV2=SP().all([null!=(i=OP)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=SP().all([null!=(r=wP)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=DP,this._theme=EP,this._themeV2=OP,this._localizations=wP}}}CP._instances={};var RP=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},UP=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},_P=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 MP,NP,FP,$P,GP,xP,VP,WP,jP,KP,BP;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(MP||(MP={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(NP||(NP={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(FP||(FP={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}($P||($P={})),function(e){e.Invoices="invoices"}(GP||(GP={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(xP||(xP={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(VP||(VP={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(WP||(WP={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(jP||(jP={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(KP||(KP={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(BP||(BP={}));const zP={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},qP={hidden:"hidden",edit:"edit"};var HP="6.82.0",JP={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on","show-passkeys":"on","groups-admin-box":"on"},YP=function(){function e(t,n){var o,i=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];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(HP),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,a,r;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=da,i.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,i.options.metadata=null!=(n=null==r||null==(o=r.rows)||null==(a=o[0])?void 0:a.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:CP.set(i.options.metadata,i.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:i.options.hostedLoginBox||i.options.builderMode||"nextjs"===i.options.framework||i.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(!i.options.previewMode&&!i.options.builderMode){e.next=4;break}fd.set(JP,i.name),e.next=14;break;case 4:return e.prev=4,e.next=7,pd();case 7:t=e.sent,fd.set(t,i.name),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){i.updateLocalizations=e};var l=RP(n),s="frontegg-app-".concat(l);this.iframeRendering=a,this.name=l,this.options=O({},t,{contextOptions:O({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=s;var c,u,d=this.options.authOptions?O({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(o=this.options.authOptions)?void 0:o.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=pP({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);E.setInstance(l,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;CP.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}(),QP=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}(),XP=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}(),ZP=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}(),eI=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},tI=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];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 r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=pP({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=O({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},i),this.app=new YP(this.options,t,!0),CP.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,_P(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}(),nI="modern",oI=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[nI]},iI=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];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 r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=pP({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=O({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},i),this.app=new YP(this.options,t,!0,a),CP.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,_P(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 aI(e,t){return aI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},aI(e,t)}function rI(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&&aI(e,t)}function lI(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 sI(e){return sI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},sI(e)}function cI(){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 uI(e,t,n){return uI=cI()?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&&aI(i,n.prototype),i},uI.apply(null,arguments)}function dI(e){var t="function"==typeof Map?new Map:void 0;return dI=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 uI(e,arguments,sI(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),aI(n,e)},dI(e)}function yI(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=sI(e);if(t){var i=sI(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return lI(this,n)}}var fI=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new YP(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){rI(n,e);var t=yI(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=UP(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=UP(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=UP(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=UP(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=UP(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=UP(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}(dI(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 XP},AdminPortalRenderer:function(){return tI},AppHolder:function(){return E},CheckoutDialog:function(){return ZP},FronteggApp:function(){return YP},HostedLogin:function(){return QP},LoginBoxRenderer:function(){return iI},createElement:function(){return UP},defaultTheme:function(){return nI},formatName:function(){return RP},getThemeAdminByName:function(){return eI},getThemeByName:function(){return oI},initialize:function(){return fI},mockFlagsList:function(){return JP},waitThemeSetter:function(){return _P}});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 Od},addUsersToGroup:function(){return Dd},createGroup:function(){return Id},deleteGroup:function(){return Ed},deleteRolesFromGroup:function(){return wd},deleteUsersFromGroup:function(){return Cd},getGroupById:function(){return kd},getGroupConfiguration:function(){return Rd},getGroups:function(){return Td},getGroupsByIds:function(){return Pd},updateGroup:function(){return Ld},updateGroupConfiguration:function(){return Ud}});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},GroupManagedByEnum:function(){return zd},GroupRelations:function(){return Bd},ISubscriptionCancellationPolicy:function(){return td},ISubscriptionStatus:function(){return Zu},MFAStrategyEnum:function(){return Nd},MachineToMachineAuthStrategy:function(){return Er},PaymentMethodType:function(){return ed},ProviderType:function(){return nd},RestrictionType:function(){return $n},ScimConnectionSource:function(){return Kd},SecondaryAuthStrategy:function(){return _d},SocialLoginProviders:function(){return Ir},TenantType:function(){return $d},UserManagedByEnum:function(){return Fd},WebAuthnDeviceType:function(){return Md},api:function(){return qd},countConfigurationUsers:function(){return md},createConfiguration:function(){return vd},default:function(){return Hd},deleteConfiguration:function(){return hd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Gd},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 $P},DomainRestrictionsTabFields:function(){return KP},GeneralSettingsTabFields:function(){return WP},InviteUserModalFields:function(){return FP},IpRestrictionsTabFields:function(){return jP},Metadata:function(){return CP},PrivacyPageFields:function(){return NP},ProfilePageFields:function(){return MP},SecurityPageTabs:function(){return xP},SessionManagementTabFields:function(){return VP},SsoPageTabs:function(){return BP},SubscriptionsPageFields:function(){return GP},alpha:function(){return AP},fieldAppearance:function(){return zP},tabAppearance:function(){return qP}});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={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},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(){var e;this._flags={},this._flags=null!=(e=yd.flags)?e:{}}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,t){const n=this.getInstance(t);return e.map((e=>"on"===(null==n?void 0:n._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t;this._flags=O({},null!=(t=null==yd?void 0:yd.flags)?t:{},null!=e?e:{})}}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,t){return ya(`${Oa.getByIds.v1}`,e,{params:t})}async function Id(e){return ya(`${Oa.v1}`,e)}async function Ld(e){let{groupId:t}=e,n=Ao(e,Ad);return fa(`${Oa.v1}/${t}`,n)}async function Ed(e){return ga(`${Oa.v1}/${e}`)}async function Od(e,t){return ya(`${Oa.v1}/${e}/roles`,t)}async function wd(e,t){return ga(`${Oa.v1}/${e}/roles`,t)}async function Dd(e,t){return ya(`${Oa.v1}/${e}/users`,t)}async function Cd(e,t){return ga(`${Oa.v1}/${e}/users`,t)}async function Rd(){return da(`${Oa.configurations.v1}`)}async function Ud(e){return ya(`${Oa.configurations.v1}`,e)}let _d,Md,Nd,Fd,$d;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(_d||(_d={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Md||(Md={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Nd||(Nd={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Fd||(Fd={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}($d||($d={}));const Gd=[/^(.*)\/logout$/g,"/logout",/^\/identity\/resources\/auth\/v[0-9]*\/user\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/passwordless\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/webauthn\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/token\/refresh$/g,/^\/identity\/resources\/users\/v[0-9]*$/g,/^\/identity\/resources\/users\/v[0-9]*\/signUp$/g,/^\/identity\/resources\/users\/v[0-9]*\/activate$/g,/^\/identity\/resources\/users\/v[0-9]*\/invitation\/accept$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/verify$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/[^\/]*\/[^\/]*\/verify$/g,/^\/oauth\/token$/g,/^\/oauth\/authorize\/silent$/g],xd=`${ha.v1}/user/token/refresh`,Vd=`${za}/authorize/silent`,Wd=`${ma.v2}/me`,jd=`${ma.v2}/me/tenants`;let Kd,Bd,zd;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Kd||(Kd={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Bd||(Bd={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(zd||(zd={}));const qd={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 Hd={fetch:e,ContextHolder:ra,FronteggContext:la,api:qd,FronteggApiError:sa,AuthStrategyEnum:Lr,MachineToMachineAuthStrategy:Er,SocialLoginProviders:Ir,ISubscriptionCancellationPolicy:td,ISubscriptionStatus:Zu,PaymentMethodType:ed,ProviderType:nd};let Jd,Yd;function Qd(e,t){const n=O({},e);return t.forEach((e=>{delete n[e]})),n}async function Xd(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 Zd(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"}(Jd||(Jd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Yd||(Yd={}));const ey=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n}));function*ty(e){const t=yield di((e=>e.root.appName));return fd.getFeatureFlags(e,t)}const ny={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},oy=O({},ny,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),iy=[{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"}],ay={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},ry=O({},ay,{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}),ly={loading:!1,error:void 0,saving:!0,profile:ay},sy={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"},cy={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Lr.EmailAndPassword,machineToMachineAuthStrategy:Er.ClientCredentials},uy={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},dy={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},yy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},fy={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},py={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},gy=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Sy={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:fy,roles:gy,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},vy=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],hy={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:[iy[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[iy[0]],managedBy:zd.FRONTEGG}]},my={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:[iy[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[iy[0]],managedBy:zd.FRONTEGG}]},by={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Ay=[my,hy],ky=[by],Ty=[{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}],Py=[{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"}],Iy={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Ly={isActive:!0,strategy:$n.ALLOW},Ey=[{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"}],Oy=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(O({},my,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},wy=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"}),Dy=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Oy(6),roles:[wy("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:zd.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Oy(44),roles:[wy("Editor")],managedBy:zd.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Oy(8),roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Oy(5),roles:[wy("Admin")],managedBy:zd.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Oy(21),description:"BDR, AE, and inside sales",roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Oy(23),description:"Dev success and customer success",roles:[wy("Admin")],managedBy:zd.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Oy(10),description:"The marketing department",roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Oy(4),description:"Human resources",roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Oy(3),roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Oy(8),roles:[wy("Editor")],managedBy:zd.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Oy(4),roles:[wy("Viewer")],managedBy:zd.FRONTEGG}];let Cy,Ry,Uy;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Cy||(Cy={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Ry||(Ry={})),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"}(Uy||(Uy={})),Uy.profile,Uy.privacy,Uy.personalApiTokens,Uy.account,Uy.users,Uy.groups,Uy.security,Uy.sso,Uy.audits,Uy.webhooks,Uy.apiTokens,Uy.roles,Uy.subscriptions;const _y=["events","url"];function*My(){yield ai(lo.setSignUpState({loading:!0}));try{const e=yield si(qd.auth.getVendorConfig),[t]=(yield si(qd.auth.getVendorPublicAuthStrategiesConfig),yield si(ty,["admin_portal_login_per_tenant"]));if(t){const t=yield si(qd.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*Ny(e){let{payload:{events:t,url:n}}=e,o=Ao(e.payload,_y);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(qd.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:Ry.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(ra.setAccessToken(null==l?void 0:l.accessToken),ra.setUser(l),!r&&l&&Jf(l)){const t=yield Xf(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*Fy(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield di((e=>e.auth.signUpState));yield ai(lo.resetSignUpState()),yield ai(lo.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*$y(){yield aa(lo.signUpUser,Ny),yield aa(lo.resetSignUpStateSoft,Fy)}const Gy={setVendorState:(e,{payload:t})=>O({},e,t)},xy={loadVendorPublicInfo:rt("vendor/loadVendorPublicInfo")},Vy={loading:!1},{reducer:Wy,actions:jy}=st({name:Dt,initialState:Vy,reducers:O({},Gy)}),Ky=O({},jy,xy);function*By(){yield ai(Ky.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield qd.vendor.getVendorPublicInfo();yield ai(Ky.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield ai(Ky.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const zy=["callback"],qy=["callback"],Hy=["callback"],Jy=["callback"],Yy=["callback"],Qy=["callback"];function*Xy(){yield ai(lo.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield si(qd.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*Zy(){yield ai(lo.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorConfig),[t]=yield si(ty,["admin_portal_login_per_tenant"]);if(t){const t=yield si(qd.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*ef(){yield ai(lo.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorPublicAuthStrategiesConfig);yield ai(lo.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*tf(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield si(qd.auth.getMfaPolicy);yield ai(lo.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*nf(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorMfaPolicy);yield ai(lo.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*of(e){let{payload:{callback:t}}=e,n=Ao(e.payload,zy);yield ai(lo.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield si(qd.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*af(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield si(qd.auth.getLockoutPolicy);yield ai(lo.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*rf(e){let{payload:{callback:t}}=e,n=Ao(e.payload,qy);yield ai(lo.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield si(qd.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*lf(){yield ai(lo.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorLockoutPolicy);yield ai(lo.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*sf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield si(qd.auth.getCaptchaPolicy);yield ai(lo.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*cf(){yield ai(lo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield si(qd.auth.getPasswordHistoryPolicy);yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*uf(){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorPasswordHistoryPolicy);yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*df(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Hy);yield ai(lo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield si(qd.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*yf(){yield ai(lo.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield si(qd.auth.getPasswordConfigPolicy);yield ai(lo.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*ff(){yield aa(lo.loadSecurityPolicy,Xy),yield oa(lo.saveSecurityPolicyMfa,of),yield oa(lo.loadSecurityPolicyMfa,tf),yield oa(lo.loadSecurityPolicyVendorMfa,nf),yield oa(lo.saveSecurityPolicyLockout,rf),yield oa(lo.loadSecurityPolicyLockout,af),yield oa(lo.loadSecurityPolicyVendorLockout,lf),yield oa(lo.loadSecurityPolicyCaptcha,sf),yield oa(lo.saveSecurityPolicyPasswordHistory,df),yield oa(lo.loadSecurityPolicyPasswordHistory,cf),yield oa(lo.loadSecurityPolicyVendorPasswordHistory,uf),yield oa(lo.loadVendorPasswordConfig,yf),yield oa(lo.loadPublicSecurityPolicy,Zy),yield oa(lo.loadPublicAuthStrategiesPolicy,ef)}function*pf(){yield ai(lo.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield ai(lo.setSecurityPolicyPublicState({policy:cy,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*gf(){yield ai(lo.setSecurityPolicyGlobalState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyGlobalState({policy:sy,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*Sf(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyMfaState({policy:uy,loading:!1}))}function*vf(){yield ai(lo.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorMfaState({policy:uy,loading:!1}))}function*hf(e){var t;let{payload:{callback:n}}=e,o=Ao(e.payload,Jy);yield ai(lo.setSecurityPolicyMfaState({saving:!0,error:null}));const i=O({},dy,{id:null!=(t=o.id)?t:dy.id,enforceMFAType:o.enforceMFAType});yield vt(),yield ai(lo.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*mf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyLockoutState({policy:dy,loading:!1}))}function*bf(){yield ai(lo.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorLockoutState({policy:dy,loading:!1}))}function*Af(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Yy);yield ai(lo.setSecurityPolicyLockoutState({saving:!0,error:null})),yield vt();const o=O({},dy,n,{id:n.id?n.id:dy.id});null==t||t(o),yield ai(lo.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*kf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyLockoutState({policy:dy,loading:!1}))}function*Tf(){yield ai(lo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:yy,loading:!1}))}function*Pf(){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({policy:yy,loading:!1}))}function*If(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Qy);yield ai(lo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield vt();const o=O({},yy,n,{id:n.id?n.id:yy.id});null==t||t(o),yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*Lf(){yield aa(lo.loadSecurityPolicy,gf),yield oa(lo.loadPublicSecurityPolicy,pf),yield oa(lo.saveSecurityPolicyMfa,hf),yield oa(lo.loadSecurityPolicyMfa,Sf),yield oa(lo.loadSecurityPolicyVendorMfa,vf),yield oa(lo.saveSecurityPolicyLockout,Af),yield oa(lo.loadSecurityPolicyLockout,mf),yield oa(lo.loadSecurityPolicyVendorLockout,bf),yield oa(lo.loadSecurityPolicyCaptcha,kf),yield oa(lo.saveSecurityPolicyPasswordHistory,If),yield oa(lo.loadSecurityPolicyPasswordHistory,Tf),yield oa(lo.loadSecurityPolicyVendorPasswordHistory,Pf)}const Ef=["callback"],Of=["callback"],wf=["callback"],Df=["callback"],Cf=["callback","events"],Rf=["callback"],Uf=["callback"],_f=["callback"],Mf=["callback"],Nf=["callback"],Ff=["callback"],$f=["callback"],Gf=["callback"],xf=["callback"],Vf=["callback","deviceId"],Wf=["callback","deviceId"],jf=["callback","deviceId"],Kf=["callback","deviceId"],Bf={[Lr.Code]:kt.loginWithOtc,[Lr.EmailAndPassword]:kt.loginWithPassword,[Lr.MagicLink]:kt.magicLinkPreLoginSuccess,[Lr.SmsCode]:kt.loginWithSmsOtc};function*zf(){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*qf(){let e;try{var t;const n=yield si(qd.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*Hf(){try{const{isActive:e}=yield si(qd.auth.getSSOPublicConfiguration);yield ai(lo.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const Jf=e=>e.mfaRequired&&e.mfaToken?(ra.setAccessToken(null),ra.setUser(null),!0):(ra.setAccessToken(e.accessToken),ra.setUser(e),!1),Yf=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},Qf=e=>{if(1===e.length){const[t]=e;if(t===Nd.AuthenticatorApp)return nn.authenticatorApp;if(t===Nd.SMS)return nn.smsSetPhoneNumber}return nn.verify};function*Xf(e){let t=kt.loginWithTwoFactor,n={};const{loginState:o}=yield di((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield si(qd.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Yf(e.mfaDevices)}:(n={step:Qf(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*Zf(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*ep(){const{hostedLoginBox:e}=yield di((e=>e.auth));e?yield si(tp):yield si(op)}function*tp(){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(qd.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*np(){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(qd.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*op(){try{const t=ra.onRedirectTo,{routes:n,loginState:o}=yield di((e=>e.auth)),{user:i,tenants:a}=yield si(qd.auth.refreshTokenV2);if(Jf(i)){const e=yield Xf(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 Zf(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 ap(n)}}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:void 0,isAuthenticated:!1}))}}function*ip(){try{const t=ra.onRedirectTo,{routes:n,loginState:o}=yield di((e=>e.auth)),{user:i,tenants:a}=yield si(qd.auth.refreshTokenV2);if(Jf(i)){const e=yield Xf(i);yield ai(lo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield si(Sp))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 Zf(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 ap(n)}}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:void 0,isAuthenticated:!1}))}}function*ap(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 zf())}function*rp({payload:{callback:e}}){try{const{ip:t}=yield si(qd.metadata.getCurrentUserIpMetadata);yield ai(lo.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*lp({payload:e}){const t=[];e&&(yield ai(lo.setState({isLoading:!0})),yield ai(lo.loadSocialLoginsConfigurationV2()),t.push(si(My)),t.push(si(ef)),t.push(si(Hf)),t.push(si(By)),t.push(si(qf))),t.push(si(ep)),yield ri(t),yield ai(lo.setState({isLoading:!1}))}function*sp({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(Jf(t)){const e=yield Xf(t);yield ai(lo.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*cp({payload:e}){const t=[];yield ai(lo.loadSocialLoginsConfigurationV2()),t.push(si(My)),t.push(si(Hf)),t.push(si(By)),t.push(si(qf)),t.push(si(sp,e)),yield ri(t)}function*up({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(qd.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=Zd(),r=Zd(),l=yield si(Xd,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*dp({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(qd.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 zf()}}function*yp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Ef);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(qd.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*fp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Of);try{yield ai(lo.setLoginState({loading:!0})),yield si(qd.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*pp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,wf);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(qd.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*gp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Df);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(qd.auth.passwordlessPreLogin,n),a=Bf[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*Sp(){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===_d.Passkeys))))(t),o="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield si(ty,["show-passkeys"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield si(qd.auth.getWebAuthnDevices);return yield ai(lo.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*vp(e){let{payload:{callback:t,events:n}}=e,o=Ao(e.payload,Cf);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(qd.auth.passwordlessPostLogin,o),a=ra.onRedirectTo,{routes:r}=yield di((e=>e.auth));if(Jf(e)){const t=yield Xf(e);yield ai(lo.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield di((e=>e.auth)),l=yield si(qd.auth.generateLoginResponse,e);var i;e.emailVerified&&(null==n||null==(i=n.userVerified)||i.call(n,{email:l.email,origin:Cy.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(Sp))?(yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield ai(lo.setState({isAuthenticated:!0})),yield zf()):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*hp({payload:e}){try{yield ai(lo.setLoginState({loading:!0}));const{name:t}=yield si(qd.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*mp({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(qd.auth.preLoginV2,{email:e});if(a){let e=a;if(r===Yd.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 bp({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield bp({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*bp(e){let{callback:t}=e,n=Ao(e,Rf);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*Ap({payload:{callback:e}}){try{yield ai(lo.setLoginState({loading:!0}));const{options:t}=yield si(qd.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*kp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Uf);try{yield ai(lo.setLoginState({loading:!0}));const e=At(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?Md.Platform:Md.CrossPlatform;yield si(qd.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*Tp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,_f);try{var o;yield ai(lo.setPasskeysState({loading:!0})),yield ai(lo.setLoginState({loading:!0}));const{options:e}=yield si(qd.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*Pp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Mf);try{var o;yield ai(lo.setPasskeysState({loading:!0})),yield ai(lo.setLoginState({loading:!0}));const e=At(n.publicKey),i=yield si(qd.auth.webAuthnPostLogin,O({},e,{response:O({},e.response,{userHandle:null!=(o=e.response.userHandle)?o:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(Jf(i)){const e=ra.onRedirectTo,{routes:t}=yield di((e=>e.auth)),n=yield Xf(i);yield ai(lo.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield si(qd.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 zf(),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*Ip({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(qd.auth.postLogin,e);ra.setAccessToken(t.accessToken),ra.setUser(t),yield ai(lo.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield zf()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield ai(lo.setLoginState({step:kt.loginWithSSOFailed,loading:!1}))}}function*Lp({payload:{email:e,password:t,recaptchaToken:n,invitationToken:o,callback:i}}){yield ai(lo.setLoginState({loading:!0}));try{const a=yield si(qd.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(Jf(a)){const e=yield Xf(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(Sp))?(yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})),r(l.loginUrl,{preserveQueryParams:!0})):yield zf())}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*Ep({payload:{mfaToken:e,value:t,rememberDevice:n,callback:o}}){yield ai(lo.setLoginState({loading:!0}));try{const i=yield si(qd.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(Sp))?yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})):yield zf()),null==o||o(!0)}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1})),null==o||o(!1,e)}}function*Op({payload:e}){yield ai(lo.setLoginState({loading:!0}));try{var t;yield si(qd.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*wp({payload:e}){const{hostedLoginBox:t}=yield di((e=>e.auth));yield ai(lo.setState({isLoading:!0}));try{t?yield si(qd.auth.OAuthLogout):yield si(qd.auth.logout)}catch{}yield ai(lo.resetState()),yield ai(lo.requestAuthorize(!0)),null==e||e()}function*Dp({payload:e}){var t;try{yield si(qd.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*Cp({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*Rp({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(Sp);o===nn.smsVerifyCode&&e?yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})):yield zf()}yield ai(lo.setState({isAuthenticated:!0}))}function*Up(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Nf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.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*_p(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Ff);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.auth.enrollMFASMSForLogin,n),o=yield si(qd.auth.generateLoginResponseV2,e);yield Cp(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*Mp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,$f);yield ai(lo.setLoginState({loading:!0}));try{var o;const e=yield si(qd.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*Np(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Gf);yield ai(lo.setLoginState({loading:!0}));try{const e=At(n.publicKey),o=yield si(qd.auth.enrollMFAWebAuthnForLogin,O({},n,{options:e})),i=yield si(qd.auth.generateLoginResponseV2,o);yield Cp(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*Fp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,xf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.auth.enrollMFAAuthenticatorAppForLogin,n),o=yield si(qd.auth.generateLoginResponseV2,e);yield Cp(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*$p(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Vf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.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*Gp(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Wf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.auth.verifyMFASMSForLogin,n,o),i=yield si(qd.auth.generateLoginResponseV2,e);yield Rp(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*xp(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,jf);yield ai(lo.setLoginState({loading:!0}));try{var i;const e=yield si(qd.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*Vp(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Kf);yield ai(lo.setLoginState({loading:!0}));try{const e=At(o.publicKey),i=yield si(qd.auth.verifyMFAWebAuthnForLogin,n,O({},o,{options:e})),a=yield si(qd.auth.generateLoginResponseV2,i);yield Rp(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*Wp(){yield aa(lo.requestAuthorize,lp),yield aa(lo.requestAuthorizeSSR,cp),yield aa(lo.requestHostedLoginAuthorize,up),yield aa(lo.handleHostedLoginCallback,dp),yield aa(lo.preLogin,mp),yield aa(lo.postLogin,Ip),yield aa(lo.login,Lp),yield aa(lo.logout,wp),yield aa(lo.silentLogout,Dp),yield aa(lo.loginWithMfa,Ep),yield aa(lo.recoverMfa,Op),yield aa(lo.quickSmsPasswordlessPreLogin,pp),yield aa(lo.changePhoneNumberWithVerification,yp),yield aa(lo.verifyChangePhoneNumber,fp),yield aa(lo.passwordlessPreLogin,gp),yield aa(lo.passwordlessPostLogin,vp),yield aa(lo.verifyInviteToken,hp),yield aa(lo.webAuthnPrelogin,Tp),yield aa(lo.webAuthnPostLogin,Pp),yield aa(lo.webAuthnCreateNewDeviceSession,Ap),yield aa(lo.webAuthnVerifyNewDeviceSession,kp),yield aa(lo.afterAuthNavigation,zf),yield aa(lo.getUserIP,rp),yield aa(lo.preEnrollMFASMSForLogin,Up),yield aa(lo.enrollMFASMSForLogin,_p),yield aa(lo.preEnrollMFAWebAuthnForLogin,Mp),yield aa(lo.enrollMFAWebAuthnForLogin,Np),yield aa(lo.enrollMFAAuthenticatorAppForLogin,Fp),yield aa(lo.preVerifyMFASMSForLogin,$p),yield aa(lo.verifyMFASMSForLogin,Gp),yield aa(lo.preVerifyMFAWebAuthnForLogin,xp),yield aa(lo.verifyMFAWebAuthnForLogin,Vp)}function*jp({payload:e}){e&&(yield ai(lo.setState({isLoading:!0})));const t=ry;yield ai(lo.loadTenants()),yield ai(lo.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Kp({payload:{callback:e}}){try{const{ip:t}=Ey[0];yield ai(lo.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Bp(){yield aa(lo.requestAuthorize,jp),yield aa(lo.afterAuthNavigation,zf),yield aa(lo.getUserIP,Kp)}const zp=["callback","samlVendor"],qp=["callback","samlVendor"];function*Hp(){try{var e,t;yield ai(lo.setSSOState({loading:!0}));const n=yield si(qd.auth.getSamlConfiguration),o=yield si(qd.auth.getOidcConfiguration),i=yield si(qd.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*Jp({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 ey(e[0]),i=yield si(qd.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*Yp({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 ey(t),a=yield si(qd.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*Qp({payload:e}){const{callback:t,samlVendor:n}=e,o=Ao(e,zp),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===Yd.Saml){var l,s;const e=yield si(qd.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=Qd(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(qd.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*Xp({payload:{callback:e}={}}){const t=yield di((e=>e.auth.ssoState.samlConfiguration));try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(qd.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*Zp(){try{const e=yield si(qd.auth.getSamlRoles),t=yield si(qd.auth.getSamlRolesGroups);yield ai(lo.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield ai(lo.setSSOState({error:e.message}))}}function*eg({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(qd.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield ri(e.map((e=>si(qd.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield ai(lo.setSSOState({error:e.message}))}}(n)),yield Zp(),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*tg({payload:{callback:e,id:t}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(qd.auth.deleteSamlGroup,{id:t}),yield Zp(),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*ng({payload:{group:e,roleIds:t,callback:n}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(qd.auth.createSamlGroup,{group:e,roleIds:t}),yield Zp(),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*og({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield ai(lo.setSSOState({loading:!0})),yield si(qd.auth.oidcPostLoginV2,t),yield si(ep),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*ig(){yield oa(lo.loadSSOConfigurations,Hp),yield oa(lo.saveSSOConfigurations,Qp),yield oa(lo.saveSSOConfigurationsFile,Jp),yield oa(lo.saveSSOConfigurationsFileWithCallback,Yp),yield oa(lo.validateSSODomain,Xp),yield oa(lo.loadSSOAuthorizationRoles,Zp),yield oa(lo.updateSSOAuthorizationRoles,eg),yield oa(lo.deleteSamlGroup,tg),yield oa(lo.createSamlGroup,ng),yield oa(lo.oidcPostlogin,og)}function*ag(){yield ai(lo.setSSOState({loading:!0})),yield vt(),yield ai(lo.setSSOState({samlConfiguration:fy,loading:!1,firstLoad:!1}))}function*rg({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*lg({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Ao(e,qp),r=Sy.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==py||null==(t=py.configuration)?void 0:t.acsUrl,l.spEntityId=null==py||null==(n=py.configuration)?void 0:n.spEntityId;const c=Qd(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*sg({payload:{callback:e}={}}){const t=Sy.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*cg(){yield vt(),yield ai(lo.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*ug({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*dg(){yield oa(lo.loadSSOConfigurations,ag),yield oa(lo.saveSSOConfigurations,lg),yield oa(lo.saveSSOConfigurationsFile,rg),yield oa(lo.validateSSODomain,sg),yield oa(lo.loadSSOAuthorizationRoles,cg),yield oa(lo.updateSSOAuthorizationRoles,ug)}const yg=["callback"],fg=["callback","ssoConfigId"],pg=["callback","ssoConfigId"];function*gg(){try{return yield si(qd.auth.getOidcConfiguration)}catch(e){return null}}function*Sg(){try{return yield si(qd.metadata.getSamlMetadata)}catch(e){return null}}function*vg(){try{yield ai(lo.setSSOLoader({key:Jd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield ri([si(gg),si(Sg)]),n=yield si(qd.auth.getSSOConfigurations);yield ai(lo.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield ai(lo.setSSOError({key:Jd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield ai(lo.setSSOLoader({key:Jd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*hg({payload:e}){yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ao(e,yg),o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield si(qd.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:Jd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*mg({payload:e}){yield ai(lo.setSSOLoader({key:Jd.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 ey(t),i=yield si(qd.auth.createSSOConfigurationByMetadata,{metadata:e});yield ai(lo.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield ai(lo.setSSOError({key:Jd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*bg({payload:e}){yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Ao(e,fg),i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield si(qd.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:Jd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Ag({payload:e}){yield ai(lo.setSSOLoader({key:Jd.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 ey(o),a=yield si(qd.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:Jd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*kg({payload:e}){yield ai(lo.setSSOLoader({key:Jd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(qd.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:Jd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Tg({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Ao(e,pg);yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield si(qd.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:Jd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_DOMAIN,value:!1}))}}function*Pg({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield ai(lo.setSSOLoader({key:Jd.DELETE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(qd.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:Jd.DELETE_SSO_DOMAIN,value:e.message})),null==o||o(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.DELETE_SSO_DOMAIN,value:!1}))}}function*Ig({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield ai(lo.setSSOLoader({key:Jd.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(qd.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:Jd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Lg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(qd.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:Jd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Eg({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_GROUPS,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield ri(t.map((e=>si(qd.auth.deleteSSOGroup,n,e)))),yield ri(e.map((e=>si(qd.auth.createSSOGroup,n,e))));const a=yield si(qd.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:Jd.SAVE_SSO_GROUPS,value:e.message})),null==o||o(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_GROUPS,value:!1}))}}function*Og({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield ri(t.map((t=>si(qd.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield ai(lo.setSSOError({key:Jd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_GROUPS,value:!1}))}}function*wg(){yield oa(lo.loadSSOConfigurationsV2,vg),yield oa(lo.saveSSOConfigurationV2,hg),yield oa(lo.saveSSODomain,Tg),yield oa(lo.deleteSSODomain,Pg),yield oa(lo.validateSSODomainV2,Ig),yield oa(lo.updateSSOConfiguration,bg),yield oa(lo.deleteSSOConfiguration,kg),yield oa(lo.setSSOGroups,Eg),yield oa(lo.updateSSOGroups,Og),yield oa(lo.setSSODefaultRoles,Lg),yield oa(lo.saveSSOConfigurationByMetadata,mg),yield oa(lo.updateSSOConfigurationByMetadata,Ag)}const Dg=["callback","profilePictureUrl"],Cg=["callback","profilePictureUrl"];function*Rg(){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,qd.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*Ug(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ao(e.payload,Dg);yield ai(lo.setProfileState({saving:!0,error:null,loading:!0}));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(qd.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(qd.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,loading:!1})),null==t||t(a)}catch(e){yield ai(lo.setProfileState({saving:!1,error:e.message,loading:!1})),null==t||t(null,e)}}function*_g({payload:e}){yield ai(lo.setProfileState({loading:!0}));try{var t;yield si(qd.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*Mg(){yield aa(lo.loadProfile,Rg),yield oa(lo.saveProfile,Ug),yield oa(lo.changePassword,_g)}function*Ng(){yield ai(lo.setProfileState({loading:!0})),yield vt(),yield ai(lo.setUser(O({},ry,ay))),yield ai(lo.setProfileState({loading:!1,profile:ay}))}function*Fg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ao(e.payload,Cg);yield ai(lo.setProfileState({saving:!0,error:null}));const i=ly;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=ry;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*$g({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*Gg(){yield aa(lo.loadProfile,Ng),yield oa(lo.saveProfile,Fg),yield oa(lo.changePassword,$g)}const xg=["callback"],Vg=["callback"],Wg=["callback"],jg=["deviceId","callback"],Kg=["deviceId","callback"],Bg=["callback"],zg=["deviceId"],qg=["deviceId"],Hg=["callback"],Jg=["deviceId"],Yg=["callback"];function*Qg(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*Xg(){yield ai(lo.setMfaState({saving:!0}));try{const{qrCode:e}=yield si(qd.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*Zg(e){let{payload:{callback:t}}=e,n=Ao(e.payload,xg);yield ai(lo.setMfaState({saving:!0}));try{const e=yield di((e=>e.auth.user)),o=yield si(qd.auth.verifyMfa,n),i=yield si(qd.auth.getMFADevices),a=yield Qg(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*eS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Vg);yield ai(lo.setMfaState({loading:!0}));try{const e=yield si(qd.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*tS({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t;yield si(qd.auth.disableMfa,e);const n=yield si(qd.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*nS({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t,n;const o=yield si(qd.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*oS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Wg);yield ai(lo.setMfaState({saving:!0}));try{const e=At(n.publicKey),o=yield si(qd.auth.enrollMFAWebAuthn,O({},n,{options:e})),i=yield si(qd.auth.getMFADevices),a=yield Qg(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*iS(e){let{payload:{deviceId:t,callback:n}}=e;Ao(e.payload,jg),yield ai(lo.setMfaState({saving:!0}));try{var o;const e=yield si(qd.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*aS(e){let{payload:{deviceId:t,callback:n}}=e,o=Ao(e.payload,Kg);yield ai(lo.setMfaState({saving:!0}));try{const e=At(o.publicKey);yield si(qd.auth.disableMFAWebAuthn,t,O({},o,{options:e}));const i=yield si(qd.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*rS({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t;const n=yield si(qd.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*lS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Bg);yield ai(lo.setMfaState({saving:!0}));try{const e=yield si(qd.auth.enrollMFASMS,n),o=yield si(qd.auth.getMFADevices),i=yield Qg(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*sS(e){let{payload:{deviceId:t}}=e,n=Ao(e.payload,zg);yield ai(lo.setMfaState({saving:!0}));try{var o;const e=yield si(qd.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*cS(e){let{payload:{deviceId:t}}=e,n=Ao(e.payload,qg);yield ai(lo.setMfaState({saving:!0}));try{var o;yield si(qd.auth.disableMFASMS,t,n);const e=yield si(qd.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*uS(){yield ai(lo.setMfaState({loading:!0}));try{yield di((e=>e.auth.user));const e=yield si(qd.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*dS(){yield ai(lo.setMfaState({loading:!0}));try{const e=(yield si(qd.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*yS(){yield oa(lo.enrollMfa,Xg),yield oa(lo.getMFADevices,uS),yield oa(lo.getMFAStrategies,dS),yield oa(lo.verifyMfa,Zg),yield oa(lo.disableMfa,tS),yield oa(lo.verifyMfaAfterForce,eS),yield oa(lo.preDisableMfaSms,sS),yield oa(lo.disableMfaSms,cS),yield oa(lo.preEnrollMfaSms,rS),yield oa(lo.enrollMfaSms,lS),yield oa(lo.preEnrollMfaWebAuthn,nS),yield oa(lo.enrollMfaWebAuthn,oS),yield oa(lo.preDisableMfaWebAuthn,iS),yield oa(lo.disableMfaWebAuthn,aS)}function*fS(){yield ai(lo.setMfaState({saving:!0})),yield ai(lo.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*pS({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({},ry,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*gS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Hg);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({},ry,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}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({saving:!1,error:void 0,mfaDevices:O({},n,{authenticators:[]})})),yield ai(lo.setUser(O({},ry))),null==(t=e.callback)||t.call(e,!0)}function*vS(e){let{}=e,t=Ao(e.payload,Jg);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*hS({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({},ry))),null==(t=e.callback)||t.call(e,!0)}function*mS({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*bS(e){let{payload:{callback:t}}=e;Ao(e.payload,Yg);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({},ry,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*AS(){yield oa(lo.enrollMfa,fS),yield oa(lo.verifyMfa,pS),yield oa(lo.disableMfa,SS),yield oa(lo.verifyMfaAfterForce,gS),yield oa(lo.preDisableMfaSms,vS),yield oa(lo.disableMfaSms,hS),yield oa(lo.preEnrollMfaSms,mS),yield oa(lo.enrollMfaSms,bS)}const kS=["callback"];function*TS({payload:e}){yield ai(lo.setForgotPasswordState({loading:!0}));try{var t;yield si(qd.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*PS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,kS);yield ai(lo.setForgotPasswordState({loading:!0}));try{yield si(qd.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*IS({payload:e}){yield ai(lo.setForgotPasswordState({loading:!0}));try{const t=yield si(qd.auth.loadPasswordConfig,e);yield ai(lo.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield ai(lo.setForgotPasswordState({loading:!1,error:e.message}))}}function*LS(){yield aa(lo.forgotPassword,TS),yield aa(lo.resetPassword,PS),yield aa(lo.loadPasswordConfig,IS)}let ES;!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"}(ES||(ES={}));const OS=["callback","events"],wS=["callback"],DS=["callback"];function*CS({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(qd.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*RS(e){let{payload:{callback:t,events:n}}=e,o=Ao(e.payload,OS);yield ai(lo.setActivateState({loading:!0}));try{const e=ra.onRedirectTo,{routes:a}=yield di((e=>e.auth)),r=yield si(qd.auth.activateAccount,o);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(Jf(r)){yield ai(lo.setActivateState({step:_t.success}));const t=yield Xf(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(qd.auth.generateLoginResponseV2,r);null==n||null==(i=n.userVerified)||i.call(n,{email:e.email,origin:Cy.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 zf(),yield ai(lo.resetActivateState())}null==t||t(!0)}catch(e){yield ai(lo.setActivateState({loading:!1,error:e.message}))}}function*US({payload:e}){const{callback:t}=e,n=Ao(e,wS);yield ai(lo.setActivateStrategyState({loading:!0}));try{const e=yield si(qd.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*_S({payload:e}){const{callback:t}=e,n=Ao(e,DS);yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:n.email})),yield ai(lo.setActivateState({loading:!0}));try{yield si(qd.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:ES.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:!1}))}function*MS(){yield aa(lo.activateAccount,RS),yield aa(lo.preActivateAccount,CS),yield aa(lo.getActivateAccountStrategy,US),yield aa(lo.resendActivationEmail,_S)}function*NS({payload:e}){if(e.token&&e.userId)try{yield ai(lo.setAcceptInvitationState({error:void 0,step:$t.pending})),yield si(qd.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*FS(){yield aa(lo.acceptInvitation,NS)}var $S,GS=new Uint8Array(16);function xS(){if(!$S&&!($S="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 $S(GS)}for(var VS=/^(?:[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,WS=function(e){return"string"==typeof e&&VS.test(e)},jS=[],KS=0;KS<256;++KS)jS.push((KS+256).toString(16).substr(1));var BS=function(e,t,n){var o=(e=e||{}).random||(e.rng||xS)();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=(jS[e[t+0]]+jS[e[t+1]]+jS[e[t+2]]+jS[e[t+3]]+"-"+jS[e[t+4]]+jS[e[t+5]]+"-"+jS[e[t+6]]+jS[e[t+7]]+"-"+jS[e[t+8]]+jS[e[t+9]]+"-"+jS[e[t+10]]+jS[e[t+11]]+jS[e[t+12]]+jS[e[t+13]]+jS[e[t+14]]+jS[e[t+15]]).toLowerCase();if(!WS(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let zS,qS;!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"}(zS||(zS={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(qS||(qS={}));const HS=["callback"],JS=["roles"],YS=["callback"],QS=["callback","profileImage"],XS=["callback"],ZS=["callback","userId"],ev=["callback"],tv=["callback"],nv=["callback"],ov=["callback"],iv=["callback"],av=["callback"],rv=["callback"],lv=["callback","profileImage"],sv=["callback"],cv=["callback"],uv=["callback"],dv=["callback"],yv=["callback"],fv=["callback"],pv=()=>di((e=>e.auth.teamState));function*gv(){try{const{groups:e}=yield si(qd.groups.getGroups,{_groupsRelations:qS.roles});return e}catch(e){return[]}}function*Sv({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield pv(),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:ES.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},a]=yield ri([si(qd.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),si(qd.teams.loadAvailableRoles),si(qd.teams.loadAvailablePermissions),si(gv)]),l=e.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>a.filter((t=>t.id===e.id)))).flat();return O({},e,{groups:n})}));yield ai(lo.setTeamState({users:l,totalPages:t,totalItems:n,roles:o,permissions:i})),null==r||r(e)}catch(e){yield ai(lo.setTeamError({key:ES.USERS,value:e.message})),yield ai(lo.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield ai(lo.setTeamLoader({key:ES.USERS,value:!1}))}function*vv({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield pv(),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:ES.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(qd.subTenants.loadAllUsers,O({},c)),si(qd.teams.loadAvailableRoles),si(qd.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:ES.USERS,value:e.message})),yield ai(lo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield ai(lo.setTeamLoader({key:ES.USERS,value:!1}))}function*hv({payload:e}){yield ai(lo.setTeamLoader({key:ES.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield ri([si(qd.teams.loadAvailableRoles),si(qd.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:ES.ROLES_AND_PERMISSIONS,value:t.message}))}yield ai(lo.setTeamLoader({key:ES.ROLES_AND_PERMISSIONS,value:!0}))}function*mv({payload:e}){const{callback:t}=e,n=Ao(e,HS),o=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield si(qd.teams.addUser,n),{roles:a}=e,r=O({},Ao(e,JS),{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*bv({payload:e}){const{callback:t}=e,n=yield pv();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(qd.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*Av({payload:e}){const{callback:t}=e,n=Ao(e,YS),o=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})}));try{yield si(qd.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield si(qd.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*kv({payload:e}){const{callback:t}=e,n=Ao(e,QS),{id:o}=n,i=yield pv(),a=i.users.find((e=>e.id===n.id));yield ai(lo.setTeamLoader({key:ES.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(qd.teams.updateUser,n);null==t||t(e),yield ai(lo.setTeamState({users:i.users.map((t=>t.id===e.id?O({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield ai(lo.setTeamLoader({key:ES.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:ES.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*Tv({payload:e}){const{callback:t}=e,n=Ao(e,XS),o=yield pv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})}));try{yield si(qd.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*Pv({payload:e}){const{callback:t,userId:n}=e,o=Ao(e,ZS),i=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0})}));try{yield si(qd.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*Iv({payload:e}){const{callback:t}=e,n=Ao(e,ev),o=yield pv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})}));try{yield si(qd.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*Lv({payload:e}){const{callback:t}=e,n=Ao(e,tv);yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield si(qd.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:!1}))}function*Ev({payload:e}){const{callback:t}=e,n=Ao(e,nv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email}));try{yield si(qd.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Ov({payload:e}){const{callback:t}=e,n=Ao(e,ov);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email}));try{yield si(qd.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*wv({payload:e}){const{callback:t}=e,n=Ao(e,iv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email}));try{yield si(qd.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Dv(){yield ai(lo.setTeamError({key:ES.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield si(qd.teams.getInviteLinkConfiguration);yield ai(lo.setTeamState({inviteTokenState:O({},e)}))}catch(e){yield ai(lo.setTeamError({key:ES.CONFIG_TOKEN_LINK,value:e.message}))}}function*Cv(){yield ai(lo.setTeamError({key:ES.GET_TOKEN_LINK,value:!1}));try{yield si(Dv);const e=yield si(qd.teams.getInviteUserLink),{inviteTokenState:t}=yield pv();yield ai(lo.setTeamState({inviteTokenState:O({},t,e)}))}catch(e){yield ai(lo.setTeamError({key:ES.GET_TOKEN_LINK,value:e.message}))}}function*Rv({payload:{callback:e}}){yield ai(lo.setTeamError({key:ES.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield pv();try{const n=yield si(qd.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:ES.CREATE_TOKEN_LINK,value:t.message}))}}function*Uv({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield pv();yield ai(lo.setTeamError({key:ES.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield si(qd.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:ES.UPDATE_TOKEN_LINK,value:t.message}))}}function*_v({payload:e}){const{callback:t}=null!=e?e:{};yield ai(lo.setTeamError({key:ES.DELETE_TOKEN_LINK,value:!1}));try{yield si(qd.teams.deleteInviteUserLink),yield ai(lo.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Mv({payload:e}){yield ai(lo.setTeamState({addUserDialogState:O({open:!0,loading:!1,error:!1},e)}))}function*Nv({payload:e}){const t=yield pv(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield ai(lo.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Fv({payload:e}){yield ai(lo.setTeamState({deleteUserDialogState:O({open:!0,loading:!1,error:!1},e)}))}function*$v({payload:e}){const t=yield pv(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield ai(lo.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Gv(){yield ia(lo.loadUsers,Sv),yield ia(lo.loadAllSubTenantsUsers,vv),yield ia(lo.loadRoles,hv),yield oa(lo.addUser,mv),yield oa(lo.addUsersBulk,bv),yield oa(lo.addUserToSubTenants,Av),yield oa(lo.updateUser,kv),yield oa(lo.setUserRolesForSubTenants,Pv),yield oa(lo.deleteUser,Tv),yield oa(lo.deleteUserFromSubTenants,Iv),yield oa(lo.resendActivationLink,Lv),yield oa(lo.resendInvitationLink,Ev),yield oa(lo.resendInvitationEmail,Ov),yield oa(lo.resendInvitationLinkToAllSubTenants,wv),yield oa(lo.getInvitationLink,Cv),yield oa(lo.createInvitationLink,Rv),yield oa(lo.updateInvitationLink,Uv),yield oa(lo.deleteInvitationLink,_v),yield oa(lo.openAddUserDialog,Mv),yield oa(lo.closeAddUserDialog,Nv),yield oa(lo.openDeleteUserDialog,Fv),yield oa(lo.closeDeleteUserDialog,$v)}function*xv({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield pv(),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:ES.USERS,value:!a})),yield ai(lo.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield vt(),yield ai(lo.setTeamState({users:Ay,totalPages:2,totalItems:10,roles:gy,permissions:vy})),yield ai(lo.setTeamLoader({key:ES.USERS,value:!1})),null==r||r(Ay)}function*Vv({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield pv(),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:ES.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:ky,totalPages:2,totalItems:10,roles:gy,permissions:vy})),yield ai(lo.setTeamLoader({key:ES.USERS,value:!1})),null==l||l(ky)}function*Wv({payload:e}){var t;yield ai(lo.setTeamLoader({key:ES.ROLES_AND_PERMISSIONS,value:!0})),yield vt(),yield ai(lo.setTeamState({roles:gy,permissions:vy})),yield ai(lo.setTeamLoader({key:ES.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:gy,permissions:vy})}function*jv({payload:e}){const{callback:t}=e,n=Ao(e,av),o=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})})),yield vt();const i=O({},my,{groups:[]},n,{id:`${BS()}`});null==t||t(i),yield ai(lo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*Kv({payload:e}){const{callback:t}=e,n=Ao(e,rv),o=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})})),yield vt();const i=O({},my,n,{id:`${BS()}`});yield ai(lo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*Bv({payload:e}){var t;const{callback:n}=e,o=Ao(e,lv),{id:i}=o,a=yield pv(),r=a.users.find((e=>e.id===o.id));yield ai(lo.setTeamLoader({key:ES.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:ES.UPDATE_USER,value:!1}))}function*zv({payload:e}){const{callback:t}=e,n=Ao(e,sv),o=yield pv();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*qv({payload:e}){const{callback:t}=e,n=Ao(e,cv),o=yield pv();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*Hv({payload:e}){const{callback:t}=e,n=Ao(e,uv);yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:n.userId})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:!1}))}function*Jv({payload:e}){const{callback:t}=e,n=Ao(e,dv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Yv({payload:e}){const{callback:t}=e,n=Ao(e,yv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Qv({payload:e}){const{callback:t}=e,n=Ao(e,fv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Xv(){yield ia(lo.loadUsers,xv),yield ia(lo.loadAllSubTenantsUsers,Vv),yield ia(lo.loadRoles,Wv),yield oa(lo.addUser,jv),yield oa(lo.addUserToSubTenants,Kv),yield oa(lo.updateUser,Bv),yield oa(lo.deleteUser,zv),yield oa(lo.deleteUserFromSubTenants,qv),yield oa(lo.resendActivationLink,Hv),yield oa(lo.resendInvitationLink,Jv),yield oa(lo.resendInvitationEmail,Yv),yield oa(lo.resendInvitationLinkToAllSubTenants,Qv),yield oa(lo.openAddUserDialog,Mv),yield oa(lo.closeAddUserDialog,Nv),yield oa(lo.openDeleteUserDialog,Fv),yield oa(lo.closeDeleteUserDialog,$v)}const Zv=["authorizationUrl"],eh=["events","url"];function*th(){try{yield ai(lo.setSocialLoginsState({loading:!0}));const e=yield si(qd.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*nh(){try{const e=yield di((e=>e.root.context));yield ai(lo.setSocialLoginsState({loading:!0}));const t=yield si(qd.auth.getSocialLoginProvidersV2),{providers:n}=yield si(qd.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Ao(t,Zv);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*oh(e){let{payload:{events:t,url:n}}=e,o=Ao(e.payload,eh);try{yield ai(lo.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield si(qd.auth.loginViaSocialLogin,o);var i,a;r&&(null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,url:n,authenticationType:Ry.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:o.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:Cy.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(np):yield si(ip)}(),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*ih({payload:e}){yield ai(lo.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*ah(){yield aa(lo.loadSocialLoginsConfiguration,th),yield aa(lo.loadSocialLoginsConfigurationV2,nh),yield aa(lo.loginViaSocialLogin,oh),yield ia(lo.setSocialLoginError,ih)}let rh;function*lh({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:rh.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield si(qd.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield si(qd.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:rh.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield ai(lo.setApiTokensError({key:rh.ADD_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:rh.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*sh({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:rh.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield si(qd.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield si(qd.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:rh.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield ai(lo.setApiTokensError({key:rh.ADD_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:rh.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*ch({payload:e}){const{apiTokensDataUser:t}=yield di((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!0})),n?(yield si(qd.auth.deleteUserAccessToken,{id:e}),yield ai(lo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield si(qd.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:rh.DELETE_API_TOKEN,value:!1}))}catch(e){yield ai(lo.setApiTokensError({key:rh.DELETE_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!1}))}}function*uh({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:rh.DELETE_API_TOKEN,value:!0})),n?(yield si(qd.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield si(qd.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:rh.DELETE_API_TOKEN,value:!1}))}catch(e){yield ai(lo.setApiTokensError({key:rh.DELETE_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!1}))}}function*dh({payload:e}){null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield ri([si(qd.auth.getUserApiTokensData),si(qd.auth.getTenantApiTokensData)]);yield ai(lo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setApiTokensError({key:rh.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*yh({payload:e}){null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=si(qd.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=si(qd.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:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield ai(lo.setApiTokensError({key:rh.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*fh({payload:e}){null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=si(qd.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=si(qd.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:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield ai(lo.setApiTokensError({key:rh.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*ph(){yield aa(lo.loadApiTokens,dh),yield aa(lo.loadUserApiTokens,yh),yield aa(lo.loadTenantApiTokens,fh),yield oa(lo.addUserApiToken,lh),yield oa(lo.addTenantApiToken,sh),yield ia(lo.deleteTenantApiToken,uh),yield ia(lo.deleteUserApiToken,ch)}function*gh({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield ai(lo.setApiTokensLoader({key:rh.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield di((e=>e.auth.apiTokensState)),a=O({},oy,{description:t,roleIds:n,clientId:`CLIENT_ID_${BS()}`});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:rh.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*Sh({payload:e}){yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!0})),yield yi(200);const t=[oy];yield ai(lo.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!1}))}function*vh({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));const n=[ny],o=[oy];yield ai(lo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield yi(200),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*hh({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));const n=[ny];yield ai(lo.setApiTokensState({apiTokensDataUser:n})),yield yi(200),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*mh({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));const n=[oy];yield ai(lo.setApiTokensState({apiTokensDataTenant:n})),yield yi(200),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*bh(){yield aa(lo.loadApiTokens,vh),yield aa(lo.loadUserApiTokens,hh),yield aa(lo.loadTenantApiTokens,mh),yield oa(lo.addTenantApiToken,gh),yield ia(lo.deleteTenantApiToken,Sh)}function*Ah({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(qd.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*kh({payload:e}){yield ai(lo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield si(qd.accountSettings.getSettings);yield ai(lo.setAccountSettingsState(O({},e,{loading:!1})))}catch(e){yield ai(lo.setAccountSettingsState({loading:!1,error:e.message}))}}function*Th(){yield aa(lo.saveAccountSettings,Ah),yield aa(lo.loadAccountSettings,kh)}function*Ph({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*Ih({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*Lh(){yield aa(lo.saveAccountSettings,Ph),yield aa(lo.loadAccountSettings,Ih)}function*Eh({payload:{tenantId:e,callback:t}}){yield ai(lo.setState({isLoading:!0}));try{yield si(qd.tenants.switchTenant,{tenantId:e}),yield si(ep),(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*Oh({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(qd.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*wh({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(qd.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*Dh({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(qd.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*Ch(){yield oa(lo.loadTenants,Oh),yield oa(lo.loadSubTenants,wh),yield oa(lo.switchTenant,Eh),yield oa(lo.loadSubTenantsTree,Dh)}function*Rh(){yield ai(lo.setTenantsState({loading:!0})),yield vt(),yield ai(lo.setTenantsState({tenants:Ty,loading:!1}))}function*Uh(){yield oa(lo.loadTenants,Rh)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(rh||(rh={}));const _h=["callback"],Mh=["callback"],Nh=["callback"],Fh=["callback"],$h=["callback"];function*Gh({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(qd.roles.getRoles),si(qd.roles.getPermissions),si(qd.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*xh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,_h);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(qd.roles.addRole,n),o=yield si(qd.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*Vh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Mh);yield ai(lo.setRolesState({saving:!0}));try{yield si(qd.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*Wh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Nh);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(qd.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*jh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Fh);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(qd.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*Kh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,$h);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(qd.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*Bh(){yield aa(lo.loadRolesAndPermissions,Gh),yield oa(lo.addRole,xh),yield oa(lo.deleteRole,Vh),yield oa(lo.updateRole,Wh),yield oa(lo.attachPermissionsToRole,jh),yield oa(lo.attachPermissionToRoles,Kh)}function*zh({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:iy,loading:!1}))}catch(e){yield ai(lo.setRolesState({error:e.message,loading:!1}))}}function*qh(){yield aa(lo.loadRolesAndPermissions,zh)}const Hh=["callback"],Jh=["callback"],Yh=["callback"];function*Qh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Hh);yield ai(lo.setResetPhoneNumberState({loading:!0}));try{const e=yield si(qd.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*Xh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Jh);yield ai(lo.setResetPhoneNumberState({loading:!0}));try{const e=yield si(qd.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*Zh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Yh);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(qd.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*em(){yield aa(lo.resetPhoneNumber,Qh),yield aa(lo.verifyResetPhoneNumber,Xh),yield aa(lo.changePhoneNumber,Zh)}function*tm(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{const e=yield si(qd.auth.getCurrentUserSessions);yield ai(lo.setSessionsState({sessions:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*nm(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{const e=yield si(qd.auth.getCurrentUserSession);yield ai(lo.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*om({payload:{id:e}}){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(qd.auth.deleteSessionForUser,e),yield ai(lo.loadUserSessions())}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*im({payload:{callback:e,userId:t}}){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(qd.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield ai(lo.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*am(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(qd.auth.deleteAllSessionsForUser),yield ai(lo.loadUserSessions())}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*rm(){yield ia(lo.loadUserSessions,tm),yield ia(lo.deleteUserSession,om),yield ia(lo.deleteAllUserSessions,am),yield ia(lo.loadCurrentUserSession,nm),yield oa(lo.revokeUserSessions,im)}function*lm(){yield ai(lo.setSessionsState({loading:!0,error:null})),yield ai(lo.setSessionsState({sessions:Py,loading:!1}))}function*sm({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*cm(){yield ai(lo.setSessionsState({loading:!0,error:null}));const e=Py.filter((e=>e.current));yield ai(lo.setSessionsState({sessions:e,loading:!1}))}function*um(){yield ia(lo.loadUserSessions,lm),yield ia(lo.deleteUserSession,sm),yield ia(lo.deleteAllUserSessions,cm)}const dm=["callback"],ym=["callback"];function*fm(){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield si(qd.auth.getSessionConfigurations);yield ai(lo.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*pm({payload:e}){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ao(e,dm);yield si(qd.auth.createOrUpdateSessionConfigrations,n),yield ai(lo.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield ai(lo.setSessionsPolicyState({error:e,loading:!1}))}}function*gm(){yield aa(lo.loadSessionsPolicy,fm),yield ia(lo.createOrUpdateSessionsPolicy,pm)}function*Sm(){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:Iy}));yield ai(lo.setSessionsPolicyState(O({},e,{loading:!1})))}function*vm({payload:e}){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ao(e,ym);null==t||t(!0),yield ai(lo.setSessionsPolicyState({configurations:n,loading:!1}))}function*hm(){yield aa(lo.loadSessionsPolicy,Sm),yield ia(lo.createOrUpdateSessionsPolicy,vm)}const mm=["callback"],bm=["callback"],Am=["callback"],km=["callback"],Tm=["callback"],Pm=["callback"],Im=["callback"],Lm=["callback"],Em=()=>di((e=>e.auth.restrictionsState.ipRestrictions)),Om=()=>di((e=>e.auth.restrictionsState.emailDomainRestrictions));function*wm(){yield ai(lo.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield si(qd.auth.getDomainRestrictionsConfig),t=(yield si(qd.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*Dm(e){let{payload:{callback:t}}=e,n=Ao(e.payload,mm);yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield Om();try{var i;yield si(qd.auth.createDomainRestriction,n);const e=(yield si(qd.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*Cm(e){let{payload:{callback:t}}=e,n=Ao(e.payload,bm);yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield si(qd.auth.updateDomainRestrictionConfig,n),o=(yield si(qd.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*Rm({payload:{id:e}}){yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Om();try{var n;yield si(qd.auth.deleteDomainRestriction,e);const o=(yield si(qd.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 Um=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*_m(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Em(),t=yield si(qd.auth.getIPRestrictionsConfig),n=Um({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield si(qd.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*Mm(){try{const{valid:e}=yield si(qd.auth.testCurrentIpInAllowList);yield ai(lo.setIpRestrictionsState({userIpValid:e}))}catch(e){yield ai(lo.setIpRestrictionsState({error:e.message}))}}function*Nm({payload:{callback:e}}){yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield di((e=>e.auth.userIp));yield ri([si(qd.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:$n.ALLOW}),si(qd.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield Em(),o=Um(n.pagination),{items:i,_metadata:{totalPages:a}}=yield si(qd.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*Fm(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Am);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const o=yield Em();try{var i,a;yield si(qd.auth.createIPRestriction,n);const e=yield Em(),r=Um(e.pagination),{items:l,_metadata:{totalPages:s}}=yield si(qd.auth.getIPRestrictions,r);yield Mm(),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*$m(e){let{payload:{callback:t}}=e,n=Ao(e.payload,km);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));try{yield si(qd.auth.updateIPRestrictionConfig,n);const e=yield Em(),o=yield si(qd.auth.getIPRestrictionsConfig),i=Um(O({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield si(qd.auth.getIPRestrictions,i);yield Mm(),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*Gm({payload:{id:e,callback:t}}){yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const n=yield Em();try{var o;yield si(qd.auth.deleteIPRestriction,e);const i=yield Em(),a=Um(i.pagination),{items:r,_metadata:{totalPages:l}}=yield si(qd.auth.getIPRestrictions,a);yield Mm(),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*xm(){yield aa(lo.loadIpRestrictions,_m),yield aa(lo.loadEmailDomainRestrictions,wm),yield oa(lo.saveIpRestriction,Fm),yield oa(lo.saveIpRestrictionsConfig,$m),yield oa(lo.deleteIpRestriction,Gm),yield oa(lo.checkIfUserIpValid,Mm),yield oa(lo.addCurrentUserIpAndActivate,Nm),yield oa(lo.saveEmailDomainRestriction,Dm),yield oa(lo.saveEmailDomainRestrictionsConfig,Cm),yield oa(lo.deleteEmailDomainRestriction,Rm)}function*Vm(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null})),yield ai(lo.setIpRestrictionsState({data:{restrictions:Ey.filter((e=>e.strategy===Ly.strategy)),config:Ly},totalPages:1,pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Wm(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Em(),t=Ey[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*jm(e){var t,n,o;let{payload:{callback:i}}=e,a=Ao(e.payload,Tm);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const r=yield Em(),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:BS(),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*Km(e){var t,n,o;let{payload:{callback:i}}=e,a=Ao(e.payload,Pm);const r=yield Em();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*Bm({payload:{id:e,callback:t}}){var n;yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const o=yield Em();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*zm(){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*qm(e){var t,n;let{payload:{callback:o}}=e,i=Ao(e.payload,Im);const a=yield Om();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*Hm(e){var t;let{payload:{callback:n}}=e,o=Ao(e.payload,Lm);const i=yield Om();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*Jm({payload:{id:e}}){var t,n;const o=yield Om();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*Ym(){yield aa(lo.loadIpRestrictions,Vm),yield aa(lo.loadEmailDomainRestrictions,zm),yield oa(lo.saveIpRestriction,jm),yield oa(lo.saveIpRestrictionsConfig,Km),yield oa(lo.deleteIpRestriction,Bm),yield oa(lo.checkIfUserIpValid,Wm),yield oa(lo.saveEmailDomainRestriction,qm),yield oa(lo.saveEmailDomainRestrictionsConfig,Hm),yield oa(lo.deleteEmailDomainRestriction,Jm)}const Qm=["callback"],Xm=["id"];function*Zm(e){const{count:t}=yield si(qd.directory.countConfigurationUsers,e.id);return O({},e,{count:t})}function*eb(){yield ai(lo.setProvisioningState({loading:!0,error:null}));try{const e=yield si(qd.directory.getConfigs),t=yield ri(e.map((e=>Zm(e))));yield ai(lo.setProvisioningState({connections:t,loading:!1}))}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1}))}}function*tb(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Qm);yield ai(lo.setProvisioningState({loading:!0,error:null}));try{const e=yield si(qd.directory.createConfiguration,n),o=yield si(qd.directory.getConfigs),i=yield ri(o.map((e=>Zm(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*nb(e){let{payload:{id:t}}=e,n=Ao(e.payload,Xm);yield ai(lo.setProvisioningState({loading:!0,error:null}));try{yield si(qd.directory.updateConfiguration,t,n);const e=yield si(qd.directory.getConfigs),o=yield ri(e.map((e=>Zm(e))));yield ai(lo.setProvisioningState({connections:o,loading:!1}))}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1}))}}function*ob({payload:{id:e,callback:t}}){yield ai(lo.setProvisioningState({loading:!0,error:null}));try{yield si(qd.directory.deleteConfiguration,e);const n=yield si(qd.directory.getConfigs),o=yield ri(n.map((e=>Zm(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*ib(){yield aa(lo.loadProvisionConnections,eb),yield oa(lo.createProvisionConnection,tb),yield oa(lo.deleteProvisionConnection,ob),yield oa(lo.updateProvisionConnection,nb)}const ab=["callback","events"];function*rb(e){let{payload:{callback:t}}=e,n=Ao(e.payload,ab);yield ai(lo.setImpersonateState({loading:!0}));try{yield si(qd.impersonate.impersonate,n),yield ai(lo.setImpersonateState({step:to.success})),yield yi(1e3),yield zf(),yield ai(lo.resetImpersonateState()),null==t||t(!0)}catch(e){yield ai(lo.setImpersonateState({loading:!1,error:e.message}))}}function*lb(){yield aa(lo.impersonate,rb)}function*sb({payload:e}){const{callback:t,deviceId:n}=e;yield ai(lo.setPasskeysState({loading:!0}));try{yield si(qd.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*cb(){yield ai(lo.setPasskeysState({loading:!0}));try{const{devices:e}=yield si(qd.auth.getWebAuthnDevices);yield ai(lo.setPasskeysState({devices:e,loading:!1}))}catch(e){yield ai(lo.setPasskeysState({loading:!1,error:e.message||null}))}}function*ub(){yield oa(lo.loadWebAuthnDevices,cb),yield oa(lo.deleteWebAuthnDevice,sb)}const db=["roleIds","userIds"],yb=()=>di((e=>e.auth.groupsState));function*fb({payload:e}){const t=zS.GET_TEAM_USERS;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield si(qd.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*pb({payload:e}){const t=zS.GET_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield si(qd.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:qS.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*gb(){const e=zS.GET_GROUPS,t=yield yb();yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield si(qd.groups.getGroups,{_groupsRelations:qS.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*Sb({payload:e}){const t=zS.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Ao(e,db);yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield si(qd.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*vb({payload:e}){const t=zS.UPDATE_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.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*hb({payload:e}){const t=zS.DELETE_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.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*mb({payload:e}){const t=zS.ADD_ROLES_TO_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.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*bb({payload:e}){const t=zS.DELETE_ROLES_FROM_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.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*Ab({payload:e}){const t=zS.ADD_USERS_TO_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.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*kb({payload:e}){const t=zS.DELETE_USERS_FROM_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.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*Tb(){const e=zS.GET_GROUP_CONFIGURATION;yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield si(qd.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*Pb({payload:e}){const t=zS.UPDATE_GROUP_CONFIGURATION;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{yield si(qd.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*Ib(){yield ia(lo.loadGroups,gb),yield ia(lo.getGroupById,pb),yield ia(lo.createGroup,Sb),yield ia(lo.updateGroup,vb),yield ia(lo.deleteGroup,hb),yield ia(lo.addRolesToGroup,mb),yield ia(lo.deleteRolesFromGroup,bb),yield ia(lo.addUsersToGroup,Ab),yield ia(lo.deleteUsersFromGroup,kb),yield ia(lo.getGroupConfiguration,Tb),yield ia(lo.updateGroupConfiguration,Pb),yield ia(lo.getTeamUsers,fb)}function*Lb(){const e=zS.GET_GROUPS;yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));const t=Dy;yield ai(lo.setGroupsState({groups:t})),yield ai(lo.setUsersGroupsLoader({key:e,value:!1}))}function*Eb({payload:e}){var t;const n=zS.CREATE_GROUP,{groups:o}=yield yb();yield ai(lo.setUsersGroupsLoader({key:n,value:!0})),yield ai(lo.setGroupsState({groups:[O({},e,{id:`${e.name}ID`,managedBy:zd.FRONTEGG}),...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*Ob({payload:e}){var t,n,o,i,a;const r=zS.UPDATE_GROUP,l=yield yb();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:"",managedBy:zd.FRONTEGG}):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*wb({payload:e}){var t,n;const o=zS.DELETE_GROUP,i=yield yb();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*Db({payload:e}){var t,n;const o=zS.ADD_ROLES_TO_GROUP,i=yield yb();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*Cb({payload:e}){var t,n;const o=zS.DELETE_ROLES_FROM_GROUP,i=yield yb();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*Rb({payload:e}){var t,n;const o=zS.ADD_USERS_TO_GROUP,i=yield yb();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*Ub({payload:e}){var t,n;const o=zS.DELETE_USERS_FROM_GROUP,i=yield yb();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*_b(){const e=zS.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield yb();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*Mb({payload:e}){const t=zS.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield yb();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*Nb(){yield ia(lo.loadGroups,Lb),yield ia(lo.createGroup,Eb),yield ia(lo.updateGroup,Ob),yield ia(lo.deleteGroup,wb),yield ia(lo.addRolesToGroup,Db),yield ia(lo.deleteRolesFromGroup,Cb),yield ia(lo.addUsersToGroup,Rb),yield ia(lo.deleteUsersFromGroup,Ub),yield ia(lo.getGroupConfiguration,_b),yield ia(lo.updateGroupConfiguration,Mb)}var Fb={sagas:function*(){yield ri([si(Wp),si(MS),si(FS),si(LS),si(em),si(ig),si(wg),si(Mg),si(yS),si(Gv),si(Ib),si(ah),si($y),si(ph),si(ff),si(Th),si(Ch),si(Bh),si(rm),si(gm),si(xm),si(ib),si(lb),si(ub)])},mockSagas:function*(){yield ri([si(Bp),si(dg),si(Gg),si(AS),si(Xv),si(bh),si(Lf),si(um),si(Lh),si(Uh),si(hm),si(Ym),si(qh),si(Nb)])},storeName:Et,initialState:eo,reducer:ao,actions:lo};const $b=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>O({},t,{[e]:O({},t[e],n)})}),Gb={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},xb={setAuditLogsState:$b("auditLogsState"),resetAuditLogsState:e=>O({},e,{auditLogsState:Gb})},Vb={exportAuditsCsv:rt("auditLogs/exportAuditsCsv"),loadAuditLogs:rt("auditLogs/loadAuditLogs",(e=>({payload:e})))},Wb={loading:!0},jb={setAuditsMetadataState:$b("auditsMetadataState"),resetAuditsMetadataState:e=>O({},e,{auditsMetadataState:Wb})},Kb={loadAuditsMetadata:rt("auditLogs/loadAuditsMetadata")},Bb={auditLogsState:Gb,auditsMetadataState:Wb},{reducer:zb,actions:qb}=st({name:wt,initialState:Bb,reducers:O({resetState:e=>O({},e,Bb),setState:(e,{payload:t})=>O({},e,t)},xb,jb)}),Hb=O({},qb,Vb,Kb),Jb=e=>"createdAt"!==e.id,Yb={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`})))},Qb={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}]},Xb=()=>di((e=>e.auditLogs.auditLogsState)),Zb=()=>di((e=>e.auditLogs.auditsMetadataState));function*eA(){const e=yield Xb(),{columns:t}=yield Zb();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(Hb.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield qd.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(Hb.setAuditLogsState({isDownloadingCsv:!1}))}function*tA({payload:e}){yield ai(Hb.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Xb(),{columns:n}=yield Zb();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(Hb.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(Hb.loadAuditsMetadata()));const{data:p,total:g}=yield si(qd.audits.getAudits,O({offset:c,count:s},y,f));yield ai(Hb.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(Hb.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*nA(){yield oa(Hb.exportAuditsCsv,eA),yield oa(Hb.loadAuditLogs,tA)}function*oA({payload:e}){yield ai(Hb.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Xb(),{columns:n}=yield Zb();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(Hb.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield ai(Hb.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=Yb;let o=n.filter((e=>t=>e.filter(Jb).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(Hb.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(Hb.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*iA(){yield oa(Hb.loadAuditLogs,oA)}function*aA(){yield ai(Hb.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield si(qd.metadata.getAuditsMetadata);yield ai(Hb.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ai(Hb.setAuditsMetadataState({error:e,loading:!1}))}}function*rA(){yield oa(Hb.loadAuditsMetadata,aA)}function*lA(){yield ai(Hb.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Qb;yield ai(Hb.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ai(Hb.setAuditsMetadataState({error:e,loading:!1}))}}function*sA(){yield oa(Hb.loadAuditsMetadata,lA)}var cA={sagas:function*(){yield ri([si(nA),si(rA)])},mockSagas:function*(){yield ri([si(iA),si(sA)])},storeName:wt,initialState:Bb,reducer:zb,actions:Hb};const uA={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:dA,actions:yA,reducer:fA}=st({name:"audits",initialState:uA,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]})))}}}),pA=O({},yA,{initData:rt(`${dA}/initData`),loadAudits:rt(`${dA}/loadAudits`),removeFilter:rt(`${dA}/removeFilter`),filterData:rt(`${dA}/filterData`),exportCSV:rt(`${dA}/exportCSV`),deleteAudits:rt(`${dA}/deleteAudits`)}),gA=()=>di((e=>e[dA]));function*SA(){const{sortBy:e,sortDirection:t}=yield gA();try{const n=yield si(qd.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield ai(pA.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield ai(pA.loadItemFailedAction(t))}}function*vA(){try{const e=yield si(qd.metadata.getAuditsMetadata);yield ai(pA.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield ai(pA.loadItemFailedAction(t))}}const hA=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*mA({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield gA(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield gA():{rowsData:[]};try{const e=hA(t),{data:l,total:d}=yield si(qd.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(pA.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield ai(pA.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield ai(pA.loadItemFailedAction(t))}}function*bA(){yield ai(pA.startLoading()),yield ri([SA(),vA(),mA({payload:{onlyOneLoad:!1},type:""})]),yield ai(pA.finishLoading())}function*AA({payload:e}){const{filters:t}=yield gA(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield ai(pA.setFilterData(o))}function*kA({payload:e}){const{filters:t}=yield gA();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(pA.setFilterData(o))}function*TA(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield gA(),a=hA(e);yield ai(pA.startDownloadingCsv());try{yield qd.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(pA.stopDownloadingCsv())}}function*PA(){yield ia(pA.initData,bA),yield ia(pA.removeFilter,AA),yield ia(pA.filterData,kA),yield ia([pA.loadAudits,pA.textSearch,pA.onPageChange],mA),yield ia([pA.setFilterData,pA.setDataSorting,pA.startRefresh],(()=>mA({payload:{appendMode:!1},type:""}))),yield ia(pA.exportCSV,TA)}const IA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},LA={initData:()=>O({},IA),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)})}},EA={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}})))},OA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:wA,actions:DA}=st({name:Ot,initialState:OA,reducers:O({},LA)}),CA=O({},DA,EA),RA={slack:qd.connectivity.getSlackConfiguration,email:qd.connectivity.getEmailConfiguration,sms:qd.connectivity.getSMSConfiguration,webhook:qd.connectivity.getWebhooksConfigurations,categories:qd.connectivity.getCategories,channelMap:qd.connectivity.getChannelMaps},UA={slack:qd.connectivity.postSlackConfiguration,email:qd.connectivity.postEmailConfiguration,sms:qd.connectivity.postSMSConfiguration,webhook:qd.connectivity.postWebhooksConfiguration},_A=["email","slack","sms","webhook"],MA={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"}},NA=["id"],FA=["id","enabled"],$A=["categories","channelMap"];function*GA(e){return yield si(VA,{payload:{api:e},type:""})}function*xA({payload:e=_A}){yield ai(CA.setConnectivityState({isLoading:!0}));try{const t=yield ri([...e.map(GA),yield VA({payload:{api:"categories"},type:""}),yield function*(){return(yield ri(e.map((function*(e){return yield VA({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>O({},t,{[`${e[o]}`]:n})),{})}()]),n=yield VA({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:MA[e[i]].events(o),active:MA[e[i]].isActive(o),platform:MA[e[i]].title,image:MA[e[i]].image}]}):n:O({},n,{[`${$A[i-e.length]}`]:o})),{list:[],webhook:n});yield ai(CA.setConnectivityState(O({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield ai(CA.setConnectivityState({isLoading:!1}))}}function*VA({payload:{api:e,params:t}}){try{return yield si(RA[e],t)}catch(e){return}}function*WA(){try{yield ai(CA.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield si(qd.connectivity.getSlackChannels);yield ai(CA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield ai(CA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*jA(e,t){const{connectivity:{list:n}}=yield di(),o=n.find((({key:t})=>t===e));if(!o)return;const i=MA[e].isActive(t);i!==o.active&&(yield ai(CA.setConnectivityState({list:n.map((t=>t.key===e?O({},t,{active:i}):t))})))}function*KA({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield di((e=>e.connectivity));try{if(yield ai(CA.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,NA);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(UA.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield si(qd.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?qd.connectivity.postEmailConfiguration:qd.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,FA);return yield ri([yield si("email"===t?qd.connectivity.patchEmailConfiguration:qd.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield si("email"===t?qd.connectivity.putEmailSubscriptions:qd.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?qd.connectivity.deleteEmailSubscriptions:qd.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield VA({payload:{api:t},type:""});yield ai(CA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield jA(t,e)}else yield ai(CA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield si(UA[e],t),!["sms","email"].includes(e)){const i=yield VA({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield ai(CA.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield jA(e,i),null==n||n(!0)}}catch(e){var i;yield ai(CA.setConnectivityState({error:null!=(i=e.message)?i:e.toString(),isSaving:!1,isLoading:!1}))}}function*BA({payload:e}){try{yield qd.connectivity.postSlackCode(e)}catch{}yield ai(CA.setConnectivityState({error:void 0,isSaving:!1}))}function*zA(){const{slackChannels:e}=yield di((e=>e.connectivity));try{yield ai(CA.setConnectivityState({slackChannels:O({},e,{isLoadingScope:!0})}));const{clientId:t}=yield si(qd.connectivity.getSlackScope);yield ai(CA.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield ai(CA.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*qA({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield di((e=>e.connectivity));try{yield ai(CA.setConnectivityState({isSaving:!0})),yield si(qd.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const i=yield VA({payload:{api:"webhook"},type:""});i&&(yield ai(CA.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*HA({payload:e}){try{yield ai(CA.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield si(qd.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield ai(CA.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield ai(CA.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield ai(CA.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*JA({payload:e}){try{const{statusCode:t}=yield si(qd.connectivity.postWebhookRetry,e);yield ai(CA.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield ai(CA.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*YA({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield di((e=>e.connectivity));try{yield ai(CA.setConnectivityState({webhookLogs:O({},o,{isLoading:!0})}));const i=yield si(qd.connectivity.getWebhookLog,e,n,t);yield ai(CA.setConnectivityState({error:void 0,webhookLogs:O({isLoading:!1},i)}))}catch(e){yield ai(CA.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var QA={sagas:function*(){yield oa(CA.loadDataAction,xA),yield ia(CA.loadSlackActions,WA),yield oa(CA.postDataAction,KA),yield oa(CA.postCodeAction,BA),yield oa(CA.loadScope,zA),yield oa(CA.deleteWebhookConfigAction,qA),yield oa(CA.postWebhookTestAction,HA),yield oa(CA.postWebhookRetryAction,JA),yield ia(CA.loadWebhookLogsAction,YA)},storeName:Ot,initialState:OA,reducer:wA,actions:CA};function XA(){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 ZA(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>O({},n,{[e]:t(n[e],o)})}}function ek(e){return ZA(e,((e,t)=>O({},e,{loading:t.payload})))}function tk(e){return ZA(e,((e,t)=>O({},e,{error:t.payload,loading:!1})))}const nk={loading:!1,error:null,fetching:!0,plans:[]},{actions:ok,reducer:ik,name:ak}=st({name:"subscriptions/plans",initialState:nk,reducers:O({},XA())}),rk=O({loadPlans:rt(`${ak}/loadPlans`)},ok),lk={loading:!1,error:null,fetching:!0,config:null},sk=O({},XA()),{actions:ck,reducer:uk,name:dk}=st({name:"subscriptions/config",initialState:lk,reducers:sk}),yk=O({loadPaymentConfiguration:rt(`${dk}/loadPaymentConfiguration`)},ck),fk={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},pk=O({},XA(),{setCancellationLoading:ek("cancellation"),setCancellationError:tk("cancellation"),setRenewalLoading:ek("renewal"),setRenewalError:tk("renewal")}),{reducer:gk,actions:Sk,name:vk}=st({name:"subscriptions/billing/subscription",initialState:fk,reducers:pk}),hk=O({load:rt(`${vk}/loadSubscription`),cancelSubscription:rt(`${vk}/cancelSubscription`),renewSubscription:rt(`${vk}/renewSubscription`)},Sk),mk={loading:!1,error:null,fetching:!0},bk=O({},XA()),{reducer:Ak,actions:kk,name:Tk}=st({name:"subscriptions/billing/information",initialState:mk,reducers:bk}),Pk=O({loadBillingInformation:rt(`${Tk}/loadBillingInformation`),cancelSubscription:hk.cancelSubscription,renewSubscription:hk.renewSubscription},kk),Ik={loading:!1,error:null,fetching:!0},Lk=O({},XA(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,t.payload)}}),{reducer:Ek,actions:Ok,name:wk}=st({name:"subscriptions/billing/payment",initialState:Ik,reducers:Lk}),Dk=O({loadPaymentMethod:rt(`${wk}/loadPaymentMethod`),submitPaymentMethod:rt(`${wk}/submitPaymentMethod`),submitPaymentMethodError:rt(`${wk}/submitPaymentMethodError`),submitPaymentMethodSuccess:rt(`${wk}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:rt(`${wk}/updateBillingDetails`,(e=>({payload:e})))},Ok),Ck={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},Rk=O({},XA(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,{invoiceDownload:O({},e.invoiceDownload,t.payload)})}}),{reducer:Uk,actions:_k,name:Mk}=st({name:"subscriptions/billing/invoices",initialState:Ck,reducers:Rk}),Nk=O({loadInvoices:rt(`${Mk}/loadInvoices`),downloadInvoice:rt(`${Mk}/downloadInvoice`,(e=>({payload:e})))},_k),Fk={information:mk,invoices:Ck,paymentMethod:Ik,subscription:fk},$k={invoices:Nk,information:Pk,paymentMethod:Dk,subscription:hk},Gk=xe({invoices:Uk,information:Ak,paymentMethod:Ek,subscription:gk}),xk={fetching:!0,loading:!1,error:null,confirmed:!1},Vk=O({},XA()),{actions:Wk,reducer:jk,name:Kk}=st({name:"subscriptions/checkout",initialState:xk,reducers:Vk}),Bk=O({loadCheckout:rt(`${Kk}/loadCheckout`),resetCheckout:rt(`${Kk}/resetCheckout`),submitCheckout:rt(`${Kk}/submitCheckout`),confirmCheckout:rt(`${Kk}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:rt(`${Kk}/errorCheckout`,(e=>({payload:e})))},Wk),zk={loading:!1,error:null,cardSetupIntentSecret:null},qk=O({},XA()),{reducer:Hk,actions:Jk,name:Yk}=st({name:"subscriptions/stripe",initialState:zk,reducers:qk}),Qk=O({loadCustomer:rt(`${Yk}/loadCustomer`),createCardSetupIntentSecret:rt(`${Yk}/createCardSetupIntentSecret`)},Jk),Xk={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:Zk,reducer:eT,name:tT}=st({name:"subscriptions/vendorPublicConfig",initialState:Xk,reducers:O({},XA())}),nT=O({loadVendorPublicConfiguration:rt(`${tT}/loadVendorPublicConfiguration`)},Zk),oT={config:lk,plans:nk,checkout:xk,billing:Fk,stripe:zk,vendorPublicConfig:Xk},iT={config:yk,billing:$k,plans:rk,checkout:Bk,stripe:Qk,vendorPublicConfig:nT},aT=xe({config:uk,billing:Gk,plans:ik,checkout:jk,stripe:Hk,vendorPublicConfig:eT});let rT,lT,sT;function cT({policy:e}){return{policy:sT.AT_PERIOD_END}}function uT(e){switch(e){case Zu.ACTIVE:return lT.ACTIVE;case Zu.INCOMPLETE:return lT.INCOMPLETE;case Zu.CANCELED:return lT.CANCELED;case Zu.EXPIRED:return lT.EXPIRED;case Zu.TRIALING:return lT.TRIALING;default:return lT.EXPIRED}}!function(e){e.STRIPE="Stripe"}(rT||(rT={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(lT||(lT={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(sT||(sT={}));const dT={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"}},yT=[{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"}],fT=[{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:""}],pT=[{id:"id",externalId:"externalId",type:ed.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],gT={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*ST(){yield oa(hk.load,vT),yield oa(hk.cancelSubscription,mT),yield oa(hk.renewSubscription,bT)}function*vT(){const e=yield di((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield IT(e)}function*hT(){yield ai(hk.setLoading(!0));try{const[e]=yield si(qd.subscriptions.getManagedSubscriptions);yield ai(hk.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield ai(hk.setError(e))}}function*mT(){const{subscription:e}=yield di((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ai(hk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ai(hk.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===Zu.ACTIVE)try{yield ai(hk.setCancellationLoading(!0)),yield si(qd.subscriptions.cancelManagedSubscription,t),yield hT(),yield ai(hk.setCancellationLoading(!1))}catch(e){yield ai(hk.setCancellationError(e.message))}}function*bT(){const{subscription:e}=yield di((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ai(hk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ai(hk.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(hk.setRenewalLoading(!0)),yield si(qd.subscriptions.renewManagedSubscription,t),yield hT(),yield ai(hk.setRenewalLoading(!1))}catch(e){yield ai(hk.setCancellationError(e.message))}}function*AT(){yield ai(hk.setLoading(!0)),yield yi(500),yield ai(hk.setState({subscription:dT,fetching:!1,loading:!1,error:null}))}function*kT(){yield oa(hk.load,AT)}function*TT(){yield oa(Pk.loadBillingInformation,PT)}function*PT(){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 IT(n,!1):yield ai(Pk.setError(t?"Not authorized":"Internal feature failure"))}()}function*IT(e,t){yield ai(Pk.setLoading(!0));try{var n,o;const i=yield si(qd.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield si(qd.subscriptions.getSubscriptionPlan,a):([,l]=yield ri([si(hT),si(qd.subscriptions.getSubscriptionPlan,a)]),s=yield di((e=>e.subscriptions.billing.subscription.subscription||null))),yield ai(Pk.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?lT.ACTIVE:uT(s.status),cancellation:s.cancellation&&cT(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(Pk.setError(e.message))}}function*LT(){yield function*(){var e,t;yield ai(Pk.setLoading(!0)),yield yi(500),yield ai(Pk.setState({loading:!1,fetching:!1,summary:{subscriptionId:dT.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:nd.Stripe,externallyManaged:!1,currentPlanId:yT[0].id,defaultPlanId:yT[0].id},plan:O({},yT[0],{price:null==(e=yT[0].price)?void 0:e.amount,currency:null==(t=yT[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*ET(){yield oa(Pk.loadBillingInformation,LT)}function*OT(){yield oa(Dk.loadPaymentMethod,wT),yield oa(Dk.submitPaymentMethod,CT),yield oa(Dk.submitPaymentMethodError,RT),yield oa(Dk.submitPaymentMethodSuccess,UT),yield oa(Dk.updatePaymentMethodBillingDetails,DT)}function*wT(){yield ai(Dk.setLoading(!0));try{const e=(yield si(qd.subscriptions.getPaymentMethods))[0];yield ai(Dk.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield ai(Dk.setError(e.message))}}function*DT({payload:e}){yield ai(Dk.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield si(qd.subscriptions.updatePaymentMethodBillingDetails,t,O({email:n},o)),yield si(wT),null==i||i(!0)}catch(e){yield ai(Dk.setError(e.message)),null==i||i(!1)}yield ai(Dk.setLoading(!1))}function*CT(){yield ai(Dk.setLoading(!0))}function*RT({payload:e}){yield ai(Dk.setError(e))}function*UT(){yield ai(Dk.loadPaymentMethod())}function*_T(){yield ai(Dk.setLoading(!0)),yield yi(500);const e=pT[0];yield ai(Dk.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*MT(){yield oa(Dk.loadPaymentMethod,_T)}function*NT(){yield oa(Nk.loadInvoices,FT),yield oa(Nk.downloadInvoice,$T)}function*FT(){yield ai(Nk.setLoading(!0));try{const e=(yield si(qd.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(Nk.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield ai(Nk.setError(e.message))}}function*$T({payload:e}){yield ai(Nk.setInvoiceDownloadState({loading:!0,error:null}));try{yield si(qd.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield ai(Nk.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield ai(Nk.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*GT(){yield ai(Nk.setLoading(!0)),yield yi(500),yield ai(Nk.setState({loading:!1,fetching:!1,invoices:fT.map((e=>O({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield ai(Nk.setLoading(!1))}function*xT(){yield oa(Nk.loadInvoices,GT)}function*VT(){yield ri([si(TT),si(OT),si(NT),si(ST)])}function*WT(){yield ri([si(ET),si(MT),si(xT),si(kT)])}function*jT(){yield oa(Bk.loadCheckout,KT),yield oa(Bk.resetCheckout,BT),yield oa(Bk.submitCheckout,zT),yield oa(Bk.confirmCheckout,qT),yield oa(Bk.errorCheckout,JT)}function*KT(){yield ai(Bk.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*BT(){yield ai(Bk.setState({loading:!1,error:null,confirmed:!1}))}function*zT(){yield ai(Bk.setState({loading:!0,error:null}))}function*qT({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(Bk.setState({loading:!0,error:null})),i&&a)return yield HT(),void(yield ai(hk.setState({subscription:O({},n,{status:Zu.ACTIVE})})));try{yield si(qd.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield ri([PT(),wT(),FT()]),yield HT()}catch(e){yield ai(Bk.setState({loading:!1,error:e.message}))}}else yield ai(Bk.setState({loading:!1,error:"Subscription not found"}))}function*HT(){yield ai(Bk.setState({loading:!1,error:null,confirmed:!0}))}function*JT({payload:e}){yield ai(Bk.setState({loading:!1,error:e}))}function*YT(){yield oa(Bk.resetCheckout,BT)}function*QT(){yield oa(rk.loadPlans,XT)}function*XT(){yield ai(rk.setLoading(!0));try{const e=(yield si(qd.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(rk.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield ai(rk.setError(e.message))}}function*ZT(){yield ai(rk.setLoading(!0)),yield yi(500),yield ai(rk.setState({fetching:!1,loading:!1,plans:yT.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*eP(){yield oa(rk.loadPlans,ZT)}function*tP(){yield oa(yk.loadPaymentConfiguration,nP)}function*nP(){yield ai(yk.setLoading(!0));try{(yield si(qd.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===nd.Stripe))?yield function*(){yield ai(yk.setLoading(!0));try{const e=yield si(qd.subscriptions.getStripePaymentProviderConfiguration);yield ai(yk.setState({loading:!1,fetching:!1,config:{paymentProvider:rT.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield ai(yk.setError(e.message))}}():yield ai(yk.setError("Payment provider not configured"))}catch(e){yield ai(yk.setError(e.message))}}function*oP(){yield ai(yk.setLoading(!0)),yield yi(500),yield ai(yk.setState({loading:!1,fetching:!1,config:{paymentProvider:rT.STRIPE,apiKey:""}}))}function*iP(){yield oa(yk.loadPaymentConfiguration,oP)}function*aP(){yield oa(Qk.createCardSetupIntentSecret,rP)}function*rP({payload:e}){yield ai(Qk.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield si(qd.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield ai(Qk.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield ai(Qk.setError(e.message))}}function*lP(){yield oa(nT.loadVendorPublicConfiguration,sP)}function*sP(){yield ai(nT.setLoading(!0));try{const e=yield si(qd.subscriptions.getVendorPublicConfigurations);yield ai(nT.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield ai(nT.setError(e.message))}}function*cP(){yield ai(nT.setLoading(!0)),yield yi(500),yield ai(nT.setState({fetching:!1,loading:!1,vendorPublicConfig:gT}))}function*uP(){yield oa(nT.loadVendorPublicConfiguration,cP)}var dP={sagas:function*(){yield ri([si(VT),si(jT),si(QT),si(tP),si(aP),si(lP)])},mockSagas:function*(){yield ri([si(WT),si(YT),si(eP),si(iP),si(uP)])},reducer:aT,actions:iT,initialState:oT,storeName:"subscriptions"},yP={sagas:function*(){yield oa(Ky.loadVendorPublicInfo,By)},storeName:Dt,initialState:Vy,reducer:Wy,actions:Ky};const{reducer:fP}=st({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(ra.setContext(t),O({},e,{context:t}))}}}),pP=(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}),[Fb.storeName]:O({},Fb.initialState,o,null!=(s=null==i?void 0:i.auth)?s:{},{routes:O({},Fb.initialState.routes,null!=(c=null==o?void 0:o.routes)?c:{},null!=(u=null==i||null==(d=i.auth)?void 0:d.routes)?u:{})}),[cA.storeName]:O({},cA.initialState,null!=(y=null==i?void 0:i.auditLogs)?y:{},{auditLogsState:O({},cA.initialState.auditLogsState,null!=(f=null==i||null==(p=i.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:O({},cA.initialState.auditsMetadataState,null!=(g=null==i||null==(S=i.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[dA]:O({},uA,null!=(v=null==i?void 0:i.audits)?v:{}),[QA.storeName]:QA.initialState,[dP.storeName]:dP.initialState,[yP.storeName]:yP.initialState},reducer:xe({root:fP,[Fb.storeName]:Fb.reducer,[cA.storeName]:cA.reducer,[dA]:fA,[QA.storeName]:QA.reducer,[dP.storeName]:dP.reducer,[yP.storeName]:yP.reducer})});const m=function*(){yield ri([si(Fb.sagas),si(cA.sagas),si(PA),si(QA.sagas),si(dP.sagas),si(yP.sagas)])},b=function*(){yield ri([si(Fb.mockSagas),si(cA.mockSagas),si(dP.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 gP=n(714),SP=n.n(gP);function vP(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function hP(e){if(e.type)return e;if("#"===e.charAt(0))return hP(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 mP(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 bP(e){if(0===e.indexOf("#"))return e;const{values:t}=hP(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 AP(e,t){return e=hP(e),t=vP(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,mP(e)}function kP(e,t){if(e=hP(e),t=vP(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 mP(e)}function TP(e,t){if(e=hP(e),t=vP(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 mP(e)}const PP=e=>{if(e)return{main:e,light:bP(TP(e,.4)),dark:bP(kP(e,.15)),hover:bP(kP(e,.15)),active:bP(kP(e,.2))}},IP=e=>{if(e)return{main:e,light:TP(e,.7),dark:kP(e,.2)}},LP=(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({},PP(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({},PP(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({},PP(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:O({},IP(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:O({},IP(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:O({},IP(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:O({},IP(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},EP={},OP={},wP={},DP={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 CP{constructor(){this._theme=EP,this._themeV2=OP,this._navigation=DP,this._localizations=wP}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new CP;return n.set(e),CP._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=SP().all([null!=(t=DP)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=SP().all([null!=(o=EP)?o:{},LP(null==e?void 0:e.theme,EP)]),this._themeV2=SP().all([null!=(i=OP)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=SP().all([null!=(r=wP)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=DP,this._theme=EP,this._themeV2=OP,this._localizations=wP}}}CP._instances={};var RP=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},UP=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},_P=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 MP,NP,FP,$P,GP,xP,VP,WP,jP,KP,BP;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(MP||(MP={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(NP||(NP={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(FP||(FP={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}($P||($P={})),function(e){e.Invoices="invoices"}(GP||(GP={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(xP||(xP={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(VP||(VP={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(WP||(WP={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(jP||(jP={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(KP||(KP={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(BP||(BP={}));const zP={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},qP={hidden:"hidden",edit:"edit"};var HP="6.83.0",JP={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on","show-passkeys":"on","groups-admin-box-new":"on"},YP=function(){function e(t,n){var o,i=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];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(HP),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,a,r;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=da,i.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,i.options.metadata=null!=(n=null==r||null==(o=r.rows)||null==(a=o[0])?void 0:a.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:CP.set(i.options.metadata,i.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:i.options.hostedLoginBox||i.options.builderMode||"nextjs"===i.options.framework||i.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(!i.options.previewMode&&!i.options.builderMode){e.next=4;break}fd.set(JP,i.name),e.next=14;break;case 4:return e.prev=4,e.next=7,pd();case 7:t=e.sent,fd.set(t,i.name),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){i.updateLocalizations=e};var l=RP(n),s="frontegg-app-".concat(l);this.iframeRendering=a,this.name=l,this.options=O({},t,{contextOptions:O({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=s;var c,u,d=this.options.authOptions?O({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(o=this.options.authOptions)?void 0:o.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=pP({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);E.setInstance(l,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;CP.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}(),QP=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}(),XP=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}(),ZP=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}(),eI=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},tI=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];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 r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=pP({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=O({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},i),this.app=new YP(this.options,t,!0),CP.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,_P(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}(),nI="modern",oI=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[nI]},iI=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];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 r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=pP({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=O({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},i),this.app=new YP(this.options,t,!0,a),CP.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,_P(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 aI(e,t){return aI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},aI(e,t)}function rI(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&&aI(e,t)}function lI(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 sI(e){return sI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},sI(e)}function cI(){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 uI(e,t,n){return uI=cI()?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&&aI(i,n.prototype),i},uI.apply(null,arguments)}function dI(e){var t="function"==typeof Map?new Map:void 0;return dI=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 uI(e,arguments,sI(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),aI(n,e)},dI(e)}function yI(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=sI(e);if(t){var i=sI(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return lI(this,n)}}var fI=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new YP(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){rI(n,e);var t=yI(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=UP(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=UP(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=UP(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=UP(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=UP(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=UP(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}(dI(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}()}));
|