@frontegg/js 6.109.0 → 6.110.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +2 -2
- package/umd/frontegg.production.min.js +1 -1
- package/version.js +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see frontegg.production.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map((function(e){return o(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||i,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=o;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var i={};return n.isMergeableObject(e)&&a(e).forEach((function(t){i[t]=o(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?i[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):i[a]=o(t[a],n))})),i}(e,n,s):o(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var o=n(425).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},s=l.iterator||"@@iterator",c=l.asyncIterator||"@@asyncIterator",u=l.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,o){var i=t&&t.prototype instanceof g?t:g,a=Object.create(i.prototype),l=new O(o||[]);return r(a,"_invoke",{value:P(e,n,l)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,s,(function(){return this}));var m=Object.getPrototypeOf,A=m&&m(m(w([])));A&&A!==n&&a.call(A,s)&&(h=A);var b=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 E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,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:U}}function U(){return{value:void 0,done:!0}}return S.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},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(b),d(b,u,"Generator"),d(b,s,(function(){return this})),d(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=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(L),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,o){return r.type="throw",r.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],r=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var r=i?i.completion:{};return r.type=e,r.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator: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 _E},AdminPortalRenderer:function(){return NE},AppHolder:function(){return w},CheckoutDialog:function(){return RE},FronteggApp:function(){return CE},HostedLogin:function(){return DE},LoginBoxRenderer:function(){return $E},createElement:function(){return fE},defaultTheme:function(){return FE},formatName:function(){return yE},getThemeAdminByName:function(){return ME},getThemeByName:function(){return GE},initialize:function(){return HE},mockFlagsList:function(){return UE},restoreSearchParams:function(){return gE},waitThemeSetter:function(){return pE}});var e={};n.r(e),n.d(e,{Delete:function(){return pr},Get:function(){return ur},Patch:function(){return yr},Post:function(){return dr},PostDownload:function(){return gr},Put:function(){return fr},extractHeadersFromOptions:function(){return Sr},getBaseUrl:function(){return lr},getMetadataHeaders:function(){return sr}});var t={};n.r(t),n.d(t,{getHierarchyMetadata:function(){return Ir},getParentTenants:function(){return br},getParentTenantsById:function(){return kr},getSubTenants:function(){return mr},getSubTenantsAsTree:function(){return Ar},getTenants:function(){return hr},getTenantsUsersCount:function(){return Tr},searchSubTenants:function(){return Pr},switchTenant:function(){return vr}});var i={};n.r(i),n.d(i,{AuthStrategyEnum:function(){return Xr},MachineToMachineAuthStrategy:function(){return Zr},OAuthLogout:function(){return Tl},SocialLoginProviders:function(){return Yr},acceptInvitation:function(){return ml},activateAccount:function(){return gl},bulkCreateIPRestriction:function(){return zr},changePhoneNumber:function(){return yc},changePhoneNumberWithVerification:function(){return uc},checkIfAllowToRememberMfaDevice:function(){return $s},createDomainRestriction:function(){return xr},createIPRestriction:function(){return Kr},createOrUpdateSessionConfigrations:function(){return Ts},createSSOConfiguration:function(){return Bs},createSSOConfigurationByMetadata:function(){return qs},createSSODomain:function(){return Js},createSSOGroup:function(){return ec},createSamlGroup:function(){return ss},createTenantAccessToken:function(){return Cs},createUserAccessToken:function(){return Us},deleteAllSessionsForUser:function(){return Is},deleteDomainRestriction:function(){return jr},deleteIPRestriction:function(){return Hr},deleteSSOConfiguration:function(){return zs},deleteSSODomain:function(){return Qs},deleteSSOGroup:function(){return nc},deleteSamlGroup:function(){return us},deleteSessionForUser:function(){return Ps},deleteTenantAccessToken:function(){return Os},deleteTenantApiToken:function(){return Ns},deleteUserAccessToken:function(){return ws},deleteUserApiToken:function(){return Fs},deleteWebAuthnDevice:function(){return vc},disableMFAAuthenticatorApp:function(){return Fl},disableMFASMS:function(){return $l},disableMFAWebAuthn:function(){return Vl},disableMfa:function(){return Nl},enrollMFAAuthenticatorApp:function(){return Ul},enrollMFAAuthenticatorAppForLogin:function(){return Bl},enrollMFASMS:function(){return Dl},enrollMFASMSForLogin:function(){return ql},enrollMFAWebAuthn:function(){return Rl},enrollMFAWebAuthnForLogin:function(){return Yl},enrollMfa:function(){return Ol},exchangeOAuthTokens:function(){return rc},forgotPassword:function(){return Pl},generateLoginResponse:function(){return rl},generateLoginResponseFromOAuthResponse:function(){return sl},generateLoginResponseV2:function(){return ll},getActivateAccountStrategy:function(){return Sl},getCaptchaPolicy:function(){return _r},getCurrentUserSession:function(){return As},getCurrentUserSessions:function(){return ms},getCustomSocialLoginProvidersV1:function(){return gs},getDomainRestrictions:function(){return Gr},getDomainRestrictionsConfig:function(){return $r},getGlobalSecurityPolicy:function(){return Er},getIPRestrictions:function(){return Wr},getIPRestrictionsConfig:function(){return Br},getLockoutPolicy:function(){return Ur},getMFADevices:function(){return jl},getMFAStrategiesConfig:function(){return Ac},getMfaPolicy:function(){return Lr},getOidcConfiguration:function(){return ds},getPasswordConfigPolicy:function(){return Fr},getPasswordHistoryPolicy:function(){return Rr},getSSOConfigurations:function(){return Ws},getSSODefaultRoles:function(){return Xs},getSSOGroups:function(){return oc},getSSOPublicConfiguration:function(){return ys},getSamlConfiguration:function(){return es},getSamlRoles:function(){return as},getSamlRolesGroups:function(){return rs},getSamlVendorConfiguration:function(){return ns},getSessionConfigurations:function(){return ks},getSocialLoginProviders:function(){return fs},getSocialLoginProvidersV2:function(){return ps},getTenantAccessTokensData:function(){return Ls},getTenantApiTokensData:function(){return _s},getUserAccessTokensData:function(){return Es},getUserApiTokensData:function(){return Ds},getUserById:function(){return Gs},getVendorConfig:function(){return vs},getVendorLockoutPolicy:function(){return Cr},getVendorMfaPolicy:function(){return Or},getVendorPasswordHistoryPolicy:function(){return Mr},getVendorPublicAuthStrategiesConfig:function(){return mc},getWebAuthnDevices:function(){return Sc},loadPasswordConfig:function(){return El},login:function(){return fl},loginViaSocialLogin:function(){return Ss},loginWithMfa:function(){return pl},logout:function(){return kl},oidcPostLogin:function(){return yl},oidcPostLoginV2:function(){return ac},passwordlessPostLogin:function(){return Vs},passwordlessPreLogin:function(){return xs},postLogin:function(){return dl},preDisableMFASMS:function(){return Gl},preDisableMFAWebAuthn:function(){return xl},preEnrollMFAAuthenticatorApp:function(){return wl},preEnrollMFAAuthenticatorAppForLogin:function(){return Wl},preEnrollMFASMS:function(){return Cl},preEnrollMFASMSForLogin:function(){return zl},preEnrollMFAWebAuthn:function(){return _l},preEnrollMFAWebAuthnForLogin:function(){return Ql},preLogin:function(){return cl},preLoginV2:function(){return ic},preLoginWithIdpType:function(){return ul},preVerifyMFASMSForLogin:function(){return Hl},preVerifyMFAWebAuthnForLogin:function(){return Xl},recoverMfaToken:function(){return Ll},refreshToken:function(){return Al},refreshTokenV2:function(){return bl},resendActivationEmail:function(){return vl},resendInvitationEmail:function(){return hl},resetPassword:function(){return Il},resetPhoneNumber:function(){return sc},revokeSessionsForUser:function(){return bs},saveLockoutPolicy:function(){return Dr},saveMfaPolicy:function(){return wr},savePasswordHistoryPolicy:function(){return Nr},setSSODefaultRoles:function(){return Zs},signUpUser:function(){return hs},silentOAuthRefreshToken:function(){return lc},testCurrentIp:function(){return Jr},testCurrentIpInAllowList:function(){return Qr},updateDomainRestrictionConfig:function(){return Vr},updateIPRestrictionConfig:function(){return qr},updateSSOConfiguration:function(){return Ks},updateSSOConfigurationByMetadata:function(){return Hs},updateSSOGroup:function(){return tc},updateSamlConfiguration:function(){return ts},updateSamlGroup:function(){return cs},updateSamlRoles:function(){return ls},updateSamlVendorMetadata:function(){return os},updateTenantApiTokensData:function(){return Ms},updateUserApiTokensData:function(){return Rs},validateSSODomain:function(){return Ys},validateSamlDomain:function(){return is},verifyChangePhoneNumber:function(){return dc},verifyInviteToken:function(){return js},verifyMFAAuthenticatorAppForLogin:function(){return Kl},verifyMFASMSForLogin:function(){return Jl},verifyMFAWebAuthnForLogin:function(){return Zl},verifyMfa:function(){return Ml},verifyNewDeviceSession:function(){return hc},verifyResetPhoneNumber:function(){return cc},webAuthnCreateNewDeviceSession:function(){return gc},webAuthnPostLogin:function(){return pc},webAuthnPreLogin:function(){return fc}});var a={};n.r(a),n.d(a,{addUser:function(){return Ec},changePassword:function(){return Pc},createInviteUserLink:function(){return wc},deleteInviteUserLink:function(){return Cc},deleteUser:function(){return Lc},getInviteLinkConfiguration:function(){return _c},getInviteUserLink:function(){return Dc},getProfile:function(){return bc},loadAvailablePermissions:function(){return Mc},loadAvailableRoles:function(){return Rc},loadStats:function(){return Nc},loadUsers:function(){return Ic},resendActivationLink:function(){return Fc},resendInvitationLink:function(){return Gc},resendInvitationLinkToAllTenants:function(){return $c},updateInviteUserLink:function(){return Uc},updateProfile:function(){return kc},updateProfileImage:function(){return Tc},updateUser:function(){return Oc}});var r={};n.r(r),n.d(r,{getAdminBoxMetadata:function(){return Vc},getAuditsMetadata:function(){return zc},getCurrentUserIpMetadata:function(){return Wc},getIpAdressMetadata:function(){return qc},getNotificationsMetadata:function(){return Bc},getSamlMetadata:function(){return Kc},updateAdminBoxMetadata:function(){return jc}});var l={};n.r(l),n.d(l,{downloadReport:function(){return tu},getReport:function(){return Xc},getReports:function(){return Yc},renderReport:function(){return Zc},scheduleReport:function(){return eu},sendReport:function(){return nu}});var s={};n.r(s),n.d(s,{getNotifications:function(){return ou},markAllAsRead:function(){return ru},updateNotificationIsPinned:function(){return au},updateNotificationStatus:function(){return iu}});var c={};n.r(c),n.d(c,{exportAudits:function(){return uu},getAudits:function(){return su},getAuditsStats:function(){return cu}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return Pu},deleteEmailSubscriptions:function(){return ku},deleteSMSConfiguration:function(){return Uu},deleteSMSSubscriptions:function(){return Ou},deleteSlackConfiguration:function(){return vu},deleteWebhooksConfiguration:function(){return _u},getCategories:function(){return Fu},getChannelMaps:function(){return Gu},getEmailConfiguration:function(){return mu},getSMSConfiguration:function(){return Iu},getSlackChannels:function(){return gu},getSlackConfiguration:function(){return fu},getSlackScope:function(){return pu},getWebhookLog:function(){return Ru},getWebhooksConfigurations:function(){return Cu},patchEmailConfiguration:function(){return bu},patchSMSConfiguration:function(){return Lu},postEmailConfiguration:function(){return Au},postSMSConfiguration:function(){return Eu},postSlackCode:function(){return hu},postSlackConfiguration:function(){return Su},postWebhookRetry:function(){return Nu},postWebhookTest:function(){return Mu},postWebhooksConfiguration:function(){return Du},putEmailSubscriptions:function(){return Tu},putSMSSubscriptions:function(){return wu}});var d={};n.r(d),n.d(d,{getPublicSettings:function(){return Vu},getSettings:function(){return xu},updateSettings:function(){return $u}});var y={};n.r(y),n.d(y,{addRole:function(){return zu},attachPermissionToRoles:function(){return Yu},attachPermissionsToRole:function(){return Ju},deleteRole:function(){return qu},getPermissionCategories:function(){return Xu},getPermissions:function(){return Qu},getRoles:function(){return Ku},updateRole:function(){return Hu}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return Ud},ISubscriptionStatus:function(){return Od},PaymentMethodType:function(){return wd},ProviderType:function(){return Cd},TenantCreatedAction:function(){return _d},TrialEndAction:function(){return Dd},cancelManagedSubscription:function(){return rd},cancelSubscription:function(){return td},createStripeCustomer:function(){return Ad},createStripePaymentMethodSetupIntentSecret:function(){return kd},createSubscription:function(){return hd},createTenantConfiguration:function(){return Id},getManagedSubscription:function(){return id},getManagedSubscriptions:function(){return ad},getPaymentMethod:function(){return Sd},getPaymentMethods:function(){return gd},getPaymentProviders:function(){return Ed},getStripeCustomer:function(){return md},getStripePaymentProviderConfiguration:function(){return bd},getSubscription:function(){return ed},getSubscriptionInvoice:function(){return yd},getSubscriptionInvoicePdf:function(){return fd},getSubscriptionInvoices:function(){return dd},getSubscriptionPlan:function(){return ud},getSubscriptionPlans:function(){return cd},getSubscriptionSummaries:function(){return Td},getSubscriptions:function(){return Zu},getTenantConfiguration:function(){return Pd},getVendorPublicConfigurations:function(){return Ld},renewManagedSubscription:function(){return ld},renewSubscription:function(){return nd},updateManagedSubscription:function(){return sd},updatePaymentMethodBillingDetails:function(){return vd},updateSubscription:function(){return od}});var p={};n.r(p),n.d(p,{getVendorPublicInfo:function(){return Rd}});var g={};n.r(g),n.d(g,{addUserRolesForSubTenants:function(){return Gd},addUserToTenantAndSubTenants:function(){return Nd},addUsersToSubTenant:function(){return Kd},createSubTenant:function(){return Vd},deleteSubTenant:function(){return jd},loadAllUsers:function(){return Md},removeUserFromTenantAndSubTenants:function(){return Fd},removeUserRolesFromSubTenants:function(){return $d},setUserRolesForSubTenants:function(){return xd},updateSubAccountAccess:function(){return Bd},updateSubTenant:function(){return Wd}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return qd},loadFeatureFlags:function(){return Hd}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return Zd},createConfiguration:function(){return Yd},deleteConfiguration:function(){return Xd},getConfigs:function(){return Jd},updateConfiguration:function(){return Qd}});var h={};n.r(h),n.d(h,{impersonate:function(){return ey}});var m={};n.r(m),n.d(m,{addRolesToGroup:function(){return sy},addUsersToGroup:function(){return uy},createGroup:function(){return ay},deleteGroup:function(){return ly},deleteRolesFromGroup:function(){return cy},deleteUsersFromGroup:function(){return dy},getGroupById:function(){return ny},getGroupConfiguration:function(){return yy},getGroups:function(){return oy},getGroupsByIds:function(){return iy},updateGroup:function(){return ry},updateGroupConfiguration:function(){return fy}});var A={};n.r(A),n.d(A,{GetUserJwt:function(){return py},getUsersRoles:function(){return Sy},getUsersV3:function(){return gy}});var b={};n.r(b),n.d(b,{loadEntitlements:function(){return vy}});var k={};n.r(k),n.d(k,{AuthStrategyEnum:function(){return Xr},ContextHolder:function(){return Ta},FeatureFlags:function(){return qd},FronteggApiError:function(){return Ia},FronteggContext:function(){return Pa},FronteggFrameworks:function(){return ro},GroupManagedByEnum:function(){return Cy},GroupRelations:function(){return Uy},ISubscriptionCancellationPolicy:function(){return Ud},ISubscriptionStatus:function(){return Od},MFAStrategyEnum:function(){return Ay},MachineToMachineAuthStrategy:function(){return Zr},PaginationOrderEnum:function(){return lo},PaymentMethodType:function(){return wd},ProviderType:function(){return Cd},RequestSource:function(){return ao},RestrictionType:function(){return xn},ScimConnectionSource:function(){return wy},SecondaryAuthStrategy:function(){return hy},SocialLoginProviders:function(){return Yr},SortByEnum:function(){return so},TenantSortByEnum:function(){return ky},TenantType:function(){return Ty},UserManagedByEnum:function(){return by},WebAuthnDeviceType:function(){return my},api:function(){return Dy},countConfigurationUsers:function(){return Zd},createConfiguration:function(){return Yd},default:function(){return _y},deleteConfiguration:function(){return Xd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Py},fronteggHeaders:function(){return io},fronteggRefreshTokenUrl:function(){return Iy},fronteggSilentRefreshTokenUrl:function(){return Ey},fronteggTenantsUrl:function(){return Oy},fronteggUsersUrl:function(){return Ly},getConfigs:function(){return Jd},loadFeatureFlags:function(){return Hd},updateConfiguration:function(){return Qd}});var T={};function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function E(e){var t=function(e,t){if("object"!==I(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!==I(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===I(t)?t:String(t)}function L(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,E(o.key),o)}}function O(e,t,n){return t&&L(e.prototype,t),n&&L(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(T),n.d(T,{AccountDetailsPageTabs:function(){return EE},AccountPageFields:function(){return mE},DomainRestrictionsTabFields:function(){return IE},GeneralSettingsTabFields:function(){return TE},InviteUserModalFields:function(){return hE},IpRestrictionsTabFields:function(){return PE},Metadata:function(){return dE},PrivacyPageFields:function(){return vE},ProfilePageFields:function(){return SE},SecurityPageTabs:function(){return bE},SessionManagementTabFields:function(){return kE},SubscriptionsPageFields:function(){return AE},alpha:function(){return tE},fieldAppearance:function(){return LE},tabAppearance:function(){return OE}});var w=function(){function e(){P(this,e)}return O(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function U(){return U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},U.apply(this,arguments)}function C(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){C(a,o,i,r,l,"next",e)}function l(e){C(a,o,i,r,l,"throw",e)}r(void 0)}))}}w._apps={};var _=n(841),R=n.n(_);function M(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 N(e){return!!e&&!!e[ke]}function F(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Te}(e)||Array.isArray(e)||!!e[be]||!!e.constructor[be]||W(e)||B(e))}function G(e,t,n){void 0===n&&(n=!1),0===$(e)?(n?Object.keys:Pe)(e).forEach((function(o){n&&"symbol"==typeof o||t(o,e[o],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function $(e){var t=e[ke];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:W(e)?2:B(e)?3:0}function x(e,t){return 2===$(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function V(e,t,n){var o=$(e);2===o?e.set(t,n):3===o?(e.delete(t),e.add(n)):e[t]=n}function j(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function W(e){return ve&&e instanceof Map}function B(e){return he&&e instanceof Set}function K(e){return e.o||e.t}function z(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Ie(e);delete t[ke];for(var n=Pe(t),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 q(e,t){return void 0===t&&(t=!1),J(e)||N(e)||!F(e)||($(e)>1&&(e.set=e.add=e.clear=e.delete=H),Object.freeze(e),t&&G(e,(function(e,t){return q(t,!0)}),!0)),e}function H(){M(2)}function J(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Q(e){var t=Ee[e];return t||M(18,e),t}function Y(){return ge}function X(e,t){t&&(Q("Patches"),e.u=[],e.s=[],e.v=t)}function Z(e){ee(e),e.p.forEach(ne),e.p=null}function ee(e){e===ge&&(ge=e.l)}function te(e){return ge={p:[],l:ge,h:e,m:!0,_:0}}function ne(e){var t=e[ke];0===t.i||1===t.i?t.j():t.O=!0}function oe(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.g||Q("ES5").S(t,e,o),o?(n[ke].P&&(Z(t),M(4)),F(e)&&(e=ie(t,e),t.l||re(t,e)),t.u&&Q("Patches").M(n[ke].t,e,t.u,t.s)):e=ie(t,n,[]),Z(t),t.u&&t.v(t.u,t.s),e!==Ae?e:void 0}function ie(e,t,n){if(J(t))return t;var o=t[ke];if(!o)return G(t,(function(i,a){return ae(e,o,t,i,a,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return re(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var i=4===o.i||5===o.i?o.o=z(o.k):o.o;G(3===o.i?new Set(i):i,(function(t,a){return ae(e,o,i,t,a,n)})),re(e,i,!1),n&&e.u&&Q("Patches").R(o,n,e.u,e.s)}return o.o}function ae(e,t,n,o,i,a){if(N(i)){var r=ie(e,i,a&&t&&3!==t.i&&!x(t.D,o)?a.concat(o):void 0);if(V(n,o,r),!N(r))return;e.m=!1}if(F(i)&&!J(i)){if(!e.h.F&&e._<1)return;ie(e,i),t&&t.A.l||re(e,i)}}function re(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&q(t,n)}function le(e,t){var n=e[ke];return(n?K(n):e)[t]}function se(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 ce(e){e.P||(e.P=!0,e.l&&ce(e.l))}function ue(e){e.o||(e.o=z(e.t))}function de(e,t,n){var o=W(t)?Q("MapSet").N(t,n):B(t)?Q("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),o={i:n?1:0,A:t?t.A:Y(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=o,a=Le;n&&(i=[o],a=Oe);var r=Proxy.revocable(i,a),l=r.revoke,s=r.proxy;return o.k=s,o.j=l,s}(t,n):Q("ES5").J(t,n);return(n?n.A:Y()).p.push(o),o}function ye(e){return N(e)||M(22,e),function e(t){if(!F(t))return t;var n,o=t[ke],i=$(t);if(o){if(!o.P&&(o.i<4||!Q("ES5").K(o)))return o.t;o.I=!0,n=fe(t,i),o.I=!1}else n=fe(t,i);return G(n,(function(t,i){o&&function(e,t){return 2===$(e)?e.get(t):e[t]}(o.t,t)===i||V(n,t,e(i))})),3===i?new Set(n):n}(e)}function fe(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return z(e)}var pe,ge,Se="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ve="undefined"!=typeof Map,he="undefined"!=typeof Set,me="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Ae=Se?Symbol.for("immer-nothing"):((pe={})["immer-nothing"]=!0,pe),be=Se?Symbol.for("immer-draftable"):"__$immer_draftable",ke=Se?Symbol.for("immer-state"):"__$immer_state",Te=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Pe="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Ie=Object.getOwnPropertyDescriptors||function(e){var t={};return Pe(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ee={},Le={get:function(e,t){if(t===ke)return e;var n=K(e);if(!x(n,t))return function(e,t,n){var o,i=se(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||!F(o)?o:o===le(e.t,t)?(ue(e),e.o[t]=de(e.A.h,o,e)):o},has:function(e,t){return t in K(e)},ownKeys:function(e){return Reflect.ownKeys(K(e))},set:function(e,t,n){var o=se(K(e),t);if(null==o?void 0:o.set)return o.set.call(e.k,n),!0;if(!e.P){var i=le(K(e),t),a=null==i?void 0:i[ke];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(j(n,i)&&(void 0!==n||x(e.t,t)))return!0;ue(e),ce(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==le(e.t,t)||t in e.t?(e.D[t]=!1,ue(e),ce(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=K(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty:function(){M(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){M(12)}},Oe={};G(Le,(function(e,t){Oe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Oe.deleteProperty=function(e,t){return Oe.set.call(this,e,t,void 0)},Oe.set=function(e,t,n){return Le.set.call(this,e[0],t,n,e[0])};var we=function(){function e(e){var t=this;this.g=me,this.F=!0,this.produce=function(e,n,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&&M(6),void 0!==o&&"function"!=typeof o&&M(7),F(e)){var l=te(t),s=de(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?Z(l):ee(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return X(l,o),oe(e,l)}),(function(e){throw Z(l),e})):(X(l,o),oe(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===Ae&&(r=void 0),t.F&&q(r,!0),o){var u=[],d=[];Q("Patches").M(e,r,u,d),o(u,d)}return r}M(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){F(e)||M(8),N(e)&&(e=ye(e));var t=te(this),n=de(this,e,void 0);return n[ke].C=!0,ee(t),n},t.finishDraft=function(e,t){var n=(e&&e[ke]).A;return X(n,t),oe(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!me&&M(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));var i=Q("Patches").$;return N(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Ue=new we,Ce=Ue.produce,De=(Ue.produceWithPatches.bind(Ue),Ue.setAutoFreeze.bind(Ue),Ue.setUseProxies.bind(Ue),Ue.applyPatches.bind(Ue),Ue.createDraft.bind(Ue),Ue.finishDraft.bind(Ue),Ce);function _e(e,t,n){return(t=E(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 Me(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){_e(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 Ne(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Fe="function"==typeof Symbol&&Symbol.observable||"@@observable",Ge=function(){return Math.random().toString(36).substring(7).split("").join(".")},$e={INIT:"@@redux/INIT"+Ge(),REPLACE:"@@redux/REPLACE"+Ge(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ge()}};function xe(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Ve(e,t,n){var o;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ne(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ne(1));return n(Ve)(e,t)}if("function"!=typeof e)throw new Error(Ne(2));var i=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(Ne(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ne(4));if(s)throw new Error(Ne(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(Ne(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!xe(e))throw new Error(Ne(7));if(void 0===e.type)throw new Error(Ne(8));if(s)throw new Error(Ne(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(Ne(10));i=e,y({type:$e.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ne(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Fe]=function(){return this},e}return y({type:$e.INIT}),(o={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Fe]=p,o}function je(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:$e.INIT}))throw new Error(Ne(12));if(void 0===n(void 0,{type:$e.PROBE_UNKNOWN_ACTION()}))throw new Error(Ne(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var 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(Ne(14));i[s]=d,o=o||d!==u}return(o=o||r.length!==Object.keys(e).length)?i:e}}function We(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function Be(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),o=function(){throw new Error(Ne(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return o=We.apply(void 0,a)(n.dispatch),Me(Me({},n),{},{dispatch:o})}}}function Ke(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 ze=Ke();ze.withExtraArgument=Ke;var qe,He=ze,Je=(qe=function(e,t){return qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},qe(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}qe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Qe=function(e,t){for(var n=0,o=t.length,i=e.length;n<o;n++,i++)e[i]=t[n];return e},Ye=Object.defineProperty,Xe=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Ze=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable,tt=function(e,t,n){return t in e?Ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},nt=function(e,t){for(var n in t||(t={}))Ze.call(t,n)&&tt(e,n,t[n]);if(Xe)for(var o=0,i=Xe(t);o<i.length;o++)n=i[o],et.call(t,n)&&tt(e,n,t[n]);return e},ot="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?We:We.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var it=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 Je(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Qe([void 0],e[0].concat(this)))):new(t.bind.apply(t,Qe([void 0],e.concat(this))))},t}(Array);function at(e){return F(e)?De(e,(function(){})):e}function rt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,o=(e.immutableCheck,e.serializableCheck,new it);return n&&(function(e){return"boolean"==typeof e}(n)?o.push(He):o.push(He.withExtraArgument(n.extraArgument))),o}function lt(e){var t,n=function(e){return rt(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=je(a)}var p=l;"function"==typeof p&&(p=p(n));var g=Be.apply(void 0,p),S=We;c&&(S=ot(nt({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=Qe([g],f):"function"==typeof f&&(v=f(v)),Ve(t,d,S.apply(void 0,v))}function st(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 nt(nt({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 ct(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 ut(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:at(e.initialState),i=e.reducers||{},a=Object.keys(i),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?ct(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=nt(nt({},i),l);return function(e,t,n,o){void 0===n&&(n=[]);var i,a="function"==typeof t?ct(t):[t,n,o],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))i=function(){return at(e())};else{var c=at(e);i=function(){return c}}function u(e,t){void 0===e&&(e=i());var n=Qe([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(N(e))return void 0===(o=n(e,t))?e:o;if(F(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?st(c,o):st(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 dt="listenerMiddleware";st(dt+"/add"),st(dt+"/removeAll"),st(dt+"/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[ke];return Le.get(t,e)},set:function(t){var n=this[ke];Le.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][ke];if(!i.P)switch(i.i){case 5:o(i)&&ce(i);break;case 4:n(i)&&ce(i)}}}function n(e){for(var t=e.t,n=e.k,o=Pe(n),i=o.length-1;i>=0;i--){var a=o[i];if(a!==ke){var r=t[a];if(void 0===r&&!x(t,a))return!0;var l=n[a],s=l&&l[ke];if(s?s.t!==r:!j(l,r))return!0}}var c=!!t[ke];return o.length!==Pe(t).length+(c?0:1)}function o(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var o=0;o<t.length;o++)if(!t.hasOwnProperty(o))return!0;return!1}var i={};!function(e,t){Ee[e]||(Ee[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=Ie(n);delete a[ke];for(var r=Pe(a),l=0;l<r.length;l++){var s=r[l];a[s]=e(s,t||!!a[s].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(o,t),a={i:o?5:4,A:n?n.A:Y(),P:!1,I:!1,D:{},l:n,t:t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,ke,{value:a,writable:!0}),i},S:function(e,n,i){i?N(n)&&n[ke].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ke];if(n){var i=n.t,a=n.k,r=n.D,l=n.i;if(4===l)G(a,(function(t){t!==ke&&(void 0!==i[t]||x(i,t)?r[t]||e(a[t]):(r[t]=!0,ce(n)))})),G(i,(function(e){void 0!==a[e]||x(a,e)||(r[e]=!1,ce(n))}));else if(5===l){if(o(n)&&(ce(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 yt=(e,t)=>n=>U({},n,{[e]:t[e]}),ft=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),pt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:o})=>{var i;return U({},n,{[e]:U({},n[e],{[t]:U({},null==n||null==(i=n[e])?void 0:i[t],o)})})}}),gt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o,i;return U({},t,{[e]:U({},t[e],{loaders:U({},null==(o=t[e])?void 0:o.loaders,{[n.key]:null==(i=n.value)||i})})})}}),St=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o;return U({},t,{[e]:U({},t[e],{errors:U({},t[e].errors,{[n.key]:null==(o=n.value)||o})})})}}),vt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(o,{payload:i})=>{var a;return U({},o,{[e]:U({},o[e],{[t]:U({},null==o||null==(a=o[e])?void 0:a[t],i,n)})})}}),ht=(e,t,n)=>o=>{var i;return U({},o,{[e]:U({},o[e],{[t]:U({},null==o||null==(i=o[e])?void 0:i[t],n)})})},mt=(e=500)=>new Promise((t=>setTimeout(t,e))),At="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bt=new Uint8Array(256);for(let e=0;e<At.length;e++)bt[At.charCodeAt(e)]=e;const kt=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=bt[e.charCodeAt(o)],a=bt[e.charCodeAt(o+1)],r=bt[e.charCodeAt(o+2)],l=bt[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},Tt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(Tt(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let o,i="";for(o=0;o<n;o+=3)i+=At[t[o]>>2],i+=At[(3&t[o])<<4|t[o+1]>>4],i+=At[(15&t[o+1])<<2|t[o+2]>>6],i+=At[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]=Tt(e[n]);return t}return e};let Pt,It,Et;!function(e){e.preLogin="preLogin",e.magicLinkPreLoginSuccess="magicLinkPreLoginSuccess",e.loginWithSmsOtc="loginWithSmsOtc",e.loginWithQuickSmsOtc="loginWithQuickSmsOtc",e.loginWithOtc="loginWithOtc",e.loginWithPassword="loginWithPassword",e.loginWithTwoFactor="loginWithTwoFactor",e.redirectToSSO="redirectToSSO",e.loginWithSSOFailed="loginWithSSOFailed",e.success="success",e.forceTwoFactor="forceTwoFactor",e.recoverTwoFactor="recoverTwoFactor",e.promptPasskeys="promptPasskeys",e.breachedPassword="breachedPassword"}(Pt||(Pt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(It||(It={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Et||(Et={}));const Lt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Ot="HOSTED_LOGIN_VERIFIER_KEY",wt="auth",Ut="connectivity",Ct="auditLogs",Dt="vendor",_t={flow:It.Login,step:Pt.preLogin,loading:!1,email:"",tenants:[]},Rt={setLoginState:ft("loginState"),resetLoginState:yt("loginState",{loginState:_t})},Mt={requestAuthorize:st("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:st("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:st("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:st("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:st("auth/afterAuthNavigation"),preLogin:st("auth/preLogin",(e=>({payload:e}))),postLogin:st("auth/postLogin",(e=>({payload:e}))),login:st("auth/login",(e=>({payload:e}))),loginWithMfa:st("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:st("auth/recoverMfa",(e=>({payload:e}))),logout:st("auth/logout",(e=>({payload:e}))),silentLogout:st("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:st("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:st("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:st("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:st("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:st("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:st("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:st("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:st("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:st("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:st("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:st("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:st("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:st("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:st("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:st("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:st("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:st("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:st("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:st("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:st("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:st("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Nt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Nt||(Nt={}));const Ft={step:Nt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Gt={setActivateState:ft("activateState"),resetActivateState:yt("activateState",{activateState:Ft}),setActivateStrategyState:pt("activateState","activationStrategy")},$t={activateAccount:st("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:st("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:st("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:st("auth/resendActivationEmail",(e=>({payload:e})))};let xt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(xt||(xt={}));const Vt={step:xt.validate},jt={setAcceptInvitationState:ft("acceptInvitationState"),resetAcceptInvitationState:yt("acceptInvitationState",{acceptInvitationState:Vt})},Wt={acceptInvitation:st("auth/acceptInvitation",(e=>({payload:e})))};let Bt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Bt||(Bt={}));const Kt={step:Bt.forgotPassword,loading:!1,email:"",passwordConfig:null},zt={setForgotPasswordState:ft("forgotPasswordState"),resetForgotPasswordState:yt("forgotPasswordState",{forgotPasswordState:Kt})},qt={forgotPassword:st("auth/forgotPassword",(e=>({payload:e}))),resetPassword:st("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:st("auth/loadPasswordConfig",(e=>({payload:e})))};let Ht;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Ht||(Ht={}));const Jt={step:Ht.ResetPhoneNumber,loading:!1},Qt={setResetPhoneNumberState:ft("resetPhoneNumberState"),resetResetPhoneNumberState:yt("resetPhoneNumberState",{resetPhoneNumberState:Jt})},Yt={resetPhoneNumber:st("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:st("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:st("auth/changePhoneNumber",(e=>({payload:e})))},Xt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Zt={setSSOLoader:gt("ssoState"),setSSOError:St("ssoState"),setSSOState:ft("ssoState"),resetSSOState:yt("ssoState",{ssoState:Xt})},en={loadSSOConfigurationsV2:st("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:st("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:st("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:st("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:st("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:st("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:st("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:st("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:st("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:st("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:st("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:st("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:st("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:st("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:st("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:st("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:st("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:st("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:st("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:st("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:st("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:st("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:st("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:st("auth/oidcPostlogin",(e=>({payload:e})))},tn={loading:!1,error:null},nn={setProfileState:ft("profileState"),resetProfileState:yt("profileState",{profileState:tn})},on={loadProfile:st("auth/loadProfile"),saveProfile:st("auth/saveProfile",(e=>({payload:e}))),changePassword:st("auth/changePassword",(e=>({payload:e})))};let an;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(an||(an={}));const rn={step:an.verify,loading:!1,saving:!1},ln={setMfaState:ft("mfaState"),resetMfaState:yt("mfaState",{mfaState:rn})},sn={enrollMfa:st("auth/enrollMfa"),getMFADevices:st("auth/getMFADevices"),getMFAStrategies:st("auth/getMFAStrategies"),verifyMfa:st("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:st("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:st("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:st("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:st("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:st("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:st("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:st("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:st("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:st("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:st("auth/disableMfaWebAuthn",(e=>({payload:e})))},cn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},un={setTeamLoader:gt("teamState"),setTeamError:St("teamState"),setTeamState:ft("teamState"),resetTeamState:yt("teamState",{teamState:cn})},dn={loadUsers:st("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:st("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:st("auth/loadRoles",(e=>({payload:e}))),addUser:st("auth/addUser",(e=>({payload:e}))),addUsersBulk:st("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:st("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:st("auth/updateUser",(e=>({payload:e}))),deleteUser:st("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:st("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:st("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:st("auth/lockUser",(e=>({payload:e}))),resendActivationLink:st("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:st("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:st("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:st("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:st("auth/getInvitationLink"),createInvitationLink:st("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:st("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:st("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:st("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:st("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:st("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:st("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:st("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:st("auth/closeLockUserDialog",(e=>({payload:e})))},yn={firstLoad:!0,loading:!1,error:""},fn={setSocialLoginsState:ft("socialLoginState"),resetSocialLoginsState:yt("socialLoginState",{socialLoginState:yn})},pn={loadSocialLoginsConfiguration:st("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:st("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:st("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:st("auth/setSocialLoginError",(e=>({payload:e})))};let gn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(gn||(gn={}));const Sn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:gn.SignUp},vn={setSignUpState:ft("signUpState"),resetSignUpState:yt("signUpState",{signUpState:Sn})},hn={signUpUser:st("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:st("auth/resetSignUpStateSoft")},mn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},An={setApiTokensLoader:gt("apiTokensState"),setApiTokensError:St("apiTokensState"),setApiTokensState:ft("apiTokensState"),resetApiTokensState:yt("apiTokensState",{apiTokensState:mn})},bn={loadApiTokens:st("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:st("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:st("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:st("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:st("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:st("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:st("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:st("auth/deleteTenantApiToken",(e=>({payload:e})))},kn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},Tn={setSecurityPolicyState:ft("securityPolicyState"),setSecurityPolicyGlobalState:pt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:pt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:pt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:pt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:pt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:pt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:pt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:pt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:pt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:pt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:pt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:yt("securityPolicyState",{securityPolicyState:kn})},Pn={loadSecurityPolicy:st("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:st("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:st("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:st("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:st("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:st("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:st("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:st("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:st("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:st("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:st("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:st("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:st("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:st("auth/loadPublicAuthStrategiesPolicy")},In={loading:!1},En={setAccountSettingsState:ft("accountSettingsState"),resetAccountSettingsState:yt("accountSettingsState",{accountSettingsState:In})},Ln={loadAccountSettings:st("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:st("auth/saveAccountSettings",(e=>({payload:e})))},On={tenants:[],subTenants:[],loading:!0,tenantTree:null},wn={setTenantsState:ft("tenantsState"),resetTenantsState:yt("tenantsState",{tenantsState:On})},Un={switchTenant:st("auth/switchTenant",(e=>({payload:e}))),loadTenants:st("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:st("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:st("auth/loadSubTenantsTree",(e=>({payload:e})))},Cn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Dn={setRolesState:ft("rolesState"),resetRolesState:yt("rolesState",{rolesState:Cn})},_n={loadRolesAndPermissions:st("auth/loadRoles",(e=>({payload:e}))),addRole:st("auth/addRole",(e=>({payload:e}))),updateRole:st("auth/updateRole",(e=>({payload:e}))),deleteRole:st("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:st("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:st("auth/attachPermissionToRoles",(e=>({payload:e})))},Rn={loading:!1,sessions:[]},Mn={setSessionsState:ft("sessionsState"),resetSessionsState:yt("sessionsState",{sessionsState:Rn})},Nn={loadUserSessions:st("auth/loadUserSessions"),loadCurrentUserSession:st("auth/loadCurrentUserSession"),deleteUserSession:st("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:st("auth/deleteAllUserSessions"),revokeUserSessions:st("auth/revokeUserSessions",(e=>({payload:e})))},Fn={loading:!1,configurations:{}},Gn={setSessionsPolicyState:ft("sessionsPolicyState"),resetSessionsPolicyState:yt("sessionsPolicyState",{sessionsPolicyState:Fn})},$n={loadSessionsPolicy:st("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:st("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let xn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(xn||(xn={}));const Vn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:xn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},jn={setRestrictionsState:ft("restrictionsState"),setIpRestrictionsState:pt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:pt("restrictionsState","emailDomainRestrictions")},Wn={checkIfUserIpValid:st("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:st("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:st("auth/loadIpRestrictions"),saveIpRestriction:st("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:st("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:st("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:st("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:st("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:st("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:st("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Bn={loading:!1},Kn={setProvisioningState:ft("provisioningState"),resetProvisioningState:yt("provisioningState",{provisioningState:Bn})},zn={loadProvisionConnections:st("auth/loadProvisionConnections"),createProvisionConnection:st("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:st("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:st("auth/updateProvisionConnection",(e=>({payload:e})))},qn={devices:[],loading:!1,error:null},Hn={setPasskeysState:ft("passkeysState"),resetPasskeysState:yt("passkeysState",{passkeysState:qn})},Jn={loadWebAuthnDevices:st("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:st("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Qn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Yn={setUsersGroupsLoader:gt("groupsState"),setUsersGroupsError:St("groupsState"),setGroupsState:ft("groupsState"),resetUsersGroupsState:yt("groupsState",{groupsState:Qn})},Xn={loadGroups:st("auth/loadUsersGroups"),getGroupById:st("auth/getGroupById",(e=>({payload:e}))),createGroup:st("auth/createGroup",(e=>({payload:e}))),updateGroup:st("auth/updateGroup",(e=>({payload:e}))),deleteGroup:st("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:st("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:st("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:st("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:st("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:st("auth/getGroupConfiguration"),updateGroupConfiguration:st("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:st("auth/getUsers",(e=>({payload:e})))},Zn={addGroupDialogState:{loading:!1,open:!1},editGroupDialogState:{loading:!1,open:!1},deleteGroupDialogState:{loading:!1,open:!1},addMembersToGroupDialogState:{loading:!1,open:!1,userIds:[]},deleteMemberFromGroupDialogState:{loading:!1,open:!1}},eo={setGroupsDialogsState:ft("groupsDialogsState"),resetGroupsDialogsState:yt("groupsState",{groupsDialogsState:Zn}),openAddGroupDialog:ht("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:ht("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:vt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:ht("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:vt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:ht("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:ht("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:ht("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:vt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:ht("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},to={loading:!0,error:null},no={setCustomLoginState:ft("customLoginState"),resetCustomLoginState:yt("customLoginState",{customLoginState:to})},oo={loadTenantMetadata:st("auth/loadTenantMetadata"),updateTenantMetadata:st("auth/updateTenantMetadata",(e=>({payload:e})))},io={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let ao,ro,lo,so;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ao||(ao={})),function(e){e.Nextjs="nextjs",e.React="react",e.Angular="angular",e.Vuejs="vuejs",e.Flutter="flutter",e.Ios="ios",e.Android="android",e.Vanillajs="vanillajs"}(ro||(ro={})),function(e){e.ASC="ASC",e.DESC="DESC"}(lo||(lo={})),function(e){e.createdAt="createdAt",e.name="name",e.email="email",e.id="id",e.verified="verified",e.isLocked="isLocked",e.provider="provider",e.tenantId="tenantId"}(so||(so={}));const co={loaders:{},errors:{},accounts:{tenantId:"",children:[]},accountsQueryParams:{_limit:2,_offset:0,_filter:"",_subTenantId:""},searchAccountsData:[],topAccount:{tenantId:""},selectedAccount:{tenantId:"",userJwt:{accessToken:"",expiresIn:0,expires:""},users:[],usersQueryParams:{_offset:0,_limit:10,_order:lo.DESC,_sortBy:so.name},usersPageOffset:0,accountSettings:{}},teamUsers:[]},uo={setAllAccountsLoader:gt("allAccountsState"),setAllAccountsError:St("allAccountsState"),setAllAccountsState:ft("allAccountsState"),setSelectedAccountState:pt("allAccountsState","selectedAccount"),resetAllAccountsState:yt("allAccountsState",{allAccountsState:co})},yo={loadAccounts:st("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:st("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:st("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:st("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:st("auth/updateAccount",(e=>({payload:e}))),deleteSubAccount:st("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:st("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:st("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:st("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:st("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:st("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:st("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setSelectedSubAccountData:st("auth/setSelectedSubAccountData",(e=>({payload:e})))},fo={createSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:"",canSelectParentAccount:!1},updateSubAccountDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1,jwt:""},deleteSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:""},addUsersToAccountDialog:{loading:!1,open:!1,accountName:"",accountId:"",permissionToGiveAccessToSubAccounts:!1,jwt:""},deleteUserFromAccountDialog:{userId:"",userName:"",accountId:"",loading:!1,open:!1,jwt:""},editUserRolesDialog:{loading:!1,open:!1,jwt:""}},po={setAllAccountDialogsState:ft("allAccountsDialogsState"),resetAllAccountDialogsState:yt("allAccountsDialogsState",{allAccountsDialogsState:fo}),openCreateSubAccountDialog:vt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:ht("allAccountsDialogsState","createSubAccountDialog",fo.createSubAccountDialog),openUpdateSubAccountDialog:vt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:ht("allAccountsDialogsState","updateSubAccountDialog",fo.updateSubAccountDialog),openDeleteSubAccountDialog:vt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:ht("allAccountsDialogsState","deleteSubAccountDialog",fo.deleteSubAccountDialog),openAddUsersToAccountDialog:vt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:ht("allAccountsDialogsState","addUsersToAccountDialog",fo.addUsersToAccountDialog),openDeleteUserFromAccountDialog:vt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:ht("allAccountsDialogsState","deleteUserFromAccountDialog",fo.deleteUserFromAccountDialog),openEditUserRolesDialog:vt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:ht("allAccountsDialogsState","editUserRolesDialog",fo.editUserRolesDialog)},go={setEntitlementsState:ft("entitlementsState")},So={loadEntitlements:st("auth/loadEntitlements")},vo={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:Sn,loginState:_t,activateState:Ft,acceptInvitationState:Vt,forgotPasswordState:Kt,ssoState:Xt,profileState:tn,customLoginState:to,mfaState:rn,teamState:cn,groupsState:Qn,groupsDialogsState:Zn,socialLoginState:yn,apiTokensState:mn,securityPolicyState:kn,accountSettingsState:In,tenantsState:On,rolesState:Cn,resetPhoneNumberState:Jt,sessionsState:Rn,sessionsPolicyState:Fn,restrictionsState:Vn,provisioningState:Bn,passkeysState:qn,allAccountsState:co,allAccountsDialogsState:fo,entitlementsState:{entitlements:void 0,loading:!1,error:void 0}},ho=U({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},vo);let mo;!function(e){e.impersonating="impersonating",e.success="success"}(mo||(mo={}));const Ao={step:mo.impersonating,loading:!1},bo={setImpersonateState:ft("impersonateState"),resetImpersonateState:yt("impersonateState",{impersonateState:Ao})},ko={impersonate:st("impersonation/impersonate",(e=>({payload:e})))},{reducer:To,actions:Po}=ut({name:wt,initialState:ho,reducers:U({resetState:e=>U({},e,vo),setState:(e,{payload:t})=>U({},e,t),setUser:("user",(e,{payload:t})=>U({},e,{user:t}))},Rt,fn,Gt,bo,jt,zt,Qt,vn,nn,no,Zt,ln,un,Yn,eo,An,Tn,En,wn,Dn,Mn,Gn,jn,Kn,Hn,uo,po,go)});const Io=U({},Po,Mt,pn,$t,Wt,qt,Yt,hn,on,oo,en,sn,dn,Xn,{},bn,Pn,Ln,Un,_n,Nn,$n,Wn,zn,So,ko,Jn,yo);var Eo=function(e){return"@@redux-saga/"+e},Lo=Eo("CANCEL_PROMISE"),Oo=Eo("CHANNEL_END"),wo=Eo("IO"),Uo=Eo("MATCH"),Co=Eo("MULTICAST"),Do=Eo("SAGA_ACTION"),_o=Eo("SELF_CANCELLATION"),Ro=Eo("TASK"),Mo=Eo("TASK_CANCEL"),No=Eo("TERMINATE"),Fo=Eo("LOCATION");function Go(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 $o=function(e){return null==e},xo=function(e){return null!=e},Vo=function(e){return"function"==typeof e},jo=function(e){return"string"==typeof e},Wo=Array.isArray,Bo=function(e){return e&&Vo(e.then)},Ko=function(e){return e&&Vo(e.next)&&Vo(e.throw)},zo=function e(t){return t&&(jo(t)||Jo(t)||Vo(t)||Wo(t)&&t.every(e))},qo=function(e){return e&&Vo(e.take)&&Vo(e.close)},Ho=function(e){return Vo(e)&&e.hasOwnProperty("toString")},Jo=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Qo=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[Lo]=function(){clearTimeout(n)},o},Yo=function(e){return function(){return e}},Xo=Yo(!0),Zo=function(){},ei=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var ti=function(e,t){U(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function ni(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var oi=function(e){throw e},ii=function(e){return{value:e,done:!0}};function ai(e,t,n){void 0===t&&(t=oi),void 0===n&&(n="iterator");var o={meta:{name:n},next:e,throw:t,return:ii,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function ri(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var li=function(e){return Array.apply(null,new Array(e))},si=function(e){return function(t){return e(Object.defineProperty(t,Do,{value:!0}))}},ci=function(e){return e===No},ui=function(e){return e===Mo},di=function(e){return ci(e)||ui(e)};function yi(e,t){var n,o=Object.keys(e),i=o.length,a=0,r=Wo(e)?li(i):{},l={};return o.forEach((function(e){var o=function(o,l){n||(l||di(o)?(t.cancel(),t(o,l)):(r[e]=o,++a===i&&(n=!0,t(r))))};o.cancel=Zo,l[e]=o})),t.cancel=function(){n||(n=!0,o.forEach((function(e){return l[e].cancel()})))},l}function fi(e){return{name:e.name||"anonymous",location:pi(e)}}function pi(e){return e[Fo]}var gi=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)},Si="TAKE",vi="CALL",hi="FORK",mi="SELECT",Ai=function(e,t){var n;return(n={})[wo]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function bi(e,t){return void 0===e&&(e="*"),zo(e)?(xo(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Ai(Si,{pattern:e})):qo(n=e)&&n[Co]&&xo(t)&&zo(t)?Ai(Si,{channel:e,pattern:t}):qo(e)?(xo(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Ai(Si,{channel:e})):void 0;var n}function ki(e,t){return $o(t)&&(t=e,e=void 0),Ai("PUT",{channel:e,action:t})}function Ti(e){var t=Ai("ALL",e);return t.combinator=!0,t}function Pi(e,t){var n,o=null;return Vo(e)?n=e:(Wo(e)?(o=e[0],n=e[1]):(o=e.context,n=e.fn),o&&jo(n)&&Vo(o[n])&&(n=o[n])),{context:o,fn:n,args:t}}function Ii(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 Ai(vi,Pi(e,n))}function Ei(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 Ai(hi,Pi(e,n))}function Li(e){return void 0===e&&(e=_o),Ai("CANCEL",e)}function Oi(e){void 0===e&&(e=ei);for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return Ai(mi,{selector:e,args:n})}var wi=Ii.bind(null,Qo);var Ui=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Ci=[],Di=0;function _i(e){try{Ni(),e()}finally{Fi()}}function Ri(e){Ci.push(e),Di||(Ni(),Gi())}function Mi(e){try{return Ni(),e()}finally{Gi()}}function Ni(){Di++}function Fi(){Di--}function Gi(){var e;for(Fi();!Di&&void 0!==(e=Ci.shift());)_i(e)}var $i=function(e){return function(t){return e.some((function(e){return Bi(e)(t)}))}},xi=function(e){return function(t){return e(t)}},Vi=function(e){return function(t){return t.type===String(e)}},ji=function(e){return function(t){return t.type===e}},Wi=function(){return Xo};function Bi(e){var t="*"===e?Wi:jo(e)?Vi:Wo(e)?$i:Ho(e)?Vi:Vo(e)?xi:Jo(e)?ji:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Ki={type:Oo},zi=function(e){return e&&e.type===Oo};function qi(){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(Ki)}))},(e={})[Co]=!0,e.put=function(e){if(!t)if(zi(e))a();else for(var i=n=o,r=0,l=i.length;r<l;r++){var s=i[r];s[Uo](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=Wi),t?e(Ki):(e[Uo]=n,i(),o.push(e),e.cancel=(a=!1,function(){a||(a=!0,i(),ni(o,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[Do]?l(e):Ri((function(){l(e)}))},r}function Hi(e,t){var n=e[Lo];Vo(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Ji,Qi=0,Yi=function(){return++Qi};function Xi(e){e.isRunning()&&e.cancel()}var Zi=((Ji={}).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):!zi(e)||r?n(e):n(No)};try{i.take(l,xo(a)?Bi(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},Ji.PUT=function(e,t,n){var o=t.channel,i=t.action,a=t.resolve;Ri((function(){var t;try{t=(o?o.put:e.dispatch)(i)}catch(e){return void n(e,!0)}a&&Bo(t)?Hi(t,n):n(t)}))},Ji.ALL=function(e,t,n,o){var i=o.digestEffect,a=Qi,r=Object.keys(t);if(0!==r.length){var l=yi(t,n);r.forEach((function(e){i(t[e],a,l[e],e)}))}else n(Wo(t)?[]:{})},Ji.RACE=function(e,t,n,o){var i=o.digestEffect,a=Qi,r=Object.keys(t),l=Wo(t)?li(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,o){c||(o||di(t)?(n.cancel(),n(t,o)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=Zo,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)}))},Ji.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(Bo(s))return void Hi(s,n);if(Ko(s))return void ca(e,s,l.context,Qi,fi(a),!1,n);n(s)}catch(e){n(e,!0)}},Ji.CPS=function(e,t,n){var o=t.context,i=t.fn,a=t.args;try{var r=function(e,t){$o(e)?n(t):n(e,!0)};i.apply(o,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Ji.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(Ko(i))return i;var a=!1;return ai((function(e){return a?{value:e,done:!0}:(a=!0,{value:i,done:!Bo(i)})}))}catch(e){return ai((function(){throw e}))}}({context:i,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:fi(t)}(c,a);Mi((function(){var t=ca(e,c,s.context,Qi,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},Ji.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()&&ni(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Wo(t)){if(0===t.length)return void n([]);var r=yi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Ji.CANCEL=function(e,t,n,o){var i=o.task;t===_o?Xi(i):Wo(t)?t.forEach(Xi):Xi(t),n()},Ji.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)}},Ji.ACTION_CHANNEL=function(e,t,n){var o=t.pattern,i=function(e){void 0===e&&(e=gi());var t=!1,n=[];return{take:function(o){t&&e.isEmpty()?o(Ki):e.isEmpty()?(n.push(o),o.cancel=function(){ni(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(Ki):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])(Ki)}}}}(t.buffer),a=Bi(o),r=function t(n){zi(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)},Ji.CANCELLED=function(e,t,n,o){n(o.task.isCancelled())},Ji.FLUSH=function(e,t,n){t.flush(n)},Ji.GET_CONTEXT=function(e,t,n,o){n(o.task.context[t])},Ji.SET_CONTEXT=function(e,t,n,o){var i=o.task;ti(i.context,t),n()},Ji);function ea(e,t){return e+"?"+t}function ta(e){var t=e.name,n=e.location;return n?t+" "+ea(n.fileName,n.lineNumber):t}function na(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 oa=null,ia=[],aa=function(e){e.crashedEffect=oa,ia.push(e)},ra=function(){oa=null,ia.length=0},la=function(){var e,t,n=ia[0],o=ia.slice(1),i=n.crashedEffect?(e=n.crashedEffect,(t=pi(e))?t.code+" "+ea(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+ta(n.meta)+(i?" \n when executing effect "+i:"")].concat(o.map((function(e){return" created by "+ta(e.meta)})),[na(ia)]).join("\n")};function sa(e,t,n,o,i,a,r){var l;void 0===r&&(r=Zo);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||(ni(i,t),t.cont=Zo,s?r(l):(t===e&&(o=l),i.length||(a=!0,n(o))))}}function s(){a||(a=!0,i.forEach((function(e){e.cont=Zo,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,aa({meta:i,cancelledTasks:y}),S.isRoot){var o=la();ra(),e.onError(t,{sagaStack:o})}c=t,d&&d.reject(t)}else t===Mo?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={})[Ro]=!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(Mo,!1))},l.cont=r,l.end=g,l.setContext=function(e){ti(f,e)},l.toPromise=function(){return d||(d=Ui(),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 ca(e,t,n,o,i,a,r){var l=e.finalizeRunEffect((function(t,n,o){Bo(t)?Hi(t,o):Ko(t)?ca(e,t,c.context,n,i,!1,o):t&&t[wo]?(0,Zi[t.type])(e,t.payload,o,u):o(t)}));d.cancel=Zo;var s={meta:i,cancel:function(){0===s.status&&(s.status=1,d(Mo))},status:0},c=sa(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),ra()):ui(e)?(s.status=1,d.cancel(),i=Vo(t.return)?t.return(Mo):{done:!0,value:Mo}):i=ci(e)?Vo(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=Yi();function s(n,i){a||(a=!0,o.cancel=Zo,e.sagaMonitor&&(i?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),i&&function(e){oa=e}(t),o(n,i))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:i,effect:t}),s.cancel=Zo,o.cancel=function(){a||(a=!0,s.cancel(),s.cancel=Zo,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function ua(e,t){for(var n=e.channel,o=void 0===n?qi():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?ri: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=Yi();if(s&&(s.rootSagaStarted=s.rootSagaStarted||Zo,s.effectTriggered=s.effectTriggered||Zo,s.effectResolved=s.effectResolved||Zo,s.effectRejected=s.effectRejected||Zo,s.effectCancelled=s.effectCancelled||Zo,s.actionDispatched=s.actionDispatched||Zo,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=We.apply(void 0,c);g=function(e){return function(t,n,o){return h((function(t){return e(t,n,o)}))(t)}}}else g=ei;var m={channel:o,dispatch:si(i),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return Mi((function(){var e=ca(m,S,l,v,fi(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var da=function(e){var t,n=void 0===e?{}:e,o=n.context,i=void 0===o?{}:o,a=n.channel,r=void 0===a?qi():a,l=n.sagaMonitor,s=Go(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,o=e.dispatch;return t=ua.bind(null,U({},s,{context:i,channel:r,dispatch:o,getState:n,sagaMonitor:l})),function(e){return function(t){l&&l.actionDispatched&&l.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){ti(i,e)},c},ya=function(e){return{done:!0,value:e}},fa={};function pa(e){return qo(e)?"channel":Ho(e)?String(e):Vo(e)?e.name:String(e)}function ga(e,t,n){var o,i,a,r=t;function l(t,n){if(r===fa)return ya(t);if(n&&!i)throw r=fa,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===fa?ya(t):a}return ai(l,(function(e){return l(null,e)}),n)}function Sa(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:bi(e)},l=function(e){return{done:!1,value:Ei.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return ga({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+pa(e)+", "+t.name+")")}function va(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:bi(e)},s=function(e){return{done:!1,value:Ei.apply(void 0,[t].concat(o,[e]))}},c=function(e){return{done:!1,value:Li(e)}},u=function(e){return a=e},d=function(e){return r=e};return ga({q1:function(){return{nextState:"q2",effect:l,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:s(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:s(r),stateUpdater:u}}},"q1","takeLatest("+pa(e)+", "+t.name+")")}function ha(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:bi(e)},l=function(e){return{done:!1,value:Ii.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return ga({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+pa(e)+", "+t.name+")")}function ma(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:Ii.apply(void 0,[n].concat(a))},s={done:!1,value:wi(t)};return ga({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:fa}},q10:function(e){if((o-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}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 Ei.apply(void 0,[Sa,e,t].concat(o))}function ba(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 Ei.apply(void 0,[va,e,t].concat(o))}function ka(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 Ei.apply(void 0,[ha,e,t].concat(o))}class Ta{constructor(){this.context=null,this.accessToken=null,this.user=null,this.requestSource=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return Ta.instance||(Ta.instance=new Ta),Ta.instance}static setContext(e){Ta.getInstance().context=e}static setAccessToken(e){Ta.getInstance().accessToken=e}static setUser(e){Ta.getInstance().user=e}static setRequestSource(e){Ta.getInstance().requestSource=e}static setOnRedirectTo(e){Ta.getInstance().onRedirectTo=e}static setLogout(e,t){Ta.getInstance().logout=n=>{n?e(n):Ta.onRedirectTo(t)}}static getContext(){var e;return null!=(e=Ta.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Ta.getInstance().accessToken}static getRequestSource(){return Ta.getInstance().requestSource}static getUser(){return Ta.getInstance().user}static onRedirectTo(e,t){return Ta.getInstance().onRedirectTo(e,t)}static logout(e){return Ta.getInstance().logout(e)}}Ta.instance=void 0;const Pa={getContext:()=>Ta.getContext(),getAccessToken:()=>Ta.getAccessToken(),getUser:()=>Ta.getUser(),onRedirectTo:(e,t)=>Ta.onRedirectTo(e,t),logout:e=>Ta.logout(e)};class Ia extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Ea={v1:"/identity/resources/users/webauthn/v1/devices"},La={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Oa={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",roles:{v3:"/identity/resources/users/v3/roles"},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"}}},wa={v1:"/identity/resources/configurations/v1"},Ua={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Ca={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Da={v1:"/identity/resources/permissions/v1"},_a={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},accessTokens:{v1:"/identity/resources/tenants/access-tokens/v1"},invites:{user:{v1:"/identity/resources/tenants/invites/v1/user"},verify:{v1:"/identity/resources/tenants/invites/v1/verify"},configuration:{v1:"/identity/resources/tenants/invites/v1/configuration"}},users:{v1:"/identity/resources/tenants/users/v1"}},Ra={v1:"/identity/resources/roles/v1"},Ma={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Na={v1:"/identity/resources/impersonation/v1"},Fa={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Ga={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},$a={v1:"/team/resources/members/v1"},xa={v1:"/team/resources/roles/v1"},Va={v1:"/team/resources/stats/v1"},ja={v1:"/team/resources/profile"},Wa={v1:"/tenants/resources/account-settings/v1"},Ba={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"},v2:"/tenants/resources/hierarchy/v2",metadata:{v2:"/tenants/resources/hierarchy/v2/metadata"}},Ka={v1:"/tenants/resources/sub-tenants/v1"},za={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},qa={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"}}}},Ha={v1:"/subscriptions/resources/payment-providers/v1"},Ja={v1:"/subscriptions/resources/subscriptions/v1"},Qa={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Ya={v1:"/reports/engine/resources/triggers/v1"},Xa="/notification",Za="/audits",er={v1:"/event/resources/configurations/v1"},tr="/webhook",nr="/oauth",or="/flags",ir="/directory/resources/v1/configurations/scim2",ar="/directory/resources/scim/temp",rr="/entitlements/api/v1/user-entitlements";function lr(e,t,n=!0){let o;o="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const i=e.urlPrefix||"frontegg",a="frontegg"===i&&!n;return o.endsWith("/")||(o+="/"),o.endsWith(i)||a||(o+=i),o}function sr(e){var t,n;const o={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(o[io.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(o[io.frameWork]=e.metadataHeaders.framework),o}const cr=async e=>{var t,n,o;const i=Ta.getContext(),a=await async function(e,t){var n;const o=sr(e),i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Ta.getAccessToken)(),a=Ta.getRequestSource();t&&(o[io.contentType]=t),a&&(o[io.source]=a),i&&(o.Authorization=`Bearer ${i}`);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))o[`${t.key}`]=`${t.value}`;return o}(i,e.contentType),r=await async function(e,t,n){const o=lr(e,t),i=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const o=Object.keys(t);for(const e of o){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${o}${t}`;const r=Object.keys(i).length>0;return i&&r&&(a+=`?${new URLSearchParams(i)}`),a}(i,e.url,e.params),l=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:U({},a,e.headers),credentials:null!=(n=null!=(o=e.credentials)?o:i.requestCredentials)?n:"same-origin"});if(302===l.status)return window.location.href=await l.text(),new Promise((()=>{}));if(!l.ok){var s,c;if(413===l.status)throw new Ia("Error request is too large",l.status);let e,t=!0;try{e=await l.text(),e=JSON.parse(e)}catch(e){t=!1}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=i.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=i.logLevel)?c:"")&&console.error(e),new Ia(t?e:"We're facing some difficulties, Please try again",l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},ur=async(e,t,n)=>cr(U({url:e,method:"GET",contentType:"application/json",params:t},n)),dr=async(e,t,n)=>cr(U({url:e,method:"POST",contentType:"application/json",body:t},n)),yr=async(e,t,n)=>cr(U({url:e,method:"PATCH",contentType:"application/json",body:t},n)),fr=async(e,t,n)=>cr(U({url:e,method:"PUT",contentType:"application/json",body:t},n)),pr=async(e,t,n)=>cr(U({url:e,method:"DELETE",contentType:"application/json",body:t},n)),gr=async(e,t,n,o)=>cr(U({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),Sr=(e={})=>U({},e.jwt?{Authorization:e.jwt}:{});async function vr(e){return fr(`${Oa.v1}/tenant`,e)}async function hr(){return ur(`${Oa.v2}/me/tenants`)}async function mr(e){return ur(Ba.v1,void 0,{headers:Sr(e)})}async function Ar(e){return ur(Ba.tree.v1,void 0,{headers:Sr(e)})}async function br(e){return ur(Ba.parents.v1,void 0,{headers:Sr(e)})}async function kr(e,t){return ur(`${Ba.parents.v1}/${e}`,void 0,{headers:Sr(t)})}async function Tr(e,t){return dr(`${_a.users.v1}/count`,e,{headers:Sr(t)})}async function Pr(e,t){return ur(Ba.v2,e,{headers:Sr(t)})}async function Ir(e,t){return ur(Ba.metadata.v2,U({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Sr(t)})}async function Er(){return ur(wa.v1)}async function Lr(){return ur(`${wa.v1}/mfa-policy`)}async function Or(){return ur(`${wa.v1}/mfa-policy/vendor`)}async function wr(e){return e.id?yr(`${wa.v1}/mfa-policy`,e):dr(`${wa.v1}/mfa-policy`,e)}async function Ur(){return ur(`${wa.v1}/lockout-policy`)}async function Cr(){return ur(`${wa.v1}/lockout-policy/vendor`)}async function Dr(e){return e.id?yr(`${wa.v1}/lockout-policy`,e):dr(`${wa.v1}/lockout-policy`,e)}async function _r(){try{return await ur(`${wa.v1}/captcha-policy/public`)}catch{return null}}async function Rr(){return ur(`${wa.v1}/password-history-policy`)}async function Mr(){return ur(`${wa.v1}/password-history-policy/vendor`)}async function Nr(e){return e.id?yr(`${wa.v1}/password-history-policy`,e):dr(`${wa.v1}/password-history-policy`,e)}async function Fr(){return ur(`${wa.v1}/password`)}async function Gr(){return ur(`${Ua.emailDomain.v1}`)}async function $r(){return ur(`${Ua.emailDomain.v1}/config`)}async function xr(e){return dr(`${Ua.emailDomain.v1}`,e)}async function Vr(e){return dr(`${Ua.emailDomain.v1}/config`,e)}async function jr(e){return pr(`${Ua.emailDomain.v1}/${e}`)}async function Wr(e){return ur(`${Ua.ip.v1}`,e)}async function Br(){return ur(`${Ua.ip.v1}/config`)}async function Kr(e){return dr(`${Ua.ip.v1}`,e)}async function zr(e){return dr(`${Ua.ip.v1}/bulk`,e)}async function qr(e){return dr(`${Ua.ip.v1}/config`,e)}async function Hr(e){return pr(`${Ua.ip.v1}/${e}`)}async function Jr(){return dr(`${Ua.ip.v1}/verify`)}async function Qr(){return dr(`${Ua.ip.v1}/verify/allow`)}let Yr,Xr,Zr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Yr||(Yr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Xr||(Xr={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Zr||(Zr={}));class el extends Error{constructor(e){super(e)}}const tl="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new el("'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 nl extends Error{constructor(e){super(e)}}const ol=(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(tl(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 tl(t)}})(e.split(".")[n]))}catch(e){throw new nl("Invalid token specified: "+e.message)}},il=["type"],al=["type"];async function rl(e){if(!e.accessToken)return e;Ta.setAccessToken(e.accessToken);const t=await ur(`${Oa.v2}/me`),n=U({},e,e.accessToken?ol(e.accessToken):{},t);return Ta.setUser(n),n}async function ll(e){if(!e.accessToken)return{user:e};Ta.setAccessToken(e.accessToken);const[t,n]=await Promise.all([ur(`${Oa.v2}/me`),hr()]),o=U({},e,e.accessToken?ol(e.accessToken):{},t);return Ta.setUser(o),{user:o,tenants:n}}async function sl(e){Ta.setAccessToken(e.id_token);const t=await ur(`${Oa.v2}/me`),n=e.id_token?ol(e.id_token):{},o=U({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Ta.setUser(o),o}async function cl(e){try{const{address:t}=await dr(`${La.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function ul(e){return dr(`${La.v1}/user/saml/prelogin`,e)}async function dl(e){return rl(await dr(`${La.v1}/user/saml/postlogin`,e))}async function yl(e){return rl(await dr(`${La.v1}/user/oidc/postlogin`,e))}async function fl(e){return rl(await dr(`${La.v1}/user`,e))}async function pl(e){return rl(await dr(`${La.v1}/user/mfa/verify`,e))}async function gl(e){return dr(`${Oa.v1}/activate`,e)}async function Sl(e){return ur(`${Oa.v1}/activate/strategy`,e)}async function vl(e){return dr(`${Oa.v1}/activate/reset`,e)}async function hl(e){return dr(`${Oa.v1}/invitation/reset`,e)}async function ml(e){return dr(`${Oa.v1}/invitation/accept`,e)}async function Al(){return rl(await dr(`${La.v1}/user/token/refresh`))}async function bl(){return ll(await dr(`${La.v1}/user/token/refresh`))}async function kl(){return dr(`${La.v1}/logout`)}async function Tl(e){return ur(`${nr}/logout`,e)}async function Pl(e){return dr(`${Oa.v1}/passwords/reset`,e)}async function Il(e){return dr(`${Oa.v1}/passwords/reset/verify`,e)}async function El(e){return ur(`${Oa.v1}/passwords/config`,e)}async function Ll(e){return dr(`${La.v1}/user/mfa/recover`,e)}async function Ol(){return dr(`${Oa.v1}/mfa/enroll`)}async function wl(){return dr(`${Oa.v1}/mfa/authenticator/enroll`)}async function Ul(e){return dr(`${Oa.v1}/mfa/authenticator/enroll/verify`,e)}async function Cl(e){return dr(`${Oa.v1}/mfa/sms/enroll`,e)}async function Dl(e){return dr(`${Oa.v1}/mfa/sms/enroll/verify`,e)}async function _l(){return dr(`${Oa.v1}/mfa/webauthn/enroll`)}async function Rl(e){return dr(`${Oa.v1}/mfa/webauthn/enroll/verify`,e)}async function Ml(e){return dr(`${Oa.v1}/mfa/enroll/verify`,e)}async function Nl(e){return dr(`${Oa.v1}/mfa/disable`,e)}async function Fl(e,t){return dr(`${Oa.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Gl(e){return dr(`${Oa.v1}/mfa/sms/${e}/disable`)}async function $l(e,t){return dr(`${Oa.v1}/mfa/sms/${e}/disable/verify`,t)}async function xl(e){return dr(`${Oa.v1}/mfa/webauthn/${e}/disable`)}async function Vl(e,t){return dr(`${Oa.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function jl(){return ur(`${Oa.v1}/mfa/devices`)}async function Wl(e){return dr(`${La.v1}/user/mfa/authenticator/enroll`,e)}async function Bl(e){return dr(`${La.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Kl(e,t){return dr(`${La.v1}/user/mfa/authenticator/${e}/verify`,t)}async function zl(e){return dr(`${La.v1}/user/mfa/sms/enroll`,e)}async function ql(e){return dr(`${La.v1}/user/mfa/sms/enroll/verify`,e)}async function Hl(e,t){return dr(`${La.v1}/user/mfa/sms/${e}`,t)}async function Jl(e,t){return dr(`${La.v1}/user/mfa/sms/${e}/verify`,t)}async function Ql(e){return dr(`${La.v1}/user/mfa/webauthn/enroll`,e)}async function Yl(e){return dr(`${La.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Xl(e,t){return dr(`${La.v1}/user/mfa/webauthn/${e}`,t)}async function Zl(e,t){return dr(`${La.v1}/user/mfa/webauthn/${e}/verify`,t)}async function es(){return ur(`${Ga.v1}/saml/configurations`)}async function ts(e){return dr(`${Ga.v1}/saml/configurations`,e)}async function ns(){return ur(`${Ga.v1}/saml/configurations/vendor-config`)}async function os(e){return fr(`${Ga.v1}/saml/configurations/metadata`,e)}async function is(){return fr(`${Ga.v1}/saml/validations/domain`)}async function as(){return ur(`${Ga.v1}/saml/configurations/roles/default`)}async function rs(){return ur(`${Ga.v2}/saml/configurations/groups`)}async function ls({roleIds:e}){return dr(`${Ga.v1}/saml/configurations/roles/default`,{roleIds:e})}async function ss({roleIds:e,group:t}){return dr(`${Ga.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function cs({roleIds:e,group:t,id:n}){return yr(`${Ga.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function us({id:e}){return pr(`${Ga.v2}/saml/configurations/groups/${e}`)}async function ds(){return ur(`${Ga.v1}/oidc/configurations`)}async function ys(){return ur(`${Ga.v2}/configurations/public`)}async function fs(){return ur(Ca.v1)}async function ps(){return ur(Ca.v2)}async function gs(){return ur(Ca.custom.v1)}async function Ss({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),dr(`${La.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function vs(){return ur(`${wa.v1}/public`)}async function hs(e){const{shouldActivate:t,authResponse:n,userId:o,tenantId:i}=await dr(`${Oa.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await rl(n):void 0,userId:o,tenantId:i}}async function ms(){return ur(Oa.sessions.currentUser.v1)}async function As(){return ur(`${Oa.sessions.currentUser.v1}/current`)}async function bs(e){return dr(`${Oa.sessions.v1}/revoke`,{userId:e})}async function ks(){return ur(Oa.sessions.configurations.v1)}async function Ts(e){await dr(Oa.sessions.configurations.v1,e)}async function Ps(e){await pr(`${Oa.sessions.currentUser.v1}/${e}`)}async function Is(){await pr(`${Oa.sessions.currentUser.v1}/all`)}async function Es(){return ur(Oa.accessTokens.v1)}async function Ls(){return ur(_a.accessTokens.v1)}async function Os({id:e}){return pr(`${_a.accessTokens.v1}/${e}`)}async function ws({id:e}){return pr(`${Oa.accessTokens.v1}/${e}`)}async function Us(e){return dr(Oa.accessTokens.v1,e)}async function Cs(e){return dr(_a.accessTokens.v1,e)}async function Ds(){return ur(Oa.apiTokens.v1)}async function _s(){return ur(_a.apiTokens.v1)}async function Rs(e){return dr(Oa.apiTokens.v1,e)}async function Ms(e){return dr(_a.apiTokens.v2,e)}async function Ns({tokenId:e}){return pr(`${_a.apiTokens.v1}/${e}`)}async function Fs({tokenId:e}){return pr(`${Oa.apiTokens.v1}/${e}`)}async function Gs({userId:e}){return ur(`${Oa.v1}/${e}`)}async function $s(e){return ur(`${wa.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function xs(e){let{type:t}=e,n=Go(e,il);return dr(`${La.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Vs(e){let{type:t}=e,n=Go(e,al);return dr(`${La.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function js({token:e}){return dr(_a.invites.verify.v1,{token:e})}async function Ws(){return ur(`${Ga.v1}/configurations`)}async function Bs(e){return dr(`${Ga.v1}/configurations`,e)}async function Ks(e,t){return yr(`${Ga.v1}/configurations/${e}`,t)}async function zs(e){return pr(`${Ga.v1}/configurations/${e}`)}async function qs(e){return dr(`${Ga.v1}/configurations/metadata`,e)}async function Hs(e,t){return fr(`${Ga.v1}/configurations/${e}/metadata`,t)}async function Js(e,t){return dr(`${Ga.v1}/configurations/${e}/domains`,t)}async function Qs(e,t){return pr(`${Ga.v1}/configurations/${e}/domains/${t}`)}async function Ys(e,t){return fr(`${Ga.v1}/configurations/${e}/domains/${t}/validate`)}async function Xs(e){return ur(`${Ga.v1}/configurations/${e}/roles`)}async function Zs(e,t){return fr(`${Ga.v1}/configurations/${e}/roles`,t)}async function ec(e,t){return dr(`${Ga.v1}/configurations/${e}/groups`,t)}async function tc(e,{roleIds:t,group:n,id:o}){return yr(`${Ga.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function nc(e,t){return pr(`${Ga.v1}/configurations/${e}/groups/${t}`)}async function oc(e){return ur(`${Ga.v1}/configurations/${e}/groups`)}async function ic(e){return dr(`${La.v2}/user/sso/prelogin`,e)}async function ac(e){return rl(await dr(`${La.v2}/user/oidc/postlogin`,e))}async function rc(e){return sl(await dr(`${nr}/token`,e))}async function lc(){return sl(await dr(`${nr}/authorize/silent`))}async function sc(e){return dr(`${Oa.v1}/phone/reset`,e)}async function cc(e){return dr(`${Oa.v1}/phone/reset/verify`,e)}async function uc(e){return dr(`${Oa.v1}/phone`,e)}async function dc(e){return dr(`${Oa.v1}/phone/verify`,e)}async function yc(e){return fr(`${Oa.v1}/phone/change`,e)}async function fc(e){return dr(`${La.v1}/webauthn/prelogin`,e)}async function pc(e){return dr(`${La.v1}/webauthn/postlogin`,e)}async function gc(){return dr(Ea.v1)}async function Sc(){return ur(Ea.v1)}async function vc(e){return pr(`${Ea.v1}/${e}`)}async function hc(e){return dr(`${Ea.v1}/verify`,e)}async function mc(){return ur(`${wa.v1}/auth/strategies/public`)}async function Ac(){return ur(`${wa.v1}/mfa/strategies`)}async function bc(e){return ur(`${Oa.v2}/me`,null!=e?e:{addRoles:!0})}async function kc(e){return fr(`${Oa.v2}/me`,e)}async function Tc(e){return fr(`${ja.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Pc(e){return dr(`${Oa.v1}/passwords/change`,e)}async function Ic(e){var t,n,o,i,a,r;const l=(e.filter||[]).reduce(((e,t)=>U({},e,{[t.id]:t.value})),{}),s=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(o=e.sort)||null==(i=o[0])?void 0:i.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return ur($a.v1,U({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function Ec(e){return dr(Oa.v2,U({},e,{provider:"local"}))}async function Lc(e){return pr(`${$a.v1}/${e.userId}`)}async function Oc(e){return fr($a.v1,e)}async function wc(e){return dr(_a.invites.user.v1,U({},e))}async function Uc(e){return yr(_a.invites.user.v1,U({},e))}async function Cc(){return pr(_a.invites.user.v1)}async function Dc(){return ur(_a.invites.user.v1)}async function _c(){return ur(_a.invites.configuration.v1)}async function Rc(){return ur(xa.v1)}async function Mc(){return ur(Da.v1)}async function Nc(){return ur(`${Va.v1}/members`)}async function Fc(e){return dr(`${$a.v1}/${e.userId}/resendActivationEmail`,{})}async function Gc(e){return dr(Oa.v2,U({},e,{provider:"local"}))}async function $c(e){return dr(Oa.invitation.resendAll.v1,U({},e))}async function xc(e){var t,n;const o=await ur("/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 Vc(){return ur("/metadata/admin-box")}async function jc(e){return dr("/metadata/admin-box",e)}async function Wc(){const e=await ur("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Bc=async()=>xc({entityName:"notifications"}),Kc=async()=>xc({entityName:"saml"}),zc=async()=>xc({entityName:"audits"}),qc=async e=>async function(e){const t=await ur(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Hc=["dataFilters"],Jc=["templateId","dataFilters"],Qc=["dataFilters"];async function Yc(e){return ur(`${Qa.v2}/tenant-reports`,e)}async function Xc(e){return ur(`${Qa.v2}/${e.id}/tenant-reports`)}async function Zc(e){let{dataFilters:t}=e,n=Go(e,Hc);return{html:await ur(`${Ya.v1}/preview-report`,U({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function eu(e){let{templateId:t,dataFilters:n}=e,o=Go(e,Jc);return dr(`${Qa.v2}/${t}/tenant-reports`,U({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function tu(e){let{dataFilters:t}=e,n=Go(e,Qc);const o=await ur(`${Ya.v1}/preview-report`,U({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let i="text/html",a="html";"pdf"===n.responseType?(i="application/pdf",a="pdf"):"image"===n.responseType&&(i="image/jpeg",a="jpg");const r=new Blob([o],{type:i}),l=URL.createObjectURL(r),s=document.createElement("a");s.href=l,s.setAttribute("download",`report_${n.name||""}.${a}`),s.click(),setTimeout(s.remove.bind(s))}async function nu(e){return dr(`${Ya.v1}/tenant-reports`,e)}async function ou(e){return ur(Xa,{params:e})}async function iu(e){return fr(`${Xa}/status`,{params:e})}async function au(e){const{notificationId:t,pinStatus:n}=e;return fr(`${Xa}/${n}`,{notificationId:t})}async function ru(){return dr(`${Xa}/status/mark-all-read`)}const lu=["endpoint","headerProps"];async function su(e){return ur(Za,e)}async function cu(e){return ur(`${Za}/stats`,e)}async function uu(e){const{endpoint:t,headerProps:n}=e,o=Go(e,lu);return gr(`${Za}/export/${t}`,{properties:n},o)}const du=["eventKey"],yu=["eventKey"],fu=()=>ur(`${za.v1}/slack`),pu=()=>ur(`${za.v1}/slack/applications`),gu=()=>ur(`${za.v1}/slack/channels`),Su=e=>e.id?yr(`${za.v1}/slack/subscription/${e.id}`,e):dr(`${za.v1}/slack/subscriptions`,e),vu=e=>pr(`${za.v1}/slack/subscriptions/${e.id}`),hu=e=>dr(`${za.v1}/slack/applications/registrations`,{code:e}),mu=()=>ur(`${za.v1}/emails`),Au=e=>{let{eventKey:t}=e,n=Go(e,du);return dr(`${za.v1}/emails/${t}`,n)},bu=({eventKey:e,enabled:t})=>yr(`${za.v1}/emails/${e}`,{enabled:t}),ku=(e,t)=>pr(`${za.v1}/emails/${e}/subscriptions/${t}`),Tu=(e,t,n)=>fr(`${za.v1}/emails/${t}/subscriptions/${e}`,n),Pu=e=>pr(`${za.v1}/emails/${e}`),Iu=()=>ur(`${za.v2}/sms`),Eu=e=>{let{eventKey:t}=e,n=Go(e,yu);return dr(`${za.v2}/sms/${t}`,n)},Lu=({eventKey:e,enabled:t})=>yr(`${za.v2}/sms/${e}`,{enabled:t}),Ou=(e,t)=>pr(`${za.v2}/sms/${e}/subscriptions/${t}`),wu=(e,t,n)=>fr(`${za.v2}/sms/${t}/subscriptions/${e}`,n),Uu=e=>pr(`${za.v2}/sms/${e}`),Cu=()=>ur(tr),Du=e=>e._id?yr(`${tr}/${e._id}`,e):dr(`${tr}/custom`,e),_u=e=>pr(`${tr}/${e}`),Ru=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return ur(`${tr}/logs/?${o.toString()}`)},Mu=e=>dr(`${tr}/test`,e),Nu=e=>dr(`${tr}/logs/${e}/retries`),Fu=()=>ur(`${er.v1}/categories`),Gu=e=>ur(er.v1,{channels:e});async function $u(e,t){return fr(Wa.v1,e,{headers:Sr(t)})}async function xu(e){return ur(Wa.v1,void 0,{headers:Sr(e)})}async function Vu(){return ur(`${Wa.v1}/public`)}const ju=["roleId"],Wu=["roleId"],Bu=["permissionId"];async function Ku(){return ur(Ra.v1)}async function zu(e){return dr(Ra.v1,e)}async function qu({roleId:e}){return pr(`${Ra.v1}/${e}`)}async function Hu(e){let{roleId:t}=e,n=Go(e,ju);return yr(`${Ra.v1}/${t}`,n)}async function Ju(e){let{roleId:t}=e,n=Go(e,Wu);return fr(`${Ra.v1}/${t}/permissions`,n)}async function Qu(){return ur(Da.v1)}async function Yu(e){let{permissionId:t}=e,n=Go(e,Bu);return fr(`${Da.v1}/${t}/roles`,n)}async function Xu(){return ur(`${Da.v1}/categories`)}async function Zu(){return ur(qa.subscriptions.v1)}async function ed(e){return ur(`${qa.subscriptions.v1}/${e}`)}async function td(e){return fr(`${qa.subscriptions.v1}/${e}/cancellations/`,{})}async function nd(e){return fr(`${qa.subscriptions.v1}/${e}/renewals/`,{})}async function od(e,{paymentMethodId:t,planId:n}){return fr(`${qa.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function id(e){return ur(`${Ja.v1}/${e}`)}async function ad(){return ur(`${Ja.v1}`)}async function rd(e){return fr(`${Ja.v1}/${e}/cancellations/`,{})}async function ld(e){return fr(`${Ja.v1}/${e}/renewals/`,{})}async function sd(e,{paymentMethodId:t,planId:n}){return fr(`${Ja.v1}/${e}`,{paymentMethodId:t,planId:n})}async function cd(){return ur(qa.plans.v1)}async function ud(e){return ur(`${qa.plans.v1}/${e}`)}async function dd(){return ur(qa.invoices.v1)}async function yd(e){return ur(`${qa.invoices.v1}/${e}`)}async function fd(e,t){return ur(`${qa.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const pd=["email"];async function gd(){return ur(qa.paymentMethods.v1)}async function Sd(e){return ur(`${qa.paymentMethods.v1}/${e}`)}async function vd(e,t){let{email:n}=t,o=Go(t,pd);return yr(`${qa.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function hd(e){return dr(qa.paymentProviders.stripe.subscriptions.v1,e)}async function md(e){return ur(`${qa.paymentProviders.stripe.customers.v1}/${e}`)}async function Ad(e){return dr(`${qa.paymentProviders.stripe.customers.v1}`,e)}async function bd(){return ur(`${qa.paymentProviders.stripe.publicConfigurations.v1}`)}async function kd(e){return dr(`${qa.paymentProviders.stripe.setupIntents.v1}`,e)}async function Td(e){return ur(`${qa.summaries.v1}/${e}`)}async function Pd(e){return ur(`${qa.tenantConfiguration.v1}/${e}`)}async function Id(e){return dr(`${qa.tenantConfiguration.v1}`,e)}async function Ed(){return ur(Ha.v1)}async function Ld(){return ur(`${qa.configurations.vendorPublicConfigurations.v1}`)}let Od,wd,Ud,Cd,Dd,_d;async function Rd(){return ur("/vendors/public")}async function Md(e){return ur(Ma.v1,e)}async function Nd(e){return dr(Ma.v1,e)}async function Fd(e,t){return pr(Ma.v1,e,{headers:Sr(t)})}async function Gd(e,t,n){return dr(`${Ma.v1}/${e}/roles`,t,{headers:Sr(n)})}async function $d(e,t,n){return pr(`${Ma.v1}/${e}/roles`,t,{headers:Sr(n)})}async function xd(e,t,n){return yr(`${Ma.v1}/${e}/roles`,t,{headers:Sr(n)})}async function Vd(e,t){return dr(Ka.v1,e,{headers:Sr(t)})}async function jd(e,t){return pr(`${Ka.v1}/${e}`,void 0,{headers:Sr(t)})}async function Wd({tenantId:e},t,n){return yr(`${Ka.v1}/${e}`,t,{headers:Sr(n)})}async function Bd(e,t,n){return fr(`${Ma.v1}/${e}/access`,t,{headers:Sr(n)})}async function Kd(e,t){return dr(`${Ma.v2}/`,e,{headers:Sr(t)})}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Od||(Od={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(wd||(wd={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Ud||(Ud={})),(Cd||(Cd={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Dd||(Dd={})),function(e){e.CREATE="create_customer"}(_d||(_d={}));const zd={flags:{}};class qd{constructor(){var e;this._flags={},this._flags=null!=(e=zd.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new qd;return n.set(e),qd._instances[t]=n,n}static getFeatureFlags(e,t){const n=this.getInstance(t);return e.map((e=>"on"===(null==n?void 0:n._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t;this._flags=U({},null!=(t=null==zd?void 0:zd.flags)?t:{},null!=e?e:{})}}async function Hd(){return ur(or)}async function Jd(){return ur(`${ir}`)}async function Qd(e,t){return yr(`${ir}/${e}`,t)}async function Yd(e){return dr(`${ir}`,e)}async function Xd(e){return pr(`${ir}/${e}`)}async function Zd(e){return ur(`${ar}/${e}/Users/count`)}async function ey(e){return dr(`${Na.v1}`,e)}qd._instances={};const ty=["groupId"];async function ny({groupId:e},t){return ur(`${Fa.v1}/${e}`,U({},t))}async function oy(e){return ur(`${Fa.v1}`,U({},e))}async function iy(e,t){return dr(`${Fa.getByIds.v1}`,e,{params:t})}async function ay(e){return dr(`${Fa.v1}`,e)}async function ry(e){let{groupId:t}=e,n=Go(e,ty);return yr(`${Fa.v1}/${t}`,n)}async function ly(e){return pr(`${Fa.v1}/${e}`)}async function sy(e,t){return dr(`${Fa.v1}/${e}/roles`,t)}async function cy(e,t){return pr(`${Fa.v1}/${e}/roles`,t)}async function uy(e,t){return dr(`${Fa.v1}/${e}/users`,t)}async function dy(e,t){return pr(`${Fa.v1}/${e}/users`,t)}async function yy(){return ur(`${Fa.configurations.v1}`)}async function fy(e){return dr(`${Fa.configurations.v1}`,e)}async function py(e){return dr(`${Oa.v3}/me/token`,e)}async function gy(e,t){return ur(Oa.v3,e,{headers:Sr(t)})}async function Sy(e,t){return ur(Oa.roles.v3,U({},e,{ids:e.ids.join(",")}),{headers:Sr(t)})}async function vy(){return ur(rr)}let hy,my,Ay,by,ky,Ty;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(hy||(hy={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(my||(my={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Ay||(Ay={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(by||(by={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(ky||(ky={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Ty||(Ty={}));const Py=[/^(.*)\/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],Iy=`${La.v1}/user/token/refresh`,Ey=`${nr}/authorize/silent`,Ly=`${Oa.v2}/me`,Oy=`${Oa.v2}/me/tenants`;let wy,Uy,Cy;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(wy||(wy={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Uy||(Uy={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Cy||(Cy={}));const Dy={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,users:A,entitlements:b};var _y={fetch:e,ContextHolder:Ta,FronteggContext:Pa,api:Dy,FronteggApiError:Ia,AuthStrategyEnum:Xr,MachineToMachineAuthStrategy:Zr,SocialLoginProviders:Yr,ISubscriptionCancellationPolicy:Ud,ISubscriptionStatus:Od,PaymentMethodType:wd,ProviderType:Cd};let Ry,My;!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"}(Ry||(Ry={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(My||(My={}));const Ny="input is invalid type",Fy="undefined"!=typeof ArrayBuffer,Gy="0123456789abcdef".split(""),$y=[-2147483648,8388608,32768,128],xy=[24,16,8,0],Vy=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],jy=["hex","array","digest","arrayBuffer"],Wy=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Fy&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const By=function(e){return function(t){const n=new zy(!0).update(t);return null==n?void 0:n[e]()}},Ky=function(e){return function(t,n){const o=new qy(t,!0).update(n);return null==o?void 0:o[e]()}};class zy{constructor(e=!1){this.blocks=void 0,this.h0=void 0,this.h1=void 0,this.h2=void 0,this.h3=void 0,this.h4=void 0,this.h5=void 0,this.h6=void 0,this.h7=void 0,this.block=void 0,this.start=void 0,this.bytes=void 0,this.hBytes=void 0,this.finalized=void 0,this.hashed=void 0,this.first=void 0,this.lastByteIndex=void 0,this.sharedMemory=!1,this.toString=()=>this.hex(),this.array=()=>zy.prototype.digest(),e?(Wy[0]=Wy[16]=Wy[1]=Wy[2]=Wy[3]=Wy[4]=Wy[5]=Wy[6]=Wy[7]=Wy[8]=Wy[9]=Wy[10]=Wy[11]=Wy[12]=Wy[13]=Wy[14]=Wy[15]=0,this.blocks=Wy):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.sharedMemory=e}update(e){if(this.finalized)return;let t;const n=typeof e;if("string"!==n){if("object"!==n)throw new Error(Ny);if(null===e)throw new Error(Ny);if(Fy&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Fy&&ArrayBuffer.isView(e)))throw new Error(Ny);t=!0}let o,i,a=0;const r=e.length,l=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,l[0]=this.block,l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0),t)for(i=this.start;a<r&&i<64;++a)l[i>>2]|=e[a]<<xy[3&i++];else for(i=this.start;a<r&&i<64;++a)o=e.charCodeAt(a),o<128?l[i>>2]|=o<<xy[3&i++]:o<2048?(l[i>>2]|=(192|o>>6)<<xy[3&i++],l[i>>2]|=(128|63&o)<<xy[3&i++]):o<55296||o>=57344?(l[i>>2]|=(224|o>>12)<<xy[3&i++],l[i>>2]|=(128|o>>6&63)<<xy[3&i++],l[i>>2]|=(128|63&o)<<xy[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++a)),l[i>>2]|=(240|o>>18)<<xy[3&i++],l[i>>2]|=(128|o>>12&63)<<xy[3&i++],l[i>>2]|=(128|o>>6&63)<<xy[3&i++],l[i>>2]|=(128|63&o)<<xy[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=l[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}finalize(){if(this.finalized)return;this.finalized=!0;const e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=$y[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,o,i,a,r,l,s,c,u,d=this.h0,y=this.h1,f=this.h2,p=this.h3,g=this.h4,S=this.h5,v=this.h6,h=this.h7;const m=this.blocks;for(e=16;e<64;++e)i=m[e-15],t=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,i=m[e-2],n=(i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(l=704751109,i=m[0]-210244248,h=i-1521486534<<0,p=i+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),l=d&y,o=l^d&f^u,r=g&S^~g&v,i=h+n+r+Vy[e]+m[e],a=t+o,h=p+i<<0,p=i+a<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),s=p&d,o=s^p&y^l,r=h&g^~h&S,i=v+n+r+Vy[e+1]+m[e+1],a=t+o,v=f+i<<0,f=i+a<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&p,o=c^f&d^s,r=v&h^~v&g,i=S+n+r+Vy[e+2]+m[e+2],a=t+o,S=y+i<<0,y=i+a<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),u=y&f,o=u^y&p^c,r=S&v^~S&h,i=g+n+r+Vy[e+3]+m[e+3],a=t+o,g=d+i<<0,d=i+a<<0;this.h0=this.h0+d<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+p<<0,this.h4=this.h4+g<<0,this.h5=this.h5+S<<0,this.h6=this.h6+v<<0,this.h7=this.h7+h<<0}hex(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,o=this.h3,i=this.h4,a=this.h5,r=this.h6,l=this.h7;let s=Gy[e>>28&15]+Gy[e>>24&15]+Gy[e>>20&15]+Gy[e>>16&15]+Gy[e>>12&15]+Gy[e>>8&15]+Gy[e>>4&15]+Gy[15&e]+Gy[t>>28&15]+Gy[t>>24&15]+Gy[t>>20&15]+Gy[t>>16&15]+Gy[t>>12&15]+Gy[t>>8&15]+Gy[t>>4&15]+Gy[15&t]+Gy[n>>28&15]+Gy[n>>24&15]+Gy[n>>20&15]+Gy[n>>16&15]+Gy[n>>12&15]+Gy[n>>8&15]+Gy[n>>4&15]+Gy[15&n]+Gy[o>>28&15]+Gy[o>>24&15]+Gy[o>>20&15]+Gy[o>>16&15]+Gy[o>>12&15]+Gy[o>>8&15]+Gy[o>>4&15]+Gy[15&o]+Gy[i>>28&15]+Gy[i>>24&15]+Gy[i>>20&15]+Gy[i>>16&15]+Gy[i>>12&15]+Gy[i>>8&15]+Gy[i>>4&15]+Gy[15&i]+Gy[a>>28&15]+Gy[a>>24&15]+Gy[a>>20&15]+Gy[a>>16&15]+Gy[a>>12&15]+Gy[a>>8&15]+Gy[a>>4&15]+Gy[15&a]+Gy[r>>28&15]+Gy[r>>24&15]+Gy[r>>20&15]+Gy[r>>16&15]+Gy[r>>12&15]+Gy[r>>8&15]+Gy[r>>4&15]+Gy[15&r];return s+=Gy[l>>28&15]+Gy[l>>24&15]+Gy[l>>20&15]+Gy[l>>16&15]+Gy[l>>12&15]+Gy[l>>8&15]+Gy[l>>4&15]+Gy[15&l],s}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,o=this.h3,i=this.h4,a=this.h5,r=this.h6,l=this.h7,s=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return s.push(l>>24&255,l>>16&255,l>>8&255,255&l),s}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class qy extends zy{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const o=typeof e;if("string"===o){const t=[],o=e.length;let i,a=0;for(n=0;n<o;++n)i=e.charCodeAt(n),i<128?t[a++]=i:i<2048?(t[a++]=192|i>>6,t[a++]=128|63&i):i<55296||i>=57344?(t[a++]=224|i>>12,t[a++]=128|i>>6&63,t[a++]=128|63&i):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++n)),t[a++]=240|i>>18,t[a++]=128|i>>12&63,t[a++]=128|i>>6&63,t[a++]=128|63&i);e=t}else{if("object"!==o)throw new Error(Ny);if(null===e)throw new Error(Ny);if(Fy&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Fy&&ArrayBuffer.isView(e)))throw new Error(Ny)}var i;e.length>64&&(e=null==(i=new zy(!0).update(e))?void 0:i.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}zy.call(this,t),this.update(r),this.oKeyPad=a,this.inner=!0,this.sharedMemory=t}finalize(){if(super.finalize(),this.inner){this.inner=!1;const e=this.array();zy.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),zy.prototype.finalize.call(this)}}}const Hy=function(){const e=By("hex");e.create=function(){return new zy},e.update=function(t){return e.create().update(t)};for(let t=0;t<jy.length;++t){const n=jy[t];e[n]=By(n)}return e}();function Jy(e,t){const n=U({},e);return t.forEach((e=>{delete n[e]})),n}async function Qy(e){var t,n;return null!=(t=window.crypto)&&null!=(n=t.subtle)&&n.digest?async function(e){const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e):(console.warn("Generating CodeChallenge in non-secure domain:",window.location.origin),async function(e){const t=Hy.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Yy(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let o=0;o<e;o++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=Ky("hex");e.create=function(e){return new qy(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<jy.length;++t){const n=jy[t];e[n]=Ky(n)}}();const Xy=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n}));function*Zy(e){const t=yield Oi((e=>e.root.appName));return qd.getFeatureFlags(e,t)}const ef={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},tf=U({},ef,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),nf=[{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"}],of={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},af=U({},of,{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}),rf={loading:!1,error:void 0,saving:!0,profile:of},lf={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"},sf={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Xr.EmailAndPassword,machineToMachineAuthStrategy:Zr.ClientCredentials},cf={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},uf={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},df={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},yf={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},ff={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},pf=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],gf={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:yf,roles:pf,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Sf=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],vf={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:[nf[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[nf[0]],managedBy:Cy.FRONTEGG}]},hf={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:[nf[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[nf[0]],managedBy:Cy.FRONTEGG}]},mf={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Af=[hf,vf],bf=[mf],kf=[{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}],Tf=[{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"}],Pf={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},If={isActive:!0,strategy:xn.ALLOW},Ef=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:xn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:xn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:xn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:xn.BLOCK,description:"IP 4"}],Lf=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(U({},hf,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Of=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"}),wf=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Lf(6),roles:[Of("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Cy.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Lf(44),roles:[Of("Editor")],managedBy:Cy.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Lf(8),roles:[Of("Viewer")],managedBy:Cy.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Lf(5),roles:[Of("Admin")],managedBy:Cy.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Lf(21),description:"BDR, AE, and inside sales",roles:[Of("Viewer")],managedBy:Cy.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Lf(23),description:"Dev success and customer success",roles:[Of("Admin")],managedBy:Cy.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Lf(10),description:"The marketing department",roles:[Of("Viewer")],managedBy:Cy.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Lf(4),description:"Human resources",roles:[Of("Viewer")],managedBy:Cy.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Lf(3),roles:[Of("Viewer")],managedBy:Cy.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Lf(8),roles:[Of("Editor")],managedBy:Cy.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Lf(4),roles:[Of("Viewer")],managedBy:Cy.FRONTEGG}];let Uf,Cf,Df;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Uf||(Uf={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Cf||(Cf={})),function(e){e.profile="profile",e.privacy="privacy",e.personalApiTokens="personalApiTokens",e.account="account",e.users="users",e.groups="groups",e.security="security",e.sso="sso",e.audits="audits",e.webhooks="webhooks",e.apiTokens="apiTokens",e.roles="roles",e.subscriptions="subscription",e.allAccounts="allAccounts"}(Df||(Df={})),Df.profile,Df.privacy,Df.personalApiTokens,Df.account,Df.users,Df.groups,Df.security,Df.sso,Df.audits,Df.webhooks,Df.apiTokens,Df.roles,Df.subscriptions,Df.allAccounts;const _f=(e,t)=>e?(e=>Boolean(null==e?void 0:e.statusCode))(e)?e.message:((e=>e instanceof Error||(null==e?void 0:e.message)&&(null==e?void 0:e.stack)&&"Error"===(null==e?void 0:e.name))(e)?console.error(e.message):"string"==typeof e&&console.error(e),null!=t?t:"We're facing some difficulties, Please try again"):t,Rf=["events","url"];function*Mf(){yield ki(Io.setSignUpState({loading:!0}));try{const e=yield Ii(Dy.auth.getVendorConfig),[t]=(yield Ii(Dy.auth.getVendorPublicAuthStrategiesConfig),yield Ii(Zy,["admin_portal_login_per_tenant"]));if(t){const t=yield Ii(Dy.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:o}=e;yield ki(Io.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:o,firstLoad:!1})),yield ki(Io.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSignUpState({loading:!1,error:_f(e),firstLoad:!1}))}}function*Nf(e){let{payload:{events:t,url:n}}=e,o=Go(e.payload,Rf);yield ki(Io.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield Oi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield Ii(Dy.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:Cf.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(Ta.setAccessToken(null==l?void 0:l.accessToken),Ta.setUser(l),!r&&l&&Xp(l)){const t=yield tg(l);yield ki(Io.setState(t)),a(e.loginUrl)}else yield ki(Io.setSignUpState({loading:!1,shouldActivate:r,stage:gn.SignUpSuccess})),yield ki(Io.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield ki(Io.loadTenants()))}catch(e){Ta.setAccessToken(null),Ta.setUser(null),yield ki(Io.setSignUpState({loading:!1,error:_f(e)}))}yield ki(Io.setSignUpState({loading:!1}))}function*Ff(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Oi((e=>e.auth.signUpState));yield ki(Io.resetSignUpState()),yield ki(Io.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Gf(){yield ka(Io.signUpUser,Nf),yield ka(Io.resetSignUpStateSoft,Ff)}const $f={setVendorState:(e,{payload:t})=>U({},e,t)},xf={loadVendorPublicInfo:st("vendor/loadVendorPublicInfo")},Vf={loading:!1},{reducer:jf,actions:Wf}=ut({name:Dt,initialState:Vf,reducers:U({},$f)}),Bf=U({},Wf,xf);function*Kf(){yield ki(Bf.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Dy.vendor.getVendorPublicInfo();yield ki(Bf.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield ki(Bf.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const zf=["callback"],qf=["callback"],Hf=["callback"],Jf=["callback"],Qf=["callback"],Yf=["callback"];function*Xf(){yield ki(Io.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getGlobalSecurityPolicy);yield ki(Io.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyGlobalState({error:_f(e),loading:!1}))}yield ki(Io.loadSecurityPolicyMfa()),yield ki(Io.loadSecurityPolicyVendorMfa()),yield ki(Io.loadSecurityPolicyLockout()),yield ki(Io.loadSecurityPolicyVendorLockout()),yield ki(Io.loadSecurityPolicyVendorPasswordHistory()),yield ki(Io.loadSecurityPolicyCaptcha()),yield ki(Io.loadPublicAuthStrategiesPolicy())}function*Zf(){yield ki(Io.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getVendorConfig),[t]=yield Ii(Zy,["admin_portal_login_per_tenant"]);if(t){const t=yield Ii(Dy.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield ki(Io.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyPublicState({error:_f(e),loading:!1}))}}function*ep(){yield ki(Io.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getVendorPublicAuthStrategiesConfig);yield ki(Io.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyAuthStrategyPublicState({error:_f(e),loading:!1}))}}function*tp(){yield ki(Io.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getMfaPolicy);yield ki(Io.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyMfaState({error:_f(e),loading:!1}))}}function*np(){yield ki(Io.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getVendorMfaPolicy);yield ki(Io.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyVendorMfaState({error:_f(e),loading:!1}))}}function*op(e){let{payload:{callback:t}}=e,n=Go(e.payload,zf);yield ki(Io.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Ii(Dy.auth.saveMfaPolicy,n);yield ki(Io.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ki(Io.setSecurityPolicyMfaState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*ip(){yield ki(Io.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getLockoutPolicy);yield ki(Io.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyLockoutState({error:_f(e),loading:!1}))}}function*ap(e){let{payload:{callback:t}}=e,n=Go(e.payload,qf);yield ki(Io.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Ii(Dy.auth.saveLockoutPolicy,n);yield ki(Io.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ki(Io.setSecurityPolicyLockoutState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*rp(){yield ki(Io.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getVendorLockoutPolicy);yield ki(Io.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyVendorLockoutState({error:_f(e),loading:!1}))}}function*lp(){yield ki(Io.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getCaptchaPolicy);yield ki(Io.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyCaptchaState({error:_f(e),loading:!1}))}}function*sp(){yield ki(Io.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getPasswordHistoryPolicy);yield ki(Io.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyPasswordHistoryState({error:_f(e),loading:!1}))}}function*cp(){yield ki(Io.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getVendorPasswordHistoryPolicy);yield ki(Io.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyVendorPasswordHistoryState({error:_f(e),loading:!1}))}}function*up(e){let{payload:{callback:t}}=e,n=Go(e.payload,Hf);yield ki(Io.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Ii(Dy.auth.savePasswordHistoryPolicy,n);yield ki(Io.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ki(Io.setSecurityPolicyPasswordHistoryState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*dp(){yield ki(Io.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getPasswordConfigPolicy);yield ki(Io.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyPasswordState({error:_f(e),loading:!1}))}}function*yp(){yield ka(Io.loadSecurityPolicy,Xf),yield Aa(Io.saveSecurityPolicyMfa,op),yield Aa(Io.loadSecurityPolicyMfa,tp),yield Aa(Io.loadSecurityPolicyVendorMfa,np),yield Aa(Io.saveSecurityPolicyLockout,ap),yield Aa(Io.loadSecurityPolicyLockout,ip),yield Aa(Io.loadSecurityPolicyVendorLockout,rp),yield Aa(Io.loadSecurityPolicyCaptcha,lp),yield Aa(Io.saveSecurityPolicyPasswordHistory,up),yield Aa(Io.loadSecurityPolicyPasswordHistory,sp),yield Aa(Io.loadSecurityPolicyVendorPasswordHistory,cp),yield Aa(Io.loadVendorPasswordConfig,dp),yield Aa(Io.loadPublicSecurityPolicy,Zf),yield Aa(Io.loadPublicAuthStrategiesPolicy,ep)}function*fp(){yield ki(Io.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield ki(Io.setSecurityPolicyPublicState({policy:sf,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyPublicState({error:_f(e),loading:!1}))}}function*pp(){yield ki(Io.setSecurityPolicyGlobalState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyGlobalState({policy:lf,loading:!1})),yield ki(Io.loadSecurityPolicyMfa()),yield ki(Io.loadSecurityPolicyVendorMfa()),yield ki(Io.loadSecurityPolicyLockout()),yield ki(Io.loadSecurityPolicyVendorLockout()),yield ki(Io.loadSecurityPolicyPasswordHistory()),yield ki(Io.loadSecurityPolicyVendorPasswordHistory()),yield ki(Io.loadSecurityPolicyCaptcha())}function*gp(){yield ki(Io.setSecurityPolicyMfaState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyMfaState({policy:cf,loading:!1}))}function*Sp(){yield ki(Io.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyVendorMfaState({policy:cf,loading:!1}))}function*vp(e){var t;let{payload:{callback:n}}=e,o=Go(e.payload,Jf);yield ki(Io.setSecurityPolicyMfaState({saving:!0,error:null}));const i=U({},uf,{id:null!=(t=o.id)?t:uf.id,enforceMFAType:o.enforceMFAType});yield mt(),yield ki(Io.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*hp(){yield ki(Io.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyLockoutState({policy:uf,loading:!1}))}function*mp(){yield ki(Io.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyVendorLockoutState({policy:uf,loading:!1}))}function*Ap(e){let{payload:{callback:t}}=e,n=Go(e.payload,Qf);yield ki(Io.setSecurityPolicyLockoutState({saving:!0,error:null})),yield mt();const o=U({},uf,n,{id:n.id?n.id:uf.id});null==t||t(o),yield ki(Io.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*bp(){yield ki(Io.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyLockoutState({policy:uf,loading:!1}))}function*kp(){yield ki(Io.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyPasswordHistoryState({policy:df,loading:!1}))}function*Tp(){yield ki(Io.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyVendorPasswordHistoryState({policy:df,loading:!1}))}function*Pp(e){let{payload:{callback:t}}=e,n=Go(e.payload,Yf);yield ki(Io.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield mt();const o=U({},df,n,{id:n.id?n.id:df.id});null==t||t(o),yield ki(Io.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*Ip(){yield ka(Io.loadSecurityPolicy,pp),yield Aa(Io.loadPublicSecurityPolicy,fp),yield Aa(Io.saveSecurityPolicyMfa,vp),yield Aa(Io.loadSecurityPolicyMfa,gp),yield Aa(Io.loadSecurityPolicyVendorMfa,Sp),yield Aa(Io.saveSecurityPolicyLockout,Ap),yield Aa(Io.loadSecurityPolicyLockout,hp),yield Aa(Io.loadSecurityPolicyVendorLockout,mp),yield Aa(Io.loadSecurityPolicyCaptcha,bp),yield Aa(Io.saveSecurityPolicyPasswordHistory,Pp),yield Aa(Io.loadSecurityPolicyPasswordHistory,kp),yield Aa(Io.loadSecurityPolicyVendorPasswordHistory,Tp)}const Ep=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Lp=e=>{const{pathname:t}=new URL(e),n=Ep(e);return n?t+n:t};function*Op(){yield ki(Io.setEntitlementsState({loading:!0,error:null}));try{const e=yield Ii(Dy.entitlements.loadEntitlements);yield ki(Io.setEntitlementsState({entitlements:e,loading:!1}))}catch(e){yield ki(Io.setEntitlementsState({error:e.message,loading:!1}))}}function*wp(){yield ka(Io.loadEntitlements,Op)}const Up=["callback"],Cp=["callback"],Dp=["callback"],_p=["callback"],Rp=["callback","events"],Mp=["callback"],Np=["callback"],Fp=["callback"],Gp=["callback"],$p=["callback"],xp=["callback"],Vp=["callback"],jp=["callback"],Wp=["callback"],Bp=["callback","deviceId"],Kp=["callback","deviceId"],zp=["callback","deviceId"],qp=["callback","deviceId"],Hp={[Xr.Code]:Pt.loginWithOtc,[Xr.EmailAndPassword]:Pt.loginWithPassword,[Xr.MagicLink]:Pt.magicLinkPreLoginSuccess,[Xr.SmsCode]:Pt.loginWithSmsOtc};function*Jp(){const e=Ta.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:o=!1,allowedRedirectOrigins:i=[]}=yield Oi((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:l,activateUrl:s}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;try{var d,y;!u&&null!=(d=(y=Ta.getContext()).tenantResolver)&&d.call(y)&&(yield Ii(dg),u=yield Oi((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})))}catch{}const f=window.localStorage.getItem(Lt);f&&![a,r,l,s].includes(f)&&(c=f),window.localStorage.removeItem(Lt),yield mt(200),ki(Io.resetLoginState());const p=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:o})=>{let i=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),o=new URL(e),i=o.origin===n.origin;return t.includes(o.origin)||i})(a,n)?i=a:console.warn("The redirect url param is not valid, the origin is a different site"):i=a:o&&(i+=window.location.search),i})({authenticatedUrl:u?Lp(u):c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(p,{refresh:p.startsWith("http")})}function*Qp(){let e;try{var t;const n=yield Ii(Dy.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield ki(Io.setState({ssoACS:e}))}function*Yp(){try{const{isActive:e}=yield Ii(Dy.auth.getSSOPublicConfiguration);yield ki(Io.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const Xp=e=>e.mfaRequired&&e.mfaToken?(Ta.setAccessToken(null),Ta.setUser(null),!0):(Ta.setAccessToken(e.accessToken),Ta.setUser(e),!1),Zp=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 an.authenticatorApp;if(t)return an.smsVerifyCode}return an.verify},eg=e=>{if(1===e.length){const[t]=e;if(t===Ay.AuthenticatorApp)return an.authenticatorApp;if(t===Ay.SMS)return an.smsSetPhoneNumber}return an.verify};function*tg(e){let t=Pt.loginWithTwoFactor,n={};const{loginState:o}=yield Oi((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield Ii(Dy.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Zp(e.mfaDevices)}:(n={step:eg(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=Pt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:It.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:U({},o,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:i,mfaDeviceExpiration:a})}}function*ng(e){var t;const{routes:n,loginState:o}=yield Oi((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*og(){const{user:e}=yield Oi((e=>e.auth));if(!e)return;const[t]=yield Ii(Zy,["admin_portal_entitlements"]);t&&(yield Ii(Op))}function*ig(){const{hostedLoginBox:e}=yield Oi((e=>e.auth));e?yield Ii(ag):yield Ii(lg),yield og()}function*ag(){const{user:e}=yield Oi((e=>e.auth));if(null==e||!e.refreshToken)return Ta.setAccessToken(null),Ta.setUser(null),void(yield ki(Io.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Ii(Dy.auth.exchangeOAuthTokens,t);yield ki(Io.setState({user:n,isAuthenticated:!0})),yield ki(Io.loadTenants())}catch(e){Ta.setAccessToken(null),Ta.setUser(null),yield ki(Io.setState({user:null,isAuthenticated:!1}))}}function*rg(){const{user:e}=yield Oi((e=>e.auth));if(null==e||!e.refreshToken)return Ta.setAccessToken(null),Ta.setUser(null),void(yield ki(Io.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Ii(Dy.auth.exchangeOAuthTokens,t);yield ki(Io.setState({user:n,isAuthenticated:!0})),yield ki(Io.loadTenants())}catch(e){Ta.setAccessToken(null),Ta.setUser(null),yield ki(Io.setState({user:null,isAuthenticated:!1}))}}function*lg(){try{const t=Ta.onRedirectTo,{routes:n,loginState:o}=yield Oi((e=>e.auth)),{user:i,tenants:a}=yield Ii(Dy.auth.refreshTokenV2);if(Xp(i)){const e=yield tg(i);yield ki(Io.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 ng(i);yield ki(Io.setTenantsState({tenants:a,loading:!1})),yield ki(Io.setState({user:i,isAuthenticated:!0,loginState:U({},o,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield cg(n)}}catch(e){Ta.setAccessToken(null),Ta.setUser(null),yield ki(Io.setState({user:void 0,isAuthenticated:!1}))}}function*sg(){try{const t=Ta.onRedirectTo,{routes:n,loginState:o}=yield Oi((e=>e.auth)),{user:i,tenants:a}=yield Ii(Dy.auth.refreshTokenV2);if(Xp(i)){const e=yield tg(i);yield ki(Io.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield Ii(kg))yield ki(Io.setLoginState({step:Pt.promptPasskeys,loading:!1})),yield ki(Io.setTenantsState({tenants:a,loading:!1})),yield ki(Io.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 ng(i);yield ki(Io.setTenantsState({tenants:a,loading:!1})),yield ki(Io.setState({user:i,isAuthenticated:!0,loginState:U({},o,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield cg(n)}}catch(e){Ta.setAccessToken(null),Ta.setUser(null),yield ki(Io.setState({user:void 0,isAuthenticated:!1}))}}function*cg(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=Ta.onRedirectTo,{routes:i,loginState:a}=yield Oi((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 Jp())}function*ug({payload:{callback:e}}){try{const{ip:t}=yield Ii(Dy.metadata.getCurrentUserIpMetadata);yield ki(Io.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*dg(){try{var e,t;if(null!=(e=Ta.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){const{routes:e}=yield Oi((e=>e.auth)),{applicationUrl:t,loginUrl:o}=yield Ii(Vu);if(t&&o){var n;const i=null!=(n=Ep(t))?n:"";yield ki(Io.setState({routes:U({},e,{customLoginAuthenticatedUrl:o,customLoginUrl:e.loginUrl+i})}))}}}catch{}}function*yg({payload:e}){const t=[];e&&(yield ki(Io.setState({isLoading:!0})),yield ki(Io.loadSocialLoginsConfigurationV2()),t.push(Ii(Mf)),t.push(Ii(ep)),t.push(Ii(Yp)),t.push(Ii(Kf)),t.push(Ii(Qp)),t.push(Ii(dg))),t.push(Ii(ig)),yield Ti(t),yield ki(Io.setState({isLoading:!1}))}function*fg({accessToken:e,user:t}){if(!e)return void(yield ki(Io.setState({user:void 0,isAuthenticated:!1})));const n=Ta.onRedirectTo,{routes:o}=yield Oi((e=>e.auth));if(Xp(t)){const e=yield tg(t);yield ki(Io.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*pg({payload:e}){const t=[];yield ki(Io.loadSocialLoginsConfigurationV2()),t.push(Ii(Mf)),t.push(Ii(Yp)),t.push(Ii(Kf)),t.push(Ii(Qp)),t.push(Ii(fg,e)),t.push(Ii(dg)),yield Ti(t)}function*gg({payload:e}){const{disableSilentRefresh:t}=yield Oi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield Ii(Dy.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield ki(Io.setState({user:e,isAuthenticated:!0})),yield ki(Io.loadTenants()),yield ki(Io.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:o,urlStrategy:i}=yield Oi((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 ki(Io.setState({isLoading:!0}));const a=Yy(),r=Yy(),l=yield Ii(Qy,r);localStorage.setItem(Ot,r);let s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`;const c=yield Sg();c&&(s.endsWith("/")&&(s=s.slice(0,-1)),s+=c);const u=`${lr(n,"/oauth/authorize")}/oauth/authorize`,d=U({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:s,code_challenge:l,code_challenge_method:"S256",nonce:a},e);if(n.tenantResolver){var y;const e=yield null==(y=n.tenantResolver)?void 0:y.call(n);null!=e&&e.tenant&&(d.organization=e.tenant)}o(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}(e)}}function*Sg(){try{var e,t;if(null!=(e=Ta.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){yield Ii(dg);const e=yield Oi((e=>e.auth.routes.customLoginAuthenticatedUrl));if(e)return Ep(e)}}catch{}}function*vg({payload:e}){const t=localStorage.getItem(Ot)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:o}=yield Oi((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let i=`${window.location.origin}${"path"===o?"":"#"}${n.hostedLoginRedirectUrl}`;const a=yield Sg();a&&(i.endsWith("/")&&(i=i.slice(0,-1)),i+=a);const r={code:e.code,redirect_uri:i,code_verifier:t,grant_type:"authorization_code"};try{const e=yield Ii(Dy.auth.exchangeOAuthTokens,r);yield ki(Io.setState({user:e,isAuthenticated:!0})),yield ki(Io.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Jp()}}function*hg(e){let{payload:{callback:t}}=e,n=Go(e.payload,Up);try{yield ki(Io.setLoginState({loading:!0}));const e=yield Ii(Dy.auth.changePhoneNumberWithVerification,n);yield ki(Io.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Pt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({error:_f(e),loading:!1}))}}function*mg(e){let{payload:{callback:t}}=e,n=Go(e.payload,Cp);try{yield ki(Io.setLoginState({loading:!0})),yield Ii(Dy.auth.verifyChangePhoneNumber,n),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({error:_f(e),loading:!1}))}}function*Ag(e){let{payload:{callback:t}}=e,n=Go(e.payload,Dp);try{yield ki(Io.setLoginState({loading:!0}));const e=yield Ii(Dy.auth.passwordlessPreLogin,U({},n,{type:Xr.SmsCode}));yield ki(Io.setLoginState({step:Pt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({error:_f(e),loading:!1})),null==t||t(e)}}function*bg(e){let{payload:{callback:t}}=e,n=Go(e.payload,_p);try{const{onRedirectTo:e,routes:o}=yield Oi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ki(Io.setLoginState({loading:!0}));const i=yield Ii(Dy.auth.passwordlessPreLogin,n),a=Hp[n.type];if(a===Pt.loginWithSmsOtc&&i.resetPhoneNumberToken)return yield ki(Io.setResetPhoneNumberState({resetPhoneNumberToken:i.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),void e(o.resetPhoneNumberUrl);yield ki(Io.setLoginState({step:a,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield ki(Io.setLoginState({error:_f(e),loading:!1})),null==t||t()}}function*kg(){const{publicAuthStrategyPolicy:e}=yield Oi((e=>e.auth.securityPolicyState)),{policy:t}=e,n=(e=>{var t;return!(null==e||null==(t=e.secondaryAuthStrategies)||!t.some((({isActive:e,strategy:t})=>e&&t===hy.Passkeys)))})(t),o="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield Ii(Zy,["show-passkeys-new"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield Ii(Dy.auth.getWebAuthnDevices);return yield ki(Io.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*Tg(e){let{payload:{callback:t,events:n}}=e,o=Go(e.payload,Rp);try{yield ki(Io.setLoginState({loading:!0}));const e=yield Ii(Dy.auth.passwordlessPostLogin,o),a=Ta.onRedirectTo,{routes:r}=yield Oi((e=>e.auth));if(Xp(e)){const t=yield tg(e);yield ki(Io.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield Oi((e=>e.auth)),l=yield Ii(Dy.auth.generateLoginResponse,e);var i;e.emailVerified&&(null==n||null==(i=n.userVerified)||i.call(n,{email:l.email,origin:Uf.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield ki(Io.setState({user:l})),yield ki(Io.setLoginState({error:void 0})),yield ki(Io.loadTenants()),yield ki(Io.setState({isLoading:!1})),o.flow===It.Login?(yield Ii(kg))?(yield ki(Io.setLoginState({step:Pt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield ki(Io.setState({isAuthenticated:!0})),yield Jp()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield ki(Io.setLoginState({error:_f(e,"Failed to authenticate")}))}finally{yield ki(Io.setLoginState({loading:!1}))}}function*Pg({payload:e}){try{yield ki(Io.setLoginState({loading:!0}));const{name:t}=yield Ii(Dy.auth.verifyInviteToken,e);yield ki(Io.setLoginState({inviteTokenTenantName:t}))}catch(e){yield ki(Io.setLoginState({inviteTokenError:_f(e,"We couldn't verify your invitation")}))}finally{yield ki(Io.setLoginState({loading:!1}))}}function*Ig({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:o}}){yield ki(Io.setLoginState({loading:!0}));try{const i=yield Oi((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield Ii(Dy.auth.preLoginV2,{email:e});if(a){let e=a;if(r===My.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield Oi((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield ki(Io.setLoginState({step:Pt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{i(e,{refresh:!0})}),2e3)}else yield Eg({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield Eg({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*Eg(e){let{callback:t}=e,n=Go(e,Mp);const o=yield Oi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==o||!o.authStrategy)return yield ki(Io.setLoginState({step:Pt.loginWithPassword,loading:!1})),void(null==t||t());(null==o?void 0:o.authStrategy)===Xr.EmailAndPassword?(yield ki(Io.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t()):[Xr.MagicLink,Xr.Code,Xr.SmsCode].includes(null==o?void 0:o.authStrategy)?yield ki(Io.passwordlessPreLogin(U({},n,{type:null==o?void 0:o.authStrategy,callback:t}))):(yield ki(Io.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t())}function*Lg({payload:{callback:e}}){try{yield ki(Io.setLoginState({loading:!0}));const{options:t}=yield Ii(Dy.auth.webAuthnCreateNewDeviceSession);t.user.id=kt(t.user.id),t.challenge=kt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield ki(Io.setLoginState({error:_f(t)})),null==e||e(null)}finally{yield ki(Io.setLoginState({loading:!1}))}}function*Og(e){let{payload:{callback:t}}=e,n=Go(e.payload,Np);try{yield ki(Io.setLoginState({loading:!0}));const e=Tt(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?my.Platform:my.CrossPlatform;yield Ii(Dy.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({error:_f(e)})),null==t||t(null)}finally{yield ki(Io.setLoginState({loading:!1}))}}function*wg(e){let{payload:{callback:t}}=e,n=Go(e.payload,Fp);try{var o;yield ki(Io.setPasskeysState({loading:!0})),yield ki(Io.setLoginState({loading:!0}));const{options:e}=yield Ii(Dy.auth.webAuthnPreLogin,n);e.challenge=kt(e.challenge),e.allowCredentials=null==(o=e.allowCredentials)?void 0:o.map((e=>U({},e,{id:kt(e.id)}))),yield ki(Io.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield ki(Io.setLoginState({error:_f(e)})),null==t||t(null)}finally{yield ki(Io.setPasskeysState({loading:!1})),yield ki(Io.setLoginState({loading:!1}))}}function*Ug(e){let{payload:{callback:t}}=e,n=Go(e.payload,Gp);try{var o;yield ki(Io.setPasskeysState({loading:!0})),yield ki(Io.setLoginState({loading:!0}));const e=Tt(n.publicKey),i=yield Ii(Dy.auth.webAuthnPostLogin,U({},e,{response:U({},e.response,{userHandle:null!=(o=e.response.userHandle)?o:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(Xp(i)){const e=Ta.onRedirectTo,{routes:t}=yield Oi((e=>e.auth)),n=yield tg(i);yield ki(Io.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield Ii(Dy.auth.generateLoginResponse,i);e.id&&localStorage.setItem("userId",e.id),yield ki(Io.loadTenants()),yield ki(Io.setState({user:e,isAuthenticated:!0})),yield ki(Io.setLoginState({error:void 0})),yield Jp(),null==t||t(!0)}}catch(e){yield ki(Io.setLoginState({error:_f(e)})),null==t||t(null)}finally{yield ki(Io.setPasskeysState({loading:!1})),yield ki(Io.setLoginState({loading:!1}))}}function*Cg({payload:e}){const{onRedirectTo:t,routes:n}=yield Oi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ki(Io.setLoginState({loading:!0}));try{const t=yield Ii(Dy.auth.postLogin,e);Ta.setAccessToken(t.accessToken),Ta.setUser(t),yield ki(Io.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Jp()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield ki(Io.setLoginState({step:Pt.loginWithSSOFailed,loading:!1}))}}function*Dg({payload:{email:e,password:t,recaptchaToken:n,invitationToken:o,callback:i}}){yield ki(Io.setLoginState({loading:!0}));try{const a=yield Ii(Dy.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:o});Ta.setAccessToken(a.accessToken),Ta.setUser(a);const r=Ta.onRedirectTo,{routes:l}=yield Oi((e=>e.auth));if(Xp(a)){const e=yield tg(a);yield ki(Io.setState(e)),r(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Oi((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield ki(Io.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===It.Login?Pt.success:t.step,tenants:[],tenantsLoading:!0}})),yield ki(Io.loadTenants()),n&&t.flow===It.Login&&((yield Ii(kg))?(yield ki(Io.setLoginState({step:Pt.promptPasskeys,loading:!1})),r(l.loginUrl,{preserveQueryParams:!0})):yield Jp())}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){Ta.setAccessToken(null),Ta.setUser(null),null==i||i(!1,t),yield ki(Io.setLoginState({email:e,error:_f(t),loading:!1}))}}function*_g({payload:{mfaToken:e,value:t,rememberDevice:n,callback:o}}){yield ki(Io.setLoginState({loading:!0}));try{const i=yield Ii(Dy.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield Oi((e=>e.auth)),r=a.flow===It.Login?Pt.success:a.step;yield ki(Io.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 ki(Io.loadTenants()),yield ki(Io.setLoginState({error:void 0,loading:!1})),a.flow===It.Login&&((yield Ii(kg))?yield ki(Io.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield Jp()),null==o||o(!0)}catch(e){yield ki(Io.setLoginState({error:_f(e),loading:!1})),null==o||o(!1,e)}}function*Rg({payload:e}){yield ki(Io.setLoginState({loading:!0}));try{var t;yield Ii(Dy.auth.recoverMfaToken,e),yield ki(Io.setLoginState({loading:!1,error:void 0,step:Pt.preLogin})),yield ki(Io.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ki(Io.setLoginState({error:_f(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Mg({payload:e}){const{hostedLoginBox:t}=yield Oi((e=>e.auth));yield ki(Io.setState({isLoading:!0}));try{t?yield Ii(Dy.auth.OAuthLogout):yield Ii(Dy.auth.logout)}catch{}yield ki(Io.resetState()),yield ki(Io.requestAuthorize(!0)),null==e||e()}function*Ng({payload:e}){var t;try{yield Ii(Dy.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*Fg({user:e,tenants:t}){const n={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield ki(Io.setMfaState(n)),yield ki(Io.setUser(e)),yield ki(Io.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Gg({user:e,tenants:t}){const{loginState:n}=yield Oi((e=>e.auth));yield ki(Io.setUser(e)),yield ki(Io.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:o}=yield Oi((e=>e.auth.mfaState));if(n.flow===It.Login){const e=yield Ii(kg);o===an.smsVerifyCode&&e?yield ki(Io.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield Jp()}yield ki(Io.setState({isAuthenticated:!0}))}function*$g(e){let{payload:{callback:t}}=e,n=Go(e.payload,$p);yield ki(Io.setLoginState({loading:!0}));try{const e=yield Ii(Dy.auth.preEnrollMFASMSForLogin,n);yield ki(Io.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*xg(e){let{payload:{callback:t}}=e,n=Go(e.payload,xp);yield ki(Io.setLoginState({loading:!0}));try{const e=yield Ii(Dy.auth.enrollMFASMSForLogin,n),o=yield Ii(Dy.auth.generateLoginResponseV2,e);yield Fg(o),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*Vg(e){let{payload:{callback:t}}=e,n=Go(e.payload,Vp);yield ki(Io.setLoginState({loading:!0}));try{var o;const e=yield Ii(Dy.auth.preEnrollMFAWebAuthnForLogin,n),i=U({},e.options,{challenge:kt(e.options.challenge),user:U({},e.options.user,{id:kt(e.options.user.id)}),excludeCredentials:null==(o=e.options.excludeCredentials)?void 0:o.map((e=>U({},e,{id:kt(e.id)})))});yield ki(Io.setLoginState({loading:!1})),null==t||t({options:i,webauthnToken:e.webauthnToken})}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*jg(e){let{payload:{callback:t}}=e,n=Go(e.payload,jp);yield ki(Io.setLoginState({loading:!0}));try{const e=Tt(n.publicKey),o=yield Ii(Dy.auth.enrollMFAWebAuthnForLogin,U({},n,{options:e})),i=yield Ii(Dy.auth.generateLoginResponseV2,o);yield Fg(i),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*Wg(e){let{payload:{callback:t}}=e,n=Go(e.payload,Wp);yield ki(Io.setLoginState({loading:!0}));try{const e=yield Ii(Dy.auth.enrollMFAAuthenticatorAppForLogin,n),o=yield Ii(Dy.auth.generateLoginResponseV2,e);yield Fg(o),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*Bg(e){let{payload:{callback:t,deviceId:n}}=e,o=Go(e.payload,Bp);yield ki(Io.setLoginState({loading:!0}));try{const e=yield Ii(Dy.auth.preVerifyMFASMSForLogin,n,o);yield ki(Io.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*Kg(e){let{payload:{callback:t,deviceId:n}}=e,o=Go(e.payload,Kp);yield ki(Io.setLoginState({loading:!0}));try{const e=yield Ii(Dy.auth.verifyMFASMSForLogin,n,o),i=yield Ii(Dy.auth.generateLoginResponseV2,e);yield Gg(i),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*zg(e){let{payload:{callback:t,deviceId:n}}=e,o=Go(e.payload,zp);yield ki(Io.setLoginState({loading:!0}));try{var i;const e=yield Ii(Dy.auth.preVerifyMFAWebAuthnForLogin,n,o),a=U({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>U({},e,{id:kt(e.id)})))});yield ki(Io.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*qg(e){let{payload:{callback:t,deviceId:n}}=e,o=Go(e.payload,qp);yield ki(Io.setLoginState({loading:!0}));try{const e=Tt(o.publicKey),i=yield Ii(Dy.auth.verifyMFAWebAuthnForLogin,n,U({},o,{options:e})),a=yield Ii(Dy.auth.generateLoginResponseV2,i);yield Gg(a),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*Hg(){yield ka(Io.requestAuthorize,yg),yield ka(Io.requestAuthorizeSSR,pg),yield ka(Io.requestHostedLoginAuthorize,gg),yield ka(Io.handleHostedLoginCallback,vg),yield ka(Io.preLogin,Ig),yield ka(Io.postLogin,Cg),yield ka(Io.login,Dg),yield ka(Io.logout,Mg),yield ka(Io.silentLogout,Ng),yield ka(Io.loginWithMfa,_g),yield ka(Io.recoverMfa,Rg),yield ka(Io.quickSmsPasswordlessPreLogin,Ag),yield ka(Io.changePhoneNumberWithVerification,hg),yield ka(Io.verifyChangePhoneNumber,mg),yield ka(Io.passwordlessPreLogin,bg),yield ka(Io.passwordlessPostLogin,Tg),yield ka(Io.verifyInviteToken,Pg),yield ka(Io.webAuthnPrelogin,wg),yield ka(Io.webAuthnPostLogin,Ug),yield ka(Io.webAuthnCreateNewDeviceSession,Lg),yield ka(Io.webAuthnVerifyNewDeviceSession,Og),yield ka(Io.afterAuthNavigation,Jp),yield ka(Io.getUserIP,ug),yield ka(Io.preEnrollMFASMSForLogin,$g),yield ka(Io.enrollMFASMSForLogin,xg),yield ka(Io.preEnrollMFAWebAuthnForLogin,Vg),yield ka(Io.enrollMFAWebAuthnForLogin,jg),yield ka(Io.enrollMFAAuthenticatorAppForLogin,Wg),yield ka(Io.preVerifyMFASMSForLogin,Bg),yield ka(Io.verifyMFASMSForLogin,Kg),yield ka(Io.preVerifyMFAWebAuthnForLogin,zg),yield ka(Io.verifyMFAWebAuthnForLogin,qg)}function*Jg({payload:e}){e&&(yield ki(Io.setState({isLoading:!0})));const t=af;yield ki(Io.loadTenants()),yield ki(Io.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Qg({payload:{callback:e}}){try{const{ip:t}=Ef[0];yield ki(Io.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Yg(){yield ka(Io.requestAuthorize,Jg),yield ka(Io.afterAuthNavigation,Jp),yield ka(Io.getUserIP,Qg)}const Xg=["callback","samlVendor"],Zg=["callback","samlVendor"];function*eS(){try{var e,t;yield ki(Io.setSSOState({loading:!0}));const n=yield Ii(Dy.auth.getSamlConfiguration),o=yield Ii(Dy.auth.getOidcConfiguration),i=yield Ii(Dy.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 ki(Io.setSSOState({samlConfiguration:n,oidcConfiguration:o,loading:!1,firstLoad:!1}))}catch(e){yield ki(Io.setSSOState({error:_f(e),loading:!1}))}}function*tS({payload:e}){const t=yield Oi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield ki(Io.setSSOState({error:void 0,[n]:!0}));try{const o=yield Xy(e[0]),i=yield Ii(Dy.auth.updateSamlVendorMetadata,{metadata:o});i.isSamlActive=null==t?void 0:t.isSamlActive,yield ki(Io.setSSOState({samlConfiguration:i,error:void 0,[n]:!1}))}catch(e){yield ki(Io.setSSOState({samlConfiguration:t,error:_f(e),[n]:!1}))}}function*nS({payload:e}){const{configFile:t,callback:n}=e,o=yield Oi((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield ki(Io.setSSOState({error:void 0,[i]:!0}));try{const e=yield Xy(t),a=yield Ii(Dy.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==o?void 0:o.isSamlActive,yield ki(Io.setSSOState({samlConfiguration:a,error:void 0,[i]:!1})),null==n||n(!0)}catch(e){yield ki(Io.setSSOState({samlConfiguration:o,error:_f(e),[i]:!1})),null==n||n(null,e)}}function*oS({payload:e}){const{callback:t,samlVendor:n}=e,o=Go(e,Xg),i=yield Oi((e=>e.auth.ssoState.samlConfiguration)),a=U({},i,o);let r="saving";(null==a?void 0:a.enabled)!==i.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield ki(Io.setSSOState({samlConfiguration:U({},i,a)})));if(yield ki(Io.setSSOState({error:void 0,[r]:!0})),e.type===My.Saml){var l,s;const e=yield Ii(Dy.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=Jy(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 Ii(Dy.auth.updateSamlConfiguration,o);c.isSamlActive=null==i?void 0:i.isSamlActive,yield ki(Io.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield ki(Io.setSSOState({samlConfiguration:i,error:_f(e),[r]:!1})),null==t||t(null,e)}}function*iS({payload:{callback:e}={}}){const t=yield Oi((e=>e.auth.ssoState.samlConfiguration));try{yield ki(Io.setSSOState({error:void 0,saving:!0})),yield Ii(Dy.auth.validateSamlDomain),yield ki(Io.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield ki(Io.setSSOState({samlConfiguration:U({},t,{validated:!1}),error:_f(n),saving:!1})),null==e||e(null,n)}}function*aS(){try{const e=yield Ii(Dy.auth.getSamlRoles),t=yield Ii(Dy.auth.getSamlRolesGroups);yield ki(Io.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield ki(Io.setSSOState({error:_f(e)}))}}function*rS({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield ki(Io.setSSOState({error:void 0,saving:!0})),yield Ii(Dy.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Ti(e.map((e=>Ii(Dy.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield ki(Io.setSSOState({error:_f(e)}))}}(n)),yield aS(),yield ki(Io.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ki(Io.setSSOState({error:_f(t),saving:!1})),null==e||e(null,t)}}function*lS({payload:{callback:e,id:t}}){try{yield ki(Io.setSSOState({error:void 0,saving:!0})),yield Ii(Dy.auth.deleteSamlGroup,{id:t}),yield aS(),yield ki(Io.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ki(Io.setSSOState({error:_f(t),saving:!1})),null==e||e(null,t)}}function*sS({payload:{group:e,roleIds:t,callback:n}}){try{yield ki(Io.setSSOState({error:void 0,saving:!0})),yield Ii(Dy.auth.createSamlGroup,{group:e,roleIds:t}),yield aS(),yield ki(Io.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield ki(Io.setSSOState({error:_f(e),saving:!1})),null==n||n(null,e)}}function*cS({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield ki(Io.setSSOState({loading:!0})),yield Ii(Dy.auth.oidcPostLoginV2,t),yield Ii(ig),yield ki(Io.setSSOState({loading:!1}))}catch(e){yield ki(Io.setSSOState({loading:!1,error:_f(e,"Failed to authenticate"),firstLoad:!1}))}}function*uS(){yield Aa(Io.loadSSOConfigurations,eS),yield Aa(Io.saveSSOConfigurations,oS),yield Aa(Io.saveSSOConfigurationsFile,tS),yield Aa(Io.saveSSOConfigurationsFileWithCallback,nS),yield Aa(Io.validateSSODomain,iS),yield Aa(Io.loadSSOAuthorizationRoles,aS),yield Aa(Io.updateSSOAuthorizationRoles,rS),yield Aa(Io.deleteSamlGroup,lS),yield Aa(Io.createSamlGroup,sS),yield Aa(Io.oidcPostlogin,cS)}function*dS(){yield ki(Io.setSSOState({loading:!0})),yield mt(),yield ki(Io.setSSOState({samlConfiguration:yf,loading:!1,firstLoad:!1}))}function*yS({payload:e}){const t="saving";yield ki(Io.setSSOState({error:void 0,[t]:!0}));const n=U({},yield Oi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield ki(Io.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*fS({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Go(e,Zg),r=gf.samlConfiguration,l=U({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield ki(Io.setSSOState({samlConfiguration:U({},r,l)})));yield ki(Io.setSSOState({error:void 0,[s]:!0})),yield mt(),l.acsUrl=null==ff||null==(t=ff.configuration)?void 0:t.acsUrl,l.spEntityId=null==ff||null==(n=ff.configuration)?void 0:n.spEntityId;const c=Jy(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 mt(),yield ki(Io.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==o||o(!0)}function*pS({payload:{callback:e}={}}){const t=gf.samlConfiguration;yield ki(Io.setSSOState({error:void 0,saving:!0})),yield mt(),yield ki(Io.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*gS(){yield mt(),yield ki(Io.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*SS({payload:{callback:e,authorizationRoles:t}}){yield ki(Io.setSSOState({error:void 0,saving:!0})),yield mt(),yield ki(Io.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*vS(){yield Aa(Io.loadSSOConfigurations,dS),yield Aa(Io.saveSSOConfigurations,fS),yield Aa(Io.saveSSOConfigurationsFile,yS),yield Aa(Io.validateSSODomain,pS),yield Aa(Io.loadSSOAuthorizationRoles,gS),yield Aa(Io.updateSSOAuthorizationRoles,SS)}const hS=["callback"],mS=["callback","ssoConfigId"],AS=["callback","ssoConfigId"],bS=["callback","ssoConfigId"];function*kS(){try{return yield Ii(Dy.auth.getOidcConfiguration)}catch(e){return null}}function*TS(){try{return yield Ii(Dy.metadata.getSamlMetadata)}catch(e){return null}}function*PS(){try{yield ki(Io.setSSOLoader({key:Ry.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Ti([Ii(kS),Ii(TS)]),n=yield Ii(Dy.auth.getSSOConfigurations);yield ki(Io.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield ki(Io.setSSOError({key:Ry.LOAD_SSO_CONFIGURATIONS,value:_f(e)}))}finally{yield ki(Io.setSSOLoader({key:Ry.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*IS({payload:e}){yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Go(e,hS),o=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield Ii(Dy.auth.createSSOConfiguration,U({},n,{enabled:null!=(i=n.enabled)&&i}));yield ki(Io.setSSOState({ssoConfigurations:[...o,e]})),null==t||t(e)}catch(e){yield ki(Io.setSSOError({key:Ry.SAVE_SSO_CONFIGURATION,value:_f(e)})),null==t||t(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION,value:!1}))}}function*ES({payload:e}){yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,o=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Xy(t),i=yield Ii(Dy.auth.createSSOConfigurationByMetadata,{metadata:e});yield ki(Io.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield ki(Io.setSSOError({key:Ry.SAVE_SSO_CONFIGURATION_BY_METADATA,value:_f(e)})),null==n||n(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*LS({payload:e}){yield ki(Io.setSSOLoader({key:Ry.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Go(e,mS),i=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ii(Dy.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t));yield ki(Io.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ki(Io.setSSOError({key:Ry.UPDATE_SSO_CONFIGURATION,value:_f(e)})),null==t||t(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*OS({payload:e}){yield ki(Io.setSSOLoader({key:Ry.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:o}=e,i=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Xy(o),a=yield Ii(Dy.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=i.map((e=>e.id===n?a:e));yield ki(Io.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield ki(Io.setSSOError({key:Ry.UPDATE_SSO_CONFIGURATION,value:_f(e)})),null==t||t(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*wS({payload:e}){yield ki(Io.setSSOLoader({key:Ry.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ii(Dy.auth.deleteSSOConfiguration,t),yield ki(Io.setSSOState({ssoConfigurations:o.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield ki(Io.setSSOError({key:Ry.DELETE_SSO_CONFIGURATION,value:_f(e)})),null==n||n(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.DELETE_SSO_CONFIGURATION,value:!1}))}}function*US({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Go(e,AS);yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_DOMAIN,value:!0}));const i=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ii(Dy.auth.createSSODomain,n,o),a=i.map((t=>t.id===n?U({},t,{domains:[...t.domains,e]}):t));yield ki(Io.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ki(Io.setSSOError({key:Ry.SAVE_SSO_DOMAIN,value:_f(e)})),null==t||t(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_DOMAIN,value:!1}))}}function*CS({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield ki(Io.setSSOLoader({key:Ry.DELETE_SSO_DOMAIN,value:!0}));const i=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ii(Dy.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?U({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield ki(Io.setSSOState({ssoConfigurations:e})),null==o||o(!0)}catch(e){yield ki(Io.setSSOError({key:Ry.DELETE_SSO_DOMAIN,value:_f(e)})),null==o||o(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.DELETE_SSO_DOMAIN,value:!1}))}}function*DS({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield ki(Io.setSSOLoader({key:Ry.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ii(Dy.auth.validateSSODomain,o,n);const e=i.map((e=>e.id===o?U({},e,{domains:e.domains.map((e=>e.id===n?U({},e,{validated:!0}):e))}):e));yield ki(Io.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield ki(Io.setSSOError({key:Ry.VALIDATE_SSO_DOMAIN,value:_f(e)})),null==t||t(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.VALIDATE_SSO_DOMAIN,value:!1}))}}function*_S({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield ki(Io.setSSOLoader({key:Ry.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ii(Dy.auth.setSSODefaultRoles,t,{roleIds:n});const i=o.map((e=>e.id===t?U({},e,{roleIds:n}):e));yield ki(Io.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield ki(Io.setSSOError({key:Ry.UPDATE_SSO_DEFAULT_ROLES,value:_f(t)})),null==e||e(null,t)}finally{yield ki(Io.setSSOLoader({key:Ry.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*RS({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_GROUPS,value:!0}));const i=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ti(t.map((e=>Ii(Dy.auth.deleteSSOGroup,n,e)))),yield Ti(e.map((e=>Ii(Dy.auth.createSSOGroup,n,e))));const a=yield Ii(Dy.auth.getSSOGroups,n),r=i.map((e=>e.id===n?U({},e,{groups:a}):e));yield ki(Io.setSSOState({ssoConfigurations:r})),null==o||o(!0)}catch(e){yield ki(Io.setSSOError({key:Ry.SAVE_SSO_GROUPS,value:_f(e)})),null==o||o(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_GROUPS,value:!1}))}}function*MS({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Ti(t.map((t=>Ii(Dy.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield ki(Io.setSSOError({key:Ry.SAVE_SSO_GROUPS,value:_f(e)})),null==n||n(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_GROUPS,value:!1}))}}function*NS({payload:e}){yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:o,callback:i}=e,a=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield Ii(ur,t,void 0,{responseType:"plain"}),configMetadata:n};let r,l;o?(r=yield Ii(Dy.auth.updateSSOConfigurationByMetadata,o,e),l=a.map((e=>e.id===o?r:e))):(r=yield Ii(Dy.auth.createSSOConfigurationByMetadata,e),l=[r,...a]),yield ki(Io.setSSOState({ssoConfigurations:l})),null==i||i(r)}catch(e){null==i||i(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*FS({payload:e}){yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Go(e,bS),i=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Ii(Dy.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t))):(e=yield Ii(Dy.auth.createSSOConfiguration,o),a=[e,...i]),yield ki(Io.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*GS(){yield Aa(Io.loadSSOConfigurationsV2,PS),yield Aa(Io.saveSSOConfigurationV2,IS),yield Aa(Io.saveSSODomain,US),yield Aa(Io.deleteSSODomain,CS),yield Aa(Io.validateSSODomainV2,DS),yield Aa(Io.updateSSOConfiguration,LS),yield Aa(Io.deleteSSOConfiguration,wS),yield Aa(Io.setSSOGroups,RS),yield Aa(Io.updateSSOGroups,MS),yield Aa(Io.setSSODefaultRoles,_S),yield Aa(Io.saveSSOConfigurationByMetadata,ES),yield Aa(Io.updateSSOConfigurationByMetadata,OS),yield Aa(Io.saveSSOConfigurationByUrl,NS),yield Aa(Io.saveSSOConfigurationByData,FS)}const $S=["callback","profilePictureUrl"],xS=["callback","profilePictureUrl"];function*VS(){yield ki(Io.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 Ii.apply(void 0,[ma,e,t,n].concat(i))}(3,2e3,Dy.teams.getProfile),t=yield Oi((e=>e.auth.user));Io.setUser(U({},t,e)),yield ki(Io.setProfileState({profile:e,loading:!1}))}catch(e){yield ki(Io.setProfileState({loading:!1,error:_f(e)}))}}function*jS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Go(e.payload,$S);yield ki(Io.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield Oi((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 Ii(Dy.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(i);n.searchParams.set("t",t),i=n.href}}const a=U({},e,o,{profilePictureUrl:i}),r=yield Ii(Dy.teams.updateProfile,a),l=yield Oi((e=>e.auth.user));yield ki(Io.setUser(U({},l,r))),yield ki(Io.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield ki(Io.setProfileState({saving:!1,error:_f(e),loading:!1})),null==t||t(null,e)}}function*WS({payload:e}){yield ki(Io.setProfileState({loading:!0}));try{var t;yield Ii(Dy.teams.changePassword,e),yield ki(Io.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ki(Io.setProfileState({loading:!1,error:_f(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*BS(){yield ka(Io.loadProfile,VS),yield Aa(Io.saveProfile,jS),yield Aa(Io.changePassword,WS)}function*KS(){yield ki(Io.setProfileState({loading:!0})),yield mt(),yield ki(Io.setUser(U({},af,of))),yield ki(Io.setProfileState({loading:!1,profile:of}))}function*zS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Go(e.payload,xS);yield ki(Io.setProfileState({saving:!0,error:null}));const i=rf;let a=i.profile.profilePictureUrl;n!==i.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=U({},i.profile,o,{profilePictureUrl:a}),l=af;yield mt(),yield ki(Io.setUser(U({},l,r))),yield ki(Io.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*qS({payload:e}){var t;yield ki(Io.setProfileState({loading:!0})),yield mt(),yield ki(Io.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*HS(){yield ka(Io.loadProfile,KS),yield Aa(Io.saveProfile,zS),yield Aa(Io.changePassword,qS)}const JS=["callback"],QS=["callback"],YS=["callback"],XS=["deviceId","callback"],ZS=["deviceId","callback"],ev=["callback"],tv=["deviceId"],nv=["deviceId"],ov=["callback"],iv=["deviceId"],av=["callback"];function*rv(e){const{step:t}=yield Oi((e=>e.auth.mfaState));return{step:e.recoveryCode?an.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*lv(){yield ki(Io.setMfaState({saving:!0}));try{const{qrCode:e}=yield Ii(Dy.auth.enrollMfa);yield ki(Io.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield ki(Io.setMfaState({saving:!1,error:_f(e)}))}}function*sv(e){let{payload:{callback:t}}=e,n=Go(e.payload,JS);yield ki(Io.setMfaState({saving:!0}));try{const e=yield Oi((e=>e.auth.user)),o=yield Ii(Dy.auth.verifyMfa,n),i=yield Ii(Dy.auth.getMFADevices),a=yield rv(o);yield ki(Io.setMfaState(U({},a,{mfaDevices:i}))),yield ki(Io.setUser(U({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield ki(Io.setMfaState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*cv(e){let{payload:{callback:t}}=e,n=Go(e.payload,QS);yield ki(Io.setMfaState({loading:!0}));try{const e=yield Ii(Dy.auth.loginWithMfa,n),o={step:an.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(o.recoveryCode=e.recoveryCode),yield ki(Io.setMfaState(o)),yield ki(Io.setState({user:e})),yield ki(Io.loadTenants()),null==t||t(o.recoveryCode)}catch(e){yield ki(Io.setMfaState({loading:!1,error:_f(e)})),null==t||t(null,e)}}function*uv({payload:e}){yield ki(Io.setMfaState({saving:!0}));try{var t;yield Ii(Dy.auth.disableMfa,e);const n=yield Ii(Dy.auth.getMFADevices);yield ki(Io.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ki(Io.setMfaState({saving:!1,error:_f(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*dv({payload:e}){yield ki(Io.setMfaState({saving:!0}));try{var t,n;const o=yield Ii(Dy.auth.preEnrollMFAWebAuthn),i=U({},o.options,{challenge:kt(o.options.challenge),user:U({},o.options.user,{id:kt(o.options.user.id)}),excludeCredentials:null==(t=o.options.excludeCredentials)?void 0:t.map((e=>U({},e,{id:kt(e.id)})))});yield ki(Io.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:i,webauthnToken:o.webauthnToken})}catch(t){var o;yield ki(Io.setMfaState({saving:!1,error:_f(t)})),null==(o=e.callback)||o.call(e,null,t)}}function*yv(e){let{payload:{callback:t}}=e,n=Go(e.payload,YS);yield ki(Io.setMfaState({saving:!0}));try{const e=Tt(n.publicKey),o=yield Ii(Dy.auth.enrollMFAWebAuthn,U({},n,{options:e})),i=yield Ii(Dy.auth.getMFADevices),a=yield rv(o);yield ki(Io.setMfaState(U({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield ki(Io.setMfaState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*fv(e){let{payload:{deviceId:t,callback:n}}=e;Go(e.payload,XS),yield ki(Io.setMfaState({saving:!0}));try{var o;const e=yield Ii(Dy.auth.preDisableMFAWebAuthn,t),i=U({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>U({},e,{id:kt(e.id)})))});yield ki(Io.setMfaState({saving:!1})),null==n||n({options:i,webauthnToken:e.webauthnToken})}catch(e){yield ki(Io.setMfaState({saving:!1,error:_f(e)})),null==n||n(null,e)}}function*pv(e){let{payload:{deviceId:t,callback:n}}=e,o=Go(e.payload,ZS);yield ki(Io.setMfaState({saving:!0}));try{const e=Tt(o.publicKey);yield Ii(Dy.auth.disableMFAWebAuthn,t,U({},o,{options:e}));const i=yield Ii(Dy.auth.getMFADevices);yield ki(Io.setMfaState({saving:!1,error:void 0,mfaDevices:i})),null==n||n(!0)}catch(e){yield ki(Io.setMfaState({saving:!1,error:_f(e)})),null==n||n(!1,e)}}function*gv({payload:e}){yield ki(Io.setMfaState({saving:!0}));try{var t;const n=yield Ii(Dy.auth.preEnrollMFASMS,e);yield ki(Io.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 ki(Io.setMfaState({saving:!1,error:_f(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Sv(e){let{payload:{callback:t}}=e,n=Go(e.payload,ev);yield ki(Io.setMfaState({saving:!0}));try{const e=yield Ii(Dy.auth.enrollMFASMS,n),o=yield Ii(Dy.auth.getMFADevices),i=yield rv(e);yield ki(Io.setMfaState(U({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield ki(Io.setMfaState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*vv(e){let{payload:{deviceId:t}}=e,n=Go(e.payload,tv);yield ki(Io.setMfaState({saving:!0}));try{var o;const e=yield Ii(Dy.auth.preDisableMFASMS,t);yield ki(Io.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 ki(Io.setMfaState({saving:!1,error:_f(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*hv(e){let{payload:{deviceId:t}}=e,n=Go(e.payload,nv);yield ki(Io.setMfaState({saving:!0}));try{var o;yield Ii(Dy.auth.disableMFASMS,t,n);const e=yield Ii(Dy.auth.getMFADevices);yield ki(Io.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield ki(Io.setMfaState({saving:!1,error:_f(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*mv(){yield ki(Io.setMfaState({loading:!0}));try{yield Oi((e=>e.auth.user));const e=yield Ii(Dy.auth.getMFADevices);yield ki(Io.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield ki(Io.setMfaState({loading:!1,error:_f(e)}))}}function*Av(){yield ki(Io.setMfaState({loading:!0}));try{const e=(yield Ii(Dy.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield ki(Io.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield ki(Io.setMfaState({loading:!1,error:_f(e)}))}}function*bv(){yield Aa(Io.enrollMfa,lv),yield Aa(Io.getMFADevices,mv),yield Aa(Io.getMFAStrategies,Av),yield Aa(Io.verifyMfa,sv),yield Aa(Io.disableMfa,uv),yield Aa(Io.verifyMfaAfterForce,cv),yield Aa(Io.preDisableMfaSms,vv),yield Aa(Io.disableMfaSms,hv),yield Aa(Io.preEnrollMfaSms,gv),yield Aa(Io.enrollMfaSms,Sv),yield Aa(Io.preEnrollMfaWebAuthn,dv),yield Aa(Io.enrollMfaWebAuthn,yv),yield Aa(Io.preDisableMfaWebAuthn,fv),yield Aa(Io.disableMfaWebAuthn,pv)}function*kv(){yield ki(Io.setMfaState({saving:!0})),yield ki(Io.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*Tv({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield Oi((e=>e.auth.mfaState));yield ki(Io.setMfaState({saving:!0})),yield mt();const n={token:"token",recoveryCode:"recoveryCode"},o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:U({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(o.recoveryCode=n.recoveryCode),yield ki(Io.setMfaState(o)),yield ki(Io.setUser(U({},af,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*Pv(e){let{payload:{callback:t}}=e,n=Go(e.payload,ov);yield ki(Io.setMfaState({loading:!0})),yield mt();const o=U({},n,{recoveryCode:"recoveryCode"}),i={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield ki(Io.setMfaState(i)),yield mt(),yield ki(Io.setUser(U({},af,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Iv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Oi((e=>e.auth.mfaState));yield ki(Io.setMfaState({saving:!0})),yield mt(),yield ki(Io.setMfaState({saving:!1,error:void 0,mfaDevices:U({},n,{authenticators:[]})})),yield ki(Io.setUser(U({},af))),null==(t=e.callback)||t.call(e,!0)}function*Ev(e){let{}=e,t=Go(e.payload,iv);yield ki(Io.setMfaState({saving:!0}));try{var n;yield ki(Io.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var o;yield ki(Io.setMfaState({saving:!1,error:_f(e)})),null==(o=t.callback)||o.call(t,!1,e)}}function*Lv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Oi((e=>e.auth.mfaState));yield ki(Io.setMfaState({saving:!0})),yield mt(),yield ki(Io.setMfaState({loading:!1,error:void 0,mfaDevices:U({},n,{phones:[]})})),yield ki(Io.setUser(U({},af))),null==(t=e.callback)||t.call(e,!0)}function*Ov({payload:e}){var t;yield ki(Io.setMfaState({saving:!0})),yield mt(),yield ki(Io.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*wv(e){let{payload:{callback:t}}=e;Go(e.payload,av);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Oi((e=>e.auth.mfaState));yield ki(Io.setMfaState({saving:!0})),yield mt();const o={token:"token",recoveryCode:"recoveryCode"},i={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:U({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield ki(Io.setMfaState(i)),yield ki(Io.setUser(U({},af,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Uv(){yield Aa(Io.enrollMfa,kv),yield Aa(Io.verifyMfa,Tv),yield Aa(Io.disableMfa,Iv),yield Aa(Io.verifyMfaAfterForce,Pv),yield Aa(Io.preDisableMfaSms,Ev),yield Aa(Io.disableMfaSms,Lv),yield Aa(Io.preEnrollMfaSms,Ov),yield Aa(Io.enrollMfaSms,wv)}const Cv=["callback"];function*Dv({payload:e}){yield ki(Io.setForgotPasswordState({loading:!0}));try{var t;yield Ii(Dy.auth.forgotPassword,e),yield ki(Io.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ki(Io.setForgotPasswordState({loading:!1,error:_f(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*_v(e){let{payload:{callback:t}}=e,n=Go(e.payload,Cv);yield ki(Io.setForgotPasswordState({loading:!0}));try{yield Ii(Dy.auth.resetPassword,n),yield ki(Io.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==t||t(!0)}catch(e){yield ki(Io.setForgotPasswordState({loading:!1,error:_f(e)})),null==t||t(!1,e)}}function*Rv({payload:e}){yield ki(Io.setForgotPasswordState({loading:!0}));try{const t=yield Ii(Dy.auth.loadPasswordConfig,e);yield ki(Io.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield ki(Io.setForgotPasswordState({loading:!1,error:_f(e)}))}}function*Mv(){yield ka(Io.forgotPassword,Dv),yield ka(Io.resetPassword,_v),yield ka(Io.loadPasswordConfig,Rv)}let Nv;!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"}(Nv||(Nv={}));const Fv=["callback","events"],Gv=["callback"],$v=["callback"];function*xv({payload:{userId:e,token:t}}){yield ki(Io.setActivateState({loading:!0,step:Nt.activating}));try{const{isAuthenticated:n}=yield Oi((e=>e.auth));n&&(yield ki(Io.silentLogout()));const o=yield Ii(Dy.auth.getActivateAccountStrategy,{userId:e,token:t});yield ki(Io.setActivateStrategyState({strategy:o,loading:!1,error:void 0})),o.shouldSetPassword&&(yield ki(Io.setActivateState({loading:!1,step:Nt.activatingForm})))}catch(e){yield ki(Io.setActivateState({loading:!1,error:_f(e)}))}}function*Vv(e){let{payload:{callback:t,events:n}}=e,o=Go(e.payload,Fv);yield ki(Io.setActivateState({loading:!0}));try{const e=Ta.onRedirectTo,{routes:a}=yield Oi((e=>e.auth)),r=yield Ii(Dy.auth.activateAccount,o);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(Xp(r)){yield ki(Io.setActivateState({step:Nt.success}));const t=yield tg(r);yield ki(Io.setState(t)),yield wi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var i;yield ki(Io.setActivateState({step:Nt.success}));const{user:e,tenants:t}=yield Ii(Dy.auth.generateLoginResponseV2,r);null==n||null==(i=n.userVerified)||i.call(n,{email:e.email,origin:Uf.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield ki(Io.setTenantsState({tenants:t,loading:!1})),yield ki(Io.setState({user:e,isAuthenticated:!0})),yield wi(1e3),yield Jp(),yield ki(Io.resetActivateState())}null==t||t(!0)}catch(e){yield ki(Io.setActivateState({loading:!1,error:_f(e)}))}}function*jv({payload:e}){const{callback:t}=e,n=Go(e,Gv);yield ki(Io.setActivateStrategyState({loading:!0}));try{const e=yield Ii(Dy.auth.getActivateAccountStrategy,n);yield ki(Io.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield ki(Io.setActivateStrategyState({loading:!1,error:_f(e)}))}}function*Wv({payload:e}){const{callback:t}=e,n=Go(e,$v);yield ki(Io.setTeamLoader({key:Nv.RESEND_ACTIVATE_LINK,value:n.email})),yield ki(Io.setActivateState({loading:!0}));try{yield Ii(Dy.auth.resendActivationEmail,n),yield ki(Io.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield ki(Io.setActivateState({loading:!1,error:_f(e)})),yield ki(Io.setTeamError({key:Nv.RESEND_ACTIVATE_LINK,value:_f(e)})),null==t||t(null,e)}yield ki(Io.setTeamLoader({key:Nv.RESEND_ACTIVATE_LINK,value:!1}))}function*Bv(){yield ka(Io.activateAccount,Vv),yield ka(Io.preActivateAccount,xv),yield ka(Io.getActivateAccountStrategy,jv),yield ka(Io.resendActivationEmail,Wv)}function*Kv({payload:e}){if(e.token&&e.userId)try{yield ki(Io.setAcceptInvitationState({error:void 0,step:xt.pending})),yield Ii(Dy.auth.acceptInvitation,e),yield ki(Io.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:xt.success}}))}catch(e){yield ki(Io.setAcceptInvitationState({step:xt.failed,error:_f(e)}))}else yield ki(Io.setAcceptInvitationState({error:void 0,step:xt.invalid}))}function*zv(){yield ka(Io.acceptInvitation,Kv)}var qv,Hv=new Uint8Array(16);function Jv(){if(!qv&&!(qv="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 qv(Hv)}for(var Qv=/^(?:[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,Yv=function(e){return"string"==typeof e&&Qv.test(e)},Xv=[],Zv=0;Zv<256;++Zv)Xv.push((Zv+256).toString(16).substr(1));var eh=function(e,t,n){var o=(e=e||{}).random||(e.rng||Jv)();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=(Xv[e[t+0]]+Xv[e[t+1]]+Xv[e[t+2]]+Xv[e[t+3]]+"-"+Xv[e[t+4]]+Xv[e[t+5]]+"-"+Xv[e[t+6]]+Xv[e[t+7]]+"-"+Xv[e[t+8]]+Xv[e[t+9]]+"-"+Xv[e[t+10]]+Xv[e[t+11]]+Xv[e[t+12]]+Xv[e[t+13]]+Xv[e[t+14]]+Xv[e[t+15]]).toLowerCase();if(!Yv(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let th,nh;!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"}(th||(th={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(nh||(nh={}));const oh=["callback"],ih=["roles"],ah=["callback"],rh=["callback","profileImage"],lh=["callback"],sh=["callback","userId"],ch=["callback"],uh=["callback"],dh=["callback"],yh=["callback"],fh=["callback"],ph=["callback"],gh=["callback"],Sh=["callback","profileImage"],vh=["callback"],hh=["callback"],mh=["callback"],Ah=["callback"],bh=["callback"],kh=["callback"],Th=()=>Oi((e=>e.auth.teamState));function*Ph(){try{const{groups:e}=yield Ii(Dy.groups.getGroups,{_groupsRelations:nh.roles});return e}catch(e){return[]}}function*Ih({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield Th(),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 ki(Io.setTeamLoader({key:Nv.USERS,value:!a})),yield ki(Io.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:o},{items:i},a]=yield Ti([Ii(Dy.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Ii(Dy.teams.loadAvailableRoles),Ii(Dy.teams.loadAvailablePermissions),Ii(Ph)]),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 U({},e,{groups:n})}));yield ki(Io.setTeamState({users:l,totalPages:t,totalItems:n,roles:o,permissions:i})),null==r||r(e)}catch(e){yield ki(Io.setTeamError({key:Nv.USERS,value:_f(e)})),yield ki(Io.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield ki(Io.setTeamLoader({key:Nv.USERS,value:!1}))}function*Eh({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield Th(),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 ki(Io.setTeamLoader({key:Nv.USERS,value:!r})),yield ki(Io.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:o},{items:i}]=yield Ti([Ii(Dy.subTenants.loadAllUsers,U({},c)),Ii(Dy.teams.loadAvailableRoles),Ii(Dy.teams.loadAvailablePermissions)]);yield ki(Io.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==l||l(e)}catch(e){yield ki(Io.setTeamError({key:Nv.USERS,value:_f(e)})),yield ki(Io.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield ki(Io.setTeamLoader({key:Nv.USERS,value:!1}))}function*Lh({payload:e}){yield ki(Io.setTeamLoader({key:Nv.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield Ti([Ii(Dy.teams.loadAvailableRoles),Ii(Dy.teams.loadAvailablePermissions)]);yield ki(Io.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 ki(Io.setTeamError({key:Nv.ROLES_AND_PERMISSIONS,value:_f(t)}))}yield ki(Io.setTeamLoader({key:Nv.ROLES_AND_PERMISSIONS,value:!0}))}function*Oh({payload:e}){const{callback:t}=e,n=Go(e,oh),o=yield Th();yield ki(Io.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield Ii(Dy.teams.addUser,n),{roles:a}=e,r=U({},Go(e,ih),{roleIds:null!=(i=null==a?void 0:a.map((e=>e.id)))?i:[]});null==t||t(r),yield ki(Io.setTeamState({users:[r,...o.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ki(Io.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!1,error:_f(e)})})),null==t||t(null,e)}}function*wh({payload:e}){const{callback:t}=e,n=yield Th();yield ki(Io.setTeamState({addUserDialogState:U({},n.addUserDialogState,{loading:!0})}));const o=[],i=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield ki(Io.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Ii(Dy.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 ki(Io.loadUsers(r)),yield ki(Io.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:i,allowedEmails:o})}function*Uh({payload:e}){const{callback:t}=e,n=Go(e,ah),o=yield Th();yield ki(Io.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{yield Ii(Dy.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield Ii(Dy.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield ki(Io.setTeamState({allUsers:e,totalPages:o,totalItems:i,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield ki(Io.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!1,error:_f(e)})})),null==t||t(null,e)}}function*Ch({payload:e}){const{callback:t}=e,n=Go(e,rh),{id:o}=n,i=yield Th(),a=i.users.find((e=>e.id===n.id));yield ki(Io.setTeamLoader({key:Nv.UPDATE_USER,value:o||""})),yield ki(Io.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})})),yield ki(Io.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0}),users:i.users.map((e=>e.id===n.id?U({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield Ii(Dy.teams.updateUser,n);null==t||t(e),yield ki(Io.setTeamState({users:i.users.map((t=>t.id===e.id?U({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield ki(Io.setTeamLoader({key:Nv.UPDATE_USER,value:!1}))}catch(e){yield ki(Io.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:_f(e)}),users:i.users.map((e=>e.id===n.id?U({},e,a):e))})),yield ki(Io.setTeamLoader({key:Nv.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*Dh({payload:e}){const{callback:t}=e,n=Go(e,lh),o=yield Th();yield ki(Io.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Ii(Dy.teams.deleteUser,n),null==t||t(!0),yield ki(Io.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ki(Io.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!1,error:_f(e)})})),null==t||t(null,e)}}function*_h({payload:e}){const{callback:t,userId:n}=e,o=Go(e,sh),i=yield Th();yield ki(Io.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})}));try{yield Ii(Dy.subTenants.setUserRolesForSubTenants,n,o);const e=i.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return U({},e,{roles:(null==(t=o.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>i.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield ki(Io.setTeamState({allUsers:[...i.allUsers.filter((e=>e.id!==n)),...e?[U({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield ki(Io.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:_f(e)})})),null==t||t(null,e)}}function*Rh({payload:e}){const{callback:t}=e,n=Go(e,ch),o=yield Th();yield ki(Io.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Ii(Dy.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield ki(Io.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ki(Io.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!1,error:_f(e)})})),null==t||t(null,e)}}function*Mh({payload:e}){const{callback:t}=e,n=Go(e,uh);yield ki(Io.setTeamLoader({key:Nv.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Ii(Dy.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield ki(Io.setTeamError({key:Nv.RESEND_ACTIVATE_LINK,value:_f(e)})),null==t||t(null,e)}yield ki(Io.setTeamLoader({key:Nv.RESEND_ACTIVATE_LINK,value:!1}))}function*Nh({payload:e}){const{callback:t}=e,n=Go(e,dh);yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:n.email}));try{yield Ii(Dy.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield ki(Io.setTeamError({key:Nv.RESEND_INVITATION_LINK,value:_f(e)})),null==t||t(null,e)}yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:!1}))}function*Fh({payload:e}){const{callback:t}=e,n=Go(e,yh);yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:n.email}));try{yield Ii(Dy.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield ki(Io.setTeamError({key:Nv.RESEND_INVITATION_LINK,value:_f(e)})),null==t||t(null,e)}yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:!1}))}function*Gh({payload:e}){const{callback:t}=e,n=Go(e,fh);yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:n.email}));try{yield Ii(Dy.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield ki(Io.setTeamError({key:Nv.RESEND_INVITATION_LINK,value:_f(e)})),null==t||t(null,e)}yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:!1}))}function*$h(){yield ki(Io.setTeamError({key:Nv.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Ii(Dy.teams.getInviteLinkConfiguration);yield ki(Io.setTeamState({inviteTokenState:U({},e)}))}catch(e){yield ki(Io.setTeamError({key:Nv.CONFIG_TOKEN_LINK,value:_f(e)}))}}function*xh(){yield ki(Io.setTeamError({key:Nv.GET_TOKEN_LINK,value:!1}));try{yield Ii($h);const e=yield Ii(Dy.teams.getInviteUserLink),{inviteTokenState:t}=yield Th();yield ki(Io.setTeamState({inviteTokenState:U({},t,e)}))}catch(e){yield ki(Io.setTeamError({key:Nv.GET_TOKEN_LINK,value:_f(e)}))}}function*Vh({payload:{callback:e}}){yield ki(Io.setTeamError({key:Nv.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield Th();try{const n=yield Ii(Dy.teams.createInviteUserLink,{expiresInMinutes:43200});yield ki(Io.setTeamState({inviteTokenState:U({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield ki(Io.setTeamError({key:Nv.CREATE_TOKEN_LINK,value:_f(t)}))}}function*jh({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield Th();yield ki(Io.setTeamError({key:Nv.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield Ii(Dy.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield ki(Io.setTeamState({inviteTokenState:U({},o,i)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield ki(Io.setTeamError({key:Nv.UPDATE_TOKEN_LINK,value:_f(t)}))}}function*Wh({payload:e}){const{callback:t}=null!=e?e:{};yield ki(Io.setTeamError({key:Nv.DELETE_TOKEN_LINK,value:!1}));try{yield Ii(Dy.teams.deleteInviteUserLink),yield ki(Io.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield ki(Io.setTeamError({key:Nv.DELETE_TOKEN_LINK,value:_f(e)})),null==t||t(!1,e)}}function*Bh({payload:e}){yield ki(Io.setTeamState({addUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*Kh({payload:e}){const t=yield Th(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield ki(Io.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*zh({payload:e}){yield ki(Io.setTeamState({deleteUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*qh({payload:e}){const t=yield Th(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield ki(Io.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Hh(){yield ba(Io.loadUsers,Ih),yield ba(Io.loadAllSubTenantsUsers,Eh),yield ba(Io.loadRoles,Lh),yield Aa(Io.addUser,Oh),yield Aa(Io.addUsersBulk,wh),yield Aa(Io.addUserToSubTenants,Uh),yield Aa(Io.updateUser,Ch),yield Aa(Io.setUserRolesForSubTenants,_h),yield Aa(Io.deleteUser,Dh),yield Aa(Io.deleteUserFromSubTenants,Rh),yield Aa(Io.resendActivationLink,Mh),yield Aa(Io.resendInvitationLink,Nh),yield Aa(Io.resendInvitationEmail,Fh),yield Aa(Io.resendInvitationLinkToAllSubTenants,Gh),yield Aa(Io.getInvitationLink,xh),yield Aa(Io.createInvitationLink,Vh),yield Aa(Io.updateInvitationLink,jh),yield Aa(Io.deleteInvitationLink,Wh),yield Aa(Io.openAddUserDialog,Bh),yield Aa(Io.closeAddUserDialog,Kh),yield Aa(Io.openDeleteUserDialog,zh),yield Aa(Io.closeDeleteUserDialog,qh)}function*Jh({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield Th(),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 ki(Io.setTeamLoader({key:Nv.USERS,value:!a})),yield ki(Io.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield mt(),yield ki(Io.setTeamState({users:Af,totalPages:2,totalItems:10,roles:pf,permissions:Sf})),yield ki(Io.setTeamLoader({key:Nv.USERS,value:!1})),null==r||r(Af)}function*Qh({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield Th(),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 ki(Io.setTeamLoader({key:Nv.USERS,value:!r})),yield ki(Io.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield mt(),yield ki(Io.setTeamState({allUsers:bf,totalPages:2,totalItems:10,roles:pf,permissions:Sf})),yield ki(Io.setTeamLoader({key:Nv.USERS,value:!1})),null==l||l(bf)}function*Yh({payload:e}){var t;yield ki(Io.setTeamLoader({key:Nv.ROLES_AND_PERMISSIONS,value:!0})),yield mt(),yield ki(Io.setTeamState({roles:pf,permissions:Sf})),yield ki(Io.setTeamLoader({key:Nv.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:pf,permissions:Sf})}function*Xh({payload:e}){const{callback:t}=e,n=Go(e,ph),o=yield Th();yield ki(Io.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield mt();const i=U({},hf,{groups:[]},n,{id:`${eh()}`});null==t||t(i),yield ki(Io.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*Zh({payload:e}){const{callback:t}=e,n=Go(e,gh),o=yield Th();yield ki(Io.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield mt();const i=U({},hf,n,{id:`${eh()}`});yield ki(Io.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*em({payload:e}){var t;const{callback:n}=e,o=Go(e,Sh),{id:i}=o,a=yield Th(),r=a.users.find((e=>e.id===o.id));yield ki(Io.setTeamLoader({key:Nv.UPDATE_USER,value:i||""})),yield ki(Io.setTeamState({addUserDialogState:U({},a.addUserDialogState,{loading:!0})})),yield ki(Io.setTeamState({addUserDialogState:U({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===o.id?U({},e,o):e))})),r.roleIds.length>0&&0===(null==(t=o.roleIds)?void 0:t.length)&&(o.roleIds=[""]),yield mt();const l=U({},r,o);null==n||n(l),yield ki(Io.setTeamState({users:a.users.map((e=>e.id===l.id?U({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield ki(Io.setTeamLoader({key:Nv.UPDATE_USER,value:!1}))}function*tm({payload:e}){const{callback:t}=e,n=Go(e,vh),o=yield Th();yield ki(Io.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield ki(Io.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*nm({payload:e}){const{callback:t}=e,n=Go(e,hh),o=yield Th();yield ki(Io.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield ki(Io.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*om({payload:e}){const{callback:t}=e,n=Go(e,mh);yield ki(Io.setTeamLoader({key:Nv.RESEND_ACTIVATE_LINK,value:n.userId})),yield mt(),null==t||t(!0),yield ki(Io.setTeamLoader({key:Nv.RESEND_ACTIVATE_LINK,value:!1}))}function*im({payload:e}){const{callback:t}=e,n=Go(e,Ah);yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:!1}))}function*am({payload:e}){const{callback:t}=e,n=Go(e,bh);yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:!1}))}function*rm({payload:e}){const{callback:t}=e,n=Go(e,kh);yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:!1}))}function*lm(){yield ba(Io.loadUsers,Jh),yield ba(Io.loadAllSubTenantsUsers,Qh),yield ba(Io.loadRoles,Yh),yield Aa(Io.addUser,Xh),yield Aa(Io.addUserToSubTenants,Zh),yield Aa(Io.updateUser,em),yield Aa(Io.deleteUser,tm),yield Aa(Io.deleteUserFromSubTenants,nm),yield Aa(Io.resendActivationLink,om),yield Aa(Io.resendInvitationLink,im),yield Aa(Io.resendInvitationEmail,am),yield Aa(Io.resendInvitationLinkToAllSubTenants,rm),yield Aa(Io.openAddUserDialog,Bh),yield Aa(Io.closeAddUserDialog,Kh),yield Aa(Io.openDeleteUserDialog,zh),yield Aa(Io.closeDeleteUserDialog,qh)}const sm=["authorizationUrl"],cm=["events","url"];function*um(){try{yield ki(Io.setSocialLoginsState({loading:!0}));const e=yield Ii(Dy.auth.getSocialLoginProviders);yield ki(Io.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield ki(Io.setSocialLoginsState({error:_f(e),loading:!1,firstLoad:!1}))}}function*dm(){try{const e=yield Oi((e=>e.root.context));yield ki(Io.setSocialLoginsState({loading:!0}));const t=yield Ii(Dy.auth.getSocialLoginProvidersV2),{providers:n}=yield Ii(Dy.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Go(t,sm);const i=lr(e,null!=n?n:"");return U({},o,{authorizationUrl:n?`${i}${n}`:null})}));yield ki(Io.setSocialLoginsState({socialLoginsConfigV2:o,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield ki(Io.setSocialLoginsState({error:_f(e),loading:!1,firstLoad:!1}))}}function*ym(e){let{payload:{events:t,url:n}}=e,o=Go(e.payload,cm);try{yield ki(Io.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Ii(Dy.auth.loginViaSocialLogin,o);var i,a;r&&(null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,url:n,authenticationType:Cf.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:o.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:Uf.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield ki(Io.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield Oi((e=>e.auth));e?yield Ii(rg):yield Ii(sg),yield og()}(),localStorage.removeItem("register-quick-login"),yield ki(Io.setSocialLoginsState({loading:!1}))}catch(e){yield ki(Io.setSocialLoginsState({loading:!1,error:_f(e,"Failed to authenticate"),firstLoad:!1}))}}function*fm({payload:e}){yield ki(Io.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*pm(){yield ka(Io.loadSocialLoginsConfiguration,um),yield ka(Io.loadSocialLoginsConfigurationV2,dm),yield ka(Io.loginViaSocialLogin,ym),yield ba(Io.setSocialLoginError,fm)}let gm;function*Sm({payload:e}){const{description:t,expires:n,callback:o}=e,{apiTokensDataUser:i}=yield Oi((e=>e.auth.apiTokensState));try{let e,a;yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield Ii(Dy.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield Ii(Dy.auth.updateUserApiTokensData,{description:t}),yield ki(Io.setApiTokensState({showAddTokenDialog:!1})),yield wi(200),yield ki(Io.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield ki(Io.setApiTokensError({key:gm.ADD_API_TOKEN,value:_f(e)})),yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*vm({payload:e}){const{description:t,roleIds:n,expires:o,callback:i}=e,{apiTokensDataTenant:a}=yield Oi((e=>e.auth.apiTokensState));try{let e,r;yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield Ii(Dy.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield Ii(Dy.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield ki(Io.setApiTokensState({showAddTokenDialog:!1})),yield wi(200),yield ki(Io.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===o?e.clientId:void 0}})),yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield ki(Io.setApiTokensError({key:gm.ADD_API_TOKEN,value:_f(e)})),yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*hm({payload:e}){const{apiTokensDataUser:t}=yield Oi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!0})),n?(yield Ii(Dy.auth.deleteUserAccessToken,{id:e}),yield ki(Io.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Ii(Dy.auth.deleteUserApiToken,{tokenId:e}),yield ki(Io.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!1}))}catch(e){yield ki(Io.setApiTokensError({key:gm.DELETE_API_TOKEN,value:_f(e)})),yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!1}))}}function*mm({payload:e}){const{apiTokensDataTenant:t}=yield Oi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let o=t;try{yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!0})),n?(yield Ii(Dy.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield Ii(Dy.auth.deleteTenantApiToken,{tokenId:e}),o=t.filter((t=>t.clientId!==e))),yield ki(Io.setApiTokensState({apiTokensDataTenant:o,deleteTokenDialog:{open:!1,id:e}})),yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!1}))}catch(e){yield ki(Io.setApiTokensError({key:gm.DELETE_API_TOKEN,value:_f(e)})),yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!1}))}}function*Am({payload:e}){null!=e&&e.silentLoading||(yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield Ti([Ii(Dy.auth.getUserApiTokensData),Ii(Dy.auth.getTenantApiTokensData)]);yield ki(Io.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ki(Io.setApiTokensError({key:gm.LOAD_API_TOKENS,value:_f(t)})),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*bm({payload:e}){null!=e&&e.silentLoading||(yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Ii(Dy.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=Ii(Dy.auth.getUserAccessTokensData))?n:[]).accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield ki(Io.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield ki(Io.setApiTokensError({key:gm.LOAD_API_TOKENS,value:_f(t)})),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*km({payload:e}){null!=e&&e.silentLoading||(yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Ii(Dy.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Ii(Dy.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 ki(Io.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield ki(Io.setApiTokensError({key:gm.LOAD_API_TOKENS,value:_f(t)})),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Tm(){yield ka(Io.loadApiTokens,Am),yield ka(Io.loadUserApiTokens,bm),yield ka(Io.loadTenantApiTokens,km),yield Aa(Io.addUserApiToken,Sm),yield Aa(Io.addTenantApiToken,vm),yield ba(Io.deleteTenantApiToken,mm),yield ba(Io.deleteUserApiToken,hm)}function*Pm({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield Oi((e=>e.auth.apiTokensState)),a=U({},tf,{description:t,roleIds:n,clientId:`CLIENT_ID_${eh()}`});yield ki(Io.setApiTokensState({showAddTokenDialog:!1})),yield wi(200),yield ki(Io.setApiTokensState({apiTokensDataTenant:[...i,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield wi(200),yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*Im({payload:e}){yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!0})),yield wi(200);const t=[tf];yield ki(Io.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!1}))}function*Em({payload:e}){var t;null!=e&&e.silentLoading||(yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!0})));const n=[ef],o=[tf];yield ki(Io.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield wi(200),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Lm({payload:e}){var t;null!=e&&e.silentLoading||(yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!0})));const n=[ef];yield ki(Io.setApiTokensState({apiTokensDataUser:n})),yield wi(200),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Om({payload:e}){var t;null!=e&&e.silentLoading||(yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!0})));const n=[tf];yield ki(Io.setApiTokensState({apiTokensDataTenant:n})),yield wi(200),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*wm(){yield ka(Io.loadApiTokens,Em),yield ka(Io.loadUserApiTokens,Lm),yield ka(Io.loadTenantApiTokens,Om),yield Aa(Io.addTenantApiToken,Pm),yield ba(Io.deleteTenantApiToken,Im)}function*Um({payload:e}){try{var t;yield ki(Io.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Oi((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Ii(Dy.accountSettings.updateSettings,U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield ki(Io.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield ki(Io.setAccountSettingsState({loading:!1,error:_f(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Cm({payload:e}){yield ki(Io.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Ii(Dy.accountSettings.getSettings);yield ki(Io.setAccountSettingsState(U({},e,{loading:!1})))}catch(e){yield ki(Io.setAccountSettingsState({loading:!1,error:_f(e)}))}}function*Dm(){yield ka(Io.saveAccountSettings,Um),yield ka(Io.loadAccountSettings,Cm)}function*_m({payload:e}){var t;yield ki(Io.setAccountSettingsState({loading:!0})),yield mt();const{accountSettingsState:n}=yield Oi((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield ki(Io.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*Rm({payload:e}){yield ki(Io.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield mt(),yield ki(Io.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Mm(){yield ka(Io.saveAccountSettings,_m),yield ka(Io.loadAccountSettings,Rm)}function*Nm({payload:{tenantId:e,callback:t}}){yield ki(Io.setState({isLoading:!0}));try{yield Ii(Dy.tenants.switchTenant,{tenantId:e}),yield Ii(ig),(null==t?void 0:t(!0))||(yield ki(Io.setState({isLoading:!1})))}catch(e){yield ki(Io.setState({isLoading:!1})),null==t||t(!1,e)}}function*Fm({payload:e}){yield ki(Io.setTenantsState({loading:!0}));try{var t;const n=yield Ii(Dy.tenants.getTenants);yield ki(Io.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 ki(Io.setTenantsState({loading:!1}))}}function*Gm({payload:e}){yield ki(Io.setTenantsState({loading:!0}));try{var t;const n=yield Ii(Dy.tenants.getSubTenants);yield ki(Io.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ki(Io.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*$m({payload:e}){yield ki(Io.setTenantsState({loading:!0}));try{var t;const n=yield Ii(Dy.tenants.getSubTenantsAsTree);yield ki(Io.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ki(Io.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*xm(){yield Aa(Io.loadTenants,Fm),yield Aa(Io.loadSubTenants,Gm),yield Aa(Io.switchTenant,Nm),yield Aa(Io.loadSubTenantsTree,$m)}function*Vm(){yield ki(Io.setTenantsState({loading:!0})),yield mt(),yield ki(Io.setTenantsState({tenants:kf,loading:!1}))}function*jm(){yield Aa(Io.loadTenants,Vm)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(gm||(gm={}));const Wm=["callback"],Bm=["callback"],Km=["callback"],zm=["callback"],qm=["callback"];function*Hm({payload:e}){var t;yield ki(Io.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Ti([Ii(Dy.roles.getRoles),Ii(Dy.roles.getPermissions),Ii(Dy.roles.getPermissionCategories)]),[t,n,o]=e;yield ki(Io.setRolesState({roles:t,permissions:n,permissionCategories:o,loading:!1}))}catch(e){yield ki(Io.setRolesState({error:_f(e),loading:!1}))}}function*Jm(e){let{payload:{callback:t}}=e,n=Go(e.payload,Wm);yield ki(Io.setRolesState({saving:!0}));try{const e=yield Ii(Dy.roles.addRole,n),o=yield Ii(Dy.roles.getRoles);yield ki(Io.loadRolesAndPermissions({silentLoading:!0})),yield ki(Io.setRolesState({roles:o,saving:!1})),null==t||t(e)}catch(e){yield ki(Io.setRolesState({error:_f(e),saving:!1})),null==t||t(null,e)}}function*Qm(e){let{payload:{callback:t}}=e,n=Go(e.payload,Bm);yield ki(Io.setRolesState({saving:!0}));try{yield Ii(Dy.roles.deleteRole,n),yield ki(Io.loadRolesAndPermissions({silentLoading:!0})),yield ki(Io.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield ki(Io.setRolesState({error:_f(e),saving:!1})),null==t||t(!1,e)}}function*Ym(e){let{payload:{callback:t}}=e,n=Go(e.payload,Km);yield ki(Io.setRolesState({saving:!0}));try{const e=yield Ii(Dy.roles.updateRole,n);yield ki(Io.loadRolesAndPermissions({silentLoading:!0})),yield ki(Io.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ki(Io.setRolesState({error:_f(e),saving:!1})),null==t||t(null,e)}}function*Xm(e){let{payload:{callback:t}}=e,n=Go(e.payload,zm);yield ki(Io.setRolesState({saving:!0}));try{const e=yield Ii(Dy.roles.attachPermissionsToRole,n);yield ki(Io.loadRolesAndPermissions({silentLoading:!0})),yield ki(Io.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ki(Io.setRolesState({error:_f(e),saving:!1})),null==t||t(null,e)}}function*Zm(e){let{payload:{callback:t}}=e,n=Go(e.payload,qm);yield ki(Io.setRolesState({saving:!0}));try{const e=yield Ii(Dy.roles.attachPermissionToRoles,n);yield ki(Io.loadRolesAndPermissions({silentLoading:!0})),yield ki(Io.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ki(Io.setRolesState({error:_f(e),saving:!1})),null==t||t(null,e)}}function*eA(){yield ka(Io.loadRolesAndPermissions,Hm),yield Aa(Io.addRole,Jm),yield Aa(Io.deleteRole,Qm),yield Aa(Io.updateRole,Ym),yield Aa(Io.attachPermissionsToRole,Xm),yield Aa(Io.attachPermissionToRoles,Zm)}function*tA({payload:e}){var t;yield ki(Io.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield ki(Io.setRolesState({roles:nf,loading:!1}))}catch(e){yield ki(Io.setRolesState({error:_f(e),loading:!1}))}}function*nA(){yield ka(Io.loadRolesAndPermissions,tA)}const oA=["callback"],iA=["callback"],aA=["callback"];function*rA(e){let{payload:{callback:t}}=e,n=Go(e.payload,oA);yield ki(Io.setResetPhoneNumberState({loading:!0}));try{const e=yield Ii(Dy.auth.resetPhoneNumber,n);yield ki(Io.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),yield ki(Io.setLoginState({email:n.email}))}catch(e){yield ki(Io.setResetPhoneNumberState({loading:!1,error:_f(e)})),null==t||t(null,e)}}function*lA(e){let{payload:{callback:t}}=e,n=Go(e.payload,iA);yield ki(Io.setResetPhoneNumberState({loading:!0}));try{const e=yield Ii(Dy.auth.verifyResetPhoneNumber,n);yield ki(Io.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Ht.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield ki(Io.setResetPhoneNumberState({loading:!1,error:_f(e)})),null==t||t(null,e)}}function*sA(e){let{payload:{callback:t}}=e,n=Go(e.payload,aA);yield ki(Io.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:o}=yield Oi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Ii(Dy.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield ki(Io.setLoginState({step:Pt.loginWithSmsOtc})),yield ki(Io.passwordlessPreLogin({type:Xr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(o.loginUrl),yield ki(Io.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setResetPhoneNumberState({loading:!1,error:_f(e)})),null==t||t(null,e)}}function*cA(){yield ka(Io.resetPhoneNumber,rA),yield ka(Io.verifyResetPhoneNumber,lA),yield ka(Io.changePhoneNumber,sA)}function*uA(){yield ki(Io.setSessionsState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getCurrentUserSessions);yield ki(Io.setSessionsState({sessions:e,loading:!1}))}catch(e){yield ki(Io.setSessionsState({error:e,loading:!1}))}}function*dA(){yield ki(Io.setSessionsState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getCurrentUserSession);yield ki(Io.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield ki(Io.setSessionsState({error:e,loading:!1}))}}function*yA({payload:{id:e}}){yield ki(Io.setSessionsState({loading:!0,error:null}));try{yield Ii(Dy.auth.deleteSessionForUser,e),yield ki(Io.loadUserSessions())}catch(e){yield ki(Io.setSessionsState({error:e,loading:!1}))}}function*fA({payload:{callback:e,userId:t}}){yield ki(Io.setSessionsState({loading:!0,error:null}));try{yield Ii(Dy.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield ki(Io.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*pA(){yield ki(Io.setSessionsState({loading:!0,error:null}));try{yield Ii(Dy.auth.deleteAllSessionsForUser),yield ki(Io.loadUserSessions())}catch(e){yield ki(Io.setSessionsState({error:e,loading:!1}))}}function*gA(){yield ba(Io.loadUserSessions,uA),yield ba(Io.deleteUserSession,yA),yield ba(Io.deleteAllUserSessions,pA),yield ba(Io.loadCurrentUserSession,dA),yield Aa(Io.revokeUserSessions,fA)}function*SA(){yield ki(Io.setSessionsState({loading:!0,error:null})),yield ki(Io.setSessionsState({sessions:Tf,loading:!1}))}function*vA({payload:{id:e}}){yield ki(Io.setSessionsState({loading:!0,error:null}));const t=(yield Oi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield ki(Io.setSessionsState({sessions:t,loading:!1}))}function*hA(){yield ki(Io.setSessionsState({loading:!0,error:null}));const e=Tf.filter((e=>e.current));yield ki(Io.setSessionsState({sessions:e,loading:!1}))}function*mA(){yield ba(Io.loadUserSessions,SA),yield ba(Io.deleteUserSession,vA),yield ba(Io.deleteAllUserSessions,hA)}const AA=["callback"],bA=["callback"];function*kA(){yield ki(Io.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getSessionConfigurations);yield ki(Io.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield ki(Io.setSessionsState({error:e,loading:!1}))}}function*TA({payload:e}){yield ki(Io.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Go(e,AA);yield Ii(Dy.auth.createOrUpdateSessionConfigrations,n),yield ki(Io.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield ki(Io.setSessionsPolicyState({error:e,loading:!1}))}}function*PA(){yield ka(Io.loadSessionsPolicy,kA),yield ba(Io.createOrUpdateSessionsPolicy,TA)}function*IA(){yield ki(Io.setSessionsPolicyState({loading:!0,error:null}));const e=yield Oi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Pf}));yield ki(Io.setSessionsPolicyState(U({},e,{loading:!1})))}function*EA({payload:e}){yield ki(Io.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Go(e,bA);null==t||t(!0),yield ki(Io.setSessionsPolicyState({configurations:n,loading:!1}))}function*LA(){yield ka(Io.loadSessionsPolicy,IA),yield ba(Io.createOrUpdateSessionsPolicy,EA)}const OA=["callback"],wA=["callback"],UA=["callback"],CA=["callback"],DA=["callback"],_A=["callback"],RA=["callback"],MA=["callback"],NA=()=>Oi((e=>e.auth.restrictionsState.ipRestrictions)),FA=()=>Oi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*GA(){yield ki(Io.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getDomainRestrictionsConfig),t=(yield Ii(Dy.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ki(Io.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield ki(Io.setEmailDomainRestrictionsState({error:_f(e),loading:!1}))}}function*$A(e){let{payload:{callback:t}}=e,n=Go(e.payload,OA);yield ki(Io.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield FA();try{var i;yield Ii(Dy.auth.createDomainRestriction,n);const e=(yield Ii(Dy.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=o.data)?void 0:t.config.listType)}));yield ki(Io.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 ki(Io.setEmailDomainRestrictionsState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*xA(e){let{payload:{callback:t}}=e,n=Go(e.payload,wA);yield ki(Io.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Ii(Dy.auth.updateDomainRestrictionConfig,n),o=(yield Ii(Dy.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ki(Io.setEmailDomainRestrictionsState({data:{config:e,restrictions:o},saving:!1})),null==t||t(!0)}catch(e){yield ki(Io.setEmailDomainRestrictionsState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*VA({payload:{id:e}}){yield ki(Io.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield FA();try{var n;yield Ii(Dy.auth.deleteDomainRestriction,e);const o=(yield Ii(Dy.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield ki(Io.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:o},saving:!1}))}catch(e){yield ki(Io.setEmailDomainRestrictionsState({saving:!1,error:_f(e)}))}}const jA=e=>{var t,n,o;return{_filter:null!=(t=null==e?void 0:e._filter)?t:xn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(o=null==e?void 0:e._offset)?o:0}};function*WA(){yield ki(Io.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield NA(),t=yield Ii(Dy.auth.getIPRestrictionsConfig),n=jA({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield Ii(Dy.auth.getIPRestrictions,n);yield ki(Io.setIpRestrictionsState({data:{restrictions:o,config:t},totalPages:i,pagination:n,loading:!1}))}catch(e){yield ki(Io.setIpRestrictionsState({error:_f(e),loading:!1}))}}function*BA(){try{const{valid:e}=yield Ii(Dy.auth.testCurrentIpInAllowList);yield ki(Io.setIpRestrictionsState({userIpValid:e}))}catch(e){yield ki(Io.setIpRestrictionsState({error:_f(e)}))}}function*KA({payload:{callback:e}}){yield ki(Io.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Oi((e=>e.auth.userIp));yield Ti([Ii(Dy.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:xn.ALLOW}),Ii(Dy.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield NA(),o=jA(n.pagination),{items:i,_metadata:{totalPages:a}}=yield Ii(Dy.auth.getIPRestrictions,o);yield ki(Io.setIpRestrictionsState({data:{config:{isActive:!0,strategy:xn.ALLOW},restrictions:i},userIpValid:!0,pagination:o,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield ki(Io.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*zA(e){let{payload:{callback:t}}=e,n=Go(e.payload,UA);yield ki(Io.setIpRestrictionsState({saving:!0,error:null}));const o=yield NA();try{var i,a;yield Ii(Dy.auth.createIPRestriction,n);const e=yield NA(),r=jA(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Ii(Dy.auth.getIPRestrictions,r);yield BA(),yield ki(Io.setIpRestrictionsState({data:{config:null!=(i=null==(a=o.data)?void 0:a.config)?i:{isActive:!1,strategy:xn.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield ki(Io.setIpRestrictionsState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*qA(e){let{payload:{callback:t}}=e,n=Go(e.payload,CA);yield ki(Io.setIpRestrictionsState({saving:!0,error:null}));try{yield Ii(Dy.auth.updateIPRestrictionConfig,n);const e=yield NA(),o=yield Ii(Dy.auth.getIPRestrictionsConfig),i=jA(U({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield Ii(Dy.auth.getIPRestrictions,i);yield BA(),yield ki(Io.setIpRestrictionsState({data:{config:o,restrictions:a},pagination:i,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield ki(Io.setIpRestrictionsState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*HA({payload:{id:e,callback:t}}){yield ki(Io.setIpRestrictionsState({saving:!0,error:null}));const n=yield NA();try{var o;yield Ii(Dy.auth.deleteIPRestriction,e);const i=yield NA(),a=jA(i.pagination),{items:r,_metadata:{totalPages:l}}=yield Ii(Dy.auth.getIPRestrictions,a);yield BA(),yield ki(Io.setIpRestrictionsState({data:{config:(null==(o=n.data)?void 0:o.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield ki(Io.setIpRestrictionsState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*JA(){yield ka(Io.loadIpRestrictions,WA),yield ka(Io.loadEmailDomainRestrictions,GA),yield Aa(Io.saveIpRestriction,zA),yield Aa(Io.saveIpRestrictionsConfig,qA),yield Aa(Io.deleteIpRestriction,HA),yield Aa(Io.checkIfUserIpValid,BA),yield Aa(Io.addCurrentUserIpAndActivate,KA),yield Aa(Io.saveEmailDomainRestriction,$A),yield Aa(Io.saveEmailDomainRestrictionsConfig,xA),yield Aa(Io.deleteEmailDomainRestriction,VA)}function*QA(){yield ki(Io.setIpRestrictionsState({loading:!0,error:null})),yield ki(Io.setIpRestrictionsState({data:{restrictions:Ef.filter((e=>e.strategy===If.strategy)),config:If},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*YA(){yield ki(Io.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield NA(),t=Ef[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield ki(Io.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield ki(Io.setIpRestrictionsState({error:_f(e),loading:!1}))}}function*XA(e){var t,n,o;let{payload:{callback:i}}=e,a=Go(e.payload,DA);yield ki(Io.setIpRestrictionsState({saving:!0,error:null}));const r=yield NA(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield ki(Io.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:xn.ALLOW},restrictions:[...l,U({},a,{createdAt:new Date,updatedAt:new Date,id:eh(),isActive:null==(o=a.isActive)||o,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*ZA(e){var t,n,o;let{payload:{callback:i}}=e,a=Go(e.payload,_A);const r=yield NA();yield ki(Io.setIpRestrictionsState({saving:!0,error:null})),yield ki(Io.setIpRestrictionsState({data:{config:U({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(o=r.data)?void 0:o.restrictions)?n:[]},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield ki(Io.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*eb({payload:{id:e,callback:t}}){var n;yield ki(Io.setIpRestrictionsState({saving:!0,error:null}));const o=yield NA();yield ki(Io.setIpRestrictionsState({data:{config:(null==(n=o.data)?void 0:n.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:o.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*tb(){yield ki(Io.setEmailDomainRestrictionsState({loading:!0,error:null})),yield ki(Io.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:xn.ALLOW}],config:{active:!0,listType:xn.ALLOW,blockPublicDomains:!1}}}))}function*nb(e){var t,n;let{payload:{callback:o}}=e,i=Go(e.payload,RA);const a=yield FA();yield ki(Io.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==o||o(!0),yield ki(Io.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:i.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],U({},i,{id:Date.now().toString()})]},saving:!1}))}function*ob(e){var t;let{payload:{callback:n}}=e,o=Go(e.payload,MA);const i=yield FA();yield ki(Io.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==n||n(!0),yield ki(Io.setEmailDomainRestrictionsState({data:{config:{active:o.active,blockPublicDomains:o.blockPublicDomains||!1,listType:o.type||xn.ALLOW},restrictions:[...(null==(t=i.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*ib({payload:{id:e}}){var t,n;const o=yield FA();yield ki(Io.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),yield ki(Io.setEmailDomainRestrictionsState({data:{config:(null==(t=o.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:((null==(n=o.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*ab(){yield ka(Io.loadIpRestrictions,QA),yield ka(Io.loadEmailDomainRestrictions,tb),yield Aa(Io.saveIpRestriction,XA),yield Aa(Io.saveIpRestrictionsConfig,ZA),yield Aa(Io.deleteIpRestriction,eb),yield Aa(Io.checkIfUserIpValid,YA),yield Aa(Io.saveEmailDomainRestriction,nb),yield Aa(Io.saveEmailDomainRestrictionsConfig,ob),yield Aa(Io.deleteEmailDomainRestriction,ib)}const rb=["callback"],lb=["id"];function*sb(e){const{count:t}=yield Ii(Dy.directory.countConfigurationUsers,e.id);return U({},e,{count:t})}function*cb(){yield ki(Io.setProvisioningState({loading:!0,error:null}));try{const e=yield Ii(Dy.directory.getConfigs),t=yield Ti(e.map((e=>sb(e))));yield ki(Io.setProvisioningState({connections:t,loading:!1}))}catch(e){yield ki(Io.setProvisioningState({error:_f(e),loading:!1}))}}function*ub(e){let{payload:{callback:t}}=e,n=Go(e.payload,rb);yield ki(Io.setProvisioningState({loading:!0,error:null}));try{const e=yield Ii(Dy.directory.createConfiguration,n),o=yield Ii(Dy.directory.getConfigs),i=yield Ti(o.map((e=>sb(e))));yield ki(Io.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield ki(Io.setProvisioningState({error:_f(e),loading:!1}))}}function*db(e){let{payload:{id:t}}=e,n=Go(e.payload,lb);yield ki(Io.setProvisioningState({loading:!0,error:null}));try{yield Ii(Dy.directory.updateConfiguration,t,n);const e=yield Ii(Dy.directory.getConfigs),o=yield Ti(e.map((e=>sb(e))));yield ki(Io.setProvisioningState({connections:o,loading:!1}))}catch(e){yield ki(Io.setProvisioningState({error:_f(e),loading:!1}))}}function*yb({payload:{id:e,callback:t}}){yield ki(Io.setProvisioningState({loading:!0,error:null}));try{yield Ii(Dy.directory.deleteConfiguration,e);const n=yield Ii(Dy.directory.getConfigs),o=yield Ti(n.map((e=>sb(e))));yield ki(Io.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setProvisioningState({error:_f(e),loading:!1})),null==t||t(!1,e)}}function*fb(){yield ka(Io.loadProvisionConnections,cb),yield Aa(Io.createProvisionConnection,ub),yield Aa(Io.deleteProvisionConnection,yb),yield Aa(Io.updateProvisionConnection,db)}const pb=["callback","events"];function*gb(e){let{payload:{callback:t}}=e,n=Go(e.payload,pb);yield ki(Io.setImpersonateState({loading:!0}));try{yield Ii(Dy.impersonate.impersonate,n),yield ki(Io.setImpersonateState({step:mo.success})),yield wi(1e3),yield Jp(),yield ki(Io.resetImpersonateState()),null==t||t(!0)}catch(e){yield ki(Io.setImpersonateState({loading:!1,error:_f(e)}))}}function*Sb(){yield ka(Io.impersonate,gb)}function*vb({payload:e}){const{callback:t,deviceId:n}=e;yield ki(Io.setPasskeysState({loading:!0}));try{yield Ii(Dy.auth.deleteWebAuthnDevice,n);const{devices:e}=yield Oi((e=>e.auth.passkeysState)),o=e.filter((e=>e.id!==n));yield ki(Io.setPasskeysState({devices:o,loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setPasskeysState({loading:!1,error:_f(e,null)})),null==t||t(null,e)}}function*hb(){yield ki(Io.setPasskeysState({loading:!0}));try{const{devices:e}=yield Ii(Dy.auth.getWebAuthnDevices);yield ki(Io.setPasskeysState({devices:e,loading:!1}))}catch(e){yield ki(Io.setPasskeysState({loading:!1,error:_f(e,null)}))}}function*mb(){yield Aa(Io.loadWebAuthnDevices,hb),yield Aa(Io.deleteWebAuthnDevice,vb)}const Ab=["roleIds","userIds"],bb=()=>Oi((e=>e.auth.groupsState));function*kb({payload:e}){const t=th.GET_TEAM_USERS;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Ii(Dy.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield ki(Io.setGroupsState({teamUsers:n}))}catch(e){yield ki(Io.setUsersGroupsError({key:t,value:_f(e)}))}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Tb({payload:e}){const t=th.GET_GROUP;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Ii(Dy.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:nh.rolesAndUsers});yield ki(Io.setGroupsState({selectedGroup:n}))}catch(e){yield ki(Io.setUsersGroupsError({key:t,value:_f(e)}))}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Pb(){const e=th.GET_GROUPS,t=yield bb();yield ki(Io.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Ii(Dy.groups.getGroups,{_groupsRelations:nh.rolesAndUsers});yield ki(Io.setGroupsState(U({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield ki(Io.setUsersGroupsError({key:e,value:_f(t)}))}finally{yield ki(Io.setUsersGroupsLoader({key:e,value:!1}))}}function*Ib({payload:e}){const t=th.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Go(e,Ab);yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Ii(Dy.groups.createGroup,U({name:i.name},!!i.description&&{description:i.description},{color:i.color}));null!=o&&o.length&&(yield ki(Io.addUsersToGroup({groupId:r.id,userIds:o}))),null!=n&&n.length&&(yield ki(Io.addRolesToGroup({groupId:r.id,roleIds:n}))),yield ki(Io.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield ki(Io.setUsersGroupsError({key:t,value:_f(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Eb({payload:e}){const t=th.UPDATE_GROUP;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ii(Dy.groups.updateGroup,e),yield ki(Io.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ki(Io.setUsersGroupsError({key:t,value:_f(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Lb({payload:e}){const t=th.DELETE_GROUP;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ii(Dy.groups.deleteGroup,e.groupId),yield ki(Io.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ki(Io.setUsersGroupsError({key:t,value:_f(n)})),null==e||null==(o=e.callback)||o.call(e,!1,n)}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Ob({payload:e}){const t=th.ADD_ROLES_TO_GROUP;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ii(Dy.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield ki(Io.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ki(Io.setUsersGroupsError({key:t,value:_f(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*wb({payload:e}){const t=th.DELETE_ROLES_FROM_GROUP;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ii(Dy.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield ki(Io.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ki(Io.setUsersGroupsError({key:t,value:_f(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Ub({payload:e}){const t=th.ADD_USERS_TO_GROUP;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ii(Dy.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield ki(Io.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 ki(Io.setUsersGroupsError({key:t,value:_f(n)}))}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Cb({payload:e}){const t=th.DELETE_USERS_FROM_GROUP;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ii(Dy.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield ki(Io.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ki(Io.setUsersGroupsError({key:t,value:_f(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Db(){const e=th.GET_GROUP_CONFIGURATION;yield ki(Io.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Ii(Dy.groups.getGroupConfiguration);yield ki(Io.setGroupsState({groupsConfiguration:t}))}catch(t){yield ki(Io.setUsersGroupsError({key:e,value:_f(t)}))}finally{yield ki(Io.setUsersGroupsLoader({key:e,value:!1}))}}function*_b({payload:e}){const t=th.UPDATE_GROUP_CONFIGURATION;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{yield Ii(Dy.groups.updateGroupConfiguration,e),yield ki(Io.getGroupConfiguration())}catch(e){yield ki(Io.setUsersGroupsError({key:t,value:_f(e)}))}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Rb(){yield ba(Io.loadGroups,Pb),yield ba(Io.getGroupById,Tb),yield ba(Io.createGroup,Ib),yield ba(Io.updateGroup,Eb),yield ba(Io.deleteGroup,Lb),yield ba(Io.addRolesToGroup,Ob),yield ba(Io.deleteRolesFromGroup,wb),yield ba(Io.addUsersToGroup,Ub),yield ba(Io.deleteUsersFromGroup,Cb),yield ba(Io.getGroupConfiguration,Db),yield ba(Io.updateGroupConfiguration,_b),yield ba(Io.getTeamUsers,kb)}function*Mb(){const e=th.GET_GROUPS;yield ki(Io.setUsersGroupsLoader({key:e,value:!0}));const t=wf;yield ki(Io.setGroupsState({groups:t})),yield ki(Io.setUsersGroupsLoader({key:e,value:!1}))}function*Nb({payload:e}){var t;const n=th.CREATE_GROUP,{groups:o}=yield bb();yield ki(Io.setUsersGroupsLoader({key:n,value:!0})),yield ki(Io.setGroupsState({groups:[U({},e,{id:`${e.name}ID`,managedBy:Cy.FRONTEGG}),...null!=o?o:[]]})),yield wi(500),null==e||null==(t=e.callback)||t.call(e,!0),yield ki(Io.setUsersGroupsLoader({key:n,value:!1}))}function*Fb({payload:e}){var t,n,o,i,a;const r=th.UPDATE_GROUP,l=yield bb();yield ki(Io.setUsersGroupsLoader({key:r,value:!0})),yield ki(Io.setGroupsState({groups:null==l||null==(t=l.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:Cy.FRONTEGG}):t})),selectedGroup:U({},null==l?void 0:l.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(o=null==e?void 0:e.color)?o:"",description:null!=(i=null==e?void 0:e.description)?i:""})})),yield wi(500),null==e||null==(a=e.callback)||a.call(e,!0),yield ki(Io.setUsersGroupsLoader({key:r,value:!1}))}function*Gb({payload:e}){var t,n;const o=th.DELETE_GROUP,i=yield bb();yield ki(Io.setUsersGroupsLoader({key:o,value:!0})),yield ki(Io.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield wi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ki(Io.setUsersGroupsLoader({key:o,value:!1}))}function*$b({payload:e}){var t,n;const o=th.ADD_ROLES_TO_GROUP,i=yield bb();yield ki(Io.setUsersGroupsLoader({key:o,value:!0})),yield ki(Io.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield wi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ki(Io.setUsersGroupsLoader({key:o,value:!1}))}function*xb({payload:e}){var t,n;const o=th.DELETE_ROLES_FROM_GROUP,i=yield bb();yield ki(Io.setUsersGroupsLoader({key:o,value:!0})),yield ki(Io.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield wi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ki(Io.setUsersGroupsLoader({key:o,value:!1}))}function*Vb({payload:e}){var t,n;const o=th.ADD_USERS_TO_GROUP,i=yield bb();yield ki(Io.setUsersGroupsLoader({key:o,value:!0})),yield ki(Io.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield wi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ki(Io.setUsersGroupsLoader({key:o,value:!1}))}function*jb({payload:e}){var t,n;const o=th.DELETE_USERS_FROM_GROUP,i=yield bb();yield ki(Io.setUsersGroupsLoader({key:o,value:!0})),yield ki(Io.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield wi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ki(Io.setUsersGroupsLoader({key:o,value:!1}))}function*Wb(){const e=th.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield bb();yield ki(Io.setUsersGroupsLoader({key:e,value:!0})),t&&(yield ki(Io.setGroupsState({groupsConfiguration:U({},t)}))),yield ki(Io.setUsersGroupsLoader({key:e,value:!1}))}function*Bb({payload:e}){const t=th.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield bb();yield ki(Io.setUsersGroupsLoader({key:t,value:!0})),n&&(yield ki(Io.setGroupsState({groupsConfiguration:U({},n,e)}))),yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}function*Kb(){yield ba(Io.loadGroups,Mb),yield ba(Io.createGroup,Nb),yield ba(Io.updateGroup,Fb),yield ba(Io.deleteGroup,Gb),yield ba(Io.addRolesToGroup,$b),yield ba(Io.deleteRolesFromGroup,xb),yield ba(Io.addUsersToGroup,Vb),yield ba(Io.deleteUsersFromGroup,jb),yield ba(Io.getGroupConfiguration,Wb),yield ba(Io.updateGroupConfiguration,Bb)}const zb=(e,t=[])=>Object.entries(e).reduce(((e,[n,o])=>"object"==typeof o?[...e,...zb(o,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:o}]),[]),qb=["callback"];function*Hb(){yield ki(Io.setCustomLoginState({loading:!0}));try{const e=yield Ii(Vc);yield ki(Io.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield ki(Io.setCustomLoginState({loading:!1,error:_f(e)}))}}function*Jb(e){let{payload:{callback:t}}=e,n=Go(e.payload,qb);try{yield ki(Io.setCustomLoginState({error:null,saving:!0}));const e=zb(n);if(0===e.length)throw new Error("No changes to update");yield Ii(jc,{actions:e});const o=yield Ii(Vc);yield ki(Io.setCustomLoginState({tenantMetadata:o,saving:!1})),null==t||t(!0)}catch(e){yield ki(Io.setCustomLoginState({error:_f(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Qb(){yield ka(Io.loadTenantMetadata,Hb),yield ka(Io.updateTenantMetadata,Jb)}let Yb;!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.SET_SELECTED_SUB_ACCOUNT_DATA="SET_SELECTED_SUB_ACCOUNT_DATA",e.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER="UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER",e.CREATE_SUB_ACCOUNT="CREATE_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT="UPDATE_SUB_ACCOUNT",e.DELETE_SUB_ACCOUNT="DELETE_SUB_ACCOUNT",e.GET_ACCOUNT_USERS="GET_ACCOUNT_USERS",e.ADD_USERS_TO_ACCOUNT="ADD_USERS_TO_ACCOUNT",e.DELETE_USERS_FROM_ACCOUNT="DELETE_USERS_FROM_ACCOUNT",e.SET_USER_ROLES_FOR_SUB_ACCOUNT="SET_USER_ROLES_FOR_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT_SETTINGS="UPDATE_SUB_ACCOUNT_SETTINGS",e.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(Yb||(Yb={}));const Xb=(e,t,n)=>{var o,i;return e.tenantId===t?U({},e,{name:n}):U({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>Xb(e,t,n))))?o:[]})};function Zb(e,t){var n;return U({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Zb(e,t))):[]})}function ek(e,t,n){var o,i;if(e.tenantId===t){var a;const t=[...null!=(a=null==e?void 0:e.children)?a:[],...n].filter(((e,t,n)=>t===n.findIndex((t=>t.tenantId===e.tenantId))));return U({},e,{children:t})}return U({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>ek(e,t,n))))?o:[]})}const tk=({items:e},t)=>e.map((e=>{var n,o;return{name:e.name,tenantId:e.tenantId,numberOfUsers:null!=(n=null==(o=t.find((t=>t.tenantId===e.tenantId)))?void 0:o.totalUsers)?n:0,createdAt:e.createdAt,metadata:e.metadata}})),nk=()=>Oi((e=>e.auth.allAccountsState));function*ok({payload:e}){const t=Yb.GET_TEAM_USERS;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));try{const{items:n}=yield Ii(Dy.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield ki(Io.setAllAccountsState({teamUsers:n}))}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)}))}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*ik({payload:e}){const t=Yb.GET_ACCOUNTS;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield nk(),{jwt:o,_limit:i,_offset:a}=e,r={_offset:null!=a?a:n._offset,_limit:null!=i?i:n._limit,_subTenantId:null==e?void 0:e._subTenantId};try{if(o){var l;const{selectedAccount:t}=yield nk(),{items:n,_links:i}=yield Ii(Dy.tenants.searchSubTenants,r,{jwt:o}),a=yield Ii(Dy.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:o}),s=tk({items:n},a),c=ek(t.accounts?t.accounts:t,null!=(l=null==e?void 0:e._subTenantId)?l:"",s.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==i?void 0:i.next}))));yield ki(Io.setSelectedAccountState({accounts:c}))}else{var s;const{accounts:t}=yield nk(),{items:n,_links:o}=yield Ii(Dy.tenants.searchSubTenants,r),i=yield Ii(Dy.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=tk({items:n},i),l=ek(t,null!=(s=null==e?void 0:e._subTenantId)?s:"",a.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==o?void 0:o.next}))));yield ki(Io.setAllAccountsState({accounts:l}))}}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)}))}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*ak({payload:e}){const t=Yb.SEARCH_ACCOUNTS;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{topAccount:n}=yield nk(),{jwt:o}=e;try{if(null!=e&&e._subTenantId){var i;const{items:t}=yield Ii(Dy.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(i=null==e?void 0:e._filter)?i:"",_subTenantId:e._subTenantId},{jwt:o});yield ki(Io.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)}))}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*rk({payload:e}){const t=Yb.GET_USER_JWT;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:o}=e;try{const e=yield Ii(Dy.users.GetUserJwt,{tenantId:n});yield ki(Io.setSelectedAccountState({userJwt:e})),null==o||o(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==o||o(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*lk({payload:e}){const t=Yb.CREATE_SUB_ACCOUNT;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:o,tenantId:i,jwt:a,callback:r}=e;try{if(a){const{selectedAccount:e}=yield nk(),t=yield Ii(Dy.subTenants.createSubTenant,{name:n,parentTenantId:o,tenantId:i},{jwt:a}),r=ek(U({name:"",tenantId:""},null==e?void 0:e.accounts),null!=o?o:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield ki(Io.setSelectedAccountState({accounts:r}))}else{const{accounts:e}=yield nk(),t=yield Ii(Dy.subTenants.createSubTenant,{name:n,tenantId:i,parentTenantId:o}),a=ek(e,null!=o?o:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield ki(Io.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==r||r(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*sk({payload:e}){const t=Yb.DELETE_SUB_ACCOUNT;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:o,callback:i}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield nk();yield Ii(Dy.subTenants.deleteSubTenant,o,{jwt:n});const i=Zb(t,o),a=Zb(null==e?void 0:e.accounts,o);yield ki(Io.setAllAccountsState({accounts:i})),yield ki(Io.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield nk();yield Ii(Dy.subTenants.deleteSubTenant,o);const t=Zb(e,o);yield ki(Io.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==i||i(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*ck({payload:e}){const t=Yb.UPDATE_SUB_ACCOUNT_SETTINGS;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:o,callback:i,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield nk();yield Ii(Dy.subTenants.updateSubTenant,{tenantId:a},{name:o},{jwt:n});const i=Xb(e.accounts,a,o);yield ki(Io.setSelectedAccountState({name:o,accounts:i}));const r=Xb(t,a,o);yield ki(Io.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield nk();yield Ii(Dy.subTenants.updateSubTenant,{tenantId:a},{name:o});const t=Xb(e,a,o);yield ki(Io.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==i||i(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*uk({payload:e}){const t=Yb.DELETE_USERS_FROM_ACCOUNT;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:o,jwt:i,callback:a}=e;try{yield Ii(Dy.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:o},{jwt:i}),yield ki(Io.getAccountUsers({jwt:i,_tenantId:o[0].tenantId})),null==a||a(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==a||a(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*dk({payload:e}){const t=Yb.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:o,jwt:i,callback:a}=e,{selectedAccount:r}=yield nk();try{yield Ii(Dy.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:o},{jwt:i}),yield ki(Io.getAccountUsers({jwt:i,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==a||a(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*yk({payload:e}){const t=Yb.ADD_USERS_TO_ACCOUNT;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:o,jwt:i,callback:a,allowSubAccountAccess:r=!1,roleIds:l}=e;try{yield Ii(Dy.subTenants.addUsersToSubTenant,{users:n,tenantId:o,allowSubAccountAccess:r,roleIds:l},{jwt:i}),yield ki(Io.getAccountUsers({jwt:i,_tenantId:o})),null==a||a(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==a||a(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*fk({payload:e}){const t=Yb.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield nk(),{userId:o,allowAccess:i,jwt:a,callback:r}=e;try{var l;yield Ii(Dy.subTenants.updateSubAccountAccess,o,{allowAccess:i},{jwt:a}),yield ki(Io.setSelectedAccountState({users:null==n||null==(l=n.users)?void 0:l.map((e=>e.id===o?U({},e,{subAccountAccessAllowed:i}):e))})),null==r||r(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==r||r(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*pk({payload:e}){var t,n,o,i,a,r,l,s;const c=Yb.GET_ACCOUNT_USERS;yield ki(Io.setAllAccountsLoader({key:c,value:!0}));const u=yield nk(),{jwt:d,_tenantId:y,_email:f}=e,p=null!=(t=null!=(n=null==e?void 0:e._offset)?n:null==u||null==(o=u.selectedAccount)||null==(i=o.usersQueryParams)?void 0:i._offset)?t:0,g=null!=(a=null!=(r=null==e?void 0:e._limit)?r:null==u||null==(l=u.selectedAccount)||null==(s=l.usersQueryParams)?void 0:s._limit)?a:10,S=U({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield Ii(Dy.users.getUsersV3,S,{jwt:d}),o={totalUsersItems:t,totalUsersPages:n,usersQueryParams:U({_offset:null!=p?p:0,_limit:null!=g?g:10},!!f&&{_email:f})};if(e.length){const t=e.map((e=>e.id)),n=yield Ii(Dy.roles.getRoles),i=yield Ii(Dy.users.getUsersRoles,{ids:t},{jwt:d}),a=e.map((e=>{var t,o;const a=null==i||null==(t=i.find((t=>t.userId===e.id)))?void 0:t.roleIds;return U({},e,{roles:null!=(o=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?o:[]})}));yield ki(Io.setSelectedAccountState(U({users:a},o)))}else yield ki(Io.setSelectedAccountState(U({users:[]},o)))}catch(e){yield ki(Io.setAllAccountsError({key:c,value:_f(e)}))}finally{yield ki(Io.setAllAccountsLoader({key:c,value:!1}))}}function*gk({payload:e}){const t=Yb.SET_SELECTED_SUB_ACCOUNT_DATA;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var o,i,a,r,l,s,c;const e=yield Ii(Dy.accountSettings.getSettings,{jwt:n}),u=yield Ii(Dy.tenants.getTenantsUsersCount,{tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n}),d=yield Ii(Dy.tenants.getParentTenants,{jwt:n}),y=yield Ii(Dy.tenants.getHierarchyMetadata,{_tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n});yield ki(Io.setSelectedAccountState({tenantId:null!=(a=e.tenantId)?a:"",name:e.name,numberOfUsersObject:u[0],parentsAccounts:d,numberOfSubAccounts:null==(r=y[0])?void 0:r.totalSubTenants,accountSettings:e,accounts:{name:e.name,tenantId:null!=(l=e.tenantId)?l:"",numberOfUsers:null==(s=u[0])?void 0:s.totalUsers,createdAt:void 0,children:[]}})),yield ki(Io.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)}))}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*Sk(){yield ba(Io.loadAccounts,ik),yield ba(Io.searchAccounts,ak),yield ba(Io.updateSubAccountAccessForUser,fk),yield ba(Io.getUserJwtForSubAccount,rk),yield ba(Io.createSubAccount,lk),yield ba(Io.deleteSubAccount,sk),yield ba(Io.updateSubAccountSettings,ck),yield ba(Io.addUsersToAccount,yk),yield ba(Io.deleteUsersFromAccount,uk),yield ba(Io.setUserRolesForSubAccount,dk),yield ba(Io.getTeamUsers,ok),yield ba(Io.getAccountUsers,pk),yield ba(Io.setSelectedSubAccountData,gk)}var vk={sagas:function*(){yield Ti([Ii(Hg),Ii(Bv),Ii(zv),Ii(Mv),Ii(cA),Ii(uS),Ii(GS),Ii(BS),Ii(Qb),Ii(bv),Ii(Hh),Ii(Rb),Ii(pm),Ii(Gf),Ii(Tm),Ii(yp),Ii(Dm),Ii(xm),Ii(eA),Ii(gA),Ii(PA),Ii(JA),Ii(fb),Ii(Sb),Ii(mb),Ii(Sk),Ii(wp)])},mockSagas:function*(){yield Ti([Ii(Yg),Ii(vS),Ii(HS),Ii(Uv),Ii(lm),Ii(wm),Ii(Ip),Ii(mA),Ii(Mm),Ii(jm),Ii(LA),Ii(ab),Ii(nA),Ii(Kb)])},storeName:wt,initialState:ho,reducer:To,actions:Io};const hk=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),mk={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Ak={setAuditLogsState:hk("auditLogsState"),resetAuditLogsState:e=>U({},e,{auditLogsState:mk})},bk={exportAuditsCsv:st("auditLogs/exportAuditsCsv"),loadAuditLogs:st("auditLogs/loadAuditLogs",(e=>({payload:e})))},kk={loading:!0},Tk={setAuditsMetadataState:hk("auditsMetadataState"),resetAuditsMetadataState:e=>U({},e,{auditsMetadataState:kk})},Pk={loadAuditsMetadata:st("auditLogs/loadAuditsMetadata")},Ik={auditLogsState:mk,auditsMetadataState:kk},{reducer:Ek,actions:Lk}=ut({name:Ct,initialState:Ik,reducers:U({resetState:e=>U({},e,Ik),setState:(e,{payload:t})=>U({},e,t)},Ak,Tk)}),Ok=U({},Lk,bk,Pk),wk=e=>"createdAt"!==e.id,Uk={total:20,data:Array.from(Array(5).keys()).map((e=>U({ip:"198.143.51.1",user:"Demo User Name",email:"demo-user@frontegg.com"},(()=>{switch(Math.floor(6*Math.random())){case 0:return{action:"Updated profile",description:"User updated profile details",severity:"Info"};case 1:return{action:"User logged in",severity:"Info",description:"User logged in to the product"};case 2:return{action:"User failed to login",severity:"High",description:"User failed to login with password"};case 3:return{action:"Added user",severity:"Info",description:"Added user david+535@frontegg.com to tenant"};case 4:return{action:"Assigned roles",severity:"Info",description:"Assigned 0 roles for user"};case 5:return{action:"Removed user david+108@frontegg.com from account",severity:"Info",description:"Removed access from the account for user david+108@frontegg.com"}}})(),{json:{key1:"value1",key2:"value2",key3:"value3",key4:"value4"},tenantId:"my-tenant-id",vendorId:"my-vendor-id",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",createdAt:`2022-04-07 10:${50-e}:40.201`})))},Ck={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}]},Dk=()=>Oi((e=>e.auditLogs.auditLogsState)),_k=()=>Oi((e=>e.auditLogs.auditsMetadataState));function*Rk(){const e=yield Dk(),{columns:t}=yield _k();try{const n=e.filter,o=e.sort.reduce(((e,t)=>U({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),i=n.reduce(((e,t)=>U({},e,{[t.id]:t.value})),{});yield ki(Ok.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Dy.audits.exportAudits(U({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},o,i))}catch(e){console.error("failed to export audits - ",e)}yield ki(Ok.setAuditLogsState({isDownloadingCsv:!1}))}function*Mk({payload:e}){yield ki(Ok.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Dk(),{columns:n}=yield _k();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 ki(Ok.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>U({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>U({},e,{[t.id]:t.value})),{});n||(yield ki(Ok.loadAuditsMetadata()));const{data:p,total:g}=yield Ii(Dy.audits.getAudits,U({offset:c,count:s},y,f));yield ki(Ok.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 ki(Ok.setAuditLogsState({loading:!1,error:_f(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Nk(){yield Aa(Ok.exportAuditsCsv,Rk),yield Aa(Ok.loadAuditLogs,Mk)}function*Fk({payload:e}){yield ki(Ok.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Dk(),{columns:n}=yield _k();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 ki(Ok.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield ki(Ok.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=Uk;let o=n.filter((e=>t=>e.filter(wk).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 ki(Ok.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 ki(Ok.setAuditLogsState({loading:!1,error:_f(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Gk(){yield Aa(Ok.loadAuditLogs,Fk)}function*$k(){yield ki(Ok.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Ii(Dy.metadata.getAuditsMetadata);yield ki(Ok.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ki(Ok.setAuditsMetadataState({error:e,loading:!1}))}}function*xk(){yield Aa(Ok.loadAuditsMetadata,$k)}function*Vk(){yield ki(Ok.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Ck;yield ki(Ok.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ki(Ok.setAuditsMetadataState({error:e,loading:!1}))}}function*jk(){yield Aa(Ok.loadAuditsMetadata,Vk)}var Wk={sagas:function*(){yield Ti([Ii(Nk),Ii(xk)])},mockSagas:function*(){yield Ti([Ii(Gk),Ii(jk)])},storeName:Ct,initialState:Ik,reducer:Ek,actions:Ok};const Bk={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:Kk,actions:zk,reducer:qk}=ut({name:"audits",initialState:Bk,reducers:{setContext:(e,{payload:t})=>{e.context=t},startLoading:e=>{e.isLoading=!0},setVirtualScroll:(e,{payload:t})=>{e.virtualScroll=t},startRefresh:e=>{e.isLoading=!0},startFetching:e=>{e.isFetchMore=!0},finishLoading:e=>{e.isLoading=!1},startDownloadingCsv:e=>{e.isDownloadingCsv=!0},stopDownloadingCsv:e=>{e.isDownloadingCsv=!1},loadStatsSuccess:(e,{payload:t})=>{e.error=void 0,e.totalToday=t.totalToday,e.severeThisWeek=t.severeThisWeek},loadItemFailedAction:(e,{payload:t})=>{e.error=U({},e.error,{[t.name]:t.error})},loadMetadataSuccess:(e,{payload:t})=>{e.error={},e.headerProps=t.properties,e.themeAudits=t.theme?t.theme.styles:{}},loadAuditsSuccess:(e,{payload:t})=>{e.error={},e.rowsData=t.rowsData,e.lastUpdated=new Date,e.total=t.total},fetchMoreSuccess:(e,{payload:t})=>{e.error={},e.offset=t.offset,e.currentPage=t.currentPage,e.isFetchMore=!1},setFilterData:(e,{payload:t})=>{e.filters=t,e.currentPage=0,e.offset=0,e.isLoading=!0},textSearch:(e,{payload:t})=>{e.filter=t,e.currentPage=0,e.offset=0,e.isLoading=!0},onPageChange:(e,{payload:t})=>{e.currentPage=t-1,e.offset=20*e.currentPage,e.isLoading=!0},setDataSorting:(e,{payload:t})=>{e.sortBy=t.sortBy,e.currentPage=0,e.sortDirection="asc"===t.sortDirection?"desc":"asc",e.offset=0,e.isLoading=!0},setPredefinedFilters:(e,{payload:t})=>{e.predefinedFilters=t,e.filters=Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),Hk=U({},zk,{initData:st(`${Kk}/initData`),loadAudits:st(`${Kk}/loadAudits`),removeFilter:st(`${Kk}/removeFilter`),filterData:st(`${Kk}/filterData`),exportCSV:st(`${Kk}/exportCSV`),deleteAudits:st(`${Kk}/deleteAudits`)}),Jk=()=>Oi((e=>e[Kk]));function*Qk(){const{sortBy:e,sortDirection:t}=yield Jk();try{const n=yield Ii(Dy.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield ki(Hk.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield ki(Hk.loadItemFailedAction(t))}}function*Yk(){try{const e=yield Ii(Dy.metadata.getAuditsMetadata);yield ki(Hk.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield ki(Hk.loadItemFailedAction(t))}}const Xk=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Zk({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield Jk(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield Jk():{rowsData:[]};try{const e=Xk(t),{data:l,total:d}=yield Ii(Dy.audits.getAudits,U({},r&&{paginationMode:"virtual"},{sortDirection:o,sortBy:n,filter:i},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield ki(Hk.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield ki(Hk.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield ki(Hk.loadItemFailedAction(t))}}function*eT(){yield ki(Hk.startLoading()),yield Ti([Qk(),Yk(),Zk({payload:{onlyOneLoad:!1},type:""})]),yield ki(Hk.finishLoading())}function*tT({payload:e}){const{filters:t}=yield Jk(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield ki(Hk.setFilterData(o))}function*nT({payload:e}){const{filters:t}=yield Jk();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 ki(Hk.setFilterData(o))}function*oT(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield Jk(),a=Xk(e);yield ki(Hk.startDownloadingCsv());try{yield Dy.audits.exportAudits(U({endpoint:"csv/v2",headerProps:i,sortDirection:n,sortBy:t,filter:o},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield ki(Hk.stopDownloadingCsv())}}function*iT(){yield ba(Hk.initData,eT),yield ba(Hk.removeFilter,tT),yield ba(Hk.filterData,nT),yield ba([Hk.loadAudits,Hk.textSearch,Hk.onPageChange],Zk),yield ba([Hk.setFilterData,Hk.setDataSorting,Hk.startRefresh],(()=>Zk({payload:{appendMode:!1},type:""}))),yield ba(Hk.exportCSV,oT)}const aT={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},rT={initData:()=>U({},aT),setConnectivityState:(e,{payload:t})=>U({},e,t),cleanWebhookTestData:e=>U({},e,{testResult:void 0}),cleanWebhookLogsData:e=>U({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return U({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>U({},e,{error:void 0}),cleanSlackData:e=>U({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>U({},e,{retryResult:U({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>U({},e,{retryResult:U({},e.retryResult,t)})}},lT={loadSlackActions:st("connectivity/loadSlackActions"),loadDataAction:st("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:st("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:st("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:st("connectivity/loadScope"),deleteWebhookConfigAction:st("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:st("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:st("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},sT={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:cT,actions:uT}=ut({name:Ut,initialState:sT,reducers:U({},rT)}),dT=U({},uT,lT),yT={slack:Dy.connectivity.getSlackConfiguration,email:Dy.connectivity.getEmailConfiguration,sms:Dy.connectivity.getSMSConfiguration,webhook:Dy.connectivity.getWebhooksConfigurations,categories:Dy.connectivity.getCategories,channelMap:Dy.connectivity.getChannelMaps},fT={slack:Dy.connectivity.postSlackConfiguration,email:Dy.connectivity.postEmailConfiguration,sms:Dy.connectivity.postSMSConfiguration,webhook:Dy.connectivity.postWebhooksConfiguration},pT=["email","slack","sms","webhook"],gT={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"}},ST=["id"],vT=["id","enabled"],hT=["categories","channelMap"];function*mT(e){return yield Ii(bT,{payload:{api:e},type:""})}function*AT({payload:e=pT}){yield ki(dT.setConnectivityState({isLoading:!0}));try{const t=yield Ti([...e.map(mT),yield bT({payload:{api:"categories"},type:""}),yield function*(){return(yield Ti(e.map((function*(e){return yield bT({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>U({},t,{[`${e[o]}`]:n})),{})}()]),n=yield bT({payload:{api:"webhook"},type:""}),o=t.reduce(((n,o,i)=>e[i]?t[t.length-1][e[i]].length?U({},n,{[`${e[i]}`]:o,list:[...n.list,{id:i,key:e[i],events:gT[e[i]].events(o),active:gT[e[i]].isActive(o),platform:gT[e[i]].title,image:gT[e[i]].image}]}):n:U({},n,{[`${hT[i-e.length]}`]:o})),{list:[],webhook:n});yield ki(dT.setConnectivityState(U({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield ki(dT.setConnectivityState({isLoading:!1}))}}function*bT({payload:{api:e,params:t}}){try{return yield Ii(yT[e],t)}catch(e){return}}function*kT(){try{yield ki(dT.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Ii(Dy.connectivity.getSlackChannels);yield ki(dT.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield ki(dT.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*TT(e,t){const{connectivity:{list:n}}=yield Oi(),o=n.find((({key:t})=>t===e));if(!o)return;const i=gT[e].isActive(t);i!==o.active&&(yield ki(dT.setConnectivityState({list:n.map((t=>t.key===e?U({},t,{active:i}):t))})))}function*PT({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield Oi((e=>e.connectivity));try{if(yield ki(dT.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...o]:o})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Oi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:o}=e;yield Ti([...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=Go(e,ST);return n===t.id&&JSON.stringify(U({id:n},o))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length?[...e,t]:e}),[]).map((function*(e){return yield Ii(fT.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Ii(Dy.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Oi(),{processIds:o}=yield Oi((e=>e.connectivity)),i=n[t];if(!i)return;let a=[];try{a=yield Ti([...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 Ii("email"===t?Dy.connectivity.postEmailConfiguration:Dy.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=Go(i,vT);return yield Ti([yield Ii("email"===t?Dy.connectivity.patchEmailConfiguration:Dy.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield Ii("email"===t?Dy.connectivity.putEmailSubscriptions:Dy.connectivity.putSMSSubscriptions,a,o,U({},l,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return Ii("email"===t?Dy.connectivity.deleteEmailSubscriptions:Dy.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield bT({payload:{api:t},type:""});yield ki(dT.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield TT(t,e)}else yield ki(dT.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield Ii(fT[e],t),!["sms","email"].includes(e)){const i=yield bT({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield ki(dT.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield TT(e,i),null==n||n(!0)}}catch(e){yield ki(dT.setConnectivityState({error:_f(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*IT({payload:e}){try{yield Dy.connectivity.postSlackCode(e)}catch{}yield ki(dT.setConnectivityState({error:void 0,isSaving:!1}))}function*ET(){const{slackChannels:e}=yield Oi((e=>e.connectivity));try{yield ki(dT.setConnectivityState({slackChannels:U({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Ii(Dy.connectivity.getSlackScope);yield ki(dT.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield ki(dT.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*LT({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield Oi((e=>e.connectivity));try{yield ki(dT.setConnectivityState({isSaving:!0})),yield Ii(Dy.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,_f(e))}const i=yield bT({payload:{api:"webhook"},type:""});i&&(yield ki(dT.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*OT({payload:e}){try{yield ki(dT.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Ii(Dy.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield ki(dT.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield ki(dT.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield ki(dT.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*wT({payload:e}){try{const{statusCode:t}=yield Ii(Dy.connectivity.postWebhookRetry,e);yield ki(dT.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield ki(dT.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*UT({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield Oi((e=>e.connectivity));try{yield ki(dT.setConnectivityState({webhookLogs:U({},o,{isLoading:!0})}));const i=yield Ii(Dy.connectivity.getWebhookLog,e,n,t);yield ki(dT.setConnectivityState({error:void 0,webhookLogs:U({isLoading:!1},i)}))}catch(e){yield ki(dT.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var CT={sagas:function*(){yield Aa(dT.loadDataAction,AT),yield ba(dT.loadSlackActions,kT),yield Aa(dT.postDataAction,PT),yield Aa(dT.postCodeAction,IT),yield Aa(dT.loadScope,ET),yield Aa(dT.deleteWebhookConfigAction,LT),yield Aa(dT.postWebhookTestAction,OT),yield Aa(dT.postWebhookRetryAction,wT),yield ba(dT.loadWebhookLogsAction,UT)},storeName:Ut,initialState:sT,reducer:cT,actions:dT};function DT(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}}function _T(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>U({},n,{[e]:t(n[e],o)})}}function RT(e){return _T(e,((e,t)=>U({},e,{loading:t.payload})))}function MT(e){return _T(e,((e,t)=>U({},e,{error:t.payload,loading:!1})))}const NT={loading:!1,error:null,fetching:!0,plans:[]},{actions:FT,reducer:GT,name:$T}=ut({name:"subscriptions/plans",initialState:NT,reducers:U({},DT())}),xT=U({loadPlans:st(`${$T}/loadPlans`)},FT),VT={loading:!1,error:null,fetching:!0,config:null},jT=U({},DT()),{actions:WT,reducer:BT,name:KT}=ut({name:"subscriptions/config",initialState:VT,reducers:jT}),zT=U({loadPaymentConfiguration:st(`${KT}/loadPaymentConfiguration`)},WT),qT={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},HT=U({},DT(),{setCancellationLoading:RT("cancellation"),setCancellationError:MT("cancellation"),setRenewalLoading:RT("renewal"),setRenewalError:MT("renewal")}),{reducer:JT,actions:QT,name:YT}=ut({name:"subscriptions/billing/subscription",initialState:qT,reducers:HT}),XT=U({load:st(`${YT}/loadSubscription`),cancelSubscription:st(`${YT}/cancelSubscription`),renewSubscription:st(`${YT}/renewSubscription`)},QT),ZT={loading:!1,error:null,fetching:!0},eP=U({},DT()),{reducer:tP,actions:nP,name:oP}=ut({name:"subscriptions/billing/information",initialState:ZT,reducers:eP}),iP=U({loadBillingInformation:st(`${oP}/loadBillingInformation`),cancelSubscription:XT.cancelSubscription,renewSubscription:XT.renewSubscription},nP),aP={loading:!1,error:null,fetching:!0},rP=U({},DT(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}),{reducer:lP,actions:sP,name:cP}=ut({name:"subscriptions/billing/payment",initialState:aP,reducers:rP}),uP=U({loadPaymentMethod:st(`${cP}/loadPaymentMethod`),submitPaymentMethod:st(`${cP}/submitPaymentMethod`),submitPaymentMethodError:st(`${cP}/submitPaymentMethodError`),submitPaymentMethodSuccess:st(`${cP}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:st(`${cP}/updateBillingDetails`,(e=>({payload:e})))},sP),dP={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},yP=U({},DT(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{invoiceDownload:U({},e.invoiceDownload,t.payload)})}}),{reducer:fP,actions:pP,name:gP}=ut({name:"subscriptions/billing/invoices",initialState:dP,reducers:yP}),SP=U({loadInvoices:st(`${gP}/loadInvoices`),downloadInvoice:st(`${gP}/downloadInvoice`,(e=>({payload:e})))},pP),vP={information:ZT,invoices:dP,paymentMethod:aP,subscription:qT},hP={invoices:SP,information:iP,paymentMethod:uP,subscription:XT},mP=je({invoices:fP,information:tP,paymentMethod:lP,subscription:JT}),AP={fetching:!0,loading:!1,error:null,confirmed:!1},bP=U({},DT()),{actions:kP,reducer:TP,name:PP}=ut({name:"subscriptions/checkout",initialState:AP,reducers:bP}),IP=U({loadCheckout:st(`${PP}/loadCheckout`),resetCheckout:st(`${PP}/resetCheckout`),submitCheckout:st(`${PP}/submitCheckout`),confirmCheckout:st(`${PP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:st(`${PP}/errorCheckout`,(e=>({payload:e})))},kP),EP={loading:!1,error:null,cardSetupIntentSecret:null},LP=U({},DT()),{reducer:OP,actions:wP,name:UP}=ut({name:"subscriptions/stripe",initialState:EP,reducers:LP}),CP=U({loadCustomer:st(`${UP}/loadCustomer`),createCardSetupIntentSecret:st(`${UP}/createCardSetupIntentSecret`)},wP),DP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:_P,reducer:RP,name:MP}=ut({name:"subscriptions/vendorPublicConfig",initialState:DP,reducers:U({},DT())}),NP=U({loadVendorPublicConfiguration:st(`${MP}/loadVendorPublicConfiguration`)},_P),FP={config:VT,plans:NT,checkout:AP,billing:vP,stripe:EP,vendorPublicConfig:DP},GP={config:zT,billing:hP,plans:xT,checkout:IP,stripe:CP,vendorPublicConfig:NP},$P=je({config:BT,billing:mP,plans:GT,checkout:TP,stripe:OP,vendorPublicConfig:RP});let xP,VP,jP;function WP({policy:e}){return{policy:jP.AT_PERIOD_END}}function BP(e){switch(e){case Od.ACTIVE:return VP.ACTIVE;case Od.INCOMPLETE:return VP.INCOMPLETE;case Od.CANCELED:return VP.CANCELED;case Od.EXPIRED:return VP.EXPIRED;case Od.TRIALING:return VP.TRIALING;default:return VP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(xP||(xP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(VP||(VP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(jP||(jP={}));const KP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Od.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},zP=[{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"}],qP=[{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:""}],HP=[{id:"id",externalId:"externalId",type:wd.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],JP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*QP(){yield Aa(XT.load,YP),yield Aa(XT.cancelSubscription,ZP),yield Aa(XT.renewSubscription,eI)}function*YP(){const e=yield Oi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield aI(e)}function*XP(){yield ki(XT.setLoading(!0));try{const[e]=yield Ii(Dy.subscriptions.getManagedSubscriptions);yield ki(XT.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield ki(XT.setError(e))}}function*ZP(){const{subscription:e}=yield Oi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ki(XT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ki(XT.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===Od.ACTIVE)try{yield ki(XT.setCancellationLoading(!0)),yield Ii(Dy.subscriptions.cancelManagedSubscription,t),yield XP(),yield ki(XT.setCancellationLoading(!1))}catch(e){yield ki(XT.setCancellationError(_f(e)))}}function*eI(){const{subscription:e}=yield Oi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ki(XT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ki(XT.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Ud.AT_PERIOD_END)try{yield ki(XT.setRenewalLoading(!0)),yield Ii(Dy.subscriptions.renewManagedSubscription,t),yield XP(),yield ki(XT.setRenewalLoading(!1))}catch(e){yield ki(XT.setCancellationError(_f(e)))}}function*tI(){yield ki(XT.setLoading(!0)),yield wi(500),yield ki(XT.setState({subscription:KP,fetching:!1,loading:!1,error:null}))}function*nI(){yield Aa(XT.load,tI)}function*oI(){yield Aa(iP.loadBillingInformation,iI)}function*iI(){yield function*(e){const t=yield Oi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Oi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield aI(n,!1):yield ki(iP.setError(t?"Not authorized":"Internal feature failure"))}()}function*aI(e,t){yield ki(iP.setLoading(!0));try{var n,o;const i=yield Ii(Dy.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield Ii(Dy.subscriptions.getSubscriptionPlan,a):([,l]=yield Ti([Ii(XP),Ii(Dy.subscriptions.getSubscriptionPlan,a)]),s=yield Oi((e=>e.subscriptions.billing.subscription.subscription||null))),yield ki(iP.setState(U({loading:!1,fetching:!1,summary:i},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?VP.ACTIVE:BP(s.status),cancellation:s.cancellation&&WP(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 ki(iP.setError(_f(e)))}}function*rI(){yield function*(){var e,t;yield ki(iP.setLoading(!0)),yield wi(500),yield ki(iP.setState({loading:!1,fetching:!1,summary:{subscriptionId:KP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Cd.Stripe,externallyManaged:!1,currentPlanId:zP[0].id,defaultPlanId:zP[0].id},plan:U({},zP[0],{price:null==(e=zP[0].price)?void 0:e.amount,currency:null==(t=zP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*lI(){yield Aa(iP.loadBillingInformation,rI)}function*sI(){yield Aa(uP.loadPaymentMethod,cI),yield Aa(uP.submitPaymentMethod,dI),yield Aa(uP.submitPaymentMethodError,yI),yield Aa(uP.submitPaymentMethodSuccess,fI),yield Aa(uP.updatePaymentMethodBillingDetails,uI)}function*cI(){yield ki(uP.setLoading(!0));try{const e=(yield Ii(Dy.subscriptions.getPaymentMethods))[0];yield ki(uP.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield ki(uP.setError(_f(e)))}}function*uI({payload:e}){yield ki(uP.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield Ii(Dy.subscriptions.updatePaymentMethodBillingDetails,t,U({email:n},o)),yield Ii(cI),null==i||i(!0)}catch(e){yield ki(uP.setError(_f(e))),null==i||i(!1)}yield ki(uP.setLoading(!1))}function*dI(){yield ki(uP.setLoading(!0))}function*yI({payload:e}){yield ki(uP.setError(e))}function*fI(){yield ki(uP.loadPaymentMethod())}function*pI(){yield ki(uP.setLoading(!0)),yield wi(500);const e=HP[0];yield ki(uP.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*gI(){yield Aa(uP.loadPaymentMethod,pI)}function*SI(){yield Aa(SP.loadInvoices,vI),yield Aa(SP.downloadInvoice,hI)}function*vI(){yield ki(SP.setLoading(!0));try{const e=(yield Ii(Dy.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 ki(SP.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield ki(SP.setError(_f(e)))}}function*hI({payload:e}){yield ki(SP.setInvoiceDownloadState({loading:!0,error:null}));try{yield Ii(Dy.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield ki(SP.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield ki(SP.setInvoiceDownloadState({loading:!1,error:_f(e,null)}))}}function*mI(){yield ki(SP.setLoading(!0)),yield wi(500),yield ki(SP.setState({loading:!1,fetching:!1,invoices:qP.map((e=>U({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield ki(SP.setLoading(!1))}function*AI(){yield Aa(SP.loadInvoices,mI)}function*bI(){yield Ti([Ii(oI),Ii(sI),Ii(SI),Ii(QP)])}function*kI(){yield Ti([Ii(lI),Ii(gI),Ii(AI),Ii(nI)])}function*TI(){yield Aa(IP.loadCheckout,PI),yield Aa(IP.resetCheckout,II),yield Aa(IP.submitCheckout,EI),yield Aa(IP.confirmCheckout,LI),yield Aa(IP.errorCheckout,wI)}function*PI(){yield ki(IP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*II(){yield ki(IP.setState({loading:!1,error:null,confirmed:!1}))}function*EI(){yield ki(IP.setState({loading:!0,error:null}))}function*LI({payload:{paymentMethodId:e,planId:t}}){const n=yield Oi((e=>e.subscriptions.billing.subscription.subscription)),o=yield Oi((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===Od.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield ki(IP.setState({loading:!0,error:null})),i&&a)return yield OI(),void(yield ki(XT.setState({subscription:U({},n,{status:Od.ACTIVE})})));try{yield Ii(Dy.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Ti([iI(),cI(),vI()]),yield OI()}catch(e){yield ki(IP.setState({loading:!1,error:_f(e)}))}}else yield ki(IP.setState({loading:!1,error:"Subscription not found"}))}function*OI(){yield ki(IP.setState({loading:!1,error:null,confirmed:!0}))}function*wI({payload:e}){yield ki(IP.setState({loading:!1,error:e}))}function*UI(){yield Aa(IP.resetCheckout,II)}function*CI(){yield Aa(xT.loadPlans,DI)}function*DI(){yield ki(xT.setLoading(!0));try{const e=(yield Ii(Dy.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 ki(xT.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield ki(xT.setError(_f(e)))}}function*_I(){yield ki(xT.setLoading(!0)),yield wi(500),yield ki(xT.setState({fetching:!1,loading:!1,plans:zP.map((e=>{var t,n;return U({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*RI(){yield Aa(xT.loadPlans,_I)}function*MI(){yield Aa(zT.loadPaymentConfiguration,NI)}function*NI(){yield ki(zT.setLoading(!0));try{(yield Ii(Dy.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Cd.Stripe))?yield function*(){yield ki(zT.setLoading(!0));try{const e=yield Ii(Dy.subscriptions.getStripePaymentProviderConfiguration);yield ki(zT.setState({loading:!1,fetching:!1,config:{paymentProvider:xP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield ki(zT.setError(_f(e)))}}():yield ki(zT.setError("Payment provider not configured"))}catch(e){yield ki(zT.setError(_f(e)))}}function*FI(){yield ki(zT.setLoading(!0)),yield wi(500),yield ki(zT.setState({loading:!1,fetching:!1,config:{paymentProvider:xP.STRIPE,apiKey:""}}))}function*GI(){yield Aa(zT.loadPaymentConfiguration,FI)}function*$I(){yield Aa(CP.createCardSetupIntentSecret,xI)}function*xI({payload:e}){yield ki(CP.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Ii(Dy.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield ki(CP.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield ki(CP.setError(_f(e)))}}function*VI(){yield Aa(NP.loadVendorPublicConfiguration,jI)}function*jI(){yield ki(NP.setLoading(!0));try{const e=yield Ii(Dy.subscriptions.getVendorPublicConfigurations);yield ki(NP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield ki(NP.setError(_f(e)))}}function*WI(){yield ki(NP.setLoading(!0)),yield wi(500),yield ki(NP.setState({fetching:!1,loading:!1,vendorPublicConfig:JP}))}function*BI(){yield Aa(NP.loadVendorPublicConfiguration,WI)}var KI={sagas:function*(){yield Ti([Ii(bI),Ii(TI),Ii(CI),Ii(MI),Ii($I),Ii(VI)])},mockSagas:function*(){yield Ti([Ii(kI),Ii(UI),Ii(RI),Ii(GI),Ii(BI)])},reducer:$P,actions:GP,initialState:FP,storeName:"subscriptions"},zI={sagas:function*(){yield Aa(Bf.loadVendorPublicInfo,Kf)},storeName:Dt,initialState:Vf,reducer:jf,actions:Bf};const{reducer:qI}=ut({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Ta.setContext(t),U({},e,{context:t}))}}}),HI=(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||Ta.setContext(e.context);const t=da(),h=[...rt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=lt({middleware:h,preloadedState:{root:U({},e,{previewMode:n,urlStrategy:r}),[vk.storeName]:U({},vk.initialState,o,null!=(s=null==i?void 0:i.auth)?s:{},{routes:U({},vk.initialState.routes,null!=(c=null==o?void 0:o.routes)?c:{},null!=(u=null==i||null==(d=i.auth)?void 0:d.routes)?u:{})}),[Wk.storeName]:U({},Wk.initialState,null!=(y=null==i?void 0:i.auditLogs)?y:{},{auditLogsState:U({},Wk.initialState.auditLogsState,null!=(f=null==i||null==(p=i.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:U({},Wk.initialState.auditsMetadataState,null!=(g=null==i||null==(S=i.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[Kk]:U({},Bk,null!=(v=null==i?void 0:i.audits)?v:{}),[CT.storeName]:CT.initialState,[KI.storeName]:KI.initialState,[zI.storeName]:zI.initialState},reducer:je({root:qI,[vk.storeName]:vk.reducer,[Wk.storeName]:Wk.reducer,[Kk]:qk,[CT.storeName]:CT.reducer,[KI.storeName]:KI.reducer,[zI.storeName]:zI.reducer})});const m=function*(){yield Ti([Ii(vk.sagas),Ii(Wk.sagas),Ii(iT),Ii(CT.sagas),Ii(KI.sagas),Ii(zI.sagas)])},A=function*(){yield Ti([Ii(vk.mockSagas),Ii(Wk.mockSagas),Ii(KI.mockSagas)])};n?(l.store.destroy=t.run(A).cancel,l.store.dispatch(Io.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var JI=n(714),QI=n.n(JI);function YI(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function XI(e){if(e.type)return e;if("#"===e.charAt(0))return XI(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 ZI(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 eE(e){if(0===e.indexOf("#"))return e;const{values:t}=XI(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 tE(e,t){return e=XI(e),t=YI(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,ZI(e)}function nE(e,t){if(e=XI(e),t=YI(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 ZI(e)}function oE(e,t){if(e=XI(e),t=YI(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 ZI(e)}const iE=e=>{if(e)return{main:e,light:eE(oE(e,.4)),dark:eE(nE(e,.15)),hover:eE(nE(e,.15)),active:eE(nE(e,.2))}},aE=e=>{if(e)return{main:e,light:oE(e,.7),dark:nE(e,.2)}},rE=(e,t)=>{var n,o,i,a,r,l,s,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?U({},t,{palette:{primary:U({},iE(null==e||null==(o=e.palette)?void 0:o.primary),{contrastText:null!=(i=null==e||null==(a=e.palette)?void 0:a.primaryText)?i:"#000000"}),secondary:U({},iE(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(l=null==e||null==(s=e.palette)?void 0:s.secondaryText)?l:"#000000"}),danger:U({},iE(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:U({},aE(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:U({},aE(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:U({},aE(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:U({},aE(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},lE={},sE={},cE={},uE={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},provisioning:{visibility:"hidden",permissions:["fe.secure.read.provisioningConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]},allAccounts:{visibility:"hidden"}};class dE{constructor(){this._theme=lE,this._themeV2=sE,this._navigation=uE,this._localizations=cE}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new dE;return n.set(e),dE._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=QI().all([null!=(t=uE)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=QI().all([null!=(o=lE)?o:{},rE(null==e?void 0:e.theme,lE)]),this._themeV2=QI().all([null!=(i=sE)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=QI().all([null!=(r=cE)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=uE,this._theme=lE,this._themeV2=sE,this._localizations=cE}}}dE._instances={};var yE=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},fE=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},pE=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)}))},gE=function(e){var t=e.toString();if(t){var n=new URL(window.location.href);n.search=t,window.history.pushState(null,"",n.toString())}};let SE,vE,hE,mE,AE,bE,kE,TE,PE,IE,EE;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(SE||(SE={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(vE||(vE={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(hE||(hE={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(mE||(mE={})),function(e){e.Invoices="invoices"}(AE||(AE={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(bE||(bE={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(kE||(kE={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(TE||(TE={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(PE||(PE={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(IE||(IE={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(EE||(EE={}));const LE={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},OE={hidden:"hidden",edit:"edit"};var wE="6.109.0",UE={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on","show-passkeys-new":"on","groups-admin-box-new":"on","msp-all-accounts-new":"on"},CE=function(){function e(t,n){var o,i=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];P(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(wE),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=ur,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:dE.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}qd.set(UE,i.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Hd();case 7:t=e.sent,i.options.overrideFeatureFlags&&Object.assign(t,i.options.overrideFeatureFlags),qd.set(t,i.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.updateLocalizationsSetter=function(e){i.updateLocalizations=e};var l=yE(n),s="frontegg-app-".concat(l);this.iframeRendering=a,this.name=l,this.options=U({},t,{contextOptions:U({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=s;var c,u,d=this.options.authOptions?U({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(o=this.options.authOptions)?void 0:o.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=HI({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);w.setInstance(l,this)}var t,n,o,i;return O(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,this.loadFeatureFlags();case 9:return e.next=11,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize()]);case 11:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 13:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;dE.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:k,FronteggTypes:T})):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 Ta.setRequestSource(ao.AdminPortal),e.next=3,this.loadScript("FronteggAdminPortal");case 3:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e,t=new URLSearchParams(window.location.search);null==(e=this.adminPortalRenderer)||e.unmount(),gE(t),Ta.setRequestSource(null)}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,U({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"getEntitlements",value:function(e){var t;return((e={},t)=>t.reduce(((t,n)=>[...t,{isEntitled:e[n]||!1}]),[]))(null==(t=this.store.getState().auth.entitlementsState)?void 0:t.entitlements,e)}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),DE=function(){function e(){P(this,e)}return O(e,null,[{key:"setAuthentication",value:function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",i=w.getInstance(o);e&&t?(Ta.setAccessToken(t),Ta.setUser(U({},n,{accessToken:t})),i.store.dispatch(Io.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(Io.loadTenants())):(Ta.setAccessToken(null),Ta.setUser(null),i.store.dispatch(Io.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),_E=function(){function e(){P(this,e)}return O(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideAdminPortal()}}]),e}(),RE=function(){function e(){P(this,e)}return O(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";w.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideCheckoutDialog()}}]),e}(),ME=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},NE=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=HI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=U({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},i),this.app=new CE(this.options,t,!0),dE.set({},t)}var t;return O(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,pE(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}(),FE="modern",GE=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[FE]},$E=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=HI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=U({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},i),this.app=new CE(this.options,t,!0,a),dE.set({},t)}var t;return O(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,pE(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 xE(e,t){return xE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xE(e,t)}function VE(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&&xE(e,t)}function jE(e,t){if(t&&("object"===I(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function WE(e){return WE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},WE(e)}function BE(){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 KE(e,t,n){return KE=BE()?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&&xE(i,n.prototype),i},KE.apply(null,arguments)}function zE(e){var t="function"==typeof Map?new Map:void 0;return zE=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 KE(e,arguments,WE(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),xE(n,e)},zE(e)}function qE(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=WE(e);if(t){var i=WE(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return jE(this,n)}}var HE=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new CE(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){VE(n,e);var t=qE(n);function n(){var e;P(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).app=null,e}return O(n,[{key:"connectedCallback",value:function(){this.updateContent()}},{key:"attributeChangedCallback",value:function(e,t,n){if("app-name"===e){if(null===t)return;if(t===n)return;this.innerHTML="",null===n?this.remove():this.updateContent()}console.debug("attributeChangedCallback",e,t,n)}},{key:"updateContent",value:function(){var e,t=null!=(e=this.getAttribute("app-name"))?e:"default",n=w.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var o=fE(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=fE(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=fE(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=fE(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=fE(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=fE(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}(zE(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,A=m&&m(m(w([])));A&&A!==n&&a.call(A,s)&&(h=A);var b=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 E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,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:U}}function U(){return{value:void 0,done:!0}}return S.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},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(b),d(b,u,"Generator"),d(b,s,(function(){return this})),d(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=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(L),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,o){return r.type="throw",r.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],r=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var r=i?i.completion:{};return r.type=e,r.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator: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 _E},AdminPortalRenderer:function(){return NE},AppHolder:function(){return w},CheckoutDialog:function(){return RE},FronteggApp:function(){return CE},HostedLogin:function(){return DE},LoginBoxRenderer:function(){return $E},createElement:function(){return fE},defaultTheme:function(){return FE},formatName:function(){return yE},getThemeAdminByName:function(){return ME},getThemeByName:function(){return GE},initialize:function(){return HE},mockFlagsList:function(){return UE},restoreSearchParams:function(){return gE},waitThemeSetter:function(){return pE}});var e={};n.r(e),n.d(e,{Delete:function(){return pr},Get:function(){return ur},Patch:function(){return yr},Post:function(){return dr},PostDownload:function(){return gr},Put:function(){return fr},extractHeadersFromOptions:function(){return Sr},getBaseUrl:function(){return lr},getMetadataHeaders:function(){return sr}});var t={};n.r(t),n.d(t,{getHierarchyMetadata:function(){return Ir},getParentTenants:function(){return br},getParentTenantsById:function(){return kr},getSubTenants:function(){return mr},getSubTenantsAsTree:function(){return Ar},getTenants:function(){return hr},getTenantsUsersCount:function(){return Tr},searchSubTenants:function(){return Pr},switchTenant:function(){return vr}});var i={};n.r(i),n.d(i,{AuthStrategyEnum:function(){return Xr},MachineToMachineAuthStrategy:function(){return Zr},OAuthLogout:function(){return Tl},SocialLoginProviders:function(){return Yr},acceptInvitation:function(){return ml},activateAccount:function(){return gl},bulkCreateIPRestriction:function(){return zr},changePhoneNumber:function(){return yc},changePhoneNumberWithVerification:function(){return uc},checkIfAllowToRememberMfaDevice:function(){return $s},createDomainRestriction:function(){return xr},createIPRestriction:function(){return Kr},createOrUpdateSessionConfigrations:function(){return Ts},createSSOConfiguration:function(){return Bs},createSSOConfigurationByMetadata:function(){return qs},createSSODomain:function(){return Js},createSSOGroup:function(){return ec},createSamlGroup:function(){return ss},createTenantAccessToken:function(){return Cs},createUserAccessToken:function(){return Us},deleteAllSessionsForUser:function(){return Is},deleteDomainRestriction:function(){return jr},deleteIPRestriction:function(){return Hr},deleteSSOConfiguration:function(){return zs},deleteSSODomain:function(){return Qs},deleteSSOGroup:function(){return nc},deleteSamlGroup:function(){return us},deleteSessionForUser:function(){return Ps},deleteTenantAccessToken:function(){return Os},deleteTenantApiToken:function(){return Ns},deleteUserAccessToken:function(){return ws},deleteUserApiToken:function(){return Fs},deleteWebAuthnDevice:function(){return vc},disableMFAAuthenticatorApp:function(){return Fl},disableMFASMS:function(){return $l},disableMFAWebAuthn:function(){return Vl},disableMfa:function(){return Nl},enrollMFAAuthenticatorApp:function(){return Ul},enrollMFAAuthenticatorAppForLogin:function(){return Bl},enrollMFASMS:function(){return Dl},enrollMFASMSForLogin:function(){return ql},enrollMFAWebAuthn:function(){return Rl},enrollMFAWebAuthnForLogin:function(){return Yl},enrollMfa:function(){return Ol},exchangeOAuthTokens:function(){return rc},forgotPassword:function(){return Pl},generateLoginResponse:function(){return rl},generateLoginResponseFromOAuthResponse:function(){return sl},generateLoginResponseV2:function(){return ll},getActivateAccountStrategy:function(){return Sl},getCaptchaPolicy:function(){return _r},getCurrentUserSession:function(){return As},getCurrentUserSessions:function(){return ms},getCustomSocialLoginProvidersV1:function(){return gs},getDomainRestrictions:function(){return Gr},getDomainRestrictionsConfig:function(){return $r},getGlobalSecurityPolicy:function(){return Er},getIPRestrictions:function(){return Wr},getIPRestrictionsConfig:function(){return Br},getLockoutPolicy:function(){return Ur},getMFADevices:function(){return jl},getMFAStrategiesConfig:function(){return Ac},getMfaPolicy:function(){return Lr},getOidcConfiguration:function(){return ds},getPasswordConfigPolicy:function(){return Fr},getPasswordHistoryPolicy:function(){return Rr},getSSOConfigurations:function(){return Ws},getSSODefaultRoles:function(){return Xs},getSSOGroups:function(){return oc},getSSOPublicConfiguration:function(){return ys},getSamlConfiguration:function(){return es},getSamlRoles:function(){return as},getSamlRolesGroups:function(){return rs},getSamlVendorConfiguration:function(){return ns},getSessionConfigurations:function(){return ks},getSocialLoginProviders:function(){return fs},getSocialLoginProvidersV2:function(){return ps},getTenantAccessTokensData:function(){return Ls},getTenantApiTokensData:function(){return _s},getUserAccessTokensData:function(){return Es},getUserApiTokensData:function(){return Ds},getUserById:function(){return Gs},getVendorConfig:function(){return vs},getVendorLockoutPolicy:function(){return Cr},getVendorMfaPolicy:function(){return Or},getVendorPasswordHistoryPolicy:function(){return Mr},getVendorPublicAuthStrategiesConfig:function(){return mc},getWebAuthnDevices:function(){return Sc},loadPasswordConfig:function(){return El},login:function(){return fl},loginViaSocialLogin:function(){return Ss},loginWithMfa:function(){return pl},logout:function(){return kl},oidcPostLogin:function(){return yl},oidcPostLoginV2:function(){return ac},passwordlessPostLogin:function(){return Vs},passwordlessPreLogin:function(){return xs},postLogin:function(){return dl},preDisableMFASMS:function(){return Gl},preDisableMFAWebAuthn:function(){return xl},preEnrollMFAAuthenticatorApp:function(){return wl},preEnrollMFAAuthenticatorAppForLogin:function(){return Wl},preEnrollMFASMS:function(){return Cl},preEnrollMFASMSForLogin:function(){return zl},preEnrollMFAWebAuthn:function(){return _l},preEnrollMFAWebAuthnForLogin:function(){return Ql},preLogin:function(){return cl},preLoginV2:function(){return ic},preLoginWithIdpType:function(){return ul},preVerifyMFASMSForLogin:function(){return Hl},preVerifyMFAWebAuthnForLogin:function(){return Xl},recoverMfaToken:function(){return Ll},refreshToken:function(){return Al},refreshTokenV2:function(){return bl},resendActivationEmail:function(){return vl},resendInvitationEmail:function(){return hl},resetPassword:function(){return Il},resetPhoneNumber:function(){return sc},revokeSessionsForUser:function(){return bs},saveLockoutPolicy:function(){return Dr},saveMfaPolicy:function(){return wr},savePasswordHistoryPolicy:function(){return Nr},setSSODefaultRoles:function(){return Zs},signUpUser:function(){return hs},silentOAuthRefreshToken:function(){return lc},testCurrentIp:function(){return Jr},testCurrentIpInAllowList:function(){return Qr},updateDomainRestrictionConfig:function(){return Vr},updateIPRestrictionConfig:function(){return qr},updateSSOConfiguration:function(){return Ks},updateSSOConfigurationByMetadata:function(){return Hs},updateSSOGroup:function(){return tc},updateSamlConfiguration:function(){return ts},updateSamlGroup:function(){return cs},updateSamlRoles:function(){return ls},updateSamlVendorMetadata:function(){return os},updateTenantApiTokensData:function(){return Ms},updateUserApiTokensData:function(){return Rs},validateSSODomain:function(){return Ys},validateSamlDomain:function(){return is},verifyChangePhoneNumber:function(){return dc},verifyInviteToken:function(){return js},verifyMFAAuthenticatorAppForLogin:function(){return Kl},verifyMFASMSForLogin:function(){return Jl},verifyMFAWebAuthnForLogin:function(){return Zl},verifyMfa:function(){return Ml},verifyNewDeviceSession:function(){return hc},verifyResetPhoneNumber:function(){return cc},webAuthnCreateNewDeviceSession:function(){return gc},webAuthnPostLogin:function(){return pc},webAuthnPreLogin:function(){return fc}});var a={};n.r(a),n.d(a,{addUser:function(){return Ec},changePassword:function(){return Pc},createInviteUserLink:function(){return wc},deleteInviteUserLink:function(){return Cc},deleteUser:function(){return Lc},getInviteLinkConfiguration:function(){return _c},getInviteUserLink:function(){return Dc},getProfile:function(){return bc},loadAvailablePermissions:function(){return Mc},loadAvailableRoles:function(){return Rc},loadStats:function(){return Nc},loadUsers:function(){return Ic},resendActivationLink:function(){return Fc},resendInvitationLink:function(){return Gc},resendInvitationLinkToAllTenants:function(){return $c},updateInviteUserLink:function(){return Uc},updateProfile:function(){return kc},updateProfileImage:function(){return Tc},updateUser:function(){return Oc}});var r={};n.r(r),n.d(r,{getAdminBoxMetadata:function(){return Vc},getAuditsMetadata:function(){return zc},getCurrentUserIpMetadata:function(){return Wc},getIpAdressMetadata:function(){return qc},getNotificationsMetadata:function(){return Bc},getSamlMetadata:function(){return Kc},updateAdminBoxMetadata:function(){return jc}});var l={};n.r(l),n.d(l,{downloadReport:function(){return tu},getReport:function(){return Xc},getReports:function(){return Yc},renderReport:function(){return Zc},scheduleReport:function(){return eu},sendReport:function(){return nu}});var s={};n.r(s),n.d(s,{getNotifications:function(){return ou},markAllAsRead:function(){return ru},updateNotificationIsPinned:function(){return au},updateNotificationStatus:function(){return iu}});var c={};n.r(c),n.d(c,{exportAudits:function(){return uu},getAudits:function(){return su},getAuditsStats:function(){return cu}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return Pu},deleteEmailSubscriptions:function(){return ku},deleteSMSConfiguration:function(){return Uu},deleteSMSSubscriptions:function(){return Ou},deleteSlackConfiguration:function(){return vu},deleteWebhooksConfiguration:function(){return _u},getCategories:function(){return Fu},getChannelMaps:function(){return Gu},getEmailConfiguration:function(){return mu},getSMSConfiguration:function(){return Iu},getSlackChannels:function(){return gu},getSlackConfiguration:function(){return fu},getSlackScope:function(){return pu},getWebhookLog:function(){return Ru},getWebhooksConfigurations:function(){return Cu},patchEmailConfiguration:function(){return bu},patchSMSConfiguration:function(){return Lu},postEmailConfiguration:function(){return Au},postSMSConfiguration:function(){return Eu},postSlackCode:function(){return hu},postSlackConfiguration:function(){return Su},postWebhookRetry:function(){return Nu},postWebhookTest:function(){return Mu},postWebhooksConfiguration:function(){return Du},putEmailSubscriptions:function(){return Tu},putSMSSubscriptions:function(){return wu}});var d={};n.r(d),n.d(d,{getPublicSettings:function(){return Vu},getSettings:function(){return xu},updateSettings:function(){return $u}});var y={};n.r(y),n.d(y,{addRole:function(){return zu},attachPermissionToRoles:function(){return Yu},attachPermissionsToRole:function(){return Ju},deleteRole:function(){return qu},getPermissionCategories:function(){return Xu},getPermissions:function(){return Qu},getRoles:function(){return Ku},updateRole:function(){return Hu}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return Ud},ISubscriptionStatus:function(){return Od},PaymentMethodType:function(){return wd},ProviderType:function(){return Cd},TenantCreatedAction:function(){return _d},TrialEndAction:function(){return Dd},cancelManagedSubscription:function(){return rd},cancelSubscription:function(){return td},createStripeCustomer:function(){return Ad},createStripePaymentMethodSetupIntentSecret:function(){return kd},createSubscription:function(){return hd},createTenantConfiguration:function(){return Id},getManagedSubscription:function(){return id},getManagedSubscriptions:function(){return ad},getPaymentMethod:function(){return Sd},getPaymentMethods:function(){return gd},getPaymentProviders:function(){return Ed},getStripeCustomer:function(){return md},getStripePaymentProviderConfiguration:function(){return bd},getSubscription:function(){return ed},getSubscriptionInvoice:function(){return yd},getSubscriptionInvoicePdf:function(){return fd},getSubscriptionInvoices:function(){return dd},getSubscriptionPlan:function(){return ud},getSubscriptionPlans:function(){return cd},getSubscriptionSummaries:function(){return Td},getSubscriptions:function(){return Zu},getTenantConfiguration:function(){return Pd},getVendorPublicConfigurations:function(){return Ld},renewManagedSubscription:function(){return ld},renewSubscription:function(){return nd},updateManagedSubscription:function(){return sd},updatePaymentMethodBillingDetails:function(){return vd},updateSubscription:function(){return od}});var p={};n.r(p),n.d(p,{getVendorPublicInfo:function(){return Rd}});var g={};n.r(g),n.d(g,{addUserRolesForSubTenants:function(){return Gd},addUserToTenantAndSubTenants:function(){return Nd},addUsersToSubTenant:function(){return Kd},createSubTenant:function(){return Vd},deleteSubTenant:function(){return jd},loadAllUsers:function(){return Md},removeUserFromTenantAndSubTenants:function(){return Fd},removeUserRolesFromSubTenants:function(){return $d},setUserRolesForSubTenants:function(){return xd},updateSubAccountAccess:function(){return Bd},updateSubTenant:function(){return Wd}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return qd},loadFeatureFlags:function(){return Hd}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return Zd},createConfiguration:function(){return Yd},deleteConfiguration:function(){return Xd},getConfigs:function(){return Jd},updateConfiguration:function(){return Qd}});var h={};n.r(h),n.d(h,{impersonate:function(){return ey}});var m={};n.r(m),n.d(m,{addRolesToGroup:function(){return sy},addUsersToGroup:function(){return uy},createGroup:function(){return ay},deleteGroup:function(){return ly},deleteRolesFromGroup:function(){return cy},deleteUsersFromGroup:function(){return dy},getGroupById:function(){return ny},getGroupConfiguration:function(){return yy},getGroups:function(){return oy},getGroupsByIds:function(){return iy},updateGroup:function(){return ry},updateGroupConfiguration:function(){return fy}});var A={};n.r(A),n.d(A,{GetUserJwt:function(){return py},getUsersRoles:function(){return Sy},getUsersV3:function(){return gy}});var b={};n.r(b),n.d(b,{loadEntitlements:function(){return vy}});var k={};n.r(k),n.d(k,{AuthStrategyEnum:function(){return Xr},ContextHolder:function(){return Ta},FeatureFlags:function(){return qd},FronteggApiError:function(){return Ia},FronteggContext:function(){return Pa},FronteggFrameworks:function(){return ro},GroupManagedByEnum:function(){return Cy},GroupRelations:function(){return Uy},ISubscriptionCancellationPolicy:function(){return Ud},ISubscriptionStatus:function(){return Od},MFAStrategyEnum:function(){return Ay},MachineToMachineAuthStrategy:function(){return Zr},PaginationOrderEnum:function(){return lo},PaymentMethodType:function(){return wd},ProviderType:function(){return Cd},RequestSource:function(){return ao},RestrictionType:function(){return xn},ScimConnectionSource:function(){return wy},SecondaryAuthStrategy:function(){return hy},SocialLoginProviders:function(){return Yr},SortByEnum:function(){return so},TenantSortByEnum:function(){return ky},TenantType:function(){return Ty},UserManagedByEnum:function(){return by},WebAuthnDeviceType:function(){return my},api:function(){return Dy},countConfigurationUsers:function(){return Zd},createConfiguration:function(){return Yd},default:function(){return _y},deleteConfiguration:function(){return Xd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Py},fronteggHeaders:function(){return io},fronteggRefreshTokenUrl:function(){return Iy},fronteggSilentRefreshTokenUrl:function(){return Ey},fronteggTenantsUrl:function(){return Oy},fronteggUsersUrl:function(){return Ly},getConfigs:function(){return Jd},loadFeatureFlags:function(){return Hd},updateConfiguration:function(){return Qd}});var T={};function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function E(e){var t=function(e,t){if("object"!==I(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!==I(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===I(t)?t:String(t)}function L(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,E(o.key),o)}}function O(e,t,n){return t&&L(e.prototype,t),n&&L(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(T),n.d(T,{AccountDetailsPageTabs:function(){return EE},AccountPageFields:function(){return mE},DomainRestrictionsTabFields:function(){return IE},GeneralSettingsTabFields:function(){return TE},InviteUserModalFields:function(){return hE},IpRestrictionsTabFields:function(){return PE},Metadata:function(){return dE},PrivacyPageFields:function(){return vE},ProfilePageFields:function(){return SE},SecurityPageTabs:function(){return bE},SessionManagementTabFields:function(){return kE},SubscriptionsPageFields:function(){return AE},alpha:function(){return tE},fieldAppearance:function(){return LE},tabAppearance:function(){return OE}});var w=function(){function e(){P(this,e)}return O(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function U(){return U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},U.apply(this,arguments)}function C(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){C(a,o,i,r,l,"next",e)}function l(e){C(a,o,i,r,l,"throw",e)}r(void 0)}))}}w._apps={};var _=n(841),R=n.n(_);function M(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 N(e){return!!e&&!!e[ke]}function F(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Te}(e)||Array.isArray(e)||!!e[be]||!!e.constructor[be]||W(e)||B(e))}function G(e,t,n){void 0===n&&(n=!1),0===$(e)?(n?Object.keys:Pe)(e).forEach((function(o){n&&"symbol"==typeof o||t(o,e[o],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function $(e){var t=e[ke];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:W(e)?2:B(e)?3:0}function x(e,t){return 2===$(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function V(e,t,n){var o=$(e);2===o?e.set(t,n):3===o?(e.delete(t),e.add(n)):e[t]=n}function j(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function W(e){return ve&&e instanceof Map}function B(e){return he&&e instanceof Set}function K(e){return e.o||e.t}function z(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Ie(e);delete t[ke];for(var n=Pe(t),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 q(e,t){return void 0===t&&(t=!1),J(e)||N(e)||!F(e)||($(e)>1&&(e.set=e.add=e.clear=e.delete=H),Object.freeze(e),t&&G(e,(function(e,t){return q(t,!0)}),!0)),e}function H(){M(2)}function J(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Q(e){var t=Ee[e];return t||M(18,e),t}function Y(){return ge}function X(e,t){t&&(Q("Patches"),e.u=[],e.s=[],e.v=t)}function Z(e){ee(e),e.p.forEach(ne),e.p=null}function ee(e){e===ge&&(ge=e.l)}function te(e){return ge={p:[],l:ge,h:e,m:!0,_:0}}function ne(e){var t=e[ke];0===t.i||1===t.i?t.j():t.O=!0}function oe(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.g||Q("ES5").S(t,e,o),o?(n[ke].P&&(Z(t),M(4)),F(e)&&(e=ie(t,e),t.l||re(t,e)),t.u&&Q("Patches").M(n[ke].t,e,t.u,t.s)):e=ie(t,n,[]),Z(t),t.u&&t.v(t.u,t.s),e!==Ae?e:void 0}function ie(e,t,n){if(J(t))return t;var o=t[ke];if(!o)return G(t,(function(i,a){return ae(e,o,t,i,a,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return re(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var i=4===o.i||5===o.i?o.o=z(o.k):o.o;G(3===o.i?new Set(i):i,(function(t,a){return ae(e,o,i,t,a,n)})),re(e,i,!1),n&&e.u&&Q("Patches").R(o,n,e.u,e.s)}return o.o}function ae(e,t,n,o,i,a){if(N(i)){var r=ie(e,i,a&&t&&3!==t.i&&!x(t.D,o)?a.concat(o):void 0);if(V(n,o,r),!N(r))return;e.m=!1}if(F(i)&&!J(i)){if(!e.h.F&&e._<1)return;ie(e,i),t&&t.A.l||re(e,i)}}function re(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&q(t,n)}function le(e,t){var n=e[ke];return(n?K(n):e)[t]}function se(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 ce(e){e.P||(e.P=!0,e.l&&ce(e.l))}function ue(e){e.o||(e.o=z(e.t))}function de(e,t,n){var o=W(t)?Q("MapSet").N(t,n):B(t)?Q("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),o={i:n?1:0,A:t?t.A:Y(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=o,a=Le;n&&(i=[o],a=Oe);var r=Proxy.revocable(i,a),l=r.revoke,s=r.proxy;return o.k=s,o.j=l,s}(t,n):Q("ES5").J(t,n);return(n?n.A:Y()).p.push(o),o}function ye(e){return N(e)||M(22,e),function e(t){if(!F(t))return t;var n,o=t[ke],i=$(t);if(o){if(!o.P&&(o.i<4||!Q("ES5").K(o)))return o.t;o.I=!0,n=fe(t,i),o.I=!1}else n=fe(t,i);return G(n,(function(t,i){o&&function(e,t){return 2===$(e)?e.get(t):e[t]}(o.t,t)===i||V(n,t,e(i))})),3===i?new Set(n):n}(e)}function fe(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return z(e)}var pe,ge,Se="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ve="undefined"!=typeof Map,he="undefined"!=typeof Set,me="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Ae=Se?Symbol.for("immer-nothing"):((pe={})["immer-nothing"]=!0,pe),be=Se?Symbol.for("immer-draftable"):"__$immer_draftable",ke=Se?Symbol.for("immer-state"):"__$immer_state",Te=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Pe="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Ie=Object.getOwnPropertyDescriptors||function(e){var t={};return Pe(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ee={},Le={get:function(e,t){if(t===ke)return e;var n=K(e);if(!x(n,t))return function(e,t,n){var o,i=se(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||!F(o)?o:o===le(e.t,t)?(ue(e),e.o[t]=de(e.A.h,o,e)):o},has:function(e,t){return t in K(e)},ownKeys:function(e){return Reflect.ownKeys(K(e))},set:function(e,t,n){var o=se(K(e),t);if(null==o?void 0:o.set)return o.set.call(e.k,n),!0;if(!e.P){var i=le(K(e),t),a=null==i?void 0:i[ke];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(j(n,i)&&(void 0!==n||x(e.t,t)))return!0;ue(e),ce(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==le(e.t,t)||t in e.t?(e.D[t]=!1,ue(e),ce(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=K(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty:function(){M(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){M(12)}},Oe={};G(Le,(function(e,t){Oe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Oe.deleteProperty=function(e,t){return Oe.set.call(this,e,t,void 0)},Oe.set=function(e,t,n){return Le.set.call(this,e[0],t,n,e[0])};var we=function(){function e(e){var t=this;this.g=me,this.F=!0,this.produce=function(e,n,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&&M(6),void 0!==o&&"function"!=typeof o&&M(7),F(e)){var l=te(t),s=de(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?Z(l):ee(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return X(l,o),oe(e,l)}),(function(e){throw Z(l),e})):(X(l,o),oe(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===Ae&&(r=void 0),t.F&&q(r,!0),o){var u=[],d=[];Q("Patches").M(e,r,u,d),o(u,d)}return r}M(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){F(e)||M(8),N(e)&&(e=ye(e));var t=te(this),n=de(this,e,void 0);return n[ke].C=!0,ee(t),n},t.finishDraft=function(e,t){var n=(e&&e[ke]).A;return X(n,t),oe(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!me&&M(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));var i=Q("Patches").$;return N(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Ue=new we,Ce=Ue.produce,De=(Ue.produceWithPatches.bind(Ue),Ue.setAutoFreeze.bind(Ue),Ue.setUseProxies.bind(Ue),Ue.applyPatches.bind(Ue),Ue.createDraft.bind(Ue),Ue.finishDraft.bind(Ue),Ce);function _e(e,t,n){return(t=E(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 Me(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){_e(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 Ne(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Fe="function"==typeof Symbol&&Symbol.observable||"@@observable",Ge=function(){return Math.random().toString(36).substring(7).split("").join(".")},$e={INIT:"@@redux/INIT"+Ge(),REPLACE:"@@redux/REPLACE"+Ge(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ge()}};function xe(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Ve(e,t,n){var o;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ne(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ne(1));return n(Ve)(e,t)}if("function"!=typeof e)throw new Error(Ne(2));var i=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(Ne(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ne(4));if(s)throw new Error(Ne(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(Ne(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!xe(e))throw new Error(Ne(7));if(void 0===e.type)throw new Error(Ne(8));if(s)throw new Error(Ne(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(Ne(10));i=e,y({type:$e.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ne(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Fe]=function(){return this},e}return y({type:$e.INIT}),(o={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Fe]=p,o}function je(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:$e.INIT}))throw new Error(Ne(12));if(void 0===n(void 0,{type:$e.PROBE_UNKNOWN_ACTION()}))throw new Error(Ne(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var 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(Ne(14));i[s]=d,o=o||d!==u}return(o=o||r.length!==Object.keys(e).length)?i:e}}function We(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function Be(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),o=function(){throw new Error(Ne(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return o=We.apply(void 0,a)(n.dispatch),Me(Me({},n),{},{dispatch:o})}}}function Ke(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 ze=Ke();ze.withExtraArgument=Ke;var qe,He=ze,Je=(qe=function(e,t){return qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},qe(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}qe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Qe=function(e,t){for(var n=0,o=t.length,i=e.length;n<o;n++,i++)e[i]=t[n];return e},Ye=Object.defineProperty,Xe=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Ze=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable,tt=function(e,t,n){return t in e?Ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},nt=function(e,t){for(var n in t||(t={}))Ze.call(t,n)&&tt(e,n,t[n]);if(Xe)for(var o=0,i=Xe(t);o<i.length;o++)n=i[o],et.call(t,n)&&tt(e,n,t[n]);return e},ot="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?We:We.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var it=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 Je(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Qe([void 0],e[0].concat(this)))):new(t.bind.apply(t,Qe([void 0],e.concat(this))))},t}(Array);function at(e){return F(e)?De(e,(function(){})):e}function rt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,o=(e.immutableCheck,e.serializableCheck,new it);return n&&(function(e){return"boolean"==typeof e}(n)?o.push(He):o.push(He.withExtraArgument(n.extraArgument))),o}function lt(e){var t,n=function(e){return rt(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=je(a)}var p=l;"function"==typeof p&&(p=p(n));var g=Be.apply(void 0,p),S=We;c&&(S=ot(nt({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=Qe([g],f):"function"==typeof f&&(v=f(v)),Ve(t,d,S.apply(void 0,v))}function st(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 nt(nt({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 ct(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 ut(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:at(e.initialState),i=e.reducers||{},a=Object.keys(i),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?ct(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=nt(nt({},i),l);return function(e,t,n,o){void 0===n&&(n=[]);var i,a="function"==typeof t?ct(t):[t,n,o],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))i=function(){return at(e())};else{var c=at(e);i=function(){return c}}function u(e,t){void 0===e&&(e=i());var n=Qe([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(N(e))return void 0===(o=n(e,t))?e:o;if(F(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?st(c,o):st(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 dt="listenerMiddleware";st(dt+"/add"),st(dt+"/removeAll"),st(dt+"/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[ke];return Le.get(t,e)},set:function(t){var n=this[ke];Le.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][ke];if(!i.P)switch(i.i){case 5:o(i)&&ce(i);break;case 4:n(i)&&ce(i)}}}function n(e){for(var t=e.t,n=e.k,o=Pe(n),i=o.length-1;i>=0;i--){var a=o[i];if(a!==ke){var r=t[a];if(void 0===r&&!x(t,a))return!0;var l=n[a],s=l&&l[ke];if(s?s.t!==r:!j(l,r))return!0}}var c=!!t[ke];return o.length!==Pe(t).length+(c?0:1)}function o(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var o=0;o<t.length;o++)if(!t.hasOwnProperty(o))return!0;return!1}var i={};!function(e,t){Ee[e]||(Ee[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=Ie(n);delete a[ke];for(var r=Pe(a),l=0;l<r.length;l++){var s=r[l];a[s]=e(s,t||!!a[s].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(o,t),a={i:o?5:4,A:n?n.A:Y(),P:!1,I:!1,D:{},l:n,t:t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,ke,{value:a,writable:!0}),i},S:function(e,n,i){i?N(n)&&n[ke].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ke];if(n){var i=n.t,a=n.k,r=n.D,l=n.i;if(4===l)G(a,(function(t){t!==ke&&(void 0!==i[t]||x(i,t)?r[t]||e(a[t]):(r[t]=!0,ce(n)))})),G(i,(function(e){void 0!==a[e]||x(a,e)||(r[e]=!1,ce(n))}));else if(5===l){if(o(n)&&(ce(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 yt=(e,t)=>n=>U({},n,{[e]:t[e]}),ft=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),pt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:o})=>{var i;return U({},n,{[e]:U({},n[e],{[t]:U({},null==n||null==(i=n[e])?void 0:i[t],o)})})}}),gt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o,i;return U({},t,{[e]:U({},t[e],{loaders:U({},null==(o=t[e])?void 0:o.loaders,{[n.key]:null==(i=n.value)||i})})})}}),St=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o;return U({},t,{[e]:U({},t[e],{errors:U({},t[e].errors,{[n.key]:null==(o=n.value)||o})})})}}),vt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(o,{payload:i})=>{var a;return U({},o,{[e]:U({},o[e],{[t]:U({},null==o||null==(a=o[e])?void 0:a[t],i,n)})})}}),ht=(e,t,n)=>o=>{var i;return U({},o,{[e]:U({},o[e],{[t]:U({},null==o||null==(i=o[e])?void 0:i[t],n)})})},mt=(e=500)=>new Promise((t=>setTimeout(t,e))),At="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bt=new Uint8Array(256);for(let e=0;e<At.length;e++)bt[At.charCodeAt(e)]=e;const kt=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=bt[e.charCodeAt(o)],a=bt[e.charCodeAt(o+1)],r=bt[e.charCodeAt(o+2)],l=bt[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},Tt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(Tt(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let o,i="";for(o=0;o<n;o+=3)i+=At[t[o]>>2],i+=At[(3&t[o])<<4|t[o+1]>>4],i+=At[(15&t[o+1])<<2|t[o+2]>>6],i+=At[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]=Tt(e[n]);return t}return e};let Pt,It,Et;!function(e){e.preLogin="preLogin",e.magicLinkPreLoginSuccess="magicLinkPreLoginSuccess",e.loginWithSmsOtc="loginWithSmsOtc",e.loginWithQuickSmsOtc="loginWithQuickSmsOtc",e.loginWithOtc="loginWithOtc",e.loginWithPassword="loginWithPassword",e.loginWithTwoFactor="loginWithTwoFactor",e.redirectToSSO="redirectToSSO",e.loginWithSSOFailed="loginWithSSOFailed",e.success="success",e.forceTwoFactor="forceTwoFactor",e.recoverTwoFactor="recoverTwoFactor",e.promptPasskeys="promptPasskeys",e.breachedPassword="breachedPassword"}(Pt||(Pt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(It||(It={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Et||(Et={}));const Lt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Ot="HOSTED_LOGIN_VERIFIER_KEY",wt="auth",Ut="connectivity",Ct="auditLogs",Dt="vendor",_t={flow:It.Login,step:Pt.preLogin,loading:!1,email:"",tenants:[]},Rt={setLoginState:ft("loginState"),resetLoginState:yt("loginState",{loginState:_t})},Mt={requestAuthorize:st("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:st("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:st("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:st("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:st("auth/afterAuthNavigation"),preLogin:st("auth/preLogin",(e=>({payload:e}))),postLogin:st("auth/postLogin",(e=>({payload:e}))),login:st("auth/login",(e=>({payload:e}))),loginWithMfa:st("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:st("auth/recoverMfa",(e=>({payload:e}))),logout:st("auth/logout",(e=>({payload:e}))),silentLogout:st("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:st("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:st("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:st("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:st("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:st("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:st("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:st("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:st("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:st("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:st("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:st("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:st("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:st("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:st("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:st("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:st("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:st("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:st("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:st("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:st("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:st("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Nt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Nt||(Nt={}));const Ft={step:Nt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Gt={setActivateState:ft("activateState"),resetActivateState:yt("activateState",{activateState:Ft}),setActivateStrategyState:pt("activateState","activationStrategy")},$t={activateAccount:st("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:st("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:st("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:st("auth/resendActivationEmail",(e=>({payload:e})))};let xt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(xt||(xt={}));const Vt={step:xt.validate},jt={setAcceptInvitationState:ft("acceptInvitationState"),resetAcceptInvitationState:yt("acceptInvitationState",{acceptInvitationState:Vt})},Wt={acceptInvitation:st("auth/acceptInvitation",(e=>({payload:e})))};let Bt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Bt||(Bt={}));const Kt={step:Bt.forgotPassword,loading:!1,email:"",passwordConfig:null},zt={setForgotPasswordState:ft("forgotPasswordState"),resetForgotPasswordState:yt("forgotPasswordState",{forgotPasswordState:Kt})},qt={forgotPassword:st("auth/forgotPassword",(e=>({payload:e}))),resetPassword:st("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:st("auth/loadPasswordConfig",(e=>({payload:e})))};let Ht;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Ht||(Ht={}));const Jt={step:Ht.ResetPhoneNumber,loading:!1},Qt={setResetPhoneNumberState:ft("resetPhoneNumberState"),resetResetPhoneNumberState:yt("resetPhoneNumberState",{resetPhoneNumberState:Jt})},Yt={resetPhoneNumber:st("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:st("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:st("auth/changePhoneNumber",(e=>({payload:e})))},Xt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Zt={setSSOLoader:gt("ssoState"),setSSOError:St("ssoState"),setSSOState:ft("ssoState"),resetSSOState:yt("ssoState",{ssoState:Xt})},en={loadSSOConfigurationsV2:st("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:st("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:st("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:st("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:st("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:st("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:st("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:st("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:st("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:st("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:st("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:st("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:st("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:st("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:st("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:st("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:st("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:st("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:st("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:st("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:st("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:st("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:st("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:st("auth/oidcPostlogin",(e=>({payload:e})))},tn={loading:!1,error:null},nn={setProfileState:ft("profileState"),resetProfileState:yt("profileState",{profileState:tn})},on={loadProfile:st("auth/loadProfile"),saveProfile:st("auth/saveProfile",(e=>({payload:e}))),changePassword:st("auth/changePassword",(e=>({payload:e})))};let an;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(an||(an={}));const rn={step:an.verify,loading:!1,saving:!1},ln={setMfaState:ft("mfaState"),resetMfaState:yt("mfaState",{mfaState:rn})},sn={enrollMfa:st("auth/enrollMfa"),getMFADevices:st("auth/getMFADevices"),getMFAStrategies:st("auth/getMFAStrategies"),verifyMfa:st("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:st("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:st("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:st("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:st("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:st("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:st("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:st("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:st("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:st("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:st("auth/disableMfaWebAuthn",(e=>({payload:e})))},cn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},un={setTeamLoader:gt("teamState"),setTeamError:St("teamState"),setTeamState:ft("teamState"),resetTeamState:yt("teamState",{teamState:cn})},dn={loadUsers:st("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:st("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:st("auth/loadRoles",(e=>({payload:e}))),addUser:st("auth/addUser",(e=>({payload:e}))),addUsersBulk:st("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:st("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:st("auth/updateUser",(e=>({payload:e}))),deleteUser:st("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:st("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:st("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:st("auth/lockUser",(e=>({payload:e}))),resendActivationLink:st("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:st("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:st("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:st("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:st("auth/getInvitationLink"),createInvitationLink:st("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:st("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:st("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:st("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:st("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:st("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:st("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:st("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:st("auth/closeLockUserDialog",(e=>({payload:e})))},yn={firstLoad:!0,loading:!1,error:""},fn={setSocialLoginsState:ft("socialLoginState"),resetSocialLoginsState:yt("socialLoginState",{socialLoginState:yn})},pn={loadSocialLoginsConfiguration:st("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:st("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:st("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:st("auth/setSocialLoginError",(e=>({payload:e})))};let gn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(gn||(gn={}));const Sn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:gn.SignUp},vn={setSignUpState:ft("signUpState"),resetSignUpState:yt("signUpState",{signUpState:Sn})},hn={signUpUser:st("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:st("auth/resetSignUpStateSoft")},mn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},An={setApiTokensLoader:gt("apiTokensState"),setApiTokensError:St("apiTokensState"),setApiTokensState:ft("apiTokensState"),resetApiTokensState:yt("apiTokensState",{apiTokensState:mn})},bn={loadApiTokens:st("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:st("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:st("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:st("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:st("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:st("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:st("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:st("auth/deleteTenantApiToken",(e=>({payload:e})))},kn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},Tn={setSecurityPolicyState:ft("securityPolicyState"),setSecurityPolicyGlobalState:pt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:pt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:pt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:pt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:pt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:pt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:pt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:pt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:pt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:pt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:pt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:yt("securityPolicyState",{securityPolicyState:kn})},Pn={loadSecurityPolicy:st("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:st("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:st("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:st("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:st("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:st("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:st("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:st("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:st("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:st("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:st("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:st("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:st("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:st("auth/loadPublicAuthStrategiesPolicy")},In={loading:!1},En={setAccountSettingsState:ft("accountSettingsState"),resetAccountSettingsState:yt("accountSettingsState",{accountSettingsState:In})},Ln={loadAccountSettings:st("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:st("auth/saveAccountSettings",(e=>({payload:e})))},On={tenants:[],subTenants:[],loading:!0,tenantTree:null},wn={setTenantsState:ft("tenantsState"),resetTenantsState:yt("tenantsState",{tenantsState:On})},Un={switchTenant:st("auth/switchTenant",(e=>({payload:e}))),loadTenants:st("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:st("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:st("auth/loadSubTenantsTree",(e=>({payload:e})))},Cn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Dn={setRolesState:ft("rolesState"),resetRolesState:yt("rolesState",{rolesState:Cn})},_n={loadRolesAndPermissions:st("auth/loadRoles",(e=>({payload:e}))),addRole:st("auth/addRole",(e=>({payload:e}))),updateRole:st("auth/updateRole",(e=>({payload:e}))),deleteRole:st("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:st("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:st("auth/attachPermissionToRoles",(e=>({payload:e})))},Rn={loading:!1,sessions:[]},Mn={setSessionsState:ft("sessionsState"),resetSessionsState:yt("sessionsState",{sessionsState:Rn})},Nn={loadUserSessions:st("auth/loadUserSessions"),loadCurrentUserSession:st("auth/loadCurrentUserSession"),deleteUserSession:st("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:st("auth/deleteAllUserSessions"),revokeUserSessions:st("auth/revokeUserSessions",(e=>({payload:e})))},Fn={loading:!1,configurations:{}},Gn={setSessionsPolicyState:ft("sessionsPolicyState"),resetSessionsPolicyState:yt("sessionsPolicyState",{sessionsPolicyState:Fn})},$n={loadSessionsPolicy:st("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:st("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let xn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(xn||(xn={}));const Vn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:xn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},jn={setRestrictionsState:ft("restrictionsState"),setIpRestrictionsState:pt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:pt("restrictionsState","emailDomainRestrictions")},Wn={checkIfUserIpValid:st("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:st("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:st("auth/loadIpRestrictions"),saveIpRestriction:st("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:st("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:st("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:st("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:st("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:st("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:st("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Bn={loading:!1},Kn={setProvisioningState:ft("provisioningState"),resetProvisioningState:yt("provisioningState",{provisioningState:Bn})},zn={loadProvisionConnections:st("auth/loadProvisionConnections"),createProvisionConnection:st("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:st("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:st("auth/updateProvisionConnection",(e=>({payload:e})))},qn={devices:[],loading:!1,error:null},Hn={setPasskeysState:ft("passkeysState"),resetPasskeysState:yt("passkeysState",{passkeysState:qn})},Jn={loadWebAuthnDevices:st("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:st("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Qn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Yn={setUsersGroupsLoader:gt("groupsState"),setUsersGroupsError:St("groupsState"),setGroupsState:ft("groupsState"),resetUsersGroupsState:yt("groupsState",{groupsState:Qn})},Xn={loadGroups:st("auth/loadUsersGroups"),getGroupById:st("auth/getGroupById",(e=>({payload:e}))),createGroup:st("auth/createGroup",(e=>({payload:e}))),updateGroup:st("auth/updateGroup",(e=>({payload:e}))),deleteGroup:st("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:st("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:st("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:st("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:st("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:st("auth/getGroupConfiguration"),updateGroupConfiguration:st("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:st("auth/getUsers",(e=>({payload:e})))},Zn={addGroupDialogState:{loading:!1,open:!1},editGroupDialogState:{loading:!1,open:!1},deleteGroupDialogState:{loading:!1,open:!1},addMembersToGroupDialogState:{loading:!1,open:!1,userIds:[]},deleteMemberFromGroupDialogState:{loading:!1,open:!1}},eo={setGroupsDialogsState:ft("groupsDialogsState"),resetGroupsDialogsState:yt("groupsState",{groupsDialogsState:Zn}),openAddGroupDialog:ht("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:ht("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:vt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:ht("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:vt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:ht("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:ht("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:ht("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:vt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:ht("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},to={loading:!0,error:null},no={setCustomLoginState:ft("customLoginState"),resetCustomLoginState:yt("customLoginState",{customLoginState:to})},oo={loadTenantMetadata:st("auth/loadTenantMetadata"),updateTenantMetadata:st("auth/updateTenantMetadata",(e=>({payload:e})))},io={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let ao,ro,lo,so;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ao||(ao={})),function(e){e.Nextjs="nextjs",e.React="react",e.Angular="angular",e.Vuejs="vuejs",e.Flutter="flutter",e.Ios="ios",e.Android="android",e.Vanillajs="vanillajs"}(ro||(ro={})),function(e){e.ASC="ASC",e.DESC="DESC"}(lo||(lo={})),function(e){e.createdAt="createdAt",e.name="name",e.email="email",e.id="id",e.verified="verified",e.isLocked="isLocked",e.provider="provider",e.tenantId="tenantId"}(so||(so={}));const co={loaders:{},errors:{},accounts:{tenantId:"",children:[]},accountsQueryParams:{_limit:2,_offset:0,_filter:"",_subTenantId:""},searchAccountsData:[],topAccount:{tenantId:""},selectedAccount:{tenantId:"",userJwt:{accessToken:"",expiresIn:0,expires:""},users:[],usersQueryParams:{_offset:0,_limit:10,_order:lo.DESC,_sortBy:so.name},usersPageOffset:0,accountSettings:{}},teamUsers:[]},uo={setAllAccountsLoader:gt("allAccountsState"),setAllAccountsError:St("allAccountsState"),setAllAccountsState:ft("allAccountsState"),setSelectedAccountState:pt("allAccountsState","selectedAccount"),resetAllAccountsState:yt("allAccountsState",{allAccountsState:co})},yo={loadAccounts:st("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:st("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:st("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:st("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:st("auth/updateAccount",(e=>({payload:e}))),deleteSubAccount:st("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:st("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:st("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:st("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:st("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:st("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:st("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setSelectedSubAccountData:st("auth/setSelectedSubAccountData",(e=>({payload:e})))},fo={createSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:"",canSelectParentAccount:!1},updateSubAccountDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1,jwt:""},deleteSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:""},addUsersToAccountDialog:{loading:!1,open:!1,accountName:"",accountId:"",permissionToGiveAccessToSubAccounts:!1,jwt:""},deleteUserFromAccountDialog:{userId:"",userName:"",accountId:"",loading:!1,open:!1,jwt:""},editUserRolesDialog:{loading:!1,open:!1,jwt:""}},po={setAllAccountDialogsState:ft("allAccountsDialogsState"),resetAllAccountDialogsState:yt("allAccountsDialogsState",{allAccountsDialogsState:fo}),openCreateSubAccountDialog:vt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:ht("allAccountsDialogsState","createSubAccountDialog",fo.createSubAccountDialog),openUpdateSubAccountDialog:vt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:ht("allAccountsDialogsState","updateSubAccountDialog",fo.updateSubAccountDialog),openDeleteSubAccountDialog:vt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:ht("allAccountsDialogsState","deleteSubAccountDialog",fo.deleteSubAccountDialog),openAddUsersToAccountDialog:vt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:ht("allAccountsDialogsState","addUsersToAccountDialog",fo.addUsersToAccountDialog),openDeleteUserFromAccountDialog:vt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:ht("allAccountsDialogsState","deleteUserFromAccountDialog",fo.deleteUserFromAccountDialog),openEditUserRolesDialog:vt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:ht("allAccountsDialogsState","editUserRolesDialog",fo.editUserRolesDialog)},go={setEntitlementsState:ft("entitlementsState")},So={loadEntitlements:st("auth/loadEntitlements")},vo={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:Sn,loginState:_t,activateState:Ft,acceptInvitationState:Vt,forgotPasswordState:Kt,ssoState:Xt,profileState:tn,customLoginState:to,mfaState:rn,teamState:cn,groupsState:Qn,groupsDialogsState:Zn,socialLoginState:yn,apiTokensState:mn,securityPolicyState:kn,accountSettingsState:In,tenantsState:On,rolesState:Cn,resetPhoneNumberState:Jt,sessionsState:Rn,sessionsPolicyState:Fn,restrictionsState:Vn,provisioningState:Bn,passkeysState:qn,allAccountsState:co,allAccountsDialogsState:fo,entitlementsState:{entitlements:void 0,loading:!1,error:void 0}},ho=U({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},vo);let mo;!function(e){e.impersonating="impersonating",e.success="success"}(mo||(mo={}));const Ao={step:mo.impersonating,loading:!1},bo={setImpersonateState:ft("impersonateState"),resetImpersonateState:yt("impersonateState",{impersonateState:Ao})},ko={impersonate:st("impersonation/impersonate",(e=>({payload:e})))},{reducer:To,actions:Po}=ut({name:wt,initialState:ho,reducers:U({resetState:e=>U({},e,vo),setState:(e,{payload:t})=>U({},e,t),setUser:("user",(e,{payload:t})=>U({},e,{user:t}))},Rt,fn,Gt,bo,jt,zt,Qt,vn,nn,no,Zt,ln,un,Yn,eo,An,Tn,En,wn,Dn,Mn,Gn,jn,Kn,Hn,uo,po,go)});const Io=U({},Po,Mt,pn,$t,Wt,qt,Yt,hn,on,oo,en,sn,dn,Xn,{},bn,Pn,Ln,Un,_n,Nn,$n,Wn,zn,So,ko,Jn,yo);var Eo=function(e){return"@@redux-saga/"+e},Lo=Eo("CANCEL_PROMISE"),Oo=Eo("CHANNEL_END"),wo=Eo("IO"),Uo=Eo("MATCH"),Co=Eo("MULTICAST"),Do=Eo("SAGA_ACTION"),_o=Eo("SELF_CANCELLATION"),Ro=Eo("TASK"),Mo=Eo("TASK_CANCEL"),No=Eo("TERMINATE"),Fo=Eo("LOCATION");function Go(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 $o=function(e){return null==e},xo=function(e){return null!=e},Vo=function(e){return"function"==typeof e},jo=function(e){return"string"==typeof e},Wo=Array.isArray,Bo=function(e){return e&&Vo(e.then)},Ko=function(e){return e&&Vo(e.next)&&Vo(e.throw)},zo=function e(t){return t&&(jo(t)||Jo(t)||Vo(t)||Wo(t)&&t.every(e))},qo=function(e){return e&&Vo(e.take)&&Vo(e.close)},Ho=function(e){return Vo(e)&&e.hasOwnProperty("toString")},Jo=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Qo=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[Lo]=function(){clearTimeout(n)},o},Yo=function(e){return function(){return e}},Xo=Yo(!0),Zo=function(){},ei=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var ti=function(e,t){U(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function ni(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var oi=function(e){throw e},ii=function(e){return{value:e,done:!0}};function ai(e,t,n){void 0===t&&(t=oi),void 0===n&&(n="iterator");var o={meta:{name:n},next:e,throw:t,return:ii,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function ri(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var li=function(e){return Array.apply(null,new Array(e))},si=function(e){return function(t){return e(Object.defineProperty(t,Do,{value:!0}))}},ci=function(e){return e===No},ui=function(e){return e===Mo},di=function(e){return ci(e)||ui(e)};function yi(e,t){var n,o=Object.keys(e),i=o.length,a=0,r=Wo(e)?li(i):{},l={};return o.forEach((function(e){var o=function(o,l){n||(l||di(o)?(t.cancel(),t(o,l)):(r[e]=o,++a===i&&(n=!0,t(r))))};o.cancel=Zo,l[e]=o})),t.cancel=function(){n||(n=!0,o.forEach((function(e){return l[e].cancel()})))},l}function fi(e){return{name:e.name||"anonymous",location:pi(e)}}function pi(e){return e[Fo]}var gi=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)},Si="TAKE",vi="CALL",hi="FORK",mi="SELECT",Ai=function(e,t){var n;return(n={})[wo]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function bi(e,t){return void 0===e&&(e="*"),zo(e)?(xo(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Ai(Si,{pattern:e})):qo(n=e)&&n[Co]&&xo(t)&&zo(t)?Ai(Si,{channel:e,pattern:t}):qo(e)?(xo(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Ai(Si,{channel:e})):void 0;var n}function ki(e,t){return $o(t)&&(t=e,e=void 0),Ai("PUT",{channel:e,action:t})}function Ti(e){var t=Ai("ALL",e);return t.combinator=!0,t}function Pi(e,t){var n,o=null;return Vo(e)?n=e:(Wo(e)?(o=e[0],n=e[1]):(o=e.context,n=e.fn),o&&jo(n)&&Vo(o[n])&&(n=o[n])),{context:o,fn:n,args:t}}function Ii(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 Ai(vi,Pi(e,n))}function Ei(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 Ai(hi,Pi(e,n))}function Li(e){return void 0===e&&(e=_o),Ai("CANCEL",e)}function Oi(e){void 0===e&&(e=ei);for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return Ai(mi,{selector:e,args:n})}var wi=Ii.bind(null,Qo);var Ui=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Ci=[],Di=0;function _i(e){try{Ni(),e()}finally{Fi()}}function Ri(e){Ci.push(e),Di||(Ni(),Gi())}function Mi(e){try{return Ni(),e()}finally{Gi()}}function Ni(){Di++}function Fi(){Di--}function Gi(){var e;for(Fi();!Di&&void 0!==(e=Ci.shift());)_i(e)}var $i=function(e){return function(t){return e.some((function(e){return Bi(e)(t)}))}},xi=function(e){return function(t){return e(t)}},Vi=function(e){return function(t){return t.type===String(e)}},ji=function(e){return function(t){return t.type===e}},Wi=function(){return Xo};function Bi(e){var t="*"===e?Wi:jo(e)?Vi:Wo(e)?$i:Ho(e)?Vi:Vo(e)?xi:Jo(e)?ji:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Ki={type:Oo},zi=function(e){return e&&e.type===Oo};function qi(){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(Ki)}))},(e={})[Co]=!0,e.put=function(e){if(!t)if(zi(e))a();else for(var i=n=o,r=0,l=i.length;r<l;r++){var s=i[r];s[Uo](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=Wi),t?e(Ki):(e[Uo]=n,i(),o.push(e),e.cancel=(a=!1,function(){a||(a=!0,i(),ni(o,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[Do]?l(e):Ri((function(){l(e)}))},r}function Hi(e,t){var n=e[Lo];Vo(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Ji,Qi=0,Yi=function(){return++Qi};function Xi(e){e.isRunning()&&e.cancel()}var Zi=((Ji={}).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):!zi(e)||r?n(e):n(No)};try{i.take(l,xo(a)?Bi(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},Ji.PUT=function(e,t,n){var o=t.channel,i=t.action,a=t.resolve;Ri((function(){var t;try{t=(o?o.put:e.dispatch)(i)}catch(e){return void n(e,!0)}a&&Bo(t)?Hi(t,n):n(t)}))},Ji.ALL=function(e,t,n,o){var i=o.digestEffect,a=Qi,r=Object.keys(t);if(0!==r.length){var l=yi(t,n);r.forEach((function(e){i(t[e],a,l[e],e)}))}else n(Wo(t)?[]:{})},Ji.RACE=function(e,t,n,o){var i=o.digestEffect,a=Qi,r=Object.keys(t),l=Wo(t)?li(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,o){c||(o||di(t)?(n.cancel(),n(t,o)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=Zo,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)}))},Ji.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(Bo(s))return void Hi(s,n);if(Ko(s))return void ca(e,s,l.context,Qi,fi(a),!1,n);n(s)}catch(e){n(e,!0)}},Ji.CPS=function(e,t,n){var o=t.context,i=t.fn,a=t.args;try{var r=function(e,t){$o(e)?n(t):n(e,!0)};i.apply(o,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Ji.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(Ko(i))return i;var a=!1;return ai((function(e){return a?{value:e,done:!0}:(a=!0,{value:i,done:!Bo(i)})}))}catch(e){return ai((function(){throw e}))}}({context:i,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:fi(t)}(c,a);Mi((function(){var t=ca(e,c,s.context,Qi,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},Ji.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()&&ni(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Wo(t)){if(0===t.length)return void n([]);var r=yi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Ji.CANCEL=function(e,t,n,o){var i=o.task;t===_o?Xi(i):Wo(t)?t.forEach(Xi):Xi(t),n()},Ji.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)}},Ji.ACTION_CHANNEL=function(e,t,n){var o=t.pattern,i=function(e){void 0===e&&(e=gi());var t=!1,n=[];return{take:function(o){t&&e.isEmpty()?o(Ki):e.isEmpty()?(n.push(o),o.cancel=function(){ni(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(Ki):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])(Ki)}}}}(t.buffer),a=Bi(o),r=function t(n){zi(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)},Ji.CANCELLED=function(e,t,n,o){n(o.task.isCancelled())},Ji.FLUSH=function(e,t,n){t.flush(n)},Ji.GET_CONTEXT=function(e,t,n,o){n(o.task.context[t])},Ji.SET_CONTEXT=function(e,t,n,o){var i=o.task;ti(i.context,t),n()},Ji);function ea(e,t){return e+"?"+t}function ta(e){var t=e.name,n=e.location;return n?t+" "+ea(n.fileName,n.lineNumber):t}function na(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 oa=null,ia=[],aa=function(e){e.crashedEffect=oa,ia.push(e)},ra=function(){oa=null,ia.length=0},la=function(){var e,t,n=ia[0],o=ia.slice(1),i=n.crashedEffect?(e=n.crashedEffect,(t=pi(e))?t.code+" "+ea(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+ta(n.meta)+(i?" \n when executing effect "+i:"")].concat(o.map((function(e){return" created by "+ta(e.meta)})),[na(ia)]).join("\n")};function sa(e,t,n,o,i,a,r){var l;void 0===r&&(r=Zo);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||(ni(i,t),t.cont=Zo,s?r(l):(t===e&&(o=l),i.length||(a=!0,n(o))))}}function s(){a||(a=!0,i.forEach((function(e){e.cont=Zo,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,aa({meta:i,cancelledTasks:y}),S.isRoot){var o=la();ra(),e.onError(t,{sagaStack:o})}c=t,d&&d.reject(t)}else t===Mo?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={})[Ro]=!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(Mo,!1))},l.cont=r,l.end=g,l.setContext=function(e){ti(f,e)},l.toPromise=function(){return d||(d=Ui(),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 ca(e,t,n,o,i,a,r){var l=e.finalizeRunEffect((function(t,n,o){Bo(t)?Hi(t,o):Ko(t)?ca(e,t,c.context,n,i,!1,o):t&&t[wo]?(0,Zi[t.type])(e,t.payload,o,u):o(t)}));d.cancel=Zo;var s={meta:i,cancel:function(){0===s.status&&(s.status=1,d(Mo))},status:0},c=sa(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),ra()):ui(e)?(s.status=1,d.cancel(),i=Vo(t.return)?t.return(Mo):{done:!0,value:Mo}):i=ci(e)?Vo(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=Yi();function s(n,i){a||(a=!0,o.cancel=Zo,e.sagaMonitor&&(i?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),i&&function(e){oa=e}(t),o(n,i))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:i,effect:t}),s.cancel=Zo,o.cancel=function(){a||(a=!0,s.cancel(),s.cancel=Zo,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function ua(e,t){for(var n=e.channel,o=void 0===n?qi():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?ri: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=Yi();if(s&&(s.rootSagaStarted=s.rootSagaStarted||Zo,s.effectTriggered=s.effectTriggered||Zo,s.effectResolved=s.effectResolved||Zo,s.effectRejected=s.effectRejected||Zo,s.effectCancelled=s.effectCancelled||Zo,s.actionDispatched=s.actionDispatched||Zo,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=We.apply(void 0,c);g=function(e){return function(t,n,o){return h((function(t){return e(t,n,o)}))(t)}}}else g=ei;var m={channel:o,dispatch:si(i),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return Mi((function(){var e=ca(m,S,l,v,fi(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var da=function(e){var t,n=void 0===e?{}:e,o=n.context,i=void 0===o?{}:o,a=n.channel,r=void 0===a?qi():a,l=n.sagaMonitor,s=Go(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,o=e.dispatch;return t=ua.bind(null,U({},s,{context:i,channel:r,dispatch:o,getState:n,sagaMonitor:l})),function(e){return function(t){l&&l.actionDispatched&&l.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){ti(i,e)},c},ya=function(e){return{done:!0,value:e}},fa={};function pa(e){return qo(e)?"channel":Ho(e)?String(e):Vo(e)?e.name:String(e)}function ga(e,t,n){var o,i,a,r=t;function l(t,n){if(r===fa)return ya(t);if(n&&!i)throw r=fa,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===fa?ya(t):a}return ai(l,(function(e){return l(null,e)}),n)}function Sa(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:bi(e)},l=function(e){return{done:!1,value:Ei.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return ga({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+pa(e)+", "+t.name+")")}function va(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:bi(e)},s=function(e){return{done:!1,value:Ei.apply(void 0,[t].concat(o,[e]))}},c=function(e){return{done:!1,value:Li(e)}},u=function(e){return a=e},d=function(e){return r=e};return ga({q1:function(){return{nextState:"q2",effect:l,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:s(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:s(r),stateUpdater:u}}},"q1","takeLatest("+pa(e)+", "+t.name+")")}function ha(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:bi(e)},l=function(e){return{done:!1,value:Ii.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return ga({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+pa(e)+", "+t.name+")")}function ma(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:Ii.apply(void 0,[n].concat(a))},s={done:!1,value:wi(t)};return ga({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:fa}},q10:function(e){if((o-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}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 Ei.apply(void 0,[Sa,e,t].concat(o))}function ba(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 Ei.apply(void 0,[va,e,t].concat(o))}function ka(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 Ei.apply(void 0,[ha,e,t].concat(o))}class Ta{constructor(){this.context=null,this.accessToken=null,this.user=null,this.requestSource=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return Ta.instance||(Ta.instance=new Ta),Ta.instance}static setContext(e){Ta.getInstance().context=e}static setAccessToken(e){Ta.getInstance().accessToken=e}static setUser(e){Ta.getInstance().user=e}static setRequestSource(e){Ta.getInstance().requestSource=e}static setOnRedirectTo(e){Ta.getInstance().onRedirectTo=e}static setLogout(e,t){Ta.getInstance().logout=n=>{n?e(n):Ta.onRedirectTo(t)}}static getContext(){var e;return null!=(e=Ta.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Ta.getInstance().accessToken}static getRequestSource(){return Ta.getInstance().requestSource}static getUser(){return Ta.getInstance().user}static onRedirectTo(e,t){return Ta.getInstance().onRedirectTo(e,t)}static logout(e){return Ta.getInstance().logout(e)}}Ta.instance=void 0;const Pa={getContext:()=>Ta.getContext(),getAccessToken:()=>Ta.getAccessToken(),getUser:()=>Ta.getUser(),onRedirectTo:(e,t)=>Ta.onRedirectTo(e,t),logout:e=>Ta.logout(e)};class Ia extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Ea={v1:"/identity/resources/users/webauthn/v1/devices"},La={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Oa={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",roles:{v3:"/identity/resources/users/v3/roles"},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"}}},wa={v1:"/identity/resources/configurations/v1"},Ua={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Ca={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Da={v1:"/identity/resources/permissions/v1"},_a={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},accessTokens:{v1:"/identity/resources/tenants/access-tokens/v1"},invites:{user:{v1:"/identity/resources/tenants/invites/v1/user"},verify:{v1:"/identity/resources/tenants/invites/v1/verify"},configuration:{v1:"/identity/resources/tenants/invites/v1/configuration"}},users:{v1:"/identity/resources/tenants/users/v1"}},Ra={v1:"/identity/resources/roles/v1"},Ma={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Na={v1:"/identity/resources/impersonation/v1"},Fa={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Ga={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},$a={v1:"/team/resources/members/v1"},xa={v1:"/team/resources/roles/v1"},Va={v1:"/team/resources/stats/v1"},ja={v1:"/team/resources/profile"},Wa={v1:"/tenants/resources/account-settings/v1"},Ba={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"},v2:"/tenants/resources/hierarchy/v2",metadata:{v2:"/tenants/resources/hierarchy/v2/metadata"}},Ka={v1:"/tenants/resources/sub-tenants/v1"},za={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},qa={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"}}}},Ha={v1:"/subscriptions/resources/payment-providers/v1"},Ja={v1:"/subscriptions/resources/subscriptions/v1"},Qa={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Ya={v1:"/reports/engine/resources/triggers/v1"},Xa="/notification",Za="/audits",er={v1:"/event/resources/configurations/v1"},tr="/webhook",nr="/oauth",or="/flags",ir="/directory/resources/v1/configurations/scim2",ar="/directory/resources/scim/temp",rr="/entitlements/api/v1/user-entitlements";function lr(e,t,n=!0){let o;o="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const i=e.urlPrefix||"frontegg",a="frontegg"===i&&!n;return o.endsWith("/")||(o+="/"),o.endsWith(i)||a||(o+=i),o}function sr(e){var t,n;const o={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(o[io.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(o[io.frameWork]=e.metadataHeaders.framework),o}const cr=async e=>{var t,n,o;const i=Ta.getContext(),a=await async function(e,t){var n;const o=sr(e),i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Ta.getAccessToken)(),a=Ta.getRequestSource();t&&(o[io.contentType]=t),a&&(o[io.source]=a),i&&(o.Authorization=`Bearer ${i}`);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))o[`${t.key}`]=`${t.value}`;return o}(i,e.contentType),r=await async function(e,t,n){const o=lr(e,t),i=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const o=Object.keys(t);for(const e of o){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${o}${t}`;const r=Object.keys(i).length>0;return i&&r&&(a+=`?${new URLSearchParams(i)}`),a}(i,e.url,e.params),l=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:U({},a,e.headers),credentials:null!=(n=null!=(o=e.credentials)?o:i.requestCredentials)?n:"same-origin"});if(302===l.status)return window.location.href=await l.text(),new Promise((()=>{}));if(!l.ok){var s,c;if(413===l.status)throw new Ia("Error request is too large",l.status);let e,t=!0;try{e=await l.text(),e=JSON.parse(e)}catch(e){t=!1}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=i.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=i.logLevel)?c:"")&&console.error(e),new Ia(t?e:"We're facing some difficulties, Please try again",l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},ur=async(e,t,n)=>cr(U({url:e,method:"GET",contentType:"application/json",params:t},n)),dr=async(e,t,n)=>cr(U({url:e,method:"POST",contentType:"application/json",body:t},n)),yr=async(e,t,n)=>cr(U({url:e,method:"PATCH",contentType:"application/json",body:t},n)),fr=async(e,t,n)=>cr(U({url:e,method:"PUT",contentType:"application/json",body:t},n)),pr=async(e,t,n)=>cr(U({url:e,method:"DELETE",contentType:"application/json",body:t},n)),gr=async(e,t,n,o)=>cr(U({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),Sr=(e={})=>U({},e.jwt?{Authorization:e.jwt}:{});async function vr(e){return fr(`${Oa.v1}/tenant`,e)}async function hr(){return ur(`${Oa.v2}/me/tenants`)}async function mr(e){return ur(Ba.v1,void 0,{headers:Sr(e)})}async function Ar(e){return ur(Ba.tree.v1,void 0,{headers:Sr(e)})}async function br(e){return ur(Ba.parents.v1,void 0,{headers:Sr(e)})}async function kr(e,t){return ur(`${Ba.parents.v1}/${e}`,void 0,{headers:Sr(t)})}async function Tr(e,t){return dr(`${_a.users.v1}/count`,e,{headers:Sr(t)})}async function Pr(e,t){return ur(Ba.v2,e,{headers:Sr(t)})}async function Ir(e,t){return ur(Ba.metadata.v2,U({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Sr(t)})}async function Er(){return ur(wa.v1)}async function Lr(){return ur(`${wa.v1}/mfa-policy`)}async function Or(){return ur(`${wa.v1}/mfa-policy/vendor`)}async function wr(e){return e.id?yr(`${wa.v1}/mfa-policy`,e):dr(`${wa.v1}/mfa-policy`,e)}async function Ur(){return ur(`${wa.v1}/lockout-policy`)}async function Cr(){return ur(`${wa.v1}/lockout-policy/vendor`)}async function Dr(e){return e.id?yr(`${wa.v1}/lockout-policy`,e):dr(`${wa.v1}/lockout-policy`,e)}async function _r(){try{return await ur(`${wa.v1}/captcha-policy/public`)}catch{return null}}async function Rr(){return ur(`${wa.v1}/password-history-policy`)}async function Mr(){return ur(`${wa.v1}/password-history-policy/vendor`)}async function Nr(e){return e.id?yr(`${wa.v1}/password-history-policy`,e):dr(`${wa.v1}/password-history-policy`,e)}async function Fr(){return ur(`${wa.v1}/password`)}async function Gr(){return ur(`${Ua.emailDomain.v1}`)}async function $r(){return ur(`${Ua.emailDomain.v1}/config`)}async function xr(e){return dr(`${Ua.emailDomain.v1}`,e)}async function Vr(e){return dr(`${Ua.emailDomain.v1}/config`,e)}async function jr(e){return pr(`${Ua.emailDomain.v1}/${e}`)}async function Wr(e){return ur(`${Ua.ip.v1}`,e)}async function Br(){return ur(`${Ua.ip.v1}/config`)}async function Kr(e){return dr(`${Ua.ip.v1}`,e)}async function zr(e){return dr(`${Ua.ip.v1}/bulk`,e)}async function qr(e){return dr(`${Ua.ip.v1}/config`,e)}async function Hr(e){return pr(`${Ua.ip.v1}/${e}`)}async function Jr(){return dr(`${Ua.ip.v1}/verify`)}async function Qr(){return dr(`${Ua.ip.v1}/verify/allow`)}let Yr,Xr,Zr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Yr||(Yr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Xr||(Xr={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Zr||(Zr={}));class el extends Error{constructor(e){super(e)}}const tl="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new el("'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 nl extends Error{constructor(e){super(e)}}const ol=(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(tl(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 tl(t)}})(e.split(".")[n]))}catch(e){throw new nl("Invalid token specified: "+e.message)}},il=["type"],al=["type"];async function rl(e){if(!e.accessToken)return e;Ta.setAccessToken(e.accessToken);const t=await ur(`${Oa.v2}/me`),n=U({},e,e.accessToken?ol(e.accessToken):{},t);return Ta.setUser(n),n}async function ll(e){if(!e.accessToken)return{user:e};Ta.setAccessToken(e.accessToken);const[t,n]=await Promise.all([ur(`${Oa.v2}/me`),hr()]),o=U({},e,e.accessToken?ol(e.accessToken):{},t);return Ta.setUser(o),{user:o,tenants:n}}async function sl(e){Ta.setAccessToken(e.id_token);const t=await ur(`${Oa.v2}/me`),n=e.id_token?ol(e.id_token):{},o=U({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Ta.setUser(o),o}async function cl(e){try{const{address:t}=await dr(`${La.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function ul(e){return dr(`${La.v1}/user/saml/prelogin`,e)}async function dl(e){return rl(await dr(`${La.v1}/user/saml/postlogin`,e))}async function yl(e){return rl(await dr(`${La.v1}/user/oidc/postlogin`,e))}async function fl(e){return rl(await dr(`${La.v1}/user`,e))}async function pl(e){return rl(await dr(`${La.v1}/user/mfa/verify`,e))}async function gl(e){return dr(`${Oa.v1}/activate`,e)}async function Sl(e){return ur(`${Oa.v1}/activate/strategy`,e)}async function vl(e){return dr(`${Oa.v1}/activate/reset`,e)}async function hl(e){return dr(`${Oa.v1}/invitation/reset`,e)}async function ml(e){return dr(`${Oa.v1}/invitation/accept`,e)}async function Al(){return rl(await dr(`${La.v1}/user/token/refresh`))}async function bl(){return ll(await dr(`${La.v1}/user/token/refresh`))}async function kl(){return dr(`${La.v1}/logout`)}async function Tl(e){return ur(`${nr}/logout`,e)}async function Pl(e){return dr(`${Oa.v1}/passwords/reset`,e)}async function Il(e){return dr(`${Oa.v1}/passwords/reset/verify`,e)}async function El(e){return ur(`${Oa.v1}/passwords/config`,e)}async function Ll(e){return dr(`${La.v1}/user/mfa/recover`,e)}async function Ol(){return dr(`${Oa.v1}/mfa/enroll`)}async function wl(){return dr(`${Oa.v1}/mfa/authenticator/enroll`)}async function Ul(e){return dr(`${Oa.v1}/mfa/authenticator/enroll/verify`,e)}async function Cl(e){return dr(`${Oa.v1}/mfa/sms/enroll`,e)}async function Dl(e){return dr(`${Oa.v1}/mfa/sms/enroll/verify`,e)}async function _l(){return dr(`${Oa.v1}/mfa/webauthn/enroll`)}async function Rl(e){return dr(`${Oa.v1}/mfa/webauthn/enroll/verify`,e)}async function Ml(e){return dr(`${Oa.v1}/mfa/enroll/verify`,e)}async function Nl(e){return dr(`${Oa.v1}/mfa/disable`,e)}async function Fl(e,t){return dr(`${Oa.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Gl(e){return dr(`${Oa.v1}/mfa/sms/${e}/disable`)}async function $l(e,t){return dr(`${Oa.v1}/mfa/sms/${e}/disable/verify`,t)}async function xl(e){return dr(`${Oa.v1}/mfa/webauthn/${e}/disable`)}async function Vl(e,t){return dr(`${Oa.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function jl(){return ur(`${Oa.v1}/mfa/devices`)}async function Wl(e){return dr(`${La.v1}/user/mfa/authenticator/enroll`,e)}async function Bl(e){return dr(`${La.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Kl(e,t){return dr(`${La.v1}/user/mfa/authenticator/${e}/verify`,t)}async function zl(e){return dr(`${La.v1}/user/mfa/sms/enroll`,e)}async function ql(e){return dr(`${La.v1}/user/mfa/sms/enroll/verify`,e)}async function Hl(e,t){return dr(`${La.v1}/user/mfa/sms/${e}`,t)}async function Jl(e,t){return dr(`${La.v1}/user/mfa/sms/${e}/verify`,t)}async function Ql(e){return dr(`${La.v1}/user/mfa/webauthn/enroll`,e)}async function Yl(e){return dr(`${La.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Xl(e,t){return dr(`${La.v1}/user/mfa/webauthn/${e}`,t)}async function Zl(e,t){return dr(`${La.v1}/user/mfa/webauthn/${e}/verify`,t)}async function es(){return ur(`${Ga.v1}/saml/configurations`)}async function ts(e){return dr(`${Ga.v1}/saml/configurations`,e)}async function ns(){return ur(`${Ga.v1}/saml/configurations/vendor-config`)}async function os(e){return fr(`${Ga.v1}/saml/configurations/metadata`,e)}async function is(){return fr(`${Ga.v1}/saml/validations/domain`)}async function as(){return ur(`${Ga.v1}/saml/configurations/roles/default`)}async function rs(){return ur(`${Ga.v2}/saml/configurations/groups`)}async function ls({roleIds:e}){return dr(`${Ga.v1}/saml/configurations/roles/default`,{roleIds:e})}async function ss({roleIds:e,group:t}){return dr(`${Ga.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function cs({roleIds:e,group:t,id:n}){return yr(`${Ga.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function us({id:e}){return pr(`${Ga.v2}/saml/configurations/groups/${e}`)}async function ds(){return ur(`${Ga.v1}/oidc/configurations`)}async function ys(){return ur(`${Ga.v2}/configurations/public`)}async function fs(){return ur(Ca.v1)}async function ps(){return ur(Ca.v2)}async function gs(){return ur(Ca.custom.v1)}async function Ss({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),dr(`${La.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function vs(){return ur(`${wa.v1}/public`)}async function hs(e){const{shouldActivate:t,authResponse:n,userId:o,tenantId:i}=await dr(`${Oa.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await rl(n):void 0,userId:o,tenantId:i}}async function ms(){return ur(Oa.sessions.currentUser.v1)}async function As(){return ur(`${Oa.sessions.currentUser.v1}/current`)}async function bs(e){return dr(`${Oa.sessions.v1}/revoke`,{userId:e})}async function ks(){return ur(Oa.sessions.configurations.v1)}async function Ts(e){await dr(Oa.sessions.configurations.v1,e)}async function Ps(e){await pr(`${Oa.sessions.currentUser.v1}/${e}`)}async function Is(){await pr(`${Oa.sessions.currentUser.v1}/all`)}async function Es(){return ur(Oa.accessTokens.v1)}async function Ls(){return ur(_a.accessTokens.v1)}async function Os({id:e}){return pr(`${_a.accessTokens.v1}/${e}`)}async function ws({id:e}){return pr(`${Oa.accessTokens.v1}/${e}`)}async function Us(e){return dr(Oa.accessTokens.v1,e)}async function Cs(e){return dr(_a.accessTokens.v1,e)}async function Ds(){return ur(Oa.apiTokens.v1)}async function _s(){return ur(_a.apiTokens.v1)}async function Rs(e){return dr(Oa.apiTokens.v1,e)}async function Ms(e){return dr(_a.apiTokens.v2,e)}async function Ns({tokenId:e}){return pr(`${_a.apiTokens.v1}/${e}`)}async function Fs({tokenId:e}){return pr(`${Oa.apiTokens.v1}/${e}`)}async function Gs({userId:e}){return ur(`${Oa.v1}/${e}`)}async function $s(e){return ur(`${wa.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function xs(e){let{type:t}=e,n=Go(e,il);return dr(`${La.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Vs(e){let{type:t}=e,n=Go(e,al);return dr(`${La.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function js({token:e}){return dr(_a.invites.verify.v1,{token:e})}async function Ws(){return ur(`${Ga.v1}/configurations`)}async function Bs(e){return dr(`${Ga.v1}/configurations`,e)}async function Ks(e,t){return yr(`${Ga.v1}/configurations/${e}`,t)}async function zs(e){return pr(`${Ga.v1}/configurations/${e}`)}async function qs(e){return dr(`${Ga.v1}/configurations/metadata`,e)}async function Hs(e,t){return fr(`${Ga.v1}/configurations/${e}/metadata`,t)}async function Js(e,t){return dr(`${Ga.v1}/configurations/${e}/domains`,t)}async function Qs(e,t){return pr(`${Ga.v1}/configurations/${e}/domains/${t}`)}async function Ys(e,t){return fr(`${Ga.v1}/configurations/${e}/domains/${t}/validate`)}async function Xs(e){return ur(`${Ga.v1}/configurations/${e}/roles`)}async function Zs(e,t){return fr(`${Ga.v1}/configurations/${e}/roles`,t)}async function ec(e,t){return dr(`${Ga.v1}/configurations/${e}/groups`,t)}async function tc(e,{roleIds:t,group:n,id:o}){return yr(`${Ga.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function nc(e,t){return pr(`${Ga.v1}/configurations/${e}/groups/${t}`)}async function oc(e){return ur(`${Ga.v1}/configurations/${e}/groups`)}async function ic(e){return dr(`${La.v2}/user/sso/prelogin`,e)}async function ac(e){return rl(await dr(`${La.v2}/user/oidc/postlogin`,e))}async function rc(e){return sl(await dr(`${nr}/token`,e))}async function lc(){return sl(await dr(`${nr}/authorize/silent`))}async function sc(e){return dr(`${Oa.v1}/phone/reset`,e)}async function cc(e){return dr(`${Oa.v1}/phone/reset/verify`,e)}async function uc(e){return dr(`${Oa.v1}/phone`,e)}async function dc(e){return dr(`${Oa.v1}/phone/verify`,e)}async function yc(e){return fr(`${Oa.v1}/phone/change`,e)}async function fc(e){return dr(`${La.v1}/webauthn/prelogin`,e)}async function pc(e){return dr(`${La.v1}/webauthn/postlogin`,e)}async function gc(){return dr(Ea.v1)}async function Sc(){return ur(Ea.v1)}async function vc(e){return pr(`${Ea.v1}/${e}`)}async function hc(e){return dr(`${Ea.v1}/verify`,e)}async function mc(){return ur(`${wa.v1}/auth/strategies/public`)}async function Ac(){return ur(`${wa.v1}/mfa/strategies`)}async function bc(e){return ur(`${Oa.v2}/me`,null!=e?e:{addRoles:!0})}async function kc(e){return fr(`${Oa.v2}/me`,e)}async function Tc(e){return fr(`${ja.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Pc(e){return dr(`${Oa.v1}/passwords/change`,e)}async function Ic(e){var t,n,o,i,a,r;const l=(e.filter||[]).reduce(((e,t)=>U({},e,{[t.id]:t.value})),{}),s=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(o=e.sort)||null==(i=o[0])?void 0:i.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return ur($a.v1,U({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function Ec(e){return dr(Oa.v2,U({},e,{provider:"local"}))}async function Lc(e){return pr(`${$a.v1}/${e.userId}`)}async function Oc(e){return fr($a.v1,e)}async function wc(e){return dr(_a.invites.user.v1,U({},e))}async function Uc(e){return yr(_a.invites.user.v1,U({},e))}async function Cc(){return pr(_a.invites.user.v1)}async function Dc(){return ur(_a.invites.user.v1)}async function _c(){return ur(_a.invites.configuration.v1)}async function Rc(){return ur(xa.v1)}async function Mc(){return ur(Da.v1)}async function Nc(){return ur(`${Va.v1}/members`)}async function Fc(e){return dr(`${$a.v1}/${e.userId}/resendActivationEmail`,{})}async function Gc(e){return dr(Oa.v2,U({},e,{provider:"local"}))}async function $c(e){return dr(Oa.invitation.resendAll.v1,U({},e))}async function xc(e){var t,n;const o=await ur("/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 Vc(){return ur("/metadata/admin-box")}async function jc(e){return dr("/metadata/admin-box",e)}async function Wc(){const e=await ur("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Bc=async()=>xc({entityName:"notifications"}),Kc=async()=>xc({entityName:"saml"}),zc=async()=>xc({entityName:"audits"}),qc=async e=>async function(e){const t=await ur(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Hc=["dataFilters"],Jc=["templateId","dataFilters"],Qc=["dataFilters"];async function Yc(e){return ur(`${Qa.v2}/tenant-reports`,e)}async function Xc(e){return ur(`${Qa.v2}/${e.id}/tenant-reports`)}async function Zc(e){let{dataFilters:t}=e,n=Go(e,Hc);return{html:await ur(`${Ya.v1}/preview-report`,U({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function eu(e){let{templateId:t,dataFilters:n}=e,o=Go(e,Jc);return dr(`${Qa.v2}/${t}/tenant-reports`,U({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function tu(e){let{dataFilters:t}=e,n=Go(e,Qc);const o=await ur(`${Ya.v1}/preview-report`,U({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let i="text/html",a="html";"pdf"===n.responseType?(i="application/pdf",a="pdf"):"image"===n.responseType&&(i="image/jpeg",a="jpg");const r=new Blob([o],{type:i}),l=URL.createObjectURL(r),s=document.createElement("a");s.href=l,s.setAttribute("download",`report_${n.name||""}.${a}`),s.click(),setTimeout(s.remove.bind(s))}async function nu(e){return dr(`${Ya.v1}/tenant-reports`,e)}async function ou(e){return ur(Xa,{params:e})}async function iu(e){return fr(`${Xa}/status`,{params:e})}async function au(e){const{notificationId:t,pinStatus:n}=e;return fr(`${Xa}/${n}`,{notificationId:t})}async function ru(){return dr(`${Xa}/status/mark-all-read`)}const lu=["endpoint","headerProps"];async function su(e){return ur(Za,e)}async function cu(e){return ur(`${Za}/stats`,e)}async function uu(e){const{endpoint:t,headerProps:n}=e,o=Go(e,lu);return gr(`${Za}/export/${t}`,{properties:n},o)}const du=["eventKey"],yu=["eventKey"],fu=()=>ur(`${za.v1}/slack`),pu=()=>ur(`${za.v1}/slack/applications`),gu=()=>ur(`${za.v1}/slack/channels`),Su=e=>e.id?yr(`${za.v1}/slack/subscription/${e.id}`,e):dr(`${za.v1}/slack/subscriptions`,e),vu=e=>pr(`${za.v1}/slack/subscriptions/${e.id}`),hu=e=>dr(`${za.v1}/slack/applications/registrations`,{code:e}),mu=()=>ur(`${za.v1}/emails`),Au=e=>{let{eventKey:t}=e,n=Go(e,du);return dr(`${za.v1}/emails/${t}`,n)},bu=({eventKey:e,enabled:t})=>yr(`${za.v1}/emails/${e}`,{enabled:t}),ku=(e,t)=>pr(`${za.v1}/emails/${e}/subscriptions/${t}`),Tu=(e,t,n)=>fr(`${za.v1}/emails/${t}/subscriptions/${e}`,n),Pu=e=>pr(`${za.v1}/emails/${e}`),Iu=()=>ur(`${za.v2}/sms`),Eu=e=>{let{eventKey:t}=e,n=Go(e,yu);return dr(`${za.v2}/sms/${t}`,n)},Lu=({eventKey:e,enabled:t})=>yr(`${za.v2}/sms/${e}`,{enabled:t}),Ou=(e,t)=>pr(`${za.v2}/sms/${e}/subscriptions/${t}`),wu=(e,t,n)=>fr(`${za.v2}/sms/${t}/subscriptions/${e}`,n),Uu=e=>pr(`${za.v2}/sms/${e}`),Cu=()=>ur(tr),Du=e=>e._id?yr(`${tr}/${e._id}`,e):dr(`${tr}/custom`,e),_u=e=>pr(`${tr}/${e}`),Ru=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return ur(`${tr}/logs/?${o.toString()}`)},Mu=e=>dr(`${tr}/test`,e),Nu=e=>dr(`${tr}/logs/${e}/retries`),Fu=()=>ur(`${er.v1}/categories`),Gu=e=>ur(er.v1,{channels:e});async function $u(e,t){return fr(Wa.v1,e,{headers:Sr(t)})}async function xu(e){return ur(Wa.v1,void 0,{headers:Sr(e)})}async function Vu(){return ur(`${Wa.v1}/public`)}const ju=["roleId"],Wu=["roleId"],Bu=["permissionId"];async function Ku(){return ur(Ra.v1)}async function zu(e){return dr(Ra.v1,e)}async function qu({roleId:e}){return pr(`${Ra.v1}/${e}`)}async function Hu(e){let{roleId:t}=e,n=Go(e,ju);return yr(`${Ra.v1}/${t}`,n)}async function Ju(e){let{roleId:t}=e,n=Go(e,Wu);return fr(`${Ra.v1}/${t}/permissions`,n)}async function Qu(){return ur(Da.v1)}async function Yu(e){let{permissionId:t}=e,n=Go(e,Bu);return fr(`${Da.v1}/${t}/roles`,n)}async function Xu(){return ur(`${Da.v1}/categories`)}async function Zu(){return ur(qa.subscriptions.v1)}async function ed(e){return ur(`${qa.subscriptions.v1}/${e}`)}async function td(e){return fr(`${qa.subscriptions.v1}/${e}/cancellations/`,{})}async function nd(e){return fr(`${qa.subscriptions.v1}/${e}/renewals/`,{})}async function od(e,{paymentMethodId:t,planId:n}){return fr(`${qa.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function id(e){return ur(`${Ja.v1}/${e}`)}async function ad(){return ur(`${Ja.v1}`)}async function rd(e){return fr(`${Ja.v1}/${e}/cancellations/`,{})}async function ld(e){return fr(`${Ja.v1}/${e}/renewals/`,{})}async function sd(e,{paymentMethodId:t,planId:n}){return fr(`${Ja.v1}/${e}`,{paymentMethodId:t,planId:n})}async function cd(){return ur(qa.plans.v1)}async function ud(e){return ur(`${qa.plans.v1}/${e}`)}async function dd(){return ur(qa.invoices.v1)}async function yd(e){return ur(`${qa.invoices.v1}/${e}`)}async function fd(e,t){return ur(`${qa.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const pd=["email"];async function gd(){return ur(qa.paymentMethods.v1)}async function Sd(e){return ur(`${qa.paymentMethods.v1}/${e}`)}async function vd(e,t){let{email:n}=t,o=Go(t,pd);return yr(`${qa.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function hd(e){return dr(qa.paymentProviders.stripe.subscriptions.v1,e)}async function md(e){return ur(`${qa.paymentProviders.stripe.customers.v1}/${e}`)}async function Ad(e){return dr(`${qa.paymentProviders.stripe.customers.v1}`,e)}async function bd(){return ur(`${qa.paymentProviders.stripe.publicConfigurations.v1}`)}async function kd(e){return dr(`${qa.paymentProviders.stripe.setupIntents.v1}`,e)}async function Td(e){return ur(`${qa.summaries.v1}/${e}`)}async function Pd(e){return ur(`${qa.tenantConfiguration.v1}/${e}`)}async function Id(e){return dr(`${qa.tenantConfiguration.v1}`,e)}async function Ed(){return ur(Ha.v1)}async function Ld(){return ur(`${qa.configurations.vendorPublicConfigurations.v1}`)}let Od,wd,Ud,Cd,Dd,_d;async function Rd(){return ur("/vendors/public")}async function Md(e){return ur(Ma.v1,e)}async function Nd(e){return dr(Ma.v1,e)}async function Fd(e,t){return pr(Ma.v1,e,{headers:Sr(t)})}async function Gd(e,t,n){return dr(`${Ma.v1}/${e}/roles`,t,{headers:Sr(n)})}async function $d(e,t,n){return pr(`${Ma.v1}/${e}/roles`,t,{headers:Sr(n)})}async function xd(e,t,n){return yr(`${Ma.v1}/${e}/roles`,t,{headers:Sr(n)})}async function Vd(e,t){return dr(Ka.v1,e,{headers:Sr(t)})}async function jd(e,t){return pr(`${Ka.v1}/${e}`,void 0,{headers:Sr(t)})}async function Wd({tenantId:e},t,n){return yr(`${Ka.v1}/${e}`,t,{headers:Sr(n)})}async function Bd(e,t,n){return fr(`${Ma.v1}/${e}/access`,t,{headers:Sr(n)})}async function Kd(e,t){return dr(`${Ma.v2}/`,e,{headers:Sr(t)})}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Od||(Od={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(wd||(wd={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Ud||(Ud={})),(Cd||(Cd={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Dd||(Dd={})),function(e){e.CREATE="create_customer"}(_d||(_d={}));const zd={flags:{}};class qd{constructor(){var e;this._flags={},this._flags=null!=(e=zd.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new qd;return n.set(e),qd._instances[t]=n,n}static getFeatureFlags(e,t){const n=this.getInstance(t);return e.map((e=>"on"===(null==n?void 0:n._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t;this._flags=U({},null!=(t=null==zd?void 0:zd.flags)?t:{},null!=e?e:{})}}async function Hd(){return ur(or)}async function Jd(){return ur(`${ir}`)}async function Qd(e,t){return yr(`${ir}/${e}`,t)}async function Yd(e){return dr(`${ir}`,e)}async function Xd(e){return pr(`${ir}/${e}`)}async function Zd(e){return ur(`${ar}/${e}/Users/count`)}async function ey(e){return dr(`${Na.v1}`,e)}qd._instances={};const ty=["groupId"];async function ny({groupId:e},t){return ur(`${Fa.v1}/${e}`,U({},t))}async function oy(e){return ur(`${Fa.v1}`,U({},e))}async function iy(e,t){return dr(`${Fa.getByIds.v1}`,e,{params:t})}async function ay(e){return dr(`${Fa.v1}`,e)}async function ry(e){let{groupId:t}=e,n=Go(e,ty);return yr(`${Fa.v1}/${t}`,n)}async function ly(e){return pr(`${Fa.v1}/${e}`)}async function sy(e,t){return dr(`${Fa.v1}/${e}/roles`,t)}async function cy(e,t){return pr(`${Fa.v1}/${e}/roles`,t)}async function uy(e,t){return dr(`${Fa.v1}/${e}/users`,t)}async function dy(e,t){return pr(`${Fa.v1}/${e}/users`,t)}async function yy(){return ur(`${Fa.configurations.v1}`)}async function fy(e){return dr(`${Fa.configurations.v1}`,e)}async function py(e){return dr(`${Oa.v3}/me/token`,e)}async function gy(e,t){return ur(Oa.v3,e,{headers:Sr(t)})}async function Sy(e,t){return ur(Oa.roles.v3,U({},e,{ids:e.ids.join(",")}),{headers:Sr(t)})}async function vy(){return ur(rr)}let hy,my,Ay,by,ky,Ty;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(hy||(hy={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(my||(my={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Ay||(Ay={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(by||(by={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(ky||(ky={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Ty||(Ty={}));const Py=[/^(.*)\/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],Iy=`${La.v1}/user/token/refresh`,Ey=`${nr}/authorize/silent`,Ly=`${Oa.v2}/me`,Oy=`${Oa.v2}/me/tenants`;let wy,Uy,Cy;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(wy||(wy={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Uy||(Uy={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Cy||(Cy={}));const Dy={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,users:A,entitlements:b};var _y={fetch:e,ContextHolder:Ta,FronteggContext:Pa,api:Dy,FronteggApiError:Ia,AuthStrategyEnum:Xr,MachineToMachineAuthStrategy:Zr,SocialLoginProviders:Yr,ISubscriptionCancellationPolicy:Ud,ISubscriptionStatus:Od,PaymentMethodType:wd,ProviderType:Cd};let Ry,My;!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"}(Ry||(Ry={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(My||(My={}));const Ny="input is invalid type",Fy="undefined"!=typeof ArrayBuffer,Gy="0123456789abcdef".split(""),$y=[-2147483648,8388608,32768,128],xy=[24,16,8,0],Vy=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],jy=["hex","array","digest","arrayBuffer"],Wy=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Fy&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const By=function(e){return function(t){const n=new zy(!0).update(t);return null==n?void 0:n[e]()}},Ky=function(e){return function(t,n){const o=new qy(t,!0).update(n);return null==o?void 0:o[e]()}};class zy{constructor(e=!1){this.blocks=void 0,this.h0=void 0,this.h1=void 0,this.h2=void 0,this.h3=void 0,this.h4=void 0,this.h5=void 0,this.h6=void 0,this.h7=void 0,this.block=void 0,this.start=void 0,this.bytes=void 0,this.hBytes=void 0,this.finalized=void 0,this.hashed=void 0,this.first=void 0,this.lastByteIndex=void 0,this.sharedMemory=!1,this.toString=()=>this.hex(),this.array=()=>zy.prototype.digest(),e?(Wy[0]=Wy[16]=Wy[1]=Wy[2]=Wy[3]=Wy[4]=Wy[5]=Wy[6]=Wy[7]=Wy[8]=Wy[9]=Wy[10]=Wy[11]=Wy[12]=Wy[13]=Wy[14]=Wy[15]=0,this.blocks=Wy):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.sharedMemory=e}update(e){if(this.finalized)return;let t;const n=typeof e;if("string"!==n){if("object"!==n)throw new Error(Ny);if(null===e)throw new Error(Ny);if(Fy&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Fy&&ArrayBuffer.isView(e)))throw new Error(Ny);t=!0}let o,i,a=0;const r=e.length,l=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,l[0]=this.block,l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0),t)for(i=this.start;a<r&&i<64;++a)l[i>>2]|=e[a]<<xy[3&i++];else for(i=this.start;a<r&&i<64;++a)o=e.charCodeAt(a),o<128?l[i>>2]|=o<<xy[3&i++]:o<2048?(l[i>>2]|=(192|o>>6)<<xy[3&i++],l[i>>2]|=(128|63&o)<<xy[3&i++]):o<55296||o>=57344?(l[i>>2]|=(224|o>>12)<<xy[3&i++],l[i>>2]|=(128|o>>6&63)<<xy[3&i++],l[i>>2]|=(128|63&o)<<xy[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++a)),l[i>>2]|=(240|o>>18)<<xy[3&i++],l[i>>2]|=(128|o>>12&63)<<xy[3&i++],l[i>>2]|=(128|o>>6&63)<<xy[3&i++],l[i>>2]|=(128|63&o)<<xy[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=l[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}finalize(){if(this.finalized)return;this.finalized=!0;const e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=$y[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,o,i,a,r,l,s,c,u,d=this.h0,y=this.h1,f=this.h2,p=this.h3,g=this.h4,S=this.h5,v=this.h6,h=this.h7;const m=this.blocks;for(e=16;e<64;++e)i=m[e-15],t=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,i=m[e-2],n=(i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(l=704751109,i=m[0]-210244248,h=i-1521486534<<0,p=i+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),l=d&y,o=l^d&f^u,r=g&S^~g&v,i=h+n+r+Vy[e]+m[e],a=t+o,h=p+i<<0,p=i+a<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),s=p&d,o=s^p&y^l,r=h&g^~h&S,i=v+n+r+Vy[e+1]+m[e+1],a=t+o,v=f+i<<0,f=i+a<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&p,o=c^f&d^s,r=v&h^~v&g,i=S+n+r+Vy[e+2]+m[e+2],a=t+o,S=y+i<<0,y=i+a<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),u=y&f,o=u^y&p^c,r=S&v^~S&h,i=g+n+r+Vy[e+3]+m[e+3],a=t+o,g=d+i<<0,d=i+a<<0;this.h0=this.h0+d<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+p<<0,this.h4=this.h4+g<<0,this.h5=this.h5+S<<0,this.h6=this.h6+v<<0,this.h7=this.h7+h<<0}hex(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,o=this.h3,i=this.h4,a=this.h5,r=this.h6,l=this.h7;let s=Gy[e>>28&15]+Gy[e>>24&15]+Gy[e>>20&15]+Gy[e>>16&15]+Gy[e>>12&15]+Gy[e>>8&15]+Gy[e>>4&15]+Gy[15&e]+Gy[t>>28&15]+Gy[t>>24&15]+Gy[t>>20&15]+Gy[t>>16&15]+Gy[t>>12&15]+Gy[t>>8&15]+Gy[t>>4&15]+Gy[15&t]+Gy[n>>28&15]+Gy[n>>24&15]+Gy[n>>20&15]+Gy[n>>16&15]+Gy[n>>12&15]+Gy[n>>8&15]+Gy[n>>4&15]+Gy[15&n]+Gy[o>>28&15]+Gy[o>>24&15]+Gy[o>>20&15]+Gy[o>>16&15]+Gy[o>>12&15]+Gy[o>>8&15]+Gy[o>>4&15]+Gy[15&o]+Gy[i>>28&15]+Gy[i>>24&15]+Gy[i>>20&15]+Gy[i>>16&15]+Gy[i>>12&15]+Gy[i>>8&15]+Gy[i>>4&15]+Gy[15&i]+Gy[a>>28&15]+Gy[a>>24&15]+Gy[a>>20&15]+Gy[a>>16&15]+Gy[a>>12&15]+Gy[a>>8&15]+Gy[a>>4&15]+Gy[15&a]+Gy[r>>28&15]+Gy[r>>24&15]+Gy[r>>20&15]+Gy[r>>16&15]+Gy[r>>12&15]+Gy[r>>8&15]+Gy[r>>4&15]+Gy[15&r];return s+=Gy[l>>28&15]+Gy[l>>24&15]+Gy[l>>20&15]+Gy[l>>16&15]+Gy[l>>12&15]+Gy[l>>8&15]+Gy[l>>4&15]+Gy[15&l],s}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,o=this.h3,i=this.h4,a=this.h5,r=this.h6,l=this.h7,s=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return s.push(l>>24&255,l>>16&255,l>>8&255,255&l),s}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class qy extends zy{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const o=typeof e;if("string"===o){const t=[],o=e.length;let i,a=0;for(n=0;n<o;++n)i=e.charCodeAt(n),i<128?t[a++]=i:i<2048?(t[a++]=192|i>>6,t[a++]=128|63&i):i<55296||i>=57344?(t[a++]=224|i>>12,t[a++]=128|i>>6&63,t[a++]=128|63&i):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++n)),t[a++]=240|i>>18,t[a++]=128|i>>12&63,t[a++]=128|i>>6&63,t[a++]=128|63&i);e=t}else{if("object"!==o)throw new Error(Ny);if(null===e)throw new Error(Ny);if(Fy&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Fy&&ArrayBuffer.isView(e)))throw new Error(Ny)}var i;e.length>64&&(e=null==(i=new zy(!0).update(e))?void 0:i.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}zy.call(this,t),this.update(r),this.oKeyPad=a,this.inner=!0,this.sharedMemory=t}finalize(){if(super.finalize(),this.inner){this.inner=!1;const e=this.array();zy.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),zy.prototype.finalize.call(this)}}}const Hy=function(){const e=By("hex");e.create=function(){return new zy},e.update=function(t){return e.create().update(t)};for(let t=0;t<jy.length;++t){const n=jy[t];e[n]=By(n)}return e}();function Jy(e,t){const n=U({},e);return t.forEach((e=>{delete n[e]})),n}async function Qy(e){var t,n;return null!=(t=window.crypto)&&null!=(n=t.subtle)&&n.digest?async function(e){const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e):(console.warn("Generating CodeChallenge in non-secure domain:",window.location.origin),async function(e){const t=Hy.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Yy(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let o=0;o<e;o++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=Ky("hex");e.create=function(e){return new qy(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<jy.length;++t){const n=jy[t];e[n]=Ky(n)}}();const Xy=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n}));function*Zy(e){const t=yield Oi((e=>e.root.appName));return qd.getFeatureFlags(e,t)}const ef={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},tf=U({},ef,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),nf=[{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"}],of={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},af=U({},of,{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}),rf={loading:!1,error:void 0,saving:!0,profile:of},lf={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"},sf={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Xr.EmailAndPassword,machineToMachineAuthStrategy:Zr.ClientCredentials},cf={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},uf={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},df={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},yf={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},ff={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},pf=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],gf={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:yf,roles:pf,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Sf=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],vf={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:[nf[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[nf[0]],managedBy:Cy.FRONTEGG}]},hf={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:[nf[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[nf[0]],managedBy:Cy.FRONTEGG}]},mf={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Af=[hf,vf],bf=[mf],kf=[{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}],Tf=[{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"}],Pf={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},If={isActive:!0,strategy:xn.ALLOW},Ef=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:xn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:xn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:xn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:xn.BLOCK,description:"IP 4"}],Lf=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(U({},hf,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Of=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"}),wf=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Lf(6),roles:[Of("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Cy.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Lf(44),roles:[Of("Editor")],managedBy:Cy.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Lf(8),roles:[Of("Viewer")],managedBy:Cy.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Lf(5),roles:[Of("Admin")],managedBy:Cy.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Lf(21),description:"BDR, AE, and inside sales",roles:[Of("Viewer")],managedBy:Cy.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Lf(23),description:"Dev success and customer success",roles:[Of("Admin")],managedBy:Cy.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Lf(10),description:"The marketing department",roles:[Of("Viewer")],managedBy:Cy.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Lf(4),description:"Human resources",roles:[Of("Viewer")],managedBy:Cy.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Lf(3),roles:[Of("Viewer")],managedBy:Cy.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Lf(8),roles:[Of("Editor")],managedBy:Cy.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Lf(4),roles:[Of("Viewer")],managedBy:Cy.FRONTEGG}];let Uf,Cf,Df;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Uf||(Uf={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Cf||(Cf={})),function(e){e.profile="profile",e.privacy="privacy",e.personalApiTokens="personalApiTokens",e.account="account",e.users="users",e.groups="groups",e.security="security",e.sso="sso",e.audits="audits",e.webhooks="webhooks",e.apiTokens="apiTokens",e.roles="roles",e.subscriptions="subscription",e.allAccounts="allAccounts"}(Df||(Df={})),Df.profile,Df.privacy,Df.personalApiTokens,Df.account,Df.users,Df.groups,Df.security,Df.sso,Df.audits,Df.webhooks,Df.apiTokens,Df.roles,Df.subscriptions,Df.allAccounts;const _f=(e,t)=>e?(e=>Boolean(null==e?void 0:e.statusCode))(e)?e.message:((e=>e instanceof Error||(null==e?void 0:e.message)&&(null==e?void 0:e.stack)&&"Error"===(null==e?void 0:e.name))(e)?console.error(e.message):"string"==typeof e&&console.error(e),null!=t?t:"We're facing some difficulties, Please try again"):t,Rf=["events","url"];function*Mf(){yield ki(Io.setSignUpState({loading:!0}));try{const e=yield Ii(Dy.auth.getVendorConfig),[t]=(yield Ii(Dy.auth.getVendorPublicAuthStrategiesConfig),yield Ii(Zy,["admin_portal_login_per_tenant"]));if(t){const t=yield Ii(Dy.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:o}=e;yield ki(Io.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:o,firstLoad:!1})),yield ki(Io.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSignUpState({loading:!1,error:_f(e),firstLoad:!1}))}}function*Nf(e){let{payload:{events:t,url:n}}=e,o=Go(e.payload,Rf);yield ki(Io.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield Oi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield Ii(Dy.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:Cf.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(Ta.setAccessToken(null==l?void 0:l.accessToken),Ta.setUser(l),!r&&l&&Xp(l)){const t=yield tg(l);yield ki(Io.setState(t)),a(e.loginUrl)}else yield ki(Io.setSignUpState({loading:!1,shouldActivate:r,stage:gn.SignUpSuccess})),yield ki(Io.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield ki(Io.loadTenants()))}catch(e){Ta.setAccessToken(null),Ta.setUser(null),yield ki(Io.setSignUpState({loading:!1,error:_f(e)}))}yield ki(Io.setSignUpState({loading:!1}))}function*Ff(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Oi((e=>e.auth.signUpState));yield ki(Io.resetSignUpState()),yield ki(Io.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Gf(){yield ka(Io.signUpUser,Nf),yield ka(Io.resetSignUpStateSoft,Ff)}const $f={setVendorState:(e,{payload:t})=>U({},e,t)},xf={loadVendorPublicInfo:st("vendor/loadVendorPublicInfo")},Vf={loading:!1},{reducer:jf,actions:Wf}=ut({name:Dt,initialState:Vf,reducers:U({},$f)}),Bf=U({},Wf,xf);function*Kf(){yield ki(Bf.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Dy.vendor.getVendorPublicInfo();yield ki(Bf.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield ki(Bf.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const zf=["callback"],qf=["callback"],Hf=["callback"],Jf=["callback"],Qf=["callback"],Yf=["callback"];function*Xf(){yield ki(Io.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getGlobalSecurityPolicy);yield ki(Io.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyGlobalState({error:_f(e),loading:!1}))}yield ki(Io.loadSecurityPolicyMfa()),yield ki(Io.loadSecurityPolicyVendorMfa()),yield ki(Io.loadSecurityPolicyLockout()),yield ki(Io.loadSecurityPolicyVendorLockout()),yield ki(Io.loadSecurityPolicyVendorPasswordHistory()),yield ki(Io.loadSecurityPolicyCaptcha()),yield ki(Io.loadPublicAuthStrategiesPolicy())}function*Zf(){yield ki(Io.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getVendorConfig),[t]=yield Ii(Zy,["admin_portal_login_per_tenant"]);if(t){const t=yield Ii(Dy.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield ki(Io.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyPublicState({error:_f(e),loading:!1}))}}function*ep(){yield ki(Io.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getVendorPublicAuthStrategiesConfig);yield ki(Io.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyAuthStrategyPublicState({error:_f(e),loading:!1}))}}function*tp(){yield ki(Io.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getMfaPolicy);yield ki(Io.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyMfaState({error:_f(e),loading:!1}))}}function*np(){yield ki(Io.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getVendorMfaPolicy);yield ki(Io.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyVendorMfaState({error:_f(e),loading:!1}))}}function*op(e){let{payload:{callback:t}}=e,n=Go(e.payload,zf);yield ki(Io.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Ii(Dy.auth.saveMfaPolicy,n);yield ki(Io.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ki(Io.setSecurityPolicyMfaState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*ip(){yield ki(Io.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getLockoutPolicy);yield ki(Io.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyLockoutState({error:_f(e),loading:!1}))}}function*ap(e){let{payload:{callback:t}}=e,n=Go(e.payload,qf);yield ki(Io.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Ii(Dy.auth.saveLockoutPolicy,n);yield ki(Io.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ki(Io.setSecurityPolicyLockoutState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*rp(){yield ki(Io.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getVendorLockoutPolicy);yield ki(Io.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyVendorLockoutState({error:_f(e),loading:!1}))}}function*lp(){yield ki(Io.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getCaptchaPolicy);yield ki(Io.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyCaptchaState({error:_f(e),loading:!1}))}}function*sp(){yield ki(Io.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getPasswordHistoryPolicy);yield ki(Io.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyPasswordHistoryState({error:_f(e),loading:!1}))}}function*cp(){yield ki(Io.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getVendorPasswordHistoryPolicy);yield ki(Io.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyVendorPasswordHistoryState({error:_f(e),loading:!1}))}}function*up(e){let{payload:{callback:t}}=e,n=Go(e.payload,Hf);yield ki(Io.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Ii(Dy.auth.savePasswordHistoryPolicy,n);yield ki(Io.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ki(Io.setSecurityPolicyPasswordHistoryState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*dp(){yield ki(Io.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getPasswordConfigPolicy);yield ki(Io.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyPasswordState({error:_f(e),loading:!1}))}}function*yp(){yield ka(Io.loadSecurityPolicy,Xf),yield Aa(Io.saveSecurityPolicyMfa,op),yield Aa(Io.loadSecurityPolicyMfa,tp),yield Aa(Io.loadSecurityPolicyVendorMfa,np),yield Aa(Io.saveSecurityPolicyLockout,ap),yield Aa(Io.loadSecurityPolicyLockout,ip),yield Aa(Io.loadSecurityPolicyVendorLockout,rp),yield Aa(Io.loadSecurityPolicyCaptcha,lp),yield Aa(Io.saveSecurityPolicyPasswordHistory,up),yield Aa(Io.loadSecurityPolicyPasswordHistory,sp),yield Aa(Io.loadSecurityPolicyVendorPasswordHistory,cp),yield Aa(Io.loadVendorPasswordConfig,dp),yield Aa(Io.loadPublicSecurityPolicy,Zf),yield Aa(Io.loadPublicAuthStrategiesPolicy,ep)}function*fp(){yield ki(Io.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield ki(Io.setSecurityPolicyPublicState({policy:sf,loading:!1}))}catch(e){yield ki(Io.setSecurityPolicyPublicState({error:_f(e),loading:!1}))}}function*pp(){yield ki(Io.setSecurityPolicyGlobalState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyGlobalState({policy:lf,loading:!1})),yield ki(Io.loadSecurityPolicyMfa()),yield ki(Io.loadSecurityPolicyVendorMfa()),yield ki(Io.loadSecurityPolicyLockout()),yield ki(Io.loadSecurityPolicyVendorLockout()),yield ki(Io.loadSecurityPolicyPasswordHistory()),yield ki(Io.loadSecurityPolicyVendorPasswordHistory()),yield ki(Io.loadSecurityPolicyCaptcha())}function*gp(){yield ki(Io.setSecurityPolicyMfaState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyMfaState({policy:cf,loading:!1}))}function*Sp(){yield ki(Io.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyVendorMfaState({policy:cf,loading:!1}))}function*vp(e){var t;let{payload:{callback:n}}=e,o=Go(e.payload,Jf);yield ki(Io.setSecurityPolicyMfaState({saving:!0,error:null}));const i=U({},uf,{id:null!=(t=o.id)?t:uf.id,enforceMFAType:o.enforceMFAType});yield mt(),yield ki(Io.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*hp(){yield ki(Io.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyLockoutState({policy:uf,loading:!1}))}function*mp(){yield ki(Io.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyVendorLockoutState({policy:uf,loading:!1}))}function*Ap(e){let{payload:{callback:t}}=e,n=Go(e.payload,Qf);yield ki(Io.setSecurityPolicyLockoutState({saving:!0,error:null})),yield mt();const o=U({},uf,n,{id:n.id?n.id:uf.id});null==t||t(o),yield ki(Io.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*bp(){yield ki(Io.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyLockoutState({policy:uf,loading:!1}))}function*kp(){yield ki(Io.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyPasswordHistoryState({policy:df,loading:!1}))}function*Tp(){yield ki(Io.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield mt(),yield ki(Io.setSecurityPolicyVendorPasswordHistoryState({policy:df,loading:!1}))}function*Pp(e){let{payload:{callback:t}}=e,n=Go(e.payload,Yf);yield ki(Io.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield mt();const o=U({},df,n,{id:n.id?n.id:df.id});null==t||t(o),yield ki(Io.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*Ip(){yield ka(Io.loadSecurityPolicy,pp),yield Aa(Io.loadPublicSecurityPolicy,fp),yield Aa(Io.saveSecurityPolicyMfa,vp),yield Aa(Io.loadSecurityPolicyMfa,gp),yield Aa(Io.loadSecurityPolicyVendorMfa,Sp),yield Aa(Io.saveSecurityPolicyLockout,Ap),yield Aa(Io.loadSecurityPolicyLockout,hp),yield Aa(Io.loadSecurityPolicyVendorLockout,mp),yield Aa(Io.loadSecurityPolicyCaptcha,bp),yield Aa(Io.saveSecurityPolicyPasswordHistory,Pp),yield Aa(Io.loadSecurityPolicyPasswordHistory,kp),yield Aa(Io.loadSecurityPolicyVendorPasswordHistory,Tp)}const Ep=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Lp=e=>{const{pathname:t}=new URL(e),n=Ep(e);return n?t+n:t};function*Op(){yield ki(Io.setEntitlementsState({loading:!0,error:null}));try{const e=yield Ii(Dy.entitlements.loadEntitlements);yield ki(Io.setEntitlementsState({entitlements:e,loading:!1}))}catch(e){yield ki(Io.setEntitlementsState({error:e.message,loading:!1}))}}function*wp(){yield ka(Io.loadEntitlements,Op)}const Up=["callback"],Cp=["callback"],Dp=["callback"],_p=["callback"],Rp=["callback","events"],Mp=["callback"],Np=["callback"],Fp=["callback"],Gp=["callback"],$p=["callback"],xp=["callback"],Vp=["callback"],jp=["callback"],Wp=["callback"],Bp=["callback","deviceId"],Kp=["callback","deviceId"],zp=["callback","deviceId"],qp=["callback","deviceId"],Hp={[Xr.Code]:Pt.loginWithOtc,[Xr.EmailAndPassword]:Pt.loginWithPassword,[Xr.MagicLink]:Pt.magicLinkPreLoginSuccess,[Xr.SmsCode]:Pt.loginWithSmsOtc};function*Jp(){const e=Ta.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:o=!1,allowedRedirectOrigins:i=[]}=yield Oi((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:l,activateUrl:s}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;try{var d,y;!u&&null!=(d=(y=Ta.getContext()).tenantResolver)&&d.call(y)&&(yield Ii(dg),u=yield Oi((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})))}catch{}const f=window.localStorage.getItem(Lt);f&&![a,r,l,s].includes(f)&&(c=f),window.localStorage.removeItem(Lt),yield mt(200),ki(Io.resetLoginState());const p=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:o})=>{let i=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),o=new URL(e),i=o.origin===n.origin;return t.includes(o.origin)||i})(a,n)?i=a:console.warn("The redirect url param is not valid, the origin is a different site"):i=a:o&&(i+=window.location.search),i})({authenticatedUrl:u?Lp(u):c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(p,{refresh:p.startsWith("http")})}function*Qp(){let e;try{var t;const n=yield Ii(Dy.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield ki(Io.setState({ssoACS:e}))}function*Yp(){try{const{isActive:e}=yield Ii(Dy.auth.getSSOPublicConfiguration);yield ki(Io.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const Xp=e=>e.mfaRequired&&e.mfaToken?(Ta.setAccessToken(null),Ta.setUser(null),!0):(Ta.setAccessToken(e.accessToken),Ta.setUser(e),!1),Zp=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 an.authenticatorApp;if(t)return an.smsVerifyCode}return an.verify},eg=e=>{if(1===e.length){const[t]=e;if(t===Ay.AuthenticatorApp)return an.authenticatorApp;if(t===Ay.SMS)return an.smsSetPhoneNumber}return an.verify};function*tg(e){let t=Pt.loginWithTwoFactor,n={};const{loginState:o}=yield Oi((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield Ii(Dy.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Zp(e.mfaDevices)}:(n={step:eg(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=Pt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:It.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:U({},o,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:i,mfaDeviceExpiration:a})}}function*ng(e){var t;const{routes:n,loginState:o}=yield Oi((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*og(){const{user:e}=yield Oi((e=>e.auth));if(!e)return;const[t]=yield Ii(Zy,["admin_portal_entitlements"]);t&&(yield Ii(Op))}function*ig(){const{hostedLoginBox:e}=yield Oi((e=>e.auth));e?yield Ii(ag):yield Ii(lg),yield og()}function*ag(){const{user:e}=yield Oi((e=>e.auth));if(null==e||!e.refreshToken)return Ta.setAccessToken(null),Ta.setUser(null),void(yield ki(Io.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Ii(Dy.auth.exchangeOAuthTokens,t);yield ki(Io.setState({user:n,isAuthenticated:!0})),yield ki(Io.loadTenants())}catch(e){Ta.setAccessToken(null),Ta.setUser(null),yield ki(Io.setState({user:null,isAuthenticated:!1}))}}function*rg(){const{user:e}=yield Oi((e=>e.auth));if(null==e||!e.refreshToken)return Ta.setAccessToken(null),Ta.setUser(null),void(yield ki(Io.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Ii(Dy.auth.exchangeOAuthTokens,t);yield ki(Io.setState({user:n,isAuthenticated:!0})),yield ki(Io.loadTenants())}catch(e){Ta.setAccessToken(null),Ta.setUser(null),yield ki(Io.setState({user:null,isAuthenticated:!1}))}}function*lg(){try{const t=Ta.onRedirectTo,{routes:n,loginState:o}=yield Oi((e=>e.auth)),{user:i,tenants:a}=yield Ii(Dy.auth.refreshTokenV2);if(Xp(i)){const e=yield tg(i);yield ki(Io.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 ng(i);yield ki(Io.setTenantsState({tenants:a,loading:!1})),yield ki(Io.setState({user:i,isAuthenticated:!0,loginState:U({},o,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield cg(n)}}catch(e){Ta.setAccessToken(null),Ta.setUser(null),yield ki(Io.setState({user:void 0,isAuthenticated:!1}))}}function*sg(){try{const t=Ta.onRedirectTo,{routes:n,loginState:o}=yield Oi((e=>e.auth)),{user:i,tenants:a}=yield Ii(Dy.auth.refreshTokenV2);if(Xp(i)){const e=yield tg(i);yield ki(Io.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield Ii(kg))yield ki(Io.setLoginState({step:Pt.promptPasskeys,loading:!1})),yield ki(Io.setTenantsState({tenants:a,loading:!1})),yield ki(Io.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 ng(i);yield ki(Io.setTenantsState({tenants:a,loading:!1})),yield ki(Io.setState({user:i,isAuthenticated:!0,loginState:U({},o,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield cg(n)}}catch(e){Ta.setAccessToken(null),Ta.setUser(null),yield ki(Io.setState({user:void 0,isAuthenticated:!1}))}}function*cg(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=Ta.onRedirectTo,{routes:i,loginState:a}=yield Oi((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 Jp())}function*ug({payload:{callback:e}}){try{const{ip:t}=yield Ii(Dy.metadata.getCurrentUserIpMetadata);yield ki(Io.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*dg(){try{var e,t;if(null!=(e=Ta.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){const{routes:e}=yield Oi((e=>e.auth)),{applicationUrl:t,loginUrl:o}=yield Ii(Vu);if(t&&o){var n;const i=null!=(n=Ep(t))?n:"";yield ki(Io.setState({routes:U({},e,{customLoginAuthenticatedUrl:o,customLoginUrl:e.loginUrl+i})}))}}}catch{}}function*yg({payload:e}){const t=[];e&&(yield ki(Io.setState({isLoading:!0})),yield ki(Io.loadSocialLoginsConfigurationV2()),t.push(Ii(Mf)),t.push(Ii(ep)),t.push(Ii(Yp)),t.push(Ii(Kf)),t.push(Ii(Qp)),t.push(Ii(dg))),t.push(Ii(ig)),yield Ti(t),yield ki(Io.setState({isLoading:!1}))}function*fg({accessToken:e,user:t}){if(!e)return void(yield ki(Io.setState({user:void 0,isAuthenticated:!1})));const n=Ta.onRedirectTo,{routes:o}=yield Oi((e=>e.auth));if(Xp(t)){const e=yield tg(t);yield ki(Io.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*pg({payload:e}){const t=[];yield ki(Io.loadSocialLoginsConfigurationV2()),t.push(Ii(Mf)),t.push(Ii(Yp)),t.push(Ii(Kf)),t.push(Ii(Qp)),t.push(Ii(fg,e)),t.push(Ii(dg)),yield Ti(t)}function*gg({payload:e}){const{disableSilentRefresh:t}=yield Oi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield Ii(Dy.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield ki(Io.setState({user:e,isAuthenticated:!0})),yield ki(Io.loadTenants()),yield ki(Io.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:o,urlStrategy:i}=yield Oi((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 ki(Io.setState({isLoading:!0}));const a=Yy(),r=Yy(),l=yield Ii(Qy,r);localStorage.setItem(Ot,r);let s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`;const c=yield Sg();c&&(s.endsWith("/")&&(s=s.slice(0,-1)),s+=c);const u=`${lr(n,"/oauth/authorize")}/oauth/authorize`,d=U({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:s,code_challenge:l,code_challenge_method:"S256",nonce:a},e);if(n.tenantResolver){var y;const e=yield null==(y=n.tenantResolver)?void 0:y.call(n);null!=e&&e.tenant&&(d.organization=e.tenant)}o(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}(e)}}function*Sg(){try{var e,t;if(null!=(e=Ta.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){yield Ii(dg);const e=yield Oi((e=>e.auth.routes.customLoginAuthenticatedUrl));if(e)return Ep(e)}}catch{}}function*vg({payload:e}){const t=localStorage.getItem(Ot)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:o}=yield Oi((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let i=`${window.location.origin}${"path"===o?"":"#"}${n.hostedLoginRedirectUrl}`;const a=yield Sg();a&&(i.endsWith("/")&&(i=i.slice(0,-1)),i+=a);const r={code:e.code,redirect_uri:i,code_verifier:t,grant_type:"authorization_code"};try{const e=yield Ii(Dy.auth.exchangeOAuthTokens,r);yield ki(Io.setState({user:e,isAuthenticated:!0})),yield ki(Io.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Jp()}}function*hg(e){let{payload:{callback:t}}=e,n=Go(e.payload,Up);try{yield ki(Io.setLoginState({loading:!0}));const e=yield Ii(Dy.auth.changePhoneNumberWithVerification,n);yield ki(Io.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Pt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({error:_f(e),loading:!1}))}}function*mg(e){let{payload:{callback:t}}=e,n=Go(e.payload,Cp);try{yield ki(Io.setLoginState({loading:!0})),yield Ii(Dy.auth.verifyChangePhoneNumber,n),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({error:_f(e),loading:!1}))}}function*Ag(e){let{payload:{callback:t}}=e,n=Go(e.payload,Dp);try{yield ki(Io.setLoginState({loading:!0}));const e=yield Ii(Dy.auth.passwordlessPreLogin,U({},n,{type:Xr.SmsCode}));yield ki(Io.setLoginState({step:Pt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({error:_f(e),loading:!1})),null==t||t(e)}}function*bg(e){let{payload:{callback:t}}=e,n=Go(e.payload,_p);try{const{onRedirectTo:e,routes:o}=yield Oi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ki(Io.setLoginState({loading:!0}));const i=yield Ii(Dy.auth.passwordlessPreLogin,n),a=Hp[n.type];if(a===Pt.loginWithSmsOtc&&i.resetPhoneNumberToken)return yield ki(Io.setResetPhoneNumberState({resetPhoneNumberToken:i.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),void e(o.resetPhoneNumberUrl);yield ki(Io.setLoginState({step:a,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield ki(Io.setLoginState({error:_f(e),loading:!1})),null==t||t()}}function*kg(){const{publicAuthStrategyPolicy:e}=yield Oi((e=>e.auth.securityPolicyState)),{policy:t}=e,n=(e=>{var t;return!(null==e||null==(t=e.secondaryAuthStrategies)||!t.some((({isActive:e,strategy:t})=>e&&t===hy.Passkeys)))})(t),o="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield Ii(Zy,["show-passkeys-new"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield Ii(Dy.auth.getWebAuthnDevices);return yield ki(Io.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*Tg(e){let{payload:{callback:t,events:n}}=e,o=Go(e.payload,Rp);try{yield ki(Io.setLoginState({loading:!0}));const e=yield Ii(Dy.auth.passwordlessPostLogin,o),a=Ta.onRedirectTo,{routes:r}=yield Oi((e=>e.auth));if(Xp(e)){const t=yield tg(e);yield ki(Io.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield Oi((e=>e.auth)),l=yield Ii(Dy.auth.generateLoginResponse,e);var i;e.emailVerified&&(null==n||null==(i=n.userVerified)||i.call(n,{email:l.email,origin:Uf.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield ki(Io.setState({user:l})),yield ki(Io.setLoginState({error:void 0})),yield ki(Io.loadTenants()),yield ki(Io.setState({isLoading:!1})),o.flow===It.Login?(yield Ii(kg))?(yield ki(Io.setLoginState({step:Pt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield ki(Io.setState({isAuthenticated:!0})),yield Jp()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield ki(Io.setLoginState({error:_f(e,"Failed to authenticate")}))}finally{yield ki(Io.setLoginState({loading:!1}))}}function*Pg({payload:e}){try{yield ki(Io.setLoginState({loading:!0}));const{name:t}=yield Ii(Dy.auth.verifyInviteToken,e);yield ki(Io.setLoginState({inviteTokenTenantName:t}))}catch(e){yield ki(Io.setLoginState({inviteTokenError:_f(e,"We couldn't verify your invitation")}))}finally{yield ki(Io.setLoginState({loading:!1}))}}function*Ig({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:o}}){yield ki(Io.setLoginState({loading:!0}));try{const i=yield Oi((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield Ii(Dy.auth.preLoginV2,{email:e});if(a){let e=a;if(r===My.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield Oi((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield ki(Io.setLoginState({step:Pt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{i(e,{refresh:!0})}),2e3)}else yield Eg({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield Eg({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*Eg(e){let{callback:t}=e,n=Go(e,Mp);const o=yield Oi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==o||!o.authStrategy)return yield ki(Io.setLoginState({step:Pt.loginWithPassword,loading:!1})),void(null==t||t());(null==o?void 0:o.authStrategy)===Xr.EmailAndPassword?(yield ki(Io.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t()):[Xr.MagicLink,Xr.Code,Xr.SmsCode].includes(null==o?void 0:o.authStrategy)?yield ki(Io.passwordlessPreLogin(U({},n,{type:null==o?void 0:o.authStrategy,callback:t}))):(yield ki(Io.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t())}function*Lg({payload:{callback:e}}){try{yield ki(Io.setLoginState({loading:!0}));const{options:t}=yield Ii(Dy.auth.webAuthnCreateNewDeviceSession);t.user.id=kt(t.user.id),t.challenge=kt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield ki(Io.setLoginState({error:_f(t)})),null==e||e(null)}finally{yield ki(Io.setLoginState({loading:!1}))}}function*Og(e){let{payload:{callback:t}}=e,n=Go(e.payload,Np);try{yield ki(Io.setLoginState({loading:!0}));const e=Tt(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?my.Platform:my.CrossPlatform;yield Ii(Dy.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({error:_f(e)})),null==t||t(null)}finally{yield ki(Io.setLoginState({loading:!1}))}}function*wg(e){let{payload:{callback:t}}=e,n=Go(e.payload,Fp);try{var o;yield ki(Io.setPasskeysState({loading:!0})),yield ki(Io.setLoginState({loading:!0}));const{options:e}=yield Ii(Dy.auth.webAuthnPreLogin,n);e.challenge=kt(e.challenge),e.allowCredentials=null==(o=e.allowCredentials)?void 0:o.map((e=>U({},e,{id:kt(e.id)}))),yield ki(Io.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield ki(Io.setLoginState({error:_f(e)})),null==t||t(null)}finally{yield ki(Io.setPasskeysState({loading:!1})),yield ki(Io.setLoginState({loading:!1}))}}function*Ug(e){let{payload:{callback:t}}=e,n=Go(e.payload,Gp);try{var o;yield ki(Io.setPasskeysState({loading:!0})),yield ki(Io.setLoginState({loading:!0}));const e=Tt(n.publicKey),i=yield Ii(Dy.auth.webAuthnPostLogin,U({},e,{response:U({},e.response,{userHandle:null!=(o=e.response.userHandle)?o:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(Xp(i)){const e=Ta.onRedirectTo,{routes:t}=yield Oi((e=>e.auth)),n=yield tg(i);yield ki(Io.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield Ii(Dy.auth.generateLoginResponse,i);e.id&&localStorage.setItem("userId",e.id),yield ki(Io.loadTenants()),yield ki(Io.setState({user:e,isAuthenticated:!0})),yield ki(Io.setLoginState({error:void 0})),yield Jp(),null==t||t(!0)}}catch(e){yield ki(Io.setLoginState({error:_f(e)})),null==t||t(null)}finally{yield ki(Io.setPasskeysState({loading:!1})),yield ki(Io.setLoginState({loading:!1}))}}function*Cg({payload:e}){const{onRedirectTo:t,routes:n}=yield Oi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ki(Io.setLoginState({loading:!0}));try{const t=yield Ii(Dy.auth.postLogin,e);Ta.setAccessToken(t.accessToken),Ta.setUser(t),yield ki(Io.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Jp()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield ki(Io.setLoginState({step:Pt.loginWithSSOFailed,loading:!1}))}}function*Dg({payload:{email:e,password:t,recaptchaToken:n,invitationToken:o,callback:i}}){yield ki(Io.setLoginState({loading:!0}));try{const a=yield Ii(Dy.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:o});Ta.setAccessToken(a.accessToken),Ta.setUser(a);const r=Ta.onRedirectTo,{routes:l}=yield Oi((e=>e.auth));if(Xp(a)){const e=yield tg(a);yield ki(Io.setState(e)),r(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Oi((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield ki(Io.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===It.Login?Pt.success:t.step,tenants:[],tenantsLoading:!0}})),yield ki(Io.loadTenants()),n&&t.flow===It.Login&&((yield Ii(kg))?(yield ki(Io.setLoginState({step:Pt.promptPasskeys,loading:!1})),r(l.loginUrl,{preserveQueryParams:!0})):yield Jp())}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){Ta.setAccessToken(null),Ta.setUser(null),null==i||i(!1,t),yield ki(Io.setLoginState({email:e,error:_f(t),loading:!1}))}}function*_g({payload:{mfaToken:e,value:t,rememberDevice:n,callback:o}}){yield ki(Io.setLoginState({loading:!0}));try{const i=yield Ii(Dy.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield Oi((e=>e.auth)),r=a.flow===It.Login?Pt.success:a.step;yield ki(Io.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 ki(Io.loadTenants()),yield ki(Io.setLoginState({error:void 0,loading:!1})),a.flow===It.Login&&((yield Ii(kg))?yield ki(Io.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield Jp()),null==o||o(!0)}catch(e){yield ki(Io.setLoginState({error:_f(e),loading:!1})),null==o||o(!1,e)}}function*Rg({payload:e}){yield ki(Io.setLoginState({loading:!0}));try{var t;yield Ii(Dy.auth.recoverMfaToken,e),yield ki(Io.setLoginState({loading:!1,error:void 0,step:Pt.preLogin})),yield ki(Io.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ki(Io.setLoginState({error:_f(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Mg({payload:e}){const{hostedLoginBox:t}=yield Oi((e=>e.auth));yield ki(Io.setState({isLoading:!0}));try{t?yield Ii(Dy.auth.OAuthLogout):yield Ii(Dy.auth.logout)}catch{}yield ki(Io.resetState()),yield ki(Io.requestAuthorize(!0)),null==e||e()}function*Ng({payload:e}){var t;try{yield Ii(Dy.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*Fg({user:e,tenants:t}){const n={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield ki(Io.setMfaState(n)),yield ki(Io.setUser(e)),yield ki(Io.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Gg({user:e,tenants:t}){const{loginState:n}=yield Oi((e=>e.auth));yield ki(Io.setUser(e)),yield ki(Io.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:o}=yield Oi((e=>e.auth.mfaState));if(n.flow===It.Login){const e=yield Ii(kg);o===an.smsVerifyCode&&e?yield ki(Io.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield Jp()}yield ki(Io.setState({isAuthenticated:!0}))}function*$g(e){let{payload:{callback:t}}=e,n=Go(e.payload,$p);yield ki(Io.setLoginState({loading:!0}));try{const e=yield Ii(Dy.auth.preEnrollMFASMSForLogin,n);yield ki(Io.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*xg(e){let{payload:{callback:t}}=e,n=Go(e.payload,xp);yield ki(Io.setLoginState({loading:!0}));try{const e=yield Ii(Dy.auth.enrollMFASMSForLogin,n),o=yield Ii(Dy.auth.generateLoginResponseV2,e);yield Fg(o),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*Vg(e){let{payload:{callback:t}}=e,n=Go(e.payload,Vp);yield ki(Io.setLoginState({loading:!0}));try{var o;const e=yield Ii(Dy.auth.preEnrollMFAWebAuthnForLogin,n),i=U({},e.options,{challenge:kt(e.options.challenge),user:U({},e.options.user,{id:kt(e.options.user.id)}),excludeCredentials:null==(o=e.options.excludeCredentials)?void 0:o.map((e=>U({},e,{id:kt(e.id)})))});yield ki(Io.setLoginState({loading:!1})),null==t||t({options:i,webauthnToken:e.webauthnToken})}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*jg(e){let{payload:{callback:t}}=e,n=Go(e.payload,jp);yield ki(Io.setLoginState({loading:!0}));try{const e=Tt(n.publicKey),o=yield Ii(Dy.auth.enrollMFAWebAuthnForLogin,U({},n,{options:e})),i=yield Ii(Dy.auth.generateLoginResponseV2,o);yield Fg(i),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*Wg(e){let{payload:{callback:t}}=e,n=Go(e.payload,Wp);yield ki(Io.setLoginState({loading:!0}));try{const e=yield Ii(Dy.auth.enrollMFAAuthenticatorAppForLogin,n),o=yield Ii(Dy.auth.generateLoginResponseV2,e);yield Fg(o),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*Bg(e){let{payload:{callback:t,deviceId:n}}=e,o=Go(e.payload,Bp);yield ki(Io.setLoginState({loading:!0}));try{const e=yield Ii(Dy.auth.preVerifyMFASMSForLogin,n,o);yield ki(Io.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*Kg(e){let{payload:{callback:t,deviceId:n}}=e,o=Go(e.payload,Kp);yield ki(Io.setLoginState({loading:!0}));try{const e=yield Ii(Dy.auth.verifyMFASMSForLogin,n,o),i=yield Ii(Dy.auth.generateLoginResponseV2,e);yield Gg(i),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*zg(e){let{payload:{callback:t,deviceId:n}}=e,o=Go(e.payload,zp);yield ki(Io.setLoginState({loading:!0}));try{var i;const e=yield Ii(Dy.auth.preVerifyMFAWebAuthnForLogin,n,o),a=U({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>U({},e,{id:kt(e.id)})))});yield ki(Io.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*qg(e){let{payload:{callback:t,deviceId:n}}=e,o=Go(e.payload,qp);yield ki(Io.setLoginState({loading:!0}));try{const e=Tt(o.publicKey),i=yield Ii(Dy.auth.verifyMFAWebAuthnForLogin,n,U({},o,{options:e})),a=yield Ii(Dy.auth.generateLoginResponseV2,i);yield Gg(a),yield ki(Io.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setLoginState({loading:!1,error:_f(e)})),null==t||t(null)}}function*Hg(){yield ka(Io.requestAuthorize,yg),yield ka(Io.requestAuthorizeSSR,pg),yield ka(Io.requestHostedLoginAuthorize,gg),yield ka(Io.handleHostedLoginCallback,vg),yield ka(Io.preLogin,Ig),yield ka(Io.postLogin,Cg),yield ka(Io.login,Dg),yield ka(Io.logout,Mg),yield ka(Io.silentLogout,Ng),yield ka(Io.loginWithMfa,_g),yield ka(Io.recoverMfa,Rg),yield ka(Io.quickSmsPasswordlessPreLogin,Ag),yield ka(Io.changePhoneNumberWithVerification,hg),yield ka(Io.verifyChangePhoneNumber,mg),yield ka(Io.passwordlessPreLogin,bg),yield ka(Io.passwordlessPostLogin,Tg),yield ka(Io.verifyInviteToken,Pg),yield ka(Io.webAuthnPrelogin,wg),yield ka(Io.webAuthnPostLogin,Ug),yield ka(Io.webAuthnCreateNewDeviceSession,Lg),yield ka(Io.webAuthnVerifyNewDeviceSession,Og),yield ka(Io.afterAuthNavigation,Jp),yield ka(Io.getUserIP,ug),yield ka(Io.preEnrollMFASMSForLogin,$g),yield ka(Io.enrollMFASMSForLogin,xg),yield ka(Io.preEnrollMFAWebAuthnForLogin,Vg),yield ka(Io.enrollMFAWebAuthnForLogin,jg),yield ka(Io.enrollMFAAuthenticatorAppForLogin,Wg),yield ka(Io.preVerifyMFASMSForLogin,Bg),yield ka(Io.verifyMFASMSForLogin,Kg),yield ka(Io.preVerifyMFAWebAuthnForLogin,zg),yield ka(Io.verifyMFAWebAuthnForLogin,qg)}function*Jg({payload:e}){e&&(yield ki(Io.setState({isLoading:!0})));const t=af;yield ki(Io.loadTenants()),yield ki(Io.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Qg({payload:{callback:e}}){try{const{ip:t}=Ef[0];yield ki(Io.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Yg(){yield ka(Io.requestAuthorize,Jg),yield ka(Io.afterAuthNavigation,Jp),yield ka(Io.getUserIP,Qg)}const Xg=["callback","samlVendor"],Zg=["callback","samlVendor"];function*eS(){try{var e,t;yield ki(Io.setSSOState({loading:!0}));const n=yield Ii(Dy.auth.getSamlConfiguration),o=yield Ii(Dy.auth.getOidcConfiguration),i=yield Ii(Dy.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 ki(Io.setSSOState({samlConfiguration:n,oidcConfiguration:o,loading:!1,firstLoad:!1}))}catch(e){yield ki(Io.setSSOState({error:_f(e),loading:!1}))}}function*tS({payload:e}){const t=yield Oi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield ki(Io.setSSOState({error:void 0,[n]:!0}));try{const o=yield Xy(e[0]),i=yield Ii(Dy.auth.updateSamlVendorMetadata,{metadata:o});i.isSamlActive=null==t?void 0:t.isSamlActive,yield ki(Io.setSSOState({samlConfiguration:i,error:void 0,[n]:!1}))}catch(e){yield ki(Io.setSSOState({samlConfiguration:t,error:_f(e),[n]:!1}))}}function*nS({payload:e}){const{configFile:t,callback:n}=e,o=yield Oi((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield ki(Io.setSSOState({error:void 0,[i]:!0}));try{const e=yield Xy(t),a=yield Ii(Dy.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==o?void 0:o.isSamlActive,yield ki(Io.setSSOState({samlConfiguration:a,error:void 0,[i]:!1})),null==n||n(!0)}catch(e){yield ki(Io.setSSOState({samlConfiguration:o,error:_f(e),[i]:!1})),null==n||n(null,e)}}function*oS({payload:e}){const{callback:t,samlVendor:n}=e,o=Go(e,Xg),i=yield Oi((e=>e.auth.ssoState.samlConfiguration)),a=U({},i,o);let r="saving";(null==a?void 0:a.enabled)!==i.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield ki(Io.setSSOState({samlConfiguration:U({},i,a)})));if(yield ki(Io.setSSOState({error:void 0,[r]:!0})),e.type===My.Saml){var l,s;const e=yield Ii(Dy.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=Jy(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 Ii(Dy.auth.updateSamlConfiguration,o);c.isSamlActive=null==i?void 0:i.isSamlActive,yield ki(Io.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield ki(Io.setSSOState({samlConfiguration:i,error:_f(e),[r]:!1})),null==t||t(null,e)}}function*iS({payload:{callback:e}={}}){const t=yield Oi((e=>e.auth.ssoState.samlConfiguration));try{yield ki(Io.setSSOState({error:void 0,saving:!0})),yield Ii(Dy.auth.validateSamlDomain),yield ki(Io.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield ki(Io.setSSOState({samlConfiguration:U({},t,{validated:!1}),error:_f(n),saving:!1})),null==e||e(null,n)}}function*aS(){try{const e=yield Ii(Dy.auth.getSamlRoles),t=yield Ii(Dy.auth.getSamlRolesGroups);yield ki(Io.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield ki(Io.setSSOState({error:_f(e)}))}}function*rS({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield ki(Io.setSSOState({error:void 0,saving:!0})),yield Ii(Dy.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Ti(e.map((e=>Ii(Dy.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield ki(Io.setSSOState({error:_f(e)}))}}(n)),yield aS(),yield ki(Io.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ki(Io.setSSOState({error:_f(t),saving:!1})),null==e||e(null,t)}}function*lS({payload:{callback:e,id:t}}){try{yield ki(Io.setSSOState({error:void 0,saving:!0})),yield Ii(Dy.auth.deleteSamlGroup,{id:t}),yield aS(),yield ki(Io.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ki(Io.setSSOState({error:_f(t),saving:!1})),null==e||e(null,t)}}function*sS({payload:{group:e,roleIds:t,callback:n}}){try{yield ki(Io.setSSOState({error:void 0,saving:!0})),yield Ii(Dy.auth.createSamlGroup,{group:e,roleIds:t}),yield aS(),yield ki(Io.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield ki(Io.setSSOState({error:_f(e),saving:!1})),null==n||n(null,e)}}function*cS({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield ki(Io.setSSOState({loading:!0})),yield Ii(Dy.auth.oidcPostLoginV2,t),yield Ii(ig),yield ki(Io.setSSOState({loading:!1}))}catch(e){yield ki(Io.setSSOState({loading:!1,error:_f(e,"Failed to authenticate"),firstLoad:!1}))}}function*uS(){yield Aa(Io.loadSSOConfigurations,eS),yield Aa(Io.saveSSOConfigurations,oS),yield Aa(Io.saveSSOConfigurationsFile,tS),yield Aa(Io.saveSSOConfigurationsFileWithCallback,nS),yield Aa(Io.validateSSODomain,iS),yield Aa(Io.loadSSOAuthorizationRoles,aS),yield Aa(Io.updateSSOAuthorizationRoles,rS),yield Aa(Io.deleteSamlGroup,lS),yield Aa(Io.createSamlGroup,sS),yield Aa(Io.oidcPostlogin,cS)}function*dS(){yield ki(Io.setSSOState({loading:!0})),yield mt(),yield ki(Io.setSSOState({samlConfiguration:yf,loading:!1,firstLoad:!1}))}function*yS({payload:e}){const t="saving";yield ki(Io.setSSOState({error:void 0,[t]:!0}));const n=U({},yield Oi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield ki(Io.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*fS({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Go(e,Zg),r=gf.samlConfiguration,l=U({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield ki(Io.setSSOState({samlConfiguration:U({},r,l)})));yield ki(Io.setSSOState({error:void 0,[s]:!0})),yield mt(),l.acsUrl=null==ff||null==(t=ff.configuration)?void 0:t.acsUrl,l.spEntityId=null==ff||null==(n=ff.configuration)?void 0:n.spEntityId;const c=Jy(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 mt(),yield ki(Io.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==o||o(!0)}function*pS({payload:{callback:e}={}}){const t=gf.samlConfiguration;yield ki(Io.setSSOState({error:void 0,saving:!0})),yield mt(),yield ki(Io.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*gS(){yield mt(),yield ki(Io.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*SS({payload:{callback:e,authorizationRoles:t}}){yield ki(Io.setSSOState({error:void 0,saving:!0})),yield mt(),yield ki(Io.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*vS(){yield Aa(Io.loadSSOConfigurations,dS),yield Aa(Io.saveSSOConfigurations,fS),yield Aa(Io.saveSSOConfigurationsFile,yS),yield Aa(Io.validateSSODomain,pS),yield Aa(Io.loadSSOAuthorizationRoles,gS),yield Aa(Io.updateSSOAuthorizationRoles,SS)}const hS=["callback"],mS=["callback","ssoConfigId"],AS=["callback","ssoConfigId"],bS=["callback","ssoConfigId"];function*kS(){try{return yield Ii(Dy.auth.getOidcConfiguration)}catch(e){return null}}function*TS(){try{return yield Ii(Dy.metadata.getSamlMetadata)}catch(e){return null}}function*PS(){try{yield ki(Io.setSSOLoader({key:Ry.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Ti([Ii(kS),Ii(TS)]),n=yield Ii(Dy.auth.getSSOConfigurations);yield ki(Io.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield ki(Io.setSSOError({key:Ry.LOAD_SSO_CONFIGURATIONS,value:_f(e)}))}finally{yield ki(Io.setSSOLoader({key:Ry.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*IS({payload:e}){yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Go(e,hS),o=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield Ii(Dy.auth.createSSOConfiguration,U({},n,{enabled:null!=(i=n.enabled)&&i}));yield ki(Io.setSSOState({ssoConfigurations:[...o,e]})),null==t||t(e)}catch(e){yield ki(Io.setSSOError({key:Ry.SAVE_SSO_CONFIGURATION,value:_f(e)})),null==t||t(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION,value:!1}))}}function*ES({payload:e}){yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,o=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Xy(t),i=yield Ii(Dy.auth.createSSOConfigurationByMetadata,{metadata:e});yield ki(Io.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield ki(Io.setSSOError({key:Ry.SAVE_SSO_CONFIGURATION_BY_METADATA,value:_f(e)})),null==n||n(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*LS({payload:e}){yield ki(Io.setSSOLoader({key:Ry.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Go(e,mS),i=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ii(Dy.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t));yield ki(Io.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ki(Io.setSSOError({key:Ry.UPDATE_SSO_CONFIGURATION,value:_f(e)})),null==t||t(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*OS({payload:e}){yield ki(Io.setSSOLoader({key:Ry.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:o}=e,i=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Xy(o),a=yield Ii(Dy.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=i.map((e=>e.id===n?a:e));yield ki(Io.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield ki(Io.setSSOError({key:Ry.UPDATE_SSO_CONFIGURATION,value:_f(e)})),null==t||t(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*wS({payload:e}){yield ki(Io.setSSOLoader({key:Ry.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ii(Dy.auth.deleteSSOConfiguration,t),yield ki(Io.setSSOState({ssoConfigurations:o.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield ki(Io.setSSOError({key:Ry.DELETE_SSO_CONFIGURATION,value:_f(e)})),null==n||n(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.DELETE_SSO_CONFIGURATION,value:!1}))}}function*US({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Go(e,AS);yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_DOMAIN,value:!0}));const i=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ii(Dy.auth.createSSODomain,n,o),a=i.map((t=>t.id===n?U({},t,{domains:[...t.domains,e]}):t));yield ki(Io.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ki(Io.setSSOError({key:Ry.SAVE_SSO_DOMAIN,value:_f(e)})),null==t||t(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_DOMAIN,value:!1}))}}function*CS({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield ki(Io.setSSOLoader({key:Ry.DELETE_SSO_DOMAIN,value:!0}));const i=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ii(Dy.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?U({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield ki(Io.setSSOState({ssoConfigurations:e})),null==o||o(!0)}catch(e){yield ki(Io.setSSOError({key:Ry.DELETE_SSO_DOMAIN,value:_f(e)})),null==o||o(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.DELETE_SSO_DOMAIN,value:!1}))}}function*DS({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield ki(Io.setSSOLoader({key:Ry.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ii(Dy.auth.validateSSODomain,o,n);const e=i.map((e=>e.id===o?U({},e,{domains:e.domains.map((e=>e.id===n?U({},e,{validated:!0}):e))}):e));yield ki(Io.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield ki(Io.setSSOError({key:Ry.VALIDATE_SSO_DOMAIN,value:_f(e)})),null==t||t(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.VALIDATE_SSO_DOMAIN,value:!1}))}}function*_S({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield ki(Io.setSSOLoader({key:Ry.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ii(Dy.auth.setSSODefaultRoles,t,{roleIds:n});const i=o.map((e=>e.id===t?U({},e,{roleIds:n}):e));yield ki(Io.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield ki(Io.setSSOError({key:Ry.UPDATE_SSO_DEFAULT_ROLES,value:_f(t)})),null==e||e(null,t)}finally{yield ki(Io.setSSOLoader({key:Ry.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*RS({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_GROUPS,value:!0}));const i=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ti(t.map((e=>Ii(Dy.auth.deleteSSOGroup,n,e)))),yield Ti(e.map((e=>Ii(Dy.auth.createSSOGroup,n,e))));const a=yield Ii(Dy.auth.getSSOGroups,n),r=i.map((e=>e.id===n?U({},e,{groups:a}):e));yield ki(Io.setSSOState({ssoConfigurations:r})),null==o||o(!0)}catch(e){yield ki(Io.setSSOError({key:Ry.SAVE_SSO_GROUPS,value:_f(e)})),null==o||o(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_GROUPS,value:!1}))}}function*MS({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Ti(t.map((t=>Ii(Dy.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield ki(Io.setSSOError({key:Ry.SAVE_SSO_GROUPS,value:_f(e)})),null==n||n(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_GROUPS,value:!1}))}}function*NS({payload:e}){yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:o,callback:i}=e,a=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield Ii(ur,t,void 0,{responseType:"plain"}),configMetadata:n};let r,l;o?(r=yield Ii(Dy.auth.updateSSOConfigurationByMetadata,o,e),l=a.map((e=>e.id===o?r:e))):(r=yield Ii(Dy.auth.createSSOConfigurationByMetadata,e),l=[r,...a]),yield ki(Io.setSSOState({ssoConfigurations:l})),null==i||i(r)}catch(e){null==i||i(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*FS({payload:e}){yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Go(e,bS),i=yield Oi((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Ii(Dy.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t))):(e=yield Ii(Dy.auth.createSSOConfiguration,o),a=[e,...i]),yield ki(Io.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield ki(Io.setSSOLoader({key:Ry.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*GS(){yield Aa(Io.loadSSOConfigurationsV2,PS),yield Aa(Io.saveSSOConfigurationV2,IS),yield Aa(Io.saveSSODomain,US),yield Aa(Io.deleteSSODomain,CS),yield Aa(Io.validateSSODomainV2,DS),yield Aa(Io.updateSSOConfiguration,LS),yield Aa(Io.deleteSSOConfiguration,wS),yield Aa(Io.setSSOGroups,RS),yield Aa(Io.updateSSOGroups,MS),yield Aa(Io.setSSODefaultRoles,_S),yield Aa(Io.saveSSOConfigurationByMetadata,ES),yield Aa(Io.updateSSOConfigurationByMetadata,OS),yield Aa(Io.saveSSOConfigurationByUrl,NS),yield Aa(Io.saveSSOConfigurationByData,FS)}const $S=["callback","profilePictureUrl"],xS=["callback","profilePictureUrl"];function*VS(){yield ki(Io.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 Ii.apply(void 0,[ma,e,t,n].concat(i))}(3,2e3,Dy.teams.getProfile),t=yield Oi((e=>e.auth.user));Io.setUser(U({},t,e)),yield ki(Io.setProfileState({profile:e,loading:!1}))}catch(e){yield ki(Io.setProfileState({loading:!1,error:_f(e)}))}}function*jS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Go(e.payload,$S);yield ki(Io.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield Oi((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 Ii(Dy.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(i);n.searchParams.set("t",t),i=n.href}}const a=U({},e,o,{profilePictureUrl:i}),r=yield Ii(Dy.teams.updateProfile,a),l=yield Oi((e=>e.auth.user));yield ki(Io.setUser(U({},l,r))),yield ki(Io.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield ki(Io.setProfileState({saving:!1,error:_f(e),loading:!1})),null==t||t(null,e)}}function*WS({payload:e}){yield ki(Io.setProfileState({loading:!0}));try{var t;yield Ii(Dy.teams.changePassword,e),yield ki(Io.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ki(Io.setProfileState({loading:!1,error:_f(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*BS(){yield ka(Io.loadProfile,VS),yield Aa(Io.saveProfile,jS),yield Aa(Io.changePassword,WS)}function*KS(){yield ki(Io.setProfileState({loading:!0})),yield mt(),yield ki(Io.setUser(U({},af,of))),yield ki(Io.setProfileState({loading:!1,profile:of}))}function*zS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Go(e.payload,xS);yield ki(Io.setProfileState({saving:!0,error:null}));const i=rf;let a=i.profile.profilePictureUrl;n!==i.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=U({},i.profile,o,{profilePictureUrl:a}),l=af;yield mt(),yield ki(Io.setUser(U({},l,r))),yield ki(Io.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*qS({payload:e}){var t;yield ki(Io.setProfileState({loading:!0})),yield mt(),yield ki(Io.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*HS(){yield ka(Io.loadProfile,KS),yield Aa(Io.saveProfile,zS),yield Aa(Io.changePassword,qS)}const JS=["callback"],QS=["callback"],YS=["callback"],XS=["deviceId","callback"],ZS=["deviceId","callback"],ev=["callback"],tv=["deviceId"],nv=["deviceId"],ov=["callback"],iv=["deviceId"],av=["callback"];function*rv(e){const{step:t}=yield Oi((e=>e.auth.mfaState));return{step:e.recoveryCode?an.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*lv(){yield ki(Io.setMfaState({saving:!0}));try{const{qrCode:e}=yield Ii(Dy.auth.enrollMfa);yield ki(Io.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield ki(Io.setMfaState({saving:!1,error:_f(e)}))}}function*sv(e){let{payload:{callback:t}}=e,n=Go(e.payload,JS);yield ki(Io.setMfaState({saving:!0}));try{const e=yield Oi((e=>e.auth.user)),o=yield Ii(Dy.auth.verifyMfa,n),i=yield Ii(Dy.auth.getMFADevices),a=yield rv(o);yield ki(Io.setMfaState(U({},a,{mfaDevices:i}))),yield ki(Io.setUser(U({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield ki(Io.setMfaState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*cv(e){let{payload:{callback:t}}=e,n=Go(e.payload,QS);yield ki(Io.setMfaState({loading:!0}));try{const e=yield Ii(Dy.auth.loginWithMfa,n),o={step:an.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(o.recoveryCode=e.recoveryCode),yield ki(Io.setMfaState(o)),yield ki(Io.setState({user:e})),yield ki(Io.loadTenants()),null==t||t(o.recoveryCode)}catch(e){yield ki(Io.setMfaState({loading:!1,error:_f(e)})),null==t||t(null,e)}}function*uv({payload:e}){yield ki(Io.setMfaState({saving:!0}));try{var t;yield Ii(Dy.auth.disableMfa,e);const n=yield Ii(Dy.auth.getMFADevices);yield ki(Io.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ki(Io.setMfaState({saving:!1,error:_f(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*dv({payload:e}){yield ki(Io.setMfaState({saving:!0}));try{var t,n;const o=yield Ii(Dy.auth.preEnrollMFAWebAuthn),i=U({},o.options,{challenge:kt(o.options.challenge),user:U({},o.options.user,{id:kt(o.options.user.id)}),excludeCredentials:null==(t=o.options.excludeCredentials)?void 0:t.map((e=>U({},e,{id:kt(e.id)})))});yield ki(Io.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:i,webauthnToken:o.webauthnToken})}catch(t){var o;yield ki(Io.setMfaState({saving:!1,error:_f(t)})),null==(o=e.callback)||o.call(e,null,t)}}function*yv(e){let{payload:{callback:t}}=e,n=Go(e.payload,YS);yield ki(Io.setMfaState({saving:!0}));try{const e=Tt(n.publicKey),o=yield Ii(Dy.auth.enrollMFAWebAuthn,U({},n,{options:e})),i=yield Ii(Dy.auth.getMFADevices),a=yield rv(o);yield ki(Io.setMfaState(U({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield ki(Io.setMfaState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*fv(e){let{payload:{deviceId:t,callback:n}}=e;Go(e.payload,XS),yield ki(Io.setMfaState({saving:!0}));try{var o;const e=yield Ii(Dy.auth.preDisableMFAWebAuthn,t),i=U({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>U({},e,{id:kt(e.id)})))});yield ki(Io.setMfaState({saving:!1})),null==n||n({options:i,webauthnToken:e.webauthnToken})}catch(e){yield ki(Io.setMfaState({saving:!1,error:_f(e)})),null==n||n(null,e)}}function*pv(e){let{payload:{deviceId:t,callback:n}}=e,o=Go(e.payload,ZS);yield ki(Io.setMfaState({saving:!0}));try{const e=Tt(o.publicKey);yield Ii(Dy.auth.disableMFAWebAuthn,t,U({},o,{options:e}));const i=yield Ii(Dy.auth.getMFADevices);yield ki(Io.setMfaState({saving:!1,error:void 0,mfaDevices:i})),null==n||n(!0)}catch(e){yield ki(Io.setMfaState({saving:!1,error:_f(e)})),null==n||n(!1,e)}}function*gv({payload:e}){yield ki(Io.setMfaState({saving:!0}));try{var t;const n=yield Ii(Dy.auth.preEnrollMFASMS,e);yield ki(Io.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 ki(Io.setMfaState({saving:!1,error:_f(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Sv(e){let{payload:{callback:t}}=e,n=Go(e.payload,ev);yield ki(Io.setMfaState({saving:!0}));try{const e=yield Ii(Dy.auth.enrollMFASMS,n),o=yield Ii(Dy.auth.getMFADevices),i=yield rv(e);yield ki(Io.setMfaState(U({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield ki(Io.setMfaState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*vv(e){let{payload:{deviceId:t}}=e,n=Go(e.payload,tv);yield ki(Io.setMfaState({saving:!0}));try{var o;const e=yield Ii(Dy.auth.preDisableMFASMS,t);yield ki(Io.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 ki(Io.setMfaState({saving:!1,error:_f(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*hv(e){let{payload:{deviceId:t}}=e,n=Go(e.payload,nv);yield ki(Io.setMfaState({saving:!0}));try{var o;yield Ii(Dy.auth.disableMFASMS,t,n);const e=yield Ii(Dy.auth.getMFADevices);yield ki(Io.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield ki(Io.setMfaState({saving:!1,error:_f(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*mv(){yield ki(Io.setMfaState({loading:!0}));try{yield Oi((e=>e.auth.user));const e=yield Ii(Dy.auth.getMFADevices);yield ki(Io.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield ki(Io.setMfaState({loading:!1,error:_f(e)}))}}function*Av(){yield ki(Io.setMfaState({loading:!0}));try{const e=(yield Ii(Dy.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield ki(Io.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield ki(Io.setMfaState({loading:!1,error:_f(e)}))}}function*bv(){yield Aa(Io.enrollMfa,lv),yield Aa(Io.getMFADevices,mv),yield Aa(Io.getMFAStrategies,Av),yield Aa(Io.verifyMfa,sv),yield Aa(Io.disableMfa,uv),yield Aa(Io.verifyMfaAfterForce,cv),yield Aa(Io.preDisableMfaSms,vv),yield Aa(Io.disableMfaSms,hv),yield Aa(Io.preEnrollMfaSms,gv),yield Aa(Io.enrollMfaSms,Sv),yield Aa(Io.preEnrollMfaWebAuthn,dv),yield Aa(Io.enrollMfaWebAuthn,yv),yield Aa(Io.preDisableMfaWebAuthn,fv),yield Aa(Io.disableMfaWebAuthn,pv)}function*kv(){yield ki(Io.setMfaState({saving:!0})),yield ki(Io.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*Tv({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield Oi((e=>e.auth.mfaState));yield ki(Io.setMfaState({saving:!0})),yield mt();const n={token:"token",recoveryCode:"recoveryCode"},o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:U({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(o.recoveryCode=n.recoveryCode),yield ki(Io.setMfaState(o)),yield ki(Io.setUser(U({},af,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*Pv(e){let{payload:{callback:t}}=e,n=Go(e.payload,ov);yield ki(Io.setMfaState({loading:!0})),yield mt();const o=U({},n,{recoveryCode:"recoveryCode"}),i={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield ki(Io.setMfaState(i)),yield mt(),yield ki(Io.setUser(U({},af,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Iv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Oi((e=>e.auth.mfaState));yield ki(Io.setMfaState({saving:!0})),yield mt(),yield ki(Io.setMfaState({saving:!1,error:void 0,mfaDevices:U({},n,{authenticators:[]})})),yield ki(Io.setUser(U({},af))),null==(t=e.callback)||t.call(e,!0)}function*Ev(e){let{}=e,t=Go(e.payload,iv);yield ki(Io.setMfaState({saving:!0}));try{var n;yield ki(Io.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var o;yield ki(Io.setMfaState({saving:!1,error:_f(e)})),null==(o=t.callback)||o.call(t,!1,e)}}function*Lv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Oi((e=>e.auth.mfaState));yield ki(Io.setMfaState({saving:!0})),yield mt(),yield ki(Io.setMfaState({loading:!1,error:void 0,mfaDevices:U({},n,{phones:[]})})),yield ki(Io.setUser(U({},af))),null==(t=e.callback)||t.call(e,!0)}function*Ov({payload:e}){var t;yield ki(Io.setMfaState({saving:!0})),yield mt(),yield ki(Io.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*wv(e){let{payload:{callback:t}}=e;Go(e.payload,av);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Oi((e=>e.auth.mfaState));yield ki(Io.setMfaState({saving:!0})),yield mt();const o={token:"token",recoveryCode:"recoveryCode"},i={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:U({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield ki(Io.setMfaState(i)),yield ki(Io.setUser(U({},af,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Uv(){yield Aa(Io.enrollMfa,kv),yield Aa(Io.verifyMfa,Tv),yield Aa(Io.disableMfa,Iv),yield Aa(Io.verifyMfaAfterForce,Pv),yield Aa(Io.preDisableMfaSms,Ev),yield Aa(Io.disableMfaSms,Lv),yield Aa(Io.preEnrollMfaSms,Ov),yield Aa(Io.enrollMfaSms,wv)}const Cv=["callback"];function*Dv({payload:e}){yield ki(Io.setForgotPasswordState({loading:!0}));try{var t;yield Ii(Dy.auth.forgotPassword,e),yield ki(Io.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ki(Io.setForgotPasswordState({loading:!1,error:_f(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*_v(e){let{payload:{callback:t}}=e,n=Go(e.payload,Cv);yield ki(Io.setForgotPasswordState({loading:!0}));try{yield Ii(Dy.auth.resetPassword,n),yield ki(Io.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==t||t(!0)}catch(e){yield ki(Io.setForgotPasswordState({loading:!1,error:_f(e)})),null==t||t(!1,e)}}function*Rv({payload:e}){yield ki(Io.setForgotPasswordState({loading:!0}));try{const t=yield Ii(Dy.auth.loadPasswordConfig,e);yield ki(Io.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield ki(Io.setForgotPasswordState({loading:!1,error:_f(e)}))}}function*Mv(){yield ka(Io.forgotPassword,Dv),yield ka(Io.resetPassword,_v),yield ka(Io.loadPasswordConfig,Rv)}let Nv;!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"}(Nv||(Nv={}));const Fv=["callback","events"],Gv=["callback"],$v=["callback"];function*xv({payload:{userId:e,token:t}}){yield ki(Io.setActivateState({loading:!0,step:Nt.activating}));try{const{isAuthenticated:n}=yield Oi((e=>e.auth));n&&(yield ki(Io.silentLogout()));const o=yield Ii(Dy.auth.getActivateAccountStrategy,{userId:e,token:t});yield ki(Io.setActivateStrategyState({strategy:o,loading:!1,error:void 0})),o.shouldSetPassword&&(yield ki(Io.setActivateState({loading:!1,step:Nt.activatingForm})))}catch(e){yield ki(Io.setActivateState({loading:!1,error:_f(e)}))}}function*Vv(e){let{payload:{callback:t,events:n}}=e,o=Go(e.payload,Fv);yield ki(Io.setActivateState({loading:!0}));try{const e=Ta.onRedirectTo,{routes:a}=yield Oi((e=>e.auth)),r=yield Ii(Dy.auth.activateAccount,o);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(Xp(r)){yield ki(Io.setActivateState({step:Nt.success}));const t=yield tg(r);yield ki(Io.setState(t)),yield wi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var i;yield ki(Io.setActivateState({step:Nt.success}));const{user:e,tenants:t}=yield Ii(Dy.auth.generateLoginResponseV2,r);null==n||null==(i=n.userVerified)||i.call(n,{email:e.email,origin:Uf.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield ki(Io.setTenantsState({tenants:t,loading:!1})),yield ki(Io.setState({user:e,isAuthenticated:!0})),yield wi(1e3),yield Jp(),yield ki(Io.resetActivateState())}null==t||t(!0)}catch(e){yield ki(Io.setActivateState({loading:!1,error:_f(e)}))}}function*jv({payload:e}){const{callback:t}=e,n=Go(e,Gv);yield ki(Io.setActivateStrategyState({loading:!0}));try{const e=yield Ii(Dy.auth.getActivateAccountStrategy,n);yield ki(Io.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield ki(Io.setActivateStrategyState({loading:!1,error:_f(e)}))}}function*Wv({payload:e}){const{callback:t}=e,n=Go(e,$v);yield ki(Io.setTeamLoader({key:Nv.RESEND_ACTIVATE_LINK,value:n.email})),yield ki(Io.setActivateState({loading:!0}));try{yield Ii(Dy.auth.resendActivationEmail,n),yield ki(Io.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield ki(Io.setActivateState({loading:!1,error:_f(e)})),yield ki(Io.setTeamError({key:Nv.RESEND_ACTIVATE_LINK,value:_f(e)})),null==t||t(null,e)}yield ki(Io.setTeamLoader({key:Nv.RESEND_ACTIVATE_LINK,value:!1}))}function*Bv(){yield ka(Io.activateAccount,Vv),yield ka(Io.preActivateAccount,xv),yield ka(Io.getActivateAccountStrategy,jv),yield ka(Io.resendActivationEmail,Wv)}function*Kv({payload:e}){if(e.token&&e.userId)try{yield ki(Io.setAcceptInvitationState({error:void 0,step:xt.pending})),yield Ii(Dy.auth.acceptInvitation,e),yield ki(Io.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:xt.success}}))}catch(e){yield ki(Io.setAcceptInvitationState({step:xt.failed,error:_f(e)}))}else yield ki(Io.setAcceptInvitationState({error:void 0,step:xt.invalid}))}function*zv(){yield ka(Io.acceptInvitation,Kv)}var qv,Hv=new Uint8Array(16);function Jv(){if(!qv&&!(qv="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 qv(Hv)}for(var Qv=/^(?:[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,Yv=function(e){return"string"==typeof e&&Qv.test(e)},Xv=[],Zv=0;Zv<256;++Zv)Xv.push((Zv+256).toString(16).substr(1));var eh=function(e,t,n){var o=(e=e||{}).random||(e.rng||Jv)();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=(Xv[e[t+0]]+Xv[e[t+1]]+Xv[e[t+2]]+Xv[e[t+3]]+"-"+Xv[e[t+4]]+Xv[e[t+5]]+"-"+Xv[e[t+6]]+Xv[e[t+7]]+"-"+Xv[e[t+8]]+Xv[e[t+9]]+"-"+Xv[e[t+10]]+Xv[e[t+11]]+Xv[e[t+12]]+Xv[e[t+13]]+Xv[e[t+14]]+Xv[e[t+15]]).toLowerCase();if(!Yv(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let th,nh;!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"}(th||(th={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(nh||(nh={}));const oh=["callback"],ih=["roles"],ah=["callback"],rh=["callback","profileImage"],lh=["callback"],sh=["callback","userId"],ch=["callback"],uh=["callback"],dh=["callback"],yh=["callback"],fh=["callback"],ph=["callback"],gh=["callback"],Sh=["callback","profileImage"],vh=["callback"],hh=["callback"],mh=["callback"],Ah=["callback"],bh=["callback"],kh=["callback"],Th=()=>Oi((e=>e.auth.teamState));function*Ph(){try{const{groups:e}=yield Ii(Dy.groups.getGroups,{_groupsRelations:nh.roles});return e}catch(e){return[]}}function*Ih({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield Th(),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 ki(Io.setTeamLoader({key:Nv.USERS,value:!a})),yield ki(Io.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:o},{items:i},a]=yield Ti([Ii(Dy.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Ii(Dy.teams.loadAvailableRoles),Ii(Dy.teams.loadAvailablePermissions),Ii(Ph)]),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 U({},e,{groups:n})}));yield ki(Io.setTeamState({users:l,totalPages:t,totalItems:n,roles:o,permissions:i})),null==r||r(e)}catch(e){yield ki(Io.setTeamError({key:Nv.USERS,value:_f(e)})),yield ki(Io.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield ki(Io.setTeamLoader({key:Nv.USERS,value:!1}))}function*Eh({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield Th(),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 ki(Io.setTeamLoader({key:Nv.USERS,value:!r})),yield ki(Io.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:o},{items:i}]=yield Ti([Ii(Dy.subTenants.loadAllUsers,U({},c)),Ii(Dy.teams.loadAvailableRoles),Ii(Dy.teams.loadAvailablePermissions)]);yield ki(Io.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==l||l(e)}catch(e){yield ki(Io.setTeamError({key:Nv.USERS,value:_f(e)})),yield ki(Io.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield ki(Io.setTeamLoader({key:Nv.USERS,value:!1}))}function*Lh({payload:e}){yield ki(Io.setTeamLoader({key:Nv.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield Ti([Ii(Dy.teams.loadAvailableRoles),Ii(Dy.teams.loadAvailablePermissions)]);yield ki(Io.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 ki(Io.setTeamError({key:Nv.ROLES_AND_PERMISSIONS,value:_f(t)}))}yield ki(Io.setTeamLoader({key:Nv.ROLES_AND_PERMISSIONS,value:!0}))}function*Oh({payload:e}){const{callback:t}=e,n=Go(e,oh),o=yield Th();yield ki(Io.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield Ii(Dy.teams.addUser,n),{roles:a}=e,r=U({},Go(e,ih),{roleIds:null!=(i=null==a?void 0:a.map((e=>e.id)))?i:[]});null==t||t(r),yield ki(Io.setTeamState({users:[r,...o.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ki(Io.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!1,error:_f(e)})})),null==t||t(null,e)}}function*wh({payload:e}){const{callback:t}=e,n=yield Th();yield ki(Io.setTeamState({addUserDialogState:U({},n.addUserDialogState,{loading:!0})}));const o=[],i=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield ki(Io.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Ii(Dy.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 ki(Io.loadUsers(r)),yield ki(Io.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:i,allowedEmails:o})}function*Uh({payload:e}){const{callback:t}=e,n=Go(e,ah),o=yield Th();yield ki(Io.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{yield Ii(Dy.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield Ii(Dy.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield ki(Io.setTeamState({allUsers:e,totalPages:o,totalItems:i,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield ki(Io.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!1,error:_f(e)})})),null==t||t(null,e)}}function*Ch({payload:e}){const{callback:t}=e,n=Go(e,rh),{id:o}=n,i=yield Th(),a=i.users.find((e=>e.id===n.id));yield ki(Io.setTeamLoader({key:Nv.UPDATE_USER,value:o||""})),yield ki(Io.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})})),yield ki(Io.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0}),users:i.users.map((e=>e.id===n.id?U({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield Ii(Dy.teams.updateUser,n);null==t||t(e),yield ki(Io.setTeamState({users:i.users.map((t=>t.id===e.id?U({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield ki(Io.setTeamLoader({key:Nv.UPDATE_USER,value:!1}))}catch(e){yield ki(Io.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:_f(e)}),users:i.users.map((e=>e.id===n.id?U({},e,a):e))})),yield ki(Io.setTeamLoader({key:Nv.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*Dh({payload:e}){const{callback:t}=e,n=Go(e,lh),o=yield Th();yield ki(Io.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Ii(Dy.teams.deleteUser,n),null==t||t(!0),yield ki(Io.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ki(Io.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!1,error:_f(e)})})),null==t||t(null,e)}}function*_h({payload:e}){const{callback:t,userId:n}=e,o=Go(e,sh),i=yield Th();yield ki(Io.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})}));try{yield Ii(Dy.subTenants.setUserRolesForSubTenants,n,o);const e=i.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return U({},e,{roles:(null==(t=o.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>i.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield ki(Io.setTeamState({allUsers:[...i.allUsers.filter((e=>e.id!==n)),...e?[U({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield ki(Io.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:_f(e)})})),null==t||t(null,e)}}function*Rh({payload:e}){const{callback:t}=e,n=Go(e,ch),o=yield Th();yield ki(Io.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Ii(Dy.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield ki(Io.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ki(Io.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!1,error:_f(e)})})),null==t||t(null,e)}}function*Mh({payload:e}){const{callback:t}=e,n=Go(e,uh);yield ki(Io.setTeamLoader({key:Nv.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Ii(Dy.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield ki(Io.setTeamError({key:Nv.RESEND_ACTIVATE_LINK,value:_f(e)})),null==t||t(null,e)}yield ki(Io.setTeamLoader({key:Nv.RESEND_ACTIVATE_LINK,value:!1}))}function*Nh({payload:e}){const{callback:t}=e,n=Go(e,dh);yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:n.email}));try{yield Ii(Dy.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield ki(Io.setTeamError({key:Nv.RESEND_INVITATION_LINK,value:_f(e)})),null==t||t(null,e)}yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:!1}))}function*Fh({payload:e}){const{callback:t}=e,n=Go(e,yh);yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:n.email}));try{yield Ii(Dy.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield ki(Io.setTeamError({key:Nv.RESEND_INVITATION_LINK,value:_f(e)})),null==t||t(null,e)}yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:!1}))}function*Gh({payload:e}){const{callback:t}=e,n=Go(e,fh);yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:n.email}));try{yield Ii(Dy.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield ki(Io.setTeamError({key:Nv.RESEND_INVITATION_LINK,value:_f(e)})),null==t||t(null,e)}yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:!1}))}function*$h(){yield ki(Io.setTeamError({key:Nv.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Ii(Dy.teams.getInviteLinkConfiguration);yield ki(Io.setTeamState({inviteTokenState:U({},e)}))}catch(e){yield ki(Io.setTeamError({key:Nv.CONFIG_TOKEN_LINK,value:_f(e)}))}}function*xh(){yield ki(Io.setTeamError({key:Nv.GET_TOKEN_LINK,value:!1}));try{yield Ii($h);const e=yield Ii(Dy.teams.getInviteUserLink),{inviteTokenState:t}=yield Th();yield ki(Io.setTeamState({inviteTokenState:U({},t,e)}))}catch(e){yield ki(Io.setTeamError({key:Nv.GET_TOKEN_LINK,value:_f(e)}))}}function*Vh({payload:{callback:e}}){yield ki(Io.setTeamError({key:Nv.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield Th();try{const n=yield Ii(Dy.teams.createInviteUserLink,{expiresInMinutes:43200});yield ki(Io.setTeamState({inviteTokenState:U({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield ki(Io.setTeamError({key:Nv.CREATE_TOKEN_LINK,value:_f(t)}))}}function*jh({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield Th();yield ki(Io.setTeamError({key:Nv.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield Ii(Dy.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield ki(Io.setTeamState({inviteTokenState:U({},o,i)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield ki(Io.setTeamError({key:Nv.UPDATE_TOKEN_LINK,value:_f(t)}))}}function*Wh({payload:e}){const{callback:t}=null!=e?e:{};yield ki(Io.setTeamError({key:Nv.DELETE_TOKEN_LINK,value:!1}));try{yield Ii(Dy.teams.deleteInviteUserLink),yield ki(Io.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield ki(Io.setTeamError({key:Nv.DELETE_TOKEN_LINK,value:_f(e)})),null==t||t(!1,e)}}function*Bh({payload:e}){yield ki(Io.setTeamState({addUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*Kh({payload:e}){const t=yield Th(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield ki(Io.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*zh({payload:e}){yield ki(Io.setTeamState({deleteUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*qh({payload:e}){const t=yield Th(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield ki(Io.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Hh(){yield ba(Io.loadUsers,Ih),yield ba(Io.loadAllSubTenantsUsers,Eh),yield ba(Io.loadRoles,Lh),yield Aa(Io.addUser,Oh),yield Aa(Io.addUsersBulk,wh),yield Aa(Io.addUserToSubTenants,Uh),yield Aa(Io.updateUser,Ch),yield Aa(Io.setUserRolesForSubTenants,_h),yield Aa(Io.deleteUser,Dh),yield Aa(Io.deleteUserFromSubTenants,Rh),yield Aa(Io.resendActivationLink,Mh),yield Aa(Io.resendInvitationLink,Nh),yield Aa(Io.resendInvitationEmail,Fh),yield Aa(Io.resendInvitationLinkToAllSubTenants,Gh),yield Aa(Io.getInvitationLink,xh),yield Aa(Io.createInvitationLink,Vh),yield Aa(Io.updateInvitationLink,jh),yield Aa(Io.deleteInvitationLink,Wh),yield Aa(Io.openAddUserDialog,Bh),yield Aa(Io.closeAddUserDialog,Kh),yield Aa(Io.openDeleteUserDialog,zh),yield Aa(Io.closeDeleteUserDialog,qh)}function*Jh({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield Th(),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 ki(Io.setTeamLoader({key:Nv.USERS,value:!a})),yield ki(Io.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield mt(),yield ki(Io.setTeamState({users:Af,totalPages:2,totalItems:10,roles:pf,permissions:Sf})),yield ki(Io.setTeamLoader({key:Nv.USERS,value:!1})),null==r||r(Af)}function*Qh({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield Th(),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 ki(Io.setTeamLoader({key:Nv.USERS,value:!r})),yield ki(Io.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield mt(),yield ki(Io.setTeamState({allUsers:bf,totalPages:2,totalItems:10,roles:pf,permissions:Sf})),yield ki(Io.setTeamLoader({key:Nv.USERS,value:!1})),null==l||l(bf)}function*Yh({payload:e}){var t;yield ki(Io.setTeamLoader({key:Nv.ROLES_AND_PERMISSIONS,value:!0})),yield mt(),yield ki(Io.setTeamState({roles:pf,permissions:Sf})),yield ki(Io.setTeamLoader({key:Nv.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:pf,permissions:Sf})}function*Xh({payload:e}){const{callback:t}=e,n=Go(e,ph),o=yield Th();yield ki(Io.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield mt();const i=U({},hf,{groups:[]},n,{id:`${eh()}`});null==t||t(i),yield ki(Io.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*Zh({payload:e}){const{callback:t}=e,n=Go(e,gh),o=yield Th();yield ki(Io.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield mt();const i=U({},hf,n,{id:`${eh()}`});yield ki(Io.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*em({payload:e}){var t;const{callback:n}=e,o=Go(e,Sh),{id:i}=o,a=yield Th(),r=a.users.find((e=>e.id===o.id));yield ki(Io.setTeamLoader({key:Nv.UPDATE_USER,value:i||""})),yield ki(Io.setTeamState({addUserDialogState:U({},a.addUserDialogState,{loading:!0})})),yield ki(Io.setTeamState({addUserDialogState:U({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===o.id?U({},e,o):e))})),r.roleIds.length>0&&0===(null==(t=o.roleIds)?void 0:t.length)&&(o.roleIds=[""]),yield mt();const l=U({},r,o);null==n||n(l),yield ki(Io.setTeamState({users:a.users.map((e=>e.id===l.id?U({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield ki(Io.setTeamLoader({key:Nv.UPDATE_USER,value:!1}))}function*tm({payload:e}){const{callback:t}=e,n=Go(e,vh),o=yield Th();yield ki(Io.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield ki(Io.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*nm({payload:e}){const{callback:t}=e,n=Go(e,hh),o=yield Th();yield ki(Io.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield ki(Io.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*om({payload:e}){const{callback:t}=e,n=Go(e,mh);yield ki(Io.setTeamLoader({key:Nv.RESEND_ACTIVATE_LINK,value:n.userId})),yield mt(),null==t||t(!0),yield ki(Io.setTeamLoader({key:Nv.RESEND_ACTIVATE_LINK,value:!1}))}function*im({payload:e}){const{callback:t}=e,n=Go(e,Ah);yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:!1}))}function*am({payload:e}){const{callback:t}=e,n=Go(e,bh);yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:!1}))}function*rm({payload:e}){const{callback:t}=e,n=Go(e,kh);yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield ki(Io.setTeamLoader({key:Nv.RESEND_INVITATION_LINK,value:!1}))}function*lm(){yield ba(Io.loadUsers,Jh),yield ba(Io.loadAllSubTenantsUsers,Qh),yield ba(Io.loadRoles,Yh),yield Aa(Io.addUser,Xh),yield Aa(Io.addUserToSubTenants,Zh),yield Aa(Io.updateUser,em),yield Aa(Io.deleteUser,tm),yield Aa(Io.deleteUserFromSubTenants,nm),yield Aa(Io.resendActivationLink,om),yield Aa(Io.resendInvitationLink,im),yield Aa(Io.resendInvitationEmail,am),yield Aa(Io.resendInvitationLinkToAllSubTenants,rm),yield Aa(Io.openAddUserDialog,Bh),yield Aa(Io.closeAddUserDialog,Kh),yield Aa(Io.openDeleteUserDialog,zh),yield Aa(Io.closeDeleteUserDialog,qh)}const sm=["authorizationUrl"],cm=["events","url"];function*um(){try{yield ki(Io.setSocialLoginsState({loading:!0}));const e=yield Ii(Dy.auth.getSocialLoginProviders);yield ki(Io.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield ki(Io.setSocialLoginsState({error:_f(e),loading:!1,firstLoad:!1}))}}function*dm(){try{const e=yield Oi((e=>e.root.context));yield ki(Io.setSocialLoginsState({loading:!0}));const t=yield Ii(Dy.auth.getSocialLoginProvidersV2),{providers:n}=yield Ii(Dy.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Go(t,sm);const i=lr(e,null!=n?n:"");return U({},o,{authorizationUrl:n?`${i}${n}`:null})}));yield ki(Io.setSocialLoginsState({socialLoginsConfigV2:o,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield ki(Io.setSocialLoginsState({error:_f(e),loading:!1,firstLoad:!1}))}}function*ym(e){let{payload:{events:t,url:n}}=e,o=Go(e.payload,cm);try{yield ki(Io.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Ii(Dy.auth.loginViaSocialLogin,o);var i,a;r&&(null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,url:n,authenticationType:Cf.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:o.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:Uf.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield ki(Io.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield Oi((e=>e.auth));e?yield Ii(rg):yield Ii(sg),yield og()}(),localStorage.removeItem("register-quick-login"),yield ki(Io.setSocialLoginsState({loading:!1}))}catch(e){yield ki(Io.setSocialLoginsState({loading:!1,error:_f(e,"Failed to authenticate"),firstLoad:!1}))}}function*fm({payload:e}){yield ki(Io.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*pm(){yield ka(Io.loadSocialLoginsConfiguration,um),yield ka(Io.loadSocialLoginsConfigurationV2,dm),yield ka(Io.loginViaSocialLogin,ym),yield ba(Io.setSocialLoginError,fm)}let gm;function*Sm({payload:e}){const{description:t,expires:n,callback:o}=e,{apiTokensDataUser:i}=yield Oi((e=>e.auth.apiTokensState));try{let e,a;yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield Ii(Dy.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield Ii(Dy.auth.updateUserApiTokensData,{description:t}),yield ki(Io.setApiTokensState({showAddTokenDialog:!1})),yield wi(200),yield ki(Io.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield ki(Io.setApiTokensError({key:gm.ADD_API_TOKEN,value:_f(e)})),yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*vm({payload:e}){const{description:t,roleIds:n,expires:o,callback:i}=e,{apiTokensDataTenant:a}=yield Oi((e=>e.auth.apiTokensState));try{let e,r;yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield Ii(Dy.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield Ii(Dy.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield ki(Io.setApiTokensState({showAddTokenDialog:!1})),yield wi(200),yield ki(Io.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===o?e.clientId:void 0}})),yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield ki(Io.setApiTokensError({key:gm.ADD_API_TOKEN,value:_f(e)})),yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*hm({payload:e}){const{apiTokensDataUser:t}=yield Oi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!0})),n?(yield Ii(Dy.auth.deleteUserAccessToken,{id:e}),yield ki(Io.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Ii(Dy.auth.deleteUserApiToken,{tokenId:e}),yield ki(Io.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!1}))}catch(e){yield ki(Io.setApiTokensError({key:gm.DELETE_API_TOKEN,value:_f(e)})),yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!1}))}}function*mm({payload:e}){const{apiTokensDataTenant:t}=yield Oi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let o=t;try{yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!0})),n?(yield Ii(Dy.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield Ii(Dy.auth.deleteTenantApiToken,{tokenId:e}),o=t.filter((t=>t.clientId!==e))),yield ki(Io.setApiTokensState({apiTokensDataTenant:o,deleteTokenDialog:{open:!1,id:e}})),yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!1}))}catch(e){yield ki(Io.setApiTokensError({key:gm.DELETE_API_TOKEN,value:_f(e)})),yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!1}))}}function*Am({payload:e}){null!=e&&e.silentLoading||(yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield Ti([Ii(Dy.auth.getUserApiTokensData),Ii(Dy.auth.getTenantApiTokensData)]);yield ki(Io.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ki(Io.setApiTokensError({key:gm.LOAD_API_TOKENS,value:_f(t)})),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*bm({payload:e}){null!=e&&e.silentLoading||(yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Ii(Dy.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=Ii(Dy.auth.getUserAccessTokensData))?n:[]).accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield ki(Io.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield ki(Io.setApiTokensError({key:gm.LOAD_API_TOKENS,value:_f(t)})),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*km({payload:e}){null!=e&&e.silentLoading||(yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Ii(Dy.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Ii(Dy.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 ki(Io.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield ki(Io.setApiTokensError({key:gm.LOAD_API_TOKENS,value:_f(t)})),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Tm(){yield ka(Io.loadApiTokens,Am),yield ka(Io.loadUserApiTokens,bm),yield ka(Io.loadTenantApiTokens,km),yield Aa(Io.addUserApiToken,Sm),yield Aa(Io.addTenantApiToken,vm),yield ba(Io.deleteTenantApiToken,mm),yield ba(Io.deleteUserApiToken,hm)}function*Pm({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield Oi((e=>e.auth.apiTokensState)),a=U({},tf,{description:t,roleIds:n,clientId:`CLIENT_ID_${eh()}`});yield ki(Io.setApiTokensState({showAddTokenDialog:!1})),yield wi(200),yield ki(Io.setApiTokensState({apiTokensDataTenant:[...i,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield wi(200),yield ki(Io.setApiTokensLoader({key:gm.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*Im({payload:e}){yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!0})),yield wi(200);const t=[tf];yield ki(Io.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ki(Io.setApiTokensLoader({key:gm.DELETE_API_TOKEN,value:!1}))}function*Em({payload:e}){var t;null!=e&&e.silentLoading||(yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!0})));const n=[ef],o=[tf];yield ki(Io.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield wi(200),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Lm({payload:e}){var t;null!=e&&e.silentLoading||(yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!0})));const n=[ef];yield ki(Io.setApiTokensState({apiTokensDataUser:n})),yield wi(200),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Om({payload:e}){var t;null!=e&&e.silentLoading||(yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!0})));const n=[tf];yield ki(Io.setApiTokensState({apiTokensDataTenant:n})),yield wi(200),yield ki(Io.setApiTokensLoader({key:gm.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*wm(){yield ka(Io.loadApiTokens,Em),yield ka(Io.loadUserApiTokens,Lm),yield ka(Io.loadTenantApiTokens,Om),yield Aa(Io.addTenantApiToken,Pm),yield ba(Io.deleteTenantApiToken,Im)}function*Um({payload:e}){try{var t;yield ki(Io.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Oi((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Ii(Dy.accountSettings.updateSettings,U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield ki(Io.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield ki(Io.setAccountSettingsState({loading:!1,error:_f(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Cm({payload:e}){yield ki(Io.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Ii(Dy.accountSettings.getSettings);yield ki(Io.setAccountSettingsState(U({},e,{loading:!1})))}catch(e){yield ki(Io.setAccountSettingsState({loading:!1,error:_f(e)}))}}function*Dm(){yield ka(Io.saveAccountSettings,Um),yield ka(Io.loadAccountSettings,Cm)}function*_m({payload:e}){var t;yield ki(Io.setAccountSettingsState({loading:!0})),yield mt();const{accountSettingsState:n}=yield Oi((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield ki(Io.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*Rm({payload:e}){yield ki(Io.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield mt(),yield ki(Io.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Mm(){yield ka(Io.saveAccountSettings,_m),yield ka(Io.loadAccountSettings,Rm)}function*Nm({payload:{tenantId:e,callback:t}}){yield ki(Io.setState({isLoading:!0}));try{yield Ii(Dy.tenants.switchTenant,{tenantId:e}),yield Ii(ig),(null==t?void 0:t(!0))||(yield ki(Io.setState({isLoading:!1})))}catch(e){yield ki(Io.setState({isLoading:!1})),null==t||t(!1,e)}}function*Fm({payload:e}){yield ki(Io.setTenantsState({loading:!0}));try{var t;const n=yield Ii(Dy.tenants.getTenants);yield ki(Io.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 ki(Io.setTenantsState({loading:!1}))}}function*Gm({payload:e}){yield ki(Io.setTenantsState({loading:!0}));try{var t;const n=yield Ii(Dy.tenants.getSubTenants);yield ki(Io.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ki(Io.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*$m({payload:e}){yield ki(Io.setTenantsState({loading:!0}));try{var t;const n=yield Ii(Dy.tenants.getSubTenantsAsTree);yield ki(Io.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ki(Io.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*xm(){yield Aa(Io.loadTenants,Fm),yield Aa(Io.loadSubTenants,Gm),yield Aa(Io.switchTenant,Nm),yield Aa(Io.loadSubTenantsTree,$m)}function*Vm(){yield ki(Io.setTenantsState({loading:!0})),yield mt(),yield ki(Io.setTenantsState({tenants:kf,loading:!1}))}function*jm(){yield Aa(Io.loadTenants,Vm)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(gm||(gm={}));const Wm=["callback"],Bm=["callback"],Km=["callback"],zm=["callback"],qm=["callback"];function*Hm({payload:e}){var t;yield ki(Io.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Ti([Ii(Dy.roles.getRoles),Ii(Dy.roles.getPermissions),Ii(Dy.roles.getPermissionCategories)]),[t,n,o]=e;yield ki(Io.setRolesState({roles:t,permissions:n,permissionCategories:o,loading:!1}))}catch(e){yield ki(Io.setRolesState({error:_f(e),loading:!1}))}}function*Jm(e){let{payload:{callback:t}}=e,n=Go(e.payload,Wm);yield ki(Io.setRolesState({saving:!0}));try{const e=yield Ii(Dy.roles.addRole,n),o=yield Ii(Dy.roles.getRoles);yield ki(Io.loadRolesAndPermissions({silentLoading:!0})),yield ki(Io.setRolesState({roles:o,saving:!1})),null==t||t(e)}catch(e){yield ki(Io.setRolesState({error:_f(e),saving:!1})),null==t||t(null,e)}}function*Qm(e){let{payload:{callback:t}}=e,n=Go(e.payload,Bm);yield ki(Io.setRolesState({saving:!0}));try{yield Ii(Dy.roles.deleteRole,n),yield ki(Io.loadRolesAndPermissions({silentLoading:!0})),yield ki(Io.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield ki(Io.setRolesState({error:_f(e),saving:!1})),null==t||t(!1,e)}}function*Ym(e){let{payload:{callback:t}}=e,n=Go(e.payload,Km);yield ki(Io.setRolesState({saving:!0}));try{const e=yield Ii(Dy.roles.updateRole,n);yield ki(Io.loadRolesAndPermissions({silentLoading:!0})),yield ki(Io.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ki(Io.setRolesState({error:_f(e),saving:!1})),null==t||t(null,e)}}function*Xm(e){let{payload:{callback:t}}=e,n=Go(e.payload,zm);yield ki(Io.setRolesState({saving:!0}));try{const e=yield Ii(Dy.roles.attachPermissionsToRole,n);yield ki(Io.loadRolesAndPermissions({silentLoading:!0})),yield ki(Io.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ki(Io.setRolesState({error:_f(e),saving:!1})),null==t||t(null,e)}}function*Zm(e){let{payload:{callback:t}}=e,n=Go(e.payload,qm);yield ki(Io.setRolesState({saving:!0}));try{const e=yield Ii(Dy.roles.attachPermissionToRoles,n);yield ki(Io.loadRolesAndPermissions({silentLoading:!0})),yield ki(Io.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ki(Io.setRolesState({error:_f(e),saving:!1})),null==t||t(null,e)}}function*eA(){yield ka(Io.loadRolesAndPermissions,Hm),yield Aa(Io.addRole,Jm),yield Aa(Io.deleteRole,Qm),yield Aa(Io.updateRole,Ym),yield Aa(Io.attachPermissionsToRole,Xm),yield Aa(Io.attachPermissionToRoles,Zm)}function*tA({payload:e}){var t;yield ki(Io.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield ki(Io.setRolesState({roles:nf,loading:!1}))}catch(e){yield ki(Io.setRolesState({error:_f(e),loading:!1}))}}function*nA(){yield ka(Io.loadRolesAndPermissions,tA)}const oA=["callback"],iA=["callback"],aA=["callback"];function*rA(e){let{payload:{callback:t}}=e,n=Go(e.payload,oA);yield ki(Io.setResetPhoneNumberState({loading:!0}));try{const e=yield Ii(Dy.auth.resetPhoneNumber,n);yield ki(Io.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),yield ki(Io.setLoginState({email:n.email}))}catch(e){yield ki(Io.setResetPhoneNumberState({loading:!1,error:_f(e)})),null==t||t(null,e)}}function*lA(e){let{payload:{callback:t}}=e,n=Go(e.payload,iA);yield ki(Io.setResetPhoneNumberState({loading:!0}));try{const e=yield Ii(Dy.auth.verifyResetPhoneNumber,n);yield ki(Io.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Ht.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield ki(Io.setResetPhoneNumberState({loading:!1,error:_f(e)})),null==t||t(null,e)}}function*sA(e){let{payload:{callback:t}}=e,n=Go(e.payload,aA);yield ki(Io.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:o}=yield Oi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Ii(Dy.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield ki(Io.setLoginState({step:Pt.loginWithSmsOtc})),yield ki(Io.passwordlessPreLogin({type:Xr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(o.loginUrl),yield ki(Io.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setResetPhoneNumberState({loading:!1,error:_f(e)})),null==t||t(null,e)}}function*cA(){yield ka(Io.resetPhoneNumber,rA),yield ka(Io.verifyResetPhoneNumber,lA),yield ka(Io.changePhoneNumber,sA)}function*uA(){yield ki(Io.setSessionsState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getCurrentUserSessions);yield ki(Io.setSessionsState({sessions:e,loading:!1}))}catch(e){yield ki(Io.setSessionsState({error:e,loading:!1}))}}function*dA(){yield ki(Io.setSessionsState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getCurrentUserSession);yield ki(Io.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield ki(Io.setSessionsState({error:e,loading:!1}))}}function*yA({payload:{id:e}}){yield ki(Io.setSessionsState({loading:!0,error:null}));try{yield Ii(Dy.auth.deleteSessionForUser,e),yield ki(Io.loadUserSessions())}catch(e){yield ki(Io.setSessionsState({error:e,loading:!1}))}}function*fA({payload:{callback:e,userId:t}}){yield ki(Io.setSessionsState({loading:!0,error:null}));try{yield Ii(Dy.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield ki(Io.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*pA(){yield ki(Io.setSessionsState({loading:!0,error:null}));try{yield Ii(Dy.auth.deleteAllSessionsForUser),yield ki(Io.loadUserSessions())}catch(e){yield ki(Io.setSessionsState({error:e,loading:!1}))}}function*gA(){yield ba(Io.loadUserSessions,uA),yield ba(Io.deleteUserSession,yA),yield ba(Io.deleteAllUserSessions,pA),yield ba(Io.loadCurrentUserSession,dA),yield Aa(Io.revokeUserSessions,fA)}function*SA(){yield ki(Io.setSessionsState({loading:!0,error:null})),yield ki(Io.setSessionsState({sessions:Tf,loading:!1}))}function*vA({payload:{id:e}}){yield ki(Io.setSessionsState({loading:!0,error:null}));const t=(yield Oi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield ki(Io.setSessionsState({sessions:t,loading:!1}))}function*hA(){yield ki(Io.setSessionsState({loading:!0,error:null}));const e=Tf.filter((e=>e.current));yield ki(Io.setSessionsState({sessions:e,loading:!1}))}function*mA(){yield ba(Io.loadUserSessions,SA),yield ba(Io.deleteUserSession,vA),yield ba(Io.deleteAllUserSessions,hA)}const AA=["callback"],bA=["callback"];function*kA(){yield ki(Io.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getSessionConfigurations);yield ki(Io.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield ki(Io.setSessionsState({error:e,loading:!1}))}}function*TA({payload:e}){yield ki(Io.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Go(e,AA);yield Ii(Dy.auth.createOrUpdateSessionConfigrations,n),yield ki(Io.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield ki(Io.setSessionsPolicyState({error:e,loading:!1}))}}function*PA(){yield ka(Io.loadSessionsPolicy,kA),yield ba(Io.createOrUpdateSessionsPolicy,TA)}function*IA(){yield ki(Io.setSessionsPolicyState({loading:!0,error:null}));const e=yield Oi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Pf}));yield ki(Io.setSessionsPolicyState(U({},e,{loading:!1})))}function*EA({payload:e}){yield ki(Io.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Go(e,bA);null==t||t(!0),yield ki(Io.setSessionsPolicyState({configurations:n,loading:!1}))}function*LA(){yield ka(Io.loadSessionsPolicy,IA),yield ba(Io.createOrUpdateSessionsPolicy,EA)}const OA=["callback"],wA=["callback"],UA=["callback"],CA=["callback"],DA=["callback"],_A=["callback"],RA=["callback"],MA=["callback"],NA=()=>Oi((e=>e.auth.restrictionsState.ipRestrictions)),FA=()=>Oi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*GA(){yield ki(Io.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Ii(Dy.auth.getDomainRestrictionsConfig),t=(yield Ii(Dy.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ki(Io.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield ki(Io.setEmailDomainRestrictionsState({error:_f(e),loading:!1}))}}function*$A(e){let{payload:{callback:t}}=e,n=Go(e.payload,OA);yield ki(Io.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield FA();try{var i;yield Ii(Dy.auth.createDomainRestriction,n);const e=(yield Ii(Dy.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=o.data)?void 0:t.config.listType)}));yield ki(Io.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 ki(Io.setEmailDomainRestrictionsState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*xA(e){let{payload:{callback:t}}=e,n=Go(e.payload,wA);yield ki(Io.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Ii(Dy.auth.updateDomainRestrictionConfig,n),o=(yield Ii(Dy.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ki(Io.setEmailDomainRestrictionsState({data:{config:e,restrictions:o},saving:!1})),null==t||t(!0)}catch(e){yield ki(Io.setEmailDomainRestrictionsState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*VA({payload:{id:e}}){yield ki(Io.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield FA();try{var n;yield Ii(Dy.auth.deleteDomainRestriction,e);const o=(yield Ii(Dy.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield ki(Io.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:o},saving:!1}))}catch(e){yield ki(Io.setEmailDomainRestrictionsState({saving:!1,error:_f(e)}))}}const jA=e=>{var t,n,o;return{_filter:null!=(t=null==e?void 0:e._filter)?t:xn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(o=null==e?void 0:e._offset)?o:0}};function*WA(){yield ki(Io.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield NA(),t=yield Ii(Dy.auth.getIPRestrictionsConfig),n=jA({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield Ii(Dy.auth.getIPRestrictions,n);yield ki(Io.setIpRestrictionsState({data:{restrictions:o,config:t},totalPages:i,pagination:n,loading:!1}))}catch(e){yield ki(Io.setIpRestrictionsState({error:_f(e),loading:!1}))}}function*BA(){try{const{valid:e}=yield Ii(Dy.auth.testCurrentIpInAllowList);yield ki(Io.setIpRestrictionsState({userIpValid:e}))}catch(e){yield ki(Io.setIpRestrictionsState({error:_f(e)}))}}function*KA({payload:{callback:e}}){yield ki(Io.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Oi((e=>e.auth.userIp));yield Ti([Ii(Dy.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:xn.ALLOW}),Ii(Dy.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield NA(),o=jA(n.pagination),{items:i,_metadata:{totalPages:a}}=yield Ii(Dy.auth.getIPRestrictions,o);yield ki(Io.setIpRestrictionsState({data:{config:{isActive:!0,strategy:xn.ALLOW},restrictions:i},userIpValid:!0,pagination:o,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield ki(Io.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*zA(e){let{payload:{callback:t}}=e,n=Go(e.payload,UA);yield ki(Io.setIpRestrictionsState({saving:!0,error:null}));const o=yield NA();try{var i,a;yield Ii(Dy.auth.createIPRestriction,n);const e=yield NA(),r=jA(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Ii(Dy.auth.getIPRestrictions,r);yield BA(),yield ki(Io.setIpRestrictionsState({data:{config:null!=(i=null==(a=o.data)?void 0:a.config)?i:{isActive:!1,strategy:xn.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield ki(Io.setIpRestrictionsState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*qA(e){let{payload:{callback:t}}=e,n=Go(e.payload,CA);yield ki(Io.setIpRestrictionsState({saving:!0,error:null}));try{yield Ii(Dy.auth.updateIPRestrictionConfig,n);const e=yield NA(),o=yield Ii(Dy.auth.getIPRestrictionsConfig),i=jA(U({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield Ii(Dy.auth.getIPRestrictions,i);yield BA(),yield ki(Io.setIpRestrictionsState({data:{config:o,restrictions:a},pagination:i,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield ki(Io.setIpRestrictionsState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*HA({payload:{id:e,callback:t}}){yield ki(Io.setIpRestrictionsState({saving:!0,error:null}));const n=yield NA();try{var o;yield Ii(Dy.auth.deleteIPRestriction,e);const i=yield NA(),a=jA(i.pagination),{items:r,_metadata:{totalPages:l}}=yield Ii(Dy.auth.getIPRestrictions,a);yield BA(),yield ki(Io.setIpRestrictionsState({data:{config:(null==(o=n.data)?void 0:o.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield ki(Io.setIpRestrictionsState({saving:!1,error:_f(e)})),null==t||t(null,e)}}function*JA(){yield ka(Io.loadIpRestrictions,WA),yield ka(Io.loadEmailDomainRestrictions,GA),yield Aa(Io.saveIpRestriction,zA),yield Aa(Io.saveIpRestrictionsConfig,qA),yield Aa(Io.deleteIpRestriction,HA),yield Aa(Io.checkIfUserIpValid,BA),yield Aa(Io.addCurrentUserIpAndActivate,KA),yield Aa(Io.saveEmailDomainRestriction,$A),yield Aa(Io.saveEmailDomainRestrictionsConfig,xA),yield Aa(Io.deleteEmailDomainRestriction,VA)}function*QA(){yield ki(Io.setIpRestrictionsState({loading:!0,error:null})),yield ki(Io.setIpRestrictionsState({data:{restrictions:Ef.filter((e=>e.strategy===If.strategy)),config:If},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*YA(){yield ki(Io.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield NA(),t=Ef[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield ki(Io.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield ki(Io.setIpRestrictionsState({error:_f(e),loading:!1}))}}function*XA(e){var t,n,o;let{payload:{callback:i}}=e,a=Go(e.payload,DA);yield ki(Io.setIpRestrictionsState({saving:!0,error:null}));const r=yield NA(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield ki(Io.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:xn.ALLOW},restrictions:[...l,U({},a,{createdAt:new Date,updatedAt:new Date,id:eh(),isActive:null==(o=a.isActive)||o,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*ZA(e){var t,n,o;let{payload:{callback:i}}=e,a=Go(e.payload,_A);const r=yield NA();yield ki(Io.setIpRestrictionsState({saving:!0,error:null})),yield ki(Io.setIpRestrictionsState({data:{config:U({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(o=r.data)?void 0:o.restrictions)?n:[]},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield ki(Io.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*eb({payload:{id:e,callback:t}}){var n;yield ki(Io.setIpRestrictionsState({saving:!0,error:null}));const o=yield NA();yield ki(Io.setIpRestrictionsState({data:{config:(null==(n=o.data)?void 0:n.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:o.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*tb(){yield ki(Io.setEmailDomainRestrictionsState({loading:!0,error:null})),yield ki(Io.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:xn.ALLOW}],config:{active:!0,listType:xn.ALLOW,blockPublicDomains:!1}}}))}function*nb(e){var t,n;let{payload:{callback:o}}=e,i=Go(e.payload,RA);const a=yield FA();yield ki(Io.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==o||o(!0),yield ki(Io.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:i.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],U({},i,{id:Date.now().toString()})]},saving:!1}))}function*ob(e){var t;let{payload:{callback:n}}=e,o=Go(e.payload,MA);const i=yield FA();yield ki(Io.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==n||n(!0),yield ki(Io.setEmailDomainRestrictionsState({data:{config:{active:o.active,blockPublicDomains:o.blockPublicDomains||!1,listType:o.type||xn.ALLOW},restrictions:[...(null==(t=i.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*ib({payload:{id:e}}){var t,n;const o=yield FA();yield ki(Io.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),yield ki(Io.setEmailDomainRestrictionsState({data:{config:(null==(t=o.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:((null==(n=o.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*ab(){yield ka(Io.loadIpRestrictions,QA),yield ka(Io.loadEmailDomainRestrictions,tb),yield Aa(Io.saveIpRestriction,XA),yield Aa(Io.saveIpRestrictionsConfig,ZA),yield Aa(Io.deleteIpRestriction,eb),yield Aa(Io.checkIfUserIpValid,YA),yield Aa(Io.saveEmailDomainRestriction,nb),yield Aa(Io.saveEmailDomainRestrictionsConfig,ob),yield Aa(Io.deleteEmailDomainRestriction,ib)}const rb=["callback"],lb=["id"];function*sb(e){const{count:t}=yield Ii(Dy.directory.countConfigurationUsers,e.id);return U({},e,{count:t})}function*cb(){yield ki(Io.setProvisioningState({loading:!0,error:null}));try{const e=yield Ii(Dy.directory.getConfigs),t=yield Ti(e.map((e=>sb(e))));yield ki(Io.setProvisioningState({connections:t,loading:!1}))}catch(e){yield ki(Io.setProvisioningState({error:_f(e),loading:!1}))}}function*ub(e){let{payload:{callback:t}}=e,n=Go(e.payload,rb);yield ki(Io.setProvisioningState({loading:!0,error:null}));try{const e=yield Ii(Dy.directory.createConfiguration,n),o=yield Ii(Dy.directory.getConfigs),i=yield Ti(o.map((e=>sb(e))));yield ki(Io.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield ki(Io.setProvisioningState({error:_f(e),loading:!1}))}}function*db(e){let{payload:{id:t}}=e,n=Go(e.payload,lb);yield ki(Io.setProvisioningState({loading:!0,error:null}));try{yield Ii(Dy.directory.updateConfiguration,t,n);const e=yield Ii(Dy.directory.getConfigs),o=yield Ti(e.map((e=>sb(e))));yield ki(Io.setProvisioningState({connections:o,loading:!1}))}catch(e){yield ki(Io.setProvisioningState({error:_f(e),loading:!1}))}}function*yb({payload:{id:e,callback:t}}){yield ki(Io.setProvisioningState({loading:!0,error:null}));try{yield Ii(Dy.directory.deleteConfiguration,e);const n=yield Ii(Dy.directory.getConfigs),o=yield Ti(n.map((e=>sb(e))));yield ki(Io.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setProvisioningState({error:_f(e),loading:!1})),null==t||t(!1,e)}}function*fb(){yield ka(Io.loadProvisionConnections,cb),yield Aa(Io.createProvisionConnection,ub),yield Aa(Io.deleteProvisionConnection,yb),yield Aa(Io.updateProvisionConnection,db)}const pb=["callback","events"];function*gb(e){let{payload:{callback:t}}=e,n=Go(e.payload,pb);yield ki(Io.setImpersonateState({loading:!0}));try{yield Ii(Dy.impersonate.impersonate,n),yield ki(Io.setImpersonateState({step:mo.success})),yield wi(1e3),yield Jp(),yield ki(Io.resetImpersonateState()),null==t||t(!0)}catch(e){yield ki(Io.setImpersonateState({loading:!1,error:_f(e)}))}}function*Sb(){yield ka(Io.impersonate,gb)}function*vb({payload:e}){const{callback:t,deviceId:n}=e;yield ki(Io.setPasskeysState({loading:!0}));try{yield Ii(Dy.auth.deleteWebAuthnDevice,n);const{devices:e}=yield Oi((e=>e.auth.passkeysState)),o=e.filter((e=>e.id!==n));yield ki(Io.setPasskeysState({devices:o,loading:!1})),null==t||t(!0)}catch(e){yield ki(Io.setPasskeysState({loading:!1,error:_f(e,null)})),null==t||t(null,e)}}function*hb(){yield ki(Io.setPasskeysState({loading:!0}));try{const{devices:e}=yield Ii(Dy.auth.getWebAuthnDevices);yield ki(Io.setPasskeysState({devices:e,loading:!1}))}catch(e){yield ki(Io.setPasskeysState({loading:!1,error:_f(e,null)}))}}function*mb(){yield Aa(Io.loadWebAuthnDevices,hb),yield Aa(Io.deleteWebAuthnDevice,vb)}const Ab=["roleIds","userIds"],bb=()=>Oi((e=>e.auth.groupsState));function*kb({payload:e}){const t=th.GET_TEAM_USERS;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Ii(Dy.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield ki(Io.setGroupsState({teamUsers:n}))}catch(e){yield ki(Io.setUsersGroupsError({key:t,value:_f(e)}))}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Tb({payload:e}){const t=th.GET_GROUP;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Ii(Dy.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:nh.rolesAndUsers});yield ki(Io.setGroupsState({selectedGroup:n}))}catch(e){yield ki(Io.setUsersGroupsError({key:t,value:_f(e)}))}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Pb(){const e=th.GET_GROUPS,t=yield bb();yield ki(Io.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Ii(Dy.groups.getGroups,{_groupsRelations:nh.rolesAndUsers});yield ki(Io.setGroupsState(U({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield ki(Io.setUsersGroupsError({key:e,value:_f(t)}))}finally{yield ki(Io.setUsersGroupsLoader({key:e,value:!1}))}}function*Ib({payload:e}){const t=th.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Go(e,Ab);yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Ii(Dy.groups.createGroup,U({name:i.name},!!i.description&&{description:i.description},{color:i.color}));null!=o&&o.length&&(yield ki(Io.addUsersToGroup({groupId:r.id,userIds:o}))),null!=n&&n.length&&(yield ki(Io.addRolesToGroup({groupId:r.id,roleIds:n}))),yield ki(Io.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield ki(Io.setUsersGroupsError({key:t,value:_f(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Eb({payload:e}){const t=th.UPDATE_GROUP;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ii(Dy.groups.updateGroup,e),yield ki(Io.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ki(Io.setUsersGroupsError({key:t,value:_f(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Lb({payload:e}){const t=th.DELETE_GROUP;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ii(Dy.groups.deleteGroup,e.groupId),yield ki(Io.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ki(Io.setUsersGroupsError({key:t,value:_f(n)})),null==e||null==(o=e.callback)||o.call(e,!1,n)}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Ob({payload:e}){const t=th.ADD_ROLES_TO_GROUP;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ii(Dy.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield ki(Io.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ki(Io.setUsersGroupsError({key:t,value:_f(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*wb({payload:e}){const t=th.DELETE_ROLES_FROM_GROUP;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ii(Dy.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield ki(Io.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ki(Io.setUsersGroupsError({key:t,value:_f(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Ub({payload:e}){const t=th.ADD_USERS_TO_GROUP;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ii(Dy.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield ki(Io.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 ki(Io.setUsersGroupsError({key:t,value:_f(n)}))}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Cb({payload:e}){const t=th.DELETE_USERS_FROM_GROUP;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ii(Dy.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield ki(Io.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ki(Io.setUsersGroupsError({key:t,value:_f(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Db(){const e=th.GET_GROUP_CONFIGURATION;yield ki(Io.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Ii(Dy.groups.getGroupConfiguration);yield ki(Io.setGroupsState({groupsConfiguration:t}))}catch(t){yield ki(Io.setUsersGroupsError({key:e,value:_f(t)}))}finally{yield ki(Io.setUsersGroupsLoader({key:e,value:!1}))}}function*_b({payload:e}){const t=th.UPDATE_GROUP_CONFIGURATION;yield ki(Io.setUsersGroupsLoader({key:t,value:!0}));try{yield Ii(Dy.groups.updateGroupConfiguration,e),yield ki(Io.getGroupConfiguration())}catch(e){yield ki(Io.setUsersGroupsError({key:t,value:_f(e)}))}finally{yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}}function*Rb(){yield ba(Io.loadGroups,Pb),yield ba(Io.getGroupById,Tb),yield ba(Io.createGroup,Ib),yield ba(Io.updateGroup,Eb),yield ba(Io.deleteGroup,Lb),yield ba(Io.addRolesToGroup,Ob),yield ba(Io.deleteRolesFromGroup,wb),yield ba(Io.addUsersToGroup,Ub),yield ba(Io.deleteUsersFromGroup,Cb),yield ba(Io.getGroupConfiguration,Db),yield ba(Io.updateGroupConfiguration,_b),yield ba(Io.getTeamUsers,kb)}function*Mb(){const e=th.GET_GROUPS;yield ki(Io.setUsersGroupsLoader({key:e,value:!0}));const t=wf;yield ki(Io.setGroupsState({groups:t})),yield ki(Io.setUsersGroupsLoader({key:e,value:!1}))}function*Nb({payload:e}){var t;const n=th.CREATE_GROUP,{groups:o}=yield bb();yield ki(Io.setUsersGroupsLoader({key:n,value:!0})),yield ki(Io.setGroupsState({groups:[U({},e,{id:`${e.name}ID`,managedBy:Cy.FRONTEGG}),...null!=o?o:[]]})),yield wi(500),null==e||null==(t=e.callback)||t.call(e,!0),yield ki(Io.setUsersGroupsLoader({key:n,value:!1}))}function*Fb({payload:e}){var t,n,o,i,a;const r=th.UPDATE_GROUP,l=yield bb();yield ki(Io.setUsersGroupsLoader({key:r,value:!0})),yield ki(Io.setGroupsState({groups:null==l||null==(t=l.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:Cy.FRONTEGG}):t})),selectedGroup:U({},null==l?void 0:l.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(o=null==e?void 0:e.color)?o:"",description:null!=(i=null==e?void 0:e.description)?i:""})})),yield wi(500),null==e||null==(a=e.callback)||a.call(e,!0),yield ki(Io.setUsersGroupsLoader({key:r,value:!1}))}function*Gb({payload:e}){var t,n;const o=th.DELETE_GROUP,i=yield bb();yield ki(Io.setUsersGroupsLoader({key:o,value:!0})),yield ki(Io.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield wi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ki(Io.setUsersGroupsLoader({key:o,value:!1}))}function*$b({payload:e}){var t,n;const o=th.ADD_ROLES_TO_GROUP,i=yield bb();yield ki(Io.setUsersGroupsLoader({key:o,value:!0})),yield ki(Io.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield wi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ki(Io.setUsersGroupsLoader({key:o,value:!1}))}function*xb({payload:e}){var t,n;const o=th.DELETE_ROLES_FROM_GROUP,i=yield bb();yield ki(Io.setUsersGroupsLoader({key:o,value:!0})),yield ki(Io.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield wi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ki(Io.setUsersGroupsLoader({key:o,value:!1}))}function*Vb({payload:e}){var t,n;const o=th.ADD_USERS_TO_GROUP,i=yield bb();yield ki(Io.setUsersGroupsLoader({key:o,value:!0})),yield ki(Io.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield wi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ki(Io.setUsersGroupsLoader({key:o,value:!1}))}function*jb({payload:e}){var t,n;const o=th.DELETE_USERS_FROM_GROUP,i=yield bb();yield ki(Io.setUsersGroupsLoader({key:o,value:!0})),yield ki(Io.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield wi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ki(Io.setUsersGroupsLoader({key:o,value:!1}))}function*Wb(){const e=th.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield bb();yield ki(Io.setUsersGroupsLoader({key:e,value:!0})),t&&(yield ki(Io.setGroupsState({groupsConfiguration:U({},t)}))),yield ki(Io.setUsersGroupsLoader({key:e,value:!1}))}function*Bb({payload:e}){const t=th.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield bb();yield ki(Io.setUsersGroupsLoader({key:t,value:!0})),n&&(yield ki(Io.setGroupsState({groupsConfiguration:U({},n,e)}))),yield ki(Io.setUsersGroupsLoader({key:t,value:!1}))}function*Kb(){yield ba(Io.loadGroups,Mb),yield ba(Io.createGroup,Nb),yield ba(Io.updateGroup,Fb),yield ba(Io.deleteGroup,Gb),yield ba(Io.addRolesToGroup,$b),yield ba(Io.deleteRolesFromGroup,xb),yield ba(Io.addUsersToGroup,Vb),yield ba(Io.deleteUsersFromGroup,jb),yield ba(Io.getGroupConfiguration,Wb),yield ba(Io.updateGroupConfiguration,Bb)}const zb=(e,t=[])=>Object.entries(e).reduce(((e,[n,o])=>"object"==typeof o?[...e,...zb(o,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:o}]),[]),qb=["callback"];function*Hb(){yield ki(Io.setCustomLoginState({loading:!0}));try{const e=yield Ii(Vc);yield ki(Io.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield ki(Io.setCustomLoginState({loading:!1,error:_f(e)}))}}function*Jb(e){let{payload:{callback:t}}=e,n=Go(e.payload,qb);try{yield ki(Io.setCustomLoginState({error:null,saving:!0}));const e=zb(n);if(0===e.length)throw new Error("No changes to update");yield Ii(jc,{actions:e});const o=yield Ii(Vc);yield ki(Io.setCustomLoginState({tenantMetadata:o,saving:!1})),null==t||t(!0)}catch(e){yield ki(Io.setCustomLoginState({error:_f(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Qb(){yield ka(Io.loadTenantMetadata,Hb),yield ka(Io.updateTenantMetadata,Jb)}let Yb;!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.SET_SELECTED_SUB_ACCOUNT_DATA="SET_SELECTED_SUB_ACCOUNT_DATA",e.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER="UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER",e.CREATE_SUB_ACCOUNT="CREATE_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT="UPDATE_SUB_ACCOUNT",e.DELETE_SUB_ACCOUNT="DELETE_SUB_ACCOUNT",e.GET_ACCOUNT_USERS="GET_ACCOUNT_USERS",e.ADD_USERS_TO_ACCOUNT="ADD_USERS_TO_ACCOUNT",e.DELETE_USERS_FROM_ACCOUNT="DELETE_USERS_FROM_ACCOUNT",e.SET_USER_ROLES_FOR_SUB_ACCOUNT="SET_USER_ROLES_FOR_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT_SETTINGS="UPDATE_SUB_ACCOUNT_SETTINGS",e.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(Yb||(Yb={}));const Xb=(e,t,n)=>{var o,i;return e.tenantId===t?U({},e,{name:n}):U({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>Xb(e,t,n))))?o:[]})};function Zb(e,t){var n;return U({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Zb(e,t))):[]})}function ek(e,t,n){var o,i;if(e.tenantId===t){var a;const t=[...null!=(a=null==e?void 0:e.children)?a:[],...n].filter(((e,t,n)=>t===n.findIndex((t=>t.tenantId===e.tenantId))));return U({},e,{children:t})}return U({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>ek(e,t,n))))?o:[]})}const tk=({items:e},t)=>e.map((e=>{var n,o;return{name:e.name,tenantId:e.tenantId,numberOfUsers:null!=(n=null==(o=t.find((t=>t.tenantId===e.tenantId)))?void 0:o.totalUsers)?n:0,createdAt:e.createdAt,metadata:e.metadata}})),nk=()=>Oi((e=>e.auth.allAccountsState));function*ok({payload:e}){const t=Yb.GET_TEAM_USERS;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));try{const{items:n}=yield Ii(Dy.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield ki(Io.setAllAccountsState({teamUsers:n}))}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)}))}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*ik({payload:e}){const t=Yb.GET_ACCOUNTS;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield nk(),{jwt:o,_limit:i,_offset:a}=e,r={_offset:null!=a?a:n._offset,_limit:null!=i?i:n._limit,_subTenantId:null==e?void 0:e._subTenantId};try{if(o){var l;const{selectedAccount:t}=yield nk(),{items:n,_links:i}=yield Ii(Dy.tenants.searchSubTenants,r,{jwt:o}),a=yield Ii(Dy.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:o}),s=tk({items:n},a),c=ek(t.accounts?t.accounts:t,null!=(l=null==e?void 0:e._subTenantId)?l:"",s.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==i?void 0:i.next}))));yield ki(Io.setSelectedAccountState({accounts:c}))}else{var s;const{accounts:t}=yield nk(),{items:n,_links:o}=yield Ii(Dy.tenants.searchSubTenants,r),i=yield Ii(Dy.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=tk({items:n},i),l=ek(t,null!=(s=null==e?void 0:e._subTenantId)?s:"",a.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==o?void 0:o.next}))));yield ki(Io.setAllAccountsState({accounts:l}))}}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)}))}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*ak({payload:e}){const t=Yb.SEARCH_ACCOUNTS;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{topAccount:n}=yield nk(),{jwt:o}=e;try{if(null!=e&&e._subTenantId){var i;const{items:t}=yield Ii(Dy.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(i=null==e?void 0:e._filter)?i:"",_subTenantId:e._subTenantId},{jwt:o});yield ki(Io.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)}))}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*rk({payload:e}){const t=Yb.GET_USER_JWT;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:o}=e;try{const e=yield Ii(Dy.users.GetUserJwt,{tenantId:n});yield ki(Io.setSelectedAccountState({userJwt:e})),null==o||o(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==o||o(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*lk({payload:e}){const t=Yb.CREATE_SUB_ACCOUNT;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:o,tenantId:i,jwt:a,callback:r}=e;try{if(a){const{selectedAccount:e}=yield nk(),t=yield Ii(Dy.subTenants.createSubTenant,{name:n,parentTenantId:o,tenantId:i},{jwt:a}),r=ek(U({name:"",tenantId:""},null==e?void 0:e.accounts),null!=o?o:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield ki(Io.setSelectedAccountState({accounts:r}))}else{const{accounts:e}=yield nk(),t=yield Ii(Dy.subTenants.createSubTenant,{name:n,tenantId:i,parentTenantId:o}),a=ek(e,null!=o?o:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield ki(Io.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==r||r(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*sk({payload:e}){const t=Yb.DELETE_SUB_ACCOUNT;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:o,callback:i}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield nk();yield Ii(Dy.subTenants.deleteSubTenant,o,{jwt:n});const i=Zb(t,o),a=Zb(null==e?void 0:e.accounts,o);yield ki(Io.setAllAccountsState({accounts:i})),yield ki(Io.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield nk();yield Ii(Dy.subTenants.deleteSubTenant,o);const t=Zb(e,o);yield ki(Io.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==i||i(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*ck({payload:e}){const t=Yb.UPDATE_SUB_ACCOUNT_SETTINGS;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:o,callback:i,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield nk();yield Ii(Dy.subTenants.updateSubTenant,{tenantId:a},{name:o},{jwt:n});const i=Xb(e.accounts,a,o);yield ki(Io.setSelectedAccountState({name:o,accounts:i}));const r=Xb(t,a,o);yield ki(Io.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield nk();yield Ii(Dy.subTenants.updateSubTenant,{tenantId:a},{name:o});const t=Xb(e,a,o);yield ki(Io.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==i||i(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*uk({payload:e}){const t=Yb.DELETE_USERS_FROM_ACCOUNT;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:o,jwt:i,callback:a}=e;try{yield Ii(Dy.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:o},{jwt:i}),yield ki(Io.getAccountUsers({jwt:i,_tenantId:o[0].tenantId})),null==a||a(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==a||a(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*dk({payload:e}){const t=Yb.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:o,jwt:i,callback:a}=e,{selectedAccount:r}=yield nk();try{yield Ii(Dy.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:o},{jwt:i}),yield ki(Io.getAccountUsers({jwt:i,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==a||a(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*yk({payload:e}){const t=Yb.ADD_USERS_TO_ACCOUNT;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:o,jwt:i,callback:a,allowSubAccountAccess:r=!1,roleIds:l}=e;try{yield Ii(Dy.subTenants.addUsersToSubTenant,{users:n,tenantId:o,allowSubAccountAccess:r,roleIds:l},{jwt:i}),yield ki(Io.getAccountUsers({jwt:i,_tenantId:o})),null==a||a(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==a||a(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*fk({payload:e}){const t=Yb.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield nk(),{userId:o,allowAccess:i,jwt:a,callback:r}=e;try{var l;yield Ii(Dy.subTenants.updateSubAccountAccess,o,{allowAccess:i},{jwt:a}),yield ki(Io.setSelectedAccountState({users:null==n||null==(l=n.users)?void 0:l.map((e=>e.id===o?U({},e,{subAccountAccessAllowed:i}):e))})),null==r||r(!0)}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)})),null==r||r(!1)}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*pk({payload:e}){var t,n,o,i,a,r,l,s;const c=Yb.GET_ACCOUNT_USERS;yield ki(Io.setAllAccountsLoader({key:c,value:!0}));const u=yield nk(),{jwt:d,_tenantId:y,_email:f}=e,p=null!=(t=null!=(n=null==e?void 0:e._offset)?n:null==u||null==(o=u.selectedAccount)||null==(i=o.usersQueryParams)?void 0:i._offset)?t:0,g=null!=(a=null!=(r=null==e?void 0:e._limit)?r:null==u||null==(l=u.selectedAccount)||null==(s=l.usersQueryParams)?void 0:s._limit)?a:10,S=U({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield Ii(Dy.users.getUsersV3,S,{jwt:d}),o={totalUsersItems:t,totalUsersPages:n,usersQueryParams:U({_offset:null!=p?p:0,_limit:null!=g?g:10},!!f&&{_email:f})};if(e.length){const t=e.map((e=>e.id)),n=yield Ii(Dy.roles.getRoles),i=yield Ii(Dy.users.getUsersRoles,{ids:t},{jwt:d}),a=e.map((e=>{var t,o;const a=null==i||null==(t=i.find((t=>t.userId===e.id)))?void 0:t.roleIds;return U({},e,{roles:null!=(o=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?o:[]})}));yield ki(Io.setSelectedAccountState(U({users:a},o)))}else yield ki(Io.setSelectedAccountState(U({users:[]},o)))}catch(e){yield ki(Io.setAllAccountsError({key:c,value:_f(e)}))}finally{yield ki(Io.setAllAccountsLoader({key:c,value:!1}))}}function*gk({payload:e}){const t=Yb.SET_SELECTED_SUB_ACCOUNT_DATA;yield ki(Io.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var o,i,a,r,l,s,c;const e=yield Ii(Dy.accountSettings.getSettings,{jwt:n}),u=yield Ii(Dy.tenants.getTenantsUsersCount,{tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n}),d=yield Ii(Dy.tenants.getParentTenants,{jwt:n}),y=yield Ii(Dy.tenants.getHierarchyMetadata,{_tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n});yield ki(Io.setSelectedAccountState({tenantId:null!=(a=e.tenantId)?a:"",name:e.name,numberOfUsersObject:u[0],parentsAccounts:d,numberOfSubAccounts:null==(r=y[0])?void 0:r.totalSubTenants,accountSettings:e,accounts:{name:e.name,tenantId:null!=(l=e.tenantId)?l:"",numberOfUsers:null==(s=u[0])?void 0:s.totalUsers,createdAt:void 0,children:[]}})),yield ki(Io.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield ki(Io.setAllAccountsError({key:t,value:_f(e)}))}finally{yield ki(Io.setAllAccountsLoader({key:t,value:!1}))}}function*Sk(){yield ba(Io.loadAccounts,ik),yield ba(Io.searchAccounts,ak),yield ba(Io.updateSubAccountAccessForUser,fk),yield ba(Io.getUserJwtForSubAccount,rk),yield ba(Io.createSubAccount,lk),yield ba(Io.deleteSubAccount,sk),yield ba(Io.updateSubAccountSettings,ck),yield ba(Io.addUsersToAccount,yk),yield ba(Io.deleteUsersFromAccount,uk),yield ba(Io.setUserRolesForSubAccount,dk),yield ba(Io.getTeamUsers,ok),yield ba(Io.getAccountUsers,pk),yield ba(Io.setSelectedSubAccountData,gk)}var vk={sagas:function*(){yield Ti([Ii(Hg),Ii(Bv),Ii(zv),Ii(Mv),Ii(cA),Ii(uS),Ii(GS),Ii(BS),Ii(Qb),Ii(bv),Ii(Hh),Ii(Rb),Ii(pm),Ii(Gf),Ii(Tm),Ii(yp),Ii(Dm),Ii(xm),Ii(eA),Ii(gA),Ii(PA),Ii(JA),Ii(fb),Ii(Sb),Ii(mb),Ii(Sk),Ii(wp)])},mockSagas:function*(){yield Ti([Ii(Yg),Ii(vS),Ii(HS),Ii(Uv),Ii(lm),Ii(wm),Ii(Ip),Ii(mA),Ii(Mm),Ii(jm),Ii(LA),Ii(ab),Ii(nA),Ii(Kb)])},storeName:wt,initialState:ho,reducer:To,actions:Io};const hk=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),mk={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Ak={setAuditLogsState:hk("auditLogsState"),resetAuditLogsState:e=>U({},e,{auditLogsState:mk})},bk={exportAuditsCsv:st("auditLogs/exportAuditsCsv"),loadAuditLogs:st("auditLogs/loadAuditLogs",(e=>({payload:e})))},kk={loading:!0},Tk={setAuditsMetadataState:hk("auditsMetadataState"),resetAuditsMetadataState:e=>U({},e,{auditsMetadataState:kk})},Pk={loadAuditsMetadata:st("auditLogs/loadAuditsMetadata")},Ik={auditLogsState:mk,auditsMetadataState:kk},{reducer:Ek,actions:Lk}=ut({name:Ct,initialState:Ik,reducers:U({resetState:e=>U({},e,Ik),setState:(e,{payload:t})=>U({},e,t)},Ak,Tk)}),Ok=U({},Lk,bk,Pk),wk=e=>"createdAt"!==e.id,Uk={total:20,data:Array.from(Array(5).keys()).map((e=>U({ip:"198.143.51.1",user:"Demo User Name",email:"demo-user@frontegg.com"},(()=>{switch(Math.floor(6*Math.random())){case 0:return{action:"Updated profile",description:"User updated profile details",severity:"Info"};case 1:return{action:"User logged in",severity:"Info",description:"User logged in to the product"};case 2:return{action:"User failed to login",severity:"High",description:"User failed to login with password"};case 3:return{action:"Added user",severity:"Info",description:"Added user david+535@frontegg.com to tenant"};case 4:return{action:"Assigned roles",severity:"Info",description:"Assigned 0 roles for user"};case 5:return{action:"Removed user david+108@frontegg.com from account",severity:"Info",description:"Removed access from the account for user david+108@frontegg.com"}}})(),{json:{key1:"value1",key2:"value2",key3:"value3",key4:"value4"},tenantId:"my-tenant-id",vendorId:"my-vendor-id",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",createdAt:`2022-04-07 10:${50-e}:40.201`})))},Ck={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}]},Dk=()=>Oi((e=>e.auditLogs.auditLogsState)),_k=()=>Oi((e=>e.auditLogs.auditsMetadataState));function*Rk(){const e=yield Dk(),{columns:t}=yield _k();try{const n=e.filter,o=e.sort.reduce(((e,t)=>U({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),i=n.reduce(((e,t)=>U({},e,{[t.id]:t.value})),{});yield ki(Ok.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Dy.audits.exportAudits(U({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},o,i))}catch(e){console.error("failed to export audits - ",e)}yield ki(Ok.setAuditLogsState({isDownloadingCsv:!1}))}function*Mk({payload:e}){yield ki(Ok.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Dk(),{columns:n}=yield _k();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 ki(Ok.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>U({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>U({},e,{[t.id]:t.value})),{});n||(yield ki(Ok.loadAuditsMetadata()));const{data:p,total:g}=yield Ii(Dy.audits.getAudits,U({offset:c,count:s},y,f));yield ki(Ok.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 ki(Ok.setAuditLogsState({loading:!1,error:_f(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Nk(){yield Aa(Ok.exportAuditsCsv,Rk),yield Aa(Ok.loadAuditLogs,Mk)}function*Fk({payload:e}){yield ki(Ok.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Dk(),{columns:n}=yield _k();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 ki(Ok.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield ki(Ok.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=Uk;let o=n.filter((e=>t=>e.filter(wk).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 ki(Ok.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 ki(Ok.setAuditLogsState({loading:!1,error:_f(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Gk(){yield Aa(Ok.loadAuditLogs,Fk)}function*$k(){yield ki(Ok.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Ii(Dy.metadata.getAuditsMetadata);yield ki(Ok.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ki(Ok.setAuditsMetadataState({error:e,loading:!1}))}}function*xk(){yield Aa(Ok.loadAuditsMetadata,$k)}function*Vk(){yield ki(Ok.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Ck;yield ki(Ok.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ki(Ok.setAuditsMetadataState({error:e,loading:!1}))}}function*jk(){yield Aa(Ok.loadAuditsMetadata,Vk)}var Wk={sagas:function*(){yield Ti([Ii(Nk),Ii(xk)])},mockSagas:function*(){yield Ti([Ii(Gk),Ii(jk)])},storeName:Ct,initialState:Ik,reducer:Ek,actions:Ok};const Bk={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:Kk,actions:zk,reducer:qk}=ut({name:"audits",initialState:Bk,reducers:{setContext:(e,{payload:t})=>{e.context=t},startLoading:e=>{e.isLoading=!0},setVirtualScroll:(e,{payload:t})=>{e.virtualScroll=t},startRefresh:e=>{e.isLoading=!0},startFetching:e=>{e.isFetchMore=!0},finishLoading:e=>{e.isLoading=!1},startDownloadingCsv:e=>{e.isDownloadingCsv=!0},stopDownloadingCsv:e=>{e.isDownloadingCsv=!1},loadStatsSuccess:(e,{payload:t})=>{e.error=void 0,e.totalToday=t.totalToday,e.severeThisWeek=t.severeThisWeek},loadItemFailedAction:(e,{payload:t})=>{e.error=U({},e.error,{[t.name]:t.error})},loadMetadataSuccess:(e,{payload:t})=>{e.error={},e.headerProps=t.properties,e.themeAudits=t.theme?t.theme.styles:{}},loadAuditsSuccess:(e,{payload:t})=>{e.error={},e.rowsData=t.rowsData,e.lastUpdated=new Date,e.total=t.total},fetchMoreSuccess:(e,{payload:t})=>{e.error={},e.offset=t.offset,e.currentPage=t.currentPage,e.isFetchMore=!1},setFilterData:(e,{payload:t})=>{e.filters=t,e.currentPage=0,e.offset=0,e.isLoading=!0},textSearch:(e,{payload:t})=>{e.filter=t,e.currentPage=0,e.offset=0,e.isLoading=!0},onPageChange:(e,{payload:t})=>{e.currentPage=t-1,e.offset=20*e.currentPage,e.isLoading=!0},setDataSorting:(e,{payload:t})=>{e.sortBy=t.sortBy,e.currentPage=0,e.sortDirection="asc"===t.sortDirection?"desc":"asc",e.offset=0,e.isLoading=!0},setPredefinedFilters:(e,{payload:t})=>{e.predefinedFilters=t,e.filters=Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),Hk=U({},zk,{initData:st(`${Kk}/initData`),loadAudits:st(`${Kk}/loadAudits`),removeFilter:st(`${Kk}/removeFilter`),filterData:st(`${Kk}/filterData`),exportCSV:st(`${Kk}/exportCSV`),deleteAudits:st(`${Kk}/deleteAudits`)}),Jk=()=>Oi((e=>e[Kk]));function*Qk(){const{sortBy:e,sortDirection:t}=yield Jk();try{const n=yield Ii(Dy.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield ki(Hk.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield ki(Hk.loadItemFailedAction(t))}}function*Yk(){try{const e=yield Ii(Dy.metadata.getAuditsMetadata);yield ki(Hk.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield ki(Hk.loadItemFailedAction(t))}}const Xk=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Zk({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield Jk(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield Jk():{rowsData:[]};try{const e=Xk(t),{data:l,total:d}=yield Ii(Dy.audits.getAudits,U({},r&&{paginationMode:"virtual"},{sortDirection:o,sortBy:n,filter:i},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield ki(Hk.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield ki(Hk.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield ki(Hk.loadItemFailedAction(t))}}function*eT(){yield ki(Hk.startLoading()),yield Ti([Qk(),Yk(),Zk({payload:{onlyOneLoad:!1},type:""})]),yield ki(Hk.finishLoading())}function*tT({payload:e}){const{filters:t}=yield Jk(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield ki(Hk.setFilterData(o))}function*nT({payload:e}){const{filters:t}=yield Jk();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 ki(Hk.setFilterData(o))}function*oT(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield Jk(),a=Xk(e);yield ki(Hk.startDownloadingCsv());try{yield Dy.audits.exportAudits(U({endpoint:"csv/v2",headerProps:i,sortDirection:n,sortBy:t,filter:o},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield ki(Hk.stopDownloadingCsv())}}function*iT(){yield ba(Hk.initData,eT),yield ba(Hk.removeFilter,tT),yield ba(Hk.filterData,nT),yield ba([Hk.loadAudits,Hk.textSearch,Hk.onPageChange],Zk),yield ba([Hk.setFilterData,Hk.setDataSorting,Hk.startRefresh],(()=>Zk({payload:{appendMode:!1},type:""}))),yield ba(Hk.exportCSV,oT)}const aT={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},rT={initData:()=>U({},aT),setConnectivityState:(e,{payload:t})=>U({},e,t),cleanWebhookTestData:e=>U({},e,{testResult:void 0}),cleanWebhookLogsData:e=>U({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return U({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>U({},e,{error:void 0}),cleanSlackData:e=>U({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>U({},e,{retryResult:U({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>U({},e,{retryResult:U({},e.retryResult,t)})}},lT={loadSlackActions:st("connectivity/loadSlackActions"),loadDataAction:st("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:st("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:st("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:st("connectivity/loadScope"),deleteWebhookConfigAction:st("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:st("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:st("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},sT={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:cT,actions:uT}=ut({name:Ut,initialState:sT,reducers:U({},rT)}),dT=U({},uT,lT),yT={slack:Dy.connectivity.getSlackConfiguration,email:Dy.connectivity.getEmailConfiguration,sms:Dy.connectivity.getSMSConfiguration,webhook:Dy.connectivity.getWebhooksConfigurations,categories:Dy.connectivity.getCategories,channelMap:Dy.connectivity.getChannelMaps},fT={slack:Dy.connectivity.postSlackConfiguration,email:Dy.connectivity.postEmailConfiguration,sms:Dy.connectivity.postSMSConfiguration,webhook:Dy.connectivity.postWebhooksConfiguration},pT=["email","slack","sms","webhook"],gT={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"}},ST=["id"],vT=["id","enabled"],hT=["categories","channelMap"];function*mT(e){return yield Ii(bT,{payload:{api:e},type:""})}function*AT({payload:e=pT}){yield ki(dT.setConnectivityState({isLoading:!0}));try{const t=yield Ti([...e.map(mT),yield bT({payload:{api:"categories"},type:""}),yield function*(){return(yield Ti(e.map((function*(e){return yield bT({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>U({},t,{[`${e[o]}`]:n})),{})}()]),n=yield bT({payload:{api:"webhook"},type:""}),o=t.reduce(((n,o,i)=>e[i]?t[t.length-1][e[i]].length?U({},n,{[`${e[i]}`]:o,list:[...n.list,{id:i,key:e[i],events:gT[e[i]].events(o),active:gT[e[i]].isActive(o),platform:gT[e[i]].title,image:gT[e[i]].image}]}):n:U({},n,{[`${hT[i-e.length]}`]:o})),{list:[],webhook:n});yield ki(dT.setConnectivityState(U({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield ki(dT.setConnectivityState({isLoading:!1}))}}function*bT({payload:{api:e,params:t}}){try{return yield Ii(yT[e],t)}catch(e){return}}function*kT(){try{yield ki(dT.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Ii(Dy.connectivity.getSlackChannels);yield ki(dT.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield ki(dT.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*TT(e,t){const{connectivity:{list:n}}=yield Oi(),o=n.find((({key:t})=>t===e));if(!o)return;const i=gT[e].isActive(t);i!==o.active&&(yield ki(dT.setConnectivityState({list:n.map((t=>t.key===e?U({},t,{active:i}):t))})))}function*PT({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield Oi((e=>e.connectivity));try{if(yield ki(dT.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...o]:o})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Oi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:o}=e;yield Ti([...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=Go(e,ST);return n===t.id&&JSON.stringify(U({id:n},o))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length?[...e,t]:e}),[]).map((function*(e){return yield Ii(fT.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Ii(Dy.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Oi(),{processIds:o}=yield Oi((e=>e.connectivity)),i=n[t];if(!i)return;let a=[];try{a=yield Ti([...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 Ii("email"===t?Dy.connectivity.postEmailConfiguration:Dy.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=Go(i,vT);return yield Ti([yield Ii("email"===t?Dy.connectivity.patchEmailConfiguration:Dy.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield Ii("email"===t?Dy.connectivity.putEmailSubscriptions:Dy.connectivity.putSMSSubscriptions,a,o,U({},l,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return Ii("email"===t?Dy.connectivity.deleteEmailSubscriptions:Dy.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield bT({payload:{api:t},type:""});yield ki(dT.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield TT(t,e)}else yield ki(dT.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield Ii(fT[e],t),!["sms","email"].includes(e)){const i=yield bT({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield ki(dT.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield TT(e,i),null==n||n(!0)}}catch(e){yield ki(dT.setConnectivityState({error:_f(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*IT({payload:e}){try{yield Dy.connectivity.postSlackCode(e)}catch{}yield ki(dT.setConnectivityState({error:void 0,isSaving:!1}))}function*ET(){const{slackChannels:e}=yield Oi((e=>e.connectivity));try{yield ki(dT.setConnectivityState({slackChannels:U({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Ii(Dy.connectivity.getSlackScope);yield ki(dT.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield ki(dT.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*LT({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield Oi((e=>e.connectivity));try{yield ki(dT.setConnectivityState({isSaving:!0})),yield Ii(Dy.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,_f(e))}const i=yield bT({payload:{api:"webhook"},type:""});i&&(yield ki(dT.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*OT({payload:e}){try{yield ki(dT.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Ii(Dy.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield ki(dT.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield ki(dT.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield ki(dT.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*wT({payload:e}){try{const{statusCode:t}=yield Ii(Dy.connectivity.postWebhookRetry,e);yield ki(dT.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield ki(dT.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*UT({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield Oi((e=>e.connectivity));try{yield ki(dT.setConnectivityState({webhookLogs:U({},o,{isLoading:!0})}));const i=yield Ii(Dy.connectivity.getWebhookLog,e,n,t);yield ki(dT.setConnectivityState({error:void 0,webhookLogs:U({isLoading:!1},i)}))}catch(e){yield ki(dT.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var CT={sagas:function*(){yield Aa(dT.loadDataAction,AT),yield ba(dT.loadSlackActions,kT),yield Aa(dT.postDataAction,PT),yield Aa(dT.postCodeAction,IT),yield Aa(dT.loadScope,ET),yield Aa(dT.deleteWebhookConfigAction,LT),yield Aa(dT.postWebhookTestAction,OT),yield Aa(dT.postWebhookRetryAction,wT),yield ba(dT.loadWebhookLogsAction,UT)},storeName:Ut,initialState:sT,reducer:cT,actions:dT};function DT(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}}function _T(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>U({},n,{[e]:t(n[e],o)})}}function RT(e){return _T(e,((e,t)=>U({},e,{loading:t.payload})))}function MT(e){return _T(e,((e,t)=>U({},e,{error:t.payload,loading:!1})))}const NT={loading:!1,error:null,fetching:!0,plans:[]},{actions:FT,reducer:GT,name:$T}=ut({name:"subscriptions/plans",initialState:NT,reducers:U({},DT())}),xT=U({loadPlans:st(`${$T}/loadPlans`)},FT),VT={loading:!1,error:null,fetching:!0,config:null},jT=U({},DT()),{actions:WT,reducer:BT,name:KT}=ut({name:"subscriptions/config",initialState:VT,reducers:jT}),zT=U({loadPaymentConfiguration:st(`${KT}/loadPaymentConfiguration`)},WT),qT={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},HT=U({},DT(),{setCancellationLoading:RT("cancellation"),setCancellationError:MT("cancellation"),setRenewalLoading:RT("renewal"),setRenewalError:MT("renewal")}),{reducer:JT,actions:QT,name:YT}=ut({name:"subscriptions/billing/subscription",initialState:qT,reducers:HT}),XT=U({load:st(`${YT}/loadSubscription`),cancelSubscription:st(`${YT}/cancelSubscription`),renewSubscription:st(`${YT}/renewSubscription`)},QT),ZT={loading:!1,error:null,fetching:!0},eP=U({},DT()),{reducer:tP,actions:nP,name:oP}=ut({name:"subscriptions/billing/information",initialState:ZT,reducers:eP}),iP=U({loadBillingInformation:st(`${oP}/loadBillingInformation`),cancelSubscription:XT.cancelSubscription,renewSubscription:XT.renewSubscription},nP),aP={loading:!1,error:null,fetching:!0},rP=U({},DT(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}),{reducer:lP,actions:sP,name:cP}=ut({name:"subscriptions/billing/payment",initialState:aP,reducers:rP}),uP=U({loadPaymentMethod:st(`${cP}/loadPaymentMethod`),submitPaymentMethod:st(`${cP}/submitPaymentMethod`),submitPaymentMethodError:st(`${cP}/submitPaymentMethodError`),submitPaymentMethodSuccess:st(`${cP}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:st(`${cP}/updateBillingDetails`,(e=>({payload:e})))},sP),dP={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},yP=U({},DT(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{invoiceDownload:U({},e.invoiceDownload,t.payload)})}}),{reducer:fP,actions:pP,name:gP}=ut({name:"subscriptions/billing/invoices",initialState:dP,reducers:yP}),SP=U({loadInvoices:st(`${gP}/loadInvoices`),downloadInvoice:st(`${gP}/downloadInvoice`,(e=>({payload:e})))},pP),vP={information:ZT,invoices:dP,paymentMethod:aP,subscription:qT},hP={invoices:SP,information:iP,paymentMethod:uP,subscription:XT},mP=je({invoices:fP,information:tP,paymentMethod:lP,subscription:JT}),AP={fetching:!0,loading:!1,error:null,confirmed:!1},bP=U({},DT()),{actions:kP,reducer:TP,name:PP}=ut({name:"subscriptions/checkout",initialState:AP,reducers:bP}),IP=U({loadCheckout:st(`${PP}/loadCheckout`),resetCheckout:st(`${PP}/resetCheckout`),submitCheckout:st(`${PP}/submitCheckout`),confirmCheckout:st(`${PP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:st(`${PP}/errorCheckout`,(e=>({payload:e})))},kP),EP={loading:!1,error:null,cardSetupIntentSecret:null},LP=U({},DT()),{reducer:OP,actions:wP,name:UP}=ut({name:"subscriptions/stripe",initialState:EP,reducers:LP}),CP=U({loadCustomer:st(`${UP}/loadCustomer`),createCardSetupIntentSecret:st(`${UP}/createCardSetupIntentSecret`)},wP),DP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:_P,reducer:RP,name:MP}=ut({name:"subscriptions/vendorPublicConfig",initialState:DP,reducers:U({},DT())}),NP=U({loadVendorPublicConfiguration:st(`${MP}/loadVendorPublicConfiguration`)},_P),FP={config:VT,plans:NT,checkout:AP,billing:vP,stripe:EP,vendorPublicConfig:DP},GP={config:zT,billing:hP,plans:xT,checkout:IP,stripe:CP,vendorPublicConfig:NP},$P=je({config:BT,billing:mP,plans:GT,checkout:TP,stripe:OP,vendorPublicConfig:RP});let xP,VP,jP;function WP({policy:e}){return{policy:jP.AT_PERIOD_END}}function BP(e){switch(e){case Od.ACTIVE:return VP.ACTIVE;case Od.INCOMPLETE:return VP.INCOMPLETE;case Od.CANCELED:return VP.CANCELED;case Od.EXPIRED:return VP.EXPIRED;case Od.TRIALING:return VP.TRIALING;default:return VP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(xP||(xP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(VP||(VP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(jP||(jP={}));const KP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Od.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},zP=[{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"}],qP=[{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:""}],HP=[{id:"id",externalId:"externalId",type:wd.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],JP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*QP(){yield Aa(XT.load,YP),yield Aa(XT.cancelSubscription,ZP),yield Aa(XT.renewSubscription,eI)}function*YP(){const e=yield Oi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield aI(e)}function*XP(){yield ki(XT.setLoading(!0));try{const[e]=yield Ii(Dy.subscriptions.getManagedSubscriptions);yield ki(XT.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield ki(XT.setError(e))}}function*ZP(){const{subscription:e}=yield Oi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ki(XT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ki(XT.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===Od.ACTIVE)try{yield ki(XT.setCancellationLoading(!0)),yield Ii(Dy.subscriptions.cancelManagedSubscription,t),yield XP(),yield ki(XT.setCancellationLoading(!1))}catch(e){yield ki(XT.setCancellationError(_f(e)))}}function*eI(){const{subscription:e}=yield Oi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ki(XT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ki(XT.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Ud.AT_PERIOD_END)try{yield ki(XT.setRenewalLoading(!0)),yield Ii(Dy.subscriptions.renewManagedSubscription,t),yield XP(),yield ki(XT.setRenewalLoading(!1))}catch(e){yield ki(XT.setCancellationError(_f(e)))}}function*tI(){yield ki(XT.setLoading(!0)),yield wi(500),yield ki(XT.setState({subscription:KP,fetching:!1,loading:!1,error:null}))}function*nI(){yield Aa(XT.load,tI)}function*oI(){yield Aa(iP.loadBillingInformation,iI)}function*iI(){yield function*(e){const t=yield Oi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Oi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield aI(n,!1):yield ki(iP.setError(t?"Not authorized":"Internal feature failure"))}()}function*aI(e,t){yield ki(iP.setLoading(!0));try{var n,o;const i=yield Ii(Dy.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield Ii(Dy.subscriptions.getSubscriptionPlan,a):([,l]=yield Ti([Ii(XP),Ii(Dy.subscriptions.getSubscriptionPlan,a)]),s=yield Oi((e=>e.subscriptions.billing.subscription.subscription||null))),yield ki(iP.setState(U({loading:!1,fetching:!1,summary:i},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?VP.ACTIVE:BP(s.status),cancellation:s.cancellation&&WP(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 ki(iP.setError(_f(e)))}}function*rI(){yield function*(){var e,t;yield ki(iP.setLoading(!0)),yield wi(500),yield ki(iP.setState({loading:!1,fetching:!1,summary:{subscriptionId:KP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Cd.Stripe,externallyManaged:!1,currentPlanId:zP[0].id,defaultPlanId:zP[0].id},plan:U({},zP[0],{price:null==(e=zP[0].price)?void 0:e.amount,currency:null==(t=zP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*lI(){yield Aa(iP.loadBillingInformation,rI)}function*sI(){yield Aa(uP.loadPaymentMethod,cI),yield Aa(uP.submitPaymentMethod,dI),yield Aa(uP.submitPaymentMethodError,yI),yield Aa(uP.submitPaymentMethodSuccess,fI),yield Aa(uP.updatePaymentMethodBillingDetails,uI)}function*cI(){yield ki(uP.setLoading(!0));try{const e=(yield Ii(Dy.subscriptions.getPaymentMethods))[0];yield ki(uP.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield ki(uP.setError(_f(e)))}}function*uI({payload:e}){yield ki(uP.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield Ii(Dy.subscriptions.updatePaymentMethodBillingDetails,t,U({email:n},o)),yield Ii(cI),null==i||i(!0)}catch(e){yield ki(uP.setError(_f(e))),null==i||i(!1)}yield ki(uP.setLoading(!1))}function*dI(){yield ki(uP.setLoading(!0))}function*yI({payload:e}){yield ki(uP.setError(e))}function*fI(){yield ki(uP.loadPaymentMethod())}function*pI(){yield ki(uP.setLoading(!0)),yield wi(500);const e=HP[0];yield ki(uP.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*gI(){yield Aa(uP.loadPaymentMethod,pI)}function*SI(){yield Aa(SP.loadInvoices,vI),yield Aa(SP.downloadInvoice,hI)}function*vI(){yield ki(SP.setLoading(!0));try{const e=(yield Ii(Dy.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 ki(SP.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield ki(SP.setError(_f(e)))}}function*hI({payload:e}){yield ki(SP.setInvoiceDownloadState({loading:!0,error:null}));try{yield Ii(Dy.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield ki(SP.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield ki(SP.setInvoiceDownloadState({loading:!1,error:_f(e,null)}))}}function*mI(){yield ki(SP.setLoading(!0)),yield wi(500),yield ki(SP.setState({loading:!1,fetching:!1,invoices:qP.map((e=>U({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield ki(SP.setLoading(!1))}function*AI(){yield Aa(SP.loadInvoices,mI)}function*bI(){yield Ti([Ii(oI),Ii(sI),Ii(SI),Ii(QP)])}function*kI(){yield Ti([Ii(lI),Ii(gI),Ii(AI),Ii(nI)])}function*TI(){yield Aa(IP.loadCheckout,PI),yield Aa(IP.resetCheckout,II),yield Aa(IP.submitCheckout,EI),yield Aa(IP.confirmCheckout,LI),yield Aa(IP.errorCheckout,wI)}function*PI(){yield ki(IP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*II(){yield ki(IP.setState({loading:!1,error:null,confirmed:!1}))}function*EI(){yield ki(IP.setState({loading:!0,error:null}))}function*LI({payload:{paymentMethodId:e,planId:t}}){const n=yield Oi((e=>e.subscriptions.billing.subscription.subscription)),o=yield Oi((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===Od.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield ki(IP.setState({loading:!0,error:null})),i&&a)return yield OI(),void(yield ki(XT.setState({subscription:U({},n,{status:Od.ACTIVE})})));try{yield Ii(Dy.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Ti([iI(),cI(),vI()]),yield OI()}catch(e){yield ki(IP.setState({loading:!1,error:_f(e)}))}}else yield ki(IP.setState({loading:!1,error:"Subscription not found"}))}function*OI(){yield ki(IP.setState({loading:!1,error:null,confirmed:!0}))}function*wI({payload:e}){yield ki(IP.setState({loading:!1,error:e}))}function*UI(){yield Aa(IP.resetCheckout,II)}function*CI(){yield Aa(xT.loadPlans,DI)}function*DI(){yield ki(xT.setLoading(!0));try{const e=(yield Ii(Dy.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 ki(xT.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield ki(xT.setError(_f(e)))}}function*_I(){yield ki(xT.setLoading(!0)),yield wi(500),yield ki(xT.setState({fetching:!1,loading:!1,plans:zP.map((e=>{var t,n;return U({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*RI(){yield Aa(xT.loadPlans,_I)}function*MI(){yield Aa(zT.loadPaymentConfiguration,NI)}function*NI(){yield ki(zT.setLoading(!0));try{(yield Ii(Dy.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Cd.Stripe))?yield function*(){yield ki(zT.setLoading(!0));try{const e=yield Ii(Dy.subscriptions.getStripePaymentProviderConfiguration);yield ki(zT.setState({loading:!1,fetching:!1,config:{paymentProvider:xP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield ki(zT.setError(_f(e)))}}():yield ki(zT.setError("Payment provider not configured"))}catch(e){yield ki(zT.setError(_f(e)))}}function*FI(){yield ki(zT.setLoading(!0)),yield wi(500),yield ki(zT.setState({loading:!1,fetching:!1,config:{paymentProvider:xP.STRIPE,apiKey:""}}))}function*GI(){yield Aa(zT.loadPaymentConfiguration,FI)}function*$I(){yield Aa(CP.createCardSetupIntentSecret,xI)}function*xI({payload:e}){yield ki(CP.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Ii(Dy.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield ki(CP.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield ki(CP.setError(_f(e)))}}function*VI(){yield Aa(NP.loadVendorPublicConfiguration,jI)}function*jI(){yield ki(NP.setLoading(!0));try{const e=yield Ii(Dy.subscriptions.getVendorPublicConfigurations);yield ki(NP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield ki(NP.setError(_f(e)))}}function*WI(){yield ki(NP.setLoading(!0)),yield wi(500),yield ki(NP.setState({fetching:!1,loading:!1,vendorPublicConfig:JP}))}function*BI(){yield Aa(NP.loadVendorPublicConfiguration,WI)}var KI={sagas:function*(){yield Ti([Ii(bI),Ii(TI),Ii(CI),Ii(MI),Ii($I),Ii(VI)])},mockSagas:function*(){yield Ti([Ii(kI),Ii(UI),Ii(RI),Ii(GI),Ii(BI)])},reducer:$P,actions:GP,initialState:FP,storeName:"subscriptions"},zI={sagas:function*(){yield Aa(Bf.loadVendorPublicInfo,Kf)},storeName:Dt,initialState:Vf,reducer:jf,actions:Bf};const{reducer:qI}=ut({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Ta.setContext(t),U({},e,{context:t}))}}}),HI=(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||Ta.setContext(e.context);const t=da(),h=[...rt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=lt({middleware:h,preloadedState:{root:U({},e,{previewMode:n,urlStrategy:r}),[vk.storeName]:U({},vk.initialState,o,null!=(s=null==i?void 0:i.auth)?s:{},{routes:U({},vk.initialState.routes,null!=(c=null==o?void 0:o.routes)?c:{},null!=(u=null==i||null==(d=i.auth)?void 0:d.routes)?u:{})}),[Wk.storeName]:U({},Wk.initialState,null!=(y=null==i?void 0:i.auditLogs)?y:{},{auditLogsState:U({},Wk.initialState.auditLogsState,null!=(f=null==i||null==(p=i.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:U({},Wk.initialState.auditsMetadataState,null!=(g=null==i||null==(S=i.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[Kk]:U({},Bk,null!=(v=null==i?void 0:i.audits)?v:{}),[CT.storeName]:CT.initialState,[KI.storeName]:KI.initialState,[zI.storeName]:zI.initialState},reducer:je({root:qI,[vk.storeName]:vk.reducer,[Wk.storeName]:Wk.reducer,[Kk]:qk,[CT.storeName]:CT.reducer,[KI.storeName]:KI.reducer,[zI.storeName]:zI.reducer})});const m=function*(){yield Ti([Ii(vk.sagas),Ii(Wk.sagas),Ii(iT),Ii(CT.sagas),Ii(KI.sagas),Ii(zI.sagas)])},A=function*(){yield Ti([Ii(vk.mockSagas),Ii(Wk.mockSagas),Ii(KI.mockSagas)])};n?(l.store.destroy=t.run(A).cancel,l.store.dispatch(Io.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var JI=n(714),QI=n.n(JI);function YI(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function XI(e){if(e.type)return e;if("#"===e.charAt(0))return XI(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 ZI(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 eE(e){if(0===e.indexOf("#"))return e;const{values:t}=XI(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 tE(e,t){return e=XI(e),t=YI(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,ZI(e)}function nE(e,t){if(e=XI(e),t=YI(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 ZI(e)}function oE(e,t){if(e=XI(e),t=YI(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 ZI(e)}const iE=e=>{if(e)return{main:e,light:eE(oE(e,.4)),dark:eE(nE(e,.15)),hover:eE(nE(e,.15)),active:eE(nE(e,.2))}},aE=e=>{if(e)return{main:e,light:oE(e,.7),dark:nE(e,.2)}},rE=(e,t)=>{var n,o,i,a,r,l,s,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?U({},t,{palette:{primary:U({},iE(null==e||null==(o=e.palette)?void 0:o.primary),{contrastText:null!=(i=null==e||null==(a=e.palette)?void 0:a.primaryText)?i:"#000000"}),secondary:U({},iE(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(l=null==e||null==(s=e.palette)?void 0:s.secondaryText)?l:"#000000"}),danger:U({},iE(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:U({},aE(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:U({},aE(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:U({},aE(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:U({},aE(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},lE={},sE={},cE={},uE={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},provisioning:{visibility:"hidden",permissions:["fe.secure.read.provisioningConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]},allAccounts:{visibility:"hidden"}};class dE{constructor(){this._theme=lE,this._themeV2=sE,this._navigation=uE,this._localizations=cE}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new dE;return n.set(e),dE._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=QI().all([null!=(t=uE)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=QI().all([null!=(o=lE)?o:{},rE(null==e?void 0:e.theme,lE)]),this._themeV2=QI().all([null!=(i=sE)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=QI().all([null!=(r=cE)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=uE,this._theme=lE,this._themeV2=sE,this._localizations=cE}}}dE._instances={};var yE=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},fE=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},pE=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)}))},gE=function(e){var t=e.toString();if(t){var n=new URL(window.location.href);n.search=t,window.history.pushState(null,"",n.toString())}};let SE,vE,hE,mE,AE,bE,kE,TE,PE,IE,EE;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(SE||(SE={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(vE||(vE={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(hE||(hE={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(mE||(mE={})),function(e){e.Invoices="invoices"}(AE||(AE={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(bE||(bE={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(kE||(kE={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(TE||(TE={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(PE||(PE={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(IE||(IE={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(EE||(EE={}));const LE={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},OE={hidden:"hidden",edit:"edit"};var wE="6.110.0",UE={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on","show-passkeys-new":"on","groups-admin-box-new":"on","msp-all-accounts-new":"on"},CE=function(){function e(t,n){var o,i=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];P(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(wE),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=ur,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:dE.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}qd.set(UE,i.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Hd();case 7:t=e.sent,i.options.overrideFeatureFlags&&Object.assign(t,i.options.overrideFeatureFlags),qd.set(t,i.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.updateLocalizationsSetter=function(e){i.updateLocalizations=e};var l=yE(n),s="frontegg-app-".concat(l);this.iframeRendering=a,this.name=l,this.options=U({},t,{contextOptions:U({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=s;var c,u,d=this.options.authOptions?U({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(o=this.options.authOptions)?void 0:o.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=HI({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);w.setInstance(l,this)}var t,n,o,i;return O(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,this.loadFeatureFlags();case 9:return e.next=11,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize()]);case 11:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 13:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;dE.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:k,FronteggTypes:T})):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 Ta.setRequestSource(ao.AdminPortal),e.next=3,this.loadScript("FronteggAdminPortal");case 3:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e,t=new URLSearchParams(window.location.search);null==(e=this.adminPortalRenderer)||e.unmount(),gE(t),Ta.setRequestSource(null)}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,U({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"getEntitlements",value:function(e){var t;return((e={},t)=>t.reduce(((t,n)=>[...t,{isEntitled:e[n]||!1}]),[]))(null==(t=this.store.getState().auth.entitlementsState)?void 0:t.entitlements,e)}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),DE=function(){function e(){P(this,e)}return O(e,null,[{key:"setAuthentication",value:function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",i=w.getInstance(o);e&&t?(Ta.setAccessToken(t),Ta.setUser(U({},n,{accessToken:t})),i.store.dispatch(Io.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(Io.loadTenants())):(Ta.setAccessToken(null),Ta.setUser(null),i.store.dispatch(Io.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),_E=function(){function e(){P(this,e)}return O(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideAdminPortal()}}]),e}(),RE=function(){function e(){P(this,e)}return O(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";w.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideCheckoutDialog()}}]),e}(),ME=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},NE=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=HI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=U({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},i),this.app=new CE(this.options,t,!0),dE.set({},t)}var t;return O(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,pE(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}(),FE="modern",GE=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[FE]},$E=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=HI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=U({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},i),this.app=new CE(this.options,t,!0,a),dE.set({},t)}var t;return O(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,pE(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 xE(e,t){return xE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xE(e,t)}function VE(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&&xE(e,t)}function jE(e,t){if(t&&("object"===I(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function WE(e){return WE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},WE(e)}function BE(){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 KE(e,t,n){return KE=BE()?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&&xE(i,n.prototype),i},KE.apply(null,arguments)}function zE(e){var t="function"==typeof Map?new Map:void 0;return zE=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 KE(e,arguments,WE(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),xE(n,e)},zE(e)}function qE(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=WE(e);if(t){var i=WE(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return jE(this,n)}}var HE=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new CE(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){VE(n,e);var t=qE(n);function n(){var e;P(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).app=null,e}return O(n,[{key:"connectedCallback",value:function(){this.updateContent()}},{key:"attributeChangedCallback",value:function(e,t,n){if("app-name"===e){if(null===t)return;if(t===n)return;this.innerHTML="",null===n?this.remove():this.updateContent()}console.debug("attributeChangedCallback",e,t,n)}},{key:"updateContent",value:function(){var e,t=null!=(e=this.getAttribute("app-name"))?e:"default",n=w.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var o=fE(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=fE(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=fE(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=fE(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=fE(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=fE(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}(zE(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}()}));
|