@frontegg/js 6.166.0-alpha.2 → 6.166.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/AdminPortalRenderer/index.js +1 -2
- package/FronteggApp/FronteggApp.js +7 -8
- package/HostedLogin/index.js +1 -2
- package/LoginBoxRenderer/index.js +1 -2
- package/index.js +1 -1
- package/node/AdminPortalRenderer/index.js +1 -2
- package/node/FronteggApp/FronteggApp.js +7 -8
- package/node/HostedLogin/index.js +1 -2
- package/node/LoginBoxRenderer/index.js +1 -2
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg-helpers.production.min.js +1 -1
- package/umd/frontegg.development.js +118 -126
- 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={987:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createConditionEvaluator=void 0;const i=n(651),o=n(82);t.createConditionEvaluator=function(e){const t=(0,o.useSanitizer)(e.condition.op);if(!t)return()=>!1;const{isSanitized:n,sanitizedValue:a}=t(e.condition.value);if(!n||void 0===a)return()=>!1;const r=(0,i.useOperation)(e.condition.op,a);return t=>{const n=t[e.condition.attribute],{isValid:i}=void 0!==n&&r?r(n):{isValid:!1};return e.condition.negate?!i:i}}},898:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(987),t),o(n(371),t)},371:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},840:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateFeatureFlag=void 0;const i=n(380);t.evaluateFeatureFlag=function(e,t){if(!e.on)return{treatment:e.offTreatment};const n=function(e,t){var n;return null===(n=e.rules)||void 0===n?void 0:n.find((e=>(0,i.createRuleEvaluator)({rule:e})(t)===i.RuleEvaluationResultEnum.Treatable))}(e,t);return n?{treatment:n.treatment}:{treatment:e.defaultTreatment}}},95:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(840),t)},314:function(e,t,n){"use strict";t.wJ=t.tE=void 0;n(95),n(380),n(379);var i=n(535);Object.defineProperty(t,"tE",{enumerable:!0,get:function(){return i.evaluateIsEntitledToFeature}}),Object.defineProperty(t,"wJ",{enumerable:!0,get:function(){return i.evaluateIsEntitledToPermissions}})},195:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanOperationsMapper=void 0;const a=n(379),r=n(615);o(n(615),t),o(n(226),t),t.BooleanOperationsMapper={[a.OperationEnum.Is]:e=>(0,r.useIsOperation)(e)}},615:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useIsOperation=void 0,t.useIsOperation=function(e){return t=>({isValid:t===e.boolean})}},226:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanSanitizersMapper=t.singleBooleanSanitizer=void 0;const i=n(379);t.singleBooleanSanitizer=e=>{const t=void 0!==e.boolean&&(e=>"boolean"==typeof e)(e.boolean)?{boolean:e.boolean}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.BooleanSanitizersMapper={[i.OperationEnum.Is]:t.singleBooleanSanitizer}},651:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useOperation=void 0;const i=n(943),o=n(610),a=n(4),r=n(195),s={...i.StringOperationsMapper,...o.NumericOperationsMapper,...a.DateOperationsMapper,...r.BooleanOperationsMapper};t.useOperation=function(e,t){const n=s[e];return n?n(t):void 0}},82:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useSanitizer=void 0;const i=n(195),o=n(903),a=n(886),r=n(610),s={...o.StringSanitizersMapper,...r.NumericSanitizersMapper,...a.DateSanitizersMapper,...i.BooleanSanitizersMapper};t.useSanitizer=function(e){return s[e]}},4:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.DateOperationsMapper=void 0;const a=n(379),r=n(569);o(n(569),t),o(n(931),t),t.DateOperationsMapper={[a.OperationEnum.On]:e=>(0,r.useDateOnOperation)(e),[a.OperationEnum.OnOrAfter]:e=>(0,r.useDateOnOrAfterOperation)(e),[a.OperationEnum.OnOrBefore]:e=>(0,r.useDateOnOrBeforeOperation)(e),[a.OperationEnum.BetweenDate]:e=>(0,r.useDateBetweenOperation)(e)}},569:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useDateBetweenOperation=t.useDateOnOrBeforeOperation=t.useDateOnOrAfterOperation=t.useDateOnOperation=void 0,t.useDateOnOperation=function(e){return t=>({isValid:t.getTime()===e.date.getTime()})},t.useDateOnOrAfterOperation=function(e){return t=>({isValid:t.getTime()>=e.date.getTime()})},t.useDateOnOrBeforeOperation=function(e){return t=>({isValid:t.getTime()<=e.date.getTime()})},t.useDateBetweenOperation=function(e){return t=>({isValid:t.getTime()>=e.start.getTime()&&t.getTime()<=e.end.getTime()})}},886:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DateSanitizersMapper=t.sanitizeDateRange=t.sanitizeSingleDate=t.isValidDate=t.sanitizeDateValue=void 0;const i=n(379);t.sanitizeDateValue=e=>new Date(e),t.isValidDate=e=>e instanceof Date&&!isNaN(e),t.sanitizeSingleDate=e=>{const n=e.date?(0,t.sanitizeDateValue)(e.date):void 0,i=n&&(0,t.isValidDate)(n)?{date:n}:void 0;return{isSanitized:!!i,sanitizedValue:i}},t.sanitizeDateRange=e=>{const n=e.start?(0,t.sanitizeDateValue)(e.start):void 0,i=e.end?(0,t.sanitizeDateValue)(e.end):void 0,o=n&&i&&(0,t.isValidDate)(n)&&(0,t.isValidDate)(i)?{start:n,end:i}:void 0;return{isSanitized:!!o,sanitizedValue:o}},t.DateSanitizersMapper={[i.OperationEnum.On]:t.sanitizeSingleDate,[i.OperationEnum.OnOrAfter]:t.sanitizeSingleDate,[i.OperationEnum.OnOrBefore]:t.sanitizeSingleDate,[i.OperationEnum.BetweenDate]:t.sanitizeDateRange}},931:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},610:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.NumericOperationsMapper=void 0;const a=n(379),r=n(217);t.NumericOperationsMapper={[a.OperationEnum.Equal]:e=>(0,r.useEqualsOperation)(e),[a.OperationEnum.GreaterThan]:e=>(0,r.useGreaterThanOperation)(e),[a.OperationEnum.GreaterThanEqual]:e=>(0,r.useGreaterThanEqualOperation)(e),[a.OperationEnum.LesserThan]:e=>(0,r.useLesserThanOperation)(e),[a.OperationEnum.LesserThanEqual]:e=>(0,r.useLesserThanEqualOperation)(e),[a.OperationEnum.BetweenNumeric]:e=>(0,r.useBetweenNumericOperation)(e)},o(n(217),t),o(n(326),t),o(n(764),t)},217:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useBetweenNumericOperation=t.useLesserThanEqualOperation=t.useLesserThanOperation=t.useGreaterThanEqualOperation=t.useGreaterThanOperation=t.useEqualsOperation=void 0,t.useEqualsOperation=function(e){return t=>({isValid:t===e.number})},t.useGreaterThanOperation=function(e){return t=>({isValid:t>e.number})},t.useGreaterThanEqualOperation=function(e){return t=>({isValid:t>=e.number})},t.useLesserThanOperation=function(e){return t=>({isValid:t<e.number})},t.useLesserThanEqualOperation=function(e){return t=>({isValid:t<=e.number})},t.useBetweenNumericOperation=function(e){return t=>({isValid:t>=e.start&&t<=e.end})}},326:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NumericSanitizersMapper=t.sanitizeNumericRange=t.sanitizeSingleNumber=void 0;const i=n(379),o=e=>"number"==typeof e;t.sanitizeSingleNumber=e=>{const t=void 0!==e.number&&o(e.number)?{number:e.number}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.sanitizeNumericRange=e=>{const t=void 0!==e.start&&void 0!==e.end&&o(e.start)&&o(e.end)?{start:e.start,end:e.end}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.NumericSanitizersMapper={[i.OperationEnum.Equal]:t.sanitizeSingleNumber,[i.OperationEnum.GreaterThan]:t.sanitizeSingleNumber,[i.OperationEnum.GreaterThanEqual]:t.sanitizeSingleNumber,[i.OperationEnum.LesserThan]:t.sanitizeSingleNumber,[i.OperationEnum.LesserThanEqual]:t.sanitizeSingleNumber,[i.OperationEnum.BetweenNumeric]:t.sanitizeNumericRange}},764:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},943:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.StringOperationsMapper=void 0;const a=n(379),r=n(431);o(n(431),t),o(n(97),t),t.StringOperationsMapper={[a.OperationEnum.StartsWith]:e=>(0,r.useStartsWithOperation)(e),[a.OperationEnum.EndsWith]:e=>(0,r.useEndsWithOperation)(e),[a.OperationEnum.Contains]:e=>(0,r.useContainsOperation)(e),[a.OperationEnum.InList]:e=>(0,r.useInListOperation)(e),[a.OperationEnum.Matches]:e=>(0,r.useMatchesOperation)(e)}},431:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useMatchesOperation=t.useInListOperation=t.useContainsOperation=t.useEndsWithOperation=t.useStartsWithOperation=void 0,t.useStartsWithOperation=function(e){return t=>({isValid:e.list.some((e=>t.startsWith(e)))})},t.useEndsWithOperation=function(e){return t=>({isValid:e.list.some((e=>t.endsWith(e)))})},t.useContainsOperation=function(e){return t=>({isValid:e.list.some((e=>t.includes(e)))})},t.useInListOperation=function(e){return t=>({isValid:e.list.includes(t)})},t.useMatchesOperation=function(e){return t=>{let n;try{n=new RegExp(e.string)}catch(e){return{isValid:!1}}return{isValid:n.test(t)}}}},903:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringSanitizersMapper=t.sanitizeListString=t.sanitizeSingleString=void 0;const i=n(379),o=e=>"string"==typeof e;t.sanitizeSingleString=e=>{const t=void 0!==e.string&&o(e.string)?{string:e.string}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.sanitizeListString=e=>{const t=void 0!==e.list&&e.list.every((e=>o(e)))?{list:e.list}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.StringSanitizersMapper={[i.OperationEnum.Matches]:t.sanitizeSingleString,[i.OperationEnum.Contains]:t.sanitizeListString,[i.OperationEnum.StartsWith]:t.sanitizeListString,[i.OperationEnum.EndsWith]:t.sanitizeListString,[i.OperationEnum.InList]:t.sanitizeListString}},97:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},379:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(982),t)},982:function(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.OperationEnum=void 0,(n=t.OperationEnum||(t.OperationEnum={})).InList="in_list",n.StartsWith="starts_with",n.EndsWith="ends_with",n.Contains="contains",n.Matches="matches",n.Equal="equal",n.GreaterThan="greater_than",n.GreaterThanEqual="greater_than_equal",n.LesserThan="lower_than",n.LesserThanEqual="lower_than_equal",n.BetweenNumeric="between_numeric",n.Is="is",n.On="on",n.BetweenDate="between_date",n.OnOrAfter="on_or_after",n.OnOrBefore="on_or_before"},380:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(930),t),o(n(304),t)},304:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createRuleEvaluator=void 0;const i=n(930),o=n(898);t.createRuleEvaluator=function(e){return t=>e.rule.conditions.every((e=>(0,o.createConditionEvaluator)({condition:e})(t)))?i.RuleEvaluationResultEnum.Treatable:i.RuleEvaluationResultEnum.Insufficient}},930:function(e,t){"use strict";var n,i;Object.defineProperty(t,"__esModule",{value:!0}),t.RuleEvaluationResultEnum=t.TreatmentEnum=t.ConditionLogicEnum=void 0,(t.ConditionLogicEnum||(t.ConditionLogicEnum={})).And="and",(i=t.TreatmentEnum||(t.TreatmentEnum={})).True="true",i.False="false",(n=t.RuleEvaluationResultEnum||(t.RuleEvaluationResultEnum={})).Treatable="treatable",n.Insufficient="insufficient"},950:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.modifyObjectKeysWithPrefix=t.defaultFronteggAttributesMapper=t.prepareAttributes=void 0;const i=n(137);function o(e){return{email:e.email,emailVerified:e.email_verified,tenantId:e.tenantId,userId:e.id}}function a(e,t){return Object.keys(e).reduce(((n,i)=>(n[`${t}${i}`]=e[i],n)),{})}t.prepareAttributes=function(e={},t){const{custom:n={},jwt:r={}}=e,s=(0,i.flatten)(r);return{...n,...a(t?t(r):o(r),"frontegg."),...a(s,"jwt.")}},t.defaultFronteggAttributesMapper=o,t.modifyObjectKeysWithPrefix=a},137:function(e,t){"use strict";function n(e){return e}Object.defineProperty(t,"__esModule",{value:!0}),t.flatten=void 0,t.flatten=function(e,t){const i=(null==(t=t||{})?void 0:t.delimiter)||".",o=null==t?void 0:t.maxDepth,a=(null==t?void 0:t.transformKey)||n,r={};return function e(n,s,l){l=l||1,Object.keys(n).forEach((function(c){const u=n[c],d=(null==t?void 0:t.safe)&&Array.isArray(u),y=Object.prototype.toString.call(u),f=(p=u)&&p.constructor&&"function"==typeof p.constructor.isBuffer&&p.constructor.isBuffer(p);var p;const g="[object Object]"===y||"[object Array]"===y,S=s?s+i+a(c):a(c);if(!d&&!f&&g&&Object.keys(u).length&&(!(null==t?void 0:t.maxDepth)||o&&l<o))return e(u,S,l+1);r[S]=u}))}(e),r}},535:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(405),t),o(n(113),t),o(n(950),t),o(n(387),t)},405:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateIsEntitledToPermissions=t.evaluateIsEntitledToFeature=void 0;const i=n(113),o=n(95),a=n(950),r=n(380),s=n(387);function l(e,t,n={}){const s=t.features[e];let l=!1;if(s&&null!==s.expireTime&&(l=s.expireTime!==i.NO_EXPIRATION_TIME&&s.expireTime<Date.now(),!l))return{isEntitled:!0};if(s&&s.featureFlag){const e=(0,a.prepareAttributes)(n),{treatment:t}=(0,o.evaluateFeatureFlag)(s.featureFlag,e);if(t===r.TreatmentEnum.True)return{isEntitled:!0}}return{isEntitled:!1,justification:l?i.NotEntitledJustification.BUNDLE_EXPIRED:i.NotEntitledJustification.MISSING_FEATURE}}t.evaluateIsEntitledToFeature=l,t.evaluateIsEntitledToPermissions=function(e,t,n){if(!(0,s.checkPermission)(t.permissions,e))return{isEntitled:!1,justification:i.NotEntitledJustification.MISSING_PERMISSION};const o=function(e,t){return Object.keys(t.features).filter((n=>t.features[n].linkedPermissions.includes(e)))}(e,t);if(!o.length)return{isEntitled:!0};let a=!1;for(const e of o){const{isEntitled:o,justification:r}=l(e,t,n);if(o)return{isEntitled:!0};r===i.NotEntitledJustification.BUNDLE_EXPIRED&&(a=!0)}return{isEntitled:!1,justification:a?i.NotEntitledJustification.BUNDLE_EXPIRED:i.NotEntitledJustification.MISSING_FEATURE}}},387:function(e,t){"use strict";function n(e){return new RegExp("^"+e.replace(/\./g,"\\.").replace(/\*/g,".*")+"$","gs")}Object.defineProperty(t,"__esModule",{value:!0}),t.createPermissionCheckRegex=t.checkPermission=void 0,t.checkPermission=function(e,t){return Object.keys(e).some((e=>n(e).test(t)))},t.createPermissionCheckRegex=n},113:function(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.NO_EXPIRATION_TIME=t.NotEntitledJustification=void 0,(n=t.NotEntitledJustification||(t.NotEntitledJustification={})).MISSING_FEATURE="MISSING_FEATURE",n.MISSING_PERMISSION="MISSING_PERMISSION",n.BUNDLE_EXPIRED="BUNDLE_EXPIRED",t.NO_EXPIRATION_TIME=-1},714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function s(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||o,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?l.arrayMerge(e,n,l):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,l):i(n,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})};var l=s;e.exports=l},378:function(e){"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,o,a;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(o=i;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=i;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,a[o]))return!1;for(o=i;0!=o--;){var r=a[o];if(!e(t[r],n[r]))return!1}return!0}return t!=t&&n!=n}},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),s=new _(i||[]);return r(a,"_invoke",{value:k(e,n,s)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,l,(function(){return this}));var m=Object.getPrototypeOf,A=m&&m(m(L([])));A&&A!==n&&a.call(A,l)&&(h=A);var b=v.prototype=g.prototype=Object.create(h);function T(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(o,r,s,l){var c=f(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var o;r(this,"_invoke",{value:function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}})}function k(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var s=I(r,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=f(e,t,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function I(e,t){var n=t.method,i=e.iterator[n];if(void 0===i)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var o=f(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,p;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function L(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return S.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},T(E.prototype),d(E.prototype,c,(function(){return this})),t.AsyncIterator=E,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new E(y(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},T(b),d(b,u,"Generator"),d(b,l,(function(){return this})),d(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=L,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(P),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=a.call(o,"catchLoc"),l=a.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;P(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:L(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i].call(a.exports,a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return sw},AdminPortalRenderer:function(){return uw},AppHolder:function(){return U},CheckoutDialog:function(){return lw},FronteggApp:function(){return aw},HostedLogin:function(){return rw},LoginBoxRenderer:function(){return fw},createElement:function(){return xL},defaultTheme:function(){return dw},formatName:function(){return $L},getThemeAdminByName:function(){return cw},getThemeByName:function(){return yw},initialize:function(){return Tw},mockFlagsList:function(){return ow},restoreSearchParams:function(){return jL},waitThemeSetter:function(){return VL}});var e={};n.r(e),n.d(e,{Delete:function(){return Fr},Get:function(){return Rr},Patch:function(){return Nr},Post:function(){return Dr},PostDownload:function(){return Gr},Put:function(){return Mr},extractHeadersFromOptions:function(){return $r},getBaseUrl:function(){return Lr},getMetadataHeaders:function(){return wr},getScopedTenant:function(){return Ur}});var t={};n.r(t),n.d(t,{FeatureFlags:function(){return Br},loadFeatureFlags:function(){return Wr}});var o={};n.r(o),n.d(o,{GetUserJwt:function(){return zr},getCurrentUserTenantsV1:function(){return Xr},getCurrentUserTenantsV3:function(){return Yr},getUsersGroups:function(){return Jr},getUsersRoles:function(){return qr},getUsersV2:function(){return Kr},getUsersV3:function(){return Hr},sendResetBreachedPasswordEmails:function(){return Qr},updateUserProfileV2:function(){return Zr}});var a={};n.r(a),n.d(a,{getHierarchyMetadata:function(){return ds},getParentTenants:function(){return ss},getParentTenantsById:function(){return ls},getSubTenants:function(){return as},getSubTenantsAsTree:function(){return rs},getTenants:function(){return os},getTenantsUsersCount:function(){return cs},searchSubTenants:function(){return us},switchTenant:function(){return is}});var r={};n.r(r),n.d(r,{loadEntitlements:function(){return zs},loadEntitlementsV2:function(){return Ks}});var s={};n.r(s),n.d(s,{AuthStrategyEnum:function(){return Ii},MachineToMachineAuthStrategy:function(){return Oi},OAuthLogout:function(){return El},SocialLoginProviders:function(){return ki},acceptInvitation:function(){return hl},activateAccount:function(){return fl},activateAccountV2:function(){return pl},bulkCreateIPRestriction:function(){return Cs},changePhoneNumber:function(){return Ou},changePhoneNumberWithVerification:function(){return ku},checkIfAllowToRememberMfaDevice:function(){return qc},createDomainRestriction:function(){return Os},createIPRestriction:function(){return Us},createOrUpdateSessionConfigrations:function(){return Cc},createSSOConfiguration:function(){return eu},createSSOConfigurationByMetadata:function(){return iu},createSSOConfigurationByMetadataUrl:function(){return au},createSSODomain:function(){return su},createSSOGroup:function(){return yu},createSamlGroup:function(){return Sc},createTenantAccessToken:function(){return xc},createUserAccessToken:function(){return $c},deleteAllSessionsForUser:function(){return Dc},deleteDomainRestriction:function(){return _s},deleteIPRestriction:function(){return Ds},deleteSSOConfiguration:function(){return nu},deleteSSODomain:function(){return lu},deleteSSOGroup:function(){return pu},deleteSamlGroup:function(){return hc},deleteSessionForUser:function(){return Rc},deleteTenantAccessToken:function(){return Fc},deleteTenantApiToken:function(){return zc},deleteUserAccessToken:function(){return Gc},deleteUserApiToken:function(){return Kc},deleteWebAuthnDevice:function(){return Cu},disableMFAAuthenticatorApp:function(){return Fl},disableMFASMS:function(){return $l},disableMFAWebAuthn:function(){return Vl},disableMfa:function(){return Ml},enrollMFAAuthenticatorApp:function(){return wl},enrollMFAAuthenticatorAppForLogin:function(){return Wl},enrollMFAAuthenticatorAppForLoginV2:function(){return zl},enrollMFASMS:function(){return Cl},enrollMFASMSForLogin:function(){return Xl},enrollMFASMSForLoginV2:function(){return Ql},enrollMFAWebAuthn:function(){return Dl},enrollMFAWebAuthnForLogin:function(){return ic},enrollMFAWebAuthnForLoginV2:function(){return oc},enrollMfa:function(){return _l},exchangeOAuthTokens:function(){return Au},exchangeOAuthTokensV2:function(){return hu},forgotPassword:function(){return kl},generateLoginResponse:function(){return Qs},generateLoginResponseFromOAuthResponse:function(){return il},generateLoginResponseFromOAuthResponseV2:function(){return ol},generateLoginResponseV2:function(){return Zs},generateLoginResponseV3:function(){return nl},generateStepupSession:function(){return xu},getActivateAccountStrategy:function(){return gl},getCaptchaPolicy:function(){return ms},getCurrentUserSession:function(){return Lc},getCurrentUserSessions:function(){return _c},getCurrentUserTenantsFunction:function(){return ns},getCustomSocialLoginProvidersV1:function(){return kc},getDomainRestrictions:function(){return ks},getDomainRestrictionsConfig:function(){return Is},getGlobalSecurityPolicy:function(){return ys},getIPRestrictions:function(){return Ls},getIPRestrictionsConfig:function(){return ws},getLockoutPolicy:function(){return Ss},getMFADevices:function(){return jl},getMFAStrategiesConfig:function(){return Mu},getMeAndEntitlements:function(){return $u},getMeV2:function(){return Gu},getMfaPolicy:function(){return fs},getOidcConfiguration:function(){return mc},getPasswordConfigPolicy:function(){return Es},getPasswordHistoryPolicy:function(){return As},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return Nu},getSSOConfigurations:function(){return Zc},getSSODefaultRoles:function(){return uu},getSSOGroups:function(){return gu},getSSOPublicConfiguration:function(){return Ac},getSamlConfiguration:function(){return lc},getSamlRoles:function(){return fc},getSamlRolesGroups:function(){return pc},getSamlVendorConfiguration:function(){return uc},getSessionConfigurations:function(){return Uc},getSocialLoginProviders:function(){return bc},getSocialLoginProvidersV2:function(){return Tc},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return Ec},getTabTenantFromSessionStorage:function(){return ts},getTenantAccessTokensData:function(){return Mc},getTenantApiTokensData:function(){return jc},getUserAccessTokensData:function(){return Nc},getUserApiTokensData:function(){return Vc},getUserAuthorization:function(){return Fu},getUserById:function(){return Hc},getVendorConfig:function(){return Oc},getVendorLockoutPolicy:function(){return vs},getVendorMfaPolicy:function(){return ps},getVendorPasswordHistoryPolicy:function(){return bs},getVendorPublicAuthStrategiesConfig:function(){return Du},getWebAuthnDevices:function(){return Uu},loadPasswordConfig:function(){return Ol},login:function(){return cl},loginViaSocialLogin:function(){return Ic},loginWithMfa:function(){return dl},loginWithMfaV2:function(){return yl},loginv2:function(){return ul},logout:function(){return Tl},oidcPostLogin:function(){return ll},oidcPostLoginV2:function(){return vu},passwordlessPostLogin:function(){return Xc},passwordlessPostLoginV2:function(){return Yc},passwordlessPreLogin:function(){return Jc},postLogin:function(){return sl},preDisableMFASMS:function(){return Gl},preDisableMFAWebAuthn:function(){return xl},preEnrollMFAAuthenticatorApp:function(){return Ll},preEnrollMFAAuthenticatorAppForLogin:function(){return Bl},preEnrollMFASMS:function(){return Ul},preEnrollMFASMSForLogin:function(){return Yl},preEnrollMFAWebAuthn:function(){return Rl},preEnrollMFAWebAuthnForLogin:function(){return nc},preLogin:function(){return al},preLoginV2:function(){return Su},preLoginWithIdpType:function(){return rl},preVerifyMFAEmailCode:function(){return Hl},preVerifyMFASMSForLogin:function(){return Zl},preVerifyMFAWebAuthnForLogin:function(){return ac},recoverMfaToken:function(){return Pl},refreshToken:function(){return ml},refreshTokenV2:function(){return Al},refreshTokenV3:function(){return bl},resendActivationEmail:function(){return Sl},resendInvitationEmail:function(){return vl},resetPassword:function(){return Il},resetPhoneNumber:function(){return Tu},revokeSessionsForUser:function(){return wc},saveLockoutPolicy:function(){return hs},saveMfaPolicy:function(){return gs},savePasswordHistoryPolicy:function(){return Ts},setSSODefaultRoles:function(){return du},setTabTenantInSessionStorage:function(){return es},signUpUser:function(){return Pc},silentOAuthRefreshToken:function(){return bu},silentOAuthRefreshTokenV2:function(){return mu},testCurrentIp:function(){return Ns},testCurrentIpInAllowList:function(){return Ms},updateDomainRestrictionConfig:function(){return Ps},updateIPRestrictionConfig:function(){return Rs},updateSSOConfiguration:function(){return tu},updateSSOConfigurationByMetadata:function(){return ou},updateSSOConfigurationByMetadataUrl:function(){return ru},updateSSOGroup:function(){return fu},updateSamlConfiguration:function(){return cc},updateSamlGroup:function(){return vc},updateSamlRoles:function(){return gc},updateSamlVendorMetadata:function(){return dc},updateTenantApiTokensData:function(){return Wc},updateUserApiTokensData:function(){return Bc},validateSSODomain:function(){return cu},validateSamlDomain:function(){return yc},verifyChangePhoneNumber:function(){return Iu},verifyInviteToken:function(){return Qc},verifyMFAAuthenticatorAppForLogin:function(){return Kl},verifyMFAEmailCode:function(){return ql},verifyMFAEmailCodeV2:function(){return Jl},verifyMFASMSForLogin:function(){return ec},verifyMFASMSForLoginV2:function(){return tc},verifyMFAWebAuthnForLogin:function(){return rc},verifyMFAWebAuthnForLoginV2:function(){return sc},verifyMfa:function(){return Nl},verifyNewDeviceSession:function(){return Ru},verifyResetPhoneNumber:function(){return Eu},webAuthnCreateNewDeviceSession:function(){return wu},webAuthnPostLogin:function(){return _u},webAuthnPostLoginV2:function(){return Lu},webAuthnPreLogin:function(){return Pu}});var l={};n.r(l),n.d(l,{addUser:function(){return Ku},changePassword:function(){return Wu},createInviteUserLink:function(){return Qu},deleteInviteUserLink:function(){return ed},deleteUser:function(){return Hu},getInviteLinkConfiguration:function(){return nd},getInviteUserLink:function(){return td},getProfile:function(){return Vu},getTemporaryUserConfiguration:function(){return Xu},loadAvailablePermissions:function(){return od},loadAvailableRoles:function(){return id},loadStats:function(){return ad},loadUsers:function(){return zu},resendActivationLink:function(){return rd},resendInvitationLink:function(){return sd},resendInvitationLinkToAllTenants:function(){return ld},setPermanentUser:function(){return Yu},updateInviteUserLink:function(){return Zu},updateProfile:function(){return ju},updateProfileImage:function(){return Bu},updateUser:function(){return qu},updateUserExpirationTime:function(){return Ju}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return ud},getAuditsMetadata:function(){return gd},getCurrentUserIpMetadata:function(){return yd},getIpAdressMetadata:function(){return Sd},getNotificationsMetadata:function(){return fd},getSamlMetadata:function(){return pd},updateAdminBoxMetadata:function(){return dd}});var u={};n.r(u),n.d(u,{downloadReport:function(){return kd},getReport:function(){return bd},getReports:function(){return Ad},renderReport:function(){return Td},scheduleReport:function(){return Ed},sendReport:function(){return Id}});var d={};n.r(d),n.d(d,{getNotifications:function(){return Od},markAllAsRead:function(){return Ld},updateNotificationIsPinned:function(){return _d},updateNotificationStatus:function(){return Pd}});var y={};n.r(y),n.d(y,{exportAudits:function(){return Rd},getAudits:function(){return Ud},getAuditsStats:function(){return Cd}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return Hd},deleteEmailSubscriptions:function(){return zd},deleteSMSConfiguration:function(){return Zd},deleteSMSSubscriptions:function(){return Xd},deleteSlackConfiguration:function(){return xd},deleteWebhooksConfiguration:function(){return ny},getCategories:function(){return ry},getChannelMaps:function(){return sy},getEmailConfiguration:function(){return jd},getSMSConfiguration:function(){return qd},getSlackChannels:function(){return Gd},getSlackConfiguration:function(){return Md},getSlackScope:function(){return Fd},getWebhookLog:function(){return iy},getWebhooksConfigurations:function(){return ey},patchEmailConfiguration:function(){return Wd},patchSMSConfiguration:function(){return Yd},postEmailConfiguration:function(){return Bd},postSMSConfiguration:function(){return Jd},postSlackCode:function(){return Vd},postSlackConfiguration:function(){return $d},postWebhookRetry:function(){return ay},postWebhookTest:function(){return oy},postWebhooksConfiguration:function(){return ty},putEmailSubscriptions:function(){return Kd},putSMSSubscriptions:function(){return Qd}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return uy},getSettings:function(){return cy},updateSettings:function(){return ly}});var g={};n.r(g),n.d(g,{addRole:function(){return gy},attachPermissionToRoles:function(){return Ay},attachPermissionsToRole:function(){return hy},deleteRole:function(){return Sy},getPermissionCategories:function(){return by},getPermissions:function(){return my},getRoles:function(){return py},updateRole:function(){return vy}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return Zy},ISubscriptionStatus:function(){return Xy},PaymentMethodType:function(){return Qy},ProviderType:function(){return ef},TenantCreatedAction:function(){return nf},TrialEndAction:function(){return tf},cancelManagedSubscription:function(){return Ly},cancelSubscription:function(){return ky},createStripeCustomer:function(){return By},createStripePaymentMethodSetupIntentSecret:function(){return zy},createSubscription:function(){return Vy},createTenantConfiguration:function(){return qy},getManagedSubscription:function(){return Py},getManagedSubscriptions:function(){return _y},getPaymentMethod:function(){return $y},getPaymentMethods:function(){return Gy},getPaymentProviders:function(){return Jy},getStripeCustomer:function(){return jy},getStripePaymentProviderConfiguration:function(){return Wy},getSubscription:function(){return Ey},getSubscriptionInvoice:function(){return Ny},getSubscriptionInvoicePdf:function(){return My},getSubscriptionInvoices:function(){return Dy},getSubscriptionPlan:function(){return Ry},getSubscriptionPlans:function(){return Cy},getSubscriptionSummaries:function(){return Ky},getSubscriptions:function(){return Ty},getTenantConfiguration:function(){return Hy},getVendorPublicConfigurations:function(){return Yy},renewManagedSubscription:function(){return wy},renewSubscription:function(){return Iy},updateManagedSubscription:function(){return Uy},updatePaymentMethodBillingDetails:function(){return xy},updateSubscription:function(){return Oy}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return of}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return lf},addUserToTenantAndSubTenants:function(){return rf},addUsersToSubTenant:function(){return gf},createSubTenant:function(){return df},deleteSubTenant:function(){return yf},loadAllUsers:function(){return af},removeUserFromTenantAndSubTenants:function(){return sf},removeUserRolesFromSubTenants:function(){return cf},setUserRolesForSubTenants:function(){return uf},updateSubAccountAccess:function(){return pf},updateSubTenant:function(){return ff}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return Af},createConfiguration:function(){return hf},deleteConfiguration:function(){return mf},getConfigs:function(){return Sf},updateConfiguration:function(){return vf}});var A={};n.r(A),n.d(A,{impersonate:function(){return bf}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return Lf},addUsersToGroup:function(){return Uf},createGroup:function(){return Of},deleteGroup:function(){return _f},deleteRolesFromGroup:function(){return wf},deleteUsersFromGroup:function(){return Cf},getGroupById:function(){return Ef},getGroupConfiguration:function(){return Rf},getGroups:function(){return kf},getGroupsByIds:function(){return If},updateGroup:function(){return Pf},updateGroupConfiguration:function(){return Df}});var T={};n.r(T),n.d(T,{getInsights:function(){return Mf},getRecommendations:function(){return Nf}});var E={};n.r(E),n.d(E,{createPhoneNumber:function(){return Gf},deletePhoneNumber:function(){return $f},getUserPhoneNumbers:function(){return Ff},preVerifyPhoneNumber:function(){return xf},verifyDeletePhoneNumber:function(){return jf},verifyPhoneNumber:function(){return Vf}});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return qs},AuthStrategyEnum:function(){return Ii},ContextHolder:function(){return Va},FeatureFlags:function(){return Br},FronteggApiError:function(){return Ba},FronteggContext:function(){return ja},FronteggFrameworks:function(){return di},GetUsersFilterPreset:function(){return pi},GroupManagedByEnum:function(){return ep},GroupRelations:function(){return Zf},ISubscriptionCancellationPolicy:function(){return Zy},ISubscriptionStatus:function(){return Xy},InsightCode:function(){return np},LOAD_AUTHORIZATION_FF:function(){return Ws},MFAStrategyEnum:function(){return Bs},MachineToMachineAuthStrategy:function(){return Oi},NotEntitledJustification:function(){return Hs},PaginationOrderEnum:function(){return yi},PaymentMethodType:function(){return Qy},ProviderType:function(){return ef},RecommendationActionKey:function(){return ip},RecommendationCode:function(){return tp},RecommendationSeverity:function(){return op},RequestSource:function(){return ui},RestrictionType:function(){return zn},ScimConnectionSource:function(){return Qf},SecondaryAuthStrategy:function(){return Vs},SecurityCategory:function(){return ap},SocialLoginProviders:function(){return ki},SortByEnum:function(){return fi},TenantSortByEnum:function(){return Wf},TenantType:function(){return zf},USE_ENTITLEMENTS_V2_ENDPOINT_FF:function(){return Vr},UserManagedByEnum:function(){return Bf},WebAuthnDeviceType:function(){return js},api:function(){return rp},countConfigurationUsers:function(){return Af},createConfiguration:function(){return hf},default:function(){return sp},deleteConfiguration:function(){return mf},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Kf},fronteggHeaders:function(){return ci},fronteggRefreshTokenUrl:function(){return Hf},fronteggSilentRefreshTokenUrl:function(){return qf},fronteggTenantsUrl:function(){return Yf},fronteggTenantsV3Url:function(){return Xf},fronteggUsersUrl:function(){return Jf},getConfigs:function(){return Sf},getCurrentUserTenantsFunction:function(){return ns},getTabTenantFromSessionStorage:function(){return ts},loadFeatureFlags:function(){return Wr},providersArray:function(){return gi},setTabTenantInSessionStorage:function(){return es},updateConfiguration:function(){return vf}});var I={};function O(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function _(e){var t=function(e,t){if("object"!==P(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==P(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===P(t)?t:String(t)}function L(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,_(i.key),i)}}function w(e,t,n){return t&&L(e.prototype,t),n&&L(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(I),n.d(I,{AccountDetailsPageTabs:function(){return ew},AccountPageFields:function(){return HL},DomainRestrictionsTabFields:function(){return ZL},GeneralSettingsTabFields:function(){return XL},InviteUserModalFields:function(){return KL},IpRestrictionsTabFields:function(){return QL},Metadata:function(){return GL},PrivacyPageFields:function(){return zL},ProfilePageFields:function(){return WL},SecurityPageTabs:function(){return JL},SessionManagementTabFields:function(){return YL},SignupFields:function(){return BL},SubscriptionsPageFields:function(){return qL},alpha:function(){return UL},fieldAppearance:function(){return tw},tabAppearance:function(){return nw}});var U=function(){function e(){O(this,e)}return w(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,o,a,r,s=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=a.call(n)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},D.apply(this,arguments)}function N(e,t,n,i,o,a,r){try{var s=e[a](r),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,o)}function M(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){N(a,i,o,r,s,"next",e)}function s(e){N(a,i,o,r,s,"throw",e)}r(void 0)}))}}U._apps={};var F=n(841),G=n.n(F);function $(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function x(e){return!!e&&!!e[Oe]}function V(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Pe}(e)||Array.isArray(e)||!!e[Ie]||!!e.constructor[Ie]||H(e)||q(e))}function j(e,t,n){void 0===n&&(n=!1),0===B(e)?(n?Object.keys:_e)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function B(e){var t=e[Oe];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:H(e)?2:q(e)?3:0}function W(e,t){return 2===B(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function z(e,t,n){var i=B(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function K(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function H(e){return be&&e instanceof Map}function q(e){return Te&&e instanceof Set}function J(e){return e.o||e.t}function Y(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Le(e);delete t[Oe];for(var n=_e(t),i=0;i<n.length;i++){var o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function X(e,t){return void 0===t&&(t=!1),Z(e)||x(e)||!V(e)||(B(e)>1&&(e.set=e.add=e.clear=e.delete=Q),Object.freeze(e),t&&j(e,(function(e,t){return X(t,!0)}),!0)),e}function Q(){$(2)}function Z(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function ee(e){var t=we[e];return t||$(18,e),t}function te(){return me}function ne(e,t){t&&(ee("Patches"),e.u=[],e.s=[],e.v=t)}function ie(e){oe(e),e.p.forEach(re),e.p=null}function oe(e){e===me&&(me=e.l)}function ae(e){return me={p:[],l:me,h:e,m:!0,_:0}}function re(e){var t=e[Oe];0===t.i||1===t.i?t.j():t.O=!0}function se(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||ee("ES5").S(t,e,i),i?(n[Oe].P&&(ie(t),$(4)),V(e)&&(e=le(t,e),t.l||ue(t,e)),t.u&&ee("Patches").M(n[Oe].t,e,t.u,t.s)):e=le(t,n,[]),ie(t),t.u&&t.v(t.u,t.s),e!==ke?e:void 0}function le(e,t,n){if(Z(t))return t;var i=t[Oe];if(!i)return j(t,(function(o,a){return ce(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return ue(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=Y(i.k):i.o;j(3===i.i?new Set(o):o,(function(t,a){return ce(e,i,o,t,a,n)})),ue(e,o,!1),n&&e.u&&ee("Patches").R(i,n,e.u,e.s)}return i.o}function ce(e,t,n,i,o,a){if(x(o)){var r=le(e,o,a&&t&&3!==t.i&&!W(t.D,i)?a.concat(i):void 0);if(z(n,i,r),!x(r))return;e.m=!1}if(V(o)&&!Z(o)){if(!e.h.F&&e._<1)return;le(e,o),t&&t.A.l||ue(e,o)}}function ue(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&X(t,n)}function de(e,t){var n=e[Oe];return(n?J(n):e)[t]}function ye(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=Object.getPrototypeOf(n)}}function fe(e){e.P||(e.P=!0,e.l&&fe(e.l))}function pe(e){e.o||(e.o=Y(e.t))}function ge(e,t,n){var i=H(t)?ee("MapSet").N(t,n):q(t)?ee("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:te(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Ue;n&&(o=[i],a=Ce);var r=Proxy.revocable(o,a),s=r.revoke,l=r.proxy;return i.k=l,i.j=s,l}(t,n):ee("ES5").J(t,n);return(n?n.A:te()).p.push(i),i}function Se(e){return x(e)||$(22,e),function e(t){if(!V(t))return t;var n,i=t[Oe],o=B(t);if(i){if(!i.P&&(i.i<4||!ee("ES5").K(i)))return i.t;i.I=!0,n=ve(t,o),i.I=!1}else n=ve(t,o);return j(n,(function(t,o){i&&function(e,t){return 2===B(e)?e.get(t):e[t]}(i.t,t)===o||z(n,t,e(o))})),3===o?new Set(n):n}(e)}function ve(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Y(e)}var he,me,Ae="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),be="undefined"!=typeof Map,Te="undefined"!=typeof Set,Ee="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,ke=Ae?Symbol.for("immer-nothing"):((he={})["immer-nothing"]=!0,he),Ie=Ae?Symbol.for("immer-draftable"):"__$immer_draftable",Oe=Ae?Symbol.for("immer-state"):"__$immer_state",Pe=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),_e="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Le=Object.getOwnPropertyDescriptors||function(e){var t={};return _e(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},we={},Ue={get:function(e,t){if(t===Oe)return e;var n=J(e);if(!W(n,t))return function(e,t,n){var i,o=ye(t,n);return o?"value"in o?o.value:null===(i=o.get)||void 0===i?void 0:i.call(e.k):void 0}(e,n,t);var i=n[t];return e.I||!V(i)?i:i===de(e.t,t)?(pe(e),e.o[t]=ge(e.A.h,i,e)):i},has:function(e,t){return t in J(e)},ownKeys:function(e){return Reflect.ownKeys(J(e))},set:function(e,t,n){var i=ye(J(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=de(J(e),t),a=null==o?void 0:o[Oe];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(K(n,o)&&(void 0!==n||W(e.t,t)))return!0;pe(e),fe(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==de(e.t,t)||t in e.t?(e.D[t]=!1,pe(e),fe(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=J(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){$(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){$(12)}},Ce={};j(Ue,(function(e,t){Ce[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ce.deleteProperty=function(e,t){return Ce.set.call(this,e,t,void 0)},Ce.set=function(e,t,n){return Ue.set.call(this,e[0],t,n,e[0])};var Re=function(){function e(e){var t=this;this.g=Ee,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&$(6),void 0!==i&&"function"!=typeof i&&$(7),V(e)){var s=ae(t),l=ge(t,e,void 0),c=!0;try{r=n(l),c=!1}finally{c?ie(s):oe(s)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return ne(s,i),se(e,s)}),(function(e){throw ie(s),e})):(ne(s,i),se(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===ke&&(r=void 0),t.F&&X(r,!0),i){var u=[],d=[];ee("Patches").M(e,r,u,d),i(u,d)}return r}$(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){V(e)||$(8),x(e)&&(e=Se(e));var t=ae(this),n=ge(this,e,void 0);return n[Oe].C=!0,oe(t),n},t.finishDraft=function(e,t){var n=(e&&e[Oe]).A;return ne(n,t),se(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Ee&&$(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=ee("Patches").$;return x(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),De=new Re,Ne=De.produce,Me=(De.produceWithPatches.bind(De),De.setAutoFreeze.bind(De),De.setUseProxies.bind(De),De.applyPatches.bind(De),De.createDraft.bind(De),De.finishDraft.bind(De),Ne);function Fe(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function $e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach((function(t){Fe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xe(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 Ve="function"==typeof Symbol&&Symbol.observable||"@@observable",je=function(){return Math.random().toString(36).substring(7).split("").join(".")},Be={INIT:"@@redux/INIT"+je(),REPLACE:"@@redux/REPLACE"+je(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+je()}};function We(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function ze(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(xe(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(xe(1));return n(ze)(e,t)}if("function"!=typeof e)throw new Error(xe(2));var o=e,a=t,r=[],s=r,l=!1;function c(){s===r&&(s=r.slice())}function u(){if(l)throw new Error(xe(3));return a}function d(e){if("function"!=typeof e)throw new Error(xe(4));if(l)throw new Error(xe(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(xe(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!We(e))throw new Error(xe(7));if(void 0===e.type)throw new Error(xe(8));if(l)throw new Error(xe(9));try{l=!0,a=o(a,e)}finally{l=!1}for(var t=r=s,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(xe(10));o=e,y({type:Be.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(xe(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Ve]=function(){return this},e}return y({type:Be.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Ve]=p,i}function Ke(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Be.INIT}))throw new Error(xe(12));if(void 0===n(void 0,{type:Be.PROBE_UNKNOWN_ACTION()}))throw new Error(xe(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},s=0;s<r.length;s++){var l=r[s],c=n[l],u=e[l],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(xe(14));o[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function He(){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 qe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw new Error(xe(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=He.apply(void 0,a)(n.dispatch),$e($e({},n),{},{dispatch:i})}}}function Je(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var Ye=Je();Ye.withExtraArgument=Je;var Xe,Qe=Ye,Ze=(Xe=function(e,t){return Xe=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])},Xe(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}Xe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),et=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},tt=Object.defineProperty,nt=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),it=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable,at=function(e,t,n){return t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},rt=function(e,t){for(var n in t||(t={}))it.call(t,n)&&at(e,n,t[n]);if(nt)for(var i=0,o=nt(t);i<o.length;i++)n=o[i],ot.call(t,n)&&at(e,n,t[n]);return e},st="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?He:He.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var lt=function(e){function t(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Ze(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,et([void 0],e[0].concat(this)))):new(t.bind.apply(t,et([void 0],e.concat(this))))},t}(Array);function ct(e){return V(e)?Me(e,(function(){})):e}function ut(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new lt);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(Qe):i.push(Qe.withExtraArgument(n.extraArgument))),i}function dt(e){var t,n=function(e){return ut(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,s=void 0===r?n():r,l=i.devTools,c=void 0===l||l,u=i.preloadedState,d=void 0===u?void 0:u,y=i.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Ke(a)}var p=s;"function"==typeof p&&(p=p(n));var g=qe.apply(void 0,p),S=He;c&&(S=st(rt({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=et([g],f):"function"==typeof f&&(v=f(v)),ze(t,d,S.apply(void 0,v))}function yt(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return rt(rt({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ft(e){var t,n={},i=[],o={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,o},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,i,t]}function pt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:ct(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?ft(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,l=t[2],c=void 0===l?void 0:l,u=rt(rt({},o),s);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?ft(t):[t,n,i],r=a[0],s=a[1],l=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return ct(e())};else{var c=ct(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=et([r[t.type]],s.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[l]),n.reduce((function(e,n){if(n){var i;if(x(e))return void 0===(i=n(e,t))?e:i;if(V(e))return Me(e,(function(e){return n(e,t)}));if(void 0===(i=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}return e}),e)}return u.getInitialState=o,u}(i,u,r,c)}return a.forEach((function(e){var n,i,a=o[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,i=a.prepare):n=a,r[e]=n,s[c]=n,l[e]=i?yt(c,i):yt(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:l,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var gt="listenerMiddleware";yt(gt+"/add"),yt(gt+"/removeAll"),yt(gt+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Oe];return Ue.get(t,e)},set:function(t){var n=this[Oe];Ue.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][Oe];if(!o.P)switch(o.i){case 5:i(o)&&fe(o);break;case 4:n(o)&&fe(o)}}}function n(e){for(var t=e.t,n=e.k,i=_e(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==Oe){var r=t[a];if(void 0===r&&!W(t,a))return!0;var s=n[a],l=s&&s[Oe];if(l?l.t!==r:!K(s,r))return!0}}var c=!!t[Oe];return i.length!==_e(t).length+(c?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var i=0;i<t.length;i++)if(!t.hasOwnProperty(i))return!0;return!1}var o={};!function(e,t){we[e]||(we[e]=t)}("ES5",{J:function(t,n){var i=Array.isArray(t),o=function(t,n){if(t){for(var i=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(i,""+o,e(o,!0));return i}var a=Le(n);delete a[Oe];for(var r=_e(a),s=0;s<r.length;s++){var l=r[s];a[l]=e(l,t||!!a[l].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(i,t),a={i:i?5:4,A:n?n.A:te(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,Oe,{value:a,writable:!0}),o},S:function(e,n,o){o?x(n)&&n[Oe].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Oe];if(n){var o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)j(a,(function(t){t!==Oe&&(void 0!==o[t]||W(o,t)?r[t]||e(a[t]):(r[t]=!0,fe(n)))})),j(o,(function(e){void 0!==a[e]||W(a,e)||(r[e]=!1,fe(n))}));else if(5===s){if(i(n)&&(fe(n),r.length=!0),a.length<o.length)for(var l=a.length;l<o.length;l++)r[l]=!1;else for(var c=o.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,o.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}();const St=(e,t)=>n=>D({},n,{[e]:t[e]}),vt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>D({},t,{[e]:D({},t[e],n)})}),ht=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return D({},n,{[e]:D({},n[e],{[t]:D({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),mt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i,o;return D({},t,{[e]:D({},t[e],{loaders:D({},null==(i=t[e])?void 0:i.loaders,{[n.key]:null==(o=n.value)||o})})})}}),At=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return D({},t,{[e]:D({},t[e],{errors:D({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),bt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:o})=>{var a;return D({},i,{[e]:D({},i[e],{[t]:D({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),Tt=(e,t,n)=>i=>{var o;return D({},i,{[e]:D({},i[e],{[t]:D({},null==i||null==(o=i[e])?void 0:o[t],n)})})},Et=(e=500)=>new Promise((t=>setTimeout(t,e))),kt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",It=new Uint8Array(256);for(let e=0;e<kt.length;e++)It[kt.charCodeAt(e)]=e;const Ot=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,s,l=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=It[e.charCodeAt(i)],a=It[e.charCodeAt(i+1)],r=It[e.charCodeAt(i+2)],s=It[e.charCodeAt(i+3)],c[l++]=o<<2|a>>4,c[l++]=(15&a)<<4|r>>2,c[l++]=(3&r)<<6|63&s;return c.buffer},Pt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(Pt(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let i,o="";for(i=0;i<n;i+=3)o+=kt[t[i]>>2],o+=kt[(3&t[i])<<4|t[i+1]>>4],o+=kt[(15&t[i+1])<<2|t[i+2]>>6],o+=kt[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1):n%3==1&&(o=o.substring(0,o.length-2)),o})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=Pt(e[n]);return t}return e};let _t,Lt,wt,Ut;!function(e){e.preLogin="preLogin",e.magicLinkPreLoginSuccess="magicLinkPreLoginSuccess",e.loginWithSmsOtc="loginWithSmsOtc",e.loginWithQuickSmsOtc="loginWithQuickSmsOtc",e.loginWithOtc="loginWithOtc",e.loginWithPassword="loginWithPassword",e.loginWithTwoFactor="loginWithTwoFactor",e.redirectToSSO="redirectToSSO",e.loginWithSSOFailed="loginWithSSOFailed",e.success="success",e.forceTwoFactor="forceTwoFactor",e.recoverTwoFactor="recoverTwoFactor",e.promptPasskeys="promptPasskeys",e.breachedPassword="breachedPassword",e.breachedPasswordSuccess="breachedPasswordSuccess"}(_t||(_t={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Lt||(Lt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(wt||(wt={})),function(e){e["social-login"]="social-login",e["custom-social-login"]="custom-social-login",e.direct="direct"}(Ut||(Ut={}));const Ct="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Rt="HOSTED_LOGIN_VERIFIER_KEY",Dt="auth",Nt="connectivity",Mt="auditLogs",Ft="vendor",Gt={flow:Lt.Login,step:_t.preLogin,loading:!1,email:"",tenants:[]},$t={setLoginState:vt("loginState"),resetLoginState:St("loginState",{loginState:Gt})},xt={requestAuthorize:yt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:yt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:yt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),requestHostedLoginAuthorizeV2:yt("auth/requestHostedLoginAuthorizeV2",(e=>({payload:e}))),handleHostedLoginCallback:yt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:yt("auth/afterAuthNavigation"),preLogin:yt("auth/preLogin",(e=>({payload:e}))),postLogin:yt("auth/postLogin",(e=>({payload:e}))),login:yt("auth/login",(e=>({payload:e}))),loginWithMfa:yt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:yt("auth/recoverMfa",(e=>({payload:e}))),logout:yt("auth/logout",(e=>({payload:e}))),silentLogout:yt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:yt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:yt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:yt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:yt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:yt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:yt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:yt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:yt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:yt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:yt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:yt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:yt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:yt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:yt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:yt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:yt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:yt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:yt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:yt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:yt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:yt("auth/verifyMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAEmailCode:yt("auth/preVerifyMFAEmailCode",(e=>({payload:e}))),verifyMFAEmailCode:yt("auth/verifyMFAEmailCode",(e=>({payload:e}))),resetBreachedPassword:yt("auth/resetBreachedPassword",(e=>({payload:e})))};let Vt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Vt||(Vt={}));const jt={step:Vt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Bt={setActivateState:vt("activateState"),resetActivateState:St("activateState",{activateState:jt}),setActivateStrategyState:ht("activateState","activationStrategy")},Wt={activateAccount:yt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:yt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:yt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:yt("auth/resendActivationEmail",(e=>({payload:e})))};let zt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(zt||(zt={}));const Kt={step:zt.validate},Ht={setAcceptInvitationState:vt("acceptInvitationState"),resetAcceptInvitationState:St("acceptInvitationState",{acceptInvitationState:Kt})},qt={acceptInvitation:yt("auth/acceptInvitation",(e=>({payload:e})))};let Jt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Jt||(Jt={}));const Yt={step:Jt.forgotPassword,loading:!1,email:"",passwordConfig:null},Xt={setForgotPasswordState:vt("forgotPasswordState"),resetForgotPasswordState:St("forgotPasswordState",{forgotPasswordState:Yt})},Qt={forgotPassword:yt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:yt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:yt("auth/loadPasswordConfig",(e=>({payload:e})))};let Zt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Zt||(Zt={}));const en={step:Zt.ResetPhoneNumber,loading:!1},tn={setResetPhoneNumberState:vt("resetPhoneNumberState"),resetResetPhoneNumberState:St("resetPhoneNumberState",{resetPhoneNumberState:en})},nn={resetPhoneNumber:yt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:yt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:yt("auth/changePhoneNumber",(e=>({payload:e})))},on={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},an={setSSOLoader:mt("ssoState"),setSSOError:At("ssoState"),setSSOState:vt("ssoState"),resetSSOState:St("ssoState",{ssoState:on})},rn={loadSSOConfigurationsV2:yt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:yt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:yt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:yt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:yt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:yt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:yt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:yt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:yt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:yt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:yt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:yt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:yt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:yt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:yt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:yt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:yt("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:yt("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:yt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:yt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:yt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:yt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:yt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:yt("auth/oidcPostlogin",(e=>({payload:e})))},sn={loading:!1,error:null},ln={setProfileState:vt("profileState"),resetProfileState:St("profileState",{profileState:sn})},cn={loadProfile:yt("auth/loadProfile"),saveProfile:yt("auth/saveProfile",(e=>({payload:e}))),changePassword:yt("auth/changePassword",(e=>({payload:e})))};let un;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode",e.noMFAEnrolledStepUp="noMFAEnrolledStepUp"}(un||(un={}));const dn={step:un.verify,loading:!1,saving:!1},yn={setMfaState:vt("mfaState"),resetMfaState:St("mfaState",{mfaState:dn})},fn={enrollMfa:yt("auth/enrollMfa"),getMFADevices:yt("auth/getMFADevices"),getMFAStrategies:yt("auth/getMFAStrategies"),verifyMfa:yt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:yt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:yt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:yt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:yt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:yt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:yt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:yt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:yt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:yt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:yt("auth/disableMfaWebAuthn",(e=>({payload:e})))},pn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,shouldShowSubTenantUsersIfReseller:!1,allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},gn={setTeamLoader:mt("teamState"),setTeamError:At("teamState"),setTeamState:vt("teamState"),resetTeamState:St("teamState",{teamState:pn})},Sn={loadUsersV2:yt("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:yt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:yt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:yt("auth/loadRoles",(e=>({payload:e}))),addUser:yt("auth/addUser",(e=>({payload:e}))),addUsersBulk:yt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:yt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:yt("auth/updateUser",(e=>({payload:e}))),deleteUser:yt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:yt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:yt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:yt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:yt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:yt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:yt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:yt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getTemporaryUsersConfig:yt("auth/getTemporaryUsersConfig"),updateUserExpirationTime:yt("auth/updateUserExpirationTime",(e=>({payload:e}))),setUserAsPermanent:yt("auth/setUserAsPermanent",(e=>({payload:e}))),getInvitationLink:yt("auth/getInvitationLink"),createInvitationLink:yt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:yt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:yt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:yt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:yt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:yt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:yt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:yt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:yt("auth/closeLockUserDialog",(e=>({payload:e})))},vn={firstLoad:!0,loading:!1,error:""},hn={setSocialLoginsState:vt("socialLoginState"),resetSocialLoginsState:St("socialLoginState",{socialLoginState:vn})},mn={loadSocialLoginsConfiguration:yt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:yt("auth/loadSocialLoginsConfigurationV2",(e=>({payload:e}))),loginViaSocialLogin:yt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:yt("auth/setSocialLoginError",(e=>({payload:e})))};let An;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(An||(An={}));const bn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:An.SignUp},Tn={setSignUpState:vt("signUpState"),resetSignUpState:St("signUpState",{signUpState:bn})},En={signUpUser:yt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:yt("auth/resetSignUpStateSoft")},kn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},In={setApiTokensLoader:mt("apiTokensState"),setApiTokensError:At("apiTokensState"),setApiTokensState:vt("apiTokensState"),resetApiTokensState:St("apiTokensState",{apiTokensState:kn})},On={loadApiTokens:yt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:yt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:yt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:yt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:yt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:yt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:yt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:yt("auth/deleteTenantApiToken",(e=>({payload:e})))},Pn={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}},_n={setSecurityPolicyState:vt("securityPolicyState"),setSecurityPolicyGlobalState:ht("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:ht("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:ht("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:ht("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:ht("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:ht("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:ht("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:ht("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:ht("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:ht("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:ht("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:St("securityPolicyState",{securityPolicyState:Pn})},Ln={loadSecurityPolicy:yt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:yt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:yt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:yt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:yt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:yt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:yt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:yt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:yt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:yt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:yt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:yt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:yt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:yt("auth/loadPublicAuthStrategiesPolicy")},wn={loading:!1},Un={setAccountSettingsState:vt("accountSettingsState"),resetAccountSettingsState:St("accountSettingsState",{accountSettingsState:wn})},Cn={loadAccountSettings:yt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:yt("auth/saveAccountSettings",(e=>({payload:e})))},Rn={tenants:[],subTenants:[],loading:!0,tenantTree:null},Dn={setTenantsState:vt("tenantsState"),resetTenantsState:St("tenantsState",{tenantsState:Rn})},Nn={switchTenant:yt("auth/switchTenant",(e=>({payload:e}))),loadTenants:yt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:yt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:yt("auth/loadSubTenantsTree",(e=>({payload:e})))},Mn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Fn={setRolesState:vt("rolesState"),resetRolesState:St("rolesState",{rolesState:Mn})},Gn={loadRolesAndPermissions:yt("auth/loadRoles",(e=>({payload:e}))),addRole:yt("auth/addRole",(e=>({payload:e}))),updateRole:yt("auth/updateRole",(e=>({payload:e}))),deleteRole:yt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:yt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:yt("auth/attachPermissionToRoles",(e=>({payload:e})))},$n={loading:!1,sessions:[]},xn={setSessionsState:vt("sessionsState"),resetSessionsState:St("sessionsState",{sessionsState:$n})},Vn={loadUserSessions:yt("auth/loadUserSessions"),loadCurrentUserSession:yt("auth/loadCurrentUserSession"),deleteUserSession:yt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:yt("auth/deleteAllUserSessions"),revokeUserSessions:yt("auth/revokeUserSessions",(e=>({payload:e})))},jn={loading:!1,configurations:{}},Bn={setSessionsPolicyState:vt("sessionsPolicyState"),resetSessionsPolicyState:St("sessionsPolicyState",{sessionsPolicyState:jn})},Wn={loadSessionsPolicy:yt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:yt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let zn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(zn||(zn={}));const Kn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:zn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Hn={setRestrictionsState:vt("restrictionsState"),setIpRestrictionsState:ht("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:ht("restrictionsState","emailDomainRestrictions")},qn={checkIfUserIpValid:yt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:yt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:yt("auth/loadIpRestrictions"),saveIpRestriction:yt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:yt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:yt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:yt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:yt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:yt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:yt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Jn={loading:!1},Yn={setProvisioningState:vt("provisioningState"),resetProvisioningState:St("provisioningState",{provisioningState:Jn})},Xn={loadProvisionConnections:yt("auth/loadProvisionConnections"),createProvisionConnection:yt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:yt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:yt("auth/updateProvisionConnection",(e=>({payload:e})))},Qn={devices:[],loading:!1,error:null},Zn={setPasskeysState:vt("passkeysState"),resetPasskeysState:St("passkeysState",{passkeysState:Qn})},ei={loadWebAuthnDevices:yt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:yt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},ti={loaders:{},errors:{},groups:[],groupsConfiguration:{}},ni={setUsersGroupsLoader:mt("groupsState"),setUsersGroupsError:At("groupsState"),setGroupsState:vt("groupsState"),resetUsersGroupsState:St("groupsState",{groupsState:ti})},ii={loadGroups:yt("auth/loadUsersGroups"),getGroupById:yt("auth/getGroupById",(e=>({payload:e}))),createGroup:yt("auth/createGroup",(e=>({payload:e}))),updateGroup:yt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:yt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:yt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:yt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:yt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:yt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:yt("auth/getGroupConfiguration"),updateGroupConfiguration:yt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:yt("auth/getUsers",(e=>({payload:e})))},oi={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}},ai={setGroupsDialogsState:vt("groupsDialogsState"),resetGroupsDialogsState:St("groupsState",{groupsDialogsState:oi}),openAddGroupDialog:Tt("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:Tt("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:bt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:Tt("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:bt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:Tt("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:Tt("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:Tt("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:bt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:Tt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},ri={loading:!0,error:null},si={setCustomLoginState:vt("customLoginState"),resetCustomLoginState:St("customLoginState",{customLoginState:ri})},li={loadTenantMetadata:yt("auth/loadTenantMetadata"),updateTenantMetadata:yt("auth/updateTenantMetadata",(e=>({payload:e})))},ci={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source",scopedTenant:"frontegg-scoped-tenant"};let ui,di,yi,fi,pi;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ui||(ui={})),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"}(di||(di={})),function(e){e.ASC="ASC",e.DESC="DESC"}(yi||(yi={})),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"}(fi||(fi={})),function(e){e.MFA_UNENROLLED="mfa-unenrolled",e.BREACHED_PASSWORDS="breached-passwords",e.INACTIVE="inactive"}(pi||(pi={}));const gi=["local","saml","google","github","facebook","microsoft","scim2","slack"],Si={loaders:{},errors:{},accounts:{tenantId:"",children:[]},accountsQueryParams:{_limit:50,_offset:0,_filter:"",_subTenantId:""},searchAccountsData:[],rootAccount:{tenantId:""},selectedAccount:{tenantId:"",userJwt:{accessToken:"",expiresIn:0,expires:""},users:[],usersQueryParams:{_offset:0,_limit:10,_order:yi.DESC,_sortBy:fi.name},usersPageOffset:0,accountSettings:{}}},vi={setAllAccountsLoader:mt("allAccountsState"),setAllAccountsError:At("allAccountsState"),setAllAccountsState:vt("allAccountsState"),setSelectedAccountState:ht("allAccountsState","selectedAccount"),resetAllAccountsState:St("allAccountsState",{allAccountsState:Si})},hi={loadAccounts:yt("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:yt("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:yt("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:yt("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:yt("auth/updateAccount",(e=>({payload:e}))),deleteSubAccount:yt("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:yt("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:yt("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:yt("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:yt("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:yt("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:yt("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setRootAccountData:yt("auth/setRootAccountData"),setSelectedSubAccountData:yt("auth/setSelectedSubAccountData",(e=>({payload:e}))),loadNumberOfUsersForSelectedSubAccount:yt("auth/loadNumberOfUsersForSelectedSubAccount",(e=>({payload:e})))},mi={createSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:"",canSelectParentAccount:!1},updateSubAccountDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1,jwt:""},deleteSubAccountDialog:{accountId:"",accountName:"",isParentAccount:!1,loading:!1,open:!1,error:!1,jwt:""},addUsersToAccountDialog:{loading:!1,open:!1,accountName:"",accountId:"",permissionToGiveAccessToSubAccounts:!1,jwt:""},deleteUserFromAccountDialog:{userId:"",userName:"",accountId:"",loading:!1,open:!1,jwt:""},editUserRolesDialog:{loading:!1,open:!1,jwt:"",accountId:"",userId:"",userName:"",userRoles:[]}},Ai={setAllAccountDialogsState:vt("allAccountsDialogsState"),resetAllAccountDialogsState:St("allAccountsDialogsState",{allAccountsDialogsState:mi}),openCreateSubAccountDialog:bt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:Tt("allAccountsDialogsState","createSubAccountDialog",mi.createSubAccountDialog),openUpdateSubAccountDialog:bt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:Tt("allAccountsDialogsState","updateSubAccountDialog",mi.updateSubAccountDialog),openDeleteSubAccountDialog:bt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:Tt("allAccountsDialogsState","deleteSubAccountDialog",mi.deleteSubAccountDialog),openAddUsersToAccountDialog:bt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:Tt("allAccountsDialogsState","addUsersToAccountDialog",mi.addUsersToAccountDialog),openDeleteUserFromAccountDialog:bt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:Tt("allAccountsDialogsState","deleteUserFromAccountDialog",mi.deleteUserFromAccountDialog),openEditUserRolesDialog:bt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:Tt("allAccountsDialogsState","editUserRolesDialog",mi.editUserRolesDialog)},bi={loaders:{},errors:{},recommendations:void 0,insights:void 0,score:0,breachedPasswordUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},unenrolledMfaUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},inactiveUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10,_maxInactiveSeconds:7776e3}}},Ti={setSecurityCenterState:vt("securityCenterState"),resetSecurityCenterState:St("securityCenterState",{securityCenterState:bi}),setSecurityCenterStateLoader:mt("securityCenterState"),setSecurityCenterStateError:At("securityCenterState")},Ei={loadRecommendations:yt("auth/loadRecommendations"),loadInsights:yt("auth/loadInsights"),sendResetBreachedPasswordEmail:yt("auth/sendResetBreachedPasswordEmail",(e=>({payload:e}))),sendBulkResetBreachedPasswordEmails:yt("auth/sendBulkResetBreachedPasswordEmails",(e=>({payload:e}))),loadBreachedPasswordUsers:yt("auth/loadBreachedPasswordUsers",(e=>({payload:e}))),loadUnenrolledMfaUsers:yt("auth/loadUnenrolledMfaUsers",(e=>({payload:e}))),loadInactiveUsers:yt("auth/loadInactiveUsers",(e=>({payload:e})))};let ki,Ii,Oi;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(ki||(ki={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Ii||(Ii={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Oi||(Oi={}));const Pi={[Ii.Code]:_t.loginWithOtc,[Ii.EmailAndPassword]:_t.loginWithPassword,[Ii.MagicLink]:_t.magicLinkPreLoginSuccess,[Ii.SmsCode]:_t.loginWithSmsOtc},_i={loading:!1,error:null,phoneNumbers:void 0},Li={setSmsState:vt("smsState"),resetSmsState:St("smsState",{smsState:_i})},wi={loadPhoneNumbers:yt("auth/loadPhoneNumbers"),setUpPhoneNumber:yt("auth/setUpPhoneNumber",(e=>({payload:e}))),verifyPhoneNumber:yt("auth/verifyPhoneNumber",(e=>({payload:e}))),deletePhoneNumber:yt("auth/deletePhoneNumber",(e=>({payload:e}))),verifyDeletePhoneNumber:yt("auth/verifyDeletePhoneNumber",(e=>({payload:e}))),preVerifyPhoneNumber:yt("auth/preVerifyPhoneNumber",(e=>({payload:e})))},Ui={loading:!1,mfaDevices:void 0,mfaToken:""},Ci={setStepUpState:vt("stepUpState"),resetStepUpState:St("stepUpState",{stepUpState:Ui})},Ri={stepUpHostedLogin:yt("auth/stepUpHostedLogin",(e=>({payload:e}))),generateStepUpSession:yt("auth/generateStepUpSession",(e=>({payload:e}))),stepUpWithAuthenticator:yt("auth/stepUpWithAuthenticator",(e=>({payload:e}))),preVerifyMFASMSForStepUp:yt("auth/preVerifyMFASMSForStepUp",(e=>({payload:e}))),verifyMFASMSForStepUp:yt("auth/verifyMFASMSForStepUp",(e=>({payload:e}))),preVerifyMFAWebAuthnForStepUp:yt("auth/preVerifyMFAWebAuthnForStepUp",(e=>({payload:e}))),verifyMFAWebAuthnForStepUp:yt("auth/verifyMFAWebAuthnForStepUp",(e=>({payload:e}))),preVerifyMFAEmailCodeForStepUp:yt("auth/preVerifyMFAEmailCodeForStepUp",(e=>({payload:e}))),verifyMFAEmailCodeForStepUp:yt("auth/verifyMFAEmailCodeForStepUp",(e=>({payload:e})))},Di={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:bn,loginState:Gt,stepUpState:Ui,activateState:jt,acceptInvitationState:Kt,forgotPasswordState:Yt,ssoState:on,profileState:sn,customLoginState:ri,mfaState:dn,teamState:pn,groupsState:ti,groupsDialogsState:oi,socialLoginState:vn,apiTokensState:kn,securityPolicyState:Pn,accountSettingsState:wn,tenantsState:Rn,rolesState:Mn,resetPhoneNumberState:en,sessionsState:$n,sessionsPolicyState:jn,restrictionsState:Kn,provisioningState:Jn,passkeysState:Qn,allAccountsState:Si,allAccountsDialogsState:mi,securityCenterState:bi,smsState:_i},Ni=D({routes:{authenticatedUrl:"/",loginUrl:"/account/login",stepUpUrl:"/account/step-up",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:()=>{}},Di);let Mi;!function(e){e.impersonating="impersonating",e.success="success"}(Mi||(Mi={}));const Fi={step:Mi.impersonating,loading:!1},Gi={setImpersonateState:vt("impersonateState"),resetImpersonateState:St("impersonateState",{impersonateState:Fi})},$i={impersonate:yt("impersonation/impersonate",(e=>({payload:e})))},{reducer:xi,actions:Vi}=pt({name:Dt,initialState:Ni,reducers:D({resetState:e=>D({},e,Di),setState:(e,{payload:t})=>D({},e,t),setUser:("user",(e,{payload:t})=>D({},e,{user:t})),setEntitlements:ht("user","entitlements")},$t,Ci,hn,Bt,Gi,Ht,Xt,tn,Tn,ln,si,an,yn,gn,ni,ai,In,_n,Un,Dn,Fn,xn,Bn,Hn,Yn,Zn,vi,Ai,Ti,Li)});const ji=D({loadEntitlements:yt("auth/loadEntitlements",(e=>({payload:e})))},Vi,xt,Ri,mn,Wt,qt,Qt,nn,En,cn,li,rn,fn,Sn,ii,{},On,Ln,Cn,Nn,Gn,Vn,Wn,qn,Xn,$i,ei,hi,Ei,wi);var Bi=function(e){return"@@redux-saga/"+e},Wi=Bi("CANCEL_PROMISE"),zi=Bi("CHANNEL_END"),Ki=Bi("IO"),Hi=Bi("MATCH"),qi=Bi("MULTICAST"),Ji=Bi("SAGA_ACTION"),Yi=Bi("SELF_CANCELLATION"),Xi=Bi("TASK"),Qi=Bi("TASK_CANCEL"),Zi=Bi("TERMINATE"),eo=Bi("LOCATION");function to(e,t){if(null==e)return{};var n,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var no=function(e){return null==e},io=function(e){return null!=e},oo=function(e){return"function"==typeof e},ao=function(e){return"string"==typeof e},ro=Array.isArray,so=function(e){return e&&oo(e.then)},lo=function(e){return e&&oo(e.next)&&oo(e.throw)},co=function e(t){return t&&(ao(t)||fo(t)||oo(t)||ro(t)&&t.every(e))},uo=function(e){return e&&oo(e.take)&&oo(e.close)},yo=function(e){return oo(e)&&e.hasOwnProperty("toString")},fo=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},po=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[Wi]=function(){clearTimeout(n)},i},go=function(e){return function(){return e}},So=go(!0),vo=function(){},ho=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var mo=function(e,t){D(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ao(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var bo=function(e){throw e},To=function(e){return{value:e,done:!0}};function Eo(e,t,n){void 0===t&&(t=bo),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:To,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function ko(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Io=function(e){return Array.apply(null,new Array(e))},Oo=function(e){return function(t){return e(Object.defineProperty(t,Ji,{value:!0}))}},Po=function(e){return e===Zi},_o=function(e){return e===Qi},Lo=function(e){return Po(e)||_o(e)};function wo(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=ro(e)?Io(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||Lo(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=vo,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function Uo(e){return{name:e.name||"anonymous",location:Co(e)}}function Co(e){return e[eo]}var Ro=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),i=0,o=0,a=0,r=function(t){n[o]=t,o=(o+1)%e,i++},s=function(){if(0!=i){var t=n[a];return n[a]=null,i--,a=(a+1)%e,t}},l=function(){for(var e=[];i;)e.push(s());return e};return{isEmpty:function(){return 0==i},put:function(s){var c;if(i<e)r(s);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=s,a=o=(o+1)%e;break;case 4:c=2*e,n=l(),i=n.length,o=n.length,a=0,n.length=c,e=c,r(s)}},take:s,flush:l}}(e,4)},Do="TAKE",No="CALL",Mo="FORK",Fo="SELECT",Go=function(e,t){var n;return(n={})[Ki]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function $o(e,t){return void 0===e&&(e="*"),co(e)?(io(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Go(Do,{pattern:e})):uo(n=e)&&n[qi]&&io(t)&&co(t)?Go(Do,{channel:e,pattern:t}):uo(e)?(io(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Go(Do,{channel:e})):void 0;var n}function xo(e,t){return no(t)&&(t=e,e=void 0),Go("PUT",{channel:e,action:t})}function Vo(e){var t=Go("ALL",e);return t.combinator=!0,t}function jo(e,t){var n,i=null;return oo(e)?n=e:(ro(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&ao(n)&&oo(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function Bo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Go(No,jo(e,n))}function Wo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Go(Mo,jo(e,n))}function zo(e){return void 0===e&&(e=Yi),Go("CANCEL",e)}function Ko(e){void 0===e&&(e=ho);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Go(Fo,{selector:e,args:n})}var Ho=Bo.bind(null,po);var qo=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Jo=[],Yo=0;function Xo(e){try{ea(),e()}finally{ta()}}function Qo(e){Jo.push(e),Yo||(ea(),na())}function Zo(e){try{return ea(),e()}finally{na()}}function ea(){Yo++}function ta(){Yo--}function na(){var e;for(ta();!Yo&&void 0!==(e=Jo.shift());)Xo(e)}var ia=function(e){return function(t){return e.some((function(e){return la(e)(t)}))}},oa=function(e){return function(t){return e(t)}},aa=function(e){return function(t){return t.type===String(e)}},ra=function(e){return function(t){return t.type===e}},sa=function(){return So};function la(e){var t="*"===e?sa:ao(e)?aa:ro(e)?ia:yo(e)?aa:oo(e)?oa:fo(e)?ra:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var ca={type:zi},ua=function(e){return e&&e.type===zi};function da(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(ca)}))},(e={})[qi]=!0,e.put=function(e){if(!t)if(ua(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[Hi](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=sa),t?e(ca):(e[Hi]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Ao(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[Ji]?s(e):Qo((function(){s(e)}))},r}function ya(e,t){var n=e[Wi];oo(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var fa,pa=0,ga=function(){return++pa};function Sa(e){e.isRunning()&&e.cancel()}var va=((fa={}).TAKE=function(e,t,n){var i=t.channel,o=void 0===i?e.channel:i,a=t.pattern,r=t.maybe,s=function(e){e instanceof Error?n(e,!0):!ua(e)||r?n(e):n(Zi)};try{o.take(s,io(a)?la(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},fa.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Qo((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&so(t)?ya(t,n):n(t)}))},fa.ALL=function(e,t,n,i){var o=i.digestEffect,a=pa,r=Object.keys(t);if(0!==r.length){var s=wo(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(ro(t)?[]:{})},fa.RACE=function(e,t,n,i){var o=i.digestEffect,a=pa,r=Object.keys(t),s=ro(t)?Io(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Lo(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=vo,l[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return l[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,l[e],e)}))},fa.CALL=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,s=i.task;try{var l=a.apply(o,r);if(so(l))return void ya(l,n);if(lo(l))return void Pa(e,l,s.context,pa,Uo(a),!1,n);n(l)}catch(e){n(e,!0)}},fa.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){no(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},fa.FORK=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,s=t.detached,l=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var o=n.apply(t,i);if(lo(o))return o;var a=!1;return Eo((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!so(o)})}))}catch(e){return Eo((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Uo(t)}(c,a);Zo((function(){var t=Pa(e,c,l.context,pa,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},fa.JOIN=function(e,t,n,i){var o=i.task,a=function(e,t){if(e.isRunning()){var n={task:o,cb:t};t.cancel=function(){e.isRunning()&&Ao(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(ro(t)){if(0===t.length)return void n([]);var r=wo(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},fa.CANCEL=function(e,t,n,i){var o=i.task;t===Yi?Sa(o):ro(t)?t.forEach(Sa):Sa(t),n()},fa.SELECT=function(e,t,n){var i=t.selector,o=t.args;try{n(i.apply(void 0,[e.getState()].concat(o)))}catch(e){n(e,!0)}},fa.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Ro());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(ca):e.isEmpty()?(n.push(i),i.cancel=function(){Ao(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(ca):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(ca)}}}}(t.buffer),a=la(i),r=function t(n){ua(n)||e.channel.take(t,a),o.put(n)},s=o.close;o.close=function(){r.cancel(),s()},e.channel.take(r,a),n(o)},fa.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},fa.FLUSH=function(e,t,n){t.flush(n)},fa.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},fa.SET_CONTEXT=function(e,t,n,i){var o=i.task;mo(o.context,t),n()},fa);function ha(e,t){return e+"?"+t}function ma(e){var t=e.name,n=e.location;return n?t+" "+ha(n.fileName,n.lineNumber):t}function Aa(e){var t,n,i,o=(t=function(e){return e.cancelledTasks},n=e,(i=[]).concat.apply(i,n.map(t)));return o.length?["Tasks cancelled due to error:"].concat(o).join("\n"):""}var ba=null,Ta=[],Ea=function(e){e.crashedEffect=ba,Ta.push(e)},ka=function(){ba=null,Ta.length=0},Ia=function(){var e,t,n=Ta[0],i=Ta.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=Co(e))?t.code+" "+ha(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+ma(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+ma(e.meta)})),[Aa(Ta)]).join("\n")};function Oa(e,t,n,i,o,a,r){var s;void 0===r&&(r=vo);var l,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),l(),n(e,!0)}function s(t){o.push(t),t.cont=function(s,l){a||(Ao(o,t),t.cont=vo,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=vo,e.cancel()})),o=[])}return s(e),{addTask:s,cancelAll:l,abort:r,getTasks:function(){return o}}}(t,0,g);function g(t,n){if(n){if(u=2,Ea({meta:o,cancelledTasks:y}),S.isRoot){var i=Ia();ka(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Qi?u=1:1!==u&&(u=3),l=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((s={})[Xi]=!0,s.id=i,s.meta=o,s.isRoot=a,s.context=f,s.joiners=[],s.queue=p,s.cancel=function(){0===u&&(u=1,p.cancelAll(),g(Qi,!1))},s.cont=r,s.end=g,s.setContext=function(e){mo(f,e)},s.toPromise=function(){return d||(d=qo(),2===u?d.reject(c):0!==u&&d.resolve(l)),d.promise},s.isRunning=function(){return 0===u},s.isCancelled=function(){return 1===u||0===u&&1===t.status},s.isAborted=function(){return 2===u},s.result=function(){return l},s.error=function(){return c},s);return S}function Pa(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){so(t)?ya(t,i):lo(t)?Pa(e,t,c.context,n,o,!1,i):t&&t[Ki]?(0,va[t.type])(e,t.payload,i,u):i(t)}));d.cancel=vo;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(Qi))},status:0},c=Oa(e,l,n,i,o,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var o;n?(o=t.throw(e),ka()):_o(e)?(l.status=1,d.cancel(),o=oo(t.return)?t.return(Qi):{done:!0,value:Qi}):o=Po(e)?oo(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==l.status&&(l.status=3),l.cont(o.value)):y(o.value,i,d)}catch(e){if(1===l.status)throw e;l.status=2,l.cont(e,!0)}}function y(t,n,i,o){void 0===o&&(o="");var a,r=ga();function l(n,o){a||(a=!0,i.cancel=vo,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){ba=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=vo,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=vo,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function _a(e,t){for(var n=e.channel,i=void 0===n?da():n,o=e.dispatch,a=e.getState,r=e.context,s=void 0===r?{}:r,l=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?ko: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=ga();if(l&&(l.rootSagaStarted=l.rootSagaStarted||vo,l.effectTriggered=l.effectTriggered||vo,l.effectResolved=l.effectResolved||vo,l.effectRejected=l.effectRejected||vo,l.effectCancelled=l.effectCancelled||vo,l.actionDispatched=l.actionDispatched||vo,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=He.apply(void 0,c);g=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else g=ho;var m={channel:i,dispatch:Oo(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:g};return Zo((function(){var e=Pa(m,S,s,v,Uo(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var La=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?da():a,s=n.sagaMonitor,l=to(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=_a.bind(null,D({},l,{context:o,channel:r,dispatch:i,getState:n,sagaMonitor:s})),function(e){return function(t){s&&s.actionDispatched&&s.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){mo(o,e)},c},wa=function(e){return{done:!0,value:e}},Ua={};function Ca(e){return uo(e)?"channel":yo(e)?String(e):oo(e)?e.name:String(e)}function Ra(e,t,n){var i,o,a,r=t;function s(t,n){if(r===Ua)return wa(t);if(n&&!o)throw r=Ua,n;i&&i(t);var s=n?e[o](n):e[r]();return r=s.nextState,a=s.effect,i=s.stateUpdater,o=s.errorState,r===Ua?wa(t):a}return Eo(s,(function(e){return s(null,e)}),n)}function Da(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:$o(e)},s=function(e){return{done:!1,value:Wo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Ra({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+Ca(e)+", "+t.name+")")}function Na(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,s={done:!1,value:$o(e)},l=function(e){return{done:!1,value:Wo.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:zo(e)}},u=function(e){return a=e},d=function(e){return r=e};return Ra({q1:function(){return{nextState:"q2",effect:s,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:l(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:l(r),stateUpdater:u}}},"q1","takeLatest("+Ca(e)+", "+t.name+")")}function Ma(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:$o(e)},s=function(e){return{done:!1,value:Bo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Ra({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+Ca(e)+", "+t.name+")")}function Fa(e,t,n){for(var i=e,o=arguments.length,a=new Array(o>3?o-3:0),r=3;r<o;r++)a[r-3]=arguments[r];var s={done:!1,value:Bo.apply(void 0,[n].concat(a))},l={done:!1,value:Ho(t)};return Ra({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:Ua}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function Ga(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Wo.apply(void 0,[Da,e,t].concat(i))}function $a(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Wo.apply(void 0,[Na,e,t].concat(i))}function xa(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Wo.apply(void 0,[Ma,e,t].concat(i))}class Va{constructor(){this.context=null,this.accessToken=null,this.user=null,this.requestSource=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout",this.entitlementsOptions=null,this.appName=null,this.sessionContext=void 0}static getInstance(){return Va.instance||(Va.instance=new Va),Va.instance}static setContext(e){Va.getInstance().context=e}static setAccessToken(e){Va.getInstance().accessToken=e}static setUser(e){Va.getInstance().user=e}static setRequestSource(e){Va.getInstance().requestSource=e}static setOnRedirectTo(e){Va.getInstance().onRedirectTo=e}static setLogout(e,t){Va.getInstance().logout=n=>{n?e(n):Va.onRedirectTo(t)}}static setEntitlementsOptions(e){Va.getInstance().entitlementsOptions=e}static setSessionContext(e){Va.getInstance().sessionContext=e}static setAppName(e){Va.getInstance().appName=e}static getContext(){var e;return null!=(e=Va.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Va.getInstance().accessToken}static getRequestSource(){return Va.getInstance().requestSource}static getUser(){return Va.getInstance().user}static onRedirectTo(e,t){return Va.getInstance().onRedirectTo(e,t)}static logout(e){return Va.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=Va.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static isSessionPerTenantEnabled(){var e;return(null==(e=Va.getInstance().sessionContext)?void 0:e.enableSessionPerTenant)||!1}static getAppName(){return Va.getInstance().appName}}Va.instance=void 0;const ja={getContext:()=>Va.getContext(),getAccessToken:()=>Va.getAccessToken(),getUser:()=>Va.getUser(),onRedirectTo:(e,t)=>Va.onRedirectTo(e,t),logout:e=>Va.logout(e)};class Ba extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Wa={v1:"/identity/resources/users/webauthn/v1/devices"},za={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Ka={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",roles:{v3:"/identity/resources/users/v3/roles"},groups:{v3:"/identity/resources/users/v3/groups"},tenants:{me:{v1:"/identity/resources/users/v1/me/tenants",v3:"/identity/resources/users/v3/me/tenants"}},apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}},passwords:{resetBreachedPasswords:{v1:"/identity/resources/users/v1/passwords/breached/reset/bulk"}},authorization:{v1:"/identity/resources/users/v1/me/authorization"},temporary:{v1:"/identity/resources/users/temporary/v1",configuration:{v1:"/identity/resources/users/temporary/v1/configuration"}}},Ha={v1:"/identity/resources/configurations/v1"},qa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Ja={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ya={v1:"/identity/resources/permissions/v1"},Xa={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"}},Qa={v1:"/identity/resources/roles/v1"},Za={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},er={v1:"/identity/resources/impersonation/v1"},tr={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},nr={v1:"/identity/resources/users/phone-numbers/v1"},ir={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},or={v1:"/team/resources/members/v1"},ar={v1:"/team/resources/roles/v1"},rr={v1:"/team/resources/stats/v1"},sr={v1:"/team/resources/profile"},lr={v1:"/tenants/resources/account-settings/v1"},cr={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"}},ur={v1:"/tenants/resources/sub-tenants/v1"},dr={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},yr={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"}}}},fr={v1:"/subscriptions/resources/payment-providers/v1"},pr={v1:"/subscriptions/resources/subscriptions/v1"},gr={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Sr={v1:"/reports/engine/resources/triggers/v1"},vr="/notification",hr="/audits",mr={v1:"/event/resources/configurations/v1"},Ar="/webhook",br="/oauth",Tr="/flags",Er="/directory/resources/v1/configurations/scim2",kr="/directory/resources/scim/temp",Ir="/entitlements/api/v1/user-entitlements",Or="/entitlements/api/v2/user-entitlements",Pr={v1:"/security-center/resources/recommendations/v1"},_r={v1:"/security-center/resources/insights/v1"};function Lr(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}function wr(e){var t,n;const i={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(i[ci.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(i[ci.frameWork]=e.metadataHeaders.framework),i}function Ur(){return new URLSearchParams(window.location.search).get("tenantId")||null}const Cr=async e=>{var t,n,i;const o=Va.getContext(),a=await async function(e,t){var n;const i=wr(e),o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Va.getAccessToken)(),a=Va.getRequestSource(),r=Ur();t&&(i[ci.contentType]=t),a&&(i[ci.source]=a),o&&(i.Authorization=`Bearer ${o}`),r&&(i[ci.scopedTenant]=r);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))i[`${t.key}`]=`${t.value}`;return i}(o,e.contentType),r=await async function(e,t,n){const i=Lr(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),s=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:D({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===s.status)return window.location.href=await s.text(),new Promise((()=>{}));if(!s.ok){var l,c;if(413===s.status)throw new Ba("Error request is too large",s.status);let e,t=!0;try{e=await s.text(),e=JSON.parse(e)}catch(e){t=!1}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${s.status} - ${s.statusText}`),s.status>=400&&s.status<500&&["warn"].includes(null!=(l=o.logLevel)?l:"")?console.warn(e):500===s.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new Ba(t?e:"We're facing some difficulties, Please try again",s.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await s.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await s.text()}try{return await s.json()}catch(e){return{}}},Rr=async(e,t,n)=>Cr(D({url:e,method:"GET",contentType:"application/json",params:t},n)),Dr=async(e,t,n)=>Cr(D({url:e,method:"POST",contentType:"application/json",body:t},n)),Nr=async(e,t,n)=>Cr(D({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Mr=async(e,t,n)=>Cr(D({url:e,method:"PUT",contentType:"application/json",body:t},n)),Fr=async(e,t,n)=>Cr(D({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Gr=async(e,t,n,i)=>Cr(D({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),$r=(e={})=>D({},e.jwt?{Authorization:e.jwt}:{}),xr="FRONTEGG_SEPARATE_TABS_BY_TENANT",Vr="admin_portal_use_entitlements_v2_endpoint",jr={flags:{}};class Br{constructor(){var e;this._flags={},this._flags=null!=(e=jr.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Br;return n.set(e),Br._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=D({},null!=(t=null==jr?void 0:jr.flags)?t:{},null!=e?e:{})}}async function Wr(){return Rr(Tr)}async function zr(e){return Dr(`${Ka.v3}/me/token`,e)}async function Kr(e,t){return Rr(Ka.v2,e,{headers:$r(t)})}async function Hr(e,t){return Rr(Ka.v3,e,{headers:$r(t)})}async function qr(e,t){return Rr(Ka.roles.v3,D({},e,{ids:e.ids.join(",")}),{headers:$r(t)})}async function Jr(e,t){return Rr(Ka.groups.v3,D({},e,{ids:e.ids.join(",")}),{headers:$r(t)})}async function Yr(e){return Rr(Ka.tenants.me.v3,void 0,{headers:$r(e)})}async function Xr(e){return Rr(Ka.tenants.me.v1,void 0,{headers:$r(e)})}async function Qr(){return Dr(Ka.passwords.resetBreachedPasswords.v1)}async function Zr(e){return Mr(`${Ka.v2}/me`,e)}function es(e){e&&sessionStorage.setItem(xr,e)}function ts(){return Va.isSessionPerTenantEnabled()?sessionStorage.getItem(xr):null}function ns(){const[e]=Br.getFeatureFlags(["admin_portal_use_current_user_tenants_v1_endpoint"],Va.getAppName()||"");return Va.isSessionPerTenantEnabled()||e?Xr:Yr}async function is(e){return Va.isSessionPerTenantEnabled()&&es(e.tenantId),Mr(`${Ka.v1}/tenant`,e)}async function os(){return Rr(`${Ka.v2}/me/tenants`)}async function as(e){return Rr(cr.v1,void 0,{headers:$r(e)})}async function rs(e){return Rr(cr.tree.v1,void 0,{headers:$r(e)})}async function ss(e){return Rr(cr.parents.v1,void 0,{headers:$r(e)})}async function ls(e,t){return Rr(`${cr.parents.v1}/${e}`,void 0,{headers:$r(t)})}async function cs(e,t){return Dr(`${Xa.users.v1}/count`,e,{headers:$r(t)})}async function us(e,t){return Rr(cr.v2,e,{headers:$r(t)})}async function ds(e,t){return Rr(cr.metadata.v2,D({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:$r(t)})}async function ys(){return Rr(Ha.v1)}async function fs(){return Rr(`${Ha.v1}/mfa-policy`)}async function ps(){return Rr(`${Ha.v1}/mfa-policy/vendor`)}async function gs(e){return e.id?Nr(`${Ha.v1}/mfa-policy`,e):Dr(`${Ha.v1}/mfa-policy`,e)}async function Ss(){return Rr(`${Ha.v1}/lockout-policy`)}async function vs(){return Rr(`${Ha.v1}/lockout-policy/vendor`)}async function hs(e){return e.id?Nr(`${Ha.v1}/lockout-policy`,e):Dr(`${Ha.v1}/lockout-policy`,e)}async function ms(){try{return await Rr(`${Ha.v1}/captcha-policy/public`)}catch{return null}}async function As(){return Rr(`${Ha.v1}/password-history-policy`)}async function bs(){return Rr(`${Ha.v1}/password-history-policy/vendor`)}async function Ts(e){return e.id?Nr(`${Ha.v1}/password-history-policy`,e):Dr(`${Ha.v1}/password-history-policy`,e)}async function Es(){return Rr(`${Ha.v1}/password`)}async function ks(){return Rr(`${qa.emailDomain.v1}`)}async function Is(){return Rr(`${qa.emailDomain.v1}/config`)}async function Os(e){return Dr(`${qa.emailDomain.v1}`,e)}async function Ps(e){return Dr(`${qa.emailDomain.v1}/config`,e)}async function _s(e){return Fr(`${qa.emailDomain.v1}/${e}`)}async function Ls(e){return Rr(`${qa.ip.v1}`,e)}async function ws(){return Rr(`${qa.ip.v1}/config`)}async function Us(e){return Dr(`${qa.ip.v1}`,e)}async function Cs(e){return Dr(`${qa.ip.v1}/bulk`,e)}async function Rs(e){return Dr(`${qa.ip.v1}/config`,e)}async function Ds(e){return Fr(`${qa.ip.v1}/${e}`)}async function Ns(){return Dr(`${qa.ip.v1}/verify`)}async function Ms(){return Dr(`${qa.ip.v1}/verify/allow`)}Br._instances={};class Fs extends Error{constructor(e){super(e)}}const Gs="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Fs("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,i,o=0,a=0;i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?n+=String.fromCharCode(255&e>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};class $s extends Error{constructor(e){super(e)}}const xs=(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(Gs(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 Gs(t)}})(e.split(".")[n]))}catch(e){throw new $s("Invalid token specified: "+e.message)}};let Vs,js,Bs;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}(Vs||(Vs={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(js||(js={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(Bs||(Bs={}));const Ws="admin_portal_should_load_authorization";async function zs(){return Rr(Ir)}async function Ks(){return Rr(Or)}let Hs;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(Hs||(Hs={}));const qs="admin_portal_entitlements",Js=["type"],Ys=["type"],Xs=["type"];async function Qs(e){if(!e.accessToken)return e;Va.setAccessToken(e.accessToken);const t=await $u(),n=D({},e,e.accessToken?xs(e.accessToken):{},t);return Va.setUser(n),n}async function Zs(e){if(!e.accessToken)return{user:e};Va.setAccessToken(e.accessToken);const[t,n]=await Promise.all([$u(),os()]),i=D({},e,e.accessToken?xs(e.accessToken):{},t);return Va.setUser(i),{user:i,tenants:n}}function el(){if(!Va.shouldLoadEntitlements())return!1;const[e]=Br.getFeatureFlags([qs],Va.getAppName()||"");return e}function tl(){const[e]=Br.getFeatureFlags([Ws],Va.getAppName()||"");return e}async function nl(e){const{accessToken:t}=e;if(!t)return{user:e};Va.setAccessToken(t);const[n,i]=await Promise.all([$u(),ns()()]),o=D({},e,t?xs(t):{},n);return Va.isSessionPerTenantEnabled()&&es(o.tenantId),Va.setUser(o),{user:o,tenants:i.tenants,activeTenant:i.activeTenant}}async function il(e){Va.setAccessToken(e.id_token);const t=await $u(),n=e.id_token?xs(e.id_token):{},i=D({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Va.setUser(i),i}async function ol(e){Va.setAccessToken(e.id_token);const[t,n]=await Promise.all([$u(),ns()()]),i=e.id_token?xs(e.id_token):{},o=D({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},i,t,{expiresIn:e.expires_in||300});return Va.isSessionPerTenantEnabled()&&es(o.tenantId),Va.setUser(o),{user:o,tenants:n.tenants,activeTenant:n.activeTenant}}async function al(e){try{const{address:t}=await Dr(`${za.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function rl(e){return Dr(`${za.v1}/user/saml/prelogin`,e)}async function sl(e){return Qs(await Dr(`${za.v1}/user/saml/postlogin`,e))}async function ll(e){return Qs(await Dr(`${za.v1}/user/oidc/postlogin`,e))}async function cl(e){return Qs(await Dr(`${za.v1}/user`,e))}async function ul(e){return nl(await Dr(`${za.v1}/user`,e))}async function dl(e){return Qs(await Dr(`${za.v1}/user/mfa/verify`,e))}async function yl(e){return nl(await Dr(`${za.v1}/user/mfa/verify`,e))}async function fl(e){return Dr(`${Ka.v1}/activate`,e)}async function pl(e){return nl(await Dr(`${Ka.v1}/activate`,e))}async function gl(e){return Rr(`${Ka.v1}/activate/strategy`,e)}async function Sl(e){return Dr(`${Ka.v1}/activate/reset`,e)}async function vl(e){return Dr(`${Ka.v1}/invitation/reset`,e)}async function hl(e){return Dr(`${Ka.v1}/invitation/accept`,e)}async function ml(){const e=ts();return Qs(await Dr(`${za.v1}/user/token/refresh`,{tenantId:e}))}async function Al(){const e=ts();return Zs(await Dr(`${za.v1}/user/token/refresh`,{tenantId:e}))}async function bl(){const e=ts();return nl(await Dr(`${za.v1}/user/token/refresh`,{tenantId:e}))}async function Tl(){return Dr(`${za.v1}/logout`)}async function El(e){return Rr(`${br}/logout`,e)}async function kl(e){return Dr(`${Ka.v1}/passwords/reset`,e)}async function Il(e){return Dr(`${Ka.v1}/passwords/reset/verify`,e)}async function Ol(e){return Rr(`${Ka.v1}/passwords/config`,e)}async function Pl(e){return Dr(`${za.v1}/user/mfa/recover`,e)}async function _l(){return Dr(`${Ka.v1}/mfa/enroll`)}async function Ll(){return Dr(`${Ka.v1}/mfa/authenticator/enroll`)}async function wl(e){return Dr(`${Ka.v1}/mfa/authenticator/enroll/verify`,e)}async function Ul(e){return Dr(`${Ka.v1}/mfa/sms/enroll`,e)}async function Cl(e){return Dr(`${Ka.v1}/mfa/sms/enroll/verify`,e)}async function Rl(){return Dr(`${Ka.v1}/mfa/webauthn/enroll`)}async function Dl(e){return Dr(`${Ka.v1}/mfa/webauthn/enroll/verify`,e)}async function Nl(e){return Dr(`${Ka.v1}/mfa/enroll/verify`,e)}async function Ml(e){return Dr(`${Ka.v1}/mfa/disable`,e)}async function Fl(e,t){return Dr(`${Ka.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Gl(e){return Dr(`${Ka.v1}/mfa/sms/${e}/disable`)}async function $l(e,t){return Dr(`${Ka.v1}/mfa/sms/${e}/disable/verify`,t)}async function xl(e){return Dr(`${Ka.v1}/mfa/webauthn/${e}/disable`)}async function Vl(e,t){return Dr(`${Ka.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function jl(){return Rr(`${Ka.v1}/mfa/devices`)}async function Bl(e){return Dr(`${za.v1}/user/mfa/authenticator/enroll`,e)}async function Wl(e){return Dr(`${za.v1}/user/mfa/authenticator/enroll/verify`,e)}async function zl(e){return nl(await Dr(`${za.v1}/user/mfa/authenticator/enroll/verify`,e))}async function Kl(e,t){return Dr(`${za.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Hl(e){return Dr(`${za.v1}/user/mfa/emailcode`,e)}async function ql(e){return Dr(`${za.v1}/user/mfa/emailcode/verify`,e)}async function Jl(e){return nl(await Dr(`${za.v1}/user/mfa/emailcode/verify`,e))}async function Yl(e){return Dr(`${za.v1}/user/mfa/sms/enroll`,e)}async function Xl(e){return Dr(`${za.v1}/user/mfa/sms/enroll/verify`,e)}async function Ql(e){return nl(await Dr(`${za.v1}/user/mfa/sms/enroll/verify`,e))}async function Zl(e,t){return Dr(`${za.v1}/user/mfa/sms/${e}`,t)}async function ec(e,t){return Dr(`${za.v1}/user/mfa/sms/${e}/verify`,t)}async function tc(e,t){return nl(await Dr(`${za.v1}/user/mfa/sms/${e}/verify`,t))}async function nc(e){return Dr(`${za.v1}/user/mfa/webauthn/enroll`,e)}async function ic(e){return Dr(`${za.v1}/user/mfa/webauthn/enroll/verify`,e)}async function oc(e){return nl(await Dr(`${za.v1}/user/mfa/webauthn/enroll/verify`,e))}async function ac(e,t){return Dr(`${za.v1}/user/mfa/webauthn/${e}`,t)}async function rc(e,t){return Dr(`${za.v1}/user/mfa/webauthn/${e}/verify`,t)}async function sc(e,t){return nl(await Dr(`${za.v1}/user/mfa/webauthn/${e}/verify`,t))}async function lc(){return Rr(`${ir.v1}/saml/configurations`)}async function cc(e){return Dr(`${ir.v1}/saml/configurations`,e)}async function uc(){return Rr(`${ir.v1}/saml/configurations/vendor-config`)}async function dc(e){return Mr(`${ir.v1}/saml/configurations/metadata`,e)}async function yc(){return Mr(`${ir.v1}/saml/validations/domain`)}async function fc(){return Rr(`${ir.v1}/saml/configurations/roles/default`)}async function pc(){return Rr(`${ir.v2}/saml/configurations/groups`)}async function gc({roleIds:e}){return Dr(`${ir.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Sc({roleIds:e,group:t}){return Dr(`${ir.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function vc({roleIds:e,group:t,id:n}){return Nr(`${ir.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function hc({id:e}){return Fr(`${ir.v2}/saml/configurations/groups/${e}`)}async function mc(){return Rr(`${ir.v1}/oidc/configurations`)}async function Ac(){return Rr(`${ir.v2}/configurations/public`)}async function bc(){return Rr(Ja.v1)}async function Tc(){return Rr(Ja.v2)}async function Ec(){return Rr(`${Ja.v2}/authenticated`)}async function kc(){return Rr(Ja.custom.v1)}async function Ic({provider:e,code:t,idToken:n,redirectUri:i,codeVerifier:o,metadata:a,invitationToken:r,state:s}){const l={};return t&&(l.code=t),n&&(l.id_token=n),i&&(l.redirectUri=i),o&&(l.code_verifier=o),s&&(l.state=s),Dr(`${za.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function Oc(){return Rr(`${Ha.v1}/public`)}async function Pc(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Dr(`${Ka.v1}/signUp`,e),a={shouldActivate:t,userId:i,tenantId:o};if(!t&&n){const{user:e,tenants:t,activeTenant:i}=await nl(n);return D({},a,{user:e,tenants:t,activeTenant:i})}return a}async function _c(){return Rr(Ka.sessions.currentUser.v1)}async function Lc(){return Rr(`${Ka.sessions.currentUser.v1}/current`)}async function wc(e){return Dr(`${Ka.sessions.v1}/revoke`,{userId:e})}async function Uc(){return Rr(Ka.sessions.configurations.v1)}async function Cc(e){await Dr(Ka.sessions.configurations.v1,e)}async function Rc(e){await Fr(`${Ka.sessions.currentUser.v1}/${e}`)}async function Dc(){await Fr(`${Ka.sessions.currentUser.v1}/all`)}async function Nc(){return Rr(Ka.accessTokens.v1)}async function Mc(){return Rr(Xa.accessTokens.v1)}async function Fc({id:e}){return Fr(`${Xa.accessTokens.v1}/${e}`)}async function Gc({id:e}){return Fr(`${Ka.accessTokens.v1}/${e}`)}async function $c(e){return Dr(Ka.accessTokens.v1,e)}async function xc(e){return Dr(Xa.accessTokens.v1,e)}async function Vc(){return Rr(Ka.apiTokens.v1)}async function jc(){return Rr(Xa.apiTokens.v1)}async function Bc(e){return Dr(Ka.apiTokens.v1,e)}async function Wc(e){return Dr(Xa.apiTokens.v2,e)}async function zc({tokenId:e}){return Fr(`${Xa.apiTokens.v1}/${e}`)}async function Kc({tokenId:e}){return Fr(`${Ka.apiTokens.v1}/${e}`)}async function Hc({userId:e}){return Rr(`${Ka.v1}/${e}`)}async function qc(e){return Rr(`${Ha.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Jc(e){let{type:t}=e,n=to(e,Js);return Dr(`${za.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Yc(e){let{type:t}=e,n=to(e,Ys);return nl(await Dr(`${za.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function Xc(e){let{type:t}=e,n=to(e,Xs);return Dr(`${za.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Qc({token:e}){return Dr(Xa.invites.verify.v1,{token:e})}async function Zc(){return Rr(`${ir.v1}/configurations`)}async function eu(e){return Dr(`${ir.v1}/configurations`,e)}async function tu(e,t){return Nr(`${ir.v1}/configurations/${e}`,t)}async function nu(e){return Fr(`${ir.v1}/configurations/${e}`)}async function iu(e){return Dr(`${ir.v1}/configurations/metadata`,e)}async function ou(e,t){return Mr(`${ir.v1}/configurations/${e}/metadata`,t)}async function au(e){return Dr(`${ir.v1}/configurations/metadata-url`,e)}async function ru(e,t){return Mr(`${ir.v1}/configurations/${e}/metadata-url`,t)}async function su(e,t){return Dr(`${ir.v1}/configurations/${e}/domains`,t)}async function lu(e,t){return Fr(`${ir.v1}/configurations/${e}/domains/${t}`)}async function cu(e,t){return Mr(`${ir.v1}/configurations/${e}/domains/${t}/validate`)}async function uu(e){return Rr(`${ir.v1}/configurations/${e}/roles`)}async function du(e,t){return Mr(`${ir.v1}/configurations/${e}/roles`,t)}async function yu(e,t){return Dr(`${ir.v1}/configurations/${e}/groups`,t)}async function fu(e,{roleIds:t,group:n,id:i}){return Nr(`${ir.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function pu(e,t){return Fr(`${ir.v1}/configurations/${e}/groups/${t}`)}async function gu(e){return Rr(`${ir.v1}/configurations/${e}/groups`)}async function Su(e){return Dr(`${za.v2}/user/sso/prelogin`,e)}async function vu(e){return Qs(await Dr(`${za.v2}/user/oidc/postlogin`,e))}async function hu(e){return ol(await Dr(`${br}/token`,e))}async function mu(){const e=ts();return ol(await Dr(`${br}/authorize/silent`,{tenantId:e}))}async function Au(e){return il(await Dr(`${br}/token`,e))}async function bu(){const e=ts();return il(await Dr(`${br}/authorize/silent`,{tenantId:e}))}async function Tu(e){return Dr(`${Ka.v1}/phone/reset`,e)}async function Eu(e){return Dr(`${Ka.v1}/phone/reset/verify`,e)}async function ku(e){return Dr(`${Ka.v1}/phone`,e)}async function Iu(e){return Dr(`${Ka.v1}/phone/verify`,e)}async function Ou(e){return Mr(`${Ka.v1}/phone/change`,e)}async function Pu(e){return Dr(`${za.v1}/webauthn/prelogin`,e)}async function _u(e){return Dr(`${za.v1}/webauthn/postlogin`,e)}async function Lu(e){return nl(await Dr(`${za.v1}/webauthn/postlogin`,e))}async function wu(){return Dr(Wa.v1)}async function Uu(){return Rr(Wa.v1)}async function Cu(e){return Fr(`${Wa.v1}/${e}`)}async function Ru(e){return Dr(`${Wa.v1}/verify`,e)}async function Du(){return Rr(`${Ha.v1}/auth/strategies/public`)}async function Nu(){return Rr(`${Ha.v1}/auth/strategies`)}async function Mu(){return Rr(`${Ha.v1}/mfa/strategies`)}async function Fu(){return Rr(`${Ka.authorization.v1}`)}async function Gu(){return Rr(`${Ka.v2}/me`)}async function $u(){const[e]=Br.getFeatureFlags([Vr],Va.getAppName()||""),t=[{action:Gu,shouldLoad:!0},{action:e?Ks:zs,shouldLoad:el()},{action:Fu,shouldLoad:tl()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[n,i,o]=await Promise.all(t),a=ts();return a&&(n.tenantId=a),D({},n,null!=o?o:{},{entitlements:i})}async function xu(e){const t=await Dr(`${za.v1}/user/step-up/generate`,e);return t.accessToken?nl(t):t}async function Vu(e){return Rr(`${Ka.v2}/me`,null!=e?e:{addRoles:!0})}async function ju(e){return Mr(`${Ka.v2}/me`,e)}async function Bu(e){return Mr(`${sr.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Wu(e){return Dr(`${Ka.v1}/passwords/change`,e)}async function zu(e){var t,n,i,o,a,r;const s=(e.filter||[]).reduce(((e,t)=>D({},e,{[t.id]:t.value})),{}),l=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(i=e.sort)||null==(o=i[0])?void 0:o.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return Rr(or.v1,D({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function Ku(e){return Dr(Ka.v2,D({},e,{provider:"local"}))}async function Hu(e){return Fr(`${or.v1}/${e.userId}`)}async function qu(e){return Mr(or.v1,e)}async function Ju(e){const{userId:t,expirationInSeconds:n}=e;return Mr(`${Ka.temporary.v1}/${t}`,{expirationInSeconds:n})}async function Yu(e){return Fr(`${Ka.temporary.v1}/${e}`)}async function Xu(){return Rr(Ka.temporary.configuration.v1)}async function Qu(e){return Dr(Xa.invites.user.v1,D({},e))}async function Zu(e){return Nr(Xa.invites.user.v1,D({},e))}async function ed(){return Fr(Xa.invites.user.v1)}async function td(){return Rr(Xa.invites.user.v1)}async function nd(){return Rr(Xa.invites.configuration.v1)}async function id(){return Rr(ar.v1)}async function od(){return Rr(Ya.v1)}async function ad(){return Rr(`${rr.v1}/members`)}async function rd(e){return Dr(`${or.v1}/${e.userId}/resendActivationEmail`,{})}async function sd(e){return Dr(Ka.v2,D({},e,{provider:"local"}))}async function ld(e){return Dr(Ka.invitation.resendAll.v1,D({},e))}async function cd(e){var t,n;const i=await Rr("/metadata",e);if(null!=i&&null!=(t=i.rows)&&t[0])return null==i||null==(n=i.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function ud(){return Rr("/metadata/admin-box")}async function dd(e){return Dr("/metadata/admin-box",e)}async function yd(){const e=await Rr("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const fd=async()=>cd({entityName:"notifications"}),pd=async()=>cd({entityName:"saml"}),gd=async()=>cd({entityName:"audits"}),Sd=async e=>async function(e){const t=await Rr(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),vd=["dataFilters"],hd=["templateId","dataFilters"],md=["dataFilters"];async function Ad(e){return Rr(`${gr.v2}/tenant-reports`,e)}async function bd(e){return Rr(`${gr.v2}/${e.id}/tenant-reports`)}async function Td(e){let{dataFilters:t}=e,n=to(e,vd);return{html:await Rr(`${Sr.v1}/preview-report`,D({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Ed(e){let{templateId:t,dataFilters:n}=e,i=to(e,hd);return Dr(`${gr.v2}/${t}/tenant-reports`,D({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function kd(e){let{dataFilters:t}=e,n=to(e,md);const i=await Rr(`${Sr.v1}/preview-report`,D({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),s=URL.createObjectURL(r),l=document.createElement("a");l.href=s,l.setAttribute("download",`report_${n.name||""}.${a}`),l.click(),setTimeout(l.remove.bind(l))}async function Id(e){return Dr(`${Sr.v1}/tenant-reports`,e)}async function Od(e){return Rr(vr,{params:e})}async function Pd(e){return Mr(`${vr}/status`,{params:e})}async function _d(e){const{notificationId:t,pinStatus:n}=e;return Mr(`${vr}/${n}`,{notificationId:t})}async function Ld(){return Dr(`${vr}/status/mark-all-read`)}const wd=["endpoint","headerProps"];async function Ud(e){return Rr(hr,e)}async function Cd(e){return Rr(`${hr}/stats`,e)}async function Rd(e){const{endpoint:t,headerProps:n}=e,i=to(e,wd);return Gr(`${hr}/export/${t}`,{properties:n},i)}const Dd=["eventKey"],Nd=["eventKey"],Md=()=>Rr(`${dr.v1}/slack`),Fd=()=>Rr(`${dr.v1}/slack/applications`),Gd=()=>Rr(`${dr.v1}/slack/channels`),$d=e=>e.id?Nr(`${dr.v1}/slack/subscription/${e.id}`,e):Dr(`${dr.v1}/slack/subscriptions`,e),xd=e=>Fr(`${dr.v1}/slack/subscriptions/${e.id}`),Vd=e=>Dr(`${dr.v1}/slack/applications/registrations`,{code:e}),jd=()=>Rr(`${dr.v1}/emails`),Bd=e=>{let{eventKey:t}=e,n=to(e,Dd);return Dr(`${dr.v1}/emails/${t}`,n)},Wd=({eventKey:e,enabled:t})=>Nr(`${dr.v1}/emails/${e}`,{enabled:t}),zd=(e,t)=>Fr(`${dr.v1}/emails/${e}/subscriptions/${t}`),Kd=(e,t,n)=>Mr(`${dr.v1}/emails/${t}/subscriptions/${e}`,n),Hd=e=>Fr(`${dr.v1}/emails/${e}`),qd=()=>Rr(`${dr.v2}/sms`),Jd=e=>{let{eventKey:t}=e,n=to(e,Nd);return Dr(`${dr.v2}/sms/${t}`,n)},Yd=({eventKey:e,enabled:t})=>Nr(`${dr.v2}/sms/${e}`,{enabled:t}),Xd=(e,t)=>Fr(`${dr.v2}/sms/${e}/subscriptions/${t}`),Qd=(e,t,n)=>Mr(`${dr.v2}/sms/${t}/subscriptions/${e}`,n),Zd=e=>Fr(`${dr.v2}/sms/${e}`),ey=()=>Rr(Ar),ty=e=>e._id?Nr(`${Ar}/${e._id}`,e):Dr(`${Ar}/custom`,e),ny=e=>Fr(`${Ar}/${e}`),iy=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Rr(`${Ar}/logs/?${i.toString()}`)},oy=e=>Dr(`${Ar}/test`,e),ay=e=>Dr(`${Ar}/logs/${e}/retries`),ry=()=>Rr(`${mr.v1}/categories`),sy=e=>Rr(mr.v1,{channels:e});async function ly(e,t){return Mr(lr.v1,e,{headers:$r(t)})}async function cy(e){return Rr(lr.v1,void 0,{headers:$r(e)})}async function uy(){return Rr(`${lr.v1}/public`)}const dy=["roleId"],yy=["roleId"],fy=["permissionId"];async function py(){return Rr(Qa.v1)}async function gy(e){return Dr(Qa.v1,e)}async function Sy({roleId:e}){return Fr(`${Qa.v1}/${e}`)}async function vy(e){let{roleId:t}=e,n=to(e,dy);return Nr(`${Qa.v1}/${t}`,n)}async function hy(e){let{roleId:t}=e,n=to(e,yy);return Mr(`${Qa.v1}/${t}/permissions`,n)}async function my(){return Rr(Ya.v1)}async function Ay(e){let{permissionId:t}=e,n=to(e,fy);return Mr(`${Ya.v1}/${t}/roles`,n)}async function by(){return Rr(`${Ya.v1}/categories`)}async function Ty(){return Rr(yr.subscriptions.v1)}async function Ey(e){return Rr(`${yr.subscriptions.v1}/${e}`)}async function ky(e){return Mr(`${yr.subscriptions.v1}/${e}/cancellations/`,{})}async function Iy(e){return Mr(`${yr.subscriptions.v1}/${e}/renewals/`,{})}async function Oy(e,{paymentMethodId:t,planId:n}){return Mr(`${yr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Py(e){return Rr(`${pr.v1}/${e}`)}async function _y(){return Rr(`${pr.v1}`)}async function Ly(e){return Mr(`${pr.v1}/${e}/cancellations/`,{})}async function wy(e){return Mr(`${pr.v1}/${e}/renewals/`,{})}async function Uy(e,{paymentMethodId:t,planId:n}){return Mr(`${pr.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Cy(){return Rr(yr.plans.v1)}async function Ry(e){return Rr(`${yr.plans.v1}/${e}`)}async function Dy(){return Rr(yr.invoices.v1)}async function Ny(e){return Rr(`${yr.invoices.v1}/${e}`)}async function My(e,t){return Rr(`${yr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Fy=["email"];async function Gy(){return Rr(yr.paymentMethods.v1)}async function $y(e){return Rr(`${yr.paymentMethods.v1}/${e}`)}async function xy(e,t){let{email:n}=t,i=to(t,Fy);return Nr(`${yr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function Vy(e){return Dr(yr.paymentProviders.stripe.subscriptions.v1,e)}async function jy(e){return Rr(`${yr.paymentProviders.stripe.customers.v1}/${e}`)}async function By(e){return Dr(`${yr.paymentProviders.stripe.customers.v1}`,e)}async function Wy(){return Rr(`${yr.paymentProviders.stripe.publicConfigurations.v1}`)}async function zy(e){return Dr(`${yr.paymentProviders.stripe.setupIntents.v1}`,e)}async function Ky(e){return Rr(`${yr.summaries.v1}/${e}`)}async function Hy(e){return Rr(`${yr.tenantConfiguration.v1}/${e}`)}async function qy(e){return Dr(`${yr.tenantConfiguration.v1}`,e)}async function Jy(){return Rr(fr.v1)}async function Yy(){return Rr(`${yr.configurations.vendorPublicConfigurations.v1}`)}let Xy,Qy,Zy,ef,tf,nf;async function of(){return Rr("/vendors/public")}async function af(e){return Rr(Za.v1,e)}async function rf(e){return Dr(Za.v1,e)}async function sf(e,t){return Fr(Za.v1,e,{headers:$r(t)})}async function lf(e,t,n){return Dr(`${Za.v1}/${e}/roles`,t,{headers:$r(n)})}async function cf(e,t,n){return Fr(`${Za.v1}/${e}/roles`,t,{headers:$r(n)})}async function uf(e,t,n){return Nr(`${Za.v1}/${e}/roles`,t,{headers:$r(n)})}async function df(e,t){return Dr(ur.v1,e,{headers:$r(t)})}async function yf(e,t){return Fr(`${ur.v1}/${e}`,void 0,{headers:$r(t)})}async function ff({tenantId:e},t,n){return Nr(`${ur.v1}/${e}`,t,{headers:$r(n)})}async function pf(e,t,n){return Mr(`${Za.v1}/${e}/access`,t,{headers:$r(n)})}async function gf(e,t){return Dr(`${Za.v2}/`,e,{headers:$r(t)})}async function Sf(){return Rr(`${Er}`)}async function vf(e,t){return Nr(`${Er}/${e}`,t)}async function hf(e){return Dr(`${Er}`,e)}async function mf(e){return Fr(`${Er}/${e}`)}async function Af(e){return Rr(`${kr}/${e}/Users/count`)}async function bf(e){return Dr(`${er.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Xy||(Xy={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Qy||(Qy={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Zy||(Zy={})),(ef||(ef={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(tf||(tf={})),function(e){e.CREATE="create_customer"}(nf||(nf={}));const Tf=["groupId"];async function Ef({groupId:e},t){return Rr(`${tr.v1}/${e}`,D({},t))}async function kf(e){return Rr(`${tr.v1}`,D({},e))}async function If(e,t){return Dr(`${tr.getByIds.v1}`,e,{params:t})}async function Of(e){return Dr(`${tr.v1}`,e)}async function Pf(e){let{groupId:t}=e,n=to(e,Tf);return Nr(`${tr.v1}/${t}`,n)}async function _f(e){return Fr(`${tr.v1}/${e}`)}async function Lf(e,t){return Dr(`${tr.v1}/${e}/roles`,t)}async function wf(e,t){return Fr(`${tr.v1}/${e}/roles`,t)}async function Uf(e,t){return Dr(`${tr.v1}/${e}/users`,t)}async function Cf(e,t){return Fr(`${tr.v1}/${e}/users`,t)}async function Rf(){return Rr(`${tr.configurations.v1}`)}async function Df(e){return Dr(`${tr.configurations.v1}`,e)}async function Nf(){return Rr(Pr.v1)}async function Mf(){return Rr(_r.v1)}async function Ff(e){return Rr(`${nr.v1}`,e)}async function Gf(e){return Dr(`${nr.v1}`,e)}async function $f(e){return Fr(`${nr.v1}/${e}`)}async function xf(e){return Dr(`${nr.v1}/preverify`,e)}async function Vf(e){return Dr(`${nr.v1}/verify`,e)}async function jf(e,t){return Dr(`${nr.v1}/${e}/delete/verify`,t)}let Bf,Wf,zf;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Bf||(Bf={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(Wf||(Wf={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(zf||(zf={}));const Kf=[/^(.*)\/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],Hf=`${za.v1}/user/token/refresh`,qf=`${br}/authorize/silent`,Jf=`${Ka.v2}/me`,Yf=`${Ka.v2}/me/tenants`,Xf=`${Ka.v3}/me/tenants`;let Qf,Zf,ep,tp,np,ip,op,ap;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Qf||(Qf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Zf||(Zf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(ep||(ep={})),function(e){e.FORCE_MFA="FORCE_MFA",e.BREACHED_PASSWORDS_EXIST="BREACHED_PASSWORDS_EXIST",e.ENABLE_USER_LOCKOUT="ENABLE_USER_LOCKOUT",e.STRENGTHEN_USER_LOCKOUT="STRENGTHEN_USER_LOCKOUT",e.ENABLE_PASSWORD_HISTORY="ENABLE_PASSWORD_HISTORY",e.STRENGTHEN_PASSWORD_HISTORY="STRENGTHEN_PASSWORD_HISTORY",e.ENABLE_FORCE_RELOGIN="ENABLE_FORCE_RELOGIN",e.SET_FORCE_RELOGIN="SET_FORCE_RELOGIN",e.ENABLE_SESSION_CONCURRENCY="ENABLE_SESSION_CONCURRENCY",e.SET_SESSION_CONCURRENCY="SET_SESSION_CONCURRENCY",e.ENABLE_IDLE_SESSION="ENABLE_IDLE_SESSION",e.SET_IDLE_SESSION="SET_IDLE_SESSION",e.ENABLE_IP_RESTRICTIONS="ENABLE_IP_RESTRICTIONS",e.CHANGE_IP_TO_ALLOWLIST="CHANGE_IP_TO_ALLOWLIST",e.ENABLE_DOMAIN_RESTRICTIONS="ENABLE_DOMAIN_RESTRICTIONS",e.CHANGE_DOMAIN_TO_ALLOWLIST="CHANGE_DOMAIN_TO_ALLOWLIST",e.CONFIGURE_SSO="CONFIGURE_SSO"}(tp||(tp={})),function(e){e.MFA_FORCED="MFA_FORCED",e.PARTIALLY_FORCED_MFA="PARTIALLY_FORCED_MFA",e.PARTIAL_MFA_USAGE="PARTIAL_MFA_USAGE",e.FULL_MFA_USAGE="FULL_MFA_USAGE",e.BREACHED_PASSWORD_USERS_EXIST="BREACHED_PASSWORD_USERS_EXIST",e.IMPROVE_LOCKOUT_POLICY="IMPROVE_LOCKOUT_POLICY",e.IMPROVE_PASSWORD_HISTORY_POLICY="IMPROVE_PASSWORD_HISTORY_POLICY",e.NO_SESSION_SETTINGS="NO_SESSION_SETTINGS",e.PARTIAL_SESSION_SETTINGS="PARTIAL_SESSION_SETTINGS",e.FULL_SESSION_SETTINGS="FULL_SESSION_SETTINGS",e.NO_IP_RESTRICTIONS="NO_IP_RESTRICTIONS",e.IP_ALLOWLIST="IP_ALLOWLIST",e.IP_DENYLIST="IP_DENYLIST",e.NO_DOMAIN_RESTRICTIONS="NO_DOMAIN_RESTRICTIONS",e.DOMAIN_ALLOWLIST="DOMAIN_ALLOWLIST",e.DOMAIN_DENYLIST="DOMAIN_DENYLIST",e.FULL_PASSWORD_SETTINGS="FULL_PASSWORD_SETTINGS"}(np||(np={})),function(e){e.SEND_RESET_BREACHED_PASSWORD_EMAIL="SEND_RESET_BREACHED_PASSWORD_EMAIL",e.ADJUST_FORCE_RELOGIN="ADJUST_FORCE_RELOGIN",e.ADJUST_MAX_CONCURRENT_SESSIONS="ADJUST_MAX_CONCURRENT_SESSIONS",e.ADJUST_IDLE_TIMEOUT="ADJUST_IDLE_TIMEOUT"}(ip||(ip={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(op||(op={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(ap||(ap={}));const rp={auth:s,teams:l,metadata:c,reports:u,connectivity:f,notifications:d,audits:y,tenants:a,accountSettings:p,roles:g,subscriptions:S,vendor:v,subTenants:h,featureFlags:t,directory:m,impersonate:A,groups:b,users:o,entitlements:r,securityCenter:T,userPhoneNumbers:E};var sp={fetch:e,ContextHolder:Va,FronteggContext:ja,api:rp,FronteggApiError:Ba,AuthStrategyEnum:Ii,MachineToMachineAuthStrategy:Oi,SocialLoginProviders:ki,ISubscriptionCancellationPolicy:Zy,ISubscriptionStatus:Xy,PaymentMethodType:Qy,ProviderType:ef};let lp,cp;!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"}(lp||(lp={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(cp||(cp={}));const up="input is invalid type",dp="undefined"!=typeof ArrayBuffer,yp="0123456789abcdef".split(""),fp=[-2147483648,8388608,32768,128],pp=[24,16,8,0],gp=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Sp=["hex","array","digest","arrayBuffer"],vp=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),dp&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const hp=function(e){return function(t){const n=new Ap(!0).update(t);return null==n?void 0:n[e]()}},mp=function(e){return function(t,n){const i=new bp(t,!0).update(n);return null==i?void 0:i[e]()}};class Ap{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=()=>Ap.prototype.digest(),e?(vp[0]=vp[16]=vp[1]=vp[2]=vp[3]=vp[4]=vp[5]=vp[6]=vp[7]=vp[8]=vp[9]=vp[10]=vp[11]=vp[12]=vp[13]=vp[14]=vp[15]=0,this.blocks=vp):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(up);if(null===e)throw new Error(up);if(dp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||dp&&ArrayBuffer.isView(e)))throw new Error(up);t=!0}let i,o,a=0;const r=e.length,s=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)for(o=this.start;a<r&&o<64;++a)s[o>>2]|=e[a]<<pp[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<pp[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<pp[3&o++],s[o>>2]|=(128|63&i)<<pp[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<pp[3&o++],s[o>>2]|=(128|i>>6&63)<<pp[3&o++],s[o>>2]|=(128|63&i)<<pp[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<pp[3&o++],s[o>>2]|=(128|i>>12&63)<<pp[3&o++],s[o>>2]|=(128|i>>6&63)<<pp[3&o++],s[o>>2]|=(128|63&i)<<pp[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=s[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}finalize(){if(this.finalized)return;this.finalized=!0;const e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=fp[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,i,o,a,r,s,l,c,u,d=this.h0,y=this.h1,f=this.h2,p=this.h3,g=this.h4,S=this.h5,v=this.h6,h=this.h7;const m=this.blocks;for(e=16;e<64;++e)o=m[e-15],t=(o>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,o=m[e-2],n=(o>>>17|o<<15)^(o>>>19|o<<13)^o>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(s=704751109,o=m[0]-210244248,h=o-1521486534<<0,p=o+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),s=d&y,i=s^d&f^u,r=g&S^~g&v,o=h+n+r+gp[e]+m[e],a=t+i,h=p+o<<0,p=o+a<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),l=p&d,i=l^p&y^s,r=h&g^~h&S,o=v+n+r+gp[e+1]+m[e+1],a=t+i,v=f+o<<0,f=o+a<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&p,i=c^f&d^l,r=v&h^~v&g,o=S+n+r+gp[e+2]+m[e+2],a=t+i,S=y+o<<0,y=o+a<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),u=y&f,i=u^y&p^c,r=S&v^~S&h,o=g+n+r+gp[e+3]+m[e+3],a=t+i,g=d+o<<0,d=o+a<<0;this.h0=this.h0+d<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+p<<0,this.h4=this.h4+g<<0,this.h5=this.h5+S<<0,this.h6=this.h6+v<<0,this.h7=this.h7+h<<0}hex(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7;let l=yp[e>>28&15]+yp[e>>24&15]+yp[e>>20&15]+yp[e>>16&15]+yp[e>>12&15]+yp[e>>8&15]+yp[e>>4&15]+yp[15&e]+yp[t>>28&15]+yp[t>>24&15]+yp[t>>20&15]+yp[t>>16&15]+yp[t>>12&15]+yp[t>>8&15]+yp[t>>4&15]+yp[15&t]+yp[n>>28&15]+yp[n>>24&15]+yp[n>>20&15]+yp[n>>16&15]+yp[n>>12&15]+yp[n>>8&15]+yp[n>>4&15]+yp[15&n]+yp[i>>28&15]+yp[i>>24&15]+yp[i>>20&15]+yp[i>>16&15]+yp[i>>12&15]+yp[i>>8&15]+yp[i>>4&15]+yp[15&i]+yp[o>>28&15]+yp[o>>24&15]+yp[o>>20&15]+yp[o>>16&15]+yp[o>>12&15]+yp[o>>8&15]+yp[o>>4&15]+yp[15&o]+yp[a>>28&15]+yp[a>>24&15]+yp[a>>20&15]+yp[a>>16&15]+yp[a>>12&15]+yp[a>>8&15]+yp[a>>4&15]+yp[15&a]+yp[r>>28&15]+yp[r>>24&15]+yp[r>>20&15]+yp[r>>16&15]+yp[r>>12&15]+yp[r>>8&15]+yp[r>>4&15]+yp[15&r];return l+=yp[s>>28&15]+yp[s>>24&15]+yp[s>>20&15]+yp[s>>16&15]+yp[s>>12&15]+yp[s>>8&15]+yp[s>>4&15]+yp[15&s],l}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7,l=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return l.push(s>>24&255,s>>16&255,s>>8&255,255&s),l}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class bp extends Ap{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const i=typeof e;if("string"===i){const t=[],i=e.length;let o,a=0;for(n=0;n<i;++n)o=e.charCodeAt(n),o<128?t[a++]=o:o<2048?(t[a++]=192|o>>6,t[a++]=128|63&o):o<55296||o>=57344?(t[a++]=224|o>>12,t[a++]=128|o>>6&63,t[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++n)),t[a++]=240|o>>18,t[a++]=128|o>>12&63,t[a++]=128|o>>6&63,t[a++]=128|63&o);e=t}else{if("object"!==i)throw new Error(up);if(null===e)throw new Error(up);if(dp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||dp&&ArrayBuffer.isView(e)))throw new Error(up)}var o;e.length>64&&(e=null==(o=new Ap(!0).update(e))?void 0:o.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}Ap.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();Ap.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Ap.prototype.finalize.call(this)}}}const Tp=function(){const e=hp("hex");e.create=function(){return new Ap},e.update=function(t){return e.create().update(t)};for(let t=0;t<Sp.length;++t){const n=Sp[t];e[n]=hp(n)}return e}();function Ep(e,t){const n=D({},e);return t.forEach((e=>{delete n[e]})),n}async function kp(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=Tp.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Ip(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=mp("hex");e.create=function(e){return new bp(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Sp.length;++t){const n=Sp[t];e[n]=mp(n)}}();const Op=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*Pp(e){const t=yield Ko((e=>e.root.appName));return Br.getFeatureFlags(e,t)}const _p={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Lp=D({},_p,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),wp=[{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"}],Up={sub:"",tenants:[],id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!0,profilePictureUrl:"https://www.gravatar.com/avatar/42b2ad2bad6fc9b9db5086dfcf8072ac?d=https://ui-avatars.com/api/fe/128/random?t=1617261890875?t=1617261917434",roles:[{id:"roleId",key:"admin",isDefault:!1,name:"Admin",description:null,permissions:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",key:"fe.*",name:"General Admin",description:"description",categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date,roleIds:[]}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),verified:!1},Cp=D({},Up,{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}),Rp={loading:!1,error:void 0,saving:!0,profile:Up},Dp={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"},Np={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Ii.EmailAndPassword,machineToMachineAuthStrategy:Oi.ClientCredentials},Mp={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Fp={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Gp={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},$p={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},xp={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Vp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],jp={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:$p,roles:Vp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Bp=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Wp={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:[wp[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[wp[0]],managedBy:ep.FRONTEGG}]},zp={id:Wp.id,email:Wp.email,name:Wp.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[wp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Kp={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:[wp[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[wp[0]],managedBy:ep.FRONTEGG}]},Hp={id:Kp.id,email:Kp.email,name:Kp.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[wp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},qp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Jp=[Kp,Wp],Yp=[Hp,zp],Xp=[qp],Qp=[{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}],Zp=[{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"}],eg={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},tg={isActive:!0,strategy:zn.ALLOW},ng=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:zn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:zn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:zn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:zn.BLOCK,description:"IP 4"}],ig=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(D({},Kp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},og=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"}),ag=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:ig(6),roles:[og("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:ep.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:ig(44),roles:[og("Editor")],managedBy:ep.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:ig(8),roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:ig(5),roles:[og("Admin")],managedBy:ep.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:ig(21),description:"BDR, AE, and inside sales",roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:ig(23),description:"Dev success and customer success",roles:[og("Admin")],managedBy:ep.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:ig(10),description:"The marketing department",roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:ig(4),description:"Human resources",roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:ig(3),roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:ig(8),roles:[og("Editor")],managedBy:ep.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:ig(4),roles:[og("Viewer")],managedBy:ep.FRONTEGG}],rg={scoring:{score:79},recommendations:{items:[{code:tp.FORCE_MFA,severity:op.WARNING,category:ap.MFA},{code:tp.ENABLE_FORCE_RELOGIN,severity:op.WARNING,category:ap.SESSIONS}]}},sg={insights:{items:[{category:ap.MFA,code:np.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:ap.SESSIONS,code:np.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:ap.PASSWORD,code:np.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:ap.DOMAIN,code:np.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},lg={users:Yp,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},cg={users:[Yp[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},ug={users:[Yp[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0};let dg,yg,fg;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(dg||(dg={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(yg||(yg={})),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"}(fg||(fg={})),fg.profile,fg.privacy,fg.personalApiTokens,fg.account,fg.users,fg.groups,fg.security,fg.sso,fg.audits,fg.webhooks,fg.apiTokens,fg.roles,fg.subscriptions,fg.allAccounts;const pg=e=>{try{return new URL(e),!0}catch(e){return!1}},gg=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Sg=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},vg="tenantId",hg=e=>e.mfaRequired&&e.mfaToken?(Va.setAccessToken(null),Va.setUser(null),!0):(Va.setAccessToken(e.accessToken),Va.setUser(e),!1),mg=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,numberOfEmails:i,totalDevices:o}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length),o=+Boolean(e.emails.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,numberOfEmails:o,totalDevices:t+n+i+o}})(e);if(1===o){if(n)return un.authenticatorApp;if(t)return un.smsVerifyCode;if(i)return un.emailVerifyCode}return un.verify},Ag=e=>{if(1===e.length){const[t]=e;if(t===Bs.AuthenticatorApp)return un.authenticatorApp;if(t===Bs.SMS)return un.smsSetPhoneNumber;if(t===Bs.EmailCode)return un.emailVerifyCode}return un.verify};function*bg(e){let t=_t.loginWithTwoFactor,n={};const{loginState:i}=yield Ko((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield Bo(rp.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:mg(e.mfaDevices)}:(n={step:Ag(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=_t.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:Lt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:D({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a,isBreachedPassword:e.isBreachedPassword})}}const Tg=(e,t)=>e?(e=>Boolean(null==e?void 0:e.statusCode))(e)?e.message:((e=>e instanceof Error||(null==e?void 0:e.message)&&(null==e?void 0:e.stack)&&"Error"===(null==e?void 0:e.name))(e)?console.error(e.message):"string"==typeof e&&console.error(e),null!=t?t:"We're facing some difficulties, Please try again"):t;let Eg;function kg(e,t){var n,i;null==(n=(i=window).onFronteggEvent)||n.call(i,e,t)}!function(e){e.SIGNUP_COMPLETED="signup_completed",e.USER_VERIFIED="user_verified"}(Eg||(Eg={}));const Ig=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,...Ig(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),Og=["callback"];function*Pg(){yield xo(ji.setCustomLoginState({loading:!0}));try{const e=yield Bo(rp.metadata.getAdminBoxMetadata);yield xo(ji.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield xo(ji.setCustomLoginState({loading:!1,error:Tg(e)}))}}function*_g(e){let{payload:{callback:t}}=e,n=to(e.payload,Og);try{yield xo(ji.setCustomLoginState({error:null,saving:!0}));const e=Ig(n);if(0===e.length)throw new Error("No changes to update");yield Bo(rp.metadata.updateAdminBoxMetadata,{actions:e});const i=yield Bo(rp.metadata.getAdminBoxMetadata);yield xo(ji.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield xo(ji.setCustomLoginState({error:Tg(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Lg(){var e,t,n;if(yield Ko((e=>e.auth.isAuthenticated))){var i;const e=yield null!=(i=Ko((({auth:e})=>{var t;return null==(t=e.tenantsState.activeTenant)?void 0:t.hasCustomLogin})))&&i;return e}return!!(null==(e=yield null==(t=Va.getContext())||null==(n=t.tenantResolver)?void 0:n.call(t))?void 0:e.tenant)}function*wg(){try{var e;if(!(yield Bo(Lg)))return;const t=yield Ko((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:i}=rp.accountSettings,{applicationUrl:o}=yield Bo(t?n:i);if(!o)return;const{routes:a}=yield Ko((e=>e.auth)),r=null!=(e=gg(o))?e:"";yield xo(ji.setState({routes:D({},a,{customLoginAuthenticatedUrl:o,customLoginUrl:a.loginUrl+r})})),yield xo(ji.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*Ug(){yield xa(ji.loadTenantMetadata,Pg),yield xa(ji.updateTenantMetadata,_g)}let Cg;!function(e){e.RECOMMENDATIONS="recommendations",e.INSIGHTS="insights",e.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS="sendBulkResetBreachedPasswordEmails",e.SEND_BREACHED_PASSWORD_EMAIL="sendBreachedPasswordEmail",e.BREACHED_PASSWORD_USERS_TABLE="breachedPasswordUsersTable",e.UNENROLLED_MFA_USERS_TABLE="unenrolledMfaUsersTable",e.INACTIVE_USERS_TABLE="inactiveUsersTable"}(Cg||(Cg={}));const Rg=["callback"];function Dg(e){return function*(t){const[n]=yield Bo(Pp,["security-center-admin-portal-major-version"]);yield e(t),n&&(yield Ng(),yield Mg())}}function*Ng(){const e=Cg.RECOMMENDATIONS;yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:i}=yield Bo(rp.securityCenter.getRecommendations);yield xo(ji.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==i?void 0:i.score)?t:0}))}catch(t){yield xo(ji.setSecurityCenterStateError({key:e,value:Tg(t)}))}finally{yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Mg(){const e=Cg.INSIGHTS;yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield Bo(rp.securityCenter.getInsights);yield xo(ji.setSecurityCenterState({insights:t.items}))}catch(t){yield xo(ji.setSecurityCenterStateError({key:e,value:Tg(t)}))}finally{yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Fg(e){let{payload:{callback:t}}=e,n=to(e.payload,Rg);const i=Cg.SEND_BREACHED_PASSWORD_EMAIL;yield xo(ji.setSecurityCenterStateError({key:i,value:!1})),yield xo(ji.setSecurityCenterStateLoader({key:i,value:!0}));try{yield Bo(rp.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield xo(ji.setSecurityCenterStateError({key:i,value:Tg(e)})),null==t||t(!1,e)}finally{yield xo(ji.setSecurityCenterStateLoader({key:i,value:!1}))}}function*Gg({payload:{callback:e}}){const t=Cg.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield xo(ji.setSecurityCenterStateError({key:t,value:!1})),yield xo(ji.setSecurityCenterStateLoader({key:t,value:!0}));try{yield Bo(rp.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield xo(ji.setSecurityCenterStateError({key:t,value:Tg(n)})),null==e||e(!1)}finally{yield xo(ji.setSecurityCenterStateLoader({key:t,value:!1}))}}function*$g({key:e,tableState:t,updateStateKey:n,_offset:i,_limit:o,_preset:a,_email:r,_maxInactiveSeconds:s}){var l,c,u,d;yield xo(ji.setSecurityCenterStateError({key:e,value:!1})),yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0}));const y=null!=(l=null!=i?i:null==t||null==(c=t.queryParams)?void 0:c._offset)?l:0,f=null!=(u=null!=o?o:null==t||null==(d=t.queryParams)?void 0:d._limit)?u:10,p=D({_offset:y,_limit:f,_includeSubTenants:!1,_preset:a,_maxInactiveSeconds:s},!!r&&{_email:r});try{const{items:t,_metadata:{totalItems:i,totalPages:o}}=yield Bo(rp.users.getUsersV3,p),a={totalUsersItems:i,totalUsersPages:o,usersPageOffset:y,queryParams:D({_offset:y,_limit:f,_maxInactiveSeconds:s},!!r&&{_email:r})};if(t.length){const e=yield function*(e){const t=e.map((e=>e.id)),n=yield Bo(rp.roles.getRoles),i=yield Bo(rp.users.getUsersRoles,{ids:t});return e.map((e=>{var t,o;const a=null==i||null==(t=i.find((t=>t.userId===e.id)))?void 0:t.roleIds;return D({},e,{roles:null!=(o=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?o:[]})}))}(t);yield xo(ji.setSecurityCenterState({[n]:D({users:e},a)}))}else yield xo(ji.setSecurityCenterState({[n]:D({users:[]},a)}))}catch(t){yield xo(ji.setSecurityCenterStateError({key:e,value:Tg(t)}))}finally{yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}}function*xg({payload:e}){var t;const n=Cg.BREACHED_PASSWORD_USERS_TABLE,i=yield null!=(t=Ko((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield $g(D({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:pi.BREACHED_PASSWORDS,tableState:i},e))}function*Vg({payload:e}){var t;const n=Cg.UNENROLLED_MFA_USERS_TABLE,i=yield null!=(t=Ko((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield $g(D({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:pi.MFA_UNENROLLED,tableState:i},e))}function*jg({payload:e}){var t;const n=Cg.INACTIVE_USERS_TABLE,i=yield null!=(t=Ko((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield $g(D({key:n,updateStateKey:"inactiveUsersTable",_preset:pi.INACTIVE,tableState:i},e))}function*Bg(){yield Ga(ji.loadRecommendations,Ng),yield Ga(ji.loadInsights,Mg),yield Ga(ji.sendResetBreachedPasswordEmail,Fg),yield Ga(ji.sendBulkResetBreachedPasswordEmails,Gg),yield Ga(ji.loadBreachedPasswordUsers,xg),yield Ga(ji.loadUnenrolledMfaUsers,Vg),yield Ga(ji.loadInactiveUsers,jg)}function*Wg(){const e=Cg.RECOMMENDATIONS;yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield xo(ji.setSecurityCenterState({recommendations:rg.recommendations.items,score:rg.scoring.score})),yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*zg(){const e=Cg.INSIGHTS;yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield xo(ji.setSecurityCenterState({insights:sg.insights.items})),yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*Kg(){const e=Cg.BREACHED_PASSWORD_USERS_TABLE;yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield xo(ji.setSecurityCenterState({breachedPasswordUsersTable:lg})),yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*Hg(){const e=Cg.UNENROLLED_MFA_USERS_TABLE;yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield xo(ji.setSecurityCenterState({unenrolledMfaUsersTable:ug})),yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*qg(){const e=Cg.INACTIVE_USERS_TABLE;yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield xo(ji.setSecurityCenterState({inactiveUsersTable:cg})),yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*Jg({payload:{callback:e}}){const t=Cg.SEND_BREACHED_PASSWORD_EMAIL;yield xo(ji.setSecurityCenterStateLoader({key:t,value:!0})),yield Ho(500),null==e||e(!0),yield xo(ji.setSecurityCenterStateLoader({key:t,value:!1}))}function*Yg(){yield Ga(ji.loadRecommendations,Wg),yield Ga(ji.loadInsights,zg),yield Ga(ji.loadBreachedPasswordUsers,Kg),yield Ga(ji.loadUnenrolledMfaUsers,Hg),yield Ga(ji.loadInactiveUsers,qg),yield Ga(ji.sendResetBreachedPasswordEmail,Jg)}const Xg=["callback"],Qg=["callback"],Zg=["callback"],eS=["callback"],tS=["callback"],nS=["callback"];function*iS(){yield xo(ji.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getGlobalSecurityPolicy);yield xo(ji.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyGlobalState({error:Tg(e),loading:!1}))}yield xo(ji.loadSecurityPolicyMfa()),yield xo(ji.loadSecurityPolicyVendorMfa()),yield xo(ji.loadSecurityPolicyLockout()),yield xo(ji.loadSecurityPolicyVendorLockout()),yield xo(ji.loadSecurityPolicyVendorPasswordHistory()),yield xo(ji.loadSecurityPolicyCaptcha()),yield xo(ji.loadPublicAuthStrategiesPolicy())}function*oS(e){var t,n;if(!(yield Bo(Lg)))return e;const i=yield Bo(rS);return null!=i&&null!=(t=i.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?D({},e,{authStrategy:i.mainAuthStrategies[0].strategy}):e}function*aS(){yield xo(ji.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getVendorConfig),t=yield oS(e);yield xo(ji.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyPublicState({error:Tg(e),loading:!1}))}}function*rS(){const e=yield Ko((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Bo(rp.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield Bo(rp.auth.getVendorPublicAuthStrategiesConfig),t}function*sS(){yield xo(ji.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield Bo(rS);yield function*(e){const t=yield Bo(Lg);if(!e||!t)return;const{policy:n}=yield Ko((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield xo(ji.setSecurityPolicyPublicState({policy:D({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield xo(ji.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyAuthStrategyPublicState({error:Tg(e),loading:!1}))}}function*lS(){yield xo(ji.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getMfaPolicy);yield xo(ji.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyMfaState({error:Tg(e),loading:!1}))}}function*cS(){yield xo(ji.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getVendorMfaPolicy);yield xo(ji.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyVendorMfaState({error:Tg(e),loading:!1}))}}function*uS(e){let{payload:{callback:t}}=e,n=to(e.payload,Xg);yield xo(ji.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Bo(rp.auth.saveMfaPolicy,n);yield xo(ji.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield xo(ji.setSecurityPolicyMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*dS(){yield xo(ji.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getLockoutPolicy);yield xo(ji.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyLockoutState({error:Tg(e),loading:!1}))}}function*yS(e){let{payload:{callback:t}}=e,n=to(e.payload,Qg);yield xo(ji.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Bo(rp.auth.saveLockoutPolicy,n);yield xo(ji.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield xo(ji.setSecurityPolicyLockoutState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*fS(){yield xo(ji.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getVendorLockoutPolicy);yield xo(ji.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyVendorLockoutState({error:Tg(e),loading:!1}))}}function*pS(){yield xo(ji.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getCaptchaPolicy);yield xo(ji.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyCaptchaState({error:Tg(e),loading:!1}))}}function*gS(){yield xo(ji.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getPasswordHistoryPolicy);yield xo(ji.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyPasswordHistoryState({error:Tg(e),loading:!1}))}}function*SS(){yield xo(ji.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getVendorPasswordHistoryPolicy);yield xo(ji.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyVendorPasswordHistoryState({error:Tg(e),loading:!1}))}}function*vS(e){let{payload:{callback:t}}=e,n=to(e.payload,Zg);yield xo(ji.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Bo(rp.auth.savePasswordHistoryPolicy,n);yield xo(ji.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield xo(ji.setSecurityPolicyPasswordHistoryState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*hS(){yield xo(ji.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getPasswordConfigPolicy);yield xo(ji.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyPasswordState({error:Tg(e),loading:!1}))}}function*mS(){yield xa(ji.loadSecurityPolicy,iS),yield Ga(ji.saveSecurityPolicyMfa,Dg(uS)),yield Ga(ji.loadSecurityPolicyMfa,lS),yield Ga(ji.loadSecurityPolicyVendorMfa,cS),yield Ga(ji.saveSecurityPolicyLockout,Dg(yS)),yield Ga(ji.loadSecurityPolicyLockout,dS),yield Ga(ji.loadSecurityPolicyVendorLockout,fS),yield Ga(ji.loadSecurityPolicyCaptcha,pS),yield Ga(ji.saveSecurityPolicyPasswordHistory,Dg(vS)),yield Ga(ji.loadSecurityPolicyPasswordHistory,gS),yield Ga(ji.loadSecurityPolicyVendorPasswordHistory,SS),yield Ga(ji.loadVendorPasswordConfig,hS),yield Ga(ji.loadPublicSecurityPolicy,aS),yield Ga(ji.loadPublicAuthStrategiesPolicy,sS)}function*AS(){yield xo(ji.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield xo(ji.setSecurityPolicyPublicState({policy:Np,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyPublicState({error:Tg(e),loading:!1}))}}function*bS(){yield xo(ji.setSecurityPolicyGlobalState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyGlobalState({policy:Dp,loading:!1})),yield xo(ji.loadSecurityPolicyMfa()),yield xo(ji.loadSecurityPolicyVendorMfa()),yield xo(ji.loadSecurityPolicyLockout()),yield xo(ji.loadSecurityPolicyVendorLockout()),yield xo(ji.loadSecurityPolicyPasswordHistory()),yield xo(ji.loadSecurityPolicyVendorPasswordHistory()),yield xo(ji.loadSecurityPolicyCaptcha())}function*TS(){yield xo(ji.setSecurityPolicyMfaState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyMfaState({policy:Mp,loading:!1}))}function*ES(){yield xo(ji.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyVendorMfaState({policy:Mp,loading:!1}))}function*kS(e){var t;let{payload:{callback:n}}=e,i=to(e.payload,eS);yield xo(ji.setSecurityPolicyMfaState({saving:!0,error:null}));const o=D({},Fp,{id:null!=(t=i.id)?t:Fp.id,enforceMFAType:i.enforceMFAType});yield Et(),yield xo(ji.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*IS(){yield xo(ji.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyLockoutState({policy:Fp,loading:!1}))}function*OS(){yield xo(ji.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyVendorLockoutState({policy:Fp,loading:!1}))}function*PS(e){let{payload:{callback:t}}=e,n=to(e.payload,tS);yield xo(ji.setSecurityPolicyLockoutState({saving:!0,error:null})),yield Et();const i=D({},Fp,n,{id:n.id?n.id:Fp.id});null==t||t(i),yield xo(ji.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*_S(){yield xo(ji.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyLockoutState({policy:Fp,loading:!1}))}function*LS(){yield xo(ji.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyPasswordHistoryState({policy:Gp,loading:!1}))}function*wS(){yield xo(ji.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyVendorPasswordHistoryState({policy:Gp,loading:!1}))}function*US(e){let{payload:{callback:t}}=e,n=to(e.payload,nS);yield xo(ji.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield Et();const i=D({},Gp,n,{id:n.id?n.id:Gp.id});null==t||t(i),yield xo(ji.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*CS(){yield xa(ji.loadSecurityPolicy,bS),yield Ga(ji.loadPublicSecurityPolicy,AS),yield Ga(ji.saveSecurityPolicyMfa,kS),yield Ga(ji.loadSecurityPolicyMfa,TS),yield Ga(ji.loadSecurityPolicyVendorMfa,ES),yield Ga(ji.saveSecurityPolicyLockout,PS),yield Ga(ji.loadSecurityPolicyLockout,IS),yield Ga(ji.loadSecurityPolicyVendorLockout,OS),yield Ga(ji.loadSecurityPolicyCaptcha,_S),yield Ga(ji.saveSecurityPolicyPasswordHistory,US),yield Ga(ji.loadSecurityPolicyPasswordHistory,LS),yield Ga(ji.loadSecurityPolicyVendorPasswordHistory,wS)}const RS=["phoneNumber"],DS=["events","url"];function*NS(){yield xo(ji.setSignUpState({loading:!0}));try{const e=yield Bo(rp.auth.getVendorConfig),t=yield oS(e),{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield xo(ji.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield xo(ji.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield xo(ji.setSignUpState({loading:!1,error:Tg(e),firstLoad:!1}))}}function*MS(e){let{payload:{events:t,url:n}}=e,i=to(e.payload,DS);yield xo(ji.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:r}=yield Ko((e=>e.auth)),{shouldActivate:s,user:l,tenantId:c,userId:u,tenants:d=[],activeTenant:y}=yield Bo(rp.auth.signUpUser,(a=i,to(a,RS)));if(!i.invitationToken){var o;const{email:e,name:a,companyName:r,phoneNumber:s}=i,l={email:e,name:a,companyName:r,url:n,phoneNumber:s||void 0,authenticationType:yg.PASSWORD,id:u,tenantId:c,createdAt:new Date};null==t||null==(o=t.signUpComplete)||o.call(t,l),kg(Eg.SIGNUP_COMPLETED,l)}if(!s&&l&&hg(l)){const t=yield bg(l);yield xo(ji.setState(t)),r(e.loginUrl)}else{const{tenantsState:e}=yield Ko((e=>e.auth));yield xo(ji.setSignUpState({loading:!1,shouldActivate:s,stage:An.SignUpSuccess})),yield xo(ji.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:D({},e,{tenants:d,activeTenant:y})}))}}catch(e){Va.setAccessToken(null),Va.setUser(null),yield xo(ji.setSignUpState({loading:!1,error:Tg(e)}))}var a;yield xo(ji.setSignUpState({loading:!1}))}function*FS(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Ko((e=>e.auth.signUpState));yield xo(ji.resetSignUpState()),yield xo(ji.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*GS(){yield xa(ji.signUpUser,MS),yield xa(ji.resetSignUpStateSoft,FS)}const $S={setVendorState:(e,{payload:t})=>D({},e,t)},xS={loadVendorPublicInfo:yt("vendor/loadVendorPublicInfo")},VS={loading:!1},{reducer:jS,actions:BS}=pt({name:Ft,initialState:VS,reducers:D({},$S)}),WS=D({},BS,xS);function*zS(){yield xo(WS.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield rp.vendor.getVendorPublicInfo();yield xo(WS.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield xo(WS.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var KS=n(378),HS=n.n(KS);function qS(e,t){return HS()(e,t)}function*JS({payload:e}){const t=null==e?void 0:e.callback,[n]=yield Bo(Pp,[Vr]);try{const e=yield Bo(n?rp.entitlements.loadEntitlementsV2:rp.entitlements.loadEntitlements);yield function*(e){qS(yield Ko((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield xo(ji.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*YS(){yield xa(ji.loadEntitlements,JS)}var XS=new class{constructor(){this.loginWithSSO=e=>{if(this.isWebkitAvailable()){var t,n,i;null==(t=window.webkit)||null==(n=t.messageHandlers)||null==(i=n.FronteggNativeBridge)||i.postMessage(JSON.stringify({action:"loginWithSSO",payload:e}))}else{if(!this.isJsInterfaceAvailable())throw new Error("FronteggNativeBridge is not available");var o;null==(o=window.FronteggNativeBridge)||o.loginWithSSO(e)}},this.loginWithSocialLogin=e=>{if(this.isWebkitAvailable()){var t,n,i;null==(t=window.webkit)||null==(n=t.messageHandlers)||null==(i=n.FronteggNativeBridge)||i.postMessage(JSON.stringify({action:"loginWithSocialLogin",payload:e}))}else{if(!this.isJsInterfaceAvailable())throw new Error("FronteggNativeBridge is not available");var o;null==(o=window.FronteggNativeBridge)||o.loginWithSocialLogin(e)}}}isWebkitAvailable(){var e,t;return null!=(null==(e=window.webkit)||null==(t=e.messageHandlers)?void 0:t.FronteggNativeBridge)}isJsInterfaceAvailable(){return null!=window.FronteggNativeBridge}isAvailable(e){var t,n;return!(!this.isWebkitAvailable()&&!this.isJsInterfaceAvailable())&&null!=(t=null==(n=window.FronteggNativeBridgeFunctions)?void 0:n[e])&&t}};function*QS(){const{publicAuthStrategyPolicy:e}=yield Ko((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===Vs.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield Bo(Pp,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield Bo(rp.auth.getWebAuthnDevices);return yield xo(ji.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*ZS({user:e,tenants:t=[],activeTenant:n},i={}){const{tenantsState:o}=yield Ko((e=>e.auth));yield xo(ji.setState(D({user:e,tenantsState:D({},o,{tenants:t,activeTenant:n,loading:!1})},i)))}const ev="http://schemas.openid.net/pape/policies/2007/06/multi-factor",tv=["otp","sms","hwk"],nv="SHOULD_STEP_UP",iv=(e,{maxAge:t}={})=>{if(!e)return!1;const{amr:n=[],acr:i="",auth_time:o}=e;if(t&&o&&!(Date.now()/1e3-o<=t))return!1;const a=i===ev,r=-1!==n.indexOf("mfa"),s=void 0!==tv.find((e=>n.indexOf(e)));return a&&r&&s};function ov(){const e=window.location.pathname+window.location.search;window.localStorage.setItem(Ct,e)}function*av(e){const{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield Ko((e=>e.auth));if(e)return(e=>{const{pathname:t}=new URL(e),n=gg(e);return n?t+n:t})(e);const{authenticatedUrl:a,loginUrl:r,logoutUrl:s,socialLoginCallbackUrl:l,activateUrl:c}=t;let u=window.localStorage.getItem(Ct);u&&![r,s,l,c].includes(u)||(u=a);const d=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:i})=>{let o=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&pg(a)?((e,t)=>{const n=new URL(window.location.href),i=new URL(e),o=i.origin===n.origin;return t.includes(i.origin)||o})(a,n)?o=a:console.warn("The redirect url param is not valid, the origin is a different site"):o=a:i&&(o+=window.location.search),o})({authenticatedUrl:u,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});return(y=d).startsWith(null==(f=window)?void 0:f.location.origin)?y.replace(null==(p=window)?void 0:p.location.origin,""):y;var y,f,p}function*rv(e,{customLoginAuthenticatedUrl:t,forceStepUpUrl:n,shouldStepUpDuringLogin:i}={}){const o=Va.onRedirectTo;let a;if(n)a=n;else{var r;if(i){const e=window.localStorage.getItem(Ct);e&&!pg(e)&&(a=e)}a||(a=yield Bo(av,t)),null==(r=window)||r.localStorage.removeItem(Ct)}yield Ho(200),xo(e()),o(a,{refresh:a.startsWith("http")})}function*sv(){var e;const{routes:{customLoginAuthenticatedUrl:t,stepUpUrl:n}}=yield Ko((e=>e.auth)),i=null==(e=window)?void 0:e.localStorage.getItem(nv),o=yield Ko((({auth:e})=>e.user));var a;if(i&&(null==(a=window)||a.localStorage.removeItem(nv)),n&&i&&!iv(o))return void(yield Bo(rv,ji.resetLoginState,{forceStepUpUrl:n}));let r=t;t||(yield Bo(wg),r=yield Ko((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl}))),yield Bo(rv,ji.resetLoginState,{customLoginAuthenticatedUrl:r,shouldStepUpDuringLogin:!!i})}function*lv(){yield Bo(rv,ji.resetStepUpState)}const cv=["callback"];function*uv(e,t,n){const{loginState:i}=yield Ko((e=>e.auth));let o={};if(!n){const t=i.flow===Lt.Login?_t.success:i.step;o={loginState:{flow:i.flow,quickLoginToRegister:i.quickLoginToRegister,loading:!1,step:t,error:void 0,tenants:e}}}return D({},o,{isAuthenticated:t})}function*dv(e,t){const{loginState:n}=yield Ko((e=>e.auth));if(n.flow!==Lt.Login)return;const[i]=yield Bo(Pp,["security-center-show-login-flows"]);i&&n.isBreachedPassword&&!e?yield xo(ji.setLoginState({step:_t.breachedPassword,loading:!1})):(yield Bo(QS))?yield xo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})):yield sv(),null==t||t(!0)}function*yv(e){yield lv(),null==e||e(!0)}function*fv(e,t,n){let{callback:i}=e,o=to(e,cv);yield xo(t({loading:!0,error:void 0}));try{const{user:e,tenants:a=[],activeTenant:r}=yield Bo(rp.auth.loginWithMfaV2,o),s=!!e.accessToken,l=yield Bo(uv,a,s,n);if(yield Bo(ZS,{user:e,tenants:a,activeTenant:r},l),e.id&&localStorage.setItem("userId",e.id),yield xo(t({loading:!1,error:void 0})),n)return void(yield Bo(yv,i));yield Bo(dv,s,i)}catch(e){yield xo(t({loading:!1,error:Tg(e)})),null==i||i(!1,e)}}function*pv({payload:e}){yield fv(e,ji.setLoginState,!1)}function*gv(){yield Bo(lv)}function*Sv(e){const{loginState:t}=yield Ko((e=>e.auth)),{step:n}=yield Ko((e=>e.auth.mfaState)),[i]=yield Bo(Pp,["security-center-show-login-flows"]);if(t.flow===Lt.Login)if(i&&t.isBreachedPassword&&!e)yield xo(ji.setLoginState({step:_t.breachedPassword,loading:!1}));else{const e=yield Bo(QS);n===un.smsVerifyCode&&e?yield xo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})):yield sv()}}function*vv({user:e,tenants:t,activeTenant:n},i=!1){yield xo(ji.setUser(e)),yield xo(ji.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const o=!!e.accessToken;yield xo(ji.setState({isAuthenticated:o})),i?yield Bo(gv):yield Bo(Sv,o)}const hv=["callback","deviceId"],mv=["callback","deviceId"];function*Av(e,t){let{callback:n,deviceId:i}=e,o=to(e,hv);yield xo(t({loading:!1,error:void 0}));try{const e=yield Bo(rp.auth.preVerifyMFASMSForLogin,i,o);yield xo(ji.setMfaState({otcToken:e.otcToken,step:un.smsVerifyCode,phoneNumber:e.phoneNumber})),yield xo(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield xo(t({loading:!1,error:Tg(e)})),null==n||n(null)}}function*bv(e,t,n=!1){let{callback:i,deviceId:o}=e,a=to(e,mv);yield xo(t({loading:!0}));try{const e=yield Bo(rp.auth.verifyMFASMSForLoginV2,o,a);yield vv(e,n),yield xo(t({loading:!1,error:void 0})),null==i||i(!0)}catch(e){yield xo(t({loading:!1,error:Tg(e)})),null==i||i(null)}}function*Tv({payload:e}){yield Av(e,ji.setLoginState)}function*Ev({payload:e}){yield bv(e,ji.setLoginState,!1)}const kv=["callback","deviceId"],Iv=["callback","deviceId"];function*Ov(e,t){let{callback:n,deviceId:i}=e,o=to(e,kv);yield xo(t({loading:!0}));try{var a;const e=yield Bo(rp.auth.preVerifyMFAWebAuthnForLogin,i,o),r=D({},e.options,{challenge:Ot(e.options.challenge),allowCredentials:null==(a=e.options.allowCredentials)?void 0:a.map((e=>D({},e,{id:Ot(e.id)})))});yield xo(t({loading:!1,error:void 0})),null==n||n({options:r,webauthnToken:e.webauthnToken})}catch(e){yield xo(t({loading:!1,error:Tg(e)})),null==n||n(null)}}function*Pv(e,t,n){let{callback:i,deviceId:o}=e,a=to(e,Iv);yield xo(t({loading:!0}));try{const e=Pt(a.publicKey),r=yield Bo(rp.auth.verifyMFAWebAuthnForLoginV2,o,D({},a,{options:e}));yield vv(r,n),yield xo(t({loading:!1,error:void 0})),null==i||i(!0)}catch(e){yield xo(t({loading:!1,error:Tg(e)})),null==i||i(null)}}function*_v({payload:e}){yield Ov(e,ji.setLoginState)}function*Lv({payload:e}){yield Pv(e,ji.setLoginState,!1)}const wv=["callback"],Uv=["callback"];function*Cv(e,t){let{callback:n}=e,i=to(e,wv);yield xo(t({loading:!0,error:void 0}));try{const e=yield Bo(rp.auth.preVerifyMFAEmailCode,i);yield xo(ji.setMfaState({otcToken:e.otcToken,step:un.emailVerifyCode})),yield xo(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield xo(t({error:Tg(e)})),null==n||n(null)}}function*Rv(e,t){let{callback:n}=e,i=to(e,Uv);yield xo(t({loading:!0}));try{const e=yield Bo(rp.auth.verifyMFAEmailCodeV2,i);yield vv(e),yield xo(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield xo(t({loading:!1,error:Tg(e)})),null==n||n(null)}}function*Dv({payload:e}){yield Cv(e,ji.setLoginState)}function*Nv({payload:e}){yield Rv(e,ji.setLoginState)}const Mv=["callback"],Fv=["callback"],Gv=["callback"],$v=["callback"],xv=["callback","events"],Vv=["callback"],jv=["callback"],Bv=["callback"],Wv=["callback"],zv=["user"],Kv=["callback"],Hv=["callback"],qv=["callback"],Jv=["callback"],Yv=["callback"];function*Xv(e){const t=yield Ko((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return qS(t,null==e?void 0:e.entitlements)?D({},e,{entitlements:t}):e}function*Qv(){let e;try{var t;const n=yield Bo(rp.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield xo(ji.setState({ssoACS:e}))}function*Zv(){try{const{isActive:e}=yield Bo(rp.auth.getSSOPublicConfiguration);yield xo(ji.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*eh(e){var t;const{routes:n,loginState:i}=yield Ko((e=>e.auth)),o=null!=(t=localStorage.getItem("register-quick-login"))?t:i.quickLoginToRegister;return o&&"true"!==localStorage.getItem(`${e.id}-${o}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*th(){const{hostedLoginBox:e}=yield Ko((e=>e.auth));e?yield Bo(nh):yield Bo(oh)}function*nh(){const{user:e}=yield Ko((e=>e.auth));if(null==e||!e.refreshToken)return Va.setAccessToken(null),Va.setUser(null),void(yield xo(ji.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Bo(rp.auth.exchangeOAuthTokensV2,t),i=yield Bo(Xv,n.user);yield Bo(ZS,D({},n,{user:i}),{isAuthenticated:!0})}catch(e){Va.setAccessToken(null),Va.setUser(null),yield xo(ji.setState({user:null,isAuthenticated:!1}))}}function*ih(){const{user:e}=yield Ko((e=>e.auth));if(null==e||!e.refreshToken)return Va.setAccessToken(null),Va.setUser(null),void(yield xo(ji.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Bo(rp.auth.exchangeOAuthTokensV2,t),i=yield Bo(Xv,n.user);yield Bo(ZS,D({},n,{user:i}),{isAuthenticated:!0})}catch(e){Va.setAccessToken(null),Va.setUser(null),yield xo(ji.setState({user:null,isAuthenticated:!1}))}}function*oh(){try{const t=Va.onRedirectTo,{routes:n,loginState:i}=yield Ko((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield Bo(rp.auth.refreshTokenV3);if(hg(o)){const e=yield bg(o);yield xo(ji.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield eh(o),s=yield Bo(Xv,o);yield Bo(ZS,{user:s,tenants:a,activeTenant:r},{loginState:D({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield rh(n)}}catch(e){Va.setAccessToken(null),Va.setUser(null),yield xo(ji.setState({user:void 0,isAuthenticated:!1}))}}function*ah(){try{const t=Va.onRedirectTo,{routes:n,loginState:i}=yield Ko((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield Bo(rp.auth.refreshTokenV3);if(hg(o)){const e=yield bg(o);yield xo(ji.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const s=yield Bo(Xv,o);if(yield Bo(QS))yield xo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})),yield Bo(ZS,{user:s,tenants:a,activeTenant:r},{isLoading:!1}),t(n.loginUrl,{preserveQueryParams:!0});else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield eh(o);yield Bo(ZS,{user:s,tenants:a,activeTenant:r},{loginState:D({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield rh(n)}}}catch(e){Va.setAccessToken(null),Va.setUser(null),yield xo(ji.setState({user:void 0,isAuthenticated:!1}))}}function*rh(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=Va.onRedirectTo,{routes:o,loginState:a}=yield Ko((e=>e.auth)),r=n.searchParams.get("invitationToken"),s=[o.socialLoginCallbackUrl,o.oidcRedirectUrl,o.samlCallbackUrl];r||s.push(o.loginUrl,o.signUpUrl),e?i(o.loginUrl):s.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&o.signUpSuccessUrl&&o.socialLoginCallbackUrl===window.location.pathname?i(o.signUpSuccessUrl,{refresh:o.signUpSuccessUrl.startsWith("http")}):yield sv())}function*sh({payload:{callback:e}}){try{const{ip:t}=yield Bo(rp.metadata.getCurrentUserIpMetadata);yield xo(ji.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*lh({payload:e}){const t=[],n=[];t.push(Bo(th)),e&&(yield xo(ji.setState({isLoading:!0})),yield xo(ji.loadSocialLoginsConfigurationV2()),t.push(Bo(NS)),t.push(Bo(sS)),t.push(Bo(Zv)),t.push(Bo(zS)),t.push(Bo(Qv)),n.push(Bo(wg))),yield Vo(t),n.length>0&&(yield Vo(n)),yield xo(ji.setState({isLoading:!1}))}function*ch({accessToken:e,user:t}){if(!e)return void(yield xo(ji.setState({user:void 0,isAuthenticated:!1})));const n=Va.onRedirectTo,{routes:i}=yield Ko((e=>e.auth));if(hg(t)){const e=yield bg(t);yield xo(ji.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*uh({payload:e}){const t=[];yield xo(ji.loadSocialLoginsConfigurationV2()),t.push(Bo(NS)),t.push(Bo(Zv)),t.push(Bo(zS)),t.push(Bo(Qv)),t.push(Bo(ch,e)),t.push(Bo(wg)),yield Vo(t)}const dh=e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}};function*yh(){const e=yield Bo(rp.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield Bo(ZS,e,{isAuthenticated:!0,isLoading:!1})}function*fh({payload:e}){const{disableSilentRefresh:t}=yield Ko((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if("login"!==(null==e?void 0:e.prompt))try{if(t)throw new Error("silent refresh is disabled");yield yh()}catch(t){yield gh(e)}else yield gh(e)}function*ph({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n,loginDirectAction:i}}){var o;if(n){const{urlStrategy:e}=yield Ko((e=>({urlStrategy:e.root.urlStrategy}))),t=dh(e);if(yield xo(ji.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:a}=yield Ko((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if(i&&((e=e||{}).login_direct_action=btoa(JSON.stringify(i))),"login"!==(null==(o=e)?void 0:o.prompt))try{if(a)throw new Error("silent refresh is disabled");yield yh()}catch(n){if(!t)return void(yield xo(ji.setState({isLoading:!1})));yield gh(e)}else yield gh(e)}function*gh(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield Ko((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(dh(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield xo(ji.setState({isLoading:!0}));const a=Ip(),r=Ip(),s=yield Bo(kp,r);localStorage.setItem(Rt,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;yield Bo(wg);const c=yield Ko((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));c&&(l.endsWith("/")&&(l=l.slice(0,-1)),l+=c);const u=`${Lr(n,"/oauth/authorize")}/oauth/authorize`,d=D({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:l,code_challenge:s,code_challenge_method:"S256",nonce:a},e);if(n.tenantResolver){var y;const e=yield null==(y=n.tenantResolver)?void 0:y.call(n);null!=e&&e.tenant&&(d.organization=e.tenant)}const f=Sg(vg);f&&(d.tenantId=f),i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*Sh({payload:e}){const t=localStorage.getItem(Rt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield Ko((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;yield Bo(wg);const a=yield Ko((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));a&&(o.endsWith("/")&&(o=o.slice(0,-1)),o+=a);const r={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield Bo(rp.auth.exchangeOAuthTokensV2,r);yield Bo(ZS,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield xo(ji.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{const e=window.localStorage.getItem(nv);window.localStorage.removeItem(nv),e?yield lv():yield sv()}}function*vh(e){let{payload:{callback:t}}=e,n=to(e.payload,Mv);try{yield xo(ji.setLoginState({loading:!0}));const e=yield Bo(rp.auth.changePhoneNumberWithVerification,n);yield xo(ji.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:_t.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({error:Tg(e),loading:!1}))}}function*hh(e){let{payload:{callback:t}}=e,n=to(e.payload,Fv);try{yield xo(ji.setLoginState({loading:!0})),yield Bo(rp.auth.verifyChangePhoneNumber,n),yield xo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({error:Tg(e),loading:!1}))}}function*mh(e){let{payload:{callback:t}}=e,n=to(e.payload,Gv);try{yield xo(ji.setLoginState({loading:!0}));const e=yield Bo(rp.auth.passwordlessPreLogin,D({},n,{type:Ii.SmsCode}));yield xo(ji.setLoginState({step:_t.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({error:Tg(e),loading:!1})),null==t||t(e)}}function*Ah(e){let{payload:{callback:t}}=e,n=to(e.payload,$v);try{let e;yield xo(ji.setLoginState({loading:!0})),function(e){return"email"in e}(n)&&(e=n.email);const i=yield Bo(rp.auth.passwordlessPreLogin,n),o=Pi[n.type];yield xo(ji.setLoginState({step:o,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:e,error:void 0})),null==t||t()}catch(e){yield xo(ji.setLoginState({error:Tg(e),loading:!1})),null==t||t()}}function*bh(e){let{payload:{callback:t,events:n}}=e,i=to(e.payload,xv);try{yield xo(ji.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield Bo(rp.auth.passwordlessPostLoginV2,i),s=Va.onRedirectTo,{routes:l}=yield Ko((e=>e.auth));if(hg(e)){const t=yield bg(e);yield xo(ji.setState(t)),s(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield Ko((e=>e.auth));if(e.emailVerified){var o;const t={email:e.email,origin:dg.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name};null==n||null==(o=n.userVerified)||o.call(n,t),kg(Eg.USER_VERIFIED,t)}e.id&&localStorage.setItem("userId",e.id),yield Bo(ZS,{user:e,tenants:a,activeTenant:r}),yield xo(ji.setLoginState({error:void 0})),yield xo(ji.setState({isLoading:!1})),i.flow===Lt.Login?(yield Bo(QS))?(yield xo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})),s(l.loginUrl,{preserveQueryParams:!0})):(yield xo(ji.setState({isAuthenticated:!0})),yield sv()):s(l.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield xo(ji.setLoginState({error:Tg(e,"Failed to authenticate")}))}finally{yield xo(ji.setLoginState({loading:!1}))}}function*Th({payload:e}){try{yield xo(ji.setLoginState({loading:!0}));const{name:t}=yield Bo(rp.auth.verifyInviteToken,e);yield xo(ji.setLoginState({inviteTokenTenantName:t}))}catch(e){yield xo(ji.setLoginState({inviteTokenError:Tg(e,"We couldn't verify your invitation")}))}finally{yield xo(ji.setLoginState({loading:!1}))}}function*Eh({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield xo(ji.setLoginState({loading:!0}));try{const o=yield Ko((({auth:{onRedirectTo:e}})=>e)),a=Sg(vg),{address:r,idpType:s}=yield Bo(rp.auth.preLoginV2,{email:e,tenantId:a});if(r){let t=r;if(s===cp.Oidc&&!t.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield Ko((({auth:{routes:e}})=>({routes:e})));t+=`&redirect_uri=${window.location.origin}${e}`}XS.isAvailable("loginWithSSO")?(XS.loginWithSSO(e),yield xo(ji.setLoginState({loading:!1,step:_t.redirectToSSO})),null==i||i()):(yield xo(ji.setLoginState({step:_t.redirectToSSO,loading:!1,ssoRedirectUrl:t})),setTimeout((()=>{o(t,{refresh:!0})}),2e3))}else yield kh({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield kh({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*kh(e){let{callback:t}=e,n=to(e,Vv);const i=yield Ko((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield xo(ji.setLoginState({step:_t.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===Ii.EmailAndPassword?(yield xo(ji.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t()):[Ii.MagicLink,Ii.Code,Ii.SmsCode].includes(null==i?void 0:i.authStrategy)?yield xo(ji.passwordlessPreLogin(D({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield xo(ji.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t())}function*Ih({payload:{callback:e}}){try{yield xo(ji.setLoginState({loading:!0}));const{options:t}=yield Bo(rp.auth.webAuthnCreateNewDeviceSession);t.user.id=Ot(t.user.id),t.challenge=Ot(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield xo(ji.setLoginState({error:Tg(t)})),null==e||e(null)}finally{yield xo(ji.setLoginState({loading:!1}))}}function*Oh(e){let{payload:{callback:t}}=e,n=to(e.payload,jv);try{yield xo(ji.setLoginState({loading:!0}));const e=Pt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?js.Platform:js.CrossPlatform;yield Bo(rp.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({error:Tg(e)})),null==t||t(null)}finally{yield xo(ji.setLoginState({loading:!1}))}}function*Ph(e){let{payload:{callback:t}}=e,n=to(e.payload,Bv);try{var i;yield xo(ji.setPasskeysState({loading:!0})),yield xo(ji.setLoginState({loading:!0}));const{options:e}=yield Bo(rp.auth.webAuthnPreLogin,n);e.challenge=Ot(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>D({},e,{id:Ot(e.id)}))),yield xo(ji.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield xo(ji.setLoginState({error:Tg(e)})),null==t||t(null)}finally{yield xo(ji.setPasskeysState({loading:!1})),yield xo(ji.setLoginState({loading:!1}))}}function*_h(e){let{payload:{callback:t}}=e,n=to(e.payload,Wv);try{var i;yield xo(ji.setPasskeysState({loading:!0})),yield xo(ji.setLoginState({loading:!0}));const e=Pt(n.publicKey),o=yield Bo(rp.auth.webAuthnPostLoginV2,D({},e,{response:D({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken})),{user:a}=o,r=to(o,zv);if(hg(a)){const e=Va.onRedirectTo,{routes:t}=yield Ko((e=>e.auth)),n=yield bg(a);yield xo(ji.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield Bo(ZS,D({user:a},r),{isAuthenticated:!0}),yield xo(ji.setLoginState({error:void 0})),yield sv(),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({error:Tg(e)})),null==t||t(null)}finally{yield xo(ji.setPasskeysState({loading:!1})),yield xo(ji.setLoginState({loading:!1}))}}function*Lh({payload:e}){const{onRedirectTo:t,routes:n}=yield Ko((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield xo(ji.setLoginState({loading:!0}));try{const t=yield Bo(rp.auth.postLogin,e);yield xo(ji.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield sv()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield xo(ji.setLoginState({step:_t.loginWithSSOFailed,loading:!1}))}}function*wh({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield xo(ji.setLoginState({loading:!0}));try{const{user:a,tenants:r=[],activeTenant:s}=yield Bo(rp.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:i}),l=Va.onRedirectTo,{routes:c}=yield Ko((e=>e.auth));if(hg(a)){const e=yield bg(a);yield xo(ji.setState(e)),l(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Ko((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield Bo(ZS,{user:a,tenants:r,activeTenant:s},{loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===Lt.Login?_t.success:t.step,tenants:r,tenantsLoading:!0,isBreachedPassword:a.isBreachedPassword},isAuthenticated:n});const[i]=yield Bo(Pp,["security-center-show-login-flows"]);t.flow===Lt.Login&&(i&&a.isBreachedPassword&&!n?yield xo(ji.setLoginState({step:_t.breachedPassword,loading:!1})):n&&((yield Bo(QS))?(yield xo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})),l(c.loginUrl,{preserveQueryParams:!0})):yield sv()))}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){Va.setAccessToken(null),Va.setUser(null),null==o||o(!1,t),yield xo(ji.setLoginState({email:e,error:Tg(t),loading:!1}))}}function*Uh({payload:e}){yield xo(ji.setLoginState({loading:!0}));try{var t;yield Bo(rp.auth.recoverMfaToken,e),yield xo(ji.setLoginState({loading:!1,error:void 0,step:_t.preLogin})),yield xo(ji.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield xo(ji.setLoginState({error:Tg(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Ch({payload:e}){const{hostedLoginBox:t}=yield Ko((e=>e.auth));yield xo(ji.setState({isLoading:!0}));try{t?yield Bo(rp.auth.OAuthLogout):yield Bo(rp.auth.logout)}catch{}yield xo(ji.resetState()),yield xo(ji.requestAuthorize(!0)),null==e||e()}function*Rh({payload:e}){var t;try{yield Bo(rp.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*Dh({user:e,tenants:t,activeTenant:n}){const i={step:un.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield xo(ji.setMfaState(i)),yield xo(ji.setUser(e)),yield xo(ji.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Nh(e){let{payload:{callback:t}}=e,n=to(e.payload,Kv);yield xo(ji.setLoginState({loading:!0}));try{const e=yield Bo(rp.auth.preEnrollMFASMSForLogin,n);yield xo(ji.setMfaState({otcToken:e.otcToken,step:un.smsVerifyCode,phoneNumber:e.phoneNumber})),yield xo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Mh(e){let{payload:{callback:t}}=e,n=to(e.payload,Hv);yield xo(ji.setLoginState({loading:!0}));try{const e=yield Bo(rp.auth.enrollMFASMSForLoginV2,n);yield Dh(e),yield xo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Fh(e){let{payload:{callback:t}}=e,n=to(e.payload,qv);yield xo(ji.setLoginState({loading:!0}));try{var i;const e=yield Bo(rp.auth.preEnrollMFAWebAuthnForLogin,n),o=D({},e.options,{challenge:Ot(e.options.challenge),user:D({},e.options.user,{id:Ot(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>D({},e,{id:Ot(e.id)})))});yield xo(ji.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield xo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Gh(e){let{payload:{callback:t}}=e,n=to(e.payload,Jv);yield xo(ji.setLoginState({loading:!0}));try{const e=Pt(n.publicKey),i=yield Bo(rp.auth.enrollMFAWebAuthnForLoginV2,D({},n,{options:e}));yield Dh(i),yield xo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*$h(e){let{payload:{callback:t}}=e,n=to(e.payload,Yv);yield xo(ji.setLoginState({loading:!0}));try{const e=yield Bo(rp.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield Dh(e),yield xo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*xh({payload:e}){yield xo(ji.setLoginState({loading:!0}));try{yield Bo(rp.auth.forgotPassword,e),yield xo(ji.setLoginState({loading:!1,error:void 0,step:_t.breachedPasswordSuccess})),yield xo(ji.setState({isAuthenticated:!1}))}catch(e){yield xo(ji.setLoginState({loading:!1,error:Tg(e)}))}}function*Vh(){yield xa(ji.requestAuthorize,lh),yield xa(ji.requestAuthorizeSSR,uh),yield xa(ji.requestHostedLoginAuthorize,fh),yield xa(ji.requestHostedLoginAuthorizeV2,ph),yield xa(ji.handleHostedLoginCallback,Sh),yield xa(ji.preLogin,Eh),yield xa(ji.postLogin,Lh),yield xa(ji.login,wh),yield xa(ji.logout,Ch),yield xa(ji.silentLogout,Rh),yield xa(ji.loginWithMfa,pv),yield xa(ji.recoverMfa,Uh),yield xa(ji.quickSmsPasswordlessPreLogin,mh),yield xa(ji.changePhoneNumberWithVerification,vh),yield xa(ji.verifyChangePhoneNumber,hh),yield xa(ji.passwordlessPreLogin,Ah),yield xa(ji.passwordlessPostLogin,bh),yield xa(ji.verifyInviteToken,Th),yield xa(ji.webAuthnPrelogin,Ph),yield xa(ji.webAuthnPostLogin,_h),yield xa(ji.webAuthnCreateNewDeviceSession,Ih),yield xa(ji.webAuthnVerifyNewDeviceSession,Oh),yield xa(ji.afterAuthNavigation,sv),yield xa(ji.getUserIP,sh),yield xa(ji.preEnrollMFASMSForLogin,Nh),yield xa(ji.enrollMFASMSForLogin,Mh),yield xa(ji.preEnrollMFAWebAuthnForLogin,Fh),yield xa(ji.enrollMFAWebAuthnForLogin,Gh),yield xa(ji.enrollMFAAuthenticatorAppForLogin,$h),yield xa(ji.preVerifyMFASMSForLogin,Tv),yield xa(ji.verifyMFASMSForLogin,Ev),yield xa(ji.preVerifyMFAWebAuthnForLogin,_v),yield xa(ji.verifyMFAWebAuthnForLogin,Lv),yield xa(ji.preVerifyMFAEmailCode,Dv),yield xa(ji.verifyMFAEmailCode,Nv),yield xa(ji.resetBreachedPassword,xh)}function*jh({payload:e}){e&&(yield xo(ji.setState({isLoading:!0})));const t=Cp;yield xo(ji.loadTenants()),yield xo(ji.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Bh({payload:{callback:e}}){try{const{ip:t}=ng[0];yield xo(ji.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Wh(){yield xa(ji.requestAuthorize,jh),yield xa(ji.afterAuthNavigation,sv),yield xa(ji.getUserIP,Bh)}const zh=["callback","samlVendor"],Kh=["callback","samlVendor"];function*Hh(){try{var e,t;yield xo(ji.setSSOState({loading:!0}));const n=yield Bo(rp.auth.getSamlConfiguration),i=yield Bo(rp.auth.getOidcConfiguration),o=yield Bo(rp.metadata.getSamlMetadata);n.acsUrl=null==o||null==(e=o.configuration)?void 0:e.acsUrl,n.spEntityId=null==o||null==(t=o.configuration)?void 0:t.spEntityId,n.isSamlActive=null==o?void 0:o.isActive,yield xo(ji.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield xo(ji.setSSOState({error:Tg(e),loading:!1}))}}function*qh({payload:e}){const t=yield Ko((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield xo(ji.setSSOState({error:void 0,[n]:!0}));try{const i=yield Op(e[0]),o=yield Bo(rp.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield xo(ji.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield xo(ji.setSSOState({samlConfiguration:t,error:Tg(e),[n]:!1}))}}function*Jh({payload:e}){const{configFile:t,callback:n}=e,i=yield Ko((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield xo(ji.setSSOState({error:void 0,[o]:!0}));try{const e=yield Op(t),a=yield Bo(rp.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield xo(ji.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield xo(ji.setSSOState({samlConfiguration:i,error:Tg(e),[o]:!1})),null==n||n(null,e)}}function*Yh({payload:e}){const{callback:t,samlVendor:n}=e,i=to(e,zh),o=yield Ko((e=>e.auth.ssoState.samlConfiguration)),a=D({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield xo(ji.setSSOState({samlConfiguration:D({},o,a)})));if(yield xo(ji.setSSOState({error:void 0,[r]:!0})),e.type===cp.Saml){var s,l;const e=yield Bo(rp.metadata.getSamlMetadata);a.acsUrl=null==e||null==(s=e.configuration)?void 0:s.acsUrl,a.spEntityId=null==e||null==(l=e.configuration)?void 0:l.spEntityId}const i=Ep(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==o?void 0:o.domain)!==(null==i?void 0:i.domain)&&(i.ssoEndpoint="",i.publicCertificate="",i.signRequest=!1),i.type=null==n?void 0:n.toLowerCase();const c=yield Bo(rp.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield xo(ji.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield xo(ji.setSSOState({samlConfiguration:o,error:Tg(e),[r]:!1})),null==t||t(null,e)}}function*Xh({payload:{callback:e}={}}){const t=yield Ko((e=>e.auth.ssoState.samlConfiguration));try{yield xo(ji.setSSOState({error:void 0,saving:!0})),yield Bo(rp.auth.validateSamlDomain),yield xo(ji.setSSOState({samlConfiguration:D({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield xo(ji.setSSOState({samlConfiguration:D({},t,{validated:!1}),error:Tg(n),saving:!1})),null==e||e(null,n)}}function*Qh(){try{const e=yield Bo(rp.auth.getSamlRoles),t=yield Bo(rp.auth.getSamlRolesGroups);yield xo(ji.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield xo(ji.setSSOState({error:Tg(e)}))}}function*Zh({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield xo(ji.setSSOState({error:void 0,saving:!0})),yield Bo(rp.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Vo(e.map((e=>Bo(rp.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield xo(ji.setSSOState({error:Tg(e)}))}}(n)),yield Qh(),yield xo(ji.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield xo(ji.setSSOState({error:Tg(t),saving:!1})),null==e||e(null,t)}}function*em({payload:{callback:e,id:t}}){try{yield xo(ji.setSSOState({error:void 0,saving:!0})),yield Bo(rp.auth.deleteSamlGroup,{id:t}),yield Qh(),yield xo(ji.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield xo(ji.setSSOState({error:Tg(t),saving:!1})),null==e||e(null,t)}}function*tm({payload:{group:e,roleIds:t,callback:n}}){try{yield xo(ji.setSSOState({error:void 0,saving:!0})),yield Bo(rp.auth.createSamlGroup,{group:e,roleIds:t}),yield Qh(),yield xo(ji.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield xo(ji.setSSOState({error:Tg(e),saving:!1})),null==n||n(null,e)}}function*nm({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield xo(ji.setSSOState({loading:!0})),yield Bo(rp.auth.oidcPostLoginV2,t),yield Bo(th),yield xo(ji.setSSOState({loading:!1}))}catch(e){yield xo(ji.setSSOState({loading:!1,error:Tg(e,"Failed to authenticate"),firstLoad:!1}))}}function*im(){yield Ga(ji.loadSSOConfigurations,Hh),yield Ga(ji.saveSSOConfigurations,Yh),yield Ga(ji.saveSSOConfigurationsFile,qh),yield Ga(ji.saveSSOConfigurationsFileWithCallback,Jh),yield Ga(ji.validateSSODomain,Xh),yield Ga(ji.loadSSOAuthorizationRoles,Qh),yield Ga(ji.updateSSOAuthorizationRoles,Zh),yield Ga(ji.deleteSamlGroup,em),yield Ga(ji.createSamlGroup,tm),yield Ga(ji.oidcPostlogin,nm)}function*om(){yield xo(ji.setSSOState({loading:!0})),yield Et(),yield xo(ji.setSSOState({samlConfiguration:$p,loading:!1,firstLoad:!1}))}function*am({payload:e}){const t="saving";yield xo(ji.setSSOState({error:void 0,[t]:!0}));const n=D({},yield Ko((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield xo(ji.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*rm({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=to(e,Kh),r=jp.samlConfiguration,s=D({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield xo(ji.setSSOState({samlConfiguration:D({},r,s)})));yield xo(ji.setSSOState({error:void 0,[l]:!0})),yield Et(),s.acsUrl=null==xp||null==(t=xp.configuration)?void 0:t.acsUrl,s.spEntityId=null==xp||null==(n=xp.configuration)?void 0:n.spEntityId;const c=Ep(s,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==o?void 0:o.toLowerCase(),yield Et(),yield xo(ji.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*sm({payload:{callback:e}={}}){const t=jp.samlConfiguration;yield xo(ji.setSSOState({error:void 0,saving:!0})),yield Et(),yield xo(ji.setSSOState({samlConfiguration:D({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*lm(){yield Et(),yield xo(ji.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*cm({payload:{callback:e,authorizationRoles:t}}){yield xo(ji.setSSOState({error:void 0,saving:!0})),yield Et(),yield xo(ji.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*um(){yield Ga(ji.loadSSOConfigurations,om),yield Ga(ji.saveSSOConfigurations,rm),yield Ga(ji.saveSSOConfigurationsFile,am),yield Ga(ji.validateSSODomain,sm),yield Ga(ji.loadSSOAuthorizationRoles,lm),yield Ga(ji.updateSSOAuthorizationRoles,cm)}const dm=["callback"],ym=["callback","ssoConfigId"],fm=["callback","ssoConfigId"],pm=["callback","ssoConfigId"];function*gm(){try{return yield Bo(rp.auth.getOidcConfiguration)}catch(e){return null}}function*Sm(){try{return yield Bo(rp.metadata.getSamlMetadata)}catch(e){return null}}function*vm(){try{yield xo(ji.setSSOLoader({key:lp.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Vo([Bo(gm),Bo(Sm)]),n=yield Bo(rp.auth.getSSOConfigurations);yield xo(ji.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield xo(ji.setSSOError({key:lp.LOAD_SSO_CONFIGURATIONS,value:Tg(e)}))}finally{yield xo(ji.setSSOLoader({key:lp.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*hm({payload:e}){yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=to(e,dm),i=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield Bo(rp.auth.createSSOConfiguration,D({},n,{enabled:null!=(o=n.enabled)&&o}));yield xo(ji.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield xo(ji.setSSOError({key:lp.SAVE_SSO_CONFIGURATION,value:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION,value:!1}))}}function*mm({payload:e}){yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Op(t),o=yield Bo(rp.auth.createSSOConfigurationByMetadata,{metadata:e});yield xo(ji.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield xo(ji.setSSOError({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:Tg(e)})),null==n||n(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Am({payload:e}){yield xo(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=to(e,ym),o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Bo(rp.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield xo(ji.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield xo(ji.setSSOError({key:lp.UPDATE_SSO_CONFIGURATION,value:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*bm({payload:e}){yield xo(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Op(i),a=yield Bo(rp.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield xo(ji.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield xo(ji.setSSOError({key:lp.UPDATE_SSO_CONFIGURATION,value:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Tm({payload:e}){yield xo(ji.setSSOLoader({key:lp.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield Bo(rp.auth.deleteSSOConfiguration,t),yield xo(ji.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield xo(ji.setSSOError({key:lp.DELETE_SSO_CONFIGURATION,value:Tg(e)})),null==n||n(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Em({payload:e}){const{callback:t,ssoConfigId:n}=e,i=to(e,fm);yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_DOMAIN,value:!0}));const o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Bo(rp.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?D({},t,{domains:[...t.domains,e]}):t));yield xo(ji.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield xo(ji.setSSOError({key:lp.SAVE_SSO_DOMAIN,value:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_DOMAIN,value:!1}))}}function*km({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield xo(ji.setSSOLoader({key:lp.DELETE_SSO_DOMAIN,value:!0}));const o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield Bo(rp.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?D({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield xo(ji.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield xo(ji.setSSOError({key:lp.DELETE_SSO_DOMAIN,value:Tg(e)})),null==i||i(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.DELETE_SSO_DOMAIN,value:!1}))}}function*Im({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield xo(ji.setSSOLoader({key:lp.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield Bo(rp.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?D({},e,{domains:e.domains.map((e=>e.id===n?D({},e,{validated:!0}):e))}):e));yield xo(ji.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield xo(ji.setSSOError({key:lp.VALIDATE_SSO_DOMAIN,value:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Om({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield xo(ji.setSSOLoader({key:lp.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield Bo(rp.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?D({},e,{roleIds:n}):e));yield xo(ji.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield xo(ji.setSSOError({key:lp.UPDATE_SSO_DEFAULT_ROLES,value:Tg(t)})),null==e||e(null,t)}finally{yield xo(ji.setSSOLoader({key:lp.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Pm({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_GROUPS,value:!0}));const o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield Vo(t.map((e=>Bo(rp.auth.deleteSSOGroup,n,e)))),yield Vo(e.map((e=>Bo(rp.auth.createSSOGroup,n,e))));const a=yield Bo(rp.auth.getSSOGroups,n),r=o.map((e=>e.id===n?D({},e,{groups:a}):e));yield xo(ji.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield xo(ji.setSSOError({key:lp.SAVE_SSO_GROUPS,value:Tg(e)})),null==i||i(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_GROUPS,value:!1}))}}function*_m({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Vo(t.map((t=>Bo(rp.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield xo(ji.setSSOError({key:lp.SAVE_SSO_GROUPS,value:Tg(e)})),null==n||n(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_GROUPS,value:!1}))}}function*Lm({payload:e}){yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,s;i?(r=yield Bo(rp.auth.updateSSOConfigurationByMetadataUrl,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield Bo(rp.auth.createSSOConfigurationByMetadataUrl,e),s=[r,...a]),yield xo(ji.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*wm({payload:e}){yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=to(e,pm),o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Bo(rp.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield Bo(rp.auth.createSSOConfiguration,i),a=[e,...o]),yield xo(ji.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Um(){yield Ga(ji.loadSSOConfigurationsV2,vm),yield Ga(ji.saveSSOConfigurationV2,hm),yield Ga(ji.saveSSODomain,Em),yield Ga(ji.deleteSSODomain,km),yield Ga(ji.validateSSODomainV2,Im),yield Ga(ji.updateSSOConfiguration,Am),yield Ga(ji.deleteSSOConfiguration,Tm),yield Ga(ji.setSSOGroups,Pm),yield Ga(ji.updateSSOGroups,_m),yield Ga(ji.setSSODefaultRoles,Om),yield Ga(ji.saveSSOConfigurationByMetadata,mm),yield Ga(ji.updateSSOConfigurationByMetadata,bm),yield Ga(ji.saveSSOConfigurationByUrl,Lm),yield Ga(ji.saveSSOConfigurationByData,wm)}const Cm=["callback","profilePictureUrl"],Rm=["callback","profilePictureUrl"];function*Dm(){yield xo(ji.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return Bo.apply(void 0,[Fa,e,t,n].concat(o))}(3,2e3,rp.teams.getProfile),t=yield Ko((e=>e.auth.user));ji.setUser(D({},t,e)),yield xo(ji.setProfileState({profile:e,loading:!1}))}catch(e){yield xo(ji.setProfileState({loading:!1,error:Tg(e)}))}}function*Nm(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=to(e.payload,Cm);yield xo(ji.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield Ko((e=>e.auth.profileState.profile));let o=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const i=`image/${n[1]}`,o=function(e,t){const n=atob(e),i=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),o=new Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);i.push(new Uint8Array(o))}return new Blob(i,{type:t})}(n[2],i),a=new FormData;return a.append(t,new File([o],t,{type:i})),a}(n,"image");if(e){o=yield Bo(rp.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=D({},e,i,{profilePictureUrl:o}),r=yield Bo(rp.users.updateUserProfileV2,a),s=yield Ko((e=>e.auth.user));yield xo(ji.setUser(D({},s,r))),yield xo(ji.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield xo(ji.setProfileState({saving:!1,error:Tg(e),loading:!1})),null==t||t(null,e)}}function*Mm({payload:e}){yield xo(ji.setProfileState({loading:!0}));try{var t;yield Bo(rp.teams.changePassword,e),yield xo(ji.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield xo(ji.setProfileState({loading:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Fm(){yield xa(ji.loadProfile,Dm),yield Ga(ji.saveProfile,Nm),yield Ga(ji.changePassword,Mm)}function*Gm(){yield xo(ji.setProfileState({loading:!0})),yield Et(),yield xo(ji.setUser(D({},Cp,Up))),yield xo(ji.setProfileState({loading:!1,profile:Up}))}function*$m(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=to(e.payload,Rm);yield xo(ji.setProfileState({saving:!0,error:null}));const o=Rp;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=D({},o.profile,i,{profilePictureUrl:a}),s=Cp;yield Et(),yield xo(ji.setUser(D({},s,r))),yield xo(ji.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*xm({payload:e}){var t;yield xo(ji.setProfileState({loading:!0})),yield Et(),yield xo(ji.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Vm(){yield xa(ji.loadProfile,Gm),yield Ga(ji.saveProfile,$m),yield Ga(ji.changePassword,xm)}const jm=["callback"],Bm=["callback"],Wm=["user"],zm=["callback"],Km=["deviceId","callback"],Hm=["deviceId","callback"],qm=["callback"],Jm=["deviceId"],Ym=["deviceId"],Xm=["callback"],Qm=["deviceId"],Zm=["callback"];function*eA(e){const{step:t}=yield Ko((e=>e.auth.mfaState));return{step:e.recoveryCode?un.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*tA(){yield xo(ji.setMfaState({saving:!0}));try{const{qrCode:e}=yield Bo(rp.auth.enrollMfa);yield xo(ji.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield xo(ji.setMfaState({saving:!1,error:Tg(e)}))}}function*nA(e){let{payload:{callback:t}}=e,n=to(e.payload,jm);yield xo(ji.setMfaState({saving:!0}));try{const e=yield Ko((e=>e.auth.user)),i=yield Bo(rp.auth.verifyMfa,n),o=yield Bo(rp.auth.getMFADevices),a=yield eA(i);yield xo(ji.setMfaState(D({},a,{mfaDevices:o}))),yield xo(ji.setUser(D({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*iA(e){let{payload:{callback:t}}=e,n=to(e.payload,Bm);yield xo(ji.setMfaState({loading:!0}));try{const e=yield Bo(rp.auth.loginWithMfaV2,n),{user:i}=e,o=to(e,Wm),a={step:un.recoveryCode,loading:!1,saving:!1,error:void 0};null!=i&&i.recoveryCode&&(a.recoveryCode=i.recoveryCode),yield xo(ji.setMfaState(a)),yield ZS(D({user:i},o)),null==t||t(a.recoveryCode)}catch(e){yield xo(ji.setMfaState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*oA({payload:e}){yield xo(ji.setMfaState({saving:!0}));try{var t;yield Bo(rp.auth.disableMfa,e);const n=yield Bo(rp.auth.getMFADevices);yield xo(ji.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield xo(ji.setMfaState({saving:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*aA({payload:e}){yield xo(ji.setMfaState({saving:!0}));try{var t,n;const i=yield Bo(rp.auth.preEnrollMFAWebAuthn),o=D({},i.options,{challenge:Ot(i.options.challenge),user:D({},i.options.user,{id:Ot(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>D({},e,{id:Ot(e.id)})))});yield xo(ji.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield xo(ji.setMfaState({saving:!1,error:Tg(t)})),null==(i=e.callback)||i.call(e,null,t)}}function*rA(e){let{payload:{callback:t}}=e,n=to(e.payload,zm);yield xo(ji.setMfaState({saving:!0}));try{const e=Pt(n.publicKey),i=yield Bo(rp.auth.enrollMFAWebAuthn,D({},n,{options:e})),o=yield Bo(rp.auth.getMFADevices),a=yield eA(i);yield xo(ji.setMfaState(D({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*sA(e){let{payload:{deviceId:t,callback:n}}=e;to(e.payload,Km),yield xo(ji.setMfaState({saving:!0}));try{var i;const e=yield Bo(rp.auth.preDisableMFAWebAuthn,t),o=D({},e.options,{challenge:Ot(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>D({},e,{id:Ot(e.id)})))});yield xo(ji.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==n||n(null,e)}}function*lA(e){let{payload:{deviceId:t,callback:n}}=e,i=to(e.payload,Hm);yield xo(ji.setMfaState({saving:!0}));try{const e=Pt(i.publicKey);yield Bo(rp.auth.disableMFAWebAuthn,t,D({},i,{options:e}));const o=yield Bo(rp.auth.getMFADevices);yield xo(ji.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==n||n(!1,e)}}function*cA({payload:e}){yield xo(ji.setMfaState({saving:!0}));try{var t;const n=yield Bo(rp.auth.preEnrollMFASMS,e);yield xo(ji.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 xo(ji.setMfaState({saving:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*uA(e){let{payload:{callback:t}}=e,n=to(e.payload,qm);yield xo(ji.setMfaState({saving:!0}));try{const e=yield Bo(rp.auth.enrollMFASMS,n),i=yield Bo(rp.auth.getMFADevices),o=yield eA(e);yield xo(ji.setMfaState(D({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*dA(e){let{payload:{deviceId:t}}=e,n=to(e.payload,Jm);yield xo(ji.setMfaState({saving:!0}));try{var i;const e=yield Bo(rp.auth.preDisableMFASMS,t);yield xo(ji.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*yA(e){let{payload:{deviceId:t}}=e,n=to(e.payload,Ym);yield xo(ji.setMfaState({saving:!0}));try{var i;yield Bo(rp.auth.disableMFASMS,t,n);const e=yield Bo(rp.auth.getMFADevices);yield xo(ji.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*fA(){yield xo(ji.setMfaState({loading:!0}));try{yield Ko((e=>e.auth.user));const e=yield Bo(rp.auth.getMFADevices);yield xo(ji.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield xo(ji.setMfaState({loading:!1,error:Tg(e)}))}}function*pA(){yield xo(ji.setMfaState({loading:!0}));try{const e=(yield Bo(rp.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield xo(ji.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield xo(ji.setMfaState({loading:!1,error:Tg(e)}))}}function*gA(){yield Ga(ji.enrollMfa,tA),yield Ga(ji.getMFADevices,fA),yield Ga(ji.getMFAStrategies,pA),yield Ga(ji.verifyMfa,nA),yield Ga(ji.disableMfa,oA),yield Ga(ji.verifyMfaAfterForce,iA),yield Ga(ji.preDisableMfaSms,dA),yield Ga(ji.disableMfaSms,yA),yield Ga(ji.preEnrollMfaSms,cA),yield Ga(ji.enrollMfaSms,uA),yield Ga(ji.preEnrollMfaWebAuthn,aA),yield Ga(ji.enrollMfaWebAuthn,rA),yield Ga(ji.preDisableMfaWebAuthn,sA),yield Ga(ji.disableMfaWebAuthn,lA)}function*SA(){yield xo(ji.setMfaState({saving:!0})),yield xo(ji.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*vA({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Ko((e=>e.auth.mfaState));yield xo(ji.setMfaState({saving:!0})),yield Et();const n={token:"token",recoveryCode:"recoveryCode"},i={step:un.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:D({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield xo(ji.setMfaState(i)),yield xo(ji.setUser(D({},Cp,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*hA(e){let{payload:{callback:t}}=e,n=to(e.payload,Xm);yield xo(ji.setMfaState({loading:!0})),yield Et();const i=D({},n,{recoveryCode:"recoveryCode"}),o={step:un.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield xo(ji.setMfaState(o)),yield Et(),yield xo(ji.setUser(D({},Cp,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*mA({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Ko((e=>e.auth.mfaState));yield xo(ji.setMfaState({saving:!0})),yield Et(),yield xo(ji.setMfaState({saving:!1,error:void 0,mfaDevices:D({},n,{authenticators:[]})})),yield xo(ji.setUser(D({},Cp))),null==(t=e.callback)||t.call(e,!0)}function*AA(e){let{}=e,t=to(e.payload,Qm);yield xo(ji.setMfaState({saving:!0}));try{var n;yield xo(ji.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==(i=t.callback)||i.call(t,!1,e)}}function*bA({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Ko((e=>e.auth.mfaState));yield xo(ji.setMfaState({saving:!0})),yield Et(),yield xo(ji.setMfaState({loading:!1,error:void 0,mfaDevices:D({},n,{phones:[]})})),yield xo(ji.setUser(D({},Cp))),null==(t=e.callback)||t.call(e,!0)}function*TA({payload:e}){var t;yield xo(ji.setMfaState({saving:!0})),yield Et(),yield xo(ji.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*EA(e){let{payload:{callback:t}}=e;to(e.payload,Zm);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Ko((e=>e.auth.mfaState));yield xo(ji.setMfaState({saving:!0})),yield Et();const i={token:"token",recoveryCode:"recoveryCode"},o={step:un.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:D({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield xo(ji.setMfaState(o)),yield xo(ji.setUser(D({},Cp,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*kA(){yield Ga(ji.enrollMfa,SA),yield Ga(ji.verifyMfa,vA),yield Ga(ji.disableMfa,mA),yield Ga(ji.verifyMfaAfterForce,hA),yield Ga(ji.preDisableMfaSms,AA),yield Ga(ji.disableMfaSms,bA),yield Ga(ji.preEnrollMfaSms,TA),yield Ga(ji.enrollMfaSms,EA)}const IA=["callback"];function*OA({payload:e}){yield xo(ji.setForgotPasswordState({loading:!0}));try{var t;yield Bo(rp.auth.forgotPassword,e),yield xo(ji.setForgotPasswordState({loading:!1,error:void 0,step:Jt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield xo(ji.setForgotPasswordState({loading:!1,error:Tg(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*PA(e){let{payload:{callback:t}}=e,n=to(e.payload,IA);yield xo(ji.setForgotPasswordState({loading:!0}));try{yield Bo(rp.auth.resetPassword,n),yield xo(ji.setForgotPasswordState({loading:!1,error:void 0,step:Jt.success})),null==t||t(!0)}catch(e){yield xo(ji.setForgotPasswordState({loading:!1,error:Tg(e)})),null==t||t(!1,e)}}function*_A({payload:e}){yield xo(ji.setForgotPasswordState({loading:!0}));try{const t=yield Bo(rp.auth.loadPasswordConfig,e);yield xo(ji.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield xo(ji.setForgotPasswordState({loading:!1,error:Tg(e)}))}}function*LA(){yield xa(ji.forgotPassword,OA),yield xa(ji.resetPassword,PA),yield xa(ji.loadPasswordConfig,_A)}let wA;!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",e.CONFIG_TEMPORARY_USERS="CONFIG_TEMPORARY_USERS",e.UPDATE_USER_EXPIRATION_TIME="UPDATE_USER_EXPIRATION_TIME"}(wA||(wA={}));const UA=["callback","events"],CA=["user"],RA=["callback"],DA=["callback"];function*NA({payload:{userId:e,token:t}}){yield xo(ji.setActivateState({loading:!0,step:Vt.activating}));try{const{isAuthenticated:n}=yield Ko((e=>e.auth));n&&(yield xo(ji.silentLogout()));const i=yield Bo(rp.auth.getActivateAccountStrategy,{userId:e,token:t});yield xo(ji.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield xo(ji.setActivateState({loading:!1,step:Vt.activatingForm})))}catch(e){yield xo(ji.setActivateState({loading:!1,error:Tg(e)}))}}function*MA(e){let{payload:{callback:t,events:n}}=e,i=to(e.payload,UA);yield xo(ji.setActivateState({loading:!0}));try{const e=Va.onRedirectTo,{routes:a}=yield Ko((e=>e.auth)),r=yield Bo(rp.auth.activateAccountV2,i),{user:s}=r,l=to(r,CA);if(s.redirectLocation)return void(window.location.href=s.redirectLocation);if(hg(s)){yield xo(ji.setActivateState({step:Vt.success}));const t=yield bg(s);yield xo(ji.setState(t)),yield Ho(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield xo(ji.setActivateState({step:Vt.success}));const e={email:s.email,origin:dg.ACTIVATION_LINK,id:s.id,tenantId:s.tenantId,name:s.name,createdAt:new Date};null==n||null==(o=n.userVerified)||o.call(n,e),kg(Eg.USER_VERIFIED,e),yield Bo(ZS,D({user:s},l),{isAuthenticated:!0}),yield Ho(1e3),yield sv(),yield xo(ji.resetActivateState())}null==t||t(!0)}catch(e){yield xo(ji.setActivateState({loading:!1,error:Tg(e)}))}}function*FA({payload:e}){const{callback:t}=e,n=to(e,RA);yield xo(ji.setActivateStrategyState({loading:!0}));try{const e=yield Bo(rp.auth.getActivateAccountStrategy,n);yield xo(ji.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield xo(ji.setActivateStrategyState({loading:!1,error:Tg(e)}))}}function*GA({payload:e}){const{callback:t}=e,n=to(e,DA);yield xo(ji.setTeamLoader({key:wA.RESEND_ACTIVATE_LINK,value:n.email})),yield xo(ji.setActivateState({loading:!0}));try{yield Bo(rp.auth.resendActivationEmail,n),yield xo(ji.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield xo(ji.setActivateState({loading:!1,error:Tg(e)})),yield xo(ji.setTeamError({key:wA.RESEND_ACTIVATE_LINK,value:Tg(e)})),null==t||t(null,e)}yield xo(ji.setTeamLoader({key:wA.RESEND_ACTIVATE_LINK,value:!1}))}function*$A(){yield xa(ji.activateAccount,MA),yield xa(ji.preActivateAccount,NA),yield xa(ji.getActivateAccountStrategy,FA),yield xa(ji.resendActivationEmail,GA)}function*xA({payload:e}){if(e.token&&e.userId)try{yield xo(ji.setAcceptInvitationState({error:void 0,step:zt.pending})),yield Bo(rp.auth.acceptInvitation,e),yield xo(ji.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:zt.success}}))}catch(e){yield xo(ji.setAcceptInvitationState({step:zt.failed,error:Tg(e)}))}else yield xo(ji.setAcceptInvitationState({error:void 0,step:zt.invalid}))}function*VA(){yield xa(ji.acceptInvitation,xA)}var jA,BA=new Uint8Array(16);function WA(){if(!jA&&!(jA="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 jA(BA)}for(var zA=/^(?:[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,KA=function(e){return"string"==typeof e&&zA.test(e)},HA=[],qA=0;qA<256;++qA)HA.push((qA+256).toString(16).substr(1));var JA=function(e,t,n){var i=(e=e||{}).random||(e.rng||WA)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=i[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(HA[e[t+0]]+HA[e[t+1]]+HA[e[t+2]]+HA[e[t+3]]+"-"+HA[e[t+4]]+HA[e[t+5]]+"-"+HA[e[t+6]]+HA[e[t+7]]+"-"+HA[e[t+8]]+HA[e[t+9]]+"-"+HA[e[t+10]]+HA[e[t+11]]+HA[e[t+12]]+HA[e[t+13]]+HA[e[t+14]]+HA[e[t+15]]).toLowerCase();if(!KA(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let YA,XA;!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"}(YA||(YA={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(XA||(XA={}));const QA=["callback"],ZA=["roles"],eb=["callback"],tb=["callback","profileImage"],nb=["callback"],ib=["callback","userId"],ob=["callback"],ab=["callback"],rb=["callback"],sb=["callback"],lb=["callback"],cb=["callback"],ub=["callback"],db=["callback"],yb=["callback"],fb=["callback","profileImage"],pb=["callback"],gb=["callback"],Sb=["callback"],vb=["callback"],hb=["callback"],mb=["callback"],Ab=["callback"],bb=["callback"],Tb=()=>Ko((e=>e.auth.teamState));function*Eb(){try{const{groups:e}=yield Bo(rp.groups.getGroups,{_groupsRelations:XA.roles});return e}catch(e){return[]}}function*kb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield Tb(),c=null!=(t=e.pageSize)?t:l.pageSize,u=null!=(n=e.pageOffset)?n:l.pageOffset,d=null!=(i=e.filter)?i:l.filterV2,y=null!=(o=e.sort)?o:l.sortV2,f=null!=(a=null==e?void 0:e.shouldShowSubTenantUsersIfReseller)?a:null==l?void 0:l.shouldShowSubTenantUsersIfReseller;yield xo(ji.setTeamLoader({key:wA.USERS,value:!r})),yield xo(ji.setTeamState({pageSize:c,pageOffset:u,filterV2:d,sortV2:y}));try{const[{items:t,_metadata:{totalPages:n,totalItems:i}},{items:o},{items:a},r]=yield Vo([Bo(rp.users.getUsersV2,D({},(null==d?void 0:d.length)&&{_filter:d},y&&{_sortBy:y},e.order&&{_order:e.order},{_offset:u,_limit:c,_includeSubTenants:f})),Bo(rp.teams.loadAvailableRoles),Bo(rp.teams.loadAvailablePermissions),Bo(Eb)]),l=t.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>r.filter((t=>t.id===e.id)))).flat();return D({},e,{groups:n})}));yield xo(ji.setTeamState({users:l.map((e=>D({},e,{roleIds:e.roles.map((e=>e.id))}))),totalPages:n,totalItems:i,roles:o,permissions:a})),null==s||s(t)}catch(e){yield xo(ji.setTeamError({key:wA.USERS,value:Tg(e)})),yield xo(ji.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield xo(ji.setTeamLoader({key:wA.USERS,value:!1}))}function*Ib({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield Tb(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filter,d=null!=(o=e.sort)?o:s.sort;yield xo(ji.setTeamLoader({key:wA.USERS,value:!a})),yield xo(ji.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield Vo([Bo(rp.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),Bo(rp.teams.loadAvailableRoles),Bo(rp.teams.loadAvailablePermissions)]);yield xo(ji.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield xo(ji.setTeamError({key:wA.USERS,value:e.message})),yield xo(ji.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield xo(ji.setTeamLoader({key:wA.USERS,value:!1}))}function*Ob({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield Tb(),c={_limit:(null!=(t=e._limit)?t:l.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:l.allUsersQueryParams._offset)||0,_filter:(null!=(i=e._filter)?i:l.allUsersQueryParams._filter)||"",_sortBy:(null!=(o=e._sortBy)?o:l.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:l.allUsersQueryParams._order)||"DESC"};yield xo(ji.setTeamLoader({key:wA.USERS,value:!r})),yield xo(ji.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield Vo([Bo(rp.subTenants.loadAllUsers,D({},c)),Bo(rp.teams.loadAvailableRoles),Bo(rp.teams.loadAvailablePermissions)]);yield xo(ji.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield xo(ji.setTeamError({key:wA.USERS,value:Tg(e)})),yield xo(ji.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield xo(ji.setTeamLoader({key:wA.USERS,value:!1}))}function*Pb({payload:e}){yield xo(ji.setTeamLoader({key:wA.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield Vo([Bo(rp.teams.loadAvailableRoles),Bo(rp.teams.loadAvailablePermissions)]);yield xo(ji.setTeamState({roles:n,permissions:i})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:i})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield xo(ji.setTeamError({key:wA.ROLES_AND_PERMISSIONS,value:Tg(t)}))}yield xo(ji.setTeamLoader({key:wA.ROLES_AND_PERMISSIONS,value:!0}))}function*_b({payload:e}){const{callback:t}=e,n=to(e,QA),i=yield Tb();yield xo(ji.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield Bo(rp.teams.addUser,n),{roles:a}=e,r=D({},to(e,ZA),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield xo(ji.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield xo(ji.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Lb({payload:e}){const{callback:t}=e,n=yield Tb();yield xo(ji.setTeamState({addUserDialogState:D({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>D({email:t,roleIds:e.roleIds},e.expirationInSeconds&&{expirationInSeconds:e.expirationInSeconds})));yield xo(ji.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Bo(rp.teams.addUser,t),i.push(t.email)}catch(e){o.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:"",silentLoading:e.emails.length>0};yield xo(ji.loadUsersV2(r)),yield xo(ji.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*wb({payload:e}){const{callback:t}=e,n=to(e,eb),i=yield Tb();yield xo(ji.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})}));try{yield Bo(rp.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield Bo(rp.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield xo(ji.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield xo(ji.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Ub({payload:e}){const{callback:t}=e,n=to(e,tb),{id:i}=n,o=yield Tb(),a=o.users.find((e=>e.id===n.id));yield xo(ji.setTeamLoader({key:wA.UPDATE_USER,value:i||""})),yield xo(ji.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!0})})),yield xo(ji.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?D({},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 Bo(rp.teams.updateUser,n);null==t||t(e),yield xo(ji.setTeamState({users:o.users.map((t=>t.id===e.id?D({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield xo(ji.setTeamLoader({key:wA.UPDATE_USER,value:!1}))}catch(e){yield xo(ji.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!1,error:Tg(e)}),users:o.users.map((e=>e.id===n.id?D({},e,a):e))})),yield xo(ji.setTeamLoader({key:wA.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*Cb({payload:e}){const{callback:t}=e,n=to(e,nb),i=yield Tb();yield xo(ji.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})}));try{yield Bo(rp.teams.deleteUser,n),null==t||t(!0),yield xo(ji.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield xo(ji.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Rb({payload:e}){const{callback:t,userId:n}=e,i=to(e,ib),o=yield Tb();yield xo(ji.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!0})}));try{yield Bo(rp.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return D({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield xo(ji.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[D({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield xo(ji.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Db({payload:e}){const{callback:t}=e,n=to(e,ob),i=yield Tb();yield xo(ji.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})}));try{yield Bo(rp.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield xo(ji.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield xo(ji.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Nb({payload:e}){const{callback:t}=e,n=to(e,ab);yield xo(ji.setTeamLoader({key:wA.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Bo(rp.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield xo(ji.setTeamError({key:wA.RESEND_ACTIVATE_LINK,value:Tg(e)})),null==t||t(null,e)}yield xo(ji.setTeamLoader({key:wA.RESEND_ACTIVATE_LINK,value:!1}))}function*Mb({payload:e}){const{callback:t}=e,n=to(e,rb);yield xo(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:n.email}));try{yield Bo(rp.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield xo(ji.setTeamError({key:wA.RESEND_INVITATION_LINK,value:Tg(e)})),null==t||t(null,e)}yield xo(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:!1}))}function*Fb({payload:e}){const{callback:t}=e,n=to(e,sb);yield xo(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:n.email}));try{yield Bo(rp.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield xo(ji.setTeamError({key:wA.RESEND_INVITATION_LINK,value:Tg(e)})),null==t||t(null,e)}yield xo(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:!1}))}function*Gb({payload:e}){const{callback:t}=e,n=to(e,lb);yield xo(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:n.email}));try{yield Bo(rp.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield xo(ji.setTeamError({key:wA.RESEND_INVITATION_LINK,value:Tg(e)})),null==t||t(null,e)}yield xo(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:!1}))}function*$b(){yield xo(ji.setTeamError({key:wA.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Bo(rp.teams.getInviteLinkConfiguration);yield xo(ji.setTeamState({inviteTokenState:D({},e)}))}catch(e){yield xo(ji.setTeamError({key:wA.CONFIG_TOKEN_LINK,value:Tg(e)}))}}function*xb(){yield xo(ji.setTeamError({key:wA.CONFIG_TEMPORARY_USERS,value:!1}));try{const e=yield Bo(rp.teams.getTemporaryUserConfiguration);yield xo(ji.setTeamState({temporaryUsersConfig:e}))}catch(e){yield xo(ji.setTeamError({key:wA.CONFIG_TEMPORARY_USERS,value:Tg(e)}))}}function*Vb({payload:e}){const{callback:t}=e,n=to(e,cb),i=yield Tb();yield xo(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!0}));try{const e=yield Bo(rp.teams.updateUserExpirationTime,n);yield xo(ji.setTeamState({users:i.users.map((t=>t.id===n.userId?D({},t,{temporaryExpirationDate:new Date(e.temporaryExpirationDate)}):t))})),null==t||t(!0)}catch(e){yield xo(ji.setTeamError({key:wA.UPDATE_USER_EXPIRATION_TIME,value:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!1}))}}function*jb({payload:e}){const{callback:t}=e,n=to(e,ub),i=yield Tb();yield xo(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!0}));try{yield Bo(rp.teams.setPermanentUser,n.userId),yield xo(ji.setTeamState({users:i.users.map((e=>e.id===n.userId?D({},e,{temporaryExpirationDate:void 0}):e))})),null==t||t(!0)}catch(e){yield xo(ji.setTeamError({key:wA.UPDATE_USER_EXPIRATION_TIME,value:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!1}))}}function*Bb(){yield xo(ji.setTeamError({key:wA.GET_TOKEN_LINK,value:!1}));try{yield Bo($b);const e=yield Bo(rp.teams.getInviteUserLink),{inviteTokenState:t}=yield Tb();yield xo(ji.setTeamState({inviteTokenState:D({},t,e)}))}catch(e){yield xo(ji.setTeamError({key:wA.GET_TOKEN_LINK,value:Tg(e)}))}}function*Wb({payload:{callback:e}}){yield xo(ji.setTeamError({key:wA.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield Tb();try{const n=yield Bo(rp.teams.createInviteUserLink,{expiresInMinutes:43200});yield xo(ji.setTeamState({inviteTokenState:D({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield xo(ji.setTeamError({key:wA.CREATE_TOKEN_LINK,value:Tg(t)}))}}function*zb({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield Tb();yield xo(ji.setTeamError({key:wA.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield Bo(rp.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield xo(ji.setTeamState({inviteTokenState:D({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield xo(ji.setTeamError({key:wA.UPDATE_TOKEN_LINK,value:Tg(t)}))}}function*Kb({payload:e}){const{callback:t}=null!=e?e:{};yield xo(ji.setTeamError({key:wA.DELETE_TOKEN_LINK,value:!1}));try{yield Bo(rp.teams.deleteInviteUserLink),yield xo(ji.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield xo(ji.setTeamError({key:wA.DELETE_TOKEN_LINK,value:Tg(e)})),null==t||t(!1,e)}}function*Hb({payload:e}){yield xo(ji.setTeamState({addUserDialogState:D({open:!0,loading:!1,error:!1},e)}))}function*qb({payload:e}){const t=yield Tb(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield xo(ji.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Jb({payload:e}){yield xo(ji.setTeamState({deleteUserDialogState:D({open:!0,loading:!1,error:!1},e)}))}function*Yb({payload:e}){const t=yield Tb(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield xo(ji.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Xb(){yield $a(ji.loadUsers,Ib),yield $a(ji.loadUsersV2,kb),yield $a(ji.loadAllSubTenantsUsers,Ob),yield $a(ji.loadRoles,Pb),yield Ga(ji.addUser,_b),yield Ga(ji.addUsersBulk,Lb),yield Ga(ji.addUserToSubTenants,wb),yield Ga(ji.updateUser,Ub),yield Ga(ji.setUserRolesForSubTenants,Rb),yield Ga(ji.deleteUser,Cb),yield Ga(ji.deleteUserFromSubTenants,Db),yield Ga(ji.resendActivationLink,Nb),yield Ga(ji.resendInvitationLink,Mb),yield Ga(ji.resendInvitationEmail,Fb),yield Ga(ji.resendInvitationLinkToAllSubTenants,Gb),yield Ga(ji.getTemporaryUsersConfig,xb),yield Ga(ji.updateUserExpirationTime,Vb),yield Ga(ji.setUserAsPermanent,jb),yield Ga(ji.getInvitationLink,Bb),yield Ga(ji.createInvitationLink,Wb),yield Ga(ji.updateInvitationLink,zb),yield Ga(ji.deleteInvitationLink,Kb),yield Ga(ji.openAddUserDialog,Hb),yield Ga(ji.closeAddUserDialog,qb),yield Ga(ji.openDeleteUserDialog,Jb),yield Ga(ji.closeDeleteUserDialog,Yb)}function*Qb({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield Tb(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filterV2,d=null!=(o=e.sort)?o:s.sortV2;yield xo(ji.setTeamLoader({key:wA.USERS,value:!a})),yield xo(ji.setTeamState({pageSize:l,pageOffset:c,filterV2:u,sortV2:d})),yield Et(),yield xo(ji.setTeamState({users:Jp,totalPages:2,totalItems:10,roles:Vp,permissions:Bp})),yield xo(ji.setTeamLoader({key:wA.USERS,value:!1})),null==r||r(Jp)}function*Zb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield Tb(),c=null!=(t=e._limit)?t:l.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:l.allUsersQueryParams._offset,d=null!=(i=e._filter)?i:l.allUsersQueryParams._filter,y=null!=(o=e._sortBy)?o:l.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:l.allUsersQueryParams._order;yield xo(ji.setTeamLoader({key:wA.USERS,value:!r})),yield xo(ji.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield Et(),yield xo(ji.setTeamState({allUsers:Xp,totalPages:2,totalItems:10,roles:Vp,permissions:Bp})),yield xo(ji.setTeamLoader({key:wA.USERS,value:!1})),null==s||s(Xp)}function*eT({payload:e}){var t;yield xo(ji.setTeamLoader({key:wA.ROLES_AND_PERMISSIONS,value:!0})),yield Et(),yield xo(ji.setTeamState({roles:Vp,permissions:Bp})),yield xo(ji.setTeamLoader({key:wA.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Vp,permissions:Bp})}function*tT({payload:e}){const{callback:t}=e,n=to(e,db),i=yield Tb();yield xo(ji.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})})),yield Et();const o=new Date,a=D({},Kp,{groups:[]},n,{id:`${JA()}`,temporaryExpirationDate:n.expirationInSeconds?new Date(o.setSeconds(o.getSeconds()+n.expirationInSeconds)):void 0});null==t||t(a),yield xo(ji.setTeamState({users:[a,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*nT({payload:e}){const{callback:t}=e,n=to(e,yb),i=yield Tb();yield xo(ji.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})})),yield Et();const o=D({},Kp,n,{id:`${JA()}`});yield xo(ji.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*iT({payload:e}){var t;const{callback:n}=e,i=to(e,fb),{id:o}=i,a=yield Tb(),r=a.users.find((e=>e.id===i.id));yield xo(ji.setTeamLoader({key:wA.UPDATE_USER,value:o||""})),yield xo(ji.setTeamState({addUserDialogState:D({},a.addUserDialogState,{loading:!0})})),yield xo(ji.setTeamState({addUserDialogState:D({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?D({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield Et();const s=D({},r,i);null==n||n(s),yield xo(ji.setTeamState({users:a.users.map((e=>e.id===s.id?D({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield xo(ji.setTeamLoader({key:wA.UPDATE_USER,value:!1}))}function*oT({payload:e}){const{callback:t}=e,n=to(e,pb),i=yield Tb();yield xo(ji.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield xo(ji.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*aT({payload:e}){const{callback:t}=e,n=to(e,gb),i=yield Tb();yield xo(ji.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield xo(ji.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*rT({payload:e}){const{callback:t}=e,n=to(e,Sb);yield xo(ji.setTeamLoader({key:wA.RESEND_ACTIVATE_LINK,value:n.userId})),yield Et(),null==t||t(!0),yield xo(ji.setTeamLoader({key:wA.RESEND_ACTIVATE_LINK,value:!1}))}function*sT({payload:e}){const{callback:t}=e,n=to(e,vb);yield xo(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield xo(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:!1}))}function*lT({payload:e}){const{callback:t}=e,n=to(e,hb);yield xo(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield xo(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:!1}))}function*cT({payload:e}){const{callback:t}=e,n=to(e,mb);yield xo(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield xo(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:!1}))}function*uT({payload:e}){const{callback:t}=e,n=to(e,Ab),i=yield Tb();yield xo(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!0}));const o=new Date;yield xo(ji.setTeamState({users:i.users.map((e=>e.id===n.userId?D({},e,{temporaryExpirationDate:n.expirationInSeconds?new Date(o.setSeconds(o.getSeconds()+n.expirationInSeconds)):void 0}):e))})),yield Et(),null==t||t(!0),yield xo(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!1}))}function*dT({payload:e}){const{callback:t}=e,n=to(e,bb),i=yield Tb();yield xo(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!0})),yield xo(ji.setTeamState({users:i.users.map((e=>e.id===n.userId?D({},e,{temporaryExpirationDate:void 0}):e))})),yield Et(),null==t||t(!0),yield xo(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!1}))}function*yT(){yield $a(ji.loadUsersV2,Qb),yield $a(ji.loadAllSubTenantsUsers,Zb),yield $a(ji.loadRoles,eT),yield Ga(ji.addUser,tT),yield Ga(ji.addUserToSubTenants,nT),yield Ga(ji.updateUser,iT),yield Ga(ji.deleteUser,oT),yield Ga(ji.updateUserExpirationTime,uT),yield Ga(ji.setUserAsPermanent,dT),yield Ga(ji.deleteUserFromSubTenants,aT),yield Ga(ji.resendActivationLink,rT),yield Ga(ji.resendInvitationLink,sT),yield Ga(ji.resendInvitationEmail,lT),yield Ga(ji.resendInvitationLinkToAllSubTenants,cT),yield Ga(ji.openAddUserDialog,Hb),yield Ga(ji.closeAddUserDialog,qb),yield Ga(ji.openDeleteUserDialog,Jb),yield Ga(ji.closeDeleteUserDialog,Yb)}const fT=["authorizationUrl"],pT=["events","url"];function*gT(){try{yield xo(ji.setSocialLoginsState({loading:!0}));const e=yield Bo(rp.auth.getSocialLoginProviders);yield xo(ji.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield xo(ji.setSocialLoginsState({error:Tg(e),loading:!1,firstLoad:!1}))}}function*ST(){const e=yield Ko((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Bo(rp.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield Bo(rp.auth.getSocialLoginProvidersV2),t}function*vT(e){try{var t,n;const i=yield Ko((e=>e.root.context));yield xo(ji.setSocialLoginsState({loading:!0}));const o=yield Bo(ST),{providers:a}=yield Bo(rp.auth.getCustomSocialLoginProvidersV1),r={socialLoginsConfigV2:o.map((e=>{let{authorizationUrl:t}=e,n=to(e,fT);const o=Lr(i,null!=t?t:"");return D({},n,{authorizationUrl:t?`${o}${t}`:null})})),customSocialLoginsConfig:a,loading:!1,firstLoad:!1};yield xo(ji.setSocialLoginsState(r)),null==e||null==(t=e.payload)||null==(n=t.callback)||n.call(t,r)}catch(t){var i,o;null==e||null==(i=e.payload)||null==(o=i.callback)||o.call(i,null,t),yield xo(ji.setSocialLoginsState({error:Tg(t),loading:!1,firstLoad:!1}))}}function*hT(e){let{payload:{events:t,url:n}}=e,i=to(e.payload,pT);try{yield xo(ji.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield Bo(rp.auth.loginViaSocialLogin,i);if(r){var o,a;const r={email:e,url:n,createdAt:new Date,id:s,tenantId:l},u=D({},r,{socialProvider:i.provider,authenticationType:yg.SOCIAL_LOGIN});null==t||null==(o=t.signUpComplete)||o.call(t,u),kg(Eg.SIGNUP_COMPLETED,u);const d=D({},r,{origin:dg.SOCIAL_LOGIN,name:c});null==t||null==(a=t.userVerified)||a.call(t,d),kg(Eg.USER_VERIFIED,d)}s&&localStorage.setItem("userId",s),yield xo(ji.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield Ko((e=>e.auth));e?yield Bo(ih):yield Bo(ah)}(),localStorage.removeItem("register-quick-login"),yield xo(ji.setSocialLoginsState({loading:!1}))}catch(e){yield xo(ji.setSocialLoginsState({loading:!1,error:Tg(e,"Failed to authenticate"),firstLoad:!1}))}}function*mT({payload:e}){yield xo(ji.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*AT(){yield xa(ji.loadSocialLoginsConfiguration,gT),yield Ga(ji.loadSocialLoginsConfigurationV2,vT),yield xa(ji.loginViaSocialLogin,hT),yield $a(ji.setSocialLoginError,mT)}let bT;function*TT({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield Ko((e=>e.auth.apiTokensState)),{policy:a}=yield Ko((e=>e.auth.securityPolicyState.publicPolicy)),r=(null==a?void 0:a.machineToMachineAuthStrategy)===Oi.AccessToken;try{let e;yield xo(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!0}));let a=null;n&&(a=1440*n),e=r?yield Bo(rp.auth.createUserAccessToken,{description:t,expiresInMinutes:a}):yield Bo(rp.auth.updateUserApiTokensData,{description:t,expiresInMinutes:a}),yield xo(ji.setApiTokensState({showAddTokenDialog:!1})),yield Ho(200),yield xo(ji.setApiTokensState({apiTokensDataUser:[D({},e,{type:r?Oi.AccessToken:Oi.ClientCredentials}),...o],successDialog:{open:!0,secret:e.secret,clientId:r?void 0:e.clientId}})),yield xo(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield xo(ji.setApiTokensError({key:bT.ADD_API_TOKEN,value:Tg(e)})),yield xo(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*ET({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield Ko((e=>e.auth.apiTokensState)),{policy:r}=yield Ko((e=>e.auth.securityPolicyState.publicPolicy)),s=(null==r?void 0:r.machineToMachineAuthStrategy)===Oi.AccessToken;try{let e;yield xo(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!0}));let r=null;i&&(r=1440*i),e=s?yield Bo(rp.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n}):yield Bo(rp.auth.updateTenantApiTokensData,{description:t,roleIds:n,expiresInMinutes:r}),yield xo(ji.setApiTokensState({showAddTokenDialog:!1})),yield Ho(200),yield xo(ji.setApiTokensState({apiTokensDataTenant:[D({},e,{type:s?Oi.AccessToken:Oi.ClientCredentials}),...a],successDialog:{open:!0,secret:e.secret,clientId:s?void 0:e.clientId}})),yield xo(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield xo(ji.setApiTokensError({key:bT.ADD_API_TOKEN,value:Tg(e)})),yield xo(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*kT({payload:e}){const{apiTokensDataUser:t}=yield Ko((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield xo(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!0})),n?(yield Bo(rp.auth.deleteUserAccessToken,{id:e}),yield xo(ji.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Bo(rp.auth.deleteUserApiToken,{tokenId:e}),yield xo(ji.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield xo(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!1}))}catch(e){yield xo(ji.setApiTokensError({key:bT.DELETE_API_TOKEN,value:Tg(e)})),yield xo(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!1}))}}function*IT({payload:e}){const{apiTokensDataTenant:t}=yield Ko((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield xo(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!0})),n?(yield Bo(rp.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield Bo(rp.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield xo(ji.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield xo(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!1}))}catch(e){yield xo(ji.setApiTokensError({key:bT.DELETE_API_TOKEN,value:Tg(e)})),yield xo(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!1}))}}function*OT({payload:e}){null!=e&&e.silentLoading||(yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield Vo([Bo(rp.auth.getUserApiTokensData),Bo(rp.auth.getTenantApiTokensData)]);yield xo(ji.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield xo(ji.setApiTokensError({key:bT.LOAD_API_TOKENS,value:Tg(t)})),yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*PT({payload:e}){null!=e&&e.silentLoading||(yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=Bo(rp.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=Bo(rp.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).map((e=>D({},e,{type:Oi.AccessToken}))).concat(a.map((e=>D({},e,{type:Oi.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield xo(ji.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield xo(ji.setApiTokensError({key:bT.LOAD_API_TOKENS,value:Tg(t)})),yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*_T({payload:e}){null!=e&&e.silentLoading||(yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=Bo(rp.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Bo(rp.auth.getTenantAccessTokensData))?n:[],s=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).map((e=>D({},e,{type:Oi.AccessToken}))).concat(a.map((e=>D({},e,{type:Oi.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield xo(ji.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield xo(ji.setApiTokensError({key:bT.LOAD_API_TOKENS,value:Tg(t)})),yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*LT(){yield xa(ji.loadApiTokens,OT),yield xa(ji.loadUserApiTokens,PT),yield xa(ji.loadTenantApiTokens,_T),yield Ga(ji.addUserApiToken,TT),yield Ga(ji.addTenantApiToken,ET),yield $a(ji.deleteTenantApiToken,IT),yield $a(ji.deleteUserApiToken,kT)}function*wT({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield xo(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield Ko((e=>e.auth.apiTokensState)),a=D({},Lp,{description:t,roleIds:n,clientId:`CLIENT_ID_${JA()}`});yield xo(ji.setApiTokensState({showAddTokenDialog:!1})),yield Ho(200),yield xo(ji.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Ho(200),yield xo(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*UT({payload:e}){yield xo(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!0})),yield Ho(200);const t=[Lp];yield xo(ji.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield xo(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!1}))}function*CT({payload:e}){var t;null!=e&&e.silentLoading||(yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!0})));const n=[_p],i=[Lp];yield xo(ji.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Ho(200),yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*RT({payload:e}){var t;null!=e&&e.silentLoading||(yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!0})));const n=[_p];yield xo(ji.setApiTokensState({apiTokensDataUser:n})),yield Ho(200),yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*DT({payload:e}){var t;null!=e&&e.silentLoading||(yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!0})));const n=[Lp];yield xo(ji.setApiTokensState({apiTokensDataTenant:n})),yield Ho(200),yield xo(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*NT(){yield xa(ji.loadApiTokens,CT),yield xa(ji.loadUserApiTokens,RT),yield xa(ji.loadTenantApiTokens,DT),yield Ga(ji.addTenantApiToken,wT),yield $a(ji.deleteTenantApiToken,UT)}function*MT({payload:e}){try{var t;yield xo(ji.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Ko((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield Bo(rp.accountSettings.updateSettings,D({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield xo(ji.setAccountSettingsState(D({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield xo(ji.setAccountSettingsState({loading:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*FT({payload:e}){yield xo(ji.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Bo(rp.accountSettings.getSettings);yield xo(ji.setAccountSettingsState(D({},e,{loading:!1})))}catch(e){yield xo(ji.setAccountSettingsState({loading:!1,error:Tg(e)}))}}function*GT(){yield xa(ji.saveAccountSettings,MT),yield xa(ji.loadAccountSettings,FT)}function*$T({payload:e}){var t;yield xo(ji.setAccountSettingsState({loading:!0})),yield Et();const{accountSettingsState:n}=yield Ko((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=D({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield xo(ji.setAccountSettingsState(D({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*xT({payload:e}){yield xo(ji.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield Et(),yield xo(ji.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*VT(){yield xa(ji.saveAccountSettings,$T),yield xa(ji.loadAccountSettings,xT)}function*jT({payload:{tenantId:e,callback:t}}){yield xo(ji.setState({isLoading:!0}));try{yield Bo(rp.tenants.switchTenant,{tenantId:e}),yield Bo(th),(null==t?void 0:t(!0))||(yield xo(ji.setState({isLoading:!1})))}catch(e){yield xo(ji.setState({isLoading:!1})),null==t||t(!1,e)}}function*BT({payload:e}){yield xo(ji.setTenantsState({loading:!0}));try{var t;const n=yield Bo(ns());yield xo(ji.setTenantsState({tenants:n.tenants,activeTenant:n.activeTenant,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield xo(ji.setTenantsState({loading:!1}))}}function*WT({payload:e}){yield xo(ji.setTenantsState({loading:!0}));try{var t;const n=yield Bo(rp.tenants.getSubTenants);yield xo(ji.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield xo(ji.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*zT({payload:e}){yield xo(ji.setTenantsState({loading:!0}));try{var t;const n=yield Bo(rp.tenants.getSubTenantsAsTree);yield xo(ji.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield xo(ji.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*KT(){yield Ga(ji.loadTenants,BT),yield Ga(ji.loadSubTenants,WT),yield Ga(ji.switchTenant,jT),yield Ga(ji.loadSubTenantsTree,zT)}function*HT(){yield xo(ji.setTenantsState({loading:!0})),yield Et(),yield xo(ji.setTenantsState({tenants:Qp,activeTenant:Qp[0],loading:!1}))}function*qT(){yield Ga(ji.loadTenants,HT)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(bT||(bT={}));const JT=["callback"],YT=["callback"],XT=["callback"],QT=["callback"],ZT=["callback"];function*eE({payload:e}){var t;yield xo(ji.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Vo([Bo(rp.roles.getRoles),Bo(rp.roles.getPermissions),Bo(rp.roles.getPermissionCategories)]),[t,n,i]=e;yield xo(ji.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield xo(ji.setRolesState({error:Tg(e),loading:!1}))}}function*tE(e){let{payload:{callback:t}}=e,n=to(e.payload,JT);yield xo(ji.setRolesState({saving:!0}));try{const e=yield Bo(rp.roles.addRole,n),i=yield Bo(rp.roles.getRoles);yield xo(ji.loadRolesAndPermissions({silentLoading:!0})),yield xo(ji.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield xo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*nE(e){let{payload:{callback:t}}=e,n=to(e.payload,YT);yield xo(ji.setRolesState({saving:!0}));try{yield Bo(rp.roles.deleteRole,n),yield xo(ji.loadRolesAndPermissions({silentLoading:!0})),yield xo(ji.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield xo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(!1,e)}}function*iE(e){let{payload:{callback:t}}=e,n=to(e.payload,XT);yield xo(ji.setRolesState({saving:!0}));try{const e=yield Bo(rp.roles.updateRole,n);yield xo(ji.loadRolesAndPermissions({silentLoading:!0})),yield xo(ji.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield xo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*oE(e){let{payload:{callback:t}}=e,n=to(e.payload,QT);yield xo(ji.setRolesState({saving:!0}));try{const e=yield Bo(rp.roles.attachPermissionsToRole,n);yield xo(ji.loadRolesAndPermissions({silentLoading:!0})),yield xo(ji.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield xo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*aE(e){let{payload:{callback:t}}=e,n=to(e.payload,ZT);yield xo(ji.setRolesState({saving:!0}));try{const e=yield Bo(rp.roles.attachPermissionToRoles,n);yield xo(ji.loadRolesAndPermissions({silentLoading:!0})),yield xo(ji.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield xo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*rE(){yield xa(ji.loadRolesAndPermissions,eE),yield Ga(ji.addRole,tE),yield Ga(ji.deleteRole,nE),yield Ga(ji.updateRole,iE),yield Ga(ji.attachPermissionsToRole,oE),yield Ga(ji.attachPermissionToRoles,aE)}function*sE({payload:e}){var t;yield xo(ji.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield xo(ji.setRolesState({roles:wp,loading:!1}))}catch(e){yield xo(ji.setRolesState({error:Tg(e),loading:!1}))}}function*lE(){yield xa(ji.loadRolesAndPermissions,sE)}const cE=["callback"],uE=["callback"],dE=["callback"];function*yE(e){let{payload:{callback:t}}=e,n=to(e.payload,cE);yield xo(ji.setResetPhoneNumberState({loading:!0}));try{const e=yield Bo(rp.auth.resetPhoneNumber,n);yield xo(ji.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Zt.VerifyResetPhoneNumber})),yield xo(ji.setLoginState({email:n.email}))}catch(e){yield xo(ji.setResetPhoneNumberState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*fE(e){let{payload:{callback:t}}=e,n=to(e.payload,uE);yield xo(ji.setResetPhoneNumberState({loading:!0}));try{const e=yield Bo(rp.auth.verifyResetPhoneNumber,n);yield xo(ji.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Zt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield xo(ji.setResetPhoneNumberState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*pE(e){let{payload:{callback:t}}=e,n=to(e.payload,dE);yield xo(ji.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield Ko((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Bo(rp.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield xo(ji.setLoginState({step:_t.loginWithSmsOtc})),yield xo(ji.passwordlessPreLogin({type:Ii.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield xo(ji.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setResetPhoneNumberState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*gE(){yield xa(ji.resetPhoneNumber,yE),yield xa(ji.verifyResetPhoneNumber,fE),yield xa(ji.changePhoneNumber,pE)}function*SE(){yield xo(ji.setSessionsState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getCurrentUserSessions);yield xo(ji.setSessionsState({sessions:e,loading:!1}))}catch(e){yield xo(ji.setSessionsState({error:e,loading:!1}))}}function*vE(){yield xo(ji.setSessionsState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getCurrentUserSession);yield xo(ji.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield xo(ji.setSessionsState({error:e,loading:!1}))}}function*hE({payload:{id:e}}){yield xo(ji.setSessionsState({loading:!0,error:null}));try{yield Bo(rp.auth.deleteSessionForUser,e),yield xo(ji.loadUserSessions())}catch(e){yield xo(ji.setSessionsState({error:e,loading:!1}))}}function*mE({payload:{callback:e,userId:t}}){yield xo(ji.setSessionsState({loading:!0,error:null}));try{yield Bo(rp.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield xo(ji.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*AE(){yield xo(ji.setSessionsState({loading:!0,error:null}));try{yield Bo(rp.auth.deleteAllSessionsForUser),yield xo(ji.loadUserSessions())}catch(e){yield xo(ji.setSessionsState({error:e,loading:!1}))}}function*bE(){yield $a(ji.loadUserSessions,SE),yield $a(ji.deleteUserSession,hE),yield $a(ji.deleteAllUserSessions,AE),yield $a(ji.loadCurrentUserSession,vE),yield Ga(ji.revokeUserSessions,mE)}function*TE(){yield xo(ji.setSessionsState({loading:!0,error:null})),yield xo(ji.setSessionsState({sessions:Zp,loading:!1}))}function*EE({payload:{id:e}}){yield xo(ji.setSessionsState({loading:!0,error:null}));const t=(yield Ko((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield xo(ji.setSessionsState({sessions:t,loading:!1}))}function*kE(){yield xo(ji.setSessionsState({loading:!0,error:null}));const e=Zp.filter((e=>e.current));yield xo(ji.setSessionsState({sessions:e,loading:!1}))}function*IE(){yield $a(ji.loadUserSessions,TE),yield $a(ji.deleteUserSession,EE),yield $a(ji.deleteAllUserSessions,kE)}const OE=["callback"],PE=["callback"];function*_E(){yield xo(ji.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getSessionConfigurations);yield xo(ji.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield xo(ji.setSessionsState({error:e,loading:!1}))}}function*LE({payload:e}){yield xo(ji.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=to(e,OE);yield Bo(rp.auth.createOrUpdateSessionConfigrations,n),yield xo(ji.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield xo(ji.setSessionsPolicyState({error:e,loading:!1}))}}function*wE(){yield xa(ji.loadSessionsPolicy,_E),yield $a(ji.createOrUpdateSessionsPolicy,Dg(LE))}function*UE(){yield xo(ji.setSessionsPolicyState({loading:!0,error:null}));const e=yield Ko((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:eg}));yield xo(ji.setSessionsPolicyState(D({},e,{loading:!1})))}function*CE({payload:e}){yield xo(ji.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=to(e,PE);null==t||t(!0),yield xo(ji.setSessionsPolicyState({configurations:n,loading:!1}))}function*RE(){yield xa(ji.loadSessionsPolicy,UE),yield $a(ji.createOrUpdateSessionsPolicy,CE)}const DE=["callback"],NE=["callback"],ME=["callback"],FE=["callback"],GE=["callback"],$E=["callback"],xE=["callback"],VE=["callback"],jE=()=>Ko((e=>e.auth.restrictionsState.ipRestrictions)),BE=()=>Ko((e=>e.auth.restrictionsState.emailDomainRestrictions));function*WE(){yield xo(ji.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getDomainRestrictionsConfig),t=(yield Bo(rp.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield xo(ji.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield xo(ji.setEmailDomainRestrictionsState({error:Tg(e),loading:!1}))}}function*zE(e){let{payload:{callback:t}}=e,n=to(e.payload,DE);yield xo(ji.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield BE();try{var o;yield Bo(rp.auth.createDomainRestriction,n);const e=(yield Bo(rp.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield xo(ji.setEmailDomainRestrictionsState({data:{config:(null==(o=i.data)?void 0:o.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield xo(ji.setEmailDomainRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*KE(e){let{payload:{callback:t}}=e,n=to(e.payload,NE);yield xo(ji.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Bo(rp.auth.updateDomainRestrictionConfig,n),i=(yield Bo(rp.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield xo(ji.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield xo(ji.setEmailDomainRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*HE({payload:{id:e}}){yield xo(ji.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield BE();try{var n;yield Bo(rp.auth.deleteDomainRestriction,e);const i=(yield Bo(rp.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield xo(ji.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:zn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield xo(ji.setEmailDomainRestrictionsState({saving:!1,error:Tg(e)}))}}const qE=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:zn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*JE(){yield xo(ji.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield jE(),t=yield Bo(rp.auth.getIPRestrictionsConfig),n=qE({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield Bo(rp.auth.getIPRestrictions,n);yield xo(ji.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield xo(ji.setIpRestrictionsState({error:Tg(e),loading:!1}))}}function*YE(){try{const{valid:e}=yield Bo(rp.auth.testCurrentIpInAllowList);yield xo(ji.setIpRestrictionsState({userIpValid:e}))}catch(e){yield xo(ji.setIpRestrictionsState({error:Tg(e)}))}}function*XE({payload:{callback:e}}){yield xo(ji.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Ko((e=>e.auth.userIp));yield Vo([Bo(rp.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:zn.ALLOW}),Bo(rp.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield jE(),i=qE(n.pagination),{items:o,_metadata:{totalPages:a}}=yield Bo(rp.auth.getIPRestrictions,i);yield xo(ji.setIpRestrictionsState({data:{config:{isActive:!0,strategy:zn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield xo(ji.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*QE(e){let{payload:{callback:t}}=e,n=to(e.payload,ME);yield xo(ji.setIpRestrictionsState({saving:!0,error:null}));const i=yield jE();try{var o,a;yield Bo(rp.auth.createIPRestriction,n);const e=yield jE(),r=qE(e.pagination),{items:s,_metadata:{totalPages:l}}=yield Bo(rp.auth.getIPRestrictions,r);yield YE(),yield xo(ji.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:zn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield xo(ji.setIpRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*ZE(e){let{payload:{callback:t}}=e,n=to(e.payload,FE);yield xo(ji.setIpRestrictionsState({saving:!0,error:null}));try{yield Bo(rp.auth.updateIPRestrictionConfig,n);const e=yield jE(),i=yield Bo(rp.auth.getIPRestrictionsConfig),o=qE(D({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield Bo(rp.auth.getIPRestrictions,o);yield YE(),yield xo(ji.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield xo(ji.setIpRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*ek({payload:{id:e,callback:t}}){yield xo(ji.setIpRestrictionsState({saving:!0,error:null}));const n=yield jE();try{var i;yield Bo(rp.auth.deleteIPRestriction,e);const o=yield jE(),a=qE(o.pagination),{items:r,_metadata:{totalPages:s}}=yield Bo(rp.auth.getIPRestrictions,a);yield YE(),yield xo(ji.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:zn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield xo(ji.setIpRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*tk(){yield xa(ji.loadIpRestrictions,Dg(JE)),yield xa(ji.loadEmailDomainRestrictions,Dg(WE)),yield Ga(ji.saveIpRestriction,Dg(QE)),yield Ga(ji.saveIpRestrictionsConfig,Dg(ZE)),yield Ga(ji.deleteIpRestriction,Dg(ek)),yield Ga(ji.checkIfUserIpValid,Dg(YE)),yield Ga(ji.addCurrentUserIpAndActivate,Dg(XE)),yield Ga(ji.saveEmailDomainRestriction,Dg(zE)),yield Ga(ji.saveEmailDomainRestrictionsConfig,Dg(KE)),yield Ga(ji.deleteEmailDomainRestriction,Dg(HE))}function*nk(){yield xo(ji.setIpRestrictionsState({loading:!0,error:null})),yield xo(ji.setIpRestrictionsState({data:{restrictions:ng.filter((e=>e.strategy===tg.strategy)),config:tg},totalPages:1,pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*ik(){yield xo(ji.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield jE(),t=ng[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield xo(ji.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield xo(ji.setIpRestrictionsState({error:Tg(e),loading:!1}))}}function*ok(e){var t,n,i;let{payload:{callback:o}}=e,a=to(e.payload,GE);yield xo(ji.setIpRestrictionsState({saving:!0,error:null}));const r=yield jE(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield xo(ji.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:zn.ALLOW},restrictions:[...s,D({},a,{createdAt:new Date,updatedAt:new Date,id:JA(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*ak(e){var t,n,i;let{payload:{callback:o}}=e,a=to(e.payload,$E);const r=yield jE();yield xo(ji.setIpRestrictionsState({saving:!0,error:null})),yield xo(ji.setIpRestrictionsState({data:{config:D({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield xo(ji.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*rk({payload:{id:e,callback:t}}){var n;yield xo(ji.setIpRestrictionsState({saving:!0,error:null}));const i=yield jE();yield xo(ji.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:zn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*sk(){yield xo(ji.setEmailDomainRestrictionsState({loading:!0,error:null})),yield xo(ji.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:zn.ALLOW}],config:{active:!0,listType:zn.ALLOW,blockPublicDomains:!1}}}))}function*lk(e){var t,n;let{payload:{callback:i}}=e,o=to(e.payload,xE);const a=yield BE();yield xo(ji.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==i||i(!0),yield xo(ji.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],D({},o,{id:Date.now().toString()})]},saving:!1}))}function*ck(e){var t;let{payload:{callback:n}}=e,i=to(e.payload,VE);const o=yield BE();yield xo(ji.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==n||n(!0),yield xo(ji.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||zn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*uk({payload:{id:e}}){var t,n;const i=yield BE();yield xo(ji.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),yield xo(ji.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:zn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*dk(){yield xa(ji.loadIpRestrictions,nk),yield xa(ji.loadEmailDomainRestrictions,sk),yield Ga(ji.saveIpRestriction,ok),yield Ga(ji.saveIpRestrictionsConfig,ak),yield Ga(ji.deleteIpRestriction,rk),yield Ga(ji.checkIfUserIpValid,ik),yield Ga(ji.saveEmailDomainRestriction,lk),yield Ga(ji.saveEmailDomainRestrictionsConfig,ck),yield Ga(ji.deleteEmailDomainRestriction,uk)}const yk=["callback"],fk=["id"];function*pk(e){const{count:t}=yield Bo(rp.directory.countConfigurationUsers,e.id);return D({},e,{count:t})}function*gk(){yield xo(ji.setProvisioningState({loading:!0,error:null}));try{const e=yield Bo(rp.directory.getConfigs),t=yield Vo(e.map((e=>pk(e))));yield xo(ji.setProvisioningState({connections:t,loading:!1}))}catch(e){yield xo(ji.setProvisioningState({error:Tg(e),loading:!1}))}}function*Sk(e){let{payload:{callback:t}}=e,n=to(e.payload,yk);yield xo(ji.setProvisioningState({loading:!0,error:null}));try{const e=yield Bo(rp.directory.createConfiguration,n),i=yield Bo(rp.directory.getConfigs),o=yield Vo(i.map((e=>pk(e))));yield xo(ji.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield xo(ji.setProvisioningState({error:Tg(e),loading:!1}))}}function*vk(e){let{payload:{id:t}}=e,n=to(e.payload,fk);yield xo(ji.setProvisioningState({loading:!0,error:null}));try{yield Bo(rp.directory.updateConfiguration,t,n);const e=yield Bo(rp.directory.getConfigs),i=yield Vo(e.map((e=>pk(e))));yield xo(ji.setProvisioningState({connections:i,loading:!1}))}catch(e){yield xo(ji.setProvisioningState({error:Tg(e),loading:!1}))}}function*hk({payload:{id:e,callback:t}}){yield xo(ji.setProvisioningState({loading:!0,error:null}));try{yield Bo(rp.directory.deleteConfiguration,e);const n=yield Bo(rp.directory.getConfigs),i=yield Vo(n.map((e=>pk(e))));yield xo(ji.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setProvisioningState({error:Tg(e),loading:!1})),null==t||t(!1,e)}}function*mk(){yield xa(ji.loadProvisionConnections,gk),yield Ga(ji.createProvisionConnection,Sk),yield Ga(ji.deleteProvisionConnection,hk),yield Ga(ji.updateProvisionConnection,vk)}const Ak=["callback","events"];function*bk(e){let{payload:{callback:t}}=e,n=to(e.payload,Ak);yield xo(ji.setImpersonateState({loading:!0}));try{yield Bo(rp.impersonate.impersonate,n),yield xo(ji.setImpersonateState({step:Mi.success})),yield Ho(1e3),yield sv(),yield xo(ji.resetImpersonateState()),null==t||t(!0)}catch(e){yield xo(ji.setImpersonateState({loading:!1,error:Tg(e)}))}}function*Tk(){yield xa(ji.impersonate,bk)}function*Ek({payload:e}){const{callback:t,deviceId:n}=e;yield xo(ji.setPasskeysState({loading:!0}));try{yield Bo(rp.auth.deleteWebAuthnDevice,n);const{devices:e}=yield Ko((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield xo(ji.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setPasskeysState({loading:!1,error:Tg(e,null)})),null==t||t(null,e)}}function*kk(){yield xo(ji.setPasskeysState({loading:!0}));try{const{devices:e}=yield Bo(rp.auth.getWebAuthnDevices);yield xo(ji.setPasskeysState({devices:e,loading:!1}))}catch(e){yield xo(ji.setPasskeysState({loading:!1,error:Tg(e,null)}))}}function*Ik(){yield Ga(ji.loadWebAuthnDevices,kk),yield Ga(ji.deleteWebAuthnDevice,Ek)}const Ok=["roleIds","userIds"],Pk=()=>Ko((e=>e.auth.groupsState));function*_k({payload:e}){const t=YA.GET_TEAM_USERS;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Bo(rp.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield xo(ji.setGroupsState({teamUsers:n}))}catch(e){yield xo(ji.setUsersGroupsError({key:t,value:Tg(e)}))}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Lk({payload:e}){const t=YA.GET_GROUP;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Bo(rp.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:XA.rolesAndUsers});yield xo(ji.setGroupsState({selectedGroup:n}))}catch(e){yield xo(ji.setUsersGroupsError({key:t,value:Tg(e)}))}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*wk(){const e=YA.GET_GROUPS,t=yield Pk();yield xo(ji.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Bo(rp.groups.getGroups,{_groupsRelations:XA.rolesAndUsers});yield xo(ji.setGroupsState(D({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield xo(ji.setUsersGroupsError({key:e,value:Tg(t)}))}finally{yield xo(ji.setUsersGroupsLoader({key:e,value:!1}))}}function*Uk({payload:e}){const t=YA.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=to(e,Ok);yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Bo(rp.groups.createGroup,D({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield xo(ji.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield xo(ji.addRolesToGroup({groupId:r.id,roleIds:n}))),yield xo(ji.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield xo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Ck({payload:e}){const t=YA.UPDATE_GROUP;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.updateGroup,e),yield xo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield xo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Rk({payload:e}){const t=YA.DELETE_GROUP;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.deleteGroup,e.groupId),yield xo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield xo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1,n)}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Dk({payload:e}){const t=YA.ADD_ROLES_TO_GROUP;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield xo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield xo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Nk({payload:e}){const t=YA.DELETE_ROLES_FROM_GROUP;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield xo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield xo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Mk({payload:e}){const t=YA.ADD_USERS_TO_GROUP;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield xo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;null==e||null==(i=e.callback)||i.call(e,!1),yield xo(ji.setUsersGroupsError({key:t,value:Tg(n)}))}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Fk({payload:e}){const t=YA.DELETE_USERS_FROM_GROUP;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield xo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield xo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Gk(){const e=YA.GET_GROUP_CONFIGURATION;yield xo(ji.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Bo(rp.groups.getGroupConfiguration);yield xo(ji.setGroupsState({groupsConfiguration:t}))}catch(t){yield xo(ji.setUsersGroupsError({key:e,value:Tg(t)}))}finally{yield xo(ji.setUsersGroupsLoader({key:e,value:!1}))}}function*$k({payload:e}){const t=YA.UPDATE_GROUP_CONFIGURATION;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{yield Bo(rp.groups.updateGroupConfiguration,e),yield xo(ji.getGroupConfiguration())}catch(e){yield xo(ji.setUsersGroupsError({key:t,value:Tg(e)}))}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*xk(){yield $a(ji.loadGroups,wk),yield $a(ji.getGroupById,Lk),yield $a(ji.createGroup,Uk),yield $a(ji.updateGroup,Ck),yield $a(ji.deleteGroup,Rk),yield $a(ji.addRolesToGroup,Dk),yield $a(ji.deleteRolesFromGroup,Nk),yield $a(ji.addUsersToGroup,Mk),yield $a(ji.deleteUsersFromGroup,Fk),yield $a(ji.getGroupConfiguration,Gk),yield $a(ji.updateGroupConfiguration,$k),yield $a(ji.getTeamUsers,_k)}function*Vk(){const e=YA.GET_GROUPS;yield xo(ji.setUsersGroupsLoader({key:e,value:!0}));const t=ag;yield xo(ji.setGroupsState({groups:t})),yield xo(ji.setUsersGroupsLoader({key:e,value:!1}))}function*jk({payload:e}){var t;const n=YA.CREATE_GROUP,{groups:i}=yield Pk();yield xo(ji.setUsersGroupsLoader({key:n,value:!0})),yield xo(ji.setGroupsState({groups:[D({},e,{id:`${e.name}ID`,managedBy:ep.FRONTEGG}),...null!=i?i:[]]})),yield Ho(500),null==e||null==(t=e.callback)||t.call(e,!0),yield xo(ji.setUsersGroupsLoader({key:n,value:!1}))}function*Bk({payload:e}){var t,n,i,o,a;const r=YA.UPDATE_GROUP,s=yield Pk();yield xo(ji.setUsersGroupsLoader({key:r,value:!0})),yield xo(ji.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?D({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:ep.FRONTEGG}):t})),selectedGroup:D({},null==s?void 0:s.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(i=null==e?void 0:e.color)?i:"",description:null!=(o=null==e?void 0:e.description)?o:""})})),yield Ho(500),null==e||null==(a=e.callback)||a.call(e,!0),yield xo(ji.setUsersGroupsLoader({key:r,value:!1}))}function*Wk({payload:e}){var t,n;const i=YA.DELETE_GROUP,o=yield Pk();yield xo(ji.setUsersGroupsLoader({key:i,value:!0})),yield xo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield xo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*zk({payload:e}){var t,n;const i=YA.ADD_ROLES_TO_GROUP,o=yield Pk();yield xo(ji.setUsersGroupsLoader({key:i,value:!0})),yield xo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?D({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield xo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*Kk({payload:e}){var t,n;const i=YA.DELETE_ROLES_FROM_GROUP,o=yield Pk();yield xo(ji.setUsersGroupsLoader({key:i,value:!0})),yield xo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?D({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield xo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*Hk({payload:e}){var t,n;const i=YA.ADD_USERS_TO_GROUP,o=yield Pk();yield xo(ji.setUsersGroupsLoader({key:i,value:!0})),yield xo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?D({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield xo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*qk({payload:e}){var t,n;const i=YA.DELETE_USERS_FROM_GROUP,o=yield Pk();yield xo(ji.setUsersGroupsLoader({key:i,value:!0})),yield xo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?D({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield xo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*Jk(){const e=YA.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield Pk();yield xo(ji.setUsersGroupsLoader({key:e,value:!0})),t&&(yield xo(ji.setGroupsState({groupsConfiguration:D({},t)}))),yield xo(ji.setUsersGroupsLoader({key:e,value:!1}))}function*Yk({payload:e}){const t=YA.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield Pk();yield xo(ji.setUsersGroupsLoader({key:t,value:!0})),n&&(yield xo(ji.setGroupsState({groupsConfiguration:D({},n,e)}))),yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}function*Xk(){yield $a(ji.loadGroups,Vk),yield $a(ji.createGroup,jk),yield $a(ji.updateGroup,Bk),yield $a(ji.deleteGroup,Wk),yield $a(ji.addRolesToGroup,zk),yield $a(ji.deleteRolesFromGroup,Kk),yield $a(ji.addUsersToGroup,Hk),yield $a(ji.deleteUsersFromGroup,qk),yield $a(ji.getGroupConfiguration,Jk),yield $a(ji.updateGroupConfiguration,Yk)}let Qk;!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.SET_ROOT_ACCOUNT_DATA="SET_ROOT_ACCOUNT_DATA",e.SET_SELECTED_SUB_ACCOUNT_DATA="SET_SELECTED_SUB_ACCOUNT_DATA",e.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT="LOAD_NUMBER_OF_USERS_FOR_ACCOUNT",e.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER="UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER",e.CREATE_SUB_ACCOUNT="CREATE_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT="UPDATE_SUB_ACCOUNT",e.DELETE_SUB_ACCOUNT="DELETE_SUB_ACCOUNT",e.GET_ACCOUNT_USERS="GET_ACCOUNT_USERS",e.ADD_USERS_TO_ACCOUNT="ADD_USERS_TO_ACCOUNT",e.DELETE_USERS_FROM_ACCOUNT="DELETE_USERS_FROM_ACCOUNT",e.SET_USER_ROLES_FOR_SUB_ACCOUNT="SET_USER_ROLES_FOR_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT_SETTINGS="UPDATE_SUB_ACCOUNT_SETTINGS",e.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(Qk||(Qk={}));const Zk=(e,t,n)=>{var i,o;return e.tenantId===t?D({},e,{name:n}):D({},e,{children:null!=(i=null==e||null==(o=e.children)?void 0:o.map((e=>Zk(e,t,n))))?i:[]})};function eI(e,t){var n;return D({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>eI(e,t))):[]})}function tI(e,t,n){var i,o;if(e.tenantId===t){var a;const t=[...null!=(a=null==e?void 0:e.children)?a:[],...n].filter(((e,t,n)=>t===n.findIndex((t=>t.tenantId===e.tenantId))));return D({},e,{children:t})}return D({},e,{children:null!=(i=null==e||null==(o=e.children)?void 0:o.map((e=>tI(e,t,n))))?i:[]})}const nI=({items:e},t)=>e.map((e=>{var n,i;return{name:e.name,tenantId:e.tenantId,numberOfUsers:null!=(n=null==(i=t.find((t=>t.tenantId===e.tenantId)))?void 0:i.totalUsers)?n:0,createdAt:e.createdAt,metadata:e.metadata}})),iI=()=>Ko((e=>e.auth.allAccountsState));function*oI({payload:e}){const t=Qk.GET_ACCOUNTS;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield iI(),{jwt:i,_limit:o,_offset:a}=e,r={_offset:null!=a?a:n._offset,_limit:null!=o?o:n._limit,_subTenantId:null==e?void 0:e._subTenantId};try{if(i){var s;const{selectedAccount:t}=yield iI(),{items:n,_links:o}=yield Bo(rp.tenants.searchSubTenants,r,{jwt:i}),a=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:i}),l=nI({items:n},a),c=tI(t.accounts?t.accounts:t,null!=(s=null==e?void 0:e._subTenantId)?s:"",l.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==o?void 0:o.next}))));yield xo(ji.setSelectedAccountState({accounts:c}))}else{var l;const{accounts:t}=yield iI(),{items:n,_links:i}=yield Bo(rp.tenants.searchSubTenants,r),o=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=nI({items:n},o),s=tI(t,null!=(l=null==e?void 0:e._subTenantId)?l:"",a.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==i?void 0:i.next}))));yield xo(ji.setAllAccountsState({accounts:s}))}}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*aI({payload:e}){const t=Qk.SEARCH_ACCOUNTS;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield iI(),{jwt:i}=e;try{if(null!=e&&e._subTenantId){var o;const{items:t}=yield Bo(rp.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(o=null==e?void 0:e._filter)?o:"",_subTenantId:e._subTenantId},{jwt:i});yield xo(ji.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*rI({payload:e}){const t=Qk.GET_USER_JWT;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:i}=e;try{const e=yield Bo(rp.users.GetUserJwt,{tenantId:n});yield xo(ji.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==i||i(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),yield xo(ji.setSelectedAccountState({accessPermission:!1})),null==i||i(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*sI({payload:e}){const t=Qk.CREATE_SUB_ACCOUNT;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:i,tenantId:o,jwt:a,callback:r}=e;try{if(a){const{accounts:e}=yield iI(),{selectedAccount:t}=yield iI(),r=yield Bo(rp.subTenants.createSubTenant,{name:n,parentTenantId:i,tenantId:o},{jwt:a}),s=tI(e,null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),l=tI(D({name:"",tenantId:""},null==t?void 0:t.accounts),null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield xo(ji.setAllAccountsState({accounts:s})),yield xo(ji.setSelectedAccountState({accounts:l}))}else{const{accounts:e}=yield iI(),t=yield Bo(rp.subTenants.createSubTenant,{name:n,tenantId:o,parentTenantId:i}),a=tI(e,null!=i?i:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield xo(ji.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==r||r(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*lI({payload:e}){const t=Qk.DELETE_SUB_ACCOUNT;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:i,callback:o}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield iI();yield Bo(rp.subTenants.deleteSubTenant,i,{jwt:n});const o=eI(t,i),a=eI(null==e?void 0:e.accounts,i);yield xo(ji.setAllAccountsState({accounts:o})),yield xo(ji.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield iI();yield Bo(rp.subTenants.deleteSubTenant,i);const t=eI(e,i);yield xo(ji.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==o||o(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*cI({payload:e}){const t=Qk.UPDATE_SUB_ACCOUNT_SETTINGS;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:i,callback:o,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield iI();yield Bo(rp.subTenants.updateSubTenant,{tenantId:a},{name:i},{jwt:n});const o=Zk(e.accounts,a,i);yield xo(ji.setSelectedAccountState({name:i,accounts:o}));const r=Zk(t,a,i);yield xo(ji.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield iI();yield Bo(rp.subTenants.updateSubTenant,{tenantId:a},{name:i});const t=Zk(e,a,i);yield xo(ji.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==o||o(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*uI({payload:e}){const t=Qk.DELETE_USERS_FROM_ACCOUNT;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:i,jwt:o,callback:a}=e;try{yield Bo(rp.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:i},{jwt:o}),yield xo(ji.getAccountUsers({jwt:o,_tenantId:i[0].tenantId})),null==a||a(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==a||a(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*dI({payload:e}){const t=Qk.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:i,jwt:o,callback:a}=e,{selectedAccount:r}=yield iI();try{yield Bo(rp.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:i},{jwt:o}),yield xo(ji.getAccountUsers({jwt:o,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==a||a(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*yI({payload:e}){const t=Qk.ADD_USERS_TO_ACCOUNT;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:i,jwt:o,callback:a,allowSubAccountAccess:r=!1,roleIds:s}=e;try{yield Bo(rp.subTenants.addUsersToSubTenant,{users:n,tenantId:i,allowSubAccountAccess:r,roleIds:s},{jwt:o}),yield xo(ji.getAccountUsers({jwt:o,_tenantId:i})),null==a||a(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==a||a(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*fI({payload:e}){const t=Qk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield iI(),{userId:i,allowAccess:o,jwt:a,callback:r}=e;try{var s;yield Bo(rp.subTenants.updateSubAccountAccess,i,{allowAccess:o},{jwt:a}),yield xo(ji.setSelectedAccountState({users:null==n||null==(s=n.users)?void 0:s.map((e=>e.id===i?D({},e,{subAccountAccessAllowed:o}):e))})),null==r||r(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==r||r(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*pI({payload:e}){var t,n,i,o,a,r,s,l;const c=Qk.GET_ACCOUNT_USERS;yield xo(ji.setAllAccountsLoader({key:c,value:!0}));const u=yield iI(),{jwt:d,_tenantId:y,_email:f}=e,p=null!=(t=null!=(n=null==e?void 0:e._offset)?n:null==u||null==(i=u.selectedAccount)||null==(o=i.usersQueryParams)?void 0:o._offset)?t:0,g=null!=(a=null!=(r=null==e?void 0:e._limit)?r:null==u||null==(s=u.selectedAccount)||null==(l=s.usersQueryParams)?void 0:l._limit)?a:10,S=D({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield Bo(rp.users.getUsersV3,S,{jwt:d}),i={totalUsersItems:t,totalUsersPages:n,usersQueryParams:D({_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 Bo(rp.roles.getRoles),o=yield Bo(rp.users.getUsersRoles,{ids:t},{jwt:d}),a=e.map((e=>{var t,i;const a=null==o||null==(t=o.find((t=>t.userId===e.id)))?void 0:t.roleIds;return D({},e,{roles:null!=(i=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?i:[]})}));yield xo(ji.setSelectedAccountState(D({users:a},i)))}else yield xo(ji.setSelectedAccountState(D({users:[]},i)))}catch(e){yield xo(ji.setAllAccountsError({key:c,value:Tg(e)}))}finally{yield xo(ji.setAllAccountsLoader({key:c,value:!1}))}}function*gI({payload:e}){const t=Qk.SET_SELECTED_SUB_ACCOUNT_DATA;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var i,o,a,r,s,l,c;const e=yield Bo(rp.accountSettings.getSettings,{jwt:n}),u=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n}),d=yield Bo(rp.tenants.getParentTenants,{jwt:n}),y=yield Bo(rp.tenants.getHierarchyMetadata,{_tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n});yield xo(ji.setSelectedAccountState({tenantId:null!=(a=e.tenantId)?a:"",name:e.name,numberOfUsersObject:u[0],parentsAccounts:d,numberOfSubAccounts:null==(r=y[0])?void 0:r.totalSubTenants,accountSettings:e,accounts:{name:e.name,tenantId:null!=(s=e.tenantId)?s:"",numberOfUsers:null==(l=u[0])?void 0:l.totalUsers,createdAt:void 0,children:[]}})),yield xo(ji.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*SI(){const e=Qk.SET_ROOT_ACCOUNT_DATA;yield xo(ji.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield Ko((e=>e.auth.tenantsState)),{accounts:n}=yield iI();if(t)try{var i;const o=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:[null==t?void 0:t.tenantId]}),a={name:null==t?void 0:t.name,tenantId:null==t?void 0:t.tenantId,numberOfUsers:null==(i=o[0])?void 0:i.totalUsers,createdAt:null==t?void 0:t.createdAt};yield xo(ji.setAllAccountsState({rootAccount:a,accounts:D({},n,a)}))}catch(t){yield xo(ji.setAllAccountsError({key:e,value:Tg(t)}))}finally{yield xo(ji.setAllAccountsLoader({key:e,value:!1}))}}function*vI({payload:e}){const t=Qk.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:i}=e;try{const e=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:i});yield xo(ji.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*hI(){yield $a(ji.loadAccounts,oI),yield $a(ji.searchAccounts,aI),yield $a(ji.updateSubAccountAccessForUser,fI),yield $a(ji.getUserJwtForSubAccount,rI),yield $a(ji.createSubAccount,sI),yield $a(ji.deleteSubAccount,lI),yield $a(ji.updateSubAccountSettings,cI),yield $a(ji.addUsersToAccount,yI),yield $a(ji.deleteUsersFromAccount,uI),yield $a(ji.setUserRolesForSubAccount,dI),yield $a(ji.getAccountUsers,pI),yield $a(ji.setRootAccountData,SI),yield $a(ji.setSelectedSubAccountData,gI),yield $a(ji.loadNumberOfUsersForSelectedSubAccount,vI)}const mI=["callback"],AI=["callback"],bI=["callback","phoneId"],TI=["callback","phoneId"],EI=["callback"];function*kI(){yield xo(ji.setSmsState({loading:!0}));const e={_limit:10,_offset:0};try{const{items:t}=yield Bo(rp.userPhoneNumbers.getUserPhoneNumbers,e);yield xo(ji.setSmsState({phoneNumbers:t}))}catch(e){yield xo(ji.setSmsState({error:Tg(e)}))}finally{yield xo(ji.setSmsState({loading:!1}))}}function*II(e){let{payload:{callback:t}}=e,n=to(e.payload,mI);yield xo(ji.setSmsState({loading:!0}));try{const e=yield Bo(rp.userPhoneNumbers.createPhoneNumber,n);yield xo(ji.setSmsState({otcToken:e.otcToken})),yield Bo(kI),null==t||t(!0)}catch(e){yield xo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSmsState({loading:!1}))}}function*OI(e){let{payload:{callback:t}}=e,n=to(e.payload,AI);yield xo(ji.setSmsState({loading:!0}));try{yield Bo(rp.userPhoneNumbers.verifyPhoneNumber,n),yield Bo(kI),null==t||t(!0)}catch(e){yield xo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSmsState({loading:!1}))}}function*PI(e){let{payload:{callback:t,phoneId:n}}=e;to(e.payload,bI),yield xo(ji.setSmsState({loading:!0}));try{const e=yield Bo(rp.userPhoneNumbers.deletePhoneNumber,n);yield xo(ji.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield xo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSmsState({loading:!1}))}}function*_I(e){let{payload:{callback:t,phoneId:n}}=e,i=to(e.payload,TI);yield xo(ji.setSmsState({loading:!0}));try{yield Bo(rp.userPhoneNumbers.verifyDeletePhoneNumber,n,i),yield Bo(kI),null==t||t(!0)}catch(e){yield xo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSmsState({loading:!1}))}}function*LI(e){let{payload:{callback:t}}=e,n=to(e.payload,EI);yield xo(ji.setSmsState({loading:!0}));try{const e=yield Bo(rp.userPhoneNumbers.preVerifyPhoneNumber,n);yield xo(ji.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield xo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSmsState({loading:!1}))}}function*wI(){yield Ga(ji.loadPhoneNumbers,kI),yield Ga(ji.setUpPhoneNumber,II),yield Ga(ji.verifyPhoneNumber,OI),yield Ga(ji.deletePhoneNumber,PI),yield Ga(ji.verifyDeletePhoneNumber,_I),yield Ga(ji.preVerifyPhoneNumber,LI)}function*UI(e){yield Bo(ZS,e),yield Bo(lv)}function*CI({mfaToken:e,mfaDevices:t}){yield xo(ji.setStepUpState({mfaDevices:t,mfaToken:e}));const n=yield Bo(mg,t);yield xo(ji.setMfaState({step:n}))}function*RI(e){if((e=>"MFA is not enrolled"===(null==e?void 0:e.message))(e))return void(yield xo(ji.setMfaState({step:un.noMFAEnrolledStepUp})));window.localStorage.setItem(nv,"true");const{routes:t}=yield Ko((e=>e.auth));Va.onRedirectTo(t.logoutUrl,{preserveQueryParams:!0})}function*DI({payload:{maxAge:e,callback:t}}){yield xo(ji.setStepUpState({mfaDevices:void 0,mfaToken:""}));try{const n=yield Bo(rp.auth.generateStepupSession,{maxAge:e});n.user?yield Bo(UI,n):yield Bo(CI,n),null==t||t(!0)}catch(e){null==t||t(!1),yield Bo(RI,e)}}function*NI({payload:e}){const t={acr_values:ev},{maxAge:n}=e||{};void 0!==n&&(t.max_age=n.toString());const i=yield Ko((({auth:e})=>{var t,n;return null==(t=e.tenantsState)||null==(n=t.activeTenant)?void 0:n.alias}));i&&(t.organization=i),ov(),window.localStorage.setItem(nv,"true"),yield gh(t)}function*MI({payload:e}){yield fv(e,ji.setStepUpState,!0)}function*FI({payload:e}){yield Ov(e,ji.setStepUpState)}function*GI({payload:e}){yield Pv(e,ji.setStepUpState,!0)}function*$I({payload:e}){yield Av(e,ji.setStepUpState)}function*xI({payload:e}){yield bv(e,ji.setStepUpState,!0)}function*VI({payload:e}){yield Rv(e,ji.setStepUpState)}function*jI({payload:e}){yield Cv(e,ji.setStepUpState)}function*BI(){yield xa(ji.stepUpHostedLogin,NI),yield xa(ji.generateStepUpSession,DI),yield xa(ji.stepUpWithAuthenticator,MI),yield xa(ji.preVerifyMFASMSForStepUp,$I),yield xa(ji.verifyMFASMSForStepUp,xI),yield xa(ji.preVerifyMFAWebAuthnForStepUp,FI),yield xa(ji.verifyMFAWebAuthnForStepUp,GI),yield xa(ji.verifyMFAEmailCodeForStepUp,VI),yield xa(ji.preVerifyMFAEmailCodeForStepUp,jI)}var WI={sagas:function*(){yield Vo([Bo(Vh),Bo(BI),Bo($A),Bo(VA),Bo(LA),Bo(gE),Bo(im),Bo(Um),Bo(Fm),Bo(Ug),Bo(gA),Bo(Xb),Bo(xk),Bo(AT),Bo(GS),Bo(LT),Bo(mS),Bo(GT),Bo(KT),Bo(rE),Bo(bE),Bo(wE),Bo(tk),Bo(mk),Bo(Tk),Bo(Ik),Bo(hI),Bo(YS),Bo(Bg),Bo(wI)])},mockSagas:function*(){yield Vo([Bo(Wh),Bo(um),Bo(Vm),Bo(kA),Bo(yT),Bo(NT),Bo(CS),Bo(IE),Bo(VT),Bo(qT),Bo(RE),Bo(dk),Bo(lE),Bo(Xk),Bo(Yg)])},storeName:Dt,initialState:Ni,reducer:xi,actions:ji};const zI=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>D({},t,{[e]:D({},t[e],n)})}),KI={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},HI={setAuditLogsState:zI("auditLogsState"),resetAuditLogsState:e=>D({},e,{auditLogsState:KI})},qI={exportAuditsCsv:yt("auditLogs/exportAuditsCsv"),loadAuditLogs:yt("auditLogs/loadAuditLogs",(e=>({payload:e})))},JI={loading:!0},YI={setAuditsMetadataState:zI("auditsMetadataState"),resetAuditsMetadataState:e=>D({},e,{auditsMetadataState:JI})},XI={loadAuditsMetadata:yt("auditLogs/loadAuditsMetadata")},QI={auditLogsState:KI,auditsMetadataState:JI},{reducer:ZI,actions:eO}=pt({name:Mt,initialState:QI,reducers:D({resetState:e=>D({},e,QI),setState:(e,{payload:t})=>D({},e,t)},HI,YI)}),tO=D({},eO,qI,XI),nO=e=>"createdAt"!==e.id,iO={total:20,data:Array.from(Array(5).keys()).map((e=>D({ip:"198.143.51.1",user:"Demo User Name",email:"demo-user@frontegg.com"},(()=>{switch(Math.floor(6*Math.random())){case 0:return{action:"Updated profile",description:"User updated profile details",severity:"Info"};case 1:return{action:"User logged in",severity:"Info",description:"User logged in to the product"};case 2:return{action:"User failed to login",severity:"High",description:"User failed to login with password"};case 3:return{action:"Added user",severity:"Info",description:"Added user david+535@frontegg.com to tenant"};case 4:return{action:"Assigned roles",severity:"Info",description:"Assigned 0 roles for user"};case 5:return{action:"Removed user david+108@frontegg.com from account",severity:"Info",description:"Removed access from the account for user david+108@frontegg.com"}}})(),{json:{key1:"value1",key2:"value2",key3:"value3",key4:"value4"},tenantId:"my-tenant-id",vendorId:"my-vendor-id",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",createdAt:`2022-04-07 10:${50-e}:40.201`})))},oO={properties:[{showInTable:!0,name:"createdAt",displayName:"Time",type:"Timestamp",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!1},{showInTable:!0,name:"email",displayName:"User",type:"Email",filterable:!0,sortable:!0,isPredefined:!0,chosen:!1,selected:!1},{showInTable:!0,name:"action",displayName:"Action",type:"AlphaNumeric",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!0,name:"description",type:"AlphaNumeric",sortable:!1,filterable:!1,displayName:"Description",isPredefined:!0,chosen:!1,selected:!1},{showInTable:!0,name:"ip",displayName:"IP Address",type:"IpAddress",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!1,name:"severity",displayName:"Severity",type:"Severity",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!1,name:"userAgent",displayName:"User Agent",type:"AlphaNumeric",filterable:!0,sortable:!0,isPredefined:!0,chosen:!1,selected:!1},{showInTable:!1,name:"json",type:"Json",sortable:!0,filterable:!0,displayName:"Json Data",showInMoreInfo:"Always",isPredefined:!1}]},aO=()=>Ko((e=>e.auditLogs.auditLogsState)),rO=()=>Ko((e=>e.auditLogs.auditsMetadataState));function*sO(){const e=yield aO(),{columns:t}=yield rO();try{const n=e.filter,i=e.sort.reduce(((e,t)=>D({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>D({},e,{[t.id]:t.value})),{});yield xo(tO.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield rp.audits.exportAudits(D({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield xo(tO.setAuditLogsState({isDownloadingCsv:!1}))}function*lO({payload:e}){yield xo(tO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield aO(),{columns:n}=yield rO();try{var i,o,a,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield xo(tO.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>D({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>D({},e,{[t.id]:t.value})),{});n||(yield xo(tO.loadAuditsMetadata()));const{data:p,total:g}=yield Bo(rp.audits.getAudits,D({offset:c,count:l},y,f));yield xo(tO.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield xo(tO.setAuditLogsState({loading:!1,error:Tg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*cO(){yield Ga(tO.exportAuditsCsv,sO),yield Ga(tO.loadAuditLogs,lO)}function*uO({payload:e}){yield xo(tO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield aO(),{columns:n}=yield rO();try{var i,o,a,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield xo(tO.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield xo(tO.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=iO;let i=n.filter((e=>t=>e.filter(nO).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];i=i.sort(((e,t)=>(n,i)=>n[e]>i[e]?t?-1:1:i[e]>n[e]?t?1:-1:0)(e,n))}return{data:i,total:i.length}})(u,d);yield xo(tO.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield xo(tO.setAuditLogsState({loading:!1,error:Tg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*dO(){yield Ga(tO.loadAuditLogs,uO)}function*yO(){yield xo(tO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Bo(rp.metadata.getAuditsMetadata);yield xo(tO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield xo(tO.setAuditsMetadataState({error:e,loading:!1}))}}function*fO(){yield Ga(tO.loadAuditsMetadata,yO)}function*pO(){yield xo(tO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=oO;yield xo(tO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield xo(tO.setAuditsMetadataState({error:e,loading:!1}))}}function*gO(){yield Ga(tO.loadAuditsMetadata,pO)}var SO={sagas:function*(){yield Vo([Bo(cO),Bo(fO)])},mockSagas:function*(){yield Vo([Bo(dO),Bo(gO)])},storeName:Mt,initialState:QI,reducer:ZI,actions:tO};const vO={total:0,offset:0,filter:"",sortBy:"createdAt",context:null,filters:[],rowsData:[],lastUpdated:new Date,isLoading:!0,isFetchMore:!1,totalToday:0,currentPage:0,headerProps:[],sortDirection:"desc",severeThisWeek:0,predefinedFilters:[],isDownloadingCsv:!1,virtualScroll:!1},{name:hO,actions:mO,reducer:AO}=pt({name:"audits",initialState:vO,reducers:{setContext:(e,{payload:t})=>{e.context=t},startLoading:e=>{e.isLoading=!0},setVirtualScroll:(e,{payload:t})=>{e.virtualScroll=t},startRefresh:e=>{e.isLoading=!0},startFetching:e=>{e.isFetchMore=!0},finishLoading:e=>{e.isLoading=!1},startDownloadingCsv:e=>{e.isDownloadingCsv=!0},stopDownloadingCsv:e=>{e.isDownloadingCsv=!1},loadStatsSuccess:(e,{payload:t})=>{e.error=void 0,e.totalToday=t.totalToday,e.severeThisWeek=t.severeThisWeek},loadItemFailedAction:(e,{payload:t})=>{e.error=D({},e.error,{[t.name]:t.error})},loadMetadataSuccess:(e,{payload:t})=>{e.error={},e.headerProps=t.properties,e.themeAudits=t.theme?t.theme.styles:{}},loadAuditsSuccess:(e,{payload:t})=>{e.error={},e.rowsData=t.rowsData,e.lastUpdated=new Date,e.total=t.total},fetchMoreSuccess:(e,{payload:t})=>{e.error={},e.offset=t.offset,e.currentPage=t.currentPage,e.isFetchMore=!1},setFilterData:(e,{payload:t})=>{e.filters=t,e.currentPage=0,e.offset=0,e.isLoading=!0},textSearch:(e,{payload:t})=>{e.filter=t,e.currentPage=0,e.offset=0,e.isLoading=!0},onPageChange:(e,{payload:t})=>{e.currentPage=t-1,e.offset=20*e.currentPage,e.isLoading=!0},setDataSorting:(e,{payload:t})=>{e.sortBy=t.sortBy,e.currentPage=0,e.sortDirection="asc"===t.sortDirection?"desc":"asc",e.offset=0,e.isLoading=!0},setPredefinedFilters:(e,{payload:t})=>{e.predefinedFilters=t,e.filters=Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),bO=D({},mO,{initData:yt(`${hO}/initData`),loadAudits:yt(`${hO}/loadAudits`),removeFilter:yt(`${hO}/removeFilter`),filterData:yt(`${hO}/filterData`),exportCSV:yt(`${hO}/exportCSV`),deleteAudits:yt(`${hO}/deleteAudits`)}),TO=()=>Ko((e=>e[hO]));function*EO(){const{sortBy:e,sortDirection:t}=yield TO();try{const n=yield Bo(rp.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield xo(bO.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield xo(bO.loadItemFailedAction(t))}}function*kO(){try{const e=yield Bo(rp.metadata.getAuditsMetadata);yield xo(bO.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield xo(bO.loadItemFailedAction(t))}}const IO=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*OO({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield TO(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield TO():{rowsData:[]};try{const e=IO(t),{data:s,total:d}=yield Bo(rp.audits.getAudits,D({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield xo(bO.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield xo(bO.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield xo(bO.loadItemFailedAction(t))}}function*PO(){yield xo(bO.startLoading()),yield Vo([EO(),kO(),OO({payload:{onlyOneLoad:!1},type:""})]),yield xo(bO.finishLoading())}function*_O({payload:e}){const{filters:t}=yield TO(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield xo(bO.setFilterData(i))}function*LO({payload:e}){const{filters:t}=yield TO();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const i=[...t.slice(0,n),e,...t.slice(n+1)];yield xo(bO.setFilterData(i))}function*wO(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield TO(),a=IO(e);yield xo(bO.startDownloadingCsv());try{yield rp.audits.exportAudits(D({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield xo(bO.stopDownloadingCsv())}}function*UO(){yield $a(bO.initData,PO),yield $a(bO.removeFilter,_O),yield $a(bO.filterData,LO),yield $a([bO.loadAudits,bO.textSearch,bO.onPageChange],OO),yield $a([bO.setFilterData,bO.setDataSorting,bO.startRefresh],(()=>OO({payload:{appendMode:!1},type:""}))),yield $a(bO.exportCSV,wO)}const CO={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},RO={initData:()=>D({},CO),setConnectivityState:(e,{payload:t})=>D({},e,t),cleanWebhookTestData:e=>D({},e,{testResult:void 0}),cleanWebhookLogsData:e=>D({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return D({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>D({},e,{error:void 0}),cleanSlackData:e=>D({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>D({},e,{retryResult:D({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>D({},e,{retryResult:D({},e.retryResult,t)})}},DO={loadSlackActions:yt("connectivity/loadSlackActions"),loadDataAction:yt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:yt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:yt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:yt("connectivity/loadScope"),deleteWebhookConfigAction:yt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:yt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:yt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},NO={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:MO,actions:FO}=pt({name:Nt,initialState:NO,reducers:D({},RO)}),GO=D({},FO,DO),$O={slack:rp.connectivity.getSlackConfiguration,email:rp.connectivity.getEmailConfiguration,sms:rp.connectivity.getSMSConfiguration,webhook:rp.connectivity.getWebhooksConfigurations,categories:rp.connectivity.getCategories,channelMap:rp.connectivity.getChannelMaps},xO={slack:rp.connectivity.postSlackConfiguration,email:rp.connectivity.postEmailConfiguration,sms:rp.connectivity.postSMSConfiguration,webhook:rp.connectivity.postWebhooksConfiguration},VO=["email","slack","sms","webhook"],jO={sms:{title:"connectivity.sms",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({enabled:e})=>e)))&&t},image:"sms"},email:{title:"common.email",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({enabled:e})=>e)))&&t},image:"email"},slack:{title:"connectivity.slack",events:e=>{var t;return(null==e||null==(t=e.slackSubscriptions)?void 0:t.length)||0},isActive:e=>{var t;return null!=(t=!(null==e||!e.slackSubscriptions.some((({isActive:e})=>e))))&&t},image:"slack"},webhook:{title:"connectivity.webhook",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({isActive:e})=>e)))&&t},image:"webhook"}},BO=["id"],WO=["id","enabled"],zO=["categories","channelMap"];function*KO(e){return yield Bo(qO,{payload:{api:e},type:""})}function*HO({payload:e=VO}){yield xo(GO.setConnectivityState({isLoading:!0}));try{const t=yield Vo([...e.map(KO),yield qO({payload:{api:"categories"},type:""}),yield function*(){return(yield Vo(e.map((function*(e){return yield qO({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>D({},t,{[`${e[i]}`]:n})),{})}()]),n=yield qO({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?D({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:jO[e[o]].events(i),active:jO[e[o]].isActive(i),platform:jO[e[o]].title,image:jO[e[o]].image}]}):n:D({},n,{[`${zO[o-e.length]}`]:i})),{list:[],webhook:n});yield xo(GO.setConnectivityState(D({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield xo(GO.setConnectivityState({isLoading:!1}))}}function*qO({payload:{api:e,params:t}}){try{return yield Bo($O[e],t)}catch(e){return}}function*JO(){try{yield xo(GO.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Bo(rp.connectivity.getSlackChannels);yield xo(GO.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield xo(GO.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*YO(e,t){const{connectivity:{list:n}}=yield Ko(),i=n.find((({key:t})=>t===e));if(!i)return;const o=jO[e].isActive(t);o!==i.active&&(yield xo(GO.setConnectivityState({list:n.map((t=>t.key===e?D({},t,{active:o}):t))})))}function*XO({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield Ko((e=>e.connectivity));try{if(yield xo(GO.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Ko();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield Vo([...i.reduce(((e,t)=>{var i,o;return!t.id&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length||(null==n?void 0:n.find((e=>{let{id:n}=e,i=to(e,BO);return n===t.id&&JSON.stringify(D({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield Bo(xO.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Bo(rp.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Ko(),{processIds:i}=yield Ko((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield Vo([...e.reduce(((e,t)=>!o.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield Bo("email"===t?rp.connectivity.postEmailConfiguration:rp.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:i}=e,o=n[0],{id:a="",enabled:r}=o,s=to(o,WO);return yield Vo([yield Bo("email"===t?rp.connectivity.patchEmailConfiguration:rp.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield Bo("email"===t?rp.connectivity.putEmailSubscriptions:rp.connectivity.putSMSSubscriptions,a,i,D({},s,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return Bo("email"===t?rp.connectivity.deleteEmailSubscriptions:rp.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield qO({payload:{api:t},type:""});yield xo(GO.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield YO(t,e)}else yield xo(GO.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield Bo(xO[e],t),!["sms","email"].includes(e)){const o=yield qO({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield xo(GO.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield YO(e,o),null==n||n(!0)}}catch(e){yield xo(GO.setConnectivityState({error:Tg(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*QO({payload:e}){try{yield rp.connectivity.postSlackCode(e)}catch{}yield xo(GO.setConnectivityState({error:void 0,isSaving:!1}))}function*ZO(){const{slackChannels:e}=yield Ko((e=>e.connectivity));try{yield xo(GO.setConnectivityState({slackChannels:D({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Bo(rp.connectivity.getSlackScope);yield xo(GO.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield xo(GO.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*eP({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield Ko((e=>e.connectivity));try{yield xo(GO.setConnectivityState({isSaving:!0})),yield Bo(rp.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,Tg(e))}const o=yield qO({payload:{api:"webhook"},type:""});o&&(yield xo(GO.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*tP({payload:e}){try{yield xo(GO.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Bo(rp.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield xo(GO.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield xo(GO.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield xo(GO.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*nP({payload:e}){try{const{statusCode:t}=yield Bo(rp.connectivity.postWebhookRetry,e);yield xo(GO.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield xo(GO.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*iP({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield Ko((e=>e.connectivity));try{yield xo(GO.setConnectivityState({webhookLogs:D({},i,{isLoading:!0})}));const o=yield Bo(rp.connectivity.getWebhookLog,e,n,t);yield xo(GO.setConnectivityState({error:void 0,webhookLogs:D({isLoading:!1},o)}))}catch(e){yield xo(GO.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var oP={sagas:function*(){yield Ga(GO.loadDataAction,HO),yield $a(GO.loadSlackActions,JO),yield Ga(GO.postDataAction,XO),yield Ga(GO.postCodeAction,QO),yield Ga(GO.loadScope,ZO),yield Ga(GO.deleteWebhookConfigAction,eP),yield Ga(GO.postWebhookTestAction,tP),yield Ga(GO.postWebhookRetryAction,nP),yield $a(GO.loadWebhookLogsAction,iP)},storeName:Nt,initialState:NO,reducer:MO,actions:GO};function aP(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,t.payload)}}}function rP(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>D({},n,{[e]:t(n[e],i)})}}function sP(e){return rP(e,((e,t)=>D({},e,{loading:t.payload})))}function lP(e){return rP(e,((e,t)=>D({},e,{error:t.payload,loading:!1})))}const cP={loading:!1,error:null,fetching:!0,plans:[]},{actions:uP,reducer:dP,name:yP}=pt({name:"subscriptions/plans",initialState:cP,reducers:D({},aP())}),fP=D({loadPlans:yt(`${yP}/loadPlans`)},uP),pP={loading:!1,error:null,fetching:!0,config:null},gP=D({},aP()),{actions:SP,reducer:vP,name:hP}=pt({name:"subscriptions/config",initialState:pP,reducers:gP}),mP=D({loadPaymentConfiguration:yt(`${hP}/loadPaymentConfiguration`)},SP),AP={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},bP=D({},aP(),{setCancellationLoading:sP("cancellation"),setCancellationError:lP("cancellation"),setRenewalLoading:sP("renewal"),setRenewalError:lP("renewal")}),{reducer:TP,actions:EP,name:kP}=pt({name:"subscriptions/billing/subscription",initialState:AP,reducers:bP}),IP=D({load:yt(`${kP}/loadSubscription`),cancelSubscription:yt(`${kP}/cancelSubscription`),renewSubscription:yt(`${kP}/renewSubscription`)},EP),OP={loading:!1,error:null,fetching:!0},PP=D({},aP()),{reducer:_P,actions:LP,name:wP}=pt({name:"subscriptions/billing/information",initialState:OP,reducers:PP}),UP=D({loadBillingInformation:yt(`${wP}/loadBillingInformation`),cancelSubscription:IP.cancelSubscription,renewSubscription:IP.renewSubscription},LP),CP={loading:!1,error:null,fetching:!0},RP=D({},aP(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,t.payload)}}),{reducer:DP,actions:NP,name:MP}=pt({name:"subscriptions/billing/payment",initialState:CP,reducers:RP}),FP=D({loadPaymentMethod:yt(`${MP}/loadPaymentMethod`),submitPaymentMethod:yt(`${MP}/submitPaymentMethod`),submitPaymentMethodError:yt(`${MP}/submitPaymentMethodError`),submitPaymentMethodSuccess:yt(`${MP}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:yt(`${MP}/updateBillingDetails`,(e=>({payload:e})))},NP),GP={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},$P=D({},aP(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,{invoiceDownload:D({},e.invoiceDownload,t.payload)})}}),{reducer:xP,actions:VP,name:jP}=pt({name:"subscriptions/billing/invoices",initialState:GP,reducers:$P}),BP=D({loadInvoices:yt(`${jP}/loadInvoices`),downloadInvoice:yt(`${jP}/downloadInvoice`,(e=>({payload:e})))},VP),WP={information:OP,invoices:GP,paymentMethod:CP,subscription:AP},zP={invoices:BP,information:UP,paymentMethod:FP,subscription:IP},KP=Ke({invoices:xP,information:_P,paymentMethod:DP,subscription:TP}),HP={fetching:!0,loading:!1,error:null,confirmed:!1},qP=D({},aP()),{actions:JP,reducer:YP,name:XP}=pt({name:"subscriptions/checkout",initialState:HP,reducers:qP}),QP=D({loadCheckout:yt(`${XP}/loadCheckout`),resetCheckout:yt(`${XP}/resetCheckout`),submitCheckout:yt(`${XP}/submitCheckout`),confirmCheckout:yt(`${XP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:yt(`${XP}/errorCheckout`,(e=>({payload:e})))},JP),ZP={loading:!1,error:null,cardSetupIntentSecret:null},e_=D({},aP()),{reducer:t_,actions:n_,name:i_}=pt({name:"subscriptions/stripe",initialState:ZP,reducers:e_}),o_=D({loadCustomer:yt(`${i_}/loadCustomer`),createCardSetupIntentSecret:yt(`${i_}/createCardSetupIntentSecret`)},n_),a_={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:r_,reducer:s_,name:l_}=pt({name:"subscriptions/vendorPublicConfig",initialState:a_,reducers:D({},aP())}),c_=D({loadVendorPublicConfiguration:yt(`${l_}/loadVendorPublicConfiguration`)},r_),u_={config:pP,plans:cP,checkout:HP,billing:WP,stripe:ZP,vendorPublicConfig:a_},d_={config:mP,billing:zP,plans:fP,checkout:QP,stripe:o_,vendorPublicConfig:c_},y_=Ke({config:vP,billing:KP,plans:dP,checkout:YP,stripe:t_,vendorPublicConfig:s_});let f_,p_,g_;function S_({policy:e}){return{policy:g_.AT_PERIOD_END}}function v_(e){switch(e){case Xy.ACTIVE:return p_.ACTIVE;case Xy.INCOMPLETE:return p_.INCOMPLETE;case Xy.CANCELED:return p_.CANCELED;case Xy.EXPIRED:return p_.EXPIRED;case Xy.TRIALING:return p_.TRIALING;default:return p_.EXPIRED}}!function(e){e.STRIPE="Stripe"}(f_||(f_={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(p_||(p_={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(g_||(g_={}));const h_={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Xy.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},m_=[{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"}],A_=[{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:""}],b_=[{id:"id",externalId:"externalId",type:Qy.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],T_={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*E_(){yield xo(IP.setLoading(!0));try{const[e]=yield Bo(rp.subscriptions.getManagedSubscriptions);yield xo(IP.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield xo(IP.setError(e))}}function*k_(){yield Ga(UP.loadBillingInformation,I_)}function*I_(){yield function*(e){const t=yield Ko((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Ko((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield O_(n,!1):yield xo(UP.setError(t?"Not authorized":"Internal feature failure"))}()}function*O_(e,t){yield xo(UP.setLoading(!0));try{var n,i;const o=yield Bo(rp.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield Bo(rp.subscriptions.getSubscriptionPlan,a):([,s]=yield Vo([Bo(E_),Bo(rp.subscriptions.getSubscriptionPlan,a)]),l=yield Ko((e=>e.subscriptions.billing.subscription.subscription||null))),yield xo(UP.setState(D({loading:!1,fetching:!1,summary:o},l?{subscription:{id:l.id,externalId:l.externalId,startDate:l.startDate,currentPeriodStart:l.currentPeriodStart,currentPeriodEnd:l.currentPeriodEnd,status:t?p_.ACTIVE:v_(l.status),cancellation:l.cancellation&&S_(l.cancellation),trialEnd:l.trialEnd?l.trialEnd:null}}:{},s?{plan:{id:s.id,name:s.name,description:s.description,price:(null==(n=s.price)?void 0:n.amount)||0,currency:(null==(i=s.price)?void 0:i.currency)||"usd",recurringInterval:"month",slug:s.slug}}:{})))}catch(e){yield xo(UP.setError(Tg(e)))}}function*P_(){yield function*(){var e,t;yield xo(UP.setLoading(!0)),yield Ho(500),yield xo(UP.setState({loading:!1,fetching:!1,summary:{subscriptionId:h_.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:ef.Stripe,externallyManaged:!1,currentPlanId:m_[0].id,defaultPlanId:m_[0].id},plan:D({},m_[0],{price:null==(e=m_[0].price)?void 0:e.amount,currency:null==(t=m_[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*__(){yield Ga(UP.loadBillingInformation,P_)}function*L_(){yield Ga(FP.loadPaymentMethod,w_),yield Ga(FP.submitPaymentMethod,C_),yield Ga(FP.submitPaymentMethodError,R_),yield Ga(FP.submitPaymentMethodSuccess,D_),yield Ga(FP.updatePaymentMethodBillingDetails,U_)}function*w_(){yield xo(FP.setLoading(!0));try{const e=(yield Bo(rp.subscriptions.getPaymentMethods))[0];yield xo(FP.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield xo(FP.setError(Tg(e)))}}function*U_({payload:e}){yield xo(FP.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield Bo(rp.subscriptions.updatePaymentMethodBillingDetails,t,D({email:n},i)),yield Bo(w_),null==o||o(!0)}catch(e){yield xo(FP.setError(Tg(e))),null==o||o(!1)}yield xo(FP.setLoading(!1))}function*C_(){yield xo(FP.setLoading(!0))}function*R_({payload:e}){yield xo(FP.setError(e))}function*D_(){yield xo(FP.loadPaymentMethod())}function*N_(){yield xo(FP.setLoading(!0)),yield Ho(500);const e=b_[0];yield xo(FP.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*M_(){yield Ga(FP.loadPaymentMethod,N_)}function*F_(){yield Ga(BP.loadInvoices,G_),yield Ga(BP.downloadInvoice,$_)}function*G_(){yield xo(BP.setLoading(!0));try{const e=(yield Bo(rp.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 xo(BP.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield xo(BP.setError(Tg(e)))}}function*$_({payload:e}){yield xo(BP.setInvoiceDownloadState({loading:!0,error:null}));try{yield Bo(rp.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield xo(BP.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield xo(BP.setInvoiceDownloadState({loading:!1,error:Tg(e,null)}))}}function*x_(){yield xo(BP.setLoading(!0)),yield Ho(500),yield xo(BP.setState({loading:!1,fetching:!1,invoices:A_.map((e=>D({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield xo(BP.setLoading(!1))}function*V_(){yield Ga(BP.loadInvoices,x_)}function*j_(){yield Ga(IP.load,B_),yield Ga(IP.cancelSubscription,W_),yield Ga(IP.renewSubscription,z_)}function*B_(){const e=yield Ko((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield O_(e)}function*W_(){const{subscription:e}=yield Ko((e=>e.subscriptions.billing.subscription));if(!e)return void(yield xo(IP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield xo(IP.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Xy.ACTIVE)try{yield xo(IP.setCancellationLoading(!0)),yield Bo(rp.subscriptions.cancelManagedSubscription,t),yield E_(),yield xo(IP.setCancellationLoading(!1))}catch(e){yield xo(IP.setCancellationError(Tg(e)))}}function*z_(){const{subscription:e}=yield Ko((e=>e.subscriptions.billing.subscription));if(!e)return void(yield xo(IP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield xo(IP.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Zy.AT_PERIOD_END)try{yield xo(IP.setRenewalLoading(!0)),yield Bo(rp.subscriptions.renewManagedSubscription,t),yield E_(),yield xo(IP.setRenewalLoading(!1))}catch(e){yield xo(IP.setCancellationError(Tg(e)))}}function*K_(){yield xo(IP.setLoading(!0)),yield Ho(500),yield xo(IP.setState({subscription:h_,fetching:!1,loading:!1,error:null}))}function*H_(){yield Ga(IP.load,K_)}function*q_(){yield Vo([Bo(k_),Bo(L_),Bo(F_),Bo(j_)])}function*J_(){yield Vo([Bo(__),Bo(M_),Bo(V_),Bo(H_)])}function*Y_(){yield Ga(QP.loadCheckout,X_),yield Ga(QP.resetCheckout,Q_),yield Ga(QP.submitCheckout,Z_),yield Ga(QP.confirmCheckout,eL),yield Ga(QP.errorCheckout,nL)}function*X_(){yield xo(QP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*Q_(){yield xo(QP.setState({loading:!1,error:null,confirmed:!1}))}function*Z_(){yield xo(QP.setState({loading:!0,error:null}))}function*eL({payload:{paymentMethodId:e,planId:t}}){const n=yield Ko((e=>e.subscriptions.billing.subscription.subscription)),i=yield Ko((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Xy.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield xo(QP.setState({loading:!0,error:null})),o&&a)return yield tL(),void(yield xo(IP.setState({subscription:D({},n,{status:Xy.ACTIVE})})));try{yield Bo(rp.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Vo([I_(),w_(),G_()]),yield tL()}catch(e){yield xo(QP.setState({loading:!1,error:Tg(e)}))}}else yield xo(QP.setState({loading:!1,error:"Subscription not found"}))}function*tL(){yield xo(QP.setState({loading:!1,error:null,confirmed:!0}))}function*nL({payload:e}){yield xo(QP.setState({loading:!1,error:e}))}function*iL(){yield Ga(QP.resetCheckout,Q_)}function*oL(){yield Ga(fP.loadPlans,aL)}function*aL(){yield xo(fP.setLoading(!0));try{const e=(yield Bo(rp.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 xo(fP.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield xo(fP.setError(Tg(e)))}}function*rL(){yield xo(fP.setLoading(!0)),yield Ho(500),yield xo(fP.setState({fetching:!1,loading:!1,plans:m_.map((e=>{var t,n;return D({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*sL(){yield Ga(fP.loadPlans,rL)}function*lL(){yield Ga(mP.loadPaymentConfiguration,cL)}function*cL(){yield xo(mP.setLoading(!0));try{(yield Bo(rp.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===ef.Stripe))?yield function*(){yield xo(mP.setLoading(!0));try{const e=yield Bo(rp.subscriptions.getStripePaymentProviderConfiguration);yield xo(mP.setState({loading:!1,fetching:!1,config:{paymentProvider:f_.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield xo(mP.setError(Tg(e)))}}():yield xo(mP.setError("Payment provider not configured"))}catch(e){yield xo(mP.setError(Tg(e)))}}function*uL(){yield xo(mP.setLoading(!0)),yield Ho(500),yield xo(mP.setState({loading:!1,fetching:!1,config:{paymentProvider:f_.STRIPE,apiKey:""}}))}function*dL(){yield Ga(mP.loadPaymentConfiguration,uL)}function*yL(){yield Ga(o_.createCardSetupIntentSecret,fL)}function*fL({payload:e}){yield xo(o_.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Bo(rp.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield xo(o_.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield xo(o_.setError(Tg(e)))}}function*pL(){yield Ga(c_.loadVendorPublicConfiguration,gL)}function*gL(){yield xo(c_.setLoading(!0));try{const e=yield Bo(rp.subscriptions.getVendorPublicConfigurations);yield xo(c_.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield xo(c_.setError(Tg(e)))}}function*SL(){yield xo(c_.setLoading(!0)),yield Ho(500),yield xo(c_.setState({fetching:!1,loading:!1,vendorPublicConfig:T_}))}function*vL(){yield Ga(c_.loadVendorPublicConfiguration,SL)}var hL={sagas:function*(){yield Vo([Bo(q_),Bo(Y_),Bo(oL),Bo(lL),Bo(yL),Bo(pL)])},mockSagas:function*(){yield Vo([Bo(J_),Bo(iL),Bo(sL),Bo(dL),Bo(vL)])},reducer:y_,actions:d_,initialState:u_,storeName:"subscriptions"},mL={sagas:function*(){yield Ga(WS.loadVendorPublicInfo,zS)},storeName:Ft,initialState:VS,reducer:jS,actions:WS};const{reducer:AL}=pt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Va.setContext(t),D({},e,{context:t}))}}}),bL=(e,t,n=!1,i,o,a=!1,r="path")=>{const s="undefined"==typeof window;let l=t;if(s&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var c,u,d,y,f,p,g,S,v,h;n||a||Va.setContext(e.context);const t=La(),s=[...ut({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=dt({middleware:s,preloadedState:{root:D({},e,{previewMode:n,urlStrategy:r}),[WI.storeName]:D({},WI.initialState,i,null!=(c=null==o?void 0:o.auth)?c:{},{routes:D({},WI.initialState.routes,null!=(u=null==i?void 0:i.routes)?u:{},null!=(d=null==o||null==(y=o.auth)?void 0:y.routes)?d:{})}),[SO.storeName]:D({},SO.initialState,null!=(f=null==o?void 0:o.auditLogs)?f:{},{auditLogsState:D({},SO.initialState.auditLogsState,null!=(p=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:D({},SO.initialState.auditsMetadataState,null!=(S=null==o||null==(v=o.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[hO]:D({},vO,null!=(h=null==o?void 0:o.audits)?h:{}),[oP.storeName]:oP.initialState,[hL.storeName]:hL.initialState,[mL.storeName]:mL.initialState},reducer:Ke({root:AL,[WI.storeName]:WI.reducer,[SO.storeName]:SO.reducer,[hO]:AO,[oP.storeName]:oP.reducer,[hL.storeName]:hL.reducer,[mL.storeName]:mL.reducer})});const m=function*(){yield Vo([Bo(WI.sagas),Bo(SO.sagas),Bo(UO),Bo(oP.sagas),Bo(hL.sagas),Bo(mL.sagas)])},A=function*(){yield Vo([Bo(WI.mockSagas),Bo(SO.mockSagas),Bo(hL.mockSagas)])};n?(l.store.destroy=t.run(A).cancel,l.store.dispatch(ji.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel,l.store.subscribeStateChanged=e=>{let t=l.store.getState();return l.store.subscribe((()=>{const n=l.store.getState();t!=n&&(t=n,e(n))}))}}return l.store};var TL=n(314);const EL=()=>{if(!Va.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")},kL=(e,t)=>e?e.isEntitled?{isEntitled:!0}:{isEntitled:!1,justification:e.justification}:{isEntitled:!1,justification:t};var IL=n(714),OL=n.n(IL);function PL(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function _L(e){if(e.type)return e;if("#"===e.charAt(0))return _L(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const i=e.substring(t+1,e.length-1);let o,a;if("color"===n){if(a=i.split(" "),o=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(o))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+o)}else a=i.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:o}}function LL(e){const{type:t,colorSpace:n}=e;let{values:i}=e;return-1!==t.indexOf("rgb")?i=i.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),i=-1!==t.indexOf("color")?`${n} ${i.join(" ")}`:`${i.join(", ")}`,`${t}(${i})`}function wL(e){if(0===e.indexOf("#"))return e;const{values:t}=_L(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 UL(e,t){return e=_L(e),t=PL(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,LL(e)}function CL(e,t){if(e=_L(e),t=PL(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 LL(e)}function RL(e,t){if(e=_L(e),t=PL(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 LL(e)}const DL=e=>{if(e)return{main:e,light:wL(RL(e,.4)),dark:wL(CL(e,.15)),hover:wL(CL(e,.15)),active:wL(CL(e,.2))}},NL=e=>{if(e)return{main:e,light:RL(e,.7),dark:CL(e,.2)}},ML=(e,t)=>{var n,i,o,a,r,s,l,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?D({},t,{palette:{primary:D({},DL(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:D({},DL(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(s=null==e||null==(l=e.palette)?void 0:l.secondaryText)?s:"#000000"}),danger:D({},DL(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:D({},NL(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:D({},NL(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:D({},NL(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:D({},NL(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},FL={theme:{},themeV2:{},localizations:{},navigation:{usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},provisioning:{visibility:"hidden",permissions:["fe.secure.read.provisioningConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]},allAccounts:{visibility:"byPermissions",permissions:["fe.account-hierarchy.read.subAccount"]},groups:{visibility:"hidden",permissions:["fe.secure.read.groups"]}}};class GL{constructor(){this._theme=FL.theme,this._themeV2=FL.themeV2,this._navigation=FL.navigation,this._localizations=FL.localizations,this._integrations=FL.integrations}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new GL;return n.set(e),GL._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}get integrations(){var e;return null!=(e=this._integrations)?e:{}}set(e){try{var t,n,i,o,a,r,s,l,c;this._navigation=OL().all([null!=(t=FL.navigation)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=OL().all([null!=(i=FL.theme)?i:{},ML(null==e?void 0:e.theme,FL.theme)]),this._themeV2=OL().all([null!=(o=FL.themeV2)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=OL().all([null!=(r=FL.localizations)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}]),this._integrations=OL().all([null!=(l=FL.integrations)?l:{},null!=(c=null==e?void 0:e.integrations)?c:{}])}catch(e){this._navigation=FL.navigation,this._theme=FL.theme,this._themeV2=FL.themeV2,this._localizations=FL.localizations,this._integrations=FL.integrations}}}GL._instances={};var $L=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},xL=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(t);return Object.keys(n).forEach((function(e){return i.setAttribute(e,n[e])})),e.appendChild(i),i},VL=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))},jL=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 BL,WL,zL,KL,HL,qL,JL,YL,XL,QL,ZL,ew;!function(e){e.phoneNumber="phoneNumber"}(BL||(BL={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(WL||(WL={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(zL||(zL={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(KL||(KL={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(HL||(HL={})),function(e){e.Invoices="invoices"}(qL||(qL={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(JL||(JL={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(YL||(YL={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(XL||(XL={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(QL||(QL={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(ZL||(ZL={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(ew||(ew={}));const tw={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},nw={hidden:"hidden",edit:"edit"};var iw="6.166.0-alpha.2",ow={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","temporary-users":"on"},aw=function(){function e(t,n){var i,o,a=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];O(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(iw),this.customElementName="",this.adminPortalEl=void 0,this.adminPortalRenderer=void 0,this.loginBoxEl=void 0,this.checkoutDialogEl=void 0,this.checkoutDialogRenderer=void 0,this.adminPortalContainer=void 0,this.loginBoxContainer=void 0,this.checkoutDialogContainer=void 0,this.loginBoxRenderer=void 0,this.store=void 0,this.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=M(G().mark((function e(){var t,n,i,o,r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Rr,a.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,a.options.metadata=null!=(n=null==r||null==(i=r.rows)||null==(o=i[0])?void 0:o.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:GL.set(a.options.metadata,a.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=M(G().mark((function e(){var t,n,i;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=null==(t=a.options.authOptions)||null==(n=t.hostedLoginOptions)?void 0:n.loadUserOnFirstLoad,a.options.builderMode||"nextjs"===a.options.framework||(a.options.hostedLoginBox&&!a.options.customLoginBox?i&&a.store.dispatch({type:"auth/requestHostedLoginAuthorizeV2",payload:{shouldRedirectToLogin:!1,firstTime:!0}}):a.store.dispatch({type:"auth/requestAuthorize",payload:!0}));case 2:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=M(G().mark((function e(){var t;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.options.previewMode&&!a.options.builderMode){e.next=4;break}Br.set(ow,a.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Wr();case 7:t=e.sent,a.options.overrideFeatureFlags&&Object.assign(t,a.options.overrideFeatureFlags),Br.set(t,a.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.setFeatureFlagsForPreview=function(e){Br.set(D({},ow,e),a.name)},this.queryFeatureFlags=function(e){return Br.getFeatureFlags(e,a.name)},this.updateLocalizationsSetter=function(e){a.updateLocalizations=e},this.getEntitlementsFromStore=function(){var e;return null==(e=a.store.getState().auth.user)?void 0:e.entitlements},this.getUserFromStore=function(){return a.store.getState().auth.user},this.getEntitlementsQueryData=function(e){var t=a.getUserFromStore();return{entitlements:a.getEntitlementsFromStore(),attributes:{custom:e,jwt:t},isV2:R(a.queryFeatureFlags([Vr]),1)[0]}};var l=$L(n),c="frontegg-app-".concat(l);this.iframeRendering=r,this.name=l,this.options=D({},t,{contextOptions:D({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=c;var u,d,y=this.options.authOptions?D({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(y.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!s&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=bL({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,y,{auth:null!=(u=this.options.authOptions)?u:{},audits:null!=(d=this.options.auditsOptions)?d:{}},!1,this.options.urlStrategy);U.setInstance(l,this),this.setEntitlementsOptions(t.entitlementsOptions),this.setSessionContext({enableSessionPerTenant:null==(o=t.authOptions)?void 0:o.enableSessionPerTenant}),Va.setAppName(l)}var t,n,i,o;return w(e,[{key:"setEntitlementsOptions",value:function(e){Va.setEntitlementsOptions(D({},e))}},{key:"setSessionContext",value:function(e){Va.setSessionContext(D({},e))}},{key:"initContainers",value:(o=M(G().mark((function e(t){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.adminPortalEl=t.adminPortalEl,this.loginBoxEl=t.loginBoxEl,this.checkoutDialogEl=t.checkoutDialogEl,this.adminPortalContainer=t.adminPortalContainer,this.loginBoxContainer=t.loginBoxContainer,this.checkoutDialogContainer=t.checkoutDialogContainer;try{"nextjs"!==this.options.framework&&document.body.classList.add("frontegg-loading")}catch(e){console.error("Failed to add frontegg-loading to body classList")}return e.next=9,this.loadFeatureFlags();case 9:return e.next=11,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize()]);case 11:this.options.previewMode||this.options.customLoginBox||(this.loadLoginBox(),n=this.name,i=void 0,void 0,a=void 0,null==(a=null==(o=GL.getInstance(n))||null==(i=o.integrations)?void 0:i.gtm)||a.filter((function(e){var t=e.id;return e.enabled&&function(e){return/^GTM-[a-zA-Z0-9]+$/.test(e)}(t)})).forEach((function(e){var t=e.id,n=document.createElement("script");n.innerHTML="\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','".concat(t,"');\n "),document.body.appendChild(n)}))),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 13:case"end":return e.stop()}var n,i,o,a}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;GL.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:k,FronteggTypes:I})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=M(G().mark((function e(){return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){console.error("Failed to call loadLoginBoxListener",e)}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=M(G().mark((function e(){var t;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Va.setRequestSource(ui.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(),jL(t),Va.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=M(G().mark((function e(t){var n;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,D({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"getFeatureEntitlements",value:function(e,t){var n=this.getEntitlementsQueryData(t);return((e,t,n,i)=>{var o;return EL(),i?(0,TL.tE)(t,e,n):kL(null==e||null==(o=e.features)?void 0:o[t],Hs.MISSING_FEATURE)})(n.entitlements,e,n.attributes,n.isV2)}},{key:"getPermissionEntitlements",value:function(e,t){var n=this.getEntitlementsQueryData(t);return((e,t,n,i)=>{var o;return EL(),i?(0,TL.wJ)(t,e,n):kL(null==e||null==(o=e.permissions)?void 0:o[t],Hs.MISSING_PERMISSION)})(n.entitlements,e,n.attributes,n.isV2)}},{key:"getEntitlements",value:function(e,t){return"permissionKey"in e?this.getPermissionEntitlements(e.permissionKey,t):this.getFeatureEntitlements(e.featureKey,t)}},{key:"loadEntitlements",value:function(e){this.store.dispatch({type:"auth/loadEntitlements",payload:{callback:e}})}},{key:"stepUp",value:function(e){var t=this.store.getState(),n=(null==t?void 0:t.auth)||{},i=n.hostedLoginBox,o=n.routes.stepUpUrl;i?this.store.dispatch({type:"auth/stepUpHostedLogin",payload:e}):((e,t,n)=>{ov();const i=new URLSearchParams(window.location.search);n&&i.set("maxAge",n.toString()),t(`${e}${i?`?${i}`:""}`,{refresh:!1})})(o,t.auth.onRedirectTo,null==e?void 0:e.maxAge)}},{key:"isSteppedUp",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(null==(e=this.store.getState())?void 0:e.auth)||{},i=n.user;return iv(i,t)}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),rw=function(){function e(){O(this,e)}return w(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=U.getInstance(i);e&&t?(Va.setAccessToken(t),Va.setUser(D({},n,{accessToken:t})),o.store.dispatch(ji.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(ji.loadTenants())):(Va.setAccessToken(null),Va.setUser(null),o.store.dispatch(ji.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),sw=function(){function e(){O(this,e)}return w(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";U.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";U.getInstance(e).hideAdminPortal()}}]),e}(),lw=function(){function e(){O(this,e)}return w(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";U.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";U.getInstance(e).hideCheckoutDialog()}}]),e}(),cw=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},uw=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];O(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=bL({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=D({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},o),this.app=new aw(this.options,t,!0),GL.set({},t)}var t;return w(e,[{key:"render",value:(t=M(G().mark((function e(t){var n,i,o,a,r=this;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,VL(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}(),dw="modern",yw=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[dw]},fw=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];O(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=bL({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=D({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},o),this.app=new aw(this.options,t,!0,a),GL.set({},t)}var t;return w(e,[{key:"render",value:(t=M(G().mark((function e(t){var n,i,o,a,r=this;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,VL(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 pw(e,t){return pw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pw(e,t)}function gw(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&&pw(e,t)}function Sw(e,t){if(t&&("object"===P(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function vw(e){return vw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vw(e)}function hw(){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 mw(e,t,n){return mw=hw()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&pw(o,n.prototype),o},mw.apply(null,arguments)}function Aw(e){var t="function"==typeof Map?new Map:void 0;return Aw=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 mw(e,arguments,vw(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),pw(n,e)},Aw(e)}function bw(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=vw(e);if(t){var o=vw(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return Sw(this,n)}}var Tw=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new aw(e,t);if("undefined"!=typeof document){var i;if(!e.contextOptions.baseUrl){var o=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(o.message),o}if(!customElements.get("frontegg-app")){var a=function(e){gw(n,e);var t=bw(n);function n(){var e;O(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return(e=t.call.apply(t,[this].concat(o))).app=null,e}return w(n,[{key:"connectedCallback",value:function(){this.updateContent()}},{key:"attributeChangedCallback",value:function(e,t,n){if("app-name"===e){if(null===t)return;if(t===n)return;this.innerHTML="",null===n?this.remove():this.updateContent()}console.debug("attributeChangedCallback",e,t,n)}},{key:"updateContent",value:function(){var e,t=null!=(e=this.getAttribute("app-name"))?e:"default",n=U.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=xL(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=xL(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=xL(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=i.attachShadow({mode:"open"}),s=o.attachShadow({mode:"open"}),l=a.attachShadow({mode:"open"}),c=xL(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=xL(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=xL(l,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:i,loginBoxContainer:o,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(Aw(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(()=>(()=>{var e={987:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createConditionEvaluator=void 0;const i=n(651),a=n(82);t.createConditionEvaluator=function(e){const t=(0,a.useSanitizer)(e.condition.op);if(!t)return()=>!1;const{isSanitized:n,sanitizedValue:o}=t(e.condition.value);if(!n||void 0===o)return()=>!1;const r=(0,i.useOperation)(e.condition.op,o);return t=>{const n=t[e.condition.attribute],{isValid:i}=void 0!==n&&r?r(n):{isValid:!1};return e.condition.negate?!i:i}}},898:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,a)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),a(n(987),t),a(n(371),t)},371:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},840:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateFeatureFlag=void 0;const i=n(380);t.evaluateFeatureFlag=function(e,t){if(!e.on)return{treatment:e.offTreatment};const n=function(e,t){var n;return null===(n=e.rules)||void 0===n?void 0:n.find((e=>(0,i.createRuleEvaluator)({rule:e})(t)===i.RuleEvaluationResultEnum.Treatable))}(e,t);return n?{treatment:n.treatment}:{treatment:e.defaultTreatment}}},95:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,a)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),a(n(840),t)},314:(e,t,n)=>{"use strict";t.wJ=t.tE=void 0;n(95),n(380),n(379);var i=n(535);Object.defineProperty(t,"tE",{enumerable:!0,get:function(){return i.evaluateIsEntitledToFeature}}),Object.defineProperty(t,"wJ",{enumerable:!0,get:function(){return i.evaluateIsEntitledToPermissions}})},195:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,a)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanOperationsMapper=void 0;const o=n(379),r=n(615);a(n(615),t),a(n(226),t),t.BooleanOperationsMapper={[o.OperationEnum.Is]:e=>(0,r.useIsOperation)(e)}},615:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useIsOperation=void 0,t.useIsOperation=function(e){return t=>({isValid:t===e.boolean})}},226:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanSanitizersMapper=t.singleBooleanSanitizer=void 0;const i=n(379);t.singleBooleanSanitizer=e=>{const t=void 0!==e.boolean&&(e=>"boolean"==typeof e)(e.boolean)?{boolean:e.boolean}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.BooleanSanitizersMapper={[i.OperationEnum.Is]:t.singleBooleanSanitizer}},651:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useOperation=void 0;const i=n(943),a=n(610),o=n(4),r=n(195),s={...i.StringOperationsMapper,...a.NumericOperationsMapper,...o.DateOperationsMapper,...r.BooleanOperationsMapper};t.useOperation=function(e,t){const n=s[e];return n?n(t):void 0}},82:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useSanitizer=void 0;const i=n(195),a=n(903),o=n(886),r=n(610),s={...a.StringSanitizersMapper,...r.NumericSanitizersMapper,...o.DateSanitizersMapper,...i.BooleanSanitizersMapper};t.useSanitizer=function(e){return s[e]}},4:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,a)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.DateOperationsMapper=void 0;const o=n(379),r=n(569);a(n(569),t),a(n(931),t),t.DateOperationsMapper={[o.OperationEnum.On]:e=>(0,r.useDateOnOperation)(e),[o.OperationEnum.OnOrAfter]:e=>(0,r.useDateOnOrAfterOperation)(e),[o.OperationEnum.OnOrBefore]:e=>(0,r.useDateOnOrBeforeOperation)(e),[o.OperationEnum.BetweenDate]:e=>(0,r.useDateBetweenOperation)(e)}},569:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useDateBetweenOperation=t.useDateOnOrBeforeOperation=t.useDateOnOrAfterOperation=t.useDateOnOperation=void 0,t.useDateOnOperation=function(e){return t=>({isValid:t.getTime()===e.date.getTime()})},t.useDateOnOrAfterOperation=function(e){return t=>({isValid:t.getTime()>=e.date.getTime()})},t.useDateOnOrBeforeOperation=function(e){return t=>({isValid:t.getTime()<=e.date.getTime()})},t.useDateBetweenOperation=function(e){return t=>({isValid:t.getTime()>=e.start.getTime()&&t.getTime()<=e.end.getTime()})}},886:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DateSanitizersMapper=t.sanitizeDateRange=t.sanitizeSingleDate=t.isValidDate=t.sanitizeDateValue=void 0;const i=n(379);t.sanitizeDateValue=e=>new Date(e),t.isValidDate=e=>e instanceof Date&&!isNaN(e),t.sanitizeSingleDate=e=>{const n=e.date?(0,t.sanitizeDateValue)(e.date):void 0,i=n&&(0,t.isValidDate)(n)?{date:n}:void 0;return{isSanitized:!!i,sanitizedValue:i}},t.sanitizeDateRange=e=>{const n=e.start?(0,t.sanitizeDateValue)(e.start):void 0,i=e.end?(0,t.sanitizeDateValue)(e.end):void 0,a=n&&i&&(0,t.isValidDate)(n)&&(0,t.isValidDate)(i)?{start:n,end:i}:void 0;return{isSanitized:!!a,sanitizedValue:a}},t.DateSanitizersMapper={[i.OperationEnum.On]:t.sanitizeSingleDate,[i.OperationEnum.OnOrAfter]:t.sanitizeSingleDate,[i.OperationEnum.OnOrBefore]:t.sanitizeSingleDate,[i.OperationEnum.BetweenDate]:t.sanitizeDateRange}},931:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},610:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,a)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.NumericOperationsMapper=void 0;const o=n(379),r=n(217);t.NumericOperationsMapper={[o.OperationEnum.Equal]:e=>(0,r.useEqualsOperation)(e),[o.OperationEnum.GreaterThan]:e=>(0,r.useGreaterThanOperation)(e),[o.OperationEnum.GreaterThanEqual]:e=>(0,r.useGreaterThanEqualOperation)(e),[o.OperationEnum.LesserThan]:e=>(0,r.useLesserThanOperation)(e),[o.OperationEnum.LesserThanEqual]:e=>(0,r.useLesserThanEqualOperation)(e),[o.OperationEnum.BetweenNumeric]:e=>(0,r.useBetweenNumericOperation)(e)},a(n(217),t),a(n(326),t),a(n(764),t)},217:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useBetweenNumericOperation=t.useLesserThanEqualOperation=t.useLesserThanOperation=t.useGreaterThanEqualOperation=t.useGreaterThanOperation=t.useEqualsOperation=void 0,t.useEqualsOperation=function(e){return t=>({isValid:t===e.number})},t.useGreaterThanOperation=function(e){return t=>({isValid:t>e.number})},t.useGreaterThanEqualOperation=function(e){return t=>({isValid:t>=e.number})},t.useLesserThanOperation=function(e){return t=>({isValid:t<e.number})},t.useLesserThanEqualOperation=function(e){return t=>({isValid:t<=e.number})},t.useBetweenNumericOperation=function(e){return t=>({isValid:t>=e.start&&t<=e.end})}},326:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NumericSanitizersMapper=t.sanitizeNumericRange=t.sanitizeSingleNumber=void 0;const i=n(379),a=e=>"number"==typeof e;t.sanitizeSingleNumber=e=>{const t=void 0!==e.number&&a(e.number)?{number:e.number}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.sanitizeNumericRange=e=>{const t=void 0!==e.start&&void 0!==e.end&&a(e.start)&&a(e.end)?{start:e.start,end:e.end}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.NumericSanitizersMapper={[i.OperationEnum.Equal]:t.sanitizeSingleNumber,[i.OperationEnum.GreaterThan]:t.sanitizeSingleNumber,[i.OperationEnum.GreaterThanEqual]:t.sanitizeSingleNumber,[i.OperationEnum.LesserThan]:t.sanitizeSingleNumber,[i.OperationEnum.LesserThanEqual]:t.sanitizeSingleNumber,[i.OperationEnum.BetweenNumeric]:t.sanitizeNumericRange}},764:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},943:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,a)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.StringOperationsMapper=void 0;const o=n(379),r=n(431);a(n(431),t),a(n(97),t),t.StringOperationsMapper={[o.OperationEnum.StartsWith]:e=>(0,r.useStartsWithOperation)(e),[o.OperationEnum.EndsWith]:e=>(0,r.useEndsWithOperation)(e),[o.OperationEnum.Contains]:e=>(0,r.useContainsOperation)(e),[o.OperationEnum.InList]:e=>(0,r.useInListOperation)(e),[o.OperationEnum.Matches]:e=>(0,r.useMatchesOperation)(e)}},431:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useMatchesOperation=t.useInListOperation=t.useContainsOperation=t.useEndsWithOperation=t.useStartsWithOperation=void 0,t.useStartsWithOperation=function(e){return t=>({isValid:e.list.some((e=>t.startsWith(e)))})},t.useEndsWithOperation=function(e){return t=>({isValid:e.list.some((e=>t.endsWith(e)))})},t.useContainsOperation=function(e){return t=>({isValid:e.list.some((e=>t.includes(e)))})},t.useInListOperation=function(e){return t=>({isValid:e.list.includes(t)})},t.useMatchesOperation=function(e){return t=>{let n;try{n=new RegExp(e.string)}catch(e){return{isValid:!1}}return{isValid:n.test(t)}}}},903:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringSanitizersMapper=t.sanitizeListString=t.sanitizeSingleString=void 0;const i=n(379),a=e=>"string"==typeof e;t.sanitizeSingleString=e=>{const t=void 0!==e.string&&a(e.string)?{string:e.string}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.sanitizeListString=e=>{const t=void 0!==e.list&&e.list.every((e=>a(e)))?{list:e.list}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.StringSanitizersMapper={[i.OperationEnum.Matches]:t.sanitizeSingleString,[i.OperationEnum.Contains]:t.sanitizeListString,[i.OperationEnum.StartsWith]:t.sanitizeListString,[i.OperationEnum.EndsWith]:t.sanitizeListString,[i.OperationEnum.InList]:t.sanitizeListString}},97:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},379:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,a)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),a(n(982),t)},982:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.OperationEnum=void 0,(n=t.OperationEnum||(t.OperationEnum={})).InList="in_list",n.StartsWith="starts_with",n.EndsWith="ends_with",n.Contains="contains",n.Matches="matches",n.Equal="equal",n.GreaterThan="greater_than",n.GreaterThanEqual="greater_than_equal",n.LesserThan="lower_than",n.LesserThanEqual="lower_than_equal",n.BetweenNumeric="between_numeric",n.Is="is",n.On="on",n.BetweenDate="between_date",n.OnOrAfter="on_or_after",n.OnOrBefore="on_or_before"},380:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,a)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),a(n(930),t),a(n(304),t)},304:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createRuleEvaluator=void 0;const i=n(930),a=n(898);t.createRuleEvaluator=function(e){return t=>e.rule.conditions.every((e=>(0,a.createConditionEvaluator)({condition:e})(t)))?i.RuleEvaluationResultEnum.Treatable:i.RuleEvaluationResultEnum.Insufficient}},930:(e,t)=>{"use strict";var n,i;Object.defineProperty(t,"__esModule",{value:!0}),t.RuleEvaluationResultEnum=t.TreatmentEnum=t.ConditionLogicEnum=void 0,(t.ConditionLogicEnum||(t.ConditionLogicEnum={})).And="and",(i=t.TreatmentEnum||(t.TreatmentEnum={})).True="true",i.False="false",(n=t.RuleEvaluationResultEnum||(t.RuleEvaluationResultEnum={})).Treatable="treatable",n.Insufficient="insufficient"},950:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.modifyObjectKeysWithPrefix=t.defaultFronteggAttributesMapper=t.prepareAttributes=void 0;const i=n(137);function a(e){return{email:e.email,emailVerified:e.email_verified,tenantId:e.tenantId,userId:e.id}}function o(e,t){return Object.keys(e).reduce(((n,i)=>(n[`${t}${i}`]=e[i],n)),{})}t.prepareAttributes=function(e={},t){const{custom:n={},jwt:r={}}=e,s=(0,i.flatten)(r);return{...n,...o(t?t(r):a(r),"frontegg."),...o(s,"jwt.")}},t.defaultFronteggAttributesMapper=a,t.modifyObjectKeysWithPrefix=o},137:(e,t)=>{"use strict";function n(e){return e}Object.defineProperty(t,"__esModule",{value:!0}),t.flatten=void 0,t.flatten=function(e,t){const i=(null==(t=t||{})?void 0:t.delimiter)||".",a=null==t?void 0:t.maxDepth,o=(null==t?void 0:t.transformKey)||n,r={};return function e(n,s,l){l=l||1,Object.keys(n).forEach((function(c){const u=n[c],d=(null==t?void 0:t.safe)&&Array.isArray(u),y=Object.prototype.toString.call(u),f=(p=u)&&p.constructor&&"function"==typeof p.constructor.isBuffer&&p.constructor.isBuffer(p);var p;const g="[object Object]"===y||"[object Array]"===y,S=s?s+i+o(c):o(c);if(!d&&!f&&g&&Object.keys(u).length&&(!(null==t?void 0:t.maxDepth)||a&&l<a))return e(u,S,l+1);r[S]=u}))}(e),r}},535:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,a)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),a(n(405),t),a(n(113),t),a(n(950),t),a(n(387),t)},405:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateIsEntitledToPermissions=t.evaluateIsEntitledToFeature=void 0;const i=n(113),a=n(95),o=n(950),r=n(380),s=n(387);function l(e,t,n={}){const s=t.features[e];let l=!1;if(s&&null!==s.expireTime&&(l=s.expireTime!==i.NO_EXPIRATION_TIME&&s.expireTime<Date.now(),!l))return{isEntitled:!0};if(s&&s.featureFlag){const e=(0,o.prepareAttributes)(n),{treatment:t}=(0,a.evaluateFeatureFlag)(s.featureFlag,e);if(t===r.TreatmentEnum.True)return{isEntitled:!0}}return{isEntitled:!1,justification:l?i.NotEntitledJustification.BUNDLE_EXPIRED:i.NotEntitledJustification.MISSING_FEATURE}}t.evaluateIsEntitledToFeature=l,t.evaluateIsEntitledToPermissions=function(e,t,n){if(!(0,s.checkPermission)(t.permissions,e))return{isEntitled:!1,justification:i.NotEntitledJustification.MISSING_PERMISSION};const a=function(e,t){return Object.keys(t.features).filter((n=>t.features[n].linkedPermissions.includes(e)))}(e,t);if(!a.length)return{isEntitled:!0};let o=!1;for(const e of a){const{isEntitled:a,justification:r}=l(e,t,n);if(a)return{isEntitled:!0};r===i.NotEntitledJustification.BUNDLE_EXPIRED&&(o=!0)}return{isEntitled:!1,justification:o?i.NotEntitledJustification.BUNDLE_EXPIRED:i.NotEntitledJustification.MISSING_FEATURE}}},387:(e,t)=>{"use strict";function n(e){return new RegExp("^"+e.replace(/\./g,"\\.").replace(/\*/g,".*")+"$","gs")}Object.defineProperty(t,"__esModule",{value:!0}),t.createPermissionCheckRegex=t.checkPermission=void 0,t.checkPermission=function(e,t){return Object.keys(e).some((e=>n(e).test(t)))},t.createPermissionCheckRegex=n},113:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.NO_EXPIRATION_TIME=t.NotEntitledJustification=void 0,(n=t.NotEntitledJustification||(t.NotEntitledJustification={})).MISSING_FEATURE="MISSING_FEATURE",n.MISSING_PERMISSION="MISSING_PERMISSION",n.BUNDLE_EXPIRED="BUNDLE_EXPIRED",t.NO_EXPIRATION_TIME=-1},714:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function a(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function o(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function s(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||a,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?l.arrayMerge(e,n,l):function(e,t,n){var a={};return n.isMergeableObject(e)&&o(e).forEach((function(t){a[t]=i(e[t],n)})),o(t).forEach((function(o){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(r(e,o)&&n.isMergeableObject(t[o])?a[o]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(o,n)(e[o],t[o],n):a[o]=i(t[o],n))})),a}(e,n,l):i(n,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})};var l=s;e.exports=l},378:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,a,o;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(a=i;0!=a--;)if(!e(t[a],n[a]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(a=i;0!=a--;)if(!Object.prototype.hasOwnProperty.call(n,o[a]))return!1;for(a=i;0!=a--;){var r=o[a];if(!e(t[r],n[r]))return!1}return!0}return t!=t&&n!=n}},609:(e,t,n)=>{var i=n(425).default;function a(){"use strict";e.exports=a=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,o=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,i){var a=t&&t.prototype instanceof g?t:g,o=Object.create(a.prototype),s=new _(i||[]);return r(o,"_invoke",{value:k(e,n,s)}),o}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,l,(function(){return this}));var m=Object.getPrototypeOf,A=m&&m(m(L([])));A&&A!==n&&o.call(A,l)&&(h=A);var b=v.prototype=g.prototype=Object.create(h);function T(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(a,r,s,l){var c=f(e[a],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&o.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var a;r(this,"_invoke",{value:function(e,i){function o(){return new t((function(t,a){n(e,i,t,a)}))}return a=a?a.then(o,o):o()}})}function k(e,t,n){var i="suspendedStart";return function(a,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var r=n.delegate;if(r){var s=O(r,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=f(e,t,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function O(e,t){var n=t.method,i=e.iterator[n];if(void 0===i)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,O(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var a=f(i,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,p;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function L(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(o.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return S.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},T(E.prototype),d(E.prototype,c,(function(){return this})),t.AsyncIterator=E,t.async=function(e,n,i,a,o){void 0===o&&(o=Promise);var r=new E(y(e,n,i,a),o);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},T(b),d(b,u,"Generator"),d(b,l,(function(){return this})),d(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=L,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(P),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],r=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&o.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var r=a?a.completion:{};return r.type=e,r.arg=t,a?(this.method="next",this.next=a.finallyLoc,p):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var a=i.arg;P(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:L(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports},425: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:(e,t,n)=>{var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var a=t[i];if(void 0!==a)return a.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";n.r(i),n.d(i,{AdminPortal:()=>sw,AdminPortalRenderer:()=>uw,AppHolder:()=>U,CheckoutDialog:()=>lw,FronteggApp:()=>ow,HostedLogin:()=>rw,LoginBoxRenderer:()=>fw,createElement:()=>xL,defaultTheme:()=>dw,formatName:()=>$L,getThemeAdminByName:()=>cw,getThemeByName:()=>yw,initialize:()=>Tw,mockFlagsList:()=>aw,restoreSearchParams:()=>jL,waitThemeSetter:()=>VL});var e={};n.r(e),n.d(e,{Delete:()=>Fr,Get:()=>Rr,Patch:()=>Nr,Post:()=>Dr,PostDownload:()=>Gr,Put:()=>Mr,extractHeadersFromOptions:()=>$r,getBaseUrl:()=>Lr,getMetadataHeaders:()=>wr,getScopedTenant:()=>Ur});var t={};n.r(t),n.d(t,{FeatureFlags:()=>Br,loadFeatureFlags:()=>Wr});var a={};n.r(a),n.d(a,{GetUserJwt:()=>zr,getCurrentUserTenantsV1:()=>Xr,getCurrentUserTenantsV3:()=>Yr,getUsersGroups:()=>Jr,getUsersRoles:()=>qr,getUsersV2:()=>Kr,getUsersV3:()=>Hr,sendResetBreachedPasswordEmails:()=>Qr,updateUserProfileV2:()=>Zr});var o={};n.r(o),n.d(o,{getHierarchyMetadata:()=>ds,getParentTenants:()=>ss,getParentTenantsById:()=>ls,getSubTenants:()=>os,getSubTenantsAsTree:()=>rs,getTenants:()=>as,getTenantsUsersCount:()=>cs,searchSubTenants:()=>us,switchTenant:()=>is});var r={};n.r(r),n.d(r,{loadEntitlements:()=>zs,loadEntitlementsV2:()=>Ks});var s={};n.r(s),n.d(s,{AuthStrategyEnum:()=>Oi,MachineToMachineAuthStrategy:()=>Ii,OAuthLogout:()=>El,SocialLoginProviders:()=>ki,acceptInvitation:()=>hl,activateAccount:()=>fl,activateAccountV2:()=>pl,bulkCreateIPRestriction:()=>Cs,changePhoneNumber:()=>Iu,changePhoneNumberWithVerification:()=>ku,checkIfAllowToRememberMfaDevice:()=>qc,createDomainRestriction:()=>Is,createIPRestriction:()=>Us,createOrUpdateSessionConfigrations:()=>Cc,createSSOConfiguration:()=>eu,createSSOConfigurationByMetadata:()=>iu,createSSOConfigurationByMetadataUrl:()=>ou,createSSODomain:()=>su,createSSOGroup:()=>yu,createSamlGroup:()=>Sc,createTenantAccessToken:()=>xc,createUserAccessToken:()=>$c,deleteAllSessionsForUser:()=>Dc,deleteDomainRestriction:()=>_s,deleteIPRestriction:()=>Ds,deleteSSOConfiguration:()=>nu,deleteSSODomain:()=>lu,deleteSSOGroup:()=>pu,deleteSamlGroup:()=>hc,deleteSessionForUser:()=>Rc,deleteTenantAccessToken:()=>Fc,deleteTenantApiToken:()=>zc,deleteUserAccessToken:()=>Gc,deleteUserApiToken:()=>Kc,deleteWebAuthnDevice:()=>Cu,disableMFAAuthenticatorApp:()=>Fl,disableMFASMS:()=>$l,disableMFAWebAuthn:()=>Vl,disableMfa:()=>Ml,enrollMFAAuthenticatorApp:()=>wl,enrollMFAAuthenticatorAppForLogin:()=>Wl,enrollMFAAuthenticatorAppForLoginV2:()=>zl,enrollMFASMS:()=>Cl,enrollMFASMSForLogin:()=>Xl,enrollMFASMSForLoginV2:()=>Ql,enrollMFAWebAuthn:()=>Dl,enrollMFAWebAuthnForLogin:()=>ic,enrollMFAWebAuthnForLoginV2:()=>ac,enrollMfa:()=>_l,exchangeOAuthTokens:()=>Au,exchangeOAuthTokensV2:()=>hu,forgotPassword:()=>kl,generateLoginResponse:()=>Qs,generateLoginResponseFromOAuthResponse:()=>il,generateLoginResponseFromOAuthResponseV2:()=>al,generateLoginResponseV2:()=>Zs,generateLoginResponseV3:()=>nl,generateStepupSession:()=>xu,getActivateAccountStrategy:()=>gl,getCaptchaPolicy:()=>ms,getCurrentUserSession:()=>Lc,getCurrentUserSessions:()=>_c,getCurrentUserTenantsFunction:()=>ns,getCustomSocialLoginProvidersV1:()=>kc,getDomainRestrictions:()=>ks,getDomainRestrictionsConfig:()=>Os,getGlobalSecurityPolicy:()=>ys,getIPRestrictions:()=>Ls,getIPRestrictionsConfig:()=>ws,getLockoutPolicy:()=>Ss,getMFADevices:()=>jl,getMFAStrategiesConfig:()=>Mu,getMeAndEntitlements:()=>$u,getMeV2:()=>Gu,getMfaPolicy:()=>fs,getOidcConfiguration:()=>mc,getPasswordConfigPolicy:()=>Es,getPasswordHistoryPolicy:()=>As,getPublicAuthStrategiesConfigForAuthenticatedUser:()=>Nu,getSSOConfigurations:()=>Zc,getSSODefaultRoles:()=>uu,getSSOGroups:()=>gu,getSSOPublicConfiguration:()=>Ac,getSamlConfiguration:()=>lc,getSamlRoles:()=>fc,getSamlRolesGroups:()=>pc,getSamlVendorConfiguration:()=>uc,getSessionConfigurations:()=>Uc,getSocialLoginProviders:()=>bc,getSocialLoginProvidersV2:()=>Tc,getSocialLoginProvidersV2ForAuthenticatedUser:()=>Ec,getTabTenantFromSessionStorage:()=>ts,getTenantAccessTokensData:()=>Mc,getTenantApiTokensData:()=>jc,getUserAccessTokensData:()=>Nc,getUserApiTokensData:()=>Vc,getUserAuthorization:()=>Fu,getUserById:()=>Hc,getVendorConfig:()=>Ic,getVendorLockoutPolicy:()=>vs,getVendorMfaPolicy:()=>ps,getVendorPasswordHistoryPolicy:()=>bs,getVendorPublicAuthStrategiesConfig:()=>Du,getWebAuthnDevices:()=>Uu,loadPasswordConfig:()=>Il,login:()=>cl,loginViaSocialLogin:()=>Oc,loginWithMfa:()=>dl,loginWithMfaV2:()=>yl,loginv2:()=>ul,logout:()=>Tl,oidcPostLogin:()=>ll,oidcPostLoginV2:()=>vu,passwordlessPostLogin:()=>Xc,passwordlessPostLoginV2:()=>Yc,passwordlessPreLogin:()=>Jc,postLogin:()=>sl,preDisableMFASMS:()=>Gl,preDisableMFAWebAuthn:()=>xl,preEnrollMFAAuthenticatorApp:()=>Ll,preEnrollMFAAuthenticatorAppForLogin:()=>Bl,preEnrollMFASMS:()=>Ul,preEnrollMFASMSForLogin:()=>Yl,preEnrollMFAWebAuthn:()=>Rl,preEnrollMFAWebAuthnForLogin:()=>nc,preLogin:()=>ol,preLoginV2:()=>Su,preLoginWithIdpType:()=>rl,preVerifyMFAEmailCode:()=>Hl,preVerifyMFASMSForLogin:()=>Zl,preVerifyMFAWebAuthnForLogin:()=>oc,recoverMfaToken:()=>Pl,refreshToken:()=>ml,refreshTokenV2:()=>Al,refreshTokenV3:()=>bl,resendActivationEmail:()=>Sl,resendInvitationEmail:()=>vl,resetPassword:()=>Ol,resetPhoneNumber:()=>Tu,revokeSessionsForUser:()=>wc,saveLockoutPolicy:()=>hs,saveMfaPolicy:()=>gs,savePasswordHistoryPolicy:()=>Ts,setSSODefaultRoles:()=>du,setTabTenantInSessionStorage:()=>es,signUpUser:()=>Pc,silentOAuthRefreshToken:()=>bu,silentOAuthRefreshTokenV2:()=>mu,testCurrentIp:()=>Ns,testCurrentIpInAllowList:()=>Ms,updateDomainRestrictionConfig:()=>Ps,updateIPRestrictionConfig:()=>Rs,updateSSOConfiguration:()=>tu,updateSSOConfigurationByMetadata:()=>au,updateSSOConfigurationByMetadataUrl:()=>ru,updateSSOGroup:()=>fu,updateSamlConfiguration:()=>cc,updateSamlGroup:()=>vc,updateSamlRoles:()=>gc,updateSamlVendorMetadata:()=>dc,updateTenantApiTokensData:()=>Wc,updateUserApiTokensData:()=>Bc,validateSSODomain:()=>cu,validateSamlDomain:()=>yc,verifyChangePhoneNumber:()=>Ou,verifyInviteToken:()=>Qc,verifyMFAAuthenticatorAppForLogin:()=>Kl,verifyMFAEmailCode:()=>ql,verifyMFAEmailCodeV2:()=>Jl,verifyMFASMSForLogin:()=>ec,verifyMFASMSForLoginV2:()=>tc,verifyMFAWebAuthnForLogin:()=>rc,verifyMFAWebAuthnForLoginV2:()=>sc,verifyMfa:()=>Nl,verifyNewDeviceSession:()=>Ru,verifyResetPhoneNumber:()=>Eu,webAuthnCreateNewDeviceSession:()=>wu,webAuthnPostLogin:()=>_u,webAuthnPostLoginV2:()=>Lu,webAuthnPreLogin:()=>Pu});var l={};n.r(l),n.d(l,{addUser:()=>Ku,changePassword:()=>Wu,createInviteUserLink:()=>Qu,deleteInviteUserLink:()=>ed,deleteUser:()=>Hu,getInviteLinkConfiguration:()=>nd,getInviteUserLink:()=>td,getProfile:()=>Vu,getTemporaryUserConfiguration:()=>Xu,loadAvailablePermissions:()=>ad,loadAvailableRoles:()=>id,loadStats:()=>od,loadUsers:()=>zu,resendActivationLink:()=>rd,resendInvitationLink:()=>sd,resendInvitationLinkToAllTenants:()=>ld,setPermanentUser:()=>Yu,updateInviteUserLink:()=>Zu,updateProfile:()=>ju,updateProfileImage:()=>Bu,updateUser:()=>qu,updateUserExpirationTime:()=>Ju});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:()=>ud,getAuditsMetadata:()=>gd,getCurrentUserIpMetadata:()=>yd,getIpAdressMetadata:()=>Sd,getNotificationsMetadata:()=>fd,getSamlMetadata:()=>pd,updateAdminBoxMetadata:()=>dd});var u={};n.r(u),n.d(u,{downloadReport:()=>kd,getReport:()=>bd,getReports:()=>Ad,renderReport:()=>Td,scheduleReport:()=>Ed,sendReport:()=>Od});var d={};n.r(d),n.d(d,{getNotifications:()=>Id,markAllAsRead:()=>Ld,updateNotificationIsPinned:()=>_d,updateNotificationStatus:()=>Pd});var y={};n.r(y),n.d(y,{exportAudits:()=>Rd,getAudits:()=>Ud,getAuditsStats:()=>Cd});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:()=>Hd,deleteEmailSubscriptions:()=>zd,deleteSMSConfiguration:()=>Zd,deleteSMSSubscriptions:()=>Xd,deleteSlackConfiguration:()=>xd,deleteWebhooksConfiguration:()=>ny,getCategories:()=>ry,getChannelMaps:()=>sy,getEmailConfiguration:()=>jd,getSMSConfiguration:()=>qd,getSlackChannels:()=>Gd,getSlackConfiguration:()=>Md,getSlackScope:()=>Fd,getWebhookLog:()=>iy,getWebhooksConfigurations:()=>ey,patchEmailConfiguration:()=>Wd,patchSMSConfiguration:()=>Yd,postEmailConfiguration:()=>Bd,postSMSConfiguration:()=>Jd,postSlackCode:()=>Vd,postSlackConfiguration:()=>$d,postWebhookRetry:()=>oy,postWebhookTest:()=>ay,postWebhooksConfiguration:()=>ty,putEmailSubscriptions:()=>Kd,putSMSSubscriptions:()=>Qd});var p={};n.r(p),n.d(p,{getPublicSettings:()=>uy,getSettings:()=>cy,updateSettings:()=>ly});var g={};n.r(g),n.d(g,{addRole:()=>gy,attachPermissionToRoles:()=>Ay,attachPermissionsToRole:()=>hy,deleteRole:()=>Sy,getPermissionCategories:()=>by,getPermissions:()=>my,getRoles:()=>py,updateRole:()=>vy});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:()=>Zy,ISubscriptionStatus:()=>Xy,PaymentMethodType:()=>Qy,ProviderType:()=>ef,TenantCreatedAction:()=>nf,TrialEndAction:()=>tf,cancelManagedSubscription:()=>Ly,cancelSubscription:()=>ky,createStripeCustomer:()=>By,createStripePaymentMethodSetupIntentSecret:()=>zy,createSubscription:()=>Vy,createTenantConfiguration:()=>qy,getManagedSubscription:()=>Py,getManagedSubscriptions:()=>_y,getPaymentMethod:()=>$y,getPaymentMethods:()=>Gy,getPaymentProviders:()=>Jy,getStripeCustomer:()=>jy,getStripePaymentProviderConfiguration:()=>Wy,getSubscription:()=>Ey,getSubscriptionInvoice:()=>Ny,getSubscriptionInvoicePdf:()=>My,getSubscriptionInvoices:()=>Dy,getSubscriptionPlan:()=>Ry,getSubscriptionPlans:()=>Cy,getSubscriptionSummaries:()=>Ky,getSubscriptions:()=>Ty,getTenantConfiguration:()=>Hy,getVendorPublicConfigurations:()=>Yy,renewManagedSubscription:()=>wy,renewSubscription:()=>Oy,updateManagedSubscription:()=>Uy,updatePaymentMethodBillingDetails:()=>xy,updateSubscription:()=>Iy});var v={};n.r(v),n.d(v,{getVendorPublicInfo:()=>af});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:()=>lf,addUserToTenantAndSubTenants:()=>rf,addUsersToSubTenant:()=>gf,createSubTenant:()=>df,deleteSubTenant:()=>yf,loadAllUsers:()=>of,removeUserFromTenantAndSubTenants:()=>sf,removeUserRolesFromSubTenants:()=>cf,setUserRolesForSubTenants:()=>uf,updateSubAccountAccess:()=>pf,updateSubTenant:()=>ff});var m={};n.r(m),n.d(m,{countConfigurationUsers:()=>Af,createConfiguration:()=>hf,deleteConfiguration:()=>mf,getConfigs:()=>Sf,updateConfiguration:()=>vf});var A={};n.r(A),n.d(A,{impersonate:()=>bf});var b={};n.r(b),n.d(b,{addRolesToGroup:()=>Lf,addUsersToGroup:()=>Uf,createGroup:()=>If,deleteGroup:()=>_f,deleteRolesFromGroup:()=>wf,deleteUsersFromGroup:()=>Cf,getGroupById:()=>Ef,getGroupConfiguration:()=>Rf,getGroups:()=>kf,getGroupsByIds:()=>Of,updateGroup:()=>Pf,updateGroupConfiguration:()=>Df});var T={};n.r(T),n.d(T,{getInsights:()=>Mf,getRecommendations:()=>Nf});var E={};n.r(E),n.d(E,{createPhoneNumber:()=>Gf,deletePhoneNumber:()=>$f,getUserPhoneNumbers:()=>Ff,preVerifyPhoneNumber:()=>xf,verifyDeletePhoneNumber:()=>jf,verifyPhoneNumber:()=>Vf});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:()=>qs,AuthStrategyEnum:()=>Oi,ContextHolder:()=>Vo,FeatureFlags:()=>Br,FronteggApiError:()=>Bo,FronteggContext:()=>jo,FronteggFrameworks:()=>di,GetUsersFilterPreset:()=>pi,GroupManagedByEnum:()=>ep,GroupRelations:()=>Zf,ISubscriptionCancellationPolicy:()=>Zy,ISubscriptionStatus:()=>Xy,InsightCode:()=>np,LOAD_AUTHORIZATION_FF:()=>Ws,MFAStrategyEnum:()=>Bs,MachineToMachineAuthStrategy:()=>Ii,NotEntitledJustification:()=>Hs,PaginationOrderEnum:()=>yi,PaymentMethodType:()=>Qy,ProviderType:()=>ef,RecommendationActionKey:()=>ip,RecommendationCode:()=>tp,RecommendationSeverity:()=>ap,RequestSource:()=>ui,RestrictionType:()=>zn,ScimConnectionSource:()=>Qf,SecondaryAuthStrategy:()=>Vs,SecurityCategory:()=>op,SocialLoginProviders:()=>ki,SortByEnum:()=>fi,TenantSortByEnum:()=>Wf,TenantType:()=>zf,USE_ENTITLEMENTS_V2_ENDPOINT_FF:()=>Vr,UserManagedByEnum:()=>Bf,WebAuthnDeviceType:()=>js,api:()=>rp,countConfigurationUsers:()=>Af,createConfiguration:()=>hf,default:()=>sp,deleteConfiguration:()=>mf,fetch:()=>e,fronteggAuthApiRoutesRegex:()=>Kf,fronteggHeaders:()=>ci,fronteggRefreshTokenUrl:()=>Hf,fronteggSilentRefreshTokenUrl:()=>qf,fronteggTenantsUrl:()=>Yf,fronteggTenantsV3Url:()=>Xf,fronteggUsersUrl:()=>Jf,getConfigs:()=>Sf,getCurrentUserTenantsFunction:()=>ns,getTabTenantFromSessionStorage:()=>ts,loadFeatureFlags:()=>Wr,providersArray:()=>gi,setTabTenantInSessionStorage:()=>es,updateConfiguration:()=>vf});var O={};function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function _(e){var t=function(e,t){if("object"!==P(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==P(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===P(t)?t:String(t)}function L(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,_(i.key),i)}}function w(e,t,n){return t&&L(e.prototype,t),n&&L(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(O),n.d(O,{AccountDetailsPageTabs:()=>ew,AccountPageFields:()=>HL,DomainRestrictionsTabFields:()=>ZL,GeneralSettingsTabFields:()=>XL,InviteUserModalFields:()=>KL,IpRestrictionsTabFields:()=>QL,Metadata:()=>GL,PrivacyPageFields:()=>zL,ProfilePageFields:()=>WL,SecurityPageTabs:()=>JL,SessionManagementTabFields:()=>YL,SignupFields:()=>BL,SubscriptionsPageFields:()=>qL,alpha:()=>UL,fieldAppearance:()=>tw,tabAppearance:()=>nw});var U=function(){function e(){I(this,e)}return w(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,a,o,r,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=o.call(n)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(e,t,n,i,a,o,r){try{var s=e[o](r),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,a)}function N(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function r(e){D(o,i,a,r,s,"next",e)}function s(e){D(o,i,a,r,s,"throw",e)}r(void 0)}))}}U._apps={};var M=n(841),F=n.n(M);function G(){return G=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},G.apply(this,arguments)}function $(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function x(e){return!!e&&!!e[Ie]}function V(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Pe}(e)||Array.isArray(e)||!!e[Oe]||!!e.constructor[Oe]||H(e)||q(e))}function j(e,t,n){void 0===n&&(n=!1),0===B(e)?(n?Object.keys:_e)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function B(e){var t=e[Ie];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:H(e)?2:q(e)?3:0}function W(e,t){return 2===B(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function z(e,t,n){var i=B(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function K(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function H(e){return be&&e instanceof Map}function q(e){return Te&&e instanceof Set}function J(e){return e.o||e.t}function Y(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Le(e);delete t[Ie];for(var n=_e(t),i=0;i<n.length;i++){var a=n[i],o=t[a];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[a]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[a]})}return Object.create(Object.getPrototypeOf(e),t)}function X(e,t){return void 0===t&&(t=!1),Z(e)||x(e)||!V(e)||(B(e)>1&&(e.set=e.add=e.clear=e.delete=Q),Object.freeze(e),t&&j(e,(function(e,t){return X(t,!0)}),!0)),e}function Q(){$(2)}function Z(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function ee(e){var t=we[e];return t||$(18,e),t}function te(){return me}function ne(e,t){t&&(ee("Patches"),e.u=[],e.s=[],e.v=t)}function ie(e){ae(e),e.p.forEach(re),e.p=null}function ae(e){e===me&&(me=e.l)}function oe(e){return me={p:[],l:me,h:e,m:!0,_:0}}function re(e){var t=e[Ie];0===t.i||1===t.i?t.j():t.O=!0}function se(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||ee("ES5").S(t,e,i),i?(n[Ie].P&&(ie(t),$(4)),V(e)&&(e=le(t,e),t.l||ue(t,e)),t.u&&ee("Patches").M(n[Ie].t,e,t.u,t.s)):e=le(t,n,[]),ie(t),t.u&&t.v(t.u,t.s),e!==ke?e:void 0}function le(e,t,n){if(Z(t))return t;var i=t[Ie];if(!i)return j(t,(function(a,o){return ce(e,i,t,a,o,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return ue(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var a=4===i.i||5===i.i?i.o=Y(i.k):i.o;j(3===i.i?new Set(a):a,(function(t,o){return ce(e,i,a,t,o,n)})),ue(e,a,!1),n&&e.u&&ee("Patches").R(i,n,e.u,e.s)}return i.o}function ce(e,t,n,i,a,o){if(x(a)){var r=le(e,a,o&&t&&3!==t.i&&!W(t.D,i)?o.concat(i):void 0);if(z(n,i,r),!x(r))return;e.m=!1}if(V(a)&&!Z(a)){if(!e.h.F&&e._<1)return;le(e,a),t&&t.A.l||ue(e,a)}}function ue(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&X(t,n)}function de(e,t){var n=e[Ie];return(n?J(n):e)[t]}function ye(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=Object.getPrototypeOf(n)}}function fe(e){e.P||(e.P=!0,e.l&&fe(e.l))}function pe(e){e.o||(e.o=Y(e.t))}function ge(e,t,n){var i=H(t)?ee("MapSet").N(t,n):q(t)?ee("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:te(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},a=i,o=Ue;n&&(a=[i],o=Ce);var r=Proxy.revocable(a,o),s=r.revoke,l=r.proxy;return i.k=l,i.j=s,l}(t,n):ee("ES5").J(t,n);return(n?n.A:te()).p.push(i),i}function Se(e){return x(e)||$(22,e),function e(t){if(!V(t))return t;var n,i=t[Ie],a=B(t);if(i){if(!i.P&&(i.i<4||!ee("ES5").K(i)))return i.t;i.I=!0,n=ve(t,a),i.I=!1}else n=ve(t,a);return j(n,(function(t,a){i&&function(e,t){return 2===B(e)?e.get(t):e[t]}(i.t,t)===a||z(n,t,e(a))})),3===a?new Set(n):n}(e)}function ve(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Y(e)}var he,me,Ae="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),be="undefined"!=typeof Map,Te="undefined"!=typeof Set,Ee="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,ke=Ae?Symbol.for("immer-nothing"):((he={})["immer-nothing"]=!0,he),Oe=Ae?Symbol.for("immer-draftable"):"__$immer_draftable",Ie=Ae?Symbol.for("immer-state"):"__$immer_state",Pe=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),_e="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Le=Object.getOwnPropertyDescriptors||function(e){var t={};return _e(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},we={},Ue={get:function(e,t){if(t===Ie)return e;var n=J(e);if(!W(n,t))return function(e,t,n){var i,a=ye(t,n);return a?"value"in a?a.value:null===(i=a.get)||void 0===i?void 0:i.call(e.k):void 0}(e,n,t);var i=n[t];return e.I||!V(i)?i:i===de(e.t,t)?(pe(e),e.o[t]=ge(e.A.h,i,e)):i},has:function(e,t){return t in J(e)},ownKeys:function(e){return Reflect.ownKeys(J(e))},set:function(e,t,n){var i=ye(J(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var a=de(J(e),t),o=null==a?void 0:a[Ie];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(K(n,a)&&(void 0!==n||W(e.t,t)))return!0;pe(e),fe(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==de(e.t,t)||t in e.t?(e.D[t]=!1,pe(e),fe(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=J(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){$(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){$(12)}},Ce={};j(Ue,(function(e,t){Ce[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ce.deleteProperty=function(e,t){return Ce.set.call(this,e,t,void 0)},Ce.set=function(e,t,n){return Ue.set.call(this,e[0],t,n,e[0])};var Re=function(){function e(e){var t=this;this.g=Ee,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var a=n;n=e;var o=t;return function(e){var t=this;void 0===e&&(e=a);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return o.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&$(6),void 0!==i&&"function"!=typeof i&&$(7),V(e)){var s=oe(t),l=ge(t,e,void 0),c=!0;try{r=n(l),c=!1}finally{c?ie(s):ae(s)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return ne(s,i),se(e,s)}),(function(e){throw ie(s),e})):(ne(s,i),se(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===ke&&(r=void 0),t.F&&X(r,!0),i){var u=[],d=[];ee("Patches").M(e,r,u,d),i(u,d)}return r}$(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,a=Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(a))}))};var i,a,o=t.produce(e,n,(function(e,t){i=e,a=t}));return"undefined"!=typeof Promise&&o instanceof Promise?o.then((function(e){return[e,i,a]})):[o,i,a]},"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){V(e)||$(8),x(e)&&(e=Se(e));var t=oe(this),n=ge(this,e,void 0);return n[Ie].C=!0,ae(t),n},t.finishDraft=function(e,t){var n=(e&&e[Ie]).A;return ne(n,t),se(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Ee&&$(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var a=ee("Patches").$;return x(e)?a(e,t):this.produce(e,(function(e){return a(e,t)}))},e}(),De=new Re,Ne=De.produce;De.produceWithPatches.bind(De),De.setAutoFreeze.bind(De),De.setUseProxies.bind(De),De.applyPatches.bind(De),De.createDraft.bind(De),De.finishDraft.bind(De);const Me=Ne;function Fe(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function $e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach((function(t){Fe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xe(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 Ve="function"==typeof Symbol&&Symbol.observable||"@@observable",je=function(){return Math.random().toString(36).substring(7).split("").join(".")},Be={INIT:"@@redux/INIT"+je(),REPLACE:"@@redux/REPLACE"+je(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+je()}};function We(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function ze(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(xe(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(xe(1));return n(ze)(e,t)}if("function"!=typeof e)throw new Error(xe(2));var a=e,o=t,r=[],s=r,l=!1;function c(){s===r&&(s=r.slice())}function u(){if(l)throw new Error(xe(3));return o}function d(e){if("function"!=typeof e)throw new Error(xe(4));if(l)throw new Error(xe(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(xe(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!We(e))throw new Error(xe(7));if(void 0===e.type)throw new Error(xe(8));if(l)throw new Error(xe(9));try{l=!0,o=a(o,e)}finally{l=!1}for(var t=r=s,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(xe(10));a=e,y({type:Be.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(xe(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Ve]=function(){return this},e}return y({type:Be.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Ve]=p,i}function Ke(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var a=t[i];"function"==typeof e[a]&&(n[a]=e[a])}var o,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Be.INIT}))throw new Error(xe(12));if(void 0===n(void 0,{type:Be.PROBE_UNKNOWN_ACTION()}))throw new Error(xe(13))}))}(n)}catch(e){o=e}return function(e,t){if(void 0===e&&(e={}),o)throw o;for(var i=!1,a={},s=0;s<r.length;s++){var l=r[s],c=n[l],u=e[l],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(xe(14));a[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?a:e}}function He(){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 qe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw new Error(xe(15))},a={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},o=t.map((function(e){return e(a)}));return i=He.apply(void 0,o)(n.dispatch),$e($e({},n),{},{dispatch:i})}}}function Je(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(a){return"function"==typeof a?a(n,i,e):t(a)}}}}var Ye=Je();Ye.withExtraArgument=Je;const Xe=Ye;var Qe,Ze=(Qe=function(e,t){return Qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Qe(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Qe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),et=function(e,t){for(var n=0,i=t.length,a=e.length;n<i;n++,a++)e[a]=t[n];return e},tt=Object.defineProperty,nt=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),it=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable,ot=function(e,t,n){return t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},rt=function(e,t){for(var n in t||(t={}))it.call(t,n)&&ot(e,n,t[n]);if(nt)for(var i=0,a=nt(t);i<a.length;i++)n=a[i],at.call(t,n)&&ot(e,n,t[n]);return e},st="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?He:He.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var lt=function(e){function t(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=e.apply(this,n)||this;return Object.setPrototypeOf(a,t.prototype),a}return Ze(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,et([void 0],e[0].concat(this)))):new(t.bind.apply(t,et([void 0],e.concat(this))))},t}(Array);function ct(e){return V(e)?Me(e,(function(){})):e}function ut(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new lt);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(Xe):i.push(Xe.withExtraArgument(n.extraArgument))),i}function dt(e){var t,n=function(e){return ut(e)},i=e||{},a=i.reducer,o=void 0===a?void 0:a,r=i.middleware,s=void 0===r?n():r,l=i.devTools,c=void 0===l||l,u=i.preloadedState,d=void 0===u?void 0:u,y=i.enhancers,f=void 0===y?void 0:y;if("function"==typeof o)t=o;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}(o))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Ke(o)}var p=s;"function"==typeof p&&(p=p(n));var g=qe.apply(void 0,p),S=He;c&&(S=st(rt({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=et([g],f):"function"==typeof f&&(v=f(v)),ze(t,d,S.apply(void 0,v))}function yt(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var a=t.apply(void 0,n);if(!a)throw new Error("prepareAction did not return an object");return rt(rt({type:e,payload:a.payload},"meta"in a&&{meta:a.meta}),"error"in a&&{error:a.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ft(e){var t,n={},i=[],a={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,a},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),a},addDefaultCase:function(e){return t=e,a}};return e(a),[n,i,t]}function pt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:ct(e.initialState),a=e.reducers||{},o=Object.keys(a),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?ft(e.extraReducers):[e.extraReducers],n=t[0],a=void 0===n?{}:n,o=t[1],r=void 0===o?[]:o,l=t[2],c=void 0===l?void 0:l,u=rt(rt({},a),s);return function(e,t,n,i){void 0===n&&(n=[]);var a,o="function"==typeof t?ft(t):[t,n,i],r=o[0],s=o[1],l=o[2];if(function(e){return"function"==typeof e}(e))a=function(){return ct(e())};else{var c=ct(e);a=function(){return c}}function u(e,t){void 0===e&&(e=a());var n=et([r[t.type]],s.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[l]),n.reduce((function(e,n){if(n){var i;if(x(e))return void 0===(i=n(e,t))?e:i;if(V(e))return Me(e,(function(e){return n(e,t)}));if(void 0===(i=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}return e}),e)}return u.getInitialState=a,u}(i,u,r,c)}return o.forEach((function(e){var n,i,o=a[e],c=t+"/"+e;"reducer"in o?(n=o.reducer,i=o.prepare):n=o,r[e]=n,s[c]=n,l[e]=i?yt(c,i):yt(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:l,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var gt="listenerMiddleware";yt(gt+"/add"),yt(gt+"/removeAll"),yt(gt+"/remove"),function(){function e(e,t){var n=a[e];return n?n.enumerable=t:a[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Ie];return Ue.get(t,e)},set:function(t){var n=this[Ie];Ue.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var a=e[t][Ie];if(!a.P)switch(a.i){case 5:i(a)&&fe(a);break;case 4:n(a)&&fe(a)}}}function n(e){for(var t=e.t,n=e.k,i=_e(n),a=i.length-1;a>=0;a--){var o=i[a];if(o!==Ie){var r=t[o];if(void 0===r&&!W(t,o))return!0;var s=n[o],l=s&&s[Ie];if(l?l.t!==r:!K(s,r))return!0}}var c=!!t[Ie];return i.length!==_e(t).length+(c?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var i=0;i<t.length;i++)if(!t.hasOwnProperty(i))return!0;return!1}var a={};!function(e,t){we[e]||(we[e]=t)}("ES5",{J:function(t,n){var i=Array.isArray(t),a=function(t,n){if(t){for(var i=Array(n.length),a=0;a<n.length;a++)Object.defineProperty(i,""+a,e(a,!0));return i}var o=Le(n);delete o[Ie];for(var r=_e(o),s=0;s<r.length;s++){var l=r[s];o[l]=e(l,t||!!o[l].enumerable)}return Object.create(Object.getPrototypeOf(n),o)}(i,t),o={i:i?5:4,A:n?n.A:te(),P:!1,I:!1,D:{},l:n,t,k:a,o:null,O:!1,C:!1};return Object.defineProperty(a,Ie,{value:o,writable:!0}),a},S:function(e,n,a){a?x(n)&&n[Ie].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Ie];if(n){var a=n.t,o=n.k,r=n.D,s=n.i;if(4===s)j(o,(function(t){t!==Ie&&(void 0!==a[t]||W(a,t)?r[t]||e(o[t]):(r[t]=!0,fe(n)))})),j(a,(function(e){void 0!==o[e]||W(o,e)||(r[e]=!1,fe(n))}));else if(5===s){if(i(n)&&(fe(n),r.length=!0),o.length<a.length)for(var l=o.length;l<a.length;l++)r[l]=!1;else for(var c=a.length;c<o.length;c++)r[c]=!0;for(var u=Math.min(o.length,a.length),d=0;d<u;d++)o.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(o[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}();const St=(e,t)=>n=>G({},n,{[e]:t[e]}),vt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>G({},t,{[e]:G({},t[e],n)})}),ht=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var a;return G({},n,{[e]:G({},n[e],{[t]:G({},null==n||null==(a=n[e])?void 0:a[t],i)})})}}),mt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i,a;return G({},t,{[e]:G({},t[e],{loaders:G({},null==(i=t[e])?void 0:i.loaders,{[n.key]:null==(a=n.value)||a})})})}}),At=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return G({},t,{[e]:G({},t[e],{errors:G({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),bt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:a})=>{var o;return G({},i,{[e]:G({},i[e],{[t]:G({},null==i||null==(o=i[e])?void 0:o[t],a,n)})})}}),Tt=(e,t,n)=>i=>{var a;return G({},i,{[e]:G({},i[e],{[t]:G({},null==i||null==(a=i[e])?void 0:a[t],n)})})},Et=(e=500)=>new Promise((t=>setTimeout(t,e))),kt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Ot=new Uint8Array(256);for(let e=0;e<kt.length;e++)Ot[kt.charCodeAt(e)]=e;const It=e=>{const t=.75*e.length,n=e.length;let i,a,o,r,s,l=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)a=Ot[e.charCodeAt(i)],o=Ot[e.charCodeAt(i+1)],r=Ot[e.charCodeAt(i+2)],s=Ot[e.charCodeAt(i+3)],c[l++]=a<<2|o>>4,c[l++]=(15&o)<<4|r>>2,c[l++]=(3&r)<<6|63&s;return c.buffer},Pt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(Pt(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let i,a="";for(i=0;i<n;i+=3)a+=kt[t[i]>>2],a+=kt[(3&t[i])<<4|t[i+1]>>4],a+=kt[(15&t[i+1])<<2|t[i+2]>>6],a+=kt[63&t[i+2]];return n%3==2?a=a.substring(0,a.length-1):n%3==1&&(a=a.substring(0,a.length-2)),a})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=Pt(e[n]);return t}return e};let _t,Lt,wt,Ut;!function(e){e.preLogin="preLogin",e.magicLinkPreLoginSuccess="magicLinkPreLoginSuccess",e.loginWithSmsOtc="loginWithSmsOtc",e.loginWithQuickSmsOtc="loginWithQuickSmsOtc",e.loginWithOtc="loginWithOtc",e.loginWithPassword="loginWithPassword",e.loginWithTwoFactor="loginWithTwoFactor",e.redirectToSSO="redirectToSSO",e.loginWithSSOFailed="loginWithSSOFailed",e.success="success",e.forceTwoFactor="forceTwoFactor",e.recoverTwoFactor="recoverTwoFactor",e.promptPasskeys="promptPasskeys",e.breachedPassword="breachedPassword",e.breachedPasswordSuccess="breachedPasswordSuccess"}(_t||(_t={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Lt||(Lt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(wt||(wt={})),function(e){e["social-login"]="social-login",e["custom-social-login"]="custom-social-login",e.direct="direct"}(Ut||(Ut={}));const Ct="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Rt="HOSTED_LOGIN_VERIFIER_KEY",Dt="auth",Nt="connectivity",Mt="auditLogs",Ft="vendor",Gt={flow:Lt.Login,step:_t.preLogin,loading:!1,email:"",tenants:[]},$t={setLoginState:vt("loginState"),resetLoginState:St("loginState",{loginState:Gt})},xt={requestAuthorize:yt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:yt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:yt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),requestHostedLoginAuthorizeV2:yt("auth/requestHostedLoginAuthorizeV2",(e=>({payload:e}))),handleHostedLoginCallback:yt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:yt("auth/afterAuthNavigation"),preLogin:yt("auth/preLogin",(e=>({payload:e}))),postLogin:yt("auth/postLogin",(e=>({payload:e}))),login:yt("auth/login",(e=>({payload:e}))),loginWithMfa:yt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:yt("auth/recoverMfa",(e=>({payload:e}))),logout:yt("auth/logout",(e=>({payload:e}))),silentLogout:yt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:yt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:yt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:yt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:yt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:yt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:yt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:yt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:yt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:yt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:yt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:yt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:yt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:yt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:yt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:yt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:yt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:yt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:yt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:yt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:yt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:yt("auth/verifyMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAEmailCode:yt("auth/preVerifyMFAEmailCode",(e=>({payload:e}))),verifyMFAEmailCode:yt("auth/verifyMFAEmailCode",(e=>({payload:e}))),resetBreachedPassword:yt("auth/resetBreachedPassword",(e=>({payload:e})))};let Vt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Vt||(Vt={}));const jt={step:Vt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Bt={setActivateState:vt("activateState"),resetActivateState:St("activateState",{activateState:jt}),setActivateStrategyState:ht("activateState","activationStrategy")},Wt={activateAccount:yt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:yt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:yt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:yt("auth/resendActivationEmail",(e=>({payload:e})))};let zt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(zt||(zt={}));const Kt={step:zt.validate},Ht={setAcceptInvitationState:vt("acceptInvitationState"),resetAcceptInvitationState:St("acceptInvitationState",{acceptInvitationState:Kt})},qt={acceptInvitation:yt("auth/acceptInvitation",(e=>({payload:e})))};let Jt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Jt||(Jt={}));const Yt={step:Jt.forgotPassword,loading:!1,email:"",passwordConfig:null},Xt={setForgotPasswordState:vt("forgotPasswordState"),resetForgotPasswordState:St("forgotPasswordState",{forgotPasswordState:Yt})},Qt={forgotPassword:yt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:yt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:yt("auth/loadPasswordConfig",(e=>({payload:e})))};let Zt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Zt||(Zt={}));const en={step:Zt.ResetPhoneNumber,loading:!1},tn={setResetPhoneNumberState:vt("resetPhoneNumberState"),resetResetPhoneNumberState:St("resetPhoneNumberState",{resetPhoneNumberState:en})},nn={resetPhoneNumber:yt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:yt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:yt("auth/changePhoneNumber",(e=>({payload:e})))},an={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},on={setSSOLoader:mt("ssoState"),setSSOError:At("ssoState"),setSSOState:vt("ssoState"),resetSSOState:St("ssoState",{ssoState:an})},rn={loadSSOConfigurationsV2:yt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:yt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:yt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:yt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:yt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:yt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:yt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:yt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:yt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:yt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:yt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:yt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:yt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:yt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:yt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:yt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:yt("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:yt("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:yt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:yt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:yt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:yt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:yt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:yt("auth/oidcPostlogin",(e=>({payload:e})))},sn={loading:!1,error:null},ln={setProfileState:vt("profileState"),resetProfileState:St("profileState",{profileState:sn})},cn={loadProfile:yt("auth/loadProfile"),saveProfile:yt("auth/saveProfile",(e=>({payload:e}))),changePassword:yt("auth/changePassword",(e=>({payload:e})))};let un;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode",e.noMFAEnrolledStepUp="noMFAEnrolledStepUp"}(un||(un={}));const dn={step:un.verify,loading:!1,saving:!1},yn={setMfaState:vt("mfaState"),resetMfaState:St("mfaState",{mfaState:dn})},fn={enrollMfa:yt("auth/enrollMfa"),getMFADevices:yt("auth/getMFADevices"),getMFAStrategies:yt("auth/getMFAStrategies"),verifyMfa:yt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:yt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:yt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:yt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:yt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:yt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:yt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:yt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:yt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:yt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:yt("auth/disableMfaWebAuthn",(e=>({payload:e})))},pn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,shouldShowSubTenantUsersIfReseller:!1,allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},gn={setTeamLoader:mt("teamState"),setTeamError:At("teamState"),setTeamState:vt("teamState"),resetTeamState:St("teamState",{teamState:pn})},Sn={loadUsersV2:yt("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:yt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:yt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:yt("auth/loadRoles",(e=>({payload:e}))),addUser:yt("auth/addUser",(e=>({payload:e}))),addUsersBulk:yt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:yt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:yt("auth/updateUser",(e=>({payload:e}))),deleteUser:yt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:yt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:yt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:yt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:yt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:yt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:yt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:yt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getTemporaryUsersConfig:yt("auth/getTemporaryUsersConfig"),updateUserExpirationTime:yt("auth/updateUserExpirationTime",(e=>({payload:e}))),setUserAsPermanent:yt("auth/setUserAsPermanent",(e=>({payload:e}))),getInvitationLink:yt("auth/getInvitationLink"),createInvitationLink:yt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:yt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:yt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:yt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:yt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:yt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:yt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:yt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:yt("auth/closeLockUserDialog",(e=>({payload:e})))},vn={firstLoad:!0,loading:!1,error:""},hn={setSocialLoginsState:vt("socialLoginState"),resetSocialLoginsState:St("socialLoginState",{socialLoginState:vn})},mn={loadSocialLoginsConfiguration:yt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:yt("auth/loadSocialLoginsConfigurationV2",(e=>({payload:e}))),loginViaSocialLogin:yt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:yt("auth/setSocialLoginError",(e=>({payload:e})))};let An;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(An||(An={}));const bn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:An.SignUp},Tn={setSignUpState:vt("signUpState"),resetSignUpState:St("signUpState",{signUpState:bn})},En={signUpUser:yt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:yt("auth/resetSignUpStateSoft")},kn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},On={setApiTokensLoader:mt("apiTokensState"),setApiTokensError:At("apiTokensState"),setApiTokensState:vt("apiTokensState"),resetApiTokensState:St("apiTokensState",{apiTokensState:kn})},In={loadApiTokens:yt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:yt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:yt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:yt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:yt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:yt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:yt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:yt("auth/deleteTenantApiToken",(e=>({payload:e})))},Pn={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}},_n={setSecurityPolicyState:vt("securityPolicyState"),setSecurityPolicyGlobalState:ht("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:ht("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:ht("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:ht("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:ht("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:ht("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:ht("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:ht("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:ht("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:ht("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:ht("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:St("securityPolicyState",{securityPolicyState:Pn})},Ln={loadSecurityPolicy:yt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:yt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:yt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:yt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:yt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:yt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:yt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:yt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:yt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:yt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:yt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:yt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:yt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:yt("auth/loadPublicAuthStrategiesPolicy")},wn={loading:!1},Un={setAccountSettingsState:vt("accountSettingsState"),resetAccountSettingsState:St("accountSettingsState",{accountSettingsState:wn})},Cn={loadAccountSettings:yt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:yt("auth/saveAccountSettings",(e=>({payload:e})))},Rn={tenants:[],subTenants:[],loading:!0,tenantTree:null},Dn={setTenantsState:vt("tenantsState"),resetTenantsState:St("tenantsState",{tenantsState:Rn})},Nn={switchTenant:yt("auth/switchTenant",(e=>({payload:e}))),loadTenants:yt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:yt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:yt("auth/loadSubTenantsTree",(e=>({payload:e})))},Mn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Fn={setRolesState:vt("rolesState"),resetRolesState:St("rolesState",{rolesState:Mn})},Gn={loadRolesAndPermissions:yt("auth/loadRoles",(e=>({payload:e}))),addRole:yt("auth/addRole",(e=>({payload:e}))),updateRole:yt("auth/updateRole",(e=>({payload:e}))),deleteRole:yt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:yt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:yt("auth/attachPermissionToRoles",(e=>({payload:e})))},$n={loading:!1,sessions:[]},xn={setSessionsState:vt("sessionsState"),resetSessionsState:St("sessionsState",{sessionsState:$n})},Vn={loadUserSessions:yt("auth/loadUserSessions"),loadCurrentUserSession:yt("auth/loadCurrentUserSession"),deleteUserSession:yt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:yt("auth/deleteAllUserSessions"),revokeUserSessions:yt("auth/revokeUserSessions",(e=>({payload:e})))},jn={loading:!1,configurations:{}},Bn={setSessionsPolicyState:vt("sessionsPolicyState"),resetSessionsPolicyState:St("sessionsPolicyState",{sessionsPolicyState:jn})},Wn={loadSessionsPolicy:yt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:yt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let zn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(zn||(zn={}));const Kn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:zn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Hn={setRestrictionsState:vt("restrictionsState"),setIpRestrictionsState:ht("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:ht("restrictionsState","emailDomainRestrictions")},qn={checkIfUserIpValid:yt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:yt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:yt("auth/loadIpRestrictions"),saveIpRestriction:yt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:yt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:yt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:yt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:yt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:yt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:yt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Jn={loading:!1},Yn={setProvisioningState:vt("provisioningState"),resetProvisioningState:St("provisioningState",{provisioningState:Jn})},Xn={loadProvisionConnections:yt("auth/loadProvisionConnections"),createProvisionConnection:yt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:yt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:yt("auth/updateProvisionConnection",(e=>({payload:e})))},Qn={devices:[],loading:!1,error:null},Zn={setPasskeysState:vt("passkeysState"),resetPasskeysState:St("passkeysState",{passkeysState:Qn})},ei={loadWebAuthnDevices:yt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:yt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},ti={loaders:{},errors:{},groups:[],groupsConfiguration:{}},ni={setUsersGroupsLoader:mt("groupsState"),setUsersGroupsError:At("groupsState"),setGroupsState:vt("groupsState"),resetUsersGroupsState:St("groupsState",{groupsState:ti})},ii={loadGroups:yt("auth/loadUsersGroups"),getGroupById:yt("auth/getGroupById",(e=>({payload:e}))),createGroup:yt("auth/createGroup",(e=>({payload:e}))),updateGroup:yt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:yt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:yt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:yt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:yt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:yt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:yt("auth/getGroupConfiguration"),updateGroupConfiguration:yt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:yt("auth/getUsers",(e=>({payload:e})))},ai={addGroupDialogState:{loading:!1,open:!1},editGroupDialogState:{loading:!1,open:!1},deleteGroupDialogState:{loading:!1,open:!1},addMembersToGroupDialogState:{loading:!1,open:!1,userIds:[]},deleteMemberFromGroupDialogState:{loading:!1,open:!1}},oi={setGroupsDialogsState:vt("groupsDialogsState"),resetGroupsDialogsState:St("groupsState",{groupsDialogsState:ai}),openAddGroupDialog:Tt("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:Tt("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:bt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:Tt("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:bt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:Tt("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:Tt("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:Tt("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:bt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:Tt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},ri={loading:!0,error:null},si={setCustomLoginState:vt("customLoginState"),resetCustomLoginState:St("customLoginState",{customLoginState:ri})},li={loadTenantMetadata:yt("auth/loadTenantMetadata"),updateTenantMetadata:yt("auth/updateTenantMetadata",(e=>({payload:e})))},ci={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source",scopedTenant:"frontegg-scoped-tenant"};let ui,di,yi,fi,pi;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ui||(ui={})),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"}(di||(di={})),function(e){e.ASC="ASC",e.DESC="DESC"}(yi||(yi={})),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"}(fi||(fi={})),function(e){e.MFA_UNENROLLED="mfa-unenrolled",e.BREACHED_PASSWORDS="breached-passwords",e.INACTIVE="inactive"}(pi||(pi={}));const gi=["local","saml","google","github","facebook","microsoft","scim2","slack"],Si={loaders:{},errors:{},accounts:{tenantId:"",children:[]},accountsQueryParams:{_limit:50,_offset:0,_filter:"",_subTenantId:""},searchAccountsData:[],rootAccount:{tenantId:""},selectedAccount:{tenantId:"",userJwt:{accessToken:"",expiresIn:0,expires:""},users:[],usersQueryParams:{_offset:0,_limit:10,_order:yi.DESC,_sortBy:fi.name},usersPageOffset:0,accountSettings:{}}},vi={setAllAccountsLoader:mt("allAccountsState"),setAllAccountsError:At("allAccountsState"),setAllAccountsState:vt("allAccountsState"),setSelectedAccountState:ht("allAccountsState","selectedAccount"),resetAllAccountsState:St("allAccountsState",{allAccountsState:Si})},hi={loadAccounts:yt("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:yt("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:yt("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:yt("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:yt("auth/updateAccount",(e=>({payload:e}))),deleteSubAccount:yt("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:yt("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:yt("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:yt("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:yt("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:yt("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:yt("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setRootAccountData:yt("auth/setRootAccountData"),setSelectedSubAccountData:yt("auth/setSelectedSubAccountData",(e=>({payload:e}))),loadNumberOfUsersForSelectedSubAccount:yt("auth/loadNumberOfUsersForSelectedSubAccount",(e=>({payload:e})))},mi={createSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:"",canSelectParentAccount:!1},updateSubAccountDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1,jwt:""},deleteSubAccountDialog:{accountId:"",accountName:"",isParentAccount:!1,loading:!1,open:!1,error:!1,jwt:""},addUsersToAccountDialog:{loading:!1,open:!1,accountName:"",accountId:"",permissionToGiveAccessToSubAccounts:!1,jwt:""},deleteUserFromAccountDialog:{userId:"",userName:"",accountId:"",loading:!1,open:!1,jwt:""},editUserRolesDialog:{loading:!1,open:!1,jwt:"",accountId:"",userId:"",userName:"",userRoles:[]}},Ai={setAllAccountDialogsState:vt("allAccountsDialogsState"),resetAllAccountDialogsState:St("allAccountsDialogsState",{allAccountsDialogsState:mi}),openCreateSubAccountDialog:bt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:Tt("allAccountsDialogsState","createSubAccountDialog",mi.createSubAccountDialog),openUpdateSubAccountDialog:bt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:Tt("allAccountsDialogsState","updateSubAccountDialog",mi.updateSubAccountDialog),openDeleteSubAccountDialog:bt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:Tt("allAccountsDialogsState","deleteSubAccountDialog",mi.deleteSubAccountDialog),openAddUsersToAccountDialog:bt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:Tt("allAccountsDialogsState","addUsersToAccountDialog",mi.addUsersToAccountDialog),openDeleteUserFromAccountDialog:bt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:Tt("allAccountsDialogsState","deleteUserFromAccountDialog",mi.deleteUserFromAccountDialog),openEditUserRolesDialog:bt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:Tt("allAccountsDialogsState","editUserRolesDialog",mi.editUserRolesDialog)},bi={loaders:{},errors:{},recommendations:void 0,insights:void 0,score:0,breachedPasswordUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},unenrolledMfaUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},inactiveUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10,_maxInactiveSeconds:7776e3}}},Ti={setSecurityCenterState:vt("securityCenterState"),resetSecurityCenterState:St("securityCenterState",{securityCenterState:bi}),setSecurityCenterStateLoader:mt("securityCenterState"),setSecurityCenterStateError:At("securityCenterState")},Ei={loadRecommendations:yt("auth/loadRecommendations"),loadInsights:yt("auth/loadInsights"),sendResetBreachedPasswordEmail:yt("auth/sendResetBreachedPasswordEmail",(e=>({payload:e}))),sendBulkResetBreachedPasswordEmails:yt("auth/sendBulkResetBreachedPasswordEmails",(e=>({payload:e}))),loadBreachedPasswordUsers:yt("auth/loadBreachedPasswordUsers",(e=>({payload:e}))),loadUnenrolledMfaUsers:yt("auth/loadUnenrolledMfaUsers",(e=>({payload:e}))),loadInactiveUsers:yt("auth/loadInactiveUsers",(e=>({payload:e})))};let ki,Oi,Ii;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(ki||(ki={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Oi||(Oi={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Ii||(Ii={}));const Pi={[Oi.Code]:_t.loginWithOtc,[Oi.EmailAndPassword]:_t.loginWithPassword,[Oi.MagicLink]:_t.magicLinkPreLoginSuccess,[Oi.SmsCode]:_t.loginWithSmsOtc},_i={loading:!1,error:null,phoneNumbers:void 0},Li={setSmsState:vt("smsState"),resetSmsState:St("smsState",{smsState:_i})},wi={loadPhoneNumbers:yt("auth/loadPhoneNumbers"),setUpPhoneNumber:yt("auth/setUpPhoneNumber",(e=>({payload:e}))),verifyPhoneNumber:yt("auth/verifyPhoneNumber",(e=>({payload:e}))),deletePhoneNumber:yt("auth/deletePhoneNumber",(e=>({payload:e}))),verifyDeletePhoneNumber:yt("auth/verifyDeletePhoneNumber",(e=>({payload:e}))),preVerifyPhoneNumber:yt("auth/preVerifyPhoneNumber",(e=>({payload:e})))},Ui={loading:!1,mfaDevices:void 0,mfaToken:""},Ci={setStepUpState:vt("stepUpState"),resetStepUpState:St("stepUpState",{stepUpState:Ui})},Ri={stepUpHostedLogin:yt("auth/stepUpHostedLogin",(e=>({payload:e}))),generateStepUpSession:yt("auth/generateStepUpSession",(e=>({payload:e}))),stepUpWithAuthenticator:yt("auth/stepUpWithAuthenticator",(e=>({payload:e}))),preVerifyMFASMSForStepUp:yt("auth/preVerifyMFASMSForStepUp",(e=>({payload:e}))),verifyMFASMSForStepUp:yt("auth/verifyMFASMSForStepUp",(e=>({payload:e}))),preVerifyMFAWebAuthnForStepUp:yt("auth/preVerifyMFAWebAuthnForStepUp",(e=>({payload:e}))),verifyMFAWebAuthnForStepUp:yt("auth/verifyMFAWebAuthnForStepUp",(e=>({payload:e}))),preVerifyMFAEmailCodeForStepUp:yt("auth/preVerifyMFAEmailCodeForStepUp",(e=>({payload:e}))),verifyMFAEmailCodeForStepUp:yt("auth/verifyMFAEmailCodeForStepUp",(e=>({payload:e})))},Di={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:bn,loginState:Gt,stepUpState:Ui,activateState:jt,acceptInvitationState:Kt,forgotPasswordState:Yt,ssoState:an,profileState:sn,customLoginState:ri,mfaState:dn,teamState:pn,groupsState:ti,groupsDialogsState:ai,socialLoginState:vn,apiTokensState:kn,securityPolicyState:Pn,accountSettingsState:wn,tenantsState:Rn,rolesState:Mn,resetPhoneNumberState:en,sessionsState:$n,sessionsPolicyState:jn,restrictionsState:Kn,provisioningState:Jn,passkeysState:Qn,allAccountsState:Si,allAccountsDialogsState:mi,securityCenterState:bi,smsState:_i},Ni=G({routes:{authenticatedUrl:"/",loginUrl:"/account/login",stepUpUrl:"/account/step-up",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:()=>{}},Di);let Mi;!function(e){e.impersonating="impersonating",e.success="success"}(Mi||(Mi={}));const Fi={step:Mi.impersonating,loading:!1},Gi={setImpersonateState:vt("impersonateState"),resetImpersonateState:St("impersonateState",{impersonateState:Fi})},$i={impersonate:yt("impersonation/impersonate",(e=>({payload:e})))},{reducer:xi,actions:Vi}=pt({name:Dt,initialState:Ni,reducers:G({resetState:e=>G({},e,Di),setState:(e,{payload:t})=>G({},e,t),setUser:("user",(e,{payload:t})=>G({},e,{user:t})),setEntitlements:ht("user","entitlements")},$t,Ci,hn,Bt,Gi,Ht,Xt,tn,Tn,ln,si,on,yn,gn,ni,oi,On,_n,Un,Dn,Fn,xn,Bn,Hn,Yn,Zn,vi,Ai,Ti,Li)});const ji=G({loadEntitlements:yt("auth/loadEntitlements",(e=>({payload:e})))},Vi,xt,Ri,mn,Wt,qt,Qt,nn,En,cn,li,rn,fn,Sn,ii,{},In,Ln,Cn,Nn,Gn,Vn,Wn,qn,Xn,$i,ei,hi,Ei,wi);var Bi=function(e){return"@@redux-saga/"+e},Wi=Bi("CANCEL_PROMISE"),zi=Bi("CHANNEL_END"),Ki=Bi("IO"),Hi=Bi("MATCH"),qi=Bi("MULTICAST"),Ji=Bi("SAGA_ACTION"),Yi=Bi("SELF_CANCELLATION"),Xi=Bi("TASK"),Qi=Bi("TASK_CANCEL"),Zi=Bi("TERMINATE"),ea=Bi("LOCATION");function ta(e,t){if(null==e)return{};var n,i,a={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(a[n]=e[n]);return a}var na=function(e){return null==e},ia=function(e){return null!=e},aa=function(e){return"function"==typeof e},oa=function(e){return"string"==typeof e},ra=Array.isArray,sa=function(e){return e&&aa(e.then)},la=function(e){return e&&aa(e.next)&&aa(e.throw)},ca=function e(t){return t&&(oa(t)||ya(t)||aa(t)||ra(t)&&t.every(e))},ua=function(e){return e&&aa(e.take)&&aa(e.close)},da=function(e){return aa(e)&&e.hasOwnProperty("toString")},ya=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype};const fa=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[Wi]=function(){clearTimeout(n)},i};var pa=function(e){return function(){return e}},ga=pa(!0),Sa=function(){},va=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var ha=function(e,t){G(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function ma(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Aa=function(e){throw e},ba=function(e){return{value:e,done:!0}};function Ta(e,t,n){void 0===t&&(t=Aa),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:ba,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Ea(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var ka=function(e){return Array.apply(null,new Array(e))},Oa=function(e){return function(t){return e(Object.defineProperty(t,Ji,{value:!0}))}},Ia=function(e){return e===Zi},Pa=function(e){return e===Qi},_a=function(e){return Ia(e)||Pa(e)};function La(e,t){var n,i=Object.keys(e),a=i.length,o=0,r=ra(e)?ka(a):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||_a(i)?(t.cancel(),t(i,s)):(r[e]=i,++o===a&&(n=!0,t(r))))};i.cancel=Sa,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function wa(e){return{name:e.name||"anonymous",location:Ua(e)}}function Ua(e){return e[ea]}var Ca=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),i=0,a=0,o=0,r=function(t){n[a]=t,a=(a+1)%e,i++},s=function(){if(0!=i){var t=n[o];return n[o]=null,i--,o=(o+1)%e,t}},l=function(){for(var e=[];i;)e.push(s());return e};return{isEmpty:function(){return 0==i},put:function(s){var c;if(i<e)r(s);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[a]=s,o=a=(a+1)%e;break;case 4:c=2*e,n=l(),i=n.length,a=n.length,o=0,n.length=c,e=c,r(s)}},take:s,flush:l}}(e,4)},Ra="TAKE",Da="CALL",Na="FORK",Ma="SELECT",Fa=function(e,t){var n;return(n={})[Ki]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Ga(e,t){return void 0===e&&(e="*"),ca(e)?(ia(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Fa(Ra,{pattern:e})):ua(n=e)&&n[qi]&&ia(t)&&ca(t)?Fa(Ra,{channel:e,pattern:t}):ua(e)?(ia(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Fa(Ra,{channel:e})):void 0;var n}function $a(e,t){return na(t)&&(t=e,e=void 0),Fa("PUT",{channel:e,action:t})}function xa(e){var t=Fa("ALL",e);return t.combinator=!0,t}function Va(e,t){var n,i=null;return aa(e)?n=e:(ra(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&oa(n)&&aa(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function ja(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Fa(Da,Va(e,n))}function Ba(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Fa(Na,Va(e,n))}function Wa(e){return void 0===e&&(e=Yi),Fa("CANCEL",e)}function za(e){void 0===e&&(e=va);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Fa(Ma,{selector:e,args:n})}var Ka=ja.bind(null,fa);const Ha=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e};var qa=[],Ja=0;function Ya(e){try{Za(),e()}finally{eo()}}function Xa(e){qa.push(e),Ja||(Za(),to())}function Qa(e){try{return Za(),e()}finally{to()}}function Za(){Ja++}function eo(){Ja--}function to(){var e;for(eo();!Ja&&void 0!==(e=qa.shift());)Ya(e)}var no=function(e){return function(t){return e.some((function(e){return so(e)(t)}))}},io=function(e){return function(t){return e(t)}},ao=function(e){return function(t){return t.type===String(e)}},oo=function(e){return function(t){return t.type===e}},ro=function(){return ga};function so(e){var t="*"===e?ro:oa(e)?ao:ra(e)?no:da(e)?ao:aa(e)?io:ya(e)?oo:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var lo={type:zi},co=function(e){return e&&e.type===zi};function uo(){var e,t,n,i,a,o,r=(t=!1,i=n=[],a=function(){i===n&&(i=n.slice())},o=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(lo)}))},(e={})[qi]=!0,e.put=function(e){if(!t)if(co(e))o();else for(var a=n=i,r=0,s=a.length;r<s;r++){var l=a[r];l[Hi](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var o;void 0===n&&(n=ro),t?e(lo):(e[Hi]=n,a(),i.push(e),e.cancel=(o=!1,function(){o||(o=!0,a(),ma(i,e))}))},e.close=o,e),s=r.put;return r.put=function(e){e[Ji]?s(e):Xa((function(){s(e)}))},r}function yo(e,t){var n=e[Wi];aa(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var fo,po=0,go=function(){return++po};function So(e){e.isRunning()&&e.cancel()}var vo=((fo={}).TAKE=function(e,t,n){var i=t.channel,a=void 0===i?e.channel:i,o=t.pattern,r=t.maybe,s=function(e){e instanceof Error?n(e,!0):!co(e)||r?n(e):n(Zi)};try{a.take(s,ia(o)?so(o):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},fo.PUT=function(e,t,n){var i=t.channel,a=t.action,o=t.resolve;Xa((function(){var t;try{t=(i?i.put:e.dispatch)(a)}catch(e){return void n(e,!0)}o&&sa(t)?yo(t,n):n(t)}))},fo.ALL=function(e,t,n,i){var a=i.digestEffect,o=po,r=Object.keys(t);if(0!==r.length){var s=La(t,n);r.forEach((function(e){a(t[e],o,s[e],e)}))}else n(ra(t)?[]:{})},fo.RACE=function(e,t,n,i){var a=i.digestEffect,o=po,r=Object.keys(t),s=ra(t)?ka(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||_a(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=Sa,l[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return l[e].cancel()})))},r.forEach((function(e){c||a(t[e],o,l[e],e)}))},fo.CALL=function(e,t,n,i){var a=t.context,o=t.fn,r=t.args,s=i.task;try{var l=o.apply(a,r);if(sa(l))return void yo(l,n);if(la(l))return void Po(e,l,s.context,po,wa(o),!1,n);n(l)}catch(e){n(e,!0)}},fo.CPS=function(e,t,n){var i=t.context,a=t.fn,o=t.args;try{var r=function(e,t){na(e)?n(t):n(e,!0)};a.apply(i,o.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},fo.FORK=function(e,t,n,i){var a=t.context,o=t.fn,r=t.args,s=t.detached,l=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var a=n.apply(t,i);if(la(a))return a;var o=!1;return Ta((function(e){return o?{value:e,done:!0}:(o=!0,{value:a,done:!sa(a)})}))}catch(e){return Ta((function(){throw e}))}}({context:a,fn:o,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:wa(t)}(c,o);Qa((function(){var t=Po(e,c,l.context,po,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},fo.JOIN=function(e,t,n,i){var a=i.task,o=function(e,t){if(e.isRunning()){var n={task:a,cb:t};t.cancel=function(){e.isRunning()&&ma(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(ra(t)){if(0===t.length)return void n([]);var r=La(t,n);t.forEach((function(e,t){o(e,r[t])}))}else o(t,n)},fo.CANCEL=function(e,t,n,i){var a=i.task;t===Yi?So(a):ra(t)?t.forEach(So):So(t),n()},fo.SELECT=function(e,t,n){var i=t.selector,a=t.args;try{n(i.apply(void 0,[e.getState()].concat(a)))}catch(e){n(e,!0)}},fo.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,a=function(e){void 0===e&&(e=Ca());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(lo):e.isEmpty()?(n.push(i),i.cancel=function(){ma(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(lo):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,a=e.length;i<a;i++)(0,e[i])(lo)}}}}(t.buffer),o=so(i),r=function t(n){co(n)||e.channel.take(t,o),a.put(n)},s=a.close;a.close=function(){r.cancel(),s()},e.channel.take(r,o),n(a)},fo.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},fo.FLUSH=function(e,t,n){t.flush(n)},fo.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},fo.SET_CONTEXT=function(e,t,n,i){var a=i.task;ha(a.context,t),n()},fo);function ho(e,t){return e+"?"+t}function mo(e){var t=e.name,n=e.location;return n?t+" "+ho(n.fileName,n.lineNumber):t}function Ao(e){var t,n,i,a=(t=function(e){return e.cancelledTasks},n=e,(i=[]).concat.apply(i,n.map(t)));return a.length?["Tasks cancelled due to error:"].concat(a).join("\n"):""}var bo=null,To=[],Eo=function(e){e.crashedEffect=bo,To.push(e)},ko=function(){bo=null,To.length=0},Oo=function(){var e,t,n=To[0],i=To.slice(1),a=n.crashedEffect?(e=n.crashedEffect,(t=Ua(e))?t.code+" "+ho(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+mo(n.meta)+(a?" \n when executing effect "+a:"")].concat(i.map((function(e){return" created by "+mo(e.meta)})),[Ao(To)]).join("\n")};function Io(e,t,n,i,a,o,r){var s;void 0===r&&(r=Sa);var l,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var i,a=[],o=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),l(),n(e,!0)}function s(t){a.push(t),t.cont=function(s,l){o||(ma(a,t),t.cont=Sa,l?r(s):(t===e&&(i=s),a.length||(o=!0,n(i))))}}function l(){o||(o=!0,a.forEach((function(e){e.cont=Sa,e.cancel()})),a=[])}return s(e),{addTask:s,cancelAll:l,abort:r,getTasks:function(){return a}}}(t,0,g);function g(t,n){if(n){if(u=2,Eo({meta:a,cancelledTasks:y}),S.isRoot){var i=Oo();ko(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Qi?u=1:1!==u&&(u=3),l=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((s={})[Xi]=!0,s.id=i,s.meta=a,s.isRoot=o,s.context=f,s.joiners=[],s.queue=p,s.cancel=function(){0===u&&(u=1,p.cancelAll(),g(Qi,!1))},s.cont=r,s.end=g,s.setContext=function(e){ha(f,e)},s.toPromise=function(){return d||(d=Ha(),2===u?d.reject(c):0!==u&&d.resolve(l)),d.promise},s.isRunning=function(){return 0===u},s.isCancelled=function(){return 1===u||0===u&&1===t.status},s.isAborted=function(){return 2===u},s.result=function(){return l},s.error=function(){return c},s);return S}function Po(e,t,n,i,a,o,r){var s=e.finalizeRunEffect((function(t,n,i){sa(t)?yo(t,i):la(t)?Po(e,t,c.context,n,a,!1,i):t&&t[Ki]?(0,vo[t.type])(e,t.payload,i,u):i(t)}));d.cancel=Sa;var l={meta:a,cancel:function(){0===l.status&&(l.status=1,d(Qi))},status:0},c=Io(e,l,n,i,a,o,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var a;n?(a=t.throw(e),ko()):Pa(e)?(l.status=1,d.cancel(),a=aa(t.return)?t.return(Qi):{done:!0,value:Qi}):a=Ia(e)?aa(t.return)?t.return():{done:!0}:t.next(e),a.done?(1!==l.status&&(l.status=3),l.cont(a.value)):y(a.value,i,d)}catch(e){if(1===l.status)throw e;l.status=2,l.cont(e,!0)}}function y(t,n,i,a){void 0===a&&(a="");var o,r=go();function l(n,a){o||(o=!0,i.cancel=Sa,e.sagaMonitor&&(a?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),a&&function(e){bo=e}(t),i(n,a))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:a,effect:t}),l.cancel=Sa,i.cancel=function(){o||(o=!0,l.cancel(),l.cancel=Sa,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function _o(e,t){for(var n=e.channel,i=void 0===n?uo():n,a=e.dispatch,o=e.getState,r=e.context,s=void 0===r?{}:r,l=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?Ea: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=go();if(l&&(l.rootSagaStarted=l.rootSagaStarted||Sa,l.effectTriggered=l.effectTriggered||Sa,l.effectResolved=l.effectResolved||Sa,l.effectRejected=l.effectRejected||Sa,l.effectCancelled=l.effectCancelled||Sa,l.actionDispatched=l.actionDispatched||Sa,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=He.apply(void 0,c);g=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else g=va;var m={channel:i,dispatch:Oa(a),getState:o,sagaMonitor:l,onError:d,finalizeRunEffect:g};return Qa((function(){var e=Po(m,S,s,v,wa(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}const Lo=function(e){var t,n=void 0===e?{}:e,i=n.context,a=void 0===i?{}:i,o=n.channel,r=void 0===o?uo():o,s=n.sagaMonitor,l=ta(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=_o.bind(null,G({},l,{context:a,channel:r,dispatch:i,getState:n,sagaMonitor:s})),function(e){return function(t){s&&s.actionDispatched&&s.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){ha(a,e)},c};var wo=function(e){return{done:!0,value:e}},Uo={};function Co(e){return ua(e)?"channel":da(e)?String(e):aa(e)?e.name:String(e)}function Ro(e,t,n){var i,a,o,r=t;function s(t,n){if(r===Uo)return wo(t);if(n&&!a)throw r=Uo,n;i&&i(t);var s=n?e[a](n):e[r]();return r=s.nextState,o=s.effect,i=s.stateUpdater,a=s.errorState,r===Uo?wo(t):o}return Ta(s,(function(e){return s(null,e)}),n)}function Do(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];var o,r={done:!1,value:Ga(e)},s=function(e){return{done:!1,value:Ba.apply(void 0,[t].concat(i,[e]))}},l=function(e){return o=e};return Ro({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(o)}}},"q1","takeEvery("+Co(e)+", "+t.name+")")}function No(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];var o,r,s={done:!1,value:Ga(e)},l=function(e){return{done:!1,value:Ba.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:Wa(e)}},u=function(e){return o=e},d=function(e){return r=e};return Ro({q1:function(){return{nextState:"q2",effect:s,stateUpdater:d}},q2:function(){return o?{nextState:"q3",effect:c(o)}:{nextState:"q1",effect:l(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:l(r),stateUpdater:u}}},"q1","takeLatest("+Co(e)+", "+t.name+")")}function Mo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];var o,r={done:!1,value:Ga(e)},s=function(e){return{done:!1,value:ja.apply(void 0,[t].concat(i,[e]))}},l=function(e){return o=e};return Ro({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(o)}}},"q1","takeLeading("+Co(e)+", "+t.name+")")}function Fo(e,t,n){for(var i=e,a=arguments.length,o=new Array(a>3?a-3:0),r=3;r<a;r++)o[r-3]=arguments[r];var s={done:!1,value:ja.apply(void 0,[n].concat(o))},l={done:!1,value:Ka(t)};return Ro({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:Uo}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function Go(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];return Ba.apply(void 0,[Do,e,t].concat(i))}function $o(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];return Ba.apply(void 0,[No,e,t].concat(i))}function xo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];return Ba.apply(void 0,[Mo,e,t].concat(i))}class Vo{constructor(){this.context=null,this.accessToken=null,this.user=null,this.requestSource=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout",this.entitlementsOptions=null,this.appName=null,this.sessionContext=void 0}static getInstance(){return Vo.instance||(Vo.instance=new Vo),Vo.instance}static setContext(e){Vo.getInstance().context=e}static setAccessToken(e){Vo.getInstance().accessToken=e}static setUser(e){Vo.getInstance().user=e}static setRequestSource(e){Vo.getInstance().requestSource=e}static setOnRedirectTo(e){Vo.getInstance().onRedirectTo=e}static setLogout(e,t){Vo.getInstance().logout=n=>{n?e(n):Vo.onRedirectTo(t)}}static setEntitlementsOptions(e){Vo.getInstance().entitlementsOptions=e}static setSessionContext(e){Vo.getInstance().sessionContext=e}static setAppName(e){Vo.getInstance().appName=e}static getContext(){var e;return null!=(e=Vo.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Vo.getInstance().accessToken}static getRequestSource(){return Vo.getInstance().requestSource}static getUser(){return Vo.getInstance().user}static onRedirectTo(e,t){return Vo.getInstance().onRedirectTo(e,t)}static logout(e){return Vo.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=Vo.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static isSessionPerTenantEnabled(){var e;return(null==(e=Vo.getInstance().sessionContext)?void 0:e.enableSessionPerTenant)||!1}static getAppName(){return Vo.getInstance().appName}}Vo.instance=void 0;const jo={getContext:()=>Vo.getContext(),getAccessToken:()=>Vo.getAccessToken(),getUser:()=>Vo.getUser(),onRedirectTo:(e,t)=>Vo.onRedirectTo(e,t),logout:e=>Vo.logout(e)};class Bo extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Wo={v1:"/identity/resources/users/webauthn/v1/devices"},zo={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Ko={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",roles:{v3:"/identity/resources/users/v3/roles"},groups:{v3:"/identity/resources/users/v3/groups"},tenants:{me:{v1:"/identity/resources/users/v1/me/tenants",v3:"/identity/resources/users/v3/me/tenants"}},apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}},passwords:{resetBreachedPasswords:{v1:"/identity/resources/users/v1/passwords/breached/reset/bulk"}},authorization:{v1:"/identity/resources/users/v1/me/authorization"},temporary:{v1:"/identity/resources/users/temporary/v1",configuration:{v1:"/identity/resources/users/temporary/v1/configuration"}}},Ho={v1:"/identity/resources/configurations/v1"},qo={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Jo={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Yo={v1:"/identity/resources/permissions/v1"},Xo={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"}},Qo={v1:"/identity/resources/roles/v1"},Zo={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},er={v1:"/identity/resources/impersonation/v1"},tr={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},nr={v1:"/identity/resources/users/phone-numbers/v1"},ir={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},ar={v1:"/team/resources/members/v1"},or={v1:"/team/resources/roles/v1"},rr={v1:"/team/resources/stats/v1"},sr={v1:"/team/resources/profile"},lr={v1:"/tenants/resources/account-settings/v1"},cr={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"}},ur={v1:"/tenants/resources/sub-tenants/v1"},dr={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},yr={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"}}}},fr={v1:"/subscriptions/resources/payment-providers/v1"},pr={v1:"/subscriptions/resources/subscriptions/v1"},gr={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Sr={v1:"/reports/engine/resources/triggers/v1"},vr="/notification",hr="/audits",mr={v1:"/event/resources/configurations/v1"},Ar="/webhook",br="/oauth",Tr="/flags",Er="/directory/resources/v1/configurations/scim2",kr="/directory/resources/scim/temp",Or="/entitlements/api/v1/user-entitlements",Ir="/entitlements/api/v2/user-entitlements",Pr={v1:"/security-center/resources/recommendations/v1"},_r={v1:"/security-center/resources/insights/v1"};function Lr(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const a=e.urlPrefix||"frontegg",o="frontegg"===a&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(a)||o||(i+=a),i}function wr(e){var t,n;const i={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(i[ci.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(i[ci.frameWork]=e.metadataHeaders.framework),i}function Ur(){return new URLSearchParams(window.location.search).get("tenantId")||null}const Cr=async e=>{var t,n,i;const a=Vo.getContext(),o=await async function(e,t){var n;const i=wr(e),a=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Vo.getAccessToken)(),o=Vo.getRequestSource(),r=Ur();t&&(i[ci.contentType]=t),o&&(i[ci.source]=o),a&&(i.Authorization=`Bearer ${a}`),r&&(i[ci.scopedTenant]=r);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))i[`${t.key}`]=`${t.value}`;return i}(a,e.contentType),r=await async function(e,t,n){const i=Lr(e,t),a=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let o=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(a).length>0;return a&&r&&(o+=`?${new URLSearchParams(a)}`),o}(a,e.url,e.params),s=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:G({},o,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:a.requestCredentials)?n:"same-origin"});if(302===s.status)return window.location.href=await s.text(),new Promise((()=>{}));if(!s.ok){var l,c;if(413===s.status)throw new Bo("Error request is too large",s.status);let e,t=!0;try{e=await s.text(),e=JSON.parse(e)}catch(e){t=!1}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${s.status} - ${s.statusText}`),s.status>=400&&s.status<500&&["warn"].includes(null!=(l=a.logLevel)?l:"")?console.warn(e):500===s.status&&["warn","error"].includes(null!=(c=a.logLevel)?c:"")&&console.error(e),new Bo(t?e:"We're facing some difficulties, Please try again",s.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await s.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await s.text()}try{return await s.json()}catch(e){return{}}},Rr=async(e,t,n)=>Cr(G({url:e,method:"GET",contentType:"application/json",params:t},n)),Dr=async(e,t,n)=>Cr(G({url:e,method:"POST",contentType:"application/json",body:t},n)),Nr=async(e,t,n)=>Cr(G({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Mr=async(e,t,n)=>Cr(G({url:e,method:"PUT",contentType:"application/json",body:t},n)),Fr=async(e,t,n)=>Cr(G({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Gr=async(e,t,n,i)=>Cr(G({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),$r=(e={})=>G({},e.jwt?{Authorization:e.jwt}:{}),xr="FRONTEGG_SEPARATE_TABS_BY_TENANT",Vr="admin_portal_use_entitlements_v2_endpoint",jr={flags:{}};class Br{constructor(){var e;this._flags={},this._flags=null!=(e=jr.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Br;return n.set(e),Br._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=G({},null!=(t=null==jr?void 0:jr.flags)?t:{},null!=e?e:{})}}async function Wr(){return Rr(Tr)}async function zr(e){return Dr(`${Ko.v3}/me/token`,e)}async function Kr(e,t){return Rr(Ko.v2,e,{headers:$r(t)})}async function Hr(e,t){return Rr(Ko.v3,e,{headers:$r(t)})}async function qr(e,t){return Rr(Ko.roles.v3,G({},e,{ids:e.ids.join(",")}),{headers:$r(t)})}async function Jr(e,t){return Rr(Ko.groups.v3,G({},e,{ids:e.ids.join(",")}),{headers:$r(t)})}async function Yr(e){return Rr(Ko.tenants.me.v3,void 0,{headers:$r(e)})}async function Xr(e){return Rr(Ko.tenants.me.v1,void 0,{headers:$r(e)})}async function Qr(){return Dr(Ko.passwords.resetBreachedPasswords.v1)}async function Zr(e){return Mr(`${Ko.v2}/me`,e)}function es(e){e&&sessionStorage.setItem(xr,e)}function ts(){return Vo.isSessionPerTenantEnabled()?sessionStorage.getItem(xr):null}function ns(){const[e]=Br.getFeatureFlags(["admin_portal_use_current_user_tenants_v1_endpoint"],Vo.getAppName()||"");return Vo.isSessionPerTenantEnabled()||e?Xr:Yr}async function is(e){return Vo.isSessionPerTenantEnabled()&&es(e.tenantId),Mr(`${Ko.v1}/tenant`,e)}async function as(){return Rr(`${Ko.v2}/me/tenants`)}async function os(e){return Rr(cr.v1,void 0,{headers:$r(e)})}async function rs(e){return Rr(cr.tree.v1,void 0,{headers:$r(e)})}async function ss(e){return Rr(cr.parents.v1,void 0,{headers:$r(e)})}async function ls(e,t){return Rr(`${cr.parents.v1}/${e}`,void 0,{headers:$r(t)})}async function cs(e,t){return Dr(`${Xo.users.v1}/count`,e,{headers:$r(t)})}async function us(e,t){return Rr(cr.v2,e,{headers:$r(t)})}async function ds(e,t){return Rr(cr.metadata.v2,G({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:$r(t)})}async function ys(){return Rr(Ho.v1)}async function fs(){return Rr(`${Ho.v1}/mfa-policy`)}async function ps(){return Rr(`${Ho.v1}/mfa-policy/vendor`)}async function gs(e){return e.id?Nr(`${Ho.v1}/mfa-policy`,e):Dr(`${Ho.v1}/mfa-policy`,e)}async function Ss(){return Rr(`${Ho.v1}/lockout-policy`)}async function vs(){return Rr(`${Ho.v1}/lockout-policy/vendor`)}async function hs(e){return e.id?Nr(`${Ho.v1}/lockout-policy`,e):Dr(`${Ho.v1}/lockout-policy`,e)}async function ms(){try{return await Rr(`${Ho.v1}/captcha-policy/public`)}catch{return null}}async function As(){return Rr(`${Ho.v1}/password-history-policy`)}async function bs(){return Rr(`${Ho.v1}/password-history-policy/vendor`)}async function Ts(e){return e.id?Nr(`${Ho.v1}/password-history-policy`,e):Dr(`${Ho.v1}/password-history-policy`,e)}async function Es(){return Rr(`${Ho.v1}/password`)}async function ks(){return Rr(`${qo.emailDomain.v1}`)}async function Os(){return Rr(`${qo.emailDomain.v1}/config`)}async function Is(e){return Dr(`${qo.emailDomain.v1}`,e)}async function Ps(e){return Dr(`${qo.emailDomain.v1}/config`,e)}async function _s(e){return Fr(`${qo.emailDomain.v1}/${e}`)}async function Ls(e){return Rr(`${qo.ip.v1}`,e)}async function ws(){return Rr(`${qo.ip.v1}/config`)}async function Us(e){return Dr(`${qo.ip.v1}`,e)}async function Cs(e){return Dr(`${qo.ip.v1}/bulk`,e)}async function Rs(e){return Dr(`${qo.ip.v1}/config`,e)}async function Ds(e){return Fr(`${qo.ip.v1}/${e}`)}async function Ns(){return Dr(`${qo.ip.v1}/verify`)}async function Ms(){return Dr(`${qo.ip.v1}/verify/allow`)}Br._instances={};class Fs extends Error{constructor(e){super(e)}}const Gs="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Fs("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,i,a=0,o=0;i=t.charAt(o++);~i&&(e=a%4?64*e+i:i,a++%4)?n+=String.fromCharCode(255&e>>(-2*a&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};class $s extends Error{constructor(e){super(e)}}const xs=(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(Gs(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 Gs(t)}})(e.split(".")[n]))}catch(e){throw new $s("Invalid token specified: "+e.message)}};let Vs,js,Bs;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}(Vs||(Vs={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(js||(js={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(Bs||(Bs={}));const Ws="admin_portal_should_load_authorization";async function zs(){return Rr(Or)}async function Ks(){return Rr(Ir)}let Hs;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(Hs||(Hs={}));const qs="admin_portal_entitlements",Js=["type"],Ys=["type"],Xs=["type"];async function Qs(e){if(!e.accessToken)return e;Vo.setAccessToken(e.accessToken);const t=await $u(),n=G({},e,e.accessToken?xs(e.accessToken):{},t);return Vo.setUser(n),n}async function Zs(e){if(!e.accessToken)return{user:e};Vo.setAccessToken(e.accessToken);const[t,n]=await Promise.all([$u(),as()]),i=G({},e,e.accessToken?xs(e.accessToken):{},t);return Vo.setUser(i),{user:i,tenants:n}}function el(){if(!Vo.shouldLoadEntitlements())return!1;const[e]=Br.getFeatureFlags([qs],Vo.getAppName()||"");return e}function tl(){const[e]=Br.getFeatureFlags([Ws],Vo.getAppName()||"");return e}async function nl(e){const{accessToken:t}=e;if(!t)return{user:e};Vo.setAccessToken(t);const[n,i]=await Promise.all([$u(),ns()()]),a=G({},e,t?xs(t):{},n);return Vo.isSessionPerTenantEnabled()&&es(a.tenantId),Vo.setUser(a),{user:a,tenants:i.tenants,activeTenant:i.activeTenant}}async function il(e){Vo.setAccessToken(e.id_token);const t=await $u(),n=e.id_token?xs(e.id_token):{},i=G({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Vo.setUser(i),i}async function al(e){Vo.setAccessToken(e.id_token);const[t,n]=await Promise.all([$u(),ns()()]),i=e.id_token?xs(e.id_token):{},a=G({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},i,t,{expiresIn:e.expires_in||300});return Vo.isSessionPerTenantEnabled()&&es(a.tenantId),Vo.setUser(a),{user:a,tenants:n.tenants,activeTenant:n.activeTenant}}async function ol(e){try{const{address:t}=await Dr(`${zo.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function rl(e){return Dr(`${zo.v1}/user/saml/prelogin`,e)}async function sl(e){return Qs(await Dr(`${zo.v1}/user/saml/postlogin`,e))}async function ll(e){return Qs(await Dr(`${zo.v1}/user/oidc/postlogin`,e))}async function cl(e){return Qs(await Dr(`${zo.v1}/user`,e))}async function ul(e){return nl(await Dr(`${zo.v1}/user`,e))}async function dl(e){return Qs(await Dr(`${zo.v1}/user/mfa/verify`,e))}async function yl(e){return nl(await Dr(`${zo.v1}/user/mfa/verify`,e))}async function fl(e){return Dr(`${Ko.v1}/activate`,e)}async function pl(e){return nl(await Dr(`${Ko.v1}/activate`,e))}async function gl(e){return Rr(`${Ko.v1}/activate/strategy`,e)}async function Sl(e){return Dr(`${Ko.v1}/activate/reset`,e)}async function vl(e){return Dr(`${Ko.v1}/invitation/reset`,e)}async function hl(e){return Dr(`${Ko.v1}/invitation/accept`,e)}async function ml(){const e=ts();return Qs(await Dr(`${zo.v1}/user/token/refresh`,{tenantId:e}))}async function Al(){const e=ts();return Zs(await Dr(`${zo.v1}/user/token/refresh`,{tenantId:e}))}async function bl(){const e=ts();return nl(await Dr(`${zo.v1}/user/token/refresh`,{tenantId:e}))}async function Tl(){return Dr(`${zo.v1}/logout`)}async function El(e){return Rr(`${br}/logout`,e)}async function kl(e){return Dr(`${Ko.v1}/passwords/reset`,e)}async function Ol(e){return Dr(`${Ko.v1}/passwords/reset/verify`,e)}async function Il(e){return Rr(`${Ko.v1}/passwords/config`,e)}async function Pl(e){return Dr(`${zo.v1}/user/mfa/recover`,e)}async function _l(){return Dr(`${Ko.v1}/mfa/enroll`)}async function Ll(){return Dr(`${Ko.v1}/mfa/authenticator/enroll`)}async function wl(e){return Dr(`${Ko.v1}/mfa/authenticator/enroll/verify`,e)}async function Ul(e){return Dr(`${Ko.v1}/mfa/sms/enroll`,e)}async function Cl(e){return Dr(`${Ko.v1}/mfa/sms/enroll/verify`,e)}async function Rl(){return Dr(`${Ko.v1}/mfa/webauthn/enroll`)}async function Dl(e){return Dr(`${Ko.v1}/mfa/webauthn/enroll/verify`,e)}async function Nl(e){return Dr(`${Ko.v1}/mfa/enroll/verify`,e)}async function Ml(e){return Dr(`${Ko.v1}/mfa/disable`,e)}async function Fl(e,t){return Dr(`${Ko.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Gl(e){return Dr(`${Ko.v1}/mfa/sms/${e}/disable`)}async function $l(e,t){return Dr(`${Ko.v1}/mfa/sms/${e}/disable/verify`,t)}async function xl(e){return Dr(`${Ko.v1}/mfa/webauthn/${e}/disable`)}async function Vl(e,t){return Dr(`${Ko.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function jl(){return Rr(`${Ko.v1}/mfa/devices`)}async function Bl(e){return Dr(`${zo.v1}/user/mfa/authenticator/enroll`,e)}async function Wl(e){return Dr(`${zo.v1}/user/mfa/authenticator/enroll/verify`,e)}async function zl(e){return nl(await Dr(`${zo.v1}/user/mfa/authenticator/enroll/verify`,e))}async function Kl(e,t){return Dr(`${zo.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Hl(e){return Dr(`${zo.v1}/user/mfa/emailcode`,e)}async function ql(e){return Dr(`${zo.v1}/user/mfa/emailcode/verify`,e)}async function Jl(e){return nl(await Dr(`${zo.v1}/user/mfa/emailcode/verify`,e))}async function Yl(e){return Dr(`${zo.v1}/user/mfa/sms/enroll`,e)}async function Xl(e){return Dr(`${zo.v1}/user/mfa/sms/enroll/verify`,e)}async function Ql(e){return nl(await Dr(`${zo.v1}/user/mfa/sms/enroll/verify`,e))}async function Zl(e,t){return Dr(`${zo.v1}/user/mfa/sms/${e}`,t)}async function ec(e,t){return Dr(`${zo.v1}/user/mfa/sms/${e}/verify`,t)}async function tc(e,t){return nl(await Dr(`${zo.v1}/user/mfa/sms/${e}/verify`,t))}async function nc(e){return Dr(`${zo.v1}/user/mfa/webauthn/enroll`,e)}async function ic(e){return Dr(`${zo.v1}/user/mfa/webauthn/enroll/verify`,e)}async function ac(e){return nl(await Dr(`${zo.v1}/user/mfa/webauthn/enroll/verify`,e))}async function oc(e,t){return Dr(`${zo.v1}/user/mfa/webauthn/${e}`,t)}async function rc(e,t){return Dr(`${zo.v1}/user/mfa/webauthn/${e}/verify`,t)}async function sc(e,t){return nl(await Dr(`${zo.v1}/user/mfa/webauthn/${e}/verify`,t))}async function lc(){return Rr(`${ir.v1}/saml/configurations`)}async function cc(e){return Dr(`${ir.v1}/saml/configurations`,e)}async function uc(){return Rr(`${ir.v1}/saml/configurations/vendor-config`)}async function dc(e){return Mr(`${ir.v1}/saml/configurations/metadata`,e)}async function yc(){return Mr(`${ir.v1}/saml/validations/domain`)}async function fc(){return Rr(`${ir.v1}/saml/configurations/roles/default`)}async function pc(){return Rr(`${ir.v2}/saml/configurations/groups`)}async function gc({roleIds:e}){return Dr(`${ir.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Sc({roleIds:e,group:t}){return Dr(`${ir.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function vc({roleIds:e,group:t,id:n}){return Nr(`${ir.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function hc({id:e}){return Fr(`${ir.v2}/saml/configurations/groups/${e}`)}async function mc(){return Rr(`${ir.v1}/oidc/configurations`)}async function Ac(){return Rr(`${ir.v2}/configurations/public`)}async function bc(){return Rr(Jo.v1)}async function Tc(){return Rr(Jo.v2)}async function Ec(){return Rr(`${Jo.v2}/authenticated`)}async function kc(){return Rr(Jo.custom.v1)}async function Oc({provider:e,code:t,idToken:n,redirectUri:i,codeVerifier:a,metadata:o,invitationToken:r,state:s}){const l={};return t&&(l.code=t),n&&(l.id_token=n),i&&(l.redirectUri=i),a&&(l.code_verifier=a),s&&(l.state=s),Dr(`${zo.v1}/user/sso/${e}/postlogin`,{metadata:o,invitationToken:r},{params:l})}async function Ic(){return Rr(`${Ho.v1}/public`)}async function Pc(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:a}=await Dr(`${Ko.v1}/signUp`,e),o={shouldActivate:t,userId:i,tenantId:a};if(!t&&n){const{user:e,tenants:t,activeTenant:i}=await nl(n);return G({},o,{user:e,tenants:t,activeTenant:i})}return o}async function _c(){return Rr(Ko.sessions.currentUser.v1)}async function Lc(){return Rr(`${Ko.sessions.currentUser.v1}/current`)}async function wc(e){return Dr(`${Ko.sessions.v1}/revoke`,{userId:e})}async function Uc(){return Rr(Ko.sessions.configurations.v1)}async function Cc(e){await Dr(Ko.sessions.configurations.v1,e)}async function Rc(e){await Fr(`${Ko.sessions.currentUser.v1}/${e}`)}async function Dc(){await Fr(`${Ko.sessions.currentUser.v1}/all`)}async function Nc(){return Rr(Ko.accessTokens.v1)}async function Mc(){return Rr(Xo.accessTokens.v1)}async function Fc({id:e}){return Fr(`${Xo.accessTokens.v1}/${e}`)}async function Gc({id:e}){return Fr(`${Ko.accessTokens.v1}/${e}`)}async function $c(e){return Dr(Ko.accessTokens.v1,e)}async function xc(e){return Dr(Xo.accessTokens.v1,e)}async function Vc(){return Rr(Ko.apiTokens.v1)}async function jc(){return Rr(Xo.apiTokens.v1)}async function Bc(e){return Dr(Ko.apiTokens.v1,e)}async function Wc(e){return Dr(Xo.apiTokens.v2,e)}async function zc({tokenId:e}){return Fr(`${Xo.apiTokens.v1}/${e}`)}async function Kc({tokenId:e}){return Fr(`${Ko.apiTokens.v1}/${e}`)}async function Hc({userId:e}){return Rr(`${Ko.v1}/${e}`)}async function qc(e){return Rr(`${Ho.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Jc(e){let{type:t}=e,n=ta(e,Js);return Dr(`${zo.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Yc(e){let{type:t}=e,n=ta(e,Ys);return nl(await Dr(`${zo.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function Xc(e){let{type:t}=e,n=ta(e,Xs);return Dr(`${zo.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Qc({token:e}){return Dr(Xo.invites.verify.v1,{token:e})}async function Zc(){return Rr(`${ir.v1}/configurations`)}async function eu(e){return Dr(`${ir.v1}/configurations`,e)}async function tu(e,t){return Nr(`${ir.v1}/configurations/${e}`,t)}async function nu(e){return Fr(`${ir.v1}/configurations/${e}`)}async function iu(e){return Dr(`${ir.v1}/configurations/metadata`,e)}async function au(e,t){return Mr(`${ir.v1}/configurations/${e}/metadata`,t)}async function ou(e){return Dr(`${ir.v1}/configurations/metadata-url`,e)}async function ru(e,t){return Mr(`${ir.v1}/configurations/${e}/metadata-url`,t)}async function su(e,t){return Dr(`${ir.v1}/configurations/${e}/domains`,t)}async function lu(e,t){return Fr(`${ir.v1}/configurations/${e}/domains/${t}`)}async function cu(e,t){return Mr(`${ir.v1}/configurations/${e}/domains/${t}/validate`)}async function uu(e){return Rr(`${ir.v1}/configurations/${e}/roles`)}async function du(e,t){return Mr(`${ir.v1}/configurations/${e}/roles`,t)}async function yu(e,t){return Dr(`${ir.v1}/configurations/${e}/groups`,t)}async function fu(e,{roleIds:t,group:n,id:i}){return Nr(`${ir.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function pu(e,t){return Fr(`${ir.v1}/configurations/${e}/groups/${t}`)}async function gu(e){return Rr(`${ir.v1}/configurations/${e}/groups`)}async function Su(e){return Dr(`${zo.v2}/user/sso/prelogin`,e)}async function vu(e){return Qs(await Dr(`${zo.v2}/user/oidc/postlogin`,e))}async function hu(e){return al(await Dr(`${br}/token`,e))}async function mu(){const e=ts();return al(await Dr(`${br}/authorize/silent`,{tenantId:e}))}async function Au(e){return il(await Dr(`${br}/token`,e))}async function bu(){const e=ts();return il(await Dr(`${br}/authorize/silent`,{tenantId:e}))}async function Tu(e){return Dr(`${Ko.v1}/phone/reset`,e)}async function Eu(e){return Dr(`${Ko.v1}/phone/reset/verify`,e)}async function ku(e){return Dr(`${Ko.v1}/phone`,e)}async function Ou(e){return Dr(`${Ko.v1}/phone/verify`,e)}async function Iu(e){return Mr(`${Ko.v1}/phone/change`,e)}async function Pu(e){return Dr(`${zo.v1}/webauthn/prelogin`,e)}async function _u(e){return Dr(`${zo.v1}/webauthn/postlogin`,e)}async function Lu(e){return nl(await Dr(`${zo.v1}/webauthn/postlogin`,e))}async function wu(){return Dr(Wo.v1)}async function Uu(){return Rr(Wo.v1)}async function Cu(e){return Fr(`${Wo.v1}/${e}`)}async function Ru(e){return Dr(`${Wo.v1}/verify`,e)}async function Du(){return Rr(`${Ho.v1}/auth/strategies/public`)}async function Nu(){return Rr(`${Ho.v1}/auth/strategies`)}async function Mu(){return Rr(`${Ho.v1}/mfa/strategies`)}async function Fu(){return Rr(`${Ko.authorization.v1}`)}async function Gu(){return Rr(`${Ko.v2}/me`)}async function $u(){const[e]=Br.getFeatureFlags([Vr],Vo.getAppName()||""),t=[{action:Gu,shouldLoad:!0},{action:e?Ks:zs,shouldLoad:el()},{action:Fu,shouldLoad:tl()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[n,i,a]=await Promise.all(t),o=ts();return o&&(n.tenantId=o),G({},n,null!=a?a:{},{entitlements:i})}async function xu(e){const t=await Dr(`${zo.v1}/user/step-up/generate`,e);return t.accessToken?nl(t):t}async function Vu(e){return Rr(`${Ko.v2}/me`,null!=e?e:{addRoles:!0})}async function ju(e){return Mr(`${Ko.v2}/me`,e)}async function Bu(e){return Mr(`${sr.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Wu(e){return Dr(`${Ko.v1}/passwords/change`,e)}async function zu(e){var t,n,i,a,o,r;const s=(e.filter||[]).reduce(((e,t)=>G({},e,{[t.id]:t.value})),{}),l=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(i=e.sort)||null==(a=i[0])?void 0:a.id)?n:"name",sortDirection:null!=(o=e.sort)&&null!=(r=o[0])&&r.desc?"desc":"asc"}:null;return Rr(ar.v1,G({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function Ku(e){return Dr(Ko.v2,G({},e,{provider:"local"}))}async function Hu(e){return Fr(`${ar.v1}/${e.userId}`)}async function qu(e){return Mr(ar.v1,e)}async function Ju(e){const{userId:t,expirationInSeconds:n}=e;return Mr(`${Ko.temporary.v1}/${t}`,{expirationInSeconds:n})}async function Yu(e){return Fr(`${Ko.temporary.v1}/${e}`)}async function Xu(){return Rr(Ko.temporary.configuration.v1)}async function Qu(e){return Dr(Xo.invites.user.v1,G({},e))}async function Zu(e){return Nr(Xo.invites.user.v1,G({},e))}async function ed(){return Fr(Xo.invites.user.v1)}async function td(){return Rr(Xo.invites.user.v1)}async function nd(){return Rr(Xo.invites.configuration.v1)}async function id(){return Rr(or.v1)}async function ad(){return Rr(Yo.v1)}async function od(){return Rr(`${rr.v1}/members`)}async function rd(e){return Dr(`${ar.v1}/${e.userId}/resendActivationEmail`,{})}async function sd(e){return Dr(Ko.v2,G({},e,{provider:"local"}))}async function ld(e){return Dr(Ko.invitation.resendAll.v1,G({},e))}async function cd(e){var t,n;const i=await Rr("/metadata",e);if(null!=i&&null!=(t=i.rows)&&t[0])return null==i||null==(n=i.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function ud(){return Rr("/metadata/admin-box")}async function dd(e){return Dr("/metadata/admin-box",e)}async function yd(){const e=await Rr("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const fd=async()=>cd({entityName:"notifications"}),pd=async()=>cd({entityName:"saml"}),gd=async()=>cd({entityName:"audits"}),Sd=async e=>async function(e){const t=await Rr(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),vd=["dataFilters"],hd=["templateId","dataFilters"],md=["dataFilters"];async function Ad(e){return Rr(`${gr.v2}/tenant-reports`,e)}async function bd(e){return Rr(`${gr.v2}/${e.id}/tenant-reports`)}async function Td(e){let{dataFilters:t}=e,n=ta(e,vd);return{html:await Rr(`${Sr.v1}/preview-report`,G({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Ed(e){let{templateId:t,dataFilters:n}=e,i=ta(e,hd);return Dr(`${gr.v2}/${t}/tenant-reports`,G({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function kd(e){let{dataFilters:t}=e,n=ta(e,md);const i=await Rr(`${Sr.v1}/preview-report`,G({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let a="text/html",o="html";"pdf"===n.responseType?(a="application/pdf",o="pdf"):"image"===n.responseType&&(a="image/jpeg",o="jpg");const r=new Blob([i],{type:a}),s=URL.createObjectURL(r),l=document.createElement("a");l.href=s,l.setAttribute("download",`report_${n.name||""}.${o}`),l.click(),setTimeout(l.remove.bind(l))}async function Od(e){return Dr(`${Sr.v1}/tenant-reports`,e)}async function Id(e){return Rr(vr,{params:e})}async function Pd(e){return Mr(`${vr}/status`,{params:e})}async function _d(e){const{notificationId:t,pinStatus:n}=e;return Mr(`${vr}/${n}`,{notificationId:t})}async function Ld(){return Dr(`${vr}/status/mark-all-read`)}const wd=["endpoint","headerProps"];async function Ud(e){return Rr(hr,e)}async function Cd(e){return Rr(`${hr}/stats`,e)}async function Rd(e){const{endpoint:t,headerProps:n}=e,i=ta(e,wd);return Gr(`${hr}/export/${t}`,{properties:n},i)}const Dd=["eventKey"],Nd=["eventKey"],Md=()=>Rr(`${dr.v1}/slack`),Fd=()=>Rr(`${dr.v1}/slack/applications`),Gd=()=>Rr(`${dr.v1}/slack/channels`),$d=e=>e.id?Nr(`${dr.v1}/slack/subscription/${e.id}`,e):Dr(`${dr.v1}/slack/subscriptions`,e),xd=e=>Fr(`${dr.v1}/slack/subscriptions/${e.id}`),Vd=e=>Dr(`${dr.v1}/slack/applications/registrations`,{code:e}),jd=()=>Rr(`${dr.v1}/emails`),Bd=e=>{let{eventKey:t}=e,n=ta(e,Dd);return Dr(`${dr.v1}/emails/${t}`,n)},Wd=({eventKey:e,enabled:t})=>Nr(`${dr.v1}/emails/${e}`,{enabled:t}),zd=(e,t)=>Fr(`${dr.v1}/emails/${e}/subscriptions/${t}`),Kd=(e,t,n)=>Mr(`${dr.v1}/emails/${t}/subscriptions/${e}`,n),Hd=e=>Fr(`${dr.v1}/emails/${e}`),qd=()=>Rr(`${dr.v2}/sms`),Jd=e=>{let{eventKey:t}=e,n=ta(e,Nd);return Dr(`${dr.v2}/sms/${t}`,n)},Yd=({eventKey:e,enabled:t})=>Nr(`${dr.v2}/sms/${e}`,{enabled:t}),Xd=(e,t)=>Fr(`${dr.v2}/sms/${e}/subscriptions/${t}`),Qd=(e,t,n)=>Mr(`${dr.v2}/sms/${t}/subscriptions/${e}`,n),Zd=e=>Fr(`${dr.v2}/sms/${e}`),ey=()=>Rr(Ar),ty=e=>e._id?Nr(`${Ar}/${e._id}`,e):Dr(`${Ar}/custom`,e),ny=e=>Fr(`${Ar}/${e}`),iy=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Rr(`${Ar}/logs/?${i.toString()}`)},ay=e=>Dr(`${Ar}/test`,e),oy=e=>Dr(`${Ar}/logs/${e}/retries`),ry=()=>Rr(`${mr.v1}/categories`),sy=e=>Rr(mr.v1,{channels:e});async function ly(e,t){return Mr(lr.v1,e,{headers:$r(t)})}async function cy(e){return Rr(lr.v1,void 0,{headers:$r(e)})}async function uy(){return Rr(`${lr.v1}/public`)}const dy=["roleId"],yy=["roleId"],fy=["permissionId"];async function py(){return Rr(Qo.v1)}async function gy(e){return Dr(Qo.v1,e)}async function Sy({roleId:e}){return Fr(`${Qo.v1}/${e}`)}async function vy(e){let{roleId:t}=e,n=ta(e,dy);return Nr(`${Qo.v1}/${t}`,n)}async function hy(e){let{roleId:t}=e,n=ta(e,yy);return Mr(`${Qo.v1}/${t}/permissions`,n)}async function my(){return Rr(Yo.v1)}async function Ay(e){let{permissionId:t}=e,n=ta(e,fy);return Mr(`${Yo.v1}/${t}/roles`,n)}async function by(){return Rr(`${Yo.v1}/categories`)}async function Ty(){return Rr(yr.subscriptions.v1)}async function Ey(e){return Rr(`${yr.subscriptions.v1}/${e}`)}async function ky(e){return Mr(`${yr.subscriptions.v1}/${e}/cancellations/`,{})}async function Oy(e){return Mr(`${yr.subscriptions.v1}/${e}/renewals/`,{})}async function Iy(e,{paymentMethodId:t,planId:n}){return Mr(`${yr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Py(e){return Rr(`${pr.v1}/${e}`)}async function _y(){return Rr(`${pr.v1}`)}async function Ly(e){return Mr(`${pr.v1}/${e}/cancellations/`,{})}async function wy(e){return Mr(`${pr.v1}/${e}/renewals/`,{})}async function Uy(e,{paymentMethodId:t,planId:n}){return Mr(`${pr.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Cy(){return Rr(yr.plans.v1)}async function Ry(e){return Rr(`${yr.plans.v1}/${e}`)}async function Dy(){return Rr(yr.invoices.v1)}async function Ny(e){return Rr(`${yr.invoices.v1}/${e}`)}async function My(e,t){return Rr(`${yr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Fy=["email"];async function Gy(){return Rr(yr.paymentMethods.v1)}async function $y(e){return Rr(`${yr.paymentMethods.v1}/${e}`)}async function xy(e,t){let{email:n}=t,i=ta(t,Fy);return Nr(`${yr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function Vy(e){return Dr(yr.paymentProviders.stripe.subscriptions.v1,e)}async function jy(e){return Rr(`${yr.paymentProviders.stripe.customers.v1}/${e}`)}async function By(e){return Dr(`${yr.paymentProviders.stripe.customers.v1}`,e)}async function Wy(){return Rr(`${yr.paymentProviders.stripe.publicConfigurations.v1}`)}async function zy(e){return Dr(`${yr.paymentProviders.stripe.setupIntents.v1}`,e)}async function Ky(e){return Rr(`${yr.summaries.v1}/${e}`)}async function Hy(e){return Rr(`${yr.tenantConfiguration.v1}/${e}`)}async function qy(e){return Dr(`${yr.tenantConfiguration.v1}`,e)}async function Jy(){return Rr(fr.v1)}async function Yy(){return Rr(`${yr.configurations.vendorPublicConfigurations.v1}`)}let Xy,Qy,Zy,ef,tf,nf;async function af(){return Rr("/vendors/public")}async function of(e){return Rr(Zo.v1,e)}async function rf(e){return Dr(Zo.v1,e)}async function sf(e,t){return Fr(Zo.v1,e,{headers:$r(t)})}async function lf(e,t,n){return Dr(`${Zo.v1}/${e}/roles`,t,{headers:$r(n)})}async function cf(e,t,n){return Fr(`${Zo.v1}/${e}/roles`,t,{headers:$r(n)})}async function uf(e,t,n){return Nr(`${Zo.v1}/${e}/roles`,t,{headers:$r(n)})}async function df(e,t){return Dr(ur.v1,e,{headers:$r(t)})}async function yf(e,t){return Fr(`${ur.v1}/${e}`,void 0,{headers:$r(t)})}async function ff({tenantId:e},t,n){return Nr(`${ur.v1}/${e}`,t,{headers:$r(n)})}async function pf(e,t,n){return Mr(`${Zo.v1}/${e}/access`,t,{headers:$r(n)})}async function gf(e,t){return Dr(`${Zo.v2}/`,e,{headers:$r(t)})}async function Sf(){return Rr(`${Er}`)}async function vf(e,t){return Nr(`${Er}/${e}`,t)}async function hf(e){return Dr(`${Er}`,e)}async function mf(e){return Fr(`${Er}/${e}`)}async function Af(e){return Rr(`${kr}/${e}/Users/count`)}async function bf(e){return Dr(`${er.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Xy||(Xy={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Qy||(Qy={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Zy||(Zy={})),(ef||(ef={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(tf||(tf={})),function(e){e.CREATE="create_customer"}(nf||(nf={}));const Tf=["groupId"];async function Ef({groupId:e},t){return Rr(`${tr.v1}/${e}`,G({},t))}async function kf(e){return Rr(`${tr.v1}`,G({},e))}async function Of(e,t){return Dr(`${tr.getByIds.v1}`,e,{params:t})}async function If(e){return Dr(`${tr.v1}`,e)}async function Pf(e){let{groupId:t}=e,n=ta(e,Tf);return Nr(`${tr.v1}/${t}`,n)}async function _f(e){return Fr(`${tr.v1}/${e}`)}async function Lf(e,t){return Dr(`${tr.v1}/${e}/roles`,t)}async function wf(e,t){return Fr(`${tr.v1}/${e}/roles`,t)}async function Uf(e,t){return Dr(`${tr.v1}/${e}/users`,t)}async function Cf(e,t){return Fr(`${tr.v1}/${e}/users`,t)}async function Rf(){return Rr(`${tr.configurations.v1}`)}async function Df(e){return Dr(`${tr.configurations.v1}`,e)}async function Nf(){return Rr(Pr.v1)}async function Mf(){return Rr(_r.v1)}async function Ff(e){return Rr(`${nr.v1}`,e)}async function Gf(e){return Dr(`${nr.v1}`,e)}async function $f(e){return Fr(`${nr.v1}/${e}`)}async function xf(e){return Dr(`${nr.v1}/preverify`,e)}async function Vf(e){return Dr(`${nr.v1}/verify`,e)}async function jf(e,t){return Dr(`${nr.v1}/${e}/delete/verify`,t)}let Bf,Wf,zf;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Bf||(Bf={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(Wf||(Wf={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(zf||(zf={}));const Kf=[/^(.*)\/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],Hf=`${zo.v1}/user/token/refresh`,qf=`${br}/authorize/silent`,Jf=`${Ko.v2}/me`,Yf=`${Ko.v2}/me/tenants`,Xf=`${Ko.v3}/me/tenants`;let Qf,Zf,ep,tp,np,ip,ap,op;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Qf||(Qf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Zf||(Zf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(ep||(ep={})),function(e){e.FORCE_MFA="FORCE_MFA",e.BREACHED_PASSWORDS_EXIST="BREACHED_PASSWORDS_EXIST",e.ENABLE_USER_LOCKOUT="ENABLE_USER_LOCKOUT",e.STRENGTHEN_USER_LOCKOUT="STRENGTHEN_USER_LOCKOUT",e.ENABLE_PASSWORD_HISTORY="ENABLE_PASSWORD_HISTORY",e.STRENGTHEN_PASSWORD_HISTORY="STRENGTHEN_PASSWORD_HISTORY",e.ENABLE_FORCE_RELOGIN="ENABLE_FORCE_RELOGIN",e.SET_FORCE_RELOGIN="SET_FORCE_RELOGIN",e.ENABLE_SESSION_CONCURRENCY="ENABLE_SESSION_CONCURRENCY",e.SET_SESSION_CONCURRENCY="SET_SESSION_CONCURRENCY",e.ENABLE_IDLE_SESSION="ENABLE_IDLE_SESSION",e.SET_IDLE_SESSION="SET_IDLE_SESSION",e.ENABLE_IP_RESTRICTIONS="ENABLE_IP_RESTRICTIONS",e.CHANGE_IP_TO_ALLOWLIST="CHANGE_IP_TO_ALLOWLIST",e.ENABLE_DOMAIN_RESTRICTIONS="ENABLE_DOMAIN_RESTRICTIONS",e.CHANGE_DOMAIN_TO_ALLOWLIST="CHANGE_DOMAIN_TO_ALLOWLIST",e.CONFIGURE_SSO="CONFIGURE_SSO"}(tp||(tp={})),function(e){e.MFA_FORCED="MFA_FORCED",e.PARTIALLY_FORCED_MFA="PARTIALLY_FORCED_MFA",e.PARTIAL_MFA_USAGE="PARTIAL_MFA_USAGE",e.FULL_MFA_USAGE="FULL_MFA_USAGE",e.BREACHED_PASSWORD_USERS_EXIST="BREACHED_PASSWORD_USERS_EXIST",e.IMPROVE_LOCKOUT_POLICY="IMPROVE_LOCKOUT_POLICY",e.IMPROVE_PASSWORD_HISTORY_POLICY="IMPROVE_PASSWORD_HISTORY_POLICY",e.NO_SESSION_SETTINGS="NO_SESSION_SETTINGS",e.PARTIAL_SESSION_SETTINGS="PARTIAL_SESSION_SETTINGS",e.FULL_SESSION_SETTINGS="FULL_SESSION_SETTINGS",e.NO_IP_RESTRICTIONS="NO_IP_RESTRICTIONS",e.IP_ALLOWLIST="IP_ALLOWLIST",e.IP_DENYLIST="IP_DENYLIST",e.NO_DOMAIN_RESTRICTIONS="NO_DOMAIN_RESTRICTIONS",e.DOMAIN_ALLOWLIST="DOMAIN_ALLOWLIST",e.DOMAIN_DENYLIST="DOMAIN_DENYLIST",e.FULL_PASSWORD_SETTINGS="FULL_PASSWORD_SETTINGS"}(np||(np={})),function(e){e.SEND_RESET_BREACHED_PASSWORD_EMAIL="SEND_RESET_BREACHED_PASSWORD_EMAIL",e.ADJUST_FORCE_RELOGIN="ADJUST_FORCE_RELOGIN",e.ADJUST_MAX_CONCURRENT_SESSIONS="ADJUST_MAX_CONCURRENT_SESSIONS",e.ADJUST_IDLE_TIMEOUT="ADJUST_IDLE_TIMEOUT"}(ip||(ip={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(ap||(ap={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(op||(op={}));const rp={auth:s,teams:l,metadata:c,reports:u,connectivity:f,notifications:d,audits:y,tenants:o,accountSettings:p,roles:g,subscriptions:S,vendor:v,subTenants:h,featureFlags:t,directory:m,impersonate:A,groups:b,users:a,entitlements:r,securityCenter:T,userPhoneNumbers:E},sp={fetch:e,ContextHolder:Vo,FronteggContext:jo,api:rp,FronteggApiError:Bo,AuthStrategyEnum:Oi,MachineToMachineAuthStrategy:Ii,SocialLoginProviders:ki,ISubscriptionCancellationPolicy:Zy,ISubscriptionStatus:Xy,PaymentMethodType:Qy,ProviderType:ef};let lp,cp;!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"}(lp||(lp={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(cp||(cp={}));const up="input is invalid type",dp="undefined"!=typeof ArrayBuffer,yp="0123456789abcdef".split(""),fp=[-2147483648,8388608,32768,128],pp=[24,16,8,0],gp=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Sp=["hex","array","digest","arrayBuffer"],vp=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),dp&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const hp=function(e){return function(t){const n=new Ap(!0).update(t);return null==n?void 0:n[e]()}},mp=function(e){return function(t,n){const i=new bp(t,!0).update(n);return null==i?void 0:i[e]()}};class Ap{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=()=>Ap.prototype.digest(),e?(vp[0]=vp[16]=vp[1]=vp[2]=vp[3]=vp[4]=vp[5]=vp[6]=vp[7]=vp[8]=vp[9]=vp[10]=vp[11]=vp[12]=vp[13]=vp[14]=vp[15]=0,this.blocks=vp):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(up);if(null===e)throw new Error(up);if(dp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||dp&&ArrayBuffer.isView(e)))throw new Error(up);t=!0}let i,a,o=0;const r=e.length,s=this.blocks;for(;o<r;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)for(a=this.start;o<r&&a<64;++o)s[a>>2]|=e[o]<<pp[3&a++];else for(a=this.start;o<r&&a<64;++o)i=e.charCodeAt(o),i<128?s[a>>2]|=i<<pp[3&a++]:i<2048?(s[a>>2]|=(192|i>>6)<<pp[3&a++],s[a>>2]|=(128|63&i)<<pp[3&a++]):i<55296||i>=57344?(s[a>>2]|=(224|i>>12)<<pp[3&a++],s[a>>2]|=(128|i>>6&63)<<pp[3&a++],s[a>>2]|=(128|63&i)<<pp[3&a++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++o)),s[a>>2]|=(240|i>>18)<<pp[3&a++],s[a>>2]|=(128|i>>12&63)<<pp[3&a++],s[a>>2]|=(128|i>>6&63)<<pp[3&a++],s[a>>2]|=(128|63&i)<<pp[3&a++]);this.lastByteIndex=a,this.bytes+=a-this.start,a>=64?(this.block=s[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}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]|=fp[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,i,a,o,r,s,l,c,u,d=this.h0,y=this.h1,f=this.h2,p=this.h3,g=this.h4,S=this.h5,v=this.h6,h=this.h7;const m=this.blocks;for(e=16;e<64;++e)a=m[e-15],t=(a>>>7|a<<25)^(a>>>18|a<<14)^a>>>3,a=m[e-2],n=(a>>>17|a<<15)^(a>>>19|a<<13)^a>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(s=704751109,a=m[0]-210244248,h=a-1521486534<<0,p=a+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),s=d&y,i=s^d&f^u,r=g&S^~g&v,a=h+n+r+gp[e]+m[e],o=t+i,h=p+a<<0,p=a+o<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),l=p&d,i=l^p&y^s,r=h&g^~h&S,a=v+n+r+gp[e+1]+m[e+1],o=t+i,v=f+a<<0,f=a+o<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&p,i=c^f&d^l,r=v&h^~v&g,a=S+n+r+gp[e+2]+m[e+2],o=t+i,S=y+a<<0,y=a+o<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),u=y&f,i=u^y&p^c,r=S&v^~S&h,a=g+n+r+gp[e+3]+m[e+3],o=t+i,g=d+a<<0,d=a+o<<0;this.h0=this.h0+d<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+p<<0,this.h4=this.h4+g<<0,this.h5=this.h5+S<<0,this.h6=this.h6+v<<0,this.h7=this.h7+h<<0}hex(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,i=this.h3,a=this.h4,o=this.h5,r=this.h6,s=this.h7;let l=yp[e>>28&15]+yp[e>>24&15]+yp[e>>20&15]+yp[e>>16&15]+yp[e>>12&15]+yp[e>>8&15]+yp[e>>4&15]+yp[15&e]+yp[t>>28&15]+yp[t>>24&15]+yp[t>>20&15]+yp[t>>16&15]+yp[t>>12&15]+yp[t>>8&15]+yp[t>>4&15]+yp[15&t]+yp[n>>28&15]+yp[n>>24&15]+yp[n>>20&15]+yp[n>>16&15]+yp[n>>12&15]+yp[n>>8&15]+yp[n>>4&15]+yp[15&n]+yp[i>>28&15]+yp[i>>24&15]+yp[i>>20&15]+yp[i>>16&15]+yp[i>>12&15]+yp[i>>8&15]+yp[i>>4&15]+yp[15&i]+yp[a>>28&15]+yp[a>>24&15]+yp[a>>20&15]+yp[a>>16&15]+yp[a>>12&15]+yp[a>>8&15]+yp[a>>4&15]+yp[15&a]+yp[o>>28&15]+yp[o>>24&15]+yp[o>>20&15]+yp[o>>16&15]+yp[o>>12&15]+yp[o>>8&15]+yp[o>>4&15]+yp[15&o]+yp[r>>28&15]+yp[r>>24&15]+yp[r>>20&15]+yp[r>>16&15]+yp[r>>12&15]+yp[r>>8&15]+yp[r>>4&15]+yp[15&r];return l+=yp[s>>28&15]+yp[s>>24&15]+yp[s>>20&15]+yp[s>>16&15]+yp[s>>12&15]+yp[s>>8&15]+yp[s>>4&15]+yp[15&s],l}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,i=this.h3,a=this.h4,o=this.h5,r=this.h6,s=this.h7,l=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a,o>>24&255,o>>16&255,o>>8&255,255&o,r>>24&255,r>>16&255,r>>8&255,255&r];return l.push(s>>24&255,s>>16&255,s>>8&255,255&s),l}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class bp extends Ap{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const i=typeof e;if("string"===i){const t=[],i=e.length;let a,o=0;for(n=0;n<i;++n)a=e.charCodeAt(n),a<128?t[o++]=a:a<2048?(t[o++]=192|a>>6,t[o++]=128|63&a):a<55296||a>=57344?(t[o++]=224|a>>12,t[o++]=128|a>>6&63,t[o++]=128|63&a):(a=65536+((1023&a)<<10|1023&e.charCodeAt(++n)),t[o++]=240|a>>18,t[o++]=128|a>>12&63,t[o++]=128|a>>6&63,t[o++]=128|63&a);e=t}else{if("object"!==i)throw new Error(up);if(null===e)throw new Error(up);if(dp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||dp&&ArrayBuffer.isView(e)))throw new Error(up)}var a;e.length>64&&(e=null==(a=new Ap(!0).update(e))?void 0:a.array());const o=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;o[n]=92^t,r[n]=54^t}Ap.call(this,t),this.update(r),this.oKeyPad=o,this.inner=!0,this.sharedMemory=t}finalize(){if(super.finalize(),this.inner){this.inner=!1;const e=this.array();Ap.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Ap.prototype.finalize.call(this)}}}const Tp=function(){const e=hp("hex");e.create=function(){return new Ap},e.update=function(t){return e.create().update(t)};for(let t=0;t<Sp.length;++t){const n=Sp[t];e[n]=hp(n)}return e}();function Ep(e,t){const n=G({},e);return t.forEach((e=>{delete n[e]})),n}async function kp(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=Tp.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Op(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=mp("hex");e.create=function(e){return new bp(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Sp.length;++t){const n=Sp[t];e[n]=mp(n)}}();const Ip=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*Pp(e){const t=yield za((e=>e.root.appName));return Br.getFeatureFlags(e,t)}const _p={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Lp=G({},_p,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),wp=[{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"}],Up={sub:"",tenants:[],id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!0,profilePictureUrl:"https://www.gravatar.com/avatar/42b2ad2bad6fc9b9db5086dfcf8072ac?d=https://ui-avatars.com/api/fe/128/random?t=1617261890875?t=1617261917434",roles:[{id:"roleId",key:"admin",isDefault:!1,name:"Admin",description:null,permissions:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",key:"fe.*",name:"General Admin",description:"description",categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date,roleIds:[]}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),verified:!1},Cp=G({},Up,{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}),Rp={loading:!1,error:void 0,saving:!0,profile:Up},Dp={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"},Np={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Oi.EmailAndPassword,machineToMachineAuthStrategy:Ii.ClientCredentials},Mp={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Fp={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Gp={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},$p={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},xp={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Vp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],jp={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:$p,roles:Vp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Bp=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Wp={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:[wp[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[wp[0]],managedBy:ep.FRONTEGG}]},zp={id:Wp.id,email:Wp.email,name:Wp.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[wp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Kp={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:[wp[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[wp[0]],managedBy:ep.FRONTEGG}]},Hp={id:Kp.id,email:Kp.email,name:Kp.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[wp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},qp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Jp=[Kp,Wp],Yp=[Hp,zp],Xp=[qp],Qp=[{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}],Zp=[{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"}],eg={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},tg={isActive:!0,strategy:zn.ALLOW},ng=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:zn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:zn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:zn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:zn.BLOCK,description:"IP 4"}],ig=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(G({},Kp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},ag=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"}),og=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:ig(6),roles:[ag("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:ep.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:ig(44),roles:[ag("Editor")],managedBy:ep.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:ig(8),roles:[ag("Viewer")],managedBy:ep.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:ig(5),roles:[ag("Admin")],managedBy:ep.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:ig(21),description:"BDR, AE, and inside sales",roles:[ag("Viewer")],managedBy:ep.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:ig(23),description:"Dev success and customer success",roles:[ag("Admin")],managedBy:ep.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:ig(10),description:"The marketing department",roles:[ag("Viewer")],managedBy:ep.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:ig(4),description:"Human resources",roles:[ag("Viewer")],managedBy:ep.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:ig(3),roles:[ag("Viewer")],managedBy:ep.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:ig(8),roles:[ag("Editor")],managedBy:ep.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:ig(4),roles:[ag("Viewer")],managedBy:ep.FRONTEGG}],rg={scoring:{score:79},recommendations:{items:[{code:tp.FORCE_MFA,severity:ap.WARNING,category:op.MFA},{code:tp.ENABLE_FORCE_RELOGIN,severity:ap.WARNING,category:op.SESSIONS}]}},sg={insights:{items:[{category:op.MFA,code:np.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:op.SESSIONS,code:np.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:op.PASSWORD,code:np.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:op.DOMAIN,code:np.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},lg={users:Yp,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},cg={users:[Yp[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},ug={users:[Yp[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0};let dg,yg,fg;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(dg||(dg={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(yg||(yg={})),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"}(fg||(fg={})),fg.profile,fg.privacy,fg.personalApiTokens,fg.account,fg.users,fg.groups,fg.security,fg.sso,fg.audits,fg.webhooks,fg.apiTokens,fg.roles,fg.subscriptions,fg.allAccounts;const pg=e=>{try{return new URL(e),!0}catch(e){return!1}},gg=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Sg=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},vg="tenantId",hg=e=>e.mfaRequired&&e.mfaToken?(Vo.setAccessToken(null),Vo.setUser(null),!0):(Vo.setAccessToken(e.accessToken),Vo.setUser(e),!1),mg=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,numberOfEmails:i,totalDevices:a}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length),a=+Boolean(e.emails.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,numberOfEmails:a,totalDevices:t+n+i+a}})(e);if(1===a){if(n)return un.authenticatorApp;if(t)return un.smsVerifyCode;if(i)return un.emailVerifyCode}return un.verify},Ag=e=>{if(1===e.length){const[t]=e;if(t===Bs.AuthenticatorApp)return un.authenticatorApp;if(t===Bs.SMS)return un.smsSetPhoneNumber;if(t===Bs.EmailCode)return un.emailVerifyCode}return un.verify};function*bg(e){let t=_t.loginWithTwoFactor,n={};const{loginState:i}=yield za((e=>e.auth)),{isAllowedToRemember:a,mfaDeviceExpiration:o}=yield ja(rp.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:mg(e.mfaDevices)}:(n={step:Ag(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=_t.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:Lt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:G({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:a,mfaDeviceExpiration:o,isBreachedPassword:e.isBreachedPassword})}}const Tg=(e,t)=>e?(e=>Boolean(null==e?void 0:e.statusCode))(e)?e.message:((e=>e instanceof Error||(null==e?void 0:e.message)&&(null==e?void 0:e.stack)&&"Error"===(null==e?void 0:e.name))(e)?console.error(e.message):"string"==typeof e&&console.error(e),null!=t?t:"We're facing some difficulties, Please try again"):t;let Eg;function kg(e,t){var n,i;null==(n=(i=window).onFronteggEvent)||n.call(i,e,t)}!function(e){e.SIGNUP_COMPLETED="signup_completed",e.USER_VERIFIED="user_verified"}(Eg||(Eg={}));const Og=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,...Og(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),Ig=["callback"];function*Pg(){yield $a(ji.setCustomLoginState({loading:!0}));try{const e=yield ja(rp.metadata.getAdminBoxMetadata);yield $a(ji.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield $a(ji.setCustomLoginState({loading:!1,error:Tg(e)}))}}function*_g(e){let{payload:{callback:t}}=e,n=ta(e.payload,Ig);try{yield $a(ji.setCustomLoginState({error:null,saving:!0}));const e=Og(n);if(0===e.length)throw new Error("No changes to update");yield ja(rp.metadata.updateAdminBoxMetadata,{actions:e});const i=yield ja(rp.metadata.getAdminBoxMetadata);yield $a(ji.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield $a(ji.setCustomLoginState({error:Tg(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Lg(){var e,t,n;if(yield za((e=>e.auth.isAuthenticated))){var i;const e=yield null!=(i=za((({auth:e})=>{var t;return null==(t=e.tenantsState.activeTenant)?void 0:t.hasCustomLogin})))&&i;return e}return!!(null==(e=yield null==(t=Vo.getContext())||null==(n=t.tenantResolver)?void 0:n.call(t))?void 0:e.tenant)}function*wg(){try{var e;if(!(yield ja(Lg)))return;const t=yield za((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:i}=rp.accountSettings,{applicationUrl:a}=yield ja(t?n:i);if(!a)return;const{routes:o}=yield za((e=>e.auth)),r=null!=(e=gg(a))?e:"";yield $a(ji.setState({routes:G({},o,{customLoginAuthenticatedUrl:a,customLoginUrl:o.loginUrl+r})})),yield $a(ji.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*Ug(){yield xo(ji.loadTenantMetadata,Pg),yield xo(ji.updateTenantMetadata,_g)}let Cg;!function(e){e.RECOMMENDATIONS="recommendations",e.INSIGHTS="insights",e.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS="sendBulkResetBreachedPasswordEmails",e.SEND_BREACHED_PASSWORD_EMAIL="sendBreachedPasswordEmail",e.BREACHED_PASSWORD_USERS_TABLE="breachedPasswordUsersTable",e.UNENROLLED_MFA_USERS_TABLE="unenrolledMfaUsersTable",e.INACTIVE_USERS_TABLE="inactiveUsersTable"}(Cg||(Cg={}));const Rg=["callback"];function Dg(e){return function*(t){const[n]=yield ja(Pp,["security-center-admin-portal-major-version"]);yield e(t),n&&(yield Ng(),yield Mg())}}function*Ng(){const e=Cg.RECOMMENDATIONS;yield $a(ji.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:i}=yield ja(rp.securityCenter.getRecommendations);yield $a(ji.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==i?void 0:i.score)?t:0}))}catch(t){yield $a(ji.setSecurityCenterStateError({key:e,value:Tg(t)}))}finally{yield $a(ji.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Mg(){const e=Cg.INSIGHTS;yield $a(ji.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield ja(rp.securityCenter.getInsights);yield $a(ji.setSecurityCenterState({insights:t.items}))}catch(t){yield $a(ji.setSecurityCenterStateError({key:e,value:Tg(t)}))}finally{yield $a(ji.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Fg(e){let{payload:{callback:t}}=e,n=ta(e.payload,Rg);const i=Cg.SEND_BREACHED_PASSWORD_EMAIL;yield $a(ji.setSecurityCenterStateError({key:i,value:!1})),yield $a(ji.setSecurityCenterStateLoader({key:i,value:!0}));try{yield ja(rp.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield $a(ji.setSecurityCenterStateError({key:i,value:Tg(e)})),null==t||t(!1,e)}finally{yield $a(ji.setSecurityCenterStateLoader({key:i,value:!1}))}}function*Gg({payload:{callback:e}}){const t=Cg.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield $a(ji.setSecurityCenterStateError({key:t,value:!1})),yield $a(ji.setSecurityCenterStateLoader({key:t,value:!0}));try{yield ja(rp.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield $a(ji.setSecurityCenterStateError({key:t,value:Tg(n)})),null==e||e(!1)}finally{yield $a(ji.setSecurityCenterStateLoader({key:t,value:!1}))}}function*$g({key:e,tableState:t,updateStateKey:n,_offset:i,_limit:a,_preset:o,_email:r,_maxInactiveSeconds:s}){var l,c,u,d;yield $a(ji.setSecurityCenterStateError({key:e,value:!1})),yield $a(ji.setSecurityCenterStateLoader({key:e,value:!0}));const y=null!=(l=null!=i?i:null==t||null==(c=t.queryParams)?void 0:c._offset)?l:0,f=null!=(u=null!=a?a:null==t||null==(d=t.queryParams)?void 0:d._limit)?u:10,p=G({_offset:y,_limit:f,_includeSubTenants:!1,_preset:o,_maxInactiveSeconds:s},!!r&&{_email:r});try{const{items:t,_metadata:{totalItems:i,totalPages:a}}=yield ja(rp.users.getUsersV3,p),o={totalUsersItems:i,totalUsersPages:a,usersPageOffset:y,queryParams:G({_offset:y,_limit:f,_maxInactiveSeconds:s},!!r&&{_email:r})};if(t.length){const e=yield function*(e){const t=e.map((e=>e.id)),n=yield ja(rp.roles.getRoles),i=yield ja(rp.users.getUsersRoles,{ids:t});return e.map((e=>{var t,a;const o=null==i||null==(t=i.find((t=>t.userId===e.id)))?void 0:t.roleIds;return G({},e,{roles:null!=(a=null==o?void 0:o.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?a:[]})}))}(t);yield $a(ji.setSecurityCenterState({[n]:G({users:e},o)}))}else yield $a(ji.setSecurityCenterState({[n]:G({users:[]},o)}))}catch(t){yield $a(ji.setSecurityCenterStateError({key:e,value:Tg(t)}))}finally{yield $a(ji.setSecurityCenterStateLoader({key:e,value:!1}))}}function*xg({payload:e}){var t;const n=Cg.BREACHED_PASSWORD_USERS_TABLE,i=yield null!=(t=za((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield $g(G({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:pi.BREACHED_PASSWORDS,tableState:i},e))}function*Vg({payload:e}){var t;const n=Cg.UNENROLLED_MFA_USERS_TABLE,i=yield null!=(t=za((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield $g(G({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:pi.MFA_UNENROLLED,tableState:i},e))}function*jg({payload:e}){var t;const n=Cg.INACTIVE_USERS_TABLE,i=yield null!=(t=za((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield $g(G({key:n,updateStateKey:"inactiveUsersTable",_preset:pi.INACTIVE,tableState:i},e))}function*Bg(){yield Go(ji.loadRecommendations,Ng),yield Go(ji.loadInsights,Mg),yield Go(ji.sendResetBreachedPasswordEmail,Fg),yield Go(ji.sendBulkResetBreachedPasswordEmails,Gg),yield Go(ji.loadBreachedPasswordUsers,xg),yield Go(ji.loadUnenrolledMfaUsers,Vg),yield Go(ji.loadInactiveUsers,jg)}function*Wg(){const e=Cg.RECOMMENDATIONS;yield $a(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ka(500),yield $a(ji.setSecurityCenterState({recommendations:rg.recommendations.items,score:rg.scoring.score})),yield $a(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*zg(){const e=Cg.INSIGHTS;yield $a(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ka(500),yield $a(ji.setSecurityCenterState({insights:sg.insights.items})),yield $a(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*Kg(){const e=Cg.BREACHED_PASSWORD_USERS_TABLE;yield $a(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ka(500),yield $a(ji.setSecurityCenterState({breachedPasswordUsersTable:lg})),yield $a(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*Hg(){const e=Cg.UNENROLLED_MFA_USERS_TABLE;yield $a(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ka(500),yield $a(ji.setSecurityCenterState({unenrolledMfaUsersTable:ug})),yield $a(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*qg(){const e=Cg.INACTIVE_USERS_TABLE;yield $a(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ka(500),yield $a(ji.setSecurityCenterState({inactiveUsersTable:cg})),yield $a(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*Jg({payload:{callback:e}}){const t=Cg.SEND_BREACHED_PASSWORD_EMAIL;yield $a(ji.setSecurityCenterStateLoader({key:t,value:!0})),yield Ka(500),null==e||e(!0),yield $a(ji.setSecurityCenterStateLoader({key:t,value:!1}))}function*Yg(){yield Go(ji.loadRecommendations,Wg),yield Go(ji.loadInsights,zg),yield Go(ji.loadBreachedPasswordUsers,Kg),yield Go(ji.loadUnenrolledMfaUsers,Hg),yield Go(ji.loadInactiveUsers,qg),yield Go(ji.sendResetBreachedPasswordEmail,Jg)}const Xg=["callback"],Qg=["callback"],Zg=["callback"],eS=["callback"],tS=["callback"],nS=["callback"];function*iS(){yield $a(ji.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield ja(rp.auth.getGlobalSecurityPolicy);yield $a(ji.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield $a(ji.setSecurityPolicyGlobalState({error:Tg(e),loading:!1}))}yield $a(ji.loadSecurityPolicyMfa()),yield $a(ji.loadSecurityPolicyVendorMfa()),yield $a(ji.loadSecurityPolicyLockout()),yield $a(ji.loadSecurityPolicyVendorLockout()),yield $a(ji.loadSecurityPolicyVendorPasswordHistory()),yield $a(ji.loadSecurityPolicyCaptcha()),yield $a(ji.loadPublicAuthStrategiesPolicy())}function*aS(e){var t,n;if(!(yield ja(Lg)))return e;const i=yield ja(rS);return null!=i&&null!=(t=i.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?G({},e,{authStrategy:i.mainAuthStrategies[0].strategy}):e}function*oS(){yield $a(ji.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield ja(rp.auth.getVendorConfig),t=yield aS(e);yield $a(ji.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield $a(ji.setSecurityPolicyPublicState({error:Tg(e),loading:!1}))}}function*rS(){const e=yield za((({auth:e})=>e.isAuthenticated));let t;return t=e?yield ja(rp.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield ja(rp.auth.getVendorPublicAuthStrategiesConfig),t}function*sS(){yield $a(ji.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield ja(rS);yield function*(e){const t=yield ja(Lg);if(!e||!t)return;const{policy:n}=yield za((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield $a(ji.setSecurityPolicyPublicState({policy:G({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield $a(ji.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield $a(ji.setSecurityPolicyAuthStrategyPublicState({error:Tg(e),loading:!1}))}}function*lS(){yield $a(ji.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield ja(rp.auth.getMfaPolicy);yield $a(ji.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield $a(ji.setSecurityPolicyMfaState({error:Tg(e),loading:!1}))}}function*cS(){yield $a(ji.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield ja(rp.auth.getVendorMfaPolicy);yield $a(ji.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield $a(ji.setSecurityPolicyVendorMfaState({error:Tg(e),loading:!1}))}}function*uS(e){let{payload:{callback:t}}=e,n=ta(e.payload,Xg);yield $a(ji.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield ja(rp.auth.saveMfaPolicy,n);yield $a(ji.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield $a(ji.setSecurityPolicyMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*dS(){yield $a(ji.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield ja(rp.auth.getLockoutPolicy);yield $a(ji.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield $a(ji.setSecurityPolicyLockoutState({error:Tg(e),loading:!1}))}}function*yS(e){let{payload:{callback:t}}=e,n=ta(e.payload,Qg);yield $a(ji.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield ja(rp.auth.saveLockoutPolicy,n);yield $a(ji.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield $a(ji.setSecurityPolicyLockoutState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*fS(){yield $a(ji.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield ja(rp.auth.getVendorLockoutPolicy);yield $a(ji.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield $a(ji.setSecurityPolicyVendorLockoutState({error:Tg(e),loading:!1}))}}function*pS(){yield $a(ji.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield ja(rp.auth.getCaptchaPolicy);yield $a(ji.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield $a(ji.setSecurityPolicyCaptchaState({error:Tg(e),loading:!1}))}}function*gS(){yield $a(ji.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield ja(rp.auth.getPasswordHistoryPolicy);yield $a(ji.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield $a(ji.setSecurityPolicyPasswordHistoryState({error:Tg(e),loading:!1}))}}function*SS(){yield $a(ji.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield ja(rp.auth.getVendorPasswordHistoryPolicy);yield $a(ji.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield $a(ji.setSecurityPolicyVendorPasswordHistoryState({error:Tg(e),loading:!1}))}}function*vS(e){let{payload:{callback:t}}=e,n=ta(e.payload,Zg);yield $a(ji.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield ja(rp.auth.savePasswordHistoryPolicy,n);yield $a(ji.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield $a(ji.setSecurityPolicyPasswordHistoryState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*hS(){yield $a(ji.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield ja(rp.auth.getPasswordConfigPolicy);yield $a(ji.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield $a(ji.setSecurityPolicyPasswordState({error:Tg(e),loading:!1}))}}function*mS(){yield xo(ji.loadSecurityPolicy,iS),yield Go(ji.saveSecurityPolicyMfa,Dg(uS)),yield Go(ji.loadSecurityPolicyMfa,lS),yield Go(ji.loadSecurityPolicyVendorMfa,cS),yield Go(ji.saveSecurityPolicyLockout,Dg(yS)),yield Go(ji.loadSecurityPolicyLockout,dS),yield Go(ji.loadSecurityPolicyVendorLockout,fS),yield Go(ji.loadSecurityPolicyCaptcha,pS),yield Go(ji.saveSecurityPolicyPasswordHistory,Dg(vS)),yield Go(ji.loadSecurityPolicyPasswordHistory,gS),yield Go(ji.loadSecurityPolicyVendorPasswordHistory,SS),yield Go(ji.loadVendorPasswordConfig,hS),yield Go(ji.loadPublicSecurityPolicy,oS),yield Go(ji.loadPublicAuthStrategiesPolicy,sS)}function*AS(){yield $a(ji.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield $a(ji.setSecurityPolicyPublicState({policy:Np,loading:!1}))}catch(e){yield $a(ji.setSecurityPolicyPublicState({error:Tg(e),loading:!1}))}}function*bS(){yield $a(ji.setSecurityPolicyGlobalState({loading:!0,error:null})),yield Et(),yield $a(ji.setSecurityPolicyGlobalState({policy:Dp,loading:!1})),yield $a(ji.loadSecurityPolicyMfa()),yield $a(ji.loadSecurityPolicyVendorMfa()),yield $a(ji.loadSecurityPolicyLockout()),yield $a(ji.loadSecurityPolicyVendorLockout()),yield $a(ji.loadSecurityPolicyPasswordHistory()),yield $a(ji.loadSecurityPolicyVendorPasswordHistory()),yield $a(ji.loadSecurityPolicyCaptcha())}function*TS(){yield $a(ji.setSecurityPolicyMfaState({loading:!0,error:null})),yield Et(),yield $a(ji.setSecurityPolicyMfaState({policy:Mp,loading:!1}))}function*ES(){yield $a(ji.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield Et(),yield $a(ji.setSecurityPolicyVendorMfaState({policy:Mp,loading:!1}))}function*kS(e){var t;let{payload:{callback:n}}=e,i=ta(e.payload,eS);yield $a(ji.setSecurityPolicyMfaState({saving:!0,error:null}));const a=G({},Fp,{id:null!=(t=i.id)?t:Fp.id,enforceMFAType:i.enforceMFAType});yield Et(),yield $a(ji.setSecurityPolicyMfaState({policy:a,saving:!1})),null==n||n(a)}function*OS(){yield $a(ji.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield $a(ji.setSecurityPolicyLockoutState({policy:Fp,loading:!1}))}function*IS(){yield $a(ji.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield Et(),yield $a(ji.setSecurityPolicyVendorLockoutState({policy:Fp,loading:!1}))}function*PS(e){let{payload:{callback:t}}=e,n=ta(e.payload,tS);yield $a(ji.setSecurityPolicyLockoutState({saving:!0,error:null})),yield Et();const i=G({},Fp,n,{id:n.id?n.id:Fp.id});null==t||t(i),yield $a(ji.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*_S(){yield $a(ji.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield $a(ji.setSecurityPolicyLockoutState({policy:Fp,loading:!1}))}function*LS(){yield $a(ji.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield Et(),yield $a(ji.setSecurityPolicyPasswordHistoryState({policy:Gp,loading:!1}))}function*wS(){yield $a(ji.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield Et(),yield $a(ji.setSecurityPolicyVendorPasswordHistoryState({policy:Gp,loading:!1}))}function*US(e){let{payload:{callback:t}}=e,n=ta(e.payload,nS);yield $a(ji.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield Et();const i=G({},Gp,n,{id:n.id?n.id:Gp.id});null==t||t(i),yield $a(ji.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*CS(){yield xo(ji.loadSecurityPolicy,bS),yield Go(ji.loadPublicSecurityPolicy,AS),yield Go(ji.saveSecurityPolicyMfa,kS),yield Go(ji.loadSecurityPolicyMfa,TS),yield Go(ji.loadSecurityPolicyVendorMfa,ES),yield Go(ji.saveSecurityPolicyLockout,PS),yield Go(ji.loadSecurityPolicyLockout,OS),yield Go(ji.loadSecurityPolicyVendorLockout,IS),yield Go(ji.loadSecurityPolicyCaptcha,_S),yield Go(ji.saveSecurityPolicyPasswordHistory,US),yield Go(ji.loadSecurityPolicyPasswordHistory,LS),yield Go(ji.loadSecurityPolicyVendorPasswordHistory,wS)}const RS=["phoneNumber"],DS=["events","url"];function*NS(){yield $a(ji.setSignUpState({loading:!0}));try{const e=yield ja(rp.auth.getVendorConfig),t=yield aS(e),{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield $a(ji.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield $a(ji.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield $a(ji.setSignUpState({loading:!1,error:Tg(e),firstLoad:!1}))}}function*MS(e){let{payload:{events:t,url:n}}=e,i=ta(e.payload,DS);yield $a(ji.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:r}=yield za((e=>e.auth)),{shouldActivate:s,user:l,tenantId:c,userId:u,tenants:d=[],activeTenant:y}=yield ja(rp.auth.signUpUser,(o=i,ta(o,RS)));if(!i.invitationToken){var a;const{email:e,name:o,companyName:r,phoneNumber:s}=i,l={email:e,name:o,companyName:r,url:n,phoneNumber:s||void 0,authenticationType:yg.PASSWORD,id:u,tenantId:c,createdAt:new Date};null==t||null==(a=t.signUpComplete)||a.call(t,l),kg(Eg.SIGNUP_COMPLETED,l)}if(!s&&l&&hg(l)){const t=yield bg(l);yield $a(ji.setState(t)),r(e.loginUrl)}else{const{tenantsState:e}=yield za((e=>e.auth));yield $a(ji.setSignUpState({loading:!1,shouldActivate:s,stage:An.SignUpSuccess})),yield $a(ji.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:G({},e,{tenants:d,activeTenant:y})}))}}catch(e){Vo.setAccessToken(null),Vo.setUser(null),yield $a(ji.setSignUpState({loading:!1,error:Tg(e)}))}var o;yield $a(ji.setSignUpState({loading:!1}))}function*FS(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield za((e=>e.auth.signUpState));yield $a(ji.resetSignUpState()),yield $a(ji.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*GS(){yield xo(ji.signUpUser,MS),yield xo(ji.resetSignUpStateSoft,FS)}const $S={setVendorState:(e,{payload:t})=>G({},e,t)},xS={loadVendorPublicInfo:yt("vendor/loadVendorPublicInfo")},VS={loading:!1},{reducer:jS,actions:BS}=pt({name:Ft,initialState:VS,reducers:G({},$S)}),WS=G({},BS,xS);function*zS(){yield $a(WS.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield rp.vendor.getVendorPublicInfo();yield $a(WS.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield $a(WS.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var KS=n(378),HS=n.n(KS);function qS(e,t){return HS()(e,t)}function*JS({payload:e}){const t=null==e?void 0:e.callback,[n]=yield ja(Pp,[Vr]);try{const e=yield ja(n?rp.entitlements.loadEntitlementsV2:rp.entitlements.loadEntitlements);yield function*(e){qS(yield za((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield $a(ji.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*YS(){yield xo(ji.loadEntitlements,JS)}const XS=new class{constructor(){this.loginWithSSO=e=>{if(this.isWebkitAvailable()){var t,n,i;null==(t=window.webkit)||null==(n=t.messageHandlers)||null==(i=n.FronteggNativeBridge)||i.postMessage(JSON.stringify({action:"loginWithSSO",payload:e}))}else{if(!this.isJsInterfaceAvailable())throw new Error("FronteggNativeBridge is not available");var a;null==(a=window.FronteggNativeBridge)||a.loginWithSSO(e)}},this.loginWithSocialLogin=e=>{if(this.isWebkitAvailable()){var t,n,i;null==(t=window.webkit)||null==(n=t.messageHandlers)||null==(i=n.FronteggNativeBridge)||i.postMessage(JSON.stringify({action:"loginWithSocialLogin",payload:e}))}else{if(!this.isJsInterfaceAvailable())throw new Error("FronteggNativeBridge is not available");var a;null==(a=window.FronteggNativeBridge)||a.loginWithSocialLogin(e)}}}isWebkitAvailable(){var e,t;return null!=(null==(e=window.webkit)||null==(t=e.messageHandlers)?void 0:t.FronteggNativeBridge)}isJsInterfaceAvailable(){return null!=window.FronteggNativeBridge}isAvailable(e){var t,n;return!(!this.isWebkitAvailable()&&!this.isJsInterfaceAvailable())&&null!=(t=null==(n=window.FronteggNativeBridgeFunctions)?void 0:n[e])&&t}};function*QS(){const{publicAuthStrategyPolicy:e}=yield za((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===Vs.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),a="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[o]=yield ja(Pp,["show-passkeys-new"]);if(!o||!n||i||a)return!1;{const{devices:e}=yield ja(rp.auth.getWebAuthnDevices);return yield $a(ji.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*ZS({user:e,tenants:t=[],activeTenant:n},i={}){const{tenantsState:a}=yield za((e=>e.auth));yield $a(ji.setState(G({user:e,tenantsState:G({},a,{tenants:t,activeTenant:n,loading:!1})},i)))}const ev="http://schemas.openid.net/pape/policies/2007/06/multi-factor",tv=["otp","sms","hwk"],nv="SHOULD_STEP_UP",iv=(e,{maxAge:t}={})=>{if(!e)return!1;const{amr:n=[],acr:i="",auth_time:a}=e;if(t&&a&&!(Date.now()/1e3-a<=t))return!1;const o=i===ev,r=-1!==n.indexOf("mfa"),s=void 0!==tv.find((e=>n.indexOf(e)));return o&&r&&s};function av(){const e=window.location.pathname+window.location.search;window.localStorage.setItem(Ct,e)}function*ov(e){const{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:a=[]}=yield za((e=>e.auth));if(e)return(e=>{const{pathname:t}=new URL(e),n=gg(e);return n?t+n:t})(e);const{authenticatedUrl:o,loginUrl:r,logoutUrl:s,socialLoginCallbackUrl:l,activateUrl:c}=t;let u=window.localStorage.getItem(Ct);u&&![r,s,l,c].includes(u)||(u=o);const d=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:i})=>{let a=e;const o=new URL(window.location.href).searchParams.get("redirectUrl");return o?t&&pg(o)?((e,t)=>{const n=new URL(window.location.href),i=new URL(e),a=i.origin===n.origin;return t.includes(i.origin)||a})(o,n)?a=o:console.warn("The redirect url param is not valid, the origin is a different site"):a=o:i&&(a+=window.location.search),a})({authenticatedUrl:u,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:a});return(y=d).startsWith(null==(f=window)?void 0:f.location.origin)?y.replace(null==(p=window)?void 0:p.location.origin,""):y;var y,f,p}function*rv(e,{customLoginAuthenticatedUrl:t,forceStepUpUrl:n,shouldStepUpDuringLogin:i}={}){const a=Vo.onRedirectTo;let o;if(n)o=n;else{var r;if(i){const e=window.localStorage.getItem(Ct);e&&!pg(e)&&(o=e)}o||(o=yield ja(ov,t)),null==(r=window)||r.localStorage.removeItem(Ct)}yield Ka(200),$a(e()),a(o,{refresh:o.startsWith("http")})}function*sv(){var e;const{routes:{customLoginAuthenticatedUrl:t,stepUpUrl:n}}=yield za((e=>e.auth)),i=null==(e=window)?void 0:e.localStorage.getItem(nv),a=yield za((({auth:e})=>e.user));var o;if(i&&(null==(o=window)||o.localStorage.removeItem(nv)),n&&i&&!iv(a))return void(yield ja(rv,ji.resetLoginState,{forceStepUpUrl:n}));let r=t;t||(yield ja(wg),r=yield za((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl}))),yield ja(rv,ji.resetLoginState,{customLoginAuthenticatedUrl:r,shouldStepUpDuringLogin:!!i})}function*lv(){yield ja(rv,ji.resetStepUpState)}const cv=["callback"];function*uv(e,t,n){const{loginState:i}=yield za((e=>e.auth));let a={};if(!n){const t=i.flow===Lt.Login?_t.success:i.step;a={loginState:{flow:i.flow,quickLoginToRegister:i.quickLoginToRegister,loading:!1,step:t,error:void 0,tenants:e}}}return G({},a,{isAuthenticated:t})}function*dv(e,t){const{loginState:n}=yield za((e=>e.auth));if(n.flow!==Lt.Login)return;const[i]=yield ja(Pp,["security-center-show-login-flows"]);i&&n.isBreachedPassword&&!e?yield $a(ji.setLoginState({step:_t.breachedPassword,loading:!1})):(yield ja(QS))?yield $a(ji.setLoginState({step:_t.promptPasskeys,loading:!1})):yield sv(),null==t||t(!0)}function*yv(e){yield lv(),null==e||e(!0)}function*fv(e,t,n){let{callback:i}=e,a=ta(e,cv);yield $a(t({loading:!0,error:void 0}));try{const{user:e,tenants:o=[],activeTenant:r}=yield ja(rp.auth.loginWithMfaV2,a),s=!!e.accessToken,l=yield ja(uv,o,s,n);if(yield ja(ZS,{user:e,tenants:o,activeTenant:r},l),e.id&&localStorage.setItem("userId",e.id),yield $a(t({loading:!1,error:void 0})),n)return void(yield ja(yv,i));yield ja(dv,s,i)}catch(e){yield $a(t({loading:!1,error:Tg(e)})),null==i||i(!1,e)}}function*pv({payload:e}){yield fv(e,ji.setLoginState,!1)}function*gv(){yield ja(lv)}function*Sv(e){const{loginState:t}=yield za((e=>e.auth)),{step:n}=yield za((e=>e.auth.mfaState)),[i]=yield ja(Pp,["security-center-show-login-flows"]);if(t.flow===Lt.Login)if(i&&t.isBreachedPassword&&!e)yield $a(ji.setLoginState({step:_t.breachedPassword,loading:!1}));else{const e=yield ja(QS);n===un.smsVerifyCode&&e?yield $a(ji.setLoginState({step:_t.promptPasskeys,loading:!1})):yield sv()}}function*vv({user:e,tenants:t,activeTenant:n},i=!1){yield $a(ji.setUser(e)),yield $a(ji.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const a=!!e.accessToken;yield $a(ji.setState({isAuthenticated:a})),i?yield ja(gv):yield ja(Sv,a)}const hv=["callback","deviceId"],mv=["callback","deviceId"];function*Av(e,t){let{callback:n,deviceId:i}=e,a=ta(e,hv);yield $a(t({loading:!1,error:void 0}));try{const e=yield ja(rp.auth.preVerifyMFASMSForLogin,i,a);yield $a(ji.setMfaState({otcToken:e.otcToken,step:un.smsVerifyCode,phoneNumber:e.phoneNumber})),yield $a(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield $a(t({loading:!1,error:Tg(e)})),null==n||n(null)}}function*bv(e,t,n=!1){let{callback:i,deviceId:a}=e,o=ta(e,mv);yield $a(t({loading:!0}));try{const e=yield ja(rp.auth.verifyMFASMSForLoginV2,a,o);yield vv(e,n),yield $a(t({loading:!1,error:void 0})),null==i||i(!0)}catch(e){yield $a(t({loading:!1,error:Tg(e)})),null==i||i(null)}}function*Tv({payload:e}){yield Av(e,ji.setLoginState)}function*Ev({payload:e}){yield bv(e,ji.setLoginState,!1)}const kv=["callback","deviceId"],Ov=["callback","deviceId"];function*Iv(e,t){let{callback:n,deviceId:i}=e,a=ta(e,kv);yield $a(t({loading:!0}));try{var o;const e=yield ja(rp.auth.preVerifyMFAWebAuthnForLogin,i,a),r=G({},e.options,{challenge:It(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>G({},e,{id:It(e.id)})))});yield $a(t({loading:!1,error:void 0})),null==n||n({options:r,webauthnToken:e.webauthnToken})}catch(e){yield $a(t({loading:!1,error:Tg(e)})),null==n||n(null)}}function*Pv(e,t,n){let{callback:i,deviceId:a}=e,o=ta(e,Ov);yield $a(t({loading:!0}));try{const e=Pt(o.publicKey),r=yield ja(rp.auth.verifyMFAWebAuthnForLoginV2,a,G({},o,{options:e}));yield vv(r,n),yield $a(t({loading:!1,error:void 0})),null==i||i(!0)}catch(e){yield $a(t({loading:!1,error:Tg(e)})),null==i||i(null)}}function*_v({payload:e}){yield Iv(e,ji.setLoginState)}function*Lv({payload:e}){yield Pv(e,ji.setLoginState,!1)}const wv=["callback"],Uv=["callback"];function*Cv(e,t){let{callback:n}=e,i=ta(e,wv);yield $a(t({loading:!0,error:void 0}));try{const e=yield ja(rp.auth.preVerifyMFAEmailCode,i);yield $a(ji.setMfaState({otcToken:e.otcToken,step:un.emailVerifyCode})),yield $a(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield $a(t({error:Tg(e)})),null==n||n(null)}}function*Rv(e,t){let{callback:n}=e,i=ta(e,Uv);yield $a(t({loading:!0}));try{const e=yield ja(rp.auth.verifyMFAEmailCodeV2,i);yield vv(e),yield $a(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield $a(t({loading:!1,error:Tg(e)})),null==n||n(null)}}function*Dv({payload:e}){yield Cv(e,ji.setLoginState)}function*Nv({payload:e}){yield Rv(e,ji.setLoginState)}const Mv=["callback"],Fv=["callback"],Gv=["callback"],$v=["callback"],xv=["callback","events"],Vv=["callback"],jv=["callback"],Bv=["callback"],Wv=["callback"],zv=["user"],Kv=["callback"],Hv=["callback"],qv=["callback"],Jv=["callback"],Yv=["callback"];function*Xv(e){const t=yield za((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return qS(t,null==e?void 0:e.entitlements)?G({},e,{entitlements:t}):e}function*Qv(){let e;try{var t;const n=yield ja(rp.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield $a(ji.setState({ssoACS:e}))}function*Zv(){try{const{isActive:e}=yield ja(rp.auth.getSSOPublicConfiguration);yield $a(ji.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*eh(e){var t;const{routes:n,loginState:i}=yield za((e=>e.auth)),a=null!=(t=localStorage.getItem("register-quick-login"))?t:i.quickLoginToRegister;return a&&"true"!==localStorage.getItem(`${e.id}-${a}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*th(){const{hostedLoginBox:e}=yield za((e=>e.auth));e?yield ja(nh):yield ja(ah)}function*nh(){const{user:e}=yield za((e=>e.auth));if(null==e||!e.refreshToken)return Vo.setAccessToken(null),Vo.setUser(null),void(yield $a(ji.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield ja(rp.auth.exchangeOAuthTokensV2,t),i=yield ja(Xv,n.user);yield ja(ZS,G({},n,{user:i}),{isAuthenticated:!0})}catch(e){Vo.setAccessToken(null),Vo.setUser(null),yield $a(ji.setState({user:null,isAuthenticated:!1}))}}function*ih(){const{user:e}=yield za((e=>e.auth));if(null==e||!e.refreshToken)return Vo.setAccessToken(null),Vo.setUser(null),void(yield $a(ji.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield ja(rp.auth.exchangeOAuthTokensV2,t),i=yield ja(Xv,n.user);yield ja(ZS,G({},n,{user:i}),{isAuthenticated:!0})}catch(e){Vo.setAccessToken(null),Vo.setUser(null),yield $a(ji.setState({user:null,isAuthenticated:!1}))}}function*ah(){try{const t=Vo.onRedirectTo,{routes:n,loginState:i}=yield za((e=>e.auth)),{user:a,tenants:o=[],activeTenant:r}=yield ja(rp.auth.refreshTokenV3);if(hg(a)){const e=yield bg(a);yield $a(ji.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;a.id&&localStorage.setItem("userId",a.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield eh(a),s=yield ja(Xv,a);yield ja(ZS,{user:s,tenants:o,activeTenant:r},{loginState:G({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield rh(n)}}catch(e){Vo.setAccessToken(null),Vo.setUser(null),yield $a(ji.setState({user:void 0,isAuthenticated:!1}))}}function*oh(){try{const t=Vo.onRedirectTo,{routes:n,loginState:i}=yield za((e=>e.auth)),{user:a,tenants:o=[],activeTenant:r}=yield ja(rp.auth.refreshTokenV3);if(hg(a)){const e=yield bg(a);yield $a(ji.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const s=yield ja(Xv,a);if(yield ja(QS))yield $a(ji.setLoginState({step:_t.promptPasskeys,loading:!1})),yield ja(ZS,{user:s,tenants:o,activeTenant:r},{isLoading:!1}),t(n.loginUrl,{preserveQueryParams:!0});else{var e;a.id&&localStorage.setItem("userId",a.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield eh(a);yield ja(ZS,{user:s,tenants:o,activeTenant:r},{loginState:G({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield rh(n)}}}catch(e){Vo.setAccessToken(null),Vo.setUser(null),yield $a(ji.setState({user:void 0,isAuthenticated:!1}))}}function*rh(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=Vo.onRedirectTo,{routes:a,loginState:o}=yield za((e=>e.auth)),r=n.searchParams.get("invitationToken"),s=[a.socialLoginCallbackUrl,a.oidcRedirectUrl,a.samlCallbackUrl];r||s.push(a.loginUrl,a.signUpUrl),e?i(a.loginUrl):s.some((e=>e&&window.location.pathname.endsWith(e)))&&(o.isNewUser&&a.signUpSuccessUrl&&a.socialLoginCallbackUrl===window.location.pathname?i(a.signUpSuccessUrl,{refresh:a.signUpSuccessUrl.startsWith("http")}):yield sv())}function*sh({payload:{callback:e}}){try{const{ip:t}=yield ja(rp.metadata.getCurrentUserIpMetadata);yield $a(ji.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*lh({payload:e}){const t=[],n=[];t.push(ja(th)),e&&(yield $a(ji.setState({isLoading:!0})),yield $a(ji.loadSocialLoginsConfigurationV2()),t.push(ja(NS)),t.push(ja(sS)),t.push(ja(Zv)),t.push(ja(zS)),t.push(ja(Qv)),n.push(ja(wg))),yield xa(t),n.length>0&&(yield xa(n)),yield $a(ji.setState({isLoading:!1}))}function*ch({accessToken:e,user:t}){if(!e)return void(yield $a(ji.setState({user:void 0,isAuthenticated:!1})));const n=Vo.onRedirectTo,{routes:i}=yield za((e=>e.auth));if(hg(t)){const e=yield bg(t);yield $a(ji.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*uh({payload:e}){const t=[];yield $a(ji.loadSocialLoginsConfigurationV2()),t.push(ja(NS)),t.push(ja(Zv)),t.push(ja(zS)),t.push(ja(Qv)),t.push(ja(ch,e)),t.push(ja(wg)),yield xa(t)}const dh=e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}};function*yh(){const e=yield ja(rp.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield ja(ZS,e,{isAuthenticated:!0,isLoading:!1})}function*fh({payload:e}){const{disableSilentRefresh:t}=yield za((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if("login"!==(null==e?void 0:e.prompt))try{if(t)throw new Error("silent refresh is disabled");yield yh()}catch(t){yield gh(e)}else yield gh(e)}function*ph({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n,loginDirectAction:i}}){var a;if(n){const{urlStrategy:e}=yield za((e=>({urlStrategy:e.root.urlStrategy}))),t=dh(e);if(yield $a(ji.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:o}=yield za((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if(i&&((e=e||{}).login_direct_action=btoa(JSON.stringify(i))),"login"!==(null==(a=e)?void 0:a.prompt))try{if(o)throw new Error("silent refresh is disabled");yield yh()}catch(n){if(!t)return void(yield $a(ji.setState({isLoading:!1})));yield gh(e)}else yield gh(e)}function*gh(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:a}=yield za((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(dh(a)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield $a(ji.setState({isLoading:!0}));const o=Op(),r=Op(),s=yield ja(kp,r);localStorage.setItem(Rt,r);let l=`${window.location.origin}${"path"===a?"":"#"}${t.hostedLoginRedirectUrl}`;yield ja(wg);const c=yield za((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));c&&(l.endsWith("/")&&(l=l.slice(0,-1)),l+=c);const u=`${Lr(n,"/oauth/authorize")}/oauth/authorize`,d=G({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:l,code_challenge:s,code_challenge_method:"S256",nonce:o},e);if(n.tenantResolver){var y;const e=yield null==(y=n.tenantResolver)?void 0:y.call(n);null!=e&&e.tenant&&(d.organization=e.tenant)}const f=Sg(vg);f&&(d.tenantId=f),i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*Sh({payload:e}){const t=localStorage.getItem(Rt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield za((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let a=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;yield ja(wg);const o=yield za((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));o&&(a.endsWith("/")&&(a=a.slice(0,-1)),a+=o);const r={code:e.code,redirect_uri:a,code_verifier:t,grant_type:"authorization_code"};try{const e=yield ja(rp.auth.exchangeOAuthTokensV2,r);yield ja(ZS,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield $a(ji.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{const e=window.localStorage.getItem(nv);window.localStorage.removeItem(nv),e?yield lv():yield sv()}}function*vh(e){let{payload:{callback:t}}=e,n=ta(e.payload,Mv);try{yield $a(ji.setLoginState({loading:!0}));const e=yield ja(rp.auth.changePhoneNumberWithVerification,n);yield $a(ji.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:_t.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield $a(ji.setLoginState({error:Tg(e),loading:!1}))}}function*hh(e){let{payload:{callback:t}}=e,n=ta(e.payload,Fv);try{yield $a(ji.setLoginState({loading:!0})),yield ja(rp.auth.verifyChangePhoneNumber,n),yield $a(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $a(ji.setLoginState({error:Tg(e),loading:!1}))}}function*mh(e){let{payload:{callback:t}}=e,n=ta(e.payload,Gv);try{yield $a(ji.setLoginState({loading:!0}));const e=yield ja(rp.auth.passwordlessPreLogin,G({},n,{type:Oi.SmsCode}));yield $a(ji.setLoginState({step:_t.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield $a(ji.setLoginState({error:Tg(e),loading:!1})),null==t||t(e)}}function*Ah(e){let{payload:{callback:t}}=e,n=ta(e.payload,$v);try{let e;yield $a(ji.setLoginState({loading:!0})),function(e){return"email"in e}(n)&&(e=n.email);const i=yield ja(rp.auth.passwordlessPreLogin,n),a=Pi[n.type];yield $a(ji.setLoginState({step:a,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:e,error:void 0})),null==t||t()}catch(e){yield $a(ji.setLoginState({error:Tg(e),loading:!1})),null==t||t()}}function*bh(e){let{payload:{callback:t,events:n}}=e,i=ta(e.payload,xv);try{yield $a(ji.setLoginState({loading:!0}));const{user:e,tenants:o=[],activeTenant:r}=yield ja(rp.auth.passwordlessPostLoginV2,i),s=Vo.onRedirectTo,{routes:l}=yield za((e=>e.auth));if(hg(e)){const t=yield bg(e);yield $a(ji.setState(t)),s(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield za((e=>e.auth));if(e.emailVerified){var a;const t={email:e.email,origin:dg.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name};null==n||null==(a=n.userVerified)||a.call(n,t),kg(Eg.USER_VERIFIED,t)}e.id&&localStorage.setItem("userId",e.id),yield ja(ZS,{user:e,tenants:o,activeTenant:r}),yield $a(ji.setLoginState({error:void 0})),yield $a(ji.setState({isLoading:!1})),i.flow===Lt.Login?(yield ja(QS))?(yield $a(ji.setLoginState({step:_t.promptPasskeys,loading:!1})),s(l.loginUrl,{preserveQueryParams:!0})):(yield $a(ji.setState({isAuthenticated:!0})),yield sv()):s(l.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield $a(ji.setLoginState({error:Tg(e,"Failed to authenticate")}))}finally{yield $a(ji.setLoginState({loading:!1}))}}function*Th({payload:e}){try{yield $a(ji.setLoginState({loading:!0}));const{name:t}=yield ja(rp.auth.verifyInviteToken,e);yield $a(ji.setLoginState({inviteTokenTenantName:t}))}catch(e){yield $a(ji.setLoginState({inviteTokenError:Tg(e,"We couldn't verify your invitation")}))}finally{yield $a(ji.setLoginState({loading:!1}))}}function*Eh({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield $a(ji.setLoginState({loading:!0}));try{const a=yield za((({auth:{onRedirectTo:e}})=>e)),o=Sg(vg),{address:r,idpType:s}=yield ja(rp.auth.preLoginV2,{email:e,tenantId:o});if(r){let t=r;if(s===cp.Oidc&&!t.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield za((({auth:{routes:e}})=>({routes:e})));t+=`&redirect_uri=${window.location.origin}${e}`}XS.isAvailable("loginWithSSO")?(XS.loginWithSSO(e),yield $a(ji.setLoginState({loading:!1,step:_t.redirectToSSO})),null==i||i()):(yield $a(ji.setLoginState({step:_t.redirectToSSO,loading:!1,ssoRedirectUrl:t})),setTimeout((()=>{a(t,{refresh:!0})}),2e3))}else yield kh({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(a){yield kh({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*kh(e){let{callback:t}=e,n=ta(e,Vv);const i=yield za((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield $a(ji.setLoginState({step:_t.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===Oi.EmailAndPassword?(yield $a(ji.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t()):[Oi.MagicLink,Oi.Code,Oi.SmsCode].includes(null==i?void 0:i.authStrategy)?yield $a(ji.passwordlessPreLogin(G({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield $a(ji.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t())}function*Oh({payload:{callback:e}}){try{yield $a(ji.setLoginState({loading:!0}));const{options:t}=yield ja(rp.auth.webAuthnCreateNewDeviceSession);t.user.id=It(t.user.id),t.challenge=It(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield $a(ji.setLoginState({error:Tg(t)})),null==e||e(null)}finally{yield $a(ji.setLoginState({loading:!1}))}}function*Ih(e){let{payload:{callback:t}}=e,n=ta(e.payload,jv);try{yield $a(ji.setLoginState({loading:!0}));const e=Pt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?js.Platform:js.CrossPlatform;yield ja(rp.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield $a(ji.setLoginState({error:Tg(e)})),null==t||t(null)}finally{yield $a(ji.setLoginState({loading:!1}))}}function*Ph(e){let{payload:{callback:t}}=e,n=ta(e.payload,Bv);try{var i;yield $a(ji.setPasskeysState({loading:!0})),yield $a(ji.setLoginState({loading:!0}));const{options:e}=yield ja(rp.auth.webAuthnPreLogin,n);e.challenge=It(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>G({},e,{id:It(e.id)}))),yield $a(ji.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield $a(ji.setLoginState({error:Tg(e)})),null==t||t(null)}finally{yield $a(ji.setPasskeysState({loading:!1})),yield $a(ji.setLoginState({loading:!1}))}}function*_h(e){let{payload:{callback:t}}=e,n=ta(e.payload,Wv);try{var i;yield $a(ji.setPasskeysState({loading:!0})),yield $a(ji.setLoginState({loading:!0}));const e=Pt(n.publicKey),a=yield ja(rp.auth.webAuthnPostLoginV2,G({},e,{response:G({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken})),{user:o}=a,r=ta(a,zv);if(hg(o)){const e=Vo.onRedirectTo,{routes:t}=yield za((e=>e.auth)),n=yield bg(o);yield $a(ji.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else o.id&&localStorage.setItem("userId",o.id),yield ja(ZS,G({user:o},r),{isAuthenticated:!0}),yield $a(ji.setLoginState({error:void 0})),yield sv(),null==t||t(!0)}catch(e){yield $a(ji.setLoginState({error:Tg(e)})),null==t||t(null)}finally{yield $a(ji.setPasskeysState({loading:!1})),yield $a(ji.setLoginState({loading:!1}))}}function*Lh({payload:e}){const{onRedirectTo:t,routes:n}=yield za((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield $a(ji.setLoginState({loading:!0}));try{const t=yield ja(rp.auth.postLogin,e);yield $a(ji.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield sv()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield $a(ji.setLoginState({step:_t.loginWithSSOFailed,loading:!1}))}}function*wh({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:a}}){yield $a(ji.setLoginState({loading:!0}));try{const{user:o,tenants:r=[],activeTenant:s}=yield ja(rp.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:i}),l=Vo.onRedirectTo,{routes:c}=yield za((e=>e.auth));if(hg(o)){const e=yield bg(o);yield $a(ji.setState(e)),l(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield za((e=>e.auth)),n=!!o.accessToken;o.id&&localStorage.setItem("userId",o.id),yield ja(ZS,{user:o,tenants:r,activeTenant:s},{loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:o.mfaToken,step:t.flow===Lt.Login?_t.success:t.step,tenants:r,tenantsLoading:!0,isBreachedPassword:o.isBreachedPassword},isAuthenticated:n});const[i]=yield ja(Pp,["security-center-show-login-flows"]);t.flow===Lt.Login&&(i&&o.isBreachedPassword&&!n?yield $a(ji.setLoginState({step:_t.breachedPassword,loading:!1})):n&&((yield ja(QS))?(yield $a(ji.setLoginState({step:_t.promptPasskeys,loading:!1})),l(c.loginUrl,{preserveQueryParams:!0})):yield sv()))}localStorage.removeItem("register-quick-login"),null==a||a(!0)}catch(t){Vo.setAccessToken(null),Vo.setUser(null),null==a||a(!1,t),yield $a(ji.setLoginState({email:e,error:Tg(t),loading:!1}))}}function*Uh({payload:e}){yield $a(ji.setLoginState({loading:!0}));try{var t;yield ja(rp.auth.recoverMfaToken,e),yield $a(ji.setLoginState({loading:!1,error:void 0,step:_t.preLogin})),yield $a(ji.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $a(ji.setLoginState({error:Tg(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Ch({payload:e}){const{hostedLoginBox:t}=yield za((e=>e.auth));yield $a(ji.setState({isLoading:!0}));try{t?yield ja(rp.auth.OAuthLogout):yield ja(rp.auth.logout)}catch{}yield $a(ji.resetState()),yield $a(ji.requestAuthorize(!0)),null==e||e()}function*Rh({payload:e}){var t;try{yield ja(rp.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*Dh({user:e,tenants:t,activeTenant:n}){const i={step:un.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield $a(ji.setMfaState(i)),yield $a(ji.setUser(e)),yield $a(ji.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Nh(e){let{payload:{callback:t}}=e,n=ta(e.payload,Kv);yield $a(ji.setLoginState({loading:!0}));try{const e=yield ja(rp.auth.preEnrollMFASMSForLogin,n);yield $a(ji.setMfaState({otcToken:e.otcToken,step:un.smsVerifyCode,phoneNumber:e.phoneNumber})),yield $a(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $a(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Mh(e){let{payload:{callback:t}}=e,n=ta(e.payload,Hv);yield $a(ji.setLoginState({loading:!0}));try{const e=yield ja(rp.auth.enrollMFASMSForLoginV2,n);yield Dh(e),yield $a(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $a(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Fh(e){let{payload:{callback:t}}=e,n=ta(e.payload,qv);yield $a(ji.setLoginState({loading:!0}));try{var i;const e=yield ja(rp.auth.preEnrollMFAWebAuthnForLogin,n),a=G({},e.options,{challenge:It(e.options.challenge),user:G({},e.options.user,{id:It(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>G({},e,{id:It(e.id)})))});yield $a(ji.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield $a(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Gh(e){let{payload:{callback:t}}=e,n=ta(e.payload,Jv);yield $a(ji.setLoginState({loading:!0}));try{const e=Pt(n.publicKey),i=yield ja(rp.auth.enrollMFAWebAuthnForLoginV2,G({},n,{options:e}));yield Dh(i),yield $a(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $a(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*$h(e){let{payload:{callback:t}}=e,n=ta(e.payload,Yv);yield $a(ji.setLoginState({loading:!0}));try{const e=yield ja(rp.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield Dh(e),yield $a(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $a(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*xh({payload:e}){yield $a(ji.setLoginState({loading:!0}));try{yield ja(rp.auth.forgotPassword,e),yield $a(ji.setLoginState({loading:!1,error:void 0,step:_t.breachedPasswordSuccess})),yield $a(ji.setState({isAuthenticated:!1}))}catch(e){yield $a(ji.setLoginState({loading:!1,error:Tg(e)}))}}function*Vh(){yield xo(ji.requestAuthorize,lh),yield xo(ji.requestAuthorizeSSR,uh),yield xo(ji.requestHostedLoginAuthorize,fh),yield xo(ji.requestHostedLoginAuthorizeV2,ph),yield xo(ji.handleHostedLoginCallback,Sh),yield xo(ji.preLogin,Eh),yield xo(ji.postLogin,Lh),yield xo(ji.login,wh),yield xo(ji.logout,Ch),yield xo(ji.silentLogout,Rh),yield xo(ji.loginWithMfa,pv),yield xo(ji.recoverMfa,Uh),yield xo(ji.quickSmsPasswordlessPreLogin,mh),yield xo(ji.changePhoneNumberWithVerification,vh),yield xo(ji.verifyChangePhoneNumber,hh),yield xo(ji.passwordlessPreLogin,Ah),yield xo(ji.passwordlessPostLogin,bh),yield xo(ji.verifyInviteToken,Th),yield xo(ji.webAuthnPrelogin,Ph),yield xo(ji.webAuthnPostLogin,_h),yield xo(ji.webAuthnCreateNewDeviceSession,Oh),yield xo(ji.webAuthnVerifyNewDeviceSession,Ih),yield xo(ji.afterAuthNavigation,sv),yield xo(ji.getUserIP,sh),yield xo(ji.preEnrollMFASMSForLogin,Nh),yield xo(ji.enrollMFASMSForLogin,Mh),yield xo(ji.preEnrollMFAWebAuthnForLogin,Fh),yield xo(ji.enrollMFAWebAuthnForLogin,Gh),yield xo(ji.enrollMFAAuthenticatorAppForLogin,$h),yield xo(ji.preVerifyMFASMSForLogin,Tv),yield xo(ji.verifyMFASMSForLogin,Ev),yield xo(ji.preVerifyMFAWebAuthnForLogin,_v),yield xo(ji.verifyMFAWebAuthnForLogin,Lv),yield xo(ji.preVerifyMFAEmailCode,Dv),yield xo(ji.verifyMFAEmailCode,Nv),yield xo(ji.resetBreachedPassword,xh)}function*jh({payload:e}){e&&(yield $a(ji.setState({isLoading:!0})));const t=Cp;yield $a(ji.loadTenants()),yield $a(ji.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Bh({payload:{callback:e}}){try{const{ip:t}=ng[0];yield $a(ji.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Wh(){yield xo(ji.requestAuthorize,jh),yield xo(ji.afterAuthNavigation,sv),yield xo(ji.getUserIP,Bh)}const zh=["callback","samlVendor"],Kh=["callback","samlVendor"];function*Hh(){try{var e,t;yield $a(ji.setSSOState({loading:!0}));const n=yield ja(rp.auth.getSamlConfiguration),i=yield ja(rp.auth.getOidcConfiguration),a=yield ja(rp.metadata.getSamlMetadata);n.acsUrl=null==a||null==(e=a.configuration)?void 0:e.acsUrl,n.spEntityId=null==a||null==(t=a.configuration)?void 0:t.spEntityId,n.isSamlActive=null==a?void 0:a.isActive,yield $a(ji.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield $a(ji.setSSOState({error:Tg(e),loading:!1}))}}function*qh({payload:e}){const t=yield za((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield $a(ji.setSSOState({error:void 0,[n]:!0}));try{const i=yield Ip(e[0]),a=yield ja(rp.auth.updateSamlVendorMetadata,{metadata:i});a.isSamlActive=null==t?void 0:t.isSamlActive,yield $a(ji.setSSOState({samlConfiguration:a,error:void 0,[n]:!1}))}catch(e){yield $a(ji.setSSOState({samlConfiguration:t,error:Tg(e),[n]:!1}))}}function*Jh({payload:e}){const{configFile:t,callback:n}=e,i=yield za((e=>e.auth.ssoState.samlConfiguration)),a="saving";yield $a(ji.setSSOState({error:void 0,[a]:!0}));try{const e=yield Ip(t),o=yield ja(rp.auth.updateSamlVendorMetadata,{metadata:e});o.isSamlActive=null==i?void 0:i.isSamlActive,yield $a(ji.setSSOState({samlConfiguration:o,error:void 0,[a]:!1})),null==n||n(!0)}catch(e){yield $a(ji.setSSOState({samlConfiguration:i,error:Tg(e),[a]:!1})),null==n||n(null,e)}}function*Yh({payload:e}){const{callback:t,samlVendor:n}=e,i=ta(e,zh),a=yield za((e=>e.auth.ssoState.samlConfiguration)),o=G({},a,i);let r="saving";(null==o?void 0:o.enabled)!==a.enabled&&(r="loading");try{if(null==o||!o.domain)return void(yield $a(ji.setSSOState({samlConfiguration:G({},a,o)})));if(yield $a(ji.setSSOState({error:void 0,[r]:!0})),e.type===cp.Saml){var s,l;const e=yield ja(rp.metadata.getSamlMetadata);o.acsUrl=null==e||null==(s=e.configuration)?void 0:s.acsUrl,o.spEntityId=null==e||null==(l=e.configuration)?void 0:l.spEntityId}const i=Ep(o,["validated","generatedVerification","createdAt","updatedAt"]);(null==a?void 0:a.domain)!==(null==i?void 0:i.domain)&&(i.ssoEndpoint="",i.publicCertificate="",i.signRequest=!1),i.type=null==n?void 0:n.toLowerCase();const c=yield ja(rp.auth.updateSamlConfiguration,i);c.isSamlActive=null==a?void 0:a.isSamlActive,yield $a(ji.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield $a(ji.setSSOState({samlConfiguration:a,error:Tg(e),[r]:!1})),null==t||t(null,e)}}function*Xh({payload:{callback:e}={}}){const t=yield za((e=>e.auth.ssoState.samlConfiguration));try{yield $a(ji.setSSOState({error:void 0,saving:!0})),yield ja(rp.auth.validateSamlDomain),yield $a(ji.setSSOState({samlConfiguration:G({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield $a(ji.setSSOState({samlConfiguration:G({},t,{validated:!1}),error:Tg(n),saving:!1})),null==e||e(null,n)}}function*Qh(){try{const e=yield ja(rp.auth.getSamlRoles),t=yield ja(rp.auth.getSamlRolesGroups);yield $a(ji.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield $a(ji.setSSOState({error:Tg(e)}))}}function*Zh({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield $a(ji.setSSOState({error:void 0,saving:!0})),yield ja(rp.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield xa(e.map((e=>ja(rp.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield $a(ji.setSSOState({error:Tg(e)}))}}(n)),yield Qh(),yield $a(ji.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield $a(ji.setSSOState({error:Tg(t),saving:!1})),null==e||e(null,t)}}function*em({payload:{callback:e,id:t}}){try{yield $a(ji.setSSOState({error:void 0,saving:!0})),yield ja(rp.auth.deleteSamlGroup,{id:t}),yield Qh(),yield $a(ji.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield $a(ji.setSSOState({error:Tg(t),saving:!1})),null==e||e(null,t)}}function*tm({payload:{group:e,roleIds:t,callback:n}}){try{yield $a(ji.setSSOState({error:void 0,saving:!0})),yield ja(rp.auth.createSamlGroup,{group:e,roleIds:t}),yield Qh(),yield $a(ji.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield $a(ji.setSSOState({error:Tg(e),saving:!1})),null==n||n(null,e)}}function*nm({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield $a(ji.setSSOState({loading:!0})),yield ja(rp.auth.oidcPostLoginV2,t),yield ja(th),yield $a(ji.setSSOState({loading:!1}))}catch(e){yield $a(ji.setSSOState({loading:!1,error:Tg(e,"Failed to authenticate"),firstLoad:!1}))}}function*im(){yield Go(ji.loadSSOConfigurations,Hh),yield Go(ji.saveSSOConfigurations,Yh),yield Go(ji.saveSSOConfigurationsFile,qh),yield Go(ji.saveSSOConfigurationsFileWithCallback,Jh),yield Go(ji.validateSSODomain,Xh),yield Go(ji.loadSSOAuthorizationRoles,Qh),yield Go(ji.updateSSOAuthorizationRoles,Zh),yield Go(ji.deleteSamlGroup,em),yield Go(ji.createSamlGroup,tm),yield Go(ji.oidcPostlogin,nm)}function*am(){yield $a(ji.setSSOState({loading:!0})),yield Et(),yield $a(ji.setSSOState({samlConfiguration:$p,loading:!1,firstLoad:!1}))}function*om({payload:e}){const t="saving";yield $a(ji.setSSOState({error:void 0,[t]:!0}));const n=G({},yield za((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield $a(ji.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*rm({payload:e}){var t,n;const{callback:i,samlVendor:a}=e,o=ta(e,Kh),r=jp.samlConfiguration,s=G({},r,o);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield $a(ji.setSSOState({samlConfiguration:G({},r,s)})));yield $a(ji.setSSOState({error:void 0,[l]:!0})),yield Et(),s.acsUrl=null==xp||null==(t=xp.configuration)?void 0:t.acsUrl,s.spEntityId=null==xp||null==(n=xp.configuration)?void 0:n.spEntityId;const c=Ep(s,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==a?void 0:a.toLowerCase(),yield Et(),yield $a(ji.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*sm({payload:{callback:e}={}}){const t=jp.samlConfiguration;yield $a(ji.setSSOState({error:void 0,saving:!0})),yield Et(),yield $a(ji.setSSOState({samlConfiguration:G({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*lm(){yield Et(),yield $a(ji.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*cm({payload:{callback:e,authorizationRoles:t}}){yield $a(ji.setSSOState({error:void 0,saving:!0})),yield Et(),yield $a(ji.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*um(){yield Go(ji.loadSSOConfigurations,am),yield Go(ji.saveSSOConfigurations,rm),yield Go(ji.saveSSOConfigurationsFile,om),yield Go(ji.validateSSODomain,sm),yield Go(ji.loadSSOAuthorizationRoles,lm),yield Go(ji.updateSSOAuthorizationRoles,cm)}const dm=["callback"],ym=["callback","ssoConfigId"],fm=["callback","ssoConfigId"],pm=["callback","ssoConfigId"];function*gm(){try{return yield ja(rp.auth.getOidcConfiguration)}catch(e){return null}}function*Sm(){try{return yield ja(rp.metadata.getSamlMetadata)}catch(e){return null}}function*vm(){try{yield $a(ji.setSSOLoader({key:lp.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield xa([ja(gm),ja(Sm)]),n=yield ja(rp.auth.getSSOConfigurations);yield $a(ji.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield $a(ji.setSSOError({key:lp.LOAD_SSO_CONFIGURATIONS,value:Tg(e)}))}finally{yield $a(ji.setSSOLoader({key:lp.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*hm({payload:e}){yield $a(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=ta(e,dm),i=yield za((e=>e.auth.ssoState.ssoConfigurations));try{var a;const e=yield ja(rp.auth.createSSOConfiguration,G({},n,{enabled:null!=(a=n.enabled)&&a}));yield $a(ji.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield $a(ji.setSSOError({key:lp.SAVE_SSO_CONFIGURATION,value:Tg(e)})),null==t||t(null,e)}finally{yield $a(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION,value:!1}))}}function*mm({payload:e}){yield $a(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield za((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ip(t),a=yield ja(rp.auth.createSSOConfigurationByMetadata,{metadata:e});yield $a(ji.setSSOState({ssoConfigurations:[...i,a]})),null==n||n(a)}catch(e){yield $a(ji.setSSOError({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:Tg(e)})),null==n||n(null,e)}finally{yield $a(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Am({payload:e}){yield $a(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=ta(e,ym),a=yield za((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ja(rp.auth.updateSSOConfiguration,n,i),o=a.map((t=>t.id===n?e:t));yield $a(ji.setSSOState({ssoConfigurations:o})),null==t||t(e)}catch(e){yield $a(ji.setSSOError({key:lp.UPDATE_SSO_CONFIGURATION,value:Tg(e)})),null==t||t(null,e)}finally{yield $a(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*bm({payload:e}){yield $a(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,a=yield za((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ip(i),o=yield ja(rp.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=a.map((e=>e.id===n?o:e));yield $a(ji.setSSOState({ssoConfigurations:r})),null==t||t(o)}catch(e){yield $a(ji.setSSOError({key:lp.UPDATE_SSO_CONFIGURATION,value:Tg(e)})),null==t||t(null,e)}finally{yield $a(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Tm({payload:e}){yield $a(ji.setSSOLoader({key:lp.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield za((e=>e.auth.ssoState.ssoConfigurations));try{yield ja(rp.auth.deleteSSOConfiguration,t),yield $a(ji.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield $a(ji.setSSOError({key:lp.DELETE_SSO_CONFIGURATION,value:Tg(e)})),null==n||n(null,e)}finally{yield $a(ji.setSSOLoader({key:lp.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Em({payload:e}){const{callback:t,ssoConfigId:n}=e,i=ta(e,fm);yield $a(ji.setSSOLoader({key:lp.SAVE_SSO_DOMAIN,value:!0}));const a=yield za((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ja(rp.auth.createSSODomain,n,i),o=a.map((t=>t.id===n?G({},t,{domains:[...t.domains,e]}):t));yield $a(ji.setSSOState({ssoConfigurations:o})),null==t||t(e)}catch(e){yield $a(ji.setSSOError({key:lp.SAVE_SSO_DOMAIN,value:Tg(e)})),null==t||t(null,e)}finally{yield $a(ji.setSSOLoader({key:lp.SAVE_SSO_DOMAIN,value:!1}))}}function*km({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield $a(ji.setSSOLoader({key:lp.DELETE_SSO_DOMAIN,value:!0}));const a=yield za((e=>e.auth.ssoState.ssoConfigurations));try{yield ja(rp.auth.deleteSSODomain,t,n);const e=a.map((e=>e.id===t?G({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield $a(ji.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield $a(ji.setSSOError({key:lp.DELETE_SSO_DOMAIN,value:Tg(e)})),null==i||i(null,e)}finally{yield $a(ji.setSSOLoader({key:lp.DELETE_SSO_DOMAIN,value:!1}))}}function*Om({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield $a(ji.setSSOLoader({key:lp.VALIDATE_SSO_DOMAIN,value:!0}));const a=yield za((e=>e.auth.ssoState.ssoConfigurations));try{yield ja(rp.auth.validateSSODomain,i,n);const e=a.map((e=>e.id===i?G({},e,{domains:e.domains.map((e=>e.id===n?G({},e,{validated:!0}):e))}):e));yield $a(ji.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield $a(ji.setSSOError({key:lp.VALIDATE_SSO_DOMAIN,value:Tg(e)})),null==t||t(null,e)}finally{yield $a(ji.setSSOLoader({key:lp.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Im({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield $a(ji.setSSOLoader({key:lp.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield za((e=>e.auth.ssoState.ssoConfigurations));try{yield ja(rp.auth.setSSODefaultRoles,t,{roleIds:n});const a=i.map((e=>e.id===t?G({},e,{roleIds:n}):e));yield $a(ji.setSSOState({ssoConfigurations:a})),null==e||e(!0)}catch(t){yield $a(ji.setSSOError({key:lp.UPDATE_SSO_DEFAULT_ROLES,value:Tg(t)})),null==e||e(null,t)}finally{yield $a(ji.setSSOLoader({key:lp.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Pm({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield $a(ji.setSSOLoader({key:lp.SAVE_SSO_GROUPS,value:!0}));const a=yield za((e=>e.auth.ssoState.ssoConfigurations));try{yield xa(t.map((e=>ja(rp.auth.deleteSSOGroup,n,e)))),yield xa(e.map((e=>ja(rp.auth.createSSOGroup,n,e))));const o=yield ja(rp.auth.getSSOGroups,n),r=a.map((e=>e.id===n?G({},e,{groups:o}):e));yield $a(ji.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield $a(ji.setSSOError({key:lp.SAVE_SSO_GROUPS,value:Tg(e)})),null==i||i(null,e)}finally{yield $a(ji.setSSOLoader({key:lp.SAVE_SSO_GROUPS,value:!1}))}}function*_m({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield xa(t.map((t=>ja(rp.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield $a(ji.setSSOError({key:lp.SAVE_SSO_GROUPS,value:Tg(e)})),null==n||n(null,e)}finally{yield $a(ji.setSSOLoader({key:lp.SAVE_SSO_GROUPS,value:!1}))}}function*Lm({payload:e}){yield $a(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:a}=e,o=yield za((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,s;i?(r=yield ja(rp.auth.updateSSOConfigurationByMetadataUrl,i,e),s=o.map((e=>e.id===i?r:e))):(r=yield ja(rp.auth.createSSOConfigurationByMetadataUrl,e),s=[r,...o]),yield $a(ji.setSSOState({ssoConfigurations:s})),null==a||a(r)}catch(e){null==a||a(null,e)}finally{yield $a(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*wm({payload:e}){yield $a(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=ta(e,pm),a=yield za((e=>e.auth.ssoState.ssoConfigurations));try{let e,o;n?(e=yield ja(rp.auth.updateSSOConfiguration,n,i),o=a.map((t=>t.id===n?e:t))):(e=yield ja(rp.auth.createSSOConfiguration,i),o=[e,...a]),yield $a(ji.setSSOState({ssoConfigurations:o})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield $a(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Um(){yield Go(ji.loadSSOConfigurationsV2,vm),yield Go(ji.saveSSOConfigurationV2,hm),yield Go(ji.saveSSODomain,Em),yield Go(ji.deleteSSODomain,km),yield Go(ji.validateSSODomainV2,Om),yield Go(ji.updateSSOConfiguration,Am),yield Go(ji.deleteSSOConfiguration,Tm),yield Go(ji.setSSOGroups,Pm),yield Go(ji.updateSSOGroups,_m),yield Go(ji.setSSODefaultRoles,Im),yield Go(ji.saveSSOConfigurationByMetadata,mm),yield Go(ji.updateSSOConfigurationByMetadata,bm),yield Go(ji.saveSSOConfigurationByUrl,Lm),yield Go(ji.saveSSOConfigurationByData,wm)}const Cm=["callback","profilePictureUrl"],Rm=["callback","profilePictureUrl"];function*Dm(){yield $a(ji.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var i=arguments.length,a=new Array(i>3?i-3:0),o=3;o<i;o++)a[o-3]=arguments[o];return ja.apply(void 0,[Fo,e,t,n].concat(a))}(3,2e3,rp.teams.getProfile),t=yield za((e=>e.auth.user));ji.setUser(G({},t,e)),yield $a(ji.setProfileState({profile:e,loading:!1}))}catch(e){yield $a(ji.setProfileState({loading:!1,error:Tg(e)}))}}function*Nm(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=ta(e.payload,Cm);yield $a(ji.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield za((e=>e.auth.profileState.profile));let a=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const i=`image/${n[1]}`,a=function(e,t){const n=atob(e),i=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),a=new Array(t.length);for(let e=0;e<t.length;e++)a[e]=t.charCodeAt(e);i.push(new Uint8Array(a))}return new Blob(i,{type:t})}(n[2],i),o=new FormData;return o.append(t,new File([a],t,{type:i})),o}(n,"image");if(e){a=yield ja(rp.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(a);n.searchParams.set("t",t),a=n.href}}const o=G({},e,i,{profilePictureUrl:a}),r=yield ja(rp.users.updateUserProfileV2,o),s=yield za((e=>e.auth.user));yield $a(ji.setUser(G({},s,r))),yield $a(ji.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(o)}catch(e){yield $a(ji.setProfileState({saving:!1,error:Tg(e),loading:!1})),null==t||t(null,e)}}function*Mm({payload:e}){yield $a(ji.setProfileState({loading:!0}));try{var t;yield ja(rp.teams.changePassword,e),yield $a(ji.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $a(ji.setProfileState({loading:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Fm(){yield xo(ji.loadProfile,Dm),yield Go(ji.saveProfile,Nm),yield Go(ji.changePassword,Mm)}function*Gm(){yield $a(ji.setProfileState({loading:!0})),yield Et(),yield $a(ji.setUser(G({},Cp,Up))),yield $a(ji.setProfileState({loading:!1,profile:Up}))}function*$m(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=ta(e.payload,Rm);yield $a(ji.setProfileState({saving:!0,error:null}));const a=Rp;let o=a.profile.profilePictureUrl;n!==a.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(o=n);const r=G({},a.profile,i,{profilePictureUrl:o}),s=Cp;yield Et(),yield $a(ji.setUser(G({},s,r))),yield $a(ji.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*xm({payload:e}){var t;yield $a(ji.setProfileState({loading:!0})),yield Et(),yield $a(ji.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Vm(){yield xo(ji.loadProfile,Gm),yield Go(ji.saveProfile,$m),yield Go(ji.changePassword,xm)}const jm=["callback"],Bm=["callback"],Wm=["user"],zm=["callback"],Km=["deviceId","callback"],Hm=["deviceId","callback"],qm=["callback"],Jm=["deviceId"],Ym=["deviceId"],Xm=["callback"],Qm=["deviceId"],Zm=["callback"];function*eA(e){const{step:t}=yield za((e=>e.auth.mfaState));return{step:e.recoveryCode?un.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*tA(){yield $a(ji.setMfaState({saving:!0}));try{const{qrCode:e}=yield ja(rp.auth.enrollMfa);yield $a(ji.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield $a(ji.setMfaState({saving:!1,error:Tg(e)}))}}function*nA(e){let{payload:{callback:t}}=e,n=ta(e.payload,jm);yield $a(ji.setMfaState({saving:!0}));try{const e=yield za((e=>e.auth.user)),i=yield ja(rp.auth.verifyMfa,n),a=yield ja(rp.auth.getMFADevices),o=yield eA(i);yield $a(ji.setMfaState(G({},o,{mfaDevices:a}))),yield $a(ji.setUser(G({},e,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}catch(e){yield $a(ji.setMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*iA(e){let{payload:{callback:t}}=e,n=ta(e.payload,Bm);yield $a(ji.setMfaState({loading:!0}));try{const e=yield ja(rp.auth.loginWithMfaV2,n),{user:i}=e,a=ta(e,Wm),o={step:un.recoveryCode,loading:!1,saving:!1,error:void 0};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield $a(ji.setMfaState(o)),yield ZS(G({user:i},a)),null==t||t(o.recoveryCode)}catch(e){yield $a(ji.setMfaState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*aA({payload:e}){yield $a(ji.setMfaState({saving:!0}));try{var t;yield ja(rp.auth.disableMfa,e);const n=yield ja(rp.auth.getMFADevices);yield $a(ji.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $a(ji.setMfaState({saving:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*oA({payload:e}){yield $a(ji.setMfaState({saving:!0}));try{var t,n;const i=yield ja(rp.auth.preEnrollMFAWebAuthn),a=G({},i.options,{challenge:It(i.options.challenge),user:G({},i.options.user,{id:It(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>G({},e,{id:It(e.id)})))});yield $a(ji.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:a,webauthnToken:i.webauthnToken})}catch(t){var i;yield $a(ji.setMfaState({saving:!1,error:Tg(t)})),null==(i=e.callback)||i.call(e,null,t)}}function*rA(e){let{payload:{callback:t}}=e,n=ta(e.payload,zm);yield $a(ji.setMfaState({saving:!0}));try{const e=Pt(n.publicKey),i=yield ja(rp.auth.enrollMFAWebAuthn,G({},n,{options:e})),a=yield ja(rp.auth.getMFADevices),o=yield eA(i);yield $a(ji.setMfaState(G({},o,{mfaDevices:a}))),null==t||t(o.recoveryCode)}catch(e){yield $a(ji.setMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*sA(e){let{payload:{deviceId:t,callback:n}}=e;ta(e.payload,Km),yield $a(ji.setMfaState({saving:!0}));try{var i;const e=yield ja(rp.auth.preDisableMFAWebAuthn,t),a=G({},e.options,{challenge:It(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>G({},e,{id:It(e.id)})))});yield $a(ji.setMfaState({saving:!1})),null==n||n({options:a,webauthnToken:e.webauthnToken})}catch(e){yield $a(ji.setMfaState({saving:!1,error:Tg(e)})),null==n||n(null,e)}}function*lA(e){let{payload:{deviceId:t,callback:n}}=e,i=ta(e.payload,Hm);yield $a(ji.setMfaState({saving:!0}));try{const e=Pt(i.publicKey);yield ja(rp.auth.disableMFAWebAuthn,t,G({},i,{options:e}));const a=yield ja(rp.auth.getMFADevices);yield $a(ji.setMfaState({saving:!1,error:void 0,mfaDevices:a})),null==n||n(!0)}catch(e){yield $a(ji.setMfaState({saving:!1,error:Tg(e)})),null==n||n(!1,e)}}function*cA({payload:e}){yield $a(ji.setMfaState({saving:!0}));try{var t;const n=yield ja(rp.auth.preEnrollMFASMS,e);yield $a(ji.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 $a(ji.setMfaState({saving:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*uA(e){let{payload:{callback:t}}=e,n=ta(e.payload,qm);yield $a(ji.setMfaState({saving:!0}));try{const e=yield ja(rp.auth.enrollMFASMS,n),i=yield ja(rp.auth.getMFADevices),a=yield eA(e);yield $a(ji.setMfaState(G({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield $a(ji.setMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*dA(e){let{payload:{deviceId:t}}=e,n=ta(e.payload,Jm);yield $a(ji.setMfaState({saving:!0}));try{var i;const e=yield ja(rp.auth.preDisableMFASMS,t);yield $a(ji.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(i=n.callback)||i.call(n,!0)}catch(e){var a;yield $a(ji.setMfaState({saving:!1,error:Tg(e)})),null==(a=n.callback)||a.call(n,!1,e)}}function*yA(e){let{payload:{deviceId:t}}=e,n=ta(e.payload,Ym);yield $a(ji.setMfaState({saving:!0}));try{var i;yield ja(rp.auth.disableMFASMS,t,n);const e=yield ja(rp.auth.getMFADevices);yield $a(ji.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var a;yield $a(ji.setMfaState({saving:!1,error:Tg(e)})),null==(a=n.callback)||a.call(n,!1,e)}}function*fA(){yield $a(ji.setMfaState({loading:!0}));try{yield za((e=>e.auth.user));const e=yield ja(rp.auth.getMFADevices);yield $a(ji.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield $a(ji.setMfaState({loading:!1,error:Tg(e)}))}}function*pA(){yield $a(ji.setMfaState({loading:!0}));try{const e=(yield ja(rp.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield $a(ji.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield $a(ji.setMfaState({loading:!1,error:Tg(e)}))}}function*gA(){yield Go(ji.enrollMfa,tA),yield Go(ji.getMFADevices,fA),yield Go(ji.getMFAStrategies,pA),yield Go(ji.verifyMfa,nA),yield Go(ji.disableMfa,aA),yield Go(ji.verifyMfaAfterForce,iA),yield Go(ji.preDisableMfaSms,dA),yield Go(ji.disableMfaSms,yA),yield Go(ji.preEnrollMfaSms,cA),yield Go(ji.enrollMfaSms,uA),yield Go(ji.preEnrollMfaWebAuthn,oA),yield Go(ji.enrollMfaWebAuthn,rA),yield Go(ji.preDisableMfaWebAuthn,sA),yield Go(ji.disableMfaWebAuthn,lA)}function*SA(){yield $a(ji.setMfaState({saving:!0})),yield $a(ji.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*vA({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield za((e=>e.auth.mfaState));yield $a(ji.setMfaState({saving:!0})),yield Et();const n={token:"token",recoveryCode:"recoveryCode"},i={step:un.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:G({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield $a(ji.setMfaState(i)),yield $a(ji.setUser(G({},Cp,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*hA(e){let{payload:{callback:t}}=e,n=ta(e.payload,Xm);yield $a(ji.setMfaState({loading:!0})),yield Et();const i=G({},n,{recoveryCode:"recoveryCode"}),a={step:un.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(a.recoveryCode=i.recoveryCode),yield $a(ji.setMfaState(a)),yield Et(),yield $a(ji.setUser(G({},Cp,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}function*mA({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield za((e=>e.auth.mfaState));yield $a(ji.setMfaState({saving:!0})),yield Et(),yield $a(ji.setMfaState({saving:!1,error:void 0,mfaDevices:G({},n,{authenticators:[]})})),yield $a(ji.setUser(G({},Cp))),null==(t=e.callback)||t.call(e,!0)}function*AA(e){let{}=e,t=ta(e.payload,Qm);yield $a(ji.setMfaState({saving:!0}));try{var n;yield $a(ji.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield $a(ji.setMfaState({saving:!1,error:Tg(e)})),null==(i=t.callback)||i.call(t,!1,e)}}function*bA({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield za((e=>e.auth.mfaState));yield $a(ji.setMfaState({saving:!0})),yield Et(),yield $a(ji.setMfaState({loading:!1,error:void 0,mfaDevices:G({},n,{phones:[]})})),yield $a(ji.setUser(G({},Cp))),null==(t=e.callback)||t.call(e,!0)}function*TA({payload:e}){var t;yield $a(ji.setMfaState({saving:!0})),yield Et(),yield $a(ji.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*EA(e){let{payload:{callback:t}}=e;ta(e.payload,Zm);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield za((e=>e.auth.mfaState));yield $a(ji.setMfaState({saving:!0})),yield Et();const i={token:"token",recoveryCode:"recoveryCode"},a={step:un.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:G({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(a.recoveryCode=i.recoveryCode),yield $a(ji.setMfaState(a)),yield $a(ji.setUser(G({},Cp,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}function*kA(){yield Go(ji.enrollMfa,SA),yield Go(ji.verifyMfa,vA),yield Go(ji.disableMfa,mA),yield Go(ji.verifyMfaAfterForce,hA),yield Go(ji.preDisableMfaSms,AA),yield Go(ji.disableMfaSms,bA),yield Go(ji.preEnrollMfaSms,TA),yield Go(ji.enrollMfaSms,EA)}const OA=["callback"];function*IA({payload:e}){yield $a(ji.setForgotPasswordState({loading:!0}));try{var t;yield ja(rp.auth.forgotPassword,e),yield $a(ji.setForgotPasswordState({loading:!1,error:void 0,step:Jt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $a(ji.setForgotPasswordState({loading:!1,error:Tg(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*PA(e){let{payload:{callback:t}}=e,n=ta(e.payload,OA);yield $a(ji.setForgotPasswordState({loading:!0}));try{yield ja(rp.auth.resetPassword,n),yield $a(ji.setForgotPasswordState({loading:!1,error:void 0,step:Jt.success})),null==t||t(!0)}catch(e){yield $a(ji.setForgotPasswordState({loading:!1,error:Tg(e)})),null==t||t(!1,e)}}function*_A({payload:e}){yield $a(ji.setForgotPasswordState({loading:!0}));try{const t=yield ja(rp.auth.loadPasswordConfig,e);yield $a(ji.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield $a(ji.setForgotPasswordState({loading:!1,error:Tg(e)}))}}function*LA(){yield xo(ji.forgotPassword,IA),yield xo(ji.resetPassword,PA),yield xo(ji.loadPasswordConfig,_A)}let wA;!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",e.CONFIG_TEMPORARY_USERS="CONFIG_TEMPORARY_USERS",e.UPDATE_USER_EXPIRATION_TIME="UPDATE_USER_EXPIRATION_TIME"}(wA||(wA={}));const UA=["callback","events"],CA=["user"],RA=["callback"],DA=["callback"];function*NA({payload:{userId:e,token:t}}){yield $a(ji.setActivateState({loading:!0,step:Vt.activating}));try{const{isAuthenticated:n}=yield za((e=>e.auth));n&&(yield $a(ji.silentLogout()));const i=yield ja(rp.auth.getActivateAccountStrategy,{userId:e,token:t});yield $a(ji.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield $a(ji.setActivateState({loading:!1,step:Vt.activatingForm})))}catch(e){yield $a(ji.setActivateState({loading:!1,error:Tg(e)}))}}function*MA(e){let{payload:{callback:t,events:n}}=e,i=ta(e.payload,UA);yield $a(ji.setActivateState({loading:!0}));try{const e=Vo.onRedirectTo,{routes:o}=yield za((e=>e.auth)),r=yield ja(rp.auth.activateAccountV2,i),{user:s}=r,l=ta(r,CA);if(s.redirectLocation)return void(window.location.href=s.redirectLocation);if(hg(s)){yield $a(ji.setActivateState({step:Vt.success}));const t=yield bg(s);yield $a(ji.setState(t)),yield Ka(1e3),e(o.loginUrl,{preserveQueryParams:!0})}else{var a;yield $a(ji.setActivateState({step:Vt.success}));const e={email:s.email,origin:dg.ACTIVATION_LINK,id:s.id,tenantId:s.tenantId,name:s.name,createdAt:new Date};null==n||null==(a=n.userVerified)||a.call(n,e),kg(Eg.USER_VERIFIED,e),yield ja(ZS,G({user:s},l),{isAuthenticated:!0}),yield Ka(1e3),yield sv(),yield $a(ji.resetActivateState())}null==t||t(!0)}catch(e){yield $a(ji.setActivateState({loading:!1,error:Tg(e)}))}}function*FA({payload:e}){const{callback:t}=e,n=ta(e,RA);yield $a(ji.setActivateStrategyState({loading:!0}));try{const e=yield ja(rp.auth.getActivateAccountStrategy,n);yield $a(ji.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield $a(ji.setActivateStrategyState({loading:!1,error:Tg(e)}))}}function*GA({payload:e}){const{callback:t}=e,n=ta(e,DA);yield $a(ji.setTeamLoader({key:wA.RESEND_ACTIVATE_LINK,value:n.email})),yield $a(ji.setActivateState({loading:!0}));try{yield ja(rp.auth.resendActivationEmail,n),yield $a(ji.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield $a(ji.setActivateState({loading:!1,error:Tg(e)})),yield $a(ji.setTeamError({key:wA.RESEND_ACTIVATE_LINK,value:Tg(e)})),null==t||t(null,e)}yield $a(ji.setTeamLoader({key:wA.RESEND_ACTIVATE_LINK,value:!1}))}function*$A(){yield xo(ji.activateAccount,MA),yield xo(ji.preActivateAccount,NA),yield xo(ji.getActivateAccountStrategy,FA),yield xo(ji.resendActivationEmail,GA)}function*xA({payload:e}){if(e.token&&e.userId)try{yield $a(ji.setAcceptInvitationState({error:void 0,step:zt.pending})),yield ja(rp.auth.acceptInvitation,e),yield $a(ji.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:zt.success}}))}catch(e){yield $a(ji.setAcceptInvitationState({step:zt.failed,error:Tg(e)}))}else yield $a(ji.setAcceptInvitationState({error:void 0,step:zt.invalid}))}function*VA(){yield xo(ji.acceptInvitation,xA)}var jA,BA=new Uint8Array(16);function WA(){if(!jA&&!(jA="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 jA(BA)}const zA=/^(?:[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,KA=function(e){return"string"==typeof e&&zA.test(e)};for(var HA=[],qA=0;qA<256;++qA)HA.push((qA+256).toString(16).substr(1));const JA=function(e,t,n){var i=(e=e||{}).random||(e.rng||WA)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var a=0;a<16;++a)t[n+a]=i[a];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(HA[e[t+0]]+HA[e[t+1]]+HA[e[t+2]]+HA[e[t+3]]+"-"+HA[e[t+4]]+HA[e[t+5]]+"-"+HA[e[t+6]]+HA[e[t+7]]+"-"+HA[e[t+8]]+HA[e[t+9]]+"-"+HA[e[t+10]]+HA[e[t+11]]+HA[e[t+12]]+HA[e[t+13]]+HA[e[t+14]]+HA[e[t+15]]).toLowerCase();if(!KA(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let YA,XA;!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"}(YA||(YA={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(XA||(XA={}));const QA=["callback"],ZA=["roles"],eb=["callback"],tb=["callback","profileImage"],nb=["callback"],ib=["callback","userId"],ab=["callback"],ob=["callback"],rb=["callback"],sb=["callback"],lb=["callback"],cb=["callback"],ub=["callback"],db=["callback"],yb=["callback"],fb=["callback","profileImage"],pb=["callback"],gb=["callback"],Sb=["callback"],vb=["callback"],hb=["callback"],mb=["callback"],Ab=["callback"],bb=["callback"],Tb=()=>za((e=>e.auth.teamState));function*Eb(){try{const{groups:e}=yield ja(rp.groups.getGroups,{_groupsRelations:XA.roles});return e}catch(e){return[]}}function*kb({payload:e}){var t,n,i,a,o;const{silentLoading:r,callback:s}=e,l=yield Tb(),c=null!=(t=e.pageSize)?t:l.pageSize,u=null!=(n=e.pageOffset)?n:l.pageOffset,d=null!=(i=e.filter)?i:l.filterV2,y=null!=(a=e.sort)?a:l.sortV2,f=null!=(o=null==e?void 0:e.shouldShowSubTenantUsersIfReseller)?o:null==l?void 0:l.shouldShowSubTenantUsersIfReseller;yield $a(ji.setTeamLoader({key:wA.USERS,value:!r})),yield $a(ji.setTeamState({pageSize:c,pageOffset:u,filterV2:d,sortV2:y}));try{const[{items:t,_metadata:{totalPages:n,totalItems:i}},{items:a},{items:o},r]=yield xa([ja(rp.users.getUsersV2,G({},(null==d?void 0:d.length)&&{_filter:d},y&&{_sortBy:y},e.order&&{_order:e.order},{_offset:u,_limit:c,_includeSubTenants:f})),ja(rp.teams.loadAvailableRoles),ja(rp.teams.loadAvailablePermissions),ja(Eb)]),l=t.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>r.filter((t=>t.id===e.id)))).flat();return G({},e,{groups:n})}));yield $a(ji.setTeamState({users:l.map((e=>G({},e,{roleIds:e.roles.map((e=>e.id))}))),totalPages:n,totalItems:i,roles:a,permissions:o})),null==s||s(t)}catch(e){yield $a(ji.setTeamError({key:wA.USERS,value:Tg(e)})),yield $a(ji.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield $a(ji.setTeamLoader({key:wA.USERS,value:!1}))}function*Ob({payload:e}){var t,n,i,a;const{silentLoading:o,callback:r}=e,s=yield Tb(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filter,d=null!=(a=e.sort)?a:s.sort;yield $a(ji.setTeamLoader({key:wA.USERS,value:!o})),yield $a(ji.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:a}]=yield xa([ja(rp.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),ja(rp.teams.loadAvailableRoles),ja(rp.teams.loadAvailablePermissions)]);yield $a(ji.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:a})),null==r||r(e)}catch(e){yield $a(ji.setTeamError({key:wA.USERS,value:e.message})),yield $a(ji.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield $a(ji.setTeamLoader({key:wA.USERS,value:!1}))}function*Ib({payload:e}){var t,n,i,a,o;const{silentLoading:r,callback:s}=e,l=yield Tb(),c={_limit:(null!=(t=e._limit)?t:l.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:l.allUsersQueryParams._offset)||0,_filter:(null!=(i=e._filter)?i:l.allUsersQueryParams._filter)||"",_sortBy:(null!=(a=e._sortBy)?a:l.allUsersQueryParams._sortBy)||"name",_order:(null!=(o=e._order)?o:l.allUsersQueryParams._order)||"DESC"};yield $a(ji.setTeamLoader({key:wA.USERS,value:!r})),yield $a(ji.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:a}]=yield xa([ja(rp.subTenants.loadAllUsers,G({},c)),ja(rp.teams.loadAvailableRoles),ja(rp.teams.loadAvailablePermissions)]);yield $a(ji.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:a})),null==s||s(e)}catch(e){yield $a(ji.setTeamError({key:wA.USERS,value:Tg(e)})),yield $a(ji.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield $a(ji.setTeamLoader({key:wA.USERS,value:!1}))}function*Pb({payload:e}){yield $a(ji.setTeamLoader({key:wA.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield xa([ja(rp.teams.loadAvailableRoles),ja(rp.teams.loadAvailablePermissions)]);yield $a(ji.setTeamState({roles:n,permissions:i})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:i})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield $a(ji.setTeamError({key:wA.ROLES_AND_PERMISSIONS,value:Tg(t)}))}yield $a(ji.setTeamLoader({key:wA.ROLES_AND_PERMISSIONS,value:!0}))}function*_b({payload:e}){const{callback:t}=e,n=ta(e,QA),i=yield Tb();yield $a(ji.setTeamState({addUserDialogState:G({},i.addUserDialogState,{loading:!0})}));try{var a;const e=yield ja(rp.teams.addUser,n),{roles:o}=e,r=G({},ta(e,ZA),{roleIds:null!=(a=null==o?void 0:o.map((e=>e.id)))?a:[]});null==t||t(r),yield $a(ji.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield $a(ji.setTeamState({addUserDialogState:G({},i.addUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Lb({payload:e}){const{callback:t}=e,n=yield Tb();yield $a(ji.setTeamState({addUserDialogState:G({},n.addUserDialogState,{loading:!0})}));const i=[],a=[],o=e.emails.map((t=>G({email:t,roleIds:e.roleIds},e.expirationInSeconds&&{expirationInSeconds:e.expirationInSeconds})));yield $a(ji.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<o.length;e++){const t=o.at(e);try{yield ja(rp.teams.addUser,t),i.push(t.email)}catch(e){a.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:"",silentLoading:e.emails.length>0};yield $a(ji.loadUsersV2(r)),yield $a(ji.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:a,allowedEmails:i})}function*wb({payload:e}){const{callback:t}=e,n=ta(e,eb),i=yield Tb();yield $a(ji.setTeamState({addUserDialogState:G({},i.addUserDialogState,{loading:!0})}));try{yield ja(rp.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:a}}=yield ja(rp.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield $a(ji.setTeamState({allUsers:e,totalPages:i,totalItems:a,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield $a(ji.setTeamState({addUserDialogState:G({},i.addUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Ub({payload:e}){const{callback:t}=e,n=ta(e,tb),{id:i}=n,a=yield Tb(),o=a.users.find((e=>e.id===n.id));yield $a(ji.setTeamLoader({key:wA.UPDATE_USER,value:i||""})),yield $a(ji.setTeamState({addUserDialogState:G({},a.addUserDialogState,{loading:!0})})),yield $a(ji.setTeamState({addUserDialogState:G({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===n.id?G({},e,n):e))}));try{var r;o.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield ja(rp.teams.updateUser,n);null==t||t(e),yield $a(ji.setTeamState({users:a.users.map((t=>t.id===e.id?G({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield $a(ji.setTeamLoader({key:wA.UPDATE_USER,value:!1}))}catch(e){yield $a(ji.setTeamState({addUserDialogState:G({},a.addUserDialogState,{loading:!1,error:Tg(e)}),users:a.users.map((e=>e.id===n.id?G({},e,o):e))})),yield $a(ji.setTeamLoader({key:wA.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*Cb({payload:e}){const{callback:t}=e,n=ta(e,nb),i=yield Tb();yield $a(ji.setTeamState({deleteUserDialogState:G({},i.deleteUserDialogState,{loading:!0})}));try{yield ja(rp.teams.deleteUser,n),null==t||t(!0),yield $a(ji.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield $a(ji.setTeamState({deleteUserDialogState:G({},i.deleteUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Rb({payload:e}){const{callback:t,userId:n}=e,i=ta(e,ib),a=yield Tb();yield $a(ji.setTeamState({addUserDialogState:G({},a.addUserDialogState,{loading:!0})}));try{yield ja(rp.subTenants.setUserRolesForSubTenants,n,i);const e=a.allUsers.find((e=>e.id===n));let o=[];e&&(o=e.tenants.map((e=>{var t;return G({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>a.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield $a(ji.setTeamState({allUsers:[...a.allUsers.filter((e=>e.id!==n)),...e?[G({},e,{tenants:o})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield $a(ji.setTeamState({addUserDialogState:G({},a.addUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Db({payload:e}){const{callback:t}=e,n=ta(e,ab),i=yield Tb();yield $a(ji.setTeamState({deleteUserDialogState:G({},i.deleteUserDialogState,{loading:!0})}));try{yield ja(rp.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield $a(ji.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield $a(ji.setTeamState({deleteUserDialogState:G({},i.deleteUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Nb({payload:e}){const{callback:t}=e,n=ta(e,ob);yield $a(ji.setTeamLoader({key:wA.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield ja(rp.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield $a(ji.setTeamError({key:wA.RESEND_ACTIVATE_LINK,value:Tg(e)})),null==t||t(null,e)}yield $a(ji.setTeamLoader({key:wA.RESEND_ACTIVATE_LINK,value:!1}))}function*Mb({payload:e}){const{callback:t}=e,n=ta(e,rb);yield $a(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:n.email}));try{yield ja(rp.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield $a(ji.setTeamError({key:wA.RESEND_INVITATION_LINK,value:Tg(e)})),null==t||t(null,e)}yield $a(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:!1}))}function*Fb({payload:e}){const{callback:t}=e,n=ta(e,sb);yield $a(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:n.email}));try{yield ja(rp.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield $a(ji.setTeamError({key:wA.RESEND_INVITATION_LINK,value:Tg(e)})),null==t||t(null,e)}yield $a(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:!1}))}function*Gb({payload:e}){const{callback:t}=e,n=ta(e,lb);yield $a(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:n.email}));try{yield ja(rp.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield $a(ji.setTeamError({key:wA.RESEND_INVITATION_LINK,value:Tg(e)})),null==t||t(null,e)}yield $a(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:!1}))}function*$b(){yield $a(ji.setTeamError({key:wA.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield ja(rp.teams.getInviteLinkConfiguration);yield $a(ji.setTeamState({inviteTokenState:G({},e)}))}catch(e){yield $a(ji.setTeamError({key:wA.CONFIG_TOKEN_LINK,value:Tg(e)}))}}function*xb(){yield $a(ji.setTeamError({key:wA.CONFIG_TEMPORARY_USERS,value:!1}));try{const e=yield ja(rp.teams.getTemporaryUserConfiguration);yield $a(ji.setTeamState({temporaryUsersConfig:e}))}catch(e){yield $a(ji.setTeamError({key:wA.CONFIG_TEMPORARY_USERS,value:Tg(e)}))}}function*Vb({payload:e}){const{callback:t}=e,n=ta(e,cb),i=yield Tb();yield $a(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!0}));try{const e=yield ja(rp.teams.updateUserExpirationTime,n);yield $a(ji.setTeamState({users:i.users.map((t=>t.id===n.userId?G({},t,{temporaryExpirationDate:new Date(e.temporaryExpirationDate)}):t))})),null==t||t(!0)}catch(e){yield $a(ji.setTeamError({key:wA.UPDATE_USER_EXPIRATION_TIME,value:Tg(e)})),null==t||t(null,e)}finally{yield $a(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!1}))}}function*jb({payload:e}){const{callback:t}=e,n=ta(e,ub),i=yield Tb();yield $a(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!0}));try{yield ja(rp.teams.setPermanentUser,n.userId),yield $a(ji.setTeamState({users:i.users.map((e=>e.id===n.userId?G({},e,{temporaryExpirationDate:void 0}):e))})),null==t||t(!0)}catch(e){yield $a(ji.setTeamError({key:wA.UPDATE_USER_EXPIRATION_TIME,value:Tg(e)})),null==t||t(null,e)}finally{yield $a(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!1}))}}function*Bb(){yield $a(ji.setTeamError({key:wA.GET_TOKEN_LINK,value:!1}));try{yield ja($b);const e=yield ja(rp.teams.getInviteUserLink),{inviteTokenState:t}=yield Tb();yield $a(ji.setTeamState({inviteTokenState:G({},t,e)}))}catch(e){yield $a(ji.setTeamError({key:wA.GET_TOKEN_LINK,value:Tg(e)}))}}function*Wb({payload:{callback:e}}){yield $a(ji.setTeamError({key:wA.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield Tb();try{const n=yield ja(rp.teams.createInviteUserLink,{expiresInMinutes:43200});yield $a(ji.setTeamState({inviteTokenState:G({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield $a(ji.setTeamError({key:wA.CREATE_TOKEN_LINK,value:Tg(t)}))}}function*zb({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield Tb();yield $a(ji.setTeamError({key:wA.UPDATE_TOKEN_LINK,value:!1}));try{const a=yield ja(rp.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield $a(ji.setTeamState({inviteTokenState:G({},i,a)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield $a(ji.setTeamError({key:wA.UPDATE_TOKEN_LINK,value:Tg(t)}))}}function*Kb({payload:e}){const{callback:t}=null!=e?e:{};yield $a(ji.setTeamError({key:wA.DELETE_TOKEN_LINK,value:!1}));try{yield ja(rp.teams.deleteInviteUserLink),yield $a(ji.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield $a(ji.setTeamError({key:wA.DELETE_TOKEN_LINK,value:Tg(e)})),null==t||t(!1,e)}}function*Hb({payload:e}){yield $a(ji.setTeamState({addUserDialogState:G({open:!0,loading:!1,error:!1},e)}))}function*qb({payload:e}){const t=yield Tb(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield $a(ji.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Jb({payload:e}){yield $a(ji.setTeamState({deleteUserDialogState:G({open:!0,loading:!1,error:!1},e)}))}function*Yb({payload:e}){const t=yield Tb(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield $a(ji.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Xb(){yield $o(ji.loadUsers,Ob),yield $o(ji.loadUsersV2,kb),yield $o(ji.loadAllSubTenantsUsers,Ib),yield $o(ji.loadRoles,Pb),yield Go(ji.addUser,_b),yield Go(ji.addUsersBulk,Lb),yield Go(ji.addUserToSubTenants,wb),yield Go(ji.updateUser,Ub),yield Go(ji.setUserRolesForSubTenants,Rb),yield Go(ji.deleteUser,Cb),yield Go(ji.deleteUserFromSubTenants,Db),yield Go(ji.resendActivationLink,Nb),yield Go(ji.resendInvitationLink,Mb),yield Go(ji.resendInvitationEmail,Fb),yield Go(ji.resendInvitationLinkToAllSubTenants,Gb),yield Go(ji.getTemporaryUsersConfig,xb),yield Go(ji.updateUserExpirationTime,Vb),yield Go(ji.setUserAsPermanent,jb),yield Go(ji.getInvitationLink,Bb),yield Go(ji.createInvitationLink,Wb),yield Go(ji.updateInvitationLink,zb),yield Go(ji.deleteInvitationLink,Kb),yield Go(ji.openAddUserDialog,Hb),yield Go(ji.closeAddUserDialog,qb),yield Go(ji.openDeleteUserDialog,Jb),yield Go(ji.closeDeleteUserDialog,Yb)}function*Qb({payload:e}){var t,n,i,a;const{silentLoading:o,callback:r}=e,s=yield Tb(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filterV2,d=null!=(a=e.sort)?a:s.sortV2;yield $a(ji.setTeamLoader({key:wA.USERS,value:!o})),yield $a(ji.setTeamState({pageSize:l,pageOffset:c,filterV2:u,sortV2:d})),yield Et(),yield $a(ji.setTeamState({users:Jp,totalPages:2,totalItems:10,roles:Vp,permissions:Bp})),yield $a(ji.setTeamLoader({key:wA.USERS,value:!1})),null==r||r(Jp)}function*Zb({payload:e}){var t,n,i,a,o;const{silentLoading:r,callback:s}=e,l=yield Tb(),c=null!=(t=e._limit)?t:l.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:l.allUsersQueryParams._offset,d=null!=(i=e._filter)?i:l.allUsersQueryParams._filter,y=null!=(a=e._sortBy)?a:l.allUsersQueryParams._sortBy,f=null!=(o=e._order)?o:l.allUsersQueryParams._order;yield $a(ji.setTeamLoader({key:wA.USERS,value:!r})),yield $a(ji.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield Et(),yield $a(ji.setTeamState({allUsers:Xp,totalPages:2,totalItems:10,roles:Vp,permissions:Bp})),yield $a(ji.setTeamLoader({key:wA.USERS,value:!1})),null==s||s(Xp)}function*eT({payload:e}){var t;yield $a(ji.setTeamLoader({key:wA.ROLES_AND_PERMISSIONS,value:!0})),yield Et(),yield $a(ji.setTeamState({roles:Vp,permissions:Bp})),yield $a(ji.setTeamLoader({key:wA.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Vp,permissions:Bp})}function*tT({payload:e}){const{callback:t}=e,n=ta(e,db),i=yield Tb();yield $a(ji.setTeamState({addUserDialogState:G({},i.addUserDialogState,{loading:!0})})),yield Et();const a=new Date,o=G({},Kp,{groups:[]},n,{id:`${JA()}`,temporaryExpirationDate:n.expirationInSeconds?new Date(a.setSeconds(a.getSeconds()+n.expirationInSeconds)):void 0});null==t||t(o),yield $a(ji.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*nT({payload:e}){const{callback:t}=e,n=ta(e,yb),i=yield Tb();yield $a(ji.setTeamState({addUserDialogState:G({},i.addUserDialogState,{loading:!0})})),yield Et();const a=G({},Kp,n,{id:`${JA()}`});yield $a(ji.setTeamState({users:[a,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*iT({payload:e}){var t;const{callback:n}=e,i=ta(e,fb),{id:a}=i,o=yield Tb(),r=o.users.find((e=>e.id===i.id));yield $a(ji.setTeamLoader({key:wA.UPDATE_USER,value:a||""})),yield $a(ji.setTeamState({addUserDialogState:G({},o.addUserDialogState,{loading:!0})})),yield $a(ji.setTeamState({addUserDialogState:G({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===i.id?G({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield Et();const s=G({},r,i);null==n||n(s),yield $a(ji.setTeamState({users:o.users.map((e=>e.id===s.id?G({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield $a(ji.setTeamLoader({key:wA.UPDATE_USER,value:!1}))}function*aT({payload:e}){const{callback:t}=e,n=ta(e,pb),i=yield Tb();yield $a(ji.setTeamState({deleteUserDialogState:G({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield $a(ji.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*oT({payload:e}){const{callback:t}=e,n=ta(e,gb),i=yield Tb();yield $a(ji.setTeamState({deleteUserDialogState:G({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield $a(ji.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*rT({payload:e}){const{callback:t}=e,n=ta(e,Sb);yield $a(ji.setTeamLoader({key:wA.RESEND_ACTIVATE_LINK,value:n.userId})),yield Et(),null==t||t(!0),yield $a(ji.setTeamLoader({key:wA.RESEND_ACTIVATE_LINK,value:!1}))}function*sT({payload:e}){const{callback:t}=e,n=ta(e,vb);yield $a(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield $a(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:!1}))}function*lT({payload:e}){const{callback:t}=e,n=ta(e,hb);yield $a(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield $a(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:!1}))}function*cT({payload:e}){const{callback:t}=e,n=ta(e,mb);yield $a(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield $a(ji.setTeamLoader({key:wA.RESEND_INVITATION_LINK,value:!1}))}function*uT({payload:e}){const{callback:t}=e,n=ta(e,Ab),i=yield Tb();yield $a(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!0}));const a=new Date;yield $a(ji.setTeamState({users:i.users.map((e=>e.id===n.userId?G({},e,{temporaryExpirationDate:n.expirationInSeconds?new Date(a.setSeconds(a.getSeconds()+n.expirationInSeconds)):void 0}):e))})),yield Et(),null==t||t(!0),yield $a(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!1}))}function*dT({payload:e}){const{callback:t}=e,n=ta(e,bb),i=yield Tb();yield $a(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!0})),yield $a(ji.setTeamState({users:i.users.map((e=>e.id===n.userId?G({},e,{temporaryExpirationDate:void 0}):e))})),yield Et(),null==t||t(!0),yield $a(ji.setTeamLoader({key:wA.UPDATE_USER_EXPIRATION_TIME,value:!1}))}function*yT(){yield $o(ji.loadUsersV2,Qb),yield $o(ji.loadAllSubTenantsUsers,Zb),yield $o(ji.loadRoles,eT),yield Go(ji.addUser,tT),yield Go(ji.addUserToSubTenants,nT),yield Go(ji.updateUser,iT),yield Go(ji.deleteUser,aT),yield Go(ji.updateUserExpirationTime,uT),yield Go(ji.setUserAsPermanent,dT),yield Go(ji.deleteUserFromSubTenants,oT),yield Go(ji.resendActivationLink,rT),yield Go(ji.resendInvitationLink,sT),yield Go(ji.resendInvitationEmail,lT),yield Go(ji.resendInvitationLinkToAllSubTenants,cT),yield Go(ji.openAddUserDialog,Hb),yield Go(ji.closeAddUserDialog,qb),yield Go(ji.openDeleteUserDialog,Jb),yield Go(ji.closeDeleteUserDialog,Yb)}const fT=["authorizationUrl"],pT=["events","url"];function*gT(){try{yield $a(ji.setSocialLoginsState({loading:!0}));const e=yield ja(rp.auth.getSocialLoginProviders);yield $a(ji.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield $a(ji.setSocialLoginsState({error:Tg(e),loading:!1,firstLoad:!1}))}}function*ST(){const e=yield za((({auth:e})=>e.isAuthenticated));let t;return t=e?yield ja(rp.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield ja(rp.auth.getSocialLoginProvidersV2),t}function*vT(e){try{var t,n;const i=yield za((e=>e.root.context));yield $a(ji.setSocialLoginsState({loading:!0}));const a=yield ja(ST),{providers:o}=yield ja(rp.auth.getCustomSocialLoginProvidersV1),r={socialLoginsConfigV2:a.map((e=>{let{authorizationUrl:t}=e,n=ta(e,fT);const a=Lr(i,null!=t?t:"");return G({},n,{authorizationUrl:t?`${a}${t}`:null})})),customSocialLoginsConfig:o,loading:!1,firstLoad:!1};yield $a(ji.setSocialLoginsState(r)),null==e||null==(t=e.payload)||null==(n=t.callback)||n.call(t,r)}catch(t){var i,a;null==e||null==(i=e.payload)||null==(a=i.callback)||a.call(i,null,t),yield $a(ji.setSocialLoginsState({error:Tg(t),loading:!1,firstLoad:!1}))}}function*hT(e){let{payload:{events:t,url:n}}=e,i=ta(e.payload,pT);try{yield $a(ji.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield ja(rp.auth.loginViaSocialLogin,i);if(r){var a,o;const r={email:e,url:n,createdAt:new Date,id:s,tenantId:l},u=G({},r,{socialProvider:i.provider,authenticationType:yg.SOCIAL_LOGIN});null==t||null==(a=t.signUpComplete)||a.call(t,u),kg(Eg.SIGNUP_COMPLETED,u);const d=G({},r,{origin:dg.SOCIAL_LOGIN,name:c});null==t||null==(o=t.userVerified)||o.call(t,d),kg(Eg.USER_VERIFIED,d)}s&&localStorage.setItem("userId",s),yield $a(ji.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield za((e=>e.auth));e?yield ja(ih):yield ja(oh)}(),localStorage.removeItem("register-quick-login"),yield $a(ji.setSocialLoginsState({loading:!1}))}catch(e){yield $a(ji.setSocialLoginsState({loading:!1,error:Tg(e,"Failed to authenticate"),firstLoad:!1}))}}function*mT({payload:e}){yield $a(ji.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*AT(){yield xo(ji.loadSocialLoginsConfiguration,gT),yield Go(ji.loadSocialLoginsConfigurationV2,vT),yield xo(ji.loginViaSocialLogin,hT),yield $o(ji.setSocialLoginError,mT)}let bT;function*TT({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:a}=yield za((e=>e.auth.apiTokensState)),{policy:o}=yield za((e=>e.auth.securityPolicyState.publicPolicy)),r=(null==o?void 0:o.machineToMachineAuthStrategy)===Ii.AccessToken;try{let e;yield $a(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!0}));let o=null;n&&(o=1440*n),e=r?yield ja(rp.auth.createUserAccessToken,{description:t,expiresInMinutes:o}):yield ja(rp.auth.updateUserApiTokensData,{description:t,expiresInMinutes:o}),yield $a(ji.setApiTokensState({showAddTokenDialog:!1})),yield Ka(200),yield $a(ji.setApiTokensState({apiTokensDataUser:[G({},e,{type:r?Ii.AccessToken:Ii.ClientCredentials}),...a],successDialog:{open:!0,secret:e.secret,clientId:r?void 0:e.clientId}})),yield $a(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield $a(ji.setApiTokensError({key:bT.ADD_API_TOKEN,value:Tg(e)})),yield $a(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*ET({payload:e}){const{description:t,roleIds:n,expires:i,callback:a}=e,{apiTokensDataTenant:o}=yield za((e=>e.auth.apiTokensState)),{policy:r}=yield za((e=>e.auth.securityPolicyState.publicPolicy)),s=(null==r?void 0:r.machineToMachineAuthStrategy)===Ii.AccessToken;try{let e;yield $a(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!0}));let r=null;i&&(r=1440*i),e=s?yield ja(rp.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n}):yield ja(rp.auth.updateTenantApiTokensData,{description:t,roleIds:n,expiresInMinutes:r}),yield $a(ji.setApiTokensState({showAddTokenDialog:!1})),yield Ka(200),yield $a(ji.setApiTokensState({apiTokensDataTenant:[G({},e,{type:s?Ii.AccessToken:Ii.ClientCredentials}),...o],successDialog:{open:!0,secret:e.secret,clientId:s?void 0:e.clientId}})),yield $a(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!1})),null==a||a(null)}catch(e){yield $a(ji.setApiTokensError({key:bT.ADD_API_TOKEN,value:Tg(e)})),yield $a(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!1})),null==a||a(null,e)}}function*kT({payload:e}){const{apiTokensDataUser:t}=yield za((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield $a(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!0})),n?(yield ja(rp.auth.deleteUserAccessToken,{id:e}),yield $a(ji.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield ja(rp.auth.deleteUserApiToken,{tokenId:e}),yield $a(ji.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield $a(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!1}))}catch(e){yield $a(ji.setApiTokensError({key:bT.DELETE_API_TOKEN,value:Tg(e)})),yield $a(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!1}))}}function*OT({payload:e}){const{apiTokensDataTenant:t}=yield za((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield $a(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!0})),n?(yield ja(rp.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield ja(rp.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield $a(ji.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield $a(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!1}))}catch(e){yield $a(ji.setApiTokensError({key:bT.DELETE_API_TOKEN,value:Tg(e)})),yield $a(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!1}))}}function*IT({payload:e}){null!=e&&e.silentLoading||(yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield xa([ja(rp.auth.getUserApiTokensData),ja(rp.auth.getTenantApiTokensData)]);yield $a(ji.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $a(ji.setApiTokensError({key:bT.LOAD_API_TOKENS,value:Tg(t)})),yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*PT({payload:e}){null!=e&&e.silentLoading||(yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!0})));try{var t,n,i,a;const o=yield null!=(t=ja(rp.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=ja(rp.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).map((e=>G({},e,{type:Ii.AccessToken}))).concat(o.map((e=>G({},e,{type:Ii.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield $a(ji.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,!0)}catch(t){var o;yield $a(ji.setApiTokensError({key:bT.LOAD_API_TOKENS,value:Tg(t)})),yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,null,t)}}function*_T({payload:e}){null!=e&&e.silentLoading||(yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!0})));try{var t,n,i,a;const o=yield null!=(t=ja(rp.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=ja(rp.auth.getTenantAccessTokensData))?n:[],s=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).map((e=>G({},e,{type:Ii.AccessToken}))).concat(o.map((e=>G({},e,{type:Ii.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield $a(ji.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,!0)}catch(t){var o;yield $a(ji.setApiTokensError({key:bT.LOAD_API_TOKENS,value:Tg(t)})),yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,null,t)}}function*LT(){yield xo(ji.loadApiTokens,IT),yield xo(ji.loadUserApiTokens,PT),yield xo(ji.loadTenantApiTokens,_T),yield Go(ji.addUserApiToken,TT),yield Go(ji.addTenantApiToken,ET),yield $o(ji.deleteTenantApiToken,OT),yield $o(ji.deleteUserApiToken,kT)}function*wT({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield $a(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:a}=yield za((e=>e.auth.apiTokensState)),o=G({},Lp,{description:t,roleIds:n,clientId:`CLIENT_ID_${JA()}`});yield $a(ji.setApiTokensState({showAddTokenDialog:!1})),yield Ka(200),yield $a(ji.setApiTokensState({apiTokensDataTenant:[...a,o],successDialog:{open:!0,secret:o.secret,clientId:o.clientId}})),yield Ka(200),yield $a(ji.setApiTokensLoader({key:bT.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*UT({payload:e}){yield $a(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!0})),yield Ka(200);const t=[Lp];yield $a(ji.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield $a(ji.setApiTokensLoader({key:bT.DELETE_API_TOKEN,value:!1}))}function*CT({payload:e}){var t;null!=e&&e.silentLoading||(yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!0})));const n=[_p],i=[Lp];yield $a(ji.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Ka(200),yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*RT({payload:e}){var t;null!=e&&e.silentLoading||(yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!0})));const n=[_p];yield $a(ji.setApiTokensState({apiTokensDataUser:n})),yield Ka(200),yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*DT({payload:e}){var t;null!=e&&e.silentLoading||(yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!0})));const n=[Lp];yield $a(ji.setApiTokensState({apiTokensDataTenant:n})),yield Ka(200),yield $a(ji.setApiTokensLoader({key:bT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*NT(){yield xo(ji.loadApiTokens,CT),yield xo(ji.loadUserApiTokens,RT),yield xo(ji.loadTenantApiTokens,DT),yield Go(ji.addTenantApiToken,wT),yield $o(ji.deleteTenantApiToken,UT)}function*MT({payload:e}){try{var t;yield $a(ji.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield za((e=>e.auth)),{address:i,timezone:a,dateFormat:o,timeFormat:r,currency:s,logo:l}=n,c=yield ja(rp.accountSettings.updateSettings,G({address:i,timezone:a,dateFormat:o,timeFormat:r,currency:s,logo:l},e));yield $a(ji.setAccountSettingsState(G({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield $a(ji.setAccountSettingsState({loading:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*FT({payload:e}){yield $a(ji.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield ja(rp.accountSettings.getSettings);yield $a(ji.setAccountSettingsState(G({},e,{loading:!1})))}catch(e){yield $a(ji.setAccountSettingsState({loading:!1,error:Tg(e)}))}}function*GT(){yield xo(ji.saveAccountSettings,MT),yield xo(ji.loadAccountSettings,FT)}function*$T({payload:e}){var t;yield $a(ji.setAccountSettingsState({loading:!0})),yield Et();const{accountSettingsState:n}=yield za((e=>e.auth)),{address:i,timezone:a,dateFormat:o,timeFormat:r,currency:s,logo:l}=n,c=G({address:i,timezone:a,dateFormat:o,timeFormat:r,currency:s,logo:l},e);yield $a(ji.setAccountSettingsState(G({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*xT({payload:e}){yield $a(ji.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield Et(),yield $a(ji.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*VT(){yield xo(ji.saveAccountSettings,$T),yield xo(ji.loadAccountSettings,xT)}function*jT({payload:{tenantId:e,callback:t}}){yield $a(ji.setState({isLoading:!0}));try{yield ja(rp.tenants.switchTenant,{tenantId:e}),yield ja(th),(null==t?void 0:t(!0))||(yield $a(ji.setState({isLoading:!1})))}catch(e){yield $a(ji.setState({isLoading:!1})),null==t||t(!1,e)}}function*BT({payload:e}){yield $a(ji.setTenantsState({loading:!0}));try{var t;const n=yield ja(ns());yield $a(ji.setTenantsState({tenants:n.tenants,activeTenant:n.activeTenant,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield $a(ji.setTenantsState({loading:!1}))}}function*WT({payload:e}){yield $a(ji.setTenantsState({loading:!0}));try{var t;const n=yield ja(rp.tenants.getSubTenants);yield $a(ji.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $a(ji.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*zT({payload:e}){yield $a(ji.setTenantsState({loading:!0}));try{var t;const n=yield ja(rp.tenants.getSubTenantsAsTree);yield $a(ji.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $a(ji.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*KT(){yield Go(ji.loadTenants,BT),yield Go(ji.loadSubTenants,WT),yield Go(ji.switchTenant,jT),yield Go(ji.loadSubTenantsTree,zT)}function*HT(){yield $a(ji.setTenantsState({loading:!0})),yield Et(),yield $a(ji.setTenantsState({tenants:Qp,activeTenant:Qp[0],loading:!1}))}function*qT(){yield Go(ji.loadTenants,HT)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(bT||(bT={}));const JT=["callback"],YT=["callback"],XT=["callback"],QT=["callback"],ZT=["callback"];function*eE({payload:e}){var t;yield $a(ji.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield xa([ja(rp.roles.getRoles),ja(rp.roles.getPermissions),ja(rp.roles.getPermissionCategories)]),[t,n,i]=e;yield $a(ji.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield $a(ji.setRolesState({error:Tg(e),loading:!1}))}}function*tE(e){let{payload:{callback:t}}=e,n=ta(e.payload,JT);yield $a(ji.setRolesState({saving:!0}));try{const e=yield ja(rp.roles.addRole,n),i=yield ja(rp.roles.getRoles);yield $a(ji.loadRolesAndPermissions({silentLoading:!0})),yield $a(ji.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield $a(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*nE(e){let{payload:{callback:t}}=e,n=ta(e.payload,YT);yield $a(ji.setRolesState({saving:!0}));try{yield ja(rp.roles.deleteRole,n),yield $a(ji.loadRolesAndPermissions({silentLoading:!0})),yield $a(ji.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield $a(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(!1,e)}}function*iE(e){let{payload:{callback:t}}=e,n=ta(e.payload,XT);yield $a(ji.setRolesState({saving:!0}));try{const e=yield ja(rp.roles.updateRole,n);yield $a(ji.loadRolesAndPermissions({silentLoading:!0})),yield $a(ji.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield $a(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*aE(e){let{payload:{callback:t}}=e,n=ta(e.payload,QT);yield $a(ji.setRolesState({saving:!0}));try{const e=yield ja(rp.roles.attachPermissionsToRole,n);yield $a(ji.loadRolesAndPermissions({silentLoading:!0})),yield $a(ji.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield $a(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*oE(e){let{payload:{callback:t}}=e,n=ta(e.payload,ZT);yield $a(ji.setRolesState({saving:!0}));try{const e=yield ja(rp.roles.attachPermissionToRoles,n);yield $a(ji.loadRolesAndPermissions({silentLoading:!0})),yield $a(ji.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield $a(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*rE(){yield xo(ji.loadRolesAndPermissions,eE),yield Go(ji.addRole,tE),yield Go(ji.deleteRole,nE),yield Go(ji.updateRole,iE),yield Go(ji.attachPermissionsToRole,aE),yield Go(ji.attachPermissionToRoles,oE)}function*sE({payload:e}){var t;yield $a(ji.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield $a(ji.setRolesState({roles:wp,loading:!1}))}catch(e){yield $a(ji.setRolesState({error:Tg(e),loading:!1}))}}function*lE(){yield xo(ji.loadRolesAndPermissions,sE)}const cE=["callback"],uE=["callback"],dE=["callback"];function*yE(e){let{payload:{callback:t}}=e,n=ta(e.payload,cE);yield $a(ji.setResetPhoneNumberState({loading:!0}));try{const e=yield ja(rp.auth.resetPhoneNumber,n);yield $a(ji.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Zt.VerifyResetPhoneNumber})),yield $a(ji.setLoginState({email:n.email}))}catch(e){yield $a(ji.setResetPhoneNumberState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*fE(e){let{payload:{callback:t}}=e,n=ta(e.payload,uE);yield $a(ji.setResetPhoneNumberState({loading:!0}));try{const e=yield ja(rp.auth.verifyResetPhoneNumber,n);yield $a(ji.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Zt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield $a(ji.setResetPhoneNumberState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*pE(e){let{payload:{callback:t}}=e,n=ta(e.payload,dE);yield $a(ji.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield za((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ja(rp.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield $a(ji.setLoginState({step:_t.loginWithSmsOtc})),yield $a(ji.passwordlessPreLogin({type:Oi.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield $a(ji.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield $a(ji.setResetPhoneNumberState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*gE(){yield xo(ji.resetPhoneNumber,yE),yield xo(ji.verifyResetPhoneNumber,fE),yield xo(ji.changePhoneNumber,pE)}function*SE(){yield $a(ji.setSessionsState({loading:!0,error:null}));try{const e=yield ja(rp.auth.getCurrentUserSessions);yield $a(ji.setSessionsState({sessions:e,loading:!1}))}catch(e){yield $a(ji.setSessionsState({error:e,loading:!1}))}}function*vE(){yield $a(ji.setSessionsState({loading:!0,error:null}));try{const e=yield ja(rp.auth.getCurrentUserSession);yield $a(ji.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield $a(ji.setSessionsState({error:e,loading:!1}))}}function*hE({payload:{id:e}}){yield $a(ji.setSessionsState({loading:!0,error:null}));try{yield ja(rp.auth.deleteSessionForUser,e),yield $a(ji.loadUserSessions())}catch(e){yield $a(ji.setSessionsState({error:e,loading:!1}))}}function*mE({payload:{callback:e,userId:t}}){yield $a(ji.setSessionsState({loading:!0,error:null}));try{yield ja(rp.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield $a(ji.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*AE(){yield $a(ji.setSessionsState({loading:!0,error:null}));try{yield ja(rp.auth.deleteAllSessionsForUser),yield $a(ji.loadUserSessions())}catch(e){yield $a(ji.setSessionsState({error:e,loading:!1}))}}function*bE(){yield $o(ji.loadUserSessions,SE),yield $o(ji.deleteUserSession,hE),yield $o(ji.deleteAllUserSessions,AE),yield $o(ji.loadCurrentUserSession,vE),yield Go(ji.revokeUserSessions,mE)}function*TE(){yield $a(ji.setSessionsState({loading:!0,error:null})),yield $a(ji.setSessionsState({sessions:Zp,loading:!1}))}function*EE({payload:{id:e}}){yield $a(ji.setSessionsState({loading:!0,error:null}));const t=(yield za((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield $a(ji.setSessionsState({sessions:t,loading:!1}))}function*kE(){yield $a(ji.setSessionsState({loading:!0,error:null}));const e=Zp.filter((e=>e.current));yield $a(ji.setSessionsState({sessions:e,loading:!1}))}function*OE(){yield $o(ji.loadUserSessions,TE),yield $o(ji.deleteUserSession,EE),yield $o(ji.deleteAllUserSessions,kE)}const IE=["callback"],PE=["callback"];function*_E(){yield $a(ji.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield ja(rp.auth.getSessionConfigurations);yield $a(ji.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield $a(ji.setSessionsState({error:e,loading:!1}))}}function*LE({payload:e}){yield $a(ji.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=ta(e,IE);yield ja(rp.auth.createOrUpdateSessionConfigrations,n),yield $a(ji.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield $a(ji.setSessionsPolicyState({error:e,loading:!1}))}}function*wE(){yield xo(ji.loadSessionsPolicy,_E),yield $o(ji.createOrUpdateSessionsPolicy,Dg(LE))}function*UE(){yield $a(ji.setSessionsPolicyState({loading:!0,error:null}));const e=yield za((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:eg}));yield $a(ji.setSessionsPolicyState(G({},e,{loading:!1})))}function*CE({payload:e}){yield $a(ji.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=ta(e,PE);null==t||t(!0),yield $a(ji.setSessionsPolicyState({configurations:n,loading:!1}))}function*RE(){yield xo(ji.loadSessionsPolicy,UE),yield $o(ji.createOrUpdateSessionsPolicy,CE)}const DE=["callback"],NE=["callback"],ME=["callback"],FE=["callback"],GE=["callback"],$E=["callback"],xE=["callback"],VE=["callback"],jE=()=>za((e=>e.auth.restrictionsState.ipRestrictions)),BE=()=>za((e=>e.auth.restrictionsState.emailDomainRestrictions));function*WE(){yield $a(ji.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield ja(rp.auth.getDomainRestrictionsConfig),t=(yield ja(rp.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield $a(ji.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield $a(ji.setEmailDomainRestrictionsState({error:Tg(e),loading:!1}))}}function*zE(e){let{payload:{callback:t}}=e,n=ta(e.payload,DE);yield $a(ji.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield BE();try{var a;yield ja(rp.auth.createDomainRestriction,n);const e=(yield ja(rp.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield $a(ji.setEmailDomainRestrictionsState({data:{config:(null==(a=i.data)?void 0:a.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield $a(ji.setEmailDomainRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*KE(e){let{payload:{callback:t}}=e,n=ta(e.payload,NE);yield $a(ji.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield ja(rp.auth.updateDomainRestrictionConfig,n),i=(yield ja(rp.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield $a(ji.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield $a(ji.setEmailDomainRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*HE({payload:{id:e}}){yield $a(ji.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield BE();try{var n;yield ja(rp.auth.deleteDomainRestriction,e);const i=(yield ja(rp.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield $a(ji.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:zn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield $a(ji.setEmailDomainRestrictionsState({saving:!1,error:Tg(e)}))}}const qE=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:zn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*JE(){yield $a(ji.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield jE(),t=yield ja(rp.auth.getIPRestrictionsConfig),n=qE({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:a}}=yield ja(rp.auth.getIPRestrictions,n);yield $a(ji.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:a,pagination:n,loading:!1}))}catch(e){yield $a(ji.setIpRestrictionsState({error:Tg(e),loading:!1}))}}function*YE(){try{const{valid:e}=yield ja(rp.auth.testCurrentIpInAllowList);yield $a(ji.setIpRestrictionsState({userIpValid:e}))}catch(e){yield $a(ji.setIpRestrictionsState({error:Tg(e)}))}}function*XE({payload:{callback:e}}){yield $a(ji.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield za((e=>e.auth.userIp));yield xa([ja(rp.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:zn.ALLOW}),ja(rp.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield jE(),i=qE(n.pagination),{items:a,_metadata:{totalPages:o}}=yield ja(rp.auth.getIPRestrictions,i);yield $a(ji.setIpRestrictionsState({data:{config:{isActive:!0,strategy:zn.ALLOW},restrictions:a},userIpValid:!0,pagination:i,totalPages:o,saving:!1})),null==e||e(!0)}catch(t){yield $a(ji.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*QE(e){let{payload:{callback:t}}=e,n=ta(e.payload,ME);yield $a(ji.setIpRestrictionsState({saving:!0,error:null}));const i=yield jE();try{var a,o;yield ja(rp.auth.createIPRestriction,n);const e=yield jE(),r=qE(e.pagination),{items:s,_metadata:{totalPages:l}}=yield ja(rp.auth.getIPRestrictions,r);yield YE(),yield $a(ji.setIpRestrictionsState({data:{config:null!=(a=null==(o=i.data)?void 0:o.config)?a:{isActive:!1,strategy:zn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield $a(ji.setIpRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*ZE(e){let{payload:{callback:t}}=e,n=ta(e.payload,FE);yield $a(ji.setIpRestrictionsState({saving:!0,error:null}));try{yield ja(rp.auth.updateIPRestrictionConfig,n);const e=yield jE(),i=yield ja(rp.auth.getIPRestrictionsConfig),a=qE(G({},e.pagination,{_filter:i.strategy})),{items:o,_metadata:{totalPages:r}}=yield ja(rp.auth.getIPRestrictions,a);yield YE(),yield $a(ji.setIpRestrictionsState({data:{config:i,restrictions:o},pagination:a,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield $a(ji.setIpRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*ek({payload:{id:e,callback:t}}){yield $a(ji.setIpRestrictionsState({saving:!0,error:null}));const n=yield jE();try{var i;yield ja(rp.auth.deleteIPRestriction,e);const a=yield jE(),o=qE(a.pagination),{items:r,_metadata:{totalPages:s}}=yield ja(rp.auth.getIPRestrictions,o);yield YE(),yield $a(ji.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:zn.ALLOW},restrictions:r},pagination:o,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield $a(ji.setIpRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*tk(){yield xo(ji.loadIpRestrictions,Dg(JE)),yield xo(ji.loadEmailDomainRestrictions,Dg(WE)),yield Go(ji.saveIpRestriction,Dg(QE)),yield Go(ji.saveIpRestrictionsConfig,Dg(ZE)),yield Go(ji.deleteIpRestriction,Dg(ek)),yield Go(ji.checkIfUserIpValid,Dg(YE)),yield Go(ji.addCurrentUserIpAndActivate,Dg(XE)),yield Go(ji.saveEmailDomainRestriction,Dg(zE)),yield Go(ji.saveEmailDomainRestrictionsConfig,Dg(KE)),yield Go(ji.deleteEmailDomainRestriction,Dg(HE))}function*nk(){yield $a(ji.setIpRestrictionsState({loading:!0,error:null})),yield $a(ji.setIpRestrictionsState({data:{restrictions:ng.filter((e=>e.strategy===tg.strategy)),config:tg},totalPages:1,pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*ik(){yield $a(ji.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield jE(),t=ng[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield $a(ji.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield $a(ji.setIpRestrictionsState({error:Tg(e),loading:!1}))}}function*ak(e){var t,n,i;let{payload:{callback:a}}=e,o=ta(e.payload,GE);yield $a(ji.setIpRestrictionsState({saving:!0,error:null}));const r=yield jE(),s=r.data.restrictions.filter((e=>e.ip!==o.ip));yield $a(ji.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:zn.ALLOW},restrictions:[...s,G({},o,{createdAt:new Date,updatedAt:new Date,id:JA(),isActive:null==(i=o.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},saving:!1})),null==a||a(!0)}function*ok(e){var t,n,i;let{payload:{callback:a}}=e,o=ta(e.payload,$E);const r=yield jE();yield $a(ji.setIpRestrictionsState({saving:!0,error:null})),yield $a(ji.setIpRestrictionsState({data:{config:G({},null==(t=r.data)?void 0:t.config,o),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield $a(ji.setIpRestrictionsState({saving:!1,error:null})),null==a||a(!0)}function*rk({payload:{id:e,callback:t}}){var n;yield $a(ji.setIpRestrictionsState({saving:!0,error:null}));const i=yield jE();yield $a(ji.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:zn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*sk(){yield $a(ji.setEmailDomainRestrictionsState({loading:!0,error:null})),yield $a(ji.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:zn.ALLOW}],config:{active:!0,listType:zn.ALLOW,blockPublicDomains:!1}}}))}function*lk(e){var t,n;let{payload:{callback:i}}=e,a=ta(e.payload,xE);const o=yield BE();yield $a(ji.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==i||i(!0),yield $a(ji.setEmailDomainRestrictionsState({data:{config:(null==(t=o.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:a.type},restrictions:[...(null==(n=o.data)?void 0:n.restrictions)||[],G({},a,{id:Date.now().toString()})]},saving:!1}))}function*ck(e){var t;let{payload:{callback:n}}=e,i=ta(e.payload,VE);const a=yield BE();yield $a(ji.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==n||n(!0),yield $a(ji.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||zn.ALLOW},restrictions:[...(null==(t=a.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*uk({payload:{id:e}}){var t,n;const i=yield BE();yield $a(ji.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),yield $a(ji.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:zn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*dk(){yield xo(ji.loadIpRestrictions,nk),yield xo(ji.loadEmailDomainRestrictions,sk),yield Go(ji.saveIpRestriction,ak),yield Go(ji.saveIpRestrictionsConfig,ok),yield Go(ji.deleteIpRestriction,rk),yield Go(ji.checkIfUserIpValid,ik),yield Go(ji.saveEmailDomainRestriction,lk),yield Go(ji.saveEmailDomainRestrictionsConfig,ck),yield Go(ji.deleteEmailDomainRestriction,uk)}const yk=["callback"],fk=["id"];function*pk(e){const{count:t}=yield ja(rp.directory.countConfigurationUsers,e.id);return G({},e,{count:t})}function*gk(){yield $a(ji.setProvisioningState({loading:!0,error:null}));try{const e=yield ja(rp.directory.getConfigs),t=yield xa(e.map((e=>pk(e))));yield $a(ji.setProvisioningState({connections:t,loading:!1}))}catch(e){yield $a(ji.setProvisioningState({error:Tg(e),loading:!1}))}}function*Sk(e){let{payload:{callback:t}}=e,n=ta(e.payload,yk);yield $a(ji.setProvisioningState({loading:!0,error:null}));try{const e=yield ja(rp.directory.createConfiguration,n),i=yield ja(rp.directory.getConfigs),a=yield xa(i.map((e=>pk(e))));yield $a(ji.setProvisioningState({connections:a,loading:!1})),null==t||t(e)}catch(e){yield $a(ji.setProvisioningState({error:Tg(e),loading:!1}))}}function*vk(e){let{payload:{id:t}}=e,n=ta(e.payload,fk);yield $a(ji.setProvisioningState({loading:!0,error:null}));try{yield ja(rp.directory.updateConfiguration,t,n);const e=yield ja(rp.directory.getConfigs),i=yield xa(e.map((e=>pk(e))));yield $a(ji.setProvisioningState({connections:i,loading:!1}))}catch(e){yield $a(ji.setProvisioningState({error:Tg(e),loading:!1}))}}function*hk({payload:{id:e,callback:t}}){yield $a(ji.setProvisioningState({loading:!0,error:null}));try{yield ja(rp.directory.deleteConfiguration,e);const n=yield ja(rp.directory.getConfigs),i=yield xa(n.map((e=>pk(e))));yield $a(ji.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield $a(ji.setProvisioningState({error:Tg(e),loading:!1})),null==t||t(!1,e)}}function*mk(){yield xo(ji.loadProvisionConnections,gk),yield Go(ji.createProvisionConnection,Sk),yield Go(ji.deleteProvisionConnection,hk),yield Go(ji.updateProvisionConnection,vk)}const Ak=["callback","events"];function*bk(e){let{payload:{callback:t}}=e,n=ta(e.payload,Ak);yield $a(ji.setImpersonateState({loading:!0}));try{yield ja(rp.impersonate.impersonate,n),yield $a(ji.setImpersonateState({step:Mi.success})),yield Ka(1e3),yield sv(),yield $a(ji.resetImpersonateState()),null==t||t(!0)}catch(e){yield $a(ji.setImpersonateState({loading:!1,error:Tg(e)}))}}function*Tk(){yield xo(ji.impersonate,bk)}function*Ek({payload:e}){const{callback:t,deviceId:n}=e;yield $a(ji.setPasskeysState({loading:!0}));try{yield ja(rp.auth.deleteWebAuthnDevice,n);const{devices:e}=yield za((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield $a(ji.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield $a(ji.setPasskeysState({loading:!1,error:Tg(e,null)})),null==t||t(null,e)}}function*kk(){yield $a(ji.setPasskeysState({loading:!0}));try{const{devices:e}=yield ja(rp.auth.getWebAuthnDevices);yield $a(ji.setPasskeysState({devices:e,loading:!1}))}catch(e){yield $a(ji.setPasskeysState({loading:!1,error:Tg(e,null)}))}}function*Ok(){yield Go(ji.loadWebAuthnDevices,kk),yield Go(ji.deleteWebAuthnDevice,Ek)}const Ik=["roleIds","userIds"],Pk=()=>za((e=>e.auth.groupsState));function*_k({payload:e}){const t=YA.GET_TEAM_USERS;yield $a(ji.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield ja(rp.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield $a(ji.setGroupsState({teamUsers:n}))}catch(e){yield $a(ji.setUsersGroupsError({key:t,value:Tg(e)}))}finally{yield $a(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Lk({payload:e}){const t=YA.GET_GROUP;yield $a(ji.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield ja(rp.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:XA.rolesAndUsers});yield $a(ji.setGroupsState({selectedGroup:n}))}catch(e){yield $a(ji.setUsersGroupsError({key:t,value:Tg(e)}))}finally{yield $a(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*wk(){const e=YA.GET_GROUPS,t=yield Pk();yield $a(ji.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield ja(rp.groups.getGroups,{_groupsRelations:XA.rolesAndUsers});yield $a(ji.setGroupsState(G({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield $a(ji.setUsersGroupsError({key:e,value:Tg(t)}))}finally{yield $a(ji.setUsersGroupsLoader({key:e,value:!1}))}}function*Uk({payload:e}){const t=YA.CREATE_GROUP,{roleIds:n,userIds:i}=e,a=ta(e,Ik);yield $a(ji.setUsersGroupsLoader({key:t,value:!0}));try{var o;const r=yield ja(rp.groups.createGroup,G({name:a.name},!!a.description&&{description:a.description},{color:a.color}));null!=i&&i.length&&(yield $a(ji.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield $a(ji.addRolesToGroup({groupId:r.id,roleIds:n}))),yield $a(ji.loadGroups()),null==e||null==(o=e.callback)||o.call(e,!0)}catch(n){var r;yield $a(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield $a(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Ck({payload:e}){const t=YA.UPDATE_GROUP;yield $a(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ja(rp.groups.updateGroup,e),yield $a(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $a(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield $a(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Rk({payload:e}){const t=YA.DELETE_GROUP;yield $a(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ja(rp.groups.deleteGroup,e.groupId),yield $a(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $a(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1,n)}finally{yield $a(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Dk({payload:e}){const t=YA.ADD_ROLES_TO_GROUP;yield $a(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ja(rp.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield $a(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $a(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield $a(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Nk({payload:e}){const t=YA.DELETE_ROLES_FROM_GROUP;yield $a(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ja(rp.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield $a(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $a(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield $a(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Mk({payload:e}){const t=YA.ADD_USERS_TO_GROUP;yield $a(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ja(rp.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield $a(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;null==e||null==(i=e.callback)||i.call(e,!1),yield $a(ji.setUsersGroupsError({key:t,value:Tg(n)}))}finally{yield $a(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Fk({payload:e}){const t=YA.DELETE_USERS_FROM_GROUP;yield $a(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ja(rp.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield $a(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $a(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield $a(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Gk(){const e=YA.GET_GROUP_CONFIGURATION;yield $a(ji.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield ja(rp.groups.getGroupConfiguration);yield $a(ji.setGroupsState({groupsConfiguration:t}))}catch(t){yield $a(ji.setUsersGroupsError({key:e,value:Tg(t)}))}finally{yield $a(ji.setUsersGroupsLoader({key:e,value:!1}))}}function*$k({payload:e}){const t=YA.UPDATE_GROUP_CONFIGURATION;yield $a(ji.setUsersGroupsLoader({key:t,value:!0}));try{yield ja(rp.groups.updateGroupConfiguration,e),yield $a(ji.getGroupConfiguration())}catch(e){yield $a(ji.setUsersGroupsError({key:t,value:Tg(e)}))}finally{yield $a(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*xk(){yield $o(ji.loadGroups,wk),yield $o(ji.getGroupById,Lk),yield $o(ji.createGroup,Uk),yield $o(ji.updateGroup,Ck),yield $o(ji.deleteGroup,Rk),yield $o(ji.addRolesToGroup,Dk),yield $o(ji.deleteRolesFromGroup,Nk),yield $o(ji.addUsersToGroup,Mk),yield $o(ji.deleteUsersFromGroup,Fk),yield $o(ji.getGroupConfiguration,Gk),yield $o(ji.updateGroupConfiguration,$k),yield $o(ji.getTeamUsers,_k)}function*Vk(){const e=YA.GET_GROUPS;yield $a(ji.setUsersGroupsLoader({key:e,value:!0}));const t=og;yield $a(ji.setGroupsState({groups:t})),yield $a(ji.setUsersGroupsLoader({key:e,value:!1}))}function*jk({payload:e}){var t;const n=YA.CREATE_GROUP,{groups:i}=yield Pk();yield $a(ji.setUsersGroupsLoader({key:n,value:!0})),yield $a(ji.setGroupsState({groups:[G({},e,{id:`${e.name}ID`,managedBy:ep.FRONTEGG}),...null!=i?i:[]]})),yield Ka(500),null==e||null==(t=e.callback)||t.call(e,!0),yield $a(ji.setUsersGroupsLoader({key:n,value:!1}))}function*Bk({payload:e}){var t,n,i,a,o;const r=YA.UPDATE_GROUP,s=yield Pk();yield $a(ji.setUsersGroupsLoader({key:r,value:!0})),yield $a(ji.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?G({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:ep.FRONTEGG}):t})),selectedGroup:G({},null==s?void 0:s.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(i=null==e?void 0:e.color)?i:"",description:null!=(a=null==e?void 0:e.description)?a:""})})),yield Ka(500),null==e||null==(o=e.callback)||o.call(e,!0),yield $a(ji.setUsersGroupsLoader({key:r,value:!1}))}function*Wk({payload:e}){var t,n;const i=YA.DELETE_GROUP,a=yield Pk();yield $a(ji.setUsersGroupsLoader({key:i,value:!0})),yield $a(ji.setGroupsState({groups:null==a||null==(t=a.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Ka(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $a(ji.setUsersGroupsLoader({key:i,value:!1}))}function*zk({payload:e}){var t,n;const i=YA.ADD_ROLES_TO_GROUP,a=yield Pk();yield $a(ji.setUsersGroupsLoader({key:i,value:!0})),yield $a(ji.setGroupsState({groups:null==a||null==(t=a.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?G({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ka(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $a(ji.setUsersGroupsLoader({key:i,value:!1}))}function*Kk({payload:e}){var t,n;const i=YA.DELETE_ROLES_FROM_GROUP,a=yield Pk();yield $a(ji.setUsersGroupsLoader({key:i,value:!0})),yield $a(ji.setGroupsState({groups:null==a||null==(t=a.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?G({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield Ka(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $a(ji.setUsersGroupsLoader({key:i,value:!1}))}function*Hk({payload:e}){var t,n;const i=YA.ADD_USERS_TO_GROUP,a=yield Pk();yield $a(ji.setUsersGroupsLoader({key:i,value:!0})),yield $a(ji.setGroupsState({groups:null==a||null==(t=a.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?G({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ka(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $a(ji.setUsersGroupsLoader({key:i,value:!1}))}function*qk({payload:e}){var t,n;const i=YA.DELETE_USERS_FROM_GROUP,a=yield Pk();yield $a(ji.setUsersGroupsLoader({key:i,value:!0})),yield $a(ji.setGroupsState({groups:null==a||null==(t=a.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?G({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield Ka(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $a(ji.setUsersGroupsLoader({key:i,value:!1}))}function*Jk(){const e=YA.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield Pk();yield $a(ji.setUsersGroupsLoader({key:e,value:!0})),t&&(yield $a(ji.setGroupsState({groupsConfiguration:G({},t)}))),yield $a(ji.setUsersGroupsLoader({key:e,value:!1}))}function*Yk({payload:e}){const t=YA.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield Pk();yield $a(ji.setUsersGroupsLoader({key:t,value:!0})),n&&(yield $a(ji.setGroupsState({groupsConfiguration:G({},n,e)}))),yield $a(ji.setUsersGroupsLoader({key:t,value:!1}))}function*Xk(){yield $o(ji.loadGroups,Vk),yield $o(ji.createGroup,jk),yield $o(ji.updateGroup,Bk),yield $o(ji.deleteGroup,Wk),yield $o(ji.addRolesToGroup,zk),yield $o(ji.deleteRolesFromGroup,Kk),yield $o(ji.addUsersToGroup,Hk),yield $o(ji.deleteUsersFromGroup,qk),yield $o(ji.getGroupConfiguration,Jk),yield $o(ji.updateGroupConfiguration,Yk)}let Qk;!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.SET_ROOT_ACCOUNT_DATA="SET_ROOT_ACCOUNT_DATA",e.SET_SELECTED_SUB_ACCOUNT_DATA="SET_SELECTED_SUB_ACCOUNT_DATA",e.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT="LOAD_NUMBER_OF_USERS_FOR_ACCOUNT",e.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER="UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER",e.CREATE_SUB_ACCOUNT="CREATE_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT="UPDATE_SUB_ACCOUNT",e.DELETE_SUB_ACCOUNT="DELETE_SUB_ACCOUNT",e.GET_ACCOUNT_USERS="GET_ACCOUNT_USERS",e.ADD_USERS_TO_ACCOUNT="ADD_USERS_TO_ACCOUNT",e.DELETE_USERS_FROM_ACCOUNT="DELETE_USERS_FROM_ACCOUNT",e.SET_USER_ROLES_FOR_SUB_ACCOUNT="SET_USER_ROLES_FOR_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT_SETTINGS="UPDATE_SUB_ACCOUNT_SETTINGS",e.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(Qk||(Qk={}));const Zk=(e,t,n)=>{var i,a;return e.tenantId===t?G({},e,{name:n}):G({},e,{children:null!=(i=null==e||null==(a=e.children)?void 0:a.map((e=>Zk(e,t,n))))?i:[]})};function eO(e,t){var n;return G({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>eO(e,t))):[]})}function tO(e,t,n){var i,a;if(e.tenantId===t){var o;const t=[...null!=(o=null==e?void 0:e.children)?o:[],...n].filter(((e,t,n)=>t===n.findIndex((t=>t.tenantId===e.tenantId))));return G({},e,{children:t})}return G({},e,{children:null!=(i=null==e||null==(a=e.children)?void 0:a.map((e=>tO(e,t,n))))?i:[]})}const nO=({items:e},t)=>e.map((e=>{var n,i;return{name:e.name,tenantId:e.tenantId,numberOfUsers:null!=(n=null==(i=t.find((t=>t.tenantId===e.tenantId)))?void 0:i.totalUsers)?n:0,createdAt:e.createdAt,metadata:e.metadata}})),iO=()=>za((e=>e.auth.allAccountsState));function*aO({payload:e}){const t=Qk.GET_ACCOUNTS;yield $a(ji.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield iO(),{jwt:i,_limit:a,_offset:o}=e,r={_offset:null!=o?o:n._offset,_limit:null!=a?a:n._limit,_subTenantId:null==e?void 0:e._subTenantId};try{if(i){var s;const{selectedAccount:t}=yield iO(),{items:n,_links:a}=yield ja(rp.tenants.searchSubTenants,r,{jwt:i}),o=yield ja(rp.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:i}),l=nO({items:n},o),c=tO(t.accounts?t.accounts:t,null!=(s=null==e?void 0:e._subTenantId)?s:"",l.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==a?void 0:a.next}))));yield $a(ji.setSelectedAccountState({accounts:c}))}else{var l;const{accounts:t}=yield iO(),{items:n,_links:i}=yield ja(rp.tenants.searchSubTenants,r),a=yield ja(rp.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),o=nO({items:n},a),s=tO(t,null!=(l=null==e?void 0:e._subTenantId)?l:"",o.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 $a(ji.setAllAccountsState({accounts:s}))}}catch(e){yield $a(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield $a(ji.setAllAccountsLoader({key:t,value:!1}))}}function*oO({payload:e}){const t=Qk.SEARCH_ACCOUNTS;yield $a(ji.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield iO(),{jwt:i}=e;try{if(null!=e&&e._subTenantId){var a;const{items:t}=yield ja(rp.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(a=null==e?void 0:e._filter)?a:"",_subTenantId:e._subTenantId},{jwt:i});yield $a(ji.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield $a(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield $a(ji.setAllAccountsLoader({key:t,value:!1}))}}function*rO({payload:e}){const t=Qk.GET_USER_JWT;yield $a(ji.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:i}=e;try{const e=yield ja(rp.users.GetUserJwt,{tenantId:n});yield $a(ji.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==i||i(!0)}catch(e){yield $a(ji.setAllAccountsError({key:t,value:Tg(e)})),yield $a(ji.setSelectedAccountState({accessPermission:!1})),null==i||i(!1)}finally{yield $a(ji.setAllAccountsLoader({key:t,value:!1}))}}function*sO({payload:e}){const t=Qk.CREATE_SUB_ACCOUNT;yield $a(ji.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:i,tenantId:a,jwt:o,callback:r}=e;try{if(o){const{accounts:e}=yield iO(),{selectedAccount:t}=yield iO(),r=yield ja(rp.subTenants.createSubTenant,{name:n,parentTenantId:i,tenantId:a},{jwt:o}),s=tO(e,null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),l=tO(G({name:"",tenantId:""},null==t?void 0:t.accounts),null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield $a(ji.setAllAccountsState({accounts:s})),yield $a(ji.setSelectedAccountState({accounts:l}))}else{const{accounts:e}=yield iO(),t=yield ja(rp.subTenants.createSubTenant,{name:n,tenantId:a,parentTenantId:i}),o=tO(e,null!=i?i:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield $a(ji.setAllAccountsState({accounts:o}))}null==r||r(!0)}catch(e){yield $a(ji.setAllAccountsError({key:t,value:Tg(e)})),null==r||r(!1)}finally{yield $a(ji.setAllAccountsLoader({key:t,value:!1}))}}function*lO({payload:e}){const t=Qk.DELETE_SUB_ACCOUNT;yield $a(ji.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:i,callback:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield iO();yield ja(rp.subTenants.deleteSubTenant,i,{jwt:n});const a=eO(t,i),o=eO(null==e?void 0:e.accounts,i);yield $a(ji.setAllAccountsState({accounts:a})),yield $a(ji.setSelectedAccountState({accounts:o}))}else{const{accounts:e}=yield iO();yield ja(rp.subTenants.deleteSubTenant,i);const t=eO(e,i);yield $a(ji.setAllAccountsState({accounts:t}))}null==a||a(!0)}catch(e){yield $a(ji.setAllAccountsError({key:t,value:Tg(e)})),null==a||a(!1)}finally{yield $a(ji.setAllAccountsLoader({key:t,value:!1}))}}function*cO({payload:e}){const t=Qk.UPDATE_SUB_ACCOUNT_SETTINGS;yield $a(ji.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:i,callback:a,tenantId:o}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield iO();yield ja(rp.subTenants.updateSubTenant,{tenantId:o},{name:i},{jwt:n});const a=Zk(e.accounts,o,i);yield $a(ji.setSelectedAccountState({name:i,accounts:a}));const r=Zk(t,o,i);yield $a(ji.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield iO();yield ja(rp.subTenants.updateSubTenant,{tenantId:o},{name:i});const t=Zk(e,o,i);yield $a(ji.setAllAccountsState({accounts:t}))}null==a||a(!0)}catch(e){yield $a(ji.setAllAccountsError({key:t,value:Tg(e)})),null==a||a(!1)}finally{yield $a(ji.setAllAccountsLoader({key:t,value:!1}))}}function*uO({payload:e}){const t=Qk.DELETE_USERS_FROM_ACCOUNT;yield $a(ji.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:i,jwt:a,callback:o}=e;try{yield ja(rp.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:i},{jwt:a}),yield $a(ji.getAccountUsers({jwt:a,_tenantId:i[0].tenantId})),null==o||o(!0)}catch(e){yield $a(ji.setAllAccountsError({key:t,value:Tg(e)})),null==o||o(!1)}finally{yield $a(ji.setAllAccountsLoader({key:t,value:!1}))}}function*dO({payload:e}){const t=Qk.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield $a(ji.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:i,jwt:a,callback:o}=e,{selectedAccount:r}=yield iO();try{yield ja(rp.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:i},{jwt:a}),yield $a(ji.getAccountUsers({jwt:a,_tenantId:r.tenantId})),null==o||o(!0)}catch(e){yield $a(ji.setAllAccountsError({key:t,value:Tg(e)})),null==o||o(!1)}finally{yield $a(ji.setAllAccountsLoader({key:t,value:!1}))}}function*yO({payload:e}){const t=Qk.ADD_USERS_TO_ACCOUNT;yield $a(ji.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:i,jwt:a,callback:o,allowSubAccountAccess:r=!1,roleIds:s}=e;try{yield ja(rp.subTenants.addUsersToSubTenant,{users:n,tenantId:i,allowSubAccountAccess:r,roleIds:s},{jwt:a}),yield $a(ji.getAccountUsers({jwt:a,_tenantId:i})),null==o||o(!0)}catch(e){yield $a(ji.setAllAccountsError({key:t,value:Tg(e)})),null==o||o(!1)}finally{yield $a(ji.setAllAccountsLoader({key:t,value:!1}))}}function*fO({payload:e}){const t=Qk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield $a(ji.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield iO(),{userId:i,allowAccess:a,jwt:o,callback:r}=e;try{var s;yield ja(rp.subTenants.updateSubAccountAccess,i,{allowAccess:a},{jwt:o}),yield $a(ji.setSelectedAccountState({users:null==n||null==(s=n.users)?void 0:s.map((e=>e.id===i?G({},e,{subAccountAccessAllowed:a}):e))})),null==r||r(!0)}catch(e){yield $a(ji.setAllAccountsError({key:t,value:Tg(e)})),null==r||r(!1)}finally{yield $a(ji.setAllAccountsLoader({key:t,value:!1}))}}function*pO({payload:e}){var t,n,i,a,o,r,s,l;const c=Qk.GET_ACCOUNT_USERS;yield $a(ji.setAllAccountsLoader({key:c,value:!0}));const u=yield iO(),{jwt:d,_tenantId:y,_email:f}=e,p=null!=(t=null!=(n=null==e?void 0:e._offset)?n:null==u||null==(i=u.selectedAccount)||null==(a=i.usersQueryParams)?void 0:a._offset)?t:0,g=null!=(o=null!=(r=null==e?void 0:e._limit)?r:null==u||null==(s=u.selectedAccount)||null==(l=s.usersQueryParams)?void 0:l._limit)?o:10,S=G({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield ja(rp.users.getUsersV3,S,{jwt:d}),i={totalUsersItems:t,totalUsersPages:n,usersQueryParams:G({_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 ja(rp.roles.getRoles),a=yield ja(rp.users.getUsersRoles,{ids:t},{jwt:d}),o=e.map((e=>{var t,i;const o=null==a||null==(t=a.find((t=>t.userId===e.id)))?void 0:t.roleIds;return G({},e,{roles:null!=(i=null==o?void 0:o.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?i:[]})}));yield $a(ji.setSelectedAccountState(G({users:o},i)))}else yield $a(ji.setSelectedAccountState(G({users:[]},i)))}catch(e){yield $a(ji.setAllAccountsError({key:c,value:Tg(e)}))}finally{yield $a(ji.setAllAccountsLoader({key:c,value:!1}))}}function*gO({payload:e}){const t=Qk.SET_SELECTED_SUB_ACCOUNT_DATA;yield $a(ji.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var i,a,o,r,s,l,c;const e=yield ja(rp.accountSettings.getSettings,{jwt:n}),u=yield ja(rp.tenants.getTenantsUsersCount,{tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n}),d=yield ja(rp.tenants.getParentTenants,{jwt:n}),y=yield ja(rp.tenants.getHierarchyMetadata,{_tenantIds:[null!=(a=null==e?void 0:e.tenantId)?a:""]},{jwt:n});yield $a(ji.setSelectedAccountState({tenantId:null!=(o=e.tenantId)?o:"",name:e.name,numberOfUsersObject:u[0],parentsAccounts:d,numberOfSubAccounts:null==(r=y[0])?void 0:r.totalSubTenants,accountSettings:e,accounts:{name:e.name,tenantId:null!=(s=e.tenantId)?s:"",numberOfUsers:null==(l=u[0])?void 0:l.totalUsers,createdAt:void 0,children:[]}})),yield $a(ji.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield $a(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield $a(ji.setAllAccountsLoader({key:t,value:!1}))}}function*SO(){const e=Qk.SET_ROOT_ACCOUNT_DATA;yield $a(ji.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield za((e=>e.auth.tenantsState)),{accounts:n}=yield iO();if(t)try{var i;const a=yield ja(rp.tenants.getTenantsUsersCount,{tenantIds:[null==t?void 0:t.tenantId]}),o={name:null==t?void 0:t.name,tenantId:null==t?void 0:t.tenantId,numberOfUsers:null==(i=a[0])?void 0:i.totalUsers,createdAt:null==t?void 0:t.createdAt};yield $a(ji.setAllAccountsState({rootAccount:o,accounts:G({},n,o)}))}catch(t){yield $a(ji.setAllAccountsError({key:e,value:Tg(t)}))}finally{yield $a(ji.setAllAccountsLoader({key:e,value:!1}))}}function*vO({payload:e}){const t=Qk.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield $a(ji.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:i}=e;try{const e=yield ja(rp.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:i});yield $a(ji.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield $a(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield $a(ji.setAllAccountsLoader({key:t,value:!1}))}}function*hO(){yield $o(ji.loadAccounts,aO),yield $o(ji.searchAccounts,oO),yield $o(ji.updateSubAccountAccessForUser,fO),yield $o(ji.getUserJwtForSubAccount,rO),yield $o(ji.createSubAccount,sO),yield $o(ji.deleteSubAccount,lO),yield $o(ji.updateSubAccountSettings,cO),yield $o(ji.addUsersToAccount,yO),yield $o(ji.deleteUsersFromAccount,uO),yield $o(ji.setUserRolesForSubAccount,dO),yield $o(ji.getAccountUsers,pO),yield $o(ji.setRootAccountData,SO),yield $o(ji.setSelectedSubAccountData,gO),yield $o(ji.loadNumberOfUsersForSelectedSubAccount,vO)}const mO=["callback"],AO=["callback"],bO=["callback","phoneId"],TO=["callback","phoneId"],EO=["callback"];function*kO(){yield $a(ji.setSmsState({loading:!0}));const e={_limit:10,_offset:0};try{const{items:t}=yield ja(rp.userPhoneNumbers.getUserPhoneNumbers,e);yield $a(ji.setSmsState({phoneNumbers:t}))}catch(e){yield $a(ji.setSmsState({error:Tg(e)}))}finally{yield $a(ji.setSmsState({loading:!1}))}}function*OO(e){let{payload:{callback:t}}=e,n=ta(e.payload,mO);yield $a(ji.setSmsState({loading:!0}));try{const e=yield ja(rp.userPhoneNumbers.createPhoneNumber,n);yield $a(ji.setSmsState({otcToken:e.otcToken})),yield ja(kO),null==t||t(!0)}catch(e){yield $a(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield $a(ji.setSmsState({loading:!1}))}}function*IO(e){let{payload:{callback:t}}=e,n=ta(e.payload,AO);yield $a(ji.setSmsState({loading:!0}));try{yield ja(rp.userPhoneNumbers.verifyPhoneNumber,n),yield ja(kO),null==t||t(!0)}catch(e){yield $a(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield $a(ji.setSmsState({loading:!1}))}}function*PO(e){let{payload:{callback:t,phoneId:n}}=e;ta(e.payload,bO),yield $a(ji.setSmsState({loading:!0}));try{const e=yield ja(rp.userPhoneNumbers.deletePhoneNumber,n);yield $a(ji.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield $a(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield $a(ji.setSmsState({loading:!1}))}}function*_O(e){let{payload:{callback:t,phoneId:n}}=e,i=ta(e.payload,TO);yield $a(ji.setSmsState({loading:!0}));try{yield ja(rp.userPhoneNumbers.verifyDeletePhoneNumber,n,i),yield ja(kO),null==t||t(!0)}catch(e){yield $a(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield $a(ji.setSmsState({loading:!1}))}}function*LO(e){let{payload:{callback:t}}=e,n=ta(e.payload,EO);yield $a(ji.setSmsState({loading:!0}));try{const e=yield ja(rp.userPhoneNumbers.preVerifyPhoneNumber,n);yield $a(ji.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield $a(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield $a(ji.setSmsState({loading:!1}))}}function*wO(){yield Go(ji.loadPhoneNumbers,kO),yield Go(ji.setUpPhoneNumber,OO),yield Go(ji.verifyPhoneNumber,IO),yield Go(ji.deletePhoneNumber,PO),yield Go(ji.verifyDeletePhoneNumber,_O),yield Go(ji.preVerifyPhoneNumber,LO)}function*UO(e){yield ja(ZS,e),yield ja(lv)}function*CO({mfaToken:e,mfaDevices:t}){yield $a(ji.setStepUpState({mfaDevices:t,mfaToken:e}));const n=yield ja(mg,t);yield $a(ji.setMfaState({step:n}))}function*RO(e){if((e=>"MFA is not enrolled"===(null==e?void 0:e.message))(e))return void(yield $a(ji.setMfaState({step:un.noMFAEnrolledStepUp})));window.localStorage.setItem(nv,"true");const{routes:t}=yield za((e=>e.auth));Vo.onRedirectTo(t.logoutUrl,{preserveQueryParams:!0})}function*DO({payload:{maxAge:e,callback:t}}){yield $a(ji.setStepUpState({mfaDevices:void 0,mfaToken:""}));try{const n=yield ja(rp.auth.generateStepupSession,{maxAge:e});n.user?yield ja(UO,n):yield ja(CO,n),null==t||t(!0)}catch(e){null==t||t(!1),yield ja(RO,e)}}function*NO({payload:e}){const t={acr_values:ev},{maxAge:n}=e||{};void 0!==n&&(t.max_age=n.toString());const i=yield za((({auth:e})=>{var t,n;return null==(t=e.tenantsState)||null==(n=t.activeTenant)?void 0:n.alias}));i&&(t.organization=i),av(),window.localStorage.setItem(nv,"true"),yield gh(t)}function*MO({payload:e}){yield fv(e,ji.setStepUpState,!0)}function*FO({payload:e}){yield Iv(e,ji.setStepUpState)}function*GO({payload:e}){yield Pv(e,ji.setStepUpState,!0)}function*$O({payload:e}){yield Av(e,ji.setStepUpState)}function*xO({payload:e}){yield bv(e,ji.setStepUpState,!0)}function*VO({payload:e}){yield Rv(e,ji.setStepUpState)}function*jO({payload:e}){yield Cv(e,ji.setStepUpState)}function*BO(){yield xo(ji.stepUpHostedLogin,NO),yield xo(ji.generateStepUpSession,DO),yield xo(ji.stepUpWithAuthenticator,MO),yield xo(ji.preVerifyMFASMSForStepUp,$O),yield xo(ji.verifyMFASMSForStepUp,xO),yield xo(ji.preVerifyMFAWebAuthnForStepUp,FO),yield xo(ji.verifyMFAWebAuthnForStepUp,GO),yield xo(ji.verifyMFAEmailCodeForStepUp,VO),yield xo(ji.preVerifyMFAEmailCodeForStepUp,jO)}const WO={sagas:function*(){yield xa([ja(Vh),ja(BO),ja($A),ja(VA),ja(LA),ja(gE),ja(im),ja(Um),ja(Fm),ja(Ug),ja(gA),ja(Xb),ja(xk),ja(AT),ja(GS),ja(LT),ja(mS),ja(GT),ja(KT),ja(rE),ja(bE),ja(wE),ja(tk),ja(mk),ja(Tk),ja(Ok),ja(hO),ja(YS),ja(Bg),ja(wO)])},mockSagas:function*(){yield xa([ja(Wh),ja(um),ja(Vm),ja(kA),ja(yT),ja(NT),ja(CS),ja(OE),ja(VT),ja(qT),ja(RE),ja(dk),ja(lE),ja(Xk),ja(Yg)])},storeName:Dt,initialState:Ni,reducer:xi,actions:ji},zO=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>G({},t,{[e]:G({},t[e],n)})}),KO={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},HO={setAuditLogsState:zO("auditLogsState"),resetAuditLogsState:e=>G({},e,{auditLogsState:KO})},qO={exportAuditsCsv:yt("auditLogs/exportAuditsCsv"),loadAuditLogs:yt("auditLogs/loadAuditLogs",(e=>({payload:e})))},JO={loading:!0},YO={setAuditsMetadataState:zO("auditsMetadataState"),resetAuditsMetadataState:e=>G({},e,{auditsMetadataState:JO})},XO={loadAuditsMetadata:yt("auditLogs/loadAuditsMetadata")},QO={auditLogsState:KO,auditsMetadataState:JO},{reducer:ZO,actions:eI}=pt({name:Mt,initialState:QO,reducers:G({resetState:e=>G({},e,QO),setState:(e,{payload:t})=>G({},e,t)},HO,YO)}),tI=G({},eI,qO,XO),nI=e=>"createdAt"!==e.id,iI={total:20,data:Array.from(Array(5).keys()).map((e=>G({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`})))},aI={properties:[{showInTable:!0,name:"createdAt",displayName:"Time",type:"Timestamp",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!1},{showInTable:!0,name:"email",displayName:"User",type:"Email",filterable:!0,sortable:!0,isPredefined:!0,chosen:!1,selected:!1},{showInTable:!0,name:"action",displayName:"Action",type:"AlphaNumeric",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!0,name:"description",type:"AlphaNumeric",sortable:!1,filterable:!1,displayName:"Description",isPredefined:!0,chosen:!1,selected:!1},{showInTable:!0,name:"ip",displayName:"IP Address",type:"IpAddress",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!1,name:"severity",displayName:"Severity",type:"Severity",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!1,name:"userAgent",displayName:"User Agent",type:"AlphaNumeric",filterable:!0,sortable:!0,isPredefined:!0,chosen:!1,selected:!1},{showInTable:!1,name:"json",type:"Json",sortable:!0,filterable:!0,displayName:"Json Data",showInMoreInfo:"Always",isPredefined:!1}]},oI=()=>za((e=>e.auditLogs.auditLogsState)),rI=()=>za((e=>e.auditLogs.auditsMetadataState));function*sI(){const e=yield oI(),{columns:t}=yield rI();try{const n=e.filter,i=e.sort.reduce(((e,t)=>G({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),a=n.reduce(((e,t)=>G({},e,{[t.id]:t.value})),{});yield $a(tI.setAuditLogsState({isDownloadingCsv:!0}));const o="audits.csv";yield rp.audits.exportAudits(G({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:o},i,a))}catch(e){console.error("failed to export audits - ",e)}yield $a(tI.setAuditLogsState({isDownloadingCsv:!1}))}function*lI({payload:e}){yield $a(tI.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield oI(),{columns:n}=yield rI();try{var i,a,o,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(a=e.pageOffset)?a:t.pageOffset,u=null!=(o=e.filter)?o:t.filter,d=null!=(r=e.sort)?r:t.sort;yield $a(tI.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>G({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>G({},e,{[t.id]:t.value})),{});n||(yield $a(tI.loadAuditsMetadata()));const{data:p,total:g}=yield ja(rp.audits.getAudits,G({offset:c,count:l},y,f));yield $a(tI.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield $a(tI.setAuditLogsState({loading:!1,error:Tg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*cI(){yield Go(tI.exportAuditsCsv,sI),yield Go(tI.loadAuditLogs,lI)}function*uI({payload:e}){yield $a(tI.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield oI(),{columns:n}=yield rI();try{var i,a,o,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(a=e.pageOffset)?a:t.pageOffset,u=null!=(o=e.filter)?o:t.filter,d=null!=(r=e.sort)?r:t.sort;yield $a(tI.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield $a(tI.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=iI;let i=n.filter((e=>t=>e.filter(nI).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];i=i.sort(((e,t)=>(n,i)=>n[e]>i[e]?t?-1:1:i[e]>n[e]?t?1:-1:0)(e,n))}return{data:i,total:i.length}})(u,d);yield $a(tI.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield $a(tI.setAuditLogsState({loading:!1,error:Tg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*dI(){yield Go(tI.loadAuditLogs,uI)}function*yI(){yield $a(tI.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield ja(rp.metadata.getAuditsMetadata);yield $a(tI.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield $a(tI.setAuditsMetadataState({error:e,loading:!1}))}}function*fI(){yield Go(tI.loadAuditsMetadata,yI)}function*pI(){yield $a(tI.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=aI;yield $a(tI.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield $a(tI.setAuditsMetadataState({error:e,loading:!1}))}}function*gI(){yield Go(tI.loadAuditsMetadata,pI)}const SI={sagas:function*(){yield xa([ja(cI),ja(fI)])},mockSagas:function*(){yield xa([ja(dI),ja(gI)])},storeName:Mt,initialState:QO,reducer:ZO,actions:tI},vI={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:hI,actions:mI,reducer:AI}=pt({name:"audits",initialState:vI,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=G({},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]})))}}}),bI=G({},mI,{initData:yt(`${hI}/initData`),loadAudits:yt(`${hI}/loadAudits`),removeFilter:yt(`${hI}/removeFilter`),filterData:yt(`${hI}/filterData`),exportCSV:yt(`${hI}/exportCSV`),deleteAudits:yt(`${hI}/deleteAudits`)}),TI=()=>za((e=>e[hI]));function*EI(){const{sortBy:e,sortDirection:t}=yield TI();try{const n=yield ja(rp.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield $a(bI.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield $a(bI.loadItemFailedAction(t))}}function*kI(){try{const e=yield ja(rp.metadata.getAuditsMetadata);yield $a(bI.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield $a(bI.loadItemFailedAction(t))}}const OI=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*II({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:a,offset:o,virtualScroll:r}=yield TI(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield TI():{rowsData:[]};try{const e=OI(t),{data:s,total:d}=yield ja(rp.audits.getAudits,G({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:a},e,{offset:r?u.length+c||u.length+o:c||o,count:20}));yield $a(bI.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield $a(bI.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield $a(bI.loadItemFailedAction(t))}}function*PI(){yield $a(bI.startLoading()),yield xa([EI(),kI(),II({payload:{onlyOneLoad:!1},type:""})]),yield $a(bI.finishLoading())}function*_I({payload:e}){const{filters:t}=yield TI(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield $a(bI.setFilterData(i))}function*LI({payload:e}){const{filters:t}=yield TI();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const i=[...t.slice(0,n),e,...t.slice(n+1)];yield $a(bI.setFilterData(i))}function*wI(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:a}=yield TI(),o=OI(e);yield $a(bI.startDownloadingCsv());try{yield rp.audits.exportAudits(G({endpoint:"csv/v2",headerProps:a,sortDirection:n,sortBy:t,filter:i},o,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield $a(bI.stopDownloadingCsv())}}function*UI(){yield $o(bI.initData,PI),yield $o(bI.removeFilter,_I),yield $o(bI.filterData,LI),yield $o([bI.loadAudits,bI.textSearch,bI.onPageChange],II),yield $o([bI.setFilterData,bI.setDataSorting,bI.startRefresh],(()=>II({payload:{appendMode:!1},type:""}))),yield $o(bI.exportCSV,wI)}const CI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},RI={initData:()=>G({},CI),setConnectivityState:(e,{payload:t})=>G({},e,t),cleanWebhookTestData:e=>G({},e,{testResult:void 0}),cleanWebhookLogsData:e=>G({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return G({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>G({},e,{error:void 0}),cleanSlackData:e=>G({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>G({},e,{retryResult:G({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>G({},e,{retryResult:G({},e.retryResult,t)})}},DI={loadSlackActions:yt("connectivity/loadSlackActions"),loadDataAction:yt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:yt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:yt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:yt("connectivity/loadScope"),deleteWebhookConfigAction:yt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:yt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:yt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},NI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:MI,actions:FI}=pt({name:Nt,initialState:NI,reducers:G({},RI)}),GI=G({},FI,DI),$I={slack:rp.connectivity.getSlackConfiguration,email:rp.connectivity.getEmailConfiguration,sms:rp.connectivity.getSMSConfiguration,webhook:rp.connectivity.getWebhooksConfigurations,categories:rp.connectivity.getCategories,channelMap:rp.connectivity.getChannelMaps},xI={slack:rp.connectivity.postSlackConfiguration,email:rp.connectivity.postEmailConfiguration,sms:rp.connectivity.postSMSConfiguration,webhook:rp.connectivity.postWebhooksConfiguration},VI=["email","slack","sms","webhook"],jI={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"}},BI=["id"],WI=["id","enabled"],zI=["categories","channelMap"];function*KI(e){return yield ja(qI,{payload:{api:e},type:""})}function*HI({payload:e=VI}){yield $a(GI.setConnectivityState({isLoading:!0}));try{const t=yield xa([...e.map(KI),yield qI({payload:{api:"categories"},type:""}),yield function*(){return(yield xa(e.map((function*(e){return yield qI({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>G({},t,{[`${e[i]}`]:n})),{})}()]),n=yield qI({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,a)=>e[a]?t[t.length-1][e[a]].length?G({},n,{[`${e[a]}`]:i,list:[...n.list,{id:a,key:e[a],events:jI[e[a]].events(i),active:jI[e[a]].isActive(i),platform:jI[e[a]].title,image:jI[e[a]].image}]}):n:G({},n,{[`${zI[a-e.length]}`]:i})),{list:[],webhook:n});yield $a(GI.setConnectivityState(G({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield $a(GI.setConnectivityState({isLoading:!1}))}}function*qI({payload:{api:e,params:t}}){try{return yield ja($I[e],t)}catch(e){return}}function*JI(){try{yield $a(GI.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield ja(rp.connectivity.getSlackChannels);yield $a(GI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield $a(GI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*YI(e,t){const{connectivity:{list:n}}=yield za(),i=n.find((({key:t})=>t===e));if(!i)return;const a=jI[e].isActive(t);a!==i.active&&(yield $a(GI.setConnectivityState({list:n.map((t=>t.key===e?G({},t,{active:a}):t))})))}function*XI({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield za((e=>e.connectivity));try{if(yield $a(GI.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield za();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield xa([...i.reduce(((e,t)=>{var i,a;return!t.id&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length||(null==n?void 0:n.find((e=>{let{id:n}=e,i=ta(e,BI);return n===t.id&&JSON.stringify(G({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(a=t.slackEvents[0].channelIds)&&a.length?[...e,t]:e}),[]).map((function*(e){return yield ja(xI.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield ja(rp.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield za(),{processIds:i}=yield za((e=>e.connectivity)),a=n[t];if(!a)return;let o=[];try{o=yield xa([...e.reduce(((e,t)=>!a.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield ja("email"===t?rp.connectivity.postEmailConfiguration:rp.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=a.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:i}=e,a=n[0],{id:o="",enabled:r}=a,s=ta(a,WI);return yield xa([yield ja("email"===t?rp.connectivity.patchEmailConfiguration:rp.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield ja("email"===t?rp.connectivity.putEmailSubscriptions:rp.connectivity.putSMSSubscriptions,o,i,G({},s,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=a.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 ja("email"===t?rp.connectivity.deleteEmailSubscriptions:rp.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(o.length){const e=yield qI({payload:{api:t},type:""});yield $a(GI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield YI(t,e)}else yield $a(GI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:a,processIds:i}))}({payload:t,type:e}):yield ja(xI[e],t),!["sms","email"].includes(e)){const a=yield qI({payload:{api:e},type:""});"webhook"===e&&(a.id=t._id),yield $a(GI.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:a,processIds:a.id?i.filter((e=>e!==a.id)):i})),yield YI(e,a),null==n||n(!0)}}catch(e){yield $a(GI.setConnectivityState({error:Tg(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*QI({payload:e}){try{yield rp.connectivity.postSlackCode(e)}catch{}yield $a(GI.setConnectivityState({error:void 0,isSaving:!1}))}function*ZI(){const{slackChannels:e}=yield za((e=>e.connectivity));try{yield $a(GI.setConnectivityState({slackChannels:G({},e,{isLoadingScope:!0})}));const{clientId:t}=yield ja(rp.connectivity.getSlackScope);yield $a(GI.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield $a(GI.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*eP({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield za((e=>e.connectivity));try{yield $a(GI.setConnectivityState({isSaving:!0})),yield ja(rp.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,Tg(e))}const a=yield qI({payload:{api:"webhook"},type:""});a&&(yield $a(GI.setConnectivityState({error:void 0,isSaving:!1,webhook:a,processIds:a.id?i.filter((e=>e!==a.id)):i}))),null==t||t(!0)}function*tP({payload:e}){try{yield $a(GI.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield ja(rp.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield $a(GI.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield $a(GI.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield $a(GI.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*nP({payload:e}){try{const{statusCode:t}=yield ja(rp.connectivity.postWebhookRetry,e);yield $a(GI.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield $a(GI.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*iP({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield za((e=>e.connectivity));try{yield $a(GI.setConnectivityState({webhookLogs:G({},i,{isLoading:!0})}));const a=yield ja(rp.connectivity.getWebhookLog,e,n,t);yield $a(GI.setConnectivityState({error:void 0,webhookLogs:G({isLoading:!1},a)}))}catch(e){yield $a(GI.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}const aP={sagas:function*(){yield Go(GI.loadDataAction,HI),yield $o(GI.loadSlackActions,JI),yield Go(GI.postDataAction,XI),yield Go(GI.postCodeAction,QI),yield Go(GI.loadScope,ZI),yield Go(GI.deleteWebhookConfigAction,eP),yield Go(GI.postWebhookTestAction,tP),yield Go(GI.postWebhookRetryAction,nP),yield $o(GI.loadWebhookLogsAction,iP)},storeName:Nt,initialState:NI,reducer:MI,actions:GI};function oP(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>G({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>G({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>G({},e,t.payload)}}}function rP(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>G({},n,{[e]:t(n[e],i)})}}function sP(e){return rP(e,((e,t)=>G({},e,{loading:t.payload})))}function lP(e){return rP(e,((e,t)=>G({},e,{error:t.payload,loading:!1})))}const cP={loading:!1,error:null,fetching:!0,plans:[]},{actions:uP,reducer:dP,name:yP}=pt({name:"subscriptions/plans",initialState:cP,reducers:G({},oP())}),fP=G({loadPlans:yt(`${yP}/loadPlans`)},uP),pP={loading:!1,error:null,fetching:!0,config:null},gP=G({},oP()),{actions:SP,reducer:vP,name:hP}=pt({name:"subscriptions/config",initialState:pP,reducers:gP}),mP=G({loadPaymentConfiguration:yt(`${hP}/loadPaymentConfiguration`)},SP),AP={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},bP=G({},oP(),{setCancellationLoading:sP("cancellation"),setCancellationError:lP("cancellation"),setRenewalLoading:sP("renewal"),setRenewalError:lP("renewal")}),{reducer:TP,actions:EP,name:kP}=pt({name:"subscriptions/billing/subscription",initialState:AP,reducers:bP}),OP=G({load:yt(`${kP}/loadSubscription`),cancelSubscription:yt(`${kP}/cancelSubscription`),renewSubscription:yt(`${kP}/renewSubscription`)},EP),IP={loading:!1,error:null,fetching:!0},PP=G({},oP()),{reducer:_P,actions:LP,name:wP}=pt({name:"subscriptions/billing/information",initialState:IP,reducers:PP}),UP=G({loadBillingInformation:yt(`${wP}/loadBillingInformation`),cancelSubscription:OP.cancelSubscription,renewSubscription:OP.renewSubscription},LP),CP={loading:!1,error:null,fetching:!0},RP=G({},oP(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>G({},e,t.payload)}}),{reducer:DP,actions:NP,name:MP}=pt({name:"subscriptions/billing/payment",initialState:CP,reducers:RP}),FP=G({loadPaymentMethod:yt(`${MP}/loadPaymentMethod`),submitPaymentMethod:yt(`${MP}/submitPaymentMethod`),submitPaymentMethodError:yt(`${MP}/submitPaymentMethodError`),submitPaymentMethodSuccess:yt(`${MP}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:yt(`${MP}/updateBillingDetails`,(e=>({payload:e})))},NP),GP={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},$P=G({},oP(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>G({},e,{invoiceDownload:G({},e.invoiceDownload,t.payload)})}}),{reducer:xP,actions:VP,name:jP}=pt({name:"subscriptions/billing/invoices",initialState:GP,reducers:$P}),BP=G({loadInvoices:yt(`${jP}/loadInvoices`),downloadInvoice:yt(`${jP}/downloadInvoice`,(e=>({payload:e})))},VP),WP={information:IP,invoices:GP,paymentMethod:CP,subscription:AP},zP={invoices:BP,information:UP,paymentMethod:FP,subscription:OP},KP=Ke({invoices:xP,information:_P,paymentMethod:DP,subscription:TP}),HP={fetching:!0,loading:!1,error:null,confirmed:!1},qP=G({},oP()),{actions:JP,reducer:YP,name:XP}=pt({name:"subscriptions/checkout",initialState:HP,reducers:qP}),QP=G({loadCheckout:yt(`${XP}/loadCheckout`),resetCheckout:yt(`${XP}/resetCheckout`),submitCheckout:yt(`${XP}/submitCheckout`),confirmCheckout:yt(`${XP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:yt(`${XP}/errorCheckout`,(e=>({payload:e})))},JP),ZP={loading:!1,error:null,cardSetupIntentSecret:null},e_=G({},oP()),{reducer:t_,actions:n_,name:i_}=pt({name:"subscriptions/stripe",initialState:ZP,reducers:e_}),a_=G({loadCustomer:yt(`${i_}/loadCustomer`),createCardSetupIntentSecret:yt(`${i_}/createCardSetupIntentSecret`)},n_),o_={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:r_,reducer:s_,name:l_}=pt({name:"subscriptions/vendorPublicConfig",initialState:o_,reducers:G({},oP())}),c_=G({loadVendorPublicConfiguration:yt(`${l_}/loadVendorPublicConfiguration`)},r_),u_={config:pP,plans:cP,checkout:HP,billing:WP,stripe:ZP,vendorPublicConfig:o_},d_={config:mP,billing:zP,plans:fP,checkout:QP,stripe:a_,vendorPublicConfig:c_},y_=Ke({config:vP,billing:KP,plans:dP,checkout:YP,stripe:t_,vendorPublicConfig:s_});let f_,p_,g_;function S_({policy:e}){return{policy:g_.AT_PERIOD_END}}function v_(e){switch(e){case Xy.ACTIVE:return p_.ACTIVE;case Xy.INCOMPLETE:return p_.INCOMPLETE;case Xy.CANCELED:return p_.CANCELED;case Xy.EXPIRED:return p_.EXPIRED;case Xy.TRIALING:return p_.TRIALING;default:return p_.EXPIRED}}!function(e){e.STRIPE="Stripe"}(f_||(f_={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(p_||(p_={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(g_||(g_={}));const h_={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Xy.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},m_=[{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"}],A_=[{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:""}],b_=[{id:"id",externalId:"externalId",type:Qy.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],T_={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*E_(){yield $a(OP.setLoading(!0));try{const[e]=yield ja(rp.subscriptions.getManagedSubscriptions);yield $a(OP.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield $a(OP.setError(e))}}function*k_(){yield Go(UP.loadBillingInformation,O_)}function*O_(){yield function*(e){const t=yield za((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield za((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield I_(n,!1):yield $a(UP.setError(t?"Not authorized":"Internal feature failure"))}()}function*I_(e,t){yield $a(UP.setLoading(!0));try{var n,i;const a=yield ja(rp.subscriptions.getSubscriptionSummaries,e),{currentPlanId:o,externallyManaged:r}=a;let s,l=null;r?s=yield ja(rp.subscriptions.getSubscriptionPlan,o):([,s]=yield xa([ja(E_),ja(rp.subscriptions.getSubscriptionPlan,o)]),l=yield za((e=>e.subscriptions.billing.subscription.subscription||null))),yield $a(UP.setState(G({loading:!1,fetching:!1,summary:a},l?{subscription:{id:l.id,externalId:l.externalId,startDate:l.startDate,currentPeriodStart:l.currentPeriodStart,currentPeriodEnd:l.currentPeriodEnd,status:t?p_.ACTIVE:v_(l.status),cancellation:l.cancellation&&S_(l.cancellation),trialEnd:l.trialEnd?l.trialEnd:null}}:{},s?{plan:{id:s.id,name:s.name,description:s.description,price:(null==(n=s.price)?void 0:n.amount)||0,currency:(null==(i=s.price)?void 0:i.currency)||"usd",recurringInterval:"month",slug:s.slug}}:{})))}catch(e){yield $a(UP.setError(Tg(e)))}}function*P_(){yield function*(){var e,t;yield $a(UP.setLoading(!0)),yield Ka(500),yield $a(UP.setState({loading:!1,fetching:!1,summary:{subscriptionId:h_.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:ef.Stripe,externallyManaged:!1,currentPlanId:m_[0].id,defaultPlanId:m_[0].id},plan:G({},m_[0],{price:null==(e=m_[0].price)?void 0:e.amount,currency:null==(t=m_[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*__(){yield Go(UP.loadBillingInformation,P_)}function*L_(){yield Go(FP.loadPaymentMethod,w_),yield Go(FP.submitPaymentMethod,C_),yield Go(FP.submitPaymentMethodError,R_),yield Go(FP.submitPaymentMethodSuccess,D_),yield Go(FP.updatePaymentMethodBillingDetails,U_)}function*w_(){yield $a(FP.setLoading(!0));try{const e=(yield ja(rp.subscriptions.getPaymentMethods))[0];yield $a(FP.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield $a(FP.setError(Tg(e)))}}function*U_({payload:e}){yield $a(FP.setLoading(!0));const{id:t,email:n,address:i,callback:a}=e;try{yield ja(rp.subscriptions.updatePaymentMethodBillingDetails,t,G({email:n},i)),yield ja(w_),null==a||a(!0)}catch(e){yield $a(FP.setError(Tg(e))),null==a||a(!1)}yield $a(FP.setLoading(!1))}function*C_(){yield $a(FP.setLoading(!0))}function*R_({payload:e}){yield $a(FP.setError(e))}function*D_(){yield $a(FP.loadPaymentMethod())}function*N_(){yield $a(FP.setLoading(!0)),yield Ka(500);const e=b_[0];yield $a(FP.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*M_(){yield Go(FP.loadPaymentMethod,N_)}function*F_(){yield Go(BP.loadInvoices,G_),yield Go(BP.downloadInvoice,$_)}function*G_(){yield $a(BP.setLoading(!0));try{const e=(yield ja(rp.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 $a(BP.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield $a(BP.setError(Tg(e)))}}function*$_({payload:e}){yield $a(BP.setInvoiceDownloadState({loading:!0,error:null}));try{yield ja(rp.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield $a(BP.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield $a(BP.setInvoiceDownloadState({loading:!1,error:Tg(e,null)}))}}function*x_(){yield $a(BP.setLoading(!0)),yield Ka(500),yield $a(BP.setState({loading:!1,fetching:!1,invoices:A_.map((e=>G({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield $a(BP.setLoading(!1))}function*V_(){yield Go(BP.loadInvoices,x_)}function*j_(){yield Go(OP.load,B_),yield Go(OP.cancelSubscription,W_),yield Go(OP.renewSubscription,z_)}function*B_(){const e=yield za((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield I_(e)}function*W_(){const{subscription:e}=yield za((e=>e.subscriptions.billing.subscription));if(!e)return void(yield $a(OP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield $a(OP.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Xy.ACTIVE)try{yield $a(OP.setCancellationLoading(!0)),yield ja(rp.subscriptions.cancelManagedSubscription,t),yield E_(),yield $a(OP.setCancellationLoading(!1))}catch(e){yield $a(OP.setCancellationError(Tg(e)))}}function*z_(){const{subscription:e}=yield za((e=>e.subscriptions.billing.subscription));if(!e)return void(yield $a(OP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield $a(OP.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Zy.AT_PERIOD_END)try{yield $a(OP.setRenewalLoading(!0)),yield ja(rp.subscriptions.renewManagedSubscription,t),yield E_(),yield $a(OP.setRenewalLoading(!1))}catch(e){yield $a(OP.setCancellationError(Tg(e)))}}function*K_(){yield $a(OP.setLoading(!0)),yield Ka(500),yield $a(OP.setState({subscription:h_,fetching:!1,loading:!1,error:null}))}function*H_(){yield Go(OP.load,K_)}function*q_(){yield xa([ja(k_),ja(L_),ja(F_),ja(j_)])}function*J_(){yield xa([ja(__),ja(M_),ja(V_),ja(H_)])}function*Y_(){yield Go(QP.loadCheckout,X_),yield Go(QP.resetCheckout,Q_),yield Go(QP.submitCheckout,Z_),yield Go(QP.confirmCheckout,eL),yield Go(QP.errorCheckout,nL)}function*X_(){yield $a(QP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*Q_(){yield $a(QP.setState({loading:!1,error:null,confirmed:!1}))}function*Z_(){yield $a(QP.setState({loading:!0,error:null}))}function*eL({payload:{paymentMethodId:e,planId:t}}){const n=yield za((e=>e.subscriptions.billing.subscription.subscription)),i=yield za((e=>e.subscriptions.billing.information.summary)),a=(null==n?void 0:n.status)===Xy.TRIALING,o=!(null==i||!i.paymentMethodId);if(n){if(yield $a(QP.setState({loading:!0,error:null})),a&&o)return yield tL(),void(yield $a(OP.setState({subscription:G({},n,{status:Xy.ACTIVE})})));try{yield ja(rp.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield xa([O_(),w_(),G_()]),yield tL()}catch(e){yield $a(QP.setState({loading:!1,error:Tg(e)}))}}else yield $a(QP.setState({loading:!1,error:"Subscription not found"}))}function*tL(){yield $a(QP.setState({loading:!1,error:null,confirmed:!0}))}function*nL({payload:e}){yield $a(QP.setState({loading:!1,error:e}))}function*iL(){yield Go(QP.resetCheckout,Q_)}function*aL(){yield Go(fP.loadPlans,oL)}function*oL(){yield $a(fP.setLoading(!0));try{const e=(yield ja(rp.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 $a(fP.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield $a(fP.setError(Tg(e)))}}function*rL(){yield $a(fP.setLoading(!0)),yield Ka(500),yield $a(fP.setState({fetching:!1,loading:!1,plans:m_.map((e=>{var t,n;return G({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*sL(){yield Go(fP.loadPlans,rL)}function*lL(){yield Go(mP.loadPaymentConfiguration,cL)}function*cL(){yield $a(mP.setLoading(!0));try{(yield ja(rp.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===ef.Stripe))?yield function*(){yield $a(mP.setLoading(!0));try{const e=yield ja(rp.subscriptions.getStripePaymentProviderConfiguration);yield $a(mP.setState({loading:!1,fetching:!1,config:{paymentProvider:f_.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield $a(mP.setError(Tg(e)))}}():yield $a(mP.setError("Payment provider not configured"))}catch(e){yield $a(mP.setError(Tg(e)))}}function*uL(){yield $a(mP.setLoading(!0)),yield Ka(500),yield $a(mP.setState({loading:!1,fetching:!1,config:{paymentProvider:f_.STRIPE,apiKey:""}}))}function*dL(){yield Go(mP.loadPaymentConfiguration,uL)}function*yL(){yield Go(a_.createCardSetupIntentSecret,fL)}function*fL({payload:e}){yield $a(a_.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield ja(rp.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield $a(a_.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield $a(a_.setError(Tg(e)))}}function*pL(){yield Go(c_.loadVendorPublicConfiguration,gL)}function*gL(){yield $a(c_.setLoading(!0));try{const e=yield ja(rp.subscriptions.getVendorPublicConfigurations);yield $a(c_.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield $a(c_.setError(Tg(e)))}}function*SL(){yield $a(c_.setLoading(!0)),yield Ka(500),yield $a(c_.setState({fetching:!1,loading:!1,vendorPublicConfig:T_}))}function*vL(){yield Go(c_.loadVendorPublicConfiguration,SL)}const hL={sagas:function*(){yield xa([ja(q_),ja(Y_),ja(aL),ja(lL),ja(yL),ja(pL)])},mockSagas:function*(){yield xa([ja(J_),ja(iL),ja(sL),ja(dL),ja(vL)])},reducer:y_,actions:d_,initialState:u_,storeName:"subscriptions"},mL={sagas:function*(){yield Go(WS.loadVendorPublicInfo,zS)},storeName:Ft,initialState:VS,reducer:jS,actions:WS},{reducer:AL}=pt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Vo.setContext(t),G({},e,{context:t}))}}}),bL=(e,t,n=!1,i,a,o=!1,r="path")=>{const s="undefined"==typeof window;let l=t;if(s&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var c,u,d,y,f,p,g,S,v,h;n||o||Vo.setContext(e.context);const t=Lo(),s=[...ut({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=dt({middleware:s,preloadedState:{root:G({},e,{previewMode:n,urlStrategy:r}),[WO.storeName]:G({},WO.initialState,i,null!=(c=null==a?void 0:a.auth)?c:{},{routes:G({},WO.initialState.routes,null!=(u=null==i?void 0:i.routes)?u:{},null!=(d=null==a||null==(y=a.auth)?void 0:y.routes)?d:{})}),[SI.storeName]:G({},SI.initialState,null!=(f=null==a?void 0:a.auditLogs)?f:{},{auditLogsState:G({},SI.initialState.auditLogsState,null!=(p=null==a||null==(g=a.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:G({},SI.initialState.auditsMetadataState,null!=(S=null==a||null==(v=a.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[hI]:G({},vI,null!=(h=null==a?void 0:a.audits)?h:{}),[aP.storeName]:aP.initialState,[hL.storeName]:hL.initialState,[mL.storeName]:mL.initialState},reducer:Ke({root:AL,[WO.storeName]:WO.reducer,[SI.storeName]:SI.reducer,[hI]:AI,[aP.storeName]:aP.reducer,[hL.storeName]:hL.reducer,[mL.storeName]:mL.reducer})});const m=function*(){yield xa([ja(WO.sagas),ja(SI.sagas),ja(UI),ja(aP.sagas),ja(hL.sagas),ja(mL.sagas)])},A=function*(){yield xa([ja(WO.mockSagas),ja(SI.mockSagas),ja(hL.mockSagas)])};n?(l.store.destroy=t.run(A).cancel,l.store.dispatch(ji.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel,l.store.subscribeStateChanged=e=>{let t=l.store.getState();return l.store.subscribe((()=>{const n=l.store.getState();t!=n&&(t=n,e(n))}))}}return l.store};var TL=n(314);const EL=()=>{if(!Vo.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")},kL=(e,t)=>e?e.isEntitled?{isEntitled:!0}:{isEntitled:!1,justification:e.justification}:{isEntitled:!1,justification:t};var OL=n(714),IL=n.n(OL);function PL(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function _L(e){if(e.type)return e;if("#"===e.charAt(0))return _L(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const i=e.substring(t+1,e.length-1);let a,o;if("color"===n){if(o=i.split(" "),a=o.shift(),4===o.length&&"/"===o[3].charAt(0)&&(o[3]=o[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(a))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+a)}else o=i.split(",");return{type:n,values:o.map((e=>parseFloat(e))),colorSpace:a}}function LL(e){const{type:t,colorSpace:n}=e;let{values:i}=e;return-1!==t.indexOf("rgb")?i=i.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),i=-1!==t.indexOf("color")?`${n} ${i.join(" ")}`:`${i.join(", ")}`,`${t}(${i})`}function wL(e){if(0===e.indexOf("#"))return e;const{values:t}=_L(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 UL(e,t){return e=_L(e),t=PL(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,LL(e)}function CL(e,t){if(e=_L(e),t=PL(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 LL(e)}function RL(e,t){if(e=_L(e),t=PL(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 LL(e)}const DL=e=>{if(e)return{main:e,light:wL(RL(e,.4)),dark:wL(CL(e,.15)),hover:wL(CL(e,.15)),active:wL(CL(e,.2))}},NL=e=>{if(e)return{main:e,light:RL(e,.7),dark:CL(e,.2)}},ML=(e,t)=>{var n,i,a,o,r,s,l,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?G({},t,{palette:{primary:G({},DL(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(a=null==e||null==(o=e.palette)?void 0:o.primaryText)?a:"#000000"}),secondary:G({},DL(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(s=null==e||null==(l=e.palette)?void 0:l.secondaryText)?s:"#000000"}),danger:G({},DL(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:G({},NL(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:G({},NL(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:G({},NL(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:G({},NL(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},FL={theme:{},themeV2:{},localizations:{},navigation:{usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},provisioning:{visibility:"hidden",permissions:["fe.secure.read.provisioningConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]},allAccounts:{visibility:"byPermissions",permissions:["fe.account-hierarchy.read.subAccount"]},groups:{visibility:"hidden",permissions:["fe.secure.read.groups"]}}};class GL{constructor(){this._theme=FL.theme,this._themeV2=FL.themeV2,this._navigation=FL.navigation,this._localizations=FL.localizations,this._integrations=FL.integrations}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new GL;return n.set(e),GL._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}get integrations(){var e;return null!=(e=this._integrations)?e:{}}set(e){try{var t,n,i,a,o,r,s,l,c;this._navigation=IL().all([null!=(t=FL.navigation)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=IL().all([null!=(i=FL.theme)?i:{},ML(null==e?void 0:e.theme,FL.theme)]),this._themeV2=IL().all([null!=(a=FL.themeV2)?a:{},null!=(o=null==e?void 0:e.themeV2)?o:{}]),this._localizations=IL().all([null!=(r=FL.localizations)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}]),this._integrations=IL().all([null!=(l=FL.integrations)?l:{},null!=(c=null==e?void 0:e.integrations)?c:{}])}catch(e){this._navigation=FL.navigation,this._theme=FL.theme,this._themeV2=FL.themeV2,this._localizations=FL.localizations,this._integrations=FL.integrations}}}GL._instances={};var $L=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},xL=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(t);return Object.keys(n).forEach((function(e){return i.setAttribute(e,n[e])})),e.appendChild(i),i},VL=function(e){return new Promise((function(t,n){var i=4e3,a=setInterval((function(){return null!=e.themeSetter?(clearInterval(a),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(a)):void(i-=50)}),50)}))},jL=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 BL,WL,zL,KL,HL,qL,JL,YL,XL,QL,ZL,ew;!function(e){e.phoneNumber="phoneNumber"}(BL||(BL={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(WL||(WL={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(zL||(zL={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(KL||(KL={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(HL||(HL={})),function(e){e.Invoices="invoices"}(qL||(qL={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(JL||(JL={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(YL||(YL={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(XL||(XL={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(QL||(QL={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(ZL||(ZL={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(ew||(ew={}));const tw={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},nw={hidden:"hidden",edit:"edit"},iw="6.166.0";var aw={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","temporary-users":"on"},ow=function(){function e(t,n){var i,a,o=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];I(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(iw),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=N(F().mark((function e(){var t,n,i,a,r;return F().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Rr,o.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,o.options.metadata=null!=(n=null==r||null==(i=r.rows)||null==(a=i[0])?void 0:a.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:GL.set(o.options.metadata,o.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=N(F().mark((function e(){var t,n,i;return F().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=null==(t=o.options.authOptions)||null==(n=t.hostedLoginOptions)?void 0:n.loadUserOnFirstLoad,o.options.builderMode||"nextjs"===o.options.framework||(o.options.hostedLoginBox&&!o.options.customLoginBox?i&&o.store.dispatch({type:"auth/requestHostedLoginAuthorizeV2",payload:{shouldRedirectToLogin:!1,firstTime:!0}}):o.store.dispatch({type:"auth/requestAuthorize",payload:!0}));case 2:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=N(F().mark((function e(){var t;return F().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.options.previewMode&&!o.options.builderMode){e.next=4;break}Br.set(aw,o.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Wr();case 7:t=e.sent,o.options.overrideFeatureFlags&&Object.assign(t,o.options.overrideFeatureFlags),Br.set(t,o.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.setFeatureFlagsForPreview=function(e){Br.set(Object.assign({},aw,e),o.name)},this.queryFeatureFlags=function(e){return Br.getFeatureFlags(e,o.name)},this.updateLocalizationsSetter=function(e){o.updateLocalizations=e},this.getEntitlementsFromStore=function(){var e;return null==(e=o.store.getState().auth.user)?void 0:e.entitlements},this.getUserFromStore=function(){return o.store.getState().auth.user},this.getEntitlementsQueryData=function(e){var t=o.getUserFromStore();return{entitlements:o.getEntitlementsFromStore(),attributes:{custom:e,jwt:t},isV2:R(o.queryFeatureFlags([Vr]),1)[0]}};var l=$L(n),c="frontegg-app-".concat(l);this.iframeRendering=r,this.name=l,this.options=Object.assign({},t,{contextOptions:Object.assign({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=c;var u,d,y=this.options.authOptions?Object.assign({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(y.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!s&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=bL({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,y,{auth:null!=(u=this.options.authOptions)?u:{},audits:null!=(d=this.options.auditsOptions)?d:{}},!1,this.options.urlStrategy);U.setInstance(l,this),this.setEntitlementsOptions(t.entitlementsOptions),this.setSessionContext({enableSessionPerTenant:null==(a=t.authOptions)?void 0:a.enableSessionPerTenant}),Vo.setAppName(l)}var t,n,i,a;return w(e,[{key:"setEntitlementsOptions",value:function(e){Vo.setEntitlementsOptions(Object.assign({},e))}},{key:"setSessionContext",value:function(e){Vo.setSessionContext(Object.assign({},e))}},{key:"initContainers",value:(a=N(F().mark((function e(t){return F().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.adminPortalEl=t.adminPortalEl,this.loginBoxEl=t.loginBoxEl,this.checkoutDialogEl=t.checkoutDialogEl,this.adminPortalContainer=t.adminPortalContainer,this.loginBoxContainer=t.loginBoxContainer,this.checkoutDialogContainer=t.checkoutDialogContainer;try{"nextjs"!==this.options.framework&&document.body.classList.add("frontegg-loading")}catch(e){console.error("Failed to add frontegg-loading to body classList")}return e.next=9,this.loadFeatureFlags();case 9:return e.next=11,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize()]);case 11:this.options.previewMode||this.options.customLoginBox||(this.loadLoginBox(),n=this.name,i=void 0,void 0,o=void 0,null==(o=null==(a=GL.getInstance(n))||null==(i=a.integrations)?void 0:i.gtm)||o.filter((function(e){var t=e.id;return e.enabled&&function(e){return/^GTM-[a-zA-Z0-9]+$/.test(e)}(t)})).forEach((function(e){var t=e.id,n=document.createElement("script");n.innerHTML="\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','".concat(t,"');\n "),document.body.appendChild(n)}))),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 13:case"end":return e.stop()}var n,i,a,o}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;GL.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var a=document.createElement("script");a.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),a.setAttribute("id","".concat(e,"Script")),a.setAttribute("cdn-url",t.cdnUrl),a.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:k,FronteggTypes:O})):n(window[e])},a.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(a)}}))}},{key:"loadLoginBox",value:(i=N(F().mark((function e(){return F().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){console.error("Failed to call loadLoginBoxListener",e)}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=N(F().mark((function e(){var t;return F().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Vo.setRequestSource(ui.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(),jL(t),Vo.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=N(F().mark((function e(t){var n;return F().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,Object.assign({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"getFeatureEntitlements",value:function(e,t){var n=this.getEntitlementsQueryData(t);return((e,t,n,i)=>{var a;return EL(),i?(0,TL.tE)(t,e,n):kL(null==e||null==(a=e.features)?void 0:a[t],Hs.MISSING_FEATURE)})(n.entitlements,e,n.attributes,n.isV2)}},{key:"getPermissionEntitlements",value:function(e,t){var n=this.getEntitlementsQueryData(t);return((e,t,n,i)=>{var a;return EL(),i?(0,TL.wJ)(t,e,n):kL(null==e||null==(a=e.permissions)?void 0:a[t],Hs.MISSING_PERMISSION)})(n.entitlements,e,n.attributes,n.isV2)}},{key:"getEntitlements",value:function(e,t){return"permissionKey"in e?this.getPermissionEntitlements(e.permissionKey,t):this.getFeatureEntitlements(e.featureKey,t)}},{key:"loadEntitlements",value:function(e){this.store.dispatch({type:"auth/loadEntitlements",payload:{callback:e}})}},{key:"stepUp",value:function(e){var t=this.store.getState(),n=(null==t?void 0:t.auth)||{},i=n.hostedLoginBox,a=n.routes.stepUpUrl;i?this.store.dispatch({type:"auth/stepUpHostedLogin",payload:e}):((e,t,n)=>{av();const i=new URLSearchParams(window.location.search);n&&i.set("maxAge",n.toString()),t(`${e}${i?`?${i}`:""}`,{refresh:!1})})(a,t.auth.onRedirectTo,null==e?void 0:e.maxAge)}},{key:"isSteppedUp",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(null==(e=this.store.getState())?void 0:e.auth)||{},i=n.user;return iv(i,t)}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),rw=function(){function e(){I(this,e)}return w(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",a=U.getInstance(i);e&&t?(Vo.setAccessToken(t),Vo.setUser(Object.assign({},n,{accessToken:t})),a.store.dispatch(ji.setState({isLoading:!1,isAuthenticated:e,user:n})),a.store.dispatch(ji.loadTenants())):(Vo.setAccessToken(null),Vo.setUser(null),a.store.dispatch(ji.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),sw=function(){function e(){I(this,e)}return w(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";U.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";U.getInstance(e).hideAdminPortal()}}]),e}(),lw=function(){function e(){I(this,e)}return w(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";U.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";U.getInstance(e).hideCheckoutDialog()}}]),e}(),cw=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},uw=function(){function e(t,n,i,a){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];I(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(i){if(this.store=i,!o&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=bL({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=Object.assign({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},a),this.app=new ow(this.options,t,!0),GL.set({},t)}var t;return w(e,[{key:"render",value:(t=N(F().mark((function e(t){var n,i,a,o,r=this;return F().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,i=function(e){r.themeSetter=e},a=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return o=e.sent,this.app.adminPortalRenderer=o.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:a}),this.app.loading=!1,e.next=13,VL(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}(),dw="modern",yw=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[dw]},fw=function(){function e(t,n,i,a){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];I(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(i){if(this.store=i,!o&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=bL({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=Object.assign({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},a),this.app=new ow(this.options,t,!0,o),GL.set({},t)}var t;return w(e,[{key:"render",value:(t=N(F().mark((function e(t){var n,i,a,o,r=this;return F().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,i=function(e){r.themeSetter=e},a=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return o=e.sent,this.app.loginBoxRenderer=o.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:a,staticRoute:"/account/login"}),e.next=12,VL(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 pw(e,t){return pw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pw(e,t)}function gw(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&&pw(e,t)}function Sw(e,t){if(t&&("object"===P(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function vw(e){return vw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vw(e)}function hw(){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 mw(e,t,n){return mw=hw()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return n&&pw(a,n.prototype),a},mw.apply(null,arguments)}function Aw(e){var t="function"==typeof Map?new Map:void 0;return Aw=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 mw(e,arguments,vw(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),pw(n,e)},Aw(e)}function bw(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=vw(e);if(t){var a=vw(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return Sw(this,n)}}var Tw=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new ow(e,t);if("undefined"!=typeof document){var i;if(!e.contextOptions.baseUrl){var a=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(a.message),a}if(!customElements.get("frontegg-app")){var o=function(e){gw(n,e);var t=bw(n);function n(){var e;I(this,n);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return(e=t.call.apply(t,[this].concat(a))).app=null,e}return w(n,[{key:"connectedCallback",value:function(){this.updateContent()}},{key:"attributeChangedCallback",value:function(e,t,n){if("app-name"===e){if(null===t)return;if(t===n)return;this.innerHTML="",null===n?this.remove():this.updateContent()}console.debug("attributeChangedCallback",e,t,n)}},{key:"updateContent",value:function(){var e,t=null!=(e=this.getAttribute("app-name"))?e:"default",n=U.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=xL(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),a=xL(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),o=xL(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=i.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),l=o.attachShadow({mode:"open"}),c=xL(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=xL(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=xL(l,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:i,loginBoxContainer:a,checkoutDialogContainer:o,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(Aw(HTMLElement));customElements.define("frontegg-app",o)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}})(),i})()));
|