@frontegg/js 6.155.0-alpha.2 → 6.155.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +282 -82
- package/umd/frontegg.production.min.js +1 -1
- package/umd/frontegg.production.min.js.LICENSE.txt +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=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 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 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(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 FL},AdminPortalRenderer:function(){return VL},AppHolder:function(){return U},CheckoutDialog:function(){return GL},FronteggApp:function(){return NL},HostedLogin:function(){return ML},LoginBoxRenderer:function(){return BL},createElement:function(){return SL},defaultTheme:function(){return xL},formatName:function(){return gL},getThemeAdminByName:function(){return $L},getThemeByName:function(){return jL},initialize:function(){return XL},mockFlagsList:function(){return DL},restoreSearchParams:function(){return hL},waitThemeSetter:function(){return vL}});var e={};n.r(e),n.d(e,{Delete:function(){return Nr},Get:function(){return Ur},Patch:function(){return Rr},Post:function(){return Cr},PostDownload:function(){return Mr},Put:function(){return Dr},extractHeadersFromOptions:function(){return Fr},getBaseUrl:function(){return _r},getMetadataHeaders:function(){return Lr}});var t={};n.r(t),n.d(t,{FeatureFlags:function(){return xr},loadFeatureFlags:function(){return jr}});var o={};n.r(o),n.d(o,{GetUserJwt:function(){return Br},getCurrentUserTenantsV1:function(){return Jr},getCurrentUserTenantsV3:function(){return Hr},getUsersGroups:function(){return qr},getUsersRoles:function(){return Kr},getUsersV2:function(){return Wr},getUsersV3:function(){return zr},sendResetBreachedPasswordEmails:function(){return Yr},updateUserProfileV2:function(){return Qr}});var a={};n.r(a),n.d(a,{getHierarchyMetadata:function(){return cs},getParentTenants:function(){return as},getParentTenantsById:function(){return rs},getSubTenants:function(){return is},getSubTenantsAsTree:function(){return os},getTenants:function(){return ns},getTenantsUsersCount:function(){return ss},searchSubTenants:function(){return ls},switchTenant:function(){return ts}});var r={};n.r(r),n.d(r,{loadEntitlements:function(){return Bs},loadEntitlementsV2:function(){return Ws}});var s={};n.r(s),n.d(s,{AuthStrategyEnum:function(){return ki},MachineToMachineAuthStrategy:function(){return Oi},OAuthLogout:function(){return bl},SocialLoginProviders:function(){return Ei},acceptInvitation:function(){return Sl},activateAccount:function(){return dl},activateAccountV2:function(){return yl},bulkCreateIPRestriction:function(){return ws},changePhoneNumber:function(){return ku},changePhoneNumberWithVerification:function(){return Tu},checkIfAllowToRememberMfaDevice:function(){return Kc},createDomainRestriction:function(){return ks},createIPRestriction:function(){return Ls},createOrUpdateSessionConfigrations:function(){return wc},createSSOConfiguration:function(){return Xc},createSSOConfigurationByMetadata:function(){return tu},createSSOConfigurationByMetadataUrl:function(){return iu},createSSODomain:function(){return au},createSSOGroup:function(){return uu},createSamlGroup:function(){return pc},createTenantAccessToken:function(){return Gc},createUserAccessToken:function(){return Fc},deleteAllSessionsForUser:function(){return Cc},deleteDomainRestriction:function(){return Is},deleteIPRestriction:function(){return Cs},deleteSSOConfiguration:function(){return eu},deleteSSODomain:function(){return ru},deleteSSOGroup:function(){return yu},deleteSamlGroup:function(){return Sc},deleteSessionForUser:function(){return Uc},deleteTenantAccessToken:function(){return Nc},deleteTenantApiToken:function(){return Bc},deleteUserAccessToken:function(){return Mc},deleteUserApiToken:function(){return Wc},deleteWebAuthnDevice:function(){return wu},disableMFAAuthenticatorApp:function(){return Nl},disableMFASMS:function(){return Fl},disableMFAWebAuthn:function(){return $l},disableMfa:function(){return Dl},enrollMFAAuthenticatorApp:function(){return _l},enrollMFAAuthenticatorAppForLogin:function(){return jl},enrollMFAAuthenticatorAppForLoginV2:function(){return Bl},enrollMFASMS:function(){return wl},enrollMFASMSForLogin:function(){return Jl},enrollMFASMSForLoginV2:function(){return Yl},enrollMFAWebAuthn:function(){return Cl},enrollMFAWebAuthnForLogin:function(){return tc},enrollMFAWebAuthnForLoginV2:function(){return nc},enrollMfa:function(){return Il},exchangeOAuthTokens:function(){return hu},exchangeOAuthTokensV2:function(){return Su},forgotPassword:function(){return Tl},generateLoginResponse:function(){return Ys},generateLoginResponseFromOAuthResponse:function(){return tl},generateLoginResponseFromOAuthResponseV2:function(){return nl},generateLoginResponseV2:function(){return Qs},generateLoginResponseV3:function(){return el},generateStepupSession:function(){return Gu},getActivateAccountStrategy:function(){return fl},getCaptchaPolicy:function(){return vs},getCurrentUserSession:function(){return Pc},getCurrentUserSessions:function(){return Ic},getCurrentUserTenantsFunction:function(){return es},getCustomSocialLoginProvidersV1:function(){return Tc},getDomainRestrictions:function(){return Ts},getDomainRestrictionsConfig:function(){return Es},getGlobalSecurityPolicy:function(){return us},getIPRestrictions:function(){return Ps},getIPRestrictionsConfig:function(){return _s},getLockoutPolicy:function(){return ps},getMFADevices:function(){return Vl},getMFAStrategiesConfig:function(){return Du},getMeAndEntitlements:function(){return Fu},getMeV2:function(){return Mu},getMfaPolicy:function(){return ds},getOidcConfiguration:function(){return vc},getPasswordConfigPolicy:function(){return bs},getPasswordHistoryPolicy:function(){return hs},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return Ru},getSSOConfigurations:function(){return Qc},getSSODefaultRoles:function(){return lu},getSSOGroups:function(){return fu},getSSOPublicConfiguration:function(){return hc},getSamlConfiguration:function(){return rc},getSamlRoles:function(){return dc},getSamlRolesGroups:function(){return yc},getSamlVendorConfiguration:function(){return lc},getSessionConfigurations:function(){return Lc},getSocialLoginProviders:function(){return mc},getSocialLoginProvidersV2:function(){return Ac},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return bc},getTabTenantFromSessionStorage:function(){return Zr},getTenantAccessTokensData:function(){return Dc},getTenantApiTokensData:function(){return Vc},getUserAccessTokensData:function(){return Rc},getUserApiTokensData:function(){return $c},getUserAuthorization:function(){return Nu},getUserById:function(){return zc},getVendorConfig:function(){return kc},getVendorLockoutPolicy:function(){return gs},getVendorMfaPolicy:function(){return ys},getVendorPasswordHistoryPolicy:function(){return ms},getVendorPublicAuthStrategiesConfig:function(){return Cu},getWebAuthnDevices:function(){return Lu},loadPasswordConfig:function(){return kl},login:function(){return sl},loginViaSocialLogin:function(){return Ec},loginWithMfa:function(){return cl},loginWithMfaV2:function(){return ul},loginv2:function(){return ll},logout:function(){return Al},oidcPostLogin:function(){return rl},oidcPostLoginV2:function(){return gu},passwordlessPostLogin:function(){return Jc},passwordlessPostLoginV2:function(){return Hc},passwordlessPreLogin:function(){return qc},postLogin:function(){return al},preDisableMFASMS:function(){return Ml},preDisableMFAWebAuthn:function(){return Gl},preEnrollMFAAuthenticatorApp:function(){return Pl},preEnrollMFAAuthenticatorAppForLogin:function(){return xl},preEnrollMFASMS:function(){return Ll},preEnrollMFASMSForLogin:function(){return Hl},preEnrollMFAWebAuthn:function(){return Ul},preEnrollMFAWebAuthnForLogin:function(){return ec},preLogin:function(){return il},preLoginV2:function(){return pu},preLoginWithIdpType:function(){return ol},preVerifyMFAEmailCode:function(){return zl},preVerifyMFASMSForLogin:function(){return Ql},preVerifyMFAWebAuthnForLogin:function(){return ic},recoverMfaToken:function(){return Ol},refreshToken:function(){return vl},refreshTokenV2:function(){return hl},refreshTokenV3:function(){return ml},resendActivationEmail:function(){return pl},resendInvitationEmail:function(){return gl},resetPassword:function(){return El},resetPhoneNumber:function(){return Au},revokeSessionsForUser:function(){return _c},saveLockoutPolicy:function(){return Ss},saveMfaPolicy:function(){return fs},savePasswordHistoryPolicy:function(){return As},setSSODefaultRoles:function(){return cu},setTabTenantInSessionStorage:function(){return Xr},signUpUser:function(){return Oc},silentOAuthRefreshToken:function(){return mu},silentOAuthRefreshTokenV2:function(){return vu},testCurrentIp:function(){return Rs},testCurrentIpInAllowList:function(){return Ds},updateDomainRestrictionConfig:function(){return Os},updateIPRestrictionConfig:function(){return Us},updateSSOConfiguration:function(){return Zc},updateSSOConfigurationByMetadata:function(){return nu},updateSSOConfigurationByMetadataUrl:function(){return ou},updateSSOGroup:function(){return du},updateSamlConfiguration:function(){return sc},updateSamlGroup:function(){return gc},updateSamlRoles:function(){return fc},updateSamlVendorMetadata:function(){return cc},updateTenantApiTokensData:function(){return jc},updateUserApiTokensData:function(){return xc},validateSSODomain:function(){return su},validateSamlDomain:function(){return uc},verifyChangePhoneNumber:function(){return Eu},verifyInviteToken:function(){return Yc},verifyMFAAuthenticatorAppForLogin:function(){return Wl},verifyMFAEmailCode:function(){return Kl},verifyMFAEmailCodeV2:function(){return ql},verifyMFASMSForLogin:function(){return Xl},verifyMFASMSForLoginV2:function(){return Zl},verifyMFAWebAuthnForLogin:function(){return oc},verifyMFAWebAuthnForLoginV2:function(){return ac},verifyMfa:function(){return Rl},verifyNewDeviceSession:function(){return Uu},verifyResetPhoneNumber:function(){return bu},webAuthnCreateNewDeviceSession:function(){return _u},webAuthnPostLogin:function(){return Iu},webAuthnPostLoginV2:function(){return Pu},webAuthnPreLogin:function(){return Ou}});var l={};n.r(l),n.d(l,{addUser:function(){return Wu},changePassword:function(){return ju},createInviteUserLink:function(){return qu},deleteInviteUserLink:function(){return Ju},deleteUser:function(){return zu},getInviteLinkConfiguration:function(){return Qu},getInviteUserLink:function(){return Yu},getProfile:function(){return $u},loadAvailablePermissions:function(){return Zu},loadAvailableRoles:function(){return Xu},loadStats:function(){return ed},loadUsers:function(){return Bu},resendActivationLink:function(){return td},resendInvitationLink:function(){return nd},resendInvitationLinkToAllTenants:function(){return id},updateInviteUserLink:function(){return Hu},updateProfile:function(){return Vu},updateProfileImage:function(){return xu},updateUser:function(){return Ku}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return ad},getAuditsMetadata:function(){return ud},getCurrentUserIpMetadata:function(){return sd},getIpAdressMetadata:function(){return dd},getNotificationsMetadata:function(){return ld},getSamlMetadata:function(){return cd},updateAdminBoxMetadata:function(){return rd}});var u={};n.r(u),n.d(u,{downloadReport:function(){return md},getReport:function(){return Sd},getReports:function(){return gd},renderReport:function(){return vd},scheduleReport:function(){return hd},sendReport:function(){return Ad}});var d={};n.r(d),n.d(d,{getNotifications:function(){return bd},markAllAsRead:function(){return kd},updateNotificationIsPinned:function(){return Ed},updateNotificationStatus:function(){return Td}});var y={};n.r(y),n.d(y,{exportAudits:function(){return _d},getAudits:function(){return Id},getAuditsStats:function(){return Pd}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return jd},deleteEmailSubscriptions:function(){return Vd},deleteSMSConfiguration:function(){return Hd},deleteSMSSubscriptions:function(){return Kd},deleteSlackConfiguration:function(){return Nd},deleteWebhooksConfiguration:function(){return Qd},getCategories:function(){return ty},getChannelMaps:function(){return ny},getEmailConfiguration:function(){return Fd},getSMSConfiguration:function(){return Bd},getSlackChannels:function(){return Rd},getSlackConfiguration:function(){return Ud},getSlackScope:function(){return Cd},getWebhookLog:function(){return Xd},getWebhooksConfigurations:function(){return Jd},patchEmailConfiguration:function(){return $d},patchSMSConfiguration:function(){return zd},postEmailConfiguration:function(){return Gd},postSMSConfiguration:function(){return Wd},postSlackCode:function(){return Md},postSlackConfiguration:function(){return Dd},postWebhookRetry:function(){return ey},postWebhookTest:function(){return Zd},postWebhooksConfiguration:function(){return Yd},putEmailSubscriptions:function(){return xd},putSMSSubscriptions:function(){return qd}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return ay},getSettings:function(){return oy},updateSettings:function(){return iy}});var g={};n.r(g),n.d(g,{addRole:function(){return uy},attachPermissionToRoles:function(){return gy},attachPermissionsToRole:function(){return fy},deleteRole:function(){return dy},getPermissionCategories:function(){return Sy},getPermissions:function(){return py},getRoles:function(){return cy},updateRole:function(){return yy}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return Hy},ISubscriptionStatus:function(){return Ky},PaymentMethodType:function(){return qy},ProviderType:function(){return Jy},TenantCreatedAction:function(){return Qy},TrialEndAction:function(){return Yy},cancelManagedSubscription:function(){return ky},cancelSubscription:function(){return my},createStripeCustomer:function(){return Gy},createStripePaymentMethodSetupIntentSecret:function(){return Vy},createSubscription:function(){return My},createTenantConfiguration:function(){return By},getManagedSubscription:function(){return Ty},getManagedSubscriptions:function(){return Ey},getPaymentMethod:function(){return Dy},getPaymentMethods:function(){return Ry},getPaymentProviders:function(){return Wy},getStripeCustomer:function(){return Fy},getStripePaymentProviderConfiguration:function(){return $y},getSubscription:function(){return hy},getSubscriptionInvoice:function(){return wy},getSubscriptionInvoicePdf:function(){return Uy},getSubscriptionInvoices:function(){return Ly},getSubscriptionPlan:function(){return _y},getSubscriptionPlans:function(){return Py},getSubscriptionSummaries:function(){return xy},getSubscriptions:function(){return vy},getTenantConfiguration:function(){return jy},getVendorPublicConfigurations:function(){return zy},renewManagedSubscription:function(){return Oy},renewSubscription:function(){return Ay},updateManagedSubscription:function(){return Iy},updatePaymentMethodBillingDetails:function(){return Ny},updateSubscription:function(){return by}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return Xy}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return nf},addUserToTenantAndSubTenants:function(){return ef},addUsersToSubTenant:function(){return uf},createSubTenant:function(){return rf},deleteSubTenant:function(){return sf},loadAllUsers:function(){return Zy},removeUserFromTenantAndSubTenants:function(){return tf},removeUserRolesFromSubTenants:function(){return of},setUserRolesForSubTenants:function(){return af},updateSubAccountAccess:function(){return cf},updateSubTenant:function(){return lf}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return gf},createConfiguration:function(){return ff},deleteConfiguration:function(){return pf},getConfigs:function(){return df},updateConfiguration:function(){return yf}});var A={};n.r(A),n.d(A,{impersonate:function(){return Sf}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return kf},addUsersToGroup:function(){return If},createGroup:function(){return bf},deleteGroup:function(){return Ef},deleteRolesFromGroup:function(){return Of},deleteUsersFromGroup:function(){return Pf},getGroupById:function(){return hf},getGroupConfiguration:function(){return _f},getGroups:function(){return mf},getGroupsByIds:function(){return Af},updateGroup:function(){return Tf},updateGroupConfiguration:function(){return Lf}});var T={};n.r(T),n.d(T,{getInsights:function(){return Uf},getRecommendations:function(){return wf}});var E={};n.r(E),n.d(E,{createPhoneNumber:function(){return Rf},deletePhoneNumber:function(){return Df},getUserPhoneNumbers:function(){return Cf},preVerifyPhoneNumber:function(){return Nf},verifyDeletePhoneNumber:function(){return Ff},verifyPhoneNumber:function(){return Mf}});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return Ks},AuthStrategyEnum:function(){return ki},ContextHolder:function(){return Va},FeatureFlags:function(){return xr},FronteggApiError:function(){return ja},FronteggContext:function(){return xa},FronteggFrameworks:function(){return ui},GetUsersFilterPreset:function(){return fi},GroupManagedByEnum:function(){return Jf},GroupRelations:function(){return Hf},ISubscriptionCancellationPolicy:function(){return Hy},ISubscriptionStatus:function(){return Ky},InsightCode:function(){return Qf},LOAD_AUTHORIZATION_FF:function(){return js},MFAStrategyEnum:function(){return xs},MachineToMachineAuthStrategy:function(){return Oi},NotEntitledJustification:function(){return zs},PaginationOrderEnum:function(){return di},PaymentMethodType:function(){return qy},ProviderType:function(){return Jy},RecommendationActionKey:function(){return Xf},RecommendationCode:function(){return Yf},RecommendationSeverity:function(){return Zf},RequestSource:function(){return ci},RestrictionType:function(){return Wn},ScimConnectionSource:function(){return qf},SecondaryAuthStrategy:function(){return $s},SecurityCategory:function(){return ep},SocialLoginProviders:function(){return Ei},SortByEnum:function(){return yi},TenantSortByEnum:function(){return $f},TenantType:function(){return Vf},USE_ENTITLEMENTS_V2_ENDPOINT_FF:function(){return $r},UserManagedByEnum:function(){return Gf},WebAuthnDeviceType:function(){return Vs},api:function(){return tp},countConfigurationUsers:function(){return gf},createConfiguration:function(){return ff},default:function(){return np},deleteConfiguration:function(){return pf},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return xf},fronteggHeaders:function(){return li},fronteggRefreshTokenUrl:function(){return jf},fronteggSilentRefreshTokenUrl:function(){return Bf},fronteggTenantsUrl:function(){return zf},fronteggTenantsV3Url:function(){return Kf},fronteggUsersUrl:function(){return Wf},getConfigs:function(){return df},getCurrentUserTenantsFunction:function(){return es},getTabTenantFromSessionStorage:function(){return Zr},loadFeatureFlags:function(){return jr},providersArray:function(){return pi},setTabTenantInSessionStorage:function(){return Xr},updateConfiguration:function(){return yf}});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:function(){return wL},AccountPageFields:function(){return EL},DomainRestrictionsTabFields:function(){return LL},GeneralSettingsTabFields:function(){return PL},InviteUserModalFields:function(){return TL},IpRestrictionsTabFields:function(){return _L},Metadata:function(){return pL},PrivacyPageFields:function(){return bL},ProfilePageFields:function(){return AL},SecurityPageTabs:function(){return OL},SessionManagementTabFields:function(){return IL},SignupFields:function(){return mL},SubscriptionsPageFields:function(){return kL},alpha:function(){return sL},fieldAppearance:function(){return UL},tabAppearance:function(){return CL}});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,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 V(e){return!!e&&!!e[Ie]}function x(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]||q(e)||H(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:q(e)?2:H(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 q(e){return be&&e instanceof Map}function H(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 o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function Q(e,t){return void 0===t&&(t=!1),Z(e)||V(e)||!x(e)||(B(e)>1&&(e.set=e.add=e.clear=e.delete=X),Object.freeze(e),t&&j(e,(function(e,t){return Q(t,!0)}),!0)),e}function X(){$(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[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)),x(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(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(V(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),!V(r))return;e.m=!1}if(x(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&&Q(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=q(t)?ee("MapSet").N(t,n):H(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 V(e)||$(22,e),function e(t){if(!x(t))return t;var n,i=t[Ie],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),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,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||!x(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[Ie];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),x(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&&Q(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){x(e)||$(8),V(e)&&(e=Se(e));var t=ae(this),n=ge(this,e,void 0);return n[Ie].C=!0,oe(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 o=ee("Patches").$;return V(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 Ve(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 xe="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(Ve(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ve(1));return n(ze)(e,t)}if("function"!=typeof e)throw new Error(Ve(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(Ve(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ve(4));if(l)throw new Error(Ve(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(Ve(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!We(e))throw new Error(Ve(7));if(void 0===e.type)throw new Error(Ve(8));if(l)throw new Error(Ve(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(Ve(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(Ve(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[xe]=function(){return this},e}return y({type:Be.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[xe]=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(Ve(12));if(void 0===n(void 0,{type:Be.PROBE_UNKNOWN_ACTION()}))throw new Error(Ve(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(Ve(14));o[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function qe(){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 He(){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(Ve(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=qe.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 Qe,Xe=Ye,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,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]?qe:qe.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 x(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||{},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=He.apply(void 0,p),S=qe;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(V(e))return void 0===(i=n(e,t))?e:i;if(x(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[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 o=e[t][Ie];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!==Ie){var r=t[a];if(void 0===r&&!W(t,a))return!0;var s=n[a],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 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[Ie];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,Ie,{value:a,writable:!0}),o},S:function(e,n,o){o?V(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 o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)j(a,(function(t){t!==Ie&&(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-_",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,o,a,r,s,l=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=Ot[e.charCodeAt(i)],a=Ot[e.charCodeAt(i+1)],r=Ot[e.charCodeAt(i+2)],s=Ot[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;!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={}));const Ut="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Ct="HOSTED_LOGIN_VERIFIER_KEY",Rt="auth",Dt="connectivity",Nt="auditLogs",Mt="vendor",Ft={flow:Lt.Login,step:_t.preLogin,loading:!1,email:"",tenants:[]},Gt={setLoginState:vt("loginState"),resetLoginState:St("loginState",{loginState:Ft})},$t={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 xt={step:Vt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},jt={setActivateState:vt("activateState"),resetActivateState:St("activateState",{activateState:xt}),setActivateStrategyState:ht("activateState","activationStrategy")},Bt={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 Wt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Wt||(Wt={}));const zt={step:Wt.validate},Kt={setAcceptInvitationState:vt("acceptInvitationState"),resetAcceptInvitationState:St("acceptInvitationState",{acceptInvitationState:zt})},qt={acceptInvitation:yt("auth/acceptInvitation",(e=>({payload:e})))};let Ht;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Ht||(Ht={}));const Jt={step:Ht.forgotPassword,loading:!1,email:"",passwordConfig:null},Yt={setForgotPasswordState:vt("forgotPasswordState"),resetForgotPasswordState:St("forgotPasswordState",{forgotPasswordState:Jt})},Qt={forgotPassword:yt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:yt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:yt("auth/loadPasswordConfig",(e=>({payload:e})))};let Xt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Xt||(Xt={}));const Zt={step:Xt.ResetPhoneNumber,loading:!1},en={setResetPhoneNumberState:vt("resetPhoneNumberState"),resetResetPhoneNumberState:St("resetPhoneNumberState",{resetPhoneNumberState:Zt})},tn={resetPhoneNumber:yt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:yt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:yt("auth/changePhoneNumber",(e=>({payload:e})))},nn={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},on={setSSOLoader:mt("ssoState"),setSSOError:At("ssoState"),setSSOState:vt("ssoState"),resetSSOState:St("ssoState",{ssoState:nn})},an={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})))},rn={loading:!1,error:null},sn={setProfileState:vt("profileState"),resetProfileState:St("profileState",{profileState:rn})},ln={loadProfile:yt("auth/loadProfile"),saveProfile:yt("auth/saveProfile",(e=>({payload:e}))),changePassword:yt("auth/changePassword",(e=>({payload:e})))};let cn;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode"}(cn||(cn={}));const un={step:cn.verify,loading:!1,saving:!1},dn={setMfaState:vt("mfaState"),resetMfaState:St("mfaState",{mfaState:un})},yn={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})))},fn={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}},pn={setTeamLoader:mt("teamState"),setTeamError:At("teamState"),setTeamState:vt("teamState"),resetTeamState:St("teamState",{teamState:fn})},gn={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}))),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})))},Sn={firstLoad:!0,loading:!1,error:""},vn={setSocialLoginsState:vt("socialLoginState"),resetSocialLoginsState:St("socialLoginState",{socialLoginState:Sn})},hn={loadSocialLoginsConfiguration:yt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:yt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:yt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:yt("auth/setSocialLoginError",(e=>({payload:e})))};let mn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(mn||(mn={}));const An={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:mn.SignUp},bn={setSignUpState:vt("signUpState"),resetSignUpState:St("signUpState",{signUpState:An})},Tn={signUpUser:yt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:yt("auth/resetSignUpStateSoft")},En={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},kn={setApiTokensLoader:mt("apiTokensState"),setApiTokensError:At("apiTokensState"),setApiTokensState:vt("apiTokensState"),resetApiTokensState:St("apiTokensState",{apiTokensState:En})},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})))},In={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}},Pn={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:In})},_n={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")},Ln={loading:!1},wn={setAccountSettingsState:vt("accountSettingsState"),resetAccountSettingsState:St("accountSettingsState",{accountSettingsState:Ln})},Un={loadAccountSettings:yt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:yt("auth/saveAccountSettings",(e=>({payload:e})))},Cn={tenants:[],subTenants:[],loading:!0,tenantTree:null},Rn={setTenantsState:vt("tenantsState"),resetTenantsState:St("tenantsState",{tenantsState:Cn})},Dn={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})))},Nn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Mn={setRolesState:vt("rolesState"),resetRolesState:St("rolesState",{rolesState:Nn})},Fn={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})))},Gn={loading:!1,sessions:[]},$n={setSessionsState:vt("sessionsState"),resetSessionsState:St("sessionsState",{sessionsState:Gn})},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})))},xn={loading:!1,configurations:{}},jn={setSessionsPolicyState:vt("sessionsPolicyState"),resetSessionsPolicyState:St("sessionsPolicyState",{sessionsPolicyState:xn})},Bn={loadSessionsPolicy:yt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:yt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Wn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Wn||(Wn={}));const zn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Wn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Kn={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})))},Hn={loading:!1},Jn={setProvisioningState:vt("provisioningState"),resetProvisioningState:St("provisioningState",{provisioningState:Hn})},Yn={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},Xn={setPasskeysState:vt("passkeysState"),resetPasskeysState:St("passkeysState",{passkeysState:Qn})},Zn={loadWebAuthnDevices:yt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:yt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},ei={loaders:{},errors:{},groups:[],groupsConfiguration:{}},ti={setUsersGroupsLoader:mt("groupsState"),setUsersGroupsError:At("groupsState"),setGroupsState:vt("groupsState"),resetUsersGroupsState:St("groupsState",{groupsState:ei})},ni={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})))},ii={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:ii}),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})},ai={loading:!0,error:null},ri={setCustomLoginState:vt("customLoginState"),resetCustomLoginState:St("customLoginState",{customLoginState:ai})},si={loadTenantMetadata:yt("auth/loadTenantMetadata"),updateTenantMetadata:yt("auth/updateTenantMetadata",(e=>({payload:e})))},li={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let ci,ui,di,yi,fi;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ci||(ci={})),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"}(ui||(ui={})),function(e){e.ASC="ASC",e.DESC="DESC"}(di||(di={})),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"}(yi||(yi={})),function(e){e.MFA_UNENROLLED="mfa-unenrolled",e.BREACHED_PASSWORDS="breached-passwords",e.INACTIVE="inactive"}(fi||(fi={}));const pi=["local","saml","google","github","facebook","microsoft","scim2","slack"],gi={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:di.DESC,_sortBy:yi.name},usersPageOffset:0,accountSettings:{}}},Si={setAllAccountsLoader:mt("allAccountsState"),setAllAccountsError:At("allAccountsState"),setAllAccountsState:vt("allAccountsState"),setSelectedAccountState:ht("allAccountsState","selectedAccount"),resetAllAccountsState:St("allAccountsState",{allAccountsState:gi})},vi={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})))},hi={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:[]}},mi={setAllAccountDialogsState:vt("allAccountsDialogsState"),resetAllAccountDialogsState:St("allAccountsDialogsState",{allAccountsDialogsState:hi}),openCreateSubAccountDialog:bt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:Tt("allAccountsDialogsState","createSubAccountDialog",hi.createSubAccountDialog),openUpdateSubAccountDialog:bt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:Tt("allAccountsDialogsState","updateSubAccountDialog",hi.updateSubAccountDialog),openDeleteSubAccountDialog:bt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:Tt("allAccountsDialogsState","deleteSubAccountDialog",hi.deleteSubAccountDialog),openAddUsersToAccountDialog:bt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:Tt("allAccountsDialogsState","addUsersToAccountDialog",hi.addUsersToAccountDialog),openDeleteUserFromAccountDialog:bt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:Tt("allAccountsDialogsState","deleteUserFromAccountDialog",hi.deleteUserFromAccountDialog),openEditUserRolesDialog:bt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:Tt("allAccountsDialogsState","editUserRolesDialog",hi.editUserRolesDialog)},Ai={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}}},bi={setSecurityCenterState:vt("securityCenterState"),resetSecurityCenterState:St("securityCenterState",{securityCenterState:Ai}),setSecurityCenterStateLoader:mt("securityCenterState"),setSecurityCenterStateError:At("securityCenterState")},Ti={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 Ei,ki,Oi;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Ei||(Ei={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(ki||(ki={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Oi||(Oi={}));const Ii={[ki.Code]:_t.loginWithOtc,[ki.EmailAndPassword]:_t.loginWithPassword,[ki.MagicLink]:_t.magicLinkPreLoginSuccess,[ki.SmsCode]:_t.loginWithSmsOtc},Pi={loading:!1,error:null,phoneNumbers:void 0},_i={setSmsState:vt("smsState"),resetSmsState:St("smsState",{smsState:Pi})},Li={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})))},wi={loading:!1,mfaDevices:void 0,mfaToken:""},Ui={setStepUpState:vt("stepUpState"),resetStepUpState:St("stepUpState",{stepUpState:wi})},Ci={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})))},Ri={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:An,loginState:Ft,stepUpState:wi,activateState:xt,acceptInvitationState:zt,forgotPasswordState:Jt,ssoState:nn,profileState:rn,customLoginState:ai,mfaState:un,teamState:fn,groupsState:ei,groupsDialogsState:ii,socialLoginState:Sn,apiTokensState:En,securityPolicyState:In,accountSettingsState:Ln,tenantsState:Cn,rolesState:Nn,resetPhoneNumberState:Zt,sessionsState:Gn,sessionsPolicyState:xn,restrictionsState:zn,provisioningState:Hn,passkeysState:Qn,allAccountsState:gi,allAccountsDialogsState:hi,securityCenterState:Ai,smsState:Pi},Di=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:()=>{}},Ri);let Ni;!function(e){e.impersonating="impersonating",e.success="success"}(Ni||(Ni={}));const Mi={step:Ni.impersonating,loading:!1},Fi={setImpersonateState:vt("impersonateState"),resetImpersonateState:St("impersonateState",{impersonateState:Mi})},Gi={impersonate:yt("impersonation/impersonate",(e=>({payload:e})))},{reducer:$i,actions:Vi}=pt({name:Rt,initialState:Di,reducers:D({resetState:e=>D({},e,Ri),setState:(e,{payload:t})=>D({},e,t),setUser:("user",(e,{payload:t})=>D({},e,{user:t})),setEntitlements:ht("user","entitlements")},Gt,Ui,vn,jt,Fi,Kt,Yt,en,bn,sn,ri,on,dn,pn,ti,oi,kn,Pn,wn,Rn,Mn,$n,jn,Kn,Jn,Xn,Si,mi,bi,_i)});const xi=D({loadEntitlements:yt("auth/loadEntitlements",(e=>({payload:e})))},Vi,$t,Ci,hn,Bt,qt,Qt,tn,Tn,ln,si,an,yn,gn,ni,{},On,_n,Un,Dn,Fn,Vn,Bn,qn,Yn,Gi,Zn,vi,Ti,Li);var ji=function(e){return"@@redux-saga/"+e},Bi=ji("CANCEL_PROMISE"),Wi=ji("CHANNEL_END"),zi=ji("IO"),Ki=ji("MATCH"),qi=ji("MULTICAST"),Hi=ji("SAGA_ACTION"),Ji=ji("SELF_CANCELLATION"),Yi=ji("TASK"),Qi=ji("TASK_CANCEL"),Xi=ji("TERMINATE"),Zi=ji("LOCATION");function eo(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 to=function(e){return null==e},no=function(e){return null!=e},io=function(e){return"function"==typeof e},oo=function(e){return"string"==typeof e},ao=Array.isArray,ro=function(e){return e&&io(e.then)},so=function(e){return e&&io(e.next)&&io(e.throw)},lo=function e(t){return t&&(oo(t)||yo(t)||io(t)||ao(t)&&t.every(e))},co=function(e){return e&&io(e.take)&&io(e.close)},uo=function(e){return io(e)&&e.hasOwnProperty("toString")},yo=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},fo=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[Bi]=function(){clearTimeout(n)},i},po=function(e){return function(){return e}},go=po(!0),So=function(){},vo=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var ho=function(e,t){D(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function mo(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Ao=function(e){throw e},bo=function(e){return{value:e,done:!0}};function To(e,t,n){void 0===t&&(t=Ao),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:bo,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Eo(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var ko=function(e){return Array.apply(null,new Array(e))},Oo=function(e){return function(t){return e(Object.defineProperty(t,Hi,{value:!0}))}},Io=function(e){return e===Xi},Po=function(e){return e===Qi},_o=function(e){return Io(e)||Po(e)};function Lo(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=ao(e)?ko(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||_o(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=So,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function wo(e){return{name:e.name||"anonymous",location:Uo(e)}}function Uo(e){return e[Zi]}var Co=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)},Ro="TAKE",Do="CALL",No="FORK",Mo="SELECT",Fo=function(e,t){var n;return(n={})[zi]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Go(e,t){return void 0===e&&(e="*"),lo(e)?(no(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Fo(Ro,{pattern:e})):co(n=e)&&n[qi]&&no(t)&&lo(t)?Fo(Ro,{channel:e,pattern:t}):co(e)?(no(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Fo(Ro,{channel:e})):void 0;var n}function $o(e,t){return to(t)&&(t=e,e=void 0),Fo("PUT",{channel:e,action:t})}function Vo(e){var t=Fo("ALL",e);return t.combinator=!0,t}function xo(e,t){var n,i=null;return io(e)?n=e:(ao(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&oo(n)&&io(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function jo(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 Fo(Do,xo(e,n))}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 Fo(No,xo(e,n))}function Wo(e){return void 0===e&&(e=Ji),Fo("CANCEL",e)}function zo(e){void 0===e&&(e=vo);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Fo(Mo,{selector:e,args:n})}var Ko=jo.bind(null,fo);var qo=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Ho=[],Jo=0;function Yo(e){try{Zo(),e()}finally{ea()}}function Qo(e){Ho.push(e),Jo||(Zo(),ta())}function Xo(e){try{return Zo(),e()}finally{ta()}}function Zo(){Jo++}function ea(){Jo--}function ta(){var e;for(ea();!Jo&&void 0!==(e=Ho.shift());)Yo(e)}var na=function(e){return function(t){return e.some((function(e){return sa(e)(t)}))}},ia=function(e){return function(t){return e(t)}},oa=function(e){return function(t){return t.type===String(e)}},aa=function(e){return function(t){return t.type===e}},ra=function(){return go};function sa(e){var t="*"===e?ra:oo(e)?oa:ao(e)?na:uo(e)?oa:io(e)?ia:yo(e)?aa:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var la={type:Wi},ca=function(e){return e&&e.type===Wi};function ua(){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(la)}))},(e={})[qi]=!0,e.put=function(e){if(!t)if(ca(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[Ki](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=ra),t?e(la):(e[Ki]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),mo(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[Hi]?s(e):Qo((function(){s(e)}))},r}function da(e,t){var n=e[Bi];io(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var ya,fa=0,pa=function(){return++fa};function ga(e){e.isRunning()&&e.cancel()}var Sa=((ya={}).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):!ca(e)||r?n(e):n(Xi)};try{o.take(s,no(a)?sa(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},ya.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&&ro(t)?da(t,n):n(t)}))},ya.ALL=function(e,t,n,i){var o=i.digestEffect,a=fa,r=Object.keys(t);if(0!==r.length){var s=Lo(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(ao(t)?[]:{})},ya.RACE=function(e,t,n,i){var o=i.digestEffect,a=fa,r=Object.keys(t),s=ao(t)?ko(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||_o(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=So,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)}))},ya.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(ro(l))return void da(l,n);if(so(l))return void Ia(e,l,s.context,fa,wo(a),!1,n);n(l)}catch(e){n(e,!0)}},ya.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){to(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},ya.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(so(o))return o;var a=!1;return To((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!ro(o)})}))}catch(e){return To((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:wo(t)}(c,a);Xo((function(){var t=Ia(e,c,l.context,fa,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},ya.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()&&mo(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(ao(t)){if(0===t.length)return void n([]);var r=Lo(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},ya.CANCEL=function(e,t,n,i){var o=i.task;t===Ji?ga(o):ao(t)?t.forEach(ga):ga(t),n()},ya.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)}},ya.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Co());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(la):e.isEmpty()?(n.push(i),i.cancel=function(){mo(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(la):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])(la)}}}}(t.buffer),a=sa(i),r=function t(n){ca(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)},ya.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},ya.FLUSH=function(e,t,n){t.flush(n)},ya.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},ya.SET_CONTEXT=function(e,t,n,i){var o=i.task;ho(o.context,t),n()},ya);function va(e,t){return e+"?"+t}function ha(e){var t=e.name,n=e.location;return n?t+" "+va(n.fileName,n.lineNumber):t}function ma(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 Aa=null,ba=[],Ta=function(e){e.crashedEffect=Aa,ba.push(e)},Ea=function(){Aa=null,ba.length=0},ka=function(){var e,t,n=ba[0],i=ba.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=Uo(e))?t.code+" "+va(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+ha(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+ha(e.meta)})),[ma(ba)]).join("\n")};function Oa(e,t,n,i,o,a,r){var s;void 0===r&&(r=So);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||(mo(o,t),t.cont=So,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=So,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,Ta({meta:o,cancelledTasks:y}),S.isRoot){var i=ka();Ea(),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={})[Yi]=!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){ho(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 Ia(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){ro(t)?da(t,i):so(t)?Ia(e,t,c.context,n,o,!1,i):t&&t[zi]?(0,Sa[t.type])(e,t.payload,i,u):i(t)}));d.cancel=So;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),Ea()):Po(e)?(l.status=1,d.cancel(),o=io(t.return)?t.return(Qi):{done:!0,value:Qi}):o=Io(e)?io(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=pa();function l(n,o){a||(a=!0,i.cancel=So,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){Aa=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=So,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=So,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function Pa(e,t){for(var n=e.channel,i=void 0===n?ua():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?Eo: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=pa();if(l&&(l.rootSagaStarted=l.rootSagaStarted||So,l.effectTriggered=l.effectTriggered||So,l.effectResolved=l.effectResolved||So,l.effectRejected=l.effectRejected||So,l.effectCancelled=l.effectCancelled||So,l.actionDispatched=l.actionDispatched||So,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=qe.apply(void 0,c);g=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else g=vo;var m={channel:i,dispatch:Oo(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:g};return Xo((function(){var e=Ia(m,S,s,v,wo(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var _a=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?ua():a,s=n.sagaMonitor,l=eo(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Pa.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){ho(o,e)},c},La=function(e){return{done:!0,value:e}},wa={};function Ua(e){return co(e)?"channel":uo(e)?String(e):io(e)?e.name:String(e)}function Ca(e,t,n){var i,o,a,r=t;function s(t,n){if(r===wa)return La(t);if(n&&!o)throw r=wa,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===wa?La(t):a}return To(s,(function(e){return s(null,e)}),n)}function Ra(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:Go(e)},s=function(e){return{done:!1,value:Bo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Ca({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+Ua(e)+", "+t.name+")")}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,s={done:!1,value:Go(e)},l=function(e){return{done:!1,value:Bo.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:Wo(e)}},u=function(e){return a=e},d=function(e){return r=e};return Ca({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("+Ua(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={done:!1,value:Go(e)},s=function(e){return{done:!1,value:jo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Ca({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+Ua(e)+", "+t.name+")")}function Ma(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:jo.apply(void 0,[n].concat(a))},l={done:!1,value:Ko(t)};return Ca({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:wa}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function Fa(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 Bo.apply(void 0,[Ra,e,t].concat(i))}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 Bo.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 Bo.apply(void 0,[Na,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 xa={getContext:()=>Va.getContext(),getAccessToken:()=>Va.getAccessToken(),getUser:()=>Va.getUser(),onRedirectTo:(e,t)=>Va.onRedirectTo(e,t),logout:e=>Va.logout(e)};class ja extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Ba={v1:"/identity/resources/users/webauthn/v1/devices"},Wa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},za={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"}},Ka={v1:"/identity/resources/configurations/v1"},qa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Ha={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ja={v1:"/identity/resources/permissions/v1"},Ya={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"},Xa={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Za={v1:"/identity/resources/impersonation/v1"},er={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},tr={v1:"/identity/resources/users/phone-numbers/v1"},nr={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},ir={v1:"/team/resources/members/v1"},or={v1:"/team/resources/roles/v1"},ar={v1:"/team/resources/stats/v1"},rr={v1:"/team/resources/profile"},sr={v1:"/tenants/resources/account-settings/v1"},lr={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"}},cr={v1:"/tenants/resources/sub-tenants/v1"},ur={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},dr={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"}}}},yr={v1:"/subscriptions/resources/payment-providers/v1"},fr={v1:"/subscriptions/resources/subscriptions/v1"},pr={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},gr={v1:"/reports/engine/resources/triggers/v1"},Sr="/notification",vr="/audits",hr={v1:"/event/resources/configurations/v1"},mr="/webhook",Ar="/oauth",br="/flags",Tr="/directory/resources/v1/configurations/scim2",Er="/directory/resources/scim/temp",kr="/entitlements/api/v1/user-entitlements",Or="/entitlements/api/v2/user-entitlements",Ir={v1:"/security-center/resources/recommendations/v1"},Pr={v1:"/security-center/resources/insights/v1"};function _r(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 Lr(e){var t,n;const i={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(i[li.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(i[li.frameWork]=e.metadataHeaders.framework),i}const wr=async e=>{var t,n,i;const o=Va.getContext(),a=await async function(e,t){var n;const i=Lr(e),o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Va.getAccessToken)(),a=Va.getRequestSource();t&&(i[li.contentType]=t),a&&(i[li.source]=a),o&&(i.Authorization=`Bearer ${o}`);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))i[`${t.key}`]=`${t.value}`;return i}(o,e.contentType),r=await async function(e,t,n){const i=_r(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 ja("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 ja(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{}}},Ur=async(e,t,n)=>wr(D({url:e,method:"GET",contentType:"application/json",params:t},n)),Cr=async(e,t,n)=>wr(D({url:e,method:"POST",contentType:"application/json",body:t},n)),Rr=async(e,t,n)=>wr(D({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Dr=async(e,t,n)=>wr(D({url:e,method:"PUT",contentType:"application/json",body:t},n)),Nr=async(e,t,n)=>wr(D({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Mr=async(e,t,n,i)=>wr(D({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),Fr=(e={})=>D({},e.jwt?{Authorization:e.jwt}:{}),Gr="FRONTEGG_SEPARATE_TABS_BY_TENANT",$r="admin_portal_use_entitlements_v2_endpoint",Vr={flags:{}};class xr{constructor(){var e;this._flags={},this._flags=null!=(e=Vr.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new xr;return n.set(e),xr._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==Vr?void 0:Vr.flags)?t:{},null!=e?e:{})}}async function jr(){return Ur(br)}async function Br(e){return Cr(`${za.v3}/me/token`,e)}async function Wr(e,t){return Ur(za.v2,e,{headers:Fr(t)})}async function zr(e,t){return Ur(za.v3,e,{headers:Fr(t)})}async function Kr(e,t){return Ur(za.roles.v3,D({},e,{ids:e.ids.join(",")}),{headers:Fr(t)})}async function qr(e,t){return Ur(za.groups.v3,D({},e,{ids:e.ids.join(",")}),{headers:Fr(t)})}async function Hr(e){return Ur(za.tenants.me.v3,void 0,{headers:Fr(e)})}async function Jr(e){return Ur(za.tenants.me.v1,void 0,{headers:Fr(e)})}async function Yr(){return Cr(za.passwords.resetBreachedPasswords.v1)}async function Qr(e){return Dr(`${za.v2}/me`,e)}function Xr(e){e&&sessionStorage.setItem(Gr,e)}function Zr(){return Va.isSessionPerTenantEnabled()?sessionStorage.getItem(Gr):null}function es(){const[e]=xr.getFeatureFlags(["admin_portal_use_current_user_tenants_v1_endpoint"],Va.getAppName()||"");return Va.isSessionPerTenantEnabled()||e?Jr:Hr}async function ts(e){return Va.isSessionPerTenantEnabled()&&Xr(e.tenantId),Dr(`${za.v1}/tenant`,e)}async function ns(){return Ur(`${za.v2}/me/tenants`)}async function is(e){return Ur(lr.v1,void 0,{headers:Fr(e)})}async function os(e){return Ur(lr.tree.v1,void 0,{headers:Fr(e)})}async function as(e){return Ur(lr.parents.v1,void 0,{headers:Fr(e)})}async function rs(e,t){return Ur(`${lr.parents.v1}/${e}`,void 0,{headers:Fr(t)})}async function ss(e,t){return Cr(`${Ya.users.v1}/count`,e,{headers:Fr(t)})}async function ls(e,t){return Ur(lr.v2,e,{headers:Fr(t)})}async function cs(e,t){return Ur(lr.metadata.v2,D({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Fr(t)})}async function us(){return Ur(Ka.v1)}async function ds(){return Ur(`${Ka.v1}/mfa-policy`)}async function ys(){return Ur(`${Ka.v1}/mfa-policy/vendor`)}async function fs(e){return e.id?Rr(`${Ka.v1}/mfa-policy`,e):Cr(`${Ka.v1}/mfa-policy`,e)}async function ps(){return Ur(`${Ka.v1}/lockout-policy`)}async function gs(){return Ur(`${Ka.v1}/lockout-policy/vendor`)}async function Ss(e){return e.id?Rr(`${Ka.v1}/lockout-policy`,e):Cr(`${Ka.v1}/lockout-policy`,e)}async function vs(){try{return await Ur(`${Ka.v1}/captcha-policy/public`)}catch{return null}}async function hs(){return Ur(`${Ka.v1}/password-history-policy`)}async function ms(){return Ur(`${Ka.v1}/password-history-policy/vendor`)}async function As(e){return e.id?Rr(`${Ka.v1}/password-history-policy`,e):Cr(`${Ka.v1}/password-history-policy`,e)}async function bs(){return Ur(`${Ka.v1}/password`)}async function Ts(){return Ur(`${qa.emailDomain.v1}`)}async function Es(){return Ur(`${qa.emailDomain.v1}/config`)}async function ks(e){return Cr(`${qa.emailDomain.v1}`,e)}async function Os(e){return Cr(`${qa.emailDomain.v1}/config`,e)}async function Is(e){return Nr(`${qa.emailDomain.v1}/${e}`)}async function Ps(e){return Ur(`${qa.ip.v1}`,e)}async function _s(){return Ur(`${qa.ip.v1}/config`)}async function Ls(e){return Cr(`${qa.ip.v1}`,e)}async function ws(e){return Cr(`${qa.ip.v1}/bulk`,e)}async function Us(e){return Cr(`${qa.ip.v1}/config`,e)}async function Cs(e){return Nr(`${qa.ip.v1}/${e}`)}async function Rs(){return Cr(`${qa.ip.v1}/verify`)}async function Ds(){return Cr(`${qa.ip.v1}/verify/allow`)}xr._instances={};class Ns extends Error{constructor(e){super(e)}}const Ms="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Ns("'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 Fs extends Error{constructor(e){super(e)}}const Gs=(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(Ms(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 Ms(t)}})(e.split(".")[n]))}catch(e){throw new Fs("Invalid token specified: "+e.message)}};let $s,Vs,xs;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}($s||($s={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Vs||(Vs={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(xs||(xs={}));const js="admin_portal_should_load_authorization";async function Bs(){return Ur(kr)}async function Ws(){return Ur(Or)}let zs;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(zs||(zs={}));const Ks="admin_portal_entitlements",qs=["type"],Hs=["type"],Js=["type"];async function Ys(e){if(!e.accessToken)return e;Va.setAccessToken(e.accessToken);const t=await Fu(),n=D({},e,e.accessToken?Gs(e.accessToken):{},t);return Va.setUser(n),n}async function Qs(e){if(!e.accessToken)return{user:e};Va.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Fu(),ns()]),i=D({},e,e.accessToken?Gs(e.accessToken):{},t);return Va.setUser(i),{user:i,tenants:n}}function Xs(){if(!Va.shouldLoadEntitlements())return!1;const[e]=xr.getFeatureFlags([Ks],Va.getAppName()||"");return e}function Zs(){const[e]=xr.getFeatureFlags([js],Va.getAppName()||"");return e}async function el(e){const{accessToken:t}=e;if(!t)return{user:e};Va.setAccessToken(t);const[n,i]=await Promise.all([Fu(),es()()]),o=D({},e,t?Gs(t):{},n);return Va.isSessionPerTenantEnabled()&&Xr(o.tenantId),Va.setUser(o),{user:o,tenants:i.tenants,activeTenant:i.activeTenant}}async function tl(e){Va.setAccessToken(e.id_token);const t=await Fu(),n=e.id_token?Gs(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 nl(e){Va.setAccessToken(e.id_token);const[t,n]=await Promise.all([Fu(),es()()]),i=e.id_token?Gs(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()&&Xr(o.tenantId),Va.setUser(o),{user:o,tenants:n.tenants,activeTenant:n.activeTenant}}async function il(e){try{const{address:t}=await Cr(`${Wa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function ol(e){return Cr(`${Wa.v1}/user/saml/prelogin`,e)}async function al(e){return Ys(await Cr(`${Wa.v1}/user/saml/postlogin`,e))}async function rl(e){return Ys(await Cr(`${Wa.v1}/user/oidc/postlogin`,e))}async function sl(e){return Ys(await Cr(`${Wa.v1}/user`,e))}async function ll(e){return el(await Cr(`${Wa.v1}/user`,e))}async function cl(e){return Ys(await Cr(`${Wa.v1}/user/mfa/verify`,e))}async function ul(e){return el(await Cr(`${Wa.v1}/user/mfa/verify`,e))}async function dl(e){return Cr(`${za.v1}/activate`,e)}async function yl(e){return el(await Cr(`${za.v1}/activate`,e))}async function fl(e){return Ur(`${za.v1}/activate/strategy`,e)}async function pl(e){return Cr(`${za.v1}/activate/reset`,e)}async function gl(e){return Cr(`${za.v1}/invitation/reset`,e)}async function Sl(e){return Cr(`${za.v1}/invitation/accept`,e)}async function vl(){const e=Zr();return Ys(await Cr(`${Wa.v1}/user/token/refresh`,{tenantId:e}))}async function hl(){const e=Zr();return Qs(await Cr(`${Wa.v1}/user/token/refresh`,{tenantId:e}))}async function ml(){const e=Zr();return el(await Cr(`${Wa.v1}/user/token/refresh`,{tenantId:e}))}async function Al(){return Cr(`${Wa.v1}/logout`)}async function bl(e){return Ur(`${Ar}/logout`,e)}async function Tl(e){return Cr(`${za.v1}/passwords/reset`,e)}async function El(e){return Cr(`${za.v1}/passwords/reset/verify`,e)}async function kl(e){return Ur(`${za.v1}/passwords/config`,e)}async function Ol(e){return Cr(`${Wa.v1}/user/mfa/recover`,e)}async function Il(){return Cr(`${za.v1}/mfa/enroll`)}async function Pl(){return Cr(`${za.v1}/mfa/authenticator/enroll`)}async function _l(e){return Cr(`${za.v1}/mfa/authenticator/enroll/verify`,e)}async function Ll(e){return Cr(`${za.v1}/mfa/sms/enroll`,e)}async function wl(e){return Cr(`${za.v1}/mfa/sms/enroll/verify`,e)}async function Ul(){return Cr(`${za.v1}/mfa/webauthn/enroll`)}async function Cl(e){return Cr(`${za.v1}/mfa/webauthn/enroll/verify`,e)}async function Rl(e){return Cr(`${za.v1}/mfa/enroll/verify`,e)}async function Dl(e){return Cr(`${za.v1}/mfa/disable`,e)}async function Nl(e,t){return Cr(`${za.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Ml(e){return Cr(`${za.v1}/mfa/sms/${e}/disable`)}async function Fl(e,t){return Cr(`${za.v1}/mfa/sms/${e}/disable/verify`,t)}async function Gl(e){return Cr(`${za.v1}/mfa/webauthn/${e}/disable`)}async function $l(e,t){return Cr(`${za.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Vl(){return Ur(`${za.v1}/mfa/devices`)}async function xl(e){return Cr(`${Wa.v1}/user/mfa/authenticator/enroll`,e)}async function jl(e){return Cr(`${Wa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Bl(e){return el(await Cr(`${Wa.v1}/user/mfa/authenticator/enroll/verify`,e))}async function Wl(e,t){return Cr(`${Wa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function zl(e){return Cr(`${Wa.v1}/user/mfa/emailcode`,e)}async function Kl(e){return Cr(`${Wa.v1}/user/mfa/emailcode/verify`,e)}async function ql(e){return el(await Cr(`${Wa.v1}/user/mfa/emailcode/verify`,e))}async function Hl(e){return Cr(`${Wa.v1}/user/mfa/sms/enroll`,e)}async function Jl(e){return Cr(`${Wa.v1}/user/mfa/sms/enroll/verify`,e)}async function Yl(e){return el(await Cr(`${Wa.v1}/user/mfa/sms/enroll/verify`,e))}async function Ql(e,t){return Cr(`${Wa.v1}/user/mfa/sms/${e}`,t)}async function Xl(e,t){return Cr(`${Wa.v1}/user/mfa/sms/${e}/verify`,t)}async function Zl(e,t){return el(await Cr(`${Wa.v1}/user/mfa/sms/${e}/verify`,t))}async function ec(e){return Cr(`${Wa.v1}/user/mfa/webauthn/enroll`,e)}async function tc(e){return Cr(`${Wa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function nc(e){return el(await Cr(`${Wa.v1}/user/mfa/webauthn/enroll/verify`,e))}async function ic(e,t){return Cr(`${Wa.v1}/user/mfa/webauthn/${e}`,t)}async function oc(e,t){return Cr(`${Wa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function ac(e,t){return el(await Cr(`${Wa.v1}/user/mfa/webauthn/${e}/verify`,t))}async function rc(){return Ur(`${nr.v1}/saml/configurations`)}async function sc(e){return Cr(`${nr.v1}/saml/configurations`,e)}async function lc(){return Ur(`${nr.v1}/saml/configurations/vendor-config`)}async function cc(e){return Dr(`${nr.v1}/saml/configurations/metadata`,e)}async function uc(){return Dr(`${nr.v1}/saml/validations/domain`)}async function dc(){return Ur(`${nr.v1}/saml/configurations/roles/default`)}async function yc(){return Ur(`${nr.v2}/saml/configurations/groups`)}async function fc({roleIds:e}){return Cr(`${nr.v1}/saml/configurations/roles/default`,{roleIds:e})}async function pc({roleIds:e,group:t}){return Cr(`${nr.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function gc({roleIds:e,group:t,id:n}){return Rr(`${nr.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Sc({id:e}){return Nr(`${nr.v2}/saml/configurations/groups/${e}`)}async function vc(){return Ur(`${nr.v1}/oidc/configurations`)}async function hc(){return Ur(`${nr.v2}/configurations/public`)}async function mc(){return Ur(Ha.v1)}async function Ac(){return Ur(Ha.v2)}async function bc(){return Ur(`${Ha.v2}/authenticated`)}async function Tc(){return Ur(Ha.custom.v1)}async function Ec({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),Cr(`${Wa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function kc(){return Ur(`${Ka.v1}/public`)}async function Oc(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Cr(`${za.v1}/signUp`,e),a={shouldActivate:t,userId:i,tenantId:o};if(!t&&n){const{user:e,tenants:t,activeTenant:i}=await el(n);return D({},a,{user:e,tenants:t,activeTenant:i})}return a}async function Ic(){return Ur(za.sessions.currentUser.v1)}async function Pc(){return Ur(`${za.sessions.currentUser.v1}/current`)}async function _c(e){return Cr(`${za.sessions.v1}/revoke`,{userId:e})}async function Lc(){return Ur(za.sessions.configurations.v1)}async function wc(e){await Cr(za.sessions.configurations.v1,e)}async function Uc(e){await Nr(`${za.sessions.currentUser.v1}/${e}`)}async function Cc(){await Nr(`${za.sessions.currentUser.v1}/all`)}async function Rc(){return Ur(za.accessTokens.v1)}async function Dc(){return Ur(Ya.accessTokens.v1)}async function Nc({id:e}){return Nr(`${Ya.accessTokens.v1}/${e}`)}async function Mc({id:e}){return Nr(`${za.accessTokens.v1}/${e}`)}async function Fc(e){return Cr(za.accessTokens.v1,e)}async function Gc(e){return Cr(Ya.accessTokens.v1,e)}async function $c(){return Ur(za.apiTokens.v1)}async function Vc(){return Ur(Ya.apiTokens.v1)}async function xc(e){return Cr(za.apiTokens.v1,e)}async function jc(e){return Cr(Ya.apiTokens.v2,e)}async function Bc({tokenId:e}){return Nr(`${Ya.apiTokens.v1}/${e}`)}async function Wc({tokenId:e}){return Nr(`${za.apiTokens.v1}/${e}`)}async function zc({userId:e}){return Ur(`${za.v1}/${e}`)}async function Kc(e){return Ur(`${Ka.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function qc(e){let{type:t}=e,n=eo(e,qs);return Cr(`${Wa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Hc(e){let{type:t}=e,n=eo(e,Hs);return el(await Cr(`${Wa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function Jc(e){let{type:t}=e,n=eo(e,Js);return Cr(`${Wa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Yc({token:e}){return Cr(Ya.invites.verify.v1,{token:e})}async function Qc(){return Ur(`${nr.v1}/configurations`)}async function Xc(e){return Cr(`${nr.v1}/configurations`,e)}async function Zc(e,t){return Rr(`${nr.v1}/configurations/${e}`,t)}async function eu(e){return Nr(`${nr.v1}/configurations/${e}`)}async function tu(e){return Cr(`${nr.v1}/configurations/metadata`,e)}async function nu(e,t){return Dr(`${nr.v1}/configurations/${e}/metadata`,t)}async function iu(e){return Cr(`${nr.v1}/configurations/metadata-url`,e)}async function ou(e,t){return Dr(`${nr.v1}/configurations/${e}/metadata-url`,t)}async function au(e,t){return Cr(`${nr.v1}/configurations/${e}/domains`,t)}async function ru(e,t){return Nr(`${nr.v1}/configurations/${e}/domains/${t}`)}async function su(e,t){return Dr(`${nr.v1}/configurations/${e}/domains/${t}/validate`)}async function lu(e){return Ur(`${nr.v1}/configurations/${e}/roles`)}async function cu(e,t){return Dr(`${nr.v1}/configurations/${e}/roles`,t)}async function uu(e,t){return Cr(`${nr.v1}/configurations/${e}/groups`,t)}async function du(e,{roleIds:t,group:n,id:i}){return Rr(`${nr.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function yu(e,t){return Nr(`${nr.v1}/configurations/${e}/groups/${t}`)}async function fu(e){return Ur(`${nr.v1}/configurations/${e}/groups`)}async function pu(e){return Cr(`${Wa.v2}/user/sso/prelogin`,e)}async function gu(e){return Ys(await Cr(`${Wa.v2}/user/oidc/postlogin`,e))}async function Su(e){return nl(await Cr(`${Ar}/token`,e))}async function vu(){const e=Zr();return nl(await Cr(`${Ar}/authorize/silent`,{tenantId:e}))}async function hu(e){return tl(await Cr(`${Ar}/token`,e))}async function mu(){const e=Zr();return tl(await Cr(`${Ar}/authorize/silent`,{tenantId:e}))}async function Au(e){return Cr(`${za.v1}/phone/reset`,e)}async function bu(e){return Cr(`${za.v1}/phone/reset/verify`,e)}async function Tu(e){return Cr(`${za.v1}/phone`,e)}async function Eu(e){return Cr(`${za.v1}/phone/verify`,e)}async function ku(e){return Dr(`${za.v1}/phone/change`,e)}async function Ou(e){return Cr(`${Wa.v1}/webauthn/prelogin`,e)}async function Iu(e){return Cr(`${Wa.v1}/webauthn/postlogin`,e)}async function Pu(e){return el(await Cr(`${Wa.v1}/webauthn/postlogin`,e))}async function _u(){return Cr(Ba.v1)}async function Lu(){return Ur(Ba.v1)}async function wu(e){return Nr(`${Ba.v1}/${e}`)}async function Uu(e){return Cr(`${Ba.v1}/verify`,e)}async function Cu(){return Ur(`${Ka.v1}/auth/strategies/public`)}async function Ru(){return Ur(`${Ka.v1}/auth/strategies`)}async function Du(){return Ur(`${Ka.v1}/mfa/strategies`)}async function Nu(){return Ur(`${za.authorization.v1}`)}async function Mu(){return Ur(`${za.v2}/me`)}async function Fu(){const[e]=xr.getFeatureFlags([$r],Va.getAppName()||""),t=[{action:Mu,shouldLoad:!0},{action:e?Ws:Bs,shouldLoad:Xs()},{action:Nu,shouldLoad:Zs()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[n,i,o]=await Promise.all(t),a=Zr();return a&&(n.tenantId=a),D({},n,null!=o?o:{},{entitlements:i})}async function Gu(e){return Cr(`${Wa.v1}/user/step-up/generate`,e)}async function $u(e){return Ur(`${za.v2}/me`,null!=e?e:{addRoles:!0})}async function Vu(e){return Dr(`${za.v2}/me`,e)}async function xu(e){return Dr(`${rr.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function ju(e){return Cr(`${za.v1}/passwords/change`,e)}async function Bu(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 Ur(ir.v1,D({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function Wu(e){return Cr(za.v2,D({},e,{provider:"local"}))}async function zu(e){return Nr(`${ir.v1}/${e.userId}`)}async function Ku(e){return Dr(ir.v1,e)}async function qu(e){return Cr(Ya.invites.user.v1,D({},e))}async function Hu(e){return Rr(Ya.invites.user.v1,D({},e))}async function Ju(){return Nr(Ya.invites.user.v1)}async function Yu(){return Ur(Ya.invites.user.v1)}async function Qu(){return Ur(Ya.invites.configuration.v1)}async function Xu(){return Ur(or.v1)}async function Zu(){return Ur(Ja.v1)}async function ed(){return Ur(`${ar.v1}/members`)}async function td(e){return Cr(`${ir.v1}/${e.userId}/resendActivationEmail`,{})}async function nd(e){return Cr(za.v2,D({},e,{provider:"local"}))}async function id(e){return Cr(za.invitation.resendAll.v1,D({},e))}async function od(e){var t,n;const i=await Ur("/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 ad(){return Ur("/metadata/admin-box")}async function rd(e){return Cr("/metadata/admin-box",e)}async function sd(){const e=await Ur("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const ld=async()=>od({entityName:"notifications"}),cd=async()=>od({entityName:"saml"}),ud=async()=>od({entityName:"audits"}),dd=async e=>async function(e){const t=await Ur(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),yd=["dataFilters"],fd=["templateId","dataFilters"],pd=["dataFilters"];async function gd(e){return Ur(`${pr.v2}/tenant-reports`,e)}async function Sd(e){return Ur(`${pr.v2}/${e.id}/tenant-reports`)}async function vd(e){let{dataFilters:t}=e,n=eo(e,yd);return{html:await Ur(`${gr.v1}/preview-report`,D({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function hd(e){let{templateId:t,dataFilters:n}=e,i=eo(e,fd);return Cr(`${pr.v2}/${t}/tenant-reports`,D({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function md(e){let{dataFilters:t}=e,n=eo(e,pd);const i=await Ur(`${gr.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 Ad(e){return Cr(`${gr.v1}/tenant-reports`,e)}async function bd(e){return Ur(Sr,{params:e})}async function Td(e){return Dr(`${Sr}/status`,{params:e})}async function Ed(e){const{notificationId:t,pinStatus:n}=e;return Dr(`${Sr}/${n}`,{notificationId:t})}async function kd(){return Cr(`${Sr}/status/mark-all-read`)}const Od=["endpoint","headerProps"];async function Id(e){return Ur(vr,e)}async function Pd(e){return Ur(`${vr}/stats`,e)}async function _d(e){const{endpoint:t,headerProps:n}=e,i=eo(e,Od);return Mr(`${vr}/export/${t}`,{properties:n},i)}const Ld=["eventKey"],wd=["eventKey"],Ud=()=>Ur(`${ur.v1}/slack`),Cd=()=>Ur(`${ur.v1}/slack/applications`),Rd=()=>Ur(`${ur.v1}/slack/channels`),Dd=e=>e.id?Rr(`${ur.v1}/slack/subscription/${e.id}`,e):Cr(`${ur.v1}/slack/subscriptions`,e),Nd=e=>Nr(`${ur.v1}/slack/subscriptions/${e.id}`),Md=e=>Cr(`${ur.v1}/slack/applications/registrations`,{code:e}),Fd=()=>Ur(`${ur.v1}/emails`),Gd=e=>{let{eventKey:t}=e,n=eo(e,Ld);return Cr(`${ur.v1}/emails/${t}`,n)},$d=({eventKey:e,enabled:t})=>Rr(`${ur.v1}/emails/${e}`,{enabled:t}),Vd=(e,t)=>Nr(`${ur.v1}/emails/${e}/subscriptions/${t}`),xd=(e,t,n)=>Dr(`${ur.v1}/emails/${t}/subscriptions/${e}`,n),jd=e=>Nr(`${ur.v1}/emails/${e}`),Bd=()=>Ur(`${ur.v2}/sms`),Wd=e=>{let{eventKey:t}=e,n=eo(e,wd);return Cr(`${ur.v2}/sms/${t}`,n)},zd=({eventKey:e,enabled:t})=>Rr(`${ur.v2}/sms/${e}`,{enabled:t}),Kd=(e,t)=>Nr(`${ur.v2}/sms/${e}/subscriptions/${t}`),qd=(e,t,n)=>Dr(`${ur.v2}/sms/${t}/subscriptions/${e}`,n),Hd=e=>Nr(`${ur.v2}/sms/${e}`),Jd=()=>Ur(mr),Yd=e=>e._id?Rr(`${mr}/${e._id}`,e):Cr(`${mr}/custom`,e),Qd=e=>Nr(`${mr}/${e}`),Xd=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Ur(`${mr}/logs/?${i.toString()}`)},Zd=e=>Cr(`${mr}/test`,e),ey=e=>Cr(`${mr}/logs/${e}/retries`),ty=()=>Ur(`${hr.v1}/categories`),ny=e=>Ur(hr.v1,{channels:e});async function iy(e,t){return Dr(sr.v1,e,{headers:Fr(t)})}async function oy(e){return Ur(sr.v1,void 0,{headers:Fr(e)})}async function ay(){return Ur(`${sr.v1}/public`)}const ry=["roleId"],sy=["roleId"],ly=["permissionId"];async function cy(){return Ur(Qa.v1)}async function uy(e){return Cr(Qa.v1,e)}async function dy({roleId:e}){return Nr(`${Qa.v1}/${e}`)}async function yy(e){let{roleId:t}=e,n=eo(e,ry);return Rr(`${Qa.v1}/${t}`,n)}async function fy(e){let{roleId:t}=e,n=eo(e,sy);return Dr(`${Qa.v1}/${t}/permissions`,n)}async function py(){return Ur(Ja.v1)}async function gy(e){let{permissionId:t}=e,n=eo(e,ly);return Dr(`${Ja.v1}/${t}/roles`,n)}async function Sy(){return Ur(`${Ja.v1}/categories`)}async function vy(){return Ur(dr.subscriptions.v1)}async function hy(e){return Ur(`${dr.subscriptions.v1}/${e}`)}async function my(e){return Dr(`${dr.subscriptions.v1}/${e}/cancellations/`,{})}async function Ay(e){return Dr(`${dr.subscriptions.v1}/${e}/renewals/`,{})}async function by(e,{paymentMethodId:t,planId:n}){return Dr(`${dr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Ty(e){return Ur(`${fr.v1}/${e}`)}async function Ey(){return Ur(`${fr.v1}`)}async function ky(e){return Dr(`${fr.v1}/${e}/cancellations/`,{})}async function Oy(e){return Dr(`${fr.v1}/${e}/renewals/`,{})}async function Iy(e,{paymentMethodId:t,planId:n}){return Dr(`${fr.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Py(){return Ur(dr.plans.v1)}async function _y(e){return Ur(`${dr.plans.v1}/${e}`)}async function Ly(){return Ur(dr.invoices.v1)}async function wy(e){return Ur(`${dr.invoices.v1}/${e}`)}async function Uy(e,t){return Ur(`${dr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Cy=["email"];async function Ry(){return Ur(dr.paymentMethods.v1)}async function Dy(e){return Ur(`${dr.paymentMethods.v1}/${e}`)}async function Ny(e,t){let{email:n}=t,i=eo(t,Cy);return Rr(`${dr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function My(e){return Cr(dr.paymentProviders.stripe.subscriptions.v1,e)}async function Fy(e){return Ur(`${dr.paymentProviders.stripe.customers.v1}/${e}`)}async function Gy(e){return Cr(`${dr.paymentProviders.stripe.customers.v1}`,e)}async function $y(){return Ur(`${dr.paymentProviders.stripe.publicConfigurations.v1}`)}async function Vy(e){return Cr(`${dr.paymentProviders.stripe.setupIntents.v1}`,e)}async function xy(e){return Ur(`${dr.summaries.v1}/${e}`)}async function jy(e){return Ur(`${dr.tenantConfiguration.v1}/${e}`)}async function By(e){return Cr(`${dr.tenantConfiguration.v1}`,e)}async function Wy(){return Ur(yr.v1)}async function zy(){return Ur(`${dr.configurations.vendorPublicConfigurations.v1}`)}let Ky,qy,Hy,Jy,Yy,Qy;async function Xy(){return Ur("/vendors/public")}async function Zy(e){return Ur(Xa.v1,e)}async function ef(e){return Cr(Xa.v1,e)}async function tf(e,t){return Nr(Xa.v1,e,{headers:Fr(t)})}async function nf(e,t,n){return Cr(`${Xa.v1}/${e}/roles`,t,{headers:Fr(n)})}async function of(e,t,n){return Nr(`${Xa.v1}/${e}/roles`,t,{headers:Fr(n)})}async function af(e,t,n){return Rr(`${Xa.v1}/${e}/roles`,t,{headers:Fr(n)})}async function rf(e,t){return Cr(cr.v1,e,{headers:Fr(t)})}async function sf(e,t){return Nr(`${cr.v1}/${e}`,void 0,{headers:Fr(t)})}async function lf({tenantId:e},t,n){return Rr(`${cr.v1}/${e}`,t,{headers:Fr(n)})}async function cf(e,t,n){return Dr(`${Xa.v1}/${e}/access`,t,{headers:Fr(n)})}async function uf(e,t){return Cr(`${Xa.v2}/`,e,{headers:Fr(t)})}async function df(){return Ur(`${Tr}`)}async function yf(e,t){return Rr(`${Tr}/${e}`,t)}async function ff(e){return Cr(`${Tr}`,e)}async function pf(e){return Nr(`${Tr}/${e}`)}async function gf(e){return Ur(`${Er}/${e}/Users/count`)}async function Sf(e){return Cr(`${Za.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Ky||(Ky={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(qy||(qy={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Hy||(Hy={})),(Jy||(Jy={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Yy||(Yy={})),function(e){e.CREATE="create_customer"}(Qy||(Qy={}));const vf=["groupId"];async function hf({groupId:e},t){return Ur(`${er.v1}/${e}`,D({},t))}async function mf(e){return Ur(`${er.v1}`,D({},e))}async function Af(e,t){return Cr(`${er.getByIds.v1}`,e,{params:t})}async function bf(e){return Cr(`${er.v1}`,e)}async function Tf(e){let{groupId:t}=e,n=eo(e,vf);return Rr(`${er.v1}/${t}`,n)}async function Ef(e){return Nr(`${er.v1}/${e}`)}async function kf(e,t){return Cr(`${er.v1}/${e}/roles`,t)}async function Of(e,t){return Nr(`${er.v1}/${e}/roles`,t)}async function If(e,t){return Cr(`${er.v1}/${e}/users`,t)}async function Pf(e,t){return Nr(`${er.v1}/${e}/users`,t)}async function _f(){return Ur(`${er.configurations.v1}`)}async function Lf(e){return Cr(`${er.configurations.v1}`,e)}async function wf(){return Ur(Ir.v1)}async function Uf(){return Ur(Pr.v1)}async function Cf(e){return Ur(`${tr.v1}`,e)}async function Rf(e){return Cr(`${tr.v1}`,e)}async function Df(e){return Nr(`${tr.v1}/${e}`)}async function Nf(e){return Cr(`${tr.v1}/preverify`,e)}async function Mf(e){return Cr(`${tr.v1}/verify`,e)}async function Ff(e,t){return Cr(`${tr.v1}/${e}/delete/verify`,t)}let Gf,$f,Vf;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Gf||(Gf={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}($f||($f={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Vf||(Vf={}));const xf=[/^(.*)\/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],jf=`${Wa.v1}/user/token/refresh`,Bf=`${Ar}/authorize/silent`,Wf=`${za.v2}/me`,zf=`${za.v2}/me/tenants`,Kf=`${za.v3}/me/tenants`;let qf,Hf,Jf,Yf,Qf,Xf,Zf,ep;!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"}(Hf||(Hf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Jf||(Jf={})),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"}(Yf||(Yf={})),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"}(Qf||(Qf={})),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"}(Xf||(Xf={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(Zf||(Zf={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(ep||(ep={}));const tp={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 np={fetch:e,ContextHolder:Va,FronteggContext:xa,api:tp,FronteggApiError:ja,AuthStrategyEnum:ki,MachineToMachineAuthStrategy:Oi,SocialLoginProviders:Ei,ISubscriptionCancellationPolicy:Hy,ISubscriptionStatus:Ky,PaymentMethodType:qy,ProviderType:Jy};let ip,op;!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"}(ip||(ip={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(op||(op={}));const ap="input is invalid type",rp="undefined"!=typeof ArrayBuffer,sp="0123456789abcdef".split(""),lp=[-2147483648,8388608,32768,128],cp=[24,16,8,0],up=[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],dp=["hex","array","digest","arrayBuffer"],yp=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),rp&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const fp=function(e){return function(t){const n=new gp(!0).update(t);return null==n?void 0:n[e]()}},pp=function(e){return function(t,n){const i=new Sp(t,!0).update(n);return null==i?void 0:i[e]()}};class gp{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=()=>gp.prototype.digest(),e?(yp[0]=yp[16]=yp[1]=yp[2]=yp[3]=yp[4]=yp[5]=yp[6]=yp[7]=yp[8]=yp[9]=yp[10]=yp[11]=yp[12]=yp[13]=yp[14]=yp[15]=0,this.blocks=yp):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(ap);if(null===e)throw new Error(ap);if(rp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||rp&&ArrayBuffer.isView(e)))throw new Error(ap);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]<<cp[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<cp[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<cp[3&o++],s[o>>2]|=(128|63&i)<<cp[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<cp[3&o++],s[o>>2]|=(128|i>>6&63)<<cp[3&o++],s[o>>2]|=(128|63&i)<<cp[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<cp[3&o++],s[o>>2]|=(128|i>>12&63)<<cp[3&o++],s[o>>2]|=(128|i>>6&63)<<cp[3&o++],s[o>>2]|=(128|63&i)<<cp[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]|=lp[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+up[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+up[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+up[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+up[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=sp[e>>28&15]+sp[e>>24&15]+sp[e>>20&15]+sp[e>>16&15]+sp[e>>12&15]+sp[e>>8&15]+sp[e>>4&15]+sp[15&e]+sp[t>>28&15]+sp[t>>24&15]+sp[t>>20&15]+sp[t>>16&15]+sp[t>>12&15]+sp[t>>8&15]+sp[t>>4&15]+sp[15&t]+sp[n>>28&15]+sp[n>>24&15]+sp[n>>20&15]+sp[n>>16&15]+sp[n>>12&15]+sp[n>>8&15]+sp[n>>4&15]+sp[15&n]+sp[i>>28&15]+sp[i>>24&15]+sp[i>>20&15]+sp[i>>16&15]+sp[i>>12&15]+sp[i>>8&15]+sp[i>>4&15]+sp[15&i]+sp[o>>28&15]+sp[o>>24&15]+sp[o>>20&15]+sp[o>>16&15]+sp[o>>12&15]+sp[o>>8&15]+sp[o>>4&15]+sp[15&o]+sp[a>>28&15]+sp[a>>24&15]+sp[a>>20&15]+sp[a>>16&15]+sp[a>>12&15]+sp[a>>8&15]+sp[a>>4&15]+sp[15&a]+sp[r>>28&15]+sp[r>>24&15]+sp[r>>20&15]+sp[r>>16&15]+sp[r>>12&15]+sp[r>>8&15]+sp[r>>4&15]+sp[15&r];return l+=sp[s>>28&15]+sp[s>>24&15]+sp[s>>20&15]+sp[s>>16&15]+sp[s>>12&15]+sp[s>>8&15]+sp[s>>4&15]+sp[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 Sp extends gp{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(ap);if(null===e)throw new Error(ap);if(rp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||rp&&ArrayBuffer.isView(e)))throw new Error(ap)}var o;e.length>64&&(e=null==(o=new gp(!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}gp.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();gp.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),gp.prototype.finalize.call(this)}}}const vp=function(){const e=fp("hex");e.create=function(){return new gp},e.update=function(t){return e.create().update(t)};for(let t=0;t<dp.length;++t){const n=dp[t];e[n]=fp(n)}return e}();function hp(e,t){const n=D({},e);return t.forEach((e=>{delete n[e]})),n}async function mp(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=vp.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Ap(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=pp("hex");e.create=function(e){return new Sp(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<dp.length;++t){const n=dp[t];e[n]=pp(n)}}();const bp=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*Tp(e){const t=yield zo((e=>e.root.appName));return xr.getFeatureFlags(e,t)}const Ep={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},kp=D({},Ep,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Op=[{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"}],Ip={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},Pp=D({},Ip,{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}),_p={loading:!1,error:void 0,saving:!0,profile:Ip},Lp={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"},wp={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:ki.EmailAndPassword,machineToMachineAuthStrategy:Oi.ClientCredentials},Up={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Cp={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Rp={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Dp={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},Np={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Mp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Fp={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Dp,roles:Mp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Gp=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],$p={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:[Op[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[Op[0]],managedBy:Jf.FRONTEGG}]},Vp={id:$p.id,email:$p.email,name:$p.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:[Op[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},xp={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:[Op[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[Op[0]],managedBy:Jf.FRONTEGG}]},jp={id:xp.id,email:xp.email,name:xp.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:[Op[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Bp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Wp=[xp,$p],zp=[jp,Vp],Kp=[Bp],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}],Hp=[{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"}],Jp={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Yp={isActive:!0,strategy:Wn.ALLOW},Qp=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Wn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Wn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Wn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Wn.BLOCK,description:"IP 4"}],Xp=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(D({},xp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Zp=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"}),eg=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Xp(6),roles:[Zp("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Jf.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Xp(44),roles:[Zp("Editor")],managedBy:Jf.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Xp(8),roles:[Zp("Viewer")],managedBy:Jf.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Xp(5),roles:[Zp("Admin")],managedBy:Jf.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Xp(21),description:"BDR, AE, and inside sales",roles:[Zp("Viewer")],managedBy:Jf.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Xp(23),description:"Dev success and customer success",roles:[Zp("Admin")],managedBy:Jf.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Xp(10),description:"The marketing department",roles:[Zp("Viewer")],managedBy:Jf.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Xp(4),description:"Human resources",roles:[Zp("Viewer")],managedBy:Jf.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Xp(3),roles:[Zp("Viewer")],managedBy:Jf.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Xp(8),roles:[Zp("Editor")],managedBy:Jf.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Xp(4),roles:[Zp("Viewer")],managedBy:Jf.FRONTEGG}],tg={scoring:{score:79},recommendations:{items:[{code:Yf.FORCE_MFA,severity:Zf.WARNING,category:ep.MFA},{code:Yf.ENABLE_FORCE_RELOGIN,severity:Zf.WARNING,category:ep.SESSIONS}]}},ng={insights:{items:[{category:ep.MFA,code:Qf.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:ep.SESSIONS,code:Qf.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:ep.PASSWORD,code:Qf.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:ep.DOMAIN,code:Qf.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},ig={users:zp,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},og={users:[zp[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},ag={users:[zp[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0};let rg,sg,lg;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(rg||(rg={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(sg||(sg={})),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"}(lg||(lg={})),lg.profile,lg.privacy,lg.personalApiTokens,lg.account,lg.users,lg.groups,lg.security,lg.sso,lg.audits,lg.webhooks,lg.apiTokens,lg.roles,lg.subscriptions,lg.allAccounts;const cg=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},ug=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},dg="tenantId",yg=e=>e.mfaRequired&&e.mfaToken?(Va.setAccessToken(null),Va.setUser(null),!0):(Va.setAccessToken(e.accessToken),Va.setUser(e),!1),fg=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 cn.authenticatorApp;if(t)return cn.smsVerifyCode;if(i)return cn.emailVerifyCode}return cn.verify},pg=e=>{if(1===e.length){const[t]=e;if(t===xs.AuthenticatorApp)return cn.authenticatorApp;if(t===xs.SMS)return cn.smsSetPhoneNumber;if(t===xs.EmailCode)return cn.emailVerifyCode}return cn.verify};function*gg(e){let t=_t.loginWithTwoFactor,n={};const{loginState:i}=yield zo((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield jo(tp.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:fg(e.mfaDevices)}:(n={step:pg(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 Sg=(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 vg;function hg(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"}(vg||(vg={}));const mg=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,...mg(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),Ag=["callback"];function*bg(){yield $o(xi.setCustomLoginState({loading:!0}));try{const e=yield jo(tp.metadata.getAdminBoxMetadata);yield $o(xi.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield $o(xi.setCustomLoginState({loading:!1,error:Sg(e)}))}}function*Tg(e){let{payload:{callback:t}}=e,n=eo(e.payload,Ag);try{yield $o(xi.setCustomLoginState({error:null,saving:!0}));const e=mg(n);if(0===e.length)throw new Error("No changes to update");yield jo(tp.metadata.updateAdminBoxMetadata,{actions:e});const i=yield jo(tp.metadata.getAdminBoxMetadata);yield $o(xi.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield $o(xi.setCustomLoginState({error:Sg(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Eg(){var e,t,n;if(yield zo((e=>e.auth.isAuthenticated))){var i;const e=yield null!=(i=zo((({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*kg(){try{var e;if(!(yield jo(Eg)))return;const t=yield zo((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:i}=tp.accountSettings,{applicationUrl:o}=yield jo(t?n:i);if(!o)return;const{routes:a}=yield zo((e=>e.auth)),r=null!=(e=cg(o))?e:"";yield $o(xi.setState({routes:D({},a,{customLoginAuthenticatedUrl:o,customLoginUrl:a.loginUrl+r})})),yield $o(xi.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*Og(){yield $a(xi.loadTenantMetadata,bg),yield $a(xi.updateTenantMetadata,Tg)}let Ig;!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"}(Ig||(Ig={}));const Pg=["callback"];function _g(e){return function*(t){const[n]=yield jo(Tp,["security-center-admin-portal-major-version"]);yield e(t),n&&(yield Lg(),yield wg())}}function*Lg(){const e=Ig.RECOMMENDATIONS;yield $o(xi.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:i}=yield jo(tp.securityCenter.getRecommendations);yield $o(xi.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==i?void 0:i.score)?t:0}))}catch(t){yield $o(xi.setSecurityCenterStateError({key:e,value:Sg(t)}))}finally{yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}}function*wg(){const e=Ig.INSIGHTS;yield $o(xi.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield jo(tp.securityCenter.getInsights);yield $o(xi.setSecurityCenterState({insights:t.items}))}catch(t){yield $o(xi.setSecurityCenterStateError({key:e,value:Sg(t)}))}finally{yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Ug(e){let{payload:{callback:t}}=e,n=eo(e.payload,Pg);const i=Ig.SEND_BREACHED_PASSWORD_EMAIL;yield $o(xi.setSecurityCenterStateError({key:i,value:!1})),yield $o(xi.setSecurityCenterStateLoader({key:i,value:!0}));try{yield jo(tp.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield $o(xi.setSecurityCenterStateError({key:i,value:Sg(e)})),null==t||t(!1,e)}finally{yield $o(xi.setSecurityCenterStateLoader({key:i,value:!1}))}}function*Cg({payload:{callback:e}}){const t=Ig.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield $o(xi.setSecurityCenterStateError({key:t,value:!1})),yield $o(xi.setSecurityCenterStateLoader({key:t,value:!0}));try{yield jo(tp.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield $o(xi.setSecurityCenterStateError({key:t,value:Sg(n)})),null==e||e(!1)}finally{yield $o(xi.setSecurityCenterStateLoader({key:t,value:!1}))}}function*Rg({key:e,tableState:t,updateStateKey:n,_offset:i,_limit:o,_preset:a,_email:r,_maxInactiveSeconds:s}){var l,c,u,d;yield $o(xi.setSecurityCenterStateError({key:e,value:!1})),yield $o(xi.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 jo(tp.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 jo(tp.roles.getRoles),i=yield jo(tp.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 $o(xi.setSecurityCenterState({[n]:D({users:e},a)}))}else yield $o(xi.setSecurityCenterState({[n]:D({users:[]},a)}))}catch(t){yield $o(xi.setSecurityCenterStateError({key:e,value:Sg(t)}))}finally{yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Dg({payload:e}){var t;const n=Ig.BREACHED_PASSWORD_USERS_TABLE,i=yield null!=(t=zo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield Rg(D({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:fi.BREACHED_PASSWORDS,tableState:i},e))}function*Ng({payload:e}){var t;const n=Ig.UNENROLLED_MFA_USERS_TABLE,i=yield null!=(t=zo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield Rg(D({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:fi.MFA_UNENROLLED,tableState:i},e))}function*Mg({payload:e}){var t;const n=Ig.INACTIVE_USERS_TABLE,i=yield null!=(t=zo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield Rg(D({key:n,updateStateKey:"inactiveUsersTable",_preset:fi.INACTIVE,tableState:i},e))}function*Fg(){yield Fa(xi.loadRecommendations,Lg),yield Fa(xi.loadInsights,wg),yield Fa(xi.sendResetBreachedPasswordEmail,Ug),yield Fa(xi.sendBulkResetBreachedPasswordEmails,Cg),yield Fa(xi.loadBreachedPasswordUsers,Dg),yield Fa(xi.loadUnenrolledMfaUsers,Ng),yield Fa(xi.loadInactiveUsers,Mg)}function*Gg(){const e=Ig.RECOMMENDATIONS;yield $o(xi.setSecurityCenterStateLoader({key:e,value:!0})),yield Ko(500),yield $o(xi.setSecurityCenterState({recommendations:tg.recommendations.items,score:tg.scoring.score})),yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}function*$g(){const e=Ig.INSIGHTS;yield $o(xi.setSecurityCenterStateLoader({key:e,value:!0})),yield Ko(500),yield $o(xi.setSecurityCenterState({insights:ng.insights.items})),yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}function*Vg(){const e=Ig.BREACHED_PASSWORD_USERS_TABLE;yield $o(xi.setSecurityCenterStateLoader({key:e,value:!0})),yield Ko(500),yield $o(xi.setSecurityCenterState({breachedPasswordUsersTable:ig})),yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}function*xg(){const e=Ig.UNENROLLED_MFA_USERS_TABLE;yield $o(xi.setSecurityCenterStateLoader({key:e,value:!0})),yield Ko(500),yield $o(xi.setSecurityCenterState({unenrolledMfaUsersTable:ag})),yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}function*jg(){const e=Ig.INACTIVE_USERS_TABLE;yield $o(xi.setSecurityCenterStateLoader({key:e,value:!0})),yield Ko(500),yield $o(xi.setSecurityCenterState({inactiveUsersTable:og})),yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}function*Bg({payload:{callback:e}}){const t=Ig.SEND_BREACHED_PASSWORD_EMAIL;yield $o(xi.setSecurityCenterStateLoader({key:t,value:!0})),yield Ko(500),null==e||e(!0),yield $o(xi.setSecurityCenterStateLoader({key:t,value:!1}))}function*Wg(){yield Fa(xi.loadRecommendations,Gg),yield Fa(xi.loadInsights,$g),yield Fa(xi.loadBreachedPasswordUsers,Vg),yield Fa(xi.loadUnenrolledMfaUsers,xg),yield Fa(xi.loadInactiveUsers,jg),yield Fa(xi.sendResetBreachedPasswordEmail,Bg)}const zg=["callback"],Kg=["callback"],qg=["callback"],Hg=["callback"],Jg=["callback"],Yg=["callback"];function*Qg(){yield $o(xi.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getGlobalSecurityPolicy);yield $o(xi.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyGlobalState({error:Sg(e),loading:!1}))}yield $o(xi.loadSecurityPolicyMfa()),yield $o(xi.loadSecurityPolicyVendorMfa()),yield $o(xi.loadSecurityPolicyLockout()),yield $o(xi.loadSecurityPolicyVendorLockout()),yield $o(xi.loadSecurityPolicyVendorPasswordHistory()),yield $o(xi.loadSecurityPolicyCaptcha()),yield $o(xi.loadPublicAuthStrategiesPolicy())}function*Xg(e){var t,n;if(!(yield jo(Eg)))return e;const i=yield jo(eS);return null!=i&&null!=(t=i.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?D({},e,{authStrategy:i.mainAuthStrategies[0].strategy}):e}function*Zg(){yield $o(xi.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getVendorConfig),t=yield Xg(e);yield $o(xi.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyPublicState({error:Sg(e),loading:!1}))}}function*eS(){const e=yield zo((({auth:e})=>e.isAuthenticated));let t;return t=e?yield jo(tp.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield jo(tp.auth.getVendorPublicAuthStrategiesConfig),t}function*tS(){yield $o(xi.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield jo(eS);yield function*(e){const t=yield jo(Eg);if(!e||!t)return;const{policy:n}=yield zo((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield $o(xi.setSecurityPolicyPublicState({policy:D({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield $o(xi.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyAuthStrategyPublicState({error:Sg(e),loading:!1}))}}function*nS(){yield $o(xi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getMfaPolicy);yield $o(xi.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyMfaState({error:Sg(e),loading:!1}))}}function*iS(){yield $o(xi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getVendorMfaPolicy);yield $o(xi.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyVendorMfaState({error:Sg(e),loading:!1}))}}function*oS(e){let{payload:{callback:t}}=e,n=eo(e.payload,zg);yield $o(xi.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield jo(tp.auth.saveMfaPolicy,n);yield $o(xi.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield $o(xi.setSecurityPolicyMfaState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*aS(){yield $o(xi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getLockoutPolicy);yield $o(xi.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyLockoutState({error:Sg(e),loading:!1}))}}function*rS(e){let{payload:{callback:t}}=e,n=eo(e.payload,Kg);yield $o(xi.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield jo(tp.auth.saveLockoutPolicy,n);yield $o(xi.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield $o(xi.setSecurityPolicyLockoutState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*sS(){yield $o(xi.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getVendorLockoutPolicy);yield $o(xi.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyVendorLockoutState({error:Sg(e),loading:!1}))}}function*lS(){yield $o(xi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getCaptchaPolicy);yield $o(xi.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyCaptchaState({error:Sg(e),loading:!1}))}}function*cS(){yield $o(xi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getPasswordHistoryPolicy);yield $o(xi.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyPasswordHistoryState({error:Sg(e),loading:!1}))}}function*uS(){yield $o(xi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getVendorPasswordHistoryPolicy);yield $o(xi.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyVendorPasswordHistoryState({error:Sg(e),loading:!1}))}}function*dS(e){let{payload:{callback:t}}=e,n=eo(e.payload,qg);yield $o(xi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield jo(tp.auth.savePasswordHistoryPolicy,n);yield $o(xi.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield $o(xi.setSecurityPolicyPasswordHistoryState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*yS(){yield $o(xi.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getPasswordConfigPolicy);yield $o(xi.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyPasswordState({error:Sg(e),loading:!1}))}}function*fS(){yield $a(xi.loadSecurityPolicy,Qg),yield Fa(xi.saveSecurityPolicyMfa,_g(oS)),yield Fa(xi.loadSecurityPolicyMfa,nS),yield Fa(xi.loadSecurityPolicyVendorMfa,iS),yield Fa(xi.saveSecurityPolicyLockout,_g(rS)),yield Fa(xi.loadSecurityPolicyLockout,aS),yield Fa(xi.loadSecurityPolicyVendorLockout,sS),yield Fa(xi.loadSecurityPolicyCaptcha,lS),yield Fa(xi.saveSecurityPolicyPasswordHistory,_g(dS)),yield Fa(xi.loadSecurityPolicyPasswordHistory,cS),yield Fa(xi.loadSecurityPolicyVendorPasswordHistory,uS),yield Fa(xi.loadVendorPasswordConfig,yS),yield Fa(xi.loadPublicSecurityPolicy,Zg),yield Fa(xi.loadPublicAuthStrategiesPolicy,tS)}function*pS(){yield $o(xi.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield $o(xi.setSecurityPolicyPublicState({policy:wp,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyPublicState({error:Sg(e),loading:!1}))}}function*gS(){yield $o(xi.setSecurityPolicyGlobalState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyGlobalState({policy:Lp,loading:!1})),yield $o(xi.loadSecurityPolicyMfa()),yield $o(xi.loadSecurityPolicyVendorMfa()),yield $o(xi.loadSecurityPolicyLockout()),yield $o(xi.loadSecurityPolicyVendorLockout()),yield $o(xi.loadSecurityPolicyPasswordHistory()),yield $o(xi.loadSecurityPolicyVendorPasswordHistory()),yield $o(xi.loadSecurityPolicyCaptcha())}function*SS(){yield $o(xi.setSecurityPolicyMfaState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyMfaState({policy:Up,loading:!1}))}function*vS(){yield $o(xi.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyVendorMfaState({policy:Up,loading:!1}))}function*hS(e){var t;let{payload:{callback:n}}=e,i=eo(e.payload,Hg);yield $o(xi.setSecurityPolicyMfaState({saving:!0,error:null}));const o=D({},Cp,{id:null!=(t=i.id)?t:Cp.id,enforceMFAType:i.enforceMFAType});yield Et(),yield $o(xi.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*mS(){yield $o(xi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyLockoutState({policy:Cp,loading:!1}))}function*AS(){yield $o(xi.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyVendorLockoutState({policy:Cp,loading:!1}))}function*bS(e){let{payload:{callback:t}}=e,n=eo(e.payload,Jg);yield $o(xi.setSecurityPolicyLockoutState({saving:!0,error:null})),yield Et();const i=D({},Cp,n,{id:n.id?n.id:Cp.id});null==t||t(i),yield $o(xi.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*TS(){yield $o(xi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyLockoutState({policy:Cp,loading:!1}))}function*ES(){yield $o(xi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyPasswordHistoryState({policy:Rp,loading:!1}))}function*kS(){yield $o(xi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyVendorPasswordHistoryState({policy:Rp,loading:!1}))}function*OS(e){let{payload:{callback:t}}=e,n=eo(e.payload,Yg);yield $o(xi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield Et();const i=D({},Rp,n,{id:n.id?n.id:Rp.id});null==t||t(i),yield $o(xi.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*IS(){yield $a(xi.loadSecurityPolicy,gS),yield Fa(xi.loadPublicSecurityPolicy,pS),yield Fa(xi.saveSecurityPolicyMfa,hS),yield Fa(xi.loadSecurityPolicyMfa,SS),yield Fa(xi.loadSecurityPolicyVendorMfa,vS),yield Fa(xi.saveSecurityPolicyLockout,bS),yield Fa(xi.loadSecurityPolicyLockout,mS),yield Fa(xi.loadSecurityPolicyVendorLockout,AS),yield Fa(xi.loadSecurityPolicyCaptcha,TS),yield Fa(xi.saveSecurityPolicyPasswordHistory,OS),yield Fa(xi.loadSecurityPolicyPasswordHistory,ES),yield Fa(xi.loadSecurityPolicyVendorPasswordHistory,kS)}const PS=["phoneNumber"],_S=["events","url"];function*LS(){yield $o(xi.setSignUpState({loading:!0}));try{const e=yield jo(tp.auth.getVendorConfig),t=yield Xg(e),{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield $o(xi.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield $o(xi.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield $o(xi.setSignUpState({loading:!1,error:Sg(e),firstLoad:!1}))}}function*wS(e){let{payload:{events:t,url:n}}=e,i=eo(e.payload,_S);yield $o(xi.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:r}=yield zo((e=>e.auth)),{shouldActivate:s,user:l,tenantId:c,userId:u,tenants:d=[],activeTenant:y}=yield jo(tp.auth.signUpUser,(a=i,eo(a,PS)));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:sg.PASSWORD,id:u,tenantId:c,createdAt:new Date};null==t||null==(o=t.signUpComplete)||o.call(t,l),hg(vg.SIGNUP_COMPLETED,l)}if(!s&&l&&yg(l)){const t=yield gg(l);yield $o(xi.setState(t)),r(e.loginUrl)}else{const{tenantsState:e}=yield zo((e=>e.auth));yield $o(xi.setSignUpState({loading:!1,shouldActivate:s,stage:mn.SignUpSuccess})),yield $o(xi.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:D({},e,{tenants:d,activeTenant:y})}))}}catch(e){Va.setAccessToken(null),Va.setUser(null),yield $o(xi.setSignUpState({loading:!1,error:Sg(e)}))}var a;yield $o(xi.setSignUpState({loading:!1}))}function*US(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield zo((e=>e.auth.signUpState));yield $o(xi.resetSignUpState()),yield $o(xi.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*CS(){yield $a(xi.signUpUser,wS),yield $a(xi.resetSignUpStateSoft,US)}const RS={setVendorState:(e,{payload:t})=>D({},e,t)},DS={loadVendorPublicInfo:yt("vendor/loadVendorPublicInfo")},NS={loading:!1},{reducer:MS,actions:FS}=pt({name:Mt,initialState:NS,reducers:D({},RS)}),GS=D({},FS,DS);function*$S(){yield $o(GS.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield tp.vendor.getVendorPublicInfo();yield $o(GS.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield $o(GS.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var VS=n(378),xS=n.n(VS);function jS(e,t){return xS()(e,t)}function*BS({payload:e}){const t=null==e?void 0:e.callback,[n]=yield jo(Tp,[$r]);try{const e=yield jo(n?tp.entitlements.loadEntitlementsV2:tp.entitlements.loadEntitlements);yield function*(e){jS(yield zo((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield $o(xi.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*WS(){yield $a(xi.loadEntitlements,BS)}var zS=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(){return this.isWebkitAvailable()||this.isJsInterfaceAvailable()}};function*KS(){const{publicAuthStrategyPolicy:e}=yield zo((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===$s.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield jo(Tp,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield jo(tp.auth.getWebAuthnDevices);return yield $o(xi.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*qS({user:e,tenants:t=[],activeTenant:n},i={}){const{tenantsState:o}=yield zo((e=>e.auth));yield $o(xi.setState(D({user:e,tenantsState:D({},o,{tenants:t,activeTenant:n,loading:!1})},i)))}function*HS(e){const{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield zo((e=>e.auth));if(e)return(e=>{const{pathname:t}=new URL(e),n=cg(e);return n?t+n:t})(e);const{authenticatedUrl:a,loginUrl:r,logoutUrl:s,socialLoginCallbackUrl:l,activateUrl:c}=t;let u=window.localStorage.getItem(Ut);return u&&![r,s,l,c].includes(u)||(u=a),(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:i})=>{let o=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),i=new URL(e),o=i.origin===n.origin;return t.includes(i.origin)||o})(a,n)?o=a:console.warn("The redirect url param is not valid, the origin is a different site"):o=a:i&&(o+=window.location.search),o})({authenticatedUrl:u,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o})}function*JS(e,t){const n=Va.onRedirectTo,i=yield jo(HS,t);window.localStorage.removeItem(Ut),yield Ko(200),$o(e()),n(i,{refresh:i.startsWith("http")})}function*YS(){const{routes:{customLoginAuthenticatedUrl:e}}=yield zo((e=>e.auth));let t=e;e||(yield jo(kg),t=yield zo((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl}))),yield jo(JS,xi.resetLoginState,t)}function*QS(){yield jo(JS,xi.resetStepUpState)}const XS=["callback"];function*ZS(e,t,n){const{loginState:i}=yield zo((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*ev(e,t){const{loginState:n}=yield zo((e=>e.auth));if(n.flow!==Lt.Login)return;const[i]=yield jo(Tp,["security-center-show-login-flows"]);i&&n.isBreachedPassword&&!e?yield $o(xi.setLoginState({step:_t.breachedPassword,loading:!1})):(yield jo(KS))?yield $o(xi.setLoginState({step:_t.promptPasskeys,loading:!1})):yield YS(),null==t||t(!0)}function*tv(e){yield QS(),null==e||e(!0)}function*nv(e,t,n){let{callback:i}=e,o=eo(e,XS);yield $o(t({loading:!0,error:void 0}));try{const{user:e,tenants:a=[],activeTenant:r}=yield jo(tp.auth.loginWithMfaV2,o),s=!!e.accessToken,l=yield jo(ZS,a,s,n);if(yield jo(qS,{user:e,tenants:a,activeTenant:r},l),e.id&&localStorage.setItem("userId",e.id),yield $o(t({loading:!1,error:void 0})),n)return void(yield jo(tv,i));yield jo(ev,s,i)}catch(e){yield $o(t({loading:!1,error:Sg(e)})),null==i||i(!1,e)}}function*iv({payload:e}){yield nv(e,xi.setLoginState,!1)}function*ov(){yield jo(QS)}function*av(e){const{loginState:t}=yield zo((e=>e.auth)),{step:n}=yield zo((e=>e.auth.mfaState)),[i]=yield jo(Tp,["security-center-show-login-flows"]);if(t.flow===Lt.Login)if(i&&t.isBreachedPassword&&!e)yield $o(xi.setLoginState({step:_t.breachedPassword,loading:!1}));else{const e=yield jo(KS);n===cn.smsVerifyCode&&e?yield $o(xi.setLoginState({step:_t.promptPasskeys,loading:!1})):yield YS()}}function*rv({user:e,tenants:t,activeTenant:n},i=!1){yield $o(xi.setUser(e)),yield $o(xi.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const o=!!e.accessToken;yield $o(xi.setState({isAuthenticated:o})),i?yield jo(ov):yield jo(av,o)}const sv=["callback","deviceId"],lv=["callback","deviceId"];function*cv(e,t){let{callback:n,deviceId:i}=e,o=eo(e,sv);yield $o(t({loading:!1,error:void 0}));try{const e=yield jo(tp.auth.preVerifyMFASMSForLogin,i,o);yield $o(xi.setMfaState({otcToken:e.otcToken,step:cn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield $o(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield $o(t({loading:!1,error:Sg(e)})),null==n||n(null)}}function*uv(e,t,n=!1){let{callback:i,deviceId:o}=e,a=eo(e,lv);yield $o(t({loading:!0}));try{const e=yield jo(tp.auth.verifyMFASMSForLoginV2,o,a);yield rv(e,n),yield $o(t({loading:!1,error:void 0})),null==i||i(!0)}catch(e){yield $o(t({loading:!1,error:Sg(e)})),null==i||i(null)}}function*dv({payload:e}){yield cv(e,xi.setLoginState)}function*yv({payload:e}){yield uv(e,xi.setLoginState,!1)}const fv=["callback","deviceId"],pv=["callback","deviceId"];function*gv(e,t){let{callback:n,deviceId:i}=e,o=eo(e,fv);yield $o(t({loading:!0}));try{var a;const e=yield jo(tp.auth.preVerifyMFAWebAuthnForLogin,i,o),r=D({},e.options,{challenge:It(e.options.challenge),allowCredentials:null==(a=e.options.allowCredentials)?void 0:a.map((e=>D({},e,{id:It(e.id)})))});yield $o(t({loading:!1,error:void 0})),null==n||n({options:r,webauthnToken:e.webauthnToken})}catch(e){yield $o(t({loading:!1,error:Sg(e)})),null==n||n(null)}}function*Sv(e,t,n){let{callback:i,deviceId:o}=e,a=eo(e,pv);yield $o(t({loading:!0}));try{const e=Pt(a.publicKey),r=yield jo(tp.auth.verifyMFAWebAuthnForLoginV2,o,D({},a,{options:e}));yield rv(r,n),yield $o(t({loading:!1,error:void 0})),null==i||i(!0)}catch(e){yield $o(t({loading:!1,error:Sg(e)})),null==i||i(null)}}function*vv({payload:e}){yield gv(e,xi.setLoginState)}function*hv({payload:e}){yield Sv(e,xi.setLoginState,!1)}const mv=["callback"],Av=["callback"];function*bv(e,t){let{callback:n}=e,i=eo(e,mv);yield $o(t({loading:!0,error:void 0}));try{const e=yield jo(tp.auth.preVerifyMFAEmailCode,i);yield $o(xi.setMfaState({otcToken:e.otcToken,step:cn.emailVerifyCode})),yield $o(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield $o(t({error:Sg(e)})),null==n||n(null)}}function*Tv(e,t){let{callback:n}=e,i=eo(e,Av);yield $o(t({loading:!0}));try{const e=yield jo(tp.auth.verifyMFAEmailCodeV2,i);yield rv(e),yield $o(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield $o(t({loading:!1,error:Sg(e)})),null==n||n(null)}}function*Ev({payload:e}){yield bv(e,xi.setLoginState)}function*kv({payload:e}){yield Tv(e,xi.setLoginState)}const Ov=["callback"],Iv=["callback"],Pv=["callback"],_v=["callback"],Lv=["callback","events"],wv=["callback"],Uv=["callback"],Cv=["callback"],Rv=["callback"],Dv=["user"],Nv=["callback"],Mv=["callback"],Fv=["callback"],Gv=["callback"],$v=["callback"];function*Vv(e){const t=yield zo((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return jS(t,null==e?void 0:e.entitlements)?D({},e,{entitlements:t}):e}function*xv(){let e;try{var t;const n=yield jo(tp.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield $o(xi.setState({ssoACS:e}))}function*jv(){try{const{isActive:e}=yield jo(tp.auth.getSSOPublicConfiguration);yield $o(xi.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*Bv(e){var t;const{routes:n,loginState:i}=yield zo((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*Wv(){const{hostedLoginBox:e}=yield zo((e=>e.auth));e?yield jo(zv):yield jo(qv)}function*zv(){const{user:e}=yield zo((e=>e.auth));if(null==e||!e.refreshToken)return Va.setAccessToken(null),Va.setUser(null),void(yield $o(xi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield jo(tp.auth.exchangeOAuthTokensV2,t),i=yield jo(Vv,n.user);yield jo(qS,D({},n,{user:i}),{isAuthenticated:!0})}catch(e){Va.setAccessToken(null),Va.setUser(null),yield $o(xi.setState({user:null,isAuthenticated:!1}))}}function*Kv(){const{user:e}=yield zo((e=>e.auth));if(null==e||!e.refreshToken)return Va.setAccessToken(null),Va.setUser(null),void(yield $o(xi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield jo(tp.auth.exchangeOAuthTokensV2,t),i=yield jo(Vv,n.user);yield jo(qS,D({},n,{user:i}),{isAuthenticated:!0})}catch(e){Va.setAccessToken(null),Va.setUser(null),yield $o(xi.setState({user:null,isAuthenticated:!1}))}}function*qv(){try{const t=Va.onRedirectTo,{routes:n,loginState:i}=yield zo((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield jo(tp.auth.refreshTokenV3);if(yg(o)){const e=yield gg(o);yield $o(xi.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 Bv(o),s=yield jo(Vv,o);yield jo(qS,{user:s,tenants:a,activeTenant:r},{loginState:D({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield Jv(n)}}catch(e){Va.setAccessToken(null),Va.setUser(null),yield $o(xi.setState({user:void 0,isAuthenticated:!1}))}}function*Hv(){try{const t=Va.onRedirectTo,{routes:n,loginState:i}=yield zo((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield jo(tp.auth.refreshTokenV3);if(yg(o)){const e=yield gg(o);yield $o(xi.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const s=yield jo(Vv,o);if(yield jo(KS))yield $o(xi.setLoginState({step:_t.promptPasskeys,loading:!1})),yield jo(qS,{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 Bv(o);yield jo(qS,{user:s,tenants:a,activeTenant:r},{loginState:D({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield Jv(n)}}}catch(e){Va.setAccessToken(null),Va.setUser(null),yield $o(xi.setState({user:void 0,isAuthenticated:!1}))}}function*Jv(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=Va.onRedirectTo,{routes:o,loginState:a}=yield zo((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 YS())}function*Yv({payload:{callback:e}}){try{const{ip:t}=yield jo(tp.metadata.getCurrentUserIpMetadata);yield $o(xi.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*Qv({payload:e}){const t=[];(yield jo(Eg))?yield jo(Wv):t.push(jo(Wv)),e&&(yield $o(xi.setState({isLoading:!0})),yield $o(xi.loadSocialLoginsConfigurationV2()),t.push(jo(LS)),t.push(jo(tS)),t.push(jo(jv)),t.push(jo($S)),t.push(jo(xv)),t.push(jo(kg))),yield Vo(t),yield $o(xi.setState({isLoading:!1}))}function*Xv({accessToken:e,user:t}){if(!e)return void(yield $o(xi.setState({user:void 0,isAuthenticated:!1})));const n=Va.onRedirectTo,{routes:i}=yield zo((e=>e.auth));if(yg(t)){const e=yield gg(t);yield $o(xi.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*Zv({payload:e}){const t=[];yield $o(xi.loadSocialLoginsConfigurationV2()),t.push(jo(LS)),t.push(jo(jv)),t.push(jo($S)),t.push(jo(xv)),t.push(jo(Xv,e)),t.push(jo(kg)),yield Vo(t)}const eh=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*th(){const e=yield jo(tp.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield jo(qS,e,{isAuthenticated:!0,isLoading:!1})}function*nh({payload:e}){const{disableSilentRefresh:t}=yield zo((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield th()}catch(t){yield oh(e)}}function*ih({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n}}){if(n){const{urlStrategy:e}=yield zo((e=>({urlStrategy:e.root.urlStrategy}))),t=eh(e);if(yield $o(xi.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:i}=yield zo((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(i)throw new Error("silent refresh is disabled");yield th()}catch(n){if(!t)return void(yield $o(xi.setState({isLoading:!1})));yield oh(e)}}function*oh(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield zo((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(eh(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield $o(xi.setState({isLoading:!0}));const a=Ap(),r=Ap(),s=yield jo(mp,r);localStorage.setItem(Ct,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;yield jo(kg);const c=yield zo((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=`${_r(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=ug(dg);f&&(d.tenantId=f),i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*ah({payload:e}){const t=localStorage.getItem(Ct)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield zo((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;yield jo(kg);const a=yield zo((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 jo(tp.auth.exchangeOAuthTokensV2,r);yield jo(qS,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield $o(xi.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{yield YS()}}function*rh(e){let{payload:{callback:t}}=e,n=eo(e.payload,Ov);try{yield $o(xi.setLoginState({loading:!0}));const e=yield jo(tp.auth.changePhoneNumberWithVerification,n);yield $o(xi.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:_t.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({error:Sg(e),loading:!1}))}}function*sh(e){let{payload:{callback:t}}=e,n=eo(e.payload,Iv);try{yield $o(xi.setLoginState({loading:!0})),yield jo(tp.auth.verifyChangePhoneNumber,n),yield $o(xi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({error:Sg(e),loading:!1}))}}function*lh(e){let{payload:{callback:t}}=e,n=eo(e.payload,Pv);try{yield $o(xi.setLoginState({loading:!0}));const e=yield jo(tp.auth.passwordlessPreLogin,D({},n,{type:ki.SmsCode}));yield $o(xi.setLoginState({step:_t.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({error:Sg(e),loading:!1})),null==t||t(e)}}function*ch(e){let{payload:{callback:t}}=e,n=eo(e.payload,_v);try{let e;yield $o(xi.setLoginState({loading:!0})),function(e){return"email"in e}(n)&&(e=n.email);const i=yield jo(tp.auth.passwordlessPreLogin,n),o=Ii[n.type];yield $o(xi.setLoginState({step:o,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:e,error:void 0})),null==t||t()}catch(e){yield $o(xi.setLoginState({error:Sg(e),loading:!1})),null==t||t()}}function*uh(e){let{payload:{callback:t,events:n}}=e,i=eo(e.payload,Lv);try{yield $o(xi.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield jo(tp.auth.passwordlessPostLoginV2,i),s=Va.onRedirectTo,{routes:l}=yield zo((e=>e.auth));if(yg(e)){const t=yield gg(e);yield $o(xi.setState(t)),s(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield zo((e=>e.auth));if(e.emailVerified){var o;const t={email:e.email,origin:rg.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name};null==n||null==(o=n.userVerified)||o.call(n,t),hg(vg.USER_VERIFIED,t)}e.id&&localStorage.setItem("userId",e.id),yield jo(qS,{user:e,tenants:a,activeTenant:r}),yield $o(xi.setLoginState({error:void 0})),yield $o(xi.setState({isLoading:!1})),i.flow===Lt.Login?(yield jo(KS))?(yield $o(xi.setLoginState({step:_t.promptPasskeys,loading:!1})),s(l.loginUrl,{preserveQueryParams:!0})):(yield $o(xi.setState({isAuthenticated:!0})),yield YS()):s(l.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield $o(xi.setLoginState({error:Sg(e,"Failed to authenticate")}))}finally{yield $o(xi.setLoginState({loading:!1}))}}function*dh({payload:e}){try{yield $o(xi.setLoginState({loading:!0}));const{name:t}=yield jo(tp.auth.verifyInviteToken,e);yield $o(xi.setLoginState({inviteTokenTenantName:t}))}catch(e){yield $o(xi.setLoginState({inviteTokenError:Sg(e,"We couldn't verify your invitation")}))}finally{yield $o(xi.setLoginState({loading:!1}))}}function*yh({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield $o(xi.setLoginState({loading:!0}));try{const o=yield zo((({auth:{onRedirectTo:e}})=>e)),a=ug(dg),{address:r,idpType:s}=yield jo(tp.auth.preLoginV2,{email:e,tenantId:a});if(r){let t=r;if(s===op.Oidc&&!t.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield zo((({auth:{routes:e}})=>({routes:e})));t+=`&redirect_uri=${window.location.origin}${e}`}zS.isAvailable()?(zS.loginWithSSO(e),yield $o(xi.setLoginState({loading:!1,step:_t.redirectToSSO})),null==i||i()):(yield $o(xi.setLoginState({step:_t.redirectToSSO,loading:!1,ssoRedirectUrl:t})),setTimeout((()=>{o(t,{refresh:!0})}),2e3))}else yield fh({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield fh({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*fh(e){let{callback:t}=e,n=eo(e,wv);const i=yield zo((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield $o(xi.setLoginState({step:_t.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===ki.EmailAndPassword?(yield $o(xi.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t()):[ki.MagicLink,ki.Code,ki.SmsCode].includes(null==i?void 0:i.authStrategy)?yield $o(xi.passwordlessPreLogin(D({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield $o(xi.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t())}function*ph({payload:{callback:e}}){try{yield $o(xi.setLoginState({loading:!0}));const{options:t}=yield jo(tp.auth.webAuthnCreateNewDeviceSession);t.user.id=It(t.user.id),t.challenge=It(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield $o(xi.setLoginState({error:Sg(t)})),null==e||e(null)}finally{yield $o(xi.setLoginState({loading:!1}))}}function*gh(e){let{payload:{callback:t}}=e,n=eo(e.payload,Uv);try{yield $o(xi.setLoginState({loading:!0}));const e=Pt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?Vs.Platform:Vs.CrossPlatform;yield jo(tp.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({error:Sg(e)})),null==t||t(null)}finally{yield $o(xi.setLoginState({loading:!1}))}}function*Sh(e){let{payload:{callback:t}}=e,n=eo(e.payload,Cv);try{var i;yield $o(xi.setPasskeysState({loading:!0})),yield $o(xi.setLoginState({loading:!0}));const{options:e}=yield jo(tp.auth.webAuthnPreLogin,n);e.challenge=It(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>D({},e,{id:It(e.id)}))),yield $o(xi.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield $o(xi.setLoginState({error:Sg(e)})),null==t||t(null)}finally{yield $o(xi.setPasskeysState({loading:!1})),yield $o(xi.setLoginState({loading:!1}))}}function*vh(e){let{payload:{callback:t}}=e,n=eo(e.payload,Rv);try{var i;yield $o(xi.setPasskeysState({loading:!0})),yield $o(xi.setLoginState({loading:!0}));const e=Pt(n.publicKey),o=yield jo(tp.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=eo(o,Dv);if(yg(a)){const e=Va.onRedirectTo,{routes:t}=yield zo((e=>e.auth)),n=yield gg(a);yield $o(xi.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield jo(qS,D({user:a},r),{isAuthenticated:!0}),yield $o(xi.setLoginState({error:void 0})),yield YS(),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({error:Sg(e)})),null==t||t(null)}finally{yield $o(xi.setPasskeysState({loading:!1})),yield $o(xi.setLoginState({loading:!1}))}}function*hh({payload:e}){const{onRedirectTo:t,routes:n}=yield zo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield $o(xi.setLoginState({loading:!0}));try{const t=yield jo(tp.auth.postLogin,e);yield $o(xi.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield YS()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield $o(xi.setLoginState({step:_t.loginWithSSOFailed,loading:!1}))}}function*mh({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield $o(xi.setLoginState({loading:!0}));try{const{user:a,tenants:r=[],activeTenant:s}=yield jo(tp.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:i}),l=Va.onRedirectTo,{routes:c}=yield zo((e=>e.auth));if(yg(a)){const e=yield gg(a);yield $o(xi.setState(e)),l(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield zo((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield jo(qS,{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 jo(Tp,["security-center-show-login-flows"]);t.flow===Lt.Login&&(i&&a.isBreachedPassword&&!n?yield $o(xi.setLoginState({step:_t.breachedPassword,loading:!1})):n&&((yield jo(KS))?(yield $o(xi.setLoginState({step:_t.promptPasskeys,loading:!1})),l(c.loginUrl,{preserveQueryParams:!0})):yield YS()))}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){Va.setAccessToken(null),Va.setUser(null),null==o||o(!1,t),yield $o(xi.setLoginState({email:e,error:Sg(t),loading:!1}))}}function*Ah({payload:e}){yield $o(xi.setLoginState({loading:!0}));try{var t;yield jo(tp.auth.recoverMfaToken,e),yield $o(xi.setLoginState({loading:!1,error:void 0,step:_t.preLogin})),yield $o(xi.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $o(xi.setLoginState({error:Sg(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*bh({payload:e}){const{hostedLoginBox:t}=yield zo((e=>e.auth));yield $o(xi.setState({isLoading:!0}));try{t?yield jo(tp.auth.OAuthLogout):yield jo(tp.auth.logout)}catch{}yield $o(xi.resetState()),yield $o(xi.requestAuthorize(!0)),null==e||e()}function*Th({payload:e}){var t;try{yield jo(tp.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*Eh({user:e,tenants:t,activeTenant:n}){const i={step:cn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield $o(xi.setMfaState(i)),yield $o(xi.setUser(e)),yield $o(xi.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*kh(e){let{payload:{callback:t}}=e,n=eo(e.payload,Nv);yield $o(xi.setLoginState({loading:!0}));try{const e=yield jo(tp.auth.preEnrollMFASMSForLogin,n);yield $o(xi.setMfaState({otcToken:e.otcToken,step:cn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield $o(xi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({loading:!1,error:Sg(e)})),null==t||t(null)}}function*Oh(e){let{payload:{callback:t}}=e,n=eo(e.payload,Mv);yield $o(xi.setLoginState({loading:!0}));try{const e=yield jo(tp.auth.enrollMFASMSForLoginV2,n);yield Eh(e),yield $o(xi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({loading:!1,error:Sg(e)})),null==t||t(null)}}function*Ih(e){let{payload:{callback:t}}=e,n=eo(e.payload,Fv);yield $o(xi.setLoginState({loading:!0}));try{var i;const e=yield jo(tp.auth.preEnrollMFAWebAuthnForLogin,n),o=D({},e.options,{challenge:It(e.options.challenge),user:D({},e.options.user,{id:It(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>D({},e,{id:It(e.id)})))});yield $o(xi.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield $o(xi.setLoginState({loading:!1,error:Sg(e)})),null==t||t(null)}}function*Ph(e){let{payload:{callback:t}}=e,n=eo(e.payload,Gv);yield $o(xi.setLoginState({loading:!0}));try{const e=Pt(n.publicKey),i=yield jo(tp.auth.enrollMFAWebAuthnForLoginV2,D({},n,{options:e}));yield Eh(i),yield $o(xi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({loading:!1,error:Sg(e)})),null==t||t(null)}}function*_h(e){let{payload:{callback:t}}=e,n=eo(e.payload,$v);yield $o(xi.setLoginState({loading:!0}));try{const e=yield jo(tp.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield Eh(e),yield $o(xi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({loading:!1,error:Sg(e)})),null==t||t(null)}}function*Lh({payload:e}){yield $o(xi.setLoginState({loading:!0}));try{yield jo(tp.auth.forgotPassword,e),yield $o(xi.setLoginState({loading:!1,error:void 0,step:_t.breachedPasswordSuccess})),yield $o(xi.setState({isAuthenticated:!1}))}catch(e){yield $o(xi.setLoginState({loading:!1,error:Sg(e)}))}}function*wh(){yield $a(xi.requestAuthorize,Qv),yield $a(xi.requestAuthorizeSSR,Zv),yield $a(xi.requestHostedLoginAuthorize,nh),yield $a(xi.requestHostedLoginAuthorizeV2,ih),yield $a(xi.handleHostedLoginCallback,ah),yield $a(xi.preLogin,yh),yield $a(xi.postLogin,hh),yield $a(xi.login,mh),yield $a(xi.logout,bh),yield $a(xi.silentLogout,Th),yield $a(xi.loginWithMfa,iv),yield $a(xi.recoverMfa,Ah),yield $a(xi.quickSmsPasswordlessPreLogin,lh),yield $a(xi.changePhoneNumberWithVerification,rh),yield $a(xi.verifyChangePhoneNumber,sh),yield $a(xi.passwordlessPreLogin,ch),yield $a(xi.passwordlessPostLogin,uh),yield $a(xi.verifyInviteToken,dh),yield $a(xi.webAuthnPrelogin,Sh),yield $a(xi.webAuthnPostLogin,vh),yield $a(xi.webAuthnCreateNewDeviceSession,ph),yield $a(xi.webAuthnVerifyNewDeviceSession,gh),yield $a(xi.afterAuthNavigation,YS),yield $a(xi.getUserIP,Yv),yield $a(xi.preEnrollMFASMSForLogin,kh),yield $a(xi.enrollMFASMSForLogin,Oh),yield $a(xi.preEnrollMFAWebAuthnForLogin,Ih),yield $a(xi.enrollMFAWebAuthnForLogin,Ph),yield $a(xi.enrollMFAAuthenticatorAppForLogin,_h),yield $a(xi.preVerifyMFASMSForLogin,dv),yield $a(xi.verifyMFASMSForLogin,yv),yield $a(xi.preVerifyMFAWebAuthnForLogin,vv),yield $a(xi.verifyMFAWebAuthnForLogin,hv),yield $a(xi.preVerifyMFAEmailCode,Ev),yield $a(xi.verifyMFAEmailCode,kv),yield $a(xi.resetBreachedPassword,Lh)}function*Uh({payload:e}){e&&(yield $o(xi.setState({isLoading:!0})));const t=Pp;yield $o(xi.loadTenants()),yield $o(xi.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Ch({payload:{callback:e}}){try{const{ip:t}=Qp[0];yield $o(xi.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Rh(){yield $a(xi.requestAuthorize,Uh),yield $a(xi.afterAuthNavigation,YS),yield $a(xi.getUserIP,Ch)}const Dh=["callback","samlVendor"],Nh=["callback","samlVendor"];function*Mh(){try{var e,t;yield $o(xi.setSSOState({loading:!0}));const n=yield jo(tp.auth.getSamlConfiguration),i=yield jo(tp.auth.getOidcConfiguration),o=yield jo(tp.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 $o(xi.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield $o(xi.setSSOState({error:Sg(e),loading:!1}))}}function*Fh({payload:e}){const t=yield zo((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield $o(xi.setSSOState({error:void 0,[n]:!0}));try{const i=yield bp(e[0]),o=yield jo(tp.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield $o(xi.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield $o(xi.setSSOState({samlConfiguration:t,error:Sg(e),[n]:!1}))}}function*Gh({payload:e}){const{configFile:t,callback:n}=e,i=yield zo((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield $o(xi.setSSOState({error:void 0,[o]:!0}));try{const e=yield bp(t),a=yield jo(tp.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield $o(xi.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield $o(xi.setSSOState({samlConfiguration:i,error:Sg(e),[o]:!1})),null==n||n(null,e)}}function*$h({payload:e}){const{callback:t,samlVendor:n}=e,i=eo(e,Dh),o=yield zo((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 $o(xi.setSSOState({samlConfiguration:D({},o,a)})));if(yield $o(xi.setSSOState({error:void 0,[r]:!0})),e.type===op.Saml){var s,l;const e=yield jo(tp.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=hp(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 jo(tp.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield $o(xi.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield $o(xi.setSSOState({samlConfiguration:o,error:Sg(e),[r]:!1})),null==t||t(null,e)}}function*Vh({payload:{callback:e}={}}){const t=yield zo((e=>e.auth.ssoState.samlConfiguration));try{yield $o(xi.setSSOState({error:void 0,saving:!0})),yield jo(tp.auth.validateSamlDomain),yield $o(xi.setSSOState({samlConfiguration:D({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield $o(xi.setSSOState({samlConfiguration:D({},t,{validated:!1}),error:Sg(n),saving:!1})),null==e||e(null,n)}}function*xh(){try{const e=yield jo(tp.auth.getSamlRoles),t=yield jo(tp.auth.getSamlRolesGroups);yield $o(xi.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield $o(xi.setSSOState({error:Sg(e)}))}}function*jh({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield $o(xi.setSSOState({error:void 0,saving:!0})),yield jo(tp.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Vo(e.map((e=>jo(tp.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield $o(xi.setSSOState({error:Sg(e)}))}}(n)),yield xh(),yield $o(xi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield $o(xi.setSSOState({error:Sg(t),saving:!1})),null==e||e(null,t)}}function*Bh({payload:{callback:e,id:t}}){try{yield $o(xi.setSSOState({error:void 0,saving:!0})),yield jo(tp.auth.deleteSamlGroup,{id:t}),yield xh(),yield $o(xi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield $o(xi.setSSOState({error:Sg(t),saving:!1})),null==e||e(null,t)}}function*Wh({payload:{group:e,roleIds:t,callback:n}}){try{yield $o(xi.setSSOState({error:void 0,saving:!0})),yield jo(tp.auth.createSamlGroup,{group:e,roleIds:t}),yield xh(),yield $o(xi.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield $o(xi.setSSOState({error:Sg(e),saving:!1})),null==n||n(null,e)}}function*zh({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield $o(xi.setSSOState({loading:!0})),yield jo(tp.auth.oidcPostLoginV2,t),yield jo(Wv),yield $o(xi.setSSOState({loading:!1}))}catch(e){yield $o(xi.setSSOState({loading:!1,error:Sg(e,"Failed to authenticate"),firstLoad:!1}))}}function*Kh(){yield Fa(xi.loadSSOConfigurations,Mh),yield Fa(xi.saveSSOConfigurations,$h),yield Fa(xi.saveSSOConfigurationsFile,Fh),yield Fa(xi.saveSSOConfigurationsFileWithCallback,Gh),yield Fa(xi.validateSSODomain,Vh),yield Fa(xi.loadSSOAuthorizationRoles,xh),yield Fa(xi.updateSSOAuthorizationRoles,jh),yield Fa(xi.deleteSamlGroup,Bh),yield Fa(xi.createSamlGroup,Wh),yield Fa(xi.oidcPostlogin,zh)}function*qh(){yield $o(xi.setSSOState({loading:!0})),yield Et(),yield $o(xi.setSSOState({samlConfiguration:Dp,loading:!1,firstLoad:!1}))}function*Hh({payload:e}){const t="saving";yield $o(xi.setSSOState({error:void 0,[t]:!0}));const n=D({},yield zo((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield $o(xi.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Jh({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=eo(e,Nh),r=Fp.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 $o(xi.setSSOState({samlConfiguration:D({},r,s)})));yield $o(xi.setSSOState({error:void 0,[l]:!0})),yield Et(),s.acsUrl=null==Np||null==(t=Np.configuration)?void 0:t.acsUrl,s.spEntityId=null==Np||null==(n=Np.configuration)?void 0:n.spEntityId;const c=hp(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 $o(xi.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*Yh({payload:{callback:e}={}}){const t=Fp.samlConfiguration;yield $o(xi.setSSOState({error:void 0,saving:!0})),yield Et(),yield $o(xi.setSSOState({samlConfiguration:D({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Qh(){yield Et(),yield $o(xi.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Xh({payload:{callback:e,authorizationRoles:t}}){yield $o(xi.setSSOState({error:void 0,saving:!0})),yield Et(),yield $o(xi.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Zh(){yield Fa(xi.loadSSOConfigurations,qh),yield Fa(xi.saveSSOConfigurations,Jh),yield Fa(xi.saveSSOConfigurationsFile,Hh),yield Fa(xi.validateSSODomain,Yh),yield Fa(xi.loadSSOAuthorizationRoles,Qh),yield Fa(xi.updateSSOAuthorizationRoles,Xh)}const em=["callback"],tm=["callback","ssoConfigId"],nm=["callback","ssoConfigId"],im=["callback","ssoConfigId"];function*om(){try{return yield jo(tp.auth.getOidcConfiguration)}catch(e){return null}}function*am(){try{return yield jo(tp.metadata.getSamlMetadata)}catch(e){return null}}function*rm(){try{yield $o(xi.setSSOLoader({key:ip.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Vo([jo(om),jo(am)]),n=yield jo(tp.auth.getSSOConfigurations);yield $o(xi.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield $o(xi.setSSOError({key:ip.LOAD_SSO_CONFIGURATIONS,value:Sg(e)}))}finally{yield $o(xi.setSSOLoader({key:ip.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*sm({payload:e}){yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=eo(e,em),i=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield jo(tp.auth.createSSOConfiguration,D({},n,{enabled:null!=(o=n.enabled)&&o}));yield $o(xi.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield $o(xi.setSSOError({key:ip.SAVE_SSO_CONFIGURATION,value:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION,value:!1}))}}function*lm({payload:e}){yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield bp(t),o=yield jo(tp.auth.createSSOConfigurationByMetadata,{metadata:e});yield $o(xi.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield $o(xi.setSSOError({key:ip.SAVE_SSO_CONFIGURATION_BY_METADATA,value:Sg(e)})),null==n||n(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*cm({payload:e}){yield $o(xi.setSSOLoader({key:ip.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=eo(e,tm),o=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield jo(tp.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield $o(xi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield $o(xi.setSSOError({key:ip.UPDATE_SSO_CONFIGURATION,value:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*um({payload:e}){yield $o(xi.setSSOLoader({key:ip.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield bp(i),a=yield jo(tp.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield $o(xi.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield $o(xi.setSSOError({key:ip.UPDATE_SSO_CONFIGURATION,value:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*dm({payload:e}){yield $o(xi.setSSOLoader({key:ip.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{yield jo(tp.auth.deleteSSOConfiguration,t),yield $o(xi.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield $o(xi.setSSOError({key:ip.DELETE_SSO_CONFIGURATION,value:Sg(e)})),null==n||n(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.DELETE_SSO_CONFIGURATION,value:!1}))}}function*ym({payload:e}){const{callback:t,ssoConfigId:n}=e,i=eo(e,nm);yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_DOMAIN,value:!0}));const o=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield jo(tp.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?D({},t,{domains:[...t.domains,e]}):t));yield $o(xi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield $o(xi.setSSOError({key:ip.SAVE_SSO_DOMAIN,value:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_DOMAIN,value:!1}))}}function*fm({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield $o(xi.setSSOLoader({key:ip.DELETE_SSO_DOMAIN,value:!0}));const o=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{yield jo(tp.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?D({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield $o(xi.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield $o(xi.setSSOError({key:ip.DELETE_SSO_DOMAIN,value:Sg(e)})),null==i||i(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.DELETE_SSO_DOMAIN,value:!1}))}}function*pm({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield $o(xi.setSSOLoader({key:ip.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{yield jo(tp.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 $o(xi.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield $o(xi.setSSOError({key:ip.VALIDATE_SSO_DOMAIN,value:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.VALIDATE_SSO_DOMAIN,value:!1}))}}function*gm({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield $o(xi.setSSOLoader({key:ip.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{yield jo(tp.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?D({},e,{roleIds:n}):e));yield $o(xi.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield $o(xi.setSSOError({key:ip.UPDATE_SSO_DEFAULT_ROLES,value:Sg(t)})),null==e||e(null,t)}finally{yield $o(xi.setSSOLoader({key:ip.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Sm({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_GROUPS,value:!0}));const o=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{yield Vo(t.map((e=>jo(tp.auth.deleteSSOGroup,n,e)))),yield Vo(e.map((e=>jo(tp.auth.createSSOGroup,n,e))));const a=yield jo(tp.auth.getSSOGroups,n),r=o.map((e=>e.id===n?D({},e,{groups:a}):e));yield $o(xi.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield $o(xi.setSSOError({key:ip.SAVE_SSO_GROUPS,value:Sg(e)})),null==i||i(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_GROUPS,value:!1}))}}function*vm({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Vo(t.map((t=>jo(tp.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield $o(xi.setSSOError({key:ip.SAVE_SSO_GROUPS,value:Sg(e)})),null==n||n(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_GROUPS,value:!1}))}}function*hm({payload:e}){yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,s;i?(r=yield jo(tp.auth.updateSSOConfigurationByMetadataUrl,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield jo(tp.auth.createSSOConfigurationByMetadataUrl,e),s=[r,...a]),yield $o(xi.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*mm({payload:e}){yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=eo(e,im),o=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield jo(tp.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield jo(tp.auth.createSSOConfiguration,i),a=[e,...o]),yield $o(xi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Am(){yield Fa(xi.loadSSOConfigurationsV2,rm),yield Fa(xi.saveSSOConfigurationV2,sm),yield Fa(xi.saveSSODomain,ym),yield Fa(xi.deleteSSODomain,fm),yield Fa(xi.validateSSODomainV2,pm),yield Fa(xi.updateSSOConfiguration,cm),yield Fa(xi.deleteSSOConfiguration,dm),yield Fa(xi.setSSOGroups,Sm),yield Fa(xi.updateSSOGroups,vm),yield Fa(xi.setSSODefaultRoles,gm),yield Fa(xi.saveSSOConfigurationByMetadata,lm),yield Fa(xi.updateSSOConfigurationByMetadata,um),yield Fa(xi.saveSSOConfigurationByUrl,hm),yield Fa(xi.saveSSOConfigurationByData,mm)}const bm=["callback","profilePictureUrl"],Tm=["callback","profilePictureUrl"];function*Em(){yield $o(xi.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 jo.apply(void 0,[Ma,e,t,n].concat(o))}(3,2e3,tp.teams.getProfile),t=yield zo((e=>e.auth.user));xi.setUser(D({},t,e)),yield $o(xi.setProfileState({profile:e,loading:!1}))}catch(e){yield $o(xi.setProfileState({loading:!1,error:Sg(e)}))}}function*km(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=eo(e.payload,bm);yield $o(xi.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield zo((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 jo(tp.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 jo(tp.users.updateUserProfileV2,a),s=yield zo((e=>e.auth.user));yield $o(xi.setUser(D({},s,r))),yield $o(xi.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield $o(xi.setProfileState({saving:!1,error:Sg(e),loading:!1})),null==t||t(null,e)}}function*Om({payload:e}){yield $o(xi.setProfileState({loading:!0}));try{var t;yield jo(tp.teams.changePassword,e),yield $o(xi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $o(xi.setProfileState({loading:!1,error:Sg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Im(){yield $a(xi.loadProfile,Em),yield Fa(xi.saveProfile,km),yield Fa(xi.changePassword,Om)}function*Pm(){yield $o(xi.setProfileState({loading:!0})),yield Et(),yield $o(xi.setUser(D({},Pp,Ip))),yield $o(xi.setProfileState({loading:!1,profile:Ip}))}function*_m(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=eo(e.payload,Tm);yield $o(xi.setProfileState({saving:!0,error:null}));const o=_p;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=Pp;yield Et(),yield $o(xi.setUser(D({},s,r))),yield $o(xi.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Lm({payload:e}){var t;yield $o(xi.setProfileState({loading:!0})),yield Et(),yield $o(xi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*wm(){yield $a(xi.loadProfile,Pm),yield Fa(xi.saveProfile,_m),yield Fa(xi.changePassword,Lm)}const Um=["callback"],Cm=["callback"],Rm=["user"],Dm=["callback"],Nm=["deviceId","callback"],Mm=["deviceId","callback"],Fm=["callback"],Gm=["deviceId"],$m=["deviceId"],Vm=["callback"],xm=["deviceId"],jm=["callback"];function*Bm(e){const{step:t}=yield zo((e=>e.auth.mfaState));return{step:e.recoveryCode?cn.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Wm(){yield $o(xi.setMfaState({saving:!0}));try{const{qrCode:e}=yield jo(tp.auth.enrollMfa);yield $o(xi.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield $o(xi.setMfaState({saving:!1,error:Sg(e)}))}}function*zm(e){let{payload:{callback:t}}=e,n=eo(e.payload,Um);yield $o(xi.setMfaState({saving:!0}));try{const e=yield zo((e=>e.auth.user)),i=yield jo(tp.auth.verifyMfa,n),o=yield jo(tp.auth.getMFADevices),a=yield Bm(i);yield $o(xi.setMfaState(D({},a,{mfaDevices:o}))),yield $o(xi.setUser(D({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*Km(e){let{payload:{callback:t}}=e,n=eo(e.payload,Cm);yield $o(xi.setMfaState({loading:!0}));try{const e=yield jo(tp.auth.loginWithMfaV2,n),{user:i}=e,o=eo(e,Rm),a={step:cn.recoveryCode,loading:!1,saving:!1,error:void 0};null!=i&&i.recoveryCode&&(a.recoveryCode=i.recoveryCode),yield $o(xi.setMfaState(a)),yield qS(D({user:i},o)),null==t||t(a.recoveryCode)}catch(e){yield $o(xi.setMfaState({loading:!1,error:Sg(e)})),null==t||t(null,e)}}function*qm({payload:e}){yield $o(xi.setMfaState({saving:!0}));try{var t;yield jo(tp.auth.disableMfa,e);const n=yield jo(tp.auth.getMFADevices);yield $o(xi.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $o(xi.setMfaState({saving:!1,error:Sg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Hm({payload:e}){yield $o(xi.setMfaState({saving:!0}));try{var t,n;const i=yield jo(tp.auth.preEnrollMFAWebAuthn),o=D({},i.options,{challenge:It(i.options.challenge),user:D({},i.options.user,{id:It(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>D({},e,{id:It(e.id)})))});yield $o(xi.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield $o(xi.setMfaState({saving:!1,error:Sg(t)})),null==(i=e.callback)||i.call(e,null,t)}}function*Jm(e){let{payload:{callback:t}}=e,n=eo(e.payload,Dm);yield $o(xi.setMfaState({saving:!0}));try{const e=Pt(n.publicKey),i=yield jo(tp.auth.enrollMFAWebAuthn,D({},n,{options:e})),o=yield jo(tp.auth.getMFADevices),a=yield Bm(i);yield $o(xi.setMfaState(D({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*Ym(e){let{payload:{deviceId:t,callback:n}}=e;eo(e.payload,Nm),yield $o(xi.setMfaState({saving:!0}));try{var i;const e=yield jo(tp.auth.preDisableMFAWebAuthn,t),o=D({},e.options,{challenge:It(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>D({},e,{id:It(e.id)})))});yield $o(xi.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==n||n(null,e)}}function*Qm(e){let{payload:{deviceId:t,callback:n}}=e,i=eo(e.payload,Mm);yield $o(xi.setMfaState({saving:!0}));try{const e=Pt(i.publicKey);yield jo(tp.auth.disableMFAWebAuthn,t,D({},i,{options:e}));const o=yield jo(tp.auth.getMFADevices);yield $o(xi.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==n||n(!1,e)}}function*Xm({payload:e}){yield $o(xi.setMfaState({saving:!0}));try{var t;const n=yield jo(tp.auth.preEnrollMFASMS,e);yield $o(xi.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 $o(xi.setMfaState({saving:!1,error:Sg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Zm(e){let{payload:{callback:t}}=e,n=eo(e.payload,Fm);yield $o(xi.setMfaState({saving:!0}));try{const e=yield jo(tp.auth.enrollMFASMS,n),i=yield jo(tp.auth.getMFADevices),o=yield Bm(e);yield $o(xi.setMfaState(D({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*eA(e){let{payload:{deviceId:t}}=e,n=eo(e.payload,Gm);yield $o(xi.setMfaState({saving:!0}));try{var i;const e=yield jo(tp.auth.preDisableMFASMS,t);yield $o(xi.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 $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*tA(e){let{payload:{deviceId:t}}=e,n=eo(e.payload,$m);yield $o(xi.setMfaState({saving:!0}));try{var i;yield jo(tp.auth.disableMFASMS,t,n);const e=yield jo(tp.auth.getMFADevices);yield $o(xi.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*nA(){yield $o(xi.setMfaState({loading:!0}));try{yield zo((e=>e.auth.user));const e=yield jo(tp.auth.getMFADevices);yield $o(xi.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield $o(xi.setMfaState({loading:!1,error:Sg(e)}))}}function*iA(){yield $o(xi.setMfaState({loading:!0}));try{const e=(yield jo(tp.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield $o(xi.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield $o(xi.setMfaState({loading:!1,error:Sg(e)}))}}function*oA(){yield Fa(xi.enrollMfa,Wm),yield Fa(xi.getMFADevices,nA),yield Fa(xi.getMFAStrategies,iA),yield Fa(xi.verifyMfa,zm),yield Fa(xi.disableMfa,qm),yield Fa(xi.verifyMfaAfterForce,Km),yield Fa(xi.preDisableMfaSms,eA),yield Fa(xi.disableMfaSms,tA),yield Fa(xi.preEnrollMfaSms,Xm),yield Fa(xi.enrollMfaSms,Zm),yield Fa(xi.preEnrollMfaWebAuthn,Hm),yield Fa(xi.enrollMfaWebAuthn,Jm),yield Fa(xi.preDisableMfaWebAuthn,Ym),yield Fa(xi.disableMfaWebAuthn,Qm)}function*aA(){yield $o(xi.setMfaState({saving:!0})),yield $o(xi.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*rA({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield zo((e=>e.auth.mfaState));yield $o(xi.setMfaState({saving:!0})),yield Et();const n={token:"token",recoveryCode:"recoveryCode"},i={step:cn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:D({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield $o(xi.setMfaState(i)),yield $o(xi.setUser(D({},Pp,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*sA(e){let{payload:{callback:t}}=e,n=eo(e.payload,Vm);yield $o(xi.setMfaState({loading:!0})),yield Et();const i=D({},n,{recoveryCode:"recoveryCode"}),o={step:cn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield $o(xi.setMfaState(o)),yield Et(),yield $o(xi.setUser(D({},Pp,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*lA({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield zo((e=>e.auth.mfaState));yield $o(xi.setMfaState({saving:!0})),yield Et(),yield $o(xi.setMfaState({saving:!1,error:void 0,mfaDevices:D({},n,{authenticators:[]})})),yield $o(xi.setUser(D({},Pp))),null==(t=e.callback)||t.call(e,!0)}function*cA(e){let{}=e,t=eo(e.payload,xm);yield $o(xi.setMfaState({saving:!0}));try{var n;yield $o(xi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==(i=t.callback)||i.call(t,!1,e)}}function*uA({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield zo((e=>e.auth.mfaState));yield $o(xi.setMfaState({saving:!0})),yield Et(),yield $o(xi.setMfaState({loading:!1,error:void 0,mfaDevices:D({},n,{phones:[]})})),yield $o(xi.setUser(D({},Pp))),null==(t=e.callback)||t.call(e,!0)}function*dA({payload:e}){var t;yield $o(xi.setMfaState({saving:!0})),yield Et(),yield $o(xi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*yA(e){let{payload:{callback:t}}=e;eo(e.payload,jm);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield zo((e=>e.auth.mfaState));yield $o(xi.setMfaState({saving:!0})),yield Et();const i={token:"token",recoveryCode:"recoveryCode"},o={step:cn.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 $o(xi.setMfaState(o)),yield $o(xi.setUser(D({},Pp,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*fA(){yield Fa(xi.enrollMfa,aA),yield Fa(xi.verifyMfa,rA),yield Fa(xi.disableMfa,lA),yield Fa(xi.verifyMfaAfterForce,sA),yield Fa(xi.preDisableMfaSms,cA),yield Fa(xi.disableMfaSms,uA),yield Fa(xi.preEnrollMfaSms,dA),yield Fa(xi.enrollMfaSms,yA)}const pA=["callback"];function*gA({payload:e}){yield $o(xi.setForgotPasswordState({loading:!0}));try{var t;yield jo(tp.auth.forgotPassword,e),yield $o(xi.setForgotPasswordState({loading:!1,error:void 0,step:Ht.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $o(xi.setForgotPasswordState({loading:!1,error:Sg(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*SA(e){let{payload:{callback:t}}=e,n=eo(e.payload,pA);yield $o(xi.setForgotPasswordState({loading:!0}));try{yield jo(tp.auth.resetPassword,n),yield $o(xi.setForgotPasswordState({loading:!1,error:void 0,step:Ht.success})),null==t||t(!0)}catch(e){yield $o(xi.setForgotPasswordState({loading:!1,error:Sg(e)})),null==t||t(!1,e)}}function*vA({payload:e}){yield $o(xi.setForgotPasswordState({loading:!0}));try{const t=yield jo(tp.auth.loadPasswordConfig,e);yield $o(xi.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield $o(xi.setForgotPasswordState({loading:!1,error:Sg(e)}))}}function*hA(){yield $a(xi.forgotPassword,gA),yield $a(xi.resetPassword,SA),yield $a(xi.loadPasswordConfig,vA)}let mA;!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"}(mA||(mA={}));const AA=["callback","events"],bA=["user"],TA=["callback"],EA=["callback"];function*kA({payload:{userId:e,token:t}}){yield $o(xi.setActivateState({loading:!0,step:Vt.activating}));try{const{isAuthenticated:n}=yield zo((e=>e.auth));n&&(yield $o(xi.silentLogout()));const i=yield jo(tp.auth.getActivateAccountStrategy,{userId:e,token:t});yield $o(xi.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield $o(xi.setActivateState({loading:!1,step:Vt.activatingForm})))}catch(e){yield $o(xi.setActivateState({loading:!1,error:Sg(e)}))}}function*OA(e){let{payload:{callback:t,events:n}}=e,i=eo(e.payload,AA);yield $o(xi.setActivateState({loading:!0}));try{const e=Va.onRedirectTo,{routes:a}=yield zo((e=>e.auth)),r=yield jo(tp.auth.activateAccountV2,i),{user:s}=r,l=eo(r,bA);if(s.redirectLocation)return void(window.location.href=s.redirectLocation);if(yg(s)){yield $o(xi.setActivateState({step:Vt.success}));const t=yield gg(s);yield $o(xi.setState(t)),yield Ko(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield $o(xi.setActivateState({step:Vt.success}));const e={email:s.email,origin:rg.ACTIVATION_LINK,id:s.id,tenantId:s.tenantId,name:s.name,createdAt:new Date};null==n||null==(o=n.userVerified)||o.call(n,e),hg(vg.USER_VERIFIED,e),yield jo(qS,D({user:s},l),{isAuthenticated:!0}),yield Ko(1e3),yield YS(),yield $o(xi.resetActivateState())}null==t||t(!0)}catch(e){yield $o(xi.setActivateState({loading:!1,error:Sg(e)}))}}function*IA({payload:e}){const{callback:t}=e,n=eo(e,TA);yield $o(xi.setActivateStrategyState({loading:!0}));try{const e=yield jo(tp.auth.getActivateAccountStrategy,n);yield $o(xi.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield $o(xi.setActivateStrategyState({loading:!1,error:Sg(e)}))}}function*PA({payload:e}){const{callback:t}=e,n=eo(e,EA);yield $o(xi.setTeamLoader({key:mA.RESEND_ACTIVATE_LINK,value:n.email})),yield $o(xi.setActivateState({loading:!0}));try{yield jo(tp.auth.resendActivationEmail,n),yield $o(xi.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield $o(xi.setActivateState({loading:!1,error:Sg(e)})),yield $o(xi.setTeamError({key:mA.RESEND_ACTIVATE_LINK,value:Sg(e)})),null==t||t(null,e)}yield $o(xi.setTeamLoader({key:mA.RESEND_ACTIVATE_LINK,value:!1}))}function*_A(){yield $a(xi.activateAccount,OA),yield $a(xi.preActivateAccount,kA),yield $a(xi.getActivateAccountStrategy,IA),yield $a(xi.resendActivationEmail,PA)}function*LA({payload:e}){if(e.token&&e.userId)try{yield $o(xi.setAcceptInvitationState({error:void 0,step:Wt.pending})),yield jo(tp.auth.acceptInvitation,e),yield $o(xi.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Wt.success}}))}catch(e){yield $o(xi.setAcceptInvitationState({step:Wt.failed,error:Sg(e)}))}else yield $o(xi.setAcceptInvitationState({error:void 0,step:Wt.invalid}))}function*wA(){yield $a(xi.acceptInvitation,LA)}var UA,CA=new Uint8Array(16);function RA(){if(!UA&&!(UA="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 UA(CA)}for(var DA=/^(?:[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,NA=function(e){return"string"==typeof e&&DA.test(e)},MA=[],FA=0;FA<256;++FA)MA.push((FA+256).toString(16).substr(1));var GA=function(e,t,n){var i=(e=e||{}).random||(e.rng||RA)();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=(MA[e[t+0]]+MA[e[t+1]]+MA[e[t+2]]+MA[e[t+3]]+"-"+MA[e[t+4]]+MA[e[t+5]]+"-"+MA[e[t+6]]+MA[e[t+7]]+"-"+MA[e[t+8]]+MA[e[t+9]]+"-"+MA[e[t+10]]+MA[e[t+11]]+MA[e[t+12]]+MA[e[t+13]]+MA[e[t+14]]+MA[e[t+15]]).toLowerCase();if(!NA(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let $A,VA;!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"}($A||($A={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(VA||(VA={}));const xA=["callback"],jA=["roles"],BA=["callback"],WA=["callback","profileImage"],zA=["callback"],KA=["callback","userId"],qA=["callback"],HA=["callback"],JA=["callback"],YA=["callback"],QA=["callback"],XA=["callback"],ZA=["callback"],eb=["callback","profileImage"],tb=["callback"],nb=["callback"],ib=["callback"],ob=["callback"],ab=["callback"],rb=["callback"],sb=()=>zo((e=>e.auth.teamState));function*lb(){try{const{groups:e}=yield jo(tp.groups.getGroups,{_groupsRelations:VA.roles});return e}catch(e){return[]}}function*cb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield sb(),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 $o(xi.setTeamLoader({key:mA.USERS,value:!r})),yield $o(xi.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([jo(tp.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})),jo(tp.teams.loadAvailableRoles),jo(tp.teams.loadAvailablePermissions),jo(lb)]),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 $o(xi.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 $o(xi.setTeamError({key:mA.USERS,value:Sg(e)})),yield $o(xi.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield $o(xi.setTeamLoader({key:mA.USERS,value:!1}))}function*ub({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield sb(),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 $o(xi.setTeamLoader({key:mA.USERS,value:!a})),yield $o(xi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield Vo([jo(tp.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),jo(tp.teams.loadAvailableRoles),jo(tp.teams.loadAvailablePermissions)]);yield $o(xi.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield $o(xi.setTeamError({key:mA.USERS,value:e.message})),yield $o(xi.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield $o(xi.setTeamLoader({key:mA.USERS,value:!1}))}function*db({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield sb(),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 $o(xi.setTeamLoader({key:mA.USERS,value:!r})),yield $o(xi.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield Vo([jo(tp.subTenants.loadAllUsers,D({},c)),jo(tp.teams.loadAvailableRoles),jo(tp.teams.loadAvailablePermissions)]);yield $o(xi.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield $o(xi.setTeamError({key:mA.USERS,value:Sg(e)})),yield $o(xi.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield $o(xi.setTeamLoader({key:mA.USERS,value:!1}))}function*yb({payload:e}){yield $o(xi.setTeamLoader({key:mA.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield Vo([jo(tp.teams.loadAvailableRoles),jo(tp.teams.loadAvailablePermissions)]);yield $o(xi.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 $o(xi.setTeamError({key:mA.ROLES_AND_PERMISSIONS,value:Sg(t)}))}yield $o(xi.setTeamLoader({key:mA.ROLES_AND_PERMISSIONS,value:!0}))}function*fb({payload:e}){const{callback:t}=e,n=eo(e,xA),i=yield sb();yield $o(xi.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield jo(tp.teams.addUser,n),{roles:a}=e,r=D({},eo(e,jA),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield $o(xi.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield $o(xi.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!1,error:Sg(e)})})),null==t||t(null,e)}}function*pb({payload:e}){const{callback:t}=e,n=yield sb();yield $o(xi.setTeamState({addUserDialogState:D({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield $o(xi.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield jo(tp.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 $o(xi.loadUsersV2(r)),yield $o(xi.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*gb({payload:e}){const{callback:t}=e,n=eo(e,BA),i=yield sb();yield $o(xi.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})}));try{yield jo(tp.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield jo(tp.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield $o(xi.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield $o(xi.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!1,error:Sg(e)})})),null==t||t(null,e)}}function*Sb({payload:e}){const{callback:t}=e,n=eo(e,WA),{id:i}=n,o=yield sb(),a=o.users.find((e=>e.id===n.id));yield $o(xi.setTeamLoader({key:mA.UPDATE_USER,value:i||""})),yield $o(xi.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!0})})),yield $o(xi.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 jo(tp.teams.updateUser,n);null==t||t(e),yield $o(xi.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 $o(xi.setTeamLoader({key:mA.UPDATE_USER,value:!1}))}catch(e){yield $o(xi.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!1,error:Sg(e)}),users:o.users.map((e=>e.id===n.id?D({},e,a):e))})),yield $o(xi.setTeamLoader({key:mA.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*vb({payload:e}){const{callback:t}=e,n=eo(e,zA),i=yield sb();yield $o(xi.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})}));try{yield jo(tp.teams.deleteUser,n),null==t||t(!0),yield $o(xi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield $o(xi.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!1,error:Sg(e)})})),null==t||t(null,e)}}function*hb({payload:e}){const{callback:t,userId:n}=e,i=eo(e,KA),o=yield sb();yield $o(xi.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!0})}));try{yield jo(tp.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 $o(xi.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 $o(xi.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!1,error:Sg(e)})})),null==t||t(null,e)}}function*mb({payload:e}){const{callback:t}=e,n=eo(e,qA),i=yield sb();yield $o(xi.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})}));try{yield jo(tp.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield $o(xi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield $o(xi.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!1,error:Sg(e)})})),null==t||t(null,e)}}function*Ab({payload:e}){const{callback:t}=e,n=eo(e,HA);yield $o(xi.setTeamLoader({key:mA.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield jo(tp.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield $o(xi.setTeamError({key:mA.RESEND_ACTIVATE_LINK,value:Sg(e)})),null==t||t(null,e)}yield $o(xi.setTeamLoader({key:mA.RESEND_ACTIVATE_LINK,value:!1}))}function*bb({payload:e}){const{callback:t}=e,n=eo(e,JA);yield $o(xi.setTeamLoader({key:mA.RESEND_INVITATION_LINK,value:n.email}));try{yield jo(tp.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield $o(xi.setTeamError({key:mA.RESEND_INVITATION_LINK,value:Sg(e)})),null==t||t(null,e)}yield $o(xi.setTeamLoader({key:mA.RESEND_INVITATION_LINK,value:!1}))}function*Tb({payload:e}){const{callback:t}=e,n=eo(e,YA);yield $o(xi.setTeamLoader({key:mA.RESEND_INVITATION_LINK,value:n.email}));try{yield jo(tp.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield $o(xi.setTeamError({key:mA.RESEND_INVITATION_LINK,value:Sg(e)})),null==t||t(null,e)}yield $o(xi.setTeamLoader({key:mA.RESEND_INVITATION_LINK,value:!1}))}function*Eb({payload:e}){const{callback:t}=e,n=eo(e,QA);yield $o(xi.setTeamLoader({key:mA.RESEND_INVITATION_LINK,value:n.email}));try{yield jo(tp.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield $o(xi.setTeamError({key:mA.RESEND_INVITATION_LINK,value:Sg(e)})),null==t||t(null,e)}yield $o(xi.setTeamLoader({key:mA.RESEND_INVITATION_LINK,value:!1}))}function*kb(){yield $o(xi.setTeamError({key:mA.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield jo(tp.teams.getInviteLinkConfiguration);yield $o(xi.setTeamState({inviteTokenState:D({},e)}))}catch(e){yield $o(xi.setTeamError({key:mA.CONFIG_TOKEN_LINK,value:Sg(e)}))}}function*Ob(){yield $o(xi.setTeamError({key:mA.GET_TOKEN_LINK,value:!1}));try{yield jo(kb);const e=yield jo(tp.teams.getInviteUserLink),{inviteTokenState:t}=yield sb();yield $o(xi.setTeamState({inviteTokenState:D({},t,e)}))}catch(e){yield $o(xi.setTeamError({key:mA.GET_TOKEN_LINK,value:Sg(e)}))}}function*Ib({payload:{callback:e}}){yield $o(xi.setTeamError({key:mA.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield sb();try{const n=yield jo(tp.teams.createInviteUserLink,{expiresInMinutes:43200});yield $o(xi.setTeamState({inviteTokenState:D({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield $o(xi.setTeamError({key:mA.CREATE_TOKEN_LINK,value:Sg(t)}))}}function*Pb({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield sb();yield $o(xi.setTeamError({key:mA.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield jo(tp.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield $o(xi.setTeamState({inviteTokenState:D({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield $o(xi.setTeamError({key:mA.UPDATE_TOKEN_LINK,value:Sg(t)}))}}function*_b({payload:e}){const{callback:t}=null!=e?e:{};yield $o(xi.setTeamError({key:mA.DELETE_TOKEN_LINK,value:!1}));try{yield jo(tp.teams.deleteInviteUserLink),yield $o(xi.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield $o(xi.setTeamError({key:mA.DELETE_TOKEN_LINK,value:Sg(e)})),null==t||t(!1,e)}}function*Lb({payload:e}){yield $o(xi.setTeamState({addUserDialogState:D({open:!0,loading:!1,error:!1},e)}))}function*wb({payload:e}){const t=yield sb(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield $o(xi.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Ub({payload:e}){yield $o(xi.setTeamState({deleteUserDialogState:D({open:!0,loading:!1,error:!1},e)}))}function*Cb({payload:e}){const t=yield sb(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield $o(xi.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Rb(){yield Ga(xi.loadUsers,ub),yield Ga(xi.loadUsersV2,cb),yield Ga(xi.loadAllSubTenantsUsers,db),yield Ga(xi.loadRoles,yb),yield Fa(xi.addUser,fb),yield Fa(xi.addUsersBulk,pb),yield Fa(xi.addUserToSubTenants,gb),yield Fa(xi.updateUser,Sb),yield Fa(xi.setUserRolesForSubTenants,hb),yield Fa(xi.deleteUser,vb),yield Fa(xi.deleteUserFromSubTenants,mb),yield Fa(xi.resendActivationLink,Ab),yield Fa(xi.resendInvitationLink,bb),yield Fa(xi.resendInvitationEmail,Tb),yield Fa(xi.resendInvitationLinkToAllSubTenants,Eb),yield Fa(xi.getInvitationLink,Ob),yield Fa(xi.createInvitationLink,Ib),yield Fa(xi.updateInvitationLink,Pb),yield Fa(xi.deleteInvitationLink,_b),yield Fa(xi.openAddUserDialog,Lb),yield Fa(xi.closeAddUserDialog,wb),yield Fa(xi.openDeleteUserDialog,Ub),yield Fa(xi.closeDeleteUserDialog,Cb)}function*Db({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield sb(),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 $o(xi.setTeamLoader({key:mA.USERS,value:!a})),yield $o(xi.setTeamState({pageSize:l,pageOffset:c,filterV2:u,sortV2:d})),yield Et(),yield $o(xi.setTeamState({users:Wp,totalPages:2,totalItems:10,roles:Mp,permissions:Gp})),yield $o(xi.setTeamLoader({key:mA.USERS,value:!1})),null==r||r(Wp)}function*Nb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield sb(),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 $o(xi.setTeamLoader({key:mA.USERS,value:!r})),yield $o(xi.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield Et(),yield $o(xi.setTeamState({allUsers:Kp,totalPages:2,totalItems:10,roles:Mp,permissions:Gp})),yield $o(xi.setTeamLoader({key:mA.USERS,value:!1})),null==s||s(Kp)}function*Mb({payload:e}){var t;yield $o(xi.setTeamLoader({key:mA.ROLES_AND_PERMISSIONS,value:!0})),yield Et(),yield $o(xi.setTeamState({roles:Mp,permissions:Gp})),yield $o(xi.setTeamLoader({key:mA.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Mp,permissions:Gp})}function*Fb({payload:e}){const{callback:t}=e,n=eo(e,XA),i=yield sb();yield $o(xi.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})})),yield Et();const o=D({},xp,{groups:[]},n,{id:`${GA()}`});null==t||t(o),yield $o(xi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Gb({payload:e}){const{callback:t}=e,n=eo(e,ZA),i=yield sb();yield $o(xi.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})})),yield Et();const o=D({},xp,n,{id:`${GA()}`});yield $o(xi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*$b({payload:e}){var t;const{callback:n}=e,i=eo(e,eb),{id:o}=i,a=yield sb(),r=a.users.find((e=>e.id===i.id));yield $o(xi.setTeamLoader({key:mA.UPDATE_USER,value:o||""})),yield $o(xi.setTeamState({addUserDialogState:D({},a.addUserDialogState,{loading:!0})})),yield $o(xi.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 $o(xi.setTeamState({users:a.users.map((e=>e.id===s.id?D({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield $o(xi.setTeamLoader({key:mA.UPDATE_USER,value:!1}))}function*Vb({payload:e}){const{callback:t}=e,n=eo(e,tb),i=yield sb();yield $o(xi.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield $o(xi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*xb({payload:e}){const{callback:t}=e,n=eo(e,nb),i=yield sb();yield $o(xi.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield $o(xi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*jb({payload:e}){const{callback:t}=e,n=eo(e,ib);yield $o(xi.setTeamLoader({key:mA.RESEND_ACTIVATE_LINK,value:n.userId})),yield Et(),null==t||t(!0),yield $o(xi.setTeamLoader({key:mA.RESEND_ACTIVATE_LINK,value:!1}))}function*Bb({payload:e}){const{callback:t}=e,n=eo(e,ob);yield $o(xi.setTeamLoader({key:mA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield $o(xi.setTeamLoader({key:mA.RESEND_INVITATION_LINK,value:!1}))}function*Wb({payload:e}){const{callback:t}=e,n=eo(e,ab);yield $o(xi.setTeamLoader({key:mA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield $o(xi.setTeamLoader({key:mA.RESEND_INVITATION_LINK,value:!1}))}function*zb({payload:e}){const{callback:t}=e,n=eo(e,rb);yield $o(xi.setTeamLoader({key:mA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield $o(xi.setTeamLoader({key:mA.RESEND_INVITATION_LINK,value:!1}))}function*Kb(){yield Ga(xi.loadUsersV2,Db),yield Ga(xi.loadAllSubTenantsUsers,Nb),yield Ga(xi.loadRoles,Mb),yield Fa(xi.addUser,Fb),yield Fa(xi.addUserToSubTenants,Gb),yield Fa(xi.updateUser,$b),yield Fa(xi.deleteUser,Vb),yield Fa(xi.deleteUserFromSubTenants,xb),yield Fa(xi.resendActivationLink,jb),yield Fa(xi.resendInvitationLink,Bb),yield Fa(xi.resendInvitationEmail,Wb),yield Fa(xi.resendInvitationLinkToAllSubTenants,zb),yield Fa(xi.openAddUserDialog,Lb),yield Fa(xi.closeAddUserDialog,wb),yield Fa(xi.openDeleteUserDialog,Ub),yield Fa(xi.closeDeleteUserDialog,Cb)}const qb=["authorizationUrl"],Hb=["events","url"];function*Jb(){try{yield $o(xi.setSocialLoginsState({loading:!0}));const e=yield jo(tp.auth.getSocialLoginProviders);yield $o(xi.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield $o(xi.setSocialLoginsState({error:Sg(e),loading:!1,firstLoad:!1}))}}function*Yb(){const e=yield zo((({auth:e})=>e.isAuthenticated));let t;return t=e?yield jo(tp.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield jo(tp.auth.getSocialLoginProvidersV2),t}function*Qb(){try{const e=yield zo((e=>e.root.context));yield $o(xi.setSocialLoginsState({loading:!0}));const t=yield jo(Yb),{providers:n}=yield jo(tp.auth.getCustomSocialLoginProvidersV1),i=t.map((t=>{let{authorizationUrl:n}=t,i=eo(t,qb);const o=_r(e,null!=n?n:"");return D({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield $o(xi.setSocialLoginsState({socialLoginsConfigV2:i,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield $o(xi.setSocialLoginsState({error:Sg(e),loading:!1,firstLoad:!1}))}}function*Xb(e){let{payload:{events:t,url:n}}=e,i=eo(e.payload,Hb);try{yield $o(xi.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield jo(tp.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:sg.SOCIAL_LOGIN});null==t||null==(o=t.signUpComplete)||o.call(t,u),hg(vg.SIGNUP_COMPLETED,u);const d=D({},r,{origin:rg.SOCIAL_LOGIN,name:c});null==t||null==(a=t.userVerified)||a.call(t,d),hg(vg.USER_VERIFIED,d)}s&&localStorage.setItem("userId",s),yield $o(xi.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield zo((e=>e.auth));e?yield jo(Kv):yield jo(Hv)}(),localStorage.removeItem("register-quick-login"),yield $o(xi.setSocialLoginsState({loading:!1}))}catch(e){yield $o(xi.setSocialLoginsState({loading:!1,error:Sg(e,"Failed to authenticate"),firstLoad:!1}))}}function*Zb({payload:e}){yield $o(xi.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*eT(){yield $a(xi.loadSocialLoginsConfiguration,Jb),yield $a(xi.loadSocialLoginsConfigurationV2,Qb),yield $a(xi.loginViaSocialLogin,Xb),yield Ga(xi.setSocialLoginError,Zb)}let tT;function*nT({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield zo((e=>e.auth.apiTokensState)),{policy:a}=yield zo((e=>e.auth.securityPolicyState.publicPolicy)),r=(null==a?void 0:a.machineToMachineAuthStrategy)===Oi.AccessToken;try{let e;yield $o(xi.setApiTokensLoader({key:tT.ADD_API_TOKEN,value:!0}));let a=null;n&&(a=1440*n),e=r?yield jo(tp.auth.createUserAccessToken,{description:t,expiresInMinutes:a}):yield jo(tp.auth.updateUserApiTokensData,{description:t,expiresInMinutes:a}),yield $o(xi.setApiTokensState({showAddTokenDialog:!1})),yield Ko(200),yield $o(xi.setApiTokensState({apiTokensDataUser:[D({},e,{type:r?Oi.AccessToken:Oi.ClientCredentials}),...o],successDialog:{open:!0,secret:e.secret,clientId:r?void 0:e.clientId}})),yield $o(xi.setApiTokensLoader({key:tT.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield $o(xi.setApiTokensError({key:tT.ADD_API_TOKEN,value:Sg(e)})),yield $o(xi.setApiTokensLoader({key:tT.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*iT({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield zo((e=>e.auth.apiTokensState)),{policy:r}=yield zo((e=>e.auth.securityPolicyState.publicPolicy)),s=(null==r?void 0:r.machineToMachineAuthStrategy)===Oi.AccessToken;try{let e;yield $o(xi.setApiTokensLoader({key:tT.ADD_API_TOKEN,value:!0}));let r=null;i&&(r=1440*i),e=s?yield jo(tp.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n}):yield jo(tp.auth.updateTenantApiTokensData,{description:t,roleIds:n,expiresInMinutes:r}),yield $o(xi.setApiTokensState({showAddTokenDialog:!1})),yield Ko(200),yield $o(xi.setApiTokensState({apiTokensDataTenant:[D({},e,{type:s?Oi.AccessToken:Oi.ClientCredentials}),...a],successDialog:{open:!0,secret:e.secret,clientId:s?void 0:e.clientId}})),yield $o(xi.setApiTokensLoader({key:tT.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield $o(xi.setApiTokensError({key:tT.ADD_API_TOKEN,value:Sg(e)})),yield $o(xi.setApiTokensLoader({key:tT.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*oT({payload:e}){const{apiTokensDataUser:t}=yield zo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield $o(xi.setApiTokensLoader({key:tT.DELETE_API_TOKEN,value:!0})),n?(yield jo(tp.auth.deleteUserAccessToken,{id:e}),yield $o(xi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield jo(tp.auth.deleteUserApiToken,{tokenId:e}),yield $o(xi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield $o(xi.setApiTokensLoader({key:tT.DELETE_API_TOKEN,value:!1}))}catch(e){yield $o(xi.setApiTokensError({key:tT.DELETE_API_TOKEN,value:Sg(e)})),yield $o(xi.setApiTokensLoader({key:tT.DELETE_API_TOKEN,value:!1}))}}function*aT({payload:e}){const{apiTokensDataTenant:t}=yield zo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield $o(xi.setApiTokensLoader({key:tT.DELETE_API_TOKEN,value:!0})),n?(yield jo(tp.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield jo(tp.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield $o(xi.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield $o(xi.setApiTokensLoader({key:tT.DELETE_API_TOKEN,value:!1}))}catch(e){yield $o(xi.setApiTokensError({key:tT.DELETE_API_TOKEN,value:Sg(e)})),yield $o(xi.setApiTokensLoader({key:tT.DELETE_API_TOKEN,value:!1}))}}function*rT({payload:e}){null!=e&&e.silentLoading||(yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield Vo([jo(tp.auth.getUserApiTokensData),jo(tp.auth.getTenantApiTokensData)]);yield $o(xi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $o(xi.setApiTokensError({key:tT.LOAD_API_TOKENS,value:Sg(t)})),yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*sT({payload:e}){null!=e&&e.silentLoading||(yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=jo(tp.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=jo(tp.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 $o(xi.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield $o(xi.setApiTokensError({key:tT.LOAD_API_TOKENS,value:Sg(t)})),yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*lT({payload:e}){null!=e&&e.silentLoading||(yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=jo(tp.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=jo(tp.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 $o(xi.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield $o(xi.setApiTokensError({key:tT.LOAD_API_TOKENS,value:Sg(t)})),yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*cT(){yield $a(xi.loadApiTokens,rT),yield $a(xi.loadUserApiTokens,sT),yield $a(xi.loadTenantApiTokens,lT),yield Fa(xi.addUserApiToken,nT),yield Fa(xi.addTenantApiToken,iT),yield Ga(xi.deleteTenantApiToken,aT),yield Ga(xi.deleteUserApiToken,oT)}function*uT({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield $o(xi.setApiTokensLoader({key:tT.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield zo((e=>e.auth.apiTokensState)),a=D({},kp,{description:t,roleIds:n,clientId:`CLIENT_ID_${GA()}`});yield $o(xi.setApiTokensState({showAddTokenDialog:!1})),yield Ko(200),yield $o(xi.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Ko(200),yield $o(xi.setApiTokensLoader({key:tT.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*dT({payload:e}){yield $o(xi.setApiTokensLoader({key:tT.DELETE_API_TOKEN,value:!0})),yield Ko(200);const t=[kp];yield $o(xi.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield $o(xi.setApiTokensLoader({key:tT.DELETE_API_TOKEN,value:!1}))}function*yT({payload:e}){var t;null!=e&&e.silentLoading||(yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!0})));const n=[Ep],i=[kp];yield $o(xi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Ko(200),yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*fT({payload:e}){var t;null!=e&&e.silentLoading||(yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!0})));const n=[Ep];yield $o(xi.setApiTokensState({apiTokensDataUser:n})),yield Ko(200),yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*pT({payload:e}){var t;null!=e&&e.silentLoading||(yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!0})));const n=[kp];yield $o(xi.setApiTokensState({apiTokensDataTenant:n})),yield Ko(200),yield $o(xi.setApiTokensLoader({key:tT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*gT(){yield $a(xi.loadApiTokens,yT),yield $a(xi.loadUserApiTokens,fT),yield $a(xi.loadTenantApiTokens,pT),yield Fa(xi.addTenantApiToken,uT),yield Ga(xi.deleteTenantApiToken,dT)}function*ST({payload:e}){try{var t;yield $o(xi.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield zo((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield jo(tp.accountSettings.updateSettings,D({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield $o(xi.setAccountSettingsState(D({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield $o(xi.setAccountSettingsState({loading:!1,error:Sg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*vT({payload:e}){yield $o(xi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield jo(tp.accountSettings.getSettings);yield $o(xi.setAccountSettingsState(D({},e,{loading:!1})))}catch(e){yield $o(xi.setAccountSettingsState({loading:!1,error:Sg(e)}))}}function*hT(){yield $a(xi.saveAccountSettings,ST),yield $a(xi.loadAccountSettings,vT)}function*mT({payload:e}){var t;yield $o(xi.setAccountSettingsState({loading:!0})),yield Et();const{accountSettingsState:n}=yield zo((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 $o(xi.setAccountSettingsState(D({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*AT({payload:e}){yield $o(xi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield Et(),yield $o(xi.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*bT(){yield $a(xi.saveAccountSettings,mT),yield $a(xi.loadAccountSettings,AT)}function*TT({payload:{tenantId:e,callback:t}}){yield $o(xi.setState({isLoading:!0}));try{yield jo(tp.tenants.switchTenant,{tenantId:e}),yield jo(Wv),(null==t?void 0:t(!0))||(yield $o(xi.setState({isLoading:!1})))}catch(e){yield $o(xi.setState({isLoading:!1})),null==t||t(!1,e)}}function*ET({payload:e}){yield $o(xi.setTenantsState({loading:!0}));try{var t;const n=yield jo(es());yield $o(xi.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 $o(xi.setTenantsState({loading:!1}))}}function*kT({payload:e}){yield $o(xi.setTenantsState({loading:!0}));try{var t;const n=yield jo(tp.tenants.getSubTenants);yield $o(xi.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $o(xi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*OT({payload:e}){yield $o(xi.setTenantsState({loading:!0}));try{var t;const n=yield jo(tp.tenants.getSubTenantsAsTree);yield $o(xi.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $o(xi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*IT(){yield Fa(xi.loadTenants,ET),yield Fa(xi.loadSubTenants,kT),yield Fa(xi.switchTenant,TT),yield Fa(xi.loadSubTenantsTree,OT)}function*PT(){yield $o(xi.setTenantsState({loading:!0})),yield Et(),yield $o(xi.setTenantsState({tenants:qp,activeTenant:qp[0],loading:!1}))}function*_T(){yield Fa(xi.loadTenants,PT)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(tT||(tT={}));const LT=["callback"],wT=["callback"],UT=["callback"],CT=["callback"],RT=["callback"];function*DT({payload:e}){var t;yield $o(xi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Vo([jo(tp.roles.getRoles),jo(tp.roles.getPermissions),jo(tp.roles.getPermissionCategories)]),[t,n,i]=e;yield $o(xi.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield $o(xi.setRolesState({error:Sg(e),loading:!1}))}}function*NT(e){let{payload:{callback:t}}=e,n=eo(e.payload,LT);yield $o(xi.setRolesState({saving:!0}));try{const e=yield jo(tp.roles.addRole,n),i=yield jo(tp.roles.getRoles);yield $o(xi.loadRolesAndPermissions({silentLoading:!0})),yield $o(xi.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield $o(xi.setRolesState({error:Sg(e),saving:!1})),null==t||t(null,e)}}function*MT(e){let{payload:{callback:t}}=e,n=eo(e.payload,wT);yield $o(xi.setRolesState({saving:!0}));try{yield jo(tp.roles.deleteRole,n),yield $o(xi.loadRolesAndPermissions({silentLoading:!0})),yield $o(xi.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield $o(xi.setRolesState({error:Sg(e),saving:!1})),null==t||t(!1,e)}}function*FT(e){let{payload:{callback:t}}=e,n=eo(e.payload,UT);yield $o(xi.setRolesState({saving:!0}));try{const e=yield jo(tp.roles.updateRole,n);yield $o(xi.loadRolesAndPermissions({silentLoading:!0})),yield $o(xi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield $o(xi.setRolesState({error:Sg(e),saving:!1})),null==t||t(null,e)}}function*GT(e){let{payload:{callback:t}}=e,n=eo(e.payload,CT);yield $o(xi.setRolesState({saving:!0}));try{const e=yield jo(tp.roles.attachPermissionsToRole,n);yield $o(xi.loadRolesAndPermissions({silentLoading:!0})),yield $o(xi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield $o(xi.setRolesState({error:Sg(e),saving:!1})),null==t||t(null,e)}}function*$T(e){let{payload:{callback:t}}=e,n=eo(e.payload,RT);yield $o(xi.setRolesState({saving:!0}));try{const e=yield jo(tp.roles.attachPermissionToRoles,n);yield $o(xi.loadRolesAndPermissions({silentLoading:!0})),yield $o(xi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield $o(xi.setRolesState({error:Sg(e),saving:!1})),null==t||t(null,e)}}function*VT(){yield $a(xi.loadRolesAndPermissions,DT),yield Fa(xi.addRole,NT),yield Fa(xi.deleteRole,MT),yield Fa(xi.updateRole,FT),yield Fa(xi.attachPermissionsToRole,GT),yield Fa(xi.attachPermissionToRoles,$T)}function*xT({payload:e}){var t;yield $o(xi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield $o(xi.setRolesState({roles:Op,loading:!1}))}catch(e){yield $o(xi.setRolesState({error:Sg(e),loading:!1}))}}function*jT(){yield $a(xi.loadRolesAndPermissions,xT)}const BT=["callback"],WT=["callback"],zT=["callback"];function*KT(e){let{payload:{callback:t}}=e,n=eo(e.payload,BT);yield $o(xi.setResetPhoneNumberState({loading:!0}));try{const e=yield jo(tp.auth.resetPhoneNumber,n);yield $o(xi.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Xt.VerifyResetPhoneNumber})),yield $o(xi.setLoginState({email:n.email}))}catch(e){yield $o(xi.setResetPhoneNumberState({loading:!1,error:Sg(e)})),null==t||t(null,e)}}function*qT(e){let{payload:{callback:t}}=e,n=eo(e.payload,WT);yield $o(xi.setResetPhoneNumberState({loading:!0}));try{const e=yield jo(tp.auth.verifyResetPhoneNumber,n);yield $o(xi.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Xt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield $o(xi.setResetPhoneNumberState({loading:!1,error:Sg(e)})),null==t||t(null,e)}}function*HT(e){let{payload:{callback:t}}=e,n=eo(e.payload,zT);yield $o(xi.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield zo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield jo(tp.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield $o(xi.setLoginState({step:_t.loginWithSmsOtc})),yield $o(xi.passwordlessPreLogin({type:ki.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield $o(xi.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setResetPhoneNumberState({loading:!1,error:Sg(e)})),null==t||t(null,e)}}function*JT(){yield $a(xi.resetPhoneNumber,KT),yield $a(xi.verifyResetPhoneNumber,qT),yield $a(xi.changePhoneNumber,HT)}function*YT(){yield $o(xi.setSessionsState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getCurrentUserSessions);yield $o(xi.setSessionsState({sessions:e,loading:!1}))}catch(e){yield $o(xi.setSessionsState({error:e,loading:!1}))}}function*QT(){yield $o(xi.setSessionsState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getCurrentUserSession);yield $o(xi.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield $o(xi.setSessionsState({error:e,loading:!1}))}}function*XT({payload:{id:e}}){yield $o(xi.setSessionsState({loading:!0,error:null}));try{yield jo(tp.auth.deleteSessionForUser,e),yield $o(xi.loadUserSessions())}catch(e){yield $o(xi.setSessionsState({error:e,loading:!1}))}}function*ZT({payload:{callback:e,userId:t}}){yield $o(xi.setSessionsState({loading:!0,error:null}));try{yield jo(tp.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield $o(xi.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*eE(){yield $o(xi.setSessionsState({loading:!0,error:null}));try{yield jo(tp.auth.deleteAllSessionsForUser),yield $o(xi.loadUserSessions())}catch(e){yield $o(xi.setSessionsState({error:e,loading:!1}))}}function*tE(){yield Ga(xi.loadUserSessions,YT),yield Ga(xi.deleteUserSession,XT),yield Ga(xi.deleteAllUserSessions,eE),yield Ga(xi.loadCurrentUserSession,QT),yield Fa(xi.revokeUserSessions,ZT)}function*nE(){yield $o(xi.setSessionsState({loading:!0,error:null})),yield $o(xi.setSessionsState({sessions:Hp,loading:!1}))}function*iE({payload:{id:e}}){yield $o(xi.setSessionsState({loading:!0,error:null}));const t=(yield zo((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield $o(xi.setSessionsState({sessions:t,loading:!1}))}function*oE(){yield $o(xi.setSessionsState({loading:!0,error:null}));const e=Hp.filter((e=>e.current));yield $o(xi.setSessionsState({sessions:e,loading:!1}))}function*aE(){yield Ga(xi.loadUserSessions,nE),yield Ga(xi.deleteUserSession,iE),yield Ga(xi.deleteAllUserSessions,oE)}const rE=["callback"],sE=["callback"];function*lE(){yield $o(xi.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getSessionConfigurations);yield $o(xi.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield $o(xi.setSessionsState({error:e,loading:!1}))}}function*cE({payload:e}){yield $o(xi.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=eo(e,rE);yield jo(tp.auth.createOrUpdateSessionConfigrations,n),yield $o(xi.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield $o(xi.setSessionsPolicyState({error:e,loading:!1}))}}function*uE(){yield $a(xi.loadSessionsPolicy,lE),yield Ga(xi.createOrUpdateSessionsPolicy,_g(cE))}function*dE(){yield $o(xi.setSessionsPolicyState({loading:!0,error:null}));const e=yield zo((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Jp}));yield $o(xi.setSessionsPolicyState(D({},e,{loading:!1})))}function*yE({payload:e}){yield $o(xi.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=eo(e,sE);null==t||t(!0),yield $o(xi.setSessionsPolicyState({configurations:n,loading:!1}))}function*fE(){yield $a(xi.loadSessionsPolicy,dE),yield Ga(xi.createOrUpdateSessionsPolicy,yE)}const pE=["callback"],gE=["callback"],SE=["callback"],vE=["callback"],hE=["callback"],mE=["callback"],AE=["callback"],bE=["callback"],TE=()=>zo((e=>e.auth.restrictionsState.ipRestrictions)),EE=()=>zo((e=>e.auth.restrictionsState.emailDomainRestrictions));function*kE(){yield $o(xi.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getDomainRestrictionsConfig),t=(yield jo(tp.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield $o(xi.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield $o(xi.setEmailDomainRestrictionsState({error:Sg(e),loading:!1}))}}function*OE(e){let{payload:{callback:t}}=e,n=eo(e.payload,pE);yield $o(xi.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield EE();try{var o;yield jo(tp.auth.createDomainRestriction,n);const e=(yield jo(tp.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield $o(xi.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 $o(xi.setEmailDomainRestrictionsState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*IE(e){let{payload:{callback:t}}=e,n=eo(e.payload,gE);yield $o(xi.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield jo(tp.auth.updateDomainRestrictionConfig,n),i=(yield jo(tp.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield $o(xi.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield $o(xi.setEmailDomainRestrictionsState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*PE({payload:{id:e}}){yield $o(xi.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield EE();try{var n;yield jo(tp.auth.deleteDomainRestriction,e);const i=(yield jo(tp.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield $o(xi.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Wn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield $o(xi.setEmailDomainRestrictionsState({saving:!1,error:Sg(e)}))}}const _E=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Wn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*LE(){yield $o(xi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield TE(),t=yield jo(tp.auth.getIPRestrictionsConfig),n=_E({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield jo(tp.auth.getIPRestrictions,n);yield $o(xi.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield $o(xi.setIpRestrictionsState({error:Sg(e),loading:!1}))}}function*wE(){try{const{valid:e}=yield jo(tp.auth.testCurrentIpInAllowList);yield $o(xi.setIpRestrictionsState({userIpValid:e}))}catch(e){yield $o(xi.setIpRestrictionsState({error:Sg(e)}))}}function*UE({payload:{callback:e}}){yield $o(xi.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield zo((e=>e.auth.userIp));yield Vo([jo(tp.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Wn.ALLOW}),jo(tp.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield TE(),i=_E(n.pagination),{items:o,_metadata:{totalPages:a}}=yield jo(tp.auth.getIPRestrictions,i);yield $o(xi.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Wn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield $o(xi.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*CE(e){let{payload:{callback:t}}=e,n=eo(e.payload,SE);yield $o(xi.setIpRestrictionsState({saving:!0,error:null}));const i=yield TE();try{var o,a;yield jo(tp.auth.createIPRestriction,n);const e=yield TE(),r=_E(e.pagination),{items:s,_metadata:{totalPages:l}}=yield jo(tp.auth.getIPRestrictions,r);yield wE(),yield $o(xi.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:Wn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield $o(xi.setIpRestrictionsState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*RE(e){let{payload:{callback:t}}=e,n=eo(e.payload,vE);yield $o(xi.setIpRestrictionsState({saving:!0,error:null}));try{yield jo(tp.auth.updateIPRestrictionConfig,n);const e=yield TE(),i=yield jo(tp.auth.getIPRestrictionsConfig),o=_E(D({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield jo(tp.auth.getIPRestrictions,o);yield wE(),yield $o(xi.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield $o(xi.setIpRestrictionsState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*DE({payload:{id:e,callback:t}}){yield $o(xi.setIpRestrictionsState({saving:!0,error:null}));const n=yield TE();try{var i;yield jo(tp.auth.deleteIPRestriction,e);const o=yield TE(),a=_E(o.pagination),{items:r,_metadata:{totalPages:s}}=yield jo(tp.auth.getIPRestrictions,a);yield wE(),yield $o(xi.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:Wn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield $o(xi.setIpRestrictionsState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*NE(){yield $a(xi.loadIpRestrictions,_g(LE)),yield $a(xi.loadEmailDomainRestrictions,_g(kE)),yield Fa(xi.saveIpRestriction,_g(CE)),yield Fa(xi.saveIpRestrictionsConfig,_g(RE)),yield Fa(xi.deleteIpRestriction,_g(DE)),yield Fa(xi.checkIfUserIpValid,_g(wE)),yield Fa(xi.addCurrentUserIpAndActivate,_g(UE)),yield Fa(xi.saveEmailDomainRestriction,_g(OE)),yield Fa(xi.saveEmailDomainRestrictionsConfig,_g(IE)),yield Fa(xi.deleteEmailDomainRestriction,_g(PE))}function*ME(){yield $o(xi.setIpRestrictionsState({loading:!0,error:null})),yield $o(xi.setIpRestrictionsState({data:{restrictions:Qp.filter((e=>e.strategy===Yp.strategy)),config:Yp},totalPages:1,pagination:{_filter:Wn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*FE(){yield $o(xi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield TE(),t=Qp[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield $o(xi.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield $o(xi.setIpRestrictionsState({error:Sg(e),loading:!1}))}}function*GE(e){var t,n,i;let{payload:{callback:o}}=e,a=eo(e.payload,hE);yield $o(xi.setIpRestrictionsState({saving:!0,error:null}));const r=yield TE(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield $o(xi.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Wn.ALLOW},restrictions:[...s,D({},a,{createdAt:new Date,updatedAt:new Date,id:GA(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Wn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*$E(e){var t,n,i;let{payload:{callback:o}}=e,a=eo(e.payload,mE);const r=yield TE();yield $o(xi.setIpRestrictionsState({saving:!0,error:null})),yield $o(xi.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:Wn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield $o(xi.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*VE({payload:{id:e,callback:t}}){var n;yield $o(xi.setIpRestrictionsState({saving:!0,error:null}));const i=yield TE();yield $o(xi.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:Wn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Wn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*xE(){yield $o(xi.setEmailDomainRestrictionsState({loading:!0,error:null})),yield $o(xi.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Wn.ALLOW}],config:{active:!0,listType:Wn.ALLOW,blockPublicDomains:!1}}}))}function*jE(e){var t,n;let{payload:{callback:i}}=e,o=eo(e.payload,AE);const a=yield EE();yield $o(xi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==i||i(!0),yield $o(xi.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*BE(e){var t;let{payload:{callback:n}}=e,i=eo(e.payload,bE);const o=yield EE();yield $o(xi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==n||n(!0),yield $o(xi.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||Wn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*WE({payload:{id:e}}){var t,n;const i=yield EE();yield $o(xi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),yield $o(xi.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Wn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*zE(){yield $a(xi.loadIpRestrictions,ME),yield $a(xi.loadEmailDomainRestrictions,xE),yield Fa(xi.saveIpRestriction,GE),yield Fa(xi.saveIpRestrictionsConfig,$E),yield Fa(xi.deleteIpRestriction,VE),yield Fa(xi.checkIfUserIpValid,FE),yield Fa(xi.saveEmailDomainRestriction,jE),yield Fa(xi.saveEmailDomainRestrictionsConfig,BE),yield Fa(xi.deleteEmailDomainRestriction,WE)}const KE=["callback"],qE=["id"];function*HE(e){const{count:t}=yield jo(tp.directory.countConfigurationUsers,e.id);return D({},e,{count:t})}function*JE(){yield $o(xi.setProvisioningState({loading:!0,error:null}));try{const e=yield jo(tp.directory.getConfigs),t=yield Vo(e.map((e=>HE(e))));yield $o(xi.setProvisioningState({connections:t,loading:!1}))}catch(e){yield $o(xi.setProvisioningState({error:Sg(e),loading:!1}))}}function*YE(e){let{payload:{callback:t}}=e,n=eo(e.payload,KE);yield $o(xi.setProvisioningState({loading:!0,error:null}));try{const e=yield jo(tp.directory.createConfiguration,n),i=yield jo(tp.directory.getConfigs),o=yield Vo(i.map((e=>HE(e))));yield $o(xi.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield $o(xi.setProvisioningState({error:Sg(e),loading:!1}))}}function*QE(e){let{payload:{id:t}}=e,n=eo(e.payload,qE);yield $o(xi.setProvisioningState({loading:!0,error:null}));try{yield jo(tp.directory.updateConfiguration,t,n);const e=yield jo(tp.directory.getConfigs),i=yield Vo(e.map((e=>HE(e))));yield $o(xi.setProvisioningState({connections:i,loading:!1}))}catch(e){yield $o(xi.setProvisioningState({error:Sg(e),loading:!1}))}}function*XE({payload:{id:e,callback:t}}){yield $o(xi.setProvisioningState({loading:!0,error:null}));try{yield jo(tp.directory.deleteConfiguration,e);const n=yield jo(tp.directory.getConfigs),i=yield Vo(n.map((e=>HE(e))));yield $o(xi.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setProvisioningState({error:Sg(e),loading:!1})),null==t||t(!1,e)}}function*ZE(){yield $a(xi.loadProvisionConnections,JE),yield Fa(xi.createProvisionConnection,YE),yield Fa(xi.deleteProvisionConnection,XE),yield Fa(xi.updateProvisionConnection,QE)}const ek=["callback","events"];function*tk(e){let{payload:{callback:t}}=e,n=eo(e.payload,ek);yield $o(xi.setImpersonateState({loading:!0}));try{yield jo(tp.impersonate.impersonate,n),yield $o(xi.setImpersonateState({step:Ni.success})),yield Ko(1e3),yield YS(),yield $o(xi.resetImpersonateState()),null==t||t(!0)}catch(e){yield $o(xi.setImpersonateState({loading:!1,error:Sg(e)}))}}function*nk(){yield $a(xi.impersonate,tk)}function*ik({payload:e}){const{callback:t,deviceId:n}=e;yield $o(xi.setPasskeysState({loading:!0}));try{yield jo(tp.auth.deleteWebAuthnDevice,n);const{devices:e}=yield zo((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield $o(xi.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setPasskeysState({loading:!1,error:Sg(e,null)})),null==t||t(null,e)}}function*ok(){yield $o(xi.setPasskeysState({loading:!0}));try{const{devices:e}=yield jo(tp.auth.getWebAuthnDevices);yield $o(xi.setPasskeysState({devices:e,loading:!1}))}catch(e){yield $o(xi.setPasskeysState({loading:!1,error:Sg(e,null)}))}}function*ak(){yield Fa(xi.loadWebAuthnDevices,ok),yield Fa(xi.deleteWebAuthnDevice,ik)}const rk=["roleIds","userIds"],sk=()=>zo((e=>e.auth.groupsState));function*lk({payload:e}){const t=$A.GET_TEAM_USERS;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield jo(tp.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield $o(xi.setGroupsState({teamUsers:n}))}catch(e){yield $o(xi.setUsersGroupsError({key:t,value:Sg(e)}))}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*ck({payload:e}){const t=$A.GET_GROUP;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield jo(tp.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:VA.rolesAndUsers});yield $o(xi.setGroupsState({selectedGroup:n}))}catch(e){yield $o(xi.setUsersGroupsError({key:t,value:Sg(e)}))}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*uk(){const e=$A.GET_GROUPS,t=yield sk();yield $o(xi.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield jo(tp.groups.getGroups,{_groupsRelations:VA.rolesAndUsers});yield $o(xi.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 $o(xi.setUsersGroupsError({key:e,value:Sg(t)}))}finally{yield $o(xi.setUsersGroupsLoader({key:e,value:!1}))}}function*dk({payload:e}){const t=$A.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=eo(e,rk);yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield jo(tp.groups.createGroup,D({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield $o(xi.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield $o(xi.addRolesToGroup({groupId:r.id,roleIds:n}))),yield $o(xi.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield $o(xi.setUsersGroupsError({key:t,value:Sg(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*yk({payload:e}){const t=$A.UPDATE_GROUP;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield jo(tp.groups.updateGroup,e),yield $o(xi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $o(xi.setUsersGroupsError({key:t,value:Sg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*fk({payload:e}){const t=$A.DELETE_GROUP;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield jo(tp.groups.deleteGroup,e.groupId),yield $o(xi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $o(xi.setUsersGroupsError({key:t,value:Sg(n)})),null==e||null==(i=e.callback)||i.call(e,!1,n)}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*pk({payload:e}){const t=$A.ADD_ROLES_TO_GROUP;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield jo(tp.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield $o(xi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $o(xi.setUsersGroupsError({key:t,value:Sg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*gk({payload:e}){const t=$A.DELETE_ROLES_FROM_GROUP;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield jo(tp.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield $o(xi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $o(xi.setUsersGroupsError({key:t,value:Sg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*Sk({payload:e}){const t=$A.ADD_USERS_TO_GROUP;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield jo(tp.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield $o(xi.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 $o(xi.setUsersGroupsError({key:t,value:Sg(n)}))}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*vk({payload:e}){const t=$A.DELETE_USERS_FROM_GROUP;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield jo(tp.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield $o(xi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $o(xi.setUsersGroupsError({key:t,value:Sg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*hk(){const e=$A.GET_GROUP_CONFIGURATION;yield $o(xi.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield jo(tp.groups.getGroupConfiguration);yield $o(xi.setGroupsState({groupsConfiguration:t}))}catch(t){yield $o(xi.setUsersGroupsError({key:e,value:Sg(t)}))}finally{yield $o(xi.setUsersGroupsLoader({key:e,value:!1}))}}function*mk({payload:e}){const t=$A.UPDATE_GROUP_CONFIGURATION;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{yield jo(tp.groups.updateGroupConfiguration,e),yield $o(xi.getGroupConfiguration())}catch(e){yield $o(xi.setUsersGroupsError({key:t,value:Sg(e)}))}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*Ak(){yield Ga(xi.loadGroups,uk),yield Ga(xi.getGroupById,ck),yield Ga(xi.createGroup,dk),yield Ga(xi.updateGroup,yk),yield Ga(xi.deleteGroup,fk),yield Ga(xi.addRolesToGroup,pk),yield Ga(xi.deleteRolesFromGroup,gk),yield Ga(xi.addUsersToGroup,Sk),yield Ga(xi.deleteUsersFromGroup,vk),yield Ga(xi.getGroupConfiguration,hk),yield Ga(xi.updateGroupConfiguration,mk),yield Ga(xi.getTeamUsers,lk)}function*bk(){const e=$A.GET_GROUPS;yield $o(xi.setUsersGroupsLoader({key:e,value:!0}));const t=eg;yield $o(xi.setGroupsState({groups:t})),yield $o(xi.setUsersGroupsLoader({key:e,value:!1}))}function*Tk({payload:e}){var t;const n=$A.CREATE_GROUP,{groups:i}=yield sk();yield $o(xi.setUsersGroupsLoader({key:n,value:!0})),yield $o(xi.setGroupsState({groups:[D({},e,{id:`${e.name}ID`,managedBy:Jf.FRONTEGG}),...null!=i?i:[]]})),yield Ko(500),null==e||null==(t=e.callback)||t.call(e,!0),yield $o(xi.setUsersGroupsLoader({key:n,value:!1}))}function*Ek({payload:e}){var t,n,i,o,a;const r=$A.UPDATE_GROUP,s=yield sk();yield $o(xi.setUsersGroupsLoader({key:r,value:!0})),yield $o(xi.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:Jf.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 Ko(500),null==e||null==(a=e.callback)||a.call(e,!0),yield $o(xi.setUsersGroupsLoader({key:r,value:!1}))}function*kk({payload:e}){var t,n;const i=$A.DELETE_GROUP,o=yield sk();yield $o(xi.setUsersGroupsLoader({key:i,value:!0})),yield $o(xi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Ko(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $o(xi.setUsersGroupsLoader({key:i,value:!1}))}function*Ok({payload:e}){var t,n;const i=$A.ADD_ROLES_TO_GROUP,o=yield sk();yield $o(xi.setUsersGroupsLoader({key:i,value:!0})),yield $o(xi.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 Ko(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $o(xi.setUsersGroupsLoader({key:i,value:!1}))}function*Ik({payload:e}){var t,n;const i=$A.DELETE_ROLES_FROM_GROUP,o=yield sk();yield $o(xi.setUsersGroupsLoader({key:i,value:!0})),yield $o(xi.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 Ko(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $o(xi.setUsersGroupsLoader({key:i,value:!1}))}function*Pk({payload:e}){var t,n;const i=$A.ADD_USERS_TO_GROUP,o=yield sk();yield $o(xi.setUsersGroupsLoader({key:i,value:!0})),yield $o(xi.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 Ko(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $o(xi.setUsersGroupsLoader({key:i,value:!1}))}function*_k({payload:e}){var t,n;const i=$A.DELETE_USERS_FROM_GROUP,o=yield sk();yield $o(xi.setUsersGroupsLoader({key:i,value:!0})),yield $o(xi.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 Ko(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $o(xi.setUsersGroupsLoader({key:i,value:!1}))}function*Lk(){const e=$A.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield sk();yield $o(xi.setUsersGroupsLoader({key:e,value:!0})),t&&(yield $o(xi.setGroupsState({groupsConfiguration:D({},t)}))),yield $o(xi.setUsersGroupsLoader({key:e,value:!1}))}function*wk({payload:e}){const t=$A.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield sk();yield $o(xi.setUsersGroupsLoader({key:t,value:!0})),n&&(yield $o(xi.setGroupsState({groupsConfiguration:D({},n,e)}))),yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}function*Uk(){yield Ga(xi.loadGroups,bk),yield Ga(xi.createGroup,Tk),yield Ga(xi.updateGroup,Ek),yield Ga(xi.deleteGroup,kk),yield Ga(xi.addRolesToGroup,Ok),yield Ga(xi.deleteRolesFromGroup,Ik),yield Ga(xi.addUsersToGroup,Pk),yield Ga(xi.deleteUsersFromGroup,_k),yield Ga(xi.getGroupConfiguration,Lk),yield Ga(xi.updateGroupConfiguration,wk)}let Ck;!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"}(Ck||(Ck={}));const Rk=(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=>Rk(e,t,n))))?i:[]})};function Dk(e,t){var n;return D({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Dk(e,t))):[]})}function Nk(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=>Nk(e,t,n))))?i:[]})}const Mk=({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}})),Fk=()=>zo((e=>e.auth.allAccountsState));function*Gk({payload:e}){const t=Ck.GET_ACCOUNTS;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield Fk(),{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 Fk(),{items:n,_links:o}=yield jo(tp.tenants.searchSubTenants,r,{jwt:i}),a=yield jo(tp.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:i}),l=Mk({items:n},a),c=Nk(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 $o(xi.setSelectedAccountState({accounts:c}))}else{var l;const{accounts:t}=yield Fk(),{items:n,_links:i}=yield jo(tp.tenants.searchSubTenants,r),o=yield jo(tp.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=Mk({items:n},o),s=Nk(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 $o(xi.setAllAccountsState({accounts:s}))}}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)}))}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*$k({payload:e}){const t=Ck.SEARCH_ACCOUNTS;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield Fk(),{jwt:i}=e;try{if(null!=e&&e._subTenantId){var o;const{items:t}=yield jo(tp.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(o=null==e?void 0:e._filter)?o:"",_subTenantId:e._subTenantId},{jwt:i});yield $o(xi.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)}))}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*Vk({payload:e}){const t=Ck.GET_USER_JWT;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:i}=e;try{const e=yield jo(tp.users.GetUserJwt,{tenantId:n});yield $o(xi.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==i||i(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),yield $o(xi.setSelectedAccountState({accessPermission:!1})),null==i||i(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*xk({payload:e}){const t=Ck.CREATE_SUB_ACCOUNT;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:i,tenantId:o,jwt:a,callback:r}=e;try{if(a){const{accounts:e}=yield Fk(),{selectedAccount:t}=yield Fk(),r=yield jo(tp.subTenants.createSubTenant,{name:n,parentTenantId:i,tenantId:o},{jwt:a}),s=Nk(e,null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),l=Nk(D({name:"",tenantId:""},null==t?void 0:t.accounts),null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield $o(xi.setAllAccountsState({accounts:s})),yield $o(xi.setSelectedAccountState({accounts:l}))}else{const{accounts:e}=yield Fk(),t=yield jo(tp.subTenants.createSubTenant,{name:n,tenantId:o,parentTenantId:i}),a=Nk(e,null!=i?i:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield $o(xi.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),null==r||r(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*jk({payload:e}){const t=Ck.DELETE_SUB_ACCOUNT;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:i,callback:o}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield Fk();yield jo(tp.subTenants.deleteSubTenant,i,{jwt:n});const o=Dk(t,i),a=Dk(null==e?void 0:e.accounts,i);yield $o(xi.setAllAccountsState({accounts:o})),yield $o(xi.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield Fk();yield jo(tp.subTenants.deleteSubTenant,i);const t=Dk(e,i);yield $o(xi.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),null==o||o(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*Bk({payload:e}){const t=Ck.UPDATE_SUB_ACCOUNT_SETTINGS;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:i,callback:o,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield Fk();yield jo(tp.subTenants.updateSubTenant,{tenantId:a},{name:i},{jwt:n});const o=Rk(e.accounts,a,i);yield $o(xi.setSelectedAccountState({name:i,accounts:o}));const r=Rk(t,a,i);yield $o(xi.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield Fk();yield jo(tp.subTenants.updateSubTenant,{tenantId:a},{name:i});const t=Rk(e,a,i);yield $o(xi.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),null==o||o(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*Wk({payload:e}){const t=Ck.DELETE_USERS_FROM_ACCOUNT;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:i,jwt:o,callback:a}=e;try{yield jo(tp.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:i},{jwt:o}),yield $o(xi.getAccountUsers({jwt:o,_tenantId:i[0].tenantId})),null==a||a(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),null==a||a(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*zk({payload:e}){const t=Ck.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:i,jwt:o,callback:a}=e,{selectedAccount:r}=yield Fk();try{yield jo(tp.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:i},{jwt:o}),yield $o(xi.getAccountUsers({jwt:o,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),null==a||a(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*Kk({payload:e}){const t=Ck.ADD_USERS_TO_ACCOUNT;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:i,jwt:o,callback:a,allowSubAccountAccess:r=!1,roleIds:s}=e;try{yield jo(tp.subTenants.addUsersToSubTenant,{users:n,tenantId:i,allowSubAccountAccess:r,roleIds:s},{jwt:o}),yield $o(xi.getAccountUsers({jwt:o,_tenantId:i})),null==a||a(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),null==a||a(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*qk({payload:e}){const t=Ck.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield Fk(),{userId:i,allowAccess:o,jwt:a,callback:r}=e;try{var s;yield jo(tp.subTenants.updateSubAccountAccess,i,{allowAccess:o},{jwt:a}),yield $o(xi.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 $o(xi.setAllAccountsError({key:t,value:Sg(e)})),null==r||r(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*Hk({payload:e}){var t,n,i,o,a,r,s,l;const c=Ck.GET_ACCOUNT_USERS;yield $o(xi.setAllAccountsLoader({key:c,value:!0}));const u=yield Fk(),{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 jo(tp.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 jo(tp.roles.getRoles),o=yield jo(tp.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 $o(xi.setSelectedAccountState(D({users:a},i)))}else yield $o(xi.setSelectedAccountState(D({users:[]},i)))}catch(e){yield $o(xi.setAllAccountsError({key:c,value:Sg(e)}))}finally{yield $o(xi.setAllAccountsLoader({key:c,value:!1}))}}function*Jk({payload:e}){const t=Ck.SET_SELECTED_SUB_ACCOUNT_DATA;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var i,o,a,r,s,l,c;const e=yield jo(tp.accountSettings.getSettings,{jwt:n}),u=yield jo(tp.tenants.getTenantsUsersCount,{tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n}),d=yield jo(tp.tenants.getParentTenants,{jwt:n}),y=yield jo(tp.tenants.getHierarchyMetadata,{_tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n});yield $o(xi.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 $o(xi.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)}))}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*Yk(){const e=Ck.SET_ROOT_ACCOUNT_DATA;yield $o(xi.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield zo((e=>e.auth.tenantsState)),{accounts:n}=yield Fk();if(t)try{var i;const o=yield jo(tp.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 $o(xi.setAllAccountsState({rootAccount:a,accounts:D({},n,a)}))}catch(t){yield $o(xi.setAllAccountsError({key:e,value:Sg(t)}))}finally{yield $o(xi.setAllAccountsLoader({key:e,value:!1}))}}function*Qk({payload:e}){const t=Ck.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:i}=e;try{const e=yield jo(tp.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:i});yield $o(xi.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)}))}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*Xk(){yield Ga(xi.loadAccounts,Gk),yield Ga(xi.searchAccounts,$k),yield Ga(xi.updateSubAccountAccessForUser,qk),yield Ga(xi.getUserJwtForSubAccount,Vk),yield Ga(xi.createSubAccount,xk),yield Ga(xi.deleteSubAccount,jk),yield Ga(xi.updateSubAccountSettings,Bk),yield Ga(xi.addUsersToAccount,Kk),yield Ga(xi.deleteUsersFromAccount,Wk),yield Ga(xi.setUserRolesForSubAccount,zk),yield Ga(xi.getAccountUsers,Hk),yield Ga(xi.setRootAccountData,Yk),yield Ga(xi.setSelectedSubAccountData,Jk),yield Ga(xi.loadNumberOfUsersForSelectedSubAccount,Qk)}const Zk=["callback"],eO=["callback"],tO=["callback","phoneId"],nO=["callback","phoneId"],iO=["callback"];function*oO(){yield $o(xi.setSmsState({loading:!0}));const e={_limit:10,_offset:0};try{const{items:t}=yield jo(tp.userPhoneNumbers.getUserPhoneNumbers,e);yield $o(xi.setSmsState({phoneNumbers:t}))}catch(e){yield $o(xi.setSmsState({error:Sg(e)}))}finally{yield $o(xi.setSmsState({loading:!1}))}}function*aO(e){let{payload:{callback:t}}=e,n=eo(e.payload,Zk);yield $o(xi.setSmsState({loading:!0}));try{const e=yield jo(tp.userPhoneNumbers.createPhoneNumber,n);yield $o(xi.setSmsState({otcToken:e.otcToken})),yield jo(oO),null==t||t(!0)}catch(e){yield $o(xi.setSmsState({error:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSmsState({loading:!1}))}}function*rO(e){let{payload:{callback:t}}=e,n=eo(e.payload,eO);yield $o(xi.setSmsState({loading:!0}));try{yield jo(tp.userPhoneNumbers.verifyPhoneNumber,n),yield jo(oO),null==t||t(!0)}catch(e){yield $o(xi.setSmsState({error:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSmsState({loading:!1}))}}function*sO(e){let{payload:{callback:t,phoneId:n}}=e;eo(e.payload,tO),yield $o(xi.setSmsState({loading:!0}));try{const e=yield jo(tp.userPhoneNumbers.deletePhoneNumber,n);yield $o(xi.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield $o(xi.setSmsState({error:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSmsState({loading:!1}))}}function*lO(e){let{payload:{callback:t,phoneId:n}}=e,i=eo(e.payload,nO);yield $o(xi.setSmsState({loading:!0}));try{yield jo(tp.userPhoneNumbers.verifyDeletePhoneNumber,n,i),yield jo(oO),null==t||t(!0)}catch(e){yield $o(xi.setSmsState({error:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSmsState({loading:!1}))}}function*cO(e){let{payload:{callback:t}}=e,n=eo(e.payload,iO);yield $o(xi.setSmsState({loading:!0}));try{const e=yield jo(tp.userPhoneNumbers.preVerifyPhoneNumber,n);yield $o(xi.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield $o(xi.setSmsState({error:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSmsState({loading:!1}))}}function*uO(){yield Fa(xi.loadPhoneNumbers,oO),yield Fa(xi.setUpPhoneNumber,aO),yield Fa(xi.verifyPhoneNumber,rO),yield Fa(xi.deletePhoneNumber,sO),yield Fa(xi.verifyDeletePhoneNumber,lO),yield Fa(xi.preVerifyPhoneNumber,cO)}function*dO({payload:{maxAge:e,callback:t}}){yield $o(xi.setStepUpState({mfaDevices:void 0,mfaToken:""}));try{const{mfaToken:n,mfaDevices:i}=yield jo(tp.auth.generateStepupSession,{maxAge:e});yield $o(xi.setStepUpState({mfaDevices:i,mfaToken:n}));const o=yield jo(fg,i);yield $o(xi.setMfaState({step:o})),null==t||t(!0)}catch(e){null==t||t(!1),yield $o(xi.logout());const{routes:n}=yield zo((e=>e.auth));Va.onRedirectTo(n.loginUrl)}}function*yO({payload:e}){yield nv(e,xi.setStepUpState,!0)}function*fO({payload:e}){yield gv(e,xi.setStepUpState)}function*pO({payload:e}){yield Sv(e,xi.setStepUpState,!0)}function*gO({payload:e}){yield cv(e,xi.setStepUpState)}function*SO({payload:e}){yield uv(e,xi.setStepUpState,!0)}function*vO({payload:e}){yield Tv(e,xi.setStepUpState)}function*hO({payload:e}){yield bv(e,xi.setStepUpState)}function*mO(){yield $a(xi.generateStepUpSession,dO),yield $a(xi.stepUpWithAuthenticator,yO),yield $a(xi.preVerifyMFASMSForStepUp,gO),yield $a(xi.verifyMFASMSForStepUp,SO),yield $a(xi.preVerifyMFAWebAuthnForStepUp,fO),yield $a(xi.verifyMFAWebAuthnForStepUp,pO),yield $a(xi.verifyMFAEmailCodeForStepUp,vO),yield $a(xi.preVerifyMFAEmailCodeForStepUp,hO)}var AO={sagas:function*(){yield Vo([jo(wh),jo(mO),jo(_A),jo(wA),jo(hA),jo(JT),jo(Kh),jo(Am),jo(Im),jo(Og),jo(oA),jo(Rb),jo(Ak),jo(eT),jo(CS),jo(cT),jo(fS),jo(hT),jo(IT),jo(VT),jo(tE),jo(uE),jo(NE),jo(ZE),jo(nk),jo(ak),jo(Xk),jo(WS),jo(Fg),jo(uO)])},mockSagas:function*(){yield Vo([jo(Rh),jo(Zh),jo(wm),jo(fA),jo(Kb),jo(gT),jo(IS),jo(aE),jo(bT),jo(_T),jo(fE),jo(zE),jo(jT),jo(Uk),jo(Wg)])},storeName:Rt,initialState:Di,reducer:$i,actions:xi};const bO=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>D({},t,{[e]:D({},t[e],n)})}),TO={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},EO={setAuditLogsState:bO("auditLogsState"),resetAuditLogsState:e=>D({},e,{auditLogsState:TO})},kO={exportAuditsCsv:yt("auditLogs/exportAuditsCsv"),loadAuditLogs:yt("auditLogs/loadAuditLogs",(e=>({payload:e})))},OO={loading:!0},IO={setAuditsMetadataState:bO("auditsMetadataState"),resetAuditsMetadataState:e=>D({},e,{auditsMetadataState:OO})},PO={loadAuditsMetadata:yt("auditLogs/loadAuditsMetadata")},_O={auditLogsState:TO,auditsMetadataState:OO},{reducer:LO,actions:wO}=pt({name:Nt,initialState:_O,reducers:D({resetState:e=>D({},e,_O),setState:(e,{payload:t})=>D({},e,t)},EO,IO)}),UO=D({},wO,kO,PO),CO=e=>"createdAt"!==e.id,RO={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`})))},DO={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}]},NO=()=>zo((e=>e.auditLogs.auditLogsState)),MO=()=>zo((e=>e.auditLogs.auditsMetadataState));function*FO(){const e=yield NO(),{columns:t}=yield MO();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 $o(UO.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield tp.audits.exportAudits(D({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield $o(UO.setAuditLogsState({isDownloadingCsv:!1}))}function*GO({payload:e}){yield $o(UO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield NO(),{columns:n}=yield MO();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 $o(UO.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 $o(UO.loadAuditsMetadata()));const{data:p,total:g}=yield jo(tp.audits.getAudits,D({offset:c,count:l},y,f));yield $o(UO.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 $o(UO.setAuditLogsState({loading:!1,error:Sg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*$O(){yield Fa(UO.exportAuditsCsv,FO),yield Fa(UO.loadAuditLogs,GO)}function*VO({payload:e}){yield $o(UO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield NO(),{columns:n}=yield MO();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 $o(UO.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield $o(UO.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=RO;let i=n.filter((e=>t=>e.filter(CO).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 $o(UO.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 $o(UO.setAuditLogsState({loading:!1,error:Sg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*xO(){yield Fa(UO.loadAuditLogs,VO)}function*jO(){yield $o(UO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield jo(tp.metadata.getAuditsMetadata);yield $o(UO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield $o(UO.setAuditsMetadataState({error:e,loading:!1}))}}function*BO(){yield Fa(UO.loadAuditsMetadata,jO)}function*WO(){yield $o(UO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=DO;yield $o(UO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield $o(UO.setAuditsMetadataState({error:e,loading:!1}))}}function*zO(){yield Fa(UO.loadAuditsMetadata,WO)}var KO={sagas:function*(){yield Vo([jo($O),jo(BO)])},mockSagas:function*(){yield Vo([jo(xO),jo(zO)])},storeName:Nt,initialState:_O,reducer:LO,actions:UO};const qO={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:JO,reducer:YO}=pt({name:"audits",initialState:qO,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]})))}}}),QO=D({},JO,{initData:yt(`${HO}/initData`),loadAudits:yt(`${HO}/loadAudits`),removeFilter:yt(`${HO}/removeFilter`),filterData:yt(`${HO}/filterData`),exportCSV:yt(`${HO}/exportCSV`),deleteAudits:yt(`${HO}/deleteAudits`)}),XO=()=>zo((e=>e[HO]));function*ZO(){const{sortBy:e,sortDirection:t}=yield XO();try{const n=yield jo(tp.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield $o(QO.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield $o(QO.loadItemFailedAction(t))}}function*eI(){try{const e=yield jo(tp.metadata.getAuditsMetadata);yield $o(QO.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield $o(QO.loadItemFailedAction(t))}}const tI=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*nI({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield XO(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield XO():{rowsData:[]};try{const e=tI(t),{data:s,total:d}=yield jo(tp.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 $o(QO.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield $o(QO.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield $o(QO.loadItemFailedAction(t))}}function*iI(){yield $o(QO.startLoading()),yield Vo([ZO(),eI(),nI({payload:{onlyOneLoad:!1},type:""})]),yield $o(QO.finishLoading())}function*oI({payload:e}){const{filters:t}=yield XO(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield $o(QO.setFilterData(i))}function*aI({payload:e}){const{filters:t}=yield XO();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 $o(QO.setFilterData(i))}function*rI(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield XO(),a=tI(e);yield $o(QO.startDownloadingCsv());try{yield tp.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 $o(QO.stopDownloadingCsv())}}function*sI(){yield Ga(QO.initData,iI),yield Ga(QO.removeFilter,oI),yield Ga(QO.filterData,aI),yield Ga([QO.loadAudits,QO.textSearch,QO.onPageChange],nI),yield Ga([QO.setFilterData,QO.setDataSorting,QO.startRefresh],(()=>nI({payload:{appendMode:!1},type:""}))),yield Ga(QO.exportCSV,rI)}const lI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},cI={initData:()=>D({},lI),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)})}},uI={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}})))},dI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:yI,actions:fI}=pt({name:Dt,initialState:dI,reducers:D({},cI)}),pI=D({},fI,uI),gI={slack:tp.connectivity.getSlackConfiguration,email:tp.connectivity.getEmailConfiguration,sms:tp.connectivity.getSMSConfiguration,webhook:tp.connectivity.getWebhooksConfigurations,categories:tp.connectivity.getCategories,channelMap:tp.connectivity.getChannelMaps},SI={slack:tp.connectivity.postSlackConfiguration,email:tp.connectivity.postEmailConfiguration,sms:tp.connectivity.postSMSConfiguration,webhook:tp.connectivity.postWebhooksConfiguration},vI=["email","slack","sms","webhook"],hI={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"}},mI=["id"],AI=["id","enabled"],bI=["categories","channelMap"];function*TI(e){return yield jo(kI,{payload:{api:e},type:""})}function*EI({payload:e=vI}){yield $o(pI.setConnectivityState({isLoading:!0}));try{const t=yield Vo([...e.map(TI),yield kI({payload:{api:"categories"},type:""}),yield function*(){return(yield Vo(e.map((function*(e){return yield kI({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>D({},t,{[`${e[i]}`]:n})),{})}()]),n=yield kI({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:hI[e[o]].events(i),active:hI[e[o]].isActive(i),platform:hI[e[o]].title,image:hI[e[o]].image}]}):n:D({},n,{[`${bI[o-e.length]}`]:i})),{list:[],webhook:n});yield $o(pI.setConnectivityState(D({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield $o(pI.setConnectivityState({isLoading:!1}))}}function*kI({payload:{api:e,params:t}}){try{return yield jo(gI[e],t)}catch(e){return}}function*OI(){try{yield $o(pI.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield jo(tp.connectivity.getSlackChannels);yield $o(pI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield $o(pI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*II(e,t){const{connectivity:{list:n}}=yield zo(),i=n.find((({key:t})=>t===e));if(!i)return;const o=hI[e].isActive(t);o!==i.active&&(yield $o(pI.setConnectivityState({list:n.map((t=>t.key===e?D({},t,{active:o}):t))})))}function*PI({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield zo((e=>e.connectivity));try{if(yield $o(pI.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield zo();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=eo(e,mI);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 jo(SI.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield jo(tp.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield zo(),{processIds:i}=yield zo((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 jo("email"===t?tp.connectivity.postEmailConfiguration:tp.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=eo(o,AI);return yield Vo([yield jo("email"===t?tp.connectivity.patchEmailConfiguration:tp.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield jo("email"===t?tp.connectivity.putEmailSubscriptions:tp.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 jo("email"===t?tp.connectivity.deleteEmailSubscriptions:tp.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield kI({payload:{api:t},type:""});yield $o(pI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield II(t,e)}else yield $o(pI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield jo(SI[e],t),!["sms","email"].includes(e)){const o=yield kI({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield $o(pI.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield II(e,o),null==n||n(!0)}}catch(e){yield $o(pI.setConnectivityState({error:Sg(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*_I({payload:e}){try{yield tp.connectivity.postSlackCode(e)}catch{}yield $o(pI.setConnectivityState({error:void 0,isSaving:!1}))}function*LI(){const{slackChannels:e}=yield zo((e=>e.connectivity));try{yield $o(pI.setConnectivityState({slackChannels:D({},e,{isLoadingScope:!0})}));const{clientId:t}=yield jo(tp.connectivity.getSlackScope);yield $o(pI.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield $o(pI.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*wI({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield zo((e=>e.connectivity));try{yield $o(pI.setConnectivityState({isSaving:!0})),yield jo(tp.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,Sg(e))}const o=yield kI({payload:{api:"webhook"},type:""});o&&(yield $o(pI.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*UI({payload:e}){try{yield $o(pI.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield jo(tp.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield $o(pI.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield $o(pI.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield $o(pI.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*CI({payload:e}){try{const{statusCode:t}=yield jo(tp.connectivity.postWebhookRetry,e);yield $o(pI.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield $o(pI.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*RI({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield zo((e=>e.connectivity));try{yield $o(pI.setConnectivityState({webhookLogs:D({},i,{isLoading:!0})}));const o=yield jo(tp.connectivity.getWebhookLog,e,n,t);yield $o(pI.setConnectivityState({error:void 0,webhookLogs:D({isLoading:!1},o)}))}catch(e){yield $o(pI.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var DI={sagas:function*(){yield Fa(pI.loadDataAction,EI),yield Ga(pI.loadSlackActions,OI),yield Fa(pI.postDataAction,PI),yield Fa(pI.postCodeAction,_I),yield Fa(pI.loadScope,LI),yield Fa(pI.deleteWebhookConfigAction,wI),yield Fa(pI.postWebhookTestAction,UI),yield Fa(pI.postWebhookRetryAction,CI),yield Ga(pI.loadWebhookLogsAction,RI)},storeName:Dt,initialState:dI,reducer:yI,actions:pI};function NI(){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 MI(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>D({},n,{[e]:t(n[e],i)})}}function FI(e){return MI(e,((e,t)=>D({},e,{loading:t.payload})))}function GI(e){return MI(e,((e,t)=>D({},e,{error:t.payload,loading:!1})))}const $I={loading:!1,error:null,fetching:!0,plans:[]},{actions:VI,reducer:xI,name:jI}=pt({name:"subscriptions/plans",initialState:$I,reducers:D({},NI())}),BI=D({loadPlans:yt(`${jI}/loadPlans`)},VI),WI={loading:!1,error:null,fetching:!0,config:null},zI=D({},NI()),{actions:KI,reducer:qI,name:HI}=pt({name:"subscriptions/config",initialState:WI,reducers:zI}),JI=D({loadPaymentConfiguration:yt(`${HI}/loadPaymentConfiguration`)},KI),YI={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},QI=D({},NI(),{setCancellationLoading:FI("cancellation"),setCancellationError:GI("cancellation"),setRenewalLoading:FI("renewal"),setRenewalError:GI("renewal")}),{reducer:XI,actions:ZI,name:eP}=pt({name:"subscriptions/billing/subscription",initialState:YI,reducers:QI}),tP=D({load:yt(`${eP}/loadSubscription`),cancelSubscription:yt(`${eP}/cancelSubscription`),renewSubscription:yt(`${eP}/renewSubscription`)},ZI),nP={loading:!1,error:null,fetching:!0},iP=D({},NI()),{reducer:oP,actions:aP,name:rP}=pt({name:"subscriptions/billing/information",initialState:nP,reducers:iP}),sP=D({loadBillingInformation:yt(`${rP}/loadBillingInformation`),cancelSubscription:tP.cancelSubscription,renewSubscription:tP.renewSubscription},aP),lP={loading:!1,error:null,fetching:!0},cP=D({},NI(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,t.payload)}}),{reducer:uP,actions:dP,name:yP}=pt({name:"subscriptions/billing/payment",initialState:lP,reducers:cP}),fP=D({loadPaymentMethod:yt(`${yP}/loadPaymentMethod`),submitPaymentMethod:yt(`${yP}/submitPaymentMethod`),submitPaymentMethodError:yt(`${yP}/submitPaymentMethodError`),submitPaymentMethodSuccess:yt(`${yP}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:yt(`${yP}/updateBillingDetails`,(e=>({payload:e})))},dP),pP={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},gP=D({},NI(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,{invoiceDownload:D({},e.invoiceDownload,t.payload)})}}),{reducer:SP,actions:vP,name:hP}=pt({name:"subscriptions/billing/invoices",initialState:pP,reducers:gP}),mP=D({loadInvoices:yt(`${hP}/loadInvoices`),downloadInvoice:yt(`${hP}/downloadInvoice`,(e=>({payload:e})))},vP),AP={information:nP,invoices:pP,paymentMethod:lP,subscription:YI},bP={invoices:mP,information:sP,paymentMethod:fP,subscription:tP},TP=Ke({invoices:SP,information:oP,paymentMethod:uP,subscription:XI}),EP={fetching:!0,loading:!1,error:null,confirmed:!1},kP=D({},NI()),{actions:OP,reducer:IP,name:PP}=pt({name:"subscriptions/checkout",initialState:EP,reducers:kP}),_P=D({loadCheckout:yt(`${PP}/loadCheckout`),resetCheckout:yt(`${PP}/resetCheckout`),submitCheckout:yt(`${PP}/submitCheckout`),confirmCheckout:yt(`${PP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:yt(`${PP}/errorCheckout`,(e=>({payload:e})))},OP),LP={loading:!1,error:null,cardSetupIntentSecret:null},wP=D({},NI()),{reducer:UP,actions:CP,name:RP}=pt({name:"subscriptions/stripe",initialState:LP,reducers:wP}),DP=D({loadCustomer:yt(`${RP}/loadCustomer`),createCardSetupIntentSecret:yt(`${RP}/createCardSetupIntentSecret`)},CP),NP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:MP,reducer:FP,name:GP}=pt({name:"subscriptions/vendorPublicConfig",initialState:NP,reducers:D({},NI())}),$P=D({loadVendorPublicConfiguration:yt(`${GP}/loadVendorPublicConfiguration`)},MP),VP={config:WI,plans:$I,checkout:EP,billing:AP,stripe:LP,vendorPublicConfig:NP},xP={config:JI,billing:bP,plans:BI,checkout:_P,stripe:DP,vendorPublicConfig:$P},jP=Ke({config:qI,billing:TP,plans:xI,checkout:IP,stripe:UP,vendorPublicConfig:FP});let BP,WP,zP;function KP({policy:e}){return{policy:zP.AT_PERIOD_END}}function qP(e){switch(e){case Ky.ACTIVE:return WP.ACTIVE;case Ky.INCOMPLETE:return WP.INCOMPLETE;case Ky.CANCELED:return WP.CANCELED;case Ky.EXPIRED:return WP.EXPIRED;case Ky.TRIALING:return WP.TRIALING;default:return WP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(BP||(BP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(WP||(WP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(zP||(zP={}));const HP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Ky.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},JP=[{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"}],YP=[{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:""}],QP=[{id:"id",externalId:"externalId",type:qy.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],XP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*ZP(){yield $o(tP.setLoading(!0));try{const[e]=yield jo(tp.subscriptions.getManagedSubscriptions);yield $o(tP.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield $o(tP.setError(e))}}function*e_(){yield Fa(sP.loadBillingInformation,t_)}function*t_(){yield function*(e){const t=yield zo((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield zo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield n_(n,!1):yield $o(sP.setError(t?"Not authorized":"Internal feature failure"))}()}function*n_(e,t){yield $o(sP.setLoading(!0));try{var n,i;const o=yield jo(tp.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield jo(tp.subscriptions.getSubscriptionPlan,a):([,s]=yield Vo([jo(ZP),jo(tp.subscriptions.getSubscriptionPlan,a)]),l=yield zo((e=>e.subscriptions.billing.subscription.subscription||null))),yield $o(sP.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?WP.ACTIVE:qP(l.status),cancellation:l.cancellation&&KP(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 $o(sP.setError(Sg(e)))}}function*i_(){yield function*(){var e,t;yield $o(sP.setLoading(!0)),yield Ko(500),yield $o(sP.setState({loading:!1,fetching:!1,summary:{subscriptionId:HP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Jy.Stripe,externallyManaged:!1,currentPlanId:JP[0].id,defaultPlanId:JP[0].id},plan:D({},JP[0],{price:null==(e=JP[0].price)?void 0:e.amount,currency:null==(t=JP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*o_(){yield Fa(sP.loadBillingInformation,i_)}function*a_(){yield Fa(fP.loadPaymentMethod,r_),yield Fa(fP.submitPaymentMethod,l_),yield Fa(fP.submitPaymentMethodError,c_),yield Fa(fP.submitPaymentMethodSuccess,u_),yield Fa(fP.updatePaymentMethodBillingDetails,s_)}function*r_(){yield $o(fP.setLoading(!0));try{const e=(yield jo(tp.subscriptions.getPaymentMethods))[0];yield $o(fP.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield $o(fP.setError(Sg(e)))}}function*s_({payload:e}){yield $o(fP.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield jo(tp.subscriptions.updatePaymentMethodBillingDetails,t,D({email:n},i)),yield jo(r_),null==o||o(!0)}catch(e){yield $o(fP.setError(Sg(e))),null==o||o(!1)}yield $o(fP.setLoading(!1))}function*l_(){yield $o(fP.setLoading(!0))}function*c_({payload:e}){yield $o(fP.setError(e))}function*u_(){yield $o(fP.loadPaymentMethod())}function*d_(){yield $o(fP.setLoading(!0)),yield Ko(500);const e=QP[0];yield $o(fP.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*y_(){yield Fa(fP.loadPaymentMethod,d_)}function*f_(){yield Fa(mP.loadInvoices,p_),yield Fa(mP.downloadInvoice,g_)}function*p_(){yield $o(mP.setLoading(!0));try{const e=(yield jo(tp.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 $o(mP.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield $o(mP.setError(Sg(e)))}}function*g_({payload:e}){yield $o(mP.setInvoiceDownloadState({loading:!0,error:null}));try{yield jo(tp.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield $o(mP.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield $o(mP.setInvoiceDownloadState({loading:!1,error:Sg(e,null)}))}}function*S_(){yield $o(mP.setLoading(!0)),yield Ko(500),yield $o(mP.setState({loading:!1,fetching:!1,invoices:YP.map((e=>D({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield $o(mP.setLoading(!1))}function*v_(){yield Fa(mP.loadInvoices,S_)}function*h_(){yield Fa(tP.load,m_),yield Fa(tP.cancelSubscription,A_),yield Fa(tP.renewSubscription,b_)}function*m_(){const e=yield zo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield n_(e)}function*A_(){const{subscription:e}=yield zo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield $o(tP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield $o(tP.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Ky.ACTIVE)try{yield $o(tP.setCancellationLoading(!0)),yield jo(tp.subscriptions.cancelManagedSubscription,t),yield ZP(),yield $o(tP.setCancellationLoading(!1))}catch(e){yield $o(tP.setCancellationError(Sg(e)))}}function*b_(){const{subscription:e}=yield zo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield $o(tP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield $o(tP.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Hy.AT_PERIOD_END)try{yield $o(tP.setRenewalLoading(!0)),yield jo(tp.subscriptions.renewManagedSubscription,t),yield ZP(),yield $o(tP.setRenewalLoading(!1))}catch(e){yield $o(tP.setCancellationError(Sg(e)))}}function*T_(){yield $o(tP.setLoading(!0)),yield Ko(500),yield $o(tP.setState({subscription:HP,fetching:!1,loading:!1,error:null}))}function*E_(){yield Fa(tP.load,T_)}function*k_(){yield Vo([jo(e_),jo(a_),jo(f_),jo(h_)])}function*O_(){yield Vo([jo(o_),jo(y_),jo(v_),jo(E_)])}function*I_(){yield Fa(_P.loadCheckout,P_),yield Fa(_P.resetCheckout,__),yield Fa(_P.submitCheckout,L_),yield Fa(_P.confirmCheckout,w_),yield Fa(_P.errorCheckout,C_)}function*P_(){yield $o(_P.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*__(){yield $o(_P.setState({loading:!1,error:null,confirmed:!1}))}function*L_(){yield $o(_P.setState({loading:!0,error:null}))}function*w_({payload:{paymentMethodId:e,planId:t}}){const n=yield zo((e=>e.subscriptions.billing.subscription.subscription)),i=yield zo((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Ky.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield $o(_P.setState({loading:!0,error:null})),o&&a)return yield U_(),void(yield $o(tP.setState({subscription:D({},n,{status:Ky.ACTIVE})})));try{yield jo(tp.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Vo([t_(),r_(),p_()]),yield U_()}catch(e){yield $o(_P.setState({loading:!1,error:Sg(e)}))}}else yield $o(_P.setState({loading:!1,error:"Subscription not found"}))}function*U_(){yield $o(_P.setState({loading:!1,error:null,confirmed:!0}))}function*C_({payload:e}){yield $o(_P.setState({loading:!1,error:e}))}function*R_(){yield Fa(_P.resetCheckout,__)}function*D_(){yield Fa(BI.loadPlans,N_)}function*N_(){yield $o(BI.setLoading(!0));try{const e=(yield jo(tp.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 $o(BI.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield $o(BI.setError(Sg(e)))}}function*M_(){yield $o(BI.setLoading(!0)),yield Ko(500),yield $o(BI.setState({fetching:!1,loading:!1,plans:JP.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*F_(){yield Fa(BI.loadPlans,M_)}function*G_(){yield Fa(JI.loadPaymentConfiguration,$_)}function*$_(){yield $o(JI.setLoading(!0));try{(yield jo(tp.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Jy.Stripe))?yield function*(){yield $o(JI.setLoading(!0));try{const e=yield jo(tp.subscriptions.getStripePaymentProviderConfiguration);yield $o(JI.setState({loading:!1,fetching:!1,config:{paymentProvider:BP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield $o(JI.setError(Sg(e)))}}():yield $o(JI.setError("Payment provider not configured"))}catch(e){yield $o(JI.setError(Sg(e)))}}function*V_(){yield $o(JI.setLoading(!0)),yield Ko(500),yield $o(JI.setState({loading:!1,fetching:!1,config:{paymentProvider:BP.STRIPE,apiKey:""}}))}function*x_(){yield Fa(JI.loadPaymentConfiguration,V_)}function*j_(){yield Fa(DP.createCardSetupIntentSecret,B_)}function*B_({payload:e}){yield $o(DP.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield jo(tp.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield $o(DP.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield $o(DP.setError(Sg(e)))}}function*W_(){yield Fa($P.loadVendorPublicConfiguration,z_)}function*z_(){yield $o($P.setLoading(!0));try{const e=yield jo(tp.subscriptions.getVendorPublicConfigurations);yield $o($P.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield $o($P.setError(Sg(e)))}}function*K_(){yield $o($P.setLoading(!0)),yield Ko(500),yield $o($P.setState({fetching:!1,loading:!1,vendorPublicConfig:XP}))}function*q_(){yield Fa($P.loadVendorPublicConfiguration,K_)}var H_={sagas:function*(){yield Vo([jo(k_),jo(I_),jo(D_),jo(G_),jo(j_),jo(W_)])},mockSagas:function*(){yield Vo([jo(O_),jo(R_),jo(F_),jo(x_),jo(q_)])},reducer:jP,actions:xP,initialState:VP,storeName:"subscriptions"},J_={sagas:function*(){yield Fa(GS.loadVendorPublicInfo,$S)},storeName:Mt,initialState:NS,reducer:MS,actions:GS};const{reducer:Y_}=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}))}}}),Q_=(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=_a(),s=[...ut({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=dt({middleware:s,preloadedState:{root:D({},e,{previewMode:n,urlStrategy:r}),[AO.storeName]:D({},AO.initialState,i,null!=(c=null==o?void 0:o.auth)?c:{},{routes:D({},AO.initialState.routes,null!=(u=null==i?void 0:i.routes)?u:{},null!=(d=null==o||null==(y=o.auth)?void 0:y.routes)?d:{})}),[KO.storeName]:D({},KO.initialState,null!=(f=null==o?void 0:o.auditLogs)?f:{},{auditLogsState:D({},KO.initialState.auditLogsState,null!=(p=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:D({},KO.initialState.auditsMetadataState,null!=(S=null==o||null==(v=o.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[HO]:D({},qO,null!=(h=null==o?void 0:o.audits)?h:{}),[DI.storeName]:DI.initialState,[H_.storeName]:H_.initialState,[J_.storeName]:J_.initialState},reducer:Ke({root:Y_,[AO.storeName]:AO.reducer,[KO.storeName]:KO.reducer,[HO]:YO,[DI.storeName]:DI.reducer,[H_.storeName]:H_.reducer,[J_.storeName]:J_.reducer})});const m=function*(){yield Vo([jo(AO.sagas),jo(KO.sagas),jo(sI),jo(DI.sagas),jo(H_.sagas),jo(J_.sagas)])},A=function*(){yield Vo([jo(AO.mockSagas),jo(KO.mockSagas),jo(H_.mockSagas)])};n?(l.store.destroy=t.run(A).cancel,l.store.dispatch(xi.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 X_=n(314);const Z_=()=>{if(!Va.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")},eL=(e,t)=>e?e.isEntitled?{isEntitled:!0}:{isEntitled:!1,justification:e.justification}:{isEntitled:!1,justification:t};var tL=n(714),nL=n.n(tL);function iL(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function oL(e){if(e.type)return e;if("#"===e.charAt(0))return oL(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 aL(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 rL(e){if(0===e.indexOf("#"))return e;const{values:t}=oL(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 sL(e,t){return e=oL(e),t=iL(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,aL(e)}function lL(e,t){if(e=oL(e),t=iL(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 aL(e)}function cL(e,t){if(e=oL(e),t=iL(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 aL(e)}const uL=e=>{if(e)return{main:e,light:rL(cL(e,.4)),dark:rL(lL(e,.15)),hover:rL(lL(e,.15)),active:rL(lL(e,.2))}},dL=e=>{if(e)return{main:e,light:cL(e,.7),dark:lL(e,.2)}},yL=(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({},uL(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({},uL(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({},uL(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:D({},dL(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:D({},dL(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:D({},dL(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:D({},dL(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 pL{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 pL;return n.set(e),pL._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=nL().all([null!=(t=fL.navigation)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=nL().all([null!=(i=fL.theme)?i:{},yL(null==e?void 0:e.theme,fL.theme)]),this._themeV2=nL().all([null!=(o=fL.themeV2)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=nL().all([null!=(r=fL.localizations)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}]),this._integrations=nL().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}}}pL._instances={};var gL=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},SL=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)}))},hL=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 mL,AL,bL,TL,EL,kL,OL,IL,PL,_L,LL,wL;!function(e){e.phoneNumber="phoneNumber"}(mL||(mL={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(AL||(AL={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(bL||(bL={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(TL||(TL={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(EL||(EL={})),function(e){e.Invoices="invoices"}(kL||(kL={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(OL||(OL={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(IL||(IL={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(PL||(PL={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(_L||(_L={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(LL||(LL={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(wL||(wL={}));const UL={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},CL={hidden:"hidden",edit:"edit"};var RL="6.155.0-alpha.2",DL={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"},NL=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];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(RL),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=Ur,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:pL.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}xr.set(DL,a.name),e.next=15;break;case 4:return e.prev=4,e.next=7,jr();case 7:t=e.sent,a.options.overrideFeatureFlags&&Object.assign(t,a.options.overrideFeatureFlags),xr.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){xr.set(D({},DL,e),a.name)},this.queryFeatureFlags=function(e){return xr.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([$r]),1)[0]}};var l=gL(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=Q_({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=pL.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;pL.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:O})):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(ci.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(),hL(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 Z_(),i?(0,X_.tE)(t,e,n):eL(null==e||null==(o=e.features)?void 0:o[t],zs.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 Z_(),i?(0,X_.wJ)(t,e,n):eL(null==e||null==(o=e.permissions)?void 0:o[t],zs.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:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),ML=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",o=U.getInstance(i);e&&t?(Va.setAccessToken(t),Va.setUser(D({},n,{accessToken:t})),o.store.dispatch(xi.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(xi.loadTenants())):(Va.setAccessToken(null),Va.setUser(null),o.store.dispatch(xi.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),FL=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}(),GL=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}(),$L=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},VL=function(){function e(t,n,i,o){var a=!(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,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=Q_({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 NL(this.options,t,!0),pL.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}(),xL="modern",jL=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[xL]},BL=function(){function e(t,n,i,o){var a=!(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,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=Q_({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 NL(this.options,t,!0,a),pL.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 WL(e,t){return WL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},WL(e,t)}function zL(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&&WL(e,t)}function KL(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 qL(e){return qL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},qL(e)}function HL(){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 JL(e,t,n){return JL=HL()?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&&WL(o,n.prototype),o},JL.apply(null,arguments)}function YL(e){var t="function"==typeof Map?new Map:void 0;return YL=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 JL(e,arguments,qL(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),WL(n,e)},YL(e)}function QL(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=qL(e);if(t){var o=qL(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return KL(this,n)}}var XL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new NL(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){zL(n,e);var t=QL(n);function n(){var e;I(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=SL(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=SL(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=SL(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=SL(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=SL(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=SL(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}(YL(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={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=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 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 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(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 jL},AdminPortalRenderer:function(){return zL},AppHolder:function(){return U},CheckoutDialog:function(){return BL},FronteggApp:function(){return VL},HostedLogin:function(){return xL},LoginBoxRenderer:function(){return qL},createElement:function(){return bL},defaultTheme:function(){return KL},formatName:function(){return AL},getThemeAdminByName:function(){return WL},getThemeByName:function(){return HL},initialize:function(){return iw},mockFlagsList:function(){return $L},restoreSearchParams:function(){return EL},waitThemeSetter:function(){return TL}});var e={};n.r(e),n.d(e,{Delete:function(){return Nr},Get:function(){return Ur},Patch:function(){return Dr},Post:function(){return Cr},PostDownload:function(){return Mr},Put:function(){return Rr},extractHeadersFromOptions:function(){return Fr},getBaseUrl:function(){return _r},getMetadataHeaders:function(){return Lr}});var t={};n.r(t),n.d(t,{FeatureFlags:function(){return xr},loadFeatureFlags:function(){return jr}});var o={};n.r(o),n.d(o,{GetUserJwt:function(){return Br},getCurrentUserTenantsV1:function(){return Jr},getCurrentUserTenantsV3:function(){return qr},getUsersGroups:function(){return Hr},getUsersRoles:function(){return Kr},getUsersV2:function(){return Wr},getUsersV3:function(){return zr},sendResetBreachedPasswordEmails:function(){return Yr},updateUserProfileV2:function(){return Qr}});var a={};n.r(a),n.d(a,{getHierarchyMetadata:function(){return cs},getParentTenants:function(){return as},getParentTenantsById:function(){return rs},getSubTenants:function(){return is},getSubTenantsAsTree:function(){return os},getTenants:function(){return ns},getTenantsUsersCount:function(){return ss},searchSubTenants:function(){return ls},switchTenant:function(){return ts}});var r={};n.r(r),n.d(r,{loadEntitlements:function(){return Bs},loadEntitlementsV2:function(){return Ws}});var s={};n.r(s),n.d(s,{AuthStrategyEnum:function(){return ki},MachineToMachineAuthStrategy:function(){return Oi},OAuthLogout:function(){return bl},SocialLoginProviders:function(){return Ei},acceptInvitation:function(){return Sl},activateAccount:function(){return dl},activateAccountV2:function(){return yl},bulkCreateIPRestriction:function(){return ws},changePhoneNumber:function(){return ku},changePhoneNumberWithVerification:function(){return Tu},checkIfAllowToRememberMfaDevice:function(){return Kc},createDomainRestriction:function(){return ks},createIPRestriction:function(){return Ls},createOrUpdateSessionConfigrations:function(){return wc},createSSOConfiguration:function(){return Xc},createSSOConfigurationByMetadata:function(){return tu},createSSOConfigurationByMetadataUrl:function(){return iu},createSSODomain:function(){return au},createSSOGroup:function(){return uu},createSamlGroup:function(){return pc},createTenantAccessToken:function(){return Gc},createUserAccessToken:function(){return Fc},deleteAllSessionsForUser:function(){return Cc},deleteDomainRestriction:function(){return Is},deleteIPRestriction:function(){return Cs},deleteSSOConfiguration:function(){return eu},deleteSSODomain:function(){return ru},deleteSSOGroup:function(){return yu},deleteSamlGroup:function(){return Sc},deleteSessionForUser:function(){return Uc},deleteTenantAccessToken:function(){return Nc},deleteTenantApiToken:function(){return Bc},deleteUserAccessToken:function(){return Mc},deleteUserApiToken:function(){return Wc},deleteWebAuthnDevice:function(){return wu},disableMFAAuthenticatorApp:function(){return Nl},disableMFASMS:function(){return Fl},disableMFAWebAuthn:function(){return $l},disableMfa:function(){return Rl},enrollMFAAuthenticatorApp:function(){return _l},enrollMFAAuthenticatorAppForLogin:function(){return jl},enrollMFAAuthenticatorAppForLoginV2:function(){return Bl},enrollMFASMS:function(){return wl},enrollMFASMSForLogin:function(){return Jl},enrollMFASMSForLoginV2:function(){return Yl},enrollMFAWebAuthn:function(){return Cl},enrollMFAWebAuthnForLogin:function(){return tc},enrollMFAWebAuthnForLoginV2:function(){return nc},enrollMfa:function(){return Il},exchangeOAuthTokens:function(){return hu},exchangeOAuthTokensV2:function(){return Su},forgotPassword:function(){return Tl},generateLoginResponse:function(){return Ys},generateLoginResponseFromOAuthResponse:function(){return tl},generateLoginResponseFromOAuthResponseV2:function(){return nl},generateLoginResponseV2:function(){return Qs},generateLoginResponseV3:function(){return el},generateStepupSession:function(){return Gu},getActivateAccountStrategy:function(){return fl},getCaptchaPolicy:function(){return vs},getCurrentUserSession:function(){return Pc},getCurrentUserSessions:function(){return Ic},getCurrentUserTenantsFunction:function(){return es},getCustomSocialLoginProvidersV1:function(){return Tc},getDomainRestrictions:function(){return Ts},getDomainRestrictionsConfig:function(){return Es},getGlobalSecurityPolicy:function(){return us},getIPRestrictions:function(){return Ps},getIPRestrictionsConfig:function(){return _s},getLockoutPolicy:function(){return ps},getMFADevices:function(){return Vl},getMFAStrategiesConfig:function(){return Ru},getMeAndEntitlements:function(){return Fu},getMeV2:function(){return Mu},getMfaPolicy:function(){return ds},getOidcConfiguration:function(){return vc},getPasswordConfigPolicy:function(){return bs},getPasswordHistoryPolicy:function(){return hs},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return Du},getSSOConfigurations:function(){return Qc},getSSODefaultRoles:function(){return lu},getSSOGroups:function(){return fu},getSSOPublicConfiguration:function(){return hc},getSamlConfiguration:function(){return rc},getSamlRoles:function(){return dc},getSamlRolesGroups:function(){return yc},getSamlVendorConfiguration:function(){return lc},getSessionConfigurations:function(){return Lc},getSocialLoginProviders:function(){return mc},getSocialLoginProvidersV2:function(){return Ac},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return bc},getTabTenantFromSessionStorage:function(){return Zr},getTenantAccessTokensData:function(){return Rc},getTenantApiTokensData:function(){return Vc},getUserAccessTokensData:function(){return Dc},getUserApiTokensData:function(){return $c},getUserAuthorization:function(){return Nu},getUserById:function(){return zc},getVendorConfig:function(){return kc},getVendorLockoutPolicy:function(){return gs},getVendorMfaPolicy:function(){return ys},getVendorPasswordHistoryPolicy:function(){return ms},getVendorPublicAuthStrategiesConfig:function(){return Cu},getWebAuthnDevices:function(){return Lu},loadPasswordConfig:function(){return kl},login:function(){return sl},loginViaSocialLogin:function(){return Ec},loginWithMfa:function(){return cl},loginWithMfaV2:function(){return ul},loginv2:function(){return ll},logout:function(){return Al},oidcPostLogin:function(){return rl},oidcPostLoginV2:function(){return gu},passwordlessPostLogin:function(){return Jc},passwordlessPostLoginV2:function(){return qc},passwordlessPreLogin:function(){return Hc},postLogin:function(){return al},preDisableMFASMS:function(){return Ml},preDisableMFAWebAuthn:function(){return Gl},preEnrollMFAAuthenticatorApp:function(){return Pl},preEnrollMFAAuthenticatorAppForLogin:function(){return xl},preEnrollMFASMS:function(){return Ll},preEnrollMFASMSForLogin:function(){return ql},preEnrollMFAWebAuthn:function(){return Ul},preEnrollMFAWebAuthnForLogin:function(){return ec},preLogin:function(){return il},preLoginV2:function(){return pu},preLoginWithIdpType:function(){return ol},preVerifyMFAEmailCode:function(){return zl},preVerifyMFASMSForLogin:function(){return Ql},preVerifyMFAWebAuthnForLogin:function(){return ic},recoverMfaToken:function(){return Ol},refreshToken:function(){return vl},refreshTokenV2:function(){return hl},refreshTokenV3:function(){return ml},resendActivationEmail:function(){return pl},resendInvitationEmail:function(){return gl},resetPassword:function(){return El},resetPhoneNumber:function(){return Au},revokeSessionsForUser:function(){return _c},saveLockoutPolicy:function(){return Ss},saveMfaPolicy:function(){return fs},savePasswordHistoryPolicy:function(){return As},setSSODefaultRoles:function(){return cu},setTabTenantInSessionStorage:function(){return Xr},signUpUser:function(){return Oc},silentOAuthRefreshToken:function(){return mu},silentOAuthRefreshTokenV2:function(){return vu},testCurrentIp:function(){return Ds},testCurrentIpInAllowList:function(){return Rs},updateDomainRestrictionConfig:function(){return Os},updateIPRestrictionConfig:function(){return Us},updateSSOConfiguration:function(){return Zc},updateSSOConfigurationByMetadata:function(){return nu},updateSSOConfigurationByMetadataUrl:function(){return ou},updateSSOGroup:function(){return du},updateSamlConfiguration:function(){return sc},updateSamlGroup:function(){return gc},updateSamlRoles:function(){return fc},updateSamlVendorMetadata:function(){return cc},updateTenantApiTokensData:function(){return jc},updateUserApiTokensData:function(){return xc},validateSSODomain:function(){return su},validateSamlDomain:function(){return uc},verifyChangePhoneNumber:function(){return Eu},verifyInviteToken:function(){return Yc},verifyMFAAuthenticatorAppForLogin:function(){return Wl},verifyMFAEmailCode:function(){return Kl},verifyMFAEmailCodeV2:function(){return Hl},verifyMFASMSForLogin:function(){return Xl},verifyMFASMSForLoginV2:function(){return Zl},verifyMFAWebAuthnForLogin:function(){return oc},verifyMFAWebAuthnForLoginV2:function(){return ac},verifyMfa:function(){return Dl},verifyNewDeviceSession:function(){return Uu},verifyResetPhoneNumber:function(){return bu},webAuthnCreateNewDeviceSession:function(){return _u},webAuthnPostLogin:function(){return Iu},webAuthnPostLoginV2:function(){return Pu},webAuthnPreLogin:function(){return Ou}});var l={};n.r(l),n.d(l,{addUser:function(){return Wu},changePassword:function(){return ju},createInviteUserLink:function(){return Hu},deleteInviteUserLink:function(){return Ju},deleteUser:function(){return zu},getInviteLinkConfiguration:function(){return Qu},getInviteUserLink:function(){return Yu},getProfile:function(){return $u},loadAvailablePermissions:function(){return Zu},loadAvailableRoles:function(){return Xu},loadStats:function(){return ed},loadUsers:function(){return Bu},resendActivationLink:function(){return td},resendInvitationLink:function(){return nd},resendInvitationLinkToAllTenants:function(){return id},updateInviteUserLink:function(){return qu},updateProfile:function(){return Vu},updateProfileImage:function(){return xu},updateUser:function(){return Ku}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return ad},getAuditsMetadata:function(){return ud},getCurrentUserIpMetadata:function(){return sd},getIpAdressMetadata:function(){return dd},getNotificationsMetadata:function(){return ld},getSamlMetadata:function(){return cd},updateAdminBoxMetadata:function(){return rd}});var u={};n.r(u),n.d(u,{downloadReport:function(){return md},getReport:function(){return Sd},getReports:function(){return gd},renderReport:function(){return vd},scheduleReport:function(){return hd},sendReport:function(){return Ad}});var d={};n.r(d),n.d(d,{getNotifications:function(){return bd},markAllAsRead:function(){return kd},updateNotificationIsPinned:function(){return Ed},updateNotificationStatus:function(){return Td}});var y={};n.r(y),n.d(y,{exportAudits:function(){return _d},getAudits:function(){return Id},getAuditsStats:function(){return Pd}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return jd},deleteEmailSubscriptions:function(){return Vd},deleteSMSConfiguration:function(){return qd},deleteSMSSubscriptions:function(){return Kd},deleteSlackConfiguration:function(){return Nd},deleteWebhooksConfiguration:function(){return Qd},getCategories:function(){return ty},getChannelMaps:function(){return ny},getEmailConfiguration:function(){return Fd},getSMSConfiguration:function(){return Bd},getSlackChannels:function(){return Dd},getSlackConfiguration:function(){return Ud},getSlackScope:function(){return Cd},getWebhookLog:function(){return Xd},getWebhooksConfigurations:function(){return Jd},patchEmailConfiguration:function(){return $d},patchSMSConfiguration:function(){return zd},postEmailConfiguration:function(){return Gd},postSMSConfiguration:function(){return Wd},postSlackCode:function(){return Md},postSlackConfiguration:function(){return Rd},postWebhookRetry:function(){return ey},postWebhookTest:function(){return Zd},postWebhooksConfiguration:function(){return Yd},putEmailSubscriptions:function(){return xd},putSMSSubscriptions:function(){return Hd}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return ay},getSettings:function(){return oy},updateSettings:function(){return iy}});var g={};n.r(g),n.d(g,{addRole:function(){return uy},attachPermissionToRoles:function(){return gy},attachPermissionsToRole:function(){return fy},deleteRole:function(){return dy},getPermissionCategories:function(){return Sy},getPermissions:function(){return py},getRoles:function(){return cy},updateRole:function(){return yy}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return qy},ISubscriptionStatus:function(){return Ky},PaymentMethodType:function(){return Hy},ProviderType:function(){return Jy},TenantCreatedAction:function(){return Qy},TrialEndAction:function(){return Yy},cancelManagedSubscription:function(){return ky},cancelSubscription:function(){return my},createStripeCustomer:function(){return Gy},createStripePaymentMethodSetupIntentSecret:function(){return Vy},createSubscription:function(){return My},createTenantConfiguration:function(){return By},getManagedSubscription:function(){return Ty},getManagedSubscriptions:function(){return Ey},getPaymentMethod:function(){return Ry},getPaymentMethods:function(){return Dy},getPaymentProviders:function(){return Wy},getStripeCustomer:function(){return Fy},getStripePaymentProviderConfiguration:function(){return $y},getSubscription:function(){return hy},getSubscriptionInvoice:function(){return wy},getSubscriptionInvoicePdf:function(){return Uy},getSubscriptionInvoices:function(){return Ly},getSubscriptionPlan:function(){return _y},getSubscriptionPlans:function(){return Py},getSubscriptionSummaries:function(){return xy},getSubscriptions:function(){return vy},getTenantConfiguration:function(){return jy},getVendorPublicConfigurations:function(){return zy},renewManagedSubscription:function(){return Oy},renewSubscription:function(){return Ay},updateManagedSubscription:function(){return Iy},updatePaymentMethodBillingDetails:function(){return Ny},updateSubscription:function(){return by}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return Xy}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return nf},addUserToTenantAndSubTenants:function(){return ef},addUsersToSubTenant:function(){return uf},createSubTenant:function(){return rf},deleteSubTenant:function(){return sf},loadAllUsers:function(){return Zy},removeUserFromTenantAndSubTenants:function(){return tf},removeUserRolesFromSubTenants:function(){return of},setUserRolesForSubTenants:function(){return af},updateSubAccountAccess:function(){return cf},updateSubTenant:function(){return lf}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return gf},createConfiguration:function(){return ff},deleteConfiguration:function(){return pf},getConfigs:function(){return df},updateConfiguration:function(){return yf}});var A={};n.r(A),n.d(A,{impersonate:function(){return Sf}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return kf},addUsersToGroup:function(){return If},createGroup:function(){return bf},deleteGroup:function(){return Ef},deleteRolesFromGroup:function(){return Of},deleteUsersFromGroup:function(){return Pf},getGroupById:function(){return hf},getGroupConfiguration:function(){return _f},getGroups:function(){return mf},getGroupsByIds:function(){return Af},updateGroup:function(){return Tf},updateGroupConfiguration:function(){return Lf}});var T={};n.r(T),n.d(T,{getInsights:function(){return Uf},getRecommendations:function(){return wf}});var E={};n.r(E),n.d(E,{createPhoneNumber:function(){return Df},deletePhoneNumber:function(){return Rf},getUserPhoneNumbers:function(){return Cf},preVerifyPhoneNumber:function(){return Nf},verifyDeletePhoneNumber:function(){return Ff},verifyPhoneNumber:function(){return Mf}});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return Ks},AuthStrategyEnum:function(){return ki},ContextHolder:function(){return Va},FeatureFlags:function(){return xr},FronteggApiError:function(){return ja},FronteggContext:function(){return xa},FronteggFrameworks:function(){return ui},GetUsersFilterPreset:function(){return fi},GroupManagedByEnum:function(){return Jf},GroupRelations:function(){return qf},ISubscriptionCancellationPolicy:function(){return qy},ISubscriptionStatus:function(){return Ky},InsightCode:function(){return Qf},LOAD_AUTHORIZATION_FF:function(){return js},MFAStrategyEnum:function(){return xs},MachineToMachineAuthStrategy:function(){return Oi},NotEntitledJustification:function(){return zs},PaginationOrderEnum:function(){return di},PaymentMethodType:function(){return Hy},ProviderType:function(){return Jy},RecommendationActionKey:function(){return Xf},RecommendationCode:function(){return Yf},RecommendationSeverity:function(){return Zf},RequestSource:function(){return ci},RestrictionType:function(){return Wn},ScimConnectionSource:function(){return Hf},SecondaryAuthStrategy:function(){return $s},SecurityCategory:function(){return ep},SocialLoginProviders:function(){return Ei},SortByEnum:function(){return yi},TenantSortByEnum:function(){return $f},TenantType:function(){return Vf},USE_ENTITLEMENTS_V2_ENDPOINT_FF:function(){return $r},UserManagedByEnum:function(){return Gf},WebAuthnDeviceType:function(){return Vs},api:function(){return tp},countConfigurationUsers:function(){return gf},createConfiguration:function(){return ff},default:function(){return np},deleteConfiguration:function(){return pf},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return xf},fronteggHeaders:function(){return li},fronteggRefreshTokenUrl:function(){return jf},fronteggSilentRefreshTokenUrl:function(){return Bf},fronteggTenantsUrl:function(){return zf},fronteggTenantsV3Url:function(){return Kf},fronteggUsersUrl:function(){return Wf},getConfigs:function(){return df},getCurrentUserTenantsFunction:function(){return es},getTabTenantFromSessionStorage:function(){return Zr},loadFeatureFlags:function(){return jr},providersArray:function(){return pi},setTabTenantInSessionStorage:function(){return Xr},updateConfiguration:function(){return yf}});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:function(){return NL},AccountPageFields:function(){return _L},DomainRestrictionsTabFields:function(){return RL},GeneralSettingsTabFields:function(){return CL},InviteUserModalFields:function(){return PL},IpRestrictionsTabFields:function(){return DL},Metadata:function(){return mL},PrivacyPageFields:function(){return IL},ProfilePageFields:function(){return OL},SecurityPageTabs:function(){return wL},SessionManagementTabFields:function(){return UL},SignupFields:function(){return kL},SubscriptionsPageFields:function(){return LL},alpha:function(){return yL},fieldAppearance:function(){return ML},tabAppearance:function(){return FL}});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 D(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 R(){return R=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},R.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 V(e){return!!e&&!!e[Ie]}function x(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 o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function Q(e,t){return void 0===t&&(t=!1),Z(e)||V(e)||!x(e)||(B(e)>1&&(e.set=e.add=e.clear=e.delete=X),Object.freeze(e),t&&j(e,(function(e,t){return Q(t,!0)}),!0)),e}function X(){$(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[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)),x(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(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(V(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),!V(r))return;e.m=!1}if(x(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&&Q(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},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 V(e)||$(22,e),function e(t){if(!x(t))return t;var n,i=t[Ie],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),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,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||!x(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[Ie];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 De=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),x(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&&Q(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){x(e)||$(8),V(e)&&(e=Se(e));var t=ae(this),n=ge(this,e,void 0);return n[Ie].C=!0,oe(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 o=ee("Patches").$;return V(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Re=new De,Ne=Re.produce,Me=(Re.produceWithPatches.bind(Re),Re.setAutoFreeze.bind(Re),Re.setUseProxies.bind(Re),Re.applyPatches.bind(Re),Re.createDraft.bind(Re),Re.finishDraft.bind(Re),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 Ve(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 xe="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(Ve(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ve(1));return n(ze)(e,t)}if("function"!=typeof e)throw new Error(Ve(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(Ve(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ve(4));if(l)throw new Error(Ve(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(Ve(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!We(e))throw new Error(Ve(7));if(void 0===e.type)throw new Error(Ve(8));if(l)throw new Error(Ve(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(Ve(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(Ve(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[xe]=function(){return this},e}return y({type:Be.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[xe]=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(Ve(12));if(void 0===n(void 0,{type:Be.PROBE_UNKNOWN_ACTION()}))throw new Error(Ve(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(Ve(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(Ve(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 Qe,Xe=Ye,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,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 x(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||{},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(V(e))return void 0===(i=n(e,t))?e:i;if(x(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[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 o=e[t][Ie];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!==Ie){var r=t[a];if(void 0===r&&!W(t,a))return!0;var s=n[a],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 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[Ie];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,Ie,{value:a,writable:!0}),o},S:function(e,n,o){o?V(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 o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)j(a,(function(t){t!==Ie&&(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=>R({},n,{[e]:t[e]}),vt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>R({},t,{[e]:R({},t[e],n)})}),ht=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return R({},n,{[e]:R({},n[e],{[t]:R({},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 R({},t,{[e]:R({},t[e],{loaders:R({},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 R({},t,{[e]:R({},t[e],{errors:R({},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 R({},i,{[e]:R({},i[e],{[t]:R({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),Tt=(e,t,n)=>i=>{var o;return R({},i,{[e]:R({},i[e],{[t]:R({},null==i||null==(o=i[e])?void 0:o[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,o,a,r,s,l=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=Ot[e.charCodeAt(i)],a=Ot[e.charCodeAt(i+1)],r=Ot[e.charCodeAt(i+2)],s=Ot[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;!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={}));const Ut="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Ct="HOSTED_LOGIN_VERIFIER_KEY",Dt="auth",Rt="connectivity",Nt="auditLogs",Mt="vendor",Ft={flow:Lt.Login,step:_t.preLogin,loading:!1,email:"",tenants:[]},Gt={setLoginState:vt("loginState"),resetLoginState:St("loginState",{loginState:Ft})},$t={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 xt={step:Vt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},jt={setActivateState:vt("activateState"),resetActivateState:St("activateState",{activateState:xt}),setActivateStrategyState:ht("activateState","activationStrategy")},Bt={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 Wt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Wt||(Wt={}));const zt={step:Wt.validate},Kt={setAcceptInvitationState:vt("acceptInvitationState"),resetAcceptInvitationState:St("acceptInvitationState",{acceptInvitationState:zt})},Ht={acceptInvitation:yt("auth/acceptInvitation",(e=>({payload:e})))};let qt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(qt||(qt={}));const Jt={step:qt.forgotPassword,loading:!1,email:"",passwordConfig:null},Yt={setForgotPasswordState:vt("forgotPasswordState"),resetForgotPasswordState:St("forgotPasswordState",{forgotPasswordState:Jt})},Qt={forgotPassword:yt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:yt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:yt("auth/loadPasswordConfig",(e=>({payload:e})))};let Xt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Xt||(Xt={}));const Zt={step:Xt.ResetPhoneNumber,loading:!1},en={setResetPhoneNumberState:vt("resetPhoneNumberState"),resetResetPhoneNumberState:St("resetPhoneNumberState",{resetPhoneNumberState:Zt})},tn={resetPhoneNumber:yt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:yt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:yt("auth/changePhoneNumber",(e=>({payload:e})))},nn={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},on={setSSOLoader:mt("ssoState"),setSSOError:At("ssoState"),setSSOState:vt("ssoState"),resetSSOState:St("ssoState",{ssoState:nn})},an={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})))},rn={loading:!1,error:null},sn={setProfileState:vt("profileState"),resetProfileState:St("profileState",{profileState:rn})},ln={loadProfile:yt("auth/loadProfile"),saveProfile:yt("auth/saveProfile",(e=>({payload:e}))),changePassword:yt("auth/changePassword",(e=>({payload:e})))};let cn;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode",e.noMFAEnrolledStepUp="noMFAEnrolledStepUp"}(cn||(cn={}));const un={step:cn.verify,loading:!1,saving:!1},dn={setMfaState:vt("mfaState"),resetMfaState:St("mfaState",{mfaState:un})},yn={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})))},fn={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}},pn={setTeamLoader:mt("teamState"),setTeamError:At("teamState"),setTeamState:vt("teamState"),resetTeamState:St("teamState",{teamState:fn})},gn={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}))),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})))},Sn={firstLoad:!0,loading:!1,error:""},vn={setSocialLoginsState:vt("socialLoginState"),resetSocialLoginsState:St("socialLoginState",{socialLoginState:Sn})},hn={loadSocialLoginsConfiguration:yt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:yt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:yt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:yt("auth/setSocialLoginError",(e=>({payload:e})))};let mn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(mn||(mn={}));const An={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:mn.SignUp},bn={setSignUpState:vt("signUpState"),resetSignUpState:St("signUpState",{signUpState:An})},Tn={signUpUser:yt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:yt("auth/resetSignUpStateSoft")},En={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},kn={setApiTokensLoader:mt("apiTokensState"),setApiTokensError:At("apiTokensState"),setApiTokensState:vt("apiTokensState"),resetApiTokensState:St("apiTokensState",{apiTokensState:En})},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})))},In={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}},Pn={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:In})},_n={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")},Ln={loading:!1},wn={setAccountSettingsState:vt("accountSettingsState"),resetAccountSettingsState:St("accountSettingsState",{accountSettingsState:Ln})},Un={loadAccountSettings:yt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:yt("auth/saveAccountSettings",(e=>({payload:e})))},Cn={tenants:[],subTenants:[],loading:!0,tenantTree:null},Dn={setTenantsState:vt("tenantsState"),resetTenantsState:St("tenantsState",{tenantsState:Cn})},Rn={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})))},Nn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Mn={setRolesState:vt("rolesState"),resetRolesState:St("rolesState",{rolesState:Nn})},Fn={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})))},Gn={loading:!1,sessions:[]},$n={setSessionsState:vt("sessionsState"),resetSessionsState:St("sessionsState",{sessionsState:Gn})},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})))},xn={loading:!1,configurations:{}},jn={setSessionsPolicyState:vt("sessionsPolicyState"),resetSessionsPolicyState:St("sessionsPolicyState",{sessionsPolicyState:xn})},Bn={loadSessionsPolicy:yt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:yt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Wn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Wn||(Wn={}));const zn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Wn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Kn={setRestrictionsState:vt("restrictionsState"),setIpRestrictionsState:ht("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:ht("restrictionsState","emailDomainRestrictions")},Hn={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})))},qn={loading:!1},Jn={setProvisioningState:vt("provisioningState"),resetProvisioningState:St("provisioningState",{provisioningState:qn})},Yn={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},Xn={setPasskeysState:vt("passkeysState"),resetPasskeysState:St("passkeysState",{passkeysState:Qn})},Zn={loadWebAuthnDevices:yt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:yt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},ei={loaders:{},errors:{},groups:[],groupsConfiguration:{}},ti={setUsersGroupsLoader:mt("groupsState"),setUsersGroupsError:At("groupsState"),setGroupsState:vt("groupsState"),resetUsersGroupsState:St("groupsState",{groupsState:ei})},ni={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})))},ii={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:ii}),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})},ai={loading:!0,error:null},ri={setCustomLoginState:vt("customLoginState"),resetCustomLoginState:St("customLoginState",{customLoginState:ai})},si={loadTenantMetadata:yt("auth/loadTenantMetadata"),updateTenantMetadata:yt("auth/updateTenantMetadata",(e=>({payload:e})))},li={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let ci,ui,di,yi,fi;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ci||(ci={})),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"}(ui||(ui={})),function(e){e.ASC="ASC",e.DESC="DESC"}(di||(di={})),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"}(yi||(yi={})),function(e){e.MFA_UNENROLLED="mfa-unenrolled",e.BREACHED_PASSWORDS="breached-passwords",e.INACTIVE="inactive"}(fi||(fi={}));const pi=["local","saml","google","github","facebook","microsoft","scim2","slack"],gi={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:di.DESC,_sortBy:yi.name},usersPageOffset:0,accountSettings:{}}},Si={setAllAccountsLoader:mt("allAccountsState"),setAllAccountsError:At("allAccountsState"),setAllAccountsState:vt("allAccountsState"),setSelectedAccountState:ht("allAccountsState","selectedAccount"),resetAllAccountsState:St("allAccountsState",{allAccountsState:gi})},vi={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})))},hi={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:[]}},mi={setAllAccountDialogsState:vt("allAccountsDialogsState"),resetAllAccountDialogsState:St("allAccountsDialogsState",{allAccountsDialogsState:hi}),openCreateSubAccountDialog:bt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:Tt("allAccountsDialogsState","createSubAccountDialog",hi.createSubAccountDialog),openUpdateSubAccountDialog:bt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:Tt("allAccountsDialogsState","updateSubAccountDialog",hi.updateSubAccountDialog),openDeleteSubAccountDialog:bt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:Tt("allAccountsDialogsState","deleteSubAccountDialog",hi.deleteSubAccountDialog),openAddUsersToAccountDialog:bt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:Tt("allAccountsDialogsState","addUsersToAccountDialog",hi.addUsersToAccountDialog),openDeleteUserFromAccountDialog:bt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:Tt("allAccountsDialogsState","deleteUserFromAccountDialog",hi.deleteUserFromAccountDialog),openEditUserRolesDialog:bt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:Tt("allAccountsDialogsState","editUserRolesDialog",hi.editUserRolesDialog)},Ai={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}}},bi={setSecurityCenterState:vt("securityCenterState"),resetSecurityCenterState:St("securityCenterState",{securityCenterState:Ai}),setSecurityCenterStateLoader:mt("securityCenterState"),setSecurityCenterStateError:At("securityCenterState")},Ti={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 Ei,ki,Oi;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Ei||(Ei={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(ki||(ki={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Oi||(Oi={}));const Ii={[ki.Code]:_t.loginWithOtc,[ki.EmailAndPassword]:_t.loginWithPassword,[ki.MagicLink]:_t.magicLinkPreLoginSuccess,[ki.SmsCode]:_t.loginWithSmsOtc},Pi={loading:!1,error:null,phoneNumbers:void 0},_i={setSmsState:vt("smsState"),resetSmsState:St("smsState",{smsState:Pi})},Li={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})))},wi={loading:!1,mfaDevices:void 0,mfaToken:""},Ui={setStepUpState:vt("stepUpState"),resetStepUpState:St("stepUpState",{stepUpState:wi})},Ci={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:An,loginState:Ft,stepUpState:wi,activateState:xt,acceptInvitationState:zt,forgotPasswordState:Jt,ssoState:nn,profileState:rn,customLoginState:ai,mfaState:un,teamState:fn,groupsState:ei,groupsDialogsState:ii,socialLoginState:Sn,apiTokensState:En,securityPolicyState:In,accountSettingsState:Ln,tenantsState:Cn,rolesState:Nn,resetPhoneNumberState:Zt,sessionsState:Gn,sessionsPolicyState:xn,restrictionsState:zn,provisioningState:qn,passkeysState:Qn,allAccountsState:gi,allAccountsDialogsState:hi,securityCenterState:Ai,smsState:Pi},Ri=R({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 Ni;!function(e){e.impersonating="impersonating",e.success="success"}(Ni||(Ni={}));const Mi={step:Ni.impersonating,loading:!1},Fi={setImpersonateState:vt("impersonateState"),resetImpersonateState:St("impersonateState",{impersonateState:Mi})},Gi={impersonate:yt("impersonation/impersonate",(e=>({payload:e})))},{reducer:$i,actions:Vi}=pt({name:Dt,initialState:Ri,reducers:R({resetState:e=>R({},e,Di),setState:(e,{payload:t})=>R({},e,t),setUser:("user",(e,{payload:t})=>R({},e,{user:t})),setEntitlements:ht("user","entitlements")},Gt,Ui,vn,jt,Fi,Kt,Yt,en,bn,sn,ri,on,dn,pn,ti,oi,kn,Pn,wn,Dn,Mn,$n,jn,Kn,Jn,Xn,Si,mi,bi,_i)});const xi=R({loadEntitlements:yt("auth/loadEntitlements",(e=>({payload:e})))},Vi,$t,Ci,hn,Bt,Ht,Qt,tn,Tn,ln,si,an,yn,gn,ni,{},On,_n,Un,Rn,Fn,Vn,Bn,Hn,Yn,Gi,Zn,vi,Ti,Li);var ji=function(e){return"@@redux-saga/"+e},Bi=ji("CANCEL_PROMISE"),Wi=ji("CHANNEL_END"),zi=ji("IO"),Ki=ji("MATCH"),Hi=ji("MULTICAST"),qi=ji("SAGA_ACTION"),Ji=ji("SELF_CANCELLATION"),Yi=ji("TASK"),Qi=ji("TASK_CANCEL"),Xi=ji("TERMINATE"),Zi=ji("LOCATION");function eo(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 to=function(e){return null==e},no=function(e){return null!=e},io=function(e){return"function"==typeof e},oo=function(e){return"string"==typeof e},ao=Array.isArray,ro=function(e){return e&&io(e.then)},so=function(e){return e&&io(e.next)&&io(e.throw)},lo=function e(t){return t&&(oo(t)||yo(t)||io(t)||ao(t)&&t.every(e))},co=function(e){return e&&io(e.take)&&io(e.close)},uo=function(e){return io(e)&&e.hasOwnProperty("toString")},yo=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},fo=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[Bi]=function(){clearTimeout(n)},i},po=function(e){return function(){return e}},go=po(!0),So=function(){},vo=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var ho=function(e,t){R(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function mo(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Ao=function(e){throw e},bo=function(e){return{value:e,done:!0}};function To(e,t,n){void 0===t&&(t=Ao),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:bo,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Eo(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var ko=function(e){return Array.apply(null,new Array(e))},Oo=function(e){return function(t){return e(Object.defineProperty(t,qi,{value:!0}))}},Io=function(e){return e===Xi},Po=function(e){return e===Qi},_o=function(e){return Io(e)||Po(e)};function Lo(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=ao(e)?ko(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||_o(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=So,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function wo(e){return{name:e.name||"anonymous",location:Uo(e)}}function Uo(e){return e[Zi]}var Co=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",Ro="CALL",No="FORK",Mo="SELECT",Fo=function(e,t){var n;return(n={})[zi]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Go(e,t){return void 0===e&&(e="*"),lo(e)?(no(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Fo(Do,{pattern:e})):co(n=e)&&n[Hi]&&no(t)&&lo(t)?Fo(Do,{channel:e,pattern:t}):co(e)?(no(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Fo(Do,{channel:e})):void 0;var n}function $o(e,t){return to(t)&&(t=e,e=void 0),Fo("PUT",{channel:e,action:t})}function Vo(e){var t=Fo("ALL",e);return t.combinator=!0,t}function xo(e,t){var n,i=null;return io(e)?n=e:(ao(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&oo(n)&&io(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function jo(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 Fo(Ro,xo(e,n))}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 Fo(No,xo(e,n))}function Wo(e){return void 0===e&&(e=Ji),Fo("CANCEL",e)}function zo(e){void 0===e&&(e=vo);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Fo(Mo,{selector:e,args:n})}var Ko=jo.bind(null,fo);var Ho=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},qo=[],Jo=0;function Yo(e){try{Zo(),e()}finally{ea()}}function Qo(e){qo.push(e),Jo||(Zo(),ta())}function Xo(e){try{return Zo(),e()}finally{ta()}}function Zo(){Jo++}function ea(){Jo--}function ta(){var e;for(ea();!Jo&&void 0!==(e=qo.shift());)Yo(e)}var na=function(e){return function(t){return e.some((function(e){return sa(e)(t)}))}},ia=function(e){return function(t){return e(t)}},oa=function(e){return function(t){return t.type===String(e)}},aa=function(e){return function(t){return t.type===e}},ra=function(){return go};function sa(e){var t="*"===e?ra:oo(e)?oa:ao(e)?na:uo(e)?oa:io(e)?ia:yo(e)?aa:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var la={type:Wi},ca=function(e){return e&&e.type===Wi};function ua(){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(la)}))},(e={})[Hi]=!0,e.put=function(e){if(!t)if(ca(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[Ki](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=ra),t?e(la):(e[Ki]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),mo(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[qi]?s(e):Qo((function(){s(e)}))},r}function da(e,t){var n=e[Bi];io(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var ya,fa=0,pa=function(){return++fa};function ga(e){e.isRunning()&&e.cancel()}var Sa=((ya={}).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):!ca(e)||r?n(e):n(Xi)};try{o.take(s,no(a)?sa(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},ya.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&&ro(t)?da(t,n):n(t)}))},ya.ALL=function(e,t,n,i){var o=i.digestEffect,a=fa,r=Object.keys(t);if(0!==r.length){var s=Lo(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(ao(t)?[]:{})},ya.RACE=function(e,t,n,i){var o=i.digestEffect,a=fa,r=Object.keys(t),s=ao(t)?ko(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||_o(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=So,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)}))},ya.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(ro(l))return void da(l,n);if(so(l))return void Ia(e,l,s.context,fa,wo(a),!1,n);n(l)}catch(e){n(e,!0)}},ya.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){to(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},ya.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(so(o))return o;var a=!1;return To((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!ro(o)})}))}catch(e){return To((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:wo(t)}(c,a);Xo((function(){var t=Ia(e,c,l.context,fa,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},ya.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()&&mo(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(ao(t)){if(0===t.length)return void n([]);var r=Lo(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},ya.CANCEL=function(e,t,n,i){var o=i.task;t===Ji?ga(o):ao(t)?t.forEach(ga):ga(t),n()},ya.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)}},ya.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Co());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(la):e.isEmpty()?(n.push(i),i.cancel=function(){mo(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(la):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])(la)}}}}(t.buffer),a=sa(i),r=function t(n){ca(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)},ya.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},ya.FLUSH=function(e,t,n){t.flush(n)},ya.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},ya.SET_CONTEXT=function(e,t,n,i){var o=i.task;ho(o.context,t),n()},ya);function va(e,t){return e+"?"+t}function ha(e){var t=e.name,n=e.location;return n?t+" "+va(n.fileName,n.lineNumber):t}function ma(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 Aa=null,ba=[],Ta=function(e){e.crashedEffect=Aa,ba.push(e)},Ea=function(){Aa=null,ba.length=0},ka=function(){var e,t,n=ba[0],i=ba.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=Uo(e))?t.code+" "+va(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+ha(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+ha(e.meta)})),[ma(ba)]).join("\n")};function Oa(e,t,n,i,o,a,r){var s;void 0===r&&(r=So);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||(mo(o,t),t.cont=So,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=So,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,Ta({meta:o,cancelledTasks:y}),S.isRoot){var i=ka();Ea(),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={})[Yi]=!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){ho(f,e)},s.toPromise=function(){return d||(d=Ho(),2===u?d.reject(c):0!==u&&d.resolve(l)),d.promise},s.isRunning=function(){return 0===u},s.isCancelled=function(){return 1===u||0===u&&1===t.status},s.isAborted=function(){return 2===u},s.result=function(){return l},s.error=function(){return c},s);return S}function Ia(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){ro(t)?da(t,i):so(t)?Ia(e,t,c.context,n,o,!1,i):t&&t[zi]?(0,Sa[t.type])(e,t.payload,i,u):i(t)}));d.cancel=So;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),Ea()):Po(e)?(l.status=1,d.cancel(),o=io(t.return)?t.return(Qi):{done:!0,value:Qi}):o=Io(e)?io(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=pa();function l(n,o){a||(a=!0,i.cancel=So,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){Aa=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=So,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=So,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function Pa(e,t){for(var n=e.channel,i=void 0===n?ua():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?Eo: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=pa();if(l&&(l.rootSagaStarted=l.rootSagaStarted||So,l.effectTriggered=l.effectTriggered||So,l.effectResolved=l.effectResolved||So,l.effectRejected=l.effectRejected||So,l.effectCancelled=l.effectCancelled||So,l.actionDispatched=l.actionDispatched||So,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=vo;var m={channel:i,dispatch:Oo(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:g};return Xo((function(){var e=Ia(m,S,s,v,wo(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var _a=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?ua():a,s=n.sagaMonitor,l=eo(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Pa.bind(null,R({},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){ho(o,e)},c},La=function(e){return{done:!0,value:e}},wa={};function Ua(e){return co(e)?"channel":uo(e)?String(e):io(e)?e.name:String(e)}function Ca(e,t,n){var i,o,a,r=t;function s(t,n){if(r===wa)return La(t);if(n&&!o)throw r=wa,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===wa?La(t):a}return To(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:Go(e)},s=function(e){return{done:!1,value:Bo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Ca({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+Ua(e)+", "+t.name+")")}function Ra(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,s={done:!1,value:Go(e)},l=function(e){return{done:!1,value:Bo.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:Wo(e)}},u=function(e){return a=e},d=function(e){return r=e};return Ca({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("+Ua(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={done:!1,value:Go(e)},s=function(e){return{done:!1,value:jo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Ca({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+Ua(e)+", "+t.name+")")}function Ma(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:jo.apply(void 0,[n].concat(a))},l={done:!1,value:Ko(t)};return Ca({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:wa}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function Fa(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 Bo.apply(void 0,[Da,e,t].concat(i))}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 Bo.apply(void 0,[Ra,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 Bo.apply(void 0,[Na,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 xa={getContext:()=>Va.getContext(),getAccessToken:()=>Va.getAccessToken(),getUser:()=>Va.getUser(),onRedirectTo:(e,t)=>Va.onRedirectTo(e,t),logout:e=>Va.logout(e)};class ja extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Ba={v1:"/identity/resources/users/webauthn/v1/devices"},Wa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},za={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"}},Ka={v1:"/identity/resources/configurations/v1"},Ha={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},qa={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ja={v1:"/identity/resources/permissions/v1"},Ya={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"},Xa={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Za={v1:"/identity/resources/impersonation/v1"},er={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},tr={v1:"/identity/resources/users/phone-numbers/v1"},nr={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},ir={v1:"/team/resources/members/v1"},or={v1:"/team/resources/roles/v1"},ar={v1:"/team/resources/stats/v1"},rr={v1:"/team/resources/profile"},sr={v1:"/tenants/resources/account-settings/v1"},lr={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"}},cr={v1:"/tenants/resources/sub-tenants/v1"},ur={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},dr={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"}}}},yr={v1:"/subscriptions/resources/payment-providers/v1"},fr={v1:"/subscriptions/resources/subscriptions/v1"},pr={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},gr={v1:"/reports/engine/resources/triggers/v1"},Sr="/notification",vr="/audits",hr={v1:"/event/resources/configurations/v1"},mr="/webhook",Ar="/oauth",br="/flags",Tr="/directory/resources/v1/configurations/scim2",Er="/directory/resources/scim/temp",kr="/entitlements/api/v1/user-entitlements",Or="/entitlements/api/v2/user-entitlements",Ir={v1:"/security-center/resources/recommendations/v1"},Pr={v1:"/security-center/resources/insights/v1"};function _r(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 Lr(e){var t,n;const i={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(i[li.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(i[li.frameWork]=e.metadataHeaders.framework),i}const wr=async e=>{var t,n,i;const o=Va.getContext(),a=await async function(e,t){var n;const i=Lr(e),o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Va.getAccessToken)(),a=Va.getRequestSource();t&&(i[li.contentType]=t),a&&(i[li.source]=a),o&&(i.Authorization=`Bearer ${o}`);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))i[`${t.key}`]=`${t.value}`;return i}(o,e.contentType),r=await async function(e,t,n){const i=_r(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:R({},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 ja("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 ja(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{}}},Ur=async(e,t,n)=>wr(R({url:e,method:"GET",contentType:"application/json",params:t},n)),Cr=async(e,t,n)=>wr(R({url:e,method:"POST",contentType:"application/json",body:t},n)),Dr=async(e,t,n)=>wr(R({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Rr=async(e,t,n)=>wr(R({url:e,method:"PUT",contentType:"application/json",body:t},n)),Nr=async(e,t,n)=>wr(R({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Mr=async(e,t,n,i)=>wr(R({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),Fr=(e={})=>R({},e.jwt?{Authorization:e.jwt}:{}),Gr="FRONTEGG_SEPARATE_TABS_BY_TENANT",$r="admin_portal_use_entitlements_v2_endpoint",Vr={flags:{}};class xr{constructor(){var e;this._flags={},this._flags=null!=(e=Vr.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new xr;return n.set(e),xr._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=R({},null!=(t=null==Vr?void 0:Vr.flags)?t:{},null!=e?e:{})}}async function jr(){return Ur(br)}async function Br(e){return Cr(`${za.v3}/me/token`,e)}async function Wr(e,t){return Ur(za.v2,e,{headers:Fr(t)})}async function zr(e,t){return Ur(za.v3,e,{headers:Fr(t)})}async function Kr(e,t){return Ur(za.roles.v3,R({},e,{ids:e.ids.join(",")}),{headers:Fr(t)})}async function Hr(e,t){return Ur(za.groups.v3,R({},e,{ids:e.ids.join(",")}),{headers:Fr(t)})}async function qr(e){return Ur(za.tenants.me.v3,void 0,{headers:Fr(e)})}async function Jr(e){return Ur(za.tenants.me.v1,void 0,{headers:Fr(e)})}async function Yr(){return Cr(za.passwords.resetBreachedPasswords.v1)}async function Qr(e){return Rr(`${za.v2}/me`,e)}function Xr(e){e&&sessionStorage.setItem(Gr,e)}function Zr(){return Va.isSessionPerTenantEnabled()?sessionStorage.getItem(Gr):null}function es(){const[e]=xr.getFeatureFlags(["admin_portal_use_current_user_tenants_v1_endpoint"],Va.getAppName()||"");return Va.isSessionPerTenantEnabled()||e?Jr:qr}async function ts(e){return Va.isSessionPerTenantEnabled()&&Xr(e.tenantId),Rr(`${za.v1}/tenant`,e)}async function ns(){return Ur(`${za.v2}/me/tenants`)}async function is(e){return Ur(lr.v1,void 0,{headers:Fr(e)})}async function os(e){return Ur(lr.tree.v1,void 0,{headers:Fr(e)})}async function as(e){return Ur(lr.parents.v1,void 0,{headers:Fr(e)})}async function rs(e,t){return Ur(`${lr.parents.v1}/${e}`,void 0,{headers:Fr(t)})}async function ss(e,t){return Cr(`${Ya.users.v1}/count`,e,{headers:Fr(t)})}async function ls(e,t){return Ur(lr.v2,e,{headers:Fr(t)})}async function cs(e,t){return Ur(lr.metadata.v2,R({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Fr(t)})}async function us(){return Ur(Ka.v1)}async function ds(){return Ur(`${Ka.v1}/mfa-policy`)}async function ys(){return Ur(`${Ka.v1}/mfa-policy/vendor`)}async function fs(e){return e.id?Dr(`${Ka.v1}/mfa-policy`,e):Cr(`${Ka.v1}/mfa-policy`,e)}async function ps(){return Ur(`${Ka.v1}/lockout-policy`)}async function gs(){return Ur(`${Ka.v1}/lockout-policy/vendor`)}async function Ss(e){return e.id?Dr(`${Ka.v1}/lockout-policy`,e):Cr(`${Ka.v1}/lockout-policy`,e)}async function vs(){try{return await Ur(`${Ka.v1}/captcha-policy/public`)}catch{return null}}async function hs(){return Ur(`${Ka.v1}/password-history-policy`)}async function ms(){return Ur(`${Ka.v1}/password-history-policy/vendor`)}async function As(e){return e.id?Dr(`${Ka.v1}/password-history-policy`,e):Cr(`${Ka.v1}/password-history-policy`,e)}async function bs(){return Ur(`${Ka.v1}/password`)}async function Ts(){return Ur(`${Ha.emailDomain.v1}`)}async function Es(){return Ur(`${Ha.emailDomain.v1}/config`)}async function ks(e){return Cr(`${Ha.emailDomain.v1}`,e)}async function Os(e){return Cr(`${Ha.emailDomain.v1}/config`,e)}async function Is(e){return Nr(`${Ha.emailDomain.v1}/${e}`)}async function Ps(e){return Ur(`${Ha.ip.v1}`,e)}async function _s(){return Ur(`${Ha.ip.v1}/config`)}async function Ls(e){return Cr(`${Ha.ip.v1}`,e)}async function ws(e){return Cr(`${Ha.ip.v1}/bulk`,e)}async function Us(e){return Cr(`${Ha.ip.v1}/config`,e)}async function Cs(e){return Nr(`${Ha.ip.v1}/${e}`)}async function Ds(){return Cr(`${Ha.ip.v1}/verify`)}async function Rs(){return Cr(`${Ha.ip.v1}/verify/allow`)}xr._instances={};class Ns extends Error{constructor(e){super(e)}}const Ms="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Ns("'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 Fs extends Error{constructor(e){super(e)}}const Gs=(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(Ms(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 Ms(t)}})(e.split(".")[n]))}catch(e){throw new Fs("Invalid token specified: "+e.message)}};let $s,Vs,xs;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}($s||($s={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Vs||(Vs={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(xs||(xs={}));const js="admin_portal_should_load_authorization";async function Bs(){return Ur(kr)}async function Ws(){return Ur(Or)}let zs;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(zs||(zs={}));const Ks="admin_portal_entitlements",Hs=["type"],qs=["type"],Js=["type"];async function Ys(e){if(!e.accessToken)return e;Va.setAccessToken(e.accessToken);const t=await Fu(),n=R({},e,e.accessToken?Gs(e.accessToken):{},t);return Va.setUser(n),n}async function Qs(e){if(!e.accessToken)return{user:e};Va.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Fu(),ns()]),i=R({},e,e.accessToken?Gs(e.accessToken):{},t);return Va.setUser(i),{user:i,tenants:n}}function Xs(){if(!Va.shouldLoadEntitlements())return!1;const[e]=xr.getFeatureFlags([Ks],Va.getAppName()||"");return e}function Zs(){const[e]=xr.getFeatureFlags([js],Va.getAppName()||"");return e}async function el(e){const{accessToken:t}=e;if(!t)return{user:e};Va.setAccessToken(t);const[n,i]=await Promise.all([Fu(),es()()]),o=R({},e,t?Gs(t):{},n);return Va.isSessionPerTenantEnabled()&&Xr(o.tenantId),Va.setUser(o),{user:o,tenants:i.tenants,activeTenant:i.activeTenant}}async function tl(e){Va.setAccessToken(e.id_token);const t=await Fu(),n=e.id_token?Gs(e.id_token):{},i=R({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Va.setUser(i),i}async function nl(e){Va.setAccessToken(e.id_token);const[t,n]=await Promise.all([Fu(),es()()]),i=e.id_token?Gs(e.id_token):{},o=R({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},i,t,{expiresIn:e.expires_in||300});return Va.isSessionPerTenantEnabled()&&Xr(o.tenantId),Va.setUser(o),{user:o,tenants:n.tenants,activeTenant:n.activeTenant}}async function il(e){try{const{address:t}=await Cr(`${Wa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function ol(e){return Cr(`${Wa.v1}/user/saml/prelogin`,e)}async function al(e){return Ys(await Cr(`${Wa.v1}/user/saml/postlogin`,e))}async function rl(e){return Ys(await Cr(`${Wa.v1}/user/oidc/postlogin`,e))}async function sl(e){return Ys(await Cr(`${Wa.v1}/user`,e))}async function ll(e){return el(await Cr(`${Wa.v1}/user`,e))}async function cl(e){return Ys(await Cr(`${Wa.v1}/user/mfa/verify`,e))}async function ul(e){return el(await Cr(`${Wa.v1}/user/mfa/verify`,e))}async function dl(e){return Cr(`${za.v1}/activate`,e)}async function yl(e){return el(await Cr(`${za.v1}/activate`,e))}async function fl(e){return Ur(`${za.v1}/activate/strategy`,e)}async function pl(e){return Cr(`${za.v1}/activate/reset`,e)}async function gl(e){return Cr(`${za.v1}/invitation/reset`,e)}async function Sl(e){return Cr(`${za.v1}/invitation/accept`,e)}async function vl(){const e=Zr();return Ys(await Cr(`${Wa.v1}/user/token/refresh`,{tenantId:e}))}async function hl(){const e=Zr();return Qs(await Cr(`${Wa.v1}/user/token/refresh`,{tenantId:e}))}async function ml(){const e=Zr();return el(await Cr(`${Wa.v1}/user/token/refresh`,{tenantId:e}))}async function Al(){return Cr(`${Wa.v1}/logout`)}async function bl(e){return Ur(`${Ar}/logout`,e)}async function Tl(e){return Cr(`${za.v1}/passwords/reset`,e)}async function El(e){return Cr(`${za.v1}/passwords/reset/verify`,e)}async function kl(e){return Ur(`${za.v1}/passwords/config`,e)}async function Ol(e){return Cr(`${Wa.v1}/user/mfa/recover`,e)}async function Il(){return Cr(`${za.v1}/mfa/enroll`)}async function Pl(){return Cr(`${za.v1}/mfa/authenticator/enroll`)}async function _l(e){return Cr(`${za.v1}/mfa/authenticator/enroll/verify`,e)}async function Ll(e){return Cr(`${za.v1}/mfa/sms/enroll`,e)}async function wl(e){return Cr(`${za.v1}/mfa/sms/enroll/verify`,e)}async function Ul(){return Cr(`${za.v1}/mfa/webauthn/enroll`)}async function Cl(e){return Cr(`${za.v1}/mfa/webauthn/enroll/verify`,e)}async function Dl(e){return Cr(`${za.v1}/mfa/enroll/verify`,e)}async function Rl(e){return Cr(`${za.v1}/mfa/disable`,e)}async function Nl(e,t){return Cr(`${za.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Ml(e){return Cr(`${za.v1}/mfa/sms/${e}/disable`)}async function Fl(e,t){return Cr(`${za.v1}/mfa/sms/${e}/disable/verify`,t)}async function Gl(e){return Cr(`${za.v1}/mfa/webauthn/${e}/disable`)}async function $l(e,t){return Cr(`${za.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Vl(){return Ur(`${za.v1}/mfa/devices`)}async function xl(e){return Cr(`${Wa.v1}/user/mfa/authenticator/enroll`,e)}async function jl(e){return Cr(`${Wa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Bl(e){return el(await Cr(`${Wa.v1}/user/mfa/authenticator/enroll/verify`,e))}async function Wl(e,t){return Cr(`${Wa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function zl(e){return Cr(`${Wa.v1}/user/mfa/emailcode`,e)}async function Kl(e){return Cr(`${Wa.v1}/user/mfa/emailcode/verify`,e)}async function Hl(e){return el(await Cr(`${Wa.v1}/user/mfa/emailcode/verify`,e))}async function ql(e){return Cr(`${Wa.v1}/user/mfa/sms/enroll`,e)}async function Jl(e){return Cr(`${Wa.v1}/user/mfa/sms/enroll/verify`,e)}async function Yl(e){return el(await Cr(`${Wa.v1}/user/mfa/sms/enroll/verify`,e))}async function Ql(e,t){return Cr(`${Wa.v1}/user/mfa/sms/${e}`,t)}async function Xl(e,t){return Cr(`${Wa.v1}/user/mfa/sms/${e}/verify`,t)}async function Zl(e,t){return el(await Cr(`${Wa.v1}/user/mfa/sms/${e}/verify`,t))}async function ec(e){return Cr(`${Wa.v1}/user/mfa/webauthn/enroll`,e)}async function tc(e){return Cr(`${Wa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function nc(e){return el(await Cr(`${Wa.v1}/user/mfa/webauthn/enroll/verify`,e))}async function ic(e,t){return Cr(`${Wa.v1}/user/mfa/webauthn/${e}`,t)}async function oc(e,t){return Cr(`${Wa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function ac(e,t){return el(await Cr(`${Wa.v1}/user/mfa/webauthn/${e}/verify`,t))}async function rc(){return Ur(`${nr.v1}/saml/configurations`)}async function sc(e){return Cr(`${nr.v1}/saml/configurations`,e)}async function lc(){return Ur(`${nr.v1}/saml/configurations/vendor-config`)}async function cc(e){return Rr(`${nr.v1}/saml/configurations/metadata`,e)}async function uc(){return Rr(`${nr.v1}/saml/validations/domain`)}async function dc(){return Ur(`${nr.v1}/saml/configurations/roles/default`)}async function yc(){return Ur(`${nr.v2}/saml/configurations/groups`)}async function fc({roleIds:e}){return Cr(`${nr.v1}/saml/configurations/roles/default`,{roleIds:e})}async function pc({roleIds:e,group:t}){return Cr(`${nr.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function gc({roleIds:e,group:t,id:n}){return Dr(`${nr.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Sc({id:e}){return Nr(`${nr.v2}/saml/configurations/groups/${e}`)}async function vc(){return Ur(`${nr.v1}/oidc/configurations`)}async function hc(){return Ur(`${nr.v2}/configurations/public`)}async function mc(){return Ur(qa.v1)}async function Ac(){return Ur(qa.v2)}async function bc(){return Ur(`${qa.v2}/authenticated`)}async function Tc(){return Ur(qa.custom.v1)}async function Ec({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),Cr(`${Wa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function kc(){return Ur(`${Ka.v1}/public`)}async function Oc(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Cr(`${za.v1}/signUp`,e),a={shouldActivate:t,userId:i,tenantId:o};if(!t&&n){const{user:e,tenants:t,activeTenant:i}=await el(n);return R({},a,{user:e,tenants:t,activeTenant:i})}return a}async function Ic(){return Ur(za.sessions.currentUser.v1)}async function Pc(){return Ur(`${za.sessions.currentUser.v1}/current`)}async function _c(e){return Cr(`${za.sessions.v1}/revoke`,{userId:e})}async function Lc(){return Ur(za.sessions.configurations.v1)}async function wc(e){await Cr(za.sessions.configurations.v1,e)}async function Uc(e){await Nr(`${za.sessions.currentUser.v1}/${e}`)}async function Cc(){await Nr(`${za.sessions.currentUser.v1}/all`)}async function Dc(){return Ur(za.accessTokens.v1)}async function Rc(){return Ur(Ya.accessTokens.v1)}async function Nc({id:e}){return Nr(`${Ya.accessTokens.v1}/${e}`)}async function Mc({id:e}){return Nr(`${za.accessTokens.v1}/${e}`)}async function Fc(e){return Cr(za.accessTokens.v1,e)}async function Gc(e){return Cr(Ya.accessTokens.v1,e)}async function $c(){return Ur(za.apiTokens.v1)}async function Vc(){return Ur(Ya.apiTokens.v1)}async function xc(e){return Cr(za.apiTokens.v1,e)}async function jc(e){return Cr(Ya.apiTokens.v2,e)}async function Bc({tokenId:e}){return Nr(`${Ya.apiTokens.v1}/${e}`)}async function Wc({tokenId:e}){return Nr(`${za.apiTokens.v1}/${e}`)}async function zc({userId:e}){return Ur(`${za.v1}/${e}`)}async function Kc(e){return Ur(`${Ka.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Hc(e){let{type:t}=e,n=eo(e,Hs);return Cr(`${Wa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function qc(e){let{type:t}=e,n=eo(e,qs);return el(await Cr(`${Wa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function Jc(e){let{type:t}=e,n=eo(e,Js);return Cr(`${Wa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Yc({token:e}){return Cr(Ya.invites.verify.v1,{token:e})}async function Qc(){return Ur(`${nr.v1}/configurations`)}async function Xc(e){return Cr(`${nr.v1}/configurations`,e)}async function Zc(e,t){return Dr(`${nr.v1}/configurations/${e}`,t)}async function eu(e){return Nr(`${nr.v1}/configurations/${e}`)}async function tu(e){return Cr(`${nr.v1}/configurations/metadata`,e)}async function nu(e,t){return Rr(`${nr.v1}/configurations/${e}/metadata`,t)}async function iu(e){return Cr(`${nr.v1}/configurations/metadata-url`,e)}async function ou(e,t){return Rr(`${nr.v1}/configurations/${e}/metadata-url`,t)}async function au(e,t){return Cr(`${nr.v1}/configurations/${e}/domains`,t)}async function ru(e,t){return Nr(`${nr.v1}/configurations/${e}/domains/${t}`)}async function su(e,t){return Rr(`${nr.v1}/configurations/${e}/domains/${t}/validate`)}async function lu(e){return Ur(`${nr.v1}/configurations/${e}/roles`)}async function cu(e,t){return Rr(`${nr.v1}/configurations/${e}/roles`,t)}async function uu(e,t){return Cr(`${nr.v1}/configurations/${e}/groups`,t)}async function du(e,{roleIds:t,group:n,id:i}){return Dr(`${nr.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function yu(e,t){return Nr(`${nr.v1}/configurations/${e}/groups/${t}`)}async function fu(e){return Ur(`${nr.v1}/configurations/${e}/groups`)}async function pu(e){return Cr(`${Wa.v2}/user/sso/prelogin`,e)}async function gu(e){return Ys(await Cr(`${Wa.v2}/user/oidc/postlogin`,e))}async function Su(e){return nl(await Cr(`${Ar}/token`,e))}async function vu(){const e=Zr();return nl(await Cr(`${Ar}/authorize/silent`,{tenantId:e}))}async function hu(e){return tl(await Cr(`${Ar}/token`,e))}async function mu(){const e=Zr();return tl(await Cr(`${Ar}/authorize/silent`,{tenantId:e}))}async function Au(e){return Cr(`${za.v1}/phone/reset`,e)}async function bu(e){return Cr(`${za.v1}/phone/reset/verify`,e)}async function Tu(e){return Cr(`${za.v1}/phone`,e)}async function Eu(e){return Cr(`${za.v1}/phone/verify`,e)}async function ku(e){return Rr(`${za.v1}/phone/change`,e)}async function Ou(e){return Cr(`${Wa.v1}/webauthn/prelogin`,e)}async function Iu(e){return Cr(`${Wa.v1}/webauthn/postlogin`,e)}async function Pu(e){return el(await Cr(`${Wa.v1}/webauthn/postlogin`,e))}async function _u(){return Cr(Ba.v1)}async function Lu(){return Ur(Ba.v1)}async function wu(e){return Nr(`${Ba.v1}/${e}`)}async function Uu(e){return Cr(`${Ba.v1}/verify`,e)}async function Cu(){return Ur(`${Ka.v1}/auth/strategies/public`)}async function Du(){return Ur(`${Ka.v1}/auth/strategies`)}async function Ru(){return Ur(`${Ka.v1}/mfa/strategies`)}async function Nu(){return Ur(`${za.authorization.v1}`)}async function Mu(){return Ur(`${za.v2}/me`)}async function Fu(){const[e]=xr.getFeatureFlags([$r],Va.getAppName()||""),t=[{action:Mu,shouldLoad:!0},{action:e?Ws:Bs,shouldLoad:Xs()},{action:Nu,shouldLoad:Zs()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[n,i,o]=await Promise.all(t),a=Zr();return a&&(n.tenantId=a),R({},n,null!=o?o:{},{entitlements:i})}async function Gu(e){const t=await Cr(`${Wa.v1}/user/step-up/generate`,e);return t.accessToken?el(t):t}async function $u(e){return Ur(`${za.v2}/me`,null!=e?e:{addRoles:!0})}async function Vu(e){return Rr(`${za.v2}/me`,e)}async function xu(e){return Rr(`${rr.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function ju(e){return Cr(`${za.v1}/passwords/change`,e)}async function Bu(e){var t,n,i,o,a,r;const s=(e.filter||[]).reduce(((e,t)=>R({},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 Ur(ir.v1,R({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function Wu(e){return Cr(za.v2,R({},e,{provider:"local"}))}async function zu(e){return Nr(`${ir.v1}/${e.userId}`)}async function Ku(e){return Rr(ir.v1,e)}async function Hu(e){return Cr(Ya.invites.user.v1,R({},e))}async function qu(e){return Dr(Ya.invites.user.v1,R({},e))}async function Ju(){return Nr(Ya.invites.user.v1)}async function Yu(){return Ur(Ya.invites.user.v1)}async function Qu(){return Ur(Ya.invites.configuration.v1)}async function Xu(){return Ur(or.v1)}async function Zu(){return Ur(Ja.v1)}async function ed(){return Ur(`${ar.v1}/members`)}async function td(e){return Cr(`${ir.v1}/${e.userId}/resendActivationEmail`,{})}async function nd(e){return Cr(za.v2,R({},e,{provider:"local"}))}async function id(e){return Cr(za.invitation.resendAll.v1,R({},e))}async function od(e){var t,n;const i=await Ur("/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 ad(){return Ur("/metadata/admin-box")}async function rd(e){return Cr("/metadata/admin-box",e)}async function sd(){const e=await Ur("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const ld=async()=>od({entityName:"notifications"}),cd=async()=>od({entityName:"saml"}),ud=async()=>od({entityName:"audits"}),dd=async e=>async function(e){const t=await Ur(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),yd=["dataFilters"],fd=["templateId","dataFilters"],pd=["dataFilters"];async function gd(e){return Ur(`${pr.v2}/tenant-reports`,e)}async function Sd(e){return Ur(`${pr.v2}/${e.id}/tenant-reports`)}async function vd(e){let{dataFilters:t}=e,n=eo(e,yd);return{html:await Ur(`${gr.v1}/preview-report`,R({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function hd(e){let{templateId:t,dataFilters:n}=e,i=eo(e,fd);return Cr(`${pr.v2}/${t}/tenant-reports`,R({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function md(e){let{dataFilters:t}=e,n=eo(e,pd);const i=await Ur(`${gr.v1}/preview-report`,R({},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 Ad(e){return Cr(`${gr.v1}/tenant-reports`,e)}async function bd(e){return Ur(Sr,{params:e})}async function Td(e){return Rr(`${Sr}/status`,{params:e})}async function Ed(e){const{notificationId:t,pinStatus:n}=e;return Rr(`${Sr}/${n}`,{notificationId:t})}async function kd(){return Cr(`${Sr}/status/mark-all-read`)}const Od=["endpoint","headerProps"];async function Id(e){return Ur(vr,e)}async function Pd(e){return Ur(`${vr}/stats`,e)}async function _d(e){const{endpoint:t,headerProps:n}=e,i=eo(e,Od);return Mr(`${vr}/export/${t}`,{properties:n},i)}const Ld=["eventKey"],wd=["eventKey"],Ud=()=>Ur(`${ur.v1}/slack`),Cd=()=>Ur(`${ur.v1}/slack/applications`),Dd=()=>Ur(`${ur.v1}/slack/channels`),Rd=e=>e.id?Dr(`${ur.v1}/slack/subscription/${e.id}`,e):Cr(`${ur.v1}/slack/subscriptions`,e),Nd=e=>Nr(`${ur.v1}/slack/subscriptions/${e.id}`),Md=e=>Cr(`${ur.v1}/slack/applications/registrations`,{code:e}),Fd=()=>Ur(`${ur.v1}/emails`),Gd=e=>{let{eventKey:t}=e,n=eo(e,Ld);return Cr(`${ur.v1}/emails/${t}`,n)},$d=({eventKey:e,enabled:t})=>Dr(`${ur.v1}/emails/${e}`,{enabled:t}),Vd=(e,t)=>Nr(`${ur.v1}/emails/${e}/subscriptions/${t}`),xd=(e,t,n)=>Rr(`${ur.v1}/emails/${t}/subscriptions/${e}`,n),jd=e=>Nr(`${ur.v1}/emails/${e}`),Bd=()=>Ur(`${ur.v2}/sms`),Wd=e=>{let{eventKey:t}=e,n=eo(e,wd);return Cr(`${ur.v2}/sms/${t}`,n)},zd=({eventKey:e,enabled:t})=>Dr(`${ur.v2}/sms/${e}`,{enabled:t}),Kd=(e,t)=>Nr(`${ur.v2}/sms/${e}/subscriptions/${t}`),Hd=(e,t,n)=>Rr(`${ur.v2}/sms/${t}/subscriptions/${e}`,n),qd=e=>Nr(`${ur.v2}/sms/${e}`),Jd=()=>Ur(mr),Yd=e=>e._id?Dr(`${mr}/${e._id}`,e):Cr(`${mr}/custom`,e),Qd=e=>Nr(`${mr}/${e}`),Xd=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Ur(`${mr}/logs/?${i.toString()}`)},Zd=e=>Cr(`${mr}/test`,e),ey=e=>Cr(`${mr}/logs/${e}/retries`),ty=()=>Ur(`${hr.v1}/categories`),ny=e=>Ur(hr.v1,{channels:e});async function iy(e,t){return Rr(sr.v1,e,{headers:Fr(t)})}async function oy(e){return Ur(sr.v1,void 0,{headers:Fr(e)})}async function ay(){return Ur(`${sr.v1}/public`)}const ry=["roleId"],sy=["roleId"],ly=["permissionId"];async function cy(){return Ur(Qa.v1)}async function uy(e){return Cr(Qa.v1,e)}async function dy({roleId:e}){return Nr(`${Qa.v1}/${e}`)}async function yy(e){let{roleId:t}=e,n=eo(e,ry);return Dr(`${Qa.v1}/${t}`,n)}async function fy(e){let{roleId:t}=e,n=eo(e,sy);return Rr(`${Qa.v1}/${t}/permissions`,n)}async function py(){return Ur(Ja.v1)}async function gy(e){let{permissionId:t}=e,n=eo(e,ly);return Rr(`${Ja.v1}/${t}/roles`,n)}async function Sy(){return Ur(`${Ja.v1}/categories`)}async function vy(){return Ur(dr.subscriptions.v1)}async function hy(e){return Ur(`${dr.subscriptions.v1}/${e}`)}async function my(e){return Rr(`${dr.subscriptions.v1}/${e}/cancellations/`,{})}async function Ay(e){return Rr(`${dr.subscriptions.v1}/${e}/renewals/`,{})}async function by(e,{paymentMethodId:t,planId:n}){return Rr(`${dr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Ty(e){return Ur(`${fr.v1}/${e}`)}async function Ey(){return Ur(`${fr.v1}`)}async function ky(e){return Rr(`${fr.v1}/${e}/cancellations/`,{})}async function Oy(e){return Rr(`${fr.v1}/${e}/renewals/`,{})}async function Iy(e,{paymentMethodId:t,planId:n}){return Rr(`${fr.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Py(){return Ur(dr.plans.v1)}async function _y(e){return Ur(`${dr.plans.v1}/${e}`)}async function Ly(){return Ur(dr.invoices.v1)}async function wy(e){return Ur(`${dr.invoices.v1}/${e}`)}async function Uy(e,t){return Ur(`${dr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Cy=["email"];async function Dy(){return Ur(dr.paymentMethods.v1)}async function Ry(e){return Ur(`${dr.paymentMethods.v1}/${e}`)}async function Ny(e,t){let{email:n}=t,i=eo(t,Cy);return Dr(`${dr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function My(e){return Cr(dr.paymentProviders.stripe.subscriptions.v1,e)}async function Fy(e){return Ur(`${dr.paymentProviders.stripe.customers.v1}/${e}`)}async function Gy(e){return Cr(`${dr.paymentProviders.stripe.customers.v1}`,e)}async function $y(){return Ur(`${dr.paymentProviders.stripe.publicConfigurations.v1}`)}async function Vy(e){return Cr(`${dr.paymentProviders.stripe.setupIntents.v1}`,e)}async function xy(e){return Ur(`${dr.summaries.v1}/${e}`)}async function jy(e){return Ur(`${dr.tenantConfiguration.v1}/${e}`)}async function By(e){return Cr(`${dr.tenantConfiguration.v1}`,e)}async function Wy(){return Ur(yr.v1)}async function zy(){return Ur(`${dr.configurations.vendorPublicConfigurations.v1}`)}let Ky,Hy,qy,Jy,Yy,Qy;async function Xy(){return Ur("/vendors/public")}async function Zy(e){return Ur(Xa.v1,e)}async function ef(e){return Cr(Xa.v1,e)}async function tf(e,t){return Nr(Xa.v1,e,{headers:Fr(t)})}async function nf(e,t,n){return Cr(`${Xa.v1}/${e}/roles`,t,{headers:Fr(n)})}async function of(e,t,n){return Nr(`${Xa.v1}/${e}/roles`,t,{headers:Fr(n)})}async function af(e,t,n){return Dr(`${Xa.v1}/${e}/roles`,t,{headers:Fr(n)})}async function rf(e,t){return Cr(cr.v1,e,{headers:Fr(t)})}async function sf(e,t){return Nr(`${cr.v1}/${e}`,void 0,{headers:Fr(t)})}async function lf({tenantId:e},t,n){return Dr(`${cr.v1}/${e}`,t,{headers:Fr(n)})}async function cf(e,t,n){return Rr(`${Xa.v1}/${e}/access`,t,{headers:Fr(n)})}async function uf(e,t){return Cr(`${Xa.v2}/`,e,{headers:Fr(t)})}async function df(){return Ur(`${Tr}`)}async function yf(e,t){return Dr(`${Tr}/${e}`,t)}async function ff(e){return Cr(`${Tr}`,e)}async function pf(e){return Nr(`${Tr}/${e}`)}async function gf(e){return Ur(`${Er}/${e}/Users/count`)}async function Sf(e){return Cr(`${Za.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Ky||(Ky={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Hy||(Hy={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(qy||(qy={})),(Jy||(Jy={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Yy||(Yy={})),function(e){e.CREATE="create_customer"}(Qy||(Qy={}));const vf=["groupId"];async function hf({groupId:e},t){return Ur(`${er.v1}/${e}`,R({},t))}async function mf(e){return Ur(`${er.v1}`,R({},e))}async function Af(e,t){return Cr(`${er.getByIds.v1}`,e,{params:t})}async function bf(e){return Cr(`${er.v1}`,e)}async function Tf(e){let{groupId:t}=e,n=eo(e,vf);return Dr(`${er.v1}/${t}`,n)}async function Ef(e){return Nr(`${er.v1}/${e}`)}async function kf(e,t){return Cr(`${er.v1}/${e}/roles`,t)}async function Of(e,t){return Nr(`${er.v1}/${e}/roles`,t)}async function If(e,t){return Cr(`${er.v1}/${e}/users`,t)}async function Pf(e,t){return Nr(`${er.v1}/${e}/users`,t)}async function _f(){return Ur(`${er.configurations.v1}`)}async function Lf(e){return Cr(`${er.configurations.v1}`,e)}async function wf(){return Ur(Ir.v1)}async function Uf(){return Ur(Pr.v1)}async function Cf(e){return Ur(`${tr.v1}`,e)}async function Df(e){return Cr(`${tr.v1}`,e)}async function Rf(e){return Nr(`${tr.v1}/${e}`)}async function Nf(e){return Cr(`${tr.v1}/preverify`,e)}async function Mf(e){return Cr(`${tr.v1}/verify`,e)}async function Ff(e,t){return Cr(`${tr.v1}/${e}/delete/verify`,t)}let Gf,$f,Vf;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Gf||(Gf={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}($f||($f={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Vf||(Vf={}));const xf=[/^(.*)\/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],jf=`${Wa.v1}/user/token/refresh`,Bf=`${Ar}/authorize/silent`,Wf=`${za.v2}/me`,zf=`${za.v2}/me/tenants`,Kf=`${za.v3}/me/tenants`;let Hf,qf,Jf,Yf,Qf,Xf,Zf,ep;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Hf||(Hf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(qf||(qf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Jf||(Jf={})),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"}(Yf||(Yf={})),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"}(Qf||(Qf={})),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"}(Xf||(Xf={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(Zf||(Zf={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(ep||(ep={}));const tp={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 np={fetch:e,ContextHolder:Va,FronteggContext:xa,api:tp,FronteggApiError:ja,AuthStrategyEnum:ki,MachineToMachineAuthStrategy:Oi,SocialLoginProviders:Ei,ISubscriptionCancellationPolicy:qy,ISubscriptionStatus:Ky,PaymentMethodType:Hy,ProviderType:Jy};let ip,op;!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"}(ip||(ip={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(op||(op={}));const ap="input is invalid type",rp="undefined"!=typeof ArrayBuffer,sp="0123456789abcdef".split(""),lp=[-2147483648,8388608,32768,128],cp=[24,16,8,0],up=[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],dp=["hex","array","digest","arrayBuffer"],yp=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),rp&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const fp=function(e){return function(t){const n=new gp(!0).update(t);return null==n?void 0:n[e]()}},pp=function(e){return function(t,n){const i=new Sp(t,!0).update(n);return null==i?void 0:i[e]()}};class gp{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=()=>gp.prototype.digest(),e?(yp[0]=yp[16]=yp[1]=yp[2]=yp[3]=yp[4]=yp[5]=yp[6]=yp[7]=yp[8]=yp[9]=yp[10]=yp[11]=yp[12]=yp[13]=yp[14]=yp[15]=0,this.blocks=yp):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(ap);if(null===e)throw new Error(ap);if(rp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||rp&&ArrayBuffer.isView(e)))throw new Error(ap);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]<<cp[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<cp[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<cp[3&o++],s[o>>2]|=(128|63&i)<<cp[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<cp[3&o++],s[o>>2]|=(128|i>>6&63)<<cp[3&o++],s[o>>2]|=(128|63&i)<<cp[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<cp[3&o++],s[o>>2]|=(128|i>>12&63)<<cp[3&o++],s[o>>2]|=(128|i>>6&63)<<cp[3&o++],s[o>>2]|=(128|63&i)<<cp[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]|=lp[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+up[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+up[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+up[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+up[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=sp[e>>28&15]+sp[e>>24&15]+sp[e>>20&15]+sp[e>>16&15]+sp[e>>12&15]+sp[e>>8&15]+sp[e>>4&15]+sp[15&e]+sp[t>>28&15]+sp[t>>24&15]+sp[t>>20&15]+sp[t>>16&15]+sp[t>>12&15]+sp[t>>8&15]+sp[t>>4&15]+sp[15&t]+sp[n>>28&15]+sp[n>>24&15]+sp[n>>20&15]+sp[n>>16&15]+sp[n>>12&15]+sp[n>>8&15]+sp[n>>4&15]+sp[15&n]+sp[i>>28&15]+sp[i>>24&15]+sp[i>>20&15]+sp[i>>16&15]+sp[i>>12&15]+sp[i>>8&15]+sp[i>>4&15]+sp[15&i]+sp[o>>28&15]+sp[o>>24&15]+sp[o>>20&15]+sp[o>>16&15]+sp[o>>12&15]+sp[o>>8&15]+sp[o>>4&15]+sp[15&o]+sp[a>>28&15]+sp[a>>24&15]+sp[a>>20&15]+sp[a>>16&15]+sp[a>>12&15]+sp[a>>8&15]+sp[a>>4&15]+sp[15&a]+sp[r>>28&15]+sp[r>>24&15]+sp[r>>20&15]+sp[r>>16&15]+sp[r>>12&15]+sp[r>>8&15]+sp[r>>4&15]+sp[15&r];return l+=sp[s>>28&15]+sp[s>>24&15]+sp[s>>20&15]+sp[s>>16&15]+sp[s>>12&15]+sp[s>>8&15]+sp[s>>4&15]+sp[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 Sp extends gp{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(ap);if(null===e)throw new Error(ap);if(rp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||rp&&ArrayBuffer.isView(e)))throw new Error(ap)}var o;e.length>64&&(e=null==(o=new gp(!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}gp.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();gp.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),gp.prototype.finalize.call(this)}}}const vp=function(){const e=fp("hex");e.create=function(){return new gp},e.update=function(t){return e.create().update(t)};for(let t=0;t<dp.length;++t){const n=dp[t];e[n]=fp(n)}return e}();function hp(e,t){const n=R({},e);return t.forEach((e=>{delete n[e]})),n}async function mp(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=vp.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Ap(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=pp("hex");e.create=function(e){return new Sp(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<dp.length;++t){const n=dp[t];e[n]=pp(n)}}();const bp=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*Tp(e){const t=yield zo((e=>e.root.appName));return xr.getFeatureFlags(e,t)}const Ep={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},kp=R({},Ep,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Op=[{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"}],Ip={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},Pp=R({},Ip,{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}),_p={loading:!1,error:void 0,saving:!0,profile:Ip},Lp={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"},wp={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:ki.EmailAndPassword,machineToMachineAuthStrategy:Oi.ClientCredentials},Up={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Cp={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Dp={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Rp={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},Np={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Mp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Fp={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Rp,roles:Mp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Gp=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],$p={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:[Op[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[Op[0]],managedBy:Jf.FRONTEGG}]},Vp={id:$p.id,email:$p.email,name:$p.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:[Op[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},xp={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:[Op[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[Op[0]],managedBy:Jf.FRONTEGG}]},jp={id:xp.id,email:xp.email,name:xp.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:[Op[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Bp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Wp=[xp,$p],zp=[jp,Vp],Kp=[Bp],Hp=[{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}],qp=[{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"}],Jp={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Yp={isActive:!0,strategy:Wn.ALLOW},Qp=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Wn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Wn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Wn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Wn.BLOCK,description:"IP 4"}],Xp=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(R({},xp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Zp=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"}),eg=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Xp(6),roles:[Zp("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Jf.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Xp(44),roles:[Zp("Editor")],managedBy:Jf.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Xp(8),roles:[Zp("Viewer")],managedBy:Jf.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Xp(5),roles:[Zp("Admin")],managedBy:Jf.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Xp(21),description:"BDR, AE, and inside sales",roles:[Zp("Viewer")],managedBy:Jf.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Xp(23),description:"Dev success and customer success",roles:[Zp("Admin")],managedBy:Jf.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Xp(10),description:"The marketing department",roles:[Zp("Viewer")],managedBy:Jf.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Xp(4),description:"Human resources",roles:[Zp("Viewer")],managedBy:Jf.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Xp(3),roles:[Zp("Viewer")],managedBy:Jf.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Xp(8),roles:[Zp("Editor")],managedBy:Jf.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Xp(4),roles:[Zp("Viewer")],managedBy:Jf.FRONTEGG}],tg={scoring:{score:79},recommendations:{items:[{code:Yf.FORCE_MFA,severity:Zf.WARNING,category:ep.MFA},{code:Yf.ENABLE_FORCE_RELOGIN,severity:Zf.WARNING,category:ep.SESSIONS}]}},ng={insights:{items:[{category:ep.MFA,code:Qf.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:ep.SESSIONS,code:Qf.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:ep.PASSWORD,code:Qf.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:ep.DOMAIN,code:Qf.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},ig={users:zp,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},og={users:[zp[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},ag={users:[zp[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0};let rg,sg,lg;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(rg||(rg={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(sg||(sg={})),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"}(lg||(lg={})),lg.profile,lg.privacy,lg.personalApiTokens,lg.account,lg.users,lg.groups,lg.security,lg.sso,lg.audits,lg.webhooks,lg.apiTokens,lg.roles,lg.subscriptions,lg.allAccounts;const cg=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},ug=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},dg="tenantId",yg=e=>e.mfaRequired&&e.mfaToken?(Va.setAccessToken(null),Va.setUser(null),!0):(Va.setAccessToken(e.accessToken),Va.setUser(e),!1),fg=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 cn.authenticatorApp;if(t)return cn.smsVerifyCode;if(i)return cn.emailVerifyCode}return cn.verify},pg=e=>{if(1===e.length){const[t]=e;if(t===xs.AuthenticatorApp)return cn.authenticatorApp;if(t===xs.SMS)return cn.smsSetPhoneNumber;if(t===xs.EmailCode)return cn.emailVerifyCode}return cn.verify};function*gg(e){let t=_t.loginWithTwoFactor,n={};const{loginState:i}=yield zo((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield jo(tp.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:fg(e.mfaDevices)}:(n={step:pg(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:R({},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 Sg=(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 vg;function hg(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"}(vg||(vg={}));const mg=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,...mg(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),Ag=["callback"];function*bg(){yield $o(xi.setCustomLoginState({loading:!0}));try{const e=yield jo(tp.metadata.getAdminBoxMetadata);yield $o(xi.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield $o(xi.setCustomLoginState({loading:!1,error:Sg(e)}))}}function*Tg(e){let{payload:{callback:t}}=e,n=eo(e.payload,Ag);try{yield $o(xi.setCustomLoginState({error:null,saving:!0}));const e=mg(n);if(0===e.length)throw new Error("No changes to update");yield jo(tp.metadata.updateAdminBoxMetadata,{actions:e});const i=yield jo(tp.metadata.getAdminBoxMetadata);yield $o(xi.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield $o(xi.setCustomLoginState({error:Sg(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Eg(){var e,t,n;if(yield zo((e=>e.auth.isAuthenticated))){var i;const e=yield null!=(i=zo((({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*kg(){try{var e;if(!(yield jo(Eg)))return;const t=yield zo((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:i}=tp.accountSettings,{applicationUrl:o}=yield jo(t?n:i);if(!o)return;const{routes:a}=yield zo((e=>e.auth)),r=null!=(e=cg(o))?e:"";yield $o(xi.setState({routes:R({},a,{customLoginAuthenticatedUrl:o,customLoginUrl:a.loginUrl+r})})),yield $o(xi.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*Og(){yield $a(xi.loadTenantMetadata,bg),yield $a(xi.updateTenantMetadata,Tg)}let Ig;!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"}(Ig||(Ig={}));const Pg=["callback"];function _g(e){return function*(t){const[n]=yield jo(Tp,["security-center-admin-portal-major-version"]);yield e(t),n&&(yield Lg(),yield wg())}}function*Lg(){const e=Ig.RECOMMENDATIONS;yield $o(xi.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:i}=yield jo(tp.securityCenter.getRecommendations);yield $o(xi.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==i?void 0:i.score)?t:0}))}catch(t){yield $o(xi.setSecurityCenterStateError({key:e,value:Sg(t)}))}finally{yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}}function*wg(){const e=Ig.INSIGHTS;yield $o(xi.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield jo(tp.securityCenter.getInsights);yield $o(xi.setSecurityCenterState({insights:t.items}))}catch(t){yield $o(xi.setSecurityCenterStateError({key:e,value:Sg(t)}))}finally{yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Ug(e){let{payload:{callback:t}}=e,n=eo(e.payload,Pg);const i=Ig.SEND_BREACHED_PASSWORD_EMAIL;yield $o(xi.setSecurityCenterStateError({key:i,value:!1})),yield $o(xi.setSecurityCenterStateLoader({key:i,value:!0}));try{yield jo(tp.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield $o(xi.setSecurityCenterStateError({key:i,value:Sg(e)})),null==t||t(!1,e)}finally{yield $o(xi.setSecurityCenterStateLoader({key:i,value:!1}))}}function*Cg({payload:{callback:e}}){const t=Ig.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield $o(xi.setSecurityCenterStateError({key:t,value:!1})),yield $o(xi.setSecurityCenterStateLoader({key:t,value:!0}));try{yield jo(tp.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield $o(xi.setSecurityCenterStateError({key:t,value:Sg(n)})),null==e||e(!1)}finally{yield $o(xi.setSecurityCenterStateLoader({key:t,value:!1}))}}function*Dg({key:e,tableState:t,updateStateKey:n,_offset:i,_limit:o,_preset:a,_email:r,_maxInactiveSeconds:s}){var l,c,u,d;yield $o(xi.setSecurityCenterStateError({key:e,value:!1})),yield $o(xi.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=R({_offset:y,_limit:f,_includeSubTenants:!1,_preset:a,_maxInactiveSeconds:s},!!r&&{_email:r});try{const{items:t,_metadata:{totalItems:i,totalPages:o}}=yield jo(tp.users.getUsersV3,p),a={totalUsersItems:i,totalUsersPages:o,usersPageOffset:y,queryParams:R({_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 jo(tp.roles.getRoles),i=yield jo(tp.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 R({},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 $o(xi.setSecurityCenterState({[n]:R({users:e},a)}))}else yield $o(xi.setSecurityCenterState({[n]:R({users:[]},a)}))}catch(t){yield $o(xi.setSecurityCenterStateError({key:e,value:Sg(t)}))}finally{yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Rg({payload:e}){var t;const n=Ig.BREACHED_PASSWORD_USERS_TABLE,i=yield null!=(t=zo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield Dg(R({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:fi.BREACHED_PASSWORDS,tableState:i},e))}function*Ng({payload:e}){var t;const n=Ig.UNENROLLED_MFA_USERS_TABLE,i=yield null!=(t=zo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield Dg(R({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:fi.MFA_UNENROLLED,tableState:i},e))}function*Mg({payload:e}){var t;const n=Ig.INACTIVE_USERS_TABLE,i=yield null!=(t=zo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield Dg(R({key:n,updateStateKey:"inactiveUsersTable",_preset:fi.INACTIVE,tableState:i},e))}function*Fg(){yield Fa(xi.loadRecommendations,Lg),yield Fa(xi.loadInsights,wg),yield Fa(xi.sendResetBreachedPasswordEmail,Ug),yield Fa(xi.sendBulkResetBreachedPasswordEmails,Cg),yield Fa(xi.loadBreachedPasswordUsers,Rg),yield Fa(xi.loadUnenrolledMfaUsers,Ng),yield Fa(xi.loadInactiveUsers,Mg)}function*Gg(){const e=Ig.RECOMMENDATIONS;yield $o(xi.setSecurityCenterStateLoader({key:e,value:!0})),yield Ko(500),yield $o(xi.setSecurityCenterState({recommendations:tg.recommendations.items,score:tg.scoring.score})),yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}function*$g(){const e=Ig.INSIGHTS;yield $o(xi.setSecurityCenterStateLoader({key:e,value:!0})),yield Ko(500),yield $o(xi.setSecurityCenterState({insights:ng.insights.items})),yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}function*Vg(){const e=Ig.BREACHED_PASSWORD_USERS_TABLE;yield $o(xi.setSecurityCenterStateLoader({key:e,value:!0})),yield Ko(500),yield $o(xi.setSecurityCenterState({breachedPasswordUsersTable:ig})),yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}function*xg(){const e=Ig.UNENROLLED_MFA_USERS_TABLE;yield $o(xi.setSecurityCenterStateLoader({key:e,value:!0})),yield Ko(500),yield $o(xi.setSecurityCenterState({unenrolledMfaUsersTable:ag})),yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}function*jg(){const e=Ig.INACTIVE_USERS_TABLE;yield $o(xi.setSecurityCenterStateLoader({key:e,value:!0})),yield Ko(500),yield $o(xi.setSecurityCenterState({inactiveUsersTable:og})),yield $o(xi.setSecurityCenterStateLoader({key:e,value:!1}))}function*Bg({payload:{callback:e}}){const t=Ig.SEND_BREACHED_PASSWORD_EMAIL;yield $o(xi.setSecurityCenterStateLoader({key:t,value:!0})),yield Ko(500),null==e||e(!0),yield $o(xi.setSecurityCenterStateLoader({key:t,value:!1}))}function*Wg(){yield Fa(xi.loadRecommendations,Gg),yield Fa(xi.loadInsights,$g),yield Fa(xi.loadBreachedPasswordUsers,Vg),yield Fa(xi.loadUnenrolledMfaUsers,xg),yield Fa(xi.loadInactiveUsers,jg),yield Fa(xi.sendResetBreachedPasswordEmail,Bg)}const zg=["callback"],Kg=["callback"],Hg=["callback"],qg=["callback"],Jg=["callback"],Yg=["callback"];function*Qg(){yield $o(xi.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getGlobalSecurityPolicy);yield $o(xi.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyGlobalState({error:Sg(e),loading:!1}))}yield $o(xi.loadSecurityPolicyMfa()),yield $o(xi.loadSecurityPolicyVendorMfa()),yield $o(xi.loadSecurityPolicyLockout()),yield $o(xi.loadSecurityPolicyVendorLockout()),yield $o(xi.loadSecurityPolicyVendorPasswordHistory()),yield $o(xi.loadSecurityPolicyCaptcha()),yield $o(xi.loadPublicAuthStrategiesPolicy())}function*Xg(e){var t,n;if(!(yield jo(Eg)))return e;const i=yield jo(eS);return null!=i&&null!=(t=i.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?R({},e,{authStrategy:i.mainAuthStrategies[0].strategy}):e}function*Zg(){yield $o(xi.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getVendorConfig),t=yield Xg(e);yield $o(xi.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyPublicState({error:Sg(e),loading:!1}))}}function*eS(){const e=yield zo((({auth:e})=>e.isAuthenticated));let t;return t=e?yield jo(tp.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield jo(tp.auth.getVendorPublicAuthStrategiesConfig),t}function*tS(){yield $o(xi.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield jo(eS);yield function*(e){const t=yield jo(Eg);if(!e||!t)return;const{policy:n}=yield zo((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield $o(xi.setSecurityPolicyPublicState({policy:R({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield $o(xi.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyAuthStrategyPublicState({error:Sg(e),loading:!1}))}}function*nS(){yield $o(xi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getMfaPolicy);yield $o(xi.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyMfaState({error:Sg(e),loading:!1}))}}function*iS(){yield $o(xi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getVendorMfaPolicy);yield $o(xi.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyVendorMfaState({error:Sg(e),loading:!1}))}}function*oS(e){let{payload:{callback:t}}=e,n=eo(e.payload,zg);yield $o(xi.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield jo(tp.auth.saveMfaPolicy,n);yield $o(xi.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield $o(xi.setSecurityPolicyMfaState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*aS(){yield $o(xi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getLockoutPolicy);yield $o(xi.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyLockoutState({error:Sg(e),loading:!1}))}}function*rS(e){let{payload:{callback:t}}=e,n=eo(e.payload,Kg);yield $o(xi.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield jo(tp.auth.saveLockoutPolicy,n);yield $o(xi.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield $o(xi.setSecurityPolicyLockoutState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*sS(){yield $o(xi.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getVendorLockoutPolicy);yield $o(xi.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyVendorLockoutState({error:Sg(e),loading:!1}))}}function*lS(){yield $o(xi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getCaptchaPolicy);yield $o(xi.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyCaptchaState({error:Sg(e),loading:!1}))}}function*cS(){yield $o(xi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getPasswordHistoryPolicy);yield $o(xi.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyPasswordHistoryState({error:Sg(e),loading:!1}))}}function*uS(){yield $o(xi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getVendorPasswordHistoryPolicy);yield $o(xi.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyVendorPasswordHistoryState({error:Sg(e),loading:!1}))}}function*dS(e){let{payload:{callback:t}}=e,n=eo(e.payload,Hg);yield $o(xi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield jo(tp.auth.savePasswordHistoryPolicy,n);yield $o(xi.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield $o(xi.setSecurityPolicyPasswordHistoryState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*yS(){yield $o(xi.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getPasswordConfigPolicy);yield $o(xi.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyPasswordState({error:Sg(e),loading:!1}))}}function*fS(){yield $a(xi.loadSecurityPolicy,Qg),yield Fa(xi.saveSecurityPolicyMfa,_g(oS)),yield Fa(xi.loadSecurityPolicyMfa,nS),yield Fa(xi.loadSecurityPolicyVendorMfa,iS),yield Fa(xi.saveSecurityPolicyLockout,_g(rS)),yield Fa(xi.loadSecurityPolicyLockout,aS),yield Fa(xi.loadSecurityPolicyVendorLockout,sS),yield Fa(xi.loadSecurityPolicyCaptcha,lS),yield Fa(xi.saveSecurityPolicyPasswordHistory,_g(dS)),yield Fa(xi.loadSecurityPolicyPasswordHistory,cS),yield Fa(xi.loadSecurityPolicyVendorPasswordHistory,uS),yield Fa(xi.loadVendorPasswordConfig,yS),yield Fa(xi.loadPublicSecurityPolicy,Zg),yield Fa(xi.loadPublicAuthStrategiesPolicy,tS)}function*pS(){yield $o(xi.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield $o(xi.setSecurityPolicyPublicState({policy:wp,loading:!1}))}catch(e){yield $o(xi.setSecurityPolicyPublicState({error:Sg(e),loading:!1}))}}function*gS(){yield $o(xi.setSecurityPolicyGlobalState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyGlobalState({policy:Lp,loading:!1})),yield $o(xi.loadSecurityPolicyMfa()),yield $o(xi.loadSecurityPolicyVendorMfa()),yield $o(xi.loadSecurityPolicyLockout()),yield $o(xi.loadSecurityPolicyVendorLockout()),yield $o(xi.loadSecurityPolicyPasswordHistory()),yield $o(xi.loadSecurityPolicyVendorPasswordHistory()),yield $o(xi.loadSecurityPolicyCaptcha())}function*SS(){yield $o(xi.setSecurityPolicyMfaState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyMfaState({policy:Up,loading:!1}))}function*vS(){yield $o(xi.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyVendorMfaState({policy:Up,loading:!1}))}function*hS(e){var t;let{payload:{callback:n}}=e,i=eo(e.payload,qg);yield $o(xi.setSecurityPolicyMfaState({saving:!0,error:null}));const o=R({},Cp,{id:null!=(t=i.id)?t:Cp.id,enforceMFAType:i.enforceMFAType});yield Et(),yield $o(xi.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*mS(){yield $o(xi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyLockoutState({policy:Cp,loading:!1}))}function*AS(){yield $o(xi.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyVendorLockoutState({policy:Cp,loading:!1}))}function*bS(e){let{payload:{callback:t}}=e,n=eo(e.payload,Jg);yield $o(xi.setSecurityPolicyLockoutState({saving:!0,error:null})),yield Et();const i=R({},Cp,n,{id:n.id?n.id:Cp.id});null==t||t(i),yield $o(xi.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*TS(){yield $o(xi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyLockoutState({policy:Cp,loading:!1}))}function*ES(){yield $o(xi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyPasswordHistoryState({policy:Dp,loading:!1}))}function*kS(){yield $o(xi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield Et(),yield $o(xi.setSecurityPolicyVendorPasswordHistoryState({policy:Dp,loading:!1}))}function*OS(e){let{payload:{callback:t}}=e,n=eo(e.payload,Yg);yield $o(xi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield Et();const i=R({},Dp,n,{id:n.id?n.id:Dp.id});null==t||t(i),yield $o(xi.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*IS(){yield $a(xi.loadSecurityPolicy,gS),yield Fa(xi.loadPublicSecurityPolicy,pS),yield Fa(xi.saveSecurityPolicyMfa,hS),yield Fa(xi.loadSecurityPolicyMfa,SS),yield Fa(xi.loadSecurityPolicyVendorMfa,vS),yield Fa(xi.saveSecurityPolicyLockout,bS),yield Fa(xi.loadSecurityPolicyLockout,mS),yield Fa(xi.loadSecurityPolicyVendorLockout,AS),yield Fa(xi.loadSecurityPolicyCaptcha,TS),yield Fa(xi.saveSecurityPolicyPasswordHistory,OS),yield Fa(xi.loadSecurityPolicyPasswordHistory,ES),yield Fa(xi.loadSecurityPolicyVendorPasswordHistory,kS)}const PS=["phoneNumber"],_S=["events","url"];function*LS(){yield $o(xi.setSignUpState({loading:!0}));try{const e=yield jo(tp.auth.getVendorConfig),t=yield Xg(e),{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield $o(xi.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield $o(xi.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield $o(xi.setSignUpState({loading:!1,error:Sg(e),firstLoad:!1}))}}function*wS(e){let{payload:{events:t,url:n}}=e,i=eo(e.payload,_S);yield $o(xi.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:r}=yield zo((e=>e.auth)),{shouldActivate:s,user:l,tenantId:c,userId:u,tenants:d=[],activeTenant:y}=yield jo(tp.auth.signUpUser,(a=i,eo(a,PS)));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:sg.PASSWORD,id:u,tenantId:c,createdAt:new Date};null==t||null==(o=t.signUpComplete)||o.call(t,l),hg(vg.SIGNUP_COMPLETED,l)}if(!s&&l&&yg(l)){const t=yield gg(l);yield $o(xi.setState(t)),r(e.loginUrl)}else{const{tenantsState:e}=yield zo((e=>e.auth));yield $o(xi.setSignUpState({loading:!1,shouldActivate:s,stage:mn.SignUpSuccess})),yield $o(xi.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:R({},e,{tenants:d,activeTenant:y})}))}}catch(e){Va.setAccessToken(null),Va.setUser(null),yield $o(xi.setSignUpState({loading:!1,error:Sg(e)}))}var a;yield $o(xi.setSignUpState({loading:!1}))}function*US(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield zo((e=>e.auth.signUpState));yield $o(xi.resetSignUpState()),yield $o(xi.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*CS(){yield $a(xi.signUpUser,wS),yield $a(xi.resetSignUpStateSoft,US)}const DS={setVendorState:(e,{payload:t})=>R({},e,t)},RS={loadVendorPublicInfo:yt("vendor/loadVendorPublicInfo")},NS={loading:!1},{reducer:MS,actions:FS}=pt({name:Mt,initialState:NS,reducers:R({},DS)}),GS=R({},FS,RS);function*$S(){yield $o(GS.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield tp.vendor.getVendorPublicInfo();yield $o(GS.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield $o(GS.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var VS=n(378),xS=n.n(VS);function jS(e,t){return xS()(e,t)}function*BS({payload:e}){const t=null==e?void 0:e.callback,[n]=yield jo(Tp,[$r]);try{const e=yield jo(n?tp.entitlements.loadEntitlementsV2:tp.entitlements.loadEntitlements);yield function*(e){jS(yield zo((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield $o(xi.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*WS(){yield $a(xi.loadEntitlements,BS)}var zS=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(){return this.isWebkitAvailable()||this.isJsInterfaceAvailable()}};function*KS(){const{publicAuthStrategyPolicy:e}=yield zo((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===$s.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield jo(Tp,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield jo(tp.auth.getWebAuthnDevices);return yield $o(xi.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*HS({user:e,tenants:t=[],activeTenant:n},i={}){const{tenantsState:o}=yield zo((e=>e.auth));yield $o(xi.setState(R({user:e,tenantsState:R({},o,{tenants:t,activeTenant:n,loading:!1})},i)))}const qS=["otp","sms","hwk"],JS="SHOULD_STEP_UP";function*YS(e){const{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield zo((e=>e.auth));if(e)return(e=>{const{pathname:t}=new URL(e),n=cg(e);return n?t+n:t})(e);const{authenticatedUrl:a,loginUrl:r,logoutUrl:s,socialLoginCallbackUrl:l,activateUrl:c}=t;let u=window.localStorage.getItem(Ut);return u&&![r,s,l,c].includes(u)||(u=a),(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:i})=>{let o=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),i=new URL(e),o=i.origin===n.origin;return t.includes(i.origin)||o})(a,n)?o=a:console.warn("The redirect url param is not valid, the origin is a different site"):o=a:i&&(o+=window.location.search),o})({authenticatedUrl:u,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o})}function*QS(e,{customLoginAuthenticatedUrl:t,forceStepUpUrl:n}={}){const i=Va.onRedirectTo;let o;var a;n?o=n:(o=yield jo(YS,t),null==(a=window)||a.localStorage.removeItem(Ut)),yield Ko(200),$o(e()),i(o,{refresh:o.startsWith("http")})}function*XS(){var e;const{routes:{customLoginAuthenticatedUrl:t,stepUpUrl:n}}=yield zo((e=>e.auth)),i=null==(e=window)?void 0:e.localStorage.getItem(JS),o=yield zo((({auth:e})=>e.user));var a;if(i&&(null==(a=window)||a.localStorage.removeItem(JS)),n&&i&&!(({amr:e=[],acr:t="",auth_time:n,maxAge:i}={})=>{if(i&&n&&!(Date.now()/1e3-n<=i))return!1;const o="http://schemas.openid.net/pape/policies/2007/06/multi-factor"===t,a=-1!==e.indexOf("mfa"),r=void 0!==qS.find((t=>e.indexOf(t)));return o&&a&&r})(o))return void(yield jo(QS,xi.resetLoginState,{forceStepUpUrl:n}));let r=t;t||(yield jo(kg),r=yield zo((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl}))),yield jo(QS,xi.resetLoginState,{customLoginAuthenticatedUrl:r})}function*ZS(){yield jo(QS,xi.resetStepUpState)}const ev=["callback"];function*tv(e,t,n){const{loginState:i}=yield zo((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 R({},o,{isAuthenticated:t})}function*nv(e,t){const{loginState:n}=yield zo((e=>e.auth));if(n.flow!==Lt.Login)return;const[i]=yield jo(Tp,["security-center-show-login-flows"]);i&&n.isBreachedPassword&&!e?yield $o(xi.setLoginState({step:_t.breachedPassword,loading:!1})):(yield jo(KS))?yield $o(xi.setLoginState({step:_t.promptPasskeys,loading:!1})):yield XS(),null==t||t(!0)}function*iv(e){yield ZS(),null==e||e(!0)}function*ov(e,t,n){let{callback:i}=e,o=eo(e,ev);yield $o(t({loading:!0,error:void 0}));try{const{user:e,tenants:a=[],activeTenant:r}=yield jo(tp.auth.loginWithMfaV2,o),s=!!e.accessToken,l=yield jo(tv,a,s,n);if(yield jo(HS,{user:e,tenants:a,activeTenant:r},l),e.id&&localStorage.setItem("userId",e.id),yield $o(t({loading:!1,error:void 0})),n)return void(yield jo(iv,i));yield jo(nv,s,i)}catch(e){yield $o(t({loading:!1,error:Sg(e)})),null==i||i(!1,e)}}function*av({payload:e}){yield ov(e,xi.setLoginState,!1)}function*rv(){yield jo(ZS)}function*sv(e){const{loginState:t}=yield zo((e=>e.auth)),{step:n}=yield zo((e=>e.auth.mfaState)),[i]=yield jo(Tp,["security-center-show-login-flows"]);if(t.flow===Lt.Login)if(i&&t.isBreachedPassword&&!e)yield $o(xi.setLoginState({step:_t.breachedPassword,loading:!1}));else{const e=yield jo(KS);n===cn.smsVerifyCode&&e?yield $o(xi.setLoginState({step:_t.promptPasskeys,loading:!1})):yield XS()}}function*lv({user:e,tenants:t,activeTenant:n},i=!1){yield $o(xi.setUser(e)),yield $o(xi.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const o=!!e.accessToken;yield $o(xi.setState({isAuthenticated:o})),i?yield jo(rv):yield jo(sv,o)}const cv=["callback","deviceId"],uv=["callback","deviceId"];function*dv(e,t){let{callback:n,deviceId:i}=e,o=eo(e,cv);yield $o(t({loading:!1,error:void 0}));try{const e=yield jo(tp.auth.preVerifyMFASMSForLogin,i,o);yield $o(xi.setMfaState({otcToken:e.otcToken,step:cn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield $o(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield $o(t({loading:!1,error:Sg(e)})),null==n||n(null)}}function*yv(e,t,n=!1){let{callback:i,deviceId:o}=e,a=eo(e,uv);yield $o(t({loading:!0}));try{const e=yield jo(tp.auth.verifyMFASMSForLoginV2,o,a);yield lv(e,n),yield $o(t({loading:!1,error:void 0})),null==i||i(!0)}catch(e){yield $o(t({loading:!1,error:Sg(e)})),null==i||i(null)}}function*fv({payload:e}){yield dv(e,xi.setLoginState)}function*pv({payload:e}){yield yv(e,xi.setLoginState,!1)}const gv=["callback","deviceId"],Sv=["callback","deviceId"];function*vv(e,t){let{callback:n,deviceId:i}=e,o=eo(e,gv);yield $o(t({loading:!0}));try{var a;const e=yield jo(tp.auth.preVerifyMFAWebAuthnForLogin,i,o),r=R({},e.options,{challenge:It(e.options.challenge),allowCredentials:null==(a=e.options.allowCredentials)?void 0:a.map((e=>R({},e,{id:It(e.id)})))});yield $o(t({loading:!1,error:void 0})),null==n||n({options:r,webauthnToken:e.webauthnToken})}catch(e){yield $o(t({loading:!1,error:Sg(e)})),null==n||n(null)}}function*hv(e,t,n){let{callback:i,deviceId:o}=e,a=eo(e,Sv);yield $o(t({loading:!0}));try{const e=Pt(a.publicKey),r=yield jo(tp.auth.verifyMFAWebAuthnForLoginV2,o,R({},a,{options:e}));yield lv(r,n),yield $o(t({loading:!1,error:void 0})),null==i||i(!0)}catch(e){yield $o(t({loading:!1,error:Sg(e)})),null==i||i(null)}}function*mv({payload:e}){yield vv(e,xi.setLoginState)}function*Av({payload:e}){yield hv(e,xi.setLoginState,!1)}const bv=["callback"],Tv=["callback"];function*Ev(e,t){let{callback:n}=e,i=eo(e,bv);yield $o(t({loading:!0,error:void 0}));try{const e=yield jo(tp.auth.preVerifyMFAEmailCode,i);yield $o(xi.setMfaState({otcToken:e.otcToken,step:cn.emailVerifyCode})),yield $o(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield $o(t({error:Sg(e)})),null==n||n(null)}}function*kv(e,t){let{callback:n}=e,i=eo(e,Tv);yield $o(t({loading:!0}));try{const e=yield jo(tp.auth.verifyMFAEmailCodeV2,i);yield lv(e),yield $o(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield $o(t({loading:!1,error:Sg(e)})),null==n||n(null)}}function*Ov({payload:e}){yield Ev(e,xi.setLoginState)}function*Iv({payload:e}){yield kv(e,xi.setLoginState)}const Pv=["callback"],_v=["callback"],Lv=["callback"],wv=["callback"],Uv=["callback","events"],Cv=["callback"],Dv=["callback"],Rv=["callback"],Nv=["callback"],Mv=["user"],Fv=["callback"],Gv=["callback"],$v=["callback"],Vv=["callback"],xv=["callback"];function*jv(e){const t=yield zo((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return jS(t,null==e?void 0:e.entitlements)?R({},e,{entitlements:t}):e}function*Bv(){let e;try{var t;const n=yield jo(tp.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield $o(xi.setState({ssoACS:e}))}function*Wv(){try{const{isActive:e}=yield jo(tp.auth.getSSOPublicConfiguration);yield $o(xi.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*zv(e){var t;const{routes:n,loginState:i}=yield zo((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*Kv(){const{hostedLoginBox:e}=yield zo((e=>e.auth));e?yield jo(Hv):yield jo(Jv)}function*Hv(){const{user:e}=yield zo((e=>e.auth));if(null==e||!e.refreshToken)return Va.setAccessToken(null),Va.setUser(null),void(yield $o(xi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield jo(tp.auth.exchangeOAuthTokensV2,t),i=yield jo(jv,n.user);yield jo(HS,R({},n,{user:i}),{isAuthenticated:!0})}catch(e){Va.setAccessToken(null),Va.setUser(null),yield $o(xi.setState({user:null,isAuthenticated:!1}))}}function*qv(){const{user:e}=yield zo((e=>e.auth));if(null==e||!e.refreshToken)return Va.setAccessToken(null),Va.setUser(null),void(yield $o(xi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield jo(tp.auth.exchangeOAuthTokensV2,t),i=yield jo(jv,n.user);yield jo(HS,R({},n,{user:i}),{isAuthenticated:!0})}catch(e){Va.setAccessToken(null),Va.setUser(null),yield $o(xi.setState({user:null,isAuthenticated:!1}))}}function*Jv(){try{const t=Va.onRedirectTo,{routes:n,loginState:i}=yield zo((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield jo(tp.auth.refreshTokenV3);if(yg(o)){const e=yield gg(o);yield $o(xi.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 zv(o),s=yield jo(jv,o);yield jo(HS,{user:s,tenants:a,activeTenant:r},{loginState:R({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield Qv(n)}}catch(e){Va.setAccessToken(null),Va.setUser(null),yield $o(xi.setState({user:void 0,isAuthenticated:!1}))}}function*Yv(){try{const t=Va.onRedirectTo,{routes:n,loginState:i}=yield zo((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield jo(tp.auth.refreshTokenV3);if(yg(o)){const e=yield gg(o);yield $o(xi.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const s=yield jo(jv,o);if(yield jo(KS))yield $o(xi.setLoginState({step:_t.promptPasskeys,loading:!1})),yield jo(HS,{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 zv(o);yield jo(HS,{user:s,tenants:a,activeTenant:r},{loginState:R({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield Qv(n)}}}catch(e){Va.setAccessToken(null),Va.setUser(null),yield $o(xi.setState({user:void 0,isAuthenticated:!1}))}}function*Qv(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=Va.onRedirectTo,{routes:o,loginState:a}=yield zo((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 XS())}function*Xv({payload:{callback:e}}){try{const{ip:t}=yield jo(tp.metadata.getCurrentUserIpMetadata);yield $o(xi.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*Zv({payload:e}){const t=[];(yield jo(Eg))?yield jo(Kv):t.push(jo(Kv)),e&&(yield $o(xi.setState({isLoading:!0})),yield $o(xi.loadSocialLoginsConfigurationV2()),t.push(jo(LS)),t.push(jo(tS)),t.push(jo(Wv)),t.push(jo($S)),t.push(jo(Bv)),t.push(jo(kg))),yield Vo(t),yield $o(xi.setState({isLoading:!1}))}function*eh({accessToken:e,user:t}){if(!e)return void(yield $o(xi.setState({user:void 0,isAuthenticated:!1})));const n=Va.onRedirectTo,{routes:i}=yield zo((e=>e.auth));if(yg(t)){const e=yield gg(t);yield $o(xi.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*th({payload:e}){const t=[];yield $o(xi.loadSocialLoginsConfigurationV2()),t.push(jo(LS)),t.push(jo(Wv)),t.push(jo($S)),t.push(jo(Bv)),t.push(jo(eh,e)),t.push(jo(kg)),yield Vo(t)}const nh=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*ih(){const e=yield jo(tp.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield jo(HS,e,{isAuthenticated:!0,isLoading:!1})}function*oh({payload:e}){const{disableSilentRefresh:t}=yield zo((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield ih()}catch(t){yield rh(e)}}function*ah({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n}}){if(n){const{urlStrategy:e}=yield zo((e=>({urlStrategy:e.root.urlStrategy}))),t=nh(e);if(yield $o(xi.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:i}=yield zo((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(i)throw new Error("silent refresh is disabled");yield ih()}catch(n){if(!t)return void(yield $o(xi.setState({isLoading:!1})));yield rh(e)}}function*rh(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield zo((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(nh(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield $o(xi.setState({isLoading:!0}));const a=Ap(),r=Ap(),s=yield jo(mp,r);localStorage.setItem(Ct,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;yield jo(kg);const c=yield zo((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=`${_r(n,"/oauth/authorize")}/oauth/authorize`,d=R({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=ug(dg);f&&(d.tenantId=f),i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*sh({payload:e}){const t=localStorage.getItem(Ct)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield zo((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;yield jo(kg);const a=yield zo((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 jo(tp.auth.exchangeOAuthTokensV2,r);yield jo(HS,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield $o(xi.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{yield XS()}}function*lh(e){let{payload:{callback:t}}=e,n=eo(e.payload,Pv);try{yield $o(xi.setLoginState({loading:!0}));const e=yield jo(tp.auth.changePhoneNumberWithVerification,n);yield $o(xi.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:_t.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({error:Sg(e),loading:!1}))}}function*ch(e){let{payload:{callback:t}}=e,n=eo(e.payload,_v);try{yield $o(xi.setLoginState({loading:!0})),yield jo(tp.auth.verifyChangePhoneNumber,n),yield $o(xi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({error:Sg(e),loading:!1}))}}function*uh(e){let{payload:{callback:t}}=e,n=eo(e.payload,Lv);try{yield $o(xi.setLoginState({loading:!0}));const e=yield jo(tp.auth.passwordlessPreLogin,R({},n,{type:ki.SmsCode}));yield $o(xi.setLoginState({step:_t.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({error:Sg(e),loading:!1})),null==t||t(e)}}function*dh(e){let{payload:{callback:t}}=e,n=eo(e.payload,wv);try{let e;yield $o(xi.setLoginState({loading:!0})),function(e){return"email"in e}(n)&&(e=n.email);const i=yield jo(tp.auth.passwordlessPreLogin,n),o=Ii[n.type];yield $o(xi.setLoginState({step:o,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:e,error:void 0})),null==t||t()}catch(e){yield $o(xi.setLoginState({error:Sg(e),loading:!1})),null==t||t()}}function*yh(e){let{payload:{callback:t,events:n}}=e,i=eo(e.payload,Uv);try{yield $o(xi.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield jo(tp.auth.passwordlessPostLoginV2,i),s=Va.onRedirectTo,{routes:l}=yield zo((e=>e.auth));if(yg(e)){const t=yield gg(e);yield $o(xi.setState(t)),s(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield zo((e=>e.auth));if(e.emailVerified){var o;const t={email:e.email,origin:rg.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name};null==n||null==(o=n.userVerified)||o.call(n,t),hg(vg.USER_VERIFIED,t)}e.id&&localStorage.setItem("userId",e.id),yield jo(HS,{user:e,tenants:a,activeTenant:r}),yield $o(xi.setLoginState({error:void 0})),yield $o(xi.setState({isLoading:!1})),i.flow===Lt.Login?(yield jo(KS))?(yield $o(xi.setLoginState({step:_t.promptPasskeys,loading:!1})),s(l.loginUrl,{preserveQueryParams:!0})):(yield $o(xi.setState({isAuthenticated:!0})),yield XS()):s(l.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield $o(xi.setLoginState({error:Sg(e,"Failed to authenticate")}))}finally{yield $o(xi.setLoginState({loading:!1}))}}function*fh({payload:e}){try{yield $o(xi.setLoginState({loading:!0}));const{name:t}=yield jo(tp.auth.verifyInviteToken,e);yield $o(xi.setLoginState({inviteTokenTenantName:t}))}catch(e){yield $o(xi.setLoginState({inviteTokenError:Sg(e,"We couldn't verify your invitation")}))}finally{yield $o(xi.setLoginState({loading:!1}))}}function*ph({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield $o(xi.setLoginState({loading:!0}));try{const o=yield zo((({auth:{onRedirectTo:e}})=>e)),a=ug(dg),{address:r,idpType:s}=yield jo(tp.auth.preLoginV2,{email:e,tenantId:a});if(r){let t=r;if(s===op.Oidc&&!t.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield zo((({auth:{routes:e}})=>({routes:e})));t+=`&redirect_uri=${window.location.origin}${e}`}zS.isAvailable()?(zS.loginWithSSO(e),yield $o(xi.setLoginState({loading:!1,step:_t.redirectToSSO})),null==i||i()):(yield $o(xi.setLoginState({step:_t.redirectToSSO,loading:!1,ssoRedirectUrl:t})),setTimeout((()=>{o(t,{refresh:!0})}),2e3))}else yield gh({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield gh({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*gh(e){let{callback:t}=e,n=eo(e,Cv);const i=yield zo((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield $o(xi.setLoginState({step:_t.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===ki.EmailAndPassword?(yield $o(xi.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t()):[ki.MagicLink,ki.Code,ki.SmsCode].includes(null==i?void 0:i.authStrategy)?yield $o(xi.passwordlessPreLogin(R({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield $o(xi.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t())}function*Sh({payload:{callback:e}}){try{yield $o(xi.setLoginState({loading:!0}));const{options:t}=yield jo(tp.auth.webAuthnCreateNewDeviceSession);t.user.id=It(t.user.id),t.challenge=It(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield $o(xi.setLoginState({error:Sg(t)})),null==e||e(null)}finally{yield $o(xi.setLoginState({loading:!1}))}}function*vh(e){let{payload:{callback:t}}=e,n=eo(e.payload,Dv);try{yield $o(xi.setLoginState({loading:!0}));const e=Pt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?Vs.Platform:Vs.CrossPlatform;yield jo(tp.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({error:Sg(e)})),null==t||t(null)}finally{yield $o(xi.setLoginState({loading:!1}))}}function*hh(e){let{payload:{callback:t}}=e,n=eo(e.payload,Rv);try{var i;yield $o(xi.setPasskeysState({loading:!0})),yield $o(xi.setLoginState({loading:!0}));const{options:e}=yield jo(tp.auth.webAuthnPreLogin,n);e.challenge=It(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>R({},e,{id:It(e.id)}))),yield $o(xi.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield $o(xi.setLoginState({error:Sg(e)})),null==t||t(null)}finally{yield $o(xi.setPasskeysState({loading:!1})),yield $o(xi.setLoginState({loading:!1}))}}function*mh(e){let{payload:{callback:t}}=e,n=eo(e.payload,Nv);try{var i;yield $o(xi.setPasskeysState({loading:!0})),yield $o(xi.setLoginState({loading:!0}));const e=Pt(n.publicKey),o=yield jo(tp.auth.webAuthnPostLoginV2,R({},e,{response:R({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken})),{user:a}=o,r=eo(o,Mv);if(yg(a)){const e=Va.onRedirectTo,{routes:t}=yield zo((e=>e.auth)),n=yield gg(a);yield $o(xi.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield jo(HS,R({user:a},r),{isAuthenticated:!0}),yield $o(xi.setLoginState({error:void 0})),yield XS(),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({error:Sg(e)})),null==t||t(null)}finally{yield $o(xi.setPasskeysState({loading:!1})),yield $o(xi.setLoginState({loading:!1}))}}function*Ah({payload:e}){const{onRedirectTo:t,routes:n}=yield zo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield $o(xi.setLoginState({loading:!0}));try{const t=yield jo(tp.auth.postLogin,e);yield $o(xi.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield XS()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield $o(xi.setLoginState({step:_t.loginWithSSOFailed,loading:!1}))}}function*bh({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield $o(xi.setLoginState({loading:!0}));try{const{user:a,tenants:r=[],activeTenant:s}=yield jo(tp.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:i}),l=Va.onRedirectTo,{routes:c}=yield zo((e=>e.auth));if(yg(a)){const e=yield gg(a);yield $o(xi.setState(e)),l(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield zo((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield jo(HS,{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 jo(Tp,["security-center-show-login-flows"]);t.flow===Lt.Login&&(i&&a.isBreachedPassword&&!n?yield $o(xi.setLoginState({step:_t.breachedPassword,loading:!1})):n&&((yield jo(KS))?(yield $o(xi.setLoginState({step:_t.promptPasskeys,loading:!1})),l(c.loginUrl,{preserveQueryParams:!0})):yield XS()))}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){Va.setAccessToken(null),Va.setUser(null),null==o||o(!1,t),yield $o(xi.setLoginState({email:e,error:Sg(t),loading:!1}))}}function*Th({payload:e}){yield $o(xi.setLoginState({loading:!0}));try{var t;yield jo(tp.auth.recoverMfaToken,e),yield $o(xi.setLoginState({loading:!1,error:void 0,step:_t.preLogin})),yield $o(xi.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $o(xi.setLoginState({error:Sg(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Eh({payload:e}){const{hostedLoginBox:t}=yield zo((e=>e.auth));yield $o(xi.setState({isLoading:!0}));try{t?yield jo(tp.auth.OAuthLogout):yield jo(tp.auth.logout)}catch{}yield $o(xi.resetState()),yield $o(xi.requestAuthorize(!0)),null==e||e()}function*kh({payload:e}){var t;try{yield jo(tp.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*Oh({user:e,tenants:t,activeTenant:n}){const i={step:cn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield $o(xi.setMfaState(i)),yield $o(xi.setUser(e)),yield $o(xi.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Ih(e){let{payload:{callback:t}}=e,n=eo(e.payload,Fv);yield $o(xi.setLoginState({loading:!0}));try{const e=yield jo(tp.auth.preEnrollMFASMSForLogin,n);yield $o(xi.setMfaState({otcToken:e.otcToken,step:cn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield $o(xi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({loading:!1,error:Sg(e)})),null==t||t(null)}}function*Ph(e){let{payload:{callback:t}}=e,n=eo(e.payload,Gv);yield $o(xi.setLoginState({loading:!0}));try{const e=yield jo(tp.auth.enrollMFASMSForLoginV2,n);yield Oh(e),yield $o(xi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({loading:!1,error:Sg(e)})),null==t||t(null)}}function*_h(e){let{payload:{callback:t}}=e,n=eo(e.payload,$v);yield $o(xi.setLoginState({loading:!0}));try{var i;const e=yield jo(tp.auth.preEnrollMFAWebAuthnForLogin,n),o=R({},e.options,{challenge:It(e.options.challenge),user:R({},e.options.user,{id:It(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>R({},e,{id:It(e.id)})))});yield $o(xi.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield $o(xi.setLoginState({loading:!1,error:Sg(e)})),null==t||t(null)}}function*Lh(e){let{payload:{callback:t}}=e,n=eo(e.payload,Vv);yield $o(xi.setLoginState({loading:!0}));try{const e=Pt(n.publicKey),i=yield jo(tp.auth.enrollMFAWebAuthnForLoginV2,R({},n,{options:e}));yield Oh(i),yield $o(xi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({loading:!1,error:Sg(e)})),null==t||t(null)}}function*wh(e){let{payload:{callback:t}}=e,n=eo(e.payload,xv);yield $o(xi.setLoginState({loading:!0}));try{const e=yield jo(tp.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield Oh(e),yield $o(xi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setLoginState({loading:!1,error:Sg(e)})),null==t||t(null)}}function*Uh({payload:e}){yield $o(xi.setLoginState({loading:!0}));try{yield jo(tp.auth.forgotPassword,e),yield $o(xi.setLoginState({loading:!1,error:void 0,step:_t.breachedPasswordSuccess})),yield $o(xi.setState({isAuthenticated:!1}))}catch(e){yield $o(xi.setLoginState({loading:!1,error:Sg(e)}))}}function*Ch(){yield $a(xi.requestAuthorize,Zv),yield $a(xi.requestAuthorizeSSR,th),yield $a(xi.requestHostedLoginAuthorize,oh),yield $a(xi.requestHostedLoginAuthorizeV2,ah),yield $a(xi.handleHostedLoginCallback,sh),yield $a(xi.preLogin,ph),yield $a(xi.postLogin,Ah),yield $a(xi.login,bh),yield $a(xi.logout,Eh),yield $a(xi.silentLogout,kh),yield $a(xi.loginWithMfa,av),yield $a(xi.recoverMfa,Th),yield $a(xi.quickSmsPasswordlessPreLogin,uh),yield $a(xi.changePhoneNumberWithVerification,lh),yield $a(xi.verifyChangePhoneNumber,ch),yield $a(xi.passwordlessPreLogin,dh),yield $a(xi.passwordlessPostLogin,yh),yield $a(xi.verifyInviteToken,fh),yield $a(xi.webAuthnPrelogin,hh),yield $a(xi.webAuthnPostLogin,mh),yield $a(xi.webAuthnCreateNewDeviceSession,Sh),yield $a(xi.webAuthnVerifyNewDeviceSession,vh),yield $a(xi.afterAuthNavigation,XS),yield $a(xi.getUserIP,Xv),yield $a(xi.preEnrollMFASMSForLogin,Ih),yield $a(xi.enrollMFASMSForLogin,Ph),yield $a(xi.preEnrollMFAWebAuthnForLogin,_h),yield $a(xi.enrollMFAWebAuthnForLogin,Lh),yield $a(xi.enrollMFAAuthenticatorAppForLogin,wh),yield $a(xi.preVerifyMFASMSForLogin,fv),yield $a(xi.verifyMFASMSForLogin,pv),yield $a(xi.preVerifyMFAWebAuthnForLogin,mv),yield $a(xi.verifyMFAWebAuthnForLogin,Av),yield $a(xi.preVerifyMFAEmailCode,Ov),yield $a(xi.verifyMFAEmailCode,Iv),yield $a(xi.resetBreachedPassword,Uh)}function*Dh({payload:e}){e&&(yield $o(xi.setState({isLoading:!0})));const t=Pp;yield $o(xi.loadTenants()),yield $o(xi.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Rh({payload:{callback:e}}){try{const{ip:t}=Qp[0];yield $o(xi.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Nh(){yield $a(xi.requestAuthorize,Dh),yield $a(xi.afterAuthNavigation,XS),yield $a(xi.getUserIP,Rh)}const Mh=["callback","samlVendor"],Fh=["callback","samlVendor"];function*Gh(){try{var e,t;yield $o(xi.setSSOState({loading:!0}));const n=yield jo(tp.auth.getSamlConfiguration),i=yield jo(tp.auth.getOidcConfiguration),o=yield jo(tp.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 $o(xi.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield $o(xi.setSSOState({error:Sg(e),loading:!1}))}}function*$h({payload:e}){const t=yield zo((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield $o(xi.setSSOState({error:void 0,[n]:!0}));try{const i=yield bp(e[0]),o=yield jo(tp.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield $o(xi.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield $o(xi.setSSOState({samlConfiguration:t,error:Sg(e),[n]:!1}))}}function*Vh({payload:e}){const{configFile:t,callback:n}=e,i=yield zo((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield $o(xi.setSSOState({error:void 0,[o]:!0}));try{const e=yield bp(t),a=yield jo(tp.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield $o(xi.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield $o(xi.setSSOState({samlConfiguration:i,error:Sg(e),[o]:!1})),null==n||n(null,e)}}function*xh({payload:e}){const{callback:t,samlVendor:n}=e,i=eo(e,Mh),o=yield zo((e=>e.auth.ssoState.samlConfiguration)),a=R({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield $o(xi.setSSOState({samlConfiguration:R({},o,a)})));if(yield $o(xi.setSSOState({error:void 0,[r]:!0})),e.type===op.Saml){var s,l;const e=yield jo(tp.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=hp(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 jo(tp.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield $o(xi.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield $o(xi.setSSOState({samlConfiguration:o,error:Sg(e),[r]:!1})),null==t||t(null,e)}}function*jh({payload:{callback:e}={}}){const t=yield zo((e=>e.auth.ssoState.samlConfiguration));try{yield $o(xi.setSSOState({error:void 0,saving:!0})),yield jo(tp.auth.validateSamlDomain),yield $o(xi.setSSOState({samlConfiguration:R({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield $o(xi.setSSOState({samlConfiguration:R({},t,{validated:!1}),error:Sg(n),saving:!1})),null==e||e(null,n)}}function*Bh(){try{const e=yield jo(tp.auth.getSamlRoles),t=yield jo(tp.auth.getSamlRolesGroups);yield $o(xi.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield $o(xi.setSSOState({error:Sg(e)}))}}function*Wh({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield $o(xi.setSSOState({error:void 0,saving:!0})),yield jo(tp.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Vo(e.map((e=>jo(tp.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield $o(xi.setSSOState({error:Sg(e)}))}}(n)),yield Bh(),yield $o(xi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield $o(xi.setSSOState({error:Sg(t),saving:!1})),null==e||e(null,t)}}function*zh({payload:{callback:e,id:t}}){try{yield $o(xi.setSSOState({error:void 0,saving:!0})),yield jo(tp.auth.deleteSamlGroup,{id:t}),yield Bh(),yield $o(xi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield $o(xi.setSSOState({error:Sg(t),saving:!1})),null==e||e(null,t)}}function*Kh({payload:{group:e,roleIds:t,callback:n}}){try{yield $o(xi.setSSOState({error:void 0,saving:!0})),yield jo(tp.auth.createSamlGroup,{group:e,roleIds:t}),yield Bh(),yield $o(xi.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield $o(xi.setSSOState({error:Sg(e),saving:!1})),null==n||n(null,e)}}function*Hh({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield $o(xi.setSSOState({loading:!0})),yield jo(tp.auth.oidcPostLoginV2,t),yield jo(Kv),yield $o(xi.setSSOState({loading:!1}))}catch(e){yield $o(xi.setSSOState({loading:!1,error:Sg(e,"Failed to authenticate"),firstLoad:!1}))}}function*qh(){yield Fa(xi.loadSSOConfigurations,Gh),yield Fa(xi.saveSSOConfigurations,xh),yield Fa(xi.saveSSOConfigurationsFile,$h),yield Fa(xi.saveSSOConfigurationsFileWithCallback,Vh),yield Fa(xi.validateSSODomain,jh),yield Fa(xi.loadSSOAuthorizationRoles,Bh),yield Fa(xi.updateSSOAuthorizationRoles,Wh),yield Fa(xi.deleteSamlGroup,zh),yield Fa(xi.createSamlGroup,Kh),yield Fa(xi.oidcPostlogin,Hh)}function*Jh(){yield $o(xi.setSSOState({loading:!0})),yield Et(),yield $o(xi.setSSOState({samlConfiguration:Rp,loading:!1,firstLoad:!1}))}function*Yh({payload:e}){const t="saving";yield $o(xi.setSSOState({error:void 0,[t]:!0}));const n=R({},yield zo((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield $o(xi.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Qh({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=eo(e,Fh),r=Fp.samlConfiguration,s=R({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield $o(xi.setSSOState({samlConfiguration:R({},r,s)})));yield $o(xi.setSSOState({error:void 0,[l]:!0})),yield Et(),s.acsUrl=null==Np||null==(t=Np.configuration)?void 0:t.acsUrl,s.spEntityId=null==Np||null==(n=Np.configuration)?void 0:n.spEntityId;const c=hp(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 $o(xi.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*Xh({payload:{callback:e}={}}){const t=Fp.samlConfiguration;yield $o(xi.setSSOState({error:void 0,saving:!0})),yield Et(),yield $o(xi.setSSOState({samlConfiguration:R({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Zh(){yield Et(),yield $o(xi.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*em({payload:{callback:e,authorizationRoles:t}}){yield $o(xi.setSSOState({error:void 0,saving:!0})),yield Et(),yield $o(xi.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*tm(){yield Fa(xi.loadSSOConfigurations,Jh),yield Fa(xi.saveSSOConfigurations,Qh),yield Fa(xi.saveSSOConfigurationsFile,Yh),yield Fa(xi.validateSSODomain,Xh),yield Fa(xi.loadSSOAuthorizationRoles,Zh),yield Fa(xi.updateSSOAuthorizationRoles,em)}const nm=["callback"],im=["callback","ssoConfigId"],om=["callback","ssoConfigId"],am=["callback","ssoConfigId"];function*rm(){try{return yield jo(tp.auth.getOidcConfiguration)}catch(e){return null}}function*sm(){try{return yield jo(tp.metadata.getSamlMetadata)}catch(e){return null}}function*lm(){try{yield $o(xi.setSSOLoader({key:ip.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Vo([jo(rm),jo(sm)]),n=yield jo(tp.auth.getSSOConfigurations);yield $o(xi.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield $o(xi.setSSOError({key:ip.LOAD_SSO_CONFIGURATIONS,value:Sg(e)}))}finally{yield $o(xi.setSSOLoader({key:ip.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*cm({payload:e}){yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=eo(e,nm),i=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield jo(tp.auth.createSSOConfiguration,R({},n,{enabled:null!=(o=n.enabled)&&o}));yield $o(xi.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield $o(xi.setSSOError({key:ip.SAVE_SSO_CONFIGURATION,value:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION,value:!1}))}}function*um({payload:e}){yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield bp(t),o=yield jo(tp.auth.createSSOConfigurationByMetadata,{metadata:e});yield $o(xi.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield $o(xi.setSSOError({key:ip.SAVE_SSO_CONFIGURATION_BY_METADATA,value:Sg(e)})),null==n||n(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*dm({payload:e}){yield $o(xi.setSSOLoader({key:ip.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=eo(e,im),o=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield jo(tp.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield $o(xi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield $o(xi.setSSOError({key:ip.UPDATE_SSO_CONFIGURATION,value:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*ym({payload:e}){yield $o(xi.setSSOLoader({key:ip.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield bp(i),a=yield jo(tp.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield $o(xi.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield $o(xi.setSSOError({key:ip.UPDATE_SSO_CONFIGURATION,value:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*fm({payload:e}){yield $o(xi.setSSOLoader({key:ip.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{yield jo(tp.auth.deleteSSOConfiguration,t),yield $o(xi.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield $o(xi.setSSOError({key:ip.DELETE_SSO_CONFIGURATION,value:Sg(e)})),null==n||n(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.DELETE_SSO_CONFIGURATION,value:!1}))}}function*pm({payload:e}){const{callback:t,ssoConfigId:n}=e,i=eo(e,om);yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_DOMAIN,value:!0}));const o=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield jo(tp.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?R({},t,{domains:[...t.domains,e]}):t));yield $o(xi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield $o(xi.setSSOError({key:ip.SAVE_SSO_DOMAIN,value:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_DOMAIN,value:!1}))}}function*gm({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield $o(xi.setSSOLoader({key:ip.DELETE_SSO_DOMAIN,value:!0}));const o=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{yield jo(tp.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?R({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield $o(xi.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield $o(xi.setSSOError({key:ip.DELETE_SSO_DOMAIN,value:Sg(e)})),null==i||i(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.DELETE_SSO_DOMAIN,value:!1}))}}function*Sm({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield $o(xi.setSSOLoader({key:ip.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{yield jo(tp.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?R({},e,{domains:e.domains.map((e=>e.id===n?R({},e,{validated:!0}):e))}):e));yield $o(xi.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield $o(xi.setSSOError({key:ip.VALIDATE_SSO_DOMAIN,value:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.VALIDATE_SSO_DOMAIN,value:!1}))}}function*vm({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield $o(xi.setSSOLoader({key:ip.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{yield jo(tp.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?R({},e,{roleIds:n}):e));yield $o(xi.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield $o(xi.setSSOError({key:ip.UPDATE_SSO_DEFAULT_ROLES,value:Sg(t)})),null==e||e(null,t)}finally{yield $o(xi.setSSOLoader({key:ip.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*hm({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_GROUPS,value:!0}));const o=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{yield Vo(t.map((e=>jo(tp.auth.deleteSSOGroup,n,e)))),yield Vo(e.map((e=>jo(tp.auth.createSSOGroup,n,e))));const a=yield jo(tp.auth.getSSOGroups,n),r=o.map((e=>e.id===n?R({},e,{groups:a}):e));yield $o(xi.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield $o(xi.setSSOError({key:ip.SAVE_SSO_GROUPS,value:Sg(e)})),null==i||i(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_GROUPS,value:!1}))}}function*mm({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Vo(t.map((t=>jo(tp.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield $o(xi.setSSOError({key:ip.SAVE_SSO_GROUPS,value:Sg(e)})),null==n||n(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_GROUPS,value:!1}))}}function*Am({payload:e}){yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,s;i?(r=yield jo(tp.auth.updateSSOConfigurationByMetadataUrl,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield jo(tp.auth.createSSOConfigurationByMetadataUrl,e),s=[r,...a]),yield $o(xi.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*bm({payload:e}){yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=eo(e,am),o=yield zo((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield jo(tp.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield jo(tp.auth.createSSOConfiguration,i),a=[e,...o]),yield $o(xi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield $o(xi.setSSOLoader({key:ip.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Tm(){yield Fa(xi.loadSSOConfigurationsV2,lm),yield Fa(xi.saveSSOConfigurationV2,cm),yield Fa(xi.saveSSODomain,pm),yield Fa(xi.deleteSSODomain,gm),yield Fa(xi.validateSSODomainV2,Sm),yield Fa(xi.updateSSOConfiguration,dm),yield Fa(xi.deleteSSOConfiguration,fm),yield Fa(xi.setSSOGroups,hm),yield Fa(xi.updateSSOGroups,mm),yield Fa(xi.setSSODefaultRoles,vm),yield Fa(xi.saveSSOConfigurationByMetadata,um),yield Fa(xi.updateSSOConfigurationByMetadata,ym),yield Fa(xi.saveSSOConfigurationByUrl,Am),yield Fa(xi.saveSSOConfigurationByData,bm)}const Em=["callback","profilePictureUrl"],km=["callback","profilePictureUrl"];function*Om(){yield $o(xi.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 jo.apply(void 0,[Ma,e,t,n].concat(o))}(3,2e3,tp.teams.getProfile),t=yield zo((e=>e.auth.user));xi.setUser(R({},t,e)),yield $o(xi.setProfileState({profile:e,loading:!1}))}catch(e){yield $o(xi.setProfileState({loading:!1,error:Sg(e)}))}}function*Im(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=eo(e.payload,Em);yield $o(xi.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield zo((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 jo(tp.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=R({},e,i,{profilePictureUrl:o}),r=yield jo(tp.users.updateUserProfileV2,a),s=yield zo((e=>e.auth.user));yield $o(xi.setUser(R({},s,r))),yield $o(xi.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield $o(xi.setProfileState({saving:!1,error:Sg(e),loading:!1})),null==t||t(null,e)}}function*Pm({payload:e}){yield $o(xi.setProfileState({loading:!0}));try{var t;yield jo(tp.teams.changePassword,e),yield $o(xi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $o(xi.setProfileState({loading:!1,error:Sg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*_m(){yield $a(xi.loadProfile,Om),yield Fa(xi.saveProfile,Im),yield Fa(xi.changePassword,Pm)}function*Lm(){yield $o(xi.setProfileState({loading:!0})),yield Et(),yield $o(xi.setUser(R({},Pp,Ip))),yield $o(xi.setProfileState({loading:!1,profile:Ip}))}function*wm(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=eo(e.payload,km);yield $o(xi.setProfileState({saving:!0,error:null}));const o=_p;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=R({},o.profile,i,{profilePictureUrl:a}),s=Pp;yield Et(),yield $o(xi.setUser(R({},s,r))),yield $o(xi.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Um({payload:e}){var t;yield $o(xi.setProfileState({loading:!0})),yield Et(),yield $o(xi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Cm(){yield $a(xi.loadProfile,Lm),yield Fa(xi.saveProfile,wm),yield Fa(xi.changePassword,Um)}const Dm=["callback"],Rm=["callback"],Nm=["user"],Mm=["callback"],Fm=["deviceId","callback"],Gm=["deviceId","callback"],$m=["callback"],Vm=["deviceId"],xm=["deviceId"],jm=["callback"],Bm=["deviceId"],Wm=["callback"];function*zm(e){const{step:t}=yield zo((e=>e.auth.mfaState));return{step:e.recoveryCode?cn.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Km(){yield $o(xi.setMfaState({saving:!0}));try{const{qrCode:e}=yield jo(tp.auth.enrollMfa);yield $o(xi.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield $o(xi.setMfaState({saving:!1,error:Sg(e)}))}}function*Hm(e){let{payload:{callback:t}}=e,n=eo(e.payload,Dm);yield $o(xi.setMfaState({saving:!0}));try{const e=yield zo((e=>e.auth.user)),i=yield jo(tp.auth.verifyMfa,n),o=yield jo(tp.auth.getMFADevices),a=yield zm(i);yield $o(xi.setMfaState(R({},a,{mfaDevices:o}))),yield $o(xi.setUser(R({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*qm(e){let{payload:{callback:t}}=e,n=eo(e.payload,Rm);yield $o(xi.setMfaState({loading:!0}));try{const e=yield jo(tp.auth.loginWithMfaV2,n),{user:i}=e,o=eo(e,Nm),a={step:cn.recoveryCode,loading:!1,saving:!1,error:void 0};null!=i&&i.recoveryCode&&(a.recoveryCode=i.recoveryCode),yield $o(xi.setMfaState(a)),yield HS(R({user:i},o)),null==t||t(a.recoveryCode)}catch(e){yield $o(xi.setMfaState({loading:!1,error:Sg(e)})),null==t||t(null,e)}}function*Jm({payload:e}){yield $o(xi.setMfaState({saving:!0}));try{var t;yield jo(tp.auth.disableMfa,e);const n=yield jo(tp.auth.getMFADevices);yield $o(xi.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $o(xi.setMfaState({saving:!1,error:Sg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Ym({payload:e}){yield $o(xi.setMfaState({saving:!0}));try{var t,n;const i=yield jo(tp.auth.preEnrollMFAWebAuthn),o=R({},i.options,{challenge:It(i.options.challenge),user:R({},i.options.user,{id:It(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>R({},e,{id:It(e.id)})))});yield $o(xi.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield $o(xi.setMfaState({saving:!1,error:Sg(t)})),null==(i=e.callback)||i.call(e,null,t)}}function*Qm(e){let{payload:{callback:t}}=e,n=eo(e.payload,Mm);yield $o(xi.setMfaState({saving:!0}));try{const e=Pt(n.publicKey),i=yield jo(tp.auth.enrollMFAWebAuthn,R({},n,{options:e})),o=yield jo(tp.auth.getMFADevices),a=yield zm(i);yield $o(xi.setMfaState(R({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*Xm(e){let{payload:{deviceId:t,callback:n}}=e;eo(e.payload,Fm),yield $o(xi.setMfaState({saving:!0}));try{var i;const e=yield jo(tp.auth.preDisableMFAWebAuthn,t),o=R({},e.options,{challenge:It(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>R({},e,{id:It(e.id)})))});yield $o(xi.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==n||n(null,e)}}function*Zm(e){let{payload:{deviceId:t,callback:n}}=e,i=eo(e.payload,Gm);yield $o(xi.setMfaState({saving:!0}));try{const e=Pt(i.publicKey);yield jo(tp.auth.disableMFAWebAuthn,t,R({},i,{options:e}));const o=yield jo(tp.auth.getMFADevices);yield $o(xi.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==n||n(!1,e)}}function*eA({payload:e}){yield $o(xi.setMfaState({saving:!0}));try{var t;const n=yield jo(tp.auth.preEnrollMFASMS,e);yield $o(xi.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 $o(xi.setMfaState({saving:!1,error:Sg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*tA(e){let{payload:{callback:t}}=e,n=eo(e.payload,$m);yield $o(xi.setMfaState({saving:!0}));try{const e=yield jo(tp.auth.enrollMFASMS,n),i=yield jo(tp.auth.getMFADevices),o=yield zm(e);yield $o(xi.setMfaState(R({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*nA(e){let{payload:{deviceId:t}}=e,n=eo(e.payload,Vm);yield $o(xi.setMfaState({saving:!0}));try{var i;const e=yield jo(tp.auth.preDisableMFASMS,t);yield $o(xi.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 $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*iA(e){let{payload:{deviceId:t}}=e,n=eo(e.payload,xm);yield $o(xi.setMfaState({saving:!0}));try{var i;yield jo(tp.auth.disableMFASMS,t,n);const e=yield jo(tp.auth.getMFADevices);yield $o(xi.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*oA(){yield $o(xi.setMfaState({loading:!0}));try{yield zo((e=>e.auth.user));const e=yield jo(tp.auth.getMFADevices);yield $o(xi.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield $o(xi.setMfaState({loading:!1,error:Sg(e)}))}}function*aA(){yield $o(xi.setMfaState({loading:!0}));try{const e=(yield jo(tp.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield $o(xi.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield $o(xi.setMfaState({loading:!1,error:Sg(e)}))}}function*rA(){yield Fa(xi.enrollMfa,Km),yield Fa(xi.getMFADevices,oA),yield Fa(xi.getMFAStrategies,aA),yield Fa(xi.verifyMfa,Hm),yield Fa(xi.disableMfa,Jm),yield Fa(xi.verifyMfaAfterForce,qm),yield Fa(xi.preDisableMfaSms,nA),yield Fa(xi.disableMfaSms,iA),yield Fa(xi.preEnrollMfaSms,eA),yield Fa(xi.enrollMfaSms,tA),yield Fa(xi.preEnrollMfaWebAuthn,Ym),yield Fa(xi.enrollMfaWebAuthn,Qm),yield Fa(xi.preDisableMfaWebAuthn,Xm),yield Fa(xi.disableMfaWebAuthn,Zm)}function*sA(){yield $o(xi.setMfaState({saving:!0})),yield $o(xi.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*lA({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield zo((e=>e.auth.mfaState));yield $o(xi.setMfaState({saving:!0})),yield Et();const n={token:"token",recoveryCode:"recoveryCode"},i={step:cn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:R({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield $o(xi.setMfaState(i)),yield $o(xi.setUser(R({},Pp,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*cA(e){let{payload:{callback:t}}=e,n=eo(e.payload,jm);yield $o(xi.setMfaState({loading:!0})),yield Et();const i=R({},n,{recoveryCode:"recoveryCode"}),o={step:cn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield $o(xi.setMfaState(o)),yield Et(),yield $o(xi.setUser(R({},Pp,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*uA({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield zo((e=>e.auth.mfaState));yield $o(xi.setMfaState({saving:!0})),yield Et(),yield $o(xi.setMfaState({saving:!1,error:void 0,mfaDevices:R({},n,{authenticators:[]})})),yield $o(xi.setUser(R({},Pp))),null==(t=e.callback)||t.call(e,!0)}function*dA(e){let{}=e,t=eo(e.payload,Bm);yield $o(xi.setMfaState({saving:!0}));try{var n;yield $o(xi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield $o(xi.setMfaState({saving:!1,error:Sg(e)})),null==(i=t.callback)||i.call(t,!1,e)}}function*yA({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield zo((e=>e.auth.mfaState));yield $o(xi.setMfaState({saving:!0})),yield Et(),yield $o(xi.setMfaState({loading:!1,error:void 0,mfaDevices:R({},n,{phones:[]})})),yield $o(xi.setUser(R({},Pp))),null==(t=e.callback)||t.call(e,!0)}function*fA({payload:e}){var t;yield $o(xi.setMfaState({saving:!0})),yield Et(),yield $o(xi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*pA(e){let{payload:{callback:t}}=e;eo(e.payload,Wm);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield zo((e=>e.auth.mfaState));yield $o(xi.setMfaState({saving:!0})),yield Et();const i={token:"token",recoveryCode:"recoveryCode"},o={step:cn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:R({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield $o(xi.setMfaState(o)),yield $o(xi.setUser(R({},Pp,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*gA(){yield Fa(xi.enrollMfa,sA),yield Fa(xi.verifyMfa,lA),yield Fa(xi.disableMfa,uA),yield Fa(xi.verifyMfaAfterForce,cA),yield Fa(xi.preDisableMfaSms,dA),yield Fa(xi.disableMfaSms,yA),yield Fa(xi.preEnrollMfaSms,fA),yield Fa(xi.enrollMfaSms,pA)}const SA=["callback"];function*vA({payload:e}){yield $o(xi.setForgotPasswordState({loading:!0}));try{var t;yield jo(tp.auth.forgotPassword,e),yield $o(xi.setForgotPasswordState({loading:!1,error:void 0,step:qt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $o(xi.setForgotPasswordState({loading:!1,error:Sg(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*hA(e){let{payload:{callback:t}}=e,n=eo(e.payload,SA);yield $o(xi.setForgotPasswordState({loading:!0}));try{yield jo(tp.auth.resetPassword,n),yield $o(xi.setForgotPasswordState({loading:!1,error:void 0,step:qt.success})),null==t||t(!0)}catch(e){yield $o(xi.setForgotPasswordState({loading:!1,error:Sg(e)})),null==t||t(!1,e)}}function*mA({payload:e}){yield $o(xi.setForgotPasswordState({loading:!0}));try{const t=yield jo(tp.auth.loadPasswordConfig,e);yield $o(xi.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield $o(xi.setForgotPasswordState({loading:!1,error:Sg(e)}))}}function*AA(){yield $a(xi.forgotPassword,vA),yield $a(xi.resetPassword,hA),yield $a(xi.loadPasswordConfig,mA)}let bA;!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"}(bA||(bA={}));const TA=["callback","events"],EA=["user"],kA=["callback"],OA=["callback"];function*IA({payload:{userId:e,token:t}}){yield $o(xi.setActivateState({loading:!0,step:Vt.activating}));try{const{isAuthenticated:n}=yield zo((e=>e.auth));n&&(yield $o(xi.silentLogout()));const i=yield jo(tp.auth.getActivateAccountStrategy,{userId:e,token:t});yield $o(xi.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield $o(xi.setActivateState({loading:!1,step:Vt.activatingForm})))}catch(e){yield $o(xi.setActivateState({loading:!1,error:Sg(e)}))}}function*PA(e){let{payload:{callback:t,events:n}}=e,i=eo(e.payload,TA);yield $o(xi.setActivateState({loading:!0}));try{const e=Va.onRedirectTo,{routes:a}=yield zo((e=>e.auth)),r=yield jo(tp.auth.activateAccountV2,i),{user:s}=r,l=eo(r,EA);if(s.redirectLocation)return void(window.location.href=s.redirectLocation);if(yg(s)){yield $o(xi.setActivateState({step:Vt.success}));const t=yield gg(s);yield $o(xi.setState(t)),yield Ko(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield $o(xi.setActivateState({step:Vt.success}));const e={email:s.email,origin:rg.ACTIVATION_LINK,id:s.id,tenantId:s.tenantId,name:s.name,createdAt:new Date};null==n||null==(o=n.userVerified)||o.call(n,e),hg(vg.USER_VERIFIED,e),yield jo(HS,R({user:s},l),{isAuthenticated:!0}),yield Ko(1e3),yield XS(),yield $o(xi.resetActivateState())}null==t||t(!0)}catch(e){yield $o(xi.setActivateState({loading:!1,error:Sg(e)}))}}function*_A({payload:e}){const{callback:t}=e,n=eo(e,kA);yield $o(xi.setActivateStrategyState({loading:!0}));try{const e=yield jo(tp.auth.getActivateAccountStrategy,n);yield $o(xi.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield $o(xi.setActivateStrategyState({loading:!1,error:Sg(e)}))}}function*LA({payload:e}){const{callback:t}=e,n=eo(e,OA);yield $o(xi.setTeamLoader({key:bA.RESEND_ACTIVATE_LINK,value:n.email})),yield $o(xi.setActivateState({loading:!0}));try{yield jo(tp.auth.resendActivationEmail,n),yield $o(xi.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield $o(xi.setActivateState({loading:!1,error:Sg(e)})),yield $o(xi.setTeamError({key:bA.RESEND_ACTIVATE_LINK,value:Sg(e)})),null==t||t(null,e)}yield $o(xi.setTeamLoader({key:bA.RESEND_ACTIVATE_LINK,value:!1}))}function*wA(){yield $a(xi.activateAccount,PA),yield $a(xi.preActivateAccount,IA),yield $a(xi.getActivateAccountStrategy,_A),yield $a(xi.resendActivationEmail,LA)}function*UA({payload:e}){if(e.token&&e.userId)try{yield $o(xi.setAcceptInvitationState({error:void 0,step:Wt.pending})),yield jo(tp.auth.acceptInvitation,e),yield $o(xi.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Wt.success}}))}catch(e){yield $o(xi.setAcceptInvitationState({step:Wt.failed,error:Sg(e)}))}else yield $o(xi.setAcceptInvitationState({error:void 0,step:Wt.invalid}))}function*CA(){yield $a(xi.acceptInvitation,UA)}var DA,RA=new Uint8Array(16);function NA(){if(!DA&&!(DA="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 DA(RA)}for(var MA=/^(?:[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,FA=function(e){return"string"==typeof e&&MA.test(e)},GA=[],$A=0;$A<256;++$A)GA.push(($A+256).toString(16).substr(1));var VA=function(e,t,n){var i=(e=e||{}).random||(e.rng||NA)();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=(GA[e[t+0]]+GA[e[t+1]]+GA[e[t+2]]+GA[e[t+3]]+"-"+GA[e[t+4]]+GA[e[t+5]]+"-"+GA[e[t+6]]+GA[e[t+7]]+"-"+GA[e[t+8]]+GA[e[t+9]]+"-"+GA[e[t+10]]+GA[e[t+11]]+GA[e[t+12]]+GA[e[t+13]]+GA[e[t+14]]+GA[e[t+15]]).toLowerCase();if(!FA(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let xA,jA;!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"}(xA||(xA={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(jA||(jA={}));const BA=["callback"],WA=["roles"],zA=["callback"],KA=["callback","profileImage"],HA=["callback"],qA=["callback","userId"],JA=["callback"],YA=["callback"],QA=["callback"],XA=["callback"],ZA=["callback"],eb=["callback"],tb=["callback"],nb=["callback","profileImage"],ib=["callback"],ob=["callback"],ab=["callback"],rb=["callback"],sb=["callback"],lb=["callback"],cb=()=>zo((e=>e.auth.teamState));function*ub(){try{const{groups:e}=yield jo(tp.groups.getGroups,{_groupsRelations:jA.roles});return e}catch(e){return[]}}function*db({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield cb(),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 $o(xi.setTeamLoader({key:bA.USERS,value:!r})),yield $o(xi.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([jo(tp.users.getUsersV2,R({},(null==d?void 0:d.length)&&{_filter:d},y&&{_sortBy:y},e.order&&{_order:e.order},{_offset:u,_limit:c,_includeSubTenants:f})),jo(tp.teams.loadAvailableRoles),jo(tp.teams.loadAvailablePermissions),jo(ub)]),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 R({},e,{groups:n})}));yield $o(xi.setTeamState({users:l.map((e=>R({},e,{roleIds:e.roles.map((e=>e.id))}))),totalPages:n,totalItems:i,roles:o,permissions:a})),null==s||s(t)}catch(e){yield $o(xi.setTeamError({key:bA.USERS,value:Sg(e)})),yield $o(xi.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield $o(xi.setTeamLoader({key:bA.USERS,value:!1}))}function*yb({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield cb(),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 $o(xi.setTeamLoader({key:bA.USERS,value:!a})),yield $o(xi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield Vo([jo(tp.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),jo(tp.teams.loadAvailableRoles),jo(tp.teams.loadAvailablePermissions)]);yield $o(xi.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield $o(xi.setTeamError({key:bA.USERS,value:e.message})),yield $o(xi.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield $o(xi.setTeamLoader({key:bA.USERS,value:!1}))}function*fb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield cb(),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 $o(xi.setTeamLoader({key:bA.USERS,value:!r})),yield $o(xi.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield Vo([jo(tp.subTenants.loadAllUsers,R({},c)),jo(tp.teams.loadAvailableRoles),jo(tp.teams.loadAvailablePermissions)]);yield $o(xi.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield $o(xi.setTeamError({key:bA.USERS,value:Sg(e)})),yield $o(xi.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield $o(xi.setTeamLoader({key:bA.USERS,value:!1}))}function*pb({payload:e}){yield $o(xi.setTeamLoader({key:bA.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield Vo([jo(tp.teams.loadAvailableRoles),jo(tp.teams.loadAvailablePermissions)]);yield $o(xi.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 $o(xi.setTeamError({key:bA.ROLES_AND_PERMISSIONS,value:Sg(t)}))}yield $o(xi.setTeamLoader({key:bA.ROLES_AND_PERMISSIONS,value:!0}))}function*gb({payload:e}){const{callback:t}=e,n=eo(e,BA),i=yield cb();yield $o(xi.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield jo(tp.teams.addUser,n),{roles:a}=e,r=R({},eo(e,WA),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield $o(xi.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield $o(xi.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!1,error:Sg(e)})})),null==t||t(null,e)}}function*Sb({payload:e}){const{callback:t}=e,n=yield cb();yield $o(xi.setTeamState({addUserDialogState:R({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield $o(xi.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield jo(tp.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 $o(xi.loadUsersV2(r)),yield $o(xi.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*vb({payload:e}){const{callback:t}=e,n=eo(e,zA),i=yield cb();yield $o(xi.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!0})}));try{yield jo(tp.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield jo(tp.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield $o(xi.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield $o(xi.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!1,error:Sg(e)})})),null==t||t(null,e)}}function*hb({payload:e}){const{callback:t}=e,n=eo(e,KA),{id:i}=n,o=yield cb(),a=o.users.find((e=>e.id===n.id));yield $o(xi.setTeamLoader({key:bA.UPDATE_USER,value:i||""})),yield $o(xi.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!0})})),yield $o(xi.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?R({},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 jo(tp.teams.updateUser,n);null==t||t(e),yield $o(xi.setTeamState({users:o.users.map((t=>t.id===e.id?R({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield $o(xi.setTeamLoader({key:bA.UPDATE_USER,value:!1}))}catch(e){yield $o(xi.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!1,error:Sg(e)}),users:o.users.map((e=>e.id===n.id?R({},e,a):e))})),yield $o(xi.setTeamLoader({key:bA.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*mb({payload:e}){const{callback:t}=e,n=eo(e,HA),i=yield cb();yield $o(xi.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!0})}));try{yield jo(tp.teams.deleteUser,n),null==t||t(!0),yield $o(xi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield $o(xi.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!1,error:Sg(e)})})),null==t||t(null,e)}}function*Ab({payload:e}){const{callback:t,userId:n}=e,i=eo(e,qA),o=yield cb();yield $o(xi.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!0})}));try{yield jo(tp.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return R({},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 $o(xi.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[R({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield $o(xi.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!1,error:Sg(e)})})),null==t||t(null,e)}}function*bb({payload:e}){const{callback:t}=e,n=eo(e,JA),i=yield cb();yield $o(xi.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!0})}));try{yield jo(tp.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield $o(xi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield $o(xi.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!1,error:Sg(e)})})),null==t||t(null,e)}}function*Tb({payload:e}){const{callback:t}=e,n=eo(e,YA);yield $o(xi.setTeamLoader({key:bA.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield jo(tp.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield $o(xi.setTeamError({key:bA.RESEND_ACTIVATE_LINK,value:Sg(e)})),null==t||t(null,e)}yield $o(xi.setTeamLoader({key:bA.RESEND_ACTIVATE_LINK,value:!1}))}function*Eb({payload:e}){const{callback:t}=e,n=eo(e,QA);yield $o(xi.setTeamLoader({key:bA.RESEND_INVITATION_LINK,value:n.email}));try{yield jo(tp.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield $o(xi.setTeamError({key:bA.RESEND_INVITATION_LINK,value:Sg(e)})),null==t||t(null,e)}yield $o(xi.setTeamLoader({key:bA.RESEND_INVITATION_LINK,value:!1}))}function*kb({payload:e}){const{callback:t}=e,n=eo(e,XA);yield $o(xi.setTeamLoader({key:bA.RESEND_INVITATION_LINK,value:n.email}));try{yield jo(tp.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield $o(xi.setTeamError({key:bA.RESEND_INVITATION_LINK,value:Sg(e)})),null==t||t(null,e)}yield $o(xi.setTeamLoader({key:bA.RESEND_INVITATION_LINK,value:!1}))}function*Ob({payload:e}){const{callback:t}=e,n=eo(e,ZA);yield $o(xi.setTeamLoader({key:bA.RESEND_INVITATION_LINK,value:n.email}));try{yield jo(tp.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield $o(xi.setTeamError({key:bA.RESEND_INVITATION_LINK,value:Sg(e)})),null==t||t(null,e)}yield $o(xi.setTeamLoader({key:bA.RESEND_INVITATION_LINK,value:!1}))}function*Ib(){yield $o(xi.setTeamError({key:bA.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield jo(tp.teams.getInviteLinkConfiguration);yield $o(xi.setTeamState({inviteTokenState:R({},e)}))}catch(e){yield $o(xi.setTeamError({key:bA.CONFIG_TOKEN_LINK,value:Sg(e)}))}}function*Pb(){yield $o(xi.setTeamError({key:bA.GET_TOKEN_LINK,value:!1}));try{yield jo(Ib);const e=yield jo(tp.teams.getInviteUserLink),{inviteTokenState:t}=yield cb();yield $o(xi.setTeamState({inviteTokenState:R({},t,e)}))}catch(e){yield $o(xi.setTeamError({key:bA.GET_TOKEN_LINK,value:Sg(e)}))}}function*_b({payload:{callback:e}}){yield $o(xi.setTeamError({key:bA.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield cb();try{const n=yield jo(tp.teams.createInviteUserLink,{expiresInMinutes:43200});yield $o(xi.setTeamState({inviteTokenState:R({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield $o(xi.setTeamError({key:bA.CREATE_TOKEN_LINK,value:Sg(t)}))}}function*Lb({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield cb();yield $o(xi.setTeamError({key:bA.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield jo(tp.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield $o(xi.setTeamState({inviteTokenState:R({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield $o(xi.setTeamError({key:bA.UPDATE_TOKEN_LINK,value:Sg(t)}))}}function*wb({payload:e}){const{callback:t}=null!=e?e:{};yield $o(xi.setTeamError({key:bA.DELETE_TOKEN_LINK,value:!1}));try{yield jo(tp.teams.deleteInviteUserLink),yield $o(xi.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield $o(xi.setTeamError({key:bA.DELETE_TOKEN_LINK,value:Sg(e)})),null==t||t(!1,e)}}function*Ub({payload:e}){yield $o(xi.setTeamState({addUserDialogState:R({open:!0,loading:!1,error:!1},e)}))}function*Cb({payload:e}){const t=yield cb(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield $o(xi.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Db({payload:e}){yield $o(xi.setTeamState({deleteUserDialogState:R({open:!0,loading:!1,error:!1},e)}))}function*Rb({payload:e}){const t=yield cb(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield $o(xi.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Nb(){yield Ga(xi.loadUsers,yb),yield Ga(xi.loadUsersV2,db),yield Ga(xi.loadAllSubTenantsUsers,fb),yield Ga(xi.loadRoles,pb),yield Fa(xi.addUser,gb),yield Fa(xi.addUsersBulk,Sb),yield Fa(xi.addUserToSubTenants,vb),yield Fa(xi.updateUser,hb),yield Fa(xi.setUserRolesForSubTenants,Ab),yield Fa(xi.deleteUser,mb),yield Fa(xi.deleteUserFromSubTenants,bb),yield Fa(xi.resendActivationLink,Tb),yield Fa(xi.resendInvitationLink,Eb),yield Fa(xi.resendInvitationEmail,kb),yield Fa(xi.resendInvitationLinkToAllSubTenants,Ob),yield Fa(xi.getInvitationLink,Pb),yield Fa(xi.createInvitationLink,_b),yield Fa(xi.updateInvitationLink,Lb),yield Fa(xi.deleteInvitationLink,wb),yield Fa(xi.openAddUserDialog,Ub),yield Fa(xi.closeAddUserDialog,Cb),yield Fa(xi.openDeleteUserDialog,Db),yield Fa(xi.closeDeleteUserDialog,Rb)}function*Mb({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield cb(),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 $o(xi.setTeamLoader({key:bA.USERS,value:!a})),yield $o(xi.setTeamState({pageSize:l,pageOffset:c,filterV2:u,sortV2:d})),yield Et(),yield $o(xi.setTeamState({users:Wp,totalPages:2,totalItems:10,roles:Mp,permissions:Gp})),yield $o(xi.setTeamLoader({key:bA.USERS,value:!1})),null==r||r(Wp)}function*Fb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield cb(),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 $o(xi.setTeamLoader({key:bA.USERS,value:!r})),yield $o(xi.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield Et(),yield $o(xi.setTeamState({allUsers:Kp,totalPages:2,totalItems:10,roles:Mp,permissions:Gp})),yield $o(xi.setTeamLoader({key:bA.USERS,value:!1})),null==s||s(Kp)}function*Gb({payload:e}){var t;yield $o(xi.setTeamLoader({key:bA.ROLES_AND_PERMISSIONS,value:!0})),yield Et(),yield $o(xi.setTeamState({roles:Mp,permissions:Gp})),yield $o(xi.setTeamLoader({key:bA.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Mp,permissions:Gp})}function*$b({payload:e}){const{callback:t}=e,n=eo(e,eb),i=yield cb();yield $o(xi.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!0})})),yield Et();const o=R({},xp,{groups:[]},n,{id:`${VA()}`});null==t||t(o),yield $o(xi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Vb({payload:e}){const{callback:t}=e,n=eo(e,tb),i=yield cb();yield $o(xi.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!0})})),yield Et();const o=R({},xp,n,{id:`${VA()}`});yield $o(xi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*xb({payload:e}){var t;const{callback:n}=e,i=eo(e,nb),{id:o}=i,a=yield cb(),r=a.users.find((e=>e.id===i.id));yield $o(xi.setTeamLoader({key:bA.UPDATE_USER,value:o||""})),yield $o(xi.setTeamState({addUserDialogState:R({},a.addUserDialogState,{loading:!0})})),yield $o(xi.setTeamState({addUserDialogState:R({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?R({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield Et();const s=R({},r,i);null==n||n(s),yield $o(xi.setTeamState({users:a.users.map((e=>e.id===s.id?R({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield $o(xi.setTeamLoader({key:bA.UPDATE_USER,value:!1}))}function*jb({payload:e}){const{callback:t}=e,n=eo(e,ib),i=yield cb();yield $o(xi.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield $o(xi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Bb({payload:e}){const{callback:t}=e,n=eo(e,ob),i=yield cb();yield $o(xi.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield $o(xi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Wb({payload:e}){const{callback:t}=e,n=eo(e,ab);yield $o(xi.setTeamLoader({key:bA.RESEND_ACTIVATE_LINK,value:n.userId})),yield Et(),null==t||t(!0),yield $o(xi.setTeamLoader({key:bA.RESEND_ACTIVATE_LINK,value:!1}))}function*zb({payload:e}){const{callback:t}=e,n=eo(e,rb);yield $o(xi.setTeamLoader({key:bA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield $o(xi.setTeamLoader({key:bA.RESEND_INVITATION_LINK,value:!1}))}function*Kb({payload:e}){const{callback:t}=e,n=eo(e,sb);yield $o(xi.setTeamLoader({key:bA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield $o(xi.setTeamLoader({key:bA.RESEND_INVITATION_LINK,value:!1}))}function*Hb({payload:e}){const{callback:t}=e,n=eo(e,lb);yield $o(xi.setTeamLoader({key:bA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield $o(xi.setTeamLoader({key:bA.RESEND_INVITATION_LINK,value:!1}))}function*qb(){yield Ga(xi.loadUsersV2,Mb),yield Ga(xi.loadAllSubTenantsUsers,Fb),yield Ga(xi.loadRoles,Gb),yield Fa(xi.addUser,$b),yield Fa(xi.addUserToSubTenants,Vb),yield Fa(xi.updateUser,xb),yield Fa(xi.deleteUser,jb),yield Fa(xi.deleteUserFromSubTenants,Bb),yield Fa(xi.resendActivationLink,Wb),yield Fa(xi.resendInvitationLink,zb),yield Fa(xi.resendInvitationEmail,Kb),yield Fa(xi.resendInvitationLinkToAllSubTenants,Hb),yield Fa(xi.openAddUserDialog,Ub),yield Fa(xi.closeAddUserDialog,Cb),yield Fa(xi.openDeleteUserDialog,Db),yield Fa(xi.closeDeleteUserDialog,Rb)}const Jb=["authorizationUrl"],Yb=["events","url"];function*Qb(){try{yield $o(xi.setSocialLoginsState({loading:!0}));const e=yield jo(tp.auth.getSocialLoginProviders);yield $o(xi.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield $o(xi.setSocialLoginsState({error:Sg(e),loading:!1,firstLoad:!1}))}}function*Xb(){const e=yield zo((({auth:e})=>e.isAuthenticated));let t;return t=e?yield jo(tp.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield jo(tp.auth.getSocialLoginProvidersV2),t}function*Zb(){try{const e=yield zo((e=>e.root.context));yield $o(xi.setSocialLoginsState({loading:!0}));const t=yield jo(Xb),{providers:n}=yield jo(tp.auth.getCustomSocialLoginProvidersV1),i=t.map((t=>{let{authorizationUrl:n}=t,i=eo(t,Jb);const o=_r(e,null!=n?n:"");return R({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield $o(xi.setSocialLoginsState({socialLoginsConfigV2:i,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield $o(xi.setSocialLoginsState({error:Sg(e),loading:!1,firstLoad:!1}))}}function*eT(e){let{payload:{events:t,url:n}}=e,i=eo(e.payload,Yb);try{yield $o(xi.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield jo(tp.auth.loginViaSocialLogin,i);if(r){var o,a;const r={email:e,url:n,createdAt:new Date,id:s,tenantId:l},u=R({},r,{socialProvider:i.provider,authenticationType:sg.SOCIAL_LOGIN});null==t||null==(o=t.signUpComplete)||o.call(t,u),hg(vg.SIGNUP_COMPLETED,u);const d=R({},r,{origin:rg.SOCIAL_LOGIN,name:c});null==t||null==(a=t.userVerified)||a.call(t,d),hg(vg.USER_VERIFIED,d)}s&&localStorage.setItem("userId",s),yield $o(xi.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield zo((e=>e.auth));e?yield jo(qv):yield jo(Yv)}(),localStorage.removeItem("register-quick-login"),yield $o(xi.setSocialLoginsState({loading:!1}))}catch(e){yield $o(xi.setSocialLoginsState({loading:!1,error:Sg(e,"Failed to authenticate"),firstLoad:!1}))}}function*tT({payload:e}){yield $o(xi.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*nT(){yield $a(xi.loadSocialLoginsConfiguration,Qb),yield $a(xi.loadSocialLoginsConfigurationV2,Zb),yield $a(xi.loginViaSocialLogin,eT),yield Ga(xi.setSocialLoginError,tT)}let iT;function*oT({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield zo((e=>e.auth.apiTokensState)),{policy:a}=yield zo((e=>e.auth.securityPolicyState.publicPolicy)),r=(null==a?void 0:a.machineToMachineAuthStrategy)===Oi.AccessToken;try{let e;yield $o(xi.setApiTokensLoader({key:iT.ADD_API_TOKEN,value:!0}));let a=null;n&&(a=1440*n),e=r?yield jo(tp.auth.createUserAccessToken,{description:t,expiresInMinutes:a}):yield jo(tp.auth.updateUserApiTokensData,{description:t,expiresInMinutes:a}),yield $o(xi.setApiTokensState({showAddTokenDialog:!1})),yield Ko(200),yield $o(xi.setApiTokensState({apiTokensDataUser:[R({},e,{type:r?Oi.AccessToken:Oi.ClientCredentials}),...o],successDialog:{open:!0,secret:e.secret,clientId:r?void 0:e.clientId}})),yield $o(xi.setApiTokensLoader({key:iT.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield $o(xi.setApiTokensError({key:iT.ADD_API_TOKEN,value:Sg(e)})),yield $o(xi.setApiTokensLoader({key:iT.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*aT({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield zo((e=>e.auth.apiTokensState)),{policy:r}=yield zo((e=>e.auth.securityPolicyState.publicPolicy)),s=(null==r?void 0:r.machineToMachineAuthStrategy)===Oi.AccessToken;try{let e;yield $o(xi.setApiTokensLoader({key:iT.ADD_API_TOKEN,value:!0}));let r=null;i&&(r=1440*i),e=s?yield jo(tp.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n}):yield jo(tp.auth.updateTenantApiTokensData,{description:t,roleIds:n,expiresInMinutes:r}),yield $o(xi.setApiTokensState({showAddTokenDialog:!1})),yield Ko(200),yield $o(xi.setApiTokensState({apiTokensDataTenant:[R({},e,{type:s?Oi.AccessToken:Oi.ClientCredentials}),...a],successDialog:{open:!0,secret:e.secret,clientId:s?void 0:e.clientId}})),yield $o(xi.setApiTokensLoader({key:iT.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield $o(xi.setApiTokensError({key:iT.ADD_API_TOKEN,value:Sg(e)})),yield $o(xi.setApiTokensLoader({key:iT.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*rT({payload:e}){const{apiTokensDataUser:t}=yield zo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield $o(xi.setApiTokensLoader({key:iT.DELETE_API_TOKEN,value:!0})),n?(yield jo(tp.auth.deleteUserAccessToken,{id:e}),yield $o(xi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield jo(tp.auth.deleteUserApiToken,{tokenId:e}),yield $o(xi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield $o(xi.setApiTokensLoader({key:iT.DELETE_API_TOKEN,value:!1}))}catch(e){yield $o(xi.setApiTokensError({key:iT.DELETE_API_TOKEN,value:Sg(e)})),yield $o(xi.setApiTokensLoader({key:iT.DELETE_API_TOKEN,value:!1}))}}function*sT({payload:e}){const{apiTokensDataTenant:t}=yield zo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield $o(xi.setApiTokensLoader({key:iT.DELETE_API_TOKEN,value:!0})),n?(yield jo(tp.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield jo(tp.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield $o(xi.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield $o(xi.setApiTokensLoader({key:iT.DELETE_API_TOKEN,value:!1}))}catch(e){yield $o(xi.setApiTokensError({key:iT.DELETE_API_TOKEN,value:Sg(e)})),yield $o(xi.setApiTokensLoader({key:iT.DELETE_API_TOKEN,value:!1}))}}function*lT({payload:e}){null!=e&&e.silentLoading||(yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield Vo([jo(tp.auth.getUserApiTokensData),jo(tp.auth.getTenantApiTokensData)]);yield $o(xi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $o(xi.setApiTokensError({key:iT.LOAD_API_TOKENS,value:Sg(t)})),yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*cT({payload:e}){null!=e&&e.silentLoading||(yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=jo(tp.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=jo(tp.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).map((e=>R({},e,{type:Oi.AccessToken}))).concat(a.map((e=>R({},e,{type:Oi.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield $o(xi.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield $o(xi.setApiTokensError({key:iT.LOAD_API_TOKENS,value:Sg(t)})),yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*uT({payload:e}){null!=e&&e.silentLoading||(yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=jo(tp.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=jo(tp.auth.getTenantAccessTokensData))?n:[],s=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).map((e=>R({},e,{type:Oi.AccessToken}))).concat(a.map((e=>R({},e,{type:Oi.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield $o(xi.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield $o(xi.setApiTokensError({key:iT.LOAD_API_TOKENS,value:Sg(t)})),yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*dT(){yield $a(xi.loadApiTokens,lT),yield $a(xi.loadUserApiTokens,cT),yield $a(xi.loadTenantApiTokens,uT),yield Fa(xi.addUserApiToken,oT),yield Fa(xi.addTenantApiToken,aT),yield Ga(xi.deleteTenantApiToken,sT),yield Ga(xi.deleteUserApiToken,rT)}function*yT({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield $o(xi.setApiTokensLoader({key:iT.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield zo((e=>e.auth.apiTokensState)),a=R({},kp,{description:t,roleIds:n,clientId:`CLIENT_ID_${VA()}`});yield $o(xi.setApiTokensState({showAddTokenDialog:!1})),yield Ko(200),yield $o(xi.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Ko(200),yield $o(xi.setApiTokensLoader({key:iT.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*fT({payload:e}){yield $o(xi.setApiTokensLoader({key:iT.DELETE_API_TOKEN,value:!0})),yield Ko(200);const t=[kp];yield $o(xi.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield $o(xi.setApiTokensLoader({key:iT.DELETE_API_TOKEN,value:!1}))}function*pT({payload:e}){var t;null!=e&&e.silentLoading||(yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!0})));const n=[Ep],i=[kp];yield $o(xi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Ko(200),yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*gT({payload:e}){var t;null!=e&&e.silentLoading||(yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!0})));const n=[Ep];yield $o(xi.setApiTokensState({apiTokensDataUser:n})),yield Ko(200),yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*ST({payload:e}){var t;null!=e&&e.silentLoading||(yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!0})));const n=[kp];yield $o(xi.setApiTokensState({apiTokensDataTenant:n})),yield Ko(200),yield $o(xi.setApiTokensLoader({key:iT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*vT(){yield $a(xi.loadApiTokens,pT),yield $a(xi.loadUserApiTokens,gT),yield $a(xi.loadTenantApiTokens,ST),yield Fa(xi.addTenantApiToken,yT),yield Ga(xi.deleteTenantApiToken,fT)}function*hT({payload:e}){try{var t;yield $o(xi.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield zo((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield jo(tp.accountSettings.updateSettings,R({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield $o(xi.setAccountSettingsState(R({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield $o(xi.setAccountSettingsState({loading:!1,error:Sg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*mT({payload:e}){yield $o(xi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield jo(tp.accountSettings.getSettings);yield $o(xi.setAccountSettingsState(R({},e,{loading:!1})))}catch(e){yield $o(xi.setAccountSettingsState({loading:!1,error:Sg(e)}))}}function*AT(){yield $a(xi.saveAccountSettings,hT),yield $a(xi.loadAccountSettings,mT)}function*bT({payload:e}){var t;yield $o(xi.setAccountSettingsState({loading:!0})),yield Et();const{accountSettingsState:n}=yield zo((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=R({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield $o(xi.setAccountSettingsState(R({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*TT({payload:e}){yield $o(xi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield Et(),yield $o(xi.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*ET(){yield $a(xi.saveAccountSettings,bT),yield $a(xi.loadAccountSettings,TT)}function*kT({payload:{tenantId:e,callback:t}}){yield $o(xi.setState({isLoading:!0}));try{yield jo(tp.tenants.switchTenant,{tenantId:e}),yield jo(Kv),(null==t?void 0:t(!0))||(yield $o(xi.setState({isLoading:!1})))}catch(e){yield $o(xi.setState({isLoading:!1})),null==t||t(!1,e)}}function*OT({payload:e}){yield $o(xi.setTenantsState({loading:!0}));try{var t;const n=yield jo(es());yield $o(xi.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 $o(xi.setTenantsState({loading:!1}))}}function*IT({payload:e}){yield $o(xi.setTenantsState({loading:!0}));try{var t;const n=yield jo(tp.tenants.getSubTenants);yield $o(xi.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $o(xi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*PT({payload:e}){yield $o(xi.setTenantsState({loading:!0}));try{var t;const n=yield jo(tp.tenants.getSubTenantsAsTree);yield $o(xi.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $o(xi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*_T(){yield Fa(xi.loadTenants,OT),yield Fa(xi.loadSubTenants,IT),yield Fa(xi.switchTenant,kT),yield Fa(xi.loadSubTenantsTree,PT)}function*LT(){yield $o(xi.setTenantsState({loading:!0})),yield Et(),yield $o(xi.setTenantsState({tenants:Hp,activeTenant:Hp[0],loading:!1}))}function*wT(){yield Fa(xi.loadTenants,LT)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(iT||(iT={}));const UT=["callback"],CT=["callback"],DT=["callback"],RT=["callback"],NT=["callback"];function*MT({payload:e}){var t;yield $o(xi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Vo([jo(tp.roles.getRoles),jo(tp.roles.getPermissions),jo(tp.roles.getPermissionCategories)]),[t,n,i]=e;yield $o(xi.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield $o(xi.setRolesState({error:Sg(e),loading:!1}))}}function*FT(e){let{payload:{callback:t}}=e,n=eo(e.payload,UT);yield $o(xi.setRolesState({saving:!0}));try{const e=yield jo(tp.roles.addRole,n),i=yield jo(tp.roles.getRoles);yield $o(xi.loadRolesAndPermissions({silentLoading:!0})),yield $o(xi.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield $o(xi.setRolesState({error:Sg(e),saving:!1})),null==t||t(null,e)}}function*GT(e){let{payload:{callback:t}}=e,n=eo(e.payload,CT);yield $o(xi.setRolesState({saving:!0}));try{yield jo(tp.roles.deleteRole,n),yield $o(xi.loadRolesAndPermissions({silentLoading:!0})),yield $o(xi.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield $o(xi.setRolesState({error:Sg(e),saving:!1})),null==t||t(!1,e)}}function*$T(e){let{payload:{callback:t}}=e,n=eo(e.payload,DT);yield $o(xi.setRolesState({saving:!0}));try{const e=yield jo(tp.roles.updateRole,n);yield $o(xi.loadRolesAndPermissions({silentLoading:!0})),yield $o(xi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield $o(xi.setRolesState({error:Sg(e),saving:!1})),null==t||t(null,e)}}function*VT(e){let{payload:{callback:t}}=e,n=eo(e.payload,RT);yield $o(xi.setRolesState({saving:!0}));try{const e=yield jo(tp.roles.attachPermissionsToRole,n);yield $o(xi.loadRolesAndPermissions({silentLoading:!0})),yield $o(xi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield $o(xi.setRolesState({error:Sg(e),saving:!1})),null==t||t(null,e)}}function*xT(e){let{payload:{callback:t}}=e,n=eo(e.payload,NT);yield $o(xi.setRolesState({saving:!0}));try{const e=yield jo(tp.roles.attachPermissionToRoles,n);yield $o(xi.loadRolesAndPermissions({silentLoading:!0})),yield $o(xi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield $o(xi.setRolesState({error:Sg(e),saving:!1})),null==t||t(null,e)}}function*jT(){yield $a(xi.loadRolesAndPermissions,MT),yield Fa(xi.addRole,FT),yield Fa(xi.deleteRole,GT),yield Fa(xi.updateRole,$T),yield Fa(xi.attachPermissionsToRole,VT),yield Fa(xi.attachPermissionToRoles,xT)}function*BT({payload:e}){var t;yield $o(xi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield $o(xi.setRolesState({roles:Op,loading:!1}))}catch(e){yield $o(xi.setRolesState({error:Sg(e),loading:!1}))}}function*WT(){yield $a(xi.loadRolesAndPermissions,BT)}const zT=["callback"],KT=["callback"],HT=["callback"];function*qT(e){let{payload:{callback:t}}=e,n=eo(e.payload,zT);yield $o(xi.setResetPhoneNumberState({loading:!0}));try{const e=yield jo(tp.auth.resetPhoneNumber,n);yield $o(xi.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Xt.VerifyResetPhoneNumber})),yield $o(xi.setLoginState({email:n.email}))}catch(e){yield $o(xi.setResetPhoneNumberState({loading:!1,error:Sg(e)})),null==t||t(null,e)}}function*JT(e){let{payload:{callback:t}}=e,n=eo(e.payload,KT);yield $o(xi.setResetPhoneNumberState({loading:!0}));try{const e=yield jo(tp.auth.verifyResetPhoneNumber,n);yield $o(xi.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Xt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield $o(xi.setResetPhoneNumberState({loading:!1,error:Sg(e)})),null==t||t(null,e)}}function*YT(e){let{payload:{callback:t}}=e,n=eo(e.payload,HT);yield $o(xi.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield zo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield jo(tp.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield $o(xi.setLoginState({step:_t.loginWithSmsOtc})),yield $o(xi.passwordlessPreLogin({type:ki.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield $o(xi.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setResetPhoneNumberState({loading:!1,error:Sg(e)})),null==t||t(null,e)}}function*QT(){yield $a(xi.resetPhoneNumber,qT),yield $a(xi.verifyResetPhoneNumber,JT),yield $a(xi.changePhoneNumber,YT)}function*XT(){yield $o(xi.setSessionsState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getCurrentUserSessions);yield $o(xi.setSessionsState({sessions:e,loading:!1}))}catch(e){yield $o(xi.setSessionsState({error:e,loading:!1}))}}function*ZT(){yield $o(xi.setSessionsState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getCurrentUserSession);yield $o(xi.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield $o(xi.setSessionsState({error:e,loading:!1}))}}function*eE({payload:{id:e}}){yield $o(xi.setSessionsState({loading:!0,error:null}));try{yield jo(tp.auth.deleteSessionForUser,e),yield $o(xi.loadUserSessions())}catch(e){yield $o(xi.setSessionsState({error:e,loading:!1}))}}function*tE({payload:{callback:e,userId:t}}){yield $o(xi.setSessionsState({loading:!0,error:null}));try{yield jo(tp.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield $o(xi.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*nE(){yield $o(xi.setSessionsState({loading:!0,error:null}));try{yield jo(tp.auth.deleteAllSessionsForUser),yield $o(xi.loadUserSessions())}catch(e){yield $o(xi.setSessionsState({error:e,loading:!1}))}}function*iE(){yield Ga(xi.loadUserSessions,XT),yield Ga(xi.deleteUserSession,eE),yield Ga(xi.deleteAllUserSessions,nE),yield Ga(xi.loadCurrentUserSession,ZT),yield Fa(xi.revokeUserSessions,tE)}function*oE(){yield $o(xi.setSessionsState({loading:!0,error:null})),yield $o(xi.setSessionsState({sessions:qp,loading:!1}))}function*aE({payload:{id:e}}){yield $o(xi.setSessionsState({loading:!0,error:null}));const t=(yield zo((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield $o(xi.setSessionsState({sessions:t,loading:!1}))}function*rE(){yield $o(xi.setSessionsState({loading:!0,error:null}));const e=qp.filter((e=>e.current));yield $o(xi.setSessionsState({sessions:e,loading:!1}))}function*sE(){yield Ga(xi.loadUserSessions,oE),yield Ga(xi.deleteUserSession,aE),yield Ga(xi.deleteAllUserSessions,rE)}const lE=["callback"],cE=["callback"];function*uE(){yield $o(xi.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getSessionConfigurations);yield $o(xi.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield $o(xi.setSessionsState({error:e,loading:!1}))}}function*dE({payload:e}){yield $o(xi.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=eo(e,lE);yield jo(tp.auth.createOrUpdateSessionConfigrations,n),yield $o(xi.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield $o(xi.setSessionsPolicyState({error:e,loading:!1}))}}function*yE(){yield $a(xi.loadSessionsPolicy,uE),yield Ga(xi.createOrUpdateSessionsPolicy,_g(dE))}function*fE(){yield $o(xi.setSessionsPolicyState({loading:!0,error:null}));const e=yield zo((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Jp}));yield $o(xi.setSessionsPolicyState(R({},e,{loading:!1})))}function*pE({payload:e}){yield $o(xi.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=eo(e,cE);null==t||t(!0),yield $o(xi.setSessionsPolicyState({configurations:n,loading:!1}))}function*gE(){yield $a(xi.loadSessionsPolicy,fE),yield Ga(xi.createOrUpdateSessionsPolicy,pE)}const SE=["callback"],vE=["callback"],hE=["callback"],mE=["callback"],AE=["callback"],bE=["callback"],TE=["callback"],EE=["callback"],kE=()=>zo((e=>e.auth.restrictionsState.ipRestrictions)),OE=()=>zo((e=>e.auth.restrictionsState.emailDomainRestrictions));function*IE(){yield $o(xi.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield jo(tp.auth.getDomainRestrictionsConfig),t=(yield jo(tp.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield $o(xi.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield $o(xi.setEmailDomainRestrictionsState({error:Sg(e),loading:!1}))}}function*PE(e){let{payload:{callback:t}}=e,n=eo(e.payload,SE);yield $o(xi.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield OE();try{var o;yield jo(tp.auth.createDomainRestriction,n);const e=(yield jo(tp.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield $o(xi.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 $o(xi.setEmailDomainRestrictionsState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*_E(e){let{payload:{callback:t}}=e,n=eo(e.payload,vE);yield $o(xi.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield jo(tp.auth.updateDomainRestrictionConfig,n),i=(yield jo(tp.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield $o(xi.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield $o(xi.setEmailDomainRestrictionsState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*LE({payload:{id:e}}){yield $o(xi.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield OE();try{var n;yield jo(tp.auth.deleteDomainRestriction,e);const i=(yield jo(tp.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield $o(xi.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Wn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield $o(xi.setEmailDomainRestrictionsState({saving:!1,error:Sg(e)}))}}const wE=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Wn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*UE(){yield $o(xi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield kE(),t=yield jo(tp.auth.getIPRestrictionsConfig),n=wE({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield jo(tp.auth.getIPRestrictions,n);yield $o(xi.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield $o(xi.setIpRestrictionsState({error:Sg(e),loading:!1}))}}function*CE(){try{const{valid:e}=yield jo(tp.auth.testCurrentIpInAllowList);yield $o(xi.setIpRestrictionsState({userIpValid:e}))}catch(e){yield $o(xi.setIpRestrictionsState({error:Sg(e)}))}}function*DE({payload:{callback:e}}){yield $o(xi.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield zo((e=>e.auth.userIp));yield Vo([jo(tp.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Wn.ALLOW}),jo(tp.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield kE(),i=wE(n.pagination),{items:o,_metadata:{totalPages:a}}=yield jo(tp.auth.getIPRestrictions,i);yield $o(xi.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Wn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield $o(xi.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*RE(e){let{payload:{callback:t}}=e,n=eo(e.payload,hE);yield $o(xi.setIpRestrictionsState({saving:!0,error:null}));const i=yield kE();try{var o,a;yield jo(tp.auth.createIPRestriction,n);const e=yield kE(),r=wE(e.pagination),{items:s,_metadata:{totalPages:l}}=yield jo(tp.auth.getIPRestrictions,r);yield CE(),yield $o(xi.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:Wn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield $o(xi.setIpRestrictionsState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*NE(e){let{payload:{callback:t}}=e,n=eo(e.payload,mE);yield $o(xi.setIpRestrictionsState({saving:!0,error:null}));try{yield jo(tp.auth.updateIPRestrictionConfig,n);const e=yield kE(),i=yield jo(tp.auth.getIPRestrictionsConfig),o=wE(R({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield jo(tp.auth.getIPRestrictions,o);yield CE(),yield $o(xi.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield $o(xi.setIpRestrictionsState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*ME({payload:{id:e,callback:t}}){yield $o(xi.setIpRestrictionsState({saving:!0,error:null}));const n=yield kE();try{var i;yield jo(tp.auth.deleteIPRestriction,e);const o=yield kE(),a=wE(o.pagination),{items:r,_metadata:{totalPages:s}}=yield jo(tp.auth.getIPRestrictions,a);yield CE(),yield $o(xi.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:Wn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield $o(xi.setIpRestrictionsState({saving:!1,error:Sg(e)})),null==t||t(null,e)}}function*FE(){yield $a(xi.loadIpRestrictions,_g(UE)),yield $a(xi.loadEmailDomainRestrictions,_g(IE)),yield Fa(xi.saveIpRestriction,_g(RE)),yield Fa(xi.saveIpRestrictionsConfig,_g(NE)),yield Fa(xi.deleteIpRestriction,_g(ME)),yield Fa(xi.checkIfUserIpValid,_g(CE)),yield Fa(xi.addCurrentUserIpAndActivate,_g(DE)),yield Fa(xi.saveEmailDomainRestriction,_g(PE)),yield Fa(xi.saveEmailDomainRestrictionsConfig,_g(_E)),yield Fa(xi.deleteEmailDomainRestriction,_g(LE))}function*GE(){yield $o(xi.setIpRestrictionsState({loading:!0,error:null})),yield $o(xi.setIpRestrictionsState({data:{restrictions:Qp.filter((e=>e.strategy===Yp.strategy)),config:Yp},totalPages:1,pagination:{_filter:Wn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*$E(){yield $o(xi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield kE(),t=Qp[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield $o(xi.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield $o(xi.setIpRestrictionsState({error:Sg(e),loading:!1}))}}function*VE(e){var t,n,i;let{payload:{callback:o}}=e,a=eo(e.payload,AE);yield $o(xi.setIpRestrictionsState({saving:!0,error:null}));const r=yield kE(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield $o(xi.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Wn.ALLOW},restrictions:[...s,R({},a,{createdAt:new Date,updatedAt:new Date,id:VA(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Wn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*xE(e){var t,n,i;let{payload:{callback:o}}=e,a=eo(e.payload,bE);const r=yield kE();yield $o(xi.setIpRestrictionsState({saving:!0,error:null})),yield $o(xi.setIpRestrictionsState({data:{config:R({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:Wn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield $o(xi.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*jE({payload:{id:e,callback:t}}){var n;yield $o(xi.setIpRestrictionsState({saving:!0,error:null}));const i=yield kE();yield $o(xi.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:Wn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Wn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*BE(){yield $o(xi.setEmailDomainRestrictionsState({loading:!0,error:null})),yield $o(xi.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Wn.ALLOW}],config:{active:!0,listType:Wn.ALLOW,blockPublicDomains:!1}}}))}function*WE(e){var t,n;let{payload:{callback:i}}=e,o=eo(e.payload,TE);const a=yield OE();yield $o(xi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==i||i(!0),yield $o(xi.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)||[],R({},o,{id:Date.now().toString()})]},saving:!1}))}function*zE(e){var t;let{payload:{callback:n}}=e,i=eo(e.payload,EE);const o=yield OE();yield $o(xi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==n||n(!0),yield $o(xi.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||Wn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*KE({payload:{id:e}}){var t,n;const i=yield OE();yield $o(xi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),yield $o(xi.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Wn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*HE(){yield $a(xi.loadIpRestrictions,GE),yield $a(xi.loadEmailDomainRestrictions,BE),yield Fa(xi.saveIpRestriction,VE),yield Fa(xi.saveIpRestrictionsConfig,xE),yield Fa(xi.deleteIpRestriction,jE),yield Fa(xi.checkIfUserIpValid,$E),yield Fa(xi.saveEmailDomainRestriction,WE),yield Fa(xi.saveEmailDomainRestrictionsConfig,zE),yield Fa(xi.deleteEmailDomainRestriction,KE)}const qE=["callback"],JE=["id"];function*YE(e){const{count:t}=yield jo(tp.directory.countConfigurationUsers,e.id);return R({},e,{count:t})}function*QE(){yield $o(xi.setProvisioningState({loading:!0,error:null}));try{const e=yield jo(tp.directory.getConfigs),t=yield Vo(e.map((e=>YE(e))));yield $o(xi.setProvisioningState({connections:t,loading:!1}))}catch(e){yield $o(xi.setProvisioningState({error:Sg(e),loading:!1}))}}function*XE(e){let{payload:{callback:t}}=e,n=eo(e.payload,qE);yield $o(xi.setProvisioningState({loading:!0,error:null}));try{const e=yield jo(tp.directory.createConfiguration,n),i=yield jo(tp.directory.getConfigs),o=yield Vo(i.map((e=>YE(e))));yield $o(xi.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield $o(xi.setProvisioningState({error:Sg(e),loading:!1}))}}function*ZE(e){let{payload:{id:t}}=e,n=eo(e.payload,JE);yield $o(xi.setProvisioningState({loading:!0,error:null}));try{yield jo(tp.directory.updateConfiguration,t,n);const e=yield jo(tp.directory.getConfigs),i=yield Vo(e.map((e=>YE(e))));yield $o(xi.setProvisioningState({connections:i,loading:!1}))}catch(e){yield $o(xi.setProvisioningState({error:Sg(e),loading:!1}))}}function*ek({payload:{id:e,callback:t}}){yield $o(xi.setProvisioningState({loading:!0,error:null}));try{yield jo(tp.directory.deleteConfiguration,e);const n=yield jo(tp.directory.getConfigs),i=yield Vo(n.map((e=>YE(e))));yield $o(xi.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setProvisioningState({error:Sg(e),loading:!1})),null==t||t(!1,e)}}function*tk(){yield $a(xi.loadProvisionConnections,QE),yield Fa(xi.createProvisionConnection,XE),yield Fa(xi.deleteProvisionConnection,ek),yield Fa(xi.updateProvisionConnection,ZE)}const nk=["callback","events"];function*ik(e){let{payload:{callback:t}}=e,n=eo(e.payload,nk);yield $o(xi.setImpersonateState({loading:!0}));try{yield jo(tp.impersonate.impersonate,n),yield $o(xi.setImpersonateState({step:Ni.success})),yield Ko(1e3),yield XS(),yield $o(xi.resetImpersonateState()),null==t||t(!0)}catch(e){yield $o(xi.setImpersonateState({loading:!1,error:Sg(e)}))}}function*ok(){yield $a(xi.impersonate,ik)}function*ak({payload:e}){const{callback:t,deviceId:n}=e;yield $o(xi.setPasskeysState({loading:!0}));try{yield jo(tp.auth.deleteWebAuthnDevice,n);const{devices:e}=yield zo((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield $o(xi.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield $o(xi.setPasskeysState({loading:!1,error:Sg(e,null)})),null==t||t(null,e)}}function*rk(){yield $o(xi.setPasskeysState({loading:!0}));try{const{devices:e}=yield jo(tp.auth.getWebAuthnDevices);yield $o(xi.setPasskeysState({devices:e,loading:!1}))}catch(e){yield $o(xi.setPasskeysState({loading:!1,error:Sg(e,null)}))}}function*sk(){yield Fa(xi.loadWebAuthnDevices,rk),yield Fa(xi.deleteWebAuthnDevice,ak)}const lk=["roleIds","userIds"],ck=()=>zo((e=>e.auth.groupsState));function*uk({payload:e}){const t=xA.GET_TEAM_USERS;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield jo(tp.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield $o(xi.setGroupsState({teamUsers:n}))}catch(e){yield $o(xi.setUsersGroupsError({key:t,value:Sg(e)}))}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*dk({payload:e}){const t=xA.GET_GROUP;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield jo(tp.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:jA.rolesAndUsers});yield $o(xi.setGroupsState({selectedGroup:n}))}catch(e){yield $o(xi.setUsersGroupsError({key:t,value:Sg(e)}))}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*yk(){const e=xA.GET_GROUPS,t=yield ck();yield $o(xi.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield jo(tp.groups.getGroups,{_groupsRelations:jA.rolesAndUsers});yield $o(xi.setGroupsState(R({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield $o(xi.setUsersGroupsError({key:e,value:Sg(t)}))}finally{yield $o(xi.setUsersGroupsLoader({key:e,value:!1}))}}function*fk({payload:e}){const t=xA.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=eo(e,lk);yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield jo(tp.groups.createGroup,R({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield $o(xi.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield $o(xi.addRolesToGroup({groupId:r.id,roleIds:n}))),yield $o(xi.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield $o(xi.setUsersGroupsError({key:t,value:Sg(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*pk({payload:e}){const t=xA.UPDATE_GROUP;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield jo(tp.groups.updateGroup,e),yield $o(xi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $o(xi.setUsersGroupsError({key:t,value:Sg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*gk({payload:e}){const t=xA.DELETE_GROUP;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield jo(tp.groups.deleteGroup,e.groupId),yield $o(xi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $o(xi.setUsersGroupsError({key:t,value:Sg(n)})),null==e||null==(i=e.callback)||i.call(e,!1,n)}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*Sk({payload:e}){const t=xA.ADD_ROLES_TO_GROUP;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield jo(tp.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield $o(xi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $o(xi.setUsersGroupsError({key:t,value:Sg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*vk({payload:e}){const t=xA.DELETE_ROLES_FROM_GROUP;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield jo(tp.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield $o(xi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $o(xi.setUsersGroupsError({key:t,value:Sg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*hk({payload:e}){const t=xA.ADD_USERS_TO_GROUP;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield jo(tp.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield $o(xi.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 $o(xi.setUsersGroupsError({key:t,value:Sg(n)}))}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*mk({payload:e}){const t=xA.DELETE_USERS_FROM_GROUP;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield jo(tp.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield $o(xi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield $o(xi.setUsersGroupsError({key:t,value:Sg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*Ak(){const e=xA.GET_GROUP_CONFIGURATION;yield $o(xi.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield jo(tp.groups.getGroupConfiguration);yield $o(xi.setGroupsState({groupsConfiguration:t}))}catch(t){yield $o(xi.setUsersGroupsError({key:e,value:Sg(t)}))}finally{yield $o(xi.setUsersGroupsLoader({key:e,value:!1}))}}function*bk({payload:e}){const t=xA.UPDATE_GROUP_CONFIGURATION;yield $o(xi.setUsersGroupsLoader({key:t,value:!0}));try{yield jo(tp.groups.updateGroupConfiguration,e),yield $o(xi.getGroupConfiguration())}catch(e){yield $o(xi.setUsersGroupsError({key:t,value:Sg(e)}))}finally{yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}}function*Tk(){yield Ga(xi.loadGroups,yk),yield Ga(xi.getGroupById,dk),yield Ga(xi.createGroup,fk),yield Ga(xi.updateGroup,pk),yield Ga(xi.deleteGroup,gk),yield Ga(xi.addRolesToGroup,Sk),yield Ga(xi.deleteRolesFromGroup,vk),yield Ga(xi.addUsersToGroup,hk),yield Ga(xi.deleteUsersFromGroup,mk),yield Ga(xi.getGroupConfiguration,Ak),yield Ga(xi.updateGroupConfiguration,bk),yield Ga(xi.getTeamUsers,uk)}function*Ek(){const e=xA.GET_GROUPS;yield $o(xi.setUsersGroupsLoader({key:e,value:!0}));const t=eg;yield $o(xi.setGroupsState({groups:t})),yield $o(xi.setUsersGroupsLoader({key:e,value:!1}))}function*kk({payload:e}){var t;const n=xA.CREATE_GROUP,{groups:i}=yield ck();yield $o(xi.setUsersGroupsLoader({key:n,value:!0})),yield $o(xi.setGroupsState({groups:[R({},e,{id:`${e.name}ID`,managedBy:Jf.FRONTEGG}),...null!=i?i:[]]})),yield Ko(500),null==e||null==(t=e.callback)||t.call(e,!0),yield $o(xi.setUsersGroupsLoader({key:n,value:!1}))}function*Ok({payload:e}){var t,n,i,o,a;const r=xA.UPDATE_GROUP,s=yield ck();yield $o(xi.setUsersGroupsLoader({key:r,value:!0})),yield $o(xi.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:Jf.FRONTEGG}):t})),selectedGroup:R({},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 Ko(500),null==e||null==(a=e.callback)||a.call(e,!0),yield $o(xi.setUsersGroupsLoader({key:r,value:!1}))}function*Ik({payload:e}){var t,n;const i=xA.DELETE_GROUP,o=yield ck();yield $o(xi.setUsersGroupsLoader({key:i,value:!0})),yield $o(xi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Ko(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $o(xi.setUsersGroupsLoader({key:i,value:!1}))}function*Pk({payload:e}){var t,n;const i=xA.ADD_ROLES_TO_GROUP,o=yield ck();yield $o(xi.setUsersGroupsLoader({key:i,value:!0})),yield $o(xi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ko(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $o(xi.setUsersGroupsLoader({key:i,value:!1}))}function*_k({payload:e}){var t,n;const i=xA.DELETE_ROLES_FROM_GROUP,o=yield ck();yield $o(xi.setUsersGroupsLoader({key:i,value:!0})),yield $o(xi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield Ko(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $o(xi.setUsersGroupsLoader({key:i,value:!1}))}function*Lk({payload:e}){var t,n;const i=xA.ADD_USERS_TO_GROUP,o=yield ck();yield $o(xi.setUsersGroupsLoader({key:i,value:!0})),yield $o(xi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ko(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $o(xi.setUsersGroupsLoader({key:i,value:!1}))}function*wk({payload:e}){var t,n;const i=xA.DELETE_USERS_FROM_GROUP,o=yield ck();yield $o(xi.setUsersGroupsLoader({key:i,value:!0})),yield $o(xi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield Ko(500),null==e||null==(n=e.callback)||n.call(e,!0),yield $o(xi.setUsersGroupsLoader({key:i,value:!1}))}function*Uk(){const e=xA.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield ck();yield $o(xi.setUsersGroupsLoader({key:e,value:!0})),t&&(yield $o(xi.setGroupsState({groupsConfiguration:R({},t)}))),yield $o(xi.setUsersGroupsLoader({key:e,value:!1}))}function*Ck({payload:e}){const t=xA.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield ck();yield $o(xi.setUsersGroupsLoader({key:t,value:!0})),n&&(yield $o(xi.setGroupsState({groupsConfiguration:R({},n,e)}))),yield $o(xi.setUsersGroupsLoader({key:t,value:!1}))}function*Dk(){yield Ga(xi.loadGroups,Ek),yield Ga(xi.createGroup,kk),yield Ga(xi.updateGroup,Ok),yield Ga(xi.deleteGroup,Ik),yield Ga(xi.addRolesToGroup,Pk),yield Ga(xi.deleteRolesFromGroup,_k),yield Ga(xi.addUsersToGroup,Lk),yield Ga(xi.deleteUsersFromGroup,wk),yield Ga(xi.getGroupConfiguration,Uk),yield Ga(xi.updateGroupConfiguration,Ck)}let Rk;!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"}(Rk||(Rk={}));const Nk=(e,t,n)=>{var i,o;return e.tenantId===t?R({},e,{name:n}):R({},e,{children:null!=(i=null==e||null==(o=e.children)?void 0:o.map((e=>Nk(e,t,n))))?i:[]})};function Mk(e,t){var n;return R({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Mk(e,t))):[]})}function Fk(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 R({},e,{children:t})}return R({},e,{children:null!=(i=null==e||null==(o=e.children)?void 0:o.map((e=>Fk(e,t,n))))?i:[]})}const Gk=({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}})),$k=()=>zo((e=>e.auth.allAccountsState));function*Vk({payload:e}){const t=Rk.GET_ACCOUNTS;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield $k(),{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 $k(),{items:n,_links:o}=yield jo(tp.tenants.searchSubTenants,r,{jwt:i}),a=yield jo(tp.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:i}),l=Gk({items:n},a),c=Fk(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 $o(xi.setSelectedAccountState({accounts:c}))}else{var l;const{accounts:t}=yield $k(),{items:n,_links:i}=yield jo(tp.tenants.searchSubTenants,r),o=yield jo(tp.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=Gk({items:n},o),s=Fk(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 $o(xi.setAllAccountsState({accounts:s}))}}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)}))}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*xk({payload:e}){const t=Rk.SEARCH_ACCOUNTS;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield $k(),{jwt:i}=e;try{if(null!=e&&e._subTenantId){var o;const{items:t}=yield jo(tp.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(o=null==e?void 0:e._filter)?o:"",_subTenantId:e._subTenantId},{jwt:i});yield $o(xi.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)}))}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*jk({payload:e}){const t=Rk.GET_USER_JWT;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:i}=e;try{const e=yield jo(tp.users.GetUserJwt,{tenantId:n});yield $o(xi.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==i||i(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),yield $o(xi.setSelectedAccountState({accessPermission:!1})),null==i||i(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*Bk({payload:e}){const t=Rk.CREATE_SUB_ACCOUNT;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:i,tenantId:o,jwt:a,callback:r}=e;try{if(a){const{accounts:e}=yield $k(),{selectedAccount:t}=yield $k(),r=yield jo(tp.subTenants.createSubTenant,{name:n,parentTenantId:i,tenantId:o},{jwt:a}),s=Fk(e,null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),l=Fk(R({name:"",tenantId:""},null==t?void 0:t.accounts),null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield $o(xi.setAllAccountsState({accounts:s})),yield $o(xi.setSelectedAccountState({accounts:l}))}else{const{accounts:e}=yield $k(),t=yield jo(tp.subTenants.createSubTenant,{name:n,tenantId:o,parentTenantId:i}),a=Fk(e,null!=i?i:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield $o(xi.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),null==r||r(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*Wk({payload:e}){const t=Rk.DELETE_SUB_ACCOUNT;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:i,callback:o}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield $k();yield jo(tp.subTenants.deleteSubTenant,i,{jwt:n});const o=Mk(t,i),a=Mk(null==e?void 0:e.accounts,i);yield $o(xi.setAllAccountsState({accounts:o})),yield $o(xi.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield $k();yield jo(tp.subTenants.deleteSubTenant,i);const t=Mk(e,i);yield $o(xi.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),null==o||o(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*zk({payload:e}){const t=Rk.UPDATE_SUB_ACCOUNT_SETTINGS;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:i,callback:o,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield $k();yield jo(tp.subTenants.updateSubTenant,{tenantId:a},{name:i},{jwt:n});const o=Nk(e.accounts,a,i);yield $o(xi.setSelectedAccountState({name:i,accounts:o}));const r=Nk(t,a,i);yield $o(xi.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield $k();yield jo(tp.subTenants.updateSubTenant,{tenantId:a},{name:i});const t=Nk(e,a,i);yield $o(xi.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),null==o||o(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*Kk({payload:e}){const t=Rk.DELETE_USERS_FROM_ACCOUNT;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:i,jwt:o,callback:a}=e;try{yield jo(tp.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:i},{jwt:o}),yield $o(xi.getAccountUsers({jwt:o,_tenantId:i[0].tenantId})),null==a||a(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),null==a||a(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*Hk({payload:e}){const t=Rk.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:i,jwt:o,callback:a}=e,{selectedAccount:r}=yield $k();try{yield jo(tp.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:i},{jwt:o}),yield $o(xi.getAccountUsers({jwt:o,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),null==a||a(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*qk({payload:e}){const t=Rk.ADD_USERS_TO_ACCOUNT;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:i,jwt:o,callback:a,allowSubAccountAccess:r=!1,roleIds:s}=e;try{yield jo(tp.subTenants.addUsersToSubTenant,{users:n,tenantId:i,allowSubAccountAccess:r,roleIds:s},{jwt:o}),yield $o(xi.getAccountUsers({jwt:o,_tenantId:i})),null==a||a(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),null==a||a(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*Jk({payload:e}){const t=Rk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield $k(),{userId:i,allowAccess:o,jwt:a,callback:r}=e;try{var s;yield jo(tp.subTenants.updateSubAccountAccess,i,{allowAccess:o},{jwt:a}),yield $o(xi.setSelectedAccountState({users:null==n||null==(s=n.users)?void 0:s.map((e=>e.id===i?R({},e,{subAccountAccessAllowed:o}):e))})),null==r||r(!0)}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)})),null==r||r(!1)}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*Yk({payload:e}){var t,n,i,o,a,r,s,l;const c=Rk.GET_ACCOUNT_USERS;yield $o(xi.setAllAccountsLoader({key:c,value:!0}));const u=yield $k(),{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=R({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield jo(tp.users.getUsersV3,S,{jwt:d}),i={totalUsersItems:t,totalUsersPages:n,usersQueryParams:R({_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 jo(tp.roles.getRoles),o=yield jo(tp.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 R({},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 $o(xi.setSelectedAccountState(R({users:a},i)))}else yield $o(xi.setSelectedAccountState(R({users:[]},i)))}catch(e){yield $o(xi.setAllAccountsError({key:c,value:Sg(e)}))}finally{yield $o(xi.setAllAccountsLoader({key:c,value:!1}))}}function*Qk({payload:e}){const t=Rk.SET_SELECTED_SUB_ACCOUNT_DATA;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var i,o,a,r,s,l,c;const e=yield jo(tp.accountSettings.getSettings,{jwt:n}),u=yield jo(tp.tenants.getTenantsUsersCount,{tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n}),d=yield jo(tp.tenants.getParentTenants,{jwt:n}),y=yield jo(tp.tenants.getHierarchyMetadata,{_tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n});yield $o(xi.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 $o(xi.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)}))}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*Xk(){const e=Rk.SET_ROOT_ACCOUNT_DATA;yield $o(xi.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield zo((e=>e.auth.tenantsState)),{accounts:n}=yield $k();if(t)try{var i;const o=yield jo(tp.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 $o(xi.setAllAccountsState({rootAccount:a,accounts:R({},n,a)}))}catch(t){yield $o(xi.setAllAccountsError({key:e,value:Sg(t)}))}finally{yield $o(xi.setAllAccountsLoader({key:e,value:!1}))}}function*Zk({payload:e}){const t=Rk.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield $o(xi.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:i}=e;try{const e=yield jo(tp.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:i});yield $o(xi.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield $o(xi.setAllAccountsError({key:t,value:Sg(e)}))}finally{yield $o(xi.setAllAccountsLoader({key:t,value:!1}))}}function*eO(){yield Ga(xi.loadAccounts,Vk),yield Ga(xi.searchAccounts,xk),yield Ga(xi.updateSubAccountAccessForUser,Jk),yield Ga(xi.getUserJwtForSubAccount,jk),yield Ga(xi.createSubAccount,Bk),yield Ga(xi.deleteSubAccount,Wk),yield Ga(xi.updateSubAccountSettings,zk),yield Ga(xi.addUsersToAccount,qk),yield Ga(xi.deleteUsersFromAccount,Kk),yield Ga(xi.setUserRolesForSubAccount,Hk),yield Ga(xi.getAccountUsers,Yk),yield Ga(xi.setRootAccountData,Xk),yield Ga(xi.setSelectedSubAccountData,Qk),yield Ga(xi.loadNumberOfUsersForSelectedSubAccount,Zk)}const tO=["callback"],nO=["callback"],iO=["callback","phoneId"],oO=["callback","phoneId"],aO=["callback"];function*rO(){yield $o(xi.setSmsState({loading:!0}));const e={_limit:10,_offset:0};try{const{items:t}=yield jo(tp.userPhoneNumbers.getUserPhoneNumbers,e);yield $o(xi.setSmsState({phoneNumbers:t}))}catch(e){yield $o(xi.setSmsState({error:Sg(e)}))}finally{yield $o(xi.setSmsState({loading:!1}))}}function*sO(e){let{payload:{callback:t}}=e,n=eo(e.payload,tO);yield $o(xi.setSmsState({loading:!0}));try{const e=yield jo(tp.userPhoneNumbers.createPhoneNumber,n);yield $o(xi.setSmsState({otcToken:e.otcToken})),yield jo(rO),null==t||t(!0)}catch(e){yield $o(xi.setSmsState({error:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSmsState({loading:!1}))}}function*lO(e){let{payload:{callback:t}}=e,n=eo(e.payload,nO);yield $o(xi.setSmsState({loading:!0}));try{yield jo(tp.userPhoneNumbers.verifyPhoneNumber,n),yield jo(rO),null==t||t(!0)}catch(e){yield $o(xi.setSmsState({error:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSmsState({loading:!1}))}}function*cO(e){let{payload:{callback:t,phoneId:n}}=e;eo(e.payload,iO),yield $o(xi.setSmsState({loading:!0}));try{const e=yield jo(tp.userPhoneNumbers.deletePhoneNumber,n);yield $o(xi.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield $o(xi.setSmsState({error:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSmsState({loading:!1}))}}function*uO(e){let{payload:{callback:t,phoneId:n}}=e,i=eo(e.payload,oO);yield $o(xi.setSmsState({loading:!0}));try{yield jo(tp.userPhoneNumbers.verifyDeletePhoneNumber,n,i),yield jo(rO),null==t||t(!0)}catch(e){yield $o(xi.setSmsState({error:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSmsState({loading:!1}))}}function*dO(e){let{payload:{callback:t}}=e,n=eo(e.payload,aO);yield $o(xi.setSmsState({loading:!0}));try{const e=yield jo(tp.userPhoneNumbers.preVerifyPhoneNumber,n);yield $o(xi.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield $o(xi.setSmsState({error:Sg(e)})),null==t||t(null,e)}finally{yield $o(xi.setSmsState({loading:!1}))}}function*yO(){yield Fa(xi.loadPhoneNumbers,rO),yield Fa(xi.setUpPhoneNumber,sO),yield Fa(xi.verifyPhoneNumber,lO),yield Fa(xi.deletePhoneNumber,cO),yield Fa(xi.verifyDeletePhoneNumber,uO),yield Fa(xi.preVerifyPhoneNumber,dO)}function*fO(e){yield jo(HS,e),yield jo(ZS)}function*pO({mfaToken:e,mfaDevices:t}){yield $o(xi.setStepUpState({mfaDevices:t,mfaToken:e}));const n=yield jo(fg,t);yield $o(xi.setMfaState({step:n}))}function*gO(e){if((e=>"MFA is not enrolled"===(null==e?void 0:e.message))(e))return void(yield $o(xi.setMfaState({step:cn.noMFAEnrolledStepUp})));yield $o(xi.logout()),window.localStorage.setItem(JS,"true");const{routes:t}=yield zo((e=>e.auth));Va.onRedirectTo(t.loginUrl)}function*SO({payload:{maxAge:e,callback:t}}){yield $o(xi.setStepUpState({mfaDevices:void 0,mfaToken:""}));try{const n=yield jo(tp.auth.generateStepupSession,{maxAge:e});n.user?yield jo(fO,n):yield jo(pO,n),null==t||t(!0)}catch(e){null==t||t(!1),yield jo(gO,e)}}function*vO({payload:e}){yield ov(e,xi.setStepUpState,!0)}function*hO({payload:e}){yield vv(e,xi.setStepUpState)}function*mO({payload:e}){yield hv(e,xi.setStepUpState,!0)}function*AO({payload:e}){yield dv(e,xi.setStepUpState)}function*bO({payload:e}){yield yv(e,xi.setStepUpState,!0)}function*TO({payload:e}){yield kv(e,xi.setStepUpState)}function*EO({payload:e}){yield Ev(e,xi.setStepUpState)}function*kO(){yield $a(xi.generateStepUpSession,SO),yield $a(xi.stepUpWithAuthenticator,vO),yield $a(xi.preVerifyMFASMSForStepUp,AO),yield $a(xi.verifyMFASMSForStepUp,bO),yield $a(xi.preVerifyMFAWebAuthnForStepUp,hO),yield $a(xi.verifyMFAWebAuthnForStepUp,mO),yield $a(xi.verifyMFAEmailCodeForStepUp,TO),yield $a(xi.preVerifyMFAEmailCodeForStepUp,EO)}var OO={sagas:function*(){yield Vo([jo(Ch),jo(kO),jo(wA),jo(CA),jo(AA),jo(QT),jo(qh),jo(Tm),jo(_m),jo(Og),jo(rA),jo(Nb),jo(Tk),jo(nT),jo(CS),jo(dT),jo(fS),jo(AT),jo(_T),jo(jT),jo(iE),jo(yE),jo(FE),jo(tk),jo(ok),jo(sk),jo(eO),jo(WS),jo(Fg),jo(yO)])},mockSagas:function*(){yield Vo([jo(Nh),jo(tm),jo(Cm),jo(gA),jo(qb),jo(vT),jo(IS),jo(sE),jo(ET),jo(wT),jo(gE),jo(HE),jo(WT),jo(Dk),jo(Wg)])},storeName:Dt,initialState:Ri,reducer:$i,actions:xi};const IO=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>R({},t,{[e]:R({},t[e],n)})}),PO={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},_O={setAuditLogsState:IO("auditLogsState"),resetAuditLogsState:e=>R({},e,{auditLogsState:PO})},LO={exportAuditsCsv:yt("auditLogs/exportAuditsCsv"),loadAuditLogs:yt("auditLogs/loadAuditLogs",(e=>({payload:e})))},wO={loading:!0},UO={setAuditsMetadataState:IO("auditsMetadataState"),resetAuditsMetadataState:e=>R({},e,{auditsMetadataState:wO})},CO={loadAuditsMetadata:yt("auditLogs/loadAuditsMetadata")},DO={auditLogsState:PO,auditsMetadataState:wO},{reducer:RO,actions:NO}=pt({name:Nt,initialState:DO,reducers:R({resetState:e=>R({},e,DO),setState:(e,{payload:t})=>R({},e,t)},_O,UO)}),MO=R({},NO,LO,CO),FO=e=>"createdAt"!==e.id,GO={total:20,data:Array.from(Array(5).keys()).map((e=>R({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`})))},$O={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}]},VO=()=>zo((e=>e.auditLogs.auditLogsState)),xO=()=>zo((e=>e.auditLogs.auditsMetadataState));function*jO(){const e=yield VO(),{columns:t}=yield xO();try{const n=e.filter,i=e.sort.reduce(((e,t)=>R({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>R({},e,{[t.id]:t.value})),{});yield $o(MO.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield tp.audits.exportAudits(R({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield $o(MO.setAuditLogsState({isDownloadingCsv:!1}))}function*BO({payload:e}){yield $o(MO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield VO(),{columns:n}=yield xO();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 $o(MO.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>R({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>R({},e,{[t.id]:t.value})),{});n||(yield $o(MO.loadAuditsMetadata()));const{data:p,total:g}=yield jo(tp.audits.getAudits,R({offset:c,count:l},y,f));yield $o(MO.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 $o(MO.setAuditLogsState({loading:!1,error:Sg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*WO(){yield Fa(MO.exportAuditsCsv,jO),yield Fa(MO.loadAuditLogs,BO)}function*zO({payload:e}){yield $o(MO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield VO(),{columns:n}=yield xO();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 $o(MO.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield $o(MO.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=GO;let i=n.filter((e=>t=>e.filter(FO).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 $o(MO.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 $o(MO.setAuditLogsState({loading:!1,error:Sg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*KO(){yield Fa(MO.loadAuditLogs,zO)}function*HO(){yield $o(MO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield jo(tp.metadata.getAuditsMetadata);yield $o(MO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield $o(MO.setAuditsMetadataState({error:e,loading:!1}))}}function*qO(){yield Fa(MO.loadAuditsMetadata,HO)}function*JO(){yield $o(MO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=$O;yield $o(MO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield $o(MO.setAuditsMetadataState({error:e,loading:!1}))}}function*YO(){yield Fa(MO.loadAuditsMetadata,JO)}var QO={sagas:function*(){yield Vo([jo(WO),jo(qO)])},mockSagas:function*(){yield Vo([jo(KO),jo(YO)])},storeName:Nt,initialState:DO,reducer:RO,actions:MO};const XO={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:ZO,actions:eI,reducer:tI}=pt({name:"audits",initialState:XO,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=R({},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]})))}}}),nI=R({},eI,{initData:yt(`${ZO}/initData`),loadAudits:yt(`${ZO}/loadAudits`),removeFilter:yt(`${ZO}/removeFilter`),filterData:yt(`${ZO}/filterData`),exportCSV:yt(`${ZO}/exportCSV`),deleteAudits:yt(`${ZO}/deleteAudits`)}),iI=()=>zo((e=>e[ZO]));function*oI(){const{sortBy:e,sortDirection:t}=yield iI();try{const n=yield jo(tp.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield $o(nI.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield $o(nI.loadItemFailedAction(t))}}function*aI(){try{const e=yield jo(tp.metadata.getAuditsMetadata);yield $o(nI.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield $o(nI.loadItemFailedAction(t))}}const rI=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*sI({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield iI(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield iI():{rowsData:[]};try{const e=rI(t),{data:s,total:d}=yield jo(tp.audits.getAudits,R({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield $o(nI.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield $o(nI.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield $o(nI.loadItemFailedAction(t))}}function*lI(){yield $o(nI.startLoading()),yield Vo([oI(),aI(),sI({payload:{onlyOneLoad:!1},type:""})]),yield $o(nI.finishLoading())}function*cI({payload:e}){const{filters:t}=yield iI(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield $o(nI.setFilterData(i))}function*uI({payload:e}){const{filters:t}=yield iI();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 $o(nI.setFilterData(i))}function*dI(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield iI(),a=rI(e);yield $o(nI.startDownloadingCsv());try{yield tp.audits.exportAudits(R({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 $o(nI.stopDownloadingCsv())}}function*yI(){yield Ga(nI.initData,lI),yield Ga(nI.removeFilter,cI),yield Ga(nI.filterData,uI),yield Ga([nI.loadAudits,nI.textSearch,nI.onPageChange],sI),yield Ga([nI.setFilterData,nI.setDataSorting,nI.startRefresh],(()=>sI({payload:{appendMode:!1},type:""}))),yield Ga(nI.exportCSV,dI)}const fI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},pI={initData:()=>R({},fI),setConnectivityState:(e,{payload:t})=>R({},e,t),cleanWebhookTestData:e=>R({},e,{testResult:void 0}),cleanWebhookLogsData:e=>R({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return R({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>R({},e,{error:void 0}),cleanSlackData:e=>R({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>R({},e,{retryResult:R({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>R({},e,{retryResult:R({},e.retryResult,t)})}},gI={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}})))},SI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:vI,actions:hI}=pt({name:Rt,initialState:SI,reducers:R({},pI)}),mI=R({},hI,gI),AI={slack:tp.connectivity.getSlackConfiguration,email:tp.connectivity.getEmailConfiguration,sms:tp.connectivity.getSMSConfiguration,webhook:tp.connectivity.getWebhooksConfigurations,categories:tp.connectivity.getCategories,channelMap:tp.connectivity.getChannelMaps},bI={slack:tp.connectivity.postSlackConfiguration,email:tp.connectivity.postEmailConfiguration,sms:tp.connectivity.postSMSConfiguration,webhook:tp.connectivity.postWebhooksConfiguration},TI=["email","slack","sms","webhook"],EI={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"}},kI=["id"],OI=["id","enabled"],II=["categories","channelMap"];function*PI(e){return yield jo(LI,{payload:{api:e},type:""})}function*_I({payload:e=TI}){yield $o(mI.setConnectivityState({isLoading:!0}));try{const t=yield Vo([...e.map(PI),yield LI({payload:{api:"categories"},type:""}),yield function*(){return(yield Vo(e.map((function*(e){return yield LI({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>R({},t,{[`${e[i]}`]:n})),{})}()]),n=yield LI({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?R({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:EI[e[o]].events(i),active:EI[e[o]].isActive(i),platform:EI[e[o]].title,image:EI[e[o]].image}]}):n:R({},n,{[`${II[o-e.length]}`]:i})),{list:[],webhook:n});yield $o(mI.setConnectivityState(R({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield $o(mI.setConnectivityState({isLoading:!1}))}}function*LI({payload:{api:e,params:t}}){try{return yield jo(AI[e],t)}catch(e){return}}function*wI(){try{yield $o(mI.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield jo(tp.connectivity.getSlackChannels);yield $o(mI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield $o(mI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*UI(e,t){const{connectivity:{list:n}}=yield zo(),i=n.find((({key:t})=>t===e));if(!i)return;const o=EI[e].isActive(t);o!==i.active&&(yield $o(mI.setConnectivityState({list:n.map((t=>t.key===e?R({},t,{active:o}):t))})))}function*CI({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield zo((e=>e.connectivity));try{if(yield $o(mI.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield zo();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=eo(e,kI);return n===t.id&&JSON.stringify(R({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield jo(bI.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield jo(tp.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield zo(),{processIds:i}=yield zo((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 jo("email"===t?tp.connectivity.postEmailConfiguration:tp.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=eo(o,OI);return yield Vo([yield jo("email"===t?tp.connectivity.patchEmailConfiguration:tp.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield jo("email"===t?tp.connectivity.putEmailSubscriptions:tp.connectivity.putSMSSubscriptions,a,i,R({},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 jo("email"===t?tp.connectivity.deleteEmailSubscriptions:tp.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield LI({payload:{api:t},type:""});yield $o(mI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield UI(t,e)}else yield $o(mI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield jo(bI[e],t),!["sms","email"].includes(e)){const o=yield LI({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield $o(mI.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield UI(e,o),null==n||n(!0)}}catch(e){yield $o(mI.setConnectivityState({error:Sg(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*DI({payload:e}){try{yield tp.connectivity.postSlackCode(e)}catch{}yield $o(mI.setConnectivityState({error:void 0,isSaving:!1}))}function*RI(){const{slackChannels:e}=yield zo((e=>e.connectivity));try{yield $o(mI.setConnectivityState({slackChannels:R({},e,{isLoadingScope:!0})}));const{clientId:t}=yield jo(tp.connectivity.getSlackScope);yield $o(mI.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield $o(mI.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*NI({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield zo((e=>e.connectivity));try{yield $o(mI.setConnectivityState({isSaving:!0})),yield jo(tp.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,Sg(e))}const o=yield LI({payload:{api:"webhook"},type:""});o&&(yield $o(mI.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*MI({payload:e}){try{yield $o(mI.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield jo(tp.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield $o(mI.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield $o(mI.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield $o(mI.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*FI({payload:e}){try{const{statusCode:t}=yield jo(tp.connectivity.postWebhookRetry,e);yield $o(mI.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield $o(mI.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*GI({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield zo((e=>e.connectivity));try{yield $o(mI.setConnectivityState({webhookLogs:R({},i,{isLoading:!0})}));const o=yield jo(tp.connectivity.getWebhookLog,e,n,t);yield $o(mI.setConnectivityState({error:void 0,webhookLogs:R({isLoading:!1},o)}))}catch(e){yield $o(mI.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var $I={sagas:function*(){yield Fa(mI.loadDataAction,_I),yield Ga(mI.loadSlackActions,wI),yield Fa(mI.postDataAction,CI),yield Fa(mI.postCodeAction,DI),yield Fa(mI.loadScope,RI),yield Fa(mI.deleteWebhookConfigAction,NI),yield Fa(mI.postWebhookTestAction,MI),yield Fa(mI.postWebhookRetryAction,FI),yield Ga(mI.loadWebhookLogsAction,GI)},storeName:Rt,initialState:SI,reducer:vI,actions:mI};function VI(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,t.payload)}}}function xI(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>R({},n,{[e]:t(n[e],i)})}}function jI(e){return xI(e,((e,t)=>R({},e,{loading:t.payload})))}function BI(e){return xI(e,((e,t)=>R({},e,{error:t.payload,loading:!1})))}const WI={loading:!1,error:null,fetching:!0,plans:[]},{actions:zI,reducer:KI,name:HI}=pt({name:"subscriptions/plans",initialState:WI,reducers:R({},VI())}),qI=R({loadPlans:yt(`${HI}/loadPlans`)},zI),JI={loading:!1,error:null,fetching:!0,config:null},YI=R({},VI()),{actions:QI,reducer:XI,name:ZI}=pt({name:"subscriptions/config",initialState:JI,reducers:YI}),eP=R({loadPaymentConfiguration:yt(`${ZI}/loadPaymentConfiguration`)},QI),tP={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},nP=R({},VI(),{setCancellationLoading:jI("cancellation"),setCancellationError:BI("cancellation"),setRenewalLoading:jI("renewal"),setRenewalError:BI("renewal")}),{reducer:iP,actions:oP,name:aP}=pt({name:"subscriptions/billing/subscription",initialState:tP,reducers:nP}),rP=R({load:yt(`${aP}/loadSubscription`),cancelSubscription:yt(`${aP}/cancelSubscription`),renewSubscription:yt(`${aP}/renewSubscription`)},oP),sP={loading:!1,error:null,fetching:!0},lP=R({},VI()),{reducer:cP,actions:uP,name:dP}=pt({name:"subscriptions/billing/information",initialState:sP,reducers:lP}),yP=R({loadBillingInformation:yt(`${dP}/loadBillingInformation`),cancelSubscription:rP.cancelSubscription,renewSubscription:rP.renewSubscription},uP),fP={loading:!1,error:null,fetching:!0},pP=R({},VI(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,t.payload)}}),{reducer:gP,actions:SP,name:vP}=pt({name:"subscriptions/billing/payment",initialState:fP,reducers:pP}),hP=R({loadPaymentMethod:yt(`${vP}/loadPaymentMethod`),submitPaymentMethod:yt(`${vP}/submitPaymentMethod`),submitPaymentMethodError:yt(`${vP}/submitPaymentMethodError`),submitPaymentMethodSuccess:yt(`${vP}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:yt(`${vP}/updateBillingDetails`,(e=>({payload:e})))},SP),mP={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},AP=R({},VI(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,{invoiceDownload:R({},e.invoiceDownload,t.payload)})}}),{reducer:bP,actions:TP,name:EP}=pt({name:"subscriptions/billing/invoices",initialState:mP,reducers:AP}),kP=R({loadInvoices:yt(`${EP}/loadInvoices`),downloadInvoice:yt(`${EP}/downloadInvoice`,(e=>({payload:e})))},TP),OP={information:sP,invoices:mP,paymentMethod:fP,subscription:tP},IP={invoices:kP,information:yP,paymentMethod:hP,subscription:rP},PP=Ke({invoices:bP,information:cP,paymentMethod:gP,subscription:iP}),_P={fetching:!0,loading:!1,error:null,confirmed:!1},LP=R({},VI()),{actions:wP,reducer:UP,name:CP}=pt({name:"subscriptions/checkout",initialState:_P,reducers:LP}),DP=R({loadCheckout:yt(`${CP}/loadCheckout`),resetCheckout:yt(`${CP}/resetCheckout`),submitCheckout:yt(`${CP}/submitCheckout`),confirmCheckout:yt(`${CP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:yt(`${CP}/errorCheckout`,(e=>({payload:e})))},wP),RP={loading:!1,error:null,cardSetupIntentSecret:null},NP=R({},VI()),{reducer:MP,actions:FP,name:GP}=pt({name:"subscriptions/stripe",initialState:RP,reducers:NP}),$P=R({loadCustomer:yt(`${GP}/loadCustomer`),createCardSetupIntentSecret:yt(`${GP}/createCardSetupIntentSecret`)},FP),VP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:xP,reducer:jP,name:BP}=pt({name:"subscriptions/vendorPublicConfig",initialState:VP,reducers:R({},VI())}),WP=R({loadVendorPublicConfiguration:yt(`${BP}/loadVendorPublicConfiguration`)},xP),zP={config:JI,plans:WI,checkout:_P,billing:OP,stripe:RP,vendorPublicConfig:VP},KP={config:eP,billing:IP,plans:qI,checkout:DP,stripe:$P,vendorPublicConfig:WP},HP=Ke({config:XI,billing:PP,plans:KI,checkout:UP,stripe:MP,vendorPublicConfig:jP});let qP,JP,YP;function QP({policy:e}){return{policy:YP.AT_PERIOD_END}}function XP(e){switch(e){case Ky.ACTIVE:return JP.ACTIVE;case Ky.INCOMPLETE:return JP.INCOMPLETE;case Ky.CANCELED:return JP.CANCELED;case Ky.EXPIRED:return JP.EXPIRED;case Ky.TRIALING:return JP.TRIALING;default:return JP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(qP||(qP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(JP||(JP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(YP||(YP={}));const ZP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Ky.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},e_=[{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"}],t_=[{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:""}],n_=[{id:"id",externalId:"externalId",type:Hy.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],i_={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*o_(){yield $o(rP.setLoading(!0));try{const[e]=yield jo(tp.subscriptions.getManagedSubscriptions);yield $o(rP.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield $o(rP.setError(e))}}function*a_(){yield Fa(yP.loadBillingInformation,r_)}function*r_(){yield function*(e){const t=yield zo((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield zo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield s_(n,!1):yield $o(yP.setError(t?"Not authorized":"Internal feature failure"))}()}function*s_(e,t){yield $o(yP.setLoading(!0));try{var n,i;const o=yield jo(tp.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield jo(tp.subscriptions.getSubscriptionPlan,a):([,s]=yield Vo([jo(o_),jo(tp.subscriptions.getSubscriptionPlan,a)]),l=yield zo((e=>e.subscriptions.billing.subscription.subscription||null))),yield $o(yP.setState(R({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?JP.ACTIVE:XP(l.status),cancellation:l.cancellation&&QP(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 $o(yP.setError(Sg(e)))}}function*l_(){yield function*(){var e,t;yield $o(yP.setLoading(!0)),yield Ko(500),yield $o(yP.setState({loading:!1,fetching:!1,summary:{subscriptionId:ZP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Jy.Stripe,externallyManaged:!1,currentPlanId:e_[0].id,defaultPlanId:e_[0].id},plan:R({},e_[0],{price:null==(e=e_[0].price)?void 0:e.amount,currency:null==(t=e_[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*c_(){yield Fa(yP.loadBillingInformation,l_)}function*u_(){yield Fa(hP.loadPaymentMethod,d_),yield Fa(hP.submitPaymentMethod,f_),yield Fa(hP.submitPaymentMethodError,p_),yield Fa(hP.submitPaymentMethodSuccess,g_),yield Fa(hP.updatePaymentMethodBillingDetails,y_)}function*d_(){yield $o(hP.setLoading(!0));try{const e=(yield jo(tp.subscriptions.getPaymentMethods))[0];yield $o(hP.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield $o(hP.setError(Sg(e)))}}function*y_({payload:e}){yield $o(hP.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield jo(tp.subscriptions.updatePaymentMethodBillingDetails,t,R({email:n},i)),yield jo(d_),null==o||o(!0)}catch(e){yield $o(hP.setError(Sg(e))),null==o||o(!1)}yield $o(hP.setLoading(!1))}function*f_(){yield $o(hP.setLoading(!0))}function*p_({payload:e}){yield $o(hP.setError(e))}function*g_(){yield $o(hP.loadPaymentMethod())}function*S_(){yield $o(hP.setLoading(!0)),yield Ko(500);const e=n_[0];yield $o(hP.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*v_(){yield Fa(hP.loadPaymentMethod,S_)}function*h_(){yield Fa(kP.loadInvoices,m_),yield Fa(kP.downloadInvoice,A_)}function*m_(){yield $o(kP.setLoading(!0));try{const e=(yield jo(tp.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 $o(kP.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield $o(kP.setError(Sg(e)))}}function*A_({payload:e}){yield $o(kP.setInvoiceDownloadState({loading:!0,error:null}));try{yield jo(tp.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield $o(kP.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield $o(kP.setInvoiceDownloadState({loading:!1,error:Sg(e,null)}))}}function*b_(){yield $o(kP.setLoading(!0)),yield Ko(500),yield $o(kP.setState({loading:!1,fetching:!1,invoices:t_.map((e=>R({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield $o(kP.setLoading(!1))}function*T_(){yield Fa(kP.loadInvoices,b_)}function*E_(){yield Fa(rP.load,k_),yield Fa(rP.cancelSubscription,O_),yield Fa(rP.renewSubscription,I_)}function*k_(){const e=yield zo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield s_(e)}function*O_(){const{subscription:e}=yield zo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield $o(rP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield $o(rP.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Ky.ACTIVE)try{yield $o(rP.setCancellationLoading(!0)),yield jo(tp.subscriptions.cancelManagedSubscription,t),yield o_(),yield $o(rP.setCancellationLoading(!1))}catch(e){yield $o(rP.setCancellationError(Sg(e)))}}function*I_(){const{subscription:e}=yield zo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield $o(rP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield $o(rP.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===qy.AT_PERIOD_END)try{yield $o(rP.setRenewalLoading(!0)),yield jo(tp.subscriptions.renewManagedSubscription,t),yield o_(),yield $o(rP.setRenewalLoading(!1))}catch(e){yield $o(rP.setCancellationError(Sg(e)))}}function*P_(){yield $o(rP.setLoading(!0)),yield Ko(500),yield $o(rP.setState({subscription:ZP,fetching:!1,loading:!1,error:null}))}function*__(){yield Fa(rP.load,P_)}function*L_(){yield Vo([jo(a_),jo(u_),jo(h_),jo(E_)])}function*w_(){yield Vo([jo(c_),jo(v_),jo(T_),jo(__)])}function*U_(){yield Fa(DP.loadCheckout,C_),yield Fa(DP.resetCheckout,D_),yield Fa(DP.submitCheckout,R_),yield Fa(DP.confirmCheckout,N_),yield Fa(DP.errorCheckout,F_)}function*C_(){yield $o(DP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*D_(){yield $o(DP.setState({loading:!1,error:null,confirmed:!1}))}function*R_(){yield $o(DP.setState({loading:!0,error:null}))}function*N_({payload:{paymentMethodId:e,planId:t}}){const n=yield zo((e=>e.subscriptions.billing.subscription.subscription)),i=yield zo((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Ky.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield $o(DP.setState({loading:!0,error:null})),o&&a)return yield M_(),void(yield $o(rP.setState({subscription:R({},n,{status:Ky.ACTIVE})})));try{yield jo(tp.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Vo([r_(),d_(),m_()]),yield M_()}catch(e){yield $o(DP.setState({loading:!1,error:Sg(e)}))}}else yield $o(DP.setState({loading:!1,error:"Subscription not found"}))}function*M_(){yield $o(DP.setState({loading:!1,error:null,confirmed:!0}))}function*F_({payload:e}){yield $o(DP.setState({loading:!1,error:e}))}function*G_(){yield Fa(DP.resetCheckout,D_)}function*$_(){yield Fa(qI.loadPlans,V_)}function*V_(){yield $o(qI.setLoading(!0));try{const e=(yield jo(tp.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 $o(qI.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield $o(qI.setError(Sg(e)))}}function*x_(){yield $o(qI.setLoading(!0)),yield Ko(500),yield $o(qI.setState({fetching:!1,loading:!1,plans:e_.map((e=>{var t,n;return R({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*j_(){yield Fa(qI.loadPlans,x_)}function*B_(){yield Fa(eP.loadPaymentConfiguration,W_)}function*W_(){yield $o(eP.setLoading(!0));try{(yield jo(tp.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Jy.Stripe))?yield function*(){yield $o(eP.setLoading(!0));try{const e=yield jo(tp.subscriptions.getStripePaymentProviderConfiguration);yield $o(eP.setState({loading:!1,fetching:!1,config:{paymentProvider:qP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield $o(eP.setError(Sg(e)))}}():yield $o(eP.setError("Payment provider not configured"))}catch(e){yield $o(eP.setError(Sg(e)))}}function*z_(){yield $o(eP.setLoading(!0)),yield Ko(500),yield $o(eP.setState({loading:!1,fetching:!1,config:{paymentProvider:qP.STRIPE,apiKey:""}}))}function*K_(){yield Fa(eP.loadPaymentConfiguration,z_)}function*H_(){yield Fa($P.createCardSetupIntentSecret,q_)}function*q_({payload:e}){yield $o($P.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield jo(tp.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield $o($P.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield $o($P.setError(Sg(e)))}}function*J_(){yield Fa(WP.loadVendorPublicConfiguration,Y_)}function*Y_(){yield $o(WP.setLoading(!0));try{const e=yield jo(tp.subscriptions.getVendorPublicConfigurations);yield $o(WP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield $o(WP.setError(Sg(e)))}}function*Q_(){yield $o(WP.setLoading(!0)),yield Ko(500),yield $o(WP.setState({fetching:!1,loading:!1,vendorPublicConfig:i_}))}function*X_(){yield Fa(WP.loadVendorPublicConfiguration,Q_)}var Z_={sagas:function*(){yield Vo([jo(L_),jo(U_),jo($_),jo(B_),jo(H_),jo(J_)])},mockSagas:function*(){yield Vo([jo(w_),jo(G_),jo(j_),jo(K_),jo(X_)])},reducer:HP,actions:KP,initialState:zP,storeName:"subscriptions"},eL={sagas:function*(){yield Fa(GS.loadVendorPublicInfo,$S)},storeName:Mt,initialState:NS,reducer:MS,actions:GS};const{reducer:tL}=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),R({},e,{context:t}))}}}),nL=(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=_a(),s=[...ut({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=dt({middleware:s,preloadedState:{root:R({},e,{previewMode:n,urlStrategy:r}),[OO.storeName]:R({},OO.initialState,i,null!=(c=null==o?void 0:o.auth)?c:{},{routes:R({},OO.initialState.routes,null!=(u=null==i?void 0:i.routes)?u:{},null!=(d=null==o||null==(y=o.auth)?void 0:y.routes)?d:{})}),[QO.storeName]:R({},QO.initialState,null!=(f=null==o?void 0:o.auditLogs)?f:{},{auditLogsState:R({},QO.initialState.auditLogsState,null!=(p=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:R({},QO.initialState.auditsMetadataState,null!=(S=null==o||null==(v=o.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[ZO]:R({},XO,null!=(h=null==o?void 0:o.audits)?h:{}),[$I.storeName]:$I.initialState,[Z_.storeName]:Z_.initialState,[eL.storeName]:eL.initialState},reducer:Ke({root:tL,[OO.storeName]:OO.reducer,[QO.storeName]:QO.reducer,[ZO]:tI,[$I.storeName]:$I.reducer,[Z_.storeName]:Z_.reducer,[eL.storeName]:eL.reducer})});const m=function*(){yield Vo([jo(OO.sagas),jo(QO.sagas),jo(yI),jo($I.sagas),jo(Z_.sagas),jo(eL.sagas)])},A=function*(){yield Vo([jo(OO.mockSagas),jo(QO.mockSagas),jo(Z_.mockSagas)])};n?(l.store.destroy=t.run(A).cancel,l.store.dispatch(xi.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 iL=n(314);const oL=()=>{if(!Va.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")},aL=(e,t)=>e?e.isEntitled?{isEntitled:!0}:{isEntitled:!1,justification:e.justification}:{isEntitled:!1,justification:t};var rL=n(714),sL=n.n(rL);function lL(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function cL(e){if(e.type)return e;if("#"===e.charAt(0))return cL(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 uL(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 dL(e){if(0===e.indexOf("#"))return e;const{values:t}=cL(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 yL(e,t){return e=cL(e),t=lL(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,uL(e)}function fL(e,t){if(e=cL(e),t=lL(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 uL(e)}function pL(e,t){if(e=cL(e),t=lL(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 uL(e)}const gL=e=>{if(e)return{main:e,light:dL(pL(e,.4)),dark:dL(fL(e,.15)),hover:dL(fL(e,.15)),active:dL(fL(e,.2))}},SL=e=>{if(e)return{main:e,light:pL(e,.7),dark:fL(e,.2)}},vL=(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)?R({},t,{palette:{primary:R({},gL(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:R({},gL(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:R({},gL(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:R({},SL(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:R({},SL(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:R({},SL(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:R({},SL(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},hL={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 mL{constructor(){this._theme=hL.theme,this._themeV2=hL.themeV2,this._navigation=hL.navigation,this._localizations=hL.localizations,this._integrations=hL.integrations}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new mL;return n.set(e),mL._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=sL().all([null!=(t=hL.navigation)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=sL().all([null!=(i=hL.theme)?i:{},vL(null==e?void 0:e.theme,hL.theme)]),this._themeV2=sL().all([null!=(o=hL.themeV2)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=sL().all([null!=(r=hL.localizations)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}]),this._integrations=sL().all([null!=(l=hL.integrations)?l:{},null!=(c=null==e?void 0:e.integrations)?c:{}])}catch(e){this._navigation=hL.navigation,this._theme=hL.theme,this._themeV2=hL.themeV2,this._localizations=hL.localizations,this._integrations=hL.integrations}}}mL._instances={};var AL=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},bL=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},TL=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)}))},EL=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 kL,OL,IL,PL,_L,LL,wL,UL,CL,DL,RL,NL;!function(e){e.phoneNumber="phoneNumber"}(kL||(kL={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(OL||(OL={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(IL||(IL={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(PL||(PL={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(_L||(_L={})),function(e){e.Invoices="invoices"}(LL||(LL={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(wL||(wL={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(UL||(UL={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(CL||(CL={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(DL||(DL={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(RL||(RL={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(NL||(NL={}));const ML={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},FL={hidden:"hidden",edit:"edit"};var GL="6.155.0-alpha.3",$L={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"},VL=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];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(GL),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=Ur,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:mL.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}xr.set($L,a.name),e.next=15;break;case 4:return e.prev=4,e.next=7,jr();case 7:t=e.sent,a.options.overrideFeatureFlags&&Object.assign(t,a.options.overrideFeatureFlags),xr.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){xr.set(R({},$L,e),a.name)},this.queryFeatureFlags=function(e){return xr.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:D(a.queryFeatureFlags([$r]),1)[0]}};var l=AL(n),c="frontegg-app-".concat(l);this.iframeRendering=r,this.name=l,this.options=R({},t,{contextOptions:R({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=c;var u,d,y=this.options.authOptions?R({},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=nL({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(R({},e))}},{key:"setSessionContext",value:function(e){Va.setSessionContext(R({},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=mL.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;mL.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:O})):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(ci.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(),EL(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,R({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 oL(),i?(0,iL.tE)(t,e,n):aL(null==e||null==(o=e.features)?void 0:o[t],zs.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 oL(),i?(0,iL.wJ)(t,e,n):aL(null==e||null==(o=e.permissions)?void 0:o[t],zs.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:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),xL=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",o=U.getInstance(i);e&&t?(Va.setAccessToken(t),Va.setUser(R({},n,{accessToken:t})),o.store.dispatch(xi.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(xi.loadTenants())):(Va.setAccessToken(null),Va.setUser(null),o.store.dispatch(xi.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),jL=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}(),BL=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}(),WL=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},zL=function(){function e(t,n,i,o){var a=!(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,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=nL({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=R({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},o),this.app=new VL(this.options,t,!0),mL.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,TL(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}(),KL="modern",HL=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[KL]},qL=function(){function e(t,n,i,o){var a=!(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,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=nL({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=R({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},o),this.app=new VL(this.options,t,!0,a),mL.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,TL(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 JL(e,t){return JL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},JL(e,t)}function YL(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&&JL(e,t)}function QL(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 XL(e){return XL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},XL(e)}function ZL(){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 ew(e,t,n){return ew=ZL()?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&&JL(o,n.prototype),o},ew.apply(null,arguments)}function tw(e){var t="function"==typeof Map?new Map:void 0;return tw=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 ew(e,arguments,XL(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),JL(n,e)},tw(e)}function nw(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=XL(e);if(t){var o=XL(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return QL(this,n)}}var iw=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new VL(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){YL(n,e);var t=nw(n);function n(){var e;I(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=bL(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=bL(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=bL(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=bL(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=bL(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=bL(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}(tw(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}()}));
|