@frontegg/js 6.159.0 → 6.160.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 uL},AdminPortalRenderer:function(){return fL},AppHolder:function(){return C},CheckoutDialog:function(){return dL},FronteggApp:function(){return lL},HostedLogin:function(){return cL},LoginBoxRenderer:function(){return SL},createElement:function(){return B_},defaultTheme:function(){return pL},formatName:function(){return j_},getThemeAdminByName:function(){return yL},getThemeByName:function(){return gL},initialize:function(){return OL},mockFlagsList:function(){return sL},restoreSearchParams:function(){return z_},waitThemeSetter:function(){return W_}});var e={};n.r(e),n.d(e,{Delete:function(){return Ur},Get:function(){return _r},Patch:function(){return wr},Post:function(){return Lr},PostDownload:function(){return Rr},Put:function(){return Cr},extractHeadersFromOptions:function(){return Dr},getBaseUrl:function(){return Or},getMetadataHeaders:function(){return Ir}});var t={};n.r(t),n.d(t,{FeatureFlags:function(){return Gr},loadFeatureFlags:function(){return $r}});var o={};n.r(o),n.d(o,{GetUserJwt:function(){return Vr},getCurrentUserTenantsV1:function(){return Kr},getCurrentUserTenantsV3:function(){return zr},getUsersGroups:function(){return Wr},getUsersRoles:function(){return Br},getUsersV2:function(){return xr},getUsersV3:function(){return jr},sendResetBreachedPasswordEmails:function(){return qr},updateUserProfileV2:function(){return Hr}});var a={};n.r(a),n.d(a,{getHierarchyMetadata:function(){return rs},getParentTenants:function(){return ns},getParentTenantsById:function(){return is},getSubTenants:function(){return es},getSubTenantsAsTree:function(){return ts},getTenants:function(){return Zr},getTenantsUsersCount:function(){return os},searchSubTenants:function(){return as},switchTenant:function(){return Xr}});var r={};n.r(r),n.d(r,{loadEntitlements:function(){return Vs},loadEntitlementsV2:function(){return xs}});var s={};n.r(s),n.d(s,{AuthStrategyEnum:function(){return ki},MachineToMachineAuthStrategy:function(){return Oi},OAuthLogout:function(){return hl},SocialLoginProviders:function(){return Ei},acceptInvitation:function(){return fl},activateAccount:function(){return ll},activateAccountV2:function(){return cl},bulkCreateIPRestriction:function(){return Ps},changePhoneNumber:function(){return bu},changePhoneNumberWithVerification:function(){return mu},checkIfAllowToRememberMfaDevice:function(){return Bc},createDomainRestriction:function(){return bs},createIPRestriction:function(){return Is},createOrUpdateSessionConfigrations:function(){return Pc},createSSOConfiguration:function(){return Jc},createSSOConfigurationByMetadata:function(){return Xc},createSSOConfigurationByMetadataUrl:function(){return eu},createSSODomain:function(){return nu},createSSOGroup:function(){return su},createSamlGroup:function(){return dc},createTenantAccessToken:function(){return Nc},createUserAccessToken:function(){return Dc},deleteAllSessionsForUser:function(){return Lc},deleteDomainRestriction:function(){return Es},deleteIPRestriction:function(){return Ls},deleteSSOConfiguration:function(){return Qc},deleteSSODomain:function(){return iu},deleteSSOGroup:function(){return cu},deleteSamlGroup:function(){return fc},deleteSessionForUser:function(){return _c},deleteTenantAccessToken:function(){return Uc},deleteTenantApiToken:function(){return Vc},deleteUserAccessToken:function(){return Rc},deleteUserApiToken:function(){return xc},deleteWebAuthnDevice:function(){return Pu},disableMFAAuthenticatorApp:function(){return Ul},disableMFASMS:function(){return Dl},disableMFAWebAuthn:function(){return Ml},disableMfa:function(){return Cl},enrollMFAAuthenticatorApp:function(){return Ol},enrollMFAAuthenticatorAppForLogin:function(){return $l},enrollMFAAuthenticatorAppForLoginV2:function(){return Vl},enrollMFASMS:function(){return Pl},enrollMFASMSForLogin:function(){return Kl},enrollMFASMSForLoginV2:function(){return ql},enrollMFAWebAuthn:function(){return Ll},enrollMFAWebAuthnForLogin:function(){return Xl},enrollMFAWebAuthnForLoginV2:function(){return Zl},enrollMfa:function(){return El},exchangeOAuthTokens:function(){return gu},exchangeOAuthTokensV2:function(){return fu},forgotPassword:function(){return ml},generateLoginResponse:function(){return qs},generateLoginResponseFromOAuthResponse:function(){return Xs},generateLoginResponseFromOAuthResponseV2:function(){return Zs},generateLoginResponseV2:function(){return Hs},generateLoginResponseV3:function(){return Qs},generateStepupSession:function(){return Nu},getActivateAccountStrategy:function(){return ul},getCaptchaPolicy:function(){return ps},getCurrentUserSession:function(){return kc},getCurrentUserSessions:function(){return Ec},getCurrentUserTenantsFunction:function(){return Qr},getCustomSocialLoginProvidersV1:function(){return mc},getDomainRestrictions:function(){return ms},getDomainRestrictionsConfig:function(){return As},getGlobalSecurityPolicy:function(){return ss},getIPRestrictions:function(){return ks},getIPRestrictionsConfig:function(){return Os},getLockoutPolicy:function(){return ds},getMFADevices:function(){return Fl},getMFAStrategiesConfig:function(){return Cu},getMeAndEntitlements:function(){return Du},getMeV2:function(){return Ru},getMfaPolicy:function(){return ls},getOidcConfiguration:function(){return pc},getPasswordConfigPolicy:function(){return hs},getPasswordHistoryPolicy:function(){return gs},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return wu},getSSOConfigurations:function(){return Hc},getSSODefaultRoles:function(){return au},getSSOGroups:function(){return uu},getSSOPublicConfiguration:function(){return gc},getSamlConfiguration:function(){return ic},getSamlRoles:function(){return lc},getSamlRolesGroups:function(){return cc},getSamlVendorConfiguration:function(){return ac},getSessionConfigurations:function(){return Ic},getSocialLoginProviders:function(){return Sc},getSocialLoginProvidersV2:function(){return vc},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return hc},getTabTenantFromSessionStorage:function(){return Yr},getTenantAccessTokensData:function(){return Cc},getTenantApiTokensData:function(){return Fc},getUserAccessTokensData:function(){return wc},getUserApiTokensData:function(){return Mc},getUserAuthorization:function(){return Uu},getUserById:function(){return jc},getVendorConfig:function(){return bc},getVendorLockoutPolicy:function(){return ys},getVendorMfaPolicy:function(){return cs},getVendorPasswordHistoryPolicy:function(){return Ss},getVendorPublicAuthStrategiesConfig:function(){return Lu},getWebAuthnDevices:function(){return Iu},loadPasswordConfig:function(){return bl},login:function(){return ol},loginViaSocialLogin:function(){return Ac},loginWithMfa:function(){return rl},loginWithMfaV2:function(){return sl},loginv2:function(){return al},logout:function(){return vl},oidcPostLogin:function(){return il},oidcPostLoginV2:function(){return yu},passwordlessPostLogin:function(){return Kc},passwordlessPostLoginV2:function(){return zc},passwordlessPreLogin:function(){return Wc},postLogin:function(){return nl},preDisableMFASMS:function(){return Rl},preDisableMFAWebAuthn:function(){return Nl},preEnrollMFAAuthenticatorApp:function(){return kl},preEnrollMFAAuthenticatorAppForLogin:function(){return Gl},preEnrollMFASMS:function(){return Il},preEnrollMFASMSForLogin:function(){return zl},preEnrollMFAWebAuthn:function(){return _l},preEnrollMFAWebAuthnForLogin:function(){return Ql},preLogin:function(){return el},preLoginV2:function(){return du},preLoginWithIdpType:function(){return tl},preVerifyMFAEmailCode:function(){return jl},preVerifyMFASMSForLogin:function(){return Hl},preVerifyMFAWebAuthnForLogin:function(){return ec},recoverMfaToken:function(){return Tl},refreshToken:function(){return pl},refreshTokenV2:function(){return gl},refreshTokenV3:function(){return Sl},resendActivationEmail:function(){return dl},resendInvitationEmail:function(){return yl},resetPassword:function(){return Al},resetPhoneNumber:function(){return vu},revokeSessionsForUser:function(){return Oc},saveLockoutPolicy:function(){return fs},saveMfaPolicy:function(){return us},savePasswordHistoryPolicy:function(){return vs},setSSODefaultRoles:function(){return ru},setTabTenantInSessionStorage:function(){return Jr},signUpUser:function(){return Tc},silentOAuthRefreshToken:function(){return Su},silentOAuthRefreshTokenV2:function(){return pu},testCurrentIp:function(){return ws},testCurrentIpInAllowList:function(){return Cs},updateDomainRestrictionConfig:function(){return Ts},updateIPRestrictionConfig:function(){return _s},updateSSOConfiguration:function(){return Yc},updateSSOConfigurationByMetadata:function(){return Zc},updateSSOConfigurationByMetadataUrl:function(){return tu},updateSSOGroup:function(){return lu},updateSamlConfiguration:function(){return oc},updateSamlGroup:function(){return yc},updateSamlRoles:function(){return uc},updateSamlVendorMetadata:function(){return rc},updateTenantApiTokensData:function(){return $c},updateUserApiTokensData:function(){return Gc},validateSSODomain:function(){return ou},validateSamlDomain:function(){return sc},verifyChangePhoneNumber:function(){return Au},verifyInviteToken:function(){return qc},verifyMFAAuthenticatorAppForLogin:function(){return xl},verifyMFAEmailCode:function(){return Bl},verifyMFAEmailCodeV2:function(){return Wl},verifyMFASMSForLogin:function(){return Jl},verifyMFASMSForLoginV2:function(){return Yl},verifyMFAWebAuthnForLogin:function(){return tc},verifyMFAWebAuthnForLoginV2:function(){return nc},verifyMfa:function(){return wl},verifyNewDeviceSession:function(){return _u},verifyResetPhoneNumber:function(){return hu},webAuthnCreateNewDeviceSession:function(){return Ou},webAuthnPostLogin:function(){return Eu},webAuthnPostLoginV2:function(){return ku},webAuthnPreLogin:function(){return Tu}});var l={};n.r(l),n.d(l,{addUser:function(){return xu},changePassword:function(){return $u},createInviteUserLink:function(){return Wu},deleteInviteUserLink:function(){return Ku},deleteUser:function(){return ju},getInviteLinkConfiguration:function(){return Hu},getInviteUserLink:function(){return qu},getProfile:function(){return Mu},loadAvailablePermissions:function(){return Yu},loadAvailableRoles:function(){return Ju},loadStats:function(){return Qu},loadUsers:function(){return Vu},resendActivationLink:function(){return Xu},resendInvitationLink:function(){return Zu},resendInvitationLinkToAllTenants:function(){return ed},updateInviteUserLink:function(){return zu},updateProfile:function(){return Fu},updateProfileImage:function(){return Gu},updateUser:function(){return Bu}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return nd},getAuditsMetadata:function(){return sd},getCurrentUserIpMetadata:function(){return od},getIpAdressMetadata:function(){return ld},getNotificationsMetadata:function(){return ad},getSamlMetadata:function(){return rd},updateAdminBoxMetadata:function(){return id}});var u={};n.r(u),n.d(u,{downloadReport:function(){return Sd},getReport:function(){return fd},getReports:function(){return yd},renderReport:function(){return pd},scheduleReport:function(){return gd},sendReport:function(){return vd}});var d={};n.r(d),n.d(d,{getNotifications:function(){return hd},markAllAsRead:function(){return bd},updateNotificationIsPinned:function(){return Ad},updateNotificationStatus:function(){return md}});var y={};n.r(y),n.d(y,{exportAudits:function(){return Od},getAudits:function(){return Ed},getAuditsStats:function(){return kd}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return $d},deleteEmailSubscriptions:function(){return Fd},deleteSMSConfiguration:function(){return zd},deleteSMSSubscriptions:function(){return Bd},deleteSlackConfiguration:function(){return Ud},deleteWebhooksConfiguration:function(){return Hd},getCategories:function(){return Xd},getChannelMaps:function(){return Zd},getEmailConfiguration:function(){return Dd},getSMSConfiguration:function(){return Vd},getSlackChannels:function(){return wd},getSlackConfiguration:function(){return _d},getSlackScope:function(){return Ld},getWebhookLog:function(){return Jd},getWebhooksConfigurations:function(){return Kd},patchEmailConfiguration:function(){return Md},patchSMSConfiguration:function(){return jd},postEmailConfiguration:function(){return Nd},postSMSConfiguration:function(){return xd},postSlackCode:function(){return Rd},postSlackConfiguration:function(){return Cd},postWebhookRetry:function(){return Qd},postWebhookTest:function(){return Yd},postWebhooksConfiguration:function(){return qd},putEmailSubscriptions:function(){return Gd},putSMSSubscriptions:function(){return Wd}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return ny},getSettings:function(){return ty},updateSettings:function(){return ey}});var g={};n.r(g),n.d(g,{addRole:function(){return sy},attachPermissionToRoles:function(){return yy},attachPermissionsToRole:function(){return uy},deleteRole:function(){return ly},getPermissionCategories:function(){return fy},getPermissions:function(){return dy},getRoles:function(){return ry},updateRole:function(){return cy}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return zy},ISubscriptionStatus:function(){return By},PaymentMethodType:function(){return Wy},ProviderType:function(){return Ky},TenantCreatedAction:function(){return Hy},TrialEndAction:function(){return qy},cancelManagedSubscription:function(){return by},cancelSubscription:function(){return Sy},createStripeCustomer:function(){return Ny},createStripePaymentMethodSetupIntentSecret:function(){return Fy},createSubscription:function(){return Ry},createTenantConfiguration:function(){return Vy},getManagedSubscription:function(){return my},getManagedSubscriptions:function(){return Ay},getPaymentMethod:function(){return Cy},getPaymentMethods:function(){return wy},getPaymentProviders:function(){return xy},getStripeCustomer:function(){return Dy},getStripePaymentProviderConfiguration:function(){return My},getSubscription:function(){return gy},getSubscriptionInvoice:function(){return Py},getSubscriptionInvoicePdf:function(){return _y},getSubscriptionInvoices:function(){return Iy},getSubscriptionPlan:function(){return Oy},getSubscriptionPlans:function(){return ky},getSubscriptionSummaries:function(){return Gy},getSubscriptions:function(){return py},getTenantConfiguration:function(){return $y},getVendorPublicConfigurations:function(){return jy},renewManagedSubscription:function(){return Ty},renewSubscription:function(){return vy},updateManagedSubscription:function(){return Ey},updatePaymentMethodBillingDetails:function(){return Uy},updateSubscription:function(){return hy}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return Jy}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return Zy},addUserToTenantAndSubTenants:function(){return Qy},addUsersToSubTenant:function(){return sf},createSubTenant:function(){return nf},deleteSubTenant:function(){return of},loadAllUsers:function(){return Yy},removeUserFromTenantAndSubTenants:function(){return Xy},removeUserRolesFromSubTenants:function(){return ef},setUserRolesForSubTenants:function(){return tf},updateSubAccountAccess:function(){return rf},updateSubTenant:function(){return af}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return yf},createConfiguration:function(){return uf},deleteConfiguration:function(){return df},getConfigs:function(){return lf},updateConfiguration:function(){return cf}});var A={};n.r(A),n.d(A,{impersonate:function(){return ff}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return bf},addUsersToGroup:function(){return Ef},createGroup:function(){return hf},deleteGroup:function(){return Af},deleteRolesFromGroup:function(){return Tf},deleteUsersFromGroup:function(){return kf},getGroupById:function(){return gf},getGroupConfiguration:function(){return Of},getGroups:function(){return Sf},getGroupsByIds:function(){return vf},updateGroup:function(){return mf},updateGroupConfiguration:function(){return If}});var T={};n.r(T),n.d(T,{getInsights:function(){return _f},getRecommendations:function(){return Pf}});var E={};n.r(E),n.d(E,{createPhoneNumber:function(){return wf},deletePhoneNumber:function(){return Cf},getUserPhoneNumbers:function(){return Lf},preVerifyPhoneNumber:function(){return Uf},verifyDeletePhoneNumber:function(){return Df},verifyPhoneNumber:function(){return Rf}});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return Bs},AuthStrategyEnum:function(){return ki},ContextHolder:function(){return Fa},FeatureFlags:function(){return Gr},FronteggApiError:function(){return $a},FronteggContext:function(){return Ga},FronteggFrameworks:function(){return ui},GetUsersFilterPreset:function(){return fi},GroupManagedByEnum:function(){return Kf},GroupRelations:function(){return zf},ISubscriptionCancellationPolicy:function(){return zy},ISubscriptionStatus:function(){return By},InsightCode:function(){return Hf},LOAD_AUTHORIZATION_FF:function(){return $s},MFAStrategyEnum:function(){return Gs},MachineToMachineAuthStrategy:function(){return Oi},NotEntitledJustification:function(){return js},PaginationOrderEnum:function(){return di},PaymentMethodType:function(){return Wy},ProviderType:function(){return Ky},RecommendationActionKey:function(){return Jf},RecommendationCode:function(){return qf},RecommendationSeverity:function(){return Yf},RequestSource:function(){return ci},RestrictionType:function(){return Wn},ScimConnectionSource:function(){return Wf},SecondaryAuthStrategy:function(){return Ms},SecurityCategory:function(){return Qf},SocialLoginProviders:function(){return Ei},SortByEnum:function(){return yi},TenantSortByEnum:function(){return Mf},TenantType:function(){return Ff},USE_ENTITLEMENTS_V2_ENDPOINT_FF:function(){return Mr},UserManagedByEnum:function(){return Nf},WebAuthnDeviceType:function(){return Fs},api:function(){return Xf},countConfigurationUsers:function(){return yf},createConfiguration:function(){return uf},default:function(){return Zf},deleteConfiguration:function(){return df},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Gf},fronteggHeaders:function(){return li},fronteggRefreshTokenUrl:function(){return $f},fronteggSilentRefreshTokenUrl:function(){return Vf},fronteggTenantsUrl:function(){return jf},fronteggTenantsV3Url:function(){return Bf},fronteggUsersUrl:function(){return xf},getConfigs:function(){return lf},getCurrentUserTenantsFunction:function(){return Qr},getTabTenantFromSessionStorage:function(){return Yr},loadFeatureFlags:function(){return $r},providersArray:function(){return pi},setTabTenantInSessionStorage:function(){return Jr},updateConfiguration:function(){return cf}});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 iL},AccountPageFields:function(){return Y_},DomainRestrictionsTabFields:function(){return nL},GeneralSettingsTabFields:function(){return eL},InviteUserModalFields:function(){return J_},IpRestrictionsTabFields:function(){return tL},Metadata:function(){return x_},PrivacyPageFields:function(){return H_},ProfilePageFields:function(){return q_},SecurityPageTabs:function(){return X_},SessionManagementTabFields:function(){return Z_},SignupFields:function(){return K_},SubscriptionsPageFields:function(){return Q_},alpha:function(){return D_},fieldAppearance:function(){return oL},tabAppearance:function(){return aL}});var C=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 U(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 U(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)?U(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)}))}}C._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=Ce;n&&(o=[i],a=Ue);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={},Ce={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)}},Ue={};j(Ce,(function(e,t){Ue[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ue.deleteProperty=function(e,t){return Ue.set.call(this,e,t,void 0)},Ue.set=function(e,t,n){return Ce.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 Ce.get(t,e)},set:function(t){var n=this[Ie];Ce.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 Ct="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Ut="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})},Cn={loadAccountSettings:yt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:yt("auth/saveAccountSettings",(e=>({payload:e})))},Un={tenants:[],subTenants:[],loading:!0,tenantTree:null},Rn={setTenantsState:vt("tenantsState"),resetTenantsState:St("tenantsState",{tenantsState:Un})},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={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:An,loginState:Ft,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:Un,rolesState:Nn,resetPhoneNumberState:Zt,sessionsState:Gn,sessionsPolicyState:xn,restrictionsState:zn,provisioningState:Hn,passkeysState:Qn,allAccountsState:gi,allAccountsDialogsState:hi,securityCenterState:Ai,smsState:Pi},Ci=D({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},wi);let Ui;!function(e){e.impersonating="impersonating",e.success="success"}(Ui||(Ui={}));const Ri={step:Ui.impersonating,loading:!1},Di={setImpersonateState:vt("impersonateState"),resetImpersonateState:St("impersonateState",{impersonateState:Ri})},Ni={impersonate:yt("impersonation/impersonate",(e=>({payload:e})))},{reducer:Mi,actions:Fi}=pt({name:Rt,initialState:Ci,reducers:D({resetState:e=>D({},e,wi),setState:(e,{payload:t})=>D({},e,t),setUser:("user",(e,{payload:t})=>D({},e,{user:t})),setEntitlements:ht("user","entitlements")},Gt,vn,jt,Di,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 Gi=D({loadEntitlements:yt("auth/loadEntitlements",(e=>({payload:e})))},Fi,$t,hn,Bt,qt,Qt,tn,Tn,ln,si,an,yn,gn,ni,{},On,_n,Cn,Dn,Fn,Vn,Bn,qn,Yn,Ni,Zn,vi,Ti,Li);var $i=function(e){return"@@redux-saga/"+e},Vi=$i("CANCEL_PROMISE"),xi=$i("CHANNEL_END"),ji=$i("IO"),Bi=$i("MATCH"),Wi=$i("MULTICAST"),zi=$i("SAGA_ACTION"),Ki=$i("SELF_CANCELLATION"),qi=$i("TASK"),Hi=$i("TASK_CANCEL"),Ji=$i("TERMINATE"),Yi=$i("LOCATION");function Qi(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 Xi=function(e){return null==e},Zi=function(e){return null!=e},eo=function(e){return"function"==typeof e},to=function(e){return"string"==typeof e},no=Array.isArray,io=function(e){return e&&eo(e.then)},oo=function(e){return e&&eo(e.next)&&eo(e.throw)},ao=function e(t){return t&&(to(t)||lo(t)||eo(t)||no(t)&&t.every(e))},ro=function(e){return e&&eo(e.take)&&eo(e.close)},so=function(e){return eo(e)&&e.hasOwnProperty("toString")},lo=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},co=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[Vi]=function(){clearTimeout(n)},i},uo=function(e){return function(){return e}},yo=uo(!0),fo=function(){},po=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var go=function(e,t){D(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function So(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var vo=function(e){throw e},ho=function(e){return{value:e,done:!0}};function mo(e,t,n){void 0===t&&(t=vo),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:ho,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Ao(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var bo=function(e){return Array.apply(null,new Array(e))},To=function(e){return function(t){return e(Object.defineProperty(t,zi,{value:!0}))}},Eo=function(e){return e===Ji},ko=function(e){return e===Hi},Oo=function(e){return Eo(e)||ko(e)};function Io(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=no(e)?bo(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||Oo(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=fo,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function Po(e){return{name:e.name||"anonymous",location:_o(e)}}function _o(e){return e[Yi]}var Lo=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)},wo="TAKE",Co="CALL",Uo="FORK",Ro="SELECT",Do=function(e,t){var n;return(n={})[ji]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function No(e,t){return void 0===e&&(e="*"),ao(e)?(Zi(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Do(wo,{pattern:e})):ro(n=e)&&n[Wi]&&Zi(t)&&ao(t)?Do(wo,{channel:e,pattern:t}):ro(e)?(Zi(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Do(wo,{channel:e})):void 0;var n}function Mo(e,t){return Xi(t)&&(t=e,e=void 0),Do("PUT",{channel:e,action:t})}function Fo(e){var t=Do("ALL",e);return t.combinator=!0,t}function Go(e,t){var n,i=null;return eo(e)?n=e:(no(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&to(n)&&eo(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function $o(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 Do(Co,Go(e,n))}function Vo(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 Do(Uo,Go(e,n))}function xo(e){return void 0===e&&(e=Ki),Do("CANCEL",e)}function jo(e){void 0===e&&(e=po);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Do(Ro,{selector:e,args:n})}var Bo=$o.bind(null,co);var Wo=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},zo=[],Ko=0;function qo(e){try{Yo(),e()}finally{Qo()}}function Ho(e){zo.push(e),Ko||(Yo(),Xo())}function Jo(e){try{return Yo(),e()}finally{Xo()}}function Yo(){Ko++}function Qo(){Ko--}function Xo(){var e;for(Qo();!Ko&&void 0!==(e=zo.shift());)qo(e)}var Zo=function(e){return function(t){return e.some((function(e){return oa(e)(t)}))}},ea=function(e){return function(t){return e(t)}},ta=function(e){return function(t){return t.type===String(e)}},na=function(e){return function(t){return t.type===e}},ia=function(){return yo};function oa(e){var t="*"===e?ia:to(e)?ta:no(e)?Zo:so(e)?ta:eo(e)?ea:lo(e)?na:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var aa={type:xi},ra=function(e){return e&&e.type===xi};function sa(){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(aa)}))},(e={})[Wi]=!0,e.put=function(e){if(!t)if(ra(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[Bi](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=ia),t?e(aa):(e[Bi]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),So(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[zi]?s(e):Ho((function(){s(e)}))},r}function la(e,t){var n=e[Vi];eo(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var ca,ua=0,da=function(){return++ua};function ya(e){e.isRunning()&&e.cancel()}var fa=((ca={}).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):!ra(e)||r?n(e):n(Ji)};try{o.take(s,Zi(a)?oa(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},ca.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Ho((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&io(t)?la(t,n):n(t)}))},ca.ALL=function(e,t,n,i){var o=i.digestEffect,a=ua,r=Object.keys(t);if(0!==r.length){var s=Io(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(no(t)?[]:{})},ca.RACE=function(e,t,n,i){var o=i.digestEffect,a=ua,r=Object.keys(t),s=no(t)?bo(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Oo(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=fo,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)}))},ca.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(io(l))return void la(l,n);if(oo(l))return void Ea(e,l,s.context,ua,Po(a),!1,n);n(l)}catch(e){n(e,!0)}},ca.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){Xi(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},ca.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(oo(o))return o;var a=!1;return mo((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!io(o)})}))}catch(e){return mo((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Po(t)}(c,a);Jo((function(){var t=Ea(e,c,l.context,ua,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},ca.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()&&So(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(no(t)){if(0===t.length)return void n([]);var r=Io(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},ca.CANCEL=function(e,t,n,i){var o=i.task;t===Ki?ya(o):no(t)?t.forEach(ya):ya(t),n()},ca.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)}},ca.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Lo());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(aa):e.isEmpty()?(n.push(i),i.cancel=function(){So(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(aa):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])(aa)}}}}(t.buffer),a=oa(i),r=function t(n){ra(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)},ca.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},ca.FLUSH=function(e,t,n){t.flush(n)},ca.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},ca.SET_CONTEXT=function(e,t,n,i){var o=i.task;go(o.context,t),n()},ca);function pa(e,t){return e+"?"+t}function ga(e){var t=e.name,n=e.location;return n?t+" "+pa(n.fileName,n.lineNumber):t}function Sa(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 va=null,ha=[],ma=function(e){e.crashedEffect=va,ha.push(e)},Aa=function(){va=null,ha.length=0},ba=function(){var e,t,n=ha[0],i=ha.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=_o(e))?t.code+" "+pa(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+ga(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+ga(e.meta)})),[Sa(ha)]).join("\n")};function Ta(e,t,n,i,o,a,r){var s;void 0===r&&(r=fo);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||(So(o,t),t.cont=fo,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=fo,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,ma({meta:o,cancelledTasks:y}),S.isRoot){var i=ba();Aa(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Hi?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={})[qi]=!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(Hi,!1))},s.cont=r,s.end=g,s.setContext=function(e){go(f,e)},s.toPromise=function(){return d||(d=Wo(),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 Ea(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){io(t)?la(t,i):oo(t)?Ea(e,t,c.context,n,o,!1,i):t&&t[ji]?(0,fa[t.type])(e,t.payload,i,u):i(t)}));d.cancel=fo;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(Hi))},status:0},c=Ta(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),Aa()):ko(e)?(l.status=1,d.cancel(),o=eo(t.return)?t.return(Hi):{done:!0,value:Hi}):o=Eo(e)?eo(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=da();function l(n,o){a||(a=!0,i.cancel=fo,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){va=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=fo,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=fo,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function ka(e,t){for(var n=e.channel,i=void 0===n?sa():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?Ao: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=da();if(l&&(l.rootSagaStarted=l.rootSagaStarted||fo,l.effectTriggered=l.effectTriggered||fo,l.effectResolved=l.effectResolved||fo,l.effectRejected=l.effectRejected||fo,l.effectCancelled=l.effectCancelled||fo,l.actionDispatched=l.actionDispatched||fo,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=po;var m={channel:i,dispatch:To(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:g};return Jo((function(){var e=Ea(m,S,s,v,Po(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var Oa=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?sa():a,s=n.sagaMonitor,l=Qi(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=ka.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){go(o,e)},c},Ia=function(e){return{done:!0,value:e}},Pa={};function _a(e){return ro(e)?"channel":so(e)?String(e):eo(e)?e.name:String(e)}function La(e,t,n){var i,o,a,r=t;function s(t,n){if(r===Pa)return Ia(t);if(n&&!o)throw r=Pa,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===Pa?Ia(t):a}return mo(s,(function(e){return s(null,e)}),n)}function wa(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:No(e)},s=function(e){return{done:!1,value:Vo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return La({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+_a(e)+", "+t.name+")")}function Ca(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:No(e)},l=function(e){return{done:!1,value:Vo.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:xo(e)}},u=function(e){return a=e},d=function(e){return r=e};return La({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("+_a(e)+", "+t.name+")")}function Ua(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:No(e)},s=function(e){return{done:!1,value:$o.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return La({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+_a(e)+", "+t.name+")")}function Ra(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:$o.apply(void 0,[n].concat(a))},l={done:!1,value:Bo(t)};return La({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:Pa}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.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];return Vo.apply(void 0,[wa,e,t].concat(i))}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];return Vo.apply(void 0,[Ca,e,t].concat(i))}function Ma(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Vo.apply(void 0,[Ua,e,t].concat(i))}class Fa{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 Fa.instance||(Fa.instance=new Fa),Fa.instance}static setContext(e){Fa.getInstance().context=e}static setAccessToken(e){Fa.getInstance().accessToken=e}static setUser(e){Fa.getInstance().user=e}static setRequestSource(e){Fa.getInstance().requestSource=e}static setOnRedirectTo(e){Fa.getInstance().onRedirectTo=e}static setLogout(e,t){Fa.getInstance().logout=n=>{n?e(n):Fa.onRedirectTo(t)}}static setEntitlementsOptions(e){Fa.getInstance().entitlementsOptions=e}static setSessionContext(e){Fa.getInstance().sessionContext=e}static setAppName(e){Fa.getInstance().appName=e}static getContext(){var e;return null!=(e=Fa.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Fa.getInstance().accessToken}static getRequestSource(){return Fa.getInstance().requestSource}static getUser(){return Fa.getInstance().user}static onRedirectTo(e,t){return Fa.getInstance().onRedirectTo(e,t)}static logout(e){return Fa.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=Fa.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static isSessionPerTenantEnabled(){var e;return(null==(e=Fa.getInstance().sessionContext)?void 0:e.enableSessionPerTenant)||!1}static getAppName(){return Fa.getInstance().appName}}Fa.instance=void 0;const Ga={getContext:()=>Fa.getContext(),getAccessToken:()=>Fa.getAccessToken(),getUser:()=>Fa.getUser(),onRedirectTo:(e,t)=>Fa.onRedirectTo(e,t),logout:e=>Fa.logout(e)};class $a extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Va={v1:"/identity/resources/users/webauthn/v1/devices"},xa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},ja={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"}},Ba={v1:"/identity/resources/configurations/v1"},Wa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},za={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ka={v1:"/identity/resources/permissions/v1"},qa={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"}},Ha={v1:"/identity/resources/roles/v1"},Ja={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Ya={v1:"/identity/resources/impersonation/v1"},Qa={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Xa={v1:"/identity/resources/users/phone-numbers/v1"},Za={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},er={v1:"/team/resources/members/v1"},tr={v1:"/team/resources/roles/v1"},nr={v1:"/team/resources/stats/v1"},ir={v1:"/team/resources/profile"},or={v1:"/tenants/resources/account-settings/v1"},ar={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"}},rr={v1:"/tenants/resources/sub-tenants/v1"},sr={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},lr={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"}}}},cr={v1:"/subscriptions/resources/payment-providers/v1"},ur={v1:"/subscriptions/resources/subscriptions/v1"},dr={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},yr={v1:"/reports/engine/resources/triggers/v1"},fr="/notification",pr="/audits",gr={v1:"/event/resources/configurations/v1"},Sr="/webhook",vr="/oauth",hr="/flags",mr="/directory/resources/v1/configurations/scim2",Ar="/directory/resources/scim/temp",br="/entitlements/api/v1/user-entitlements",Tr="/entitlements/api/v2/user-entitlements",Er={v1:"/security-center/resources/recommendations/v1"},kr={v1:"/security-center/resources/insights/v1"};function Or(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 Ir(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 Pr=async e=>{var t,n,i;const o=Fa.getContext(),a=await async function(e,t){var n;const i=Ir(e),o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Fa.getAccessToken)(),a=Fa.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=Or(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 $a("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 $a(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{}}},_r=async(e,t,n)=>Pr(D({url:e,method:"GET",contentType:"application/json",params:t},n)),Lr=async(e,t,n)=>Pr(D({url:e,method:"POST",contentType:"application/json",body:t},n)),wr=async(e,t,n)=>Pr(D({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Cr=async(e,t,n)=>Pr(D({url:e,method:"PUT",contentType:"application/json",body:t},n)),Ur=async(e,t,n)=>Pr(D({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Rr=async(e,t,n,i)=>Pr(D({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),Dr=(e={})=>D({},e.jwt?{Authorization:e.jwt}:{}),Nr="FRONTEGG_SEPARATE_TABS_BY_TENANT",Mr="admin_portal_use_entitlements_v2_endpoint",Fr={flags:{}};class Gr{constructor(){var e;this._flags={},this._flags=null!=(e=Fr.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Gr;return n.set(e),Gr._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==Fr?void 0:Fr.flags)?t:{},null!=e?e:{})}}async function $r(){return _r(hr)}async function Vr(e){return Lr(`${ja.v3}/me/token`,e)}async function xr(e,t){return _r(ja.v2,e,{headers:Dr(t)})}async function jr(e,t){return _r(ja.v3,e,{headers:Dr(t)})}async function Br(e,t){return _r(ja.roles.v3,D({},e,{ids:e.ids.join(",")}),{headers:Dr(t)})}async function Wr(e,t){return _r(ja.groups.v3,D({},e,{ids:e.ids.join(",")}),{headers:Dr(t)})}async function zr(e){return _r(ja.tenants.me.v3,void 0,{headers:Dr(e)})}async function Kr(e){return _r(ja.tenants.me.v1,void 0,{headers:Dr(e)})}async function qr(){return Lr(ja.passwords.resetBreachedPasswords.v1)}async function Hr(e){return Cr(`${ja.v2}/me`,e)}function Jr(e){e&&sessionStorage.setItem(Nr,e)}function Yr(){return Fa.isSessionPerTenantEnabled()?sessionStorage.getItem(Nr):null}function Qr(){const[e]=Gr.getFeatureFlags(["admin_portal_use_current_user_tenants_v1_endpoint"],Fa.getAppName()||"");return Fa.isSessionPerTenantEnabled()||e?Kr:zr}async function Xr(e){return Fa.isSessionPerTenantEnabled()&&Jr(e.tenantId),Cr(`${ja.v1}/tenant`,e)}async function Zr(){return _r(`${ja.v2}/me/tenants`)}async function es(e){return _r(ar.v1,void 0,{headers:Dr(e)})}async function ts(e){return _r(ar.tree.v1,void 0,{headers:Dr(e)})}async function ns(e){return _r(ar.parents.v1,void 0,{headers:Dr(e)})}async function is(e,t){return _r(`${ar.parents.v1}/${e}`,void 0,{headers:Dr(t)})}async function os(e,t){return Lr(`${qa.users.v1}/count`,e,{headers:Dr(t)})}async function as(e,t){return _r(ar.v2,e,{headers:Dr(t)})}async function rs(e,t){return _r(ar.metadata.v2,D({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Dr(t)})}async function ss(){return _r(Ba.v1)}async function ls(){return _r(`${Ba.v1}/mfa-policy`)}async function cs(){return _r(`${Ba.v1}/mfa-policy/vendor`)}async function us(e){return e.id?wr(`${Ba.v1}/mfa-policy`,e):Lr(`${Ba.v1}/mfa-policy`,e)}async function ds(){return _r(`${Ba.v1}/lockout-policy`)}async function ys(){return _r(`${Ba.v1}/lockout-policy/vendor`)}async function fs(e){return e.id?wr(`${Ba.v1}/lockout-policy`,e):Lr(`${Ba.v1}/lockout-policy`,e)}async function ps(){try{return await _r(`${Ba.v1}/captcha-policy/public`)}catch{return null}}async function gs(){return _r(`${Ba.v1}/password-history-policy`)}async function Ss(){return _r(`${Ba.v1}/password-history-policy/vendor`)}async function vs(e){return e.id?wr(`${Ba.v1}/password-history-policy`,e):Lr(`${Ba.v1}/password-history-policy`,e)}async function hs(){return _r(`${Ba.v1}/password`)}async function ms(){return _r(`${Wa.emailDomain.v1}`)}async function As(){return _r(`${Wa.emailDomain.v1}/config`)}async function bs(e){return Lr(`${Wa.emailDomain.v1}`,e)}async function Ts(e){return Lr(`${Wa.emailDomain.v1}/config`,e)}async function Es(e){return Ur(`${Wa.emailDomain.v1}/${e}`)}async function ks(e){return _r(`${Wa.ip.v1}`,e)}async function Os(){return _r(`${Wa.ip.v1}/config`)}async function Is(e){return Lr(`${Wa.ip.v1}`,e)}async function Ps(e){return Lr(`${Wa.ip.v1}/bulk`,e)}async function _s(e){return Lr(`${Wa.ip.v1}/config`,e)}async function Ls(e){return Ur(`${Wa.ip.v1}/${e}`)}async function ws(){return Lr(`${Wa.ip.v1}/verify`)}async function Cs(){return Lr(`${Wa.ip.v1}/verify/allow`)}Gr._instances={};class Us extends Error{constructor(e){super(e)}}const Rs="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Us("'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 Ds extends Error{constructor(e){super(e)}}const Ns=(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(Rs(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 Rs(t)}})(e.split(".")[n]))}catch(e){throw new Ds("Invalid token specified: "+e.message)}};let Ms,Fs,Gs;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}(Ms||(Ms={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Fs||(Fs={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(Gs||(Gs={}));const $s="admin_portal_should_load_authorization";async function Vs(){return _r(br)}async function xs(){return _r(Tr)}let js;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(js||(js={}));const Bs="admin_portal_entitlements",Ws=["type"],zs=["type"],Ks=["type"];async function qs(e){if(!e.accessToken)return e;Fa.setAccessToken(e.accessToken);const t=await Du(),n=D({},e,e.accessToken?Ns(e.accessToken):{},t);return Fa.setUser(n),n}async function Hs(e){if(!e.accessToken)return{user:e};Fa.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Du(),Zr()]),i=D({},e,e.accessToken?Ns(e.accessToken):{},t);return Fa.setUser(i),{user:i,tenants:n}}function Js(){if(!Fa.shouldLoadEntitlements())return!1;const[e]=Gr.getFeatureFlags([Bs],Fa.getAppName()||"");return e}function Ys(){const[e]=Gr.getFeatureFlags([$s],Fa.getAppName()||"");return e}async function Qs(e){const{accessToken:t}=e;if(!t)return{user:e};Fa.setAccessToken(t);const[n,i]=await Promise.all([Du(),Qr()()]),o=D({},e,t?Ns(t):{},n);return Fa.isSessionPerTenantEnabled()&&Jr(o.tenantId),Fa.setUser(o),{user:o,tenants:i.tenants,activeTenant:i.activeTenant}}async function Xs(e){Fa.setAccessToken(e.id_token);const t=await Du(),n=e.id_token?Ns(e.id_token):{},i=D({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Fa.setUser(i),i}async function Zs(e){Fa.setAccessToken(e.id_token);const[t,n]=await Promise.all([Du(),Qr()()]),i=e.id_token?Ns(e.id_token):{},o=D({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},i,t,{expiresIn:e.expires_in||300});return Fa.isSessionPerTenantEnabled()&&Jr(o.tenantId),Fa.setUser(o),{user:o,tenants:n.tenants,activeTenant:n.activeTenant}}async function el(e){try{const{address:t}=await Lr(`${xa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function tl(e){return Lr(`${xa.v1}/user/saml/prelogin`,e)}async function nl(e){return qs(await Lr(`${xa.v1}/user/saml/postlogin`,e))}async function il(e){return qs(await Lr(`${xa.v1}/user/oidc/postlogin`,e))}async function ol(e){return qs(await Lr(`${xa.v1}/user`,e))}async function al(e){return Qs(await Lr(`${xa.v1}/user`,e))}async function rl(e){return qs(await Lr(`${xa.v1}/user/mfa/verify`,e))}async function sl(e){return Qs(await Lr(`${xa.v1}/user/mfa/verify`,e))}async function ll(e){return Lr(`${ja.v1}/activate`,e)}async function cl(e){return Qs(await Lr(`${ja.v1}/activate`,e))}async function ul(e){return _r(`${ja.v1}/activate/strategy`,e)}async function dl(e){return Lr(`${ja.v1}/activate/reset`,e)}async function yl(e){return Lr(`${ja.v1}/invitation/reset`,e)}async function fl(e){return Lr(`${ja.v1}/invitation/accept`,e)}async function pl(){const e=Yr();return qs(await Lr(`${xa.v1}/user/token/refresh`,{tenantId:e}))}async function gl(){const e=Yr();return Hs(await Lr(`${xa.v1}/user/token/refresh`,{tenantId:e}))}async function Sl(){const e=Yr();return Qs(await Lr(`${xa.v1}/user/token/refresh`,{tenantId:e}))}async function vl(){return Lr(`${xa.v1}/logout`)}async function hl(e){return _r(`${vr}/logout`,e)}async function ml(e){return Lr(`${ja.v1}/passwords/reset`,e)}async function Al(e){return Lr(`${ja.v1}/passwords/reset/verify`,e)}async function bl(e){return _r(`${ja.v1}/passwords/config`,e)}async function Tl(e){return Lr(`${xa.v1}/user/mfa/recover`,e)}async function El(){return Lr(`${ja.v1}/mfa/enroll`)}async function kl(){return Lr(`${ja.v1}/mfa/authenticator/enroll`)}async function Ol(e){return Lr(`${ja.v1}/mfa/authenticator/enroll/verify`,e)}async function Il(e){return Lr(`${ja.v1}/mfa/sms/enroll`,e)}async function Pl(e){return Lr(`${ja.v1}/mfa/sms/enroll/verify`,e)}async function _l(){return Lr(`${ja.v1}/mfa/webauthn/enroll`)}async function Ll(e){return Lr(`${ja.v1}/mfa/webauthn/enroll/verify`,e)}async function wl(e){return Lr(`${ja.v1}/mfa/enroll/verify`,e)}async function Cl(e){return Lr(`${ja.v1}/mfa/disable`,e)}async function Ul(e,t){return Lr(`${ja.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Rl(e){return Lr(`${ja.v1}/mfa/sms/${e}/disable`)}async function Dl(e,t){return Lr(`${ja.v1}/mfa/sms/${e}/disable/verify`,t)}async function Nl(e){return Lr(`${ja.v1}/mfa/webauthn/${e}/disable`)}async function Ml(e,t){return Lr(`${ja.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Fl(){return _r(`${ja.v1}/mfa/devices`)}async function Gl(e){return Lr(`${xa.v1}/user/mfa/authenticator/enroll`,e)}async function $l(e){return Lr(`${xa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Vl(e){return Qs(await Lr(`${xa.v1}/user/mfa/authenticator/enroll/verify`,e))}async function xl(e,t){return Lr(`${xa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function jl(e){return Lr(`${xa.v1}/user/mfa/emailcode`,e)}async function Bl(e){return Lr(`${xa.v1}/user/mfa/emailcode/verify`,e)}async function Wl(e){return Qs(await Lr(`${xa.v1}/user/mfa/emailcode/verify`,e))}async function zl(e){return Lr(`${xa.v1}/user/mfa/sms/enroll`,e)}async function Kl(e){return Lr(`${xa.v1}/user/mfa/sms/enroll/verify`,e)}async function ql(e){return Qs(await Lr(`${xa.v1}/user/mfa/sms/enroll/verify`,e))}async function Hl(e,t){return Lr(`${xa.v1}/user/mfa/sms/${e}`,t)}async function Jl(e,t){return Lr(`${xa.v1}/user/mfa/sms/${e}/verify`,t)}async function Yl(e,t){return Qs(await Lr(`${xa.v1}/user/mfa/sms/${e}/verify`,t))}async function Ql(e){return Lr(`${xa.v1}/user/mfa/webauthn/enroll`,e)}async function Xl(e){return Lr(`${xa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Zl(e){return Qs(await Lr(`${xa.v1}/user/mfa/webauthn/enroll/verify`,e))}async function ec(e,t){return Lr(`${xa.v1}/user/mfa/webauthn/${e}`,t)}async function tc(e,t){return Lr(`${xa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function nc(e,t){return Qs(await Lr(`${xa.v1}/user/mfa/webauthn/${e}/verify`,t))}async function ic(){return _r(`${Za.v1}/saml/configurations`)}async function oc(e){return Lr(`${Za.v1}/saml/configurations`,e)}async function ac(){return _r(`${Za.v1}/saml/configurations/vendor-config`)}async function rc(e){return Cr(`${Za.v1}/saml/configurations/metadata`,e)}async function sc(){return Cr(`${Za.v1}/saml/validations/domain`)}async function lc(){return _r(`${Za.v1}/saml/configurations/roles/default`)}async function cc(){return _r(`${Za.v2}/saml/configurations/groups`)}async function uc({roleIds:e}){return Lr(`${Za.v1}/saml/configurations/roles/default`,{roleIds:e})}async function dc({roleIds:e,group:t}){return Lr(`${Za.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function yc({roleIds:e,group:t,id:n}){return wr(`${Za.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function fc({id:e}){return Ur(`${Za.v2}/saml/configurations/groups/${e}`)}async function pc(){return _r(`${Za.v1}/oidc/configurations`)}async function gc(){return _r(`${Za.v2}/configurations/public`)}async function Sc(){return _r(za.v1)}async function vc(){return _r(za.v2)}async function hc(){return _r(`${za.v2}/authenticated`)}async function mc(){return _r(za.custom.v1)}async function Ac({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),Lr(`${xa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function bc(){return _r(`${Ba.v1}/public`)}async function Tc(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Lr(`${ja.v1}/signUp`,e),a={shouldActivate:t,userId:i,tenantId:o};if(!t&&n){const{user:e,tenants:t,activeTenant:i}=await Qs(n);return D({},a,{user:e,tenants:t,activeTenant:i})}return a}async function Ec(){return _r(ja.sessions.currentUser.v1)}async function kc(){return _r(`${ja.sessions.currentUser.v1}/current`)}async function Oc(e){return Lr(`${ja.sessions.v1}/revoke`,{userId:e})}async function Ic(){return _r(ja.sessions.configurations.v1)}async function Pc(e){await Lr(ja.sessions.configurations.v1,e)}async function _c(e){await Ur(`${ja.sessions.currentUser.v1}/${e}`)}async function Lc(){await Ur(`${ja.sessions.currentUser.v1}/all`)}async function wc(){return _r(ja.accessTokens.v1)}async function Cc(){return _r(qa.accessTokens.v1)}async function Uc({id:e}){return Ur(`${qa.accessTokens.v1}/${e}`)}async function Rc({id:e}){return Ur(`${ja.accessTokens.v1}/${e}`)}async function Dc(e){return Lr(ja.accessTokens.v1,e)}async function Nc(e){return Lr(qa.accessTokens.v1,e)}async function Mc(){return _r(ja.apiTokens.v1)}async function Fc(){return _r(qa.apiTokens.v1)}async function Gc(e){return Lr(ja.apiTokens.v1,e)}async function $c(e){return Lr(qa.apiTokens.v2,e)}async function Vc({tokenId:e}){return Ur(`${qa.apiTokens.v1}/${e}`)}async function xc({tokenId:e}){return Ur(`${ja.apiTokens.v1}/${e}`)}async function jc({userId:e}){return _r(`${ja.v1}/${e}`)}async function Bc(e){return _r(`${Ba.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Wc(e){let{type:t}=e,n=Qi(e,Ws);return Lr(`${xa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function zc(e){let{type:t}=e,n=Qi(e,zs);return Qs(await Lr(`${xa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function Kc(e){let{type:t}=e,n=Qi(e,Ks);return Lr(`${xa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function qc({token:e}){return Lr(qa.invites.verify.v1,{token:e})}async function Hc(){return _r(`${Za.v1}/configurations`)}async function Jc(e){return Lr(`${Za.v1}/configurations`,e)}async function Yc(e,t){return wr(`${Za.v1}/configurations/${e}`,t)}async function Qc(e){return Ur(`${Za.v1}/configurations/${e}`)}async function Xc(e){return Lr(`${Za.v1}/configurations/metadata`,e)}async function Zc(e,t){return Cr(`${Za.v1}/configurations/${e}/metadata`,t)}async function eu(e){return Lr(`${Za.v1}/configurations/metadata-url`,e)}async function tu(e,t){return Cr(`${Za.v1}/configurations/${e}/metadata-url`,t)}async function nu(e,t){return Lr(`${Za.v1}/configurations/${e}/domains`,t)}async function iu(e,t){return Ur(`${Za.v1}/configurations/${e}/domains/${t}`)}async function ou(e,t){return Cr(`${Za.v1}/configurations/${e}/domains/${t}/validate`)}async function au(e){return _r(`${Za.v1}/configurations/${e}/roles`)}async function ru(e,t){return Cr(`${Za.v1}/configurations/${e}/roles`,t)}async function su(e,t){return Lr(`${Za.v1}/configurations/${e}/groups`,t)}async function lu(e,{roleIds:t,group:n,id:i}){return wr(`${Za.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function cu(e,t){return Ur(`${Za.v1}/configurations/${e}/groups/${t}`)}async function uu(e){return _r(`${Za.v1}/configurations/${e}/groups`)}async function du(e){return Lr(`${xa.v2}/user/sso/prelogin`,e)}async function yu(e){return qs(await Lr(`${xa.v2}/user/oidc/postlogin`,e))}async function fu(e){return Zs(await Lr(`${vr}/token`,e))}async function pu(){const e=Yr();return Zs(await Lr(`${vr}/authorize/silent`,{tenantId:e}))}async function gu(e){return Xs(await Lr(`${vr}/token`,e))}async function Su(){const e=Yr();return Xs(await Lr(`${vr}/authorize/silent`,{tenantId:e}))}async function vu(e){return Lr(`${ja.v1}/phone/reset`,e)}async function hu(e){return Lr(`${ja.v1}/phone/reset/verify`,e)}async function mu(e){return Lr(`${ja.v1}/phone`,e)}async function Au(e){return Lr(`${ja.v1}/phone/verify`,e)}async function bu(e){return Cr(`${ja.v1}/phone/change`,e)}async function Tu(e){return Lr(`${xa.v1}/webauthn/prelogin`,e)}async function Eu(e){return Lr(`${xa.v1}/webauthn/postlogin`,e)}async function ku(e){return Qs(await Lr(`${xa.v1}/webauthn/postlogin`,e))}async function Ou(){return Lr(Va.v1)}async function Iu(){return _r(Va.v1)}async function Pu(e){return Ur(`${Va.v1}/${e}`)}async function _u(e){return Lr(`${Va.v1}/verify`,e)}async function Lu(){return _r(`${Ba.v1}/auth/strategies/public`)}async function wu(){return _r(`${Ba.v1}/auth/strategies`)}async function Cu(){return _r(`${Ba.v1}/mfa/strategies`)}async function Uu(){return _r(`${ja.authorization.v1}`)}async function Ru(){return _r(`${ja.v2}/me`)}async function Du(){const[e]=Gr.getFeatureFlags([Mr],Fa.getAppName()||""),t=[{action:Ru,shouldLoad:!0},{action:e?xs:Vs,shouldLoad:Js()},{action:Uu,shouldLoad:Ys()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[n,i,o]=await Promise.all(t),a=Yr();return a&&(n.tenantId=a),D({},n,null!=o?o:{},{entitlements:i})}async function Nu(e){return Lr(`${xa.v1}/user/step-up/generate`,e)}async function Mu(e){return _r(`${ja.v2}/me`,null!=e?e:{addRoles:!0})}async function Fu(e){return Cr(`${ja.v2}/me`,e)}async function Gu(e){return Cr(`${ir.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function $u(e){return Lr(`${ja.v1}/passwords/change`,e)}async function Vu(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 _r(er.v1,D({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function xu(e){return Lr(ja.v2,D({},e,{provider:"local"}))}async function ju(e){return Ur(`${er.v1}/${e.userId}`)}async function Bu(e){return Cr(er.v1,e)}async function Wu(e){return Lr(qa.invites.user.v1,D({},e))}async function zu(e){return wr(qa.invites.user.v1,D({},e))}async function Ku(){return Ur(qa.invites.user.v1)}async function qu(){return _r(qa.invites.user.v1)}async function Hu(){return _r(qa.invites.configuration.v1)}async function Ju(){return _r(tr.v1)}async function Yu(){return _r(Ka.v1)}async function Qu(){return _r(`${nr.v1}/members`)}async function Xu(e){return Lr(`${er.v1}/${e.userId}/resendActivationEmail`,{})}async function Zu(e){return Lr(ja.v2,D({},e,{provider:"local"}))}async function ed(e){return Lr(ja.invitation.resendAll.v1,D({},e))}async function td(e){var t,n;const i=await _r("/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 nd(){return _r("/metadata/admin-box")}async function id(e){return Lr("/metadata/admin-box",e)}async function od(){const e=await _r("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const ad=async()=>td({entityName:"notifications"}),rd=async()=>td({entityName:"saml"}),sd=async()=>td({entityName:"audits"}),ld=async e=>async function(e){const t=await _r(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),cd=["dataFilters"],ud=["templateId","dataFilters"],dd=["dataFilters"];async function yd(e){return _r(`${dr.v2}/tenant-reports`,e)}async function fd(e){return _r(`${dr.v2}/${e.id}/tenant-reports`)}async function pd(e){let{dataFilters:t}=e,n=Qi(e,cd);return{html:await _r(`${yr.v1}/preview-report`,D({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function gd(e){let{templateId:t,dataFilters:n}=e,i=Qi(e,ud);return Lr(`${dr.v2}/${t}/tenant-reports`,D({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Sd(e){let{dataFilters:t}=e,n=Qi(e,dd);const i=await _r(`${yr.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 vd(e){return Lr(`${yr.v1}/tenant-reports`,e)}async function hd(e){return _r(fr,{params:e})}async function md(e){return Cr(`${fr}/status`,{params:e})}async function Ad(e){const{notificationId:t,pinStatus:n}=e;return Cr(`${fr}/${n}`,{notificationId:t})}async function bd(){return Lr(`${fr}/status/mark-all-read`)}const Td=["endpoint","headerProps"];async function Ed(e){return _r(pr,e)}async function kd(e){return _r(`${pr}/stats`,e)}async function Od(e){const{endpoint:t,headerProps:n}=e,i=Qi(e,Td);return Rr(`${pr}/export/${t}`,{properties:n},i)}const Id=["eventKey"],Pd=["eventKey"],_d=()=>_r(`${sr.v1}/slack`),Ld=()=>_r(`${sr.v1}/slack/applications`),wd=()=>_r(`${sr.v1}/slack/channels`),Cd=e=>e.id?wr(`${sr.v1}/slack/subscription/${e.id}`,e):Lr(`${sr.v1}/slack/subscriptions`,e),Ud=e=>Ur(`${sr.v1}/slack/subscriptions/${e.id}`),Rd=e=>Lr(`${sr.v1}/slack/applications/registrations`,{code:e}),Dd=()=>_r(`${sr.v1}/emails`),Nd=e=>{let{eventKey:t}=e,n=Qi(e,Id);return Lr(`${sr.v1}/emails/${t}`,n)},Md=({eventKey:e,enabled:t})=>wr(`${sr.v1}/emails/${e}`,{enabled:t}),Fd=(e,t)=>Ur(`${sr.v1}/emails/${e}/subscriptions/${t}`),Gd=(e,t,n)=>Cr(`${sr.v1}/emails/${t}/subscriptions/${e}`,n),$d=e=>Ur(`${sr.v1}/emails/${e}`),Vd=()=>_r(`${sr.v2}/sms`),xd=e=>{let{eventKey:t}=e,n=Qi(e,Pd);return Lr(`${sr.v2}/sms/${t}`,n)},jd=({eventKey:e,enabled:t})=>wr(`${sr.v2}/sms/${e}`,{enabled:t}),Bd=(e,t)=>Ur(`${sr.v2}/sms/${e}/subscriptions/${t}`),Wd=(e,t,n)=>Cr(`${sr.v2}/sms/${t}/subscriptions/${e}`,n),zd=e=>Ur(`${sr.v2}/sms/${e}`),Kd=()=>_r(Sr),qd=e=>e._id?wr(`${Sr}/${e._id}`,e):Lr(`${Sr}/custom`,e),Hd=e=>Ur(`${Sr}/${e}`),Jd=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return _r(`${Sr}/logs/?${i.toString()}`)},Yd=e=>Lr(`${Sr}/test`,e),Qd=e=>Lr(`${Sr}/logs/${e}/retries`),Xd=()=>_r(`${gr.v1}/categories`),Zd=e=>_r(gr.v1,{channels:e});async function ey(e,t){return Cr(or.v1,e,{headers:Dr(t)})}async function ty(e){return _r(or.v1,void 0,{headers:Dr(e)})}async function ny(){return _r(`${or.v1}/public`)}const iy=["roleId"],oy=["roleId"],ay=["permissionId"];async function ry(){return _r(Ha.v1)}async function sy(e){return Lr(Ha.v1,e)}async function ly({roleId:e}){return Ur(`${Ha.v1}/${e}`)}async function cy(e){let{roleId:t}=e,n=Qi(e,iy);return wr(`${Ha.v1}/${t}`,n)}async function uy(e){let{roleId:t}=e,n=Qi(e,oy);return Cr(`${Ha.v1}/${t}/permissions`,n)}async function dy(){return _r(Ka.v1)}async function yy(e){let{permissionId:t}=e,n=Qi(e,ay);return Cr(`${Ka.v1}/${t}/roles`,n)}async function fy(){return _r(`${Ka.v1}/categories`)}async function py(){return _r(lr.subscriptions.v1)}async function gy(e){return _r(`${lr.subscriptions.v1}/${e}`)}async function Sy(e){return Cr(`${lr.subscriptions.v1}/${e}/cancellations/`,{})}async function vy(e){return Cr(`${lr.subscriptions.v1}/${e}/renewals/`,{})}async function hy(e,{paymentMethodId:t,planId:n}){return Cr(`${lr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function my(e){return _r(`${ur.v1}/${e}`)}async function Ay(){return _r(`${ur.v1}`)}async function by(e){return Cr(`${ur.v1}/${e}/cancellations/`,{})}async function Ty(e){return Cr(`${ur.v1}/${e}/renewals/`,{})}async function Ey(e,{paymentMethodId:t,planId:n}){return Cr(`${ur.v1}/${e}`,{paymentMethodId:t,planId:n})}async function ky(){return _r(lr.plans.v1)}async function Oy(e){return _r(`${lr.plans.v1}/${e}`)}async function Iy(){return _r(lr.invoices.v1)}async function Py(e){return _r(`${lr.invoices.v1}/${e}`)}async function _y(e,t){return _r(`${lr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Ly=["email"];async function wy(){return _r(lr.paymentMethods.v1)}async function Cy(e){return _r(`${lr.paymentMethods.v1}/${e}`)}async function Uy(e,t){let{email:n}=t,i=Qi(t,Ly);return wr(`${lr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function Ry(e){return Lr(lr.paymentProviders.stripe.subscriptions.v1,e)}async function Dy(e){return _r(`${lr.paymentProviders.stripe.customers.v1}/${e}`)}async function Ny(e){return Lr(`${lr.paymentProviders.stripe.customers.v1}`,e)}async function My(){return _r(`${lr.paymentProviders.stripe.publicConfigurations.v1}`)}async function Fy(e){return Lr(`${lr.paymentProviders.stripe.setupIntents.v1}`,e)}async function Gy(e){return _r(`${lr.summaries.v1}/${e}`)}async function $y(e){return _r(`${lr.tenantConfiguration.v1}/${e}`)}async function Vy(e){return Lr(`${lr.tenantConfiguration.v1}`,e)}async function xy(){return _r(cr.v1)}async function jy(){return _r(`${lr.configurations.vendorPublicConfigurations.v1}`)}let By,Wy,zy,Ky,qy,Hy;async function Jy(){return _r("/vendors/public")}async function Yy(e){return _r(Ja.v1,e)}async function Qy(e){return Lr(Ja.v1,e)}async function Xy(e,t){return Ur(Ja.v1,e,{headers:Dr(t)})}async function Zy(e,t,n){return Lr(`${Ja.v1}/${e}/roles`,t,{headers:Dr(n)})}async function ef(e,t,n){return Ur(`${Ja.v1}/${e}/roles`,t,{headers:Dr(n)})}async function tf(e,t,n){return wr(`${Ja.v1}/${e}/roles`,t,{headers:Dr(n)})}async function nf(e,t){return Lr(rr.v1,e,{headers:Dr(t)})}async function of(e,t){return Ur(`${rr.v1}/${e}`,void 0,{headers:Dr(t)})}async function af({tenantId:e},t,n){return wr(`${rr.v1}/${e}`,t,{headers:Dr(n)})}async function rf(e,t,n){return Cr(`${Ja.v1}/${e}/access`,t,{headers:Dr(n)})}async function sf(e,t){return Lr(`${Ja.v2}/`,e,{headers:Dr(t)})}async function lf(){return _r(`${mr}`)}async function cf(e,t){return wr(`${mr}/${e}`,t)}async function uf(e){return Lr(`${mr}`,e)}async function df(e){return Ur(`${mr}/${e}`)}async function yf(e){return _r(`${Ar}/${e}/Users/count`)}async function ff(e){return Lr(`${Ya.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(By||(By={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Wy||(Wy={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(zy||(zy={})),(Ky||(Ky={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(qy||(qy={})),function(e){e.CREATE="create_customer"}(Hy||(Hy={}));const pf=["groupId"];async function gf({groupId:e},t){return _r(`${Qa.v1}/${e}`,D({},t))}async function Sf(e){return _r(`${Qa.v1}`,D({},e))}async function vf(e,t){return Lr(`${Qa.getByIds.v1}`,e,{params:t})}async function hf(e){return Lr(`${Qa.v1}`,e)}async function mf(e){let{groupId:t}=e,n=Qi(e,pf);return wr(`${Qa.v1}/${t}`,n)}async function Af(e){return Ur(`${Qa.v1}/${e}`)}async function bf(e,t){return Lr(`${Qa.v1}/${e}/roles`,t)}async function Tf(e,t){return Ur(`${Qa.v1}/${e}/roles`,t)}async function Ef(e,t){return Lr(`${Qa.v1}/${e}/users`,t)}async function kf(e,t){return Ur(`${Qa.v1}/${e}/users`,t)}async function Of(){return _r(`${Qa.configurations.v1}`)}async function If(e){return Lr(`${Qa.configurations.v1}`,e)}async function Pf(){return _r(Er.v1)}async function _f(){return _r(kr.v1)}async function Lf(e){return _r(`${Xa.v1}`,e)}async function wf(e){return Lr(`${Xa.v1}`,e)}async function Cf(e){return Ur(`${Xa.v1}/${e}`)}async function Uf(e){return Lr(`${Xa.v1}/preverify`,e)}async function Rf(e){return Lr(`${Xa.v1}/verify`,e)}async function Df(e,t){return Lr(`${Xa.v1}/${e}/delete/verify`,t)}let Nf,Mf,Ff;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Nf||(Nf={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(Mf||(Mf={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Ff||(Ff={}));const Gf=[/^(.*)\/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],$f=`${xa.v1}/user/token/refresh`,Vf=`${vr}/authorize/silent`,xf=`${ja.v2}/me`,jf=`${ja.v2}/me/tenants`,Bf=`${ja.v3}/me/tenants`;let Wf,zf,Kf,qf,Hf,Jf,Yf,Qf;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Wf||(Wf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(zf||(zf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Kf||(Kf={})),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"}(qf||(qf={})),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"}(Hf||(Hf={})),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"}(Jf||(Jf={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(Yf||(Yf={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(Qf||(Qf={}));const Xf={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 Zf={fetch:e,ContextHolder:Fa,FronteggContext:Ga,api:Xf,FronteggApiError:$a,AuthStrategyEnum:ki,MachineToMachineAuthStrategy:Oi,SocialLoginProviders:Ei,ISubscriptionCancellationPolicy:zy,ISubscriptionStatus:By,PaymentMethodType:Wy,ProviderType:Ky};let ep,tp;!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"}(ep||(ep={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(tp||(tp={}));const np="input is invalid type",ip="undefined"!=typeof ArrayBuffer,op="0123456789abcdef".split(""),ap=[-2147483648,8388608,32768,128],rp=[24,16,8,0],sp=[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],lp=["hex","array","digest","arrayBuffer"],cp=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),ip&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const up=function(e){return function(t){const n=new yp(!0).update(t);return null==n?void 0:n[e]()}},dp=function(e){return function(t,n){const i=new fp(t,!0).update(n);return null==i?void 0:i[e]()}};class yp{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=()=>yp.prototype.digest(),e?(cp[0]=cp[16]=cp[1]=cp[2]=cp[3]=cp[4]=cp[5]=cp[6]=cp[7]=cp[8]=cp[9]=cp[10]=cp[11]=cp[12]=cp[13]=cp[14]=cp[15]=0,this.blocks=cp):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(np);if(null===e)throw new Error(np);if(ip&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||ip&&ArrayBuffer.isView(e)))throw new Error(np);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]<<rp[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<rp[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<rp[3&o++],s[o>>2]|=(128|63&i)<<rp[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<rp[3&o++],s[o>>2]|=(128|i>>6&63)<<rp[3&o++],s[o>>2]|=(128|63&i)<<rp[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<rp[3&o++],s[o>>2]|=(128|i>>12&63)<<rp[3&o++],s[o>>2]|=(128|i>>6&63)<<rp[3&o++],s[o>>2]|=(128|63&i)<<rp[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]|=ap[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+sp[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+sp[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+sp[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+sp[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=op[e>>28&15]+op[e>>24&15]+op[e>>20&15]+op[e>>16&15]+op[e>>12&15]+op[e>>8&15]+op[e>>4&15]+op[15&e]+op[t>>28&15]+op[t>>24&15]+op[t>>20&15]+op[t>>16&15]+op[t>>12&15]+op[t>>8&15]+op[t>>4&15]+op[15&t]+op[n>>28&15]+op[n>>24&15]+op[n>>20&15]+op[n>>16&15]+op[n>>12&15]+op[n>>8&15]+op[n>>4&15]+op[15&n]+op[i>>28&15]+op[i>>24&15]+op[i>>20&15]+op[i>>16&15]+op[i>>12&15]+op[i>>8&15]+op[i>>4&15]+op[15&i]+op[o>>28&15]+op[o>>24&15]+op[o>>20&15]+op[o>>16&15]+op[o>>12&15]+op[o>>8&15]+op[o>>4&15]+op[15&o]+op[a>>28&15]+op[a>>24&15]+op[a>>20&15]+op[a>>16&15]+op[a>>12&15]+op[a>>8&15]+op[a>>4&15]+op[15&a]+op[r>>28&15]+op[r>>24&15]+op[r>>20&15]+op[r>>16&15]+op[r>>12&15]+op[r>>8&15]+op[r>>4&15]+op[15&r];return l+=op[s>>28&15]+op[s>>24&15]+op[s>>20&15]+op[s>>16&15]+op[s>>12&15]+op[s>>8&15]+op[s>>4&15]+op[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 fp extends yp{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(np);if(null===e)throw new Error(np);if(ip&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||ip&&ArrayBuffer.isView(e)))throw new Error(np)}var o;e.length>64&&(e=null==(o=new yp(!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}yp.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();yp.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),yp.prototype.finalize.call(this)}}}const pp=function(){const e=up("hex");e.create=function(){return new yp},e.update=function(t){return e.create().update(t)};for(let t=0;t<lp.length;++t){const n=lp[t];e[n]=up(n)}return e}();function gp(e,t){const n=D({},e);return t.forEach((e=>{delete n[e]})),n}async function Sp(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=pp.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function vp(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=dp("hex");e.create=function(e){return new fp(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<lp.length;++t){const n=lp[t];e[n]=dp(n)}}();const hp=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*mp(e){const t=yield jo((e=>e.root.appName));return Gr.getFeatureFlags(e,t)}const Ap={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},bp=D({},Ap,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Tp=[{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"}],Ep={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},kp=D({},Ep,{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}),Op={loading:!1,error:void 0,saving:!0,profile:Ep},Ip={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"},Pp={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:ki.EmailAndPassword,machineToMachineAuthStrategy:Oi.ClientCredentials},_p={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Lp={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},wp={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Cp={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},Up={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Rp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Dp={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Cp,roles:Rp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Np=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Mp={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:[Tp[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[Tp[0]],managedBy:Kf.FRONTEGG}]},Fp={id:Mp.id,email:Mp.email,name:Mp.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:[Tp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Gp={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:[Tp[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[Tp[0]],managedBy:Kf.FRONTEGG}]},$p={id:Gp.id,email:Gp.email,name:Gp.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:[Tp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Vp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},xp=[Gp,Mp],jp=[$p,Fp],Bp=[Vp],Wp=[{id:"my-tenant-id",isReseller:!1,name:"Frontegg demo",deletedAt:null,metadata:void 0,tenantId:"my-tenant-id",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date,address:void 0,timezone:void 0,dateFormat:void 0,timeFormat:void 0,currency:void 0,logo:void 0}],zp=[{id:"laptop",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15",createdAt:new Date,ipAddress:"190.194.88.251",current:!0},{id:"iphone",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Mobile/15E148 Safari/604.1",createdAt:new Date(Date.now()-1e4),ipAddress:"191.49.203.21"},{id:"tablet",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; SGP771 Build/32.2.A.0.253; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.98 Safari/537.36",createdAt:new Date(Date.now()-3e4),ipAddress:"130.19.196.136"},{id:"anotherlaptop",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15",createdAt:new Date(Date.now()-1002232300),ipAddress:"2.228.163.92"}],Kp={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},qp={isActive:!0,strategy:Wn.ALLOW},Hp=[{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"}],Jp=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(D({},Gp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Yp=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"}),Qp=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Jp(6),roles:[Yp("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Kf.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Jp(44),roles:[Yp("Editor")],managedBy:Kf.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Jp(8),roles:[Yp("Viewer")],managedBy:Kf.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Jp(5),roles:[Yp("Admin")],managedBy:Kf.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Jp(21),description:"BDR, AE, and inside sales",roles:[Yp("Viewer")],managedBy:Kf.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Jp(23),description:"Dev success and customer success",roles:[Yp("Admin")],managedBy:Kf.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Jp(10),description:"The marketing department",roles:[Yp("Viewer")],managedBy:Kf.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Jp(4),description:"Human resources",roles:[Yp("Viewer")],managedBy:Kf.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Jp(3),roles:[Yp("Viewer")],managedBy:Kf.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Jp(8),roles:[Yp("Editor")],managedBy:Kf.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Jp(4),roles:[Yp("Viewer")],managedBy:Kf.FRONTEGG}],Xp={scoring:{score:79},recommendations:{items:[{code:qf.FORCE_MFA,severity:Yf.WARNING,category:Qf.MFA},{code:qf.ENABLE_FORCE_RELOGIN,severity:Yf.WARNING,category:Qf.SESSIONS}]}},Zp={insights:{items:[{category:Qf.MFA,code:Hf.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:Qf.SESSIONS,code:Hf.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:Qf.PASSWORD,code:Hf.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:Qf.DOMAIN,code:Hf.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},eg={users:jp,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},tg={users:[jp[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},ng={users:[jp[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0};let ig,og,ag;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(ig||(ig={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(og||(og={})),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"}(ag||(ag={})),ag.profile,ag.privacy,ag.personalApiTokens,ag.account,ag.users,ag.groups,ag.security,ag.sso,ag.audits,ag.webhooks,ag.apiTokens,ag.roles,ag.subscriptions,ag.allAccounts;const rg=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},sg=e=>{const{pathname:t}=new URL(e),n=rg(e);return n?t+n:t},lg=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},cg="tenantId",ug=e=>e.mfaRequired&&e.mfaToken?(Fa.setAccessToken(null),Fa.setUser(null),!0):(Fa.setAccessToken(e.accessToken),Fa.setUser(e),!1),dg=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return cn.authenticatorApp;if(t)return cn.smsVerifyCode}return cn.verify},yg=e=>{if(1===e.length){const[t]=e;if(t===Gs.AuthenticatorApp)return cn.authenticatorApp;if(t===Gs.SMS)return cn.smsSetPhoneNumber;if(t===Gs.EmailCode)return cn.emailVerifyCode}return cn.verify};function*fg(e){let t=_t.loginWithTwoFactor,n={};const{loginState:i}=yield jo((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield $o(Xf.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:dg(e.mfaDevices)}:(n={step:yg(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 pg=(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 gg;function Sg(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"}(gg||(gg={}));const vg=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,...vg(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),hg=["callback"];function*mg(){yield Mo(Gi.setCustomLoginState({loading:!0}));try{const e=yield $o(Xf.metadata.getAdminBoxMetadata);yield Mo(Gi.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield Mo(Gi.setCustomLoginState({loading:!1,error:pg(e)}))}}function*Ag(e){let{payload:{callback:t}}=e,n=Qi(e.payload,hg);try{yield Mo(Gi.setCustomLoginState({error:null,saving:!0}));const e=vg(n);if(0===e.length)throw new Error("No changes to update");yield $o(Xf.metadata.updateAdminBoxMetadata,{actions:e});const i=yield $o(Xf.metadata.getAdminBoxMetadata);yield Mo(Gi.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setCustomLoginState({error:pg(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*bg(){var e,t,n;if(yield jo((e=>e.auth.isAuthenticated))){var i;const e=yield null!=(i=jo((({auth:e})=>{var t;return null==(t=e.tenantsState.activeTenant)?void 0:t.hasCustomLogin})))&&i;return e}return!!(null==(e=yield null==(t=Fa.getContext())||null==(n=t.tenantResolver)?void 0:n.call(t))?void 0:e.tenant)}function*Tg(){try{var e;if(!(yield $o(bg)))return;const t=yield jo((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:i}=Xf.accountSettings,{applicationUrl:o}=yield $o(t?n:i);if(!o)return;const{routes:a}=yield jo((e=>e.auth)),r=null!=(e=rg(o))?e:"";yield Mo(Gi.setState({routes:D({},a,{customLoginAuthenticatedUrl:o,customLoginUrl:a.loginUrl+r})})),yield Mo(Gi.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*Eg(){yield Ma(Gi.loadTenantMetadata,mg),yield Ma(Gi.updateTenantMetadata,Ag)}let kg;!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"}(kg||(kg={}));const Og=["callback"];function Ig(e){return function*(t){const[n]=yield $o(mp,["security-center-admin-portal-major-version"]);yield e(t),n&&(yield Pg(),yield _g())}}function*Pg(){const e=kg.RECOMMENDATIONS;yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:i}=yield $o(Xf.securityCenter.getRecommendations);yield Mo(Gi.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==i?void 0:i.score)?t:0}))}catch(t){yield Mo(Gi.setSecurityCenterStateError({key:e,value:pg(t)}))}finally{yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}}function*_g(){const e=kg.INSIGHTS;yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield $o(Xf.securityCenter.getInsights);yield Mo(Gi.setSecurityCenterState({insights:t.items}))}catch(t){yield Mo(Gi.setSecurityCenterStateError({key:e,value:pg(t)}))}finally{yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Lg(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Og);const i=kg.SEND_BREACHED_PASSWORD_EMAIL;yield Mo(Gi.setSecurityCenterStateError({key:i,value:!1})),yield Mo(Gi.setSecurityCenterStateLoader({key:i,value:!0}));try{yield $o(Xf.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield Mo(Gi.setSecurityCenterStateError({key:i,value:pg(e)})),null==t||t(!1,e)}finally{yield Mo(Gi.setSecurityCenterStateLoader({key:i,value:!1}))}}function*wg({payload:{callback:e}}){const t=kg.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield Mo(Gi.setSecurityCenterStateError({key:t,value:!1})),yield Mo(Gi.setSecurityCenterStateLoader({key:t,value:!0}));try{yield $o(Xf.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield Mo(Gi.setSecurityCenterStateError({key:t,value:pg(n)})),null==e||e(!1)}finally{yield Mo(Gi.setSecurityCenterStateLoader({key:t,value:!1}))}}function*Cg({key:e,tableState:t,updateStateKey:n,_offset:i,_limit:o,_preset:a,_email:r,_maxInactiveSeconds:s}){var l,c,u,d;yield Mo(Gi.setSecurityCenterStateError({key:e,value:!1})),yield Mo(Gi.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 $o(Xf.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 $o(Xf.roles.getRoles),i=yield $o(Xf.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 Mo(Gi.setSecurityCenterState({[n]:D({users:e},a)}))}else yield Mo(Gi.setSecurityCenterState({[n]:D({users:[]},a)}))}catch(t){yield Mo(Gi.setSecurityCenterStateError({key:e,value:pg(t)}))}finally{yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Ug({payload:e}){var t;const n=kg.BREACHED_PASSWORD_USERS_TABLE,i=yield null!=(t=jo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield Cg(D({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:fi.BREACHED_PASSWORDS,tableState:i},e))}function*Rg({payload:e}){var t;const n=kg.UNENROLLED_MFA_USERS_TABLE,i=yield null!=(t=jo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield Cg(D({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:fi.MFA_UNENROLLED,tableState:i},e))}function*Dg({payload:e}){var t;const n=kg.INACTIVE_USERS_TABLE,i=yield null!=(t=jo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield Cg(D({key:n,updateStateKey:"inactiveUsersTable",_preset:fi.INACTIVE,tableState:i},e))}function*Ng(){yield Da(Gi.loadRecommendations,Pg),yield Da(Gi.loadInsights,_g),yield Da(Gi.sendResetBreachedPasswordEmail,Lg),yield Da(Gi.sendBulkResetBreachedPasswordEmails,wg),yield Da(Gi.loadBreachedPasswordUsers,Ug),yield Da(Gi.loadUnenrolledMfaUsers,Rg),yield Da(Gi.loadInactiveUsers,Dg)}function*Mg(){const e=kg.RECOMMENDATIONS;yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0})),yield Bo(500),yield Mo(Gi.setSecurityCenterState({recommendations:Xp.recommendations.items,score:Xp.scoring.score})),yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}function*Fg(){const e=kg.INSIGHTS;yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0})),yield Bo(500),yield Mo(Gi.setSecurityCenterState({insights:Zp.insights.items})),yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}function*Gg(){const e=kg.BREACHED_PASSWORD_USERS_TABLE;yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0})),yield Bo(500),yield Mo(Gi.setSecurityCenterState({breachedPasswordUsersTable:eg})),yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}function*$g(){const e=kg.UNENROLLED_MFA_USERS_TABLE;yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0})),yield Bo(500),yield Mo(Gi.setSecurityCenterState({unenrolledMfaUsersTable:ng})),yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}function*Vg(){const e=kg.INACTIVE_USERS_TABLE;yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!0})),yield Bo(500),yield Mo(Gi.setSecurityCenterState({inactiveUsersTable:tg})),yield Mo(Gi.setSecurityCenterStateLoader({key:e,value:!1}))}function*xg({payload:{callback:e}}){const t=kg.SEND_BREACHED_PASSWORD_EMAIL;yield Mo(Gi.setSecurityCenterStateLoader({key:t,value:!0})),yield Bo(500),null==e||e(!0),yield Mo(Gi.setSecurityCenterStateLoader({key:t,value:!1}))}function*jg(){yield Da(Gi.loadRecommendations,Mg),yield Da(Gi.loadInsights,Fg),yield Da(Gi.loadBreachedPasswordUsers,Gg),yield Da(Gi.loadUnenrolledMfaUsers,$g),yield Da(Gi.loadInactiveUsers,Vg),yield Da(Gi.sendResetBreachedPasswordEmail,xg)}const Bg=["callback"],Wg=["callback"],zg=["callback"],Kg=["callback"],qg=["callback"],Hg=["callback"];function*Jg(){yield Mo(Gi.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield $o(Xf.auth.getGlobalSecurityPolicy);yield Mo(Gi.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyGlobalState({error:pg(e),loading:!1}))}yield Mo(Gi.loadSecurityPolicyMfa()),yield Mo(Gi.loadSecurityPolicyVendorMfa()),yield Mo(Gi.loadSecurityPolicyLockout()),yield Mo(Gi.loadSecurityPolicyVendorLockout()),yield Mo(Gi.loadSecurityPolicyVendorPasswordHistory()),yield Mo(Gi.loadSecurityPolicyCaptcha()),yield Mo(Gi.loadPublicAuthStrategiesPolicy())}function*Yg(e){var t,n;if(!(yield $o(bg)))return e;const i=yield $o(Xg);return null!=i&&null!=(t=i.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?D({},e,{authStrategy:i.mainAuthStrategies[0].strategy}):e}function*Qg(){yield Mo(Gi.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield $o(Xf.auth.getVendorConfig),t=yield Yg(e);yield Mo(Gi.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyPublicState({error:pg(e),loading:!1}))}}function*Xg(){const e=yield jo((({auth:e})=>e.isAuthenticated));let t;return t=e?yield $o(Xf.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield $o(Xf.auth.getVendorPublicAuthStrategiesConfig),t}function*Zg(){yield Mo(Gi.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield $o(Xg);yield function*(e){const t=yield $o(bg);if(!e||!t)return;const{policy:n}=yield jo((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield Mo(Gi.setSecurityPolicyPublicState({policy:D({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield Mo(Gi.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyAuthStrategyPublicState({error:pg(e),loading:!1}))}}function*eS(){yield Mo(Gi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield $o(Xf.auth.getMfaPolicy);yield Mo(Gi.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyMfaState({error:pg(e),loading:!1}))}}function*tS(){yield Mo(Gi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield $o(Xf.auth.getVendorMfaPolicy);yield Mo(Gi.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyVendorMfaState({error:pg(e),loading:!1}))}}function*nS(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Bg);yield Mo(Gi.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield $o(Xf.auth.saveMfaPolicy,n);yield Mo(Gi.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setSecurityPolicyMfaState({saving:!1,error:pg(e)})),null==t||t(null,e)}}function*iS(){yield Mo(Gi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield $o(Xf.auth.getLockoutPolicy);yield Mo(Gi.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyLockoutState({error:pg(e),loading:!1}))}}function*oS(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Wg);yield Mo(Gi.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield $o(Xf.auth.saveLockoutPolicy,n);yield Mo(Gi.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setSecurityPolicyLockoutState({saving:!1,error:pg(e)})),null==t||t(null,e)}}function*aS(){yield Mo(Gi.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield $o(Xf.auth.getVendorLockoutPolicy);yield Mo(Gi.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyVendorLockoutState({error:pg(e),loading:!1}))}}function*rS(){yield Mo(Gi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield $o(Xf.auth.getCaptchaPolicy);yield Mo(Gi.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyCaptchaState({error:pg(e),loading:!1}))}}function*sS(){yield Mo(Gi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield $o(Xf.auth.getPasswordHistoryPolicy);yield Mo(Gi.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyPasswordHistoryState({error:pg(e),loading:!1}))}}function*lS(){yield Mo(Gi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield $o(Xf.auth.getVendorPasswordHistoryPolicy);yield Mo(Gi.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyVendorPasswordHistoryState({error:pg(e),loading:!1}))}}function*cS(e){let{payload:{callback:t}}=e,n=Qi(e.payload,zg);yield Mo(Gi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield $o(Xf.auth.savePasswordHistoryPolicy,n);yield Mo(Gi.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setSecurityPolicyPasswordHistoryState({saving:!1,error:pg(e)})),null==t||t(null,e)}}function*uS(){yield Mo(Gi.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield $o(Xf.auth.getPasswordConfigPolicy);yield Mo(Gi.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyPasswordState({error:pg(e),loading:!1}))}}function*dS(){yield Ma(Gi.loadSecurityPolicy,Jg),yield Da(Gi.saveSecurityPolicyMfa,Ig(nS)),yield Da(Gi.loadSecurityPolicyMfa,eS),yield Da(Gi.loadSecurityPolicyVendorMfa,tS),yield Da(Gi.saveSecurityPolicyLockout,Ig(oS)),yield Da(Gi.loadSecurityPolicyLockout,iS),yield Da(Gi.loadSecurityPolicyVendorLockout,aS),yield Da(Gi.loadSecurityPolicyCaptcha,rS),yield Da(Gi.saveSecurityPolicyPasswordHistory,Ig(cS)),yield Da(Gi.loadSecurityPolicyPasswordHistory,sS),yield Da(Gi.loadSecurityPolicyVendorPasswordHistory,lS),yield Da(Gi.loadVendorPasswordConfig,uS),yield Da(Gi.loadPublicSecurityPolicy,Qg),yield Da(Gi.loadPublicAuthStrategiesPolicy,Zg)}function*yS(){yield Mo(Gi.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Mo(Gi.setSecurityPolicyPublicState({policy:Pp,loading:!1}))}catch(e){yield Mo(Gi.setSecurityPolicyPublicState({error:pg(e),loading:!1}))}}function*fS(){yield Mo(Gi.setSecurityPolicyGlobalState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyGlobalState({policy:Ip,loading:!1})),yield Mo(Gi.loadSecurityPolicyMfa()),yield Mo(Gi.loadSecurityPolicyVendorMfa()),yield Mo(Gi.loadSecurityPolicyLockout()),yield Mo(Gi.loadSecurityPolicyVendorLockout()),yield Mo(Gi.loadSecurityPolicyPasswordHistory()),yield Mo(Gi.loadSecurityPolicyVendorPasswordHistory()),yield Mo(Gi.loadSecurityPolicyCaptcha())}function*pS(){yield Mo(Gi.setSecurityPolicyMfaState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyMfaState({policy:_p,loading:!1}))}function*gS(){yield Mo(Gi.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyVendorMfaState({policy:_p,loading:!1}))}function*SS(e){var t;let{payload:{callback:n}}=e,i=Qi(e.payload,Kg);yield Mo(Gi.setSecurityPolicyMfaState({saving:!0,error:null}));const o=D({},Lp,{id:null!=(t=i.id)?t:Lp.id,enforceMFAType:i.enforceMFAType});yield Et(),yield Mo(Gi.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*vS(){yield Mo(Gi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyLockoutState({policy:Lp,loading:!1}))}function*hS(){yield Mo(Gi.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyVendorLockoutState({policy:Lp,loading:!1}))}function*mS(e){let{payload:{callback:t}}=e,n=Qi(e.payload,qg);yield Mo(Gi.setSecurityPolicyLockoutState({saving:!0,error:null})),yield Et();const i=D({},Lp,n,{id:n.id?n.id:Lp.id});null==t||t(i),yield Mo(Gi.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*AS(){yield Mo(Gi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyLockoutState({policy:Lp,loading:!1}))}function*bS(){yield Mo(Gi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyPasswordHistoryState({policy:wp,loading:!1}))}function*TS(){yield Mo(Gi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield Et(),yield Mo(Gi.setSecurityPolicyVendorPasswordHistoryState({policy:wp,loading:!1}))}function*ES(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Hg);yield Mo(Gi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield Et();const i=D({},wp,n,{id:n.id?n.id:wp.id});null==t||t(i),yield Mo(Gi.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*kS(){yield Ma(Gi.loadSecurityPolicy,fS),yield Da(Gi.loadPublicSecurityPolicy,yS),yield Da(Gi.saveSecurityPolicyMfa,SS),yield Da(Gi.loadSecurityPolicyMfa,pS),yield Da(Gi.loadSecurityPolicyVendorMfa,gS),yield Da(Gi.saveSecurityPolicyLockout,mS),yield Da(Gi.loadSecurityPolicyLockout,vS),yield Da(Gi.loadSecurityPolicyVendorLockout,hS),yield Da(Gi.loadSecurityPolicyCaptcha,AS),yield Da(Gi.saveSecurityPolicyPasswordHistory,ES),yield Da(Gi.loadSecurityPolicyPasswordHistory,bS),yield Da(Gi.loadSecurityPolicyVendorPasswordHistory,TS)}const OS=["phoneNumber"],IS=["events","url"];function*PS(){yield Mo(Gi.setSignUpState({loading:!0}));try{const e=yield $o(Xf.auth.getVendorConfig),t=yield Yg(e),{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield Mo(Gi.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield Mo(Gi.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Mo(Gi.setSignUpState({loading:!1,error:pg(e),firstLoad:!1}))}}function*_S(e){let{payload:{events:t,url:n}}=e,i=Qi(e.payload,IS);yield Mo(Gi.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:r}=yield jo((e=>e.auth)),{shouldActivate:s,user:l,tenantId:c,userId:u,tenants:d=[],activeTenant:y}=yield $o(Xf.auth.signUpUser,(a=i,Qi(a,OS)));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:og.PASSWORD,id:u,tenantId:c,createdAt:new Date};null==t||null==(o=t.signUpComplete)||o.call(t,l),Sg(gg.SIGNUP_COMPLETED,l)}if(!s&&l&&ug(l)){const t=yield fg(l);yield Mo(Gi.setState(t)),r(e.loginUrl)}else{const{tenantsState:e}=yield jo((e=>e.auth));yield Mo(Gi.setSignUpState({loading:!1,shouldActivate:s,stage:mn.SignUpSuccess})),yield Mo(Gi.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:D({},e,{tenants:d,activeTenant:y})}))}}catch(e){Fa.setAccessToken(null),Fa.setUser(null),yield Mo(Gi.setSignUpState({loading:!1,error:pg(e)}))}var a;yield Mo(Gi.setSignUpState({loading:!1}))}function*LS(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield jo((e=>e.auth.signUpState));yield Mo(Gi.resetSignUpState()),yield Mo(Gi.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*wS(){yield Ma(Gi.signUpUser,_S),yield Ma(Gi.resetSignUpStateSoft,LS)}const CS={setVendorState:(e,{payload:t})=>D({},e,t)},US={loadVendorPublicInfo:yt("vendor/loadVendorPublicInfo")},RS={loading:!1},{reducer:DS,actions:NS}=pt({name:Mt,initialState:RS,reducers:D({},CS)}),MS=D({},NS,US);function*FS(){yield Mo(MS.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Xf.vendor.getVendorPublicInfo();yield Mo(MS.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Mo(MS.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var GS=n(378),$S=n.n(GS);function VS(e,t){return $S()(e,t)}function*xS({payload:e}){const t=null==e?void 0:e.callback,[n]=yield $o(mp,[Mr]);try{const e=yield $o(n?Xf.entitlements.loadEntitlementsV2:Xf.entitlements.loadEntitlements);yield function*(e){VS(yield jo((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield Mo(Gi.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*jS(){yield Ma(Gi.loadEntitlements,xS)}var BS=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()}};const WS=["callback"],zS=["callback"],KS=["callback"],qS=["callback"],HS=["callback","events"],JS=["callback"],YS=["callback"],QS=["callback"],XS=["callback"],ZS=["user"],ev=["callback"],tv=["callback"],nv=["callback"],iv=["callback"],ov=["callback"],av=["callback","deviceId"],rv=["callback"],sv=["callback"],lv=["callback","deviceId"],cv=["callback","deviceId"],uv=["callback","deviceId"];function*dv(e){const t=yield jo((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return VS(t,null==e?void 0:e.entitlements)?D({},e,{entitlements:t}):e}function*yv({user:e,tenants:t=[],activeTenant:n},i={}){const{tenantsState:o}=yield jo((e=>e.auth));yield Mo(Gi.setState(D({user:e,tenantsState:D({},o,{tenants:t,activeTenant:n,loading:!1})},i)))}function*fv(){const e=Fa.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield jo((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:s,activateUrl:l}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;u||(yield $o(Tg),u=yield jo((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})));const d=window.localStorage.getItem(Ct);d&&![a,r,s,l].includes(d)&&(c=d),window.localStorage.removeItem(Ct),yield Et(200),Mo(Gi.resetLoginState());const y=(({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?sg(u):c,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});e(y,{refresh:y.startsWith("http")})}function*pv(){let e;try{var t;const n=yield $o(Xf.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield Mo(Gi.setState({ssoACS:e}))}function*gv(){try{const{isActive:e}=yield $o(Xf.auth.getSSOPublicConfiguration);yield Mo(Gi.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*Sv(e){var t;const{routes:n,loginState:i}=yield jo((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*vv(){const{hostedLoginBox:e}=yield jo((e=>e.auth));e?yield $o(hv):yield $o(Av)}function*hv(){const{user:e}=yield jo((e=>e.auth));if(null==e||!e.refreshToken)return Fa.setAccessToken(null),Fa.setUser(null),void(yield Mo(Gi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield $o(Xf.auth.exchangeOAuthTokensV2,t),i=yield $o(dv,n.user);yield $o(yv,D({},n,{user:i}),{isAuthenticated:!0})}catch(e){Fa.setAccessToken(null),Fa.setUser(null),yield Mo(Gi.setState({user:null,isAuthenticated:!1}))}}function*mv(){const{user:e}=yield jo((e=>e.auth));if(null==e||!e.refreshToken)return Fa.setAccessToken(null),Fa.setUser(null),void(yield Mo(Gi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield $o(Xf.auth.exchangeOAuthTokensV2,t),i=yield $o(dv,n.user);yield $o(yv,D({},n,{user:i}),{isAuthenticated:!0})}catch(e){Fa.setAccessToken(null),Fa.setUser(null),yield Mo(Gi.setState({user:null,isAuthenticated:!1}))}}function*Av(){try{const t=Fa.onRedirectTo,{routes:n,loginState:i}=yield jo((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield $o(Xf.auth.refreshTokenV3);if(ug(o)){const e=yield fg(o);yield Mo(Gi.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 Sv(o),s=yield $o(dv,o);yield $o(yv,{user:s,tenants:a,activeTenant:r},{loginState:D({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield Tv(n)}}catch(e){Fa.setAccessToken(null),Fa.setUser(null),yield Mo(Gi.setState({user:void 0,isAuthenticated:!1}))}}function*bv(){try{const t=Fa.onRedirectTo,{routes:n,loginState:i}=yield jo((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield $o(Xf.auth.refreshTokenV3);if(ug(o)){const e=yield fg(o);yield Mo(Gi.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const s=yield $o(dv,o);if(yield $o(Fv))yield Mo(Gi.setLoginState({step:_t.promptPasskeys,loading:!1})),yield $o(yv,{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 Sv(o);yield $o(yv,{user:s,tenants:a,activeTenant:r},{loginState:D({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield Tv(n)}}}catch(e){Fa.setAccessToken(null),Fa.setUser(null),yield Mo(Gi.setState({user:void 0,isAuthenticated:!1}))}}function*Tv(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=Fa.onRedirectTo,{routes:o,loginState:a}=yield jo((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 fv())}function*Ev({payload:{callback:e}}){try{const{ip:t}=yield $o(Xf.metadata.getCurrentUserIpMetadata);yield Mo(Gi.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*kv({payload:e}){const t=[];(yield $o(bg))?yield $o(vv):t.push($o(vv)),e&&(yield Mo(Gi.setState({isLoading:!0})),yield Mo(Gi.loadSocialLoginsConfigurationV2()),t.push($o(PS)),t.push($o(Zg)),t.push($o(gv)),t.push($o(FS)),t.push($o(pv)),t.push($o(Tg))),yield Fo(t),yield Mo(Gi.setState({isLoading:!1}))}function*Ov({accessToken:e,user:t}){if(!e)return void(yield Mo(Gi.setState({user:void 0,isAuthenticated:!1})));const n=Fa.onRedirectTo,{routes:i}=yield jo((e=>e.auth));if(ug(t)){const e=yield fg(t);yield Mo(Gi.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*Iv({payload:e}){const t=[];yield Mo(Gi.loadSocialLoginsConfigurationV2()),t.push($o(PS)),t.push($o(gv)),t.push($o(FS)),t.push($o(pv)),t.push($o(Ov,e)),t.push($o(Tg)),yield Fo(t)}const Pv=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*_v(){const e=yield $o(Xf.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield $o(yv,e,{isAuthenticated:!0,isLoading:!1})}function*Lv({payload:e}){const{disableSilentRefresh:t}=yield jo((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if("login"!==(null==e?void 0:e.prompt))try{if(t)throw new Error("silent refresh is disabled");yield _v()}catch(t){yield Cv(e)}else yield Cv(e)}function*wv({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n}}){if(n){const{urlStrategy:e}=yield jo((e=>({urlStrategy:e.root.urlStrategy}))),t=Pv(e);if(yield Mo(Gi.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:i}=yield jo((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if("login"!==(null==e?void 0:e.prompt))try{if(i)throw new Error("silent refresh is disabled");yield _v()}catch(n){if(!t)return void(yield Mo(Gi.setState({isLoading:!1})));yield Cv(e)}else yield Cv(e)}function*Cv(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield jo((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(Pv(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield Mo(Gi.setState({isLoading:!0}));const a=vp(),r=vp(),s=yield $o(Sp,r);localStorage.setItem(Ut,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;yield $o(Tg);const c=yield jo((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=`${Or(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=lg(cg);f&&(d.tenantId=f),i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*Uv({payload:e}){const t=localStorage.getItem(Ut)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield jo((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;yield $o(Tg);const a=yield jo((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 $o(Xf.auth.exchangeOAuthTokensV2,r);yield $o(yv,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield Mo(Gi.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{yield fv()}}function*Rv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,WS);try{yield Mo(Gi.setLoginState({loading:!0}));const e=yield $o(Xf.auth.changePhoneNumberWithVerification,n);yield Mo(Gi.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:_t.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({error:pg(e),loading:!1}))}}function*Dv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,zS);try{yield Mo(Gi.setLoginState({loading:!0})),yield $o(Xf.auth.verifyChangePhoneNumber,n),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({error:pg(e),loading:!1}))}}function*Nv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,KS);try{yield Mo(Gi.setLoginState({loading:!0}));const e=yield $o(Xf.auth.passwordlessPreLogin,D({},n,{type:ki.SmsCode}));yield Mo(Gi.setLoginState({step:_t.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({error:pg(e),loading:!1})),null==t||t(e)}}function*Mv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,qS);try{let e;yield Mo(Gi.setLoginState({loading:!0})),function(e){return"email"in e}(n)&&(e=n.email);const i=yield $o(Xf.auth.passwordlessPreLogin,n),o=Ii[n.type];yield Mo(Gi.setLoginState({step:o,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:e,error:void 0})),null==t||t()}catch(e){yield Mo(Gi.setLoginState({error:pg(e),loading:!1})),null==t||t()}}function*Fv(){const{publicAuthStrategyPolicy:e}=yield jo((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===Ms.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield $o(mp,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield $o(Xf.auth.getWebAuthnDevices);return yield Mo(Gi.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*Gv(e){let{payload:{callback:t,events:n}}=e,i=Qi(e.payload,HS);try{yield Mo(Gi.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield $o(Xf.auth.passwordlessPostLoginV2,i),s=Fa.onRedirectTo,{routes:l}=yield jo((e=>e.auth));if(ug(e)){const t=yield fg(e);yield Mo(Gi.setState(t)),s(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield jo((e=>e.auth));if(e.emailVerified){var o;const t={email:e.email,origin:ig.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name};null==n||null==(o=n.userVerified)||o.call(n,t),Sg(gg.USER_VERIFIED,t)}e.id&&localStorage.setItem("userId",e.id),yield $o(yv,{user:e,tenants:a,activeTenant:r}),yield Mo(Gi.setLoginState({error:void 0})),yield Mo(Gi.setState({isLoading:!1})),i.flow===Lt.Login?(yield $o(Fv))?(yield Mo(Gi.setLoginState({step:_t.promptPasskeys,loading:!1})),s(l.loginUrl,{preserveQueryParams:!0})):(yield Mo(Gi.setState({isAuthenticated:!0})),yield fv()):s(l.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield Mo(Gi.setLoginState({error:pg(e,"Failed to authenticate")}))}finally{yield Mo(Gi.setLoginState({loading:!1}))}}function*$v({payload:e}){try{yield Mo(Gi.setLoginState({loading:!0}));const{name:t}=yield $o(Xf.auth.verifyInviteToken,e);yield Mo(Gi.setLoginState({inviteTokenTenantName:t}))}catch(e){yield Mo(Gi.setLoginState({inviteTokenError:pg(e,"We couldn't verify your invitation")}))}finally{yield Mo(Gi.setLoginState({loading:!1}))}}function*Vv({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield Mo(Gi.setLoginState({loading:!0}));try{const o=yield jo((({auth:{onRedirectTo:e}})=>e)),a=lg(cg),{address:r,idpType:s}=yield $o(Xf.auth.preLoginV2,{email:e,tenantId:a});if(r){let t=r;if(s===tp.Oidc&&!t.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield jo((({auth:{routes:e}})=>({routes:e})));t+=`&redirect_uri=${window.location.origin}${e}`}BS.isAvailable()?(BS.loginWithSSO(e),yield Mo(Gi.setLoginState({loading:!1,step:_t.redirectToSSO})),null==i||i()):(yield Mo(Gi.setLoginState({step:_t.redirectToSSO,loading:!1,ssoRedirectUrl:t})),setTimeout((()=>{o(t,{refresh:!0})}),2e3))}else yield xv({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield xv({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*xv(e){let{callback:t}=e,n=Qi(e,JS);const i=yield jo((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield Mo(Gi.setLoginState({step:_t.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===ki.EmailAndPassword?(yield Mo(Gi.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t()):[ki.MagicLink,ki.Code,ki.SmsCode].includes(null==i?void 0:i.authStrategy)?yield Mo(Gi.passwordlessPreLogin(D({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield Mo(Gi.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t())}function*jv({payload:{callback:e}}){try{yield Mo(Gi.setLoginState({loading:!0}));const{options:t}=yield $o(Xf.auth.webAuthnCreateNewDeviceSession);t.user.id=It(t.user.id),t.challenge=It(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield Mo(Gi.setLoginState({error:pg(t)})),null==e||e(null)}finally{yield Mo(Gi.setLoginState({loading:!1}))}}function*Bv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,YS);try{yield Mo(Gi.setLoginState({loading:!0}));const e=Pt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?Fs.Platform:Fs.CrossPlatform;yield $o(Xf.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({error:pg(e)})),null==t||t(null)}finally{yield Mo(Gi.setLoginState({loading:!1}))}}function*Wv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,QS);try{var i;yield Mo(Gi.setPasskeysState({loading:!0})),yield Mo(Gi.setLoginState({loading:!0}));const{options:e}=yield $o(Xf.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 Mo(Gi.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield Mo(Gi.setLoginState({error:pg(e)})),null==t||t(null)}finally{yield Mo(Gi.setPasskeysState({loading:!1})),yield Mo(Gi.setLoginState({loading:!1}))}}function*zv(e){let{payload:{callback:t}}=e,n=Qi(e.payload,XS);try{var i;yield Mo(Gi.setPasskeysState({loading:!0})),yield Mo(Gi.setLoginState({loading:!0}));const e=Pt(n.publicKey),o=yield $o(Xf.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=Qi(o,ZS);if(ug(a)){const e=Fa.onRedirectTo,{routes:t}=yield jo((e=>e.auth)),n=yield fg(a);yield Mo(Gi.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield $o(yv,D({user:a},r),{isAuthenticated:!0}),yield Mo(Gi.setLoginState({error:void 0})),yield fv(),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({error:pg(e)})),null==t||t(null)}finally{yield Mo(Gi.setPasskeysState({loading:!1})),yield Mo(Gi.setLoginState({loading:!1}))}}function*Kv({payload:e}){const{onRedirectTo:t,routes:n}=yield jo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Mo(Gi.setLoginState({loading:!0}));try{const t=yield $o(Xf.auth.postLogin,e);yield Mo(Gi.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield fv()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Mo(Gi.setLoginState({step:_t.loginWithSSOFailed,loading:!1}))}}function*qv({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield Mo(Gi.setLoginState({loading:!0}));try{const{user:a,tenants:r=[],activeTenant:s}=yield $o(Xf.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:i}),l=Fa.onRedirectTo,{routes:c}=yield jo((e=>e.auth));if(ug(a)){const e=yield fg(a);yield Mo(Gi.setState(e)),l(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield jo((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield $o(yv,{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 $o(mp,["security-center-show-login-flows"]);t.flow===Lt.Login&&(i&&a.isBreachedPassword&&!n?yield Mo(Gi.setLoginState({step:_t.breachedPassword,loading:!1})):n&&((yield $o(Fv))?(yield Mo(Gi.setLoginState({step:_t.promptPasskeys,loading:!1})),l(c.loginUrl,{preserveQueryParams:!0})):yield fv()))}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){Fa.setAccessToken(null),Fa.setUser(null),null==o||o(!1,t),yield Mo(Gi.setLoginState({email:e,error:pg(t),loading:!1}))}}function*Hv({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield Mo(Gi.setLoginState({loading:!0}));try{const{user:o,tenants:a=[],activeTenant:r}=yield $o(Xf.auth.loginWithMfaV2,{mfaToken:e,value:t,rememberDevice:n}),{loginState:s}=yield jo((e=>e.auth)),l=s.flow===Lt.Login?_t.success:s.step,c=!!o.accessToken;yield $o(yv,{user:o,tenants:a,activeTenant:r},{loginState:{flow:s.flow,quickLoginToRegister:s.quickLoginToRegister,loading:!1,step:l,error:void 0,tenants:a},isAuthenticated:c}),o.id&&localStorage.setItem("userId",o.id),yield Mo(Gi.setLoginState({error:void 0,loading:!1}));const[u]=yield $o(mp,["security-center-show-login-flows"]);s.flow===Lt.Login&&(u&&s.isBreachedPassword&&!c?yield Mo(Gi.setLoginState({step:_t.breachedPassword,loading:!1})):(yield $o(Fv))?yield Mo(Gi.setLoginState({step:_t.promptPasskeys,loading:!1})):yield fv()),null==i||i(!0)}catch(e){yield Mo(Gi.setLoginState({error:pg(e),loading:!1})),null==i||i(!1,e)}}function*Jv({payload:e}){yield Mo(Gi.setLoginState({loading:!0}));try{var t;yield $o(Xf.auth.recoverMfaToken,e),yield Mo(Gi.setLoginState({loading:!1,error:void 0,step:_t.preLogin})),yield Mo(Gi.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mo(Gi.setLoginState({error:pg(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Yv({payload:e}){const{hostedLoginBox:t}=yield jo((e=>e.auth));yield Mo(Gi.setState({isLoading:!0}));try{t?yield $o(Xf.auth.OAuthLogout):yield $o(Xf.auth.logout)}catch{}yield Mo(Gi.resetState()),yield Mo(Gi.requestAuthorize(!0)),null==e||e()}function*Qv({payload:e}){var t;try{yield $o(Xf.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*Xv({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 Mo(Gi.setMfaState(i)),yield Mo(Gi.setUser(e)),yield Mo(Gi.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Zv({user:e,tenants:t,activeTenant:n}){const{loginState:i}=yield jo((e=>e.auth));yield Mo(Gi.setUser(e)),yield Mo(Gi.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:o}=yield jo((e=>e.auth.mfaState)),[a]=yield $o(mp,["security-center-show-login-flows"]),r=!!e.accessToken;if(i.flow===Lt.Login)if(a&&i.isBreachedPassword&&!r)yield Mo(Gi.setLoginState({step:_t.breachedPassword,loading:!1}));else{const e=yield $o(Fv);o===cn.smsVerifyCode&&e?yield Mo(Gi.setLoginState({step:_t.promptPasskeys,loading:!1})):yield fv()}yield Mo(Gi.setState({isAuthenticated:r}))}function*eh(e){let{payload:{callback:t}}=e,n=Qi(e.payload,ev);yield Mo(Gi.setLoginState({loading:!0}));try{const e=yield $o(Xf.auth.preEnrollMFASMSForLogin,n);yield Mo(Gi.setMfaState({otcToken:e.otcToken,step:cn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:pg(e)})),null==t||t(null)}}function*th(e){let{payload:{callback:t}}=e,n=Qi(e.payload,tv);yield Mo(Gi.setLoginState({loading:!0}));try{const e=yield $o(Xf.auth.enrollMFASMSForLoginV2,n);yield Xv(e),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:pg(e)})),null==t||t(null)}}function*nh(e){let{payload:{callback:t}}=e,n=Qi(e.payload,nv);yield Mo(Gi.setLoginState({loading:!0}));try{var i;const e=yield $o(Xf.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 Mo(Gi.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:pg(e)})),null==t||t(null)}}function*ih(e){let{payload:{callback:t}}=e,n=Qi(e.payload,iv);yield Mo(Gi.setLoginState({loading:!0}));try{const e=Pt(n.publicKey),i=yield $o(Xf.auth.enrollMFAWebAuthnForLoginV2,D({},n,{options:e}));yield Xv(i),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:pg(e)})),null==t||t(null)}}function*oh(e){let{payload:{callback:t}}=e,n=Qi(e.payload,ov);yield Mo(Gi.setLoginState({loading:!0}));try{const e=yield $o(Xf.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield Xv(e),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:pg(e)})),null==t||t(null)}}function*ah(e){let{payload:{callback:t,deviceId:n}}=e,i=Qi(e.payload,av);yield Mo(Gi.setLoginState({loading:!0}));try{const e=yield $o(Xf.auth.preVerifyMFASMSForLogin,n,i);yield Mo(Gi.setMfaState({otcToken:e.otcToken,step:cn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:pg(e)})),null==t||t(null)}}function*rh(e){let{payload:{callback:t}}=e,n=Qi(e.payload,rv);try{const e=yield $o(Xf.auth.preVerifyMFAEmailCode,n);yield Mo(Gi.setMfaState({otcToken:e.otcToken,step:cn.emailVerifyCode})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({error:pg(e)})),null==t||t(null)}}function*sh(e){let{payload:{callback:t}}=e,n=Qi(e.payload,sv);yield Mo(Gi.setLoginState({loading:!0}));try{const e=yield $o(Xf.auth.verifyMFAEmailCodeV2,n);yield Zv(e),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:pg(e)})),null==t||t(null)}}function*lh(e){let{payload:{callback:t,deviceId:n}}=e,i=Qi(e.payload,lv);yield Mo(Gi.setLoginState({loading:!0}));try{const e=yield $o(Xf.auth.verifyMFASMSForLoginV2,n,i);yield Zv(e),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:pg(e)})),null==t||t(null)}}function*ch(e){let{payload:{callback:t,deviceId:n}}=e,i=Qi(e.payload,cv);yield Mo(Gi.setLoginState({loading:!0}));try{var o;const e=yield $o(Xf.auth.preVerifyMFAWebAuthnForLogin,n,i),a=D({},e.options,{challenge:It(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>D({},e,{id:It(e.id)})))});yield Mo(Gi.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:pg(e)})),null==t||t(null)}}function*uh(e){let{payload:{callback:t,deviceId:n}}=e,i=Qi(e.payload,uv);yield Mo(Gi.setLoginState({loading:!0}));try{const e=Pt(i.publicKey),o=yield $o(Xf.auth.verifyMFAWebAuthnForLoginV2,n,D({},i,{options:e}));yield Zv(o),yield Mo(Gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:pg(e)})),null==t||t(null)}}function*dh({payload:e}){yield Mo(Gi.setLoginState({loading:!0}));try{yield $o(Xf.auth.forgotPassword,e),yield Mo(Gi.setLoginState({loading:!1,error:void 0,step:_t.breachedPasswordSuccess})),yield Mo(Gi.setState({isAuthenticated:!1}))}catch(e){yield Mo(Gi.setLoginState({loading:!1,error:pg(e)}))}}function*yh(){yield Ma(Gi.requestAuthorize,kv),yield Ma(Gi.requestAuthorizeSSR,Iv),yield Ma(Gi.requestHostedLoginAuthorize,Lv),yield Ma(Gi.requestHostedLoginAuthorizeV2,wv),yield Ma(Gi.handleHostedLoginCallback,Uv),yield Ma(Gi.preLogin,Vv),yield Ma(Gi.postLogin,Kv),yield Ma(Gi.login,qv),yield Ma(Gi.logout,Yv),yield Ma(Gi.silentLogout,Qv),yield Ma(Gi.loginWithMfa,Hv),yield Ma(Gi.recoverMfa,Jv),yield Ma(Gi.quickSmsPasswordlessPreLogin,Nv),yield Ma(Gi.changePhoneNumberWithVerification,Rv),yield Ma(Gi.verifyChangePhoneNumber,Dv),yield Ma(Gi.passwordlessPreLogin,Mv),yield Ma(Gi.passwordlessPostLogin,Gv),yield Ma(Gi.verifyInviteToken,$v),yield Ma(Gi.webAuthnPrelogin,Wv),yield Ma(Gi.webAuthnPostLogin,zv),yield Ma(Gi.webAuthnCreateNewDeviceSession,jv),yield Ma(Gi.webAuthnVerifyNewDeviceSession,Bv),yield Ma(Gi.afterAuthNavigation,fv),yield Ma(Gi.getUserIP,Ev),yield Ma(Gi.preEnrollMFASMSForLogin,eh),yield Ma(Gi.enrollMFASMSForLogin,th),yield Ma(Gi.preEnrollMFAWebAuthnForLogin,nh),yield Ma(Gi.enrollMFAWebAuthnForLogin,ih),yield Ma(Gi.enrollMFAAuthenticatorAppForLogin,oh),yield Ma(Gi.preVerifyMFASMSForLogin,ah),yield Ma(Gi.verifyMFASMSForLogin,lh),yield Ma(Gi.preVerifyMFAWebAuthnForLogin,ch),yield Ma(Gi.verifyMFAWebAuthnForLogin,uh),yield Ma(Gi.preVerifyMFAEmailCode,rh),yield Ma(Gi.verifyMFAEmailCode,sh),yield Ma(Gi.resetBreachedPassword,dh)}function*fh({payload:e}){e&&(yield Mo(Gi.setState({isLoading:!0})));const t=kp;yield Mo(Gi.loadTenants()),yield Mo(Gi.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*ph({payload:{callback:e}}){try{const{ip:t}=Hp[0];yield Mo(Gi.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*gh(){yield Ma(Gi.requestAuthorize,fh),yield Ma(Gi.afterAuthNavigation,fv),yield Ma(Gi.getUserIP,ph)}const Sh=["callback","samlVendor"],vh=["callback","samlVendor"];function*hh(){try{var e,t;yield Mo(Gi.setSSOState({loading:!0}));const n=yield $o(Xf.auth.getSamlConfiguration),i=yield $o(Xf.auth.getOidcConfiguration),o=yield $o(Xf.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 Mo(Gi.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield Mo(Gi.setSSOState({error:pg(e),loading:!1}))}}function*mh({payload:e}){const t=yield jo((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield Mo(Gi.setSSOState({error:void 0,[n]:!0}));try{const i=yield hp(e[0]),o=yield $o(Xf.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield Mo(Gi.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield Mo(Gi.setSSOState({samlConfiguration:t,error:pg(e),[n]:!1}))}}function*Ah({payload:e}){const{configFile:t,callback:n}=e,i=yield jo((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield Mo(Gi.setSSOState({error:void 0,[o]:!0}));try{const e=yield hp(t),a=yield $o(Xf.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield Mo(Gi.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield Mo(Gi.setSSOState({samlConfiguration:i,error:pg(e),[o]:!1})),null==n||n(null,e)}}function*bh({payload:e}){const{callback:t,samlVendor:n}=e,i=Qi(e,Sh),o=yield jo((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 Mo(Gi.setSSOState({samlConfiguration:D({},o,a)})));if(yield Mo(Gi.setSSOState({error:void 0,[r]:!0})),e.type===tp.Saml){var s,l;const e=yield $o(Xf.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=gp(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 $o(Xf.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield Mo(Gi.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setSSOState({samlConfiguration:o,error:pg(e),[r]:!1})),null==t||t(null,e)}}function*Th({payload:{callback:e}={}}){const t=yield jo((e=>e.auth.ssoState.samlConfiguration));try{yield Mo(Gi.setSSOState({error:void 0,saving:!0})),yield $o(Xf.auth.validateSamlDomain),yield Mo(Gi.setSSOState({samlConfiguration:D({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield Mo(Gi.setSSOState({samlConfiguration:D({},t,{validated:!1}),error:pg(n),saving:!1})),null==e||e(null,n)}}function*Eh(){try{const e=yield $o(Xf.auth.getSamlRoles),t=yield $o(Xf.auth.getSamlRolesGroups);yield Mo(Gi.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Mo(Gi.setSSOState({error:pg(e)}))}}function*kh({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Mo(Gi.setSSOState({error:void 0,saving:!0})),yield $o(Xf.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Fo(e.map((e=>$o(Xf.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Mo(Gi.setSSOState({error:pg(e)}))}}(n)),yield Eh(),yield Mo(Gi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Mo(Gi.setSSOState({error:pg(t),saving:!1})),null==e||e(null,t)}}function*Oh({payload:{callback:e,id:t}}){try{yield Mo(Gi.setSSOState({error:void 0,saving:!0})),yield $o(Xf.auth.deleteSamlGroup,{id:t}),yield Eh(),yield Mo(Gi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Mo(Gi.setSSOState({error:pg(t),saving:!1})),null==e||e(null,t)}}function*Ih({payload:{group:e,roleIds:t,callback:n}}){try{yield Mo(Gi.setSSOState({error:void 0,saving:!0})),yield $o(Xf.auth.createSamlGroup,{group:e,roleIds:t}),yield Eh(),yield Mo(Gi.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield Mo(Gi.setSSOState({error:pg(e),saving:!1})),null==n||n(null,e)}}function*Ph({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Mo(Gi.setSSOState({loading:!0})),yield $o(Xf.auth.oidcPostLoginV2,t),yield $o(vv),yield Mo(Gi.setSSOState({loading:!1}))}catch(e){yield Mo(Gi.setSSOState({loading:!1,error:pg(e,"Failed to authenticate"),firstLoad:!1}))}}function*_h(){yield Da(Gi.loadSSOConfigurations,hh),yield Da(Gi.saveSSOConfigurations,bh),yield Da(Gi.saveSSOConfigurationsFile,mh),yield Da(Gi.saveSSOConfigurationsFileWithCallback,Ah),yield Da(Gi.validateSSODomain,Th),yield Da(Gi.loadSSOAuthorizationRoles,Eh),yield Da(Gi.updateSSOAuthorizationRoles,kh),yield Da(Gi.deleteSamlGroup,Oh),yield Da(Gi.createSamlGroup,Ih),yield Da(Gi.oidcPostlogin,Ph)}function*Lh(){yield Mo(Gi.setSSOState({loading:!0})),yield Et(),yield Mo(Gi.setSSOState({samlConfiguration:Cp,loading:!1,firstLoad:!1}))}function*wh({payload:e}){const t="saving";yield Mo(Gi.setSSOState({error:void 0,[t]:!0}));const n=D({},yield jo((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield Mo(Gi.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Ch({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=Qi(e,vh),r=Dp.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 Mo(Gi.setSSOState({samlConfiguration:D({},r,s)})));yield Mo(Gi.setSSOState({error:void 0,[l]:!0})),yield Et(),s.acsUrl=null==Up||null==(t=Up.configuration)?void 0:t.acsUrl,s.spEntityId=null==Up||null==(n=Up.configuration)?void 0:n.spEntityId;const c=gp(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 Mo(Gi.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*Uh({payload:{callback:e}={}}){const t=Dp.samlConfiguration;yield Mo(Gi.setSSOState({error:void 0,saving:!0})),yield Et(),yield Mo(Gi.setSSOState({samlConfiguration:D({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Rh(){yield Et(),yield Mo(Gi.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Dh({payload:{callback:e,authorizationRoles:t}}){yield Mo(Gi.setSSOState({error:void 0,saving:!0})),yield Et(),yield Mo(Gi.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Nh(){yield Da(Gi.loadSSOConfigurations,Lh),yield Da(Gi.saveSSOConfigurations,Ch),yield Da(Gi.saveSSOConfigurationsFile,wh),yield Da(Gi.validateSSODomain,Uh),yield Da(Gi.loadSSOAuthorizationRoles,Rh),yield Da(Gi.updateSSOAuthorizationRoles,Dh)}const Mh=["callback"],Fh=["callback","ssoConfigId"],Gh=["callback","ssoConfigId"],$h=["callback","ssoConfigId"];function*Vh(){try{return yield $o(Xf.auth.getOidcConfiguration)}catch(e){return null}}function*xh(){try{return yield $o(Xf.metadata.getSamlMetadata)}catch(e){return null}}function*jh(){try{yield Mo(Gi.setSSOLoader({key:ep.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Fo([$o(Vh),$o(xh)]),n=yield $o(Xf.auth.getSSOConfigurations);yield Mo(Gi.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Mo(Gi.setSSOError({key:ep.LOAD_SSO_CONFIGURATIONS,value:pg(e)}))}finally{yield Mo(Gi.setSSOLoader({key:ep.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Bh({payload:e}){yield Mo(Gi.setSSOLoader({key:ep.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Qi(e,Mh),i=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield $o(Xf.auth.createSSOConfiguration,D({},n,{enabled:null!=(o=n.enabled)&&o}));yield Mo(Gi.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield Mo(Gi.setSSOError({key:ep.SAVE_SSO_CONFIGURATION,value:pg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSSOLoader({key:ep.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Wh({payload:e}){yield Mo(Gi.setSSOLoader({key:ep.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield hp(t),o=yield $o(Xf.auth.createSSOConfigurationByMetadata,{metadata:e});yield Mo(Gi.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield Mo(Gi.setSSOError({key:ep.SAVE_SSO_CONFIGURATION_BY_METADATA,value:pg(e)})),null==n||n(null,e)}finally{yield Mo(Gi.setSSOLoader({key:ep.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*zh({payload:e}){yield Mo(Gi.setSSOLoader({key:ep.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Qi(e,Fh),o=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield $o(Xf.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield Mo(Gi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Mo(Gi.setSSOError({key:ep.UPDATE_SSO_CONFIGURATION,value:pg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSSOLoader({key:ep.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Kh({payload:e}){yield Mo(Gi.setSSOLoader({key:ep.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield hp(i),a=yield $o(Xf.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield Mo(Gi.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield Mo(Gi.setSSOError({key:ep.UPDATE_SSO_CONFIGURATION,value:pg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSSOLoader({key:ep.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*qh({payload:e}){yield Mo(Gi.setSSOLoader({key:ep.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{yield $o(Xf.auth.deleteSSOConfiguration,t),yield Mo(Gi.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield Mo(Gi.setSSOError({key:ep.DELETE_SSO_CONFIGURATION,value:pg(e)})),null==n||n(null,e)}finally{yield Mo(Gi.setSSOLoader({key:ep.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Hh({payload:e}){const{callback:t,ssoConfigId:n}=e,i=Qi(e,Gh);yield Mo(Gi.setSSOLoader({key:ep.SAVE_SSO_DOMAIN,value:!0}));const o=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield $o(Xf.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?D({},t,{domains:[...t.domains,e]}):t));yield Mo(Gi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Mo(Gi.setSSOError({key:ep.SAVE_SSO_DOMAIN,value:pg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSSOLoader({key:ep.SAVE_SSO_DOMAIN,value:!1}))}}function*Jh({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield Mo(Gi.setSSOLoader({key:ep.DELETE_SSO_DOMAIN,value:!0}));const o=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{yield $o(Xf.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?D({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield Mo(Gi.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield Mo(Gi.setSSOError({key:ep.DELETE_SSO_DOMAIN,value:pg(e)})),null==i||i(null,e)}finally{yield Mo(Gi.setSSOLoader({key:ep.DELETE_SSO_DOMAIN,value:!1}))}}function*Yh({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield Mo(Gi.setSSOLoader({key:ep.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{yield $o(Xf.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 Mo(Gi.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield Mo(Gi.setSSOError({key:ep.VALIDATE_SSO_DOMAIN,value:pg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSSOLoader({key:ep.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Qh({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Mo(Gi.setSSOLoader({key:ep.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{yield $o(Xf.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?D({},e,{roleIds:n}):e));yield Mo(Gi.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield Mo(Gi.setSSOError({key:ep.UPDATE_SSO_DEFAULT_ROLES,value:pg(t)})),null==e||e(null,t)}finally{yield Mo(Gi.setSSOLoader({key:ep.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Xh({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield Mo(Gi.setSSOLoader({key:ep.SAVE_SSO_GROUPS,value:!0}));const o=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{yield Fo(t.map((e=>$o(Xf.auth.deleteSSOGroup,n,e)))),yield Fo(e.map((e=>$o(Xf.auth.createSSOGroup,n,e))));const a=yield $o(Xf.auth.getSSOGroups,n),r=o.map((e=>e.id===n?D({},e,{groups:a}):e));yield Mo(Gi.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield Mo(Gi.setSSOError({key:ep.SAVE_SSO_GROUPS,value:pg(e)})),null==i||i(null,e)}finally{yield Mo(Gi.setSSOLoader({key:ep.SAVE_SSO_GROUPS,value:!1}))}}function*Zh({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Fo(t.map((t=>$o(Xf.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Mo(Gi.setSSOError({key:ep.SAVE_SSO_GROUPS,value:pg(e)})),null==n||n(null,e)}finally{yield Mo(Gi.setSSOLoader({key:ep.SAVE_SSO_GROUPS,value:!1}))}}function*em({payload:e}){yield Mo(Gi.setSSOLoader({key:ep.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,s;i?(r=yield $o(Xf.auth.updateSSOConfigurationByMetadataUrl,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield $o(Xf.auth.createSSOConfigurationByMetadataUrl,e),s=[r,...a]),yield Mo(Gi.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield Mo(Gi.setSSOLoader({key:ep.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*tm({payload:e}){yield Mo(Gi.setSSOLoader({key:ep.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Qi(e,$h),o=yield jo((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield $o(Xf.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield $o(Xf.auth.createSSOConfiguration,i),a=[e,...o]),yield Mo(Gi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield Mo(Gi.setSSOLoader({key:ep.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*nm(){yield Da(Gi.loadSSOConfigurationsV2,jh),yield Da(Gi.saveSSOConfigurationV2,Bh),yield Da(Gi.saveSSODomain,Hh),yield Da(Gi.deleteSSODomain,Jh),yield Da(Gi.validateSSODomainV2,Yh),yield Da(Gi.updateSSOConfiguration,zh),yield Da(Gi.deleteSSOConfiguration,qh),yield Da(Gi.setSSOGroups,Xh),yield Da(Gi.updateSSOGroups,Zh),yield Da(Gi.setSSODefaultRoles,Qh),yield Da(Gi.saveSSOConfigurationByMetadata,Wh),yield Da(Gi.updateSSOConfigurationByMetadata,Kh),yield Da(Gi.saveSSOConfigurationByUrl,em),yield Da(Gi.saveSSOConfigurationByData,tm)}const im=["callback","profilePictureUrl"],om=["callback","profilePictureUrl"];function*am(){yield Mo(Gi.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 $o.apply(void 0,[Ra,e,t,n].concat(o))}(3,2e3,Xf.teams.getProfile),t=yield jo((e=>e.auth.user));Gi.setUser(D({},t,e)),yield Mo(Gi.setProfileState({profile:e,loading:!1}))}catch(e){yield Mo(Gi.setProfileState({loading:!1,error:pg(e)}))}}function*rm(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Qi(e.payload,im);yield Mo(Gi.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield jo((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 $o(Xf.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 $o(Xf.users.updateUserProfileV2,a),s=yield jo((e=>e.auth.user));yield Mo(Gi.setUser(D({},s,r))),yield Mo(Gi.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield Mo(Gi.setProfileState({saving:!1,error:pg(e),loading:!1})),null==t||t(null,e)}}function*sm({payload:e}){yield Mo(Gi.setProfileState({loading:!0}));try{var t;yield $o(Xf.teams.changePassword,e),yield Mo(Gi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mo(Gi.setProfileState({loading:!1,error:pg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*lm(){yield Ma(Gi.loadProfile,am),yield Da(Gi.saveProfile,rm),yield Da(Gi.changePassword,sm)}function*cm(){yield Mo(Gi.setProfileState({loading:!0})),yield Et(),yield Mo(Gi.setUser(D({},kp,Ep))),yield Mo(Gi.setProfileState({loading:!1,profile:Ep}))}function*um(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Qi(e.payload,om);yield Mo(Gi.setProfileState({saving:!0,error:null}));const o=Op;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=kp;yield Et(),yield Mo(Gi.setUser(D({},s,r))),yield Mo(Gi.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*dm({payload:e}){var t;yield Mo(Gi.setProfileState({loading:!0})),yield Et(),yield Mo(Gi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*ym(){yield Ma(Gi.loadProfile,cm),yield Da(Gi.saveProfile,um),yield Da(Gi.changePassword,dm)}const fm=["callback"],pm=["callback"],gm=["user"],Sm=["callback"],vm=["deviceId","callback"],hm=["deviceId","callback"],mm=["callback"],Am=["deviceId"],bm=["deviceId"],Tm=["callback"],Em=["deviceId"],km=["callback"];function*Om(e){const{step:t}=yield jo((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*Im(){yield Mo(Gi.setMfaState({saving:!0}));try{const{qrCode:e}=yield $o(Xf.auth.enrollMfa);yield Mo(Gi.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield Mo(Gi.setMfaState({saving:!1,error:pg(e)}))}}function*Pm(e){let{payload:{callback:t}}=e,n=Qi(e.payload,fm);yield Mo(Gi.setMfaState({saving:!0}));try{const e=yield jo((e=>e.auth.user)),i=yield $o(Xf.auth.verifyMfa,n),o=yield $o(Xf.auth.getMFADevices),a=yield Om(i);yield Mo(Gi.setMfaState(D({},a,{mfaDevices:o}))),yield Mo(Gi.setUser(D({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield Mo(Gi.setMfaState({saving:!1,error:pg(e)})),null==t||t(null,e)}}function*_m(e){let{payload:{callback:t}}=e,n=Qi(e.payload,pm);yield Mo(Gi.setMfaState({loading:!0}));try{const e=yield $o(Xf.auth.loginWithMfaV2,n),{user:i}=e,o=Qi(e,gm),a={step:cn.recoveryCode,loading:!1,saving:!1,error:void 0};null!=i&&i.recoveryCode&&(a.recoveryCode=i.recoveryCode),yield Mo(Gi.setMfaState(a)),yield yv(D({user:i},o)),null==t||t(a.recoveryCode)}catch(e){yield Mo(Gi.setMfaState({loading:!1,error:pg(e)})),null==t||t(null,e)}}function*Lm({payload:e}){yield Mo(Gi.setMfaState({saving:!0}));try{var t;yield $o(Xf.auth.disableMfa,e);const n=yield $o(Xf.auth.getMFADevices);yield Mo(Gi.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mo(Gi.setMfaState({saving:!1,error:pg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*wm({payload:e}){yield Mo(Gi.setMfaState({saving:!0}));try{var t,n;const i=yield $o(Xf.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 Mo(Gi.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield Mo(Gi.setMfaState({saving:!1,error:pg(t)})),null==(i=e.callback)||i.call(e,null,t)}}function*Cm(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Sm);yield Mo(Gi.setMfaState({saving:!0}));try{const e=Pt(n.publicKey),i=yield $o(Xf.auth.enrollMFAWebAuthn,D({},n,{options:e})),o=yield $o(Xf.auth.getMFADevices),a=yield Om(i);yield Mo(Gi.setMfaState(D({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield Mo(Gi.setMfaState({saving:!1,error:pg(e)})),null==t||t(null,e)}}function*Um(e){let{payload:{deviceId:t,callback:n}}=e;Qi(e.payload,vm),yield Mo(Gi.setMfaState({saving:!0}));try{var i;const e=yield $o(Xf.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 Mo(Gi.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Mo(Gi.setMfaState({saving:!1,error:pg(e)})),null==n||n(null,e)}}function*Rm(e){let{payload:{deviceId:t,callback:n}}=e,i=Qi(e.payload,hm);yield Mo(Gi.setMfaState({saving:!0}));try{const e=Pt(i.publicKey);yield $o(Xf.auth.disableMFAWebAuthn,t,D({},i,{options:e}));const o=yield $o(Xf.auth.getMFADevices);yield Mo(Gi.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield Mo(Gi.setMfaState({saving:!1,error:pg(e)})),null==n||n(!1,e)}}function*Dm({payload:e}){yield Mo(Gi.setMfaState({saving:!0}));try{var t;const n=yield $o(Xf.auth.preEnrollMFASMS,e);yield Mo(Gi.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 Mo(Gi.setMfaState({saving:!1,error:pg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Nm(e){let{payload:{callback:t}}=e,n=Qi(e.payload,mm);yield Mo(Gi.setMfaState({saving:!0}));try{const e=yield $o(Xf.auth.enrollMFASMS,n),i=yield $o(Xf.auth.getMFADevices),o=yield Om(e);yield Mo(Gi.setMfaState(D({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield Mo(Gi.setMfaState({saving:!1,error:pg(e)})),null==t||t(null,e)}}function*Mm(e){let{payload:{deviceId:t}}=e,n=Qi(e.payload,Am);yield Mo(Gi.setMfaState({saving:!0}));try{var i;const e=yield $o(Xf.auth.preDisableMFASMS,t);yield Mo(Gi.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 Mo(Gi.setMfaState({saving:!1,error:pg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*Fm(e){let{payload:{deviceId:t}}=e,n=Qi(e.payload,bm);yield Mo(Gi.setMfaState({saving:!0}));try{var i;yield $o(Xf.auth.disableMFASMS,t,n);const e=yield $o(Xf.auth.getMFADevices);yield Mo(Gi.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield Mo(Gi.setMfaState({saving:!1,error:pg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*Gm(){yield Mo(Gi.setMfaState({loading:!0}));try{yield jo((e=>e.auth.user));const e=yield $o(Xf.auth.getMFADevices);yield Mo(Gi.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield Mo(Gi.setMfaState({loading:!1,error:pg(e)}))}}function*$m(){yield Mo(Gi.setMfaState({loading:!0}));try{const e=(yield $o(Xf.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield Mo(Gi.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield Mo(Gi.setMfaState({loading:!1,error:pg(e)}))}}function*Vm(){yield Da(Gi.enrollMfa,Im),yield Da(Gi.getMFADevices,Gm),yield Da(Gi.getMFAStrategies,$m),yield Da(Gi.verifyMfa,Pm),yield Da(Gi.disableMfa,Lm),yield Da(Gi.verifyMfaAfterForce,_m),yield Da(Gi.preDisableMfaSms,Mm),yield Da(Gi.disableMfaSms,Fm),yield Da(Gi.preEnrollMfaSms,Dm),yield Da(Gi.enrollMfaSms,Nm),yield Da(Gi.preEnrollMfaWebAuthn,wm),yield Da(Gi.enrollMfaWebAuthn,Cm),yield Da(Gi.preDisableMfaWebAuthn,Um),yield Da(Gi.disableMfaWebAuthn,Rm)}function*xm(){yield Mo(Gi.setMfaState({saving:!0})),yield Mo(Gi.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*jm({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield jo((e=>e.auth.mfaState));yield Mo(Gi.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 Mo(Gi.setMfaState(i)),yield Mo(Gi.setUser(D({},kp,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*Bm(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Tm);yield Mo(Gi.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 Mo(Gi.setMfaState(o)),yield Et(),yield Mo(Gi.setUser(D({},kp,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*Wm({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield jo((e=>e.auth.mfaState));yield Mo(Gi.setMfaState({saving:!0})),yield Et(),yield Mo(Gi.setMfaState({saving:!1,error:void 0,mfaDevices:D({},n,{authenticators:[]})})),yield Mo(Gi.setUser(D({},kp))),null==(t=e.callback)||t.call(e,!0)}function*zm(e){let{}=e,t=Qi(e.payload,Em);yield Mo(Gi.setMfaState({saving:!0}));try{var n;yield Mo(Gi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield Mo(Gi.setMfaState({saving:!1,error:pg(e)})),null==(i=t.callback)||i.call(t,!1,e)}}function*Km({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield jo((e=>e.auth.mfaState));yield Mo(Gi.setMfaState({saving:!0})),yield Et(),yield Mo(Gi.setMfaState({loading:!1,error:void 0,mfaDevices:D({},n,{phones:[]})})),yield Mo(Gi.setUser(D({},kp))),null==(t=e.callback)||t.call(e,!0)}function*qm({payload:e}){var t;yield Mo(Gi.setMfaState({saving:!0})),yield Et(),yield Mo(Gi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*Hm(e){let{payload:{callback:t}}=e;Qi(e.payload,km);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield jo((e=>e.auth.mfaState));yield Mo(Gi.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 Mo(Gi.setMfaState(o)),yield Mo(Gi.setUser(D({},kp,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*Jm(){yield Da(Gi.enrollMfa,xm),yield Da(Gi.verifyMfa,jm),yield Da(Gi.disableMfa,Wm),yield Da(Gi.verifyMfaAfterForce,Bm),yield Da(Gi.preDisableMfaSms,zm),yield Da(Gi.disableMfaSms,Km),yield Da(Gi.preEnrollMfaSms,qm),yield Da(Gi.enrollMfaSms,Hm)}const Ym=["callback"];function*Qm({payload:e}){yield Mo(Gi.setForgotPasswordState({loading:!0}));try{var t;yield $o(Xf.auth.forgotPassword,e),yield Mo(Gi.setForgotPasswordState({loading:!1,error:void 0,step:Ht.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mo(Gi.setForgotPasswordState({loading:!1,error:pg(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*Xm(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Ym);yield Mo(Gi.setForgotPasswordState({loading:!0}));try{yield $o(Xf.auth.resetPassword,n),yield Mo(Gi.setForgotPasswordState({loading:!1,error:void 0,step:Ht.success})),null==t||t(!0)}catch(e){yield Mo(Gi.setForgotPasswordState({loading:!1,error:pg(e)})),null==t||t(!1,e)}}function*Zm({payload:e}){yield Mo(Gi.setForgotPasswordState({loading:!0}));try{const t=yield $o(Xf.auth.loadPasswordConfig,e);yield Mo(Gi.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Mo(Gi.setForgotPasswordState({loading:!1,error:pg(e)}))}}function*eA(){yield Ma(Gi.forgotPassword,Qm),yield Ma(Gi.resetPassword,Xm),yield Ma(Gi.loadPasswordConfig,Zm)}let tA;!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"}(tA||(tA={}));const nA=["callback","events"],iA=["user"],oA=["callback"],aA=["callback"];function*rA({payload:{userId:e,token:t}}){yield Mo(Gi.setActivateState({loading:!0,step:Vt.activating}));try{const{isAuthenticated:n}=yield jo((e=>e.auth));n&&(yield Mo(Gi.silentLogout()));const i=yield $o(Xf.auth.getActivateAccountStrategy,{userId:e,token:t});yield Mo(Gi.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield Mo(Gi.setActivateState({loading:!1,step:Vt.activatingForm})))}catch(e){yield Mo(Gi.setActivateState({loading:!1,error:pg(e)}))}}function*sA(e){let{payload:{callback:t,events:n}}=e,i=Qi(e.payload,nA);yield Mo(Gi.setActivateState({loading:!0}));try{const e=Fa.onRedirectTo,{routes:a}=yield jo((e=>e.auth)),r=yield $o(Xf.auth.activateAccountV2,i),{user:s}=r,l=Qi(r,iA);if(s.redirectLocation)return void(window.location.href=s.redirectLocation);if(ug(s)){yield Mo(Gi.setActivateState({step:Vt.success}));const t=yield fg(s);yield Mo(Gi.setState(t)),yield Bo(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield Mo(Gi.setActivateState({step:Vt.success}));const e={email:s.email,origin:ig.ACTIVATION_LINK,id:s.id,tenantId:s.tenantId,name:s.name,createdAt:new Date};null==n||null==(o=n.userVerified)||o.call(n,e),Sg(gg.USER_VERIFIED,e),yield $o(yv,D({user:s},l),{isAuthenticated:!0}),yield Bo(1e3),yield fv(),yield Mo(Gi.resetActivateState())}null==t||t(!0)}catch(e){yield Mo(Gi.setActivateState({loading:!1,error:pg(e)}))}}function*lA({payload:e}){const{callback:t}=e,n=Qi(e,oA);yield Mo(Gi.setActivateStrategyState({loading:!0}));try{const e=yield $o(Xf.auth.getActivateAccountStrategy,n);yield Mo(Gi.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield Mo(Gi.setActivateStrategyState({loading:!1,error:pg(e)}))}}function*cA({payload:e}){const{callback:t}=e,n=Qi(e,aA);yield Mo(Gi.setTeamLoader({key:tA.RESEND_ACTIVATE_LINK,value:n.email})),yield Mo(Gi.setActivateState({loading:!0}));try{yield $o(Xf.auth.resendActivationEmail,n),yield Mo(Gi.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield Mo(Gi.setActivateState({loading:!1,error:pg(e)})),yield Mo(Gi.setTeamError({key:tA.RESEND_ACTIVATE_LINK,value:pg(e)})),null==t||t(null,e)}yield Mo(Gi.setTeamLoader({key:tA.RESEND_ACTIVATE_LINK,value:!1}))}function*uA(){yield Ma(Gi.activateAccount,sA),yield Ma(Gi.preActivateAccount,rA),yield Ma(Gi.getActivateAccountStrategy,lA),yield Ma(Gi.resendActivationEmail,cA)}function*dA({payload:e}){if(e.token&&e.userId)try{yield Mo(Gi.setAcceptInvitationState({error:void 0,step:Wt.pending})),yield $o(Xf.auth.acceptInvitation,e),yield Mo(Gi.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Wt.success}}))}catch(e){yield Mo(Gi.setAcceptInvitationState({step:Wt.failed,error:pg(e)}))}else yield Mo(Gi.setAcceptInvitationState({error:void 0,step:Wt.invalid}))}function*yA(){yield Ma(Gi.acceptInvitation,dA)}var fA,pA=new Uint8Array(16);function gA(){if(!fA&&!(fA="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 fA(pA)}for(var SA=/^(?:[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,vA=function(e){return"string"==typeof e&&SA.test(e)},hA=[],mA=0;mA<256;++mA)hA.push((mA+256).toString(16).substr(1));var AA=function(e,t,n){var i=(e=e||{}).random||(e.rng||gA)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=i[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(hA[e[t+0]]+hA[e[t+1]]+hA[e[t+2]]+hA[e[t+3]]+"-"+hA[e[t+4]]+hA[e[t+5]]+"-"+hA[e[t+6]]+hA[e[t+7]]+"-"+hA[e[t+8]]+hA[e[t+9]]+"-"+hA[e[t+10]]+hA[e[t+11]]+hA[e[t+12]]+hA[e[t+13]]+hA[e[t+14]]+hA[e[t+15]]).toLowerCase();if(!vA(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let bA,TA;!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"}(bA||(bA={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(TA||(TA={}));const EA=["callback"],kA=["roles"],OA=["callback"],IA=["callback","profileImage"],PA=["callback"],_A=["callback","userId"],LA=["callback"],wA=["callback"],CA=["callback"],UA=["callback"],RA=["callback"],DA=["callback"],NA=["callback"],MA=["callback","profileImage"],FA=["callback"],GA=["callback"],$A=["callback"],VA=["callback"],xA=["callback"],jA=["callback"],BA=()=>jo((e=>e.auth.teamState));function*WA(){try{const{groups:e}=yield $o(Xf.groups.getGroups,{_groupsRelations:TA.roles});return e}catch(e){return[]}}function*zA({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield BA(),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 Mo(Gi.setTeamLoader({key:tA.USERS,value:!r})),yield Mo(Gi.setTeamState({pageSize:c,pageOffset:u,filterV2:d,sortV2:y}));try{const[{items:t,_metadata:{totalPages:n,totalItems:i}},{items:o},{items:a},r]=yield Fo([$o(Xf.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})),$o(Xf.teams.loadAvailableRoles),$o(Xf.teams.loadAvailablePermissions),$o(WA)]),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 Mo(Gi.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 Mo(Gi.setTeamError({key:tA.USERS,value:pg(e)})),yield Mo(Gi.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield Mo(Gi.setTeamLoader({key:tA.USERS,value:!1}))}function*KA({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield BA(),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 Mo(Gi.setTeamLoader({key:tA.USERS,value:!a})),yield Mo(Gi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield Fo([$o(Xf.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),$o(Xf.teams.loadAvailableRoles),$o(Xf.teams.loadAvailablePermissions)]);yield Mo(Gi.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield Mo(Gi.setTeamError({key:tA.USERS,value:e.message})),yield Mo(Gi.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Mo(Gi.setTeamLoader({key:tA.USERS,value:!1}))}function*qA({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield BA(),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 Mo(Gi.setTeamLoader({key:tA.USERS,value:!r})),yield Mo(Gi.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield Fo([$o(Xf.subTenants.loadAllUsers,D({},c)),$o(Xf.teams.loadAvailableRoles),$o(Xf.teams.loadAvailablePermissions)]);yield Mo(Gi.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield Mo(Gi.setTeamError({key:tA.USERS,value:pg(e)})),yield Mo(Gi.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield Mo(Gi.setTeamLoader({key:tA.USERS,value:!1}))}function*HA({payload:e}){yield Mo(Gi.setTeamLoader({key:tA.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield Fo([$o(Xf.teams.loadAvailableRoles),$o(Xf.teams.loadAvailablePermissions)]);yield Mo(Gi.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 Mo(Gi.setTeamError({key:tA.ROLES_AND_PERMISSIONS,value:pg(t)}))}yield Mo(Gi.setTeamLoader({key:tA.ROLES_AND_PERMISSIONS,value:!0}))}function*JA({payload:e}){const{callback:t}=e,n=Qi(e,EA),i=yield BA();yield Mo(Gi.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield $o(Xf.teams.addUser,n),{roles:a}=e,r=D({},Qi(e,kA),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield Mo(Gi.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Mo(Gi.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!1,error:pg(e)})})),null==t||t(null,e)}}function*YA({payload:e}){const{callback:t}=e,n=yield BA();yield Mo(Gi.setTeamState({addUserDialogState:D({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield Mo(Gi.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield $o(Xf.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 Mo(Gi.loadUsersV2(r)),yield Mo(Gi.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*QA({payload:e}){const{callback:t}=e,n=Qi(e,OA),i=yield BA();yield Mo(Gi.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})}));try{yield $o(Xf.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield $o(Xf.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield Mo(Gi.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield Mo(Gi.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!1,error:pg(e)})})),null==t||t(null,e)}}function*XA({payload:e}){const{callback:t}=e,n=Qi(e,IA),{id:i}=n,o=yield BA(),a=o.users.find((e=>e.id===n.id));yield Mo(Gi.setTeamLoader({key:tA.UPDATE_USER,value:i||""})),yield Mo(Gi.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!0})})),yield Mo(Gi.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 $o(Xf.teams.updateUser,n);null==t||t(e),yield Mo(Gi.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 Mo(Gi.setTeamLoader({key:tA.UPDATE_USER,value:!1}))}catch(e){yield Mo(Gi.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!1,error:pg(e)}),users:o.users.map((e=>e.id===n.id?D({},e,a):e))})),yield Mo(Gi.setTeamLoader({key:tA.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*ZA({payload:e}){const{callback:t}=e,n=Qi(e,PA),i=yield BA();yield Mo(Gi.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})}));try{yield $o(Xf.teams.deleteUser,n),null==t||t(!0),yield Mo(Gi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Mo(Gi.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!1,error:pg(e)})})),null==t||t(null,e)}}function*eb({payload:e}){const{callback:t,userId:n}=e,i=Qi(e,_A),o=yield BA();yield Mo(Gi.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!0})}));try{yield $o(Xf.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 Mo(Gi.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 Mo(Gi.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!1,error:pg(e)})})),null==t||t(null,e)}}function*tb({payload:e}){const{callback:t}=e,n=Qi(e,LA),i=yield BA();yield Mo(Gi.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})}));try{yield $o(Xf.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield Mo(Gi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Mo(Gi.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!1,error:pg(e)})})),null==t||t(null,e)}}function*nb({payload:e}){const{callback:t}=e,n=Qi(e,wA);yield Mo(Gi.setTeamLoader({key:tA.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield $o(Xf.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Mo(Gi.setTeamError({key:tA.RESEND_ACTIVATE_LINK,value:pg(e)})),null==t||t(null,e)}yield Mo(Gi.setTeamLoader({key:tA.RESEND_ACTIVATE_LINK,value:!1}))}function*ib({payload:e}){const{callback:t}=e,n=Qi(e,CA);yield Mo(Gi.setTeamLoader({key:tA.RESEND_INVITATION_LINK,value:n.email}));try{yield $o(Xf.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Mo(Gi.setTeamError({key:tA.RESEND_INVITATION_LINK,value:pg(e)})),null==t||t(null,e)}yield Mo(Gi.setTeamLoader({key:tA.RESEND_INVITATION_LINK,value:!1}))}function*ob({payload:e}){const{callback:t}=e,n=Qi(e,UA);yield Mo(Gi.setTeamLoader({key:tA.RESEND_INVITATION_LINK,value:n.email}));try{yield $o(Xf.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Mo(Gi.setTeamError({key:tA.RESEND_INVITATION_LINK,value:pg(e)})),null==t||t(null,e)}yield Mo(Gi.setTeamLoader({key:tA.RESEND_INVITATION_LINK,value:!1}))}function*ab({payload:e}){const{callback:t}=e,n=Qi(e,RA);yield Mo(Gi.setTeamLoader({key:tA.RESEND_INVITATION_LINK,value:n.email}));try{yield $o(Xf.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Mo(Gi.setTeamError({key:tA.RESEND_INVITATION_LINK,value:pg(e)})),null==t||t(null,e)}yield Mo(Gi.setTeamLoader({key:tA.RESEND_INVITATION_LINK,value:!1}))}function*rb(){yield Mo(Gi.setTeamError({key:tA.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield $o(Xf.teams.getInviteLinkConfiguration);yield Mo(Gi.setTeamState({inviteTokenState:D({},e)}))}catch(e){yield Mo(Gi.setTeamError({key:tA.CONFIG_TOKEN_LINK,value:pg(e)}))}}function*sb(){yield Mo(Gi.setTeamError({key:tA.GET_TOKEN_LINK,value:!1}));try{yield $o(rb);const e=yield $o(Xf.teams.getInviteUserLink),{inviteTokenState:t}=yield BA();yield Mo(Gi.setTeamState({inviteTokenState:D({},t,e)}))}catch(e){yield Mo(Gi.setTeamError({key:tA.GET_TOKEN_LINK,value:pg(e)}))}}function*lb({payload:{callback:e}}){yield Mo(Gi.setTeamError({key:tA.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield BA();try{const n=yield $o(Xf.teams.createInviteUserLink,{expiresInMinutes:43200});yield Mo(Gi.setTeamState({inviteTokenState:D({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield Mo(Gi.setTeamError({key:tA.CREATE_TOKEN_LINK,value:pg(t)}))}}function*cb({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield BA();yield Mo(Gi.setTeamError({key:tA.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield $o(Xf.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield Mo(Gi.setTeamState({inviteTokenState:D({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield Mo(Gi.setTeamError({key:tA.UPDATE_TOKEN_LINK,value:pg(t)}))}}function*ub({payload:e}){const{callback:t}=null!=e?e:{};yield Mo(Gi.setTeamError({key:tA.DELETE_TOKEN_LINK,value:!1}));try{yield $o(Xf.teams.deleteInviteUserLink),yield Mo(Gi.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Mo(Gi.setTeamError({key:tA.DELETE_TOKEN_LINK,value:pg(e)})),null==t||t(!1,e)}}function*db({payload:e}){yield Mo(Gi.setTeamState({addUserDialogState:D({open:!0,loading:!1,error:!1},e)}))}function*yb({payload:e}){const t=yield BA(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Mo(Gi.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*fb({payload:e}){yield Mo(Gi.setTeamState({deleteUserDialogState:D({open:!0,loading:!1,error:!1},e)}))}function*pb({payload:e}){const t=yield BA(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Mo(Gi.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*gb(){yield Na(Gi.loadUsers,KA),yield Na(Gi.loadUsersV2,zA),yield Na(Gi.loadAllSubTenantsUsers,qA),yield Na(Gi.loadRoles,HA),yield Da(Gi.addUser,JA),yield Da(Gi.addUsersBulk,YA),yield Da(Gi.addUserToSubTenants,QA),yield Da(Gi.updateUser,XA),yield Da(Gi.setUserRolesForSubTenants,eb),yield Da(Gi.deleteUser,ZA),yield Da(Gi.deleteUserFromSubTenants,tb),yield Da(Gi.resendActivationLink,nb),yield Da(Gi.resendInvitationLink,ib),yield Da(Gi.resendInvitationEmail,ob),yield Da(Gi.resendInvitationLinkToAllSubTenants,ab),yield Da(Gi.getInvitationLink,sb),yield Da(Gi.createInvitationLink,lb),yield Da(Gi.updateInvitationLink,cb),yield Da(Gi.deleteInvitationLink,ub),yield Da(Gi.openAddUserDialog,db),yield Da(Gi.closeAddUserDialog,yb),yield Da(Gi.openDeleteUserDialog,fb),yield Da(Gi.closeDeleteUserDialog,pb)}function*Sb({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield BA(),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 Mo(Gi.setTeamLoader({key:tA.USERS,value:!a})),yield Mo(Gi.setTeamState({pageSize:l,pageOffset:c,filterV2:u,sortV2:d})),yield Et(),yield Mo(Gi.setTeamState({users:xp,totalPages:2,totalItems:10,roles:Rp,permissions:Np})),yield Mo(Gi.setTeamLoader({key:tA.USERS,value:!1})),null==r||r(xp)}function*vb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield BA(),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 Mo(Gi.setTeamLoader({key:tA.USERS,value:!r})),yield Mo(Gi.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield Et(),yield Mo(Gi.setTeamState({allUsers:Bp,totalPages:2,totalItems:10,roles:Rp,permissions:Np})),yield Mo(Gi.setTeamLoader({key:tA.USERS,value:!1})),null==s||s(Bp)}function*hb({payload:e}){var t;yield Mo(Gi.setTeamLoader({key:tA.ROLES_AND_PERMISSIONS,value:!0})),yield Et(),yield Mo(Gi.setTeamState({roles:Rp,permissions:Np})),yield Mo(Gi.setTeamLoader({key:tA.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Rp,permissions:Np})}function*mb({payload:e}){const{callback:t}=e,n=Qi(e,DA),i=yield BA();yield Mo(Gi.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})})),yield Et();const o=D({},Gp,{groups:[]},n,{id:`${AA()}`});null==t||t(o),yield Mo(Gi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Ab({payload:e}){const{callback:t}=e,n=Qi(e,NA),i=yield BA();yield Mo(Gi.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})})),yield Et();const o=D({},Gp,n,{id:`${AA()}`});yield Mo(Gi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*bb({payload:e}){var t;const{callback:n}=e,i=Qi(e,MA),{id:o}=i,a=yield BA(),r=a.users.find((e=>e.id===i.id));yield Mo(Gi.setTeamLoader({key:tA.UPDATE_USER,value:o||""})),yield Mo(Gi.setTeamState({addUserDialogState:D({},a.addUserDialogState,{loading:!0})})),yield Mo(Gi.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 Mo(Gi.setTeamState({users:a.users.map((e=>e.id===s.id?D({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield Mo(Gi.setTeamLoader({key:tA.UPDATE_USER,value:!1}))}function*Tb({payload:e}){const{callback:t}=e,n=Qi(e,FA),i=yield BA();yield Mo(Gi.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield Mo(Gi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Eb({payload:e}){const{callback:t}=e,n=Qi(e,GA),i=yield BA();yield Mo(Gi.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield Mo(Gi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*kb({payload:e}){const{callback:t}=e,n=Qi(e,$A);yield Mo(Gi.setTeamLoader({key:tA.RESEND_ACTIVATE_LINK,value:n.userId})),yield Et(),null==t||t(!0),yield Mo(Gi.setTeamLoader({key:tA.RESEND_ACTIVATE_LINK,value:!1}))}function*Ob({payload:e}){const{callback:t}=e,n=Qi(e,VA);yield Mo(Gi.setTeamLoader({key:tA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield Mo(Gi.setTeamLoader({key:tA.RESEND_INVITATION_LINK,value:!1}))}function*Ib({payload:e}){const{callback:t}=e,n=Qi(e,xA);yield Mo(Gi.setTeamLoader({key:tA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield Mo(Gi.setTeamLoader({key:tA.RESEND_INVITATION_LINK,value:!1}))}function*Pb({payload:e}){const{callback:t}=e,n=Qi(e,jA);yield Mo(Gi.setTeamLoader({key:tA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield Mo(Gi.setTeamLoader({key:tA.RESEND_INVITATION_LINK,value:!1}))}function*_b(){yield Na(Gi.loadUsersV2,Sb),yield Na(Gi.loadAllSubTenantsUsers,vb),yield Na(Gi.loadRoles,hb),yield Da(Gi.addUser,mb),yield Da(Gi.addUserToSubTenants,Ab),yield Da(Gi.updateUser,bb),yield Da(Gi.deleteUser,Tb),yield Da(Gi.deleteUserFromSubTenants,Eb),yield Da(Gi.resendActivationLink,kb),yield Da(Gi.resendInvitationLink,Ob),yield Da(Gi.resendInvitationEmail,Ib),yield Da(Gi.resendInvitationLinkToAllSubTenants,Pb),yield Da(Gi.openAddUserDialog,db),yield Da(Gi.closeAddUserDialog,yb),yield Da(Gi.openDeleteUserDialog,fb),yield Da(Gi.closeDeleteUserDialog,pb)}const Lb=["authorizationUrl"],wb=["events","url"];function*Cb(){try{yield Mo(Gi.setSocialLoginsState({loading:!0}));const e=yield $o(Xf.auth.getSocialLoginProviders);yield Mo(Gi.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield Mo(Gi.setSocialLoginsState({error:pg(e),loading:!1,firstLoad:!1}))}}function*Ub(){const e=yield jo((({auth:e})=>e.isAuthenticated));let t;return t=e?yield $o(Xf.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield $o(Xf.auth.getSocialLoginProvidersV2),t}function*Rb(){try{const e=yield jo((e=>e.root.context));yield Mo(Gi.setSocialLoginsState({loading:!0}));const t=yield $o(Ub),{providers:n}=yield $o(Xf.auth.getCustomSocialLoginProvidersV1),i=t.map((t=>{let{authorizationUrl:n}=t,i=Qi(t,Lb);const o=Or(e,null!=n?n:"");return D({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield Mo(Gi.setSocialLoginsState({socialLoginsConfigV2:i,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield Mo(Gi.setSocialLoginsState({error:pg(e),loading:!1,firstLoad:!1}))}}function*Db(e){let{payload:{events:t,url:n}}=e,i=Qi(e.payload,wb);try{yield Mo(Gi.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield $o(Xf.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:og.SOCIAL_LOGIN});null==t||null==(o=t.signUpComplete)||o.call(t,u),Sg(gg.SIGNUP_COMPLETED,u);const d=D({},r,{origin:ig.SOCIAL_LOGIN,name:c});null==t||null==(a=t.userVerified)||a.call(t,d),Sg(gg.USER_VERIFIED,d)}s&&localStorage.setItem("userId",s),yield Mo(Gi.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield jo((e=>e.auth));e?yield $o(mv):yield $o(bv)}(),localStorage.removeItem("register-quick-login"),yield Mo(Gi.setSocialLoginsState({loading:!1}))}catch(e){yield Mo(Gi.setSocialLoginsState({loading:!1,error:pg(e,"Failed to authenticate"),firstLoad:!1}))}}function*Nb({payload:e}){yield Mo(Gi.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*Mb(){yield Ma(Gi.loadSocialLoginsConfiguration,Cb),yield Ma(Gi.loadSocialLoginsConfigurationV2,Rb),yield Ma(Gi.loginViaSocialLogin,Db),yield Na(Gi.setSocialLoginError,Nb)}let Fb;function*Gb({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield jo((e=>e.auth.apiTokensState)),{policy:a}=yield jo((e=>e.auth.securityPolicyState.publicPolicy)),r=(null==a?void 0:a.machineToMachineAuthStrategy)===Oi.AccessToken;try{let e;yield Mo(Gi.setApiTokensLoader({key:Fb.ADD_API_TOKEN,value:!0}));let a=null;n&&(a=1440*n),e=r?yield $o(Xf.auth.createUserAccessToken,{description:t,expiresInMinutes:a}):yield $o(Xf.auth.updateUserApiTokensData,{description:t,expiresInMinutes:a}),yield Mo(Gi.setApiTokensState({showAddTokenDialog:!1})),yield Bo(200),yield Mo(Gi.setApiTokensState({apiTokensDataUser:[D({},e,{type:r?Oi.AccessToken:Oi.ClientCredentials}),...o],successDialog:{open:!0,secret:e.secret,clientId:r?void 0:e.clientId}})),yield Mo(Gi.setApiTokensLoader({key:Fb.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Mo(Gi.setApiTokensError({key:Fb.ADD_API_TOKEN,value:pg(e)})),yield Mo(Gi.setApiTokensLoader({key:Fb.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*$b({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield jo((e=>e.auth.apiTokensState)),{policy:r}=yield jo((e=>e.auth.securityPolicyState.publicPolicy)),s=(null==r?void 0:r.machineToMachineAuthStrategy)===Oi.AccessToken;try{let e;yield Mo(Gi.setApiTokensLoader({key:Fb.ADD_API_TOKEN,value:!0}));let r=null;i&&(r=1440*i),e=s?yield $o(Xf.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n}):yield $o(Xf.auth.updateTenantApiTokensData,{description:t,roleIds:n,expiresInMinutes:r}),yield Mo(Gi.setApiTokensState({showAddTokenDialog:!1})),yield Bo(200),yield Mo(Gi.setApiTokensState({apiTokensDataTenant:[D({},e,{type:s?Oi.AccessToken:Oi.ClientCredentials}),...a],successDialog:{open:!0,secret:e.secret,clientId:s?void 0:e.clientId}})),yield Mo(Gi.setApiTokensLoader({key:Fb.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield Mo(Gi.setApiTokensError({key:Fb.ADD_API_TOKEN,value:pg(e)})),yield Mo(Gi.setApiTokensLoader({key:Fb.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*Vb({payload:e}){const{apiTokensDataUser:t}=yield jo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield Mo(Gi.setApiTokensLoader({key:Fb.DELETE_API_TOKEN,value:!0})),n?(yield $o(Xf.auth.deleteUserAccessToken,{id:e}),yield Mo(Gi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield $o(Xf.auth.deleteUserApiToken,{tokenId:e}),yield Mo(Gi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield Mo(Gi.setApiTokensLoader({key:Fb.DELETE_API_TOKEN,value:!1}))}catch(e){yield Mo(Gi.setApiTokensError({key:Fb.DELETE_API_TOKEN,value:pg(e)})),yield Mo(Gi.setApiTokensLoader({key:Fb.DELETE_API_TOKEN,value:!1}))}}function*xb({payload:e}){const{apiTokensDataTenant:t}=yield jo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield Mo(Gi.setApiTokensLoader({key:Fb.DELETE_API_TOKEN,value:!0})),n?(yield $o(Xf.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield $o(Xf.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield Mo(Gi.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield Mo(Gi.setApiTokensLoader({key:Fb.DELETE_API_TOKEN,value:!1}))}catch(e){yield Mo(Gi.setApiTokensError({key:Fb.DELETE_API_TOKEN,value:pg(e)})),yield Mo(Gi.setApiTokensLoader({key:Fb.DELETE_API_TOKEN,value:!1}))}}function*jb({payload:e}){null!=e&&e.silentLoading||(yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield Fo([$o(Xf.auth.getUserApiTokensData),$o(Xf.auth.getTenantApiTokensData)]);yield Mo(Gi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mo(Gi.setApiTokensError({key:Fb.LOAD_API_TOKENS,value:pg(t)})),yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Bb({payload:e}){null!=e&&e.silentLoading||(yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=$o(Xf.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=$o(Xf.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 Mo(Gi.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield Mo(Gi.setApiTokensError({key:Fb.LOAD_API_TOKENS,value:pg(t)})),yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Wb({payload:e}){null!=e&&e.silentLoading||(yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=$o(Xf.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=$o(Xf.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 Mo(Gi.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield Mo(Gi.setApiTokensError({key:Fb.LOAD_API_TOKENS,value:pg(t)})),yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*zb(){yield Ma(Gi.loadApiTokens,jb),yield Ma(Gi.loadUserApiTokens,Bb),yield Ma(Gi.loadTenantApiTokens,Wb),yield Da(Gi.addUserApiToken,Gb),yield Da(Gi.addTenantApiToken,$b),yield Na(Gi.deleteTenantApiToken,xb),yield Na(Gi.deleteUserApiToken,Vb)}function*Kb({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield Mo(Gi.setApiTokensLoader({key:Fb.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield jo((e=>e.auth.apiTokensState)),a=D({},bp,{description:t,roleIds:n,clientId:`CLIENT_ID_${AA()}`});yield Mo(Gi.setApiTokensState({showAddTokenDialog:!1})),yield Bo(200),yield Mo(Gi.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Bo(200),yield Mo(Gi.setApiTokensLoader({key:Fb.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*qb({payload:e}){yield Mo(Gi.setApiTokensLoader({key:Fb.DELETE_API_TOKEN,value:!0})),yield Bo(200);const t=[bp];yield Mo(Gi.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Mo(Gi.setApiTokensLoader({key:Fb.DELETE_API_TOKEN,value:!1}))}function*Hb({payload:e}){var t;null!=e&&e.silentLoading||(yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!0})));const n=[Ap],i=[bp];yield Mo(Gi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Bo(200),yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Jb({payload:e}){var t;null!=e&&e.silentLoading||(yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!0})));const n=[Ap];yield Mo(Gi.setApiTokensState({apiTokensDataUser:n})),yield Bo(200),yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Yb({payload:e}){var t;null!=e&&e.silentLoading||(yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!0})));const n=[bp];yield Mo(Gi.setApiTokensState({apiTokensDataTenant:n})),yield Bo(200),yield Mo(Gi.setApiTokensLoader({key:Fb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Qb(){yield Ma(Gi.loadApiTokens,Hb),yield Ma(Gi.loadUserApiTokens,Jb),yield Ma(Gi.loadTenantApiTokens,Yb),yield Da(Gi.addTenantApiToken,Kb),yield Na(Gi.deleteTenantApiToken,qb)}function*Xb({payload:e}){try{var t;yield Mo(Gi.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield jo((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield $o(Xf.accountSettings.updateSettings,D({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield Mo(Gi.setAccountSettingsState(D({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield Mo(Gi.setAccountSettingsState({loading:!1,error:pg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Zb({payload:e}){yield Mo(Gi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield $o(Xf.accountSettings.getSettings);yield Mo(Gi.setAccountSettingsState(D({},e,{loading:!1})))}catch(e){yield Mo(Gi.setAccountSettingsState({loading:!1,error:pg(e)}))}}function*eT(){yield Ma(Gi.saveAccountSettings,Xb),yield Ma(Gi.loadAccountSettings,Zb)}function*tT({payload:e}){var t;yield Mo(Gi.setAccountSettingsState({loading:!0})),yield Et();const{accountSettingsState:n}=yield jo((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 Mo(Gi.setAccountSettingsState(D({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*nT({payload:e}){yield Mo(Gi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield Et(),yield Mo(Gi.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*iT(){yield Ma(Gi.saveAccountSettings,tT),yield Ma(Gi.loadAccountSettings,nT)}function*oT({payload:{tenantId:e,callback:t}}){yield Mo(Gi.setState({isLoading:!0}));try{yield $o(Xf.tenants.switchTenant,{tenantId:e}),yield $o(vv),(null==t?void 0:t(!0))||(yield Mo(Gi.setState({isLoading:!1})))}catch(e){yield Mo(Gi.setState({isLoading:!1})),null==t||t(!1,e)}}function*aT({payload:e}){yield Mo(Gi.setTenantsState({loading:!0}));try{var t;const n=yield $o(Qr());yield Mo(Gi.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 Mo(Gi.setTenantsState({loading:!1}))}}function*rT({payload:e}){yield Mo(Gi.setTenantsState({loading:!0}));try{var t;const n=yield $o(Xf.tenants.getSubTenants);yield Mo(Gi.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mo(Gi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*sT({payload:e}){yield Mo(Gi.setTenantsState({loading:!0}));try{var t;const n=yield $o(Xf.tenants.getSubTenantsAsTree);yield Mo(Gi.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mo(Gi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*lT(){yield Da(Gi.loadTenants,aT),yield Da(Gi.loadSubTenants,rT),yield Da(Gi.switchTenant,oT),yield Da(Gi.loadSubTenantsTree,sT)}function*cT(){yield Mo(Gi.setTenantsState({loading:!0})),yield Et(),yield Mo(Gi.setTenantsState({tenants:Wp,activeTenant:Wp[0],loading:!1}))}function*uT(){yield Da(Gi.loadTenants,cT)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(Fb||(Fb={}));const dT=["callback"],yT=["callback"],fT=["callback"],pT=["callback"],gT=["callback"];function*ST({payload:e}){var t;yield Mo(Gi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Fo([$o(Xf.roles.getRoles),$o(Xf.roles.getPermissions),$o(Xf.roles.getPermissionCategories)]),[t,n,i]=e;yield Mo(Gi.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield Mo(Gi.setRolesState({error:pg(e),loading:!1}))}}function*vT(e){let{payload:{callback:t}}=e,n=Qi(e.payload,dT);yield Mo(Gi.setRolesState({saving:!0}));try{const e=yield $o(Xf.roles.addRole,n),i=yield $o(Xf.roles.getRoles);yield Mo(Gi.loadRolesAndPermissions({silentLoading:!0})),yield Mo(Gi.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setRolesState({error:pg(e),saving:!1})),null==t||t(null,e)}}function*hT(e){let{payload:{callback:t}}=e,n=Qi(e.payload,yT);yield Mo(Gi.setRolesState({saving:!0}));try{yield $o(Xf.roles.deleteRole,n),yield Mo(Gi.loadRolesAndPermissions({silentLoading:!0})),yield Mo(Gi.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setRolesState({error:pg(e),saving:!1})),null==t||t(!1,e)}}function*mT(e){let{payload:{callback:t}}=e,n=Qi(e.payload,fT);yield Mo(Gi.setRolesState({saving:!0}));try{const e=yield $o(Xf.roles.updateRole,n);yield Mo(Gi.loadRolesAndPermissions({silentLoading:!0})),yield Mo(Gi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setRolesState({error:pg(e),saving:!1})),null==t||t(null,e)}}function*AT(e){let{payload:{callback:t}}=e,n=Qi(e.payload,pT);yield Mo(Gi.setRolesState({saving:!0}));try{const e=yield $o(Xf.roles.attachPermissionsToRole,n);yield Mo(Gi.loadRolesAndPermissions({silentLoading:!0})),yield Mo(Gi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setRolesState({error:pg(e),saving:!1})),null==t||t(null,e)}}function*bT(e){let{payload:{callback:t}}=e,n=Qi(e.payload,gT);yield Mo(Gi.setRolesState({saving:!0}));try{const e=yield $o(Xf.roles.attachPermissionToRoles,n);yield Mo(Gi.loadRolesAndPermissions({silentLoading:!0})),yield Mo(Gi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setRolesState({error:pg(e),saving:!1})),null==t||t(null,e)}}function*TT(){yield Ma(Gi.loadRolesAndPermissions,ST),yield Da(Gi.addRole,vT),yield Da(Gi.deleteRole,hT),yield Da(Gi.updateRole,mT),yield Da(Gi.attachPermissionsToRole,AT),yield Da(Gi.attachPermissionToRoles,bT)}function*ET({payload:e}){var t;yield Mo(Gi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield Mo(Gi.setRolesState({roles:Tp,loading:!1}))}catch(e){yield Mo(Gi.setRolesState({error:pg(e),loading:!1}))}}function*kT(){yield Ma(Gi.loadRolesAndPermissions,ET)}const OT=["callback"],IT=["callback"],PT=["callback"];function*_T(e){let{payload:{callback:t}}=e,n=Qi(e.payload,OT);yield Mo(Gi.setResetPhoneNumberState({loading:!0}));try{const e=yield $o(Xf.auth.resetPhoneNumber,n);yield Mo(Gi.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Xt.VerifyResetPhoneNumber})),yield Mo(Gi.setLoginState({email:n.email}))}catch(e){yield Mo(Gi.setResetPhoneNumberState({loading:!1,error:pg(e)})),null==t||t(null,e)}}function*LT(e){let{payload:{callback:t}}=e,n=Qi(e.payload,IT);yield Mo(Gi.setResetPhoneNumberState({loading:!0}));try{const e=yield $o(Xf.auth.verifyResetPhoneNumber,n);yield Mo(Gi.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Xt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield Mo(Gi.setResetPhoneNumberState({loading:!1,error:pg(e)})),null==t||t(null,e)}}function*wT(e){let{payload:{callback:t}}=e,n=Qi(e.payload,PT);yield Mo(Gi.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield jo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield $o(Xf.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Mo(Gi.setLoginState({step:_t.loginWithSmsOtc})),yield Mo(Gi.passwordlessPreLogin({type:ki.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield Mo(Gi.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setResetPhoneNumberState({loading:!1,error:pg(e)})),null==t||t(null,e)}}function*CT(){yield Ma(Gi.resetPhoneNumber,_T),yield Ma(Gi.verifyResetPhoneNumber,LT),yield Ma(Gi.changePhoneNumber,wT)}function*UT(){yield Mo(Gi.setSessionsState({loading:!0,error:null}));try{const e=yield $o(Xf.auth.getCurrentUserSessions);yield Mo(Gi.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Mo(Gi.setSessionsState({error:e,loading:!1}))}}function*RT(){yield Mo(Gi.setSessionsState({loading:!0,error:null}));try{const e=yield $o(Xf.auth.getCurrentUserSession);yield Mo(Gi.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Mo(Gi.setSessionsState({error:e,loading:!1}))}}function*DT({payload:{id:e}}){yield Mo(Gi.setSessionsState({loading:!0,error:null}));try{yield $o(Xf.auth.deleteSessionForUser,e),yield Mo(Gi.loadUserSessions())}catch(e){yield Mo(Gi.setSessionsState({error:e,loading:!1}))}}function*NT({payload:{callback:e,userId:t}}){yield Mo(Gi.setSessionsState({loading:!0,error:null}));try{yield $o(Xf.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Mo(Gi.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*MT(){yield Mo(Gi.setSessionsState({loading:!0,error:null}));try{yield $o(Xf.auth.deleteAllSessionsForUser),yield Mo(Gi.loadUserSessions())}catch(e){yield Mo(Gi.setSessionsState({error:e,loading:!1}))}}function*FT(){yield Na(Gi.loadUserSessions,UT),yield Na(Gi.deleteUserSession,DT),yield Na(Gi.deleteAllUserSessions,MT),yield Na(Gi.loadCurrentUserSession,RT),yield Da(Gi.revokeUserSessions,NT)}function*GT(){yield Mo(Gi.setSessionsState({loading:!0,error:null})),yield Mo(Gi.setSessionsState({sessions:zp,loading:!1}))}function*$T({payload:{id:e}}){yield Mo(Gi.setSessionsState({loading:!0,error:null}));const t=(yield jo((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield Mo(Gi.setSessionsState({sessions:t,loading:!1}))}function*VT(){yield Mo(Gi.setSessionsState({loading:!0,error:null}));const e=zp.filter((e=>e.current));yield Mo(Gi.setSessionsState({sessions:e,loading:!1}))}function*xT(){yield Na(Gi.loadUserSessions,GT),yield Na(Gi.deleteUserSession,$T),yield Na(Gi.deleteAllUserSessions,VT)}const jT=["callback"],BT=["callback"];function*WT(){yield Mo(Gi.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield $o(Xf.auth.getSessionConfigurations);yield Mo(Gi.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Mo(Gi.setSessionsState({error:e,loading:!1}))}}function*zT({payload:e}){yield Mo(Gi.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Qi(e,jT);yield $o(Xf.auth.createOrUpdateSessionConfigrations,n),yield Mo(Gi.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Mo(Gi.setSessionsPolicyState({error:e,loading:!1}))}}function*KT(){yield Ma(Gi.loadSessionsPolicy,WT),yield Na(Gi.createOrUpdateSessionsPolicy,Ig(zT))}function*qT(){yield Mo(Gi.setSessionsPolicyState({loading:!0,error:null}));const e=yield jo((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Kp}));yield Mo(Gi.setSessionsPolicyState(D({},e,{loading:!1})))}function*HT({payload:e}){yield Mo(Gi.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Qi(e,BT);null==t||t(!0),yield Mo(Gi.setSessionsPolicyState({configurations:n,loading:!1}))}function*JT(){yield Ma(Gi.loadSessionsPolicy,qT),yield Na(Gi.createOrUpdateSessionsPolicy,HT)}const YT=["callback"],QT=["callback"],XT=["callback"],ZT=["callback"],eE=["callback"],tE=["callback"],nE=["callback"],iE=["callback"],oE=()=>jo((e=>e.auth.restrictionsState.ipRestrictions)),aE=()=>jo((e=>e.auth.restrictionsState.emailDomainRestrictions));function*rE(){yield Mo(Gi.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield $o(Xf.auth.getDomainRestrictionsConfig),t=(yield $o(Xf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Mo(Gi.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield Mo(Gi.setEmailDomainRestrictionsState({error:pg(e),loading:!1}))}}function*sE(e){let{payload:{callback:t}}=e,n=Qi(e.payload,YT);yield Mo(Gi.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield aE();try{var o;yield $o(Xf.auth.createDomainRestriction,n);const e=(yield $o(Xf.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield Mo(Gi.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 Mo(Gi.setEmailDomainRestrictionsState({saving:!1,error:pg(e)})),null==t||t(null,e)}}function*lE(e){let{payload:{callback:t}}=e,n=Qi(e.payload,QT);yield Mo(Gi.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield $o(Xf.auth.updateDomainRestrictionConfig,n),i=(yield $o(Xf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Mo(Gi.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setEmailDomainRestrictionsState({saving:!1,error:pg(e)})),null==t||t(null,e)}}function*cE({payload:{id:e}}){yield Mo(Gi.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield aE();try{var n;yield $o(Xf.auth.deleteDomainRestriction,e);const i=(yield $o(Xf.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield Mo(Gi.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 Mo(Gi.setEmailDomainRestrictionsState({saving:!1,error:pg(e)}))}}const uE=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*dE(){yield Mo(Gi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield oE(),t=yield $o(Xf.auth.getIPRestrictionsConfig),n=uE({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield $o(Xf.auth.getIPRestrictions,n);yield Mo(Gi.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield Mo(Gi.setIpRestrictionsState({error:pg(e),loading:!1}))}}function*yE(){try{const{valid:e}=yield $o(Xf.auth.testCurrentIpInAllowList);yield Mo(Gi.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Mo(Gi.setIpRestrictionsState({error:pg(e)}))}}function*fE({payload:{callback:e}}){yield Mo(Gi.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield jo((e=>e.auth.userIp));yield Fo([$o(Xf.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Wn.ALLOW}),$o(Xf.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield oE(),i=uE(n.pagination),{items:o,_metadata:{totalPages:a}}=yield $o(Xf.auth.getIPRestrictions,i);yield Mo(Gi.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 Mo(Gi.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*pE(e){let{payload:{callback:t}}=e,n=Qi(e.payload,XT);yield Mo(Gi.setIpRestrictionsState({saving:!0,error:null}));const i=yield oE();try{var o,a;yield $o(Xf.auth.createIPRestriction,n);const e=yield oE(),r=uE(e.pagination),{items:s,_metadata:{totalPages:l}}=yield $o(Xf.auth.getIPRestrictions,r);yield yE(),yield Mo(Gi.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 Mo(Gi.setIpRestrictionsState({saving:!1,error:pg(e)})),null==t||t(null,e)}}function*gE(e){let{payload:{callback:t}}=e,n=Qi(e.payload,ZT);yield Mo(Gi.setIpRestrictionsState({saving:!0,error:null}));try{yield $o(Xf.auth.updateIPRestrictionConfig,n);const e=yield oE(),i=yield $o(Xf.auth.getIPRestrictionsConfig),o=uE(D({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield $o(Xf.auth.getIPRestrictions,o);yield yE(),yield Mo(Gi.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setIpRestrictionsState({saving:!1,error:pg(e)})),null==t||t(null,e)}}function*SE({payload:{id:e,callback:t}}){yield Mo(Gi.setIpRestrictionsState({saving:!0,error:null}));const n=yield oE();try{var i;yield $o(Xf.auth.deleteIPRestriction,e);const o=yield oE(),a=uE(o.pagination),{items:r,_metadata:{totalPages:s}}=yield $o(Xf.auth.getIPRestrictions,a);yield yE(),yield Mo(Gi.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 Mo(Gi.setIpRestrictionsState({saving:!1,error:pg(e)})),null==t||t(null,e)}}function*vE(){yield Ma(Gi.loadIpRestrictions,Ig(dE)),yield Ma(Gi.loadEmailDomainRestrictions,Ig(rE)),yield Da(Gi.saveIpRestriction,Ig(pE)),yield Da(Gi.saveIpRestrictionsConfig,Ig(gE)),yield Da(Gi.deleteIpRestriction,Ig(SE)),yield Da(Gi.checkIfUserIpValid,Ig(yE)),yield Da(Gi.addCurrentUserIpAndActivate,Ig(fE)),yield Da(Gi.saveEmailDomainRestriction,Ig(sE)),yield Da(Gi.saveEmailDomainRestrictionsConfig,Ig(lE)),yield Da(Gi.deleteEmailDomainRestriction,Ig(cE))}function*hE(){yield Mo(Gi.setIpRestrictionsState({loading:!0,error:null})),yield Mo(Gi.setIpRestrictionsState({data:{restrictions:Hp.filter((e=>e.strategy===qp.strategy)),config:qp},totalPages:1,pagination:{_filter:Wn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*mE(){yield Mo(Gi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield oE(),t=Hp[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield Mo(Gi.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield Mo(Gi.setIpRestrictionsState({error:pg(e),loading:!1}))}}function*AE(e){var t,n,i;let{payload:{callback:o}}=e,a=Qi(e.payload,eE);yield Mo(Gi.setIpRestrictionsState({saving:!0,error:null}));const r=yield oE(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield Mo(Gi.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:AA(),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*bE(e){var t,n,i;let{payload:{callback:o}}=e,a=Qi(e.payload,tE);const r=yield oE();yield Mo(Gi.setIpRestrictionsState({saving:!0,error:null})),yield Mo(Gi.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 Mo(Gi.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*TE({payload:{id:e,callback:t}}){var n;yield Mo(Gi.setIpRestrictionsState({saving:!0,error:null}));const i=yield oE();yield Mo(Gi.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*EE(){yield Mo(Gi.setEmailDomainRestrictionsState({loading:!0,error:null})),yield Mo(Gi.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Wn.ALLOW}],config:{active:!0,listType:Wn.ALLOW,blockPublicDomains:!1}}}))}function*kE(e){var t,n;let{payload:{callback:i}}=e,o=Qi(e.payload,nE);const a=yield aE();yield Mo(Gi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==i||i(!0),yield Mo(Gi.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*OE(e){var t;let{payload:{callback:n}}=e,i=Qi(e.payload,iE);const o=yield aE();yield Mo(Gi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==n||n(!0),yield Mo(Gi.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*IE({payload:{id:e}}){var t,n;const i=yield aE();yield Mo(Gi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),yield Mo(Gi.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*PE(){yield Ma(Gi.loadIpRestrictions,hE),yield Ma(Gi.loadEmailDomainRestrictions,EE),yield Da(Gi.saveIpRestriction,AE),yield Da(Gi.saveIpRestrictionsConfig,bE),yield Da(Gi.deleteIpRestriction,TE),yield Da(Gi.checkIfUserIpValid,mE),yield Da(Gi.saveEmailDomainRestriction,kE),yield Da(Gi.saveEmailDomainRestrictionsConfig,OE),yield Da(Gi.deleteEmailDomainRestriction,IE)}const _E=["callback"],LE=["id"];function*wE(e){const{count:t}=yield $o(Xf.directory.countConfigurationUsers,e.id);return D({},e,{count:t})}function*CE(){yield Mo(Gi.setProvisioningState({loading:!0,error:null}));try{const e=yield $o(Xf.directory.getConfigs),t=yield Fo(e.map((e=>wE(e))));yield Mo(Gi.setProvisioningState({connections:t,loading:!1}))}catch(e){yield Mo(Gi.setProvisioningState({error:pg(e),loading:!1}))}}function*UE(e){let{payload:{callback:t}}=e,n=Qi(e.payload,_E);yield Mo(Gi.setProvisioningState({loading:!0,error:null}));try{const e=yield $o(Xf.directory.createConfiguration,n),i=yield $o(Xf.directory.getConfigs),o=yield Fo(i.map((e=>wE(e))));yield Mo(Gi.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield Mo(Gi.setProvisioningState({error:pg(e),loading:!1}))}}function*RE(e){let{payload:{id:t}}=e,n=Qi(e.payload,LE);yield Mo(Gi.setProvisioningState({loading:!0,error:null}));try{yield $o(Xf.directory.updateConfiguration,t,n);const e=yield $o(Xf.directory.getConfigs),i=yield Fo(e.map((e=>wE(e))));yield Mo(Gi.setProvisioningState({connections:i,loading:!1}))}catch(e){yield Mo(Gi.setProvisioningState({error:pg(e),loading:!1}))}}function*DE({payload:{id:e,callback:t}}){yield Mo(Gi.setProvisioningState({loading:!0,error:null}));try{yield $o(Xf.directory.deleteConfiguration,e);const n=yield $o(Xf.directory.getConfigs),i=yield Fo(n.map((e=>wE(e))));yield Mo(Gi.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setProvisioningState({error:pg(e),loading:!1})),null==t||t(!1,e)}}function*NE(){yield Ma(Gi.loadProvisionConnections,CE),yield Da(Gi.createProvisionConnection,UE),yield Da(Gi.deleteProvisionConnection,DE),yield Da(Gi.updateProvisionConnection,RE)}const ME=["callback","events"];function*FE(e){let{payload:{callback:t}}=e,n=Qi(e.payload,ME);yield Mo(Gi.setImpersonateState({loading:!0}));try{yield $o(Xf.impersonate.impersonate,n),yield Mo(Gi.setImpersonateState({step:Ui.success})),yield Bo(1e3),yield fv(),yield Mo(Gi.resetImpersonateState()),null==t||t(!0)}catch(e){yield Mo(Gi.setImpersonateState({loading:!1,error:pg(e)}))}}function*GE(){yield Ma(Gi.impersonate,FE)}function*$E({payload:e}){const{callback:t,deviceId:n}=e;yield Mo(Gi.setPasskeysState({loading:!0}));try{yield $o(Xf.auth.deleteWebAuthnDevice,n);const{devices:e}=yield jo((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield Mo(Gi.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield Mo(Gi.setPasskeysState({loading:!1,error:pg(e,null)})),null==t||t(null,e)}}function*VE(){yield Mo(Gi.setPasskeysState({loading:!0}));try{const{devices:e}=yield $o(Xf.auth.getWebAuthnDevices);yield Mo(Gi.setPasskeysState({devices:e,loading:!1}))}catch(e){yield Mo(Gi.setPasskeysState({loading:!1,error:pg(e,null)}))}}function*xE(){yield Da(Gi.loadWebAuthnDevices,VE),yield Da(Gi.deleteWebAuthnDevice,$E)}const jE=["roleIds","userIds"],BE=()=>jo((e=>e.auth.groupsState));function*WE({payload:e}){const t=bA.GET_TEAM_USERS;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield $o(Xf.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield Mo(Gi.setGroupsState({teamUsers:n}))}catch(e){yield Mo(Gi.setUsersGroupsError({key:t,value:pg(e)}))}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*zE({payload:e}){const t=bA.GET_GROUP;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield $o(Xf.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:TA.rolesAndUsers});yield Mo(Gi.setGroupsState({selectedGroup:n}))}catch(e){yield Mo(Gi.setUsersGroupsError({key:t,value:pg(e)}))}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*KE(){const e=bA.GET_GROUPS,t=yield BE();yield Mo(Gi.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield $o(Xf.groups.getGroups,{_groupsRelations:TA.rolesAndUsers});yield Mo(Gi.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 Mo(Gi.setUsersGroupsError({key:e,value:pg(t)}))}finally{yield Mo(Gi.setUsersGroupsLoader({key:e,value:!1}))}}function*qE({payload:e}){const t=bA.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=Qi(e,jE);yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield $o(Xf.groups.createGroup,D({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield Mo(Gi.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield Mo(Gi.addRolesToGroup({groupId:r.id,roleIds:n}))),yield Mo(Gi.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield Mo(Gi.setUsersGroupsError({key:t,value:pg(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*HE({payload:e}){const t=bA.UPDATE_GROUP;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield $o(Xf.groups.updateGroup,e),yield Mo(Gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Mo(Gi.setUsersGroupsError({key:t,value:pg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*JE({payload:e}){const t=bA.DELETE_GROUP;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield $o(Xf.groups.deleteGroup,e.groupId),yield Mo(Gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Mo(Gi.setUsersGroupsError({key:t,value:pg(n)})),null==e||null==(i=e.callback)||i.call(e,!1,n)}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*YE({payload:e}){const t=bA.ADD_ROLES_TO_GROUP;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield $o(Xf.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield Mo(Gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Mo(Gi.setUsersGroupsError({key:t,value:pg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*QE({payload:e}){const t=bA.DELETE_ROLES_FROM_GROUP;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield $o(Xf.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield Mo(Gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Mo(Gi.setUsersGroupsError({key:t,value:pg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*XE({payload:e}){const t=bA.ADD_USERS_TO_GROUP;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield $o(Xf.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield Mo(Gi.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 Mo(Gi.setUsersGroupsError({key:t,value:pg(n)}))}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*ZE({payload:e}){const t=bA.DELETE_USERS_FROM_GROUP;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield $o(Xf.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield Mo(Gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Mo(Gi.setUsersGroupsError({key:t,value:pg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*ek(){const e=bA.GET_GROUP_CONFIGURATION;yield Mo(Gi.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield $o(Xf.groups.getGroupConfiguration);yield Mo(Gi.setGroupsState({groupsConfiguration:t}))}catch(t){yield Mo(Gi.setUsersGroupsError({key:e,value:pg(t)}))}finally{yield Mo(Gi.setUsersGroupsLoader({key:e,value:!1}))}}function*tk({payload:e}){const t=bA.UPDATE_GROUP_CONFIGURATION;yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0}));try{yield $o(Xf.groups.updateGroupConfiguration,e),yield Mo(Gi.getGroupConfiguration())}catch(e){yield Mo(Gi.setUsersGroupsError({key:t,value:pg(e)}))}finally{yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}}function*nk(){yield Na(Gi.loadGroups,KE),yield Na(Gi.getGroupById,zE),yield Na(Gi.createGroup,qE),yield Na(Gi.updateGroup,HE),yield Na(Gi.deleteGroup,JE),yield Na(Gi.addRolesToGroup,YE),yield Na(Gi.deleteRolesFromGroup,QE),yield Na(Gi.addUsersToGroup,XE),yield Na(Gi.deleteUsersFromGroup,ZE),yield Na(Gi.getGroupConfiguration,ek),yield Na(Gi.updateGroupConfiguration,tk),yield Na(Gi.getTeamUsers,WE)}function*ik(){const e=bA.GET_GROUPS;yield Mo(Gi.setUsersGroupsLoader({key:e,value:!0}));const t=Qp;yield Mo(Gi.setGroupsState({groups:t})),yield Mo(Gi.setUsersGroupsLoader({key:e,value:!1}))}function*ok({payload:e}){var t;const n=bA.CREATE_GROUP,{groups:i}=yield BE();yield Mo(Gi.setUsersGroupsLoader({key:n,value:!0})),yield Mo(Gi.setGroupsState({groups:[D({},e,{id:`${e.name}ID`,managedBy:Kf.FRONTEGG}),...null!=i?i:[]]})),yield Bo(500),null==e||null==(t=e.callback)||t.call(e,!0),yield Mo(Gi.setUsersGroupsLoader({key:n,value:!1}))}function*ak({payload:e}){var t,n,i,o,a;const r=bA.UPDATE_GROUP,s=yield BE();yield Mo(Gi.setUsersGroupsLoader({key:r,value:!0})),yield Mo(Gi.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:Kf.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 Bo(500),null==e||null==(a=e.callback)||a.call(e,!0),yield Mo(Gi.setUsersGroupsLoader({key:r,value:!1}))}function*rk({payload:e}){var t,n;const i=bA.DELETE_GROUP,o=yield BE();yield Mo(Gi.setUsersGroupsLoader({key:i,value:!0})),yield Mo(Gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Bo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Mo(Gi.setUsersGroupsLoader({key:i,value:!1}))}function*sk({payload:e}){var t,n;const i=bA.ADD_ROLES_TO_GROUP,o=yield BE();yield Mo(Gi.setUsersGroupsLoader({key:i,value:!0})),yield Mo(Gi.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 Bo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Mo(Gi.setUsersGroupsLoader({key:i,value:!1}))}function*lk({payload:e}){var t,n;const i=bA.DELETE_ROLES_FROM_GROUP,o=yield BE();yield Mo(Gi.setUsersGroupsLoader({key:i,value:!0})),yield Mo(Gi.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 Bo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Mo(Gi.setUsersGroupsLoader({key:i,value:!1}))}function*ck({payload:e}){var t,n;const i=bA.ADD_USERS_TO_GROUP,o=yield BE();yield Mo(Gi.setUsersGroupsLoader({key:i,value:!0})),yield Mo(Gi.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 Bo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Mo(Gi.setUsersGroupsLoader({key:i,value:!1}))}function*uk({payload:e}){var t,n;const i=bA.DELETE_USERS_FROM_GROUP,o=yield BE();yield Mo(Gi.setUsersGroupsLoader({key:i,value:!0})),yield Mo(Gi.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 Bo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Mo(Gi.setUsersGroupsLoader({key:i,value:!1}))}function*dk(){const e=bA.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield BE();yield Mo(Gi.setUsersGroupsLoader({key:e,value:!0})),t&&(yield Mo(Gi.setGroupsState({groupsConfiguration:D({},t)}))),yield Mo(Gi.setUsersGroupsLoader({key:e,value:!1}))}function*yk({payload:e}){const t=bA.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield BE();yield Mo(Gi.setUsersGroupsLoader({key:t,value:!0})),n&&(yield Mo(Gi.setGroupsState({groupsConfiguration:D({},n,e)}))),yield Mo(Gi.setUsersGroupsLoader({key:t,value:!1}))}function*fk(){yield Na(Gi.loadGroups,ik),yield Na(Gi.createGroup,ok),yield Na(Gi.updateGroup,ak),yield Na(Gi.deleteGroup,rk),yield Na(Gi.addRolesToGroup,sk),yield Na(Gi.deleteRolesFromGroup,lk),yield Na(Gi.addUsersToGroup,ck),yield Na(Gi.deleteUsersFromGroup,uk),yield Na(Gi.getGroupConfiguration,dk),yield Na(Gi.updateGroupConfiguration,yk)}let pk;!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"}(pk||(pk={}));const gk=(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=>gk(e,t,n))))?i:[]})};function Sk(e,t){var n;return D({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Sk(e,t))):[]})}function vk(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=>vk(e,t,n))))?i:[]})}const hk=({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}})),mk=()=>jo((e=>e.auth.allAccountsState));function*Ak({payload:e}){const t=pk.GET_ACCOUNTS;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield mk(),{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 mk(),{items:n,_links:o}=yield $o(Xf.tenants.searchSubTenants,r,{jwt:i}),a=yield $o(Xf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:i}),l=hk({items:n},a),c=vk(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 Mo(Gi.setSelectedAccountState({accounts:c}))}else{var l;const{accounts:t}=yield mk(),{items:n,_links:i}=yield $o(Xf.tenants.searchSubTenants,r),o=yield $o(Xf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=hk({items:n},o),s=vk(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 Mo(Gi.setAllAccountsState({accounts:s}))}}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:pg(e)}))}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*bk({payload:e}){const t=pk.SEARCH_ACCOUNTS;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield mk(),{jwt:i}=e;try{if(null!=e&&e._subTenantId){var o;const{items:t}=yield $o(Xf.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(o=null==e?void 0:e._filter)?o:"",_subTenantId:e._subTenantId},{jwt:i});yield Mo(Gi.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:pg(e)}))}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Tk({payload:e}){const t=pk.GET_USER_JWT;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:i}=e;try{const e=yield $o(Xf.users.GetUserJwt,{tenantId:n});yield Mo(Gi.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==i||i(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:pg(e)})),yield Mo(Gi.setSelectedAccountState({accessPermission:!1})),null==i||i(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Ek({payload:e}){const t=pk.CREATE_SUB_ACCOUNT;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:i,tenantId:o,jwt:a,callback:r}=e;try{if(a){const{accounts:e}=yield mk(),{selectedAccount:t}=yield mk(),r=yield $o(Xf.subTenants.createSubTenant,{name:n,parentTenantId:i,tenantId:o},{jwt:a}),s=vk(e,null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),l=vk(D({name:"",tenantId:""},null==t?void 0:t.accounts),null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Mo(Gi.setAllAccountsState({accounts:s})),yield Mo(Gi.setSelectedAccountState({accounts:l}))}else{const{accounts:e}=yield mk(),t=yield $o(Xf.subTenants.createSubTenant,{name:n,tenantId:o,parentTenantId:i}),a=vk(e,null!=i?i:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Mo(Gi.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:pg(e)})),null==r||r(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*kk({payload:e}){const t=pk.DELETE_SUB_ACCOUNT;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:i,callback:o}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield mk();yield $o(Xf.subTenants.deleteSubTenant,i,{jwt:n});const o=Sk(t,i),a=Sk(null==e?void 0:e.accounts,i);yield Mo(Gi.setAllAccountsState({accounts:o})),yield Mo(Gi.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield mk();yield $o(Xf.subTenants.deleteSubTenant,i);const t=Sk(e,i);yield Mo(Gi.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:pg(e)})),null==o||o(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Ok({payload:e}){const t=pk.UPDATE_SUB_ACCOUNT_SETTINGS;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:i,callback:o,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield mk();yield $o(Xf.subTenants.updateSubTenant,{tenantId:a},{name:i},{jwt:n});const o=gk(e.accounts,a,i);yield Mo(Gi.setSelectedAccountState({name:i,accounts:o}));const r=gk(t,a,i);yield Mo(Gi.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield mk();yield $o(Xf.subTenants.updateSubTenant,{tenantId:a},{name:i});const t=gk(e,a,i);yield Mo(Gi.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:pg(e)})),null==o||o(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Ik({payload:e}){const t=pk.DELETE_USERS_FROM_ACCOUNT;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:i,jwt:o,callback:a}=e;try{yield $o(Xf.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:i},{jwt:o}),yield Mo(Gi.getAccountUsers({jwt:o,_tenantId:i[0].tenantId})),null==a||a(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:pg(e)})),null==a||a(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Pk({payload:e}){const t=pk.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:i,jwt:o,callback:a}=e,{selectedAccount:r}=yield mk();try{yield $o(Xf.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:i},{jwt:o}),yield Mo(Gi.getAccountUsers({jwt:o,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:pg(e)})),null==a||a(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*_k({payload:e}){const t=pk.ADD_USERS_TO_ACCOUNT;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:i,jwt:o,callback:a,allowSubAccountAccess:r=!1,roleIds:s}=e;try{yield $o(Xf.subTenants.addUsersToSubTenant,{users:n,tenantId:i,allowSubAccountAccess:r,roleIds:s},{jwt:o}),yield Mo(Gi.getAccountUsers({jwt:o,_tenantId:i})),null==a||a(!0)}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:pg(e)})),null==a||a(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Lk({payload:e}){const t=pk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield mk(),{userId:i,allowAccess:o,jwt:a,callback:r}=e;try{var s;yield $o(Xf.subTenants.updateSubAccountAccess,i,{allowAccess:o},{jwt:a}),yield Mo(Gi.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 Mo(Gi.setAllAccountsError({key:t,value:pg(e)})),null==r||r(!1)}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*wk({payload:e}){var t,n,i,o,a,r,s,l;const c=pk.GET_ACCOUNT_USERS;yield Mo(Gi.setAllAccountsLoader({key:c,value:!0}));const u=yield mk(),{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 $o(Xf.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 $o(Xf.roles.getRoles),o=yield $o(Xf.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 Mo(Gi.setSelectedAccountState(D({users:a},i)))}else yield Mo(Gi.setSelectedAccountState(D({users:[]},i)))}catch(e){yield Mo(Gi.setAllAccountsError({key:c,value:pg(e)}))}finally{yield Mo(Gi.setAllAccountsLoader({key:c,value:!1}))}}function*Ck({payload:e}){const t=pk.SET_SELECTED_SUB_ACCOUNT_DATA;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var i,o,a,r,s,l,c;const e=yield $o(Xf.accountSettings.getSettings,{jwt:n}),u=yield $o(Xf.tenants.getTenantsUsersCount,{tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n}),d=yield $o(Xf.tenants.getParentTenants,{jwt:n}),y=yield $o(Xf.tenants.getHierarchyMetadata,{_tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n});yield Mo(Gi.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 Mo(Gi.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:pg(e)}))}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Uk(){const e=pk.SET_ROOT_ACCOUNT_DATA;yield Mo(Gi.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield jo((e=>e.auth.tenantsState)),{accounts:n}=yield mk();if(t)try{var i;const o=yield $o(Xf.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 Mo(Gi.setAllAccountsState({rootAccount:a,accounts:D({},n,a)}))}catch(t){yield Mo(Gi.setAllAccountsError({key:e,value:pg(t)}))}finally{yield Mo(Gi.setAllAccountsLoader({key:e,value:!1}))}}function*Rk({payload:e}){const t=pk.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield Mo(Gi.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:i}=e;try{const e=yield $o(Xf.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:i});yield Mo(Gi.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield Mo(Gi.setAllAccountsError({key:t,value:pg(e)}))}finally{yield Mo(Gi.setAllAccountsLoader({key:t,value:!1}))}}function*Dk(){yield Na(Gi.loadAccounts,Ak),yield Na(Gi.searchAccounts,bk),yield Na(Gi.updateSubAccountAccessForUser,Lk),yield Na(Gi.getUserJwtForSubAccount,Tk),yield Na(Gi.createSubAccount,Ek),yield Na(Gi.deleteSubAccount,kk),yield Na(Gi.updateSubAccountSettings,Ok),yield Na(Gi.addUsersToAccount,_k),yield Na(Gi.deleteUsersFromAccount,Ik),yield Na(Gi.setUserRolesForSubAccount,Pk),yield Na(Gi.getAccountUsers,wk),yield Na(Gi.setRootAccountData,Uk),yield Na(Gi.setSelectedSubAccountData,Ck),yield Na(Gi.loadNumberOfUsersForSelectedSubAccount,Rk)}const Nk=["callback"],Mk=["callback"],Fk=["callback","phoneId"],Gk=["callback","phoneId"],$k=["callback"];function*Vk(){yield Mo(Gi.setSmsState({loading:!0}));const e={_limit:10,_offset:0};try{const{items:t}=yield $o(Xf.userPhoneNumbers.getUserPhoneNumbers,e);yield Mo(Gi.setSmsState({phoneNumbers:t}))}catch(e){yield Mo(Gi.setSmsState({error:pg(e)}))}finally{yield Mo(Gi.setSmsState({loading:!1}))}}function*xk(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Nk);yield Mo(Gi.setSmsState({loading:!0}));try{const e=yield $o(Xf.userPhoneNumbers.createPhoneNumber,n);yield Mo(Gi.setSmsState({otcToken:e.otcToken})),yield $o(Vk),null==t||t(!0)}catch(e){yield Mo(Gi.setSmsState({error:pg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSmsState({loading:!1}))}}function*jk(e){let{payload:{callback:t}}=e,n=Qi(e.payload,Mk);yield Mo(Gi.setSmsState({loading:!0}));try{yield $o(Xf.userPhoneNumbers.verifyPhoneNumber,n),yield $o(Vk),null==t||t(!0)}catch(e){yield Mo(Gi.setSmsState({error:pg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSmsState({loading:!1}))}}function*Bk(e){let{payload:{callback:t,phoneId:n}}=e;Qi(e.payload,Fk),yield Mo(Gi.setSmsState({loading:!0}));try{const e=yield $o(Xf.userPhoneNumbers.deletePhoneNumber,n);yield Mo(Gi.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield Mo(Gi.setSmsState({error:pg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSmsState({loading:!1}))}}function*Wk(e){let{payload:{callback:t,phoneId:n}}=e,i=Qi(e.payload,Gk);yield Mo(Gi.setSmsState({loading:!0}));try{yield $o(Xf.userPhoneNumbers.verifyDeletePhoneNumber,n,i),yield $o(Vk),null==t||t(!0)}catch(e){yield Mo(Gi.setSmsState({error:pg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSmsState({loading:!1}))}}function*zk(e){let{payload:{callback:t}}=e,n=Qi(e.payload,$k);yield Mo(Gi.setSmsState({loading:!0}));try{const e=yield $o(Xf.userPhoneNumbers.preVerifyPhoneNumber,n);yield Mo(Gi.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield Mo(Gi.setSmsState({error:pg(e)})),null==t||t(null,e)}finally{yield Mo(Gi.setSmsState({loading:!1}))}}function*Kk(){yield Da(Gi.loadPhoneNumbers,Vk),yield Da(Gi.setUpPhoneNumber,xk),yield Da(Gi.verifyPhoneNumber,jk),yield Da(Gi.deletePhoneNumber,Bk),yield Da(Gi.verifyDeletePhoneNumber,Wk),yield Da(Gi.preVerifyPhoneNumber,zk)}var qk={sagas:function*(){yield Fo([$o(yh),$o(uA),$o(yA),$o(eA),$o(CT),$o(_h),$o(nm),$o(lm),$o(Eg),$o(Vm),$o(gb),$o(nk),$o(Mb),$o(wS),$o(zb),$o(dS),$o(eT),$o(lT),$o(TT),$o(FT),$o(KT),$o(vE),$o(NE),$o(GE),$o(xE),$o(Dk),$o(jS),$o(Ng),$o(Kk)])},mockSagas:function*(){yield Fo([$o(gh),$o(Nh),$o(ym),$o(Jm),$o(_b),$o(Qb),$o(kS),$o(xT),$o(iT),$o(uT),$o(JT),$o(PE),$o(kT),$o(fk),$o(jg)])},storeName:Rt,initialState:Ci,reducer:Mi,actions:Gi};const Hk=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>D({},t,{[e]:D({},t[e],n)})}),Jk={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Yk={setAuditLogsState:Hk("auditLogsState"),resetAuditLogsState:e=>D({},e,{auditLogsState:Jk})},Qk={exportAuditsCsv:yt("auditLogs/exportAuditsCsv"),loadAuditLogs:yt("auditLogs/loadAuditLogs",(e=>({payload:e})))},Xk={loading:!0},Zk={setAuditsMetadataState:Hk("auditsMetadataState"),resetAuditsMetadataState:e=>D({},e,{auditsMetadataState:Xk})},eO={loadAuditsMetadata:yt("auditLogs/loadAuditsMetadata")},tO={auditLogsState:Jk,auditsMetadataState:Xk},{reducer:nO,actions:iO}=pt({name:Nt,initialState:tO,reducers:D({resetState:e=>D({},e,tO),setState:(e,{payload:t})=>D({},e,t)},Yk,Zk)}),oO=D({},iO,Qk,eO),aO=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`})))},sO={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}]},lO=()=>jo((e=>e.auditLogs.auditLogsState)),cO=()=>jo((e=>e.auditLogs.auditsMetadataState));function*uO(){const e=yield lO(),{columns:t}=yield cO();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 Mo(oO.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Xf.audits.exportAudits(D({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield Mo(oO.setAuditLogsState({isDownloadingCsv:!1}))}function*dO({payload:e}){yield Mo(oO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield lO(),{columns:n}=yield cO();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 Mo(oO.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 Mo(oO.loadAuditsMetadata()));const{data:p,total:g}=yield $o(Xf.audits.getAudits,D({offset:c,count:l},y,f));yield Mo(oO.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 Mo(oO.setAuditLogsState({loading:!1,error:pg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*yO(){yield Da(oO.exportAuditsCsv,uO),yield Da(oO.loadAuditLogs,dO)}function*fO({payload:e}){yield Mo(oO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield lO(),{columns:n}=yield cO();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 Mo(oO.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield Mo(oO.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=rO;let i=n.filter((e=>t=>e.filter(aO).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 Mo(oO.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 Mo(oO.setAuditLogsState({loading:!1,error:pg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*pO(){yield Da(oO.loadAuditLogs,fO)}function*gO(){yield Mo(oO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield $o(Xf.metadata.getAuditsMetadata);yield Mo(oO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Mo(oO.setAuditsMetadataState({error:e,loading:!1}))}}function*SO(){yield Da(oO.loadAuditsMetadata,gO)}function*vO(){yield Mo(oO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=sO;yield Mo(oO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Mo(oO.setAuditsMetadataState({error:e,loading:!1}))}}function*hO(){yield Da(oO.loadAuditsMetadata,vO)}var mO={sagas:function*(){yield Fo([$o(yO),$o(SO)])},mockSagas:function*(){yield Fo([$o(pO),$o(hO)])},storeName:Nt,initialState:tO,reducer:nO,actions:oO};const AO={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:bO,actions:TO,reducer:EO}=pt({name:"audits",initialState:AO,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]})))}}}),kO=D({},TO,{initData:yt(`${bO}/initData`),loadAudits:yt(`${bO}/loadAudits`),removeFilter:yt(`${bO}/removeFilter`),filterData:yt(`${bO}/filterData`),exportCSV:yt(`${bO}/exportCSV`),deleteAudits:yt(`${bO}/deleteAudits`)}),OO=()=>jo((e=>e[bO]));function*IO(){const{sortBy:e,sortDirection:t}=yield OO();try{const n=yield $o(Xf.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Mo(kO.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Mo(kO.loadItemFailedAction(t))}}function*PO(){try{const e=yield $o(Xf.metadata.getAuditsMetadata);yield Mo(kO.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Mo(kO.loadItemFailedAction(t))}}const _O=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*LO({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield OO(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield OO():{rowsData:[]};try{const e=_O(t),{data:s,total:d}=yield $o(Xf.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 Mo(kO.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield Mo(kO.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Mo(kO.loadItemFailedAction(t))}}function*wO(){yield Mo(kO.startLoading()),yield Fo([IO(),PO(),LO({payload:{onlyOneLoad:!1},type:""})]),yield Mo(kO.finishLoading())}function*CO({payload:e}){const{filters:t}=yield OO(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield Mo(kO.setFilterData(i))}function*UO({payload:e}){const{filters:t}=yield OO();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 Mo(kO.setFilterData(i))}function*RO(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield OO(),a=_O(e);yield Mo(kO.startDownloadingCsv());try{yield Xf.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 Mo(kO.stopDownloadingCsv())}}function*DO(){yield Na(kO.initData,wO),yield Na(kO.removeFilter,CO),yield Na(kO.filterData,UO),yield Na([kO.loadAudits,kO.textSearch,kO.onPageChange],LO),yield Na([kO.setFilterData,kO.setDataSorting,kO.startRefresh],(()=>LO({payload:{appendMode:!1},type:""}))),yield Na(kO.exportCSV,RO)}const NO={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},MO={initData:()=>D({},NO),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)})}},FO={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}})))},GO={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:$O,actions:VO}=pt({name:Dt,initialState:GO,reducers:D({},MO)}),xO=D({},VO,FO),jO={slack:Xf.connectivity.getSlackConfiguration,email:Xf.connectivity.getEmailConfiguration,sms:Xf.connectivity.getSMSConfiguration,webhook:Xf.connectivity.getWebhooksConfigurations,categories:Xf.connectivity.getCategories,channelMap:Xf.connectivity.getChannelMaps},BO={slack:Xf.connectivity.postSlackConfiguration,email:Xf.connectivity.postEmailConfiguration,sms:Xf.connectivity.postSMSConfiguration,webhook:Xf.connectivity.postWebhooksConfiguration},WO=["email","slack","sms","webhook"],zO={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"}},KO=["id"],qO=["id","enabled"],HO=["categories","channelMap"];function*JO(e){return yield $o(QO,{payload:{api:e},type:""})}function*YO({payload:e=WO}){yield Mo(xO.setConnectivityState({isLoading:!0}));try{const t=yield Fo([...e.map(JO),yield QO({payload:{api:"categories"},type:""}),yield function*(){return(yield Fo(e.map((function*(e){return yield QO({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>D({},t,{[`${e[i]}`]:n})),{})}()]),n=yield QO({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?D({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:zO[e[o]].events(i),active:zO[e[o]].isActive(i),platform:zO[e[o]].title,image:zO[e[o]].image}]}):n:D({},n,{[`${HO[o-e.length]}`]:i})),{list:[],webhook:n});yield Mo(xO.setConnectivityState(D({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Mo(xO.setConnectivityState({isLoading:!1}))}}function*QO({payload:{api:e,params:t}}){try{return yield $o(jO[e],t)}catch(e){return}}function*XO(){try{yield Mo(xO.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield $o(Xf.connectivity.getSlackChannels);yield Mo(xO.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Mo(xO.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*ZO(e,t){const{connectivity:{list:n}}=yield jo(),i=n.find((({key:t})=>t===e));if(!i)return;const o=zO[e].isActive(t);o!==i.active&&(yield Mo(xO.setConnectivityState({list:n.map((t=>t.key===e?D({},t,{active:o}):t))})))}function*eI({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield jo((e=>e.connectivity));try{if(yield Mo(xO.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield jo();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield Fo([...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=Qi(e,KO);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 $o(BO.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield $o(Xf.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield jo(),{processIds:i}=yield jo((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield Fo([...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 $o("email"===t?Xf.connectivity.postEmailConfiguration:Xf.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=Qi(o,qO);return yield Fo([yield $o("email"===t?Xf.connectivity.patchEmailConfiguration:Xf.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield $o("email"===t?Xf.connectivity.putEmailSubscriptions:Xf.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 $o("email"===t?Xf.connectivity.deleteEmailSubscriptions:Xf.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield QO({payload:{api:t},type:""});yield Mo(xO.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield ZO(t,e)}else yield Mo(xO.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield $o(BO[e],t),!["sms","email"].includes(e)){const o=yield QO({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield Mo(xO.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield ZO(e,o),null==n||n(!0)}}catch(e){yield Mo(xO.setConnectivityState({error:pg(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*tI({payload:e}){try{yield Xf.connectivity.postSlackCode(e)}catch{}yield Mo(xO.setConnectivityState({error:void 0,isSaving:!1}))}function*nI(){const{slackChannels:e}=yield jo((e=>e.connectivity));try{yield Mo(xO.setConnectivityState({slackChannels:D({},e,{isLoadingScope:!0})}));const{clientId:t}=yield $o(Xf.connectivity.getSlackScope);yield Mo(xO.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Mo(xO.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*iI({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield jo((e=>e.connectivity));try{yield Mo(xO.setConnectivityState({isSaving:!0})),yield $o(Xf.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,pg(e))}const o=yield QO({payload:{api:"webhook"},type:""});o&&(yield Mo(xO.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*oI({payload:e}){try{yield Mo(xO.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield $o(Xf.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Mo(xO.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Mo(xO.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Mo(xO.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*aI({payload:e}){try{const{statusCode:t}=yield $o(Xf.connectivity.postWebhookRetry,e);yield Mo(xO.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Mo(xO.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*rI({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield jo((e=>e.connectivity));try{yield Mo(xO.setConnectivityState({webhookLogs:D({},i,{isLoading:!0})}));const o=yield $o(Xf.connectivity.getWebhookLog,e,n,t);yield Mo(xO.setConnectivityState({error:void 0,webhookLogs:D({isLoading:!1},o)}))}catch(e){yield Mo(xO.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var sI={sagas:function*(){yield Da(xO.loadDataAction,YO),yield Na(xO.loadSlackActions,XO),yield Da(xO.postDataAction,eI),yield Da(xO.postCodeAction,tI),yield Da(xO.loadScope,nI),yield Da(xO.deleteWebhookConfigAction,iI),yield Da(xO.postWebhookTestAction,oI),yield Da(xO.postWebhookRetryAction,aI),yield Na(xO.loadWebhookLogsAction,rI)},storeName:Dt,initialState:GO,reducer:$O,actions:xO};function lI(){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 cI(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>D({},n,{[e]:t(n[e],i)})}}function uI(e){return cI(e,((e,t)=>D({},e,{loading:t.payload})))}function dI(e){return cI(e,((e,t)=>D({},e,{error:t.payload,loading:!1})))}const yI={loading:!1,error:null,fetching:!0,plans:[]},{actions:fI,reducer:pI,name:gI}=pt({name:"subscriptions/plans",initialState:yI,reducers:D({},lI())}),SI=D({loadPlans:yt(`${gI}/loadPlans`)},fI),vI={loading:!1,error:null,fetching:!0,config:null},hI=D({},lI()),{actions:mI,reducer:AI,name:bI}=pt({name:"subscriptions/config",initialState:vI,reducers:hI}),TI=D({loadPaymentConfiguration:yt(`${bI}/loadPaymentConfiguration`)},mI),EI={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},kI=D({},lI(),{setCancellationLoading:uI("cancellation"),setCancellationError:dI("cancellation"),setRenewalLoading:uI("renewal"),setRenewalError:dI("renewal")}),{reducer:OI,actions:II,name:PI}=pt({name:"subscriptions/billing/subscription",initialState:EI,reducers:kI}),_I=D({load:yt(`${PI}/loadSubscription`),cancelSubscription:yt(`${PI}/cancelSubscription`),renewSubscription:yt(`${PI}/renewSubscription`)},II),LI={loading:!1,error:null,fetching:!0},wI=D({},lI()),{reducer:CI,actions:UI,name:RI}=pt({name:"subscriptions/billing/information",initialState:LI,reducers:wI}),DI=D({loadBillingInformation:yt(`${RI}/loadBillingInformation`),cancelSubscription:_I.cancelSubscription,renewSubscription:_I.renewSubscription},UI),NI={loading:!1,error:null,fetching:!0},MI=D({},lI(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,t.payload)}}),{reducer:FI,actions:GI,name:$I}=pt({name:"subscriptions/billing/payment",initialState:NI,reducers:MI}),VI=D({loadPaymentMethod:yt(`${$I}/loadPaymentMethod`),submitPaymentMethod:yt(`${$I}/submitPaymentMethod`),submitPaymentMethodError:yt(`${$I}/submitPaymentMethodError`),submitPaymentMethodSuccess:yt(`${$I}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:yt(`${$I}/updateBillingDetails`,(e=>({payload:e})))},GI),xI={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},jI=D({},lI(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,{invoiceDownload:D({},e.invoiceDownload,t.payload)})}}),{reducer:BI,actions:WI,name:zI}=pt({name:"subscriptions/billing/invoices",initialState:xI,reducers:jI}),KI=D({loadInvoices:yt(`${zI}/loadInvoices`),downloadInvoice:yt(`${zI}/downloadInvoice`,(e=>({payload:e})))},WI),qI={information:LI,invoices:xI,paymentMethod:NI,subscription:EI},HI={invoices:KI,information:DI,paymentMethod:VI,subscription:_I},JI=Ke({invoices:BI,information:CI,paymentMethod:FI,subscription:OI}),YI={fetching:!0,loading:!1,error:null,confirmed:!1},QI=D({},lI()),{actions:XI,reducer:ZI,name:eP}=pt({name:"subscriptions/checkout",initialState:YI,reducers:QI}),tP=D({loadCheckout:yt(`${eP}/loadCheckout`),resetCheckout:yt(`${eP}/resetCheckout`),submitCheckout:yt(`${eP}/submitCheckout`),confirmCheckout:yt(`${eP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:yt(`${eP}/errorCheckout`,(e=>({payload:e})))},XI),nP={loading:!1,error:null,cardSetupIntentSecret:null},iP=D({},lI()),{reducer:oP,actions:aP,name:rP}=pt({name:"subscriptions/stripe",initialState:nP,reducers:iP}),sP=D({loadCustomer:yt(`${rP}/loadCustomer`),createCardSetupIntentSecret:yt(`${rP}/createCardSetupIntentSecret`)},aP),lP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:cP,reducer:uP,name:dP}=pt({name:"subscriptions/vendorPublicConfig",initialState:lP,reducers:D({},lI())}),yP=D({loadVendorPublicConfiguration:yt(`${dP}/loadVendorPublicConfiguration`)},cP),fP={config:vI,plans:yI,checkout:YI,billing:qI,stripe:nP,vendorPublicConfig:lP},pP={config:TI,billing:HI,plans:SI,checkout:tP,stripe:sP,vendorPublicConfig:yP},gP=Ke({config:AI,billing:JI,plans:pI,checkout:ZI,stripe:oP,vendorPublicConfig:uP});let SP,vP,hP;function mP({policy:e}){return{policy:hP.AT_PERIOD_END}}function AP(e){switch(e){case By.ACTIVE:return vP.ACTIVE;case By.INCOMPLETE:return vP.INCOMPLETE;case By.CANCELED:return vP.CANCELED;case By.EXPIRED:return vP.EXPIRED;case By.TRIALING:return vP.TRIALING;default:return vP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(SP||(SP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(vP||(vP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(hP||(hP={}));const bP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:By.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},TP=[{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"}],EP=[{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:""}],kP=[{id:"id",externalId:"externalId",type:Wy.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],OP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*IP(){yield Mo(_I.setLoading(!0));try{const[e]=yield $o(Xf.subscriptions.getManagedSubscriptions);yield Mo(_I.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Mo(_I.setError(e))}}function*PP(){yield Da(DI.loadBillingInformation,_P)}function*_P(){yield function*(e){const t=yield jo((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield jo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield LP(n,!1):yield Mo(DI.setError(t?"Not authorized":"Internal feature failure"))}()}function*LP(e,t){yield Mo(DI.setLoading(!0));try{var n,i;const o=yield $o(Xf.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield $o(Xf.subscriptions.getSubscriptionPlan,a):([,s]=yield Fo([$o(IP),$o(Xf.subscriptions.getSubscriptionPlan,a)]),l=yield jo((e=>e.subscriptions.billing.subscription.subscription||null))),yield Mo(DI.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?vP.ACTIVE:AP(l.status),cancellation:l.cancellation&&mP(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 Mo(DI.setError(pg(e)))}}function*wP(){yield function*(){var e,t;yield Mo(DI.setLoading(!0)),yield Bo(500),yield Mo(DI.setState({loading:!1,fetching:!1,summary:{subscriptionId:bP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Ky.Stripe,externallyManaged:!1,currentPlanId:TP[0].id,defaultPlanId:TP[0].id},plan:D({},TP[0],{price:null==(e=TP[0].price)?void 0:e.amount,currency:null==(t=TP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*CP(){yield Da(DI.loadBillingInformation,wP)}function*UP(){yield Da(VI.loadPaymentMethod,RP),yield Da(VI.submitPaymentMethod,NP),yield Da(VI.submitPaymentMethodError,MP),yield Da(VI.submitPaymentMethodSuccess,FP),yield Da(VI.updatePaymentMethodBillingDetails,DP)}function*RP(){yield Mo(VI.setLoading(!0));try{const e=(yield $o(Xf.subscriptions.getPaymentMethods))[0];yield Mo(VI.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Mo(VI.setError(pg(e)))}}function*DP({payload:e}){yield Mo(VI.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield $o(Xf.subscriptions.updatePaymentMethodBillingDetails,t,D({email:n},i)),yield $o(RP),null==o||o(!0)}catch(e){yield Mo(VI.setError(pg(e))),null==o||o(!1)}yield Mo(VI.setLoading(!1))}function*NP(){yield Mo(VI.setLoading(!0))}function*MP({payload:e}){yield Mo(VI.setError(e))}function*FP(){yield Mo(VI.loadPaymentMethod())}function*GP(){yield Mo(VI.setLoading(!0)),yield Bo(500);const e=kP[0];yield Mo(VI.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*$P(){yield Da(VI.loadPaymentMethod,GP)}function*VP(){yield Da(KI.loadInvoices,xP),yield Da(KI.downloadInvoice,jP)}function*xP(){yield Mo(KI.setLoading(!0));try{const e=(yield $o(Xf.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 Mo(KI.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Mo(KI.setError(pg(e)))}}function*jP({payload:e}){yield Mo(KI.setInvoiceDownloadState({loading:!0,error:null}));try{yield $o(Xf.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Mo(KI.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Mo(KI.setInvoiceDownloadState({loading:!1,error:pg(e,null)}))}}function*BP(){yield Mo(KI.setLoading(!0)),yield Bo(500),yield Mo(KI.setState({loading:!1,fetching:!1,invoices:EP.map((e=>D({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Mo(KI.setLoading(!1))}function*WP(){yield Da(KI.loadInvoices,BP)}function*zP(){yield Da(_I.load,KP),yield Da(_I.cancelSubscription,qP),yield Da(_I.renewSubscription,HP)}function*KP(){const e=yield jo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield LP(e)}function*qP(){const{subscription:e}=yield jo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Mo(_I.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Mo(_I.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===By.ACTIVE)try{yield Mo(_I.setCancellationLoading(!0)),yield $o(Xf.subscriptions.cancelManagedSubscription,t),yield IP(),yield Mo(_I.setCancellationLoading(!1))}catch(e){yield Mo(_I.setCancellationError(pg(e)))}}function*HP(){const{subscription:e}=yield jo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Mo(_I.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Mo(_I.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===zy.AT_PERIOD_END)try{yield Mo(_I.setRenewalLoading(!0)),yield $o(Xf.subscriptions.renewManagedSubscription,t),yield IP(),yield Mo(_I.setRenewalLoading(!1))}catch(e){yield Mo(_I.setCancellationError(pg(e)))}}function*JP(){yield Mo(_I.setLoading(!0)),yield Bo(500),yield Mo(_I.setState({subscription:bP,fetching:!1,loading:!1,error:null}))}function*YP(){yield Da(_I.load,JP)}function*QP(){yield Fo([$o(PP),$o(UP),$o(VP),$o(zP)])}function*XP(){yield Fo([$o(CP),$o($P),$o(WP),$o(YP)])}function*ZP(){yield Da(tP.loadCheckout,e_),yield Da(tP.resetCheckout,t_),yield Da(tP.submitCheckout,n_),yield Da(tP.confirmCheckout,i_),yield Da(tP.errorCheckout,a_)}function*e_(){yield Mo(tP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*t_(){yield Mo(tP.setState({loading:!1,error:null,confirmed:!1}))}function*n_(){yield Mo(tP.setState({loading:!0,error:null}))}function*i_({payload:{paymentMethodId:e,planId:t}}){const n=yield jo((e=>e.subscriptions.billing.subscription.subscription)),i=yield jo((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===By.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield Mo(tP.setState({loading:!0,error:null})),o&&a)return yield o_(),void(yield Mo(_I.setState({subscription:D({},n,{status:By.ACTIVE})})));try{yield $o(Xf.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Fo([_P(),RP(),xP()]),yield o_()}catch(e){yield Mo(tP.setState({loading:!1,error:pg(e)}))}}else yield Mo(tP.setState({loading:!1,error:"Subscription not found"}))}function*o_(){yield Mo(tP.setState({loading:!1,error:null,confirmed:!0}))}function*a_({payload:e}){yield Mo(tP.setState({loading:!1,error:e}))}function*r_(){yield Da(tP.resetCheckout,t_)}function*s_(){yield Da(SI.loadPlans,l_)}function*l_(){yield Mo(SI.setLoading(!0));try{const e=(yield $o(Xf.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 Mo(SI.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Mo(SI.setError(pg(e)))}}function*c_(){yield Mo(SI.setLoading(!0)),yield Bo(500),yield Mo(SI.setState({fetching:!1,loading:!1,plans:TP.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*u_(){yield Da(SI.loadPlans,c_)}function*d_(){yield Da(TI.loadPaymentConfiguration,y_)}function*y_(){yield Mo(TI.setLoading(!0));try{(yield $o(Xf.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Ky.Stripe))?yield function*(){yield Mo(TI.setLoading(!0));try{const e=yield $o(Xf.subscriptions.getStripePaymentProviderConfiguration);yield Mo(TI.setState({loading:!1,fetching:!1,config:{paymentProvider:SP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Mo(TI.setError(pg(e)))}}():yield Mo(TI.setError("Payment provider not configured"))}catch(e){yield Mo(TI.setError(pg(e)))}}function*f_(){yield Mo(TI.setLoading(!0)),yield Bo(500),yield Mo(TI.setState({loading:!1,fetching:!1,config:{paymentProvider:SP.STRIPE,apiKey:""}}))}function*p_(){yield Da(TI.loadPaymentConfiguration,f_)}function*g_(){yield Da(sP.createCardSetupIntentSecret,S_)}function*S_({payload:e}){yield Mo(sP.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield $o(Xf.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Mo(sP.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Mo(sP.setError(pg(e)))}}function*v_(){yield Da(yP.loadVendorPublicConfiguration,h_)}function*h_(){yield Mo(yP.setLoading(!0));try{const e=yield $o(Xf.subscriptions.getVendorPublicConfigurations);yield Mo(yP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Mo(yP.setError(pg(e)))}}function*m_(){yield Mo(yP.setLoading(!0)),yield Bo(500),yield Mo(yP.setState({fetching:!1,loading:!1,vendorPublicConfig:OP}))}function*A_(){yield Da(yP.loadVendorPublicConfiguration,m_)}var b_={sagas:function*(){yield Fo([$o(QP),$o(ZP),$o(s_),$o(d_),$o(g_),$o(v_)])},mockSagas:function*(){yield Fo([$o(XP),$o(r_),$o(u_),$o(p_),$o(A_)])},reducer:gP,actions:pP,initialState:fP,storeName:"subscriptions"},T_={sagas:function*(){yield Da(MS.loadVendorPublicInfo,FS)},storeName:Mt,initialState:RS,reducer:DS,actions:MS};const{reducer:E_}=pt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Fa.setContext(t),D({},e,{context:t}))}}}),k_=(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||Fa.setContext(e.context);const t=Oa(),s=[...ut({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=dt({middleware:s,preloadedState:{root:D({},e,{previewMode:n,urlStrategy:r}),[qk.storeName]:D({},qk.initialState,i,null!=(c=null==o?void 0:o.auth)?c:{},{routes:D({},qk.initialState.routes,null!=(u=null==i?void 0:i.routes)?u:{},null!=(d=null==o||null==(y=o.auth)?void 0:y.routes)?d:{})}),[mO.storeName]:D({},mO.initialState,null!=(f=null==o?void 0:o.auditLogs)?f:{},{auditLogsState:D({},mO.initialState.auditLogsState,null!=(p=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:D({},mO.initialState.auditsMetadataState,null!=(S=null==o||null==(v=o.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[bO]:D({},AO,null!=(h=null==o?void 0:o.audits)?h:{}),[sI.storeName]:sI.initialState,[b_.storeName]:b_.initialState,[T_.storeName]:T_.initialState},reducer:Ke({root:E_,[qk.storeName]:qk.reducer,[mO.storeName]:mO.reducer,[bO]:EO,[sI.storeName]:sI.reducer,[b_.storeName]:b_.reducer,[T_.storeName]:T_.reducer})});const m=function*(){yield Fo([$o(qk.sagas),$o(mO.sagas),$o(DO),$o(sI.sagas),$o(b_.sagas),$o(T_.sagas)])},A=function*(){yield Fo([$o(qk.mockSagas),$o(mO.mockSagas),$o(b_.mockSagas)])};n?(l.store.destroy=t.run(A).cancel,l.store.dispatch(Gi.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 O_=n(314);const I_=()=>{if(!Fa.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")},P_=(e,t)=>e?e.isEntitled?{isEntitled:!0}:{isEntitled:!1,justification:e.justification}:{isEntitled:!1,justification:t};var __=n(714),L_=n.n(__);function w_(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function C_(e){if(e.type)return e;if("#"===e.charAt(0))return C_(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 U_(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 R_(e){if(0===e.indexOf("#"))return e;const{values:t}=C_(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 D_(e,t){return e=C_(e),t=w_(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,U_(e)}function N_(e,t){if(e=C_(e),t=w_(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 U_(e)}function M_(e,t){if(e=C_(e),t=w_(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 U_(e)}const F_=e=>{if(e)return{main:e,light:R_(M_(e,.4)),dark:R_(N_(e,.15)),hover:R_(N_(e,.15)),active:R_(N_(e,.2))}},G_=e=>{if(e)return{main:e,light:M_(e,.7),dark:N_(e,.2)}},$_=(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({},F_(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({},F_(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({},F_(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:D({},G_(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:D({},G_(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:D({},G_(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:D({},G_(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},V_={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 x_{constructor(){this._theme=V_.theme,this._themeV2=V_.themeV2,this._navigation=V_.navigation,this._localizations=V_.localizations,this._integrations=V_.integrations}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new x_;return n.set(e),x_._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=L_().all([null!=(t=V_.navigation)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=L_().all([null!=(i=V_.theme)?i:{},$_(null==e?void 0:e.theme,V_.theme)]),this._themeV2=L_().all([null!=(o=V_.themeV2)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=L_().all([null!=(r=V_.localizations)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}]),this._integrations=L_().all([null!=(l=V_.integrations)?l:{},null!=(c=null==e?void 0:e.integrations)?c:{}])}catch(e){this._navigation=V_.navigation,this._theme=V_.theme,this._themeV2=V_.themeV2,this._localizations=V_.localizations,this._integrations=V_.integrations}}}x_._instances={};var j_=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},B_=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},W_=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)}))},z_=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 K_,q_,H_,J_,Y_,Q_,X_,Z_,eL,tL,nL,iL;!function(e){e.phoneNumber="phoneNumber"}(K_||(K_={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(q_||(q_={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(H_||(H_={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(J_||(J_={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(Y_||(Y_={})),function(e){e.Invoices="invoices"}(Q_||(Q_={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(X_||(X_={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(Z_||(Z_={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(eL||(eL={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(tL||(tL={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(nL||(nL={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(iL||(iL={}));const oL={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},aL={hidden:"hidden",edit:"edit"};var rL="6.159.0",sL={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"},lL=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=_r,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:x_.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}Gr.set(sL,a.name),e.next=15;break;case 4:return e.prev=4,e.next=7,$r();case 7:t=e.sent,a.options.overrideFeatureFlags&&Object.assign(t,a.options.overrideFeatureFlags),Gr.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){Gr.set(D({},sL,e),a.name)},this.queryFeatureFlags=function(e){return Gr.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([Mr]),1)[0]}};var l=j_(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=k_({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);C.setInstance(l,this),this.setEntitlementsOptions(t.entitlementsOptions),this.setSessionContext({enableSessionPerTenant:null==(o=t.authOptions)?void 0:o.enableSessionPerTenant}),Fa.setAppName(l)}var t,n,i,o;return w(e,[{key:"setEntitlementsOptions",value:function(e){Fa.setEntitlementsOptions(D({},e))}},{key:"setSessionContext",value:function(e){Fa.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=x_.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;x_.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 Fa.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(),z_(t),Fa.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 I_(),i?(0,O_.tE)(t,e,n):P_(null==e||null==(o=e.features)?void 0:o[t],js.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 I_(),i?(0,O_.wJ)(t,e,n):P_(null==e||null==(o=e.permissions)?void 0:o[t],js.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}(),cL=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=C.getInstance(i);e&&t?(Fa.setAccessToken(t),Fa.setUser(D({},n,{accessToken:t})),o.store.dispatch(Gi.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(Gi.loadTenants())):(Fa.setAccessToken(null),Fa.setUser(null),o.store.dispatch(Gi.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),uL=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";C.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";C.getInstance(e).hideAdminPortal()}}]),e}(),dL=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";C.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";C.getInstance(e).hideCheckoutDialog()}}]),e}(),yL=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},fL=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=k_({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 lL(this.options,t,!0),x_.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,W_(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}(),pL="modern",gL=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[pL]},SL=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=k_({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 lL(this.options,t,!0,a),x_.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,W_(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 vL(e,t){return vL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},vL(e,t)}function hL(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&&vL(e,t)}function mL(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 AL(e){return AL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},AL(e)}function bL(){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 TL(e,t,n){return TL=bL()?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&&vL(o,n.prototype),o},TL.apply(null,arguments)}function EL(e){var t="function"==typeof Map?new Map:void 0;return EL=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 TL(e,arguments,AL(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),vL(n,e)},EL(e)}function kL(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=AL(e);if(t){var o=AL(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return mL(this,n)}}var OL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new lL(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){hL(n,e);var t=kL(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=C.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=B_(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=B_(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=B_(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=B_(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=B_(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=B_(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}(EL(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 dL},AdminPortalRenderer:function(){return pL},AppHolder:function(){return C},CheckoutDialog:function(){return yL},FronteggApp:function(){return cL},HostedLogin:function(){return uL},LoginBoxRenderer:function(){return vL},createElement:function(){return W_},defaultTheme:function(){return gL},formatName:function(){return B_},getThemeAdminByName:function(){return fL},getThemeByName:function(){return SL},initialize:function(){return IL},mockFlagsList:function(){return lL},restoreSearchParams:function(){return K_},waitThemeSetter:function(){return z_}});var e={};n.r(e),n.d(e,{Delete:function(){return Rr},Get:function(){return Lr},Patch:function(){return Cr},Post:function(){return wr},PostDownload:function(){return Dr},Put:function(){return Ur},extractHeadersFromOptions:function(){return Nr},getBaseUrl:function(){return Ir},getMetadataHeaders:function(){return Pr}});var t={};n.r(t),n.d(t,{FeatureFlags:function(){return $r},loadFeatureFlags:function(){return Vr}});var o={};n.r(o),n.d(o,{GetUserJwt:function(){return xr},getCurrentUserTenantsV1:function(){return qr},getCurrentUserTenantsV3:function(){return Kr},getUsersGroups:function(){return zr},getUsersRoles:function(){return Wr},getUsersV2:function(){return jr},getUsersV3:function(){return Br},sendResetBreachedPasswordEmails:function(){return Hr},updateUserProfileV2:function(){return Jr}});var a={};n.r(a),n.d(a,{getHierarchyMetadata:function(){return ss},getParentTenants:function(){return is},getParentTenantsById:function(){return os},getSubTenants:function(){return ts},getSubTenantsAsTree:function(){return ns},getTenants:function(){return es},getTenantsUsersCount:function(){return as},searchSubTenants:function(){return rs},switchTenant:function(){return Zr}});var r={};n.r(r),n.d(r,{loadEntitlements:function(){return xs},loadEntitlementsV2:function(){return js}});var s={};n.r(s),n.d(s,{AuthStrategyEnum:function(){return Oi},MachineToMachineAuthStrategy:function(){return Ii},OAuthLogout:function(){return ml},SocialLoginProviders:function(){return ki},acceptInvitation:function(){return pl},activateAccount:function(){return cl},activateAccountV2:function(){return ul},bulkCreateIPRestriction:function(){return _s},changePhoneNumber:function(){return Tu},changePhoneNumberWithVerification:function(){return Au},checkIfAllowToRememberMfaDevice:function(){return Wc},createDomainRestriction:function(){return Ts},createIPRestriction:function(){return Ps},createOrUpdateSessionConfigrations:function(){return _c},createSSOConfiguration:function(){return Yc},createSSOConfigurationByMetadata:function(){return Zc},createSSOConfigurationByMetadataUrl:function(){return tu},createSSODomain:function(){return iu},createSSOGroup:function(){return lu},createSamlGroup:function(){return yc},createTenantAccessToken:function(){return Mc},createUserAccessToken:function(){return Nc},deleteAllSessionsForUser:function(){return wc},deleteDomainRestriction:function(){return ks},deleteIPRestriction:function(){return ws},deleteSSOConfiguration:function(){return Xc},deleteSSODomain:function(){return ou},deleteSSOGroup:function(){return uu},deleteSamlGroup:function(){return pc},deleteSessionForUser:function(){return Lc},deleteTenantAccessToken:function(){return Rc},deleteTenantApiToken:function(){return xc},deleteUserAccessToken:function(){return Dc},deleteUserApiToken:function(){return jc},deleteWebAuthnDevice:function(){return _u},disableMFAAuthenticatorApp:function(){return Rl},disableMFASMS:function(){return Nl},disableMFAWebAuthn:function(){return Fl},disableMfa:function(){return Ul},enrollMFAAuthenticatorApp:function(){return Il},enrollMFAAuthenticatorAppForLogin:function(){return Vl},enrollMFAAuthenticatorAppForLoginV2:function(){return xl},enrollMFASMS:function(){return _l},enrollMFASMSForLogin:function(){return ql},enrollMFASMSForLoginV2:function(){return Hl},enrollMFAWebAuthn:function(){return wl},enrollMFAWebAuthnForLogin:function(){return Zl},enrollMFAWebAuthnForLoginV2:function(){return ec},enrollMfa:function(){return kl},exchangeOAuthTokens:function(){return Su},exchangeOAuthTokensV2:function(){return pu},forgotPassword:function(){return Al},generateLoginResponse:function(){return Hs},generateLoginResponseFromOAuthResponse:function(){return Zs},generateLoginResponseFromOAuthResponseV2:function(){return el},generateLoginResponseV2:function(){return Js},generateLoginResponseV3:function(){return Xs},generateStepupSession:function(){return Mu},getActivateAccountStrategy:function(){return dl},getCaptchaPolicy:function(){return gs},getCurrentUserSession:function(){return Oc},getCurrentUserSessions:function(){return kc},getCurrentUserTenantsFunction:function(){return Xr},getCustomSocialLoginProvidersV1:function(){return Ac},getDomainRestrictions:function(){return As},getDomainRestrictionsConfig:function(){return bs},getGlobalSecurityPolicy:function(){return ls},getIPRestrictions:function(){return Os},getIPRestrictionsConfig:function(){return Is},getLockoutPolicy:function(){return ys},getMFADevices:function(){return Gl},getMFAStrategiesConfig:function(){return Uu},getMeAndEntitlements:function(){return Nu},getMeV2:function(){return Du},getMfaPolicy:function(){return cs},getOidcConfiguration:function(){return gc},getPasswordConfigPolicy:function(){return ms},getPasswordHistoryPolicy:function(){return Ss},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return Cu},getSSOConfigurations:function(){return Jc},getSSODefaultRoles:function(){return ru},getSSOGroups:function(){return du},getSSOPublicConfiguration:function(){return Sc},getSamlConfiguration:function(){return oc},getSamlRoles:function(){return cc},getSamlRolesGroups:function(){return uc},getSamlVendorConfiguration:function(){return rc},getSessionConfigurations:function(){return Pc},getSocialLoginProviders:function(){return vc},getSocialLoginProvidersV2:function(){return hc},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return mc},getTabTenantFromSessionStorage:function(){return Qr},getTenantAccessTokensData:function(){return Uc},getTenantApiTokensData:function(){return Gc},getUserAccessTokensData:function(){return Cc},getUserApiTokensData:function(){return Fc},getUserAuthorization:function(){return Ru},getUserById:function(){return Bc},getVendorConfig:function(){return Tc},getVendorLockoutPolicy:function(){return fs},getVendorMfaPolicy:function(){return us},getVendorPasswordHistoryPolicy:function(){return vs},getVendorPublicAuthStrategiesConfig:function(){return wu},getWebAuthnDevices:function(){return Pu},loadPasswordConfig:function(){return Tl},login:function(){return al},loginViaSocialLogin:function(){return bc},loginWithMfa:function(){return sl},loginWithMfaV2:function(){return ll},loginv2:function(){return rl},logout:function(){return hl},oidcPostLogin:function(){return ol},oidcPostLoginV2:function(){return fu},passwordlessPostLogin:function(){return qc},passwordlessPostLoginV2:function(){return Kc},passwordlessPreLogin:function(){return zc},postLogin:function(){return il},preDisableMFASMS:function(){return Dl},preDisableMFAWebAuthn:function(){return Ml},preEnrollMFAAuthenticatorApp:function(){return Ol},preEnrollMFAAuthenticatorAppForLogin:function(){return $l},preEnrollMFASMS:function(){return Pl},preEnrollMFASMSForLogin:function(){return Kl},preEnrollMFAWebAuthn:function(){return Ll},preEnrollMFAWebAuthnForLogin:function(){return Xl},preLogin:function(){return tl},preLoginV2:function(){return yu},preLoginWithIdpType:function(){return nl},preVerifyMFAEmailCode:function(){return Bl},preVerifyMFASMSForLogin:function(){return Jl},preVerifyMFAWebAuthnForLogin:function(){return tc},recoverMfaToken:function(){return El},refreshToken:function(){return gl},refreshTokenV2:function(){return Sl},refreshTokenV3:function(){return vl},resendActivationEmail:function(){return yl},resendInvitationEmail:function(){return fl},resetPassword:function(){return bl},resetPhoneNumber:function(){return hu},revokeSessionsForUser:function(){return Ic},saveLockoutPolicy:function(){return ps},saveMfaPolicy:function(){return ds},savePasswordHistoryPolicy:function(){return hs},setSSODefaultRoles:function(){return su},setTabTenantInSessionStorage:function(){return Yr},signUpUser:function(){return Ec},silentOAuthRefreshToken:function(){return vu},silentOAuthRefreshTokenV2:function(){return gu},testCurrentIp:function(){return Cs},testCurrentIpInAllowList:function(){return Us},updateDomainRestrictionConfig:function(){return Es},updateIPRestrictionConfig:function(){return Ls},updateSSOConfiguration:function(){return Qc},updateSSOConfigurationByMetadata:function(){return eu},updateSSOConfigurationByMetadataUrl:function(){return nu},updateSSOGroup:function(){return cu},updateSamlConfiguration:function(){return ac},updateSamlGroup:function(){return fc},updateSamlRoles:function(){return dc},updateSamlVendorMetadata:function(){return sc},updateTenantApiTokensData:function(){return Vc},updateUserApiTokensData:function(){return $c},validateSSODomain:function(){return au},validateSamlDomain:function(){return lc},verifyChangePhoneNumber:function(){return bu},verifyInviteToken:function(){return Hc},verifyMFAAuthenticatorAppForLogin:function(){return jl},verifyMFAEmailCode:function(){return Wl},verifyMFAEmailCodeV2:function(){return zl},verifyMFASMSForLogin:function(){return Yl},verifyMFASMSForLoginV2:function(){return Ql},verifyMFAWebAuthnForLogin:function(){return nc},verifyMFAWebAuthnForLoginV2:function(){return ic},verifyMfa:function(){return Cl},verifyNewDeviceSession:function(){return Lu},verifyResetPhoneNumber:function(){return mu},webAuthnCreateNewDeviceSession:function(){return Iu},webAuthnPostLogin:function(){return ku},webAuthnPostLoginV2:function(){return Ou},webAuthnPreLogin:function(){return Eu}});var l={};n.r(l),n.d(l,{addUser:function(){return ju},changePassword:function(){return Vu},createInviteUserLink:function(){return zu},deleteInviteUserLink:function(){return qu},deleteUser:function(){return Bu},getInviteLinkConfiguration:function(){return Ju},getInviteUserLink:function(){return Hu},getProfile:function(){return Fu},loadAvailablePermissions:function(){return Qu},loadAvailableRoles:function(){return Yu},loadStats:function(){return Xu},loadUsers:function(){return xu},resendActivationLink:function(){return Zu},resendInvitationLink:function(){return ed},resendInvitationLinkToAllTenants:function(){return td},updateInviteUserLink:function(){return Ku},updateProfile:function(){return Gu},updateProfileImage:function(){return $u},updateUser:function(){return Wu}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return id},getAuditsMetadata:function(){return ld},getCurrentUserIpMetadata:function(){return ad},getIpAdressMetadata:function(){return cd},getNotificationsMetadata:function(){return rd},getSamlMetadata:function(){return sd},updateAdminBoxMetadata:function(){return od}});var u={};n.r(u),n.d(u,{downloadReport:function(){return vd},getReport:function(){return pd},getReports:function(){return fd},renderReport:function(){return gd},scheduleReport:function(){return Sd},sendReport:function(){return hd}});var d={};n.r(d),n.d(d,{getNotifications:function(){return md},markAllAsRead:function(){return Td},updateNotificationIsPinned:function(){return bd},updateNotificationStatus:function(){return Ad}});var y={};n.r(y),n.d(y,{exportAudits:function(){return Id},getAudits:function(){return kd},getAuditsStats:function(){return Od}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return Vd},deleteEmailSubscriptions:function(){return Gd},deleteSMSConfiguration:function(){return Kd},deleteSMSSubscriptions:function(){return Wd},deleteSlackConfiguration:function(){return Rd},deleteWebhooksConfiguration:function(){return Jd},getCategories:function(){return Zd},getChannelMaps:function(){return ey},getEmailConfiguration:function(){return Nd},getSMSConfiguration:function(){return xd},getSlackChannels:function(){return Cd},getSlackConfiguration:function(){return Ld},getSlackScope:function(){return wd},getWebhookLog:function(){return Yd},getWebhooksConfigurations:function(){return qd},patchEmailConfiguration:function(){return Fd},patchSMSConfiguration:function(){return Bd},postEmailConfiguration:function(){return Md},postSMSConfiguration:function(){return jd},postSlackCode:function(){return Dd},postSlackConfiguration:function(){return Ud},postWebhookRetry:function(){return Xd},postWebhookTest:function(){return Qd},postWebhooksConfiguration:function(){return Hd},putEmailSubscriptions:function(){return $d},putSMSSubscriptions:function(){return zd}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return iy},getSettings:function(){return ny},updateSettings:function(){return ty}});var g={};n.r(g),n.d(g,{addRole:function(){return ly},attachPermissionToRoles:function(){return fy},attachPermissionsToRole:function(){return dy},deleteRole:function(){return cy},getPermissionCategories:function(){return py},getPermissions:function(){return yy},getRoles:function(){return sy},updateRole:function(){return uy}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return Ky},ISubscriptionStatus:function(){return Wy},PaymentMethodType:function(){return zy},ProviderType:function(){return qy},TenantCreatedAction:function(){return Jy},TrialEndAction:function(){return Hy},cancelManagedSubscription:function(){return Ty},cancelSubscription:function(){return vy},createStripeCustomer:function(){return My},createStripePaymentMethodSetupIntentSecret:function(){return Gy},createSubscription:function(){return Dy},createTenantConfiguration:function(){return xy},getManagedSubscription:function(){return Ay},getManagedSubscriptions:function(){return by},getPaymentMethod:function(){return Uy},getPaymentMethods:function(){return Cy},getPaymentProviders:function(){return jy},getStripeCustomer:function(){return Ny},getStripePaymentProviderConfiguration:function(){return Fy},getSubscription:function(){return Sy},getSubscriptionInvoice:function(){return _y},getSubscriptionInvoicePdf:function(){return Ly},getSubscriptionInvoices:function(){return Py},getSubscriptionPlan:function(){return Iy},getSubscriptionPlans:function(){return Oy},getSubscriptionSummaries:function(){return $y},getSubscriptions:function(){return gy},getTenantConfiguration:function(){return Vy},getVendorPublicConfigurations:function(){return By},renewManagedSubscription:function(){return Ey},renewSubscription:function(){return hy},updateManagedSubscription:function(){return ky},updatePaymentMethodBillingDetails:function(){return Ry},updateSubscription:function(){return my}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return Yy}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return ef},addUserToTenantAndSubTenants:function(){return Xy},addUsersToSubTenant:function(){return lf},createSubTenant:function(){return of},deleteSubTenant:function(){return af},loadAllUsers:function(){return Qy},removeUserFromTenantAndSubTenants:function(){return Zy},removeUserRolesFromSubTenants:function(){return tf},setUserRolesForSubTenants:function(){return nf},updateSubAccountAccess:function(){return sf},updateSubTenant:function(){return rf}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return ff},createConfiguration:function(){return df},deleteConfiguration:function(){return yf},getConfigs:function(){return cf},updateConfiguration:function(){return uf}});var A={};n.r(A),n.d(A,{impersonate:function(){return pf}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return Tf},addUsersToGroup:function(){return kf},createGroup:function(){return mf},deleteGroup:function(){return bf},deleteRolesFromGroup:function(){return Ef},deleteUsersFromGroup:function(){return Of},getGroupById:function(){return Sf},getGroupConfiguration:function(){return If},getGroups:function(){return vf},getGroupsByIds:function(){return hf},updateGroup:function(){return Af},updateGroupConfiguration:function(){return Pf}});var T={};n.r(T),n.d(T,{getInsights:function(){return Lf},getRecommendations:function(){return _f}});var E={};n.r(E),n.d(E,{createPhoneNumber:function(){return Cf},deletePhoneNumber:function(){return Uf},getUserPhoneNumbers:function(){return wf},preVerifyPhoneNumber:function(){return Rf},verifyDeletePhoneNumber:function(){return Nf},verifyPhoneNumber:function(){return Df}});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return Ws},AuthStrategyEnum:function(){return Oi},ContextHolder:function(){return Ga},FeatureFlags:function(){return $r},FronteggApiError:function(){return Va},FronteggContext:function(){return $a},FronteggFrameworks:function(){return di},GetUsersFilterPreset:function(){return pi},GroupManagedByEnum:function(){return qf},GroupRelations:function(){return Kf},ISubscriptionCancellationPolicy:function(){return Ky},ISubscriptionStatus:function(){return Wy},InsightCode:function(){return Jf},LOAD_AUTHORIZATION_FF:function(){return Vs},MFAStrategyEnum:function(){return $s},MachineToMachineAuthStrategy:function(){return Ii},NotEntitledJustification:function(){return Bs},PaginationOrderEnum:function(){return yi},PaymentMethodType:function(){return zy},ProviderType:function(){return qy},RecommendationActionKey:function(){return Yf},RecommendationCode:function(){return Hf},RecommendationSeverity:function(){return Qf},RequestSource:function(){return ui},RestrictionType:function(){return zn},ScimConnectionSource:function(){return zf},SecondaryAuthStrategy:function(){return Fs},SecurityCategory:function(){return Xf},SocialLoginProviders:function(){return ki},SortByEnum:function(){return fi},TenantSortByEnum:function(){return Ff},TenantType:function(){return Gf},USE_ENTITLEMENTS_V2_ENDPOINT_FF:function(){return Fr},UserManagedByEnum:function(){return Mf},WebAuthnDeviceType:function(){return Gs},api:function(){return Zf},countConfigurationUsers:function(){return ff},createConfiguration:function(){return df},default:function(){return ep},deleteConfiguration:function(){return yf},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return $f},fronteggHeaders:function(){return ci},fronteggRefreshTokenUrl:function(){return Vf},fronteggSilentRefreshTokenUrl:function(){return xf},fronteggTenantsUrl:function(){return Bf},fronteggTenantsV3Url:function(){return Wf},fronteggUsersUrl:function(){return jf},getConfigs:function(){return cf},getCurrentUserTenantsFunction:function(){return Xr},getTabTenantFromSessionStorage:function(){return Qr},loadFeatureFlags:function(){return Vr},providersArray:function(){return gi},setTabTenantInSessionStorage:function(){return Yr},updateConfiguration:function(){return uf}});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 oL},AccountPageFields:function(){return Q_},DomainRestrictionsTabFields:function(){return iL},GeneralSettingsTabFields:function(){return tL},InviteUserModalFields:function(){return Y_},IpRestrictionsTabFields:function(){return nL},Metadata:function(){return j_},PrivacyPageFields:function(){return J_},ProfilePageFields:function(){return H_},SecurityPageTabs:function(){return Z_},SessionManagementTabFields:function(){return eL},SignupFields:function(){return q_},SubscriptionsPageFields:function(){return X_},alpha:function(){return N_},fieldAppearance:function(){return aL},tabAppearance:function(){return rL}});var C=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 U(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 U(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)?U(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)}))}}C._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=Ce;n&&(o=[i],a=Ue);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={},Ce={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)}},Ue={};j(Ce,(function(e,t){Ue[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ue.deleteProperty=function(e,t){return Ue.set.call(this,e,t,void 0)},Ue.set=function(e,t,n){return Ce.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 Ce.get(t,e)},set:function(t){var n=this[Ie];Ce.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,Ct;!function(e){e.preLogin="preLogin",e.magicLinkPreLoginSuccess="magicLinkPreLoginSuccess",e.loginWithSmsOtc="loginWithSmsOtc",e.loginWithQuickSmsOtc="loginWithQuickSmsOtc",e.loginWithOtc="loginWithOtc",e.loginWithPassword="loginWithPassword",e.loginWithTwoFactor="loginWithTwoFactor",e.redirectToSSO="redirectToSSO",e.loginWithSSOFailed="loginWithSSOFailed",e.success="success",e.forceTwoFactor="forceTwoFactor",e.recoverTwoFactor="recoverTwoFactor",e.promptPasskeys="promptPasskeys",e.breachedPassword="breachedPassword",e.breachedPasswordSuccess="breachedPasswordSuccess"}(_t||(_t={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Lt||(Lt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(wt||(wt={})),function(e){e["social-login"]="social-login",e["custom-social-login"]="custom-social-login",e.direct="direct"}(Ct||(Ct={}));const Ut="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Rt="HOSTED_LOGIN_VERIFIER_KEY",Dt="auth",Nt="connectivity",Mt="auditLogs",Ft="vendor",Gt={flow:Lt.Login,step:_t.preLogin,loading:!1,email:"",tenants:[]},$t={setLoginState:vt("loginState"),resetLoginState:St("loginState",{loginState:Gt})},Vt={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 xt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(xt||(xt={}));const jt={step:xt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Bt={setActivateState:vt("activateState"),resetActivateState:St("activateState",{activateState:jt}),setActivateStrategyState:ht("activateState","activationStrategy")},Wt={activateAccount:yt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:yt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:yt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:yt("auth/resendActivationEmail",(e=>({payload:e})))};let zt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(zt||(zt={}));const Kt={step:zt.validate},qt={setAcceptInvitationState:vt("acceptInvitationState"),resetAcceptInvitationState:St("acceptInvitationState",{acceptInvitationState:Kt})},Ht={acceptInvitation:yt("auth/acceptInvitation",(e=>({payload:e})))};let Jt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Jt||(Jt={}));const Yt={step:Jt.forgotPassword,loading:!1,email:"",passwordConfig:null},Qt={setForgotPasswordState:vt("forgotPasswordState"),resetForgotPasswordState:St("forgotPasswordState",{forgotPasswordState:Yt})},Xt={forgotPassword:yt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:yt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:yt("auth/loadPasswordConfig",(e=>({payload:e})))};let Zt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Zt||(Zt={}));const en={step:Zt.ResetPhoneNumber,loading:!1},tn={setResetPhoneNumberState:vt("resetPhoneNumberState"),resetResetPhoneNumberState:St("resetPhoneNumberState",{resetPhoneNumberState:en})},nn={resetPhoneNumber:yt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:yt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:yt("auth/changePhoneNumber",(e=>({payload:e})))},on={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},an={setSSOLoader:mt("ssoState"),setSSOError:At("ssoState"),setSSOState:vt("ssoState"),resetSSOState:St("ssoState",{ssoState:on})},rn={loadSSOConfigurationsV2:yt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:yt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:yt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:yt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:yt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:yt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:yt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:yt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:yt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:yt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:yt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:yt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:yt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:yt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:yt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:yt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:yt("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:yt("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:yt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:yt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:yt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:yt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:yt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:yt("auth/oidcPostlogin",(e=>({payload:e})))},sn={loading:!1,error:null},ln={setProfileState:vt("profileState"),resetProfileState:St("profileState",{profileState:sn})},cn={loadProfile:yt("auth/loadProfile"),saveProfile:yt("auth/saveProfile",(e=>({payload:e}))),changePassword:yt("auth/changePassword",(e=>({payload:e})))};let un;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode"}(un||(un={}));const dn={step:un.verify,loading:!1,saving:!1},yn={setMfaState:vt("mfaState"),resetMfaState:St("mfaState",{mfaState:dn})},fn={enrollMfa:yt("auth/enrollMfa"),getMFADevices:yt("auth/getMFADevices"),getMFAStrategies:yt("auth/getMFAStrategies"),verifyMfa:yt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:yt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:yt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:yt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:yt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:yt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:yt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:yt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:yt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:yt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:yt("auth/disableMfaWebAuthn",(e=>({payload:e})))},pn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,shouldShowSubTenantUsersIfReseller:!1,allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},gn={setTeamLoader:mt("teamState"),setTeamError:At("teamState"),setTeamState:vt("teamState"),resetTeamState:St("teamState",{teamState:pn})},Sn={loadUsersV2:yt("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:yt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:yt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:yt("auth/loadRoles",(e=>({payload:e}))),addUser:yt("auth/addUser",(e=>({payload:e}))),addUsersBulk:yt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:yt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:yt("auth/updateUser",(e=>({payload:e}))),deleteUser:yt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:yt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:yt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:yt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:yt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:yt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:yt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:yt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:yt("auth/getInvitationLink"),createInvitationLink:yt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:yt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:yt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:yt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:yt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:yt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:yt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:yt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:yt("auth/closeLockUserDialog",(e=>({payload:e})))},vn={firstLoad:!0,loading:!1,error:""},hn={setSocialLoginsState:vt("socialLoginState"),resetSocialLoginsState:St("socialLoginState",{socialLoginState:vn})},mn={loadSocialLoginsConfiguration:yt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:yt("auth/loadSocialLoginsConfigurationV2",(e=>({payload:e}))),loginViaSocialLogin:yt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:yt("auth/setSocialLoginError",(e=>({payload:e})))};let An;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(An||(An={}));const bn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:An.SignUp},Tn={setSignUpState:vt("signUpState"),resetSignUpState:St("signUpState",{signUpState:bn})},En={signUpUser:yt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:yt("auth/resetSignUpStateSoft")},kn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},On={setApiTokensLoader:mt("apiTokensState"),setApiTokensError:At("apiTokensState"),setApiTokensState:vt("apiTokensState"),resetApiTokensState:St("apiTokensState",{apiTokensState:kn})},In={loadApiTokens:yt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:yt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:yt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:yt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:yt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:yt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:yt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:yt("auth/deleteTenantApiToken",(e=>({payload:e})))},Pn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},_n={setSecurityPolicyState:vt("securityPolicyState"),setSecurityPolicyGlobalState:ht("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:ht("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:ht("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:ht("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:ht("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:ht("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:ht("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:ht("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:ht("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:ht("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:ht("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:St("securityPolicyState",{securityPolicyState:Pn})},Ln={loadSecurityPolicy:yt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:yt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:yt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:yt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:yt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:yt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:yt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:yt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:yt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:yt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:yt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:yt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:yt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:yt("auth/loadPublicAuthStrategiesPolicy")},wn={loading:!1},Cn={setAccountSettingsState:vt("accountSettingsState"),resetAccountSettingsState:St("accountSettingsState",{accountSettingsState:wn})},Un={loadAccountSettings:yt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:yt("auth/saveAccountSettings",(e=>({payload:e})))},Rn={tenants:[],subTenants:[],loading:!0,tenantTree:null},Dn={setTenantsState:vt("tenantsState"),resetTenantsState:St("tenantsState",{tenantsState:Rn})},Nn={switchTenant:yt("auth/switchTenant",(e=>({payload:e}))),loadTenants:yt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:yt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:yt("auth/loadSubTenantsTree",(e=>({payload:e})))},Mn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Fn={setRolesState:vt("rolesState"),resetRolesState:St("rolesState",{rolesState:Mn})},Gn={loadRolesAndPermissions:yt("auth/loadRoles",(e=>({payload:e}))),addRole:yt("auth/addRole",(e=>({payload:e}))),updateRole:yt("auth/updateRole",(e=>({payload:e}))),deleteRole:yt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:yt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:yt("auth/attachPermissionToRoles",(e=>({payload:e})))},$n={loading:!1,sessions:[]},Vn={setSessionsState:vt("sessionsState"),resetSessionsState:St("sessionsState",{sessionsState:$n})},xn={loadUserSessions:yt("auth/loadUserSessions"),loadCurrentUserSession:yt("auth/loadCurrentUserSession"),deleteUserSession:yt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:yt("auth/deleteAllUserSessions"),revokeUserSessions:yt("auth/revokeUserSessions",(e=>({payload:e})))},jn={loading:!1,configurations:{}},Bn={setSessionsPolicyState:vt("sessionsPolicyState"),resetSessionsPolicyState:St("sessionsPolicyState",{sessionsPolicyState:jn})},Wn={loadSessionsPolicy:yt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:yt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let zn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(zn||(zn={}));const Kn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:zn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},qn={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})))},Jn={loading:!1},Yn={setProvisioningState:vt("provisioningState"),resetProvisioningState:St("provisioningState",{provisioningState:Jn})},Qn={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})))},Xn={devices:[],loading:!1,error:null},Zn={setPasskeysState:vt("passkeysState"),resetPasskeysState:St("passkeysState",{passkeysState:Xn})},ei={loadWebAuthnDevices:yt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:yt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},ti={loaders:{},errors:{},groups:[],groupsConfiguration:{}},ni={setUsersGroupsLoader:mt("groupsState"),setUsersGroupsError:At("groupsState"),setGroupsState:vt("groupsState"),resetUsersGroupsState:St("groupsState",{groupsState:ti})},ii={loadGroups:yt("auth/loadUsersGroups"),getGroupById:yt("auth/getGroupById",(e=>({payload:e}))),createGroup:yt("auth/createGroup",(e=>({payload:e}))),updateGroup:yt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:yt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:yt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:yt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:yt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:yt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:yt("auth/getGroupConfiguration"),updateGroupConfiguration:yt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:yt("auth/getUsers",(e=>({payload:e})))},oi={addGroupDialogState:{loading:!1,open:!1},editGroupDialogState:{loading:!1,open:!1},deleteGroupDialogState:{loading:!1,open:!1},addMembersToGroupDialogState:{loading:!1,open:!1,userIds:[]},deleteMemberFromGroupDialogState:{loading:!1,open:!1}},ai={setGroupsDialogsState:vt("groupsDialogsState"),resetGroupsDialogsState:St("groupsState",{groupsDialogsState:oi}),openAddGroupDialog:Tt("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:Tt("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:bt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:Tt("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:bt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:Tt("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:Tt("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:Tt("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:bt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:Tt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},ri={loading:!0,error:null},si={setCustomLoginState:vt("customLoginState"),resetCustomLoginState:St("customLoginState",{customLoginState:ri})},li={loadTenantMetadata:yt("auth/loadTenantMetadata"),updateTenantMetadata:yt("auth/updateTenantMetadata",(e=>({payload:e})))},ci={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let ui,di,yi,fi,pi;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ui||(ui={})),function(e){e.Nextjs="nextjs",e.React="react",e.Angular="angular",e.Vuejs="vuejs",e.Flutter="flutter",e.Ios="ios",e.Android="android",e.Vanillajs="vanillajs"}(di||(di={})),function(e){e.ASC="ASC",e.DESC="DESC"}(yi||(yi={})),function(e){e.createdAt="createdAt",e.name="name",e.email="email",e.id="id",e.verified="verified",e.isLocked="isLocked",e.provider="provider",e.tenantId="tenantId"}(fi||(fi={})),function(e){e.MFA_UNENROLLED="mfa-unenrolled",e.BREACHED_PASSWORDS="breached-passwords",e.INACTIVE="inactive"}(pi||(pi={}));const gi=["local","saml","google","github","facebook","microsoft","scim2","slack"],Si={loaders:{},errors:{},accounts:{tenantId:"",children:[]},accountsQueryParams:{_limit:50,_offset:0,_filter:"",_subTenantId:""},searchAccountsData:[],rootAccount:{tenantId:""},selectedAccount:{tenantId:"",userJwt:{accessToken:"",expiresIn:0,expires:""},users:[],usersQueryParams:{_offset:0,_limit:10,_order:yi.DESC,_sortBy:fi.name},usersPageOffset:0,accountSettings:{}}},vi={setAllAccountsLoader:mt("allAccountsState"),setAllAccountsError:At("allAccountsState"),setAllAccountsState:vt("allAccountsState"),setSelectedAccountState:ht("allAccountsState","selectedAccount"),resetAllAccountsState:St("allAccountsState",{allAccountsState:Si})},hi={loadAccounts:yt("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:yt("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:yt("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:yt("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:yt("auth/updateAccount",(e=>({payload:e}))),deleteSubAccount:yt("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:yt("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:yt("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:yt("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:yt("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:yt("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:yt("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setRootAccountData:yt("auth/setRootAccountData"),setSelectedSubAccountData:yt("auth/setSelectedSubAccountData",(e=>({payload:e}))),loadNumberOfUsersForSelectedSubAccount:yt("auth/loadNumberOfUsersForSelectedSubAccount",(e=>({payload:e})))},mi={createSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:"",canSelectParentAccount:!1},updateSubAccountDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1,jwt:""},deleteSubAccountDialog:{accountId:"",accountName:"",isParentAccount:!1,loading:!1,open:!1,error:!1,jwt:""},addUsersToAccountDialog:{loading:!1,open:!1,accountName:"",accountId:"",permissionToGiveAccessToSubAccounts:!1,jwt:""},deleteUserFromAccountDialog:{userId:"",userName:"",accountId:"",loading:!1,open:!1,jwt:""},editUserRolesDialog:{loading:!1,open:!1,jwt:"",accountId:"",userId:"",userName:"",userRoles:[]}},Ai={setAllAccountDialogsState:vt("allAccountsDialogsState"),resetAllAccountDialogsState:St("allAccountsDialogsState",{allAccountsDialogsState:mi}),openCreateSubAccountDialog:bt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:Tt("allAccountsDialogsState","createSubAccountDialog",mi.createSubAccountDialog),openUpdateSubAccountDialog:bt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:Tt("allAccountsDialogsState","updateSubAccountDialog",mi.updateSubAccountDialog),openDeleteSubAccountDialog:bt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:Tt("allAccountsDialogsState","deleteSubAccountDialog",mi.deleteSubAccountDialog),openAddUsersToAccountDialog:bt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:Tt("allAccountsDialogsState","addUsersToAccountDialog",mi.addUsersToAccountDialog),openDeleteUserFromAccountDialog:bt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:Tt("allAccountsDialogsState","deleteUserFromAccountDialog",mi.deleteUserFromAccountDialog),openEditUserRolesDialog:bt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:Tt("allAccountsDialogsState","editUserRolesDialog",mi.editUserRolesDialog)},bi={loaders:{},errors:{},recommendations:void 0,insights:void 0,score:0,breachedPasswordUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},unenrolledMfaUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},inactiveUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10,_maxInactiveSeconds:7776e3}}},Ti={setSecurityCenterState:vt("securityCenterState"),resetSecurityCenterState:St("securityCenterState",{securityCenterState:bi}),setSecurityCenterStateLoader:mt("securityCenterState"),setSecurityCenterStateError:At("securityCenterState")},Ei={loadRecommendations:yt("auth/loadRecommendations"),loadInsights:yt("auth/loadInsights"),sendResetBreachedPasswordEmail:yt("auth/sendResetBreachedPasswordEmail",(e=>({payload:e}))),sendBulkResetBreachedPasswordEmails:yt("auth/sendBulkResetBreachedPasswordEmails",(e=>({payload:e}))),loadBreachedPasswordUsers:yt("auth/loadBreachedPasswordUsers",(e=>({payload:e}))),loadUnenrolledMfaUsers:yt("auth/loadUnenrolledMfaUsers",(e=>({payload:e}))),loadInactiveUsers:yt("auth/loadInactiveUsers",(e=>({payload:e})))};let ki,Oi,Ii;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(ki||(ki={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Oi||(Oi={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Ii||(Ii={}));const Pi={[Oi.Code]:_t.loginWithOtc,[Oi.EmailAndPassword]:_t.loginWithPassword,[Oi.MagicLink]:_t.magicLinkPreLoginSuccess,[Oi.SmsCode]:_t.loginWithSmsOtc},_i={loading:!1,error:null,phoneNumbers:void 0},Li={setSmsState:vt("smsState"),resetSmsState:St("smsState",{smsState:_i})},wi={loadPhoneNumbers:yt("auth/loadPhoneNumbers"),setUpPhoneNumber:yt("auth/setUpPhoneNumber",(e=>({payload:e}))),verifyPhoneNumber:yt("auth/verifyPhoneNumber",(e=>({payload:e}))),deletePhoneNumber:yt("auth/deletePhoneNumber",(e=>({payload:e}))),verifyDeletePhoneNumber:yt("auth/verifyDeletePhoneNumber",(e=>({payload:e}))),preVerifyPhoneNumber:yt("auth/preVerifyPhoneNumber",(e=>({payload:e})))},Ci={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:bn,loginState:Gt,activateState:jt,acceptInvitationState:Kt,forgotPasswordState:Yt,ssoState:on,profileState:sn,customLoginState:ri,mfaState:dn,teamState:pn,groupsState:ti,groupsDialogsState:oi,socialLoginState:vn,apiTokensState:kn,securityPolicyState:Pn,accountSettingsState:wn,tenantsState:Rn,rolesState:Mn,resetPhoneNumberState:en,sessionsState:$n,sessionsPolicyState:jn,restrictionsState:Kn,provisioningState:Jn,passkeysState:Xn,allAccountsState:Si,allAccountsDialogsState:mi,securityCenterState:bi,smsState:_i},Ui=D({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},Ci);let Ri;!function(e){e.impersonating="impersonating",e.success="success"}(Ri||(Ri={}));const Di={step:Ri.impersonating,loading:!1},Ni={setImpersonateState:vt("impersonateState"),resetImpersonateState:St("impersonateState",{impersonateState:Di})},Mi={impersonate:yt("impersonation/impersonate",(e=>({payload:e})))},{reducer:Fi,actions:Gi}=pt({name:Dt,initialState:Ui,reducers:D({resetState:e=>D({},e,Ci),setState:(e,{payload:t})=>D({},e,t),setUser:("user",(e,{payload:t})=>D({},e,{user:t})),setEntitlements:ht("user","entitlements")},$t,hn,Bt,Ni,qt,Qt,tn,Tn,ln,si,an,yn,gn,ni,ai,On,_n,Cn,Dn,Fn,Vn,Bn,qn,Yn,Zn,vi,Ai,Ti,Li)});const $i=D({loadEntitlements:yt("auth/loadEntitlements",(e=>({payload:e})))},Gi,Vt,mn,Wt,Ht,Xt,nn,En,cn,li,rn,fn,Sn,ii,{},In,Ln,Un,Nn,Gn,xn,Wn,Hn,Qn,Mi,ei,hi,Ei,wi);var Vi=function(e){return"@@redux-saga/"+e},xi=Vi("CANCEL_PROMISE"),ji=Vi("CHANNEL_END"),Bi=Vi("IO"),Wi=Vi("MATCH"),zi=Vi("MULTICAST"),Ki=Vi("SAGA_ACTION"),qi=Vi("SELF_CANCELLATION"),Hi=Vi("TASK"),Ji=Vi("TASK_CANCEL"),Yi=Vi("TERMINATE"),Qi=Vi("LOCATION");function Xi(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 Zi=function(e){return null==e},eo=function(e){return null!=e},to=function(e){return"function"==typeof e},no=function(e){return"string"==typeof e},io=Array.isArray,oo=function(e){return e&&to(e.then)},ao=function(e){return e&&to(e.next)&&to(e.throw)},ro=function e(t){return t&&(no(t)||co(t)||to(t)||io(t)&&t.every(e))},so=function(e){return e&&to(e.take)&&to(e.close)},lo=function(e){return to(e)&&e.hasOwnProperty("toString")},co=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},uo=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[xi]=function(){clearTimeout(n)},i},yo=function(e){return function(){return e}},fo=yo(!0),po=function(){},go=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var So=function(e,t){D(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function vo(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var ho=function(e){throw e},mo=function(e){return{value:e,done:!0}};function Ao(e,t,n){void 0===t&&(t=ho),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:mo,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function bo(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var To=function(e){return Array.apply(null,new Array(e))},Eo=function(e){return function(t){return e(Object.defineProperty(t,Ki,{value:!0}))}},ko=function(e){return e===Yi},Oo=function(e){return e===Ji},Io=function(e){return ko(e)||Oo(e)};function Po(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=io(e)?To(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||Io(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=po,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function _o(e){return{name:e.name||"anonymous",location:Lo(e)}}function Lo(e){return e[Qi]}var wo=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)},Co="TAKE",Uo="CALL",Ro="FORK",Do="SELECT",No=function(e,t){var n;return(n={})[Bi]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Mo(e,t){return void 0===e&&(e="*"),ro(e)?(eo(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),No(Co,{pattern:e})):so(n=e)&&n[zi]&&eo(t)&&ro(t)?No(Co,{channel:e,pattern:t}):so(e)?(eo(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),No(Co,{channel:e})):void 0;var n}function Fo(e,t){return Zi(t)&&(t=e,e=void 0),No("PUT",{channel:e,action:t})}function Go(e){var t=No("ALL",e);return t.combinator=!0,t}function $o(e,t){var n,i=null;return to(e)?n=e:(io(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&no(n)&&to(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function Vo(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 No(Uo,$o(e,n))}function xo(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 No(Ro,$o(e,n))}function jo(e){return void 0===e&&(e=qi),No("CANCEL",e)}function Bo(e){void 0===e&&(e=go);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return No(Do,{selector:e,args:n})}var Wo=Vo.bind(null,uo);var zo=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Ko=[],qo=0;function Ho(e){try{Qo(),e()}finally{Xo()}}function Jo(e){Ko.push(e),qo||(Qo(),Zo())}function Yo(e){try{return Qo(),e()}finally{Zo()}}function Qo(){qo++}function Xo(){qo--}function Zo(){var e;for(Xo();!qo&&void 0!==(e=Ko.shift());)Ho(e)}var ea=function(e){return function(t){return e.some((function(e){return aa(e)(t)}))}},ta=function(e){return function(t){return e(t)}},na=function(e){return function(t){return t.type===String(e)}},ia=function(e){return function(t){return t.type===e}},oa=function(){return fo};function aa(e){var t="*"===e?oa:no(e)?na:io(e)?ea:lo(e)?na:to(e)?ta:co(e)?ia:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var ra={type:ji},sa=function(e){return e&&e.type===ji};function la(){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(ra)}))},(e={})[zi]=!0,e.put=function(e){if(!t)if(sa(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[Wi](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=oa),t?e(ra):(e[Wi]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),vo(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[Ki]?s(e):Jo((function(){s(e)}))},r}function ca(e,t){var n=e[xi];to(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var ua,da=0,ya=function(){return++da};function fa(e){e.isRunning()&&e.cancel()}var pa=((ua={}).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):!sa(e)||r?n(e):n(Yi)};try{o.take(s,eo(a)?aa(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},ua.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Jo((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&oo(t)?ca(t,n):n(t)}))},ua.ALL=function(e,t,n,i){var o=i.digestEffect,a=da,r=Object.keys(t);if(0!==r.length){var s=Po(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(io(t)?[]:{})},ua.RACE=function(e,t,n,i){var o=i.digestEffect,a=da,r=Object.keys(t),s=io(t)?To(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Io(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=po,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)}))},ua.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(oo(l))return void ca(l,n);if(ao(l))return void ka(e,l,s.context,da,_o(a),!1,n);n(l)}catch(e){n(e,!0)}},ua.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){Zi(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},ua.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(ao(o))return o;var a=!1;return Ao((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!oo(o)})}))}catch(e){return Ao((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:_o(t)}(c,a);Yo((function(){var t=ka(e,c,l.context,da,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},ua.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()&&vo(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(io(t)){if(0===t.length)return void n([]);var r=Po(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},ua.CANCEL=function(e,t,n,i){var o=i.task;t===qi?fa(o):io(t)?t.forEach(fa):fa(t),n()},ua.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)}},ua.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=wo());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(ra):e.isEmpty()?(n.push(i),i.cancel=function(){vo(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(ra):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])(ra)}}}}(t.buffer),a=aa(i),r=function t(n){sa(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)},ua.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},ua.FLUSH=function(e,t,n){t.flush(n)},ua.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},ua.SET_CONTEXT=function(e,t,n,i){var o=i.task;So(o.context,t),n()},ua);function ga(e,t){return e+"?"+t}function Sa(e){var t=e.name,n=e.location;return n?t+" "+ga(n.fileName,n.lineNumber):t}function va(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 ha=null,ma=[],Aa=function(e){e.crashedEffect=ha,ma.push(e)},ba=function(){ha=null,ma.length=0},Ta=function(){var e,t,n=ma[0],i=ma.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=Lo(e))?t.code+" "+ga(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Sa(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+Sa(e.meta)})),[va(ma)]).join("\n")};function Ea(e,t,n,i,o,a,r){var s;void 0===r&&(r=po);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||(vo(o,t),t.cont=po,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=po,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,Aa({meta:o,cancelledTasks:y}),S.isRoot){var i=Ta();ba(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Ji?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={})[Hi]=!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(Ji,!1))},s.cont=r,s.end=g,s.setContext=function(e){So(f,e)},s.toPromise=function(){return d||(d=zo(),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 ka(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){oo(t)?ca(t,i):ao(t)?ka(e,t,c.context,n,o,!1,i):t&&t[Bi]?(0,pa[t.type])(e,t.payload,i,u):i(t)}));d.cancel=po;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(Ji))},status:0},c=Ea(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),ba()):Oo(e)?(l.status=1,d.cancel(),o=to(t.return)?t.return(Ji):{done:!0,value:Ji}):o=ko(e)?to(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=ya();function l(n,o){a||(a=!0,i.cancel=po,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){ha=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=po,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=po,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function Oa(e,t){for(var n=e.channel,i=void 0===n?la():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?bo: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=ya();if(l&&(l.rootSagaStarted=l.rootSagaStarted||po,l.effectTriggered=l.effectTriggered||po,l.effectResolved=l.effectResolved||po,l.effectRejected=l.effectRejected||po,l.effectCancelled=l.effectCancelled||po,l.actionDispatched=l.actionDispatched||po,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=go;var m={channel:i,dispatch:Eo(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:g};return Yo((function(){var e=ka(m,S,s,v,_o(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var Ia=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?la():a,s=n.sagaMonitor,l=Xi(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Oa.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){So(o,e)},c},Pa=function(e){return{done:!0,value:e}},_a={};function La(e){return so(e)?"channel":lo(e)?String(e):to(e)?e.name:String(e)}function wa(e,t,n){var i,o,a,r=t;function s(t,n){if(r===_a)return Pa(t);if(n&&!o)throw r=_a,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===_a?Pa(t):a}return Ao(s,(function(e){return s(null,e)}),n)}function Ca(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:Mo(e)},s=function(e){return{done:!1,value:xo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return wa({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+La(e)+", "+t.name+")")}function Ua(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:Mo(e)},l=function(e){return{done:!1,value:xo.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:jo(e)}},u=function(e){return a=e},d=function(e){return r=e};return wa({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("+La(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={done:!1,value:Mo(e)},s=function(e){return{done:!1,value:Vo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return wa({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+La(e)+", "+t.name+")")}function Da(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:Vo.apply(void 0,[n].concat(a))},l={done:!1,value:Wo(t)};return wa({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:_a}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.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];return xo.apply(void 0,[Ca,e,t].concat(i))}function Ma(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return xo.apply(void 0,[Ua,e,t].concat(i))}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 xo.apply(void 0,[Ra,e,t].concat(i))}class Ga{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 Ga.instance||(Ga.instance=new Ga),Ga.instance}static setContext(e){Ga.getInstance().context=e}static setAccessToken(e){Ga.getInstance().accessToken=e}static setUser(e){Ga.getInstance().user=e}static setRequestSource(e){Ga.getInstance().requestSource=e}static setOnRedirectTo(e){Ga.getInstance().onRedirectTo=e}static setLogout(e,t){Ga.getInstance().logout=n=>{n?e(n):Ga.onRedirectTo(t)}}static setEntitlementsOptions(e){Ga.getInstance().entitlementsOptions=e}static setSessionContext(e){Ga.getInstance().sessionContext=e}static setAppName(e){Ga.getInstance().appName=e}static getContext(){var e;return null!=(e=Ga.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Ga.getInstance().accessToken}static getRequestSource(){return Ga.getInstance().requestSource}static getUser(){return Ga.getInstance().user}static onRedirectTo(e,t){return Ga.getInstance().onRedirectTo(e,t)}static logout(e){return Ga.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=Ga.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static isSessionPerTenantEnabled(){var e;return(null==(e=Ga.getInstance().sessionContext)?void 0:e.enableSessionPerTenant)||!1}static getAppName(){return Ga.getInstance().appName}}Ga.instance=void 0;const $a={getContext:()=>Ga.getContext(),getAccessToken:()=>Ga.getAccessToken(),getUser:()=>Ga.getUser(),onRedirectTo:(e,t)=>Ga.onRedirectTo(e,t),logout:e=>Ga.logout(e)};class Va extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const xa={v1:"/identity/resources/users/webauthn/v1/devices"},ja={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Ba={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"}},Wa={v1:"/identity/resources/configurations/v1"},za={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Ka={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},qa={v1:"/identity/resources/permissions/v1"},Ha={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"}},Ja={v1:"/identity/resources/roles/v1"},Ya={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Qa={v1:"/identity/resources/impersonation/v1"},Xa={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Za={v1:"/identity/resources/users/phone-numbers/v1"},er={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},tr={v1:"/team/resources/members/v1"},nr={v1:"/team/resources/roles/v1"},ir={v1:"/team/resources/stats/v1"},or={v1:"/team/resources/profile"},ar={v1:"/tenants/resources/account-settings/v1"},rr={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"}},sr={v1:"/tenants/resources/sub-tenants/v1"},lr={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},cr={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"}}}},ur={v1:"/subscriptions/resources/payment-providers/v1"},dr={v1:"/subscriptions/resources/subscriptions/v1"},yr={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},fr={v1:"/reports/engine/resources/triggers/v1"},pr="/notification",gr="/audits",Sr={v1:"/event/resources/configurations/v1"},vr="/webhook",hr="/oauth",mr="/flags",Ar="/directory/resources/v1/configurations/scim2",br="/directory/resources/scim/temp",Tr="/entitlements/api/v1/user-entitlements",Er="/entitlements/api/v2/user-entitlements",kr={v1:"/security-center/resources/recommendations/v1"},Or={v1:"/security-center/resources/insights/v1"};function Ir(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 Pr(e){var t,n;const i={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(i[ci.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(i[ci.frameWork]=e.metadataHeaders.framework),i}const _r=async e=>{var t,n,i;const o=Ga.getContext(),a=await async function(e,t){var n;const i=Pr(e),o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Ga.getAccessToken)(),a=Ga.getRequestSource();t&&(i[ci.contentType]=t),a&&(i[ci.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=Ir(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 Va("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 Va(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{}}},Lr=async(e,t,n)=>_r(D({url:e,method:"GET",contentType:"application/json",params:t},n)),wr=async(e,t,n)=>_r(D({url:e,method:"POST",contentType:"application/json",body:t},n)),Cr=async(e,t,n)=>_r(D({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Ur=async(e,t,n)=>_r(D({url:e,method:"PUT",contentType:"application/json",body:t},n)),Rr=async(e,t,n)=>_r(D({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Dr=async(e,t,n,i)=>_r(D({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),Nr=(e={})=>D({},e.jwt?{Authorization:e.jwt}:{}),Mr="FRONTEGG_SEPARATE_TABS_BY_TENANT",Fr="admin_portal_use_entitlements_v2_endpoint",Gr={flags:{}};class $r{constructor(){var e;this._flags={},this._flags=null!=(e=Gr.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new $r;return n.set(e),$r._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==Gr?void 0:Gr.flags)?t:{},null!=e?e:{})}}async function Vr(){return Lr(mr)}async function xr(e){return wr(`${Ba.v3}/me/token`,e)}async function jr(e,t){return Lr(Ba.v2,e,{headers:Nr(t)})}async function Br(e,t){return Lr(Ba.v3,e,{headers:Nr(t)})}async function Wr(e,t){return Lr(Ba.roles.v3,D({},e,{ids:e.ids.join(",")}),{headers:Nr(t)})}async function zr(e,t){return Lr(Ba.groups.v3,D({},e,{ids:e.ids.join(",")}),{headers:Nr(t)})}async function Kr(e){return Lr(Ba.tenants.me.v3,void 0,{headers:Nr(e)})}async function qr(e){return Lr(Ba.tenants.me.v1,void 0,{headers:Nr(e)})}async function Hr(){return wr(Ba.passwords.resetBreachedPasswords.v1)}async function Jr(e){return Ur(`${Ba.v2}/me`,e)}function Yr(e){e&&sessionStorage.setItem(Mr,e)}function Qr(){return Ga.isSessionPerTenantEnabled()?sessionStorage.getItem(Mr):null}function Xr(){const[e]=$r.getFeatureFlags(["admin_portal_use_current_user_tenants_v1_endpoint"],Ga.getAppName()||"");return Ga.isSessionPerTenantEnabled()||e?qr:Kr}async function Zr(e){return Ga.isSessionPerTenantEnabled()&&Yr(e.tenantId),Ur(`${Ba.v1}/tenant`,e)}async function es(){return Lr(`${Ba.v2}/me/tenants`)}async function ts(e){return Lr(rr.v1,void 0,{headers:Nr(e)})}async function ns(e){return Lr(rr.tree.v1,void 0,{headers:Nr(e)})}async function is(e){return Lr(rr.parents.v1,void 0,{headers:Nr(e)})}async function os(e,t){return Lr(`${rr.parents.v1}/${e}`,void 0,{headers:Nr(t)})}async function as(e,t){return wr(`${Ha.users.v1}/count`,e,{headers:Nr(t)})}async function rs(e,t){return Lr(rr.v2,e,{headers:Nr(t)})}async function ss(e,t){return Lr(rr.metadata.v2,D({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Nr(t)})}async function ls(){return Lr(Wa.v1)}async function cs(){return Lr(`${Wa.v1}/mfa-policy`)}async function us(){return Lr(`${Wa.v1}/mfa-policy/vendor`)}async function ds(e){return e.id?Cr(`${Wa.v1}/mfa-policy`,e):wr(`${Wa.v1}/mfa-policy`,e)}async function ys(){return Lr(`${Wa.v1}/lockout-policy`)}async function fs(){return Lr(`${Wa.v1}/lockout-policy/vendor`)}async function ps(e){return e.id?Cr(`${Wa.v1}/lockout-policy`,e):wr(`${Wa.v1}/lockout-policy`,e)}async function gs(){try{return await Lr(`${Wa.v1}/captcha-policy/public`)}catch{return null}}async function Ss(){return Lr(`${Wa.v1}/password-history-policy`)}async function vs(){return Lr(`${Wa.v1}/password-history-policy/vendor`)}async function hs(e){return e.id?Cr(`${Wa.v1}/password-history-policy`,e):wr(`${Wa.v1}/password-history-policy`,e)}async function ms(){return Lr(`${Wa.v1}/password`)}async function As(){return Lr(`${za.emailDomain.v1}`)}async function bs(){return Lr(`${za.emailDomain.v1}/config`)}async function Ts(e){return wr(`${za.emailDomain.v1}`,e)}async function Es(e){return wr(`${za.emailDomain.v1}/config`,e)}async function ks(e){return Rr(`${za.emailDomain.v1}/${e}`)}async function Os(e){return Lr(`${za.ip.v1}`,e)}async function Is(){return Lr(`${za.ip.v1}/config`)}async function Ps(e){return wr(`${za.ip.v1}`,e)}async function _s(e){return wr(`${za.ip.v1}/bulk`,e)}async function Ls(e){return wr(`${za.ip.v1}/config`,e)}async function ws(e){return Rr(`${za.ip.v1}/${e}`)}async function Cs(){return wr(`${za.ip.v1}/verify`)}async function Us(){return wr(`${za.ip.v1}/verify/allow`)}$r._instances={};class Rs extends Error{constructor(e){super(e)}}const Ds="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Rs("'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 Ns extends Error{constructor(e){super(e)}}const Ms=(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(Ds(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 Ds(t)}})(e.split(".")[n]))}catch(e){throw new Ns("Invalid token specified: "+e.message)}};let Fs,Gs,$s;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}(Fs||(Fs={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Gs||(Gs={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}($s||($s={}));const Vs="admin_portal_should_load_authorization";async function xs(){return Lr(Tr)}async function js(){return Lr(Er)}let Bs;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(Bs||(Bs={}));const Ws="admin_portal_entitlements",zs=["type"],Ks=["type"],qs=["type"];async function Hs(e){if(!e.accessToken)return e;Ga.setAccessToken(e.accessToken);const t=await Nu(),n=D({},e,e.accessToken?Ms(e.accessToken):{},t);return Ga.setUser(n),n}async function Js(e){if(!e.accessToken)return{user:e};Ga.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Nu(),es()]),i=D({},e,e.accessToken?Ms(e.accessToken):{},t);return Ga.setUser(i),{user:i,tenants:n}}function Ys(){if(!Ga.shouldLoadEntitlements())return!1;const[e]=$r.getFeatureFlags([Ws],Ga.getAppName()||"");return e}function Qs(){const[e]=$r.getFeatureFlags([Vs],Ga.getAppName()||"");return e}async function Xs(e){const{accessToken:t}=e;if(!t)return{user:e};Ga.setAccessToken(t);const[n,i]=await Promise.all([Nu(),Xr()()]),o=D({},e,t?Ms(t):{},n);return Ga.isSessionPerTenantEnabled()&&Yr(o.tenantId),Ga.setUser(o),{user:o,tenants:i.tenants,activeTenant:i.activeTenant}}async function Zs(e){Ga.setAccessToken(e.id_token);const t=await Nu(),n=e.id_token?Ms(e.id_token):{},i=D({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Ga.setUser(i),i}async function el(e){Ga.setAccessToken(e.id_token);const[t,n]=await Promise.all([Nu(),Xr()()]),i=e.id_token?Ms(e.id_token):{},o=D({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},i,t,{expiresIn:e.expires_in||300});return Ga.isSessionPerTenantEnabled()&&Yr(o.tenantId),Ga.setUser(o),{user:o,tenants:n.tenants,activeTenant:n.activeTenant}}async function tl(e){try{const{address:t}=await wr(`${ja.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function nl(e){return wr(`${ja.v1}/user/saml/prelogin`,e)}async function il(e){return Hs(await wr(`${ja.v1}/user/saml/postlogin`,e))}async function ol(e){return Hs(await wr(`${ja.v1}/user/oidc/postlogin`,e))}async function al(e){return Hs(await wr(`${ja.v1}/user`,e))}async function rl(e){return Xs(await wr(`${ja.v1}/user`,e))}async function sl(e){return Hs(await wr(`${ja.v1}/user/mfa/verify`,e))}async function ll(e){return Xs(await wr(`${ja.v1}/user/mfa/verify`,e))}async function cl(e){return wr(`${Ba.v1}/activate`,e)}async function ul(e){return Xs(await wr(`${Ba.v1}/activate`,e))}async function dl(e){return Lr(`${Ba.v1}/activate/strategy`,e)}async function yl(e){return wr(`${Ba.v1}/activate/reset`,e)}async function fl(e){return wr(`${Ba.v1}/invitation/reset`,e)}async function pl(e){return wr(`${Ba.v1}/invitation/accept`,e)}async function gl(){const e=Qr();return Hs(await wr(`${ja.v1}/user/token/refresh`,{tenantId:e}))}async function Sl(){const e=Qr();return Js(await wr(`${ja.v1}/user/token/refresh`,{tenantId:e}))}async function vl(){const e=Qr();return Xs(await wr(`${ja.v1}/user/token/refresh`,{tenantId:e}))}async function hl(){return wr(`${ja.v1}/logout`)}async function ml(e){return Lr(`${hr}/logout`,e)}async function Al(e){return wr(`${Ba.v1}/passwords/reset`,e)}async function bl(e){return wr(`${Ba.v1}/passwords/reset/verify`,e)}async function Tl(e){return Lr(`${Ba.v1}/passwords/config`,e)}async function El(e){return wr(`${ja.v1}/user/mfa/recover`,e)}async function kl(){return wr(`${Ba.v1}/mfa/enroll`)}async function Ol(){return wr(`${Ba.v1}/mfa/authenticator/enroll`)}async function Il(e){return wr(`${Ba.v1}/mfa/authenticator/enroll/verify`,e)}async function Pl(e){return wr(`${Ba.v1}/mfa/sms/enroll`,e)}async function _l(e){return wr(`${Ba.v1}/mfa/sms/enroll/verify`,e)}async function Ll(){return wr(`${Ba.v1}/mfa/webauthn/enroll`)}async function wl(e){return wr(`${Ba.v1}/mfa/webauthn/enroll/verify`,e)}async function Cl(e){return wr(`${Ba.v1}/mfa/enroll/verify`,e)}async function Ul(e){return wr(`${Ba.v1}/mfa/disable`,e)}async function Rl(e,t){return wr(`${Ba.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Dl(e){return wr(`${Ba.v1}/mfa/sms/${e}/disable`)}async function Nl(e,t){return wr(`${Ba.v1}/mfa/sms/${e}/disable/verify`,t)}async function Ml(e){return wr(`${Ba.v1}/mfa/webauthn/${e}/disable`)}async function Fl(e,t){return wr(`${Ba.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Gl(){return Lr(`${Ba.v1}/mfa/devices`)}async function $l(e){return wr(`${ja.v1}/user/mfa/authenticator/enroll`,e)}async function Vl(e){return wr(`${ja.v1}/user/mfa/authenticator/enroll/verify`,e)}async function xl(e){return Xs(await wr(`${ja.v1}/user/mfa/authenticator/enroll/verify`,e))}async function jl(e,t){return wr(`${ja.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Bl(e){return wr(`${ja.v1}/user/mfa/emailcode`,e)}async function Wl(e){return wr(`${ja.v1}/user/mfa/emailcode/verify`,e)}async function zl(e){return Xs(await wr(`${ja.v1}/user/mfa/emailcode/verify`,e))}async function Kl(e){return wr(`${ja.v1}/user/mfa/sms/enroll`,e)}async function ql(e){return wr(`${ja.v1}/user/mfa/sms/enroll/verify`,e)}async function Hl(e){return Xs(await wr(`${ja.v1}/user/mfa/sms/enroll/verify`,e))}async function Jl(e,t){return wr(`${ja.v1}/user/mfa/sms/${e}`,t)}async function Yl(e,t){return wr(`${ja.v1}/user/mfa/sms/${e}/verify`,t)}async function Ql(e,t){return Xs(await wr(`${ja.v1}/user/mfa/sms/${e}/verify`,t))}async function Xl(e){return wr(`${ja.v1}/user/mfa/webauthn/enroll`,e)}async function Zl(e){return wr(`${ja.v1}/user/mfa/webauthn/enroll/verify`,e)}async function ec(e){return Xs(await wr(`${ja.v1}/user/mfa/webauthn/enroll/verify`,e))}async function tc(e,t){return wr(`${ja.v1}/user/mfa/webauthn/${e}`,t)}async function nc(e,t){return wr(`${ja.v1}/user/mfa/webauthn/${e}/verify`,t)}async function ic(e,t){return Xs(await wr(`${ja.v1}/user/mfa/webauthn/${e}/verify`,t))}async function oc(){return Lr(`${er.v1}/saml/configurations`)}async function ac(e){return wr(`${er.v1}/saml/configurations`,e)}async function rc(){return Lr(`${er.v1}/saml/configurations/vendor-config`)}async function sc(e){return Ur(`${er.v1}/saml/configurations/metadata`,e)}async function lc(){return Ur(`${er.v1}/saml/validations/domain`)}async function cc(){return Lr(`${er.v1}/saml/configurations/roles/default`)}async function uc(){return Lr(`${er.v2}/saml/configurations/groups`)}async function dc({roleIds:e}){return wr(`${er.v1}/saml/configurations/roles/default`,{roleIds:e})}async function yc({roleIds:e,group:t}){return wr(`${er.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function fc({roleIds:e,group:t,id:n}){return Cr(`${er.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function pc({id:e}){return Rr(`${er.v2}/saml/configurations/groups/${e}`)}async function gc(){return Lr(`${er.v1}/oidc/configurations`)}async function Sc(){return Lr(`${er.v2}/configurations/public`)}async function vc(){return Lr(Ka.v1)}async function hc(){return Lr(Ka.v2)}async function mc(){return Lr(`${Ka.v2}/authenticated`)}async function Ac(){return Lr(Ka.custom.v1)}async function bc({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),wr(`${ja.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function Tc(){return Lr(`${Wa.v1}/public`)}async function Ec(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await wr(`${Ba.v1}/signUp`,e),a={shouldActivate:t,userId:i,tenantId:o};if(!t&&n){const{user:e,tenants:t,activeTenant:i}=await Xs(n);return D({},a,{user:e,tenants:t,activeTenant:i})}return a}async function kc(){return Lr(Ba.sessions.currentUser.v1)}async function Oc(){return Lr(`${Ba.sessions.currentUser.v1}/current`)}async function Ic(e){return wr(`${Ba.sessions.v1}/revoke`,{userId:e})}async function Pc(){return Lr(Ba.sessions.configurations.v1)}async function _c(e){await wr(Ba.sessions.configurations.v1,e)}async function Lc(e){await Rr(`${Ba.sessions.currentUser.v1}/${e}`)}async function wc(){await Rr(`${Ba.sessions.currentUser.v1}/all`)}async function Cc(){return Lr(Ba.accessTokens.v1)}async function Uc(){return Lr(Ha.accessTokens.v1)}async function Rc({id:e}){return Rr(`${Ha.accessTokens.v1}/${e}`)}async function Dc({id:e}){return Rr(`${Ba.accessTokens.v1}/${e}`)}async function Nc(e){return wr(Ba.accessTokens.v1,e)}async function Mc(e){return wr(Ha.accessTokens.v1,e)}async function Fc(){return Lr(Ba.apiTokens.v1)}async function Gc(){return Lr(Ha.apiTokens.v1)}async function $c(e){return wr(Ba.apiTokens.v1,e)}async function Vc(e){return wr(Ha.apiTokens.v2,e)}async function xc({tokenId:e}){return Rr(`${Ha.apiTokens.v1}/${e}`)}async function jc({tokenId:e}){return Rr(`${Ba.apiTokens.v1}/${e}`)}async function Bc({userId:e}){return Lr(`${Ba.v1}/${e}`)}async function Wc(e){return Lr(`${Wa.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function zc(e){let{type:t}=e,n=Xi(e,zs);return wr(`${ja.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Kc(e){let{type:t}=e,n=Xi(e,Ks);return Xs(await wr(`${ja.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function qc(e){let{type:t}=e,n=Xi(e,qs);return wr(`${ja.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Hc({token:e}){return wr(Ha.invites.verify.v1,{token:e})}async function Jc(){return Lr(`${er.v1}/configurations`)}async function Yc(e){return wr(`${er.v1}/configurations`,e)}async function Qc(e,t){return Cr(`${er.v1}/configurations/${e}`,t)}async function Xc(e){return Rr(`${er.v1}/configurations/${e}`)}async function Zc(e){return wr(`${er.v1}/configurations/metadata`,e)}async function eu(e,t){return Ur(`${er.v1}/configurations/${e}/metadata`,t)}async function tu(e){return wr(`${er.v1}/configurations/metadata-url`,e)}async function nu(e,t){return Ur(`${er.v1}/configurations/${e}/metadata-url`,t)}async function iu(e,t){return wr(`${er.v1}/configurations/${e}/domains`,t)}async function ou(e,t){return Rr(`${er.v1}/configurations/${e}/domains/${t}`)}async function au(e,t){return Ur(`${er.v1}/configurations/${e}/domains/${t}/validate`)}async function ru(e){return Lr(`${er.v1}/configurations/${e}/roles`)}async function su(e,t){return Ur(`${er.v1}/configurations/${e}/roles`,t)}async function lu(e,t){return wr(`${er.v1}/configurations/${e}/groups`,t)}async function cu(e,{roleIds:t,group:n,id:i}){return Cr(`${er.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function uu(e,t){return Rr(`${er.v1}/configurations/${e}/groups/${t}`)}async function du(e){return Lr(`${er.v1}/configurations/${e}/groups`)}async function yu(e){return wr(`${ja.v2}/user/sso/prelogin`,e)}async function fu(e){return Hs(await wr(`${ja.v2}/user/oidc/postlogin`,e))}async function pu(e){return el(await wr(`${hr}/token`,e))}async function gu(){const e=Qr();return el(await wr(`${hr}/authorize/silent`,{tenantId:e}))}async function Su(e){return Zs(await wr(`${hr}/token`,e))}async function vu(){const e=Qr();return Zs(await wr(`${hr}/authorize/silent`,{tenantId:e}))}async function hu(e){return wr(`${Ba.v1}/phone/reset`,e)}async function mu(e){return wr(`${Ba.v1}/phone/reset/verify`,e)}async function Au(e){return wr(`${Ba.v1}/phone`,e)}async function bu(e){return wr(`${Ba.v1}/phone/verify`,e)}async function Tu(e){return Ur(`${Ba.v1}/phone/change`,e)}async function Eu(e){return wr(`${ja.v1}/webauthn/prelogin`,e)}async function ku(e){return wr(`${ja.v1}/webauthn/postlogin`,e)}async function Ou(e){return Xs(await wr(`${ja.v1}/webauthn/postlogin`,e))}async function Iu(){return wr(xa.v1)}async function Pu(){return Lr(xa.v1)}async function _u(e){return Rr(`${xa.v1}/${e}`)}async function Lu(e){return wr(`${xa.v1}/verify`,e)}async function wu(){return Lr(`${Wa.v1}/auth/strategies/public`)}async function Cu(){return Lr(`${Wa.v1}/auth/strategies`)}async function Uu(){return Lr(`${Wa.v1}/mfa/strategies`)}async function Ru(){return Lr(`${Ba.authorization.v1}`)}async function Du(){return Lr(`${Ba.v2}/me`)}async function Nu(){const[e]=$r.getFeatureFlags([Fr],Ga.getAppName()||""),t=[{action:Du,shouldLoad:!0},{action:e?js:xs,shouldLoad:Ys()},{action:Ru,shouldLoad:Qs()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[n,i,o]=await Promise.all(t),a=Qr();return a&&(n.tenantId=a),D({},n,null!=o?o:{},{entitlements:i})}async function Mu(e){return wr(`${ja.v1}/user/step-up/generate`,e)}async function Fu(e){return Lr(`${Ba.v2}/me`,null!=e?e:{addRoles:!0})}async function Gu(e){return Ur(`${Ba.v2}/me`,e)}async function $u(e){return Ur(`${or.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Vu(e){return wr(`${Ba.v1}/passwords/change`,e)}async function xu(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 Lr(tr.v1,D({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function ju(e){return wr(Ba.v2,D({},e,{provider:"local"}))}async function Bu(e){return Rr(`${tr.v1}/${e.userId}`)}async function Wu(e){return Ur(tr.v1,e)}async function zu(e){return wr(Ha.invites.user.v1,D({},e))}async function Ku(e){return Cr(Ha.invites.user.v1,D({},e))}async function qu(){return Rr(Ha.invites.user.v1)}async function Hu(){return Lr(Ha.invites.user.v1)}async function Ju(){return Lr(Ha.invites.configuration.v1)}async function Yu(){return Lr(nr.v1)}async function Qu(){return Lr(qa.v1)}async function Xu(){return Lr(`${ir.v1}/members`)}async function Zu(e){return wr(`${tr.v1}/${e.userId}/resendActivationEmail`,{})}async function ed(e){return wr(Ba.v2,D({},e,{provider:"local"}))}async function td(e){return wr(Ba.invitation.resendAll.v1,D({},e))}async function nd(e){var t,n;const i=await Lr("/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 id(){return Lr("/metadata/admin-box")}async function od(e){return wr("/metadata/admin-box",e)}async function ad(){const e=await Lr("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const rd=async()=>nd({entityName:"notifications"}),sd=async()=>nd({entityName:"saml"}),ld=async()=>nd({entityName:"audits"}),cd=async e=>async function(e){const t=await Lr(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),ud=["dataFilters"],dd=["templateId","dataFilters"],yd=["dataFilters"];async function fd(e){return Lr(`${yr.v2}/tenant-reports`,e)}async function pd(e){return Lr(`${yr.v2}/${e.id}/tenant-reports`)}async function gd(e){let{dataFilters:t}=e,n=Xi(e,ud);return{html:await Lr(`${fr.v1}/preview-report`,D({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Sd(e){let{templateId:t,dataFilters:n}=e,i=Xi(e,dd);return wr(`${yr.v2}/${t}/tenant-reports`,D({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function vd(e){let{dataFilters:t}=e,n=Xi(e,yd);const i=await Lr(`${fr.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 hd(e){return wr(`${fr.v1}/tenant-reports`,e)}async function md(e){return Lr(pr,{params:e})}async function Ad(e){return Ur(`${pr}/status`,{params:e})}async function bd(e){const{notificationId:t,pinStatus:n}=e;return Ur(`${pr}/${n}`,{notificationId:t})}async function Td(){return wr(`${pr}/status/mark-all-read`)}const Ed=["endpoint","headerProps"];async function kd(e){return Lr(gr,e)}async function Od(e){return Lr(`${gr}/stats`,e)}async function Id(e){const{endpoint:t,headerProps:n}=e,i=Xi(e,Ed);return Dr(`${gr}/export/${t}`,{properties:n},i)}const Pd=["eventKey"],_d=["eventKey"],Ld=()=>Lr(`${lr.v1}/slack`),wd=()=>Lr(`${lr.v1}/slack/applications`),Cd=()=>Lr(`${lr.v1}/slack/channels`),Ud=e=>e.id?Cr(`${lr.v1}/slack/subscription/${e.id}`,e):wr(`${lr.v1}/slack/subscriptions`,e),Rd=e=>Rr(`${lr.v1}/slack/subscriptions/${e.id}`),Dd=e=>wr(`${lr.v1}/slack/applications/registrations`,{code:e}),Nd=()=>Lr(`${lr.v1}/emails`),Md=e=>{let{eventKey:t}=e,n=Xi(e,Pd);return wr(`${lr.v1}/emails/${t}`,n)},Fd=({eventKey:e,enabled:t})=>Cr(`${lr.v1}/emails/${e}`,{enabled:t}),Gd=(e,t)=>Rr(`${lr.v1}/emails/${e}/subscriptions/${t}`),$d=(e,t,n)=>Ur(`${lr.v1}/emails/${t}/subscriptions/${e}`,n),Vd=e=>Rr(`${lr.v1}/emails/${e}`),xd=()=>Lr(`${lr.v2}/sms`),jd=e=>{let{eventKey:t}=e,n=Xi(e,_d);return wr(`${lr.v2}/sms/${t}`,n)},Bd=({eventKey:e,enabled:t})=>Cr(`${lr.v2}/sms/${e}`,{enabled:t}),Wd=(e,t)=>Rr(`${lr.v2}/sms/${e}/subscriptions/${t}`),zd=(e,t,n)=>Ur(`${lr.v2}/sms/${t}/subscriptions/${e}`,n),Kd=e=>Rr(`${lr.v2}/sms/${e}`),qd=()=>Lr(vr),Hd=e=>e._id?Cr(`${vr}/${e._id}`,e):wr(`${vr}/custom`,e),Jd=e=>Rr(`${vr}/${e}`),Yd=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Lr(`${vr}/logs/?${i.toString()}`)},Qd=e=>wr(`${vr}/test`,e),Xd=e=>wr(`${vr}/logs/${e}/retries`),Zd=()=>Lr(`${Sr.v1}/categories`),ey=e=>Lr(Sr.v1,{channels:e});async function ty(e,t){return Ur(ar.v1,e,{headers:Nr(t)})}async function ny(e){return Lr(ar.v1,void 0,{headers:Nr(e)})}async function iy(){return Lr(`${ar.v1}/public`)}const oy=["roleId"],ay=["roleId"],ry=["permissionId"];async function sy(){return Lr(Ja.v1)}async function ly(e){return wr(Ja.v1,e)}async function cy({roleId:e}){return Rr(`${Ja.v1}/${e}`)}async function uy(e){let{roleId:t}=e,n=Xi(e,oy);return Cr(`${Ja.v1}/${t}`,n)}async function dy(e){let{roleId:t}=e,n=Xi(e,ay);return Ur(`${Ja.v1}/${t}/permissions`,n)}async function yy(){return Lr(qa.v1)}async function fy(e){let{permissionId:t}=e,n=Xi(e,ry);return Ur(`${qa.v1}/${t}/roles`,n)}async function py(){return Lr(`${qa.v1}/categories`)}async function gy(){return Lr(cr.subscriptions.v1)}async function Sy(e){return Lr(`${cr.subscriptions.v1}/${e}`)}async function vy(e){return Ur(`${cr.subscriptions.v1}/${e}/cancellations/`,{})}async function hy(e){return Ur(`${cr.subscriptions.v1}/${e}/renewals/`,{})}async function my(e,{paymentMethodId:t,planId:n}){return Ur(`${cr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Ay(e){return Lr(`${dr.v1}/${e}`)}async function by(){return Lr(`${dr.v1}`)}async function Ty(e){return Ur(`${dr.v1}/${e}/cancellations/`,{})}async function Ey(e){return Ur(`${dr.v1}/${e}/renewals/`,{})}async function ky(e,{paymentMethodId:t,planId:n}){return Ur(`${dr.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Oy(){return Lr(cr.plans.v1)}async function Iy(e){return Lr(`${cr.plans.v1}/${e}`)}async function Py(){return Lr(cr.invoices.v1)}async function _y(e){return Lr(`${cr.invoices.v1}/${e}`)}async function Ly(e,t){return Lr(`${cr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const wy=["email"];async function Cy(){return Lr(cr.paymentMethods.v1)}async function Uy(e){return Lr(`${cr.paymentMethods.v1}/${e}`)}async function Ry(e,t){let{email:n}=t,i=Xi(t,wy);return Cr(`${cr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function Dy(e){return wr(cr.paymentProviders.stripe.subscriptions.v1,e)}async function Ny(e){return Lr(`${cr.paymentProviders.stripe.customers.v1}/${e}`)}async function My(e){return wr(`${cr.paymentProviders.stripe.customers.v1}`,e)}async function Fy(){return Lr(`${cr.paymentProviders.stripe.publicConfigurations.v1}`)}async function Gy(e){return wr(`${cr.paymentProviders.stripe.setupIntents.v1}`,e)}async function $y(e){return Lr(`${cr.summaries.v1}/${e}`)}async function Vy(e){return Lr(`${cr.tenantConfiguration.v1}/${e}`)}async function xy(e){return wr(`${cr.tenantConfiguration.v1}`,e)}async function jy(){return Lr(ur.v1)}async function By(){return Lr(`${cr.configurations.vendorPublicConfigurations.v1}`)}let Wy,zy,Ky,qy,Hy,Jy;async function Yy(){return Lr("/vendors/public")}async function Qy(e){return Lr(Ya.v1,e)}async function Xy(e){return wr(Ya.v1,e)}async function Zy(e,t){return Rr(Ya.v1,e,{headers:Nr(t)})}async function ef(e,t,n){return wr(`${Ya.v1}/${e}/roles`,t,{headers:Nr(n)})}async function tf(e,t,n){return Rr(`${Ya.v1}/${e}/roles`,t,{headers:Nr(n)})}async function nf(e,t,n){return Cr(`${Ya.v1}/${e}/roles`,t,{headers:Nr(n)})}async function of(e,t){return wr(sr.v1,e,{headers:Nr(t)})}async function af(e,t){return Rr(`${sr.v1}/${e}`,void 0,{headers:Nr(t)})}async function rf({tenantId:e},t,n){return Cr(`${sr.v1}/${e}`,t,{headers:Nr(n)})}async function sf(e,t,n){return Ur(`${Ya.v1}/${e}/access`,t,{headers:Nr(n)})}async function lf(e,t){return wr(`${Ya.v2}/`,e,{headers:Nr(t)})}async function cf(){return Lr(`${Ar}`)}async function uf(e,t){return Cr(`${Ar}/${e}`,t)}async function df(e){return wr(`${Ar}`,e)}async function yf(e){return Rr(`${Ar}/${e}`)}async function ff(e){return Lr(`${br}/${e}/Users/count`)}async function pf(e){return wr(`${Qa.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Wy||(Wy={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(zy||(zy={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Ky||(Ky={})),(qy||(qy={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Hy||(Hy={})),function(e){e.CREATE="create_customer"}(Jy||(Jy={}));const gf=["groupId"];async function Sf({groupId:e},t){return Lr(`${Xa.v1}/${e}`,D({},t))}async function vf(e){return Lr(`${Xa.v1}`,D({},e))}async function hf(e,t){return wr(`${Xa.getByIds.v1}`,e,{params:t})}async function mf(e){return wr(`${Xa.v1}`,e)}async function Af(e){let{groupId:t}=e,n=Xi(e,gf);return Cr(`${Xa.v1}/${t}`,n)}async function bf(e){return Rr(`${Xa.v1}/${e}`)}async function Tf(e,t){return wr(`${Xa.v1}/${e}/roles`,t)}async function Ef(e,t){return Rr(`${Xa.v1}/${e}/roles`,t)}async function kf(e,t){return wr(`${Xa.v1}/${e}/users`,t)}async function Of(e,t){return Rr(`${Xa.v1}/${e}/users`,t)}async function If(){return Lr(`${Xa.configurations.v1}`)}async function Pf(e){return wr(`${Xa.configurations.v1}`,e)}async function _f(){return Lr(kr.v1)}async function Lf(){return Lr(Or.v1)}async function wf(e){return Lr(`${Za.v1}`,e)}async function Cf(e){return wr(`${Za.v1}`,e)}async function Uf(e){return Rr(`${Za.v1}/${e}`)}async function Rf(e){return wr(`${Za.v1}/preverify`,e)}async function Df(e){return wr(`${Za.v1}/verify`,e)}async function Nf(e,t){return wr(`${Za.v1}/${e}/delete/verify`,t)}let Mf,Ff,Gf;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Mf||(Mf={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(Ff||(Ff={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Gf||(Gf={}));const $f=[/^(.*)\/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],Vf=`${ja.v1}/user/token/refresh`,xf=`${hr}/authorize/silent`,jf=`${Ba.v2}/me`,Bf=`${Ba.v2}/me/tenants`,Wf=`${Ba.v3}/me/tenants`;let zf,Kf,qf,Hf,Jf,Yf,Qf,Xf;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(zf||(zf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Kf||(Kf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(qf||(qf={})),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"}(Hf||(Hf={})),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"}(Jf||(Jf={})),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"}(Yf||(Yf={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(Qf||(Qf={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(Xf||(Xf={}));const Zf={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 ep={fetch:e,ContextHolder:Ga,FronteggContext:$a,api:Zf,FronteggApiError:Va,AuthStrategyEnum:Oi,MachineToMachineAuthStrategy:Ii,SocialLoginProviders:ki,ISubscriptionCancellationPolicy:Ky,ISubscriptionStatus:Wy,PaymentMethodType:zy,ProviderType:qy};let tp,np;!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"}(tp||(tp={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(np||(np={}));const ip="input is invalid type",op="undefined"!=typeof ArrayBuffer,ap="0123456789abcdef".split(""),rp=[-2147483648,8388608,32768,128],sp=[24,16,8,0],lp=[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],cp=["hex","array","digest","arrayBuffer"],up=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),op&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const dp=function(e){return function(t){const n=new fp(!0).update(t);return null==n?void 0:n[e]()}},yp=function(e){return function(t,n){const i=new pp(t,!0).update(n);return null==i?void 0:i[e]()}};class fp{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=()=>fp.prototype.digest(),e?(up[0]=up[16]=up[1]=up[2]=up[3]=up[4]=up[5]=up[6]=up[7]=up[8]=up[9]=up[10]=up[11]=up[12]=up[13]=up[14]=up[15]=0,this.blocks=up):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(ip);if(null===e)throw new Error(ip);if(op&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||op&&ArrayBuffer.isView(e)))throw new Error(ip);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]<<sp[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<sp[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<sp[3&o++],s[o>>2]|=(128|63&i)<<sp[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<sp[3&o++],s[o>>2]|=(128|i>>6&63)<<sp[3&o++],s[o>>2]|=(128|63&i)<<sp[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<sp[3&o++],s[o>>2]|=(128|i>>12&63)<<sp[3&o++],s[o>>2]|=(128|i>>6&63)<<sp[3&o++],s[o>>2]|=(128|63&i)<<sp[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]|=rp[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+lp[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+lp[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+lp[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+lp[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=ap[e>>28&15]+ap[e>>24&15]+ap[e>>20&15]+ap[e>>16&15]+ap[e>>12&15]+ap[e>>8&15]+ap[e>>4&15]+ap[15&e]+ap[t>>28&15]+ap[t>>24&15]+ap[t>>20&15]+ap[t>>16&15]+ap[t>>12&15]+ap[t>>8&15]+ap[t>>4&15]+ap[15&t]+ap[n>>28&15]+ap[n>>24&15]+ap[n>>20&15]+ap[n>>16&15]+ap[n>>12&15]+ap[n>>8&15]+ap[n>>4&15]+ap[15&n]+ap[i>>28&15]+ap[i>>24&15]+ap[i>>20&15]+ap[i>>16&15]+ap[i>>12&15]+ap[i>>8&15]+ap[i>>4&15]+ap[15&i]+ap[o>>28&15]+ap[o>>24&15]+ap[o>>20&15]+ap[o>>16&15]+ap[o>>12&15]+ap[o>>8&15]+ap[o>>4&15]+ap[15&o]+ap[a>>28&15]+ap[a>>24&15]+ap[a>>20&15]+ap[a>>16&15]+ap[a>>12&15]+ap[a>>8&15]+ap[a>>4&15]+ap[15&a]+ap[r>>28&15]+ap[r>>24&15]+ap[r>>20&15]+ap[r>>16&15]+ap[r>>12&15]+ap[r>>8&15]+ap[r>>4&15]+ap[15&r];return l+=ap[s>>28&15]+ap[s>>24&15]+ap[s>>20&15]+ap[s>>16&15]+ap[s>>12&15]+ap[s>>8&15]+ap[s>>4&15]+ap[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 pp extends fp{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(ip);if(null===e)throw new Error(ip);if(op&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||op&&ArrayBuffer.isView(e)))throw new Error(ip)}var o;e.length>64&&(e=null==(o=new fp(!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}fp.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();fp.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),fp.prototype.finalize.call(this)}}}const gp=function(){const e=dp("hex");e.create=function(){return new fp},e.update=function(t){return e.create().update(t)};for(let t=0;t<cp.length;++t){const n=cp[t];e[n]=dp(n)}return e}();function Sp(e,t){const n=D({},e);return t.forEach((e=>{delete n[e]})),n}async function vp(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=gp.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function hp(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=yp("hex");e.create=function(e){return new pp(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<cp.length;++t){const n=cp[t];e[n]=yp(n)}}();const mp=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*Ap(e){const t=yield Bo((e=>e.root.appName));return $r.getFeatureFlags(e,t)}const bp={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Tp=D({},bp,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Ep=[{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"}],kp={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},Op=D({},kp,{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}),Ip={loading:!1,error:void 0,saving:!0,profile:kp},Pp={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"},_p={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Oi.EmailAndPassword,machineToMachineAuthStrategy:Ii.ClientCredentials},Lp={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},wp={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Cp={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Up={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},Rp={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Dp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Np={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Up,roles:Dp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Mp=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Fp={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:[Ep[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[Ep[0]],managedBy:qf.FRONTEGG}]},Gp={id:Fp.id,email:Fp.email,name:Fp.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:[Ep[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},$p={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:[Ep[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[Ep[0]],managedBy:qf.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:[Ep[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},xp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},jp=[$p,Fp],Bp=[Vp,Gp],Wp=[xp],zp=[{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}],Kp=[{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"}],qp={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Hp={isActive:!0,strategy:zn.ALLOW},Jp=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:zn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:zn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:zn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:zn.BLOCK,description:"IP 4"}],Yp=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(D({},$p,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Qp=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"}),Xp=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Yp(6),roles:[Qp("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:qf.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Yp(44),roles:[Qp("Editor")],managedBy:qf.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Yp(8),roles:[Qp("Viewer")],managedBy:qf.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Yp(5),roles:[Qp("Admin")],managedBy:qf.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Yp(21),description:"BDR, AE, and inside sales",roles:[Qp("Viewer")],managedBy:qf.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Yp(23),description:"Dev success and customer success",roles:[Qp("Admin")],managedBy:qf.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Yp(10),description:"The marketing department",roles:[Qp("Viewer")],managedBy:qf.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Yp(4),description:"Human resources",roles:[Qp("Viewer")],managedBy:qf.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Yp(3),roles:[Qp("Viewer")],managedBy:qf.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Yp(8),roles:[Qp("Editor")],managedBy:qf.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Yp(4),roles:[Qp("Viewer")],managedBy:qf.FRONTEGG}],Zp={scoring:{score:79},recommendations:{items:[{code:Hf.FORCE_MFA,severity:Qf.WARNING,category:Xf.MFA},{code:Hf.ENABLE_FORCE_RELOGIN,severity:Qf.WARNING,category:Xf.SESSIONS}]}},eg={insights:{items:[{category:Xf.MFA,code:Jf.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:Xf.SESSIONS,code:Jf.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:Xf.PASSWORD,code:Jf.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:Xf.DOMAIN,code:Jf.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},tg={users:Bp,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},ng={users:[Bp[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},ig={users:[Bp[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0};let og,ag,rg;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(og||(og={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(ag||(ag={})),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"}(rg||(rg={})),rg.profile,rg.privacy,rg.personalApiTokens,rg.account,rg.users,rg.groups,rg.security,rg.sso,rg.audits,rg.webhooks,rg.apiTokens,rg.roles,rg.subscriptions,rg.allAccounts;const sg=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},lg=e=>{const{pathname:t}=new URL(e),n=sg(e);return n?t+n:t},cg=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},ug="tenantId",dg=e=>e.mfaRequired&&e.mfaToken?(Ga.setAccessToken(null),Ga.setUser(null),!0):(Ga.setAccessToken(e.accessToken),Ga.setUser(e),!1),yg=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return un.authenticatorApp;if(t)return un.smsVerifyCode}return un.verify},fg=e=>{if(1===e.length){const[t]=e;if(t===$s.AuthenticatorApp)return un.authenticatorApp;if(t===$s.SMS)return un.smsSetPhoneNumber;if(t===$s.EmailCode)return un.emailVerifyCode}return un.verify};function*pg(e){let t=_t.loginWithTwoFactor,n={};const{loginState:i}=yield Bo((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield Vo(Zf.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:yg(e.mfaDevices)}:(n={step:fg(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 gg=(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 Sg;function vg(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"}(Sg||(Sg={}));const hg=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,...hg(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),mg=["callback"];function*Ag(){yield Fo($i.setCustomLoginState({loading:!0}));try{const e=yield Vo(Zf.metadata.getAdminBoxMetadata);yield Fo($i.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield Fo($i.setCustomLoginState({loading:!1,error:gg(e)}))}}function*bg(e){let{payload:{callback:t}}=e,n=Xi(e.payload,mg);try{yield Fo($i.setCustomLoginState({error:null,saving:!0}));const e=hg(n);if(0===e.length)throw new Error("No changes to update");yield Vo(Zf.metadata.updateAdminBoxMetadata,{actions:e});const i=yield Vo(Zf.metadata.getAdminBoxMetadata);yield Fo($i.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield Fo($i.setCustomLoginState({error:gg(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Tg(){var e,t,n;if(yield Bo((e=>e.auth.isAuthenticated))){var i;const e=yield null!=(i=Bo((({auth:e})=>{var t;return null==(t=e.tenantsState.activeTenant)?void 0:t.hasCustomLogin})))&&i;return e}return!!(null==(e=yield null==(t=Ga.getContext())||null==(n=t.tenantResolver)?void 0:n.call(t))?void 0:e.tenant)}function*Eg(){try{var e;if(!(yield Vo(Tg)))return;const t=yield Bo((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:i}=Zf.accountSettings,{applicationUrl:o}=yield Vo(t?n:i);if(!o)return;const{routes:a}=yield Bo((e=>e.auth)),r=null!=(e=sg(o))?e:"";yield Fo($i.setState({routes:D({},a,{customLoginAuthenticatedUrl:o,customLoginUrl:a.loginUrl+r})})),yield Fo($i.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*kg(){yield Fa($i.loadTenantMetadata,Ag),yield Fa($i.updateTenantMetadata,bg)}let Og;!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"}(Og||(Og={}));const Ig=["callback"];function Pg(e){return function*(t){const[n]=yield Vo(Ap,["security-center-admin-portal-major-version"]);yield e(t),n&&(yield _g(),yield Lg())}}function*_g(){const e=Og.RECOMMENDATIONS;yield Fo($i.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:i}=yield Vo(Zf.securityCenter.getRecommendations);yield Fo($i.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==i?void 0:i.score)?t:0}))}catch(t){yield Fo($i.setSecurityCenterStateError({key:e,value:gg(t)}))}finally{yield Fo($i.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Lg(){const e=Og.INSIGHTS;yield Fo($i.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield Vo(Zf.securityCenter.getInsights);yield Fo($i.setSecurityCenterState({insights:t.items}))}catch(t){yield Fo($i.setSecurityCenterStateError({key:e,value:gg(t)}))}finally{yield Fo($i.setSecurityCenterStateLoader({key:e,value:!1}))}}function*wg(e){let{payload:{callback:t}}=e,n=Xi(e.payload,Ig);const i=Og.SEND_BREACHED_PASSWORD_EMAIL;yield Fo($i.setSecurityCenterStateError({key:i,value:!1})),yield Fo($i.setSecurityCenterStateLoader({key:i,value:!0}));try{yield Vo(Zf.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield Fo($i.setSecurityCenterStateError({key:i,value:gg(e)})),null==t||t(!1,e)}finally{yield Fo($i.setSecurityCenterStateLoader({key:i,value:!1}))}}function*Cg({payload:{callback:e}}){const t=Og.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield Fo($i.setSecurityCenterStateError({key:t,value:!1})),yield Fo($i.setSecurityCenterStateLoader({key:t,value:!0}));try{yield Vo(Zf.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield Fo($i.setSecurityCenterStateError({key:t,value:gg(n)})),null==e||e(!1)}finally{yield Fo($i.setSecurityCenterStateLoader({key:t,value:!1}))}}function*Ug({key:e,tableState:t,updateStateKey:n,_offset:i,_limit:o,_preset:a,_email:r,_maxInactiveSeconds:s}){var l,c,u,d;yield Fo($i.setSecurityCenterStateError({key:e,value:!1})),yield Fo($i.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 Vo(Zf.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 Vo(Zf.roles.getRoles),i=yield Vo(Zf.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 Fo($i.setSecurityCenterState({[n]:D({users:e},a)}))}else yield Fo($i.setSecurityCenterState({[n]:D({users:[]},a)}))}catch(t){yield Fo($i.setSecurityCenterStateError({key:e,value:gg(t)}))}finally{yield Fo($i.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Rg({payload:e}){var t;const n=Og.BREACHED_PASSWORD_USERS_TABLE,i=yield null!=(t=Bo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield Ug(D({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:pi.BREACHED_PASSWORDS,tableState:i},e))}function*Dg({payload:e}){var t;const n=Og.UNENROLLED_MFA_USERS_TABLE,i=yield null!=(t=Bo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield Ug(D({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:pi.MFA_UNENROLLED,tableState:i},e))}function*Ng({payload:e}){var t;const n=Og.INACTIVE_USERS_TABLE,i=yield null!=(t=Bo((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield Ug(D({key:n,updateStateKey:"inactiveUsersTable",_preset:pi.INACTIVE,tableState:i},e))}function*Mg(){yield Na($i.loadRecommendations,_g),yield Na($i.loadInsights,Lg),yield Na($i.sendResetBreachedPasswordEmail,wg),yield Na($i.sendBulkResetBreachedPasswordEmails,Cg),yield Na($i.loadBreachedPasswordUsers,Rg),yield Na($i.loadUnenrolledMfaUsers,Dg),yield Na($i.loadInactiveUsers,Ng)}function*Fg(){const e=Og.RECOMMENDATIONS;yield Fo($i.setSecurityCenterStateLoader({key:e,value:!0})),yield Wo(500),yield Fo($i.setSecurityCenterState({recommendations:Zp.recommendations.items,score:Zp.scoring.score})),yield Fo($i.setSecurityCenterStateLoader({key:e,value:!1}))}function*Gg(){const e=Og.INSIGHTS;yield Fo($i.setSecurityCenterStateLoader({key:e,value:!0})),yield Wo(500),yield Fo($i.setSecurityCenterState({insights:eg.insights.items})),yield Fo($i.setSecurityCenterStateLoader({key:e,value:!1}))}function*$g(){const e=Og.BREACHED_PASSWORD_USERS_TABLE;yield Fo($i.setSecurityCenterStateLoader({key:e,value:!0})),yield Wo(500),yield Fo($i.setSecurityCenterState({breachedPasswordUsersTable:tg})),yield Fo($i.setSecurityCenterStateLoader({key:e,value:!1}))}function*Vg(){const e=Og.UNENROLLED_MFA_USERS_TABLE;yield Fo($i.setSecurityCenterStateLoader({key:e,value:!0})),yield Wo(500),yield Fo($i.setSecurityCenterState({unenrolledMfaUsersTable:ig})),yield Fo($i.setSecurityCenterStateLoader({key:e,value:!1}))}function*xg(){const e=Og.INACTIVE_USERS_TABLE;yield Fo($i.setSecurityCenterStateLoader({key:e,value:!0})),yield Wo(500),yield Fo($i.setSecurityCenterState({inactiveUsersTable:ng})),yield Fo($i.setSecurityCenterStateLoader({key:e,value:!1}))}function*jg({payload:{callback:e}}){const t=Og.SEND_BREACHED_PASSWORD_EMAIL;yield Fo($i.setSecurityCenterStateLoader({key:t,value:!0})),yield Wo(500),null==e||e(!0),yield Fo($i.setSecurityCenterStateLoader({key:t,value:!1}))}function*Bg(){yield Na($i.loadRecommendations,Fg),yield Na($i.loadInsights,Gg),yield Na($i.loadBreachedPasswordUsers,$g),yield Na($i.loadUnenrolledMfaUsers,Vg),yield Na($i.loadInactiveUsers,xg),yield Na($i.sendResetBreachedPasswordEmail,jg)}const Wg=["callback"],zg=["callback"],Kg=["callback"],qg=["callback"],Hg=["callback"],Jg=["callback"];function*Yg(){yield Fo($i.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Vo(Zf.auth.getGlobalSecurityPolicy);yield Fo($i.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Fo($i.setSecurityPolicyGlobalState({error:gg(e),loading:!1}))}yield Fo($i.loadSecurityPolicyMfa()),yield Fo($i.loadSecurityPolicyVendorMfa()),yield Fo($i.loadSecurityPolicyLockout()),yield Fo($i.loadSecurityPolicyVendorLockout()),yield Fo($i.loadSecurityPolicyVendorPasswordHistory()),yield Fo($i.loadSecurityPolicyCaptcha()),yield Fo($i.loadPublicAuthStrategiesPolicy())}function*Qg(e){var t,n;if(!(yield Vo(Tg)))return e;const i=yield Vo(Zg);return null!=i&&null!=(t=i.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?D({},e,{authStrategy:i.mainAuthStrategies[0].strategy}):e}function*Xg(){yield Fo($i.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Vo(Zf.auth.getVendorConfig),t=yield Qg(e);yield Fo($i.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Fo($i.setSecurityPolicyPublicState({error:gg(e),loading:!1}))}}function*Zg(){const e=yield Bo((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Vo(Zf.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield Vo(Zf.auth.getVendorPublicAuthStrategiesConfig),t}function*eS(){yield Fo($i.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield Vo(Zg);yield function*(e){const t=yield Vo(Tg);if(!e||!t)return;const{policy:n}=yield Bo((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield Fo($i.setSecurityPolicyPublicState({policy:D({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield Fo($i.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield Fo($i.setSecurityPolicyAuthStrategyPublicState({error:gg(e),loading:!1}))}}function*tS(){yield Fo($i.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Vo(Zf.auth.getMfaPolicy);yield Fo($i.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Fo($i.setSecurityPolicyMfaState({error:gg(e),loading:!1}))}}function*nS(){yield Fo($i.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Vo(Zf.auth.getVendorMfaPolicy);yield Fo($i.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Fo($i.setSecurityPolicyVendorMfaState({error:gg(e),loading:!1}))}}function*iS(e){let{payload:{callback:t}}=e,n=Xi(e.payload,Wg);yield Fo($i.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Vo(Zf.auth.saveMfaPolicy,n);yield Fo($i.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Fo($i.setSecurityPolicyMfaState({saving:!1,error:gg(e)})),null==t||t(null,e)}}function*oS(){yield Fo($i.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Vo(Zf.auth.getLockoutPolicy);yield Fo($i.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Fo($i.setSecurityPolicyLockoutState({error:gg(e),loading:!1}))}}function*aS(e){let{payload:{callback:t}}=e,n=Xi(e.payload,zg);yield Fo($i.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Vo(Zf.auth.saveLockoutPolicy,n);yield Fo($i.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Fo($i.setSecurityPolicyLockoutState({saving:!1,error:gg(e)})),null==t||t(null,e)}}function*rS(){yield Fo($i.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Vo(Zf.auth.getVendorLockoutPolicy);yield Fo($i.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield Fo($i.setSecurityPolicyVendorLockoutState({error:gg(e),loading:!1}))}}function*sS(){yield Fo($i.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Vo(Zf.auth.getCaptchaPolicy);yield Fo($i.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Fo($i.setSecurityPolicyCaptchaState({error:gg(e),loading:!1}))}}function*lS(){yield Fo($i.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Vo(Zf.auth.getPasswordHistoryPolicy);yield Fo($i.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Fo($i.setSecurityPolicyPasswordHistoryState({error:gg(e),loading:!1}))}}function*cS(){yield Fo($i.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Vo(Zf.auth.getVendorPasswordHistoryPolicy);yield Fo($i.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Fo($i.setSecurityPolicyVendorPasswordHistoryState({error:gg(e),loading:!1}))}}function*uS(e){let{payload:{callback:t}}=e,n=Xi(e.payload,Kg);yield Fo($i.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Vo(Zf.auth.savePasswordHistoryPolicy,n);yield Fo($i.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Fo($i.setSecurityPolicyPasswordHistoryState({saving:!1,error:gg(e)})),null==t||t(null,e)}}function*dS(){yield Fo($i.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Vo(Zf.auth.getPasswordConfigPolicy);yield Fo($i.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Fo($i.setSecurityPolicyPasswordState({error:gg(e),loading:!1}))}}function*yS(){yield Fa($i.loadSecurityPolicy,Yg),yield Na($i.saveSecurityPolicyMfa,Pg(iS)),yield Na($i.loadSecurityPolicyMfa,tS),yield Na($i.loadSecurityPolicyVendorMfa,nS),yield Na($i.saveSecurityPolicyLockout,Pg(aS)),yield Na($i.loadSecurityPolicyLockout,oS),yield Na($i.loadSecurityPolicyVendorLockout,rS),yield Na($i.loadSecurityPolicyCaptcha,sS),yield Na($i.saveSecurityPolicyPasswordHistory,Pg(uS)),yield Na($i.loadSecurityPolicyPasswordHistory,lS),yield Na($i.loadSecurityPolicyVendorPasswordHistory,cS),yield Na($i.loadVendorPasswordConfig,dS),yield Na($i.loadPublicSecurityPolicy,Xg),yield Na($i.loadPublicAuthStrategiesPolicy,eS)}function*fS(){yield Fo($i.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Fo($i.setSecurityPolicyPublicState({policy:_p,loading:!1}))}catch(e){yield Fo($i.setSecurityPolicyPublicState({error:gg(e),loading:!1}))}}function*pS(){yield Fo($i.setSecurityPolicyGlobalState({loading:!0,error:null})),yield Et(),yield Fo($i.setSecurityPolicyGlobalState({policy:Pp,loading:!1})),yield Fo($i.loadSecurityPolicyMfa()),yield Fo($i.loadSecurityPolicyVendorMfa()),yield Fo($i.loadSecurityPolicyLockout()),yield Fo($i.loadSecurityPolicyVendorLockout()),yield Fo($i.loadSecurityPolicyPasswordHistory()),yield Fo($i.loadSecurityPolicyVendorPasswordHistory()),yield Fo($i.loadSecurityPolicyCaptcha())}function*gS(){yield Fo($i.setSecurityPolicyMfaState({loading:!0,error:null})),yield Et(),yield Fo($i.setSecurityPolicyMfaState({policy:Lp,loading:!1}))}function*SS(){yield Fo($i.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield Et(),yield Fo($i.setSecurityPolicyVendorMfaState({policy:Lp,loading:!1}))}function*vS(e){var t;let{payload:{callback:n}}=e,i=Xi(e.payload,qg);yield Fo($i.setSecurityPolicyMfaState({saving:!0,error:null}));const o=D({},wp,{id:null!=(t=i.id)?t:wp.id,enforceMFAType:i.enforceMFAType});yield Et(),yield Fo($i.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*hS(){yield Fo($i.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield Fo($i.setSecurityPolicyLockoutState({policy:wp,loading:!1}))}function*mS(){yield Fo($i.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield Et(),yield Fo($i.setSecurityPolicyVendorLockoutState({policy:wp,loading:!1}))}function*AS(e){let{payload:{callback:t}}=e,n=Xi(e.payload,Hg);yield Fo($i.setSecurityPolicyLockoutState({saving:!0,error:null})),yield Et();const i=D({},wp,n,{id:n.id?n.id:wp.id});null==t||t(i),yield Fo($i.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*bS(){yield Fo($i.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield Fo($i.setSecurityPolicyLockoutState({policy:wp,loading:!1}))}function*TS(){yield Fo($i.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield Et(),yield Fo($i.setSecurityPolicyPasswordHistoryState({policy:Cp,loading:!1}))}function*ES(){yield Fo($i.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield Et(),yield Fo($i.setSecurityPolicyVendorPasswordHistoryState({policy:Cp,loading:!1}))}function*kS(e){let{payload:{callback:t}}=e,n=Xi(e.payload,Jg);yield Fo($i.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield Et();const i=D({},Cp,n,{id:n.id?n.id:Cp.id});null==t||t(i),yield Fo($i.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*OS(){yield Fa($i.loadSecurityPolicy,pS),yield Na($i.loadPublicSecurityPolicy,fS),yield Na($i.saveSecurityPolicyMfa,vS),yield Na($i.loadSecurityPolicyMfa,gS),yield Na($i.loadSecurityPolicyVendorMfa,SS),yield Na($i.saveSecurityPolicyLockout,AS),yield Na($i.loadSecurityPolicyLockout,hS),yield Na($i.loadSecurityPolicyVendorLockout,mS),yield Na($i.loadSecurityPolicyCaptcha,bS),yield Na($i.saveSecurityPolicyPasswordHistory,kS),yield Na($i.loadSecurityPolicyPasswordHistory,TS),yield Na($i.loadSecurityPolicyVendorPasswordHistory,ES)}const IS=["phoneNumber"],PS=["events","url"];function*_S(){yield Fo($i.setSignUpState({loading:!0}));try{const e=yield Vo(Zf.auth.getVendorConfig),t=yield Qg(e),{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield Fo($i.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield Fo($i.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Fo($i.setSignUpState({loading:!1,error:gg(e),firstLoad:!1}))}}function*LS(e){let{payload:{events:t,url:n}}=e,i=Xi(e.payload,PS);yield Fo($i.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:r}=yield Bo((e=>e.auth)),{shouldActivate:s,user:l,tenantId:c,userId:u,tenants:d=[],activeTenant:y}=yield Vo(Zf.auth.signUpUser,(a=i,Xi(a,IS)));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:ag.PASSWORD,id:u,tenantId:c,createdAt:new Date};null==t||null==(o=t.signUpComplete)||o.call(t,l),vg(Sg.SIGNUP_COMPLETED,l)}if(!s&&l&&dg(l)){const t=yield pg(l);yield Fo($i.setState(t)),r(e.loginUrl)}else{const{tenantsState:e}=yield Bo((e=>e.auth));yield Fo($i.setSignUpState({loading:!1,shouldActivate:s,stage:An.SignUpSuccess})),yield Fo($i.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:D({},e,{tenants:d,activeTenant:y})}))}}catch(e){Ga.setAccessToken(null),Ga.setUser(null),yield Fo($i.setSignUpState({loading:!1,error:gg(e)}))}var a;yield Fo($i.setSignUpState({loading:!1}))}function*wS(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Bo((e=>e.auth.signUpState));yield Fo($i.resetSignUpState()),yield Fo($i.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*CS(){yield Fa($i.signUpUser,LS),yield Fa($i.resetSignUpStateSoft,wS)}const US={setVendorState:(e,{payload:t})=>D({},e,t)},RS={loadVendorPublicInfo:yt("vendor/loadVendorPublicInfo")},DS={loading:!1},{reducer:NS,actions:MS}=pt({name:Ft,initialState:DS,reducers:D({},US)}),FS=D({},MS,RS);function*GS(){yield Fo(FS.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Zf.vendor.getVendorPublicInfo();yield Fo(FS.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Fo(FS.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var $S=n(378),VS=n.n($S);function xS(e,t){return VS()(e,t)}function*jS({payload:e}){const t=null==e?void 0:e.callback,[n]=yield Vo(Ap,[Fr]);try{const e=yield Vo(n?Zf.entitlements.loadEntitlementsV2:Zf.entitlements.loadEntitlements);yield function*(e){xS(yield Bo((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield Fo($i.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*BS(){yield Fa($i.loadEntitlements,jS)}var WS=new class{constructor(){this.loginWithSSO=e=>{if(this.isWebkitAvailable()){var t,n,i;null==(t=window.webkit)||null==(n=t.messageHandlers)||null==(i=n.FronteggNativeBridge)||i.postMessage(JSON.stringify({action:"loginWithSSO",payload:e}))}else{if(!this.isJsInterfaceAvailable())throw new Error("FronteggNativeBridge is not available");var o;null==(o=window.FronteggNativeBridge)||o.loginWithSSO(e)}},this.loginWithSocialLogin=e=>{if(this.isWebkitAvailable()){var t,n,i;null==(t=window.webkit)||null==(n=t.messageHandlers)||null==(i=n.FronteggNativeBridge)||i.postMessage(JSON.stringify({action:"loginWithSocialLogin",payload:e}))}else{if(!this.isJsInterfaceAvailable())throw new Error("FronteggNativeBridge is not available");var o;null==(o=window.FronteggNativeBridge)||o.loginWithSocialLogin(e)}}}isWebkitAvailable(){var e,t;return null!=(null==(e=window.webkit)||null==(t=e.messageHandlers)?void 0:t.FronteggNativeBridge)}isJsInterfaceAvailable(){return null!=window.FronteggNativeBridge}isAvailable(e){var t,n;return!(!this.isWebkitAvailable()&&!this.isJsInterfaceAvailable())&&null!=(t=null==(n=window.FronteggNativeBridgeFunctions)?void 0:n[e])&&t}};const zS=["callback"],KS=["callback"],qS=["callback"],HS=["callback"],JS=["callback","events"],YS=["callback"],QS=["callback"],XS=["callback"],ZS=["callback"],ev=["user"],tv=["callback"],nv=["callback"],iv=["callback"],ov=["callback"],av=["callback"],rv=["callback","deviceId"],sv=["callback"],lv=["callback"],cv=["callback","deviceId"],uv=["callback","deviceId"],dv=["callback","deviceId"];function*yv(e){const t=yield Bo((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return xS(t,null==e?void 0:e.entitlements)?D({},e,{entitlements:t}):e}function*fv({user:e,tenants:t=[],activeTenant:n},i={}){const{tenantsState:o}=yield Bo((e=>e.auth));yield Fo($i.setState(D({user:e,tenantsState:D({},o,{tenants:t,activeTenant:n,loading:!1})},i)))}function*pv(){const e=Ga.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield Bo((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:s,activateUrl:l}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;u||(yield Vo(Eg),u=yield Bo((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})));const d=window.localStorage.getItem(Ut);d&&![a,r,s,l].includes(d)&&(c=d),window.localStorage.removeItem(Ut),yield Et(200),Fo($i.resetLoginState());const y=(({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?lg(u):c,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});e(y,{refresh:y.startsWith("http")})}function*gv(){let e;try{var t;const n=yield Vo(Zf.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield Fo($i.setState({ssoACS:e}))}function*Sv(){try{const{isActive:e}=yield Vo(Zf.auth.getSSOPublicConfiguration);yield Fo($i.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*vv(e){var t;const{routes:n,loginState:i}=yield Bo((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*hv(){const{hostedLoginBox:e}=yield Bo((e=>e.auth));e?yield Vo(mv):yield Vo(bv)}function*mv(){const{user:e}=yield Bo((e=>e.auth));if(null==e||!e.refreshToken)return Ga.setAccessToken(null),Ga.setUser(null),void(yield Fo($i.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Vo(Zf.auth.exchangeOAuthTokensV2,t),i=yield Vo(yv,n.user);yield Vo(fv,D({},n,{user:i}),{isAuthenticated:!0})}catch(e){Ga.setAccessToken(null),Ga.setUser(null),yield Fo($i.setState({user:null,isAuthenticated:!1}))}}function*Av(){const{user:e}=yield Bo((e=>e.auth));if(null==e||!e.refreshToken)return Ga.setAccessToken(null),Ga.setUser(null),void(yield Fo($i.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Vo(Zf.auth.exchangeOAuthTokensV2,t),i=yield Vo(yv,n.user);yield Vo(fv,D({},n,{user:i}),{isAuthenticated:!0})}catch(e){Ga.setAccessToken(null),Ga.setUser(null),yield Fo($i.setState({user:null,isAuthenticated:!1}))}}function*bv(){try{const t=Ga.onRedirectTo,{routes:n,loginState:i}=yield Bo((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield Vo(Zf.auth.refreshTokenV3);if(dg(o)){const e=yield pg(o);yield Fo($i.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 vv(o),s=yield Vo(yv,o);yield Vo(fv,{user:s,tenants:a,activeTenant:r},{loginState:D({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield Ev(n)}}catch(e){Ga.setAccessToken(null),Ga.setUser(null),yield Fo($i.setState({user:void 0,isAuthenticated:!1}))}}function*Tv(){try{const t=Ga.onRedirectTo,{routes:n,loginState:i}=yield Bo((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield Vo(Zf.auth.refreshTokenV3);if(dg(o)){const e=yield pg(o);yield Fo($i.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const s=yield Vo(yv,o);if(yield Vo(Gv))yield Fo($i.setLoginState({step:_t.promptPasskeys,loading:!1})),yield Vo(fv,{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 vv(o);yield Vo(fv,{user:s,tenants:a,activeTenant:r},{loginState:D({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield Ev(n)}}}catch(e){Ga.setAccessToken(null),Ga.setUser(null),yield Fo($i.setState({user:void 0,isAuthenticated:!1}))}}function*Ev(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=Ga.onRedirectTo,{routes:o,loginState:a}=yield Bo((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 pv())}function*kv({payload:{callback:e}}){try{const{ip:t}=yield Vo(Zf.metadata.getCurrentUserIpMetadata);yield Fo($i.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*Ov({payload:e}){const t=[];(yield Vo(Tg))?yield Vo(hv):t.push(Vo(hv)),e&&(yield Fo($i.setState({isLoading:!0})),yield Fo($i.loadSocialLoginsConfigurationV2()),t.push(Vo(_S)),t.push(Vo(eS)),t.push(Vo(Sv)),t.push(Vo(GS)),t.push(Vo(gv)),t.push(Vo(Eg))),yield Go(t),yield Fo($i.setState({isLoading:!1}))}function*Iv({accessToken:e,user:t}){if(!e)return void(yield Fo($i.setState({user:void 0,isAuthenticated:!1})));const n=Ga.onRedirectTo,{routes:i}=yield Bo((e=>e.auth));if(dg(t)){const e=yield pg(t);yield Fo($i.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*Pv({payload:e}){const t=[];yield Fo($i.loadSocialLoginsConfigurationV2()),t.push(Vo(_S)),t.push(Vo(Sv)),t.push(Vo(GS)),t.push(Vo(gv)),t.push(Vo(Iv,e)),t.push(Vo(Eg)),yield Go(t)}const _v=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*Lv(){const e=yield Vo(Zf.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield Vo(fv,e,{isAuthenticated:!0,isLoading:!1})}function*wv({payload:e}){const{disableSilentRefresh:t}=yield Bo((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if("login"!==(null==e?void 0:e.prompt))try{if(t)throw new Error("silent refresh is disabled");yield Lv()}catch(t){yield Uv(e)}else yield Uv(e)}function*Cv({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n,loginDirectAction:i}}){var o;if(n){const{urlStrategy:e}=yield Bo((e=>({urlStrategy:e.root.urlStrategy}))),t=_v(e);if(yield Fo($i.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:a}=yield Bo((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if(i&&((e=e||{}).login_direct_action=btoa(JSON.stringify(i))),"login"!==(null==(o=e)?void 0:o.prompt))try{if(a)throw new Error("silent refresh is disabled");yield Lv()}catch(n){if(!t)return void(yield Fo($i.setState({isLoading:!1})));yield Uv(e)}else yield Uv(e)}function*Uv(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield Bo((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(_v(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield Fo($i.setState({isLoading:!0}));const a=hp(),r=hp(),s=yield Vo(vp,r);localStorage.setItem(Rt,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;yield Vo(Eg);const c=yield Bo((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=`${Ir(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=cg(ug);f&&(d.tenantId=f),i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*Rv({payload:e}){const t=localStorage.getItem(Rt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield Bo((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;yield Vo(Eg);const a=yield Bo((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 Vo(Zf.auth.exchangeOAuthTokensV2,r);yield Vo(fv,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield Fo($i.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{yield pv()}}function*Dv(e){let{payload:{callback:t}}=e,n=Xi(e.payload,zS);try{yield Fo($i.setLoginState({loading:!0}));const e=yield Vo(Zf.auth.changePhoneNumberWithVerification,n);yield Fo($i.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:_t.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield Fo($i.setLoginState({error:gg(e),loading:!1}))}}function*Nv(e){let{payload:{callback:t}}=e,n=Xi(e.payload,KS);try{yield Fo($i.setLoginState({loading:!0})),yield Vo(Zf.auth.verifyChangePhoneNumber,n),yield Fo($i.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Fo($i.setLoginState({error:gg(e),loading:!1}))}}function*Mv(e){let{payload:{callback:t}}=e,n=Xi(e.payload,qS);try{yield Fo($i.setLoginState({loading:!0}));const e=yield Vo(Zf.auth.passwordlessPreLogin,D({},n,{type:Oi.SmsCode}));yield Fo($i.setLoginState({step:_t.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield Fo($i.setLoginState({error:gg(e),loading:!1})),null==t||t(e)}}function*Fv(e){let{payload:{callback:t}}=e,n=Xi(e.payload,HS);try{let e;yield Fo($i.setLoginState({loading:!0})),function(e){return"email"in e}(n)&&(e=n.email);const i=yield Vo(Zf.auth.passwordlessPreLogin,n),o=Pi[n.type];yield Fo($i.setLoginState({step:o,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:e,error:void 0})),null==t||t()}catch(e){yield Fo($i.setLoginState({error:gg(e),loading:!1})),null==t||t()}}function*Gv(){const{publicAuthStrategyPolicy:e}=yield Bo((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===Fs.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield Vo(Ap,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield Vo(Zf.auth.getWebAuthnDevices);return yield Fo($i.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*$v(e){let{payload:{callback:t,events:n}}=e,i=Xi(e.payload,JS);try{yield Fo($i.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield Vo(Zf.auth.passwordlessPostLoginV2,i),s=Ga.onRedirectTo,{routes:l}=yield Bo((e=>e.auth));if(dg(e)){const t=yield pg(e);yield Fo($i.setState(t)),s(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield Bo((e=>e.auth));if(e.emailVerified){var o;const t={email:e.email,origin:og.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name};null==n||null==(o=n.userVerified)||o.call(n,t),vg(Sg.USER_VERIFIED,t)}e.id&&localStorage.setItem("userId",e.id),yield Vo(fv,{user:e,tenants:a,activeTenant:r}),yield Fo($i.setLoginState({error:void 0})),yield Fo($i.setState({isLoading:!1})),i.flow===Lt.Login?(yield Vo(Gv))?(yield Fo($i.setLoginState({step:_t.promptPasskeys,loading:!1})),s(l.loginUrl,{preserveQueryParams:!0})):(yield Fo($i.setState({isAuthenticated:!0})),yield pv()):s(l.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield Fo($i.setLoginState({error:gg(e,"Failed to authenticate")}))}finally{yield Fo($i.setLoginState({loading:!1}))}}function*Vv({payload:e}){try{yield Fo($i.setLoginState({loading:!0}));const{name:t}=yield Vo(Zf.auth.verifyInviteToken,e);yield Fo($i.setLoginState({inviteTokenTenantName:t}))}catch(e){yield Fo($i.setLoginState({inviteTokenError:gg(e,"We couldn't verify your invitation")}))}finally{yield Fo($i.setLoginState({loading:!1}))}}function*xv({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield Fo($i.setLoginState({loading:!0}));try{const o=yield Bo((({auth:{onRedirectTo:e}})=>e)),a=cg(ug),{address:r,idpType:s}=yield Vo(Zf.auth.preLoginV2,{email:e,tenantId:a});if(r){let t=r;if(s===np.Oidc&&!t.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield Bo((({auth:{routes:e}})=>({routes:e})));t+=`&redirect_uri=${window.location.origin}${e}`}WS.isAvailable("loginWithSSO")?(WS.loginWithSSO(e),yield Fo($i.setLoginState({loading:!1,step:_t.redirectToSSO})),null==i||i()):(yield Fo($i.setLoginState({step:_t.redirectToSSO,loading:!1,ssoRedirectUrl:t})),setTimeout((()=>{o(t,{refresh:!0})}),2e3))}else yield jv({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield jv({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*jv(e){let{callback:t}=e,n=Xi(e,YS);const i=yield Bo((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield Fo($i.setLoginState({step:_t.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===Oi.EmailAndPassword?(yield Fo($i.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t()):[Oi.MagicLink,Oi.Code,Oi.SmsCode].includes(null==i?void 0:i.authStrategy)?yield Fo($i.passwordlessPreLogin(D({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield Fo($i.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t())}function*Bv({payload:{callback:e}}){try{yield Fo($i.setLoginState({loading:!0}));const{options:t}=yield Vo(Zf.auth.webAuthnCreateNewDeviceSession);t.user.id=It(t.user.id),t.challenge=It(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield Fo($i.setLoginState({error:gg(t)})),null==e||e(null)}finally{yield Fo($i.setLoginState({loading:!1}))}}function*Wv(e){let{payload:{callback:t}}=e,n=Xi(e.payload,QS);try{yield Fo($i.setLoginState({loading:!0}));const e=Pt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?Gs.Platform:Gs.CrossPlatform;yield Vo(Zf.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield Fo($i.setLoginState({error:gg(e)})),null==t||t(null)}finally{yield Fo($i.setLoginState({loading:!1}))}}function*zv(e){let{payload:{callback:t}}=e,n=Xi(e.payload,XS);try{var i;yield Fo($i.setPasskeysState({loading:!0})),yield Fo($i.setLoginState({loading:!0}));const{options:e}=yield Vo(Zf.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 Fo($i.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield Fo($i.setLoginState({error:gg(e)})),null==t||t(null)}finally{yield Fo($i.setPasskeysState({loading:!1})),yield Fo($i.setLoginState({loading:!1}))}}function*Kv(e){let{payload:{callback:t}}=e,n=Xi(e.payload,ZS);try{var i;yield Fo($i.setPasskeysState({loading:!0})),yield Fo($i.setLoginState({loading:!0}));const e=Pt(n.publicKey),o=yield Vo(Zf.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=Xi(o,ev);if(dg(a)){const e=Ga.onRedirectTo,{routes:t}=yield Bo((e=>e.auth)),n=yield pg(a);yield Fo($i.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield Vo(fv,D({user:a},r),{isAuthenticated:!0}),yield Fo($i.setLoginState({error:void 0})),yield pv(),null==t||t(!0)}catch(e){yield Fo($i.setLoginState({error:gg(e)})),null==t||t(null)}finally{yield Fo($i.setPasskeysState({loading:!1})),yield Fo($i.setLoginState({loading:!1}))}}function*qv({payload:e}){const{onRedirectTo:t,routes:n}=yield Bo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Fo($i.setLoginState({loading:!0}));try{const t=yield Vo(Zf.auth.postLogin,e);yield Fo($i.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield pv()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Fo($i.setLoginState({step:_t.loginWithSSOFailed,loading:!1}))}}function*Hv({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield Fo($i.setLoginState({loading:!0}));try{const{user:a,tenants:r=[],activeTenant:s}=yield Vo(Zf.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:i}),l=Ga.onRedirectTo,{routes:c}=yield Bo((e=>e.auth));if(dg(a)){const e=yield pg(a);yield Fo($i.setState(e)),l(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Bo((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield Vo(fv,{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 Vo(Ap,["security-center-show-login-flows"]);t.flow===Lt.Login&&(i&&a.isBreachedPassword&&!n?yield Fo($i.setLoginState({step:_t.breachedPassword,loading:!1})):n&&((yield Vo(Gv))?(yield Fo($i.setLoginState({step:_t.promptPasskeys,loading:!1})),l(c.loginUrl,{preserveQueryParams:!0})):yield pv()))}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){Ga.setAccessToken(null),Ga.setUser(null),null==o||o(!1,t),yield Fo($i.setLoginState({email:e,error:gg(t),loading:!1}))}}function*Jv({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield Fo($i.setLoginState({loading:!0}));try{const{user:o,tenants:a=[],activeTenant:r}=yield Vo(Zf.auth.loginWithMfaV2,{mfaToken:e,value:t,rememberDevice:n}),{loginState:s}=yield Bo((e=>e.auth)),l=s.flow===Lt.Login?_t.success:s.step,c=!!o.accessToken;yield Vo(fv,{user:o,tenants:a,activeTenant:r},{loginState:{flow:s.flow,quickLoginToRegister:s.quickLoginToRegister,loading:!1,step:l,error:void 0,tenants:a},isAuthenticated:c}),o.id&&localStorage.setItem("userId",o.id),yield Fo($i.setLoginState({error:void 0,loading:!1}));const[u]=yield Vo(Ap,["security-center-show-login-flows"]);s.flow===Lt.Login&&(u&&s.isBreachedPassword&&!c?yield Fo($i.setLoginState({step:_t.breachedPassword,loading:!1})):(yield Vo(Gv))?yield Fo($i.setLoginState({step:_t.promptPasskeys,loading:!1})):yield pv()),null==i||i(!0)}catch(e){yield Fo($i.setLoginState({error:gg(e),loading:!1})),null==i||i(!1,e)}}function*Yv({payload:e}){yield Fo($i.setLoginState({loading:!0}));try{var t;yield Vo(Zf.auth.recoverMfaToken,e),yield Fo($i.setLoginState({loading:!1,error:void 0,step:_t.preLogin})),yield Fo($i.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Fo($i.setLoginState({error:gg(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Qv({payload:e}){const{hostedLoginBox:t}=yield Bo((e=>e.auth));yield Fo($i.setState({isLoading:!0}));try{t?yield Vo(Zf.auth.OAuthLogout):yield Vo(Zf.auth.logout)}catch{}yield Fo($i.resetState()),yield Fo($i.requestAuthorize(!0)),null==e||e()}function*Xv({payload:e}){var t;try{yield Vo(Zf.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*Zv({user:e,tenants:t,activeTenant:n}){const i={step:un.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield Fo($i.setMfaState(i)),yield Fo($i.setUser(e)),yield Fo($i.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*eh({user:e,tenants:t,activeTenant:n}){const{loginState:i}=yield Bo((e=>e.auth));yield Fo($i.setUser(e)),yield Fo($i.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:o}=yield Bo((e=>e.auth.mfaState)),[a]=yield Vo(Ap,["security-center-show-login-flows"]),r=!!e.accessToken;if(i.flow===Lt.Login)if(a&&i.isBreachedPassword&&!r)yield Fo($i.setLoginState({step:_t.breachedPassword,loading:!1}));else{const e=yield Vo(Gv);o===un.smsVerifyCode&&e?yield Fo($i.setLoginState({step:_t.promptPasskeys,loading:!1})):yield pv()}yield Fo($i.setState({isAuthenticated:r}))}function*th(e){let{payload:{callback:t}}=e,n=Xi(e.payload,tv);yield Fo($i.setLoginState({loading:!0}));try{const e=yield Vo(Zf.auth.preEnrollMFASMSForLogin,n);yield Fo($i.setMfaState({otcToken:e.otcToken,step:un.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Fo($i.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Fo($i.setLoginState({loading:!1,error:gg(e)})),null==t||t(null)}}function*nh(e){let{payload:{callback:t}}=e,n=Xi(e.payload,nv);yield Fo($i.setLoginState({loading:!0}));try{const e=yield Vo(Zf.auth.enrollMFASMSForLoginV2,n);yield Zv(e),yield Fo($i.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Fo($i.setLoginState({loading:!1,error:gg(e)})),null==t||t(null)}}function*ih(e){let{payload:{callback:t}}=e,n=Xi(e.payload,iv);yield Fo($i.setLoginState({loading:!0}));try{var i;const e=yield Vo(Zf.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 Fo($i.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Fo($i.setLoginState({loading:!1,error:gg(e)})),null==t||t(null)}}function*oh(e){let{payload:{callback:t}}=e,n=Xi(e.payload,ov);yield Fo($i.setLoginState({loading:!0}));try{const e=Pt(n.publicKey),i=yield Vo(Zf.auth.enrollMFAWebAuthnForLoginV2,D({},n,{options:e}));yield Zv(i),yield Fo($i.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Fo($i.setLoginState({loading:!1,error:gg(e)})),null==t||t(null)}}function*ah(e){let{payload:{callback:t}}=e,n=Xi(e.payload,av);yield Fo($i.setLoginState({loading:!0}));try{const e=yield Vo(Zf.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield Zv(e),yield Fo($i.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Fo($i.setLoginState({loading:!1,error:gg(e)})),null==t||t(null)}}function*rh(e){let{payload:{callback:t,deviceId:n}}=e,i=Xi(e.payload,rv);yield Fo($i.setLoginState({loading:!0}));try{const e=yield Vo(Zf.auth.preVerifyMFASMSForLogin,n,i);yield Fo($i.setMfaState({otcToken:e.otcToken,step:un.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Fo($i.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Fo($i.setLoginState({loading:!1,error:gg(e)})),null==t||t(null)}}function*sh(e){let{payload:{callback:t}}=e,n=Xi(e.payload,sv);try{const e=yield Vo(Zf.auth.preVerifyMFAEmailCode,n);yield Fo($i.setMfaState({otcToken:e.otcToken,step:un.emailVerifyCode})),null==t||t(!0)}catch(e){yield Fo($i.setLoginState({error:gg(e)})),null==t||t(null)}}function*lh(e){let{payload:{callback:t}}=e,n=Xi(e.payload,lv);yield Fo($i.setLoginState({loading:!0}));try{const e=yield Vo(Zf.auth.verifyMFAEmailCodeV2,n);yield eh(e),yield Fo($i.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Fo($i.setLoginState({loading:!1,error:gg(e)})),null==t||t(null)}}function*ch(e){let{payload:{callback:t,deviceId:n}}=e,i=Xi(e.payload,cv);yield Fo($i.setLoginState({loading:!0}));try{const e=yield Vo(Zf.auth.verifyMFASMSForLoginV2,n,i);yield eh(e),yield Fo($i.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Fo($i.setLoginState({loading:!1,error:gg(e)})),null==t||t(null)}}function*uh(e){let{payload:{callback:t,deviceId:n}}=e,i=Xi(e.payload,uv);yield Fo($i.setLoginState({loading:!0}));try{var o;const e=yield Vo(Zf.auth.preVerifyMFAWebAuthnForLogin,n,i),a=D({},e.options,{challenge:It(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>D({},e,{id:It(e.id)})))});yield Fo($i.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield Fo($i.setLoginState({loading:!1,error:gg(e)})),null==t||t(null)}}function*dh(e){let{payload:{callback:t,deviceId:n}}=e,i=Xi(e.payload,dv);yield Fo($i.setLoginState({loading:!0}));try{const e=Pt(i.publicKey),o=yield Vo(Zf.auth.verifyMFAWebAuthnForLoginV2,n,D({},i,{options:e}));yield eh(o),yield Fo($i.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Fo($i.setLoginState({loading:!1,error:gg(e)})),null==t||t(null)}}function*yh({payload:e}){yield Fo($i.setLoginState({loading:!0}));try{yield Vo(Zf.auth.forgotPassword,e),yield Fo($i.setLoginState({loading:!1,error:void 0,step:_t.breachedPasswordSuccess})),yield Fo($i.setState({isAuthenticated:!1}))}catch(e){yield Fo($i.setLoginState({loading:!1,error:gg(e)}))}}function*fh(){yield Fa($i.requestAuthorize,Ov),yield Fa($i.requestAuthorizeSSR,Pv),yield Fa($i.requestHostedLoginAuthorize,wv),yield Fa($i.requestHostedLoginAuthorizeV2,Cv),yield Fa($i.handleHostedLoginCallback,Rv),yield Fa($i.preLogin,xv),yield Fa($i.postLogin,qv),yield Fa($i.login,Hv),yield Fa($i.logout,Qv),yield Fa($i.silentLogout,Xv),yield Fa($i.loginWithMfa,Jv),yield Fa($i.recoverMfa,Yv),yield Fa($i.quickSmsPasswordlessPreLogin,Mv),yield Fa($i.changePhoneNumberWithVerification,Dv),yield Fa($i.verifyChangePhoneNumber,Nv),yield Fa($i.passwordlessPreLogin,Fv),yield Fa($i.passwordlessPostLogin,$v),yield Fa($i.verifyInviteToken,Vv),yield Fa($i.webAuthnPrelogin,zv),yield Fa($i.webAuthnPostLogin,Kv),yield Fa($i.webAuthnCreateNewDeviceSession,Bv),yield Fa($i.webAuthnVerifyNewDeviceSession,Wv),yield Fa($i.afterAuthNavigation,pv),yield Fa($i.getUserIP,kv),yield Fa($i.preEnrollMFASMSForLogin,th),yield Fa($i.enrollMFASMSForLogin,nh),yield Fa($i.preEnrollMFAWebAuthnForLogin,ih),yield Fa($i.enrollMFAWebAuthnForLogin,oh),yield Fa($i.enrollMFAAuthenticatorAppForLogin,ah),yield Fa($i.preVerifyMFASMSForLogin,rh),yield Fa($i.verifyMFASMSForLogin,ch),yield Fa($i.preVerifyMFAWebAuthnForLogin,uh),yield Fa($i.verifyMFAWebAuthnForLogin,dh),yield Fa($i.preVerifyMFAEmailCode,sh),yield Fa($i.verifyMFAEmailCode,lh),yield Fa($i.resetBreachedPassword,yh)}function*ph({payload:e}){e&&(yield Fo($i.setState({isLoading:!0})));const t=Op;yield Fo($i.loadTenants()),yield Fo($i.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*gh({payload:{callback:e}}){try{const{ip:t}=Jp[0];yield Fo($i.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Sh(){yield Fa($i.requestAuthorize,ph),yield Fa($i.afterAuthNavigation,pv),yield Fa($i.getUserIP,gh)}const vh=["callback","samlVendor"],hh=["callback","samlVendor"];function*mh(){try{var e,t;yield Fo($i.setSSOState({loading:!0}));const n=yield Vo(Zf.auth.getSamlConfiguration),i=yield Vo(Zf.auth.getOidcConfiguration),o=yield Vo(Zf.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 Fo($i.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield Fo($i.setSSOState({error:gg(e),loading:!1}))}}function*Ah({payload:e}){const t=yield Bo((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield Fo($i.setSSOState({error:void 0,[n]:!0}));try{const i=yield mp(e[0]),o=yield Vo(Zf.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield Fo($i.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield Fo($i.setSSOState({samlConfiguration:t,error:gg(e),[n]:!1}))}}function*bh({payload:e}){const{configFile:t,callback:n}=e,i=yield Bo((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield Fo($i.setSSOState({error:void 0,[o]:!0}));try{const e=yield mp(t),a=yield Vo(Zf.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield Fo($i.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield Fo($i.setSSOState({samlConfiguration:i,error:gg(e),[o]:!1})),null==n||n(null,e)}}function*Th({payload:e}){const{callback:t,samlVendor:n}=e,i=Xi(e,vh),o=yield Bo((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 Fo($i.setSSOState({samlConfiguration:D({},o,a)})));if(yield Fo($i.setSSOState({error:void 0,[r]:!0})),e.type===np.Saml){var s,l;const e=yield Vo(Zf.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=Sp(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 Vo(Zf.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield Fo($i.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield Fo($i.setSSOState({samlConfiguration:o,error:gg(e),[r]:!1})),null==t||t(null,e)}}function*Eh({payload:{callback:e}={}}){const t=yield Bo((e=>e.auth.ssoState.samlConfiguration));try{yield Fo($i.setSSOState({error:void 0,saving:!0})),yield Vo(Zf.auth.validateSamlDomain),yield Fo($i.setSSOState({samlConfiguration:D({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield Fo($i.setSSOState({samlConfiguration:D({},t,{validated:!1}),error:gg(n),saving:!1})),null==e||e(null,n)}}function*kh(){try{const e=yield Vo(Zf.auth.getSamlRoles),t=yield Vo(Zf.auth.getSamlRolesGroups);yield Fo($i.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Fo($i.setSSOState({error:gg(e)}))}}function*Oh({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Fo($i.setSSOState({error:void 0,saving:!0})),yield Vo(Zf.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Go(e.map((e=>Vo(Zf.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Fo($i.setSSOState({error:gg(e)}))}}(n)),yield kh(),yield Fo($i.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Fo($i.setSSOState({error:gg(t),saving:!1})),null==e||e(null,t)}}function*Ih({payload:{callback:e,id:t}}){try{yield Fo($i.setSSOState({error:void 0,saving:!0})),yield Vo(Zf.auth.deleteSamlGroup,{id:t}),yield kh(),yield Fo($i.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Fo($i.setSSOState({error:gg(t),saving:!1})),null==e||e(null,t)}}function*Ph({payload:{group:e,roleIds:t,callback:n}}){try{yield Fo($i.setSSOState({error:void 0,saving:!0})),yield Vo(Zf.auth.createSamlGroup,{group:e,roleIds:t}),yield kh(),yield Fo($i.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield Fo($i.setSSOState({error:gg(e),saving:!1})),null==n||n(null,e)}}function*_h({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Fo($i.setSSOState({loading:!0})),yield Vo(Zf.auth.oidcPostLoginV2,t),yield Vo(hv),yield Fo($i.setSSOState({loading:!1}))}catch(e){yield Fo($i.setSSOState({loading:!1,error:gg(e,"Failed to authenticate"),firstLoad:!1}))}}function*Lh(){yield Na($i.loadSSOConfigurations,mh),yield Na($i.saveSSOConfigurations,Th),yield Na($i.saveSSOConfigurationsFile,Ah),yield Na($i.saveSSOConfigurationsFileWithCallback,bh),yield Na($i.validateSSODomain,Eh),yield Na($i.loadSSOAuthorizationRoles,kh),yield Na($i.updateSSOAuthorizationRoles,Oh),yield Na($i.deleteSamlGroup,Ih),yield Na($i.createSamlGroup,Ph),yield Na($i.oidcPostlogin,_h)}function*wh(){yield Fo($i.setSSOState({loading:!0})),yield Et(),yield Fo($i.setSSOState({samlConfiguration:Up,loading:!1,firstLoad:!1}))}function*Ch({payload:e}){const t="saving";yield Fo($i.setSSOState({error:void 0,[t]:!0}));const n=D({},yield Bo((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield Fo($i.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Uh({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=Xi(e,hh),r=Np.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 Fo($i.setSSOState({samlConfiguration:D({},r,s)})));yield Fo($i.setSSOState({error:void 0,[l]:!0})),yield Et(),s.acsUrl=null==Rp||null==(t=Rp.configuration)?void 0:t.acsUrl,s.spEntityId=null==Rp||null==(n=Rp.configuration)?void 0:n.spEntityId;const c=Sp(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 Fo($i.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*Rh({payload:{callback:e}={}}){const t=Np.samlConfiguration;yield Fo($i.setSSOState({error:void 0,saving:!0})),yield Et(),yield Fo($i.setSSOState({samlConfiguration:D({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Dh(){yield Et(),yield Fo($i.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Nh({payload:{callback:e,authorizationRoles:t}}){yield Fo($i.setSSOState({error:void 0,saving:!0})),yield Et(),yield Fo($i.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Mh(){yield Na($i.loadSSOConfigurations,wh),yield Na($i.saveSSOConfigurations,Uh),yield Na($i.saveSSOConfigurationsFile,Ch),yield Na($i.validateSSODomain,Rh),yield Na($i.loadSSOAuthorizationRoles,Dh),yield Na($i.updateSSOAuthorizationRoles,Nh)}const Fh=["callback"],Gh=["callback","ssoConfigId"],$h=["callback","ssoConfigId"],Vh=["callback","ssoConfigId"];function*xh(){try{return yield Vo(Zf.auth.getOidcConfiguration)}catch(e){return null}}function*jh(){try{return yield Vo(Zf.metadata.getSamlMetadata)}catch(e){return null}}function*Bh(){try{yield Fo($i.setSSOLoader({key:tp.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Go([Vo(xh),Vo(jh)]),n=yield Vo(Zf.auth.getSSOConfigurations);yield Fo($i.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Fo($i.setSSOError({key:tp.LOAD_SSO_CONFIGURATIONS,value:gg(e)}))}finally{yield Fo($i.setSSOLoader({key:tp.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Wh({payload:e}){yield Fo($i.setSSOLoader({key:tp.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Xi(e,Fh),i=yield Bo((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield Vo(Zf.auth.createSSOConfiguration,D({},n,{enabled:null!=(o=n.enabled)&&o}));yield Fo($i.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield Fo($i.setSSOError({key:tp.SAVE_SSO_CONFIGURATION,value:gg(e)})),null==t||t(null,e)}finally{yield Fo($i.setSSOLoader({key:tp.SAVE_SSO_CONFIGURATION,value:!1}))}}function*zh({payload:e}){yield Fo($i.setSSOLoader({key:tp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield Bo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield mp(t),o=yield Vo(Zf.auth.createSSOConfigurationByMetadata,{metadata:e});yield Fo($i.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield Fo($i.setSSOError({key:tp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:gg(e)})),null==n||n(null,e)}finally{yield Fo($i.setSSOLoader({key:tp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Kh({payload:e}){yield Fo($i.setSSOLoader({key:tp.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Xi(e,Gh),o=yield Bo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Vo(Zf.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield Fo($i.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Fo($i.setSSOError({key:tp.UPDATE_SSO_CONFIGURATION,value:gg(e)})),null==t||t(null,e)}finally{yield Fo($i.setSSOLoader({key:tp.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*qh({payload:e}){yield Fo($i.setSSOLoader({key:tp.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield Bo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield mp(i),a=yield Vo(Zf.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield Fo($i.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield Fo($i.setSSOError({key:tp.UPDATE_SSO_CONFIGURATION,value:gg(e)})),null==t||t(null,e)}finally{yield Fo($i.setSSOLoader({key:tp.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Hh({payload:e}){yield Fo($i.setSSOLoader({key:tp.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield Bo((e=>e.auth.ssoState.ssoConfigurations));try{yield Vo(Zf.auth.deleteSSOConfiguration,t),yield Fo($i.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield Fo($i.setSSOError({key:tp.DELETE_SSO_CONFIGURATION,value:gg(e)})),null==n||n(null,e)}finally{yield Fo($i.setSSOLoader({key:tp.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Jh({payload:e}){const{callback:t,ssoConfigId:n}=e,i=Xi(e,$h);yield Fo($i.setSSOLoader({key:tp.SAVE_SSO_DOMAIN,value:!0}));const o=yield Bo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Vo(Zf.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?D({},t,{domains:[...t.domains,e]}):t));yield Fo($i.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Fo($i.setSSOError({key:tp.SAVE_SSO_DOMAIN,value:gg(e)})),null==t||t(null,e)}finally{yield Fo($i.setSSOLoader({key:tp.SAVE_SSO_DOMAIN,value:!1}))}}function*Yh({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield Fo($i.setSSOLoader({key:tp.DELETE_SSO_DOMAIN,value:!0}));const o=yield Bo((e=>e.auth.ssoState.ssoConfigurations));try{yield Vo(Zf.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?D({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield Fo($i.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield Fo($i.setSSOError({key:tp.DELETE_SSO_DOMAIN,value:gg(e)})),null==i||i(null,e)}finally{yield Fo($i.setSSOLoader({key:tp.DELETE_SSO_DOMAIN,value:!1}))}}function*Qh({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield Fo($i.setSSOLoader({key:tp.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield Bo((e=>e.auth.ssoState.ssoConfigurations));try{yield Vo(Zf.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 Fo($i.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield Fo($i.setSSOError({key:tp.VALIDATE_SSO_DOMAIN,value:gg(e)})),null==t||t(null,e)}finally{yield Fo($i.setSSOLoader({key:tp.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Xh({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Fo($i.setSSOLoader({key:tp.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield Bo((e=>e.auth.ssoState.ssoConfigurations));try{yield Vo(Zf.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?D({},e,{roleIds:n}):e));yield Fo($i.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield Fo($i.setSSOError({key:tp.UPDATE_SSO_DEFAULT_ROLES,value:gg(t)})),null==e||e(null,t)}finally{yield Fo($i.setSSOLoader({key:tp.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Zh({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield Fo($i.setSSOLoader({key:tp.SAVE_SSO_GROUPS,value:!0}));const o=yield Bo((e=>e.auth.ssoState.ssoConfigurations));try{yield Go(t.map((e=>Vo(Zf.auth.deleteSSOGroup,n,e)))),yield Go(e.map((e=>Vo(Zf.auth.createSSOGroup,n,e))));const a=yield Vo(Zf.auth.getSSOGroups,n),r=o.map((e=>e.id===n?D({},e,{groups:a}):e));yield Fo($i.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield Fo($i.setSSOError({key:tp.SAVE_SSO_GROUPS,value:gg(e)})),null==i||i(null,e)}finally{yield Fo($i.setSSOLoader({key:tp.SAVE_SSO_GROUPS,value:!1}))}}function*em({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Go(t.map((t=>Vo(Zf.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Fo($i.setSSOError({key:tp.SAVE_SSO_GROUPS,value:gg(e)})),null==n||n(null,e)}finally{yield Fo($i.setSSOLoader({key:tp.SAVE_SSO_GROUPS,value:!1}))}}function*tm({payload:e}){yield Fo($i.setSSOLoader({key:tp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield Bo((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,s;i?(r=yield Vo(Zf.auth.updateSSOConfigurationByMetadataUrl,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield Vo(Zf.auth.createSSOConfigurationByMetadataUrl,e),s=[r,...a]),yield Fo($i.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield Fo($i.setSSOLoader({key:tp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*nm({payload:e}){yield Fo($i.setSSOLoader({key:tp.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Xi(e,Vh),o=yield Bo((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Vo(Zf.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield Vo(Zf.auth.createSSOConfiguration,i),a=[e,...o]),yield Fo($i.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield Fo($i.setSSOLoader({key:tp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*im(){yield Na($i.loadSSOConfigurationsV2,Bh),yield Na($i.saveSSOConfigurationV2,Wh),yield Na($i.saveSSODomain,Jh),yield Na($i.deleteSSODomain,Yh),yield Na($i.validateSSODomainV2,Qh),yield Na($i.updateSSOConfiguration,Kh),yield Na($i.deleteSSOConfiguration,Hh),yield Na($i.setSSOGroups,Zh),yield Na($i.updateSSOGroups,em),yield Na($i.setSSODefaultRoles,Xh),yield Na($i.saveSSOConfigurationByMetadata,zh),yield Na($i.updateSSOConfigurationByMetadata,qh),yield Na($i.saveSSOConfigurationByUrl,tm),yield Na($i.saveSSOConfigurationByData,nm)}const om=["callback","profilePictureUrl"],am=["callback","profilePictureUrl"];function*rm(){yield Fo($i.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 Vo.apply(void 0,[Da,e,t,n].concat(o))}(3,2e3,Zf.teams.getProfile),t=yield Bo((e=>e.auth.user));$i.setUser(D({},t,e)),yield Fo($i.setProfileState({profile:e,loading:!1}))}catch(e){yield Fo($i.setProfileState({loading:!1,error:gg(e)}))}}function*sm(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Xi(e.payload,om);yield Fo($i.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield Bo((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 Vo(Zf.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 Vo(Zf.users.updateUserProfileV2,a),s=yield Bo((e=>e.auth.user));yield Fo($i.setUser(D({},s,r))),yield Fo($i.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield Fo($i.setProfileState({saving:!1,error:gg(e),loading:!1})),null==t||t(null,e)}}function*lm({payload:e}){yield Fo($i.setProfileState({loading:!0}));try{var t;yield Vo(Zf.teams.changePassword,e),yield Fo($i.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Fo($i.setProfileState({loading:!1,error:gg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*cm(){yield Fa($i.loadProfile,rm),yield Na($i.saveProfile,sm),yield Na($i.changePassword,lm)}function*um(){yield Fo($i.setProfileState({loading:!0})),yield Et(),yield Fo($i.setUser(D({},Op,kp))),yield Fo($i.setProfileState({loading:!1,profile:kp}))}function*dm(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Xi(e.payload,am);yield Fo($i.setProfileState({saving:!0,error:null}));const o=Ip;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=Op;yield Et(),yield Fo($i.setUser(D({},s,r))),yield Fo($i.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*ym({payload:e}){var t;yield Fo($i.setProfileState({loading:!0})),yield Et(),yield Fo($i.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*fm(){yield Fa($i.loadProfile,um),yield Na($i.saveProfile,dm),yield Na($i.changePassword,ym)}const pm=["callback"],gm=["callback"],Sm=["user"],vm=["callback"],hm=["deviceId","callback"],mm=["deviceId","callback"],Am=["callback"],bm=["deviceId"],Tm=["deviceId"],Em=["callback"],km=["deviceId"],Om=["callback"];function*Im(e){const{step:t}=yield Bo((e=>e.auth.mfaState));return{step:e.recoveryCode?un.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Pm(){yield Fo($i.setMfaState({saving:!0}));try{const{qrCode:e}=yield Vo(Zf.auth.enrollMfa);yield Fo($i.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield Fo($i.setMfaState({saving:!1,error:gg(e)}))}}function*_m(e){let{payload:{callback:t}}=e,n=Xi(e.payload,pm);yield Fo($i.setMfaState({saving:!0}));try{const e=yield Bo((e=>e.auth.user)),i=yield Vo(Zf.auth.verifyMfa,n),o=yield Vo(Zf.auth.getMFADevices),a=yield Im(i);yield Fo($i.setMfaState(D({},a,{mfaDevices:o}))),yield Fo($i.setUser(D({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield Fo($i.setMfaState({saving:!1,error:gg(e)})),null==t||t(null,e)}}function*Lm(e){let{payload:{callback:t}}=e,n=Xi(e.payload,gm);yield Fo($i.setMfaState({loading:!0}));try{const e=yield Vo(Zf.auth.loginWithMfaV2,n),{user:i}=e,o=Xi(e,Sm),a={step:un.recoveryCode,loading:!1,saving:!1,error:void 0};null!=i&&i.recoveryCode&&(a.recoveryCode=i.recoveryCode),yield Fo($i.setMfaState(a)),yield fv(D({user:i},o)),null==t||t(a.recoveryCode)}catch(e){yield Fo($i.setMfaState({loading:!1,error:gg(e)})),null==t||t(null,e)}}function*wm({payload:e}){yield Fo($i.setMfaState({saving:!0}));try{var t;yield Vo(Zf.auth.disableMfa,e);const n=yield Vo(Zf.auth.getMFADevices);yield Fo($i.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Fo($i.setMfaState({saving:!1,error:gg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Cm({payload:e}){yield Fo($i.setMfaState({saving:!0}));try{var t,n;const i=yield Vo(Zf.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 Fo($i.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield Fo($i.setMfaState({saving:!1,error:gg(t)})),null==(i=e.callback)||i.call(e,null,t)}}function*Um(e){let{payload:{callback:t}}=e,n=Xi(e.payload,vm);yield Fo($i.setMfaState({saving:!0}));try{const e=Pt(n.publicKey),i=yield Vo(Zf.auth.enrollMFAWebAuthn,D({},n,{options:e})),o=yield Vo(Zf.auth.getMFADevices),a=yield Im(i);yield Fo($i.setMfaState(D({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield Fo($i.setMfaState({saving:!1,error:gg(e)})),null==t||t(null,e)}}function*Rm(e){let{payload:{deviceId:t,callback:n}}=e;Xi(e.payload,hm),yield Fo($i.setMfaState({saving:!0}));try{var i;const e=yield Vo(Zf.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 Fo($i.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Fo($i.setMfaState({saving:!1,error:gg(e)})),null==n||n(null,e)}}function*Dm(e){let{payload:{deviceId:t,callback:n}}=e,i=Xi(e.payload,mm);yield Fo($i.setMfaState({saving:!0}));try{const e=Pt(i.publicKey);yield Vo(Zf.auth.disableMFAWebAuthn,t,D({},i,{options:e}));const o=yield Vo(Zf.auth.getMFADevices);yield Fo($i.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield Fo($i.setMfaState({saving:!1,error:gg(e)})),null==n||n(!1,e)}}function*Nm({payload:e}){yield Fo($i.setMfaState({saving:!0}));try{var t;const n=yield Vo(Zf.auth.preEnrollMFASMS,e);yield Fo($i.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 Fo($i.setMfaState({saving:!1,error:gg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Mm(e){let{payload:{callback:t}}=e,n=Xi(e.payload,Am);yield Fo($i.setMfaState({saving:!0}));try{const e=yield Vo(Zf.auth.enrollMFASMS,n),i=yield Vo(Zf.auth.getMFADevices),o=yield Im(e);yield Fo($i.setMfaState(D({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield Fo($i.setMfaState({saving:!1,error:gg(e)})),null==t||t(null,e)}}function*Fm(e){let{payload:{deviceId:t}}=e,n=Xi(e.payload,bm);yield Fo($i.setMfaState({saving:!0}));try{var i;const e=yield Vo(Zf.auth.preDisableMFASMS,t);yield Fo($i.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 Fo($i.setMfaState({saving:!1,error:gg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*Gm(e){let{payload:{deviceId:t}}=e,n=Xi(e.payload,Tm);yield Fo($i.setMfaState({saving:!0}));try{var i;yield Vo(Zf.auth.disableMFASMS,t,n);const e=yield Vo(Zf.auth.getMFADevices);yield Fo($i.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield Fo($i.setMfaState({saving:!1,error:gg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*$m(){yield Fo($i.setMfaState({loading:!0}));try{yield Bo((e=>e.auth.user));const e=yield Vo(Zf.auth.getMFADevices);yield Fo($i.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield Fo($i.setMfaState({loading:!1,error:gg(e)}))}}function*Vm(){yield Fo($i.setMfaState({loading:!0}));try{const e=(yield Vo(Zf.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield Fo($i.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield Fo($i.setMfaState({loading:!1,error:gg(e)}))}}function*xm(){yield Na($i.enrollMfa,Pm),yield Na($i.getMFADevices,$m),yield Na($i.getMFAStrategies,Vm),yield Na($i.verifyMfa,_m),yield Na($i.disableMfa,wm),yield Na($i.verifyMfaAfterForce,Lm),yield Na($i.preDisableMfaSms,Fm),yield Na($i.disableMfaSms,Gm),yield Na($i.preEnrollMfaSms,Nm),yield Na($i.enrollMfaSms,Mm),yield Na($i.preEnrollMfaWebAuthn,Cm),yield Na($i.enrollMfaWebAuthn,Um),yield Na($i.preDisableMfaWebAuthn,Rm),yield Na($i.disableMfaWebAuthn,Dm)}function*jm(){yield Fo($i.setMfaState({saving:!0})),yield Fo($i.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*Bm({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Bo((e=>e.auth.mfaState));yield Fo($i.setMfaState({saving:!0})),yield Et();const n={token:"token",recoveryCode:"recoveryCode"},i={step:un.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:D({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield Fo($i.setMfaState(i)),yield Fo($i.setUser(D({},Op,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*Wm(e){let{payload:{callback:t}}=e,n=Xi(e.payload,Em);yield Fo($i.setMfaState({loading:!0})),yield Et();const i=D({},n,{recoveryCode:"recoveryCode"}),o={step:un.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Fo($i.setMfaState(o)),yield Et(),yield Fo($i.setUser(D({},Op,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*zm({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Bo((e=>e.auth.mfaState));yield Fo($i.setMfaState({saving:!0})),yield Et(),yield Fo($i.setMfaState({saving:!1,error:void 0,mfaDevices:D({},n,{authenticators:[]})})),yield Fo($i.setUser(D({},Op))),null==(t=e.callback)||t.call(e,!0)}function*Km(e){let{}=e,t=Xi(e.payload,km);yield Fo($i.setMfaState({saving:!0}));try{var n;yield Fo($i.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield Fo($i.setMfaState({saving:!1,error:gg(e)})),null==(i=t.callback)||i.call(t,!1,e)}}function*qm({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Bo((e=>e.auth.mfaState));yield Fo($i.setMfaState({saving:!0})),yield Et(),yield Fo($i.setMfaState({loading:!1,error:void 0,mfaDevices:D({},n,{phones:[]})})),yield Fo($i.setUser(D({},Op))),null==(t=e.callback)||t.call(e,!0)}function*Hm({payload:e}){var t;yield Fo($i.setMfaState({saving:!0})),yield Et(),yield Fo($i.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*Jm(e){let{payload:{callback:t}}=e;Xi(e.payload,Om);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Bo((e=>e.auth.mfaState));yield Fo($i.setMfaState({saving:!0})),yield Et();const i={token:"token",recoveryCode:"recoveryCode"},o={step:un.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:D({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Fo($i.setMfaState(o)),yield Fo($i.setUser(D({},Op,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*Ym(){yield Na($i.enrollMfa,jm),yield Na($i.verifyMfa,Bm),yield Na($i.disableMfa,zm),yield Na($i.verifyMfaAfterForce,Wm),yield Na($i.preDisableMfaSms,Km),yield Na($i.disableMfaSms,qm),yield Na($i.preEnrollMfaSms,Hm),yield Na($i.enrollMfaSms,Jm)}const Qm=["callback"];function*Xm({payload:e}){yield Fo($i.setForgotPasswordState({loading:!0}));try{var t;yield Vo(Zf.auth.forgotPassword,e),yield Fo($i.setForgotPasswordState({loading:!1,error:void 0,step:Jt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Fo($i.setForgotPasswordState({loading:!1,error:gg(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*Zm(e){let{payload:{callback:t}}=e,n=Xi(e.payload,Qm);yield Fo($i.setForgotPasswordState({loading:!0}));try{yield Vo(Zf.auth.resetPassword,n),yield Fo($i.setForgotPasswordState({loading:!1,error:void 0,step:Jt.success})),null==t||t(!0)}catch(e){yield Fo($i.setForgotPasswordState({loading:!1,error:gg(e)})),null==t||t(!1,e)}}function*eA({payload:e}){yield Fo($i.setForgotPasswordState({loading:!0}));try{const t=yield Vo(Zf.auth.loadPasswordConfig,e);yield Fo($i.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Fo($i.setForgotPasswordState({loading:!1,error:gg(e)}))}}function*tA(){yield Fa($i.forgotPassword,Xm),yield Fa($i.resetPassword,Zm),yield Fa($i.loadPasswordConfig,eA)}let nA;!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"}(nA||(nA={}));const iA=["callback","events"],oA=["user"],aA=["callback"],rA=["callback"];function*sA({payload:{userId:e,token:t}}){yield Fo($i.setActivateState({loading:!0,step:xt.activating}));try{const{isAuthenticated:n}=yield Bo((e=>e.auth));n&&(yield Fo($i.silentLogout()));const i=yield Vo(Zf.auth.getActivateAccountStrategy,{userId:e,token:t});yield Fo($i.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield Fo($i.setActivateState({loading:!1,step:xt.activatingForm})))}catch(e){yield Fo($i.setActivateState({loading:!1,error:gg(e)}))}}function*lA(e){let{payload:{callback:t,events:n}}=e,i=Xi(e.payload,iA);yield Fo($i.setActivateState({loading:!0}));try{const e=Ga.onRedirectTo,{routes:a}=yield Bo((e=>e.auth)),r=yield Vo(Zf.auth.activateAccountV2,i),{user:s}=r,l=Xi(r,oA);if(s.redirectLocation)return void(window.location.href=s.redirectLocation);if(dg(s)){yield Fo($i.setActivateState({step:xt.success}));const t=yield pg(s);yield Fo($i.setState(t)),yield Wo(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield Fo($i.setActivateState({step:xt.success}));const e={email:s.email,origin:og.ACTIVATION_LINK,id:s.id,tenantId:s.tenantId,name:s.name,createdAt:new Date};null==n||null==(o=n.userVerified)||o.call(n,e),vg(Sg.USER_VERIFIED,e),yield Vo(fv,D({user:s},l),{isAuthenticated:!0}),yield Wo(1e3),yield pv(),yield Fo($i.resetActivateState())}null==t||t(!0)}catch(e){yield Fo($i.setActivateState({loading:!1,error:gg(e)}))}}function*cA({payload:e}){const{callback:t}=e,n=Xi(e,aA);yield Fo($i.setActivateStrategyState({loading:!0}));try{const e=yield Vo(Zf.auth.getActivateAccountStrategy,n);yield Fo($i.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield Fo($i.setActivateStrategyState({loading:!1,error:gg(e)}))}}function*uA({payload:e}){const{callback:t}=e,n=Xi(e,rA);yield Fo($i.setTeamLoader({key:nA.RESEND_ACTIVATE_LINK,value:n.email})),yield Fo($i.setActivateState({loading:!0}));try{yield Vo(Zf.auth.resendActivationEmail,n),yield Fo($i.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield Fo($i.setActivateState({loading:!1,error:gg(e)})),yield Fo($i.setTeamError({key:nA.RESEND_ACTIVATE_LINK,value:gg(e)})),null==t||t(null,e)}yield Fo($i.setTeamLoader({key:nA.RESEND_ACTIVATE_LINK,value:!1}))}function*dA(){yield Fa($i.activateAccount,lA),yield Fa($i.preActivateAccount,sA),yield Fa($i.getActivateAccountStrategy,cA),yield Fa($i.resendActivationEmail,uA)}function*yA({payload:e}){if(e.token&&e.userId)try{yield Fo($i.setAcceptInvitationState({error:void 0,step:zt.pending})),yield Vo(Zf.auth.acceptInvitation,e),yield Fo($i.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:zt.success}}))}catch(e){yield Fo($i.setAcceptInvitationState({step:zt.failed,error:gg(e)}))}else yield Fo($i.setAcceptInvitationState({error:void 0,step:zt.invalid}))}function*fA(){yield Fa($i.acceptInvitation,yA)}var pA,gA=new Uint8Array(16);function SA(){if(!pA&&!(pA="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 pA(gA)}for(var vA=/^(?:[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,hA=function(e){return"string"==typeof e&&vA.test(e)},mA=[],AA=0;AA<256;++AA)mA.push((AA+256).toString(16).substr(1));var bA=function(e,t,n){var i=(e=e||{}).random||(e.rng||SA)();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(!hA(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let TA,EA;!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"}(TA||(TA={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(EA||(EA={}));const kA=["callback"],OA=["roles"],IA=["callback"],PA=["callback","profileImage"],_A=["callback"],LA=["callback","userId"],wA=["callback"],CA=["callback"],UA=["callback"],RA=["callback"],DA=["callback"],NA=["callback"],MA=["callback"],FA=["callback","profileImage"],GA=["callback"],$A=["callback"],VA=["callback"],xA=["callback"],jA=["callback"],BA=["callback"],WA=()=>Bo((e=>e.auth.teamState));function*zA(){try{const{groups:e}=yield Vo(Zf.groups.getGroups,{_groupsRelations:EA.roles});return e}catch(e){return[]}}function*KA({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield WA(),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 Fo($i.setTeamLoader({key:nA.USERS,value:!r})),yield Fo($i.setTeamState({pageSize:c,pageOffset:u,filterV2:d,sortV2:y}));try{const[{items:t,_metadata:{totalPages:n,totalItems:i}},{items:o},{items:a},r]=yield Go([Vo(Zf.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})),Vo(Zf.teams.loadAvailableRoles),Vo(Zf.teams.loadAvailablePermissions),Vo(zA)]),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 Fo($i.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 Fo($i.setTeamError({key:nA.USERS,value:gg(e)})),yield Fo($i.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield Fo($i.setTeamLoader({key:nA.USERS,value:!1}))}function*qA({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield WA(),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 Fo($i.setTeamLoader({key:nA.USERS,value:!a})),yield Fo($i.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield Go([Vo(Zf.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),Vo(Zf.teams.loadAvailableRoles),Vo(Zf.teams.loadAvailablePermissions)]);yield Fo($i.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield Fo($i.setTeamError({key:nA.USERS,value:e.message})),yield Fo($i.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Fo($i.setTeamLoader({key:nA.USERS,value:!1}))}function*HA({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield WA(),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 Fo($i.setTeamLoader({key:nA.USERS,value:!r})),yield Fo($i.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield Go([Vo(Zf.subTenants.loadAllUsers,D({},c)),Vo(Zf.teams.loadAvailableRoles),Vo(Zf.teams.loadAvailablePermissions)]);yield Fo($i.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield Fo($i.setTeamError({key:nA.USERS,value:gg(e)})),yield Fo($i.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield Fo($i.setTeamLoader({key:nA.USERS,value:!1}))}function*JA({payload:e}){yield Fo($i.setTeamLoader({key:nA.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield Go([Vo(Zf.teams.loadAvailableRoles),Vo(Zf.teams.loadAvailablePermissions)]);yield Fo($i.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 Fo($i.setTeamError({key:nA.ROLES_AND_PERMISSIONS,value:gg(t)}))}yield Fo($i.setTeamLoader({key:nA.ROLES_AND_PERMISSIONS,value:!0}))}function*YA({payload:e}){const{callback:t}=e,n=Xi(e,kA),i=yield WA();yield Fo($i.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield Vo(Zf.teams.addUser,n),{roles:a}=e,r=D({},Xi(e,OA),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield Fo($i.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Fo($i.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!1,error:gg(e)})})),null==t||t(null,e)}}function*QA({payload:e}){const{callback:t}=e,n=yield WA();yield Fo($i.setTeamState({addUserDialogState:D({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield Fo($i.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Vo(Zf.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 Fo($i.loadUsersV2(r)),yield Fo($i.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*XA({payload:e}){const{callback:t}=e,n=Xi(e,IA),i=yield WA();yield Fo($i.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})}));try{yield Vo(Zf.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield Vo(Zf.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield Fo($i.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield Fo($i.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!1,error:gg(e)})})),null==t||t(null,e)}}function*ZA({payload:e}){const{callback:t}=e,n=Xi(e,PA),{id:i}=n,o=yield WA(),a=o.users.find((e=>e.id===n.id));yield Fo($i.setTeamLoader({key:nA.UPDATE_USER,value:i||""})),yield Fo($i.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!0})})),yield Fo($i.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 Vo(Zf.teams.updateUser,n);null==t||t(e),yield Fo($i.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 Fo($i.setTeamLoader({key:nA.UPDATE_USER,value:!1}))}catch(e){yield Fo($i.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!1,error:gg(e)}),users:o.users.map((e=>e.id===n.id?D({},e,a):e))})),yield Fo($i.setTeamLoader({key:nA.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*eb({payload:e}){const{callback:t}=e,n=Xi(e,_A),i=yield WA();yield Fo($i.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})}));try{yield Vo(Zf.teams.deleteUser,n),null==t||t(!0),yield Fo($i.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Fo($i.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!1,error:gg(e)})})),null==t||t(null,e)}}function*tb({payload:e}){const{callback:t,userId:n}=e,i=Xi(e,LA),o=yield WA();yield Fo($i.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!0})}));try{yield Vo(Zf.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 Fo($i.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 Fo($i.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!1,error:gg(e)})})),null==t||t(null,e)}}function*nb({payload:e}){const{callback:t}=e,n=Xi(e,wA),i=yield WA();yield Fo($i.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})}));try{yield Vo(Zf.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield Fo($i.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Fo($i.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!1,error:gg(e)})})),null==t||t(null,e)}}function*ib({payload:e}){const{callback:t}=e,n=Xi(e,CA);yield Fo($i.setTeamLoader({key:nA.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Vo(Zf.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Fo($i.setTeamError({key:nA.RESEND_ACTIVATE_LINK,value:gg(e)})),null==t||t(null,e)}yield Fo($i.setTeamLoader({key:nA.RESEND_ACTIVATE_LINK,value:!1}))}function*ob({payload:e}){const{callback:t}=e,n=Xi(e,UA);yield Fo($i.setTeamLoader({key:nA.RESEND_INVITATION_LINK,value:n.email}));try{yield Vo(Zf.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Fo($i.setTeamError({key:nA.RESEND_INVITATION_LINK,value:gg(e)})),null==t||t(null,e)}yield Fo($i.setTeamLoader({key:nA.RESEND_INVITATION_LINK,value:!1}))}function*ab({payload:e}){const{callback:t}=e,n=Xi(e,RA);yield Fo($i.setTeamLoader({key:nA.RESEND_INVITATION_LINK,value:n.email}));try{yield Vo(Zf.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Fo($i.setTeamError({key:nA.RESEND_INVITATION_LINK,value:gg(e)})),null==t||t(null,e)}yield Fo($i.setTeamLoader({key:nA.RESEND_INVITATION_LINK,value:!1}))}function*rb({payload:e}){const{callback:t}=e,n=Xi(e,DA);yield Fo($i.setTeamLoader({key:nA.RESEND_INVITATION_LINK,value:n.email}));try{yield Vo(Zf.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Fo($i.setTeamError({key:nA.RESEND_INVITATION_LINK,value:gg(e)})),null==t||t(null,e)}yield Fo($i.setTeamLoader({key:nA.RESEND_INVITATION_LINK,value:!1}))}function*sb(){yield Fo($i.setTeamError({key:nA.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Vo(Zf.teams.getInviteLinkConfiguration);yield Fo($i.setTeamState({inviteTokenState:D({},e)}))}catch(e){yield Fo($i.setTeamError({key:nA.CONFIG_TOKEN_LINK,value:gg(e)}))}}function*lb(){yield Fo($i.setTeamError({key:nA.GET_TOKEN_LINK,value:!1}));try{yield Vo(sb);const e=yield Vo(Zf.teams.getInviteUserLink),{inviteTokenState:t}=yield WA();yield Fo($i.setTeamState({inviteTokenState:D({},t,e)}))}catch(e){yield Fo($i.setTeamError({key:nA.GET_TOKEN_LINK,value:gg(e)}))}}function*cb({payload:{callback:e}}){yield Fo($i.setTeamError({key:nA.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield WA();try{const n=yield Vo(Zf.teams.createInviteUserLink,{expiresInMinutes:43200});yield Fo($i.setTeamState({inviteTokenState:D({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield Fo($i.setTeamError({key:nA.CREATE_TOKEN_LINK,value:gg(t)}))}}function*ub({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield WA();yield Fo($i.setTeamError({key:nA.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield Vo(Zf.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield Fo($i.setTeamState({inviteTokenState:D({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield Fo($i.setTeamError({key:nA.UPDATE_TOKEN_LINK,value:gg(t)}))}}function*db({payload:e}){const{callback:t}=null!=e?e:{};yield Fo($i.setTeamError({key:nA.DELETE_TOKEN_LINK,value:!1}));try{yield Vo(Zf.teams.deleteInviteUserLink),yield Fo($i.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Fo($i.setTeamError({key:nA.DELETE_TOKEN_LINK,value:gg(e)})),null==t||t(!1,e)}}function*yb({payload:e}){yield Fo($i.setTeamState({addUserDialogState:D({open:!0,loading:!1,error:!1},e)}))}function*fb({payload:e}){const t=yield WA(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Fo($i.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*pb({payload:e}){yield Fo($i.setTeamState({deleteUserDialogState:D({open:!0,loading:!1,error:!1},e)}))}function*gb({payload:e}){const t=yield WA(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Fo($i.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Sb(){yield Ma($i.loadUsers,qA),yield Ma($i.loadUsersV2,KA),yield Ma($i.loadAllSubTenantsUsers,HA),yield Ma($i.loadRoles,JA),yield Na($i.addUser,YA),yield Na($i.addUsersBulk,QA),yield Na($i.addUserToSubTenants,XA),yield Na($i.updateUser,ZA),yield Na($i.setUserRolesForSubTenants,tb),yield Na($i.deleteUser,eb),yield Na($i.deleteUserFromSubTenants,nb),yield Na($i.resendActivationLink,ib),yield Na($i.resendInvitationLink,ob),yield Na($i.resendInvitationEmail,ab),yield Na($i.resendInvitationLinkToAllSubTenants,rb),yield Na($i.getInvitationLink,lb),yield Na($i.createInvitationLink,cb),yield Na($i.updateInvitationLink,ub),yield Na($i.deleteInvitationLink,db),yield Na($i.openAddUserDialog,yb),yield Na($i.closeAddUserDialog,fb),yield Na($i.openDeleteUserDialog,pb),yield Na($i.closeDeleteUserDialog,gb)}function*vb({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield WA(),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 Fo($i.setTeamLoader({key:nA.USERS,value:!a})),yield Fo($i.setTeamState({pageSize:l,pageOffset:c,filterV2:u,sortV2:d})),yield Et(),yield Fo($i.setTeamState({users:jp,totalPages:2,totalItems:10,roles:Dp,permissions:Mp})),yield Fo($i.setTeamLoader({key:nA.USERS,value:!1})),null==r||r(jp)}function*hb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield WA(),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 Fo($i.setTeamLoader({key:nA.USERS,value:!r})),yield Fo($i.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield Et(),yield Fo($i.setTeamState({allUsers:Wp,totalPages:2,totalItems:10,roles:Dp,permissions:Mp})),yield Fo($i.setTeamLoader({key:nA.USERS,value:!1})),null==s||s(Wp)}function*mb({payload:e}){var t;yield Fo($i.setTeamLoader({key:nA.ROLES_AND_PERMISSIONS,value:!0})),yield Et(),yield Fo($i.setTeamState({roles:Dp,permissions:Mp})),yield Fo($i.setTeamLoader({key:nA.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Dp,permissions:Mp})}function*Ab({payload:e}){const{callback:t}=e,n=Xi(e,NA),i=yield WA();yield Fo($i.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})})),yield Et();const o=D({},$p,{groups:[]},n,{id:`${bA()}`});null==t||t(o),yield Fo($i.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*bb({payload:e}){const{callback:t}=e,n=Xi(e,MA),i=yield WA();yield Fo($i.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})})),yield Et();const o=D({},$p,n,{id:`${bA()}`});yield Fo($i.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*Tb({payload:e}){var t;const{callback:n}=e,i=Xi(e,FA),{id:o}=i,a=yield WA(),r=a.users.find((e=>e.id===i.id));yield Fo($i.setTeamLoader({key:nA.UPDATE_USER,value:o||""})),yield Fo($i.setTeamState({addUserDialogState:D({},a.addUserDialogState,{loading:!0})})),yield Fo($i.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 Fo($i.setTeamState({users:a.users.map((e=>e.id===s.id?D({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield Fo($i.setTeamLoader({key:nA.UPDATE_USER,value:!1}))}function*Eb({payload:e}){const{callback:t}=e,n=Xi(e,GA),i=yield WA();yield Fo($i.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield Fo($i.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*kb({payload:e}){const{callback:t}=e,n=Xi(e,$A),i=yield WA();yield Fo($i.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield Fo($i.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Ob({payload:e}){const{callback:t}=e,n=Xi(e,VA);yield Fo($i.setTeamLoader({key:nA.RESEND_ACTIVATE_LINK,value:n.userId})),yield Et(),null==t||t(!0),yield Fo($i.setTeamLoader({key:nA.RESEND_ACTIVATE_LINK,value:!1}))}function*Ib({payload:e}){const{callback:t}=e,n=Xi(e,xA);yield Fo($i.setTeamLoader({key:nA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield Fo($i.setTeamLoader({key:nA.RESEND_INVITATION_LINK,value:!1}))}function*Pb({payload:e}){const{callback:t}=e,n=Xi(e,jA);yield Fo($i.setTeamLoader({key:nA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield Fo($i.setTeamLoader({key:nA.RESEND_INVITATION_LINK,value:!1}))}function*_b({payload:e}){const{callback:t}=e,n=Xi(e,BA);yield Fo($i.setTeamLoader({key:nA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield Fo($i.setTeamLoader({key:nA.RESEND_INVITATION_LINK,value:!1}))}function*Lb(){yield Ma($i.loadUsersV2,vb),yield Ma($i.loadAllSubTenantsUsers,hb),yield Ma($i.loadRoles,mb),yield Na($i.addUser,Ab),yield Na($i.addUserToSubTenants,bb),yield Na($i.updateUser,Tb),yield Na($i.deleteUser,Eb),yield Na($i.deleteUserFromSubTenants,kb),yield Na($i.resendActivationLink,Ob),yield Na($i.resendInvitationLink,Ib),yield Na($i.resendInvitationEmail,Pb),yield Na($i.resendInvitationLinkToAllSubTenants,_b),yield Na($i.openAddUserDialog,yb),yield Na($i.closeAddUserDialog,fb),yield Na($i.openDeleteUserDialog,pb),yield Na($i.closeDeleteUserDialog,gb)}const wb=["authorizationUrl"],Cb=["events","url"];function*Ub(){try{yield Fo($i.setSocialLoginsState({loading:!0}));const e=yield Vo(Zf.auth.getSocialLoginProviders);yield Fo($i.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield Fo($i.setSocialLoginsState({error:gg(e),loading:!1,firstLoad:!1}))}}function*Rb(){const e=yield Bo((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Vo(Zf.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield Vo(Zf.auth.getSocialLoginProvidersV2),t}function*Db(e){try{var t;const n=yield Bo((e=>e.root.context));yield Fo($i.setSocialLoginsState({loading:!0}));const i=yield Vo(Rb),{providers:o}=yield Vo(Zf.auth.getCustomSocialLoginProvidersV1),a={socialLoginsConfigV2:i.map((e=>{let{authorizationUrl:t}=e,i=Xi(e,wb);const o=Ir(n,null!=t?t:"");return D({},i,{authorizationUrl:t?`${o}${t}`:null})})),customSocialLoginsConfig:o,loading:!1,firstLoad:!1};yield Fo($i.setSocialLoginsState(a)),null==e||null==(t=e.callback)||t.call(e,a)}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield Fo($i.setSocialLoginsState({error:gg(t),loading:!1,firstLoad:!1}))}}function*Nb(e){let{payload:{events:t,url:n}}=e,i=Xi(e.payload,Cb);try{yield Fo($i.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield Vo(Zf.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:ag.SOCIAL_LOGIN});null==t||null==(o=t.signUpComplete)||o.call(t,u),vg(Sg.SIGNUP_COMPLETED,u);const d=D({},r,{origin:og.SOCIAL_LOGIN,name:c});null==t||null==(a=t.userVerified)||a.call(t,d),vg(Sg.USER_VERIFIED,d)}s&&localStorage.setItem("userId",s),yield Fo($i.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield Bo((e=>e.auth));e?yield Vo(Av):yield Vo(Tv)}(),localStorage.removeItem("register-quick-login"),yield Fo($i.setSocialLoginsState({loading:!1}))}catch(e){yield Fo($i.setSocialLoginsState({loading:!1,error:gg(e,"Failed to authenticate"),firstLoad:!1}))}}function*Mb({payload:e}){yield Fo($i.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*Fb(){yield Fa($i.loadSocialLoginsConfiguration,Ub),yield Fa($i.loadSocialLoginsConfigurationV2,Db),yield Fa($i.loginViaSocialLogin,Nb),yield Ma($i.setSocialLoginError,Mb)}let Gb;function*$b({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield Bo((e=>e.auth.apiTokensState)),{policy:a}=yield Bo((e=>e.auth.securityPolicyState.publicPolicy)),r=(null==a?void 0:a.machineToMachineAuthStrategy)===Ii.AccessToken;try{let e;yield Fo($i.setApiTokensLoader({key:Gb.ADD_API_TOKEN,value:!0}));let a=null;n&&(a=1440*n),e=r?yield Vo(Zf.auth.createUserAccessToken,{description:t,expiresInMinutes:a}):yield Vo(Zf.auth.updateUserApiTokensData,{description:t,expiresInMinutes:a}),yield Fo($i.setApiTokensState({showAddTokenDialog:!1})),yield Wo(200),yield Fo($i.setApiTokensState({apiTokensDataUser:[D({},e,{type:r?Ii.AccessToken:Ii.ClientCredentials}),...o],successDialog:{open:!0,secret:e.secret,clientId:r?void 0:e.clientId}})),yield Fo($i.setApiTokensLoader({key:Gb.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Fo($i.setApiTokensError({key:Gb.ADD_API_TOKEN,value:gg(e)})),yield Fo($i.setApiTokensLoader({key:Gb.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*Vb({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield Bo((e=>e.auth.apiTokensState)),{policy:r}=yield Bo((e=>e.auth.securityPolicyState.publicPolicy)),s=(null==r?void 0:r.machineToMachineAuthStrategy)===Ii.AccessToken;try{let e;yield Fo($i.setApiTokensLoader({key:Gb.ADD_API_TOKEN,value:!0}));let r=null;i&&(r=1440*i),e=s?yield Vo(Zf.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n}):yield Vo(Zf.auth.updateTenantApiTokensData,{description:t,roleIds:n,expiresInMinutes:r}),yield Fo($i.setApiTokensState({showAddTokenDialog:!1})),yield Wo(200),yield Fo($i.setApiTokensState({apiTokensDataTenant:[D({},e,{type:s?Ii.AccessToken:Ii.ClientCredentials}),...a],successDialog:{open:!0,secret:e.secret,clientId:s?void 0:e.clientId}})),yield Fo($i.setApiTokensLoader({key:Gb.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield Fo($i.setApiTokensError({key:Gb.ADD_API_TOKEN,value:gg(e)})),yield Fo($i.setApiTokensLoader({key:Gb.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*xb({payload:e}){const{apiTokensDataUser:t}=yield Bo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield Fo($i.setApiTokensLoader({key:Gb.DELETE_API_TOKEN,value:!0})),n?(yield Vo(Zf.auth.deleteUserAccessToken,{id:e}),yield Fo($i.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Vo(Zf.auth.deleteUserApiToken,{tokenId:e}),yield Fo($i.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield Fo($i.setApiTokensLoader({key:Gb.DELETE_API_TOKEN,value:!1}))}catch(e){yield Fo($i.setApiTokensError({key:Gb.DELETE_API_TOKEN,value:gg(e)})),yield Fo($i.setApiTokensLoader({key:Gb.DELETE_API_TOKEN,value:!1}))}}function*jb({payload:e}){const{apiTokensDataTenant:t}=yield Bo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield Fo($i.setApiTokensLoader({key:Gb.DELETE_API_TOKEN,value:!0})),n?(yield Vo(Zf.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield Vo(Zf.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield Fo($i.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield Fo($i.setApiTokensLoader({key:Gb.DELETE_API_TOKEN,value:!1}))}catch(e){yield Fo($i.setApiTokensError({key:Gb.DELETE_API_TOKEN,value:gg(e)})),yield Fo($i.setApiTokensLoader({key:Gb.DELETE_API_TOKEN,value:!1}))}}function*Bb({payload:e}){null!=e&&e.silentLoading||(yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield Go([Vo(Zf.auth.getUserApiTokensData),Vo(Zf.auth.getTenantApiTokensData)]);yield Fo($i.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Fo($i.setApiTokensError({key:Gb.LOAD_API_TOKENS,value:gg(t)})),yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Wb({payload:e}){null!=e&&e.silentLoading||(yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=Vo(Zf.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=Vo(Zf.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).map((e=>D({},e,{type:Ii.AccessToken}))).concat(a.map((e=>D({},e,{type:Ii.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Fo($i.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield Fo($i.setApiTokensError({key:Gb.LOAD_API_TOKENS,value:gg(t)})),yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*zb({payload:e}){null!=e&&e.silentLoading||(yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=Vo(Zf.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Vo(Zf.auth.getTenantAccessTokensData))?n:[],s=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).map((e=>D({},e,{type:Ii.AccessToken}))).concat(a.map((e=>D({},e,{type:Ii.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Fo($i.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield Fo($i.setApiTokensError({key:Gb.LOAD_API_TOKENS,value:gg(t)})),yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Kb(){yield Fa($i.loadApiTokens,Bb),yield Fa($i.loadUserApiTokens,Wb),yield Fa($i.loadTenantApiTokens,zb),yield Na($i.addUserApiToken,$b),yield Na($i.addTenantApiToken,Vb),yield Ma($i.deleteTenantApiToken,jb),yield Ma($i.deleteUserApiToken,xb)}function*qb({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield Fo($i.setApiTokensLoader({key:Gb.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield Bo((e=>e.auth.apiTokensState)),a=D({},Tp,{description:t,roleIds:n,clientId:`CLIENT_ID_${bA()}`});yield Fo($i.setApiTokensState({showAddTokenDialog:!1})),yield Wo(200),yield Fo($i.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Wo(200),yield Fo($i.setApiTokensLoader({key:Gb.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*Hb({payload:e}){yield Fo($i.setApiTokensLoader({key:Gb.DELETE_API_TOKEN,value:!0})),yield Wo(200);const t=[Tp];yield Fo($i.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Fo($i.setApiTokensLoader({key:Gb.DELETE_API_TOKEN,value:!1}))}function*Jb({payload:e}){var t;null!=e&&e.silentLoading||(yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!0})));const n=[bp],i=[Tp];yield Fo($i.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Wo(200),yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Yb({payload:e}){var t;null!=e&&e.silentLoading||(yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!0})));const n=[bp];yield Fo($i.setApiTokensState({apiTokensDataUser:n})),yield Wo(200),yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Qb({payload:e}){var t;null!=e&&e.silentLoading||(yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!0})));const n=[Tp];yield Fo($i.setApiTokensState({apiTokensDataTenant:n})),yield Wo(200),yield Fo($i.setApiTokensLoader({key:Gb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Xb(){yield Fa($i.loadApiTokens,Jb),yield Fa($i.loadUserApiTokens,Yb),yield Fa($i.loadTenantApiTokens,Qb),yield Na($i.addTenantApiToken,qb),yield Ma($i.deleteTenantApiToken,Hb)}function*Zb({payload:e}){try{var t;yield Fo($i.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Bo((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield Vo(Zf.accountSettings.updateSettings,D({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield Fo($i.setAccountSettingsState(D({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield Fo($i.setAccountSettingsState({loading:!1,error:gg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*eT({payload:e}){yield Fo($i.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Vo(Zf.accountSettings.getSettings);yield Fo($i.setAccountSettingsState(D({},e,{loading:!1})))}catch(e){yield Fo($i.setAccountSettingsState({loading:!1,error:gg(e)}))}}function*tT(){yield Fa($i.saveAccountSettings,Zb),yield Fa($i.loadAccountSettings,eT)}function*nT({payload:e}){var t;yield Fo($i.setAccountSettingsState({loading:!0})),yield Et();const{accountSettingsState:n}=yield Bo((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 Fo($i.setAccountSettingsState(D({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*iT({payload:e}){yield Fo($i.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield Et(),yield Fo($i.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*oT(){yield Fa($i.saveAccountSettings,nT),yield Fa($i.loadAccountSettings,iT)}function*aT({payload:{tenantId:e,callback:t}}){yield Fo($i.setState({isLoading:!0}));try{yield Vo(Zf.tenants.switchTenant,{tenantId:e}),yield Vo(hv),(null==t?void 0:t(!0))||(yield Fo($i.setState({isLoading:!1})))}catch(e){yield Fo($i.setState({isLoading:!1})),null==t||t(!1,e)}}function*rT({payload:e}){yield Fo($i.setTenantsState({loading:!0}));try{var t;const n=yield Vo(Xr());yield Fo($i.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 Fo($i.setTenantsState({loading:!1}))}}function*sT({payload:e}){yield Fo($i.setTenantsState({loading:!0}));try{var t;const n=yield Vo(Zf.tenants.getSubTenants);yield Fo($i.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Fo($i.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*lT({payload:e}){yield Fo($i.setTenantsState({loading:!0}));try{var t;const n=yield Vo(Zf.tenants.getSubTenantsAsTree);yield Fo($i.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Fo($i.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*cT(){yield Na($i.loadTenants,rT),yield Na($i.loadSubTenants,sT),yield Na($i.switchTenant,aT),yield Na($i.loadSubTenantsTree,lT)}function*uT(){yield Fo($i.setTenantsState({loading:!0})),yield Et(),yield Fo($i.setTenantsState({tenants:zp,activeTenant:zp[0],loading:!1}))}function*dT(){yield Na($i.loadTenants,uT)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(Gb||(Gb={}));const yT=["callback"],fT=["callback"],pT=["callback"],gT=["callback"],ST=["callback"];function*vT({payload:e}){var t;yield Fo($i.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Go([Vo(Zf.roles.getRoles),Vo(Zf.roles.getPermissions),Vo(Zf.roles.getPermissionCategories)]),[t,n,i]=e;yield Fo($i.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield Fo($i.setRolesState({error:gg(e),loading:!1}))}}function*hT(e){let{payload:{callback:t}}=e,n=Xi(e.payload,yT);yield Fo($i.setRolesState({saving:!0}));try{const e=yield Vo(Zf.roles.addRole,n),i=yield Vo(Zf.roles.getRoles);yield Fo($i.loadRolesAndPermissions({silentLoading:!0})),yield Fo($i.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield Fo($i.setRolesState({error:gg(e),saving:!1})),null==t||t(null,e)}}function*mT(e){let{payload:{callback:t}}=e,n=Xi(e.payload,fT);yield Fo($i.setRolesState({saving:!0}));try{yield Vo(Zf.roles.deleteRole,n),yield Fo($i.loadRolesAndPermissions({silentLoading:!0})),yield Fo($i.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield Fo($i.setRolesState({error:gg(e),saving:!1})),null==t||t(!1,e)}}function*AT(e){let{payload:{callback:t}}=e,n=Xi(e.payload,pT);yield Fo($i.setRolesState({saving:!0}));try{const e=yield Vo(Zf.roles.updateRole,n);yield Fo($i.loadRolesAndPermissions({silentLoading:!0})),yield Fo($i.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Fo($i.setRolesState({error:gg(e),saving:!1})),null==t||t(null,e)}}function*bT(e){let{payload:{callback:t}}=e,n=Xi(e.payload,gT);yield Fo($i.setRolesState({saving:!0}));try{const e=yield Vo(Zf.roles.attachPermissionsToRole,n);yield Fo($i.loadRolesAndPermissions({silentLoading:!0})),yield Fo($i.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Fo($i.setRolesState({error:gg(e),saving:!1})),null==t||t(null,e)}}function*TT(e){let{payload:{callback:t}}=e,n=Xi(e.payload,ST);yield Fo($i.setRolesState({saving:!0}));try{const e=yield Vo(Zf.roles.attachPermissionToRoles,n);yield Fo($i.loadRolesAndPermissions({silentLoading:!0})),yield Fo($i.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Fo($i.setRolesState({error:gg(e),saving:!1})),null==t||t(null,e)}}function*ET(){yield Fa($i.loadRolesAndPermissions,vT),yield Na($i.addRole,hT),yield Na($i.deleteRole,mT),yield Na($i.updateRole,AT),yield Na($i.attachPermissionsToRole,bT),yield Na($i.attachPermissionToRoles,TT)}function*kT({payload:e}){var t;yield Fo($i.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield Fo($i.setRolesState({roles:Ep,loading:!1}))}catch(e){yield Fo($i.setRolesState({error:gg(e),loading:!1}))}}function*OT(){yield Fa($i.loadRolesAndPermissions,kT)}const IT=["callback"],PT=["callback"],_T=["callback"];function*LT(e){let{payload:{callback:t}}=e,n=Xi(e.payload,IT);yield Fo($i.setResetPhoneNumberState({loading:!0}));try{const e=yield Vo(Zf.auth.resetPhoneNumber,n);yield Fo($i.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Zt.VerifyResetPhoneNumber})),yield Fo($i.setLoginState({email:n.email}))}catch(e){yield Fo($i.setResetPhoneNumberState({loading:!1,error:gg(e)})),null==t||t(null,e)}}function*wT(e){let{payload:{callback:t}}=e,n=Xi(e.payload,PT);yield Fo($i.setResetPhoneNumberState({loading:!0}));try{const e=yield Vo(Zf.auth.verifyResetPhoneNumber,n);yield Fo($i.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Zt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield Fo($i.setResetPhoneNumberState({loading:!1,error:gg(e)})),null==t||t(null,e)}}function*CT(e){let{payload:{callback:t}}=e,n=Xi(e.payload,_T);yield Fo($i.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield Bo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Vo(Zf.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Fo($i.setLoginState({step:_t.loginWithSmsOtc})),yield Fo($i.passwordlessPreLogin({type:Oi.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield Fo($i.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield Fo($i.setResetPhoneNumberState({loading:!1,error:gg(e)})),null==t||t(null,e)}}function*UT(){yield Fa($i.resetPhoneNumber,LT),yield Fa($i.verifyResetPhoneNumber,wT),yield Fa($i.changePhoneNumber,CT)}function*RT(){yield Fo($i.setSessionsState({loading:!0,error:null}));try{const e=yield Vo(Zf.auth.getCurrentUserSessions);yield Fo($i.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Fo($i.setSessionsState({error:e,loading:!1}))}}function*DT(){yield Fo($i.setSessionsState({loading:!0,error:null}));try{const e=yield Vo(Zf.auth.getCurrentUserSession);yield Fo($i.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Fo($i.setSessionsState({error:e,loading:!1}))}}function*NT({payload:{id:e}}){yield Fo($i.setSessionsState({loading:!0,error:null}));try{yield Vo(Zf.auth.deleteSessionForUser,e),yield Fo($i.loadUserSessions())}catch(e){yield Fo($i.setSessionsState({error:e,loading:!1}))}}function*MT({payload:{callback:e,userId:t}}){yield Fo($i.setSessionsState({loading:!0,error:null}));try{yield Vo(Zf.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Fo($i.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*FT(){yield Fo($i.setSessionsState({loading:!0,error:null}));try{yield Vo(Zf.auth.deleteAllSessionsForUser),yield Fo($i.loadUserSessions())}catch(e){yield Fo($i.setSessionsState({error:e,loading:!1}))}}function*GT(){yield Ma($i.loadUserSessions,RT),yield Ma($i.deleteUserSession,NT),yield Ma($i.deleteAllUserSessions,FT),yield Ma($i.loadCurrentUserSession,DT),yield Na($i.revokeUserSessions,MT)}function*$T(){yield Fo($i.setSessionsState({loading:!0,error:null})),yield Fo($i.setSessionsState({sessions:Kp,loading:!1}))}function*VT({payload:{id:e}}){yield Fo($i.setSessionsState({loading:!0,error:null}));const t=(yield Bo((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield Fo($i.setSessionsState({sessions:t,loading:!1}))}function*xT(){yield Fo($i.setSessionsState({loading:!0,error:null}));const e=Kp.filter((e=>e.current));yield Fo($i.setSessionsState({sessions:e,loading:!1}))}function*jT(){yield Ma($i.loadUserSessions,$T),yield Ma($i.deleteUserSession,VT),yield Ma($i.deleteAllUserSessions,xT)}const BT=["callback"],WT=["callback"];function*zT(){yield Fo($i.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Vo(Zf.auth.getSessionConfigurations);yield Fo($i.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Fo($i.setSessionsState({error:e,loading:!1}))}}function*KT({payload:e}){yield Fo($i.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Xi(e,BT);yield Vo(Zf.auth.createOrUpdateSessionConfigrations,n),yield Fo($i.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Fo($i.setSessionsPolicyState({error:e,loading:!1}))}}function*qT(){yield Fa($i.loadSessionsPolicy,zT),yield Ma($i.createOrUpdateSessionsPolicy,Pg(KT))}function*HT(){yield Fo($i.setSessionsPolicyState({loading:!0,error:null}));const e=yield Bo((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:qp}));yield Fo($i.setSessionsPolicyState(D({},e,{loading:!1})))}function*JT({payload:e}){yield Fo($i.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Xi(e,WT);null==t||t(!0),yield Fo($i.setSessionsPolicyState({configurations:n,loading:!1}))}function*YT(){yield Fa($i.loadSessionsPolicy,HT),yield Ma($i.createOrUpdateSessionsPolicy,JT)}const QT=["callback"],XT=["callback"],ZT=["callback"],eE=["callback"],tE=["callback"],nE=["callback"],iE=["callback"],oE=["callback"],aE=()=>Bo((e=>e.auth.restrictionsState.ipRestrictions)),rE=()=>Bo((e=>e.auth.restrictionsState.emailDomainRestrictions));function*sE(){yield Fo($i.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Vo(Zf.auth.getDomainRestrictionsConfig),t=(yield Vo(Zf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Fo($i.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield Fo($i.setEmailDomainRestrictionsState({error:gg(e),loading:!1}))}}function*lE(e){let{payload:{callback:t}}=e,n=Xi(e.payload,QT);yield Fo($i.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield rE();try{var o;yield Vo(Zf.auth.createDomainRestriction,n);const e=(yield Vo(Zf.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield Fo($i.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 Fo($i.setEmailDomainRestrictionsState({saving:!1,error:gg(e)})),null==t||t(null,e)}}function*cE(e){let{payload:{callback:t}}=e,n=Xi(e.payload,XT);yield Fo($i.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Vo(Zf.auth.updateDomainRestrictionConfig,n),i=(yield Vo(Zf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Fo($i.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield Fo($i.setEmailDomainRestrictionsState({saving:!1,error:gg(e)})),null==t||t(null,e)}}function*uE({payload:{id:e}}){yield Fo($i.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield rE();try{var n;yield Vo(Zf.auth.deleteDomainRestriction,e);const i=(yield Vo(Zf.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield Fo($i.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:zn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield Fo($i.setEmailDomainRestrictionsState({saving:!1,error:gg(e)}))}}const dE=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:zn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*yE(){yield Fo($i.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield aE(),t=yield Vo(Zf.auth.getIPRestrictionsConfig),n=dE({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield Vo(Zf.auth.getIPRestrictions,n);yield Fo($i.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield Fo($i.setIpRestrictionsState({error:gg(e),loading:!1}))}}function*fE(){try{const{valid:e}=yield Vo(Zf.auth.testCurrentIpInAllowList);yield Fo($i.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Fo($i.setIpRestrictionsState({error:gg(e)}))}}function*pE({payload:{callback:e}}){yield Fo($i.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Bo((e=>e.auth.userIp));yield Go([Vo(Zf.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:zn.ALLOW}),Vo(Zf.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield aE(),i=dE(n.pagination),{items:o,_metadata:{totalPages:a}}=yield Vo(Zf.auth.getIPRestrictions,i);yield Fo($i.setIpRestrictionsState({data:{config:{isActive:!0,strategy:zn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield Fo($i.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*gE(e){let{payload:{callback:t}}=e,n=Xi(e.payload,ZT);yield Fo($i.setIpRestrictionsState({saving:!0,error:null}));const i=yield aE();try{var o,a;yield Vo(Zf.auth.createIPRestriction,n);const e=yield aE(),r=dE(e.pagination),{items:s,_metadata:{totalPages:l}}=yield Vo(Zf.auth.getIPRestrictions,r);yield fE(),yield Fo($i.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:zn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield Fo($i.setIpRestrictionsState({saving:!1,error:gg(e)})),null==t||t(null,e)}}function*SE(e){let{payload:{callback:t}}=e,n=Xi(e.payload,eE);yield Fo($i.setIpRestrictionsState({saving:!0,error:null}));try{yield Vo(Zf.auth.updateIPRestrictionConfig,n);const e=yield aE(),i=yield Vo(Zf.auth.getIPRestrictionsConfig),o=dE(D({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield Vo(Zf.auth.getIPRestrictions,o);yield fE(),yield Fo($i.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield Fo($i.setIpRestrictionsState({saving:!1,error:gg(e)})),null==t||t(null,e)}}function*vE({payload:{id:e,callback:t}}){yield Fo($i.setIpRestrictionsState({saving:!0,error:null}));const n=yield aE();try{var i;yield Vo(Zf.auth.deleteIPRestriction,e);const o=yield aE(),a=dE(o.pagination),{items:r,_metadata:{totalPages:s}}=yield Vo(Zf.auth.getIPRestrictions,a);yield fE(),yield Fo($i.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:zn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield Fo($i.setIpRestrictionsState({saving:!1,error:gg(e)})),null==t||t(null,e)}}function*hE(){yield Fa($i.loadIpRestrictions,Pg(yE)),yield Fa($i.loadEmailDomainRestrictions,Pg(sE)),yield Na($i.saveIpRestriction,Pg(gE)),yield Na($i.saveIpRestrictionsConfig,Pg(SE)),yield Na($i.deleteIpRestriction,Pg(vE)),yield Na($i.checkIfUserIpValid,Pg(fE)),yield Na($i.addCurrentUserIpAndActivate,Pg(pE)),yield Na($i.saveEmailDomainRestriction,Pg(lE)),yield Na($i.saveEmailDomainRestrictionsConfig,Pg(cE)),yield Na($i.deleteEmailDomainRestriction,Pg(uE))}function*mE(){yield Fo($i.setIpRestrictionsState({loading:!0,error:null})),yield Fo($i.setIpRestrictionsState({data:{restrictions:Jp.filter((e=>e.strategy===Hp.strategy)),config:Hp},totalPages:1,pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*AE(){yield Fo($i.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield aE(),t=Jp[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield Fo($i.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield Fo($i.setIpRestrictionsState({error:gg(e),loading:!1}))}}function*bE(e){var t,n,i;let{payload:{callback:o}}=e,a=Xi(e.payload,tE);yield Fo($i.setIpRestrictionsState({saving:!0,error:null}));const r=yield aE(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield Fo($i.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:zn.ALLOW},restrictions:[...s,D({},a,{createdAt:new Date,updatedAt:new Date,id:bA(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*TE(e){var t,n,i;let{payload:{callback:o}}=e,a=Xi(e.payload,nE);const r=yield aE();yield Fo($i.setIpRestrictionsState({saving:!0,error:null})),yield Fo($i.setIpRestrictionsState({data:{config:D({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield Fo($i.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*EE({payload:{id:e,callback:t}}){var n;yield Fo($i.setIpRestrictionsState({saving:!0,error:null}));const i=yield aE();yield Fo($i.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:zn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*kE(){yield Fo($i.setEmailDomainRestrictionsState({loading:!0,error:null})),yield Fo($i.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:zn.ALLOW}],config:{active:!0,listType:zn.ALLOW,blockPublicDomains:!1}}}))}function*OE(e){var t,n;let{payload:{callback:i}}=e,o=Xi(e.payload,iE);const a=yield rE();yield Fo($i.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==i||i(!0),yield Fo($i.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*IE(e){var t;let{payload:{callback:n}}=e,i=Xi(e.payload,oE);const o=yield rE();yield Fo($i.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==n||n(!0),yield Fo($i.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||zn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*PE({payload:{id:e}}){var t,n;const i=yield rE();yield Fo($i.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),yield Fo($i.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:zn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*_E(){yield Fa($i.loadIpRestrictions,mE),yield Fa($i.loadEmailDomainRestrictions,kE),yield Na($i.saveIpRestriction,bE),yield Na($i.saveIpRestrictionsConfig,TE),yield Na($i.deleteIpRestriction,EE),yield Na($i.checkIfUserIpValid,AE),yield Na($i.saveEmailDomainRestriction,OE),yield Na($i.saveEmailDomainRestrictionsConfig,IE),yield Na($i.deleteEmailDomainRestriction,PE)}const LE=["callback"],wE=["id"];function*CE(e){const{count:t}=yield Vo(Zf.directory.countConfigurationUsers,e.id);return D({},e,{count:t})}function*UE(){yield Fo($i.setProvisioningState({loading:!0,error:null}));try{const e=yield Vo(Zf.directory.getConfigs),t=yield Go(e.map((e=>CE(e))));yield Fo($i.setProvisioningState({connections:t,loading:!1}))}catch(e){yield Fo($i.setProvisioningState({error:gg(e),loading:!1}))}}function*RE(e){let{payload:{callback:t}}=e,n=Xi(e.payload,LE);yield Fo($i.setProvisioningState({loading:!0,error:null}));try{const e=yield Vo(Zf.directory.createConfiguration,n),i=yield Vo(Zf.directory.getConfigs),o=yield Go(i.map((e=>CE(e))));yield Fo($i.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield Fo($i.setProvisioningState({error:gg(e),loading:!1}))}}function*DE(e){let{payload:{id:t}}=e,n=Xi(e.payload,wE);yield Fo($i.setProvisioningState({loading:!0,error:null}));try{yield Vo(Zf.directory.updateConfiguration,t,n);const e=yield Vo(Zf.directory.getConfigs),i=yield Go(e.map((e=>CE(e))));yield Fo($i.setProvisioningState({connections:i,loading:!1}))}catch(e){yield Fo($i.setProvisioningState({error:gg(e),loading:!1}))}}function*NE({payload:{id:e,callback:t}}){yield Fo($i.setProvisioningState({loading:!0,error:null}));try{yield Vo(Zf.directory.deleteConfiguration,e);const n=yield Vo(Zf.directory.getConfigs),i=yield Go(n.map((e=>CE(e))));yield Fo($i.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield Fo($i.setProvisioningState({error:gg(e),loading:!1})),null==t||t(!1,e)}}function*ME(){yield Fa($i.loadProvisionConnections,UE),yield Na($i.createProvisionConnection,RE),yield Na($i.deleteProvisionConnection,NE),yield Na($i.updateProvisionConnection,DE)}const FE=["callback","events"];function*GE(e){let{payload:{callback:t}}=e,n=Xi(e.payload,FE);yield Fo($i.setImpersonateState({loading:!0}));try{yield Vo(Zf.impersonate.impersonate,n),yield Fo($i.setImpersonateState({step:Ri.success})),yield Wo(1e3),yield pv(),yield Fo($i.resetImpersonateState()),null==t||t(!0)}catch(e){yield Fo($i.setImpersonateState({loading:!1,error:gg(e)}))}}function*$E(){yield Fa($i.impersonate,GE)}function*VE({payload:e}){const{callback:t,deviceId:n}=e;yield Fo($i.setPasskeysState({loading:!0}));try{yield Vo(Zf.auth.deleteWebAuthnDevice,n);const{devices:e}=yield Bo((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield Fo($i.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield Fo($i.setPasskeysState({loading:!1,error:gg(e,null)})),null==t||t(null,e)}}function*xE(){yield Fo($i.setPasskeysState({loading:!0}));try{const{devices:e}=yield Vo(Zf.auth.getWebAuthnDevices);yield Fo($i.setPasskeysState({devices:e,loading:!1}))}catch(e){yield Fo($i.setPasskeysState({loading:!1,error:gg(e,null)}))}}function*jE(){yield Na($i.loadWebAuthnDevices,xE),yield Na($i.deleteWebAuthnDevice,VE)}const BE=["roleIds","userIds"],WE=()=>Bo((e=>e.auth.groupsState));function*zE({payload:e}){const t=TA.GET_TEAM_USERS;yield Fo($i.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Vo(Zf.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield Fo($i.setGroupsState({teamUsers:n}))}catch(e){yield Fo($i.setUsersGroupsError({key:t,value:gg(e)}))}finally{yield Fo($i.setUsersGroupsLoader({key:t,value:!1}))}}function*KE({payload:e}){const t=TA.GET_GROUP;yield Fo($i.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Vo(Zf.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:EA.rolesAndUsers});yield Fo($i.setGroupsState({selectedGroup:n}))}catch(e){yield Fo($i.setUsersGroupsError({key:t,value:gg(e)}))}finally{yield Fo($i.setUsersGroupsLoader({key:t,value:!1}))}}function*qE(){const e=TA.GET_GROUPS,t=yield WE();yield Fo($i.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Vo(Zf.groups.getGroups,{_groupsRelations:EA.rolesAndUsers});yield Fo($i.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 Fo($i.setUsersGroupsError({key:e,value:gg(t)}))}finally{yield Fo($i.setUsersGroupsLoader({key:e,value:!1}))}}function*HE({payload:e}){const t=TA.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=Xi(e,BE);yield Fo($i.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Vo(Zf.groups.createGroup,D({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield Fo($i.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield Fo($i.addRolesToGroup({groupId:r.id,roleIds:n}))),yield Fo($i.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield Fo($i.setUsersGroupsError({key:t,value:gg(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield Fo($i.setUsersGroupsLoader({key:t,value:!1}))}}function*JE({payload:e}){const t=TA.UPDATE_GROUP;yield Fo($i.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Vo(Zf.groups.updateGroup,e),yield Fo($i.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Fo($i.setUsersGroupsError({key:t,value:gg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Fo($i.setUsersGroupsLoader({key:t,value:!1}))}}function*YE({payload:e}){const t=TA.DELETE_GROUP;yield Fo($i.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Vo(Zf.groups.deleteGroup,e.groupId),yield Fo($i.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Fo($i.setUsersGroupsError({key:t,value:gg(n)})),null==e||null==(i=e.callback)||i.call(e,!1,n)}finally{yield Fo($i.setUsersGroupsLoader({key:t,value:!1}))}}function*QE({payload:e}){const t=TA.ADD_ROLES_TO_GROUP;yield Fo($i.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Vo(Zf.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield Fo($i.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Fo($i.setUsersGroupsError({key:t,value:gg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Fo($i.setUsersGroupsLoader({key:t,value:!1}))}}function*XE({payload:e}){const t=TA.DELETE_ROLES_FROM_GROUP;yield Fo($i.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Vo(Zf.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield Fo($i.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Fo($i.setUsersGroupsError({key:t,value:gg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Fo($i.setUsersGroupsLoader({key:t,value:!1}))}}function*ZE({payload:e}){const t=TA.ADD_USERS_TO_GROUP;yield Fo($i.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Vo(Zf.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield Fo($i.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 Fo($i.setUsersGroupsError({key:t,value:gg(n)}))}finally{yield Fo($i.setUsersGroupsLoader({key:t,value:!1}))}}function*ek({payload:e}){const t=TA.DELETE_USERS_FROM_GROUP;yield Fo($i.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Vo(Zf.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield Fo($i.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Fo($i.setUsersGroupsError({key:t,value:gg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Fo($i.setUsersGroupsLoader({key:t,value:!1}))}}function*tk(){const e=TA.GET_GROUP_CONFIGURATION;yield Fo($i.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Vo(Zf.groups.getGroupConfiguration);yield Fo($i.setGroupsState({groupsConfiguration:t}))}catch(t){yield Fo($i.setUsersGroupsError({key:e,value:gg(t)}))}finally{yield Fo($i.setUsersGroupsLoader({key:e,value:!1}))}}function*nk({payload:e}){const t=TA.UPDATE_GROUP_CONFIGURATION;yield Fo($i.setUsersGroupsLoader({key:t,value:!0}));try{yield Vo(Zf.groups.updateGroupConfiguration,e),yield Fo($i.getGroupConfiguration())}catch(e){yield Fo($i.setUsersGroupsError({key:t,value:gg(e)}))}finally{yield Fo($i.setUsersGroupsLoader({key:t,value:!1}))}}function*ik(){yield Ma($i.loadGroups,qE),yield Ma($i.getGroupById,KE),yield Ma($i.createGroup,HE),yield Ma($i.updateGroup,JE),yield Ma($i.deleteGroup,YE),yield Ma($i.addRolesToGroup,QE),yield Ma($i.deleteRolesFromGroup,XE),yield Ma($i.addUsersToGroup,ZE),yield Ma($i.deleteUsersFromGroup,ek),yield Ma($i.getGroupConfiguration,tk),yield Ma($i.updateGroupConfiguration,nk),yield Ma($i.getTeamUsers,zE)}function*ok(){const e=TA.GET_GROUPS;yield Fo($i.setUsersGroupsLoader({key:e,value:!0}));const t=Xp;yield Fo($i.setGroupsState({groups:t})),yield Fo($i.setUsersGroupsLoader({key:e,value:!1}))}function*ak({payload:e}){var t;const n=TA.CREATE_GROUP,{groups:i}=yield WE();yield Fo($i.setUsersGroupsLoader({key:n,value:!0})),yield Fo($i.setGroupsState({groups:[D({},e,{id:`${e.name}ID`,managedBy:qf.FRONTEGG}),...null!=i?i:[]]})),yield Wo(500),null==e||null==(t=e.callback)||t.call(e,!0),yield Fo($i.setUsersGroupsLoader({key:n,value:!1}))}function*rk({payload:e}){var t,n,i,o,a;const r=TA.UPDATE_GROUP,s=yield WE();yield Fo($i.setUsersGroupsLoader({key:r,value:!0})),yield Fo($i.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:qf.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 Wo(500),null==e||null==(a=e.callback)||a.call(e,!0),yield Fo($i.setUsersGroupsLoader({key:r,value:!1}))}function*sk({payload:e}){var t,n;const i=TA.DELETE_GROUP,o=yield WE();yield Fo($i.setUsersGroupsLoader({key:i,value:!0})),yield Fo($i.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Wo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Fo($i.setUsersGroupsLoader({key:i,value:!1}))}function*lk({payload:e}){var t,n;const i=TA.ADD_ROLES_TO_GROUP,o=yield WE();yield Fo($i.setUsersGroupsLoader({key:i,value:!0})),yield Fo($i.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 Wo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Fo($i.setUsersGroupsLoader({key:i,value:!1}))}function*ck({payload:e}){var t,n;const i=TA.DELETE_ROLES_FROM_GROUP,o=yield WE();yield Fo($i.setUsersGroupsLoader({key:i,value:!0})),yield Fo($i.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 Wo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Fo($i.setUsersGroupsLoader({key:i,value:!1}))}function*uk({payload:e}){var t,n;const i=TA.ADD_USERS_TO_GROUP,o=yield WE();yield Fo($i.setUsersGroupsLoader({key:i,value:!0})),yield Fo($i.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 Wo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Fo($i.setUsersGroupsLoader({key:i,value:!1}))}function*dk({payload:e}){var t,n;const i=TA.DELETE_USERS_FROM_GROUP,o=yield WE();yield Fo($i.setUsersGroupsLoader({key:i,value:!0})),yield Fo($i.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 Wo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Fo($i.setUsersGroupsLoader({key:i,value:!1}))}function*yk(){const e=TA.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield WE();yield Fo($i.setUsersGroupsLoader({key:e,value:!0})),t&&(yield Fo($i.setGroupsState({groupsConfiguration:D({},t)}))),yield Fo($i.setUsersGroupsLoader({key:e,value:!1}))}function*fk({payload:e}){const t=TA.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield WE();yield Fo($i.setUsersGroupsLoader({key:t,value:!0})),n&&(yield Fo($i.setGroupsState({groupsConfiguration:D({},n,e)}))),yield Fo($i.setUsersGroupsLoader({key:t,value:!1}))}function*pk(){yield Ma($i.loadGroups,ok),yield Ma($i.createGroup,ak),yield Ma($i.updateGroup,rk),yield Ma($i.deleteGroup,sk),yield Ma($i.addRolesToGroup,lk),yield Ma($i.deleteRolesFromGroup,ck),yield Ma($i.addUsersToGroup,uk),yield Ma($i.deleteUsersFromGroup,dk),yield Ma($i.getGroupConfiguration,yk),yield Ma($i.updateGroupConfiguration,fk)}let gk;!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"}(gk||(gk={}));const Sk=(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=>Sk(e,t,n))))?i:[]})};function vk(e,t){var n;return D({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>vk(e,t))):[]})}function hk(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=>hk(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}})),Ak=()=>Bo((e=>e.auth.allAccountsState));function*bk({payload:e}){const t=gk.GET_ACCOUNTS;yield Fo($i.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield Ak(),{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 Ak(),{items:n,_links:o}=yield Vo(Zf.tenants.searchSubTenants,r,{jwt:i}),a=yield Vo(Zf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:i}),l=mk({items:n},a),c=hk(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 Fo($i.setSelectedAccountState({accounts:c}))}else{var l;const{accounts:t}=yield Ak(),{items:n,_links:i}=yield Vo(Zf.tenants.searchSubTenants,r),o=yield Vo(Zf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=mk({items:n},o),s=hk(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 Fo($i.setAllAccountsState({accounts:s}))}}catch(e){yield Fo($i.setAllAccountsError({key:t,value:gg(e)}))}finally{yield Fo($i.setAllAccountsLoader({key:t,value:!1}))}}function*Tk({payload:e}){const t=gk.SEARCH_ACCOUNTS;yield Fo($i.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield Ak(),{jwt:i}=e;try{if(null!=e&&e._subTenantId){var o;const{items:t}=yield Vo(Zf.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(o=null==e?void 0:e._filter)?o:"",_subTenantId:e._subTenantId},{jwt:i});yield Fo($i.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield Fo($i.setAllAccountsError({key:t,value:gg(e)}))}finally{yield Fo($i.setAllAccountsLoader({key:t,value:!1}))}}function*Ek({payload:e}){const t=gk.GET_USER_JWT;yield Fo($i.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:i}=e;try{const e=yield Vo(Zf.users.GetUserJwt,{tenantId:n});yield Fo($i.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==i||i(!0)}catch(e){yield Fo($i.setAllAccountsError({key:t,value:gg(e)})),yield Fo($i.setSelectedAccountState({accessPermission:!1})),null==i||i(!1)}finally{yield Fo($i.setAllAccountsLoader({key:t,value:!1}))}}function*kk({payload:e}){const t=gk.CREATE_SUB_ACCOUNT;yield Fo($i.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:i,tenantId:o,jwt:a,callback:r}=e;try{if(a){const{accounts:e}=yield Ak(),{selectedAccount:t}=yield Ak(),r=yield Vo(Zf.subTenants.createSubTenant,{name:n,parentTenantId:i,tenantId:o},{jwt:a}),s=hk(e,null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),l=hk(D({name:"",tenantId:""},null==t?void 0:t.accounts),null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Fo($i.setAllAccountsState({accounts:s})),yield Fo($i.setSelectedAccountState({accounts:l}))}else{const{accounts:e}=yield Ak(),t=yield Vo(Zf.subTenants.createSubTenant,{name:n,tenantId:o,parentTenantId:i}),a=hk(e,null!=i?i:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Fo($i.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield Fo($i.setAllAccountsError({key:t,value:gg(e)})),null==r||r(!1)}finally{yield Fo($i.setAllAccountsLoader({key:t,value:!1}))}}function*Ok({payload:e}){const t=gk.DELETE_SUB_ACCOUNT;yield Fo($i.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:i,callback:o}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield Ak();yield Vo(Zf.subTenants.deleteSubTenant,i,{jwt:n});const o=vk(t,i),a=vk(null==e?void 0:e.accounts,i);yield Fo($i.setAllAccountsState({accounts:o})),yield Fo($i.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield Ak();yield Vo(Zf.subTenants.deleteSubTenant,i);const t=vk(e,i);yield Fo($i.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield Fo($i.setAllAccountsError({key:t,value:gg(e)})),null==o||o(!1)}finally{yield Fo($i.setAllAccountsLoader({key:t,value:!1}))}}function*Ik({payload:e}){const t=gk.UPDATE_SUB_ACCOUNT_SETTINGS;yield Fo($i.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:i,callback:o,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield Ak();yield Vo(Zf.subTenants.updateSubTenant,{tenantId:a},{name:i},{jwt:n});const o=Sk(e.accounts,a,i);yield Fo($i.setSelectedAccountState({name:i,accounts:o}));const r=Sk(t,a,i);yield Fo($i.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield Ak();yield Vo(Zf.subTenants.updateSubTenant,{tenantId:a},{name:i});const t=Sk(e,a,i);yield Fo($i.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield Fo($i.setAllAccountsError({key:t,value:gg(e)})),null==o||o(!1)}finally{yield Fo($i.setAllAccountsLoader({key:t,value:!1}))}}function*Pk({payload:e}){const t=gk.DELETE_USERS_FROM_ACCOUNT;yield Fo($i.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:i,jwt:o,callback:a}=e;try{yield Vo(Zf.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:i},{jwt:o}),yield Fo($i.getAccountUsers({jwt:o,_tenantId:i[0].tenantId})),null==a||a(!0)}catch(e){yield Fo($i.setAllAccountsError({key:t,value:gg(e)})),null==a||a(!1)}finally{yield Fo($i.setAllAccountsLoader({key:t,value:!1}))}}function*_k({payload:e}){const t=gk.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield Fo($i.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:i,jwt:o,callback:a}=e,{selectedAccount:r}=yield Ak();try{yield Vo(Zf.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:i},{jwt:o}),yield Fo($i.getAccountUsers({jwt:o,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield Fo($i.setAllAccountsError({key:t,value:gg(e)})),null==a||a(!1)}finally{yield Fo($i.setAllAccountsLoader({key:t,value:!1}))}}function*Lk({payload:e}){const t=gk.ADD_USERS_TO_ACCOUNT;yield Fo($i.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:i,jwt:o,callback:a,allowSubAccountAccess:r=!1,roleIds:s}=e;try{yield Vo(Zf.subTenants.addUsersToSubTenant,{users:n,tenantId:i,allowSubAccountAccess:r,roleIds:s},{jwt:o}),yield Fo($i.getAccountUsers({jwt:o,_tenantId:i})),null==a||a(!0)}catch(e){yield Fo($i.setAllAccountsError({key:t,value:gg(e)})),null==a||a(!1)}finally{yield Fo($i.setAllAccountsLoader({key:t,value:!1}))}}function*wk({payload:e}){const t=gk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield Fo($i.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield Ak(),{userId:i,allowAccess:o,jwt:a,callback:r}=e;try{var s;yield Vo(Zf.subTenants.updateSubAccountAccess,i,{allowAccess:o},{jwt:a}),yield Fo($i.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 Fo($i.setAllAccountsError({key:t,value:gg(e)})),null==r||r(!1)}finally{yield Fo($i.setAllAccountsLoader({key:t,value:!1}))}}function*Ck({payload:e}){var t,n,i,o,a,r,s,l;const c=gk.GET_ACCOUNT_USERS;yield Fo($i.setAllAccountsLoader({key:c,value:!0}));const u=yield Ak(),{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 Vo(Zf.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 Vo(Zf.roles.getRoles),o=yield Vo(Zf.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 Fo($i.setSelectedAccountState(D({users:a},i)))}else yield Fo($i.setSelectedAccountState(D({users:[]},i)))}catch(e){yield Fo($i.setAllAccountsError({key:c,value:gg(e)}))}finally{yield Fo($i.setAllAccountsLoader({key:c,value:!1}))}}function*Uk({payload:e}){const t=gk.SET_SELECTED_SUB_ACCOUNT_DATA;yield Fo($i.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var i,o,a,r,s,l,c;const e=yield Vo(Zf.accountSettings.getSettings,{jwt:n}),u=yield Vo(Zf.tenants.getTenantsUsersCount,{tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n}),d=yield Vo(Zf.tenants.getParentTenants,{jwt:n}),y=yield Vo(Zf.tenants.getHierarchyMetadata,{_tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n});yield Fo($i.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 Fo($i.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield Fo($i.setAllAccountsError({key:t,value:gg(e)}))}finally{yield Fo($i.setAllAccountsLoader({key:t,value:!1}))}}function*Rk(){const e=gk.SET_ROOT_ACCOUNT_DATA;yield Fo($i.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield Bo((e=>e.auth.tenantsState)),{accounts:n}=yield Ak();if(t)try{var i;const o=yield Vo(Zf.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 Fo($i.setAllAccountsState({rootAccount:a,accounts:D({},n,a)}))}catch(t){yield Fo($i.setAllAccountsError({key:e,value:gg(t)}))}finally{yield Fo($i.setAllAccountsLoader({key:e,value:!1}))}}function*Dk({payload:e}){const t=gk.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield Fo($i.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:i}=e;try{const e=yield Vo(Zf.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:i});yield Fo($i.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield Fo($i.setAllAccountsError({key:t,value:gg(e)}))}finally{yield Fo($i.setAllAccountsLoader({key:t,value:!1}))}}function*Nk(){yield Ma($i.loadAccounts,bk),yield Ma($i.searchAccounts,Tk),yield Ma($i.updateSubAccountAccessForUser,wk),yield Ma($i.getUserJwtForSubAccount,Ek),yield Ma($i.createSubAccount,kk),yield Ma($i.deleteSubAccount,Ok),yield Ma($i.updateSubAccountSettings,Ik),yield Ma($i.addUsersToAccount,Lk),yield Ma($i.deleteUsersFromAccount,Pk),yield Ma($i.setUserRolesForSubAccount,_k),yield Ma($i.getAccountUsers,Ck),yield Ma($i.setRootAccountData,Rk),yield Ma($i.setSelectedSubAccountData,Uk),yield Ma($i.loadNumberOfUsersForSelectedSubAccount,Dk)}const Mk=["callback"],Fk=["callback"],Gk=["callback","phoneId"],$k=["callback","phoneId"],Vk=["callback"];function*xk(){yield Fo($i.setSmsState({loading:!0}));const e={_limit:10,_offset:0};try{const{items:t}=yield Vo(Zf.userPhoneNumbers.getUserPhoneNumbers,e);yield Fo($i.setSmsState({phoneNumbers:t}))}catch(e){yield Fo($i.setSmsState({error:gg(e)}))}finally{yield Fo($i.setSmsState({loading:!1}))}}function*jk(e){let{payload:{callback:t}}=e,n=Xi(e.payload,Mk);yield Fo($i.setSmsState({loading:!0}));try{const e=yield Vo(Zf.userPhoneNumbers.createPhoneNumber,n);yield Fo($i.setSmsState({otcToken:e.otcToken})),yield Vo(xk),null==t||t(!0)}catch(e){yield Fo($i.setSmsState({error:gg(e)})),null==t||t(null,e)}finally{yield Fo($i.setSmsState({loading:!1}))}}function*Bk(e){let{payload:{callback:t}}=e,n=Xi(e.payload,Fk);yield Fo($i.setSmsState({loading:!0}));try{yield Vo(Zf.userPhoneNumbers.verifyPhoneNumber,n),yield Vo(xk),null==t||t(!0)}catch(e){yield Fo($i.setSmsState({error:gg(e)})),null==t||t(null,e)}finally{yield Fo($i.setSmsState({loading:!1}))}}function*Wk(e){let{payload:{callback:t,phoneId:n}}=e;Xi(e.payload,Gk),yield Fo($i.setSmsState({loading:!0}));try{const e=yield Vo(Zf.userPhoneNumbers.deletePhoneNumber,n);yield Fo($i.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield Fo($i.setSmsState({error:gg(e)})),null==t||t(null,e)}finally{yield Fo($i.setSmsState({loading:!1}))}}function*zk(e){let{payload:{callback:t,phoneId:n}}=e,i=Xi(e.payload,$k);yield Fo($i.setSmsState({loading:!0}));try{yield Vo(Zf.userPhoneNumbers.verifyDeletePhoneNumber,n,i),yield Vo(xk),null==t||t(!0)}catch(e){yield Fo($i.setSmsState({error:gg(e)})),null==t||t(null,e)}finally{yield Fo($i.setSmsState({loading:!1}))}}function*Kk(e){let{payload:{callback:t}}=e,n=Xi(e.payload,Vk);yield Fo($i.setSmsState({loading:!0}));try{const e=yield Vo(Zf.userPhoneNumbers.preVerifyPhoneNumber,n);yield Fo($i.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield Fo($i.setSmsState({error:gg(e)})),null==t||t(null,e)}finally{yield Fo($i.setSmsState({loading:!1}))}}function*qk(){yield Na($i.loadPhoneNumbers,xk),yield Na($i.setUpPhoneNumber,jk),yield Na($i.verifyPhoneNumber,Bk),yield Na($i.deletePhoneNumber,Wk),yield Na($i.verifyDeletePhoneNumber,zk),yield Na($i.preVerifyPhoneNumber,Kk)}var Hk={sagas:function*(){yield Go([Vo(fh),Vo(dA),Vo(fA),Vo(tA),Vo(UT),Vo(Lh),Vo(im),Vo(cm),Vo(kg),Vo(xm),Vo(Sb),Vo(ik),Vo(Fb),Vo(CS),Vo(Kb),Vo(yS),Vo(tT),Vo(cT),Vo(ET),Vo(GT),Vo(qT),Vo(hE),Vo(ME),Vo($E),Vo(jE),Vo(Nk),Vo(BS),Vo(Mg),Vo(qk)])},mockSagas:function*(){yield Go([Vo(Sh),Vo(Mh),Vo(fm),Vo(Ym),Vo(Lb),Vo(Xb),Vo(OS),Vo(jT),Vo(oT),Vo(dT),Vo(YT),Vo(_E),Vo(OT),Vo(pk),Vo(Bg)])},storeName:Dt,initialState:Ui,reducer:Fi,actions:$i};const Jk=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>D({},t,{[e]:D({},t[e],n)})}),Yk={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Qk={setAuditLogsState:Jk("auditLogsState"),resetAuditLogsState:e=>D({},e,{auditLogsState:Yk})},Xk={exportAuditsCsv:yt("auditLogs/exportAuditsCsv"),loadAuditLogs:yt("auditLogs/loadAuditLogs",(e=>({payload:e})))},Zk={loading:!0},eO={setAuditsMetadataState:Jk("auditsMetadataState"),resetAuditsMetadataState:e=>D({},e,{auditsMetadataState:Zk})},tO={loadAuditsMetadata:yt("auditLogs/loadAuditsMetadata")},nO={auditLogsState:Yk,auditsMetadataState:Zk},{reducer:iO,actions:oO}=pt({name:Mt,initialState:nO,reducers:D({resetState:e=>D({},e,nO),setState:(e,{payload:t})=>D({},e,t)},Qk,eO)}),aO=D({},oO,Xk,tO),rO=e=>"createdAt"!==e.id,sO={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`})))},lO={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}]},cO=()=>Bo((e=>e.auditLogs.auditLogsState)),uO=()=>Bo((e=>e.auditLogs.auditsMetadataState));function*dO(){const e=yield cO(),{columns:t}=yield uO();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 Fo(aO.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Zf.audits.exportAudits(D({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield Fo(aO.setAuditLogsState({isDownloadingCsv:!1}))}function*yO({payload:e}){yield Fo(aO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield cO(),{columns:n}=yield uO();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 Fo(aO.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 Fo(aO.loadAuditsMetadata()));const{data:p,total:g}=yield Vo(Zf.audits.getAudits,D({offset:c,count:l},y,f));yield Fo(aO.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 Fo(aO.setAuditLogsState({loading:!1,error:gg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*fO(){yield Na(aO.exportAuditsCsv,dO),yield Na(aO.loadAuditLogs,yO)}function*pO({payload:e}){yield Fo(aO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield cO(),{columns:n}=yield uO();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 Fo(aO.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield Fo(aO.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=sO;let i=n.filter((e=>t=>e.filter(rO).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 Fo(aO.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 Fo(aO.setAuditLogsState({loading:!1,error:gg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*gO(){yield Na(aO.loadAuditLogs,pO)}function*SO(){yield Fo(aO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Vo(Zf.metadata.getAuditsMetadata);yield Fo(aO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Fo(aO.setAuditsMetadataState({error:e,loading:!1}))}}function*vO(){yield Na(aO.loadAuditsMetadata,SO)}function*hO(){yield Fo(aO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=lO;yield Fo(aO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Fo(aO.setAuditsMetadataState({error:e,loading:!1}))}}function*mO(){yield Na(aO.loadAuditsMetadata,hO)}var AO={sagas:function*(){yield Go([Vo(fO),Vo(vO)])},mockSagas:function*(){yield Go([Vo(gO),Vo(mO)])},storeName:Mt,initialState:nO,reducer:iO,actions:aO};const bO={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:TO,actions:EO,reducer:kO}=pt({name:"audits",initialState:bO,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]})))}}}),OO=D({},EO,{initData:yt(`${TO}/initData`),loadAudits:yt(`${TO}/loadAudits`),removeFilter:yt(`${TO}/removeFilter`),filterData:yt(`${TO}/filterData`),exportCSV:yt(`${TO}/exportCSV`),deleteAudits:yt(`${TO}/deleteAudits`)}),IO=()=>Bo((e=>e[TO]));function*PO(){const{sortBy:e,sortDirection:t}=yield IO();try{const n=yield Vo(Zf.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Fo(OO.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Fo(OO.loadItemFailedAction(t))}}function*_O(){try{const e=yield Vo(Zf.metadata.getAuditsMetadata);yield Fo(OO.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Fo(OO.loadItemFailedAction(t))}}const LO=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*wO({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield IO(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield IO():{rowsData:[]};try{const e=LO(t),{data:s,total:d}=yield Vo(Zf.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 Fo(OO.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield Fo(OO.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Fo(OO.loadItemFailedAction(t))}}function*CO(){yield Fo(OO.startLoading()),yield Go([PO(),_O(),wO({payload:{onlyOneLoad:!1},type:""})]),yield Fo(OO.finishLoading())}function*UO({payload:e}){const{filters:t}=yield IO(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield Fo(OO.setFilterData(i))}function*RO({payload:e}){const{filters:t}=yield IO();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 Fo(OO.setFilterData(i))}function*DO(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield IO(),a=LO(e);yield Fo(OO.startDownloadingCsv());try{yield Zf.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 Fo(OO.stopDownloadingCsv())}}function*NO(){yield Ma(OO.initData,CO),yield Ma(OO.removeFilter,UO),yield Ma(OO.filterData,RO),yield Ma([OO.loadAudits,OO.textSearch,OO.onPageChange],wO),yield Ma([OO.setFilterData,OO.setDataSorting,OO.startRefresh],(()=>wO({payload:{appendMode:!1},type:""}))),yield Ma(OO.exportCSV,DO)}const MO={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},FO={initData:()=>D({},MO),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)})}},GO={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}})))},$O={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:VO,actions:xO}=pt({name:Nt,initialState:$O,reducers:D({},FO)}),jO=D({},xO,GO),BO={slack:Zf.connectivity.getSlackConfiguration,email:Zf.connectivity.getEmailConfiguration,sms:Zf.connectivity.getSMSConfiguration,webhook:Zf.connectivity.getWebhooksConfigurations,categories:Zf.connectivity.getCategories,channelMap:Zf.connectivity.getChannelMaps},WO={slack:Zf.connectivity.postSlackConfiguration,email:Zf.connectivity.postEmailConfiguration,sms:Zf.connectivity.postSMSConfiguration,webhook:Zf.connectivity.postWebhooksConfiguration},zO=["email","slack","sms","webhook"],KO={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"}},qO=["id"],HO=["id","enabled"],JO=["categories","channelMap"];function*YO(e){return yield Vo(XO,{payload:{api:e},type:""})}function*QO({payload:e=zO}){yield Fo(jO.setConnectivityState({isLoading:!0}));try{const t=yield Go([...e.map(YO),yield XO({payload:{api:"categories"},type:""}),yield function*(){return(yield Go(e.map((function*(e){return yield XO({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>D({},t,{[`${e[i]}`]:n})),{})}()]),n=yield XO({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:KO[e[o]].events(i),active:KO[e[o]].isActive(i),platform:KO[e[o]].title,image:KO[e[o]].image}]}):n:D({},n,{[`${JO[o-e.length]}`]:i})),{list:[],webhook:n});yield Fo(jO.setConnectivityState(D({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Fo(jO.setConnectivityState({isLoading:!1}))}}function*XO({payload:{api:e,params:t}}){try{return yield Vo(BO[e],t)}catch(e){return}}function*ZO(){try{yield Fo(jO.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Vo(Zf.connectivity.getSlackChannels);yield Fo(jO.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Fo(jO.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*eI(e,t){const{connectivity:{list:n}}=yield Bo(),i=n.find((({key:t})=>t===e));if(!i)return;const o=KO[e].isActive(t);o!==i.active&&(yield Fo(jO.setConnectivityState({list:n.map((t=>t.key===e?D({},t,{active:o}):t))})))}function*tI({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield Bo((e=>e.connectivity));try{if(yield Fo(jO.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Bo();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield Go([...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=Xi(e,qO);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 Vo(WO.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Vo(Zf.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Bo(),{processIds:i}=yield Bo((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield Go([...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 Vo("email"===t?Zf.connectivity.postEmailConfiguration:Zf.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=Xi(o,HO);return yield Go([yield Vo("email"===t?Zf.connectivity.patchEmailConfiguration:Zf.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield Vo("email"===t?Zf.connectivity.putEmailSubscriptions:Zf.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 Vo("email"===t?Zf.connectivity.deleteEmailSubscriptions:Zf.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield XO({payload:{api:t},type:""});yield Fo(jO.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield eI(t,e)}else yield Fo(jO.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield Vo(WO[e],t),!["sms","email"].includes(e)){const o=yield XO({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield Fo(jO.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield eI(e,o),null==n||n(!0)}}catch(e){yield Fo(jO.setConnectivityState({error:gg(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*nI({payload:e}){try{yield Zf.connectivity.postSlackCode(e)}catch{}yield Fo(jO.setConnectivityState({error:void 0,isSaving:!1}))}function*iI(){const{slackChannels:e}=yield Bo((e=>e.connectivity));try{yield Fo(jO.setConnectivityState({slackChannels:D({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Vo(Zf.connectivity.getSlackScope);yield Fo(jO.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Fo(jO.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*oI({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield Bo((e=>e.connectivity));try{yield Fo(jO.setConnectivityState({isSaving:!0})),yield Vo(Zf.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,gg(e))}const o=yield XO({payload:{api:"webhook"},type:""});o&&(yield Fo(jO.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*aI({payload:e}){try{yield Fo(jO.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Vo(Zf.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Fo(jO.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Fo(jO.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Fo(jO.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*rI({payload:e}){try{const{statusCode:t}=yield Vo(Zf.connectivity.postWebhookRetry,e);yield Fo(jO.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Fo(jO.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*sI({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield Bo((e=>e.connectivity));try{yield Fo(jO.setConnectivityState({webhookLogs:D({},i,{isLoading:!0})}));const o=yield Vo(Zf.connectivity.getWebhookLog,e,n,t);yield Fo(jO.setConnectivityState({error:void 0,webhookLogs:D({isLoading:!1},o)}))}catch(e){yield Fo(jO.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var lI={sagas:function*(){yield Na(jO.loadDataAction,QO),yield Ma(jO.loadSlackActions,ZO),yield Na(jO.postDataAction,tI),yield Na(jO.postCodeAction,nI),yield Na(jO.loadScope,iI),yield Na(jO.deleteWebhookConfigAction,oI),yield Na(jO.postWebhookTestAction,aI),yield Na(jO.postWebhookRetryAction,rI),yield Ma(jO.loadWebhookLogsAction,sI)},storeName:Nt,initialState:$O,reducer:VO,actions:jO};function cI(){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 uI(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>D({},n,{[e]:t(n[e],i)})}}function dI(e){return uI(e,((e,t)=>D({},e,{loading:t.payload})))}function yI(e){return uI(e,((e,t)=>D({},e,{error:t.payload,loading:!1})))}const fI={loading:!1,error:null,fetching:!0,plans:[]},{actions:pI,reducer:gI,name:SI}=pt({name:"subscriptions/plans",initialState:fI,reducers:D({},cI())}),vI=D({loadPlans:yt(`${SI}/loadPlans`)},pI),hI={loading:!1,error:null,fetching:!0,config:null},mI=D({},cI()),{actions:AI,reducer:bI,name:TI}=pt({name:"subscriptions/config",initialState:hI,reducers:mI}),EI=D({loadPaymentConfiguration:yt(`${TI}/loadPaymentConfiguration`)},AI),kI={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},OI=D({},cI(),{setCancellationLoading:dI("cancellation"),setCancellationError:yI("cancellation"),setRenewalLoading:dI("renewal"),setRenewalError:yI("renewal")}),{reducer:II,actions:PI,name:_I}=pt({name:"subscriptions/billing/subscription",initialState:kI,reducers:OI}),LI=D({load:yt(`${_I}/loadSubscription`),cancelSubscription:yt(`${_I}/cancelSubscription`),renewSubscription:yt(`${_I}/renewSubscription`)},PI),wI={loading:!1,error:null,fetching:!0},CI=D({},cI()),{reducer:UI,actions:RI,name:DI}=pt({name:"subscriptions/billing/information",initialState:wI,reducers:CI}),NI=D({loadBillingInformation:yt(`${DI}/loadBillingInformation`),cancelSubscription:LI.cancelSubscription,renewSubscription:LI.renewSubscription},RI),MI={loading:!1,error:null,fetching:!0},FI=D({},cI(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,t.payload)}}),{reducer:GI,actions:$I,name:VI}=pt({name:"subscriptions/billing/payment",initialState:MI,reducers:FI}),xI=D({loadPaymentMethod:yt(`${VI}/loadPaymentMethod`),submitPaymentMethod:yt(`${VI}/submitPaymentMethod`),submitPaymentMethodError:yt(`${VI}/submitPaymentMethodError`),submitPaymentMethodSuccess:yt(`${VI}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:yt(`${VI}/updateBillingDetails`,(e=>({payload:e})))},$I),jI={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},BI=D({},cI(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,{invoiceDownload:D({},e.invoiceDownload,t.payload)})}}),{reducer:WI,actions:zI,name:KI}=pt({name:"subscriptions/billing/invoices",initialState:jI,reducers:BI}),qI=D({loadInvoices:yt(`${KI}/loadInvoices`),downloadInvoice:yt(`${KI}/downloadInvoice`,(e=>({payload:e})))},zI),HI={information:wI,invoices:jI,paymentMethod:MI,subscription:kI},JI={invoices:qI,information:NI,paymentMethod:xI,subscription:LI},YI=Ke({invoices:WI,information:UI,paymentMethod:GI,subscription:II}),QI={fetching:!0,loading:!1,error:null,confirmed:!1},XI=D({},cI()),{actions:ZI,reducer:eP,name:tP}=pt({name:"subscriptions/checkout",initialState:QI,reducers:XI}),nP=D({loadCheckout:yt(`${tP}/loadCheckout`),resetCheckout:yt(`${tP}/resetCheckout`),submitCheckout:yt(`${tP}/submitCheckout`),confirmCheckout:yt(`${tP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:yt(`${tP}/errorCheckout`,(e=>({payload:e})))},ZI),iP={loading:!1,error:null,cardSetupIntentSecret:null},oP=D({},cI()),{reducer:aP,actions:rP,name:sP}=pt({name:"subscriptions/stripe",initialState:iP,reducers:oP}),lP=D({loadCustomer:yt(`${sP}/loadCustomer`),createCardSetupIntentSecret:yt(`${sP}/createCardSetupIntentSecret`)},rP),cP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:uP,reducer:dP,name:yP}=pt({name:"subscriptions/vendorPublicConfig",initialState:cP,reducers:D({},cI())}),fP=D({loadVendorPublicConfiguration:yt(`${yP}/loadVendorPublicConfiguration`)},uP),pP={config:hI,plans:fI,checkout:QI,billing:HI,stripe:iP,vendorPublicConfig:cP},gP={config:EI,billing:JI,plans:vI,checkout:nP,stripe:lP,vendorPublicConfig:fP},SP=Ke({config:bI,billing:YI,plans:gI,checkout:eP,stripe:aP,vendorPublicConfig:dP});let vP,hP,mP;function AP({policy:e}){return{policy:mP.AT_PERIOD_END}}function bP(e){switch(e){case Wy.ACTIVE:return hP.ACTIVE;case Wy.INCOMPLETE:return hP.INCOMPLETE;case Wy.CANCELED:return hP.CANCELED;case Wy.EXPIRED:return hP.EXPIRED;case Wy.TRIALING:return hP.TRIALING;default:return hP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(vP||(vP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(hP||(hP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(mP||(mP={}));const TP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Wy.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},EP=[{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"}],kP=[{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:""}],OP=[{id:"id",externalId:"externalId",type:zy.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],IP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*PP(){yield Fo(LI.setLoading(!0));try{const[e]=yield Vo(Zf.subscriptions.getManagedSubscriptions);yield Fo(LI.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Fo(LI.setError(e))}}function*_P(){yield Na(NI.loadBillingInformation,LP)}function*LP(){yield function*(e){const t=yield Bo((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Bo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield wP(n,!1):yield Fo(NI.setError(t?"Not authorized":"Internal feature failure"))}()}function*wP(e,t){yield Fo(NI.setLoading(!0));try{var n,i;const o=yield Vo(Zf.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield Vo(Zf.subscriptions.getSubscriptionPlan,a):([,s]=yield Go([Vo(PP),Vo(Zf.subscriptions.getSubscriptionPlan,a)]),l=yield Bo((e=>e.subscriptions.billing.subscription.subscription||null))),yield Fo(NI.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?hP.ACTIVE:bP(l.status),cancellation:l.cancellation&&AP(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 Fo(NI.setError(gg(e)))}}function*CP(){yield function*(){var e,t;yield Fo(NI.setLoading(!0)),yield Wo(500),yield Fo(NI.setState({loading:!1,fetching:!1,summary:{subscriptionId:TP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:qy.Stripe,externallyManaged:!1,currentPlanId:EP[0].id,defaultPlanId:EP[0].id},plan:D({},EP[0],{price:null==(e=EP[0].price)?void 0:e.amount,currency:null==(t=EP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*UP(){yield Na(NI.loadBillingInformation,CP)}function*RP(){yield Na(xI.loadPaymentMethod,DP),yield Na(xI.submitPaymentMethod,MP),yield Na(xI.submitPaymentMethodError,FP),yield Na(xI.submitPaymentMethodSuccess,GP),yield Na(xI.updatePaymentMethodBillingDetails,NP)}function*DP(){yield Fo(xI.setLoading(!0));try{const e=(yield Vo(Zf.subscriptions.getPaymentMethods))[0];yield Fo(xI.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Fo(xI.setError(gg(e)))}}function*NP({payload:e}){yield Fo(xI.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield Vo(Zf.subscriptions.updatePaymentMethodBillingDetails,t,D({email:n},i)),yield Vo(DP),null==o||o(!0)}catch(e){yield Fo(xI.setError(gg(e))),null==o||o(!1)}yield Fo(xI.setLoading(!1))}function*MP(){yield Fo(xI.setLoading(!0))}function*FP({payload:e}){yield Fo(xI.setError(e))}function*GP(){yield Fo(xI.loadPaymentMethod())}function*$P(){yield Fo(xI.setLoading(!0)),yield Wo(500);const e=OP[0];yield Fo(xI.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*VP(){yield Na(xI.loadPaymentMethod,$P)}function*xP(){yield Na(qI.loadInvoices,jP),yield Na(qI.downloadInvoice,BP)}function*jP(){yield Fo(qI.setLoading(!0));try{const e=(yield Vo(Zf.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 Fo(qI.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Fo(qI.setError(gg(e)))}}function*BP({payload:e}){yield Fo(qI.setInvoiceDownloadState({loading:!0,error:null}));try{yield Vo(Zf.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Fo(qI.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Fo(qI.setInvoiceDownloadState({loading:!1,error:gg(e,null)}))}}function*WP(){yield Fo(qI.setLoading(!0)),yield Wo(500),yield Fo(qI.setState({loading:!1,fetching:!1,invoices:kP.map((e=>D({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Fo(qI.setLoading(!1))}function*zP(){yield Na(qI.loadInvoices,WP)}function*KP(){yield Na(LI.load,qP),yield Na(LI.cancelSubscription,HP),yield Na(LI.renewSubscription,JP)}function*qP(){const e=yield Bo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield wP(e)}function*HP(){const{subscription:e}=yield Bo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Fo(LI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Fo(LI.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Wy.ACTIVE)try{yield Fo(LI.setCancellationLoading(!0)),yield Vo(Zf.subscriptions.cancelManagedSubscription,t),yield PP(),yield Fo(LI.setCancellationLoading(!1))}catch(e){yield Fo(LI.setCancellationError(gg(e)))}}function*JP(){const{subscription:e}=yield Bo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Fo(LI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Fo(LI.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Ky.AT_PERIOD_END)try{yield Fo(LI.setRenewalLoading(!0)),yield Vo(Zf.subscriptions.renewManagedSubscription,t),yield PP(),yield Fo(LI.setRenewalLoading(!1))}catch(e){yield Fo(LI.setCancellationError(gg(e)))}}function*YP(){yield Fo(LI.setLoading(!0)),yield Wo(500),yield Fo(LI.setState({subscription:TP,fetching:!1,loading:!1,error:null}))}function*QP(){yield Na(LI.load,YP)}function*XP(){yield Go([Vo(_P),Vo(RP),Vo(xP),Vo(KP)])}function*ZP(){yield Go([Vo(UP),Vo(VP),Vo(zP),Vo(QP)])}function*e_(){yield Na(nP.loadCheckout,t_),yield Na(nP.resetCheckout,n_),yield Na(nP.submitCheckout,i_),yield Na(nP.confirmCheckout,o_),yield Na(nP.errorCheckout,r_)}function*t_(){yield Fo(nP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*n_(){yield Fo(nP.setState({loading:!1,error:null,confirmed:!1}))}function*i_(){yield Fo(nP.setState({loading:!0,error:null}))}function*o_({payload:{paymentMethodId:e,planId:t}}){const n=yield Bo((e=>e.subscriptions.billing.subscription.subscription)),i=yield Bo((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Wy.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield Fo(nP.setState({loading:!0,error:null})),o&&a)return yield a_(),void(yield Fo(LI.setState({subscription:D({},n,{status:Wy.ACTIVE})})));try{yield Vo(Zf.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Go([LP(),DP(),jP()]),yield a_()}catch(e){yield Fo(nP.setState({loading:!1,error:gg(e)}))}}else yield Fo(nP.setState({loading:!1,error:"Subscription not found"}))}function*a_(){yield Fo(nP.setState({loading:!1,error:null,confirmed:!0}))}function*r_({payload:e}){yield Fo(nP.setState({loading:!1,error:e}))}function*s_(){yield Na(nP.resetCheckout,n_)}function*l_(){yield Na(vI.loadPlans,c_)}function*c_(){yield Fo(vI.setLoading(!0));try{const e=(yield Vo(Zf.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 Fo(vI.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Fo(vI.setError(gg(e)))}}function*u_(){yield Fo(vI.setLoading(!0)),yield Wo(500),yield Fo(vI.setState({fetching:!1,loading:!1,plans:EP.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*d_(){yield Na(vI.loadPlans,u_)}function*y_(){yield Na(EI.loadPaymentConfiguration,f_)}function*f_(){yield Fo(EI.setLoading(!0));try{(yield Vo(Zf.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===qy.Stripe))?yield function*(){yield Fo(EI.setLoading(!0));try{const e=yield Vo(Zf.subscriptions.getStripePaymentProviderConfiguration);yield Fo(EI.setState({loading:!1,fetching:!1,config:{paymentProvider:vP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Fo(EI.setError(gg(e)))}}():yield Fo(EI.setError("Payment provider not configured"))}catch(e){yield Fo(EI.setError(gg(e)))}}function*p_(){yield Fo(EI.setLoading(!0)),yield Wo(500),yield Fo(EI.setState({loading:!1,fetching:!1,config:{paymentProvider:vP.STRIPE,apiKey:""}}))}function*g_(){yield Na(EI.loadPaymentConfiguration,p_)}function*S_(){yield Na(lP.createCardSetupIntentSecret,v_)}function*v_({payload:e}){yield Fo(lP.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Vo(Zf.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Fo(lP.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Fo(lP.setError(gg(e)))}}function*h_(){yield Na(fP.loadVendorPublicConfiguration,m_)}function*m_(){yield Fo(fP.setLoading(!0));try{const e=yield Vo(Zf.subscriptions.getVendorPublicConfigurations);yield Fo(fP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Fo(fP.setError(gg(e)))}}function*A_(){yield Fo(fP.setLoading(!0)),yield Wo(500),yield Fo(fP.setState({fetching:!1,loading:!1,vendorPublicConfig:IP}))}function*b_(){yield Na(fP.loadVendorPublicConfiguration,A_)}var T_={sagas:function*(){yield Go([Vo(XP),Vo(e_),Vo(l_),Vo(y_),Vo(S_),Vo(h_)])},mockSagas:function*(){yield Go([Vo(ZP),Vo(s_),Vo(d_),Vo(g_),Vo(b_)])},reducer:SP,actions:gP,initialState:pP,storeName:"subscriptions"},E_={sagas:function*(){yield Na(FS.loadVendorPublicInfo,GS)},storeName:Ft,initialState:DS,reducer:NS,actions:FS};const{reducer:k_}=pt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Ga.setContext(t),D({},e,{context:t}))}}}),O_=(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||Ga.setContext(e.context);const t=Ia(),s=[...ut({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=dt({middleware:s,preloadedState:{root:D({},e,{previewMode:n,urlStrategy:r}),[Hk.storeName]:D({},Hk.initialState,i,null!=(c=null==o?void 0:o.auth)?c:{},{routes:D({},Hk.initialState.routes,null!=(u=null==i?void 0:i.routes)?u:{},null!=(d=null==o||null==(y=o.auth)?void 0:y.routes)?d:{})}),[AO.storeName]:D({},AO.initialState,null!=(f=null==o?void 0:o.auditLogs)?f:{},{auditLogsState:D({},AO.initialState.auditLogsState,null!=(p=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:D({},AO.initialState.auditsMetadataState,null!=(S=null==o||null==(v=o.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[TO]:D({},bO,null!=(h=null==o?void 0:o.audits)?h:{}),[lI.storeName]:lI.initialState,[T_.storeName]:T_.initialState,[E_.storeName]:E_.initialState},reducer:Ke({root:k_,[Hk.storeName]:Hk.reducer,[AO.storeName]:AO.reducer,[TO]:kO,[lI.storeName]:lI.reducer,[T_.storeName]:T_.reducer,[E_.storeName]:E_.reducer})});const m=function*(){yield Go([Vo(Hk.sagas),Vo(AO.sagas),Vo(NO),Vo(lI.sagas),Vo(T_.sagas),Vo(E_.sagas)])},A=function*(){yield Go([Vo(Hk.mockSagas),Vo(AO.mockSagas),Vo(T_.mockSagas)])};n?(l.store.destroy=t.run(A).cancel,l.store.dispatch($i.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 I_=n(314);const P_=()=>{if(!Ga.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")},__=(e,t)=>e?e.isEntitled?{isEntitled:!0}:{isEntitled:!1,justification:e.justification}:{isEntitled:!1,justification:t};var L_=n(714),w_=n.n(L_);function C_(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function U_(e){if(e.type)return e;if("#"===e.charAt(0))return U_(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 R_(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 D_(e){if(0===e.indexOf("#"))return e;const{values:t}=U_(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 N_(e,t){return e=U_(e),t=C_(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,R_(e)}function M_(e,t){if(e=U_(e),t=C_(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 R_(e)}function F_(e,t){if(e=U_(e),t=C_(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 R_(e)}const G_=e=>{if(e)return{main:e,light:D_(F_(e,.4)),dark:D_(M_(e,.15)),hover:D_(M_(e,.15)),active:D_(M_(e,.2))}},$_=e=>{if(e)return{main:e,light:F_(e,.7),dark:M_(e,.2)}},V_=(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({},G_(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({},G_(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({},G_(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:D({},$_(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:D({},$_(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:D({},$_(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:D({},$_(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},x_={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 j_{constructor(){this._theme=x_.theme,this._themeV2=x_.themeV2,this._navigation=x_.navigation,this._localizations=x_.localizations,this._integrations=x_.integrations}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new j_;return n.set(e),j_._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=w_().all([null!=(t=x_.navigation)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=w_().all([null!=(i=x_.theme)?i:{},V_(null==e?void 0:e.theme,x_.theme)]),this._themeV2=w_().all([null!=(o=x_.themeV2)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=w_().all([null!=(r=x_.localizations)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}]),this._integrations=w_().all([null!=(l=x_.integrations)?l:{},null!=(c=null==e?void 0:e.integrations)?c:{}])}catch(e){this._navigation=x_.navigation,this._theme=x_.theme,this._themeV2=x_.themeV2,this._localizations=x_.localizations,this._integrations=x_.integrations}}}j_._instances={};var B_=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},W_=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},z_=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)}))},K_=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 q_,H_,J_,Y_,Q_,X_,Z_,eL,tL,nL,iL,oL;!function(e){e.phoneNumber="phoneNumber"}(q_||(q_={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(H_||(H_={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(J_||(J_={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(Y_||(Y_={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(Q_||(Q_={})),function(e){e.Invoices="invoices"}(X_||(X_={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(Z_||(Z_={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(eL||(eL={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(tL||(tL={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(nL||(nL={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(iL||(iL={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(oL||(oL={}));const aL={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},rL={hidden:"hidden",edit:"edit"};var sL="6.160.0",lL={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"},cL=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(sL),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=Lr,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:j_.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}$r.set(lL,a.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Vr();case 7:t=e.sent,a.options.overrideFeatureFlags&&Object.assign(t,a.options.overrideFeatureFlags),$r.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){$r.set(D({},lL,e),a.name)},this.queryFeatureFlags=function(e){return $r.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([Fr]),1)[0]}};var l=B_(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=O_({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);C.setInstance(l,this),this.setEntitlementsOptions(t.entitlementsOptions),this.setSessionContext({enableSessionPerTenant:null==(o=t.authOptions)?void 0:o.enableSessionPerTenant}),Ga.setAppName(l)}var t,n,i,o;return w(e,[{key:"setEntitlementsOptions",value:function(e){Ga.setEntitlementsOptions(D({},e))}},{key:"setSessionContext",value:function(e){Ga.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=j_.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;j_.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 Ga.setRequestSource(ui.AdminPortal),e.next=3,this.loadScript("FronteggAdminPortal");case 3:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e,t=new URLSearchParams(window.location.search);null==(e=this.adminPortalRenderer)||e.unmount(),K_(t),Ga.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 P_(),i?(0,I_.tE)(t,e,n):__(null==e||null==(o=e.features)?void 0:o[t],Bs.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 P_(),i?(0,I_.wJ)(t,e,n):__(null==e||null==(o=e.permissions)?void 0:o[t],Bs.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}(),uL=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=C.getInstance(i);e&&t?(Ga.setAccessToken(t),Ga.setUser(D({},n,{accessToken:t})),o.store.dispatch($i.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch($i.loadTenants())):(Ga.setAccessToken(null),Ga.setUser(null),o.store.dispatch($i.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),dL=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";C.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";C.getInstance(e).hideAdminPortal()}}]),e}(),yL=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";C.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";C.getInstance(e).hideCheckoutDialog()}}]),e}(),fL=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},pL=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=O_({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 cL(this.options,t,!0),j_.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,z_(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}(),gL="modern",SL=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[gL]},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.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=O_({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 cL(this.options,t,!0,a),j_.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,z_(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 hL(e,t){return hL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},hL(e,t)}function mL(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&&hL(e,t)}function AL(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 bL(e){return bL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},bL(e)}function TL(){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 EL(e,t,n){return EL=TL()?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&&hL(o,n.prototype),o},EL.apply(null,arguments)}function kL(e){var t="function"==typeof Map?new Map:void 0;return kL=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 EL(e,arguments,bL(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),hL(n,e)},kL(e)}function OL(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=bL(e);if(t){var o=bL(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return AL(this,n)}}var IL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new cL(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){mL(n,e);var t=OL(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=C.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=W_(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=W_(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=W_(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=W_(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=W_(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=W_(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}(kL(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}()}));