jplan-pack 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,7 +53,7 @@ Error Description: ${s.errorMessage}`);else{const l=s;this.logger.error(`A non-M
53
53
  Error: ${l.name}
54
54
  Error Description: ${l.message}`)}return null}return n||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),n=St.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),n}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(t=>t&&ye.getDomainFromUrl(t).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,t){let n;if(t&&t.azureCloudInstance!==Qd.None){const i=t.tenant?t.tenant:P.DEFAULT_COMMON_TENANT;n=`${t.azureCloudInstance}/${i}/`}return n||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return P.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw B(vr)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return aC.has(e)}static isPublicCloudAuthority(e){return P.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,t,n){const i=new ye(e);i.validateAsUri();const s=i.getUrlComponents();let l=`${t}.${s.HostNameAndPort}`;this.isPublicCloudAuthority(s.HostNameAndPort)&&(l=`${t}.${P.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const d=ye.constructAuthorityUriFromObject({...i.getUrlComponents(),HostNameAndPort:l}).urlString;return n?`${d}?${n}`:d}static replaceWithRegionalInformation(e,t){const n={...e};return n.authorization_endpoint=St.buildRegionalAuthorityString(n.authorization_endpoint,t),n.token_endpoint=St.buildRegionalAuthorityString(n.token_endpoint,t),n.end_session_endpoint&&(n.end_session_endpoint=St.buildRegionalAuthorityString(n.end_session_endpoint,t)),n}static transformCIAMAuthority(e){let t=e;const i=new ye(e).getUrlComponents();if(i.PathSegments.length===0&&i.HostNameAndPort.endsWith(P.CIAM_AUTH_URL)){const s=i.HostNameAndPort.split(".")[0];t=`${t}${s}${P.AAD_TENANT_DOMAIN_SUFFIX}`}return t}}St.reservedTenantDomains=new Set(["{tenant}","{tenantid}",zr.COMMON,zr.CONSUMERS,zr.ORGANIZATIONS]);function hx(r){var i;const n=(i=new ye(r).getUrlComponents().PathSegments.slice(-1)[0])==null?void 0:i.toLowerCase();switch(n){case zr.COMMON:case zr.ORGANIZATIONS:case zr.CONSUMERS:return;default:return n}}function uC(r){return r.endsWith(P.FORWARD_SLASH)?r:`${r}${P.FORWARD_SLASH}`}function fx(r){const e=r.cloudDiscoveryMetadata;let t;if(e)try{t=JSON.parse(e)}catch{throw Pe(th)}return{canonicalAuthority:r.authority?uC(r.authority):void 0,knownAuthorities:r.knownAuthorities,cloudDiscoveryMetadata:t}}/*! @azure/msal-common v14.16.0 2024-11-05 */async function dC(r,e,t,n,i,s,l){l==null||l.addQueueMeasurement(k.AuthorityFactoryCreateDiscoveredInstance,s);const d=St.transformCIAMAuthority(uC(r)),f=new St(d,e,t,n,i,s,l);try{return await U(f.resolveEndpointsAsync.bind(f),k.AuthorityResolveEndpointsAsync,i,l,s)(),f}catch{throw B(vr)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class Gr extends He{constructor(e,t,n,i,s){super(e,t,n),this.name="ServerError",this.errorNo=i,this.status=s,Object.setPrototypeOf(this,Gr.prototype)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class Yn{static generateThrottlingStorageKey(e){return`${sa.THROTTLING_PREFIX}.${JSON.stringify(e)}`}static preProcess(e,t){var s;const n=Yn.generateThrottlingStorageKey(t),i=e.getThrottlingCache(n);if(i){if(i.throttleTime<Date.now()){e.removeItem(n);return}throw new Gr(((s=i.errorCodes)==null?void 0:s.join(" "))||P.EMPTY_STRING,i.errorMessage,i.subError)}}static postProcess(e,t,n){if(Yn.checkResponseStatus(n)||Yn.checkResponseForRetryAfter(n)){const i={throttleTime:Yn.calculateThrottleTime(parseInt(n.headers[Pt.RETRY_AFTER])),error:n.body.error,errorCodes:n.body.error_codes,errorMessage:n.body.error_description,subError:n.body.suberror};e.setThrottlingCache(Yn.generateThrottlingStorageKey(t),i)}}static checkResponseStatus(e){return e.status===429||e.status>=500&&e.status<600}static checkResponseForRetryAfter(e){return e.headers?e.headers.hasOwnProperty(Pt.RETRY_AFTER)&&(e.status<200||e.status>=300):!1}static calculateThrottleTime(e){const t=e<=0?0:e,n=Date.now()/1e3;return Math.floor(Math.min(n+(t||sa.DEFAULT_THROTTLE_TIME_SECONDS),n+sa.DEFAULT_MAX_THROTTLE_TIME_SECONDS)*1e3)}static removeThrottle(e,t,n,i){const s={clientId:t,authority:n.authority,scopes:n.scopes,homeAccountIdentifier:i,claims:n.claims,authenticationScheme:n.authenticationScheme,resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,sshKid:n.sshKid},l=this.generateThrottlingStorageKey(s);e.removeItem(l)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class Dc extends He{constructor(e,t,n){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,Dc.prototype),this.name="NetworkError",this.error=e,this.httpStatus=t,this.responseHeaders=n}}function cp(r,e,t){return new Dc(r,e,t)}/*! @azure/msal-common v14.16.0 2024-11-05 */class ch{constructor(e,t){this.config=EM(e),this.logger=new qr(this.config.loggerOptions,Fy,Jd),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=t}createTokenRequestHeaders(e){const t={};if(t[Pt.CONTENT_TYPE]=P.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case on.HOME_ACCOUNT_ID:try{const n=ii(e.credential);t[Pt.CCS_HEADER]=`Oid:${n.uid}@${n.utid}`}catch(n){this.logger.verbose("Could not parse home account ID for CCS Header: "+n)}break;case on.UPN:t[Pt.CCS_HEADER]=`UPN: ${e.credential}`;break}return t}async executePostToTokenEndpoint(e,t,n,i,s,l){var f;l&&((f=this.performanceClient)==null||f.addQueueMeasurement(l,s));const d=await this.sendPostRequest(i,e,{body:t,headers:n},s);return this.config.serverTelemetryManager&&d.status<500&&d.status!==429&&this.config.serverTelemetryManager.clearTelemetryCache(),d}async sendPostRequest(e,t,n,i){var l,d,f;Yn.preProcess(this.cacheManager,e);let s;try{s=await U(this.networkClient.sendPostRequestAsync.bind(this.networkClient),k.NetworkClientSendPostRequestAsync,this.logger,this.performanceClient,i)(t,n);const g=s.headers||{};(d=this.performanceClient)==null||d.addFields({refreshTokenSize:((l=s.body.refresh_token)==null?void 0:l.length)||0,httpVerToken:g[Pt.X_MS_HTTP_VERSION]||"",requestId:g[Pt.X_MS_REQUEST_ID]||""},i)}catch(g){if(g instanceof Dc){const m=g.responseHeaders;throw m&&((f=this.performanceClient)==null||f.addFields({httpVerToken:m[Pt.X_MS_HTTP_VERSION]||"",requestId:m[Pt.X_MS_REQUEST_ID]||"",contentTypeHeader:m[Pt.CONTENT_TYPE]||void 0,contentLengthHeader:m[Pt.CONTENT_LENGTH]||void 0,httpStatus:g.httpStatus},i)),g.error}throw g instanceof He?g:B(Ay)}return Yn.postProcess(this.cacheManager,e,s),s}async updateAuthority(e,t){var s;(s=this.performanceClient)==null||s.addQueueMeasurement(k.UpdateTokenEndpointAuthority,t);const n=`https://${e}/${this.authority.tenant}/`,i=await dC(n,this.networkClient,this.cacheManager,this.authority.options,this.logger,t,this.performanceClient);this.authority=i}createTokenQueryParameters(e){const t=new ca(e.correlationId,this.performanceClient);return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenQueryParameters&&t.addExtraQueryParameters(e.tokenQueryParameters),t.addCorrelationId(e.correlationId),t.createQueryString()}}/*! @azure/msal-common v14.16.0 2024-11-05 */const fc="no_tokens_found",hC="native_account_unavailable",lh="refresh_token_expired",gx="interaction_required",mx="consent_required",px="login_required",Lc="bad_token";/*! @azure/msal-common v14.16.0 2024-11-05 */const lp=[gx,mx,px,Lc],vx=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],yx={[fc]:"No refresh token found in the cache. Please sign-in.",[hC]:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",[lh]:"Refresh token has expired.",[Lc]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve."};class Vn extends He{constructor(e,t,n,i,s,l,d,f){super(e,t,n),Object.setPrototypeOf(this,Vn.prototype),this.timestamp=i||P.EMPTY_STRING,this.traceId=s||P.EMPTY_STRING,this.correlationId=l||P.EMPTY_STRING,this.claims=d||P.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=f}}function up(r,e,t){const n=!!r&&lp.indexOf(r)>-1,i=!!t&&vx.indexOf(t)>-1,s=!!e&&lp.some(l=>e.indexOf(l)>-1);return n||s||i}function pd(r){return new Vn(r,yx[r])}/*! @azure/msal-common v14.16.0 2024-11-05 */class Un{static setRequestState(e,t,n){const i=Un.generateLibraryState(e,n);return t?`${i}${P.RESOURCE_DELIM}${t}`:i}static generateLibraryState(e,t){if(!e)throw B(dd);const n={id:e.createNewGuid()};t&&(n.meta=t);const i=JSON.stringify(n);return e.base64Encode(i)}static parseRequestState(e,t){if(!e)throw B(dd);if(!t)throw B(hi);try{const n=t.split(P.RESOURCE_DELIM),i=n[0],s=n.length>1?n.slice(1).join(P.RESOURCE_DELIM):P.EMPTY_STRING,l=e.base64Decode(i),d=JSON.parse(l);return{userRequestState:s||P.EMPTY_STRING,libraryState:d}}catch{throw B(hi)}}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Cx={SW:"sw",UHW:"uhw"};class gi{constructor(e,t){this.cryptoUtils=e,this.performanceClient=t}async generateCnf(e,t){var s;(s=this.performanceClient)==null||s.addQueueMeasurement(k.PopTokenGenerateCnf,e.correlationId);const n=await U(this.generateKid.bind(this),k.PopTokenGenerateCnf,t,this.performanceClient,e.correlationId)(e),i=this.cryptoUtils.base64UrlEncode(JSON.stringify(n));return{kid:n.kid,reqCnfString:i}}async generateKid(e){var n;return(n=this.performanceClient)==null||n.addQueueMeasurement(k.PopTokenGenerateKid,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:Cx.SW}}async signPopToken(e,t,n){return this.signPayload(e,t,n)}async signPayload(e,t,n,i){const{resourceRequestMethod:s,resourceRequestUri:l,shrClaims:d,shrNonce:f,shrOptions:g}=n,m=l?new ye(l):void 0,v=m==null?void 0:m.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:rr(),m:s==null?void 0:s.toUpperCase(),u:v==null?void 0:v.HostNameAndPort,nonce:f||this.cryptoUtils.createNewGuid(),p:v==null?void 0:v.AbsolutePath,q:v!=null&&v.QueryString?[[],v.QueryString]:void 0,client_claims:d||void 0,...i},t,g,n.correlationId)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class wx{constructor(e,t){this.cache=e,this.hasChanged=t}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}/*! @azure/msal-common v14.16.0 2024-11-05 */function _x(r){var n,i;const e="code=",t=(n=r.error_uri)==null?void 0:n.lastIndexOf(e);return t&&t>=0?(i=r.error_uri)==null?void 0:i.substring(t+e.length):void 0}class po{constructor(e,t,n,i,s,l,d){this.clientId=e,this.cacheStorage=t,this.cryptoObj=n,this.logger=i,this.serializableCache=s,this.persistencePlugin=l,this.performanceClient=d}validateServerAuthorizationCodeResponse(e,t){if(!e.state||!t)throw e.state?B(sc,"Cached State"):B(sc,"Server State");let n,i;try{n=decodeURIComponent(e.state)}catch{throw B(hi,e.state)}try{i=decodeURIComponent(t)}catch{throw B(hi,e.state)}if(n!==i)throw B(ky);if(e.error||e.error_description||e.suberror){const s=_x(e);throw up(e.error,e.error_description,e.suberror)?new Vn(e.error||"",e.error_description,e.suberror,e.timestamp||"",e.trace_id||"",e.correlation_id||"",e.claims||"",s):new Gr(e.error||"",e.error_description,e.suberror,s)}}validateTokenResponse(e,t){var n;if(e.error||e.error_description||e.suberror){const i=`Error(s): ${e.error_codes||P.NOT_AVAILABLE} - Timestamp: ${e.timestamp||P.NOT_AVAILABLE} - Description: ${e.error_description||P.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||P.NOT_AVAILABLE} - Trace ID: ${e.trace_id||P.NOT_AVAILABLE}`,s=(n=e.error_codes)!=null&&n.length?e.error_codes[0]:void 0,l=new Gr(e.error,i,e.suberror,s,e.status);if(t&&e.status&&e.status>=Ss.SERVER_ERROR_RANGE_START&&e.status<=Ss.SERVER_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed.
55
55
  ${l}`);return}else if(t&&e.status&&e.status>=Ss.CLIENT_ERROR_RANGE_START&&e.status<=Ss.CLIENT_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently available but is unable to refresh the access token.
56
- ${l}`);return}throw up(e.error,e.error_description,e.suberror)?new Vn(e.error,e.error_description,e.suberror,e.timestamp||P.EMPTY_STRING,e.trace_id||P.EMPTY_STRING,e.correlation_id||P.EMPTY_STRING,e.claims||P.EMPTY_STRING,s):l}}async handleServerTokenResponse(e,t,n,i,s,l,d,f,g){var T;(T=this.performanceClient)==null||T.addQueueMeasurement(k.HandleServerTokenResponse,e.correlation_id);let m;if(e.id_token){if(m=wo(e.id_token||P.EMPTY_STRING,this.cryptoObj.base64Decode),s&&s.nonce&&m.nonce!==s.nonce)throw B(Ry);if(i.maxAge||i.maxAge===0){const I=m.auth_time;if(!I)throw B(qd);Hy(I,i.maxAge)}}this.homeAccountIdentifier=at.generateHomeAccountId(e.client_info||P.EMPTY_STRING,t.authorityType,this.logger,this.cryptoObj,m);let v;s&&s.state&&(v=Un.parseRequestState(this.cryptoObj,s.state)),e.key_id=e.key_id||i.sshKid||void 0;const C=this.generateCacheRecord(e,t,n,i,m,l,s);let S;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),S=new wx(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(S)),d&&!f&&C.account){const I=C.account.generateAccountKey();if(!this.cacheStorage.getAccount(I,this.logger))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await po.generateAuthenticationResult(this.cryptoObj,t,C,!1,i,m,v,void 0,g)}await this.cacheStorage.saveCacheRecord(C,i.storeInCache,i.correlationId)}finally{this.persistencePlugin&&this.serializableCache&&S&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(S))}return po.generateAuthenticationResult(this.cryptoObj,t,C,!1,i,m,v,e,g)}generateCacheRecord(e,t,n,i,s,l,d){const f=t.getPreferredCache();if(!f)throw B(jd);const g=rC(s);let m,v;e.id_token&&s&&(m=Nc(this.homeAccountIdentifier,f,e.id_token,this.clientId,g||""),v=uh(this.cacheStorage,t,this.homeAccountIdentifier,this.cryptoObj.base64Decode,s,e.client_info,f,g,d,void 0,this.logger));let C=null;if(e.access_token){const I=e.scope?Je.fromString(e.scope):new Je(i.scopes||[]),O=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,$=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,F=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,H=n+O,z=H+$,Q=F&&F>0?n+F:void 0;C=Pc(this.homeAccountIdentifier,f,e.access_token,this.clientId,g||t.tenant||"",I.printScopes(),H,z,this.cryptoObj.base64Decode,Q,e.token_type,l,e.key_id,i.claims,i.requestedClaimsHash)}let S=null;if(e.refresh_token){let I;if(e.refresh_token_expires_in){const O=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;I=n+O}S=$y(this.homeAccountIdentifier,f,e.refresh_token,this.clientId,e.foci,l,I)}let T=null;return e.foci&&(T={clientId:this.clientId,environment:f,familyId:e.foci}),{account:v,idToken:m,accessToken:C,refreshToken:S,appMetadata:T}}static async generateAuthenticationResult(e,t,n,i,s,l,d,f,g){var H,z,Q,we,W;let m=P.EMPTY_STRING,v=[],C=null,S,T,I=P.EMPTY_STRING;if(n.accessToken){if(n.accessToken.tokenType===Oe.POP&&!s.popKid){const tt=new gi(e),{secret:Te,keyId:Y}=n.accessToken;if(!Y)throw B(Yd);m=await tt.signPopToken(Te,Y,s)}else m=n.accessToken.secret;v=Je.fromString(n.accessToken.target).asArray(),C=new Date(Number(n.accessToken.expiresOn)*1e3),S=new Date(Number(n.accessToken.extendedExpiresOn)*1e3),n.accessToken.refreshOn&&(T=new Date(Number(n.accessToken.refreshOn)*1e3))}n.appMetadata&&(I=n.appMetadata.familyId===aa?aa:"");const O=(l==null?void 0:l.oid)||(l==null?void 0:l.sub)||"",$=(l==null?void 0:l.tid)||"";f!=null&&f.spa_accountid&&n.account&&(n.account.nativeAccountId=f==null?void 0:f.spa_accountid);const F=n.account?oh(n.account.getAccountInfo(),void 0,l,(H=n.idToken)==null?void 0:H.secret):null;return{authority:t.canonicalAuthority,uniqueId:O,tenantId:$,scopes:v,account:F,idToken:((z=n==null?void 0:n.idToken)==null?void 0:z.secret)||"",idTokenClaims:l||{},accessToken:m,fromCache:i,expiresOn:C,extExpiresOn:S,refreshOn:T,correlationId:s.correlationId,requestId:g||P.EMPTY_STRING,familyId:I,tokenType:((Q=n.accessToken)==null?void 0:Q.tokenType)||P.EMPTY_STRING,state:d?d.userRequestState:P.EMPTY_STRING,cloudGraphHostName:((we=n.account)==null?void 0:we.cloudGraphHostName)||P.EMPTY_STRING,msGraphHost:((W=n.account)==null?void 0:W.msGraphHost)||P.EMPTY_STRING,code:f==null?void 0:f.spa_code,fromNativeBroker:!1}}}function uh(r,e,t,n,i,s,l,d,f,g,m){m==null||m.verbose("setCachedAccount called");const C=r.getAccountKeys().find($=>$.startsWith(t));let S=null;C&&(S=r.getAccount(C,m));const T=S||at.createAccount({homeAccountId:t,idTokenClaims:i,clientInfo:s,environment:l,cloudGraphHostName:f==null?void 0:f.cloud_graph_host_name,msGraphHost:f==null?void 0:f.msgraph_host,nativeAccountId:g},e,n),I=T.tenantProfiles||[],O=d||T.realm;if(O&&!I.find($=>$.tenantId===O)){const $=rh(t,T.localAccountId,O,i);I.push($)}return T.tenantProfiles=I,T}/*! @azure/msal-common v14.16.0 2024-11-05 */async function fC(r,e,t){return typeof r=="string"?r:r({clientId:e,tokenEndpoint:t})}/*! @azure/msal-common v14.16.0 2024-11-05 */class gC extends ch{constructor(e,t){var n;super(e,t),this.includeRedirectUri=!0,this.oidcDefaultScopes=(n=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:n.defaultScopes}async getAuthCodeUrl(e){var n;(n=this.performanceClient)==null||n.addQueueMeasurement(k.GetAuthCodeUrl,e.correlationId);const t=await U(this.createAuthCodeUrlQueryString.bind(this),k.AuthClientCreateQueryString,this.logger,this.performanceClient,e.correlationId)(e);return ye.appendQueryString(this.authority.authorizationEndpoint,t)}async acquireToken(e,t){var d,f;if((d=this.performanceClient)==null||d.addQueueMeasurement(k.AuthClientAcquireToken,e.correlationId),!e.code)throw B(Py);const n=rr(),i=await U(this.executeTokenRequest.bind(this),k.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),s=(f=i.headers)==null?void 0:f[Pt.X_MS_REQUEST_ID],l=new po(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return l.validateTokenResponse(i.body),U(l.handleServerTokenResponse.bind(l),k.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(i.body,this.authority,n,e,t,void 0,void 0,void 0,s)}handleFragmentResponse(e,t){if(new po(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,null,null).validateServerAuthorizationCodeResponse(e,t),!e.code)throw B(By);return e}getLogoutUri(e){if(!e)throw Pe(Yy);const t=this.createLogoutUrlQueryString(e);return ye.appendQueryString(this.authority.endSessionEndpoint,t)}async executeTokenRequest(e,t){var g,m;(g=this.performanceClient)==null||g.addQueueMeasurement(k.AuthClientExecuteTokenRequest,t.correlationId);const n=this.createTokenQueryParameters(t),i=ye.appendQueryString(e.tokenEndpoint,n),s=await U(this.createTokenRequestBody.bind(this),k.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,t.correlationId)(t);let l;if(t.clientInfo)try{const v=lc(t.clientInfo,this.cryptoUtils.base64Decode);l={credential:`${v.uid}${bt.CLIENT_INFO_SEPARATOR}${v.utid}`,type:on.HOME_ACCOUNT_ID}}catch(v){this.logger.verbose("Could not parse client info for CCS Header: "+v)}const d=this.createTokenRequestHeaders(l||t.ccsCredential),f={clientId:((m=t.tokenBodyParameters)==null?void 0:m.clientId)||this.config.authOptions.clientId,authority:e.canonicalAuthority,scopes:t.scopes,claims:t.claims,authenticationScheme:t.authenticationScheme,resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,sshKid:t.sshKid};return U(this.executePostToTokenEndpoint.bind(this),k.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,t.correlationId)(i,s,d,f,t.correlationId,k.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var i,s;(i=this.performanceClient)==null||i.addQueueMeasurement(k.AuthClientCreateTokenRequestBody,e.correlationId);const t=new ca(e.correlationId,this.performanceClient);if(t.addClientId(e.embeddedClientId||((s=e.tokenBodyParameters)==null?void 0:s[mo])||this.config.authOptions.clientId),this.includeRedirectUri?t.addRedirectUri(e.redirectUri):Qo.validateRedirectUri(e.redirectUri),t.addScopes(e.scopes,!0,this.oidcDefaultScopes),t.addAuthorizationCode(e.code),t.addLibraryInfo(this.config.libraryInfo),t.addApplicationTelemetry(this.config.telemetry.application),t.addThrottling(),this.serverTelemetryManager&&!gd(this.config)&&t.addServerTelemetry(this.serverTelemetryManager),e.codeVerifier&&t.addCodeVerifier(e.codeVerifier),this.config.clientCredentials.clientSecret&&t.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const l=this.config.clientCredentials.clientAssertion;t.addClientAssertion(await fC(l.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),t.addClientAssertionType(l.assertionType)}if(t.addGrantType(_y.AUTHORIZATION_CODE_GRANT),t.addClientInfo(),e.authenticationScheme===Oe.POP){const l=new gi(this.cryptoUtils,this.performanceClient);let d;e.popKid?d=this.cryptoUtils.encodeKid(e.popKid):d=(await U(l.generateCnf.bind(l),k.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,t.addPopToken(d)}else if(e.authenticationScheme===Oe.SSH)if(e.sshJwk)t.addSshJwk(e.sshJwk);else throw Pe(Mc);(!Bn.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&t.addClaims(e.claims,this.config.authOptions.clientCapabilities);let n;if(e.clientInfo)try{const l=lc(e.clientInfo,this.cryptoUtils.base64Decode);n={credential:`${l.uid}${bt.CLIENT_INFO_SEPARATOR}${l.utid}`,type:on.HOME_ACCOUNT_ID}}catch(l){this.logger.verbose("Could not parse client info for CCS Header: "+l)}else n=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&n)switch(n.type){case on.HOME_ACCOUNT_ID:try{const l=ii(n.credential);t.addCcsOid(l)}catch(l){this.logger.verbose("Could not parse home account ID for CCS Header: "+l)}break;case on.UPN:t.addCcsUpn(n.credential);break}return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&t.addExtraQueryParameters(e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[sp])&&t.addExtraQueryParameters({[sp]:"1"}),t.createQueryString()}async createAuthCodeUrlQueryString(e){var s,l;const t=e.correlationId||this.config.cryptoInterface.createNewGuid();(s=this.performanceClient)==null||s.addQueueMeasurement(k.AuthClientCreateQueryString,t);const n=new ca(t,this.performanceClient);n.addClientId(e.embeddedClientId||((l=e.extraQueryParameters)==null?void 0:l[mo])||this.config.authOptions.clientId);const i=[...e.scopes||[],...e.extraScopesToConsent||[]];if(n.addScopes(i,!0,this.oidcDefaultScopes),n.addRedirectUri(e.redirectUri),n.addCorrelationId(t),n.addResponseMode(e.responseMode),n.addResponseTypeCode(),n.addLibraryInfo(this.config.libraryInfo),gd(this.config)||n.addApplicationTelemetry(this.config.telemetry.application),n.addClientInfo(),e.codeChallenge&&e.codeChallengeMethod&&n.addCodeChallengeParams(e.codeChallenge,e.codeChallengeMethod),e.prompt&&n.addPrompt(e.prompt),e.domainHint&&n.addDomainHint(e.domainHint),e.prompt!==dt.SELECT_ACCOUNT)if(e.sid&&e.prompt===dt.NONE)this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),n.addSid(e.sid);else if(e.account){const d=this.extractAccountSid(e.account);let f=this.extractLoginHint(e.account);if(f&&e.domainHint&&(this.logger.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),f=null),f){this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),n.addLoginHint(f);try{const g=ii(e.account.homeAccountId);n.addCcsOid(g)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(d&&e.prompt===dt.NONE){this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),n.addSid(d);try{const g=ii(e.account.homeAccountId);n.addCcsOid(g)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),n.addLoginHint(e.loginHint),n.addCcsUpn(e.loginHint);else if(e.account.username){this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),n.addLoginHint(e.account.username);try{const g=ii(e.account.homeAccountId);n.addCcsOid(g)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),n.addLoginHint(e.loginHint),n.addCcsUpn(e.loginHint));else this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");if(e.nonce&&n.addNonce(e.nonce),e.state&&n.addState(e.state),(e.claims||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&n.addClaims(e.claims,this.config.authOptions.clientCapabilities),e.embeddedClientId&&n.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),this.addExtraQueryParams(e,n),e.nativeBroker&&(n.addNativeBroker(),e.authenticationScheme===Oe.POP)){const d=new gi(this.cryptoUtils);let f;e.popKid?f=this.cryptoUtils.encodeKid(e.popKid):f=(await U(d.generateCnf.bind(d),k.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,n.addPopToken(f)}return n.createQueryString()}createLogoutUrlQueryString(e){const t=new ca(e.correlationId,this.performanceClient);return e.postLogoutRedirectUri&&t.addPostLogoutRedirectUri(e.postLogoutRedirectUri),e.correlationId&&t.addCorrelationId(e.correlationId),e.idTokenHint&&t.addIdTokenHint(e.idTokenHint),e.state&&t.addState(e.state),e.logoutHint&&t.addLogoutHint(e.logoutHint),this.addExtraQueryParams(e,t),t.createQueryString()}addExtraQueryParams(e,t){!(e.extraQueryParameters&&e.extraQueryParameters.hasOwnProperty("instance_aware"))&&this.config.authOptions.instanceAware&&(e.extraQueryParameters=e.extraQueryParameters||{},e.extraQueryParameters.instance_aware="true"),e.extraQueryParameters&&t.addExtraQueryParameters(e.extraQueryParameters)}extractAccountSid(e){var t;return((t=e.idTokenClaims)==null?void 0:t.sid)||null}extractLoginHint(e){var t;return((t=e.idTokenClaims)==null?void 0:t.login_hint)||null}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Tx=300;class vd extends ch{constructor(e,t){super(e,t)}async acquireToken(e){var l,d;(l=this.performanceClient)==null||l.addQueueMeasurement(k.RefreshTokenClientAcquireToken,e.correlationId);const t=rr(),n=await U(this.executeTokenRequest.bind(this),k.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),i=(d=n.headers)==null?void 0:d[Pt.X_MS_REQUEST_ID],s=new po(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return s.validateTokenResponse(n.body),U(s.handleServerTokenResponse.bind(s),k.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(n.body,this.authority,t,e,void 0,void 0,!0,e.forceCache,i)}async acquireTokenByRefreshToken(e){var n;if(!e)throw Pe(jy);if((n=this.performanceClient)==null||n.addQueueMeasurement(k.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw B(Gd);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await U(this.acquireTokenWithCachedRefreshToken.bind(this),k.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(i){const s=i instanceof Vn&&i.errorCode===fc,l=i instanceof Gr&&i.errorCode===Gm.INVALID_GRANT_ERROR&&i.subError===Gm.CLIENT_MISMATCH_ERROR;if(s||l)return U(this.acquireTokenWithCachedRefreshToken.bind(this),k.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw i}return U(this.acquireTokenWithCachedRefreshToken.bind(this),k.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,t){var s;(s=this.performanceClient)==null||s.addQueueMeasurement(k.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const n=_o(this.cacheManager.getRefreshToken.bind(this.cacheManager),k.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,t,void 0,this.performanceClient,e.correlationId);if(!n)throw pd(fc);if(n.expiresOn&&fd(n.expiresOn,e.refreshTokenExpirationOffsetSeconds||Tx))throw pd(lh);const i={...e,refreshToken:n.secret,authenticationScheme:e.authenticationScheme||Oe.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:on.HOME_ACCOUNT_ID}};try{return await U(this.acquireToken.bind(this),k.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(i)}catch(l){if(l instanceof Vn&&l.subError===Lc){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const d=oi(n);this.cacheManager.removeRefreshToken(d)}throw l}}async executeTokenRequest(e,t){var f,g;(f=this.performanceClient)==null||f.addQueueMeasurement(k.RefreshTokenClientExecuteTokenRequest,e.correlationId);const n=this.createTokenQueryParameters(e),i=ye.appendQueryString(t.tokenEndpoint,n),s=await U(this.createTokenRequestBody.bind(this),k.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),l=this.createTokenRequestHeaders(e.ccsCredential),d={clientId:((g=e.tokenBodyParameters)==null?void 0:g.clientId)||this.config.authOptions.clientId,authority:t.canonicalAuthority,scopes:e.scopes,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid};return U(this.executePostToTokenEndpoint.bind(this),k.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(i,s,l,d,e.correlationId,k.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var i,s,l;(i=this.performanceClient)==null||i.addQueueMeasurement(k.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const t=e.correlationId,n=new ca(t,this.performanceClient);if(n.addClientId(e.embeddedClientId||((s=e.tokenBodyParameters)==null?void 0:s[mo])||this.config.authOptions.clientId),e.redirectUri&&n.addRedirectUri(e.redirectUri),n.addScopes(e.scopes,!0,(l=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:l.defaultScopes),n.addGrantType(_y.REFRESH_TOKEN_GRANT),n.addClientInfo(),n.addLibraryInfo(this.config.libraryInfo),n.addApplicationTelemetry(this.config.telemetry.application),n.addThrottling(),this.serverTelemetryManager&&!gd(this.config)&&n.addServerTelemetry(this.serverTelemetryManager),n.addRefreshToken(e.refreshToken),this.config.clientCredentials.clientSecret&&n.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const d=this.config.clientCredentials.clientAssertion;n.addClientAssertion(await fC(d.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),n.addClientAssertionType(d.assertionType)}if(e.authenticationScheme===Oe.POP){const d=new gi(this.cryptoUtils,this.performanceClient);let f;e.popKid?f=this.cryptoUtils.encodeKid(e.popKid):f=(await U(d.generateCnf.bind(d),k.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,n.addPopToken(f)}else if(e.authenticationScheme===Oe.SSH)if(e.sshJwk)n.addSshJwk(e.sshJwk);else throw Pe(Mc);if((!Bn.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&n.addClaims(e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case on.HOME_ACCOUNT_ID:try{const d=ii(e.ccsCredential.credential);n.addCcsOid(d)}catch(d){this.logger.verbose("Could not parse home account ID for CCS Header: "+d)}break;case on.UPN:n.addCcsUpn(e.ccsCredential.credential);break}return e.embeddedClientId&&n.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&n.addExtraQueryParameters(e.tokenBodyParameters),n.createQueryString()}}/*! @azure/msal-common v14.16.0 2024-11-05 */class Ex extends ch{constructor(e,t){super(e,t)}async acquireToken(e){var t;try{const[n,i]=await this.acquireCachedToken({...e,scopes:(t=e.scopes)!=null&&t.length?e.scopes:[...vi]});return i===Br.PROACTIVELY_REFRESHED&&(this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."),new vd(this.config,this.performanceClient).acquireTokenByRefreshToken(e).catch(()=>{})),n}catch(n){if(n instanceof Oc&&n.errorCode===yr)return new vd(this.config,this.performanceClient).acquireTokenByRefreshToken(e);throw n}}async acquireCachedToken(e){var f;(f=this.performanceClient)==null||f.addQueueMeasurement(k.SilentFlowClientAcquireCachedToken,e.correlationId);let t=Br.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!Bn.isEmptyObj(e.claims))throw this.setCacheOutcome(Br.FORCE_REFRESH_OR_CLAIMS,e.correlationId),B(yr);if(!e.account)throw B(Gd);const n=e.account.tenantId||hx(e.authority),i=this.cacheManager.getTokenKeys(),s=this.cacheManager.getAccessToken(e.account,e,i,n,this.performanceClient,e.correlationId);if(s){if(X1(s.cachedAt)||fd(s.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(Br.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),B(yr);s.refreshOn&&fd(s.refreshOn,0)&&(t=Br.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(Br.NO_CACHED_ACCESS_TOKEN,e.correlationId),B(yr);const l=e.authority||this.authority.getPreferredCache(),d={account:this.cacheManager.readAccountFromCache(e.account),accessToken:s,idToken:this.cacheManager.getIdToken(e.account,i,n,this.performanceClient,e.correlationId),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(l)};return this.setCacheOutcome(t,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await U(this.generateResultFromCacheRecord.bind(this),k.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(d,e),t]}setCacheOutcome(e,t){var n,i;(n=this.serverTelemetryManager)==null||n.setCacheOutcome(e),(i=this.performanceClient)==null||i.addFields({cacheOutcome:e},t),e!==Br.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,t){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(k.SilentFlowClientGenerateResultFromCacheRecord,t.correlationId);let n;if(e.idToken&&(n=wo(e.idToken.secret,this.config.cryptoInterface.base64Decode)),t.maxAge||t.maxAge===0){const s=n==null?void 0:n.auth_time;if(!s)throw B(qd);Hy(s,t.maxAge)}return po.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,t,n)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Sx={sendGetRequestAsync:()=>Promise.reject(B(ge)),sendPostRequestAsync:()=>Promise.reject(B(ge))};/*! @azure/msal-common v14.16.0 2024-11-05 */const dp=",",mC="|";function Ax(r){const{skus:e,libraryName:t,libraryVersion:n,extensionName:i,extensionVersion:s}=r,l=new Map([[0,[t,n]],[2,[i,s]]]);let d=[];if(e!=null&&e.length){if(d=e.split(dp),d.length<4)return e}else d=Array.from({length:4},()=>mC);return l.forEach((f,g)=>{var m,v;f.length===2&&((m=f[0])!=null&&m.length)&&((v=f[1])!=null&&v.length)&&bx({skuArr:d,index:g,skuName:f[0],skuVersion:f[1]})}),d.join(dp)}function bx(r){const{skuArr:e,index:t,skuName:n,skuVersion:i}=r;t>=e.length||(e[t]=[n,i].join(mC))}class ga{constructor(e,t){this.cacheOutcome=Br.NOT_APPLICABLE,this.cacheManager=t,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||P.EMPTY_STRING,this.wrapperVer=e.wrapperVer||P.EMPTY_STRING,this.telemetryCacheKey=pt.CACHE_KEY+bt.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${pt.VALUE_SEPARATOR}${this.cacheOutcome}`,t=[this.wrapperSKU,this.wrapperVer],n=this.getNativeBrokerErrorCode();n!=null&&n.length&&t.push(`broker_error=${n}`);const i=t.join(pt.VALUE_SEPARATOR),s=this.getRegionDiscoveryFields(),l=[e,s].join(pt.VALUE_SEPARATOR);return[pt.SCHEMA_VERSION,l,i].join(pt.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),t=ga.maxErrorsToSend(e),n=e.failedRequests.slice(0,2*t).join(pt.VALUE_SEPARATOR),i=e.errors.slice(0,t).join(pt.VALUE_SEPARATOR),s=e.errors.length,l=t<s?pt.OVERFLOW_TRUE:pt.OVERFLOW_FALSE,d=[s,l].join(pt.VALUE_SEPARATOR);return[pt.SCHEMA_VERSION,e.cacheHits,n,i,d].join(pt.CATEGORY_SEPARATOR)}cacheFailedRequest(e){const t=this.getLastRequests();t.errors.length>=pt.MAX_CACHED_ERRORS&&(t.failedRequests.shift(),t.failedRequests.shift(),t.errors.shift()),t.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof He?e.subError?t.errors.push(e.subError):e.errorCode?t.errors.push(e.errorCode):t.errors.push(e.toString()):t.errors.push(e.toString()):t.errors.push(pt.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),t=ga.maxErrorsToSend(e),n=e.errors.length;if(t===n)this.cacheManager.removeItem(this.telemetryCacheKey);else{const i={failedRequests:e.failedRequests.slice(t*2),errors:e.errors.slice(t),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,i)}}static maxErrorsToSend(e){let t,n=0,i=0;const s=e.errors.length;for(t=0;t<s;t++){const l=e.failedRequests[2*t]||P.EMPTY_STRING,d=e.failedRequests[2*t+1]||P.EMPTY_STRING,f=e.errors[t]||P.EMPTY_STRING;if(i+=l.toString().length+d.toString().length+f.length+3,i<pt.MAX_LAST_HEADER_BYTES)n+=1;else break}return n}getRegionDiscoveryFields(){const e=[];return e.push(this.regionUsed||P.EMPTY_STRING),e.push(this.regionSource||P.EMPTY_STRING),e.push(this.regionOutcome||P.EMPTY_STRING),e.join(",")}updateRegionDiscoveryMetadata(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome}setCacheOutcome(e){this.cacheOutcome=e}setNativeBrokerErrorCode(e){const t=this.getLastRequests();t.nativeBrokerErrorCode=e,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}getNativeBrokerErrorCode(){return this.getLastRequests().nativeBrokerErrorCode}clearNativeBrokerErrorCode(){const e=this.getLastRequests();delete e.nativeBrokerErrorCode,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e)}static makeExtraSkuString(e){return Ax(e)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const pC="missing_kid_error",vC="missing_alg_error";/*! @azure/msal-common v14.16.0 2024-11-05 */const Ix={[pC]:"The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided.",[vC]:"The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided."};class dh extends He{constructor(e,t){super(e,t),this.name="JoseHeaderError",Object.setPrototypeOf(this,dh.prototype)}}function hp(r){return new dh(r,Ix[r])}/*! @azure/msal-common v14.16.0 2024-11-05 */class hh{constructor(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}static getShrHeaderString(e){if(!e.kid)throw hp(pC);if(!e.alg)throw hp(vC);const t=new hh({typ:e.typ||L1.Pop,kid:e.kid,alg:e.alg});return JSON.stringify(t)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class fp{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class kx{generateId(){return"callback-id"}startMeasurement(e,t){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:dx.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:t||""},measurement:new fp}}startPerformanceMeasurement(){return new fp}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const fh="pkce_not_created",yd="crypto_nonexistent",Bc="empty_navigate_uri",yC="hash_empty_error",gh="no_state_in_hash",CC="hash_does_not_contain_known_properties",wC="unable_to_parse_state",_C="state_interaction_type_mismatch",TC="interaction_in_progress",EC="popup_window_error",SC="empty_window_error",vo="user_cancelled",Rx="monitor_popup_timeout",AC="monitor_window_timeout",bC="redirect_in_iframe",IC="block_iframe_reload",kC="block_nested_popups",Ox="iframe_closed_prematurely",Uc="silent_logout_unsupported",RC="no_account_error",Nx="silent_prompt_value_error",OC="no_token_request_cache_error",NC="unable_to_parse_token_request_cache_error",mh="no_cached_authority_error",Px="auth_request_not_set_error",Mx="invalid_cache_type",Vc="non_browser_environment",Xo="database_not_open",gc="no_network_connectivity",PC="post_request_failed",MC="get_request_failed",Cd="failed_to_parse_response",xC="unable_to_load_token",ph="crypto_key_not_found",DC="auth_code_required",LC="auth_code_or_nativeAccountId_required",BC="spa_code_and_nativeAccountId_present",vh="database_unavailable",UC="unable_to_acquire_token_from_native_platform",VC="native_handshake_timeout",FC="native_extension_not_installed",Ea="native_connection_not_established",HC="uninitialized_public_client_application",$C="native_prompt_not_supported",KC="invalid_base64_string",zC="invalid_pop_token_request",WC="failed_to_build_headers",qC="failed_to_parse_headers";/*! @azure/msal-browser v3.28.1 2025-01-14 */const mr="For more visit: aka.ms/msaljs/browser-errors",xx={[fh]:"The PKCE code challenge and verifier could not be generated.",[yd]:"The crypto object or function is not available.",[Bc]:"Navigation URI is empty. Please check stack trace for more info.",[yC]:`Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. ${mr}`,[gh]:"Hash does not contain state. Please verify that the request originated from msal.",[CC]:`Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. ${mr}`,[wC]:"Unable to parse state. Please verify that the request originated from msal.",[_C]:"Hash contains state but the interaction type does not match the caller.",[TC]:`Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. ${mr}`,[EC]:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.",[SC]:"window.open returned null or undefined window object.",[vo]:"User cancelled the flow.",[Rx]:`Token acquisition in popup failed due to timeout. ${mr}`,[AC]:`Token acquisition in iframe failed due to timeout. ${mr}`,[bC]:"Redirects are not supported for iframed or brokered applications. Please ensure you are using MSAL.js in a top frame of the window if using the redirect APIs, or use the popup APIs.",[IC]:`Request was blocked inside an iframe because MSAL detected an authentication response. ${mr}`,[kC]:"Request was blocked inside a popup because MSAL detected it was running in a popup.",[Ox]:"The iframe being monitored was closed prematurely.",[Uc]:"Silent logout not supported. Please call logoutRedirect or logoutPopup instead.",[RC]:"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request.",[Nx]:"The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'.",[OC]:"No token request found in cache.",[NC]:"The cached token request could not be parsed.",[mh]:"No cached authority found.",[Px]:"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler",[Mx]:"Invalid cache type",[Vc]:"Login and token requests are not supported in non-browser environments.",[Xo]:"Database is not open!",[gc]:"No network connectivity. Check your internet connection.",[PC]:"Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'",[MC]:"Network request failed. Please check the network trace to determine root cause.",[Cd]:"Failed to parse network response. Check network trace.",[xC]:"Error loading token to cache.",[ph]:"Cryptographic Key or Keypair not found in browser storage.",[DC]:"An authorization code must be provided (as the `code` property on the request) to this flow.",[LC]:"An authorization code or nativeAccountId must be provided to this flow.",[BC]:"Request cannot contain both spa code and native account id.",[vh]:"IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts.",[UC]:`Unable to acquire token from native platform. ${mr}`,[VC]:"Timed out while attempting to establish connection to browser extension",[FC]:"Native extension is not installed. If you think this is a mistake call the initialize function.",[Ea]:`Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). ${mr}`,[HC]:`You must call and await the initialize function before attempting to call any other MSAL API. ${mr}`,[$C]:"The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",[KC]:"Invalid base64 encoded string.",[zC]:"Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",[WC]:"Failed to build request headers object.",[qC]:"Failed to parse response headers"};class Sa extends He{constructor(e,t){super(e,xx[e],t),Object.setPrototypeOf(this,Sa.prototype),this.name="BrowserAuthError"}}function j(r,e){return new Sa(r,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const tn={INTERACTION_IN_PROGRESS_VALUE:"interaction_in_progress",INVALID_GRANT_ERROR:"invalid_grant",POPUP_WIDTH:483,POPUP_HEIGHT:600,POPUP_NAME_PREFIX:"msal",DEFAULT_POLL_INTERVAL_MS:30,MSAL_SKU:"msal.js.browser"},ai={CHANNEL_ID:"53ee284d-920a-4b59-9d30-a60315b26836",PREFERRED_EXTENSION_ID:"ppnbnpeolgkicgegkbkbjmhlideopiji",MATS_TELEMETRY:"MATS"},uo={HandshakeRequest:"Handshake",HandshakeResponse:"HandshakeResponse",GetToken:"GetToken",Response:"Response"},Ht={LocalStorage:"localStorage",SessionStorage:"sessionStorage",MemoryStorage:"memoryStorage"},gp={GET:"GET",POST:"POST"},ke={AUTHORITY:"authority",ACQUIRE_TOKEN_ACCOUNT:"acquireToken.account",SESSION_STATE:"session.state",REQUEST_STATE:"request.state",NONCE_IDTOKEN:"nonce.id_token",ORIGIN_URI:"request.origin",RENEW_STATUS:"token.renew.status",URL_HASH:"urlHash",REQUEST_PARAMS:"request.params",SCOPES:"scopes",INTERACTION_STATUS_KEY:"interaction.status",CCS_CREDENTIAL:"ccs.credential",CORRELATION_ID:"request.correlationId",NATIVE_REQUEST:"request.native",REDIRECT_CONTEXT:"request.redirect.context"},Lr={ACCOUNT_KEYS:"msal.account.keys",TOKEN_KEYS:"msal.token.keys"},Rs={WRAPPER_SKU:"wrapper.sku",WRAPPER_VER:"wrapper.version"},Le={acquireTokenRedirect:861,acquireTokenPopup:862,ssoSilent:863,acquireTokenSilent_authCode:864,handleRedirectPromise:865,acquireTokenByCode:866,acquireTokenSilent_silentFlow:61,logout:961,logoutPopup:962};var X;(function(r){r.Redirect="redirect",r.Popup="popup",r.Silent="silent",r.None="none"})(X||(X={}));const mp={scopes:vi},GC="jwk",wd="msal.db",Dx=1,Lx=`${wd}.keys`,Zt={Default:0,AccessToken:1,AccessTokenAndRefreshToken:2,RefreshToken:3,RefreshTokenAndNetwork:4,Skip:5},Bx=[Zt.Default,Zt.Skip,Zt.RefreshTokenAndNetwork],Ux="msal.browser.log.level",Vx="msal.browser.log.pii";/*! @azure/msal-browser v3.28.1 2025-01-14 */function Os(r){return encodeURIComponent(yh(r).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"))}function Fc(r){return jC(r).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function yh(r){return jC(new TextEncoder().encode(r))}function jC(r){const e=Array.from(r,t=>String.fromCodePoint(t)).join("");return btoa(e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Fx="RSASSA-PKCS1-v1_5",YC="SHA-256",Hx=2048,$x=new Uint8Array([1,0,1]),pp="0123456789abcdef",vp=new Uint32Array(1),Kx="crypto_subtle_undefined",Ch={name:Fx,hash:YC,modulusLength:Hx,publicExponent:$x};function zx(r){if(!window)throw j(Vc);if(!window.crypto)throw j(yd);if(!r&&!window.crypto.subtle)throw j(yd,Kx)}async function JC(r,e,t){e==null||e.addQueueMeasurement(k.Sha256Digest,t);const i=new TextEncoder().encode(r);return window.crypto.subtle.digest(YC,i)}function Wx(r){return window.crypto.getRandomValues(r)}function Bu(){return window.crypto.getRandomValues(vp),vp[0]}function Sr(){const r=Date.now(),e=Bu()*1024+(Bu()&1023),t=new Uint8Array(16),n=Math.trunc(e/2**30),i=e&2**30-1,s=Bu();t[0]=r/2**40,t[1]=r/2**32,t[2]=r/2**24,t[3]=r/2**16,t[4]=r/2**8,t[5]=r,t[6]=112|n>>>8,t[7]=n,t[8]=128|i>>>24,t[9]=i>>>16,t[10]=i>>>8,t[11]=i,t[12]=s>>>24,t[13]=s>>>16,t[14]=s>>>8,t[15]=s;let l="";for(let d=0;d<t.length;d++)l+=pp.charAt(t[d]>>>4),l+=pp.charAt(t[d]&15),(d===3||d===5||d===7||d===9)&&(l+="-");return l}async function qx(r,e){return window.crypto.subtle.generateKey(Ch,r,e)}async function Uu(r){return window.crypto.subtle.exportKey(GC,r)}async function Gx(r,e,t){return window.crypto.subtle.importKey(GC,r,Ch,e,t)}async function jx(r,e){return window.crypto.subtle.sign(Ch,r,e)}async function QC(r){const e=await JC(r),t=new Uint8Array(e);return Fc(t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const ma="storage_not_supported",_d="stubbed_public_client_application_called",mc="in_mem_redirect_unavailable";/*! @azure/msal-browser v3.28.1 2025-01-14 */const Gs={[ma]:"Given storage configuration option was not supported.",[_d]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[mc]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};Gs[ma],Gs[_d],Gs[mc];class wh extends He{constructor(e,t){super(e,t),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,wh.prototype)}}function _h(r){return new wh(r,Gs[r])}/*! @azure/msal-browser v3.28.1 2025-01-14 */function Yx(r){r.location.hash="",typeof r.history.replaceState=="function"&&r.history.replaceState(null,"",`${r.location.origin}${r.location.pathname}${r.location.search}`)}function Jx(r){const e=r.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function Th(){return window.parent!==window}function Qx(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${tn.POPUP_NAME_PREFIX}.`)===0}function Cr(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function Xx(){const e=new ye(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function Zx(){if(ye.hashContainsKnownProperties(window.location.hash)&&Th())throw j(IC)}function eD(r){if(Th()&&!r)throw j(bC)}function tD(){if(Qx())throw j(kC)}function XC(){if(typeof window>"u")throw j(Vc)}function ZC(r){if(!r)throw j(HC)}function Eh(r){XC(),Zx(),tD(),ZC(r)}function yp(r,e){if(Eh(r),eD(e.system.allowRedirectInIframe),e.cache.cacheLocation===Ht.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw _h(mc)}function ew(r){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(r).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function nD(){return Sr()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class pc{navigateInternal(e,t){return pc.defaultNavigateWindow(e,t)}navigateExternal(e,t){return pc.defaultNavigateWindow(e,t)}static defaultNavigateWindow(e,t){return t.noHistory?window.location.replace(e):window.location.assign(e),new Promise(n=>{setTimeout(()=>{n(!0)},t.timeout)})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class rD{async sendGetRequestAsync(e,t){let n,i={},s=0;const l=Cp(t);try{n=await fetch(e,{method:gp.GET,headers:l})}catch{throw j(window.navigator.onLine?MC:gc)}i=wp(n.headers);try{return s=n.status,{headers:i,body:await n.json(),status:s}}catch{throw cp(j(Cd),s,i)}}async sendPostRequestAsync(e,t){const n=t&&t.body||"",i=Cp(t);let s,l=0,d={};try{s=await fetch(e,{method:gp.POST,headers:i,body:n})}catch{throw j(window.navigator.onLine?PC:gc)}d=wp(s.headers);try{return l=s.status,{headers:d,body:await s.json(),status:l}}catch{throw cp(j(Cd),l,d)}}}function Cp(r){try{const e=new Headers;if(!(r&&r.headers))return e;const t=r.headers;return Object.entries(t).forEach(([n,i])=>{e.append(n,i)}),e}catch{throw j(WC)}}function wp(r){try{const e={};return r.forEach((t,n)=>{e[n]=t}),e}catch{throw j(qC)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const oD=6e4,Td=1e4,iD=3e4,aD=2e3;function sD({auth:r,cache:e,system:t,telemetry:n},i){const s={clientId:P.EMPTY_STRING,authority:`${P.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:P.EMPTY_STRING,authorityMetadata:P.EMPTY_STRING,redirectUri:typeof window<"u"?Cr():"",postLogoutRedirectUri:P.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:Tr.AAD,OIDCOptions:{serverResponseType:Ta.FRAGMENT,defaultScopes:[P.OPENID_SCOPE,P.PROFILE_SCOPE,P.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:Qd.None,tenant:P.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1},l={cacheLocation:Ht.SessionStorage,temporaryCacheLocation:Ht.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===Ht.LocalStorage),claimsBasedCachingEnabled:!1},d={loggerCallback:()=>{},logLevel:xe.Info,piiLoggingEnabled:!1},g={...{...cC,loggerOptions:d,networkClient:i?new rD:Sx,navigationClient:new pc,loadFrameTimeout:0,windowHashTimeout:(t==null?void 0:t.loadFrameTimeout)||oD,iframeHashTimeout:(t==null?void 0:t.loadFrameTimeout)||Td,navigateFrameWait:0,redirectNavigationTimeout:iD,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!1,nativeBrokerHandshakeTimeout:(t==null?void 0:t.nativeBrokerHandshakeTimeout)||aD,pollIntervalMilliseconds:tn.DEFAULT_POLL_INTERVAL_MS},...t,loggerOptions:(t==null?void 0:t.loggerOptions)||d},m={application:{appName:P.EMPTY_STRING,appVersion:P.EMPTY_STRING},client:new kx};if((r==null?void 0:r.protocolMode)!==Tr.OIDC&&(r!=null&&r.OIDCOptions)&&new qr(g.loggerOptions).warning(JSON.stringify(Pe(eC))),r!=null&&r.protocolMode&&r.protocolMode!==Tr.AAD&&(g!=null&&g.allowNativeBroker))throw Pe(tC);return{auth:{...s,...r,OIDCOptions:{...s.OIDCOptions,...r==null?void 0:r.OIDCOptions}},cache:{...l,...e},system:g,telemetry:{...m,...n}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const cD="@azure/msal-browser",Hc="3.28.1";/*! @azure/msal-browser v3.28.1 2025-01-14 */class Sh{static loggerCallback(e,t){switch(e){case xe.Error:console.error(t);return;case xe.Info:console.info(t);return;case xe.Verbose:console.debug(t);return;case xe.Warning:console.warn(t);return;default:console.log(t);return}}constructor(e){var f;this.browserEnvironment=typeof window<"u",this.config=sD(e,this.browserEnvironment);let t;try{t=window[Ht.SessionStorage]}catch{}const n=t==null?void 0:t.getItem(Ux),i=(f=t==null?void 0:t.getItem(Vx))==null?void 0:f.toLowerCase(),s=i==="true"?!0:i==="false"?!1:void 0,l={...this.config.system.loggerOptions},d=n&&Object.keys(xe).includes(n)?xe[n]:void 0;d&&(l.loggerCallback=Sh.loggerCallback,l.logLevel=d),s!==void 0&&(l.piiLoggingEnabled=s),this.logger=new qr(l,cD,Hc),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class yo extends Sh{getModuleName(){return yo.MODULE_NAME}getId(){return yo.ID}async initialize(){return this.available=typeof window<"u",this.available}}yo.MODULE_NAME="";yo.ID="StandardOperatingContext";/*! @azure/msal-browser v3.28.1 2025-01-14 */function tr(r){return new TextDecoder().decode(lD(r))}function lD(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw j(KC)}const t=atob(e);return Uint8Array.from(t,n=>n.codePointAt(0)||0)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class uD{constructor(){this.dbName=wd,this.version=Dx,this.tableName=Lx,this.dbOpen=!1}async open(){return new Promise((e,t)=>{const n=window.indexedDB.open(this.dbName,this.version);n.addEventListener("upgradeneeded",i=>{i.target.result.createObjectStore(this.tableName)}),n.addEventListener("success",i=>{const s=i;this.db=s.target.result,this.dbOpen=!0,e()}),n.addEventListener("error",()=>t(j(vh)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((t,n)=>{if(!this.db)return n(j(Xo));const l=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);l.addEventListener("success",d=>{const f=d;this.closeConnection(),t(f.target.result)}),l.addEventListener("error",d=>{this.closeConnection(),n(d)})})}async setItem(e,t){return await this.validateDbIsOpen(),new Promise((n,i)=>{if(!this.db)return i(j(Xo));const d=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(t,e);d.addEventListener("success",()=>{this.closeConnection(),n()}),d.addEventListener("error",f=>{this.closeConnection(),i(f)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((t,n)=>{if(!this.db)return n(j(Xo));const l=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);l.addEventListener("success",()=>{this.closeConnection(),t()}),l.addEventListener("error",d=>{this.closeConnection(),n(d)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,t)=>{if(!this.db)return t(j(Xo));const s=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();s.addEventListener("success",l=>{const d=l;this.closeConnection(),e(d.target.result)}),s.addEventListener("error",l=>{this.closeConnection(),t(l)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((t,n)=>{if(!this.db)return n(j(Xo));const l=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);l.addEventListener("success",d=>{const f=d;this.closeConnection(),t(f.target.result===1)}),l.addEventListener("error",d=>{this.closeConnection(),n(d)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,t)=>{const n=window.indexedDB.deleteDatabase(wd),i=setTimeout(()=>t(!1),200);n.addEventListener("success",()=>(clearTimeout(i),e(!0))),n.addEventListener("blocked",()=>(clearTimeout(i),e(!0))),n.addEventListener("error",()=>(clearTimeout(i),t(!1)))})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ed{constructor(){this.cache=new Map}getItem(e){return this.cache.get(e)||null}setItem(e,t){this.cache.set(e,t)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((t,n)=>{e.push(n)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class dD{constructor(e){this.inMemoryCache=new Ed,this.indexedDBCache=new uD,this.logger=e}handleDatabaseAccessError(e){if(e instanceof Sa&&e.errorCode===vh)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e}async getItem(e){const t=this.inMemoryCache.getItem(e);if(!t)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(n){this.handleDatabaseAccessError(n)}return t}async setItem(e,t){this.inMemoryCache.setItem(e,t);try{await this.indexedDBCache.setItem(e,t)}catch(n){this.handleDatabaseAccessError(n)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(t){this.handleDatabaseAccessError(t)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(e.length===0)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(t){this.handleDatabaseAccessError(t)}return e}async containsKey(e){const t=this.inMemoryCache.containsKey(e);if(!t)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(n){this.handleDatabaseAccessError(n)}return t}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class mi{constructor(e,t,n){this.logger=e,zx(n??!1),this.cache=new dD(this.logger),this.performanceClient=t}createNewGuid(){return Sr()}base64Encode(e){return yh(e)}base64Decode(e){return tr(e)}base64UrlEncode(e){return Os(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){var m;const t=(m=this.performanceClient)==null?void 0:m.startMeasurement(k.CryptoOptsGetPublicKeyThumbprint,e.correlationId),n=await qx(mi.EXTRACTABLE,mi.POP_KEY_USAGES),i=await Uu(n.publicKey),s={e:i.e,kty:i.kty,n:i.n},l=_p(s),d=await this.hashString(l),f=await Uu(n.privateKey),g=await Gx(f,!1,["sign"]);return await this.cache.setItem(d,{privateKey:g,publicKey:n.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),t&&t.end({success:!0}),d}async removeTokenBindingKey(e){return await this.cache.removeItem(e),!await this.cache.containsKey(e)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,t,n,i){var H;const s=(H=this.performanceClient)==null?void 0:H.startMeasurement(k.CryptoOptsSignJwt,i),l=await this.cache.getItem(t);if(!l)throw j(ph);const d=await Uu(l.publicKey),f=_p(d),g=Os(JSON.stringify({kid:t})),m=hh.getShrHeaderString({...n==null?void 0:n.header,alg:d.alg,kid:g}),v=Os(m);e.cnf={jwk:JSON.parse(f)};const C=Os(JSON.stringify(e)),S=`${v}.${C}`,I=new TextEncoder().encode(S),O=await jx(l.privateKey,I),$=Fc(new Uint8Array(O)),F=`${S}.${$}`;return s&&s.end({success:!0}),F}async hashString(e){return QC(e)}}mi.POP_KEY_USAGES=["sign","verify"];mi.EXTRACTABLE=!0;function _p(r){return JSON.stringify(r,Object.keys(r).sort())}/*! @azure/msal-browser v3.28.1 2025-01-14 */class hD{constructor(){if(!window.localStorage)throw _h(ma)}getItem(e){return window.localStorage.getItem(e)}setItem(e,t){window.localStorage.setItem(e,t)}removeItem(e){window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class fD{constructor(){if(!window.sessionStorage)throw _h(ma)}getItem(e){return window.sessionStorage.getItem(e)}setItem(e,t){window.sessionStorage.setItem(e,t)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function tw(r,e){if(!e)return null;try{return Un.parseRequestState(r,e).libraryState.meta}catch{throw B(hi)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const gD=24*60*60*1e3;class mD{getItem(e){const t=`${encodeURIComponent(e)}`,n=document.cookie.split(";");for(let i=0;i<n.length;i++){const s=n[i],[l,...d]=decodeURIComponent(s).trim().split("="),f=d.join("=");if(l===t)return f}return""}setItem(e,t,n,i=!0){let s=`${encodeURIComponent(e)}=${encodeURIComponent(t)};path=/;SameSite=Lax;`;if(n){const l=pD(n);s+=`expires=${l};`}i&&(s+="Secure;"),document.cookie=s}removeItem(e){this.setItem(e,"",-1)}getKeys(){const e=document.cookie.split(";"),t=[];return e.forEach(n=>{const i=decodeURIComponent(n).trim().split("=");t.push(i[0])}),t}containsKey(e){return this.getKeys().includes(e)}}function pD(r){const e=new Date;return new Date(e.getTime()+r*gD).toUTCString()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Sd extends fi{constructor(e,t,n,i,s,l){super(e,n,i,s),this.cacheConfig=t,this.logger=i,this.internalStorage=new Ed,this.browserStorage=this.setupBrowserStorage(this.cacheConfig.cacheLocation),this.temporaryCacheStorage=this.setupBrowserStorage(this.cacheConfig.temporaryCacheLocation),this.cookieStorage=new mD,t.cacheMigrationEnabled&&(this.migrateCacheEntries(),this.createKeyMaps()),this.performanceClient=l}setupBrowserStorage(e){try{switch(e){case Ht.LocalStorage:return new hD;case Ht.SessionStorage:return new fD;case Ht.MemoryStorage:default:break}}catch(t){this.logger.error(t)}return this.cacheConfig.cacheLocation=Ht.MemoryStorage,new Ed}migrateCacheEntries(){const e=`${P.CACHE_PREFIX}.${ct.ID_TOKEN}`,t=`${P.CACHE_PREFIX}.${ct.CLIENT_INFO}`,n=`${P.CACHE_PREFIX}.${ct.ERROR}`,i=`${P.CACHE_PREFIX}.${ct.ERROR_DESC}`,s=this.browserStorage.getItem(e),l=this.browserStorage.getItem(t),d=this.browserStorage.getItem(n),f=this.browserStorage.getItem(i),g=[s,l,d,f];[ct.ID_TOKEN,ct.CLIENT_INFO,ct.ERROR,ct.ERROR_DESC].forEach((v,C)=>{const S=g[C];S&&this.setTemporaryCache(v,S,!0)})}createKeyMaps(){this.logger.trace("BrowserCacheManager - createKeyMaps called.");const e=this.getItem(Lr.ACCOUNT_KEYS),t=this.getItem(`${Lr.TOKEN_KEYS}.${this.clientId}`);if(e&&t){this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.");return}this.browserStorage.getKeys().forEach(i=>{if(this.isCredentialKey(i)){const s=this.getItem(i);if(s){const l=this.validateAndParseJson(s);if(l&&l.hasOwnProperty("credentialType"))switch(l.credentialType){case re.ID_TOKEN:if(Xm(l)){this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - idToken with key: ${i} found, saving key to token key map`);const d=l,f=this.updateCredentialCacheKey(i,d);this.addTokenKey(f,re.ID_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed idToken validation on key: ${i}`);break;case re.ACCESS_TOKEN:case re.ACCESS_TOKEN_WITH_AUTH_SCHEME:if(Qm(l)){this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - accessToken with key: ${i} found, saving key to token key map`);const d=l,f=this.updateCredentialCacheKey(i,d);this.addTokenKey(f,re.ACCESS_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed accessToken validation on key: ${i}`);break;case re.REFRESH_TOKEN:if(Zm(l)){this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - refreshToken with key: ${i} found, saving key to token key map`);const d=l,f=this.updateCredentialCacheKey(i,d);this.addTokenKey(f,re.REFRESH_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: ${i}`);break}}}if(this.isAccountKey(i)){const s=this.getItem(i);if(s){const l=this.validateAndParseJson(s);l&&at.isAccountEntity(l)&&(this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - account with key: ${i} found, saving key to account key map`),this.addAccountKeyToMap(i))}}})}validateAndParseJson(e){try{const t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}}getItem(e){return this.browserStorage.getItem(e)}setItem(e,t){this.browserStorage.setItem(e,t)}getAccount(e,t){this.logger.trace("BrowserCacheManager.getAccount called");const n=this.getCachedAccountEntity(e);return this.updateOutdatedCachedAccount(e,n,t)}getCachedAccountEntity(e){const t=this.getItem(e);if(!t)return this.removeAccountKeyFromMap(e),null;const n=this.validateAndParseJson(t);return!n||!at.isAccountEntity(n)?(this.removeAccountKeyFromMap(e),null):fi.toObject(new at,n)}setAccount(e){this.logger.trace("BrowserCacheManager.setAccount called");const t=e.generateAccountKey();this.setItem(t,JSON.stringify(e)),this.addAccountKeyToMap(t)}getAccountKeys(){this.logger.trace("BrowserCacheManager.getAccountKeys called");const e=this.getItem(Lr.ACCOUNT_KEYS);return e?JSON.parse(e):(this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found"),[])}addAccountKeyToMap(e){this.logger.trace("BrowserCacheManager.addAccountKeyToMap called"),this.logger.tracePii(`BrowserCacheManager.addAccountKeyToMap called with key: ${e}`);const t=this.getAccountKeys();t.indexOf(e)===-1?(t.push(e),this.setItem(Lr.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added")):this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map")}removeAccountKeyFromMap(e){this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called"),this.logger.tracePii(`BrowserCacheManager.removeAccountKeyFromMap called with key: ${e}`);const t=this.getAccountKeys(),n=t.indexOf(e);n>-1?(t.splice(n,1),this.setItem(Lr.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")):this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}async removeAccount(e){super.removeAccount(e),this.removeAccountKeyFromMap(e)}removeOutdatedAccount(e){this.removeItem(e),this.removeAccountKeyFromMap(e)}removeIdToken(e){super.removeIdToken(e),this.removeTokenKey(e,re.ID_TOKEN)}async removeAccessToken(e){super.removeAccessToken(e),this.removeTokenKey(e,re.ACCESS_TOKEN)}removeRefreshToken(e){super.removeRefreshToken(e),this.removeTokenKey(e,re.REFRESH_TOKEN)}getTokenKeys(){this.logger.trace("BrowserCacheManager.getTokenKeys called");const e=this.getItem(`${Lr.TOKEN_KEYS}.${this.clientId}`);if(e){const t=this.validateAndParseJson(e);if(t&&t.hasOwnProperty("idToken")&&t.hasOwnProperty("accessToken")&&t.hasOwnProperty("refreshToken"))return t;this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.")}else this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");return{idToken:[],accessToken:[],refreshToken:[]}}addTokenKey(e,t){this.logger.trace("BrowserCacheManager addTokenKey called");const n=this.getTokenKeys();switch(t){case re.ID_TOKEN:n.idToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),n.idToken.push(e));break;case re.ACCESS_TOKEN:n.accessToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - accessToken added to map"),n.accessToken.push(e));break;case re.REFRESH_TOKEN:n.refreshToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),n.refreshToken.push(e));break;default:throw this.logger.error(`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${t}`),B(hd)}this.setItem(`${Lr.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(n))}removeTokenKey(e,t){this.logger.trace("BrowserCacheManager removeTokenKey called");const n=this.getTokenKeys();switch(t){case re.ID_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: ${e} from map`);const i=n.idToken.indexOf(e);i>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map"),n.idToken.splice(i,1)):this.logger.info("BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.");break;case re.ACCESS_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: ${e} from map`);const s=n.accessToken.indexOf(e);s>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map"),n.accessToken.splice(s,1)):this.logger.info("BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.");break;case re.REFRESH_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: ${e} from map`);const l=n.refreshToken.indexOf(e);l>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map"),n.refreshToken.splice(l,1)):this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.");break;default:throw this.logger.error(`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${t}`),B(hd)}this.setItem(`${Lr.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(n))}getIdTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,re.ID_TOKEN),null;const n=this.validateAndParseJson(t);return!n||!Xm(n)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,re.ID_TOKEN),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),n)}setIdTokenCredential(e){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const t=oi(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,re.ID_TOKEN)}getAccessTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,re.ACCESS_TOKEN),null;const n=this.validateAndParseJson(t);return!n||!Qm(n)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,re.ACCESS_TOKEN),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),n)}setAccessTokenCredential(e){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const t=oi(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,re.ACCESS_TOKEN)}getRefreshTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,re.REFRESH_TOKEN),null;const n=this.validateAndParseJson(t);return!n||!Zm(n)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,re.REFRESH_TOKEN),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),n)}setRefreshTokenCredential(e){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const t=oi(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,re.REFRESH_TOKEN)}getAppMetadata(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const n=this.validateAndParseJson(t);return!n||!sM(e,n)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),n)}setAppMetadata(e){this.logger.trace("BrowserCacheManager.setAppMetadata called");const t=aM(e);this.setItem(t,JSON.stringify(e))}getServerTelemetry(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const n=this.validateAndParseJson(t);return!n||!oM(e,n)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),n)}setServerTelemetry(e,t){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(t))}getAuthorityMetadata(e){const t=this.internalStorage.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const n=this.validateAndParseJson(t);return n&&cM(e,n)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),n):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(t=>this.isAuthorityMetadata(t))}setWrapperMetadata(e,t){this.internalStorage.setItem(Rs.WRAPPER_SKU,e),this.internalStorage.setItem(Rs.WRAPPER_VER,t)}getWrapperMetadata(){const e=this.internalStorage.getItem(Rs.WRAPPER_SKU)||P.EMPTY_STRING,t=this.internalStorage.getItem(Rs.WRAPPER_VER)||P.EMPTY_STRING;return[e,t]}setAuthorityMetadata(e,t){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(t))}getActiveAccount(){const e=this.generateCacheKey(ct.ACTIVE_ACCOUNT_FILTERS),t=this.getItem(e);if(!t){this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema");const i=this.generateCacheKey(ct.ACTIVE_ACCOUNT),s=this.getItem(i);if(!s)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null;const l=this.getAccountInfoFilteredBy({localAccountId:s});return l?(this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found"),this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema"),this.setActiveAccount(l),l):null}const n=this.validateAndParseJson(t);return n?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:n.homeAccountId,localAccountId:n.localAccountId,tenantId:n.tenantId})):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e){const t=this.generateCacheKey(ct.ACTIVE_ACCOUNT_FILTERS),n=this.generateCacheKey(ct.ACTIVE_ACCOUNT);if(e){this.logger.verbose("setActiveAccount: Active account set");const i={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId};this.browserStorage.setItem(t,JSON.stringify(i)),this.browserStorage.setItem(n,e.localAccountId)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(t),this.browserStorage.removeItem(n)}getThrottlingCache(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const n=this.validateAndParseJson(t);return!n||!iM(e,n)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),n)}setThrottlingCache(e,t){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(t))}getTemporaryCache(e,t){const n=t?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const s=this.cookieStorage.getItem(n);if(s)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),s}const i=this.temporaryCacheStorage.getItem(n);if(!i){if(this.cacheConfig.cacheLocation===Ht.LocalStorage){const s=this.browserStorage.getItem(n);if(s)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),s}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),i}setTemporaryCache(e,t,n){const i=n?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(i,t),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(i,t,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}async clear(){await this.removeAllAccounts(),this.removeAppMetadata(),this.temporaryCacheStorage.getKeys().forEach(e=>{(e.indexOf(P.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(e)}),this.browserStorage.getKeys().forEach(e=>{(e.indexOf(P.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(e)}),this.internalStorage.clear()}async clearTokensAndKeysWithClaims(e,t){e.addQueueMeasurement(k.ClearTokensAndKeysWithClaims,t);const n=this.getTokenKeys(),i=[];n.accessToken.forEach(s=>{const l=this.getAccessTokenCredential(s);l!=null&&l.requestedClaimsHash&&s.includes(l.requestedClaimsHash.toLowerCase())&&i.push(this.removeAccessToken(s))}),await Promise.all(i),i.length>0&&this.logger.warning(`${i.length} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return this.validateAndParseJson(e)?JSON.stringify(e):Bn.startsWith(e,P.CACHE_PREFIX)||Bn.startsWith(e,ct.ADAL_ID_TOKEN)?e:`${P.CACHE_PREFIX}.${this.clientId}.${e}`}generateAuthorityKey(e){const{libraryState:{id:t}}=Un.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${ke.AUTHORITY}.${t}`)}generateNonceKey(e){const{libraryState:{id:t}}=Un.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${ke.NONCE_IDTOKEN}.${t}`)}generateStateKey(e){const{libraryState:{id:t}}=Un.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${ke.REQUEST_STATE}.${t}`)}getCachedAuthority(e){const t=this.generateStateKey(e),n=this.getTemporaryCache(t);if(!n)return null;const i=this.generateAuthorityKey(n);return this.getTemporaryCache(i)}updateCacheEntries(e,t,n,i,s){this.logger.trace("BrowserCacheManager.updateCacheEntries called");const l=this.generateStateKey(e);this.setTemporaryCache(l,e,!1);const d=this.generateNonceKey(e);this.setTemporaryCache(d,t,!1);const f=this.generateAuthorityKey(e);if(this.setTemporaryCache(f,n,!1),s){const g={credential:s.homeAccountId,type:on.HOME_ACCOUNT_ID};this.setTemporaryCache(ke.CCS_CREDENTIAL,JSON.stringify(g),!0)}else if(i){const g={credential:i,type:on.UPN};this.setTemporaryCache(ke.CCS_CREDENTIAL,JSON.stringify(g),!0)}}resetRequestCache(e){this.logger.trace("BrowserCacheManager.resetRequestCache called"),e&&(this.temporaryCacheStorage.getKeys().forEach(t=>{t.indexOf(e)!==-1&&this.removeTemporaryItem(t)}),this.removeTemporaryItem(this.generateStateKey(e)),this.removeTemporaryItem(this.generateNonceKey(e)),this.removeTemporaryItem(this.generateAuthorityKey(e))),this.removeTemporaryItem(this.generateCacheKey(ke.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey(ke.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey(ke.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey(ke.CORRELATION_ID)),this.removeTemporaryItem(this.generateCacheKey(ke.CCS_CREDENTIAL)),this.removeTemporaryItem(this.generateCacheKey(ke.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cleanRequestByState(e){if(this.logger.trace("BrowserCacheManager.cleanRequestByState called"),e){const t=this.generateStateKey(e),n=this.temporaryCacheStorage.getItem(t);this.logger.infoPii(`BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: ${n}`),this.resetRequestCache(n||P.EMPTY_STRING)}}cleanRequestByInteractionType(e){this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.temporaryCacheStorage.getKeys().forEach(t=>{if(t.indexOf(ke.REQUEST_STATE)===-1)return;const n=this.temporaryCacheStorage.getItem(t);if(!n)return;const i=tw(this.cryptoImpl,n);i&&i.interactionType===e&&(this.logger.infoPii(`BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: ${n}`),this.resetRequestCache(n))}),this.setInteractionInProgress(!1)}cacheCodeRequest(e){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");const t=yh(JSON.stringify(e));this.setTemporaryCache(ke.REQUEST_PARAMS,t,!0)}getCachedRequest(e){this.logger.trace("BrowserCacheManager.getCachedRequest called");const t=this.getTemporaryCache(ke.REQUEST_PARAMS,!0);if(!t)throw j(OC);let n;try{n=JSON.parse(tr(t))}catch(i){throw this.logger.errorPii(`Attempted to parse: ${t}`),this.logger.error(`Parsing cached token request threw with error: ${i}`),j(NC)}if(this.removeTemporaryItem(this.generateCacheKey(ke.REQUEST_PARAMS)),!n.authority){const i=this.generateAuthorityKey(e),s=this.getTemporaryCache(i);if(!s)throw j(mh);n.authority=s}return n}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(ke.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const t=this.validateAndParseJson(e);return t||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){const t=this.getInteractionInProgress();return e?t===this.clientId:!!t}getInteractionInProgress(){const e=`${P.CACHE_PREFIX}.${ke.INTERACTION_STATUS_KEY}`;return this.getTemporaryCache(e,!1)}setInteractionInProgress(e){const t=`${P.CACHE_PREFIX}.${ke.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw j(TC);this.setTemporaryCache(t,this.clientId,!1)}else!e&&this.getInteractionInProgress()===this.clientId&&this.removeTemporaryItem(t)}getLegacyLoginHint(){const e=this.getTemporaryCache(ct.ADAL_ID_TOKEN);e&&(this.browserStorage.removeItem(ct.ADAL_ID_TOKEN),this.logger.verbose("Cached ADAL id token retrieved."));const t=this.getTemporaryCache(ct.ID_TOKEN,!0);t&&(this.browserStorage.removeItem(this.generateCacheKey(ct.ID_TOKEN)),this.logger.verbose("Cached MSAL.js v1 id token retrieved"));const n=t||e;if(n){const i=wo(n,tr);if(i.preferred_username)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint"),i.preferred_username;if(i.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),i.upn;this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, however, no account hint claim found. Enable preferred_username or upn id token claim to get SSO.")}return null}updateCredentialCacheKey(e,t){const n=oi(t);if(e!==n){const i=this.getItem(e);if(i)return this.browserStorage.removeItem(e),this.setItem(n,i),this.logger.verbose(`Updated an outdated ${t.credentialType} cache key`),n;this.logger.error(`Attempted to update an outdated ${t.credentialType} cache key but no item matching the outdated key was found in storage`)}return e}async hydrateCache(e,t){var d,f,g;const n=Nc((d=e.account)==null?void 0:d.homeAccountId,(f=e.account)==null?void 0:f.environment,e.idToken,this.clientId,e.tenantId);let i;t.claims&&(i=await this.cryptoImpl.hashString(t.claims));const s=Pc((g=e.account)==null?void 0:g.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?e.expiresOn.getTime()/1e3:0,e.extExpiresOn?e.extExpiresOn.getTime()/1e3:0,tr,void 0,e.tokenType,void 0,t.sshKid,t.claims,i),l={idToken:n,accessToken:s};return this.saveCacheRecord(l)}async saveCacheRecord(e,t,n){try{await super.saveCacheRecord(e,t,n)}catch(i){if(i instanceof ci&&this.performanceClient&&n)try{const s=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:s.refreshToken.length,cacheIdCount:s.idToken.length,cacheAtCount:s.accessToken.length},n)}catch{}throw i}}}const vD=(r,e)=>{const t={cacheLocation:Ht.MemoryStorage,temporaryCacheLocation:Ht.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new Sd(r,t,cc,e)};/*! @azure/msal-browser v3.28.1 2025-01-14 */function yD(r,e,t,n){return r.verbose("getAllAccounts called"),t?e.getAllAccounts(n):[]}function CD(r,e,t){if(e.trace("getAccount called"),Object.keys(r).length===0)return e.warning("getAccount: No accountFilter provided"),null;const n=t.getAccountInfoFilteredBy(r);return n?(e.verbose("getAccount: Account matching provided filter found, returning"),n):(e.verbose("getAccount: No matching account found, returning null"),null)}function wD(r,e,t){if(e.trace("getAccountByUsername called"),!r)return e.warning("getAccountByUsername: No username provided"),null;const n=t.getAccountInfoFilteredBy({username:r});return n?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${r}`),n):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function _D(r,e,t){if(e.trace("getAccountByHomeId called"),!r)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const n=t.getAccountInfoFilteredBy({homeAccountId:r});return n?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${r}`),n):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function TD(r,e,t){if(e.trace("getAccountByLocalId called"),!r)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const n=t.getAccountInfoFilteredBy({localAccountId:r});return n?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${r}`),n):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function ED(r,e){e.setActiveAccount(r)}function SD(r){return r.getActiveAccount()}/*! @azure/msal-browser v3.28.1 2025-01-14 */const ne={INITIALIZE_START:"msal:initializeStart",INITIALIZE_END:"msal:initializeEnd",ACCOUNT_ADDED:"msal:accountAdded",ACCOUNT_REMOVED:"msal:accountRemoved",ACTIVE_ACCOUNT_CHANGED:"msal:activeAccountChanged",LOGIN_START:"msal:loginStart",LOGIN_SUCCESS:"msal:loginSuccess",LOGIN_FAILURE:"msal:loginFailure",ACQUIRE_TOKEN_START:"msal:acquireTokenStart",ACQUIRE_TOKEN_SUCCESS:"msal:acquireTokenSuccess",ACQUIRE_TOKEN_FAILURE:"msal:acquireTokenFailure",ACQUIRE_TOKEN_NETWORK_START:"msal:acquireTokenFromNetworkStart",SSO_SILENT_START:"msal:ssoSilentStart",SSO_SILENT_SUCCESS:"msal:ssoSilentSuccess",SSO_SILENT_FAILURE:"msal:ssoSilentFailure",ACQUIRE_TOKEN_BY_CODE_START:"msal:acquireTokenByCodeStart",ACQUIRE_TOKEN_BY_CODE_SUCCESS:"msal:acquireTokenByCodeSuccess",ACQUIRE_TOKEN_BY_CODE_FAILURE:"msal:acquireTokenByCodeFailure",HANDLE_REDIRECT_START:"msal:handleRedirectStart",HANDLE_REDIRECT_END:"msal:handleRedirectEnd",POPUP_OPENED:"msal:popupOpened",LOGOUT_START:"msal:logoutStart",LOGOUT_SUCCESS:"msal:logoutSuccess",LOGOUT_FAILURE:"msal:logoutFailure",LOGOUT_END:"msal:logoutEnd",RESTORE_FROM_BFCACHE:"msal:restoreFromBFCache"};/*! @azure/msal-browser v3.28.1 2025-01-14 */class AD{constructor(e){this.eventCallbacks=new Map,this.logger=e||new qr({})}addEventCallback(e,t,n){if(typeof window<"u"){const i=n||nD();return this.eventCallbacks.has(i)?(this.logger.error(`Event callback with id: ${i} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(i,[e,t||[]]),this.logger.verbose(`Event callback registered with id: ${i}`),i)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,t,n,i){if(typeof window<"u"){const s={eventType:e,interactionType:t||null,payload:n||null,error:i||null,timestamp:Date.now()};this.eventCallbacks.forEach(([l,d],f)=>{(d.length===0||d.includes(e))&&(this.logger.verbose(`Emitting event to callback ${f}: ${e}`),l.apply(null,[s]))})}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class nw{constructor(e,t,n,i,s,l,d,f,g){this.config=e,this.browserStorage=t,this.browserCrypto=n,this.networkClient=this.config.system.networkClient,this.eventHandler=s,this.navigationClient=l,this.nativeMessageHandler=f,this.correlationId=g||Sr(),this.logger=i.clone(tn.MSAL_SKU,Hc,this.correlationId),this.performanceClient=d}async clearCacheOnLogout(e){if(e){at.accountInfoIsEqual(e,this.browserStorage.getActiveAccount(),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null));try{await this.browserStorage.removeAccount(at.generateAccountCacheKey(e)),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch{this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),await this.browserStorage.clear(),await this.browserCrypto.clearKeystore()}catch{this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const t=e||this.config.auth.redirectUri;return ye.getAbsoluteUrl(t,Cr())}initializeServerTelemetryManager(e,t){this.logger.verbose("initializeServerTelemetryManager called");const n={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:t||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new ga(n,this.browserStorage)}async getDiscoveredAuthority(e){const{account:t}=e,n=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(k.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const i={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},s=e.requestAuthority||this.config.auth.authority,l=n!=null&&n.length?n==="true":this.config.auth.instanceAware,d=t&&l?this.config.auth.authority.replace(ye.getDomainFromUrl(s),t.environment):s,f=St.generateAuthority(d,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),g=await U(dC,k.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(f,this.config.system.networkClient,this.browserStorage,i,this.logger,this.correlationId,this.performanceClient);if(t&&!g.isAlias(t.environment))throw Pe(nC);return g}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const bD=32;async function ID(r,e,t){r.addQueueMeasurement(k.GeneratePkceCodes,t);const n=_o(kD,k.GenerateCodeVerifier,e,r,t)(r,e,t),i=await U(RD,k.GenerateCodeChallengeFromVerifier,e,r,t)(n,r,e,t);return{verifier:n,challenge:i}}function kD(r,e,t){try{const n=new Uint8Array(bD);return _o(Wx,k.GetRandomValues,e,r,t)(n),Fc(n)}catch{throw j(fh)}}async function RD(r,e,t,n){e.addQueueMeasurement(k.GenerateCodeChallengeFromVerifier,n);try{const i=await U(JC,k.Sha256Digest,t,e,n)(r,e,n);return Fc(new Uint8Array(i))}catch{throw j(fh)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function Ah(r,e,t,n){t.addQueueMeasurement(k.InitializeBaseRequest,r.correlationId);const i=r.authority||e.auth.authority,s=[...r&&r.scopes||[]],l={...r,correlationId:r.correlationId,authority:i,scopes:s};if(!l.authenticationScheme)l.authenticationScheme=Oe.BEARER,n.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(l.authenticationScheme===Oe.SSH){if(!r.sshJwk)throw Pe(Mc);if(!r.sshKid)throw Pe(Zy)}n.verbose(`Authentication Scheme set to "${l.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&r.claims&&!Bn.isEmptyObj(r.claims)&&(l.requestedClaimsHash=await QC(r.claims)),l}async function OD(r,e,t,n,i){n.addQueueMeasurement(k.InitializeSilentRequest,r.correlationId);const s=await U(Ah,k.InitializeBaseRequest,i,n,r.correlationId)(r,t,n,i);return{...r,...s,account:e,forceRefresh:r.forceRefresh||!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class yi extends nw{async initializeAuthorizationCodeRequest(e){this.performanceClient.addQueueMeasurement(k.StandardInteractionClientInitializeAuthorizationCodeRequest,this.correlationId);const t=await U(ID,k.GeneratePkceCodes,this.logger,this.performanceClient,this.correlationId)(this.performanceClient,this.logger,this.correlationId),n={...e,redirectUri:e.redirectUri,code:P.EMPTY_STRING,codeVerifier:t.verifier};return e.codeChallenge=t.challenge,e.codeChallengeMethod=P.S256_CODE_CHALLENGE_METHOD,n}initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const t={correlationId:this.correlationId||Sr(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const n=this.getLogoutHintFromIdTokenClaims(e.account);n&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),t.logoutHint=n)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return!e||e.postLogoutRedirectUri!==null?e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",t.correlationId),t.postLogoutRedirectUri=ye.getAbsoluteUrl(e.postLogoutRedirectUri,Cr())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",t.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",t.correlationId),t.postLogoutRedirectUri=ye.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,Cr())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",t.correlationId),t.postLogoutRedirectUri=ye.getAbsoluteUrl(Cr(),Cr())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",t.correlationId),t}getLogoutHintFromIdTokenClaims(e){const t=e.idTokenClaims;if(t){if(t.login_hint)return t.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(k.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const t=await U(this.getClientConfiguration.bind(this),k.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new gC(t,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:t,requestAuthority:n,requestAzureCloudOptions:i,requestExtraQueryParameters:s,account:l}=e;this.performanceClient.addQueueMeasurement(k.StandardInteractionClientGetClientConfiguration,this.correlationId);const d=await U(this.getDiscoveredAuthority.bind(this),k.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:n,requestAzureCloudOptions:i,requestExtraQueryParameters:s,account:l}),f=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:d,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:f.loggerCallback,piiLoggingEnabled:f.piiLoggingEnabled,logLevel:f.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:t,libraryInfo:{sku:tn.MSAL_SKU,version:Hc,cpu:P.EMPTY_STRING,os:P.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,t){this.performanceClient.addQueueMeasurement(k.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const n=this.getRedirectUri(e.redirectUri),i={interactionType:t},s=Un.setRequestState(this.browserCrypto,e&&e.state||P.EMPTY_STRING,i),d={...await U(Ah,k.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:n,state:s,nonce:e.nonce||Sr(),responseMode:this.config.auth.OIDCOptions.serverResponseType};if(e.loginHint||e.sid)return d;const f=e.account||this.browserStorage.getActiveAccount();if(f&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${f.homeAccountId}`,this.correlationId),d.account=f),!d.loginHint&&!f){const g=this.browserStorage.getLegacyLoginHint();g&&(d.loginHint=g)}return d}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const ND="ContentError",rw="user_switch";/*! @azure/msal-browser v3.28.1 2025-01-14 */const PD="USER_INTERACTION_REQUIRED",MD="USER_CANCEL",xD="NO_NETWORK",DD="PERSISTENT_ERROR",LD="DISABLED",BD="ACCOUNT_UNAVAILABLE";/*! @azure/msal-browser v3.28.1 2025-01-14 */const UD=-2147186943,VD={[rw]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class Jn extends He{constructor(e,t,n){super(e,t),Object.setPrototypeOf(this,Jn.prototype),this.name="NativeAuthError",this.ext=n}}function Zo(r){if(r.ext&&r.ext.status&&(r.ext.status===DD||r.ext.status===LD)||r.ext&&r.ext.error&&r.ext.error===UD)return!0;switch(r.errorCode){case ND:return!0;default:return!1}}function Ad(r,e,t){if(t&&t.status)switch(t.status){case BD:return pd(hC);case PD:return new Vn(r,e);case MD:return j(vo);case xD:return j(gc)}return new Jn(r,VD[r]||e,t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class ow extends yi{async acquireToken(e){this.performanceClient.addQueueMeasurement(k.SilentCacheClientAcquireToken,e.correlationId);const t=this.initializeServerTelemetryManager(Le.acquireTokenSilent_silentFlow),n=await U(this.getClientConfiguration.bind(this),k.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),i=new Ex(n,this.performanceClient);this.logger.verbose("Silent auth client created");try{const l=(await U(i.acquireCachedToken.bind(i),k.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),l}catch(s){throw s instanceof Sa&&s.errorCode===ph&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),s}}logout(e){this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(t==null?void 0:t.account)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class li extends nw{constructor(e,t,n,i,s,l,d,f,g,m,v,C){var T;super(e,t,n,i,s,l,f,g,C),this.apiId=d,this.accountId=m,this.nativeMessageHandler=g,this.nativeStorageManager=v,this.silentCacheClient=new ow(e,this.nativeStorageManager,n,i,s,l,f,g,C),this.serverTelemetryManager=this.initializeServerTelemetryManager(this.apiId);const S=this.nativeMessageHandler.getExtensionId()===ai.PREFERRED_EXTENSION_ID?"chrome":(T=this.nativeMessageHandler.getExtensionId())!=null&&T.length?"unknown":void 0;this.skus=ga.makeExtraSkuString({libraryName:tn.MSAL_SKU,libraryVersion:Hc,extensionName:S,extensionVersion:this.nativeMessageHandler.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[ax]:this.skus}}async acquireToken(e){this.performanceClient.addQueueMeasurement(k.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const t=this.performanceClient.startMeasurement(k.NativeInteractionClientAcquireToken,e.correlationId),n=rr();try{const i=await this.initializeNativeRequest(e);try{const g=await this.acquireTokensFromCache(this.accountId,i);return t.end({success:!0,isNativeBroker:!1,fromCache:!0}),g}catch{this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const{...s}=i,l={method:uo.GetToken,request:s},d=await this.nativeMessageHandler.sendMessage(l),f=this.validateNativeResponse(d);return await this.handleNativeResponse(f,i,n).then(g=>(t.end({success:!0,isNativeBroker:!0,requestId:g.requestId}),this.serverTelemetryManager.clearNativeBrokerErrorCode(),g)).catch(g=>{throw t.end({success:!1,errorCode:g.errorCode,subErrorCode:g.subError,isNativeBroker:!0}),g})}catch(i){throw i instanceof Jn&&this.serverTelemetryManager.setNativeBrokerErrorCode(i.errorCode),i}}createSilentCacheRequest(e,t){return{authority:e.authority,correlationId:this.correlationId,scopes:Je.fromString(e.scope).asArray(),account:t,forceRefresh:!1}}async acquireTokensFromCache(e,t){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),B(ud);const n=this.browserStorage.getBaseAccountInfo({nativeAccountId:e});if(!n)throw B(ud);try{const i=this.createSilentCacheRequest(t,n),s=await this.silentCacheClient.acquireToken(i),l={...n,idTokenClaims:s==null?void 0:s.idTokenClaims,idToken:s==null?void 0:s.idToken};return{...s,account:l}}catch(i){throw i}}async acquireTokenRedirect(e,t){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...n}=e;delete n.onRedirectNavigate;const i=await this.initializeNativeRequest(n),s={method:uo.GetToken,request:i};try{const f=await this.nativeMessageHandler.sendMessage(s);this.validateNativeResponse(f)}catch(f){if(f instanceof Jn&&(this.serverTelemetryManager.setNativeBrokerErrorCode(f.errorCode),Zo(f)))throw f}this.browserStorage.setTemporaryCache(ke.NATIVE_REQUEST,JSON.stringify(i),!0);const l={apiId:Le.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);t.end({success:!0}),await this.navigationClient.navigateExternal(d,l)}async handleRedirectPromise(e,t){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const n=this.browserStorage.getCachedNativeRequest();if(!n)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&t&&(e==null||e.addFields({errorCode:"no_cached_request"},t)),null;const{prompt:i,...s}=n;i&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(ke.NATIVE_REQUEST));const l={method:uo.GetToken,request:s},d=rr();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const f=await this.nativeMessageHandler.sendMessage(l);this.validateNativeResponse(f);const g=this.handleNativeResponse(f,s,d);this.browserStorage.setInteractionInProgress(!1);const m=await g;return this.serverTelemetryManager.clearNativeBrokerErrorCode(),m}catch(f){throw this.browserStorage.setInteractionInProgress(!1),f}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,t,n){var m;this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const i=wo(e.id_token,tr),s=this.createHomeAccountIdentifier(e,i),l=(m=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:t.accountId}))==null?void 0:m.homeAccountId;if(s!==l&&e.account.id!==t.accountId)throw Ad(rw);const d=await this.getDiscoveredAuthority({requestAuthority:t.authority}),f=uh(this.browserStorage,d,s,tr,i,e.client_info,void 0,i.tid,void 0,e.account.id,this.logger),g=await this.generateAuthenticationResult(e,t,i,f,d.canonicalAuthority,n);return this.cacheAccount(f),this.cacheNativeTokens(e,t,s,i,e.access_token,g.tenantId,n),g}createHomeAccountIdentifier(e,t){return at.generateHomeAccountId(e.client_info||P.EMPTY_STRING,xn.Default,this.logger,this.browserCrypto,t)}generateScopes(e,t){return e.scope?Je.fromString(e.scope):Je.fromString(t.scope)}async generatePopAccessToken(e,t){if(t.tokenType===Oe.POP&&t.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const n=new gi(this.browserCrypto),i={resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,shrNonce:t.shrNonce};if(!t.keyId)throw B(Yd);return n.signPopToken(e.access_token,t.keyId,i)}else return e.access_token}async generateAuthenticationResult(e,t,n,i,s,l){const d=this.addTelemetryFromNativeResponse(e),f=e.scope?Je.fromString(e.scope):Je.fromString(t.scope),g=e.account.properties||{},m=g.UID||n.oid||n.sub||P.EMPTY_STRING,v=g.TenantId||n.tid||P.EMPTY_STRING,C=oh(i.getAccountInfo(),void 0,n,e.id_token);C.nativeAccountId!==e.account.id&&(C.nativeAccountId=e.account.id);const S=await this.generatePopAccessToken(e,t),T=t.tokenType===Oe.POP?Oe.POP:Oe.BEARER;return{authority:s,uniqueId:m,tenantId:v,scopes:f.asArray(),account:C,idToken:e.id_token,idTokenClaims:n,accessToken:S,fromCache:d?this.isResponseFromCache(d):!1,expiresOn:new Date(Number(l+e.expires_in)*1e3),tokenType:T,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}cacheAccount(e){this.browserStorage.setAccount(e),this.browserStorage.removeAccountContext(e).catch(t=>{this.logger.error(`Error occurred while removing account context from browser storage. ${t}`)})}cacheNativeTokens(e,t,n,i,s,l,d){const f=Nc(n,t.authority,e.id_token||"",t.clientId,i.tid||""),g=t.tokenType===Oe.POP?P.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,m=d+g,v=this.generateScopes(e,t),C=Pc(n,t.authority,s,t.clientId,i.tid||l,v.printScopes(),m,0,tr,void 0,t.tokenType,void 0,t.keyId),S={idToken:f,accessToken:C};this.nativeStorageManager.saveCacheRecord(S,t.storeInCache)}addTelemetryFromNativeResponse(e){const t=this.getMATSFromResponse(e);return t?(this.performanceClient.addFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:t.broker_version,matsAccountJoinOnStart:t.account_join_on_start,matsAccountJoinOnEnd:t.account_join_on_end,matsDeviceJoin:t.device_join,matsPromptBehavior:t.prompt_behavior,matsApiErrorCode:t.api_error_code,matsUiVisible:t.ui_visible,matsSilentCode:t.silent_code,matsSilentBiSubCode:t.silent_bi_sub_code,matsSilentMessage:t.silent_message,matsSilentStatus:t.silent_status,matsHttpStatus:t.http_status,matsHttpEventCount:t.http_event_count},this.correlationId),t):null}validateNativeResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw Ty(Kd,"Response missing expected properties.")}getMATSFromResponse(e){if(e.properties.MATS)try{return JSON.parse(e.properties.MATS)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return typeof e.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const t=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:t,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const n=new ye(t);n.validateAsUri();const{scopes:i,...s}=e,l=new Je(i||[]);l.appendScopes(vi);const d=()=>{switch(this.apiId){case Le.ssoSilent:case Le.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),dt.NONE}if(!e.prompt){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e.prompt){case dt.NONE:case dt.CONSENT:case dt.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e.prompt;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e.prompt} is not compatible with native flow`),j($C)}},f={...s,accountId:this.accountId,clientId:this.config.auth.clientId,authority:n.urlString,scope:l.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:d(),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(f.signPopToken&&e.popKid)throw j(zC);if(this.handleExtraBrokerParams(f),f.extraParameters=f.extraParameters||{},f.extraParameters.telemetry=ai.MATS_TELEMETRY,e.authenticationScheme===Oe.POP){const g={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},m=new gi(this.browserCrypto);let v;if(f.keyId)v=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:f.keyId})),f.signPopToken=!1;else{const C=await U(m.generateCnf.bind(m),k.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(g,this.logger);v=C.reqCnfString,f.keyId=C.kid,f.signPopToken=!0}f.reqCnf=v}return this.addRequestSKUs(f),f}handleExtraBrokerParams(e){var s;const t=e.extraParameters&&e.extraParameters.hasOwnProperty(sh)&&e.extraParameters.hasOwnProperty(md)&&e.extraParameters.hasOwnProperty(mo);if(!e.embeddedClientId&&!t)return;let n="";const i=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,n=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[md],n=e.extraParameters[mo]),e.extraParameters={child_client_id:n,child_redirect_uri:i},(s=this.performanceClient)==null||s.addFields({embeddedClientId:n,embeddedRedirectUri:i},e.correlationId)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Qn{constructor(e,t,n,i){this.logger=e,this.handshakeTimeoutMs=t,this.extensionId=i,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=n,this.handshakeEvent=n.startMeasurement(k.NativeMessageHandlerHandshake)}async sendMessage(e){this.logger.trace("NativeMessageHandler - sendMessage called.");const t={channel:ai.CHANNEL_ID,extensionId:this.extensionId,responseId:Sr(),body:e};return this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii(`NativeMessageHandler - Sending request to browser extension: ${JSON.stringify(t)}`),this.messageChannel.port1.postMessage(t),new Promise((n,i)=>{this.resolvers.set(t.responseId,{resolve:n,reject:i})})}static async createProvider(e,t,n){e.trace("NativeMessageHandler - createProvider called.");try{const i=new Qn(e,t,n,ai.PREFERRED_EXTENSION_ID);return await i.sendHandshakeRequest(),i}catch{const s=new Qn(e,t,n);return await s.sendHandshakeRequest(),s}}async sendHandshakeRequest(){this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:ai.CHANNEL_ID,extensionId:this.extensionId,responseId:Sr(),body:{method:uo.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=t=>{this.onChannelMessage(t)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((t,n)=>{this.handshakeResolvers.set(e.responseId,{resolve:t,reject:n}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),n(j(VC)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source!==window)return;const t=e.data;if(!(!t.channel||t.channel!==ai.CHANNEL_ID)&&!(t.extensionId&&t.extensionId!==this.extensionId)&&t.body.method===uo.HandshakeRequest){const n=this.handshakeResolvers.get(t.responseId);if(!n){this.logger.trace(`NativeMessageHandler.onWindowMessage - resolver can't be found for request ${t.responseId}`);return}this.logger.verbose(t.extensionId?`Extension with id: ${t.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),n.reject(j(FC))}}onChannelMessage(e){this.logger.trace("NativeMessageHandler - onChannelMessage called.");const t=e.data,n=this.resolvers.get(t.responseId),i=this.handshakeResolvers.get(t.responseId);try{const s=t.body.method;if(s===uo.Response){if(!n)return;const l=t.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii(`NativeMessageHandler - Received response from browser extension: ${JSON.stringify(l)}`),l.status!=="Success")n.reject(Ad(l.code,l.description,l.ext));else if(l.result)l.result.code&&l.result.description?n.reject(Ad(l.result.code,l.result.description,l.result.ext)):n.resolve(l.result);else throw Ty(Kd,"Event does not contain result.");this.resolvers.delete(t.responseId)}else if(s===uo.HandshakeResponse){if(!i){this.logger.trace(`NativeMessageHandler.onChannelMessage - resolver can't be found for request ${t.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=t.extensionId,this.extensionVersion=t.body.version,this.logger.verbose(`NativeMessageHandler - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),i.resolve(),this.handshakeResolvers.delete(t.responseId)}}catch(s){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${s}`),this.logger.errorPii(`Unable to parse ${e}`),n?n.reject(s):i&&i.reject(s)}}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}static isNativeAvailable(e,t,n,i){if(t.trace("isNativeAvailable called"),!e.system.allowNativeBroker)return t.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!n)return t.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(i)switch(i){case Oe.BEARER:case Oe.POP:return t.trace("isNativeAvailable: authenticationScheme is supported, returning true"),!0;default:return t.trace("isNativeAvailable: authenticationScheme is not supported, returning false"),!1}return!0}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class bh{constructor(e,t,n,i,s){this.authModule=e,this.browserStorage=t,this.authCodeRequest=n,this.logger=i,this.performanceClient=s}async handleCodeResponse(e,t){this.performanceClient.addQueueMeasurement(k.HandleCodeResponse,t.correlationId);let n;try{n=this.authModule.handleFragmentResponse(e,t.state)}catch(i){throw i instanceof Gr&&i.subError===vo?j(vo):i}return U(this.handleCodeResponseFromServer.bind(this),k.HandleCodeResponseFromServer,this.logger,this.performanceClient,t.correlationId)(n,t)}async handleCodeResponseFromServer(e,t,n=!0){if(this.performanceClient.addQueueMeasurement(k.HandleCodeResponseFromServer,t.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await U(this.authModule.updateAuthority.bind(this.authModule),k.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,t.correlationId)(e.cloud_instance_host_name,t.correlationId),n&&(e.nonce=t.nonce||void 0),e.state=t.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const s=this.createCcsCredentials(t);s&&(this.authCodeRequest.ccsCredential=s)}return await U(this.authModule.acquireToken.bind(this.authModule),k.AuthClientAcquireToken,this.logger,this.performanceClient,t.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:on.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:on.UPN}:null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function iw(r,e,t){const n=dc(r);if(!n)throw oC(r)?(t.error(`A ${e} is present in the iframe but it does not contain known properties. It's likely that the ${e} has been replaced by code running on the redirectUri page.`),t.errorPii(`The ${e} detected is: ${r}`),j(CC)):(t.error(`The request has returned to the redirectUri but a ${e} is not present. It's likely that the ${e} has been removed or the page has been redirected by code running on the redirectUri page.`),j(yC));return n}function FD(r,e,t){if(!r.state)throw j(gh);const n=tw(e,r.state);if(!n)throw j(wC);if(n.interactionType!==t)throw j(_C)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class HD extends yi{constructor(e,t,n,i,s,l,d,f,g,m){super(e,t,n,i,s,l,d,g,m),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=f}acquireToken(e){try{const n={popupName:this.generatePopupName(e.scopes||vi,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window};return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,n)):(this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),n.popup=this.openSizedPopup("about:blank",n),this.acquireTokenPopupAsync(e,n))}catch(t){return Promise.reject(t)}}logout(e){try{this.logger.verbose("logoutPopup called");const t=this.initializeLogoutRequest(e),n={popupName:this.generateLogoutPopupName(t),popupWindowAttributes:(e==null?void 0:e.popupWindowAttributes)||{},popupWindowParent:(e==null?void 0:e.popupWindowParent)??window},i=e&&e.authority,s=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(t,n,i,s)):(this.logger.verbose("asyncPopup set to false, opening popup"),n.popup=this.openSizedPopup("about:blank",n),this.logoutPopupAsync(t,n,i,s))}catch(t){return Promise.reject(t)}}async acquireTokenPopupAsync(e,t){var s;this.logger.verbose("acquireTokenPopupAsync called");const n=this.initializeServerTelemetryManager(Le.acquireTokenPopup),i=await U(this.initializeAuthorizationRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,X.Popup);ew(i.authority);try{const l=await U(this.initializeAuthorizationCodeRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(i),d=await U(this.createAuthCodeClient.bind(this),k.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:i.authority,requestAzureCloudOptions:i.azureCloudOptions,requestExtraQueryParameters:i.extraQueryParameters,account:i.account}),f=Qn.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme);let g;f&&(g=this.performanceClient.startMeasurement(k.FetchAccountIdWithNativeBroker,e.correlationId));const m=await d.getAuthCodeUrl({...i,nativeBroker:f}),v=new bh(d,this.browserStorage,l,this.logger,this.performanceClient),C=this.initiateAuthRequest(m,t);this.eventHandler.emitEvent(ne.POPUP_OPENED,X.Popup,{popupWindow:C},null);const S=await this.monitorPopupForHash(C,t.popupWindowParent),T=_o(iw,k.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(S,this.config.auth.OIDCOptions.serverResponseType,this.logger);if(Yn.removeThrottle(this.browserStorage,this.config.auth.clientId,l),T.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),g&&g.end({success:!0,isNativeBroker:!0}),!this.nativeMessageHandler)throw j(Ea);const O=new li(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Le.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,T.accountId,this.nativeStorage,i.correlationId),{userRequestState:$}=Un.parseRequestState(this.browserCrypto,i.state);return await O.acquireToken({...i,state:$,prompt:void 0})}return await v.handleCodeResponse(T,i)}catch(l){throw(s=t.popup)==null||s.close(),l instanceof He&&(l.setCorrelationId(this.correlationId),n.cacheFailedRequest(l)),l}}async logoutPopupAsync(e,t,n,i){var l,d,f,g;this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(ne.LOGOUT_START,X.Popup,e);const s=this.initializeServerTelemetryManager(Le.logoutPopup);try{await this.clearCacheOnLogout(e.account);const m=await U(this.createAuthCodeClient.bind(this),k.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:s,requestAuthority:n,account:e.account||void 0});try{m.authority.endSessionEndpoint}catch{if((l=e.account)!=null&&l.homeAccountId&&e.postLogoutRedirectUri&&m.authority.protocolMode===Tr.OIDC){if(this.browserStorage.removeAccount((d=e.account)==null?void 0:d.homeAccountId),this.eventHandler.emitEvent(ne.LOGOUT_SUCCESS,X.Popup,e),i){const S={apiId:Le.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},T=ye.getAbsoluteUrl(i,Cr());await this.navigationClient.navigateInternal(T,S)}(f=t.popup)==null||f.close();return}}const v=m.getLogoutUri(e);this.eventHandler.emitEvent(ne.LOGOUT_SUCCESS,X.Popup,e);const C=this.openPopup(v,t);if(this.eventHandler.emitEvent(ne.POPUP_OPENED,X.Popup,{popupWindow:C},null),await this.monitorPopupForHash(C,t.popupWindowParent).catch(()=>{}),i){const S={apiId:Le.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},T=ye.getAbsoluteUrl(i,Cr());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${T}`),await this.navigationClient.navigateInternal(T,S)}else this.logger.verbose("No main window navigation requested")}catch(m){throw(g=t.popup)==null||g.close(),m instanceof He&&(m.setCorrelationId(this.correlationId),s.cacheFailedRequest(m)),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(ne.LOGOUT_FAILURE,X.Popup,null,m),this.eventHandler.emitEvent(ne.LOGOUT_END,X.Popup),m}this.eventHandler.emitEvent(ne.LOGOUT_END,X.Popup)}initiateAuthRequest(e,t){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,t);throw this.logger.error("Navigate url is empty"),j(Bc)}monitorPopupForHash(e,t){return new Promise((n,i)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const s=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(s),i(j(vo));return}let l="";try{l=e.location.href}catch{}if(!l||l==="about:blank")return;clearInterval(s);let d="";const f=this.config.auth.OIDCOptions.serverResponseType;e&&(f===Ta.QUERY?d=e.location.search:d=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),n(d)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,t)})}openPopup(e,t){try{let n;if(t.popup?(n=t.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),n.location.assign(e)):typeof t.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),n=this.openSizedPopup(e,t)),!n)throw j(SC);return n.focus&&n.focus(),this.currentWindow=n,t.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),n}catch(n){throw this.logger.error("error opening popup "+n.message),this.browserStorage.setInteractionInProgress(!1),j(EC)}}openSizedPopup(e,{popupName:t,popupWindowAttributes:n,popupWindowParent:i}){var S,T,I,O;const s=i.screenLeft?i.screenLeft:i.screenX,l=i.screenTop?i.screenTop:i.screenY,d=i.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,f=i.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let g=(S=n.popupSize)==null?void 0:S.width,m=(T=n.popupSize)==null?void 0:T.height,v=(I=n.popupPosition)==null?void 0:I.top,C=(O=n.popupPosition)==null?void 0:O.left;return(!g||g<0||g>d)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),g=tn.POPUP_WIDTH),(!m||m<0||m>f)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),m=tn.POPUP_HEIGHT),(!v||v<0||v>f)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),v=Math.max(0,f/2-tn.POPUP_HEIGHT/2+l)),(!C||C<0||C>d)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),C=Math.max(0,d/2-tn.POPUP_WIDTH/2+s)),i.open(e,t,`width=${g}, height=${m}, top=${v}, left=${C}, scrollbars=yes`)}unloadWindow(e){this.browserStorage.cleanRequestByInteractionType(X.Popup),this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,t){e.close(),t.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)}generatePopupName(e,t){return`${tn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${t}.${this.correlationId}`}generateLogoutPopupName(e){const t=e.account&&e.account.homeAccountId;return`${tn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${t}.${this.correlationId}`}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Tp{constructor(e,t,n,i,s){this.authModule=e,this.browserStorage=t,this.authCodeRequest=n,this.logger=i,this.performanceClient=s}async initiateAuthRequest(e,t){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){t.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache(ke.ORIGIN_URI,t.redirectStartPage,!0)),this.browserStorage.setTemporaryCache(ke.CORRELATION_ID,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest),this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const n={apiId:Le.acquireTokenRedirect,timeout:t.redirectTimeout,noHistory:!1};if(typeof t.onRedirectNavigate=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),t.onRedirectNavigate(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await t.navigationClient.navigateExternal(e,n);return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation");return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),await t.navigationClient.navigateExternal(e,n);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),j(Bc)}async handleCodeResponse(e,t){this.logger.verbose("RedirectHandler.handleCodeResponse called"),this.browserStorage.setInteractionInProgress(!1);const n=this.browserStorage.generateStateKey(t),i=this.browserStorage.getTemporaryCache(n);if(!i)throw B(sc,"Cached State");let s;try{s=this.authModule.handleFragmentResponse(e,i)}catch(g){throw g instanceof Gr&&g.subError===vo?j(vo):g}const l=this.browserStorage.generateNonceKey(i),d=this.browserStorage.getTemporaryCache(l);if(this.authCodeRequest.code=s.code,s.cloud_instance_host_name&&await U(this.authModule.updateAuthority.bind(this.authModule),k.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,this.authCodeRequest.correlationId)(s.cloud_instance_host_name,this.authCodeRequest.correlationId),s.nonce=d||void 0,s.state=i,s.client_info)this.authCodeRequest.clientInfo=s.client_info;else{const g=this.checkCcsCredentials();g&&(this.authCodeRequest.ccsCredential=g)}const f=await this.authModule.acquireToken(this.authCodeRequest,s);return this.browserStorage.cleanRequestByState(t),f}checkCcsCredentials(){const e=this.browserStorage.getTemporaryCache(ke.CCS_CREDENTIAL,!0);if(e)try{return JSON.parse(e)}catch{this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii(`Cache credential could not be parsed: ${e}`)}return null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function $D(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const r=window.performance.getEntriesByType("navigation"),e=r.length?r[0]:void 0;return e==null?void 0:e.type}class KD extends yi{constructor(e,t,n,i,s,l,d,f,g,m){super(e,t,n,i,s,l,d,g,m),this.nativeStorage=f}async acquireToken(e){const t=await U(this.initializeAuthorizationRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,X.Redirect);this.browserStorage.updateCacheEntries(t.state,t.nonce,t.authority,t.loginHint||"",t.account||null);const n=this.initializeServerTelemetryManager(Le.acquireTokenRedirect),i=s=>{s.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.cleanRequestByState(t.state),this.eventHandler.emitEvent(ne.RESTORE_FROM_BFCACHE,X.Redirect))};try{const s=await U(this.initializeAuthorizationCodeRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(t),l=await U(this.createAuthCodeClient.bind(this),k.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),d=new Tp(l,this.browserStorage,s,this.logger,this.performanceClient),f=await l.getAuthCodeUrl({...t,nativeBroker:Qn.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme)}),g=this.getRedirectStartPage(e.redirectStartPage);return this.logger.verbosePii(`Redirect start page: ${g}`),window.addEventListener("pageshow",i),await d.initiateAuthRequest(f,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:g,onRedirectNavigate:e.onRedirectNavigate||this.config.auth.onRedirectNavigate})}catch(s){throw s instanceof He&&(s.setCorrelationId(this.correlationId),n.cacheFailedRequest(s)),window.removeEventListener("pageshow",i),this.browserStorage.cleanRequestByState(t.state),s}}async handleRedirectPromise(e="",t){const n=this.initializeServerTelemetryManager(Le.handleRedirectPromise);try{if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const[i,s]=this.getRedirectResponse(e||"");if(!i)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(X.Redirect),$D()!=="back_forward"?t.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const l=this.browserStorage.getTemporaryCache(ke.ORIGIN_URI,!0)||P.EMPTY_STRING,d=ye.removeHashFromUrl(l),f=ye.removeHashFromUrl(window.location.href);if(d===f&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),l.indexOf("#")>-1&&Jx(l),await this.handleResponse(i,n);if(this.config.auth.navigateToLoginRequestUrl){if(!Th()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(ke.URL_HASH,s,!0);const g={apiId:Le.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let m=!0;if(!l||l==="null"){const v=Xx();this.browserStorage.setTemporaryCache(ke.ORIGIN_URI,v,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),m=await this.navigationClient.navigateInternal(v,g)}else this.logger.verbose(`Navigating to loginRequestUrl: ${l}`),m=await this.navigationClient.navigateInternal(l,g);if(!m)return await this.handleResponse(i,n)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(i,n);return null}catch(i){throw i instanceof He&&(i.setCorrelationId(this.correlationId),n.cacheFailedRequest(i)),this.browserStorage.cleanRequestByInteractionType(X.Redirect),i}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let t=e;t||(this.config.auth.OIDCOptions.serverResponseType===Ta.QUERY?t=window.location.search:t=window.location.hash);let n=dc(t);if(n){try{FD(n,this.browserCrypto,X.Redirect)}catch(s){return s instanceof He&&this.logger.error(`Interaction type validation failed due to ${s.errorCode}: ${s.errorMessage}`),[null,""]}return Yx(window),this.logger.verbose("Hash contains known properties, returning response hash"),[n,t]}const i=this.browserStorage.getTemporaryCache(ke.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(ke.URL_HASH)),i&&(n=dc(i),n)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[n,i]):[null,""]}async handleResponse(e,t){const n=e.state;if(!n)throw j(gh);const i=this.browserStorage.getCachedRequest(n);if(this.logger.verbose("handleResponse called, retrieved cached request"),e.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw j(Ea);const f=new li(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Le.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,e.accountId,this.nativeStorage,i.correlationId),{userRequestState:g}=Un.parseRequestState(this.browserCrypto,n);return f.acquireToken({...i,state:g,prompt:void 0}).finally(()=>{this.browserStorage.cleanRequestByState(n)})}const s=this.browserStorage.getCachedAuthority(n);if(!s)throw j(mh);const l=await U(this.createAuthCodeClient.bind(this),k.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:s});return Yn.removeThrottle(this.browserStorage,this.config.auth.clientId,i),new Tp(l,this.browserStorage,i,this.logger,this.performanceClient).handleCodeResponse(e,n)}async logout(e){var i,s;this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e),n=this.initializeServerTelemetryManager(Le.logout);try{this.eventHandler.emitEvent(ne.LOGOUT_START,X.Redirect,e),await this.clearCacheOnLogout(t.account);const l={apiId:Le.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=await U(this.createAuthCodeClient.bind(this),k.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:e&&e.authority,requestExtraQueryParameters:e==null?void 0:e.extraQueryParameters,account:e&&e.account||void 0});if(d.authority.protocolMode===Tr.OIDC)try{d.authority.endSessionEndpoint}catch{if((i=t.account)!=null&&i.homeAccountId){this.browserStorage.removeAccount((s=t.account)==null?void 0:s.homeAccountId),this.eventHandler.emitEvent(ne.LOGOUT_SUCCESS,X.Redirect,t);return}}const f=d.getLogoutUri(t);if(this.eventHandler.emitEvent(ne.LOGOUT_SUCCESS,X.Redirect,t),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(f)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(f,l);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(f,l);return}}catch(l){throw l instanceof He&&(l.setCorrelationId(this.correlationId),n.cacheFailedRequest(l)),this.eventHandler.emitEvent(ne.LOGOUT_FAILURE,X.Redirect,null,l),this.eventHandler.emitEvent(ne.LOGOUT_END,X.Redirect),l}this.eventHandler.emitEvent(ne.LOGOUT_END,X.Redirect)}getRedirectStartPage(e){const t=e||window.location.href;return ye.getAbsoluteUrl(t,Cr())}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function zD(r,e,t,n,i){if(e.addQueueMeasurement(k.SilentHandlerInitiateAuthRequest,n),!r)throw t.info("Navigate url is empty"),j(Bc);return i?U(qD,k.SilentHandlerLoadFrame,t,e,n)(r,i,e,n):_o(GD,k.SilentHandlerLoadFrameSync,t,e,n)(r)}async function WD(r,e,t,n,i,s,l){return n.addQueueMeasurement(k.SilentHandlerMonitorIframeForHash,s),new Promise((d,f)=>{e<Td&&i.warning(`system.loadFrameTimeout or system.iframeHashTimeout set to lower (${e}ms) than the default (${Td}ms). This may result in timeouts.`);const g=window.setTimeout(()=>{window.clearInterval(m),f(j(AC))},e),m=window.setInterval(()=>{let v="";const C=r.contentWindow;try{v=C?C.location.href:""}catch{}if(!v||v==="about:blank")return;let S="";C&&(l===Ta.QUERY?S=C.location.search:S=C.location.hash),window.clearTimeout(g),window.clearInterval(m),d(S)},t)}).finally(()=>{_o(jD,k.RemoveHiddenIframe,i,n,s)(r)})}function qD(r,e,t,n){return t.addQueueMeasurement(k.SilentHandlerLoadFrame,n),new Promise((i,s)=>{const l=aw();window.setTimeout(()=>{if(!l){s("Unable to load iframe");return}l.src=r,i(l)},e)})}function GD(r){const e=aw();return e.src=r,e}function aw(){const r=document.createElement("iframe");return r.className="msalSilentIframe",r.style.visibility="hidden",r.style.position="absolute",r.style.width=r.style.height="0",r.style.border="0",r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(r),r}function jD(r){document.body===r.parentNode&&document.body.removeChild(r)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class YD extends yi{constructor(e,t,n,i,s,l,d,f,g,m,v){super(e,t,n,i,s,l,f,m,v),this.apiId=d,this.nativeStorage=g}async acquireToken(e){this.performanceClient.addQueueMeasurement(k.SilentIframeClientAcquireToken,e.correlationId),!e.loginHint&&!e.sid&&(!e.account||!e.account.username)&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const t={...e};t.prompt?t.prompt!==dt.NONE&&t.prompt!==dt.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${t.prompt} with ${dt.NONE}`),t.prompt=dt.NONE):t.prompt=dt.NONE;const n=await U(this.initializeAuthorizationRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,X.Silent);ew(n.authority);const i=this.initializeServerTelemetryManager(this.apiId);let s;try{return s=await U(this.createAuthCodeClient.bind(this),k.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:i,requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account}),await U(this.silentTokenHelper.bind(this),k.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(s,n)}catch(l){if(l instanceof He&&(l.setCorrelationId(this.correlationId),i.cacheFailedRequest(l)),!s||!(l instanceof He)||l.errorCode!==tn.INVALID_GRANT_ERROR)throw l;this.performanceClient.addFields({retryError:l.errorCode},this.correlationId);const d=await U(this.initializeAuthorizationRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,X.Silent);return await U(this.silentTokenHelper.bind(this),k.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(s,d)}}logout(){return Promise.reject(j(Uc))}async silentTokenHelper(e,t){const n=t.correlationId;this.performanceClient.addQueueMeasurement(k.SilentIframeClientTokenHelper,n);const i=await U(this.initializeAuthorizationCodeRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,n)(t),s=await U(e.getAuthCodeUrl.bind(e),k.GetAuthCodeUrl,this.logger,this.performanceClient,n)({...t,nativeBroker:Qn.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,t.authenticationScheme)}),l=new bh(e,this.browserStorage,i,this.logger,this.performanceClient),d=await U(zD,k.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,n)(s,this.performanceClient,this.logger,n,this.config.system.navigateFrameWait),f=this.config.auth.OIDCOptions.serverResponseType,g=await U(WD,k.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,n)(d,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,n,f),m=_o(iw,k.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(g,f,this.logger);if(m.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw j(Ea);const v=new li(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,m.accountId,this.browserStorage,n),{userRequestState:C}=Un.parseRequestState(this.browserCrypto,t.state);return U(v.acquireToken.bind(v),k.NativeInteractionClientAcquireToken,this.logger,this.performanceClient,n)({...t,state:C,prompt:t.prompt||dt.NONE})}return U(l.handleCodeResponse.bind(l),k.HandleCodeResponse,this.logger,this.performanceClient,n)(m,t)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class JD extends yi{async acquireToken(e){this.performanceClient.addQueueMeasurement(k.SilentRefreshClientAcquireToken,e.correlationId);const t=await U(Ah,k.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),n={...e,...t};e.redirectUri&&(n.redirectUri=this.getRedirectUri(e.redirectUri));const i=this.initializeServerTelemetryManager(Le.acquireTokenSilent_silentFlow),s=await this.createRefreshTokenClient({serverTelemetryManager:i,authorityUrl:n.authority,azureCloudOptions:n.azureCloudOptions,account:n.account});return U(s.acquireTokenByRefreshToken.bind(s),k.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(n).catch(l=>{throw l.setCorrelationId(this.correlationId),i.cacheFailedRequest(l),l})}logout(){return Promise.reject(j(Uc))}async createRefreshTokenClient(e){const t=await U(this.getClientConfiguration.bind(this),k.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new vd(t,this.performanceClient)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class QD{constructor(e,t,n,i){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=t,this.logger=n,this.cryptoObj=i}loadExternalTokens(e,t,n){if(!this.isBrowserEnvironment)throw j(Vc);const i=t.id_token?wo(t.id_token,tr):void 0,s={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},l=e.authority?new St(St.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,s,this.logger,e.correlationId||Sr()):void 0,d=this.loadAccount(e,n.clientInfo||t.client_info||"",i,l),f=this.loadIdToken(t,d.homeAccountId,d.environment,d.realm),g=this.loadAccessToken(e,t,d.homeAccountId,d.environment,d.realm,n),m=this.loadRefreshToken(t,d.homeAccountId,d.environment);return this.generateAuthenticationResult(e,{account:d,idToken:f,accessToken:g,refreshToken:m},i,l)}loadAccount(e,t,n,i){if(this.logger.verbose("TokenCache - loading account"),e.account){const f=at.createFromAccountInfo(e.account);return this.storage.setAccount(f),f}else if(!i||!t&&!n)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),j(xC);const s=at.generateHomeAccountId(t,i.authorityType,this.logger,this.cryptoObj,n),l=n==null?void 0:n.tid,d=uh(this.storage,i,s,tr,n,t,i.hostnameAndPort,l,void 0,void 0,this.logger);return this.storage.setAccount(d),d}loadIdToken(e,t,n,i){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const s=Nc(t,n,e.id_token,this.config.auth.clientId,i);return this.storage.setIdTokenCredential(s),s}loadAccessToken(e,t,n,i,s,l){if(t.access_token)if(t.expires_in){if(!t.scope&&(!e.scopes||!e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null}else return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;else return this.logger.verbose("TokenCache - no access token found in response"),null;this.logger.verbose("TokenCache - loading access token");const d=t.scope?Je.fromString(t.scope):new Je(e.scopes),f=l.expiresOn||t.expires_in+new Date().getTime()/1e3,g=l.extendedExpiresOn||(t.ext_expires_in||t.expires_in)+new Date().getTime()/1e3,m=Pc(n,i,t.access_token,this.config.auth.clientId,s,d.printScopes(),f,g,tr);return this.storage.setAccessTokenCredential(m),m}loadRefreshToken(e,t,n){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const i=$y(t,n,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return this.storage.setRefreshTokenCredential(i),i}generateAuthenticationResult(e,t,n,i){var m,v,C;let s="",l=[],d=null,f;t!=null&&t.accessToken&&(s=t.accessToken.secret,l=Je.fromString(t.accessToken.target).asArray(),d=new Date(Number(t.accessToken.expiresOn)*1e3),f=new Date(Number(t.accessToken.extendedExpiresOn)*1e3));const g=t.account;return{authority:i?i.canonicalAuthority:"",uniqueId:t.account.localAccountId,tenantId:t.account.realm,scopes:l,account:g.getAccountInfo(),idToken:((m=t.idToken)==null?void 0:m.secret)||"",idTokenClaims:n||{},accessToken:s,fromCache:!0,expiresOn:d,correlationId:e.correlationId||"",requestId:"",extExpiresOn:f,familyId:((v=t.refreshToken)==null?void 0:v.familyId)||"",tokenType:((C=t==null?void 0:t.accessToken)==null?void 0:C.tokenType)||"",state:e.state||"",cloudGraphHostName:g.cloudGraphHostName||"",msGraphHost:g.msGraphHost||"",fromNativeBroker:!1}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class XD extends gC{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class ZD extends yi{constructor(e,t,n,i,s,l,d,f,g,m){super(e,t,n,i,s,l,f,g,m),this.apiId=d}async acquireToken(e){if(!e.code)throw j(DC);const t=await U(this.initializeAuthorizationRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,X.Silent),n=this.initializeServerTelemetryManager(this.apiId);try{const i={...t,code:e.code},s=await U(this.getClientConfiguration.bind(this),k.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:n,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),l=new XD(s);this.logger.verbose("Auth code client created");const d=new bh(l,this.browserStorage,i,this.logger,this.performanceClient);return await U(d.handleCodeResponseFromServer.bind(d),k.HandleCodeResponseFromServer,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},t,!1)}catch(i){throw i instanceof He&&(i.setCorrelationId(this.correlationId),n.cacheFailedRequest(i)),i}}logout(){return Promise.reject(j(Uc))}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function qn(r){const e=r==null?void 0:r.idTokenClaims;if(e!=null&&e.tfp||e!=null&&e.acr)return"B2C";if(e!=null&&e.tid){if((e==null?void 0:e.tid)==="9188040d-6c67-4c5b-b112-36a304b66dad")return"MSA"}else return;return"AAD"}function Ns(r,e){try{Eh(r)}catch(t){throw e.end({success:!1},t),t}}class $c{constructor(e){this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new mi(this.logger,this.performanceClient):cc,this.eventHandler=new AD(this.logger),this.browserStorage=this.isBrowserEnvironment?new Sd(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,fx(this.config.auth),this.performanceClient):vD(this.config.auth.clientId,this.logger);const t={cacheLocation:Ht.MemoryStorage,temporaryCacheLocation:Ht.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new Sd(this.config.auth.clientId,t,this.browserCrypto,this.logger,void 0,this.performanceClient),this.tokenCache=new QD(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this),this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}static async createController(e,t){const n=new $c(e);return await n.initialize(t),n}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e){if(this.logger.trace("initialize called"),this.initialized){this.logger.info("initialize has already been called, exiting early.");return}if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,this.eventHandler.emitEvent(ne.INITIALIZE_END);return}const t=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),n=this.config.system.allowNativeBroker,i=this.performanceClient.startMeasurement(k.InitializeClientApplication,t);if(this.eventHandler.emitEvent(ne.INITIALIZE_START),n)try{this.nativeExtensionProvider=await Qn.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout,this.performanceClient)}catch(s){this.logger.verbose(s)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),await U(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),k.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,t)(this.performanceClient,t)),this.initialized=!0,this.eventHandler.emitEvent(ne.INITIALIZE_END),i.end({allowNativeBroker:n,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),ZC(this.initialized),this.isBrowserEnvironment){const t=e||"";let n=this.redirectResponse.get(t);return typeof n>"u"?(n=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(t,n),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),n}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){const t=this.getAllAccounts(),n=this.browserStorage.getCachedNativeRequest(),i=n&&Qn.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!e,s=i?n==null?void 0:n.correlationId:this.browserStorage.getTemporaryCache(ke.CORRELATION_ID,!0)||"",l=this.performanceClient.startMeasurement(k.AcquireTokenRedirect,s);this.eventHandler.emitEvent(ne.HANDLE_REDIRECT_START,X.Redirect);let d;if(i&&this.nativeExtensionProvider){this.logger.trace("handleRedirectPromise - acquiring token from native platform");const f=new li(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Le.handleRedirectPromise,this.performanceClient,this.nativeExtensionProvider,n.accountId,this.nativeInternalStorage,n.correlationId);d=U(f.handleRedirectPromise.bind(f),k.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,l.event.correlationId)(this.performanceClient,l.event.correlationId)}else{this.logger.trace("handleRedirectPromise - acquiring token from web flow");const f=this.createRedirectClient(s);d=U(f.handleRedirectPromise.bind(f),k.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,l.event.correlationId)(e,l)}return d.then(f=>(f?(t.length<this.getAllAccounts().length?(this.eventHandler.emitEvent(ne.LOGIN_SUCCESS,X.Redirect,f),this.logger.verbose("handleRedirectResponse returned result, login success")):(this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_SUCCESS,X.Redirect,f),this.logger.verbose("handleRedirectResponse returned result, acquire token success")),l.end({success:!0,accountType:qn(f.account)})):l.event.errorCode?l.end({success:!1}):l.discard(),this.eventHandler.emitEvent(ne.HANDLE_REDIRECT_END,X.Redirect),f)).catch(f=>{const g=f;throw t.length>0?this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_FAILURE,X.Redirect,null,g):this.eventHandler.emitEvent(ne.LOGIN_FAILURE,X.Redirect,null,g),this.eventHandler.emitEvent(ne.HANDLE_REDIRECT_END,X.Redirect),l.end({success:!1},g),f})}async acquireTokenRedirect(e){const t=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",t);const n=this.performanceClient.startMeasurement(k.AcquireTokenPreRedirect,t);n.add({accountType:qn(e.account),scenarioId:e.scenarioId});const i=e.onRedirectNavigate;if(i)e.onRedirectNavigate=l=>{const d=typeof i=="function"?i(l):void 0;return d!==!1?n.end({success:!0}):n.discard(),d};else{const l=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=d=>{const f=typeof l=="function"?l(d):void 0;return f!==!1?n.end({success:!0}):n.discard(),f}}const s=this.getAllAccounts().length>0;try{yp(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),s?this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_START,X.Redirect,e):this.eventHandler.emitEvent(ne.LOGIN_START,X.Redirect,e);let l;return this.nativeExtensionProvider&&this.canUseNative(e)?l=new li(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Le.acquireTokenRedirect,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(e),this.nativeInternalStorage,t).acquireTokenRedirect(e,n).catch(f=>{if(f instanceof Jn&&Zo(f))return this.nativeExtensionProvider=void 0,this.createRedirectClient(t).acquireToken(e);if(f instanceof Vn)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),f}):l=this.createRedirectClient(t).acquireToken(e),await l}catch(l){throw n.end({success:!1},l),s?this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_FAILURE,X.Redirect,null,l):this.eventHandler.emitEvent(ne.LOGIN_FAILURE,X.Redirect,null,l),l}}acquireTokenPopup(e){const t=this.getRequestCorrelationId(e),n=this.performanceClient.startMeasurement(k.AcquireTokenPopup,t);n.add({scenarioId:e.scenarioId,accountType:qn(e.account)});try{this.logger.verbose("acquireTokenPopup called",t),Ns(this.initialized,n),this.browserStorage.setInteractionInProgress(!0)}catch(l){return Promise.reject(l)}const i=this.getAllAccounts();i.length>0?this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_START,X.Popup,e):this.eventHandler.emitEvent(ne.LOGIN_START,X.Popup,e);let s;return this.canUseNative(e)?s=this.acquireTokenNative({...e,correlationId:t},Le.acquireTokenPopup).then(l=>(this.browserStorage.setInteractionInProgress(!1),n.end({success:!0,isNativeBroker:!0,accountType:qn(l.account)}),l)).catch(l=>{if(l instanceof Jn&&Zo(l))return this.nativeExtensionProvider=void 0,this.createPopupClient(t).acquireToken(e);if(l instanceof Vn)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),l}):s=this.createPopupClient(t).acquireToken(e),s.then(l=>(i.length<this.getAllAccounts().length?this.eventHandler.emitEvent(ne.LOGIN_SUCCESS,X.Popup,l):this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_SUCCESS,X.Popup,l),n.end({success:!0,accessTokenSize:l.accessToken.length,idTokenSize:l.idToken.length,accountType:qn(l.account)}),l)).catch(l=>(i.length>0?this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_FAILURE,X.Popup,null,l):this.eventHandler.emitEvent(ne.LOGIN_FAILURE,X.Popup,null,l),n.end({success:!1},l),Promise.reject(l)))}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){var s,l;const t=this.getRequestCorrelationId(e),n={...e,prompt:e.prompt,correlationId:t};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(k.SsoSilent,t),(s=this.ssoSilentMeasurement)==null||s.add({scenarioId:e.scenarioId,accountType:qn(e.account)}),Ns(this.initialized,this.ssoSilentMeasurement),(l=this.ssoSilentMeasurement)==null||l.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",t),this.eventHandler.emitEvent(ne.SSO_SILENT_START,X.Silent,n);let i;return this.canUseNative(n)?i=this.acquireTokenNative(n,Le.ssoSilent).catch(d=>{if(d instanceof Jn&&Zo(d))return this.nativeExtensionProvider=void 0,this.createSilentIframeClient(n.correlationId).acquireToken(n);throw d}):i=this.createSilentIframeClient(n.correlationId).acquireToken(n),i.then(d=>{var f;return this.eventHandler.emitEvent(ne.SSO_SILENT_SUCCESS,X.Silent,d),(f=this.ssoSilentMeasurement)==null||f.end({success:!0,isNativeBroker:d.fromNativeBroker,accessTokenSize:d.accessToken.length,idTokenSize:d.idToken.length,accountType:qn(d.account)}),d}).catch(d=>{var f;throw this.eventHandler.emitEvent(ne.SSO_SILENT_FAILURE,X.Silent,null,d),(f=this.ssoSilentMeasurement)==null||f.end({success:!1},d),d}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const t=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",t);const n=this.performanceClient.startMeasurement(k.AcquireTokenByCode,t);Ns(this.initialized,n),this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_BY_CODE_START,X.Silent,e),n.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw j(BC);if(e.code){const i=e.code;let s=this.hybridAuthCodeResponses.get(i);return s?(this.logger.verbose("Existing acquireTokenByCode request found",t),n.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",t),s=this.acquireTokenByCodeAsync({...e,correlationId:t}).then(l=>(this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_BY_CODE_SUCCESS,X.Silent,l),this.hybridAuthCodeResponses.delete(i),n.end({success:!0,isNativeBroker:l.fromNativeBroker,accessTokenSize:l.accessToken.length,idTokenSize:l.idToken.length,accountType:qn(l.account)}),l)).catch(l=>{throw this.hybridAuthCodeResponses.delete(i),this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_BY_CODE_FAILURE,X.Silent,null,l),n.end({success:!1},l),l}),this.hybridAuthCodeResponses.set(i,s)),await s}else if(e.nativeAccountId)if(this.canUseNative(e,e.nativeAccountId)){const i=await this.acquireTokenNative({...e,correlationId:t},Le.acquireTokenByCode,e.nativeAccountId).catch(s=>{throw s instanceof Jn&&Zo(s)&&(this.nativeExtensionProvider=void 0),s});return n.end({accountType:qn(i.account),success:!0}),i}else throw j(UC);else throw j(LC)}catch(i){throw this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_BY_CODE_FAILURE,X.Silent,null,i),n.end({success:!1},i),i}}async acquireTokenByCodeAsync(e){var i;return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(k.AcquireTokenByCodeAsync,e.correlationId),(i=this.acquireTokenByCodeAsyncMeasurement)==null||i.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(s=>{var l;return(l=this.acquireTokenByCodeAsyncMeasurement)==null||l.end({success:!0,fromCache:s.fromCache,isNativeBroker:s.fromNativeBroker}),s}).catch(s=>{var l;throw(l=this.acquireTokenByCodeAsyncMeasurement)==null||l.end({success:!1},s),s}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,t){switch(this.performanceClient.addQueueMeasurement(k.AcquireTokenFromCache,e.correlationId),t){case Zt.Default:case Zt.AccessToken:case Zt.AccessTokenAndRefreshToken:const n=this.createSilentCacheClient(e.correlationId);return U(n.acquireToken.bind(n),k.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw B(yr)}}async acquireTokenByRefreshToken(e,t){switch(this.performanceClient.addQueueMeasurement(k.AcquireTokenByRefreshToken,e.correlationId),t){case Zt.Default:case Zt.AccessTokenAndRefreshToken:case Zt.RefreshToken:case Zt.RefreshTokenAndNetwork:const n=this.createSilentRefreshClient(e.correlationId);return U(n.acquireToken.bind(n),k.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw B(yr)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(k.AcquireTokenBySilentIframe,e.correlationId);const t=this.createSilentIframeClient(e.correlationId);return U(t.acquireToken.bind(t),k.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const t=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",t),this.logoutRedirect({correlationId:t,...e})}async logoutRedirect(e){const t=this.getRequestCorrelationId(e);return yp(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),this.createRedirectClient(t).logout(e)}logoutPopup(e){try{const t=this.getRequestCorrelationId(e);return Eh(this.initialized),this.browserStorage.setInteractionInProgress(!0),this.createPopupClient(t).logout(e)}catch(t){return Promise.reject(t)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const t=this.getRequestCorrelationId(e);return this.createSilentCacheClient(t).logout(e)}getAllAccounts(e){return yD(this.logger,this.browserStorage,this.isBrowserEnvironment,e)}getAccount(e){return CD(e,this.logger,this.browserStorage)}getAccountByUsername(e){return wD(e,this.logger,this.browserStorage)}getAccountByHomeId(e){return _D(e,this.logger,this.browserStorage)}getAccountByLocalId(e){return TD(e,this.logger,this.browserStorage)}setActiveAccount(e){ED(e,this.browserStorage)}getActiveAccount(){return SD(this.browserStorage)}async hydrateCache(e,t){this.logger.verbose("hydrateCache called");const n=at.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return this.browserStorage.setAccount(n),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,t)):this.browserStorage.hydrateCache(e,t)}async acquireTokenNative(e,t,n){if(this.logger.trace("acquireTokenNative called"),!this.nativeExtensionProvider)throw j(Ea);return new li(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,t,this.performanceClient,this.nativeExtensionProvider,n||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e)}canUseNative(e,t){if(this.logger.trace("canUseNative called"),!Qn.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme))return this.logger.trace("canUseNative: isNativeAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case dt.NONE:case dt.CONSENT:case dt.LOGIN:this.logger.trace("canUseNative: prompt is compatible with native flow");break;default:return this.logger.trace(`canUseNative: prompt = ${e.prompt} is not compatible with native flow, returning false`),!1}return!t&&!this.getNativeAccountId(e)?(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const t=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return t&&t.nativeAccountId||""}createPopupClient(e){return new HD(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createRedirectClient(e){return new KD(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentIframeClient(e){return new YD(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Le.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentCacheClient(e){return new ow(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentRefreshClient(e){return new JD(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentAuthCodeClient(e){return new ZD(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Le.acquireTokenByCode,this.performanceClient,this.nativeExtensionProvider,e)}addEventCallback(e,t){return this.eventHandler.addEventCallback(e,t)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return XC(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?this.logger.verbose("Account storage listener already registered."):(this.logger.verbose("Adding account storage listener."),this.listeningToStorageEvents=!0,window.addEventListener("storage",this.handleAccountCacheChange)))}disableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?(this.logger.verbose("Removing account storage listener."),window.removeEventListener("storage",this.handleAccountCacheChange),this.listeningToStorageEvents=!1):this.logger.verbose("No account storage listener registered."))}handleAccountCacheChange(e){var t;try{(t=e.key)!=null&&t.includes(ct.ACTIVE_ACCOUNT_FILTERS)&&this.eventHandler.emitEvent(ne.ACTIVE_ACCOUNT_CHANGED);const n=e.newValue||e.oldValue;if(!n)return;const i=JSON.parse(n);if(typeof i!="object"||!at.isAccountEntity(i))return;const l=fi.toObject(new at,i).getAccountInfo();!e.oldValue&&e.newValue?(this.logger.info("Account was added to cache in a different window"),this.eventHandler.emitEvent(ne.ACCOUNT_ADDED,void 0,l)):!e.newValue&&e.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.eventHandler.emitEvent(ne.ACCOUNT_REMOVED,void 0,l))}catch{return}}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,t){this.browserStorage.setWrapperMetadata(e,t)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?Sr():P.EMPTY_STRING}async loginRedirect(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",t),this.acquireTokenRedirect({correlationId:t,...e||mp})}loginPopup(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",t),this.acquireTokenPopup({correlationId:t,...e||mp})}async acquireTokenSilent(e){const t=this.getRequestCorrelationId(e),n=this.performanceClient.startMeasurement(k.AcquireTokenSilent,t);n.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),Ns(this.initialized,n),this.logger.verbose("acquireTokenSilent called",t);const i=e.account||this.getActiveAccount();if(!i)throw j(RC);n.add({accountType:qn(i)});const s={clientId:this.config.auth.clientId,authority:e.authority||P.EMPTY_STRING,scopes:e.scopes,homeAccountIdentifier:i.homeAccountId,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,shrOptions:e.shrOptions},l=JSON.stringify(s),d=this.activeSilentTokenRequests.get(l);if(typeof d>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",t);const f=U(this.acquireTokenSilentAsync.bind(this),k.AcquireTokenSilentAsync,this.logger,this.performanceClient,t)({...e,correlationId:t},i).then(g=>(this.activeSilentTokenRequests.delete(l),n.end({success:!0,fromCache:g.fromCache,isNativeBroker:g.fromNativeBroker,cacheLookupPolicy:e.cacheLookupPolicy,accessTokenSize:g.accessToken.length,idTokenSize:g.idToken.length}),g)).catch(g=>{throw this.activeSilentTokenRequests.delete(l),n.end({success:!1},g),g});return this.activeSilentTokenRequests.set(l,f),{...await f,state:e.state}}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",t),n.discard(),{...await d,state:e.state}}async acquireTokenSilentAsync(e,t){const n=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(k.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_START,X.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",n);const i=await U(OD,k.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,t,this.config,this.performanceClient,this.logger),s=e.cacheLookupPolicy||Zt.Default;return this.acquireTokenSilentNoIframe(i,s).catch(async d=>{if(eL(d,s))if(this.activeIframeRequest)if(s!==Zt.Skip){const[g,m]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${m}`,i.correlationId);const v=this.performanceClient.startMeasurement(k.AwaitConcurrentIframe,i.correlationId);v.add({awaitIframeCorrelationId:m});const C=await g;if(v.end({success:C}),C)return this.logger.verbose(`Parallel iframe request with correlationId: ${m} succeeded. Retrying cache and/or RT redemption`,i.correlationId),this.acquireTokenSilentNoIframe(i,s);throw this.logger.info(`Iframe request with correlationId: ${m} failed. Interaction is required.`),d}else return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",i.correlationId),U(this.acquireTokenBySilentIframe.bind(this),k.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i);else{let g;return this.activeIframeRequest=[new Promise(m=>{g=m}),i.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",i.correlationId),U(this.acquireTokenBySilentIframe.bind(this),k.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i).then(m=>(g(!0),m)).catch(m=>{throw g(!1),m}).finally(()=>{this.activeIframeRequest=void 0})}else throw d}).then(d=>(this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_SUCCESS,X.Silent,d),e.correlationId&&this.performanceClient.addFields({fromCache:d.fromCache,isNativeBroker:d.fromNativeBroker},e.correlationId),d)).catch(d=>{throw this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_FAILURE,X.Silent,null,d),d}).finally(()=>{document.removeEventListener("visibilitychange",n)})}async acquireTokenSilentNoIframe(e,t){return Qn.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,Le.acquireTokenSilent_silentFlow).catch(async n=>{throw n instanceof Jn&&Zo(n)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0,B(yr)):n})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),U(this.acquireTokenFromCache.bind(this),k.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,t).catch(n=>{if(t===Zt.AccessToken)throw n;return this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_NETWORK_START,X.Silent,e),U(this.acquireTokenByRefreshToken.bind(this),k.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,t)}))}}function eL(r,e){const t=!(r instanceof Vn&&r.subError!==Lc),n=r.errorCode===tn.INVALID_GRANT_ERROR||r.errorCode===yr,i=t&&n||r.errorCode===fc||r.errorCode===lh,s=Bx.includes(e);return i&&s}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function tL(r,e){const t=new yo(r);return await t.initialize(),$c.createController(t,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ih{static async createPublicClientApplication(e){const t=await tL(e);return new Ih(e,t)}constructor(e,t){this.controller=t||new $c(new yo(e))}async initialize(e){return this.controller.initialize(e)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,t){return this.controller.addEventCallback(e,t)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,t){return this.controller.initializeWrapperLibrary(e,t)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,t){return this.controller.hydrateCache(e,t)}clearCache(e){return this.controller.clearCache(e)}}const Vu=process.env.JPLAN_WEBAPP__APP_PROXY_TENANT_NAME??"",nL=process.env.JPLAN_WEBAPP__APP_PROXY_CLIENT_ID??"",rL=process.env.JPLAN_WEBAPP__APP_PROXY_USER_FLOW??"",oL=process.env.JPLAN_WEBAPP__URL_AUTH??process.env.JPLAN_WEBAPP__URL_BASE??"",iL={auth:{clientId:nL,authority:`https://${Vu}.b2clogin.com/${Vu}.onmicrosoft.com/${rL}`,knownAuthorities:[`${Vu}.b2clogin.com`],redirectUri:oL},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(r,e)=>{r===xe.Error&&console.error(e)},logLevel:xe.Warning}}},Et=new Ih(iL),Ep=c.ref(null);function sw(){async function r(e){var t;if(e)try{const n=e.idTokenClaims;if(!(n!=null&&n.aud))throw new Error("User audience (aud) is missing in ID token claims");const i=localStorage.getItem(`msal.token.keys.${n.aud}`);if(!i)throw new Error(`Token keys para ${n.aud} não encontrados no localStorage`);const s=JSON.parse(i),l=(t=s==null?void 0:s.idToken)==null?void 0:t[0];if(!l)throw new Error("idToken não encontrado nos token keys");const d=localStorage.getItem(l);if(!d)throw new Error(`Dados do token para ID ${l} não encontrados no localStorage`);const f=JSON.parse(d),g=f==null?void 0:f.secret;if(!g)throw new Error("Secret não encontrado nos dados do token");sessionStorage.setItem("isAuthenticated","true"),Ep.value=g}catch(n){console.error("Erro ao obter token de acesso:",n)}}return{jToken:Ep,setJToken:r}}const aL=()=>process.env.JPLAN_WEBAPP__URL_AUTH||"http://localhost:5173/_/dashboard",pr=c.ref(null),Ps=c.ref(null);function cw(){const{setJToken:r}=sw(),e=c.computed(()=>!!pr.value),t=c.computed(()=>pr.value);async function n(g){if(!e.value)switch(g){case"redirect":await s();break;case"tab":await i();break;default:await s();break}}const i=async()=>new Promise((g,m)=>{try{localStorage.clear();const v=window.open(aL());if(!v){console.error("Failed to open authentication window"),m("Failed to open authentication window");return}const C=Date.now(),S=6e4,T=setInterval(()=>{if(Date.now()-C>S||v.closed){clearInterval(T),console.error("Authentication canceled or timeout reached."),m("Authentication canceled or timeout reached.");return}Object.keys(localStorage).some(O=>O.startsWith("msal.account.keys"))&&(clearInterval(T),l(),v.close(),g())},500)}catch(v){console.error("Error in handleRedirect:",v),m(v)}}),s=async()=>{try{await Et.initialize();const g=Et.getActiveAccount();if(console.log("activeAccount",g),g){pr.value=g;return}if(!await Et.handleRedirectPromise()||Et.getAllAccounts().length===0){await Et.initialize();const v=sL();await Et.loginRedirect(v);return}}catch(g){console.error("handleRedirect failed",g)}},l=async()=>{try{await Et.initialize();const g=Et.getActiveAccount();if(g)pr.value=g;else{const m=await Et.handleRedirectPromise();m?(Et.setActiveAccount(m.account),pr.value=Et.getActiveAccount()):console.error("Falha na autenticação")}}catch(g){console.error("Erro no processo de autenticação:",g)}pr.value&&await r(pr.value)};async function d(){Ps.value="updating";try{const g=await Et.acquireTokenSilent({scopes:["https://graph.microsoft.com/.default","openid","profile"]});Et.setActiveAccount(g.account),await r(pr.value),Ps.value="updated"}catch(g){console.error("Falha ao renovar token, forçando novo login.",g),Ps.value="error",await n()}}const f=async()=>{try{await Et.initialize(),localStorage.clear(),await Et.logoutRedirect({postLogoutRedirectUri:"/"})}catch(g){console.error("Logout error",g)}};return c.watch(pr,async(g,m)=>{var C,S,T;if(((C=g==null?void 0:g.idTokenClaims)==null?void 0:C.exp)===((S=m==null?void 0:m.idTokenClaims)==null?void 0:S.exp))return;const v=(T=g==null?void 0:g.idTokenClaims)==null?void 0:T.exp;if(v){const I=Math.floor(Date.now()/1e3),$=(v-I-120)*1e3;$>0&&setTimeout(async()=>{await d()},$)}},{immediate:!0}),{isAuthenticated:e,authState:Ps,account:t,refreshToken:d,handleRedirect:n,logout:f}}const sL=r=>({scopes:["https://graph.microsoft.com/.default","openid","profile"],redirectStartPage:window.location.href,extraQueryParameters:r});function lw(r,e){return function(){return r.apply(e,arguments)}}const{toString:cL}=Object.prototype,{getPrototypeOf:kh}=Object,Kc=(r=>e=>{const t=cL.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),$n=r=>(r=r.toLowerCase(),e=>Kc(e)===r),zc=r=>e=>typeof e===r,{isArray:Ci}=Array,pa=zc("undefined");function lL(r){return r!==null&&!pa(r)&&r.constructor!==null&&!pa(r.constructor)&&an(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const uw=$n("ArrayBuffer");function uL(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&uw(r.buffer),e}const dL=zc("string"),an=zc("function"),dw=zc("number"),Wc=r=>r!==null&&typeof r=="object",hL=r=>r===!0||r===!1,js=r=>{if(Kc(r)!=="object")return!1;const e=kh(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},fL=$n("Date"),gL=$n("File"),mL=$n("Blob"),pL=$n("FileList"),vL=r=>Wc(r)&&an(r.pipe),yL=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||an(r.append)&&((e=Kc(r))==="formdata"||e==="object"&&an(r.toString)&&r.toString()==="[object FormData]"))},CL=$n("URLSearchParams"),[wL,_L,TL,EL]=["ReadableStream","Request","Response","Headers"].map($n),SL=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Aa(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,i;if(typeof r!="object"&&(r=[r]),Ci(r))for(n=0,i=r.length;n<i;n++)e.call(null,r[n],n,r);else{const s=t?Object.getOwnPropertyNames(r):Object.keys(r),l=s.length;let d;for(n=0;n<l;n++)d=s[n],e.call(null,r[d],d,r)}}function hw(r,e){e=e.toLowerCase();const t=Object.keys(r);let n=t.length,i;for(;n-- >0;)if(i=t[n],e===i.toLowerCase())return i;return null}const ho=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,fw=r=>!pa(r)&&r!==ho;function bd(){const{caseless:r}=fw(this)&&this||{},e={},t=(n,i)=>{const s=r&&hw(e,i)||i;js(e[s])&&js(n)?e[s]=bd(e[s],n):js(n)?e[s]=bd({},n):Ci(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Aa(arguments[n],t);return e}const AL=(r,e,t,{allOwnKeys:n}={})=>(Aa(e,(i,s)=>{t&&an(i)?r[s]=lw(i,t):r[s]=i},{allOwnKeys:n}),r),bL=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),IL=(r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},kL=(r,e,t,n)=>{let i,s,l;const d={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),s=i.length;s-- >0;)l=i[s],(!n||n(l,r,e))&&!d[l]&&(e[l]=r[l],d[l]=!0);r=t!==!1&&kh(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},RL=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const n=r.indexOf(e,t);return n!==-1&&n===t},OL=r=>{if(!r)return null;if(Ci(r))return r;let e=r.length;if(!dw(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},NL=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&kh(Uint8Array)),PL=(r,e)=>{const n=(r&&r[Symbol.iterator]).call(r);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(r,s[0],s[1])}},ML=(r,e)=>{let t;const n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},xL=$n("HTMLFormElement"),DL=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,i){return n.toUpperCase()+i}),Sp=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),LL=$n("RegExp"),gw=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),n={};Aa(t,(i,s)=>{let l;(l=e(i,s,r))!==!1&&(n[s]=l||i)}),Object.defineProperties(r,n)},BL=r=>{gw(r,(e,t)=>{if(an(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=r[t];if(an(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},UL=(r,e)=>{const t={},n=i=>{i.forEach(s=>{t[s]=!0})};return Ci(r)?n(r):n(String(r).split(e)),t},VL=()=>{},FL=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e,Fu="abcdefghijklmnopqrstuvwxyz",Ap="0123456789",mw={DIGIT:Ap,ALPHA:Fu,ALPHA_DIGIT:Fu+Fu.toUpperCase()+Ap},HL=(r=16,e=mw.ALPHA_DIGIT)=>{let t="";const{length:n}=e;for(;r--;)t+=e[Math.random()*n|0];return t};function $L(r){return!!(r&&an(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}const KL=r=>{const e=new Array(10),t=(n,i)=>{if(Wc(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Ci(n)?[]:{};return Aa(n,(l,d)=>{const f=t(l,i+1);!pa(f)&&(s[d]=f)}),e[i]=void 0,s}}return n};return t(r,0)},zL=$n("AsyncFunction"),WL=r=>r&&(Wc(r)||an(r))&&an(r.then)&&an(r.catch),pw=((r,e)=>r?setImmediate:e?((t,n)=>(ho.addEventListener("message",({source:i,data:s})=>{i===ho&&s===t&&n.length&&n.shift()()},!1),i=>{n.push(i),ho.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",an(ho.postMessage)),qL=typeof queueMicrotask<"u"?queueMicrotask.bind(ho):typeof process<"u"&&process.nextTick||pw,N={isArray:Ci,isArrayBuffer:uw,isBuffer:lL,isFormData:yL,isArrayBufferView:uL,isString:dL,isNumber:dw,isBoolean:hL,isObject:Wc,isPlainObject:js,isReadableStream:wL,isRequest:_L,isResponse:TL,isHeaders:EL,isUndefined:pa,isDate:fL,isFile:gL,isBlob:mL,isRegExp:LL,isFunction:an,isStream:vL,isURLSearchParams:CL,isTypedArray:NL,isFileList:pL,forEach:Aa,merge:bd,extend:AL,trim:SL,stripBOM:bL,inherits:IL,toFlatObject:kL,kindOf:Kc,kindOfTest:$n,endsWith:RL,toArray:OL,forEachEntry:PL,matchAll:ML,isHTMLForm:xL,hasOwnProperty:Sp,hasOwnProp:Sp,reduceDescriptors:gw,freezeMethods:BL,toObjectSet:UL,toCamelCase:DL,noop:VL,toFiniteNumber:FL,findKey:hw,global:ho,isContextDefined:fw,ALPHABET:mw,generateString:HL,isSpecCompliantForm:$L,toJSONObject:KL,isAsyncFn:zL,isThenable:WL,setImmediate:pw,asap:qL};function ue(r,e,t,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}N.inherits(ue,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:N.toJSONObject(this.config),code:this.code,status:this.status}}});const vw=ue.prototype,yw={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{yw[r]={value:r}});Object.defineProperties(ue,yw);Object.defineProperty(vw,"isAxiosError",{value:!0});ue.from=(r,e,t,n,i,s)=>{const l=Object.create(vw);return N.toFlatObject(r,l,function(f){return f!==Error.prototype},d=>d!=="isAxiosError"),ue.call(l,r.message,e,t,n,i),l.cause=r,l.name=r.name,s&&Object.assign(l,s),l};const GL=null;function Id(r){return N.isPlainObject(r)||N.isArray(r)}function Cw(r){return N.endsWith(r,"[]")?r.slice(0,-2):r}function bp(r,e,t){return r?r.concat(e).map(function(i,s){return i=Cw(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function jL(r){return N.isArray(r)&&!r.some(Id)}const YL=N.toFlatObject(N,{},null,function(e){return/^is[A-Z]/.test(e)});function qc(r,e,t){if(!N.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=N.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(I,O){return!N.isUndefined(O[I])});const n=t.metaTokens,i=t.visitor||m,s=t.dots,l=t.indexes,f=(t.Blob||typeof Blob<"u"&&Blob)&&N.isSpecCompliantForm(e);if(!N.isFunction(i))throw new TypeError("visitor must be a function");function g(T){if(T===null)return"";if(N.isDate(T))return T.toISOString();if(!f&&N.isBlob(T))throw new ue("Blob is not supported. Use a Buffer instead.");return N.isArrayBuffer(T)||N.isTypedArray(T)?f&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function m(T,I,O){let $=T;if(T&&!O&&typeof T=="object"){if(N.endsWith(I,"{}"))I=n?I:I.slice(0,-2),T=JSON.stringify(T);else if(N.isArray(T)&&jL(T)||(N.isFileList(T)||N.endsWith(I,"[]"))&&($=N.toArray(T)))return I=Cw(I),$.forEach(function(H,z){!(N.isUndefined(H)||H===null)&&e.append(l===!0?bp([I],z,s):l===null?I:I+"[]",g(H))}),!1}return Id(T)?!0:(e.append(bp(O,I,s),g(T)),!1)}const v=[],C=Object.assign(YL,{defaultVisitor:m,convertValue:g,isVisitable:Id});function S(T,I){if(!N.isUndefined(T)){if(v.indexOf(T)!==-1)throw Error("Circular reference detected in "+I.join("."));v.push(T),N.forEach(T,function($,F){(!(N.isUndefined($)||$===null)&&i.call(e,$,N.isString(F)?F.trim():F,I,C))===!0&&S($,I?I.concat(F):[F])}),v.pop()}}if(!N.isObject(r))throw new TypeError("data must be an object");return S(r),e}function Ip(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function Rh(r,e){this._pairs=[],r&&qc(r,this,e)}const ww=Rh.prototype;ww.append=function(e,t){this._pairs.push([e,t])};ww.toString=function(e){const t=e?function(n){return e.call(this,n,Ip)}:Ip;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function JL(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function _w(r,e,t){if(!e)return r;const n=t&&t.encode||JL;N.isFunction(t)&&(t={serialize:t});const i=t&&t.serialize;let s;if(i?s=i(e,t):s=N.isURLSearchParams(e)?e.toString():new Rh(e,t).toString(n),s){const l=r.indexOf("#");l!==-1&&(r=r.slice(0,l)),r+=(r.indexOf("?")===-1?"?":"&")+s}return r}class kp{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){N.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Tw={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},QL=typeof URLSearchParams<"u"?URLSearchParams:Rh,XL=typeof FormData<"u"?FormData:null,ZL=typeof Blob<"u"?Blob:null,eB={isBrowser:!0,classes:{URLSearchParams:QL,FormData:XL,Blob:ZL},protocols:["http","https","file","blob","url","data"]},Oh=typeof window<"u"&&typeof document<"u",kd=typeof navigator=="object"&&navigator||void 0,tB=Oh&&(!kd||["ReactNative","NativeScript","NS"].indexOf(kd.product)<0),nB=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",rB=Oh&&window.location.href||"http://localhost",oB=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Oh,hasStandardBrowserEnv:tB,hasStandardBrowserWebWorkerEnv:nB,navigator:kd,origin:rB},Symbol.toStringTag,{value:"Module"})),It={...oB,...eB};function iB(r,e){return qc(r,new It.classes.URLSearchParams,Object.assign({visitor:function(t,n,i,s){return It.isNode&&N.isBuffer(t)?(this.append(n,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function aB(r){return N.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function sB(r){const e={},t=Object.keys(r);let n;const i=t.length;let s;for(n=0;n<i;n++)s=t[n],e[s]=r[s];return e}function Ew(r){function e(t,n,i,s){let l=t[s++];if(l==="__proto__")return!0;const d=Number.isFinite(+l),f=s>=t.length;return l=!l&&N.isArray(i)?i.length:l,f?(N.hasOwnProp(i,l)?i[l]=[i[l],n]:i[l]=n,!d):((!i[l]||!N.isObject(i[l]))&&(i[l]=[]),e(t,n,i[l],s)&&N.isArray(i[l])&&(i[l]=sB(i[l])),!d)}if(N.isFormData(r)&&N.isFunction(r.entries)){const t={};return N.forEachEntry(r,(n,i)=>{e(aB(n),i,t,0)}),t}return null}function cB(r,e,t){if(N.isString(r))try{return(e||JSON.parse)(r),N.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}const ba={transitional:Tw,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,s=N.isObject(e);if(s&&N.isHTMLForm(e)&&(e=new FormData(e)),N.isFormData(e))return i?JSON.stringify(Ew(e)):e;if(N.isArrayBuffer(e)||N.isBuffer(e)||N.isStream(e)||N.isFile(e)||N.isBlob(e)||N.isReadableStream(e))return e;if(N.isArrayBufferView(e))return e.buffer;if(N.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let d;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return iB(e,this.formSerializer).toString();if((d=N.isFileList(e))||n.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return qc(d?{"files[]":e}:e,f&&new f,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),cB(e)):e}],transformResponse:[function(e){const t=this.transitional||ba.transitional,n=t&&t.forcedJSONParsing,i=this.responseType==="json";if(N.isResponse(e)||N.isReadableStream(e))return e;if(e&&N.isString(e)&&(n&&!this.responseType||i)){const l=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(d){if(l)throw d.name==="SyntaxError"?ue.from(d,ue.ERR_BAD_RESPONSE,this,null,this.response):d}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:It.classes.FormData,Blob:It.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};N.forEach(["delete","get","head","post","put","patch"],r=>{ba.headers[r]={}});const lB=N.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),uB=r=>{const e={};let t,n,i;return r&&r.split(`
56
+ ${l}`);return}throw up(e.error,e.error_description,e.suberror)?new Vn(e.error,e.error_description,e.suberror,e.timestamp||P.EMPTY_STRING,e.trace_id||P.EMPTY_STRING,e.correlation_id||P.EMPTY_STRING,e.claims||P.EMPTY_STRING,s):l}}async handleServerTokenResponse(e,t,n,i,s,l,d,f,g){var T;(T=this.performanceClient)==null||T.addQueueMeasurement(k.HandleServerTokenResponse,e.correlation_id);let m;if(e.id_token){if(m=wo(e.id_token||P.EMPTY_STRING,this.cryptoObj.base64Decode),s&&s.nonce&&m.nonce!==s.nonce)throw B(Ry);if(i.maxAge||i.maxAge===0){const I=m.auth_time;if(!I)throw B(qd);Hy(I,i.maxAge)}}this.homeAccountIdentifier=at.generateHomeAccountId(e.client_info||P.EMPTY_STRING,t.authorityType,this.logger,this.cryptoObj,m);let v;s&&s.state&&(v=Un.parseRequestState(this.cryptoObj,s.state)),e.key_id=e.key_id||i.sshKid||void 0;const C=this.generateCacheRecord(e,t,n,i,m,l,s);let S;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),S=new wx(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(S)),d&&!f&&C.account){const I=C.account.generateAccountKey();if(!this.cacheStorage.getAccount(I,this.logger))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await po.generateAuthenticationResult(this.cryptoObj,t,C,!1,i,m,v,void 0,g)}await this.cacheStorage.saveCacheRecord(C,i.storeInCache,i.correlationId)}finally{this.persistencePlugin&&this.serializableCache&&S&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(S))}return po.generateAuthenticationResult(this.cryptoObj,t,C,!1,i,m,v,e,g)}generateCacheRecord(e,t,n,i,s,l,d){const f=t.getPreferredCache();if(!f)throw B(jd);const g=rC(s);let m,v;e.id_token&&s&&(m=Nc(this.homeAccountIdentifier,f,e.id_token,this.clientId,g||""),v=uh(this.cacheStorage,t,this.homeAccountIdentifier,this.cryptoObj.base64Decode,s,e.client_info,f,g,d,void 0,this.logger));let C=null;if(e.access_token){const I=e.scope?Je.fromString(e.scope):new Je(i.scopes||[]),O=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,$=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,F=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,H=n+O,z=H+$,Q=F&&F>0?n+F:void 0;C=Pc(this.homeAccountIdentifier,f,e.access_token,this.clientId,g||t.tenant||"",I.printScopes(),H,z,this.cryptoObj.base64Decode,Q,e.token_type,l,e.key_id,i.claims,i.requestedClaimsHash)}let S=null;if(e.refresh_token){let I;if(e.refresh_token_expires_in){const O=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;I=n+O}S=$y(this.homeAccountIdentifier,f,e.refresh_token,this.clientId,e.foci,l,I)}let T=null;return e.foci&&(T={clientId:this.clientId,environment:f,familyId:e.foci}),{account:v,idToken:m,accessToken:C,refreshToken:S,appMetadata:T}}static async generateAuthenticationResult(e,t,n,i,s,l,d,f,g){var H,z,Q,we,W;let m=P.EMPTY_STRING,v=[],C=null,S,T,I=P.EMPTY_STRING;if(n.accessToken){if(n.accessToken.tokenType===Oe.POP&&!s.popKid){const tt=new gi(e),{secret:Te,keyId:Y}=n.accessToken;if(!Y)throw B(Yd);m=await tt.signPopToken(Te,Y,s)}else m=n.accessToken.secret;v=Je.fromString(n.accessToken.target).asArray(),C=new Date(Number(n.accessToken.expiresOn)*1e3),S=new Date(Number(n.accessToken.extendedExpiresOn)*1e3),n.accessToken.refreshOn&&(T=new Date(Number(n.accessToken.refreshOn)*1e3))}n.appMetadata&&(I=n.appMetadata.familyId===aa?aa:"");const O=(l==null?void 0:l.oid)||(l==null?void 0:l.sub)||"",$=(l==null?void 0:l.tid)||"";f!=null&&f.spa_accountid&&n.account&&(n.account.nativeAccountId=f==null?void 0:f.spa_accountid);const F=n.account?oh(n.account.getAccountInfo(),void 0,l,(H=n.idToken)==null?void 0:H.secret):null;return{authority:t.canonicalAuthority,uniqueId:O,tenantId:$,scopes:v,account:F,idToken:((z=n==null?void 0:n.idToken)==null?void 0:z.secret)||"",idTokenClaims:l||{},accessToken:m,fromCache:i,expiresOn:C,extExpiresOn:S,refreshOn:T,correlationId:s.correlationId,requestId:g||P.EMPTY_STRING,familyId:I,tokenType:((Q=n.accessToken)==null?void 0:Q.tokenType)||P.EMPTY_STRING,state:d?d.userRequestState:P.EMPTY_STRING,cloudGraphHostName:((we=n.account)==null?void 0:we.cloudGraphHostName)||P.EMPTY_STRING,msGraphHost:((W=n.account)==null?void 0:W.msGraphHost)||P.EMPTY_STRING,code:f==null?void 0:f.spa_code,fromNativeBroker:!1}}}function uh(r,e,t,n,i,s,l,d,f,g,m){m==null||m.verbose("setCachedAccount called");const C=r.getAccountKeys().find($=>$.startsWith(t));let S=null;C&&(S=r.getAccount(C,m));const T=S||at.createAccount({homeAccountId:t,idTokenClaims:i,clientInfo:s,environment:l,cloudGraphHostName:f==null?void 0:f.cloud_graph_host_name,msGraphHost:f==null?void 0:f.msgraph_host,nativeAccountId:g},e,n),I=T.tenantProfiles||[],O=d||T.realm;if(O&&!I.find($=>$.tenantId===O)){const $=rh(t,T.localAccountId,O,i);I.push($)}return T.tenantProfiles=I,T}/*! @azure/msal-common v14.16.0 2024-11-05 */async function fC(r,e,t){return typeof r=="string"?r:r({clientId:e,tokenEndpoint:t})}/*! @azure/msal-common v14.16.0 2024-11-05 */class gC extends ch{constructor(e,t){var n;super(e,t),this.includeRedirectUri=!0,this.oidcDefaultScopes=(n=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:n.defaultScopes}async getAuthCodeUrl(e){var n;(n=this.performanceClient)==null||n.addQueueMeasurement(k.GetAuthCodeUrl,e.correlationId);const t=await U(this.createAuthCodeUrlQueryString.bind(this),k.AuthClientCreateQueryString,this.logger,this.performanceClient,e.correlationId)(e);return ye.appendQueryString(this.authority.authorizationEndpoint,t)}async acquireToken(e,t){var d,f;if((d=this.performanceClient)==null||d.addQueueMeasurement(k.AuthClientAcquireToken,e.correlationId),!e.code)throw B(Py);const n=rr(),i=await U(this.executeTokenRequest.bind(this),k.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),s=(f=i.headers)==null?void 0:f[Pt.X_MS_REQUEST_ID],l=new po(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return l.validateTokenResponse(i.body),U(l.handleServerTokenResponse.bind(l),k.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(i.body,this.authority,n,e,t,void 0,void 0,void 0,s)}handleFragmentResponse(e,t){if(new po(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,null,null).validateServerAuthorizationCodeResponse(e,t),!e.code)throw B(By);return e}getLogoutUri(e){if(!e)throw Pe(Yy);const t=this.createLogoutUrlQueryString(e);return ye.appendQueryString(this.authority.endSessionEndpoint,t)}async executeTokenRequest(e,t){var g,m;(g=this.performanceClient)==null||g.addQueueMeasurement(k.AuthClientExecuteTokenRequest,t.correlationId);const n=this.createTokenQueryParameters(t),i=ye.appendQueryString(e.tokenEndpoint,n),s=await U(this.createTokenRequestBody.bind(this),k.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,t.correlationId)(t);let l;if(t.clientInfo)try{const v=lc(t.clientInfo,this.cryptoUtils.base64Decode);l={credential:`${v.uid}${bt.CLIENT_INFO_SEPARATOR}${v.utid}`,type:on.HOME_ACCOUNT_ID}}catch(v){this.logger.verbose("Could not parse client info for CCS Header: "+v)}const d=this.createTokenRequestHeaders(l||t.ccsCredential),f={clientId:((m=t.tokenBodyParameters)==null?void 0:m.clientId)||this.config.authOptions.clientId,authority:e.canonicalAuthority,scopes:t.scopes,claims:t.claims,authenticationScheme:t.authenticationScheme,resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,sshKid:t.sshKid};return U(this.executePostToTokenEndpoint.bind(this),k.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,t.correlationId)(i,s,d,f,t.correlationId,k.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var i,s;(i=this.performanceClient)==null||i.addQueueMeasurement(k.AuthClientCreateTokenRequestBody,e.correlationId);const t=new ca(e.correlationId,this.performanceClient);if(t.addClientId(e.embeddedClientId||((s=e.tokenBodyParameters)==null?void 0:s[mo])||this.config.authOptions.clientId),this.includeRedirectUri?t.addRedirectUri(e.redirectUri):Qo.validateRedirectUri(e.redirectUri),t.addScopes(e.scopes,!0,this.oidcDefaultScopes),t.addAuthorizationCode(e.code),t.addLibraryInfo(this.config.libraryInfo),t.addApplicationTelemetry(this.config.telemetry.application),t.addThrottling(),this.serverTelemetryManager&&!gd(this.config)&&t.addServerTelemetry(this.serverTelemetryManager),e.codeVerifier&&t.addCodeVerifier(e.codeVerifier),this.config.clientCredentials.clientSecret&&t.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const l=this.config.clientCredentials.clientAssertion;t.addClientAssertion(await fC(l.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),t.addClientAssertionType(l.assertionType)}if(t.addGrantType(_y.AUTHORIZATION_CODE_GRANT),t.addClientInfo(),e.authenticationScheme===Oe.POP){const l=new gi(this.cryptoUtils,this.performanceClient);let d;e.popKid?d=this.cryptoUtils.encodeKid(e.popKid):d=(await U(l.generateCnf.bind(l),k.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,t.addPopToken(d)}else if(e.authenticationScheme===Oe.SSH)if(e.sshJwk)t.addSshJwk(e.sshJwk);else throw Pe(Mc);(!Bn.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&t.addClaims(e.claims,this.config.authOptions.clientCapabilities);let n;if(e.clientInfo)try{const l=lc(e.clientInfo,this.cryptoUtils.base64Decode);n={credential:`${l.uid}${bt.CLIENT_INFO_SEPARATOR}${l.utid}`,type:on.HOME_ACCOUNT_ID}}catch(l){this.logger.verbose("Could not parse client info for CCS Header: "+l)}else n=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&n)switch(n.type){case on.HOME_ACCOUNT_ID:try{const l=ii(n.credential);t.addCcsOid(l)}catch(l){this.logger.verbose("Could not parse home account ID for CCS Header: "+l)}break;case on.UPN:t.addCcsUpn(n.credential);break}return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&t.addExtraQueryParameters(e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[sp])&&t.addExtraQueryParameters({[sp]:"1"}),t.createQueryString()}async createAuthCodeUrlQueryString(e){var s,l;const t=e.correlationId||this.config.cryptoInterface.createNewGuid();(s=this.performanceClient)==null||s.addQueueMeasurement(k.AuthClientCreateQueryString,t);const n=new ca(t,this.performanceClient);n.addClientId(e.embeddedClientId||((l=e.extraQueryParameters)==null?void 0:l[mo])||this.config.authOptions.clientId);const i=[...e.scopes||[],...e.extraScopesToConsent||[]];if(n.addScopes(i,!0,this.oidcDefaultScopes),n.addRedirectUri(e.redirectUri),n.addCorrelationId(t),n.addResponseMode(e.responseMode),n.addResponseTypeCode(),n.addLibraryInfo(this.config.libraryInfo),gd(this.config)||n.addApplicationTelemetry(this.config.telemetry.application),n.addClientInfo(),e.codeChallenge&&e.codeChallengeMethod&&n.addCodeChallengeParams(e.codeChallenge,e.codeChallengeMethod),e.prompt&&n.addPrompt(e.prompt),e.domainHint&&n.addDomainHint(e.domainHint),e.prompt!==dt.SELECT_ACCOUNT)if(e.sid&&e.prompt===dt.NONE)this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),n.addSid(e.sid);else if(e.account){const d=this.extractAccountSid(e.account);let f=this.extractLoginHint(e.account);if(f&&e.domainHint&&(this.logger.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),f=null),f){this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),n.addLoginHint(f);try{const g=ii(e.account.homeAccountId);n.addCcsOid(g)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(d&&e.prompt===dt.NONE){this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),n.addSid(d);try{const g=ii(e.account.homeAccountId);n.addCcsOid(g)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),n.addLoginHint(e.loginHint),n.addCcsUpn(e.loginHint);else if(e.account.username){this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),n.addLoginHint(e.account.username);try{const g=ii(e.account.homeAccountId);n.addCcsOid(g)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),n.addLoginHint(e.loginHint),n.addCcsUpn(e.loginHint));else this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");if(e.nonce&&n.addNonce(e.nonce),e.state&&n.addState(e.state),(e.claims||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&n.addClaims(e.claims,this.config.authOptions.clientCapabilities),e.embeddedClientId&&n.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),this.addExtraQueryParams(e,n),e.nativeBroker&&(n.addNativeBroker(),e.authenticationScheme===Oe.POP)){const d=new gi(this.cryptoUtils);let f;e.popKid?f=this.cryptoUtils.encodeKid(e.popKid):f=(await U(d.generateCnf.bind(d),k.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,n.addPopToken(f)}return n.createQueryString()}createLogoutUrlQueryString(e){const t=new ca(e.correlationId,this.performanceClient);return e.postLogoutRedirectUri&&t.addPostLogoutRedirectUri(e.postLogoutRedirectUri),e.correlationId&&t.addCorrelationId(e.correlationId),e.idTokenHint&&t.addIdTokenHint(e.idTokenHint),e.state&&t.addState(e.state),e.logoutHint&&t.addLogoutHint(e.logoutHint),this.addExtraQueryParams(e,t),t.createQueryString()}addExtraQueryParams(e,t){!(e.extraQueryParameters&&e.extraQueryParameters.hasOwnProperty("instance_aware"))&&this.config.authOptions.instanceAware&&(e.extraQueryParameters=e.extraQueryParameters||{},e.extraQueryParameters.instance_aware="true"),e.extraQueryParameters&&t.addExtraQueryParameters(e.extraQueryParameters)}extractAccountSid(e){var t;return((t=e.idTokenClaims)==null?void 0:t.sid)||null}extractLoginHint(e){var t;return((t=e.idTokenClaims)==null?void 0:t.login_hint)||null}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Tx=300;class vd extends ch{constructor(e,t){super(e,t)}async acquireToken(e){var l,d;(l=this.performanceClient)==null||l.addQueueMeasurement(k.RefreshTokenClientAcquireToken,e.correlationId);const t=rr(),n=await U(this.executeTokenRequest.bind(this),k.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),i=(d=n.headers)==null?void 0:d[Pt.X_MS_REQUEST_ID],s=new po(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return s.validateTokenResponse(n.body),U(s.handleServerTokenResponse.bind(s),k.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(n.body,this.authority,t,e,void 0,void 0,!0,e.forceCache,i)}async acquireTokenByRefreshToken(e){var n;if(!e)throw Pe(jy);if((n=this.performanceClient)==null||n.addQueueMeasurement(k.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw B(Gd);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await U(this.acquireTokenWithCachedRefreshToken.bind(this),k.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(i){const s=i instanceof Vn&&i.errorCode===fc,l=i instanceof Gr&&i.errorCode===Gm.INVALID_GRANT_ERROR&&i.subError===Gm.CLIENT_MISMATCH_ERROR;if(s||l)return U(this.acquireTokenWithCachedRefreshToken.bind(this),k.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw i}return U(this.acquireTokenWithCachedRefreshToken.bind(this),k.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,t){var s;(s=this.performanceClient)==null||s.addQueueMeasurement(k.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const n=_o(this.cacheManager.getRefreshToken.bind(this.cacheManager),k.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,t,void 0,this.performanceClient,e.correlationId);if(!n)throw pd(fc);if(n.expiresOn&&fd(n.expiresOn,e.refreshTokenExpirationOffsetSeconds||Tx))throw pd(lh);const i={...e,refreshToken:n.secret,authenticationScheme:e.authenticationScheme||Oe.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:on.HOME_ACCOUNT_ID}};try{return await U(this.acquireToken.bind(this),k.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(i)}catch(l){if(l instanceof Vn&&l.subError===Lc){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const d=oi(n);this.cacheManager.removeRefreshToken(d)}throw l}}async executeTokenRequest(e,t){var f,g;(f=this.performanceClient)==null||f.addQueueMeasurement(k.RefreshTokenClientExecuteTokenRequest,e.correlationId);const n=this.createTokenQueryParameters(e),i=ye.appendQueryString(t.tokenEndpoint,n),s=await U(this.createTokenRequestBody.bind(this),k.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),l=this.createTokenRequestHeaders(e.ccsCredential),d={clientId:((g=e.tokenBodyParameters)==null?void 0:g.clientId)||this.config.authOptions.clientId,authority:t.canonicalAuthority,scopes:e.scopes,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid};return U(this.executePostToTokenEndpoint.bind(this),k.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(i,s,l,d,e.correlationId,k.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var i,s,l;(i=this.performanceClient)==null||i.addQueueMeasurement(k.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const t=e.correlationId,n=new ca(t,this.performanceClient);if(n.addClientId(e.embeddedClientId||((s=e.tokenBodyParameters)==null?void 0:s[mo])||this.config.authOptions.clientId),e.redirectUri&&n.addRedirectUri(e.redirectUri),n.addScopes(e.scopes,!0,(l=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:l.defaultScopes),n.addGrantType(_y.REFRESH_TOKEN_GRANT),n.addClientInfo(),n.addLibraryInfo(this.config.libraryInfo),n.addApplicationTelemetry(this.config.telemetry.application),n.addThrottling(),this.serverTelemetryManager&&!gd(this.config)&&n.addServerTelemetry(this.serverTelemetryManager),n.addRefreshToken(e.refreshToken),this.config.clientCredentials.clientSecret&&n.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const d=this.config.clientCredentials.clientAssertion;n.addClientAssertion(await fC(d.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),n.addClientAssertionType(d.assertionType)}if(e.authenticationScheme===Oe.POP){const d=new gi(this.cryptoUtils,this.performanceClient);let f;e.popKid?f=this.cryptoUtils.encodeKid(e.popKid):f=(await U(d.generateCnf.bind(d),k.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,n.addPopToken(f)}else if(e.authenticationScheme===Oe.SSH)if(e.sshJwk)n.addSshJwk(e.sshJwk);else throw Pe(Mc);if((!Bn.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&n.addClaims(e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case on.HOME_ACCOUNT_ID:try{const d=ii(e.ccsCredential.credential);n.addCcsOid(d)}catch(d){this.logger.verbose("Could not parse home account ID for CCS Header: "+d)}break;case on.UPN:n.addCcsUpn(e.ccsCredential.credential);break}return e.embeddedClientId&&n.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&n.addExtraQueryParameters(e.tokenBodyParameters),n.createQueryString()}}/*! @azure/msal-common v14.16.0 2024-11-05 */class Ex extends ch{constructor(e,t){super(e,t)}async acquireToken(e){var t;try{const[n,i]=await this.acquireCachedToken({...e,scopes:(t=e.scopes)!=null&&t.length?e.scopes:[...vi]});return i===Br.PROACTIVELY_REFRESHED&&(this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."),new vd(this.config,this.performanceClient).acquireTokenByRefreshToken(e).catch(()=>{})),n}catch(n){if(n instanceof Oc&&n.errorCode===yr)return new vd(this.config,this.performanceClient).acquireTokenByRefreshToken(e);throw n}}async acquireCachedToken(e){var f;(f=this.performanceClient)==null||f.addQueueMeasurement(k.SilentFlowClientAcquireCachedToken,e.correlationId);let t=Br.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!Bn.isEmptyObj(e.claims))throw this.setCacheOutcome(Br.FORCE_REFRESH_OR_CLAIMS,e.correlationId),B(yr);if(!e.account)throw B(Gd);const n=e.account.tenantId||hx(e.authority),i=this.cacheManager.getTokenKeys(),s=this.cacheManager.getAccessToken(e.account,e,i,n,this.performanceClient,e.correlationId);if(s){if(X1(s.cachedAt)||fd(s.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(Br.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),B(yr);s.refreshOn&&fd(s.refreshOn,0)&&(t=Br.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(Br.NO_CACHED_ACCESS_TOKEN,e.correlationId),B(yr);const l=e.authority||this.authority.getPreferredCache(),d={account:this.cacheManager.readAccountFromCache(e.account),accessToken:s,idToken:this.cacheManager.getIdToken(e.account,i,n,this.performanceClient,e.correlationId),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(l)};return this.setCacheOutcome(t,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await U(this.generateResultFromCacheRecord.bind(this),k.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(d,e),t]}setCacheOutcome(e,t){var n,i;(n=this.serverTelemetryManager)==null||n.setCacheOutcome(e),(i=this.performanceClient)==null||i.addFields({cacheOutcome:e},t),e!==Br.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,t){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(k.SilentFlowClientGenerateResultFromCacheRecord,t.correlationId);let n;if(e.idToken&&(n=wo(e.idToken.secret,this.config.cryptoInterface.base64Decode)),t.maxAge||t.maxAge===0){const s=n==null?void 0:n.auth_time;if(!s)throw B(qd);Hy(s,t.maxAge)}return po.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,t,n)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Sx={sendGetRequestAsync:()=>Promise.reject(B(ge)),sendPostRequestAsync:()=>Promise.reject(B(ge))};/*! @azure/msal-common v14.16.0 2024-11-05 */const dp=",",mC="|";function Ax(r){const{skus:e,libraryName:t,libraryVersion:n,extensionName:i,extensionVersion:s}=r,l=new Map([[0,[t,n]],[2,[i,s]]]);let d=[];if(e!=null&&e.length){if(d=e.split(dp),d.length<4)return e}else d=Array.from({length:4},()=>mC);return l.forEach((f,g)=>{var m,v;f.length===2&&((m=f[0])!=null&&m.length)&&((v=f[1])!=null&&v.length)&&bx({skuArr:d,index:g,skuName:f[0],skuVersion:f[1]})}),d.join(dp)}function bx(r){const{skuArr:e,index:t,skuName:n,skuVersion:i}=r;t>=e.length||(e[t]=[n,i].join(mC))}class ga{constructor(e,t){this.cacheOutcome=Br.NOT_APPLICABLE,this.cacheManager=t,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||P.EMPTY_STRING,this.wrapperVer=e.wrapperVer||P.EMPTY_STRING,this.telemetryCacheKey=pt.CACHE_KEY+bt.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${pt.VALUE_SEPARATOR}${this.cacheOutcome}`,t=[this.wrapperSKU,this.wrapperVer],n=this.getNativeBrokerErrorCode();n!=null&&n.length&&t.push(`broker_error=${n}`);const i=t.join(pt.VALUE_SEPARATOR),s=this.getRegionDiscoveryFields(),l=[e,s].join(pt.VALUE_SEPARATOR);return[pt.SCHEMA_VERSION,l,i].join(pt.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),t=ga.maxErrorsToSend(e),n=e.failedRequests.slice(0,2*t).join(pt.VALUE_SEPARATOR),i=e.errors.slice(0,t).join(pt.VALUE_SEPARATOR),s=e.errors.length,l=t<s?pt.OVERFLOW_TRUE:pt.OVERFLOW_FALSE,d=[s,l].join(pt.VALUE_SEPARATOR);return[pt.SCHEMA_VERSION,e.cacheHits,n,i,d].join(pt.CATEGORY_SEPARATOR)}cacheFailedRequest(e){const t=this.getLastRequests();t.errors.length>=pt.MAX_CACHED_ERRORS&&(t.failedRequests.shift(),t.failedRequests.shift(),t.errors.shift()),t.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof He?e.subError?t.errors.push(e.subError):e.errorCode?t.errors.push(e.errorCode):t.errors.push(e.toString()):t.errors.push(e.toString()):t.errors.push(pt.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),t=ga.maxErrorsToSend(e),n=e.errors.length;if(t===n)this.cacheManager.removeItem(this.telemetryCacheKey);else{const i={failedRequests:e.failedRequests.slice(t*2),errors:e.errors.slice(t),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,i)}}static maxErrorsToSend(e){let t,n=0,i=0;const s=e.errors.length;for(t=0;t<s;t++){const l=e.failedRequests[2*t]||P.EMPTY_STRING,d=e.failedRequests[2*t+1]||P.EMPTY_STRING,f=e.errors[t]||P.EMPTY_STRING;if(i+=l.toString().length+d.toString().length+f.length+3,i<pt.MAX_LAST_HEADER_BYTES)n+=1;else break}return n}getRegionDiscoveryFields(){const e=[];return e.push(this.regionUsed||P.EMPTY_STRING),e.push(this.regionSource||P.EMPTY_STRING),e.push(this.regionOutcome||P.EMPTY_STRING),e.join(",")}updateRegionDiscoveryMetadata(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome}setCacheOutcome(e){this.cacheOutcome=e}setNativeBrokerErrorCode(e){const t=this.getLastRequests();t.nativeBrokerErrorCode=e,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}getNativeBrokerErrorCode(){return this.getLastRequests().nativeBrokerErrorCode}clearNativeBrokerErrorCode(){const e=this.getLastRequests();delete e.nativeBrokerErrorCode,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e)}static makeExtraSkuString(e){return Ax(e)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const pC="missing_kid_error",vC="missing_alg_error";/*! @azure/msal-common v14.16.0 2024-11-05 */const Ix={[pC]:"The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided.",[vC]:"The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided."};class dh extends He{constructor(e,t){super(e,t),this.name="JoseHeaderError",Object.setPrototypeOf(this,dh.prototype)}}function hp(r){return new dh(r,Ix[r])}/*! @azure/msal-common v14.16.0 2024-11-05 */class hh{constructor(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}static getShrHeaderString(e){if(!e.kid)throw hp(pC);if(!e.alg)throw hp(vC);const t=new hh({typ:e.typ||L1.Pop,kid:e.kid,alg:e.alg});return JSON.stringify(t)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class fp{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class kx{generateId(){return"callback-id"}startMeasurement(e,t){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:dx.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:t||""},measurement:new fp}}startPerformanceMeasurement(){return new fp}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const fh="pkce_not_created",yd="crypto_nonexistent",Bc="empty_navigate_uri",yC="hash_empty_error",gh="no_state_in_hash",CC="hash_does_not_contain_known_properties",wC="unable_to_parse_state",_C="state_interaction_type_mismatch",TC="interaction_in_progress",EC="popup_window_error",SC="empty_window_error",vo="user_cancelled",Rx="monitor_popup_timeout",AC="monitor_window_timeout",bC="redirect_in_iframe",IC="block_iframe_reload",kC="block_nested_popups",Ox="iframe_closed_prematurely",Uc="silent_logout_unsupported",RC="no_account_error",Nx="silent_prompt_value_error",OC="no_token_request_cache_error",NC="unable_to_parse_token_request_cache_error",mh="no_cached_authority_error",Px="auth_request_not_set_error",Mx="invalid_cache_type",Vc="non_browser_environment",Xo="database_not_open",gc="no_network_connectivity",PC="post_request_failed",MC="get_request_failed",Cd="failed_to_parse_response",xC="unable_to_load_token",ph="crypto_key_not_found",DC="auth_code_required",LC="auth_code_or_nativeAccountId_required",BC="spa_code_and_nativeAccountId_present",vh="database_unavailable",UC="unable_to_acquire_token_from_native_platform",VC="native_handshake_timeout",FC="native_extension_not_installed",Ea="native_connection_not_established",HC="uninitialized_public_client_application",$C="native_prompt_not_supported",KC="invalid_base64_string",zC="invalid_pop_token_request",WC="failed_to_build_headers",qC="failed_to_parse_headers";/*! @azure/msal-browser v3.28.1 2025-01-14 */const mr="For more visit: aka.ms/msaljs/browser-errors",xx={[fh]:"The PKCE code challenge and verifier could not be generated.",[yd]:"The crypto object or function is not available.",[Bc]:"Navigation URI is empty. Please check stack trace for more info.",[yC]:`Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. ${mr}`,[gh]:"Hash does not contain state. Please verify that the request originated from msal.",[CC]:`Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. ${mr}`,[wC]:"Unable to parse state. Please verify that the request originated from msal.",[_C]:"Hash contains state but the interaction type does not match the caller.",[TC]:`Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. ${mr}`,[EC]:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.",[SC]:"window.open returned null or undefined window object.",[vo]:"User cancelled the flow.",[Rx]:`Token acquisition in popup failed due to timeout. ${mr}`,[AC]:`Token acquisition in iframe failed due to timeout. ${mr}`,[bC]:"Redirects are not supported for iframed or brokered applications. Please ensure you are using MSAL.js in a top frame of the window if using the redirect APIs, or use the popup APIs.",[IC]:`Request was blocked inside an iframe because MSAL detected an authentication response. ${mr}`,[kC]:"Request was blocked inside a popup because MSAL detected it was running in a popup.",[Ox]:"The iframe being monitored was closed prematurely.",[Uc]:"Silent logout not supported. Please call logoutRedirect or logoutPopup instead.",[RC]:"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request.",[Nx]:"The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'.",[OC]:"No token request found in cache.",[NC]:"The cached token request could not be parsed.",[mh]:"No cached authority found.",[Px]:"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler",[Mx]:"Invalid cache type",[Vc]:"Login and token requests are not supported in non-browser environments.",[Xo]:"Database is not open!",[gc]:"No network connectivity. Check your internet connection.",[PC]:"Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'",[MC]:"Network request failed. Please check the network trace to determine root cause.",[Cd]:"Failed to parse network response. Check network trace.",[xC]:"Error loading token to cache.",[ph]:"Cryptographic Key or Keypair not found in browser storage.",[DC]:"An authorization code must be provided (as the `code` property on the request) to this flow.",[LC]:"An authorization code or nativeAccountId must be provided to this flow.",[BC]:"Request cannot contain both spa code and native account id.",[vh]:"IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts.",[UC]:`Unable to acquire token from native platform. ${mr}`,[VC]:"Timed out while attempting to establish connection to browser extension",[FC]:"Native extension is not installed. If you think this is a mistake call the initialize function.",[Ea]:`Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). ${mr}`,[HC]:`You must call and await the initialize function before attempting to call any other MSAL API. ${mr}`,[$C]:"The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",[KC]:"Invalid base64 encoded string.",[zC]:"Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",[WC]:"Failed to build request headers object.",[qC]:"Failed to parse response headers"};class Sa extends He{constructor(e,t){super(e,xx[e],t),Object.setPrototypeOf(this,Sa.prototype),this.name="BrowserAuthError"}}function j(r,e){return new Sa(r,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const tn={INTERACTION_IN_PROGRESS_VALUE:"interaction_in_progress",INVALID_GRANT_ERROR:"invalid_grant",POPUP_WIDTH:483,POPUP_HEIGHT:600,POPUP_NAME_PREFIX:"msal",DEFAULT_POLL_INTERVAL_MS:30,MSAL_SKU:"msal.js.browser"},ai={CHANNEL_ID:"53ee284d-920a-4b59-9d30-a60315b26836",PREFERRED_EXTENSION_ID:"ppnbnpeolgkicgegkbkbjmhlideopiji",MATS_TELEMETRY:"MATS"},uo={HandshakeRequest:"Handshake",HandshakeResponse:"HandshakeResponse",GetToken:"GetToken",Response:"Response"},Ht={LocalStorage:"localStorage",SessionStorage:"sessionStorage",MemoryStorage:"memoryStorage"},gp={GET:"GET",POST:"POST"},ke={AUTHORITY:"authority",ACQUIRE_TOKEN_ACCOUNT:"acquireToken.account",SESSION_STATE:"session.state",REQUEST_STATE:"request.state",NONCE_IDTOKEN:"nonce.id_token",ORIGIN_URI:"request.origin",RENEW_STATUS:"token.renew.status",URL_HASH:"urlHash",REQUEST_PARAMS:"request.params",SCOPES:"scopes",INTERACTION_STATUS_KEY:"interaction.status",CCS_CREDENTIAL:"ccs.credential",CORRELATION_ID:"request.correlationId",NATIVE_REQUEST:"request.native",REDIRECT_CONTEXT:"request.redirect.context"},Lr={ACCOUNT_KEYS:"msal.account.keys",TOKEN_KEYS:"msal.token.keys"},Rs={WRAPPER_SKU:"wrapper.sku",WRAPPER_VER:"wrapper.version"},Le={acquireTokenRedirect:861,acquireTokenPopup:862,ssoSilent:863,acquireTokenSilent_authCode:864,handleRedirectPromise:865,acquireTokenByCode:866,acquireTokenSilent_silentFlow:61,logout:961,logoutPopup:962};var X;(function(r){r.Redirect="redirect",r.Popup="popup",r.Silent="silent",r.None="none"})(X||(X={}));const mp={scopes:vi},GC="jwk",wd="msal.db",Dx=1,Lx=`${wd}.keys`,Zt={Default:0,AccessToken:1,AccessTokenAndRefreshToken:2,RefreshToken:3,RefreshTokenAndNetwork:4,Skip:5},Bx=[Zt.Default,Zt.Skip,Zt.RefreshTokenAndNetwork],Ux="msal.browser.log.level",Vx="msal.browser.log.pii";/*! @azure/msal-browser v3.28.1 2025-01-14 */function Os(r){return encodeURIComponent(yh(r).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"))}function Fc(r){return jC(r).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function yh(r){return jC(new TextEncoder().encode(r))}function jC(r){const e=Array.from(r,t=>String.fromCodePoint(t)).join("");return btoa(e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Fx="RSASSA-PKCS1-v1_5",YC="SHA-256",Hx=2048,$x=new Uint8Array([1,0,1]),pp="0123456789abcdef",vp=new Uint32Array(1),Kx="crypto_subtle_undefined",Ch={name:Fx,hash:YC,modulusLength:Hx,publicExponent:$x};function zx(r){if(!window)throw j(Vc);if(!window.crypto)throw j(yd);if(!r&&!window.crypto.subtle)throw j(yd,Kx)}async function JC(r,e,t){e==null||e.addQueueMeasurement(k.Sha256Digest,t);const i=new TextEncoder().encode(r);return window.crypto.subtle.digest(YC,i)}function Wx(r){return window.crypto.getRandomValues(r)}function Bu(){return window.crypto.getRandomValues(vp),vp[0]}function Sr(){const r=Date.now(),e=Bu()*1024+(Bu()&1023),t=new Uint8Array(16),n=Math.trunc(e/2**30),i=e&2**30-1,s=Bu();t[0]=r/2**40,t[1]=r/2**32,t[2]=r/2**24,t[3]=r/2**16,t[4]=r/2**8,t[5]=r,t[6]=112|n>>>8,t[7]=n,t[8]=128|i>>>24,t[9]=i>>>16,t[10]=i>>>8,t[11]=i,t[12]=s>>>24,t[13]=s>>>16,t[14]=s>>>8,t[15]=s;let l="";for(let d=0;d<t.length;d++)l+=pp.charAt(t[d]>>>4),l+=pp.charAt(t[d]&15),(d===3||d===5||d===7||d===9)&&(l+="-");return l}async function qx(r,e){return window.crypto.subtle.generateKey(Ch,r,e)}async function Uu(r){return window.crypto.subtle.exportKey(GC,r)}async function Gx(r,e,t){return window.crypto.subtle.importKey(GC,r,Ch,e,t)}async function jx(r,e){return window.crypto.subtle.sign(Ch,r,e)}async function QC(r){const e=await JC(r),t=new Uint8Array(e);return Fc(t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const ma="storage_not_supported",_d="stubbed_public_client_application_called",mc="in_mem_redirect_unavailable";/*! @azure/msal-browser v3.28.1 2025-01-14 */const Gs={[ma]:"Given storage configuration option was not supported.",[_d]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[mc]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};Gs[ma],Gs[_d],Gs[mc];class wh extends He{constructor(e,t){super(e,t),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,wh.prototype)}}function _h(r){return new wh(r,Gs[r])}/*! @azure/msal-browser v3.28.1 2025-01-14 */function Yx(r){r.location.hash="",typeof r.history.replaceState=="function"&&r.history.replaceState(null,"",`${r.location.origin}${r.location.pathname}${r.location.search}`)}function Jx(r){const e=r.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function Th(){return window.parent!==window}function Qx(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${tn.POPUP_NAME_PREFIX}.`)===0}function Cr(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function Xx(){const e=new ye(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function Zx(){if(ye.hashContainsKnownProperties(window.location.hash)&&Th())throw j(IC)}function eD(r){if(Th()&&!r)throw j(bC)}function tD(){if(Qx())throw j(kC)}function XC(){if(typeof window>"u")throw j(Vc)}function ZC(r){if(!r)throw j(HC)}function Eh(r){XC(),Zx(),tD(),ZC(r)}function yp(r,e){if(Eh(r),eD(e.system.allowRedirectInIframe),e.cache.cacheLocation===Ht.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw _h(mc)}function ew(r){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(r).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function nD(){return Sr()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class pc{navigateInternal(e,t){return pc.defaultNavigateWindow(e,t)}navigateExternal(e,t){return pc.defaultNavigateWindow(e,t)}static defaultNavigateWindow(e,t){return t.noHistory?window.location.replace(e):window.location.assign(e),new Promise(n=>{setTimeout(()=>{n(!0)},t.timeout)})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class rD{async sendGetRequestAsync(e,t){let n,i={},s=0;const l=Cp(t);try{n=await fetch(e,{method:gp.GET,headers:l})}catch{throw j(window.navigator.onLine?MC:gc)}i=wp(n.headers);try{return s=n.status,{headers:i,body:await n.json(),status:s}}catch{throw cp(j(Cd),s,i)}}async sendPostRequestAsync(e,t){const n=t&&t.body||"",i=Cp(t);let s,l=0,d={};try{s=await fetch(e,{method:gp.POST,headers:i,body:n})}catch{throw j(window.navigator.onLine?PC:gc)}d=wp(s.headers);try{return l=s.status,{headers:d,body:await s.json(),status:l}}catch{throw cp(j(Cd),l,d)}}}function Cp(r){try{const e=new Headers;if(!(r&&r.headers))return e;const t=r.headers;return Object.entries(t).forEach(([n,i])=>{e.append(n,i)}),e}catch{throw j(WC)}}function wp(r){try{const e={};return r.forEach((t,n)=>{e[n]=t}),e}catch{throw j(qC)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const oD=6e4,Td=1e4,iD=3e4,aD=2e3;function sD({auth:r,cache:e,system:t,telemetry:n},i){const s={clientId:P.EMPTY_STRING,authority:`${P.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:P.EMPTY_STRING,authorityMetadata:P.EMPTY_STRING,redirectUri:typeof window<"u"?Cr():"",postLogoutRedirectUri:P.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:Tr.AAD,OIDCOptions:{serverResponseType:Ta.FRAGMENT,defaultScopes:[P.OPENID_SCOPE,P.PROFILE_SCOPE,P.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:Qd.None,tenant:P.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1},l={cacheLocation:Ht.SessionStorage,temporaryCacheLocation:Ht.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===Ht.LocalStorage),claimsBasedCachingEnabled:!1},d={loggerCallback:()=>{},logLevel:xe.Info,piiLoggingEnabled:!1},g={...{...cC,loggerOptions:d,networkClient:i?new rD:Sx,navigationClient:new pc,loadFrameTimeout:0,windowHashTimeout:(t==null?void 0:t.loadFrameTimeout)||oD,iframeHashTimeout:(t==null?void 0:t.loadFrameTimeout)||Td,navigateFrameWait:0,redirectNavigationTimeout:iD,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!1,nativeBrokerHandshakeTimeout:(t==null?void 0:t.nativeBrokerHandshakeTimeout)||aD,pollIntervalMilliseconds:tn.DEFAULT_POLL_INTERVAL_MS},...t,loggerOptions:(t==null?void 0:t.loggerOptions)||d},m={application:{appName:P.EMPTY_STRING,appVersion:P.EMPTY_STRING},client:new kx};if((r==null?void 0:r.protocolMode)!==Tr.OIDC&&(r!=null&&r.OIDCOptions)&&new qr(g.loggerOptions).warning(JSON.stringify(Pe(eC))),r!=null&&r.protocolMode&&r.protocolMode!==Tr.AAD&&(g!=null&&g.allowNativeBroker))throw Pe(tC);return{auth:{...s,...r,OIDCOptions:{...s.OIDCOptions,...r==null?void 0:r.OIDCOptions}},cache:{...l,...e},system:g,telemetry:{...m,...n}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const cD="@azure/msal-browser",Hc="3.28.1";/*! @azure/msal-browser v3.28.1 2025-01-14 */class Sh{static loggerCallback(e,t){switch(e){case xe.Error:console.error(t);return;case xe.Info:console.info(t);return;case xe.Verbose:console.debug(t);return;case xe.Warning:console.warn(t);return;default:console.log(t);return}}constructor(e){var f;this.browserEnvironment=typeof window<"u",this.config=sD(e,this.browserEnvironment);let t;try{t=window[Ht.SessionStorage]}catch{}const n=t==null?void 0:t.getItem(Ux),i=(f=t==null?void 0:t.getItem(Vx))==null?void 0:f.toLowerCase(),s=i==="true"?!0:i==="false"?!1:void 0,l={...this.config.system.loggerOptions},d=n&&Object.keys(xe).includes(n)?xe[n]:void 0;d&&(l.loggerCallback=Sh.loggerCallback,l.logLevel=d),s!==void 0&&(l.piiLoggingEnabled=s),this.logger=new qr(l,cD,Hc),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class yo extends Sh{getModuleName(){return yo.MODULE_NAME}getId(){return yo.ID}async initialize(){return this.available=typeof window<"u",this.available}}yo.MODULE_NAME="";yo.ID="StandardOperatingContext";/*! @azure/msal-browser v3.28.1 2025-01-14 */function tr(r){return new TextDecoder().decode(lD(r))}function lD(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw j(KC)}const t=atob(e);return Uint8Array.from(t,n=>n.codePointAt(0)||0)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class uD{constructor(){this.dbName=wd,this.version=Dx,this.tableName=Lx,this.dbOpen=!1}async open(){return new Promise((e,t)=>{const n=window.indexedDB.open(this.dbName,this.version);n.addEventListener("upgradeneeded",i=>{i.target.result.createObjectStore(this.tableName)}),n.addEventListener("success",i=>{const s=i;this.db=s.target.result,this.dbOpen=!0,e()}),n.addEventListener("error",()=>t(j(vh)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((t,n)=>{if(!this.db)return n(j(Xo));const l=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);l.addEventListener("success",d=>{const f=d;this.closeConnection(),t(f.target.result)}),l.addEventListener("error",d=>{this.closeConnection(),n(d)})})}async setItem(e,t){return await this.validateDbIsOpen(),new Promise((n,i)=>{if(!this.db)return i(j(Xo));const d=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(t,e);d.addEventListener("success",()=>{this.closeConnection(),n()}),d.addEventListener("error",f=>{this.closeConnection(),i(f)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((t,n)=>{if(!this.db)return n(j(Xo));const l=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);l.addEventListener("success",()=>{this.closeConnection(),t()}),l.addEventListener("error",d=>{this.closeConnection(),n(d)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,t)=>{if(!this.db)return t(j(Xo));const s=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();s.addEventListener("success",l=>{const d=l;this.closeConnection(),e(d.target.result)}),s.addEventListener("error",l=>{this.closeConnection(),t(l)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((t,n)=>{if(!this.db)return n(j(Xo));const l=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);l.addEventListener("success",d=>{const f=d;this.closeConnection(),t(f.target.result===1)}),l.addEventListener("error",d=>{this.closeConnection(),n(d)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,t)=>{const n=window.indexedDB.deleteDatabase(wd),i=setTimeout(()=>t(!1),200);n.addEventListener("success",()=>(clearTimeout(i),e(!0))),n.addEventListener("blocked",()=>(clearTimeout(i),e(!0))),n.addEventListener("error",()=>(clearTimeout(i),t(!1)))})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ed{constructor(){this.cache=new Map}getItem(e){return this.cache.get(e)||null}setItem(e,t){this.cache.set(e,t)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((t,n)=>{e.push(n)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class dD{constructor(e){this.inMemoryCache=new Ed,this.indexedDBCache=new uD,this.logger=e}handleDatabaseAccessError(e){if(e instanceof Sa&&e.errorCode===vh)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e}async getItem(e){const t=this.inMemoryCache.getItem(e);if(!t)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(n){this.handleDatabaseAccessError(n)}return t}async setItem(e,t){this.inMemoryCache.setItem(e,t);try{await this.indexedDBCache.setItem(e,t)}catch(n){this.handleDatabaseAccessError(n)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(t){this.handleDatabaseAccessError(t)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(e.length===0)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(t){this.handleDatabaseAccessError(t)}return e}async containsKey(e){const t=this.inMemoryCache.containsKey(e);if(!t)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(n){this.handleDatabaseAccessError(n)}return t}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class mi{constructor(e,t,n){this.logger=e,zx(n??!1),this.cache=new dD(this.logger),this.performanceClient=t}createNewGuid(){return Sr()}base64Encode(e){return yh(e)}base64Decode(e){return tr(e)}base64UrlEncode(e){return Os(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){var m;const t=(m=this.performanceClient)==null?void 0:m.startMeasurement(k.CryptoOptsGetPublicKeyThumbprint,e.correlationId),n=await qx(mi.EXTRACTABLE,mi.POP_KEY_USAGES),i=await Uu(n.publicKey),s={e:i.e,kty:i.kty,n:i.n},l=_p(s),d=await this.hashString(l),f=await Uu(n.privateKey),g=await Gx(f,!1,["sign"]);return await this.cache.setItem(d,{privateKey:g,publicKey:n.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),t&&t.end({success:!0}),d}async removeTokenBindingKey(e){return await this.cache.removeItem(e),!await this.cache.containsKey(e)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,t,n,i){var H;const s=(H=this.performanceClient)==null?void 0:H.startMeasurement(k.CryptoOptsSignJwt,i),l=await this.cache.getItem(t);if(!l)throw j(ph);const d=await Uu(l.publicKey),f=_p(d),g=Os(JSON.stringify({kid:t})),m=hh.getShrHeaderString({...n==null?void 0:n.header,alg:d.alg,kid:g}),v=Os(m);e.cnf={jwk:JSON.parse(f)};const C=Os(JSON.stringify(e)),S=`${v}.${C}`,I=new TextEncoder().encode(S),O=await jx(l.privateKey,I),$=Fc(new Uint8Array(O)),F=`${S}.${$}`;return s&&s.end({success:!0}),F}async hashString(e){return QC(e)}}mi.POP_KEY_USAGES=["sign","verify"];mi.EXTRACTABLE=!0;function _p(r){return JSON.stringify(r,Object.keys(r).sort())}/*! @azure/msal-browser v3.28.1 2025-01-14 */class hD{constructor(){if(!window.localStorage)throw _h(ma)}getItem(e){return window.localStorage.getItem(e)}setItem(e,t){window.localStorage.setItem(e,t)}removeItem(e){window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class fD{constructor(){if(!window.sessionStorage)throw _h(ma)}getItem(e){return window.sessionStorage.getItem(e)}setItem(e,t){window.sessionStorage.setItem(e,t)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function tw(r,e){if(!e)return null;try{return Un.parseRequestState(r,e).libraryState.meta}catch{throw B(hi)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const gD=24*60*60*1e3;class mD{getItem(e){const t=`${encodeURIComponent(e)}`,n=document.cookie.split(";");for(let i=0;i<n.length;i++){const s=n[i],[l,...d]=decodeURIComponent(s).trim().split("="),f=d.join("=");if(l===t)return f}return""}setItem(e,t,n,i=!0){let s=`${encodeURIComponent(e)}=${encodeURIComponent(t)};path=/;SameSite=Lax;`;if(n){const l=pD(n);s+=`expires=${l};`}i&&(s+="Secure;"),document.cookie=s}removeItem(e){this.setItem(e,"",-1)}getKeys(){const e=document.cookie.split(";"),t=[];return e.forEach(n=>{const i=decodeURIComponent(n).trim().split("=");t.push(i[0])}),t}containsKey(e){return this.getKeys().includes(e)}}function pD(r){const e=new Date;return new Date(e.getTime()+r*gD).toUTCString()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Sd extends fi{constructor(e,t,n,i,s,l){super(e,n,i,s),this.cacheConfig=t,this.logger=i,this.internalStorage=new Ed,this.browserStorage=this.setupBrowserStorage(this.cacheConfig.cacheLocation),this.temporaryCacheStorage=this.setupBrowserStorage(this.cacheConfig.temporaryCacheLocation),this.cookieStorage=new mD,t.cacheMigrationEnabled&&(this.migrateCacheEntries(),this.createKeyMaps()),this.performanceClient=l}setupBrowserStorage(e){try{switch(e){case Ht.LocalStorage:return new hD;case Ht.SessionStorage:return new fD;case Ht.MemoryStorage:default:break}}catch(t){this.logger.error(t)}return this.cacheConfig.cacheLocation=Ht.MemoryStorage,new Ed}migrateCacheEntries(){const e=`${P.CACHE_PREFIX}.${ct.ID_TOKEN}`,t=`${P.CACHE_PREFIX}.${ct.CLIENT_INFO}`,n=`${P.CACHE_PREFIX}.${ct.ERROR}`,i=`${P.CACHE_PREFIX}.${ct.ERROR_DESC}`,s=this.browserStorage.getItem(e),l=this.browserStorage.getItem(t),d=this.browserStorage.getItem(n),f=this.browserStorage.getItem(i),g=[s,l,d,f];[ct.ID_TOKEN,ct.CLIENT_INFO,ct.ERROR,ct.ERROR_DESC].forEach((v,C)=>{const S=g[C];S&&this.setTemporaryCache(v,S,!0)})}createKeyMaps(){this.logger.trace("BrowserCacheManager - createKeyMaps called.");const e=this.getItem(Lr.ACCOUNT_KEYS),t=this.getItem(`${Lr.TOKEN_KEYS}.${this.clientId}`);if(e&&t){this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.");return}this.browserStorage.getKeys().forEach(i=>{if(this.isCredentialKey(i)){const s=this.getItem(i);if(s){const l=this.validateAndParseJson(s);if(l&&l.hasOwnProperty("credentialType"))switch(l.credentialType){case re.ID_TOKEN:if(Xm(l)){this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - idToken with key: ${i} found, saving key to token key map`);const d=l,f=this.updateCredentialCacheKey(i,d);this.addTokenKey(f,re.ID_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed idToken validation on key: ${i}`);break;case re.ACCESS_TOKEN:case re.ACCESS_TOKEN_WITH_AUTH_SCHEME:if(Qm(l)){this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - accessToken with key: ${i} found, saving key to token key map`);const d=l,f=this.updateCredentialCacheKey(i,d);this.addTokenKey(f,re.ACCESS_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed accessToken validation on key: ${i}`);break;case re.REFRESH_TOKEN:if(Zm(l)){this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - refreshToken with key: ${i} found, saving key to token key map`);const d=l,f=this.updateCredentialCacheKey(i,d);this.addTokenKey(f,re.REFRESH_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: ${i}`);break}}}if(this.isAccountKey(i)){const s=this.getItem(i);if(s){const l=this.validateAndParseJson(s);l&&at.isAccountEntity(l)&&(this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - account with key: ${i} found, saving key to account key map`),this.addAccountKeyToMap(i))}}})}validateAndParseJson(e){try{const t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}}getItem(e){return this.browserStorage.getItem(e)}setItem(e,t){this.browserStorage.setItem(e,t)}getAccount(e,t){this.logger.trace("BrowserCacheManager.getAccount called");const n=this.getCachedAccountEntity(e);return this.updateOutdatedCachedAccount(e,n,t)}getCachedAccountEntity(e){const t=this.getItem(e);if(!t)return this.removeAccountKeyFromMap(e),null;const n=this.validateAndParseJson(t);return!n||!at.isAccountEntity(n)?(this.removeAccountKeyFromMap(e),null):fi.toObject(new at,n)}setAccount(e){this.logger.trace("BrowserCacheManager.setAccount called");const t=e.generateAccountKey();this.setItem(t,JSON.stringify(e)),this.addAccountKeyToMap(t)}getAccountKeys(){this.logger.trace("BrowserCacheManager.getAccountKeys called");const e=this.getItem(Lr.ACCOUNT_KEYS);return e?JSON.parse(e):(this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found"),[])}addAccountKeyToMap(e){this.logger.trace("BrowserCacheManager.addAccountKeyToMap called"),this.logger.tracePii(`BrowserCacheManager.addAccountKeyToMap called with key: ${e}`);const t=this.getAccountKeys();t.indexOf(e)===-1?(t.push(e),this.setItem(Lr.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added")):this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map")}removeAccountKeyFromMap(e){this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called"),this.logger.tracePii(`BrowserCacheManager.removeAccountKeyFromMap called with key: ${e}`);const t=this.getAccountKeys(),n=t.indexOf(e);n>-1?(t.splice(n,1),this.setItem(Lr.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")):this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}async removeAccount(e){super.removeAccount(e),this.removeAccountKeyFromMap(e)}removeOutdatedAccount(e){this.removeItem(e),this.removeAccountKeyFromMap(e)}removeIdToken(e){super.removeIdToken(e),this.removeTokenKey(e,re.ID_TOKEN)}async removeAccessToken(e){super.removeAccessToken(e),this.removeTokenKey(e,re.ACCESS_TOKEN)}removeRefreshToken(e){super.removeRefreshToken(e),this.removeTokenKey(e,re.REFRESH_TOKEN)}getTokenKeys(){this.logger.trace("BrowserCacheManager.getTokenKeys called");const e=this.getItem(`${Lr.TOKEN_KEYS}.${this.clientId}`);if(e){const t=this.validateAndParseJson(e);if(t&&t.hasOwnProperty("idToken")&&t.hasOwnProperty("accessToken")&&t.hasOwnProperty("refreshToken"))return t;this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.")}else this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");return{idToken:[],accessToken:[],refreshToken:[]}}addTokenKey(e,t){this.logger.trace("BrowserCacheManager addTokenKey called");const n=this.getTokenKeys();switch(t){case re.ID_TOKEN:n.idToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),n.idToken.push(e));break;case re.ACCESS_TOKEN:n.accessToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - accessToken added to map"),n.accessToken.push(e));break;case re.REFRESH_TOKEN:n.refreshToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),n.refreshToken.push(e));break;default:throw this.logger.error(`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${t}`),B(hd)}this.setItem(`${Lr.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(n))}removeTokenKey(e,t){this.logger.trace("BrowserCacheManager removeTokenKey called");const n=this.getTokenKeys();switch(t){case re.ID_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: ${e} from map`);const i=n.idToken.indexOf(e);i>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map"),n.idToken.splice(i,1)):this.logger.info("BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.");break;case re.ACCESS_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: ${e} from map`);const s=n.accessToken.indexOf(e);s>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map"),n.accessToken.splice(s,1)):this.logger.info("BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.");break;case re.REFRESH_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: ${e} from map`);const l=n.refreshToken.indexOf(e);l>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map"),n.refreshToken.splice(l,1)):this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.");break;default:throw this.logger.error(`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${t}`),B(hd)}this.setItem(`${Lr.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(n))}getIdTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,re.ID_TOKEN),null;const n=this.validateAndParseJson(t);return!n||!Xm(n)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,re.ID_TOKEN),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),n)}setIdTokenCredential(e){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const t=oi(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,re.ID_TOKEN)}getAccessTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,re.ACCESS_TOKEN),null;const n=this.validateAndParseJson(t);return!n||!Qm(n)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,re.ACCESS_TOKEN),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),n)}setAccessTokenCredential(e){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const t=oi(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,re.ACCESS_TOKEN)}getRefreshTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,re.REFRESH_TOKEN),null;const n=this.validateAndParseJson(t);return!n||!Zm(n)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,re.REFRESH_TOKEN),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),n)}setRefreshTokenCredential(e){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const t=oi(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,re.REFRESH_TOKEN)}getAppMetadata(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const n=this.validateAndParseJson(t);return!n||!sM(e,n)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),n)}setAppMetadata(e){this.logger.trace("BrowserCacheManager.setAppMetadata called");const t=aM(e);this.setItem(t,JSON.stringify(e))}getServerTelemetry(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const n=this.validateAndParseJson(t);return!n||!oM(e,n)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),n)}setServerTelemetry(e,t){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(t))}getAuthorityMetadata(e){const t=this.internalStorage.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const n=this.validateAndParseJson(t);return n&&cM(e,n)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),n):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(t=>this.isAuthorityMetadata(t))}setWrapperMetadata(e,t){this.internalStorage.setItem(Rs.WRAPPER_SKU,e),this.internalStorage.setItem(Rs.WRAPPER_VER,t)}getWrapperMetadata(){const e=this.internalStorage.getItem(Rs.WRAPPER_SKU)||P.EMPTY_STRING,t=this.internalStorage.getItem(Rs.WRAPPER_VER)||P.EMPTY_STRING;return[e,t]}setAuthorityMetadata(e,t){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(t))}getActiveAccount(){const e=this.generateCacheKey(ct.ACTIVE_ACCOUNT_FILTERS),t=this.getItem(e);if(!t){this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema");const i=this.generateCacheKey(ct.ACTIVE_ACCOUNT),s=this.getItem(i);if(!s)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null;const l=this.getAccountInfoFilteredBy({localAccountId:s});return l?(this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found"),this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema"),this.setActiveAccount(l),l):null}const n=this.validateAndParseJson(t);return n?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:n.homeAccountId,localAccountId:n.localAccountId,tenantId:n.tenantId})):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e){const t=this.generateCacheKey(ct.ACTIVE_ACCOUNT_FILTERS),n=this.generateCacheKey(ct.ACTIVE_ACCOUNT);if(e){this.logger.verbose("setActiveAccount: Active account set");const i={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId};this.browserStorage.setItem(t,JSON.stringify(i)),this.browserStorage.setItem(n,e.localAccountId)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(t),this.browserStorage.removeItem(n)}getThrottlingCache(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const n=this.validateAndParseJson(t);return!n||!iM(e,n)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),n)}setThrottlingCache(e,t){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(t))}getTemporaryCache(e,t){const n=t?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const s=this.cookieStorage.getItem(n);if(s)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),s}const i=this.temporaryCacheStorage.getItem(n);if(!i){if(this.cacheConfig.cacheLocation===Ht.LocalStorage){const s=this.browserStorage.getItem(n);if(s)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),s}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),i}setTemporaryCache(e,t,n){const i=n?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(i,t),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(i,t,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}async clear(){await this.removeAllAccounts(),this.removeAppMetadata(),this.temporaryCacheStorage.getKeys().forEach(e=>{(e.indexOf(P.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(e)}),this.browserStorage.getKeys().forEach(e=>{(e.indexOf(P.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(e)}),this.internalStorage.clear()}async clearTokensAndKeysWithClaims(e,t){e.addQueueMeasurement(k.ClearTokensAndKeysWithClaims,t);const n=this.getTokenKeys(),i=[];n.accessToken.forEach(s=>{const l=this.getAccessTokenCredential(s);l!=null&&l.requestedClaimsHash&&s.includes(l.requestedClaimsHash.toLowerCase())&&i.push(this.removeAccessToken(s))}),await Promise.all(i),i.length>0&&this.logger.warning(`${i.length} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return this.validateAndParseJson(e)?JSON.stringify(e):Bn.startsWith(e,P.CACHE_PREFIX)||Bn.startsWith(e,ct.ADAL_ID_TOKEN)?e:`${P.CACHE_PREFIX}.${this.clientId}.${e}`}generateAuthorityKey(e){const{libraryState:{id:t}}=Un.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${ke.AUTHORITY}.${t}`)}generateNonceKey(e){const{libraryState:{id:t}}=Un.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${ke.NONCE_IDTOKEN}.${t}`)}generateStateKey(e){const{libraryState:{id:t}}=Un.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${ke.REQUEST_STATE}.${t}`)}getCachedAuthority(e){const t=this.generateStateKey(e),n=this.getTemporaryCache(t);if(!n)return null;const i=this.generateAuthorityKey(n);return this.getTemporaryCache(i)}updateCacheEntries(e,t,n,i,s){this.logger.trace("BrowserCacheManager.updateCacheEntries called");const l=this.generateStateKey(e);this.setTemporaryCache(l,e,!1);const d=this.generateNonceKey(e);this.setTemporaryCache(d,t,!1);const f=this.generateAuthorityKey(e);if(this.setTemporaryCache(f,n,!1),s){const g={credential:s.homeAccountId,type:on.HOME_ACCOUNT_ID};this.setTemporaryCache(ke.CCS_CREDENTIAL,JSON.stringify(g),!0)}else if(i){const g={credential:i,type:on.UPN};this.setTemporaryCache(ke.CCS_CREDENTIAL,JSON.stringify(g),!0)}}resetRequestCache(e){this.logger.trace("BrowserCacheManager.resetRequestCache called"),e&&(this.temporaryCacheStorage.getKeys().forEach(t=>{t.indexOf(e)!==-1&&this.removeTemporaryItem(t)}),this.removeTemporaryItem(this.generateStateKey(e)),this.removeTemporaryItem(this.generateNonceKey(e)),this.removeTemporaryItem(this.generateAuthorityKey(e))),this.removeTemporaryItem(this.generateCacheKey(ke.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey(ke.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey(ke.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey(ke.CORRELATION_ID)),this.removeTemporaryItem(this.generateCacheKey(ke.CCS_CREDENTIAL)),this.removeTemporaryItem(this.generateCacheKey(ke.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cleanRequestByState(e){if(this.logger.trace("BrowserCacheManager.cleanRequestByState called"),e){const t=this.generateStateKey(e),n=this.temporaryCacheStorage.getItem(t);this.logger.infoPii(`BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: ${n}`),this.resetRequestCache(n||P.EMPTY_STRING)}}cleanRequestByInteractionType(e){this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.temporaryCacheStorage.getKeys().forEach(t=>{if(t.indexOf(ke.REQUEST_STATE)===-1)return;const n=this.temporaryCacheStorage.getItem(t);if(!n)return;const i=tw(this.cryptoImpl,n);i&&i.interactionType===e&&(this.logger.infoPii(`BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: ${n}`),this.resetRequestCache(n))}),this.setInteractionInProgress(!1)}cacheCodeRequest(e){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");const t=yh(JSON.stringify(e));this.setTemporaryCache(ke.REQUEST_PARAMS,t,!0)}getCachedRequest(e){this.logger.trace("BrowserCacheManager.getCachedRequest called");const t=this.getTemporaryCache(ke.REQUEST_PARAMS,!0);if(!t)throw j(OC);let n;try{n=JSON.parse(tr(t))}catch(i){throw this.logger.errorPii(`Attempted to parse: ${t}`),this.logger.error(`Parsing cached token request threw with error: ${i}`),j(NC)}if(this.removeTemporaryItem(this.generateCacheKey(ke.REQUEST_PARAMS)),!n.authority){const i=this.generateAuthorityKey(e),s=this.getTemporaryCache(i);if(!s)throw j(mh);n.authority=s}return n}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(ke.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const t=this.validateAndParseJson(e);return t||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){const t=this.getInteractionInProgress();return e?t===this.clientId:!!t}getInteractionInProgress(){const e=`${P.CACHE_PREFIX}.${ke.INTERACTION_STATUS_KEY}`;return this.getTemporaryCache(e,!1)}setInteractionInProgress(e){const t=`${P.CACHE_PREFIX}.${ke.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw j(TC);this.setTemporaryCache(t,this.clientId,!1)}else!e&&this.getInteractionInProgress()===this.clientId&&this.removeTemporaryItem(t)}getLegacyLoginHint(){const e=this.getTemporaryCache(ct.ADAL_ID_TOKEN);e&&(this.browserStorage.removeItem(ct.ADAL_ID_TOKEN),this.logger.verbose("Cached ADAL id token retrieved."));const t=this.getTemporaryCache(ct.ID_TOKEN,!0);t&&(this.browserStorage.removeItem(this.generateCacheKey(ct.ID_TOKEN)),this.logger.verbose("Cached MSAL.js v1 id token retrieved"));const n=t||e;if(n){const i=wo(n,tr);if(i.preferred_username)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint"),i.preferred_username;if(i.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),i.upn;this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, however, no account hint claim found. Enable preferred_username or upn id token claim to get SSO.")}return null}updateCredentialCacheKey(e,t){const n=oi(t);if(e!==n){const i=this.getItem(e);if(i)return this.browserStorage.removeItem(e),this.setItem(n,i),this.logger.verbose(`Updated an outdated ${t.credentialType} cache key`),n;this.logger.error(`Attempted to update an outdated ${t.credentialType} cache key but no item matching the outdated key was found in storage`)}return e}async hydrateCache(e,t){var d,f,g;const n=Nc((d=e.account)==null?void 0:d.homeAccountId,(f=e.account)==null?void 0:f.environment,e.idToken,this.clientId,e.tenantId);let i;t.claims&&(i=await this.cryptoImpl.hashString(t.claims));const s=Pc((g=e.account)==null?void 0:g.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?e.expiresOn.getTime()/1e3:0,e.extExpiresOn?e.extExpiresOn.getTime()/1e3:0,tr,void 0,e.tokenType,void 0,t.sshKid,t.claims,i),l={idToken:n,accessToken:s};return this.saveCacheRecord(l)}async saveCacheRecord(e,t,n){try{await super.saveCacheRecord(e,t,n)}catch(i){if(i instanceof ci&&this.performanceClient&&n)try{const s=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:s.refreshToken.length,cacheIdCount:s.idToken.length,cacheAtCount:s.accessToken.length},n)}catch{}throw i}}}const vD=(r,e)=>{const t={cacheLocation:Ht.MemoryStorage,temporaryCacheLocation:Ht.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new Sd(r,t,cc,e)};/*! @azure/msal-browser v3.28.1 2025-01-14 */function yD(r,e,t,n){return r.verbose("getAllAccounts called"),t?e.getAllAccounts(n):[]}function CD(r,e,t){if(e.trace("getAccount called"),Object.keys(r).length===0)return e.warning("getAccount: No accountFilter provided"),null;const n=t.getAccountInfoFilteredBy(r);return n?(e.verbose("getAccount: Account matching provided filter found, returning"),n):(e.verbose("getAccount: No matching account found, returning null"),null)}function wD(r,e,t){if(e.trace("getAccountByUsername called"),!r)return e.warning("getAccountByUsername: No username provided"),null;const n=t.getAccountInfoFilteredBy({username:r});return n?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${r}`),n):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function _D(r,e,t){if(e.trace("getAccountByHomeId called"),!r)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const n=t.getAccountInfoFilteredBy({homeAccountId:r});return n?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${r}`),n):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function TD(r,e,t){if(e.trace("getAccountByLocalId called"),!r)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const n=t.getAccountInfoFilteredBy({localAccountId:r});return n?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${r}`),n):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function ED(r,e){e.setActiveAccount(r)}function SD(r){return r.getActiveAccount()}/*! @azure/msal-browser v3.28.1 2025-01-14 */const ne={INITIALIZE_START:"msal:initializeStart",INITIALIZE_END:"msal:initializeEnd",ACCOUNT_ADDED:"msal:accountAdded",ACCOUNT_REMOVED:"msal:accountRemoved",ACTIVE_ACCOUNT_CHANGED:"msal:activeAccountChanged",LOGIN_START:"msal:loginStart",LOGIN_SUCCESS:"msal:loginSuccess",LOGIN_FAILURE:"msal:loginFailure",ACQUIRE_TOKEN_START:"msal:acquireTokenStart",ACQUIRE_TOKEN_SUCCESS:"msal:acquireTokenSuccess",ACQUIRE_TOKEN_FAILURE:"msal:acquireTokenFailure",ACQUIRE_TOKEN_NETWORK_START:"msal:acquireTokenFromNetworkStart",SSO_SILENT_START:"msal:ssoSilentStart",SSO_SILENT_SUCCESS:"msal:ssoSilentSuccess",SSO_SILENT_FAILURE:"msal:ssoSilentFailure",ACQUIRE_TOKEN_BY_CODE_START:"msal:acquireTokenByCodeStart",ACQUIRE_TOKEN_BY_CODE_SUCCESS:"msal:acquireTokenByCodeSuccess",ACQUIRE_TOKEN_BY_CODE_FAILURE:"msal:acquireTokenByCodeFailure",HANDLE_REDIRECT_START:"msal:handleRedirectStart",HANDLE_REDIRECT_END:"msal:handleRedirectEnd",POPUP_OPENED:"msal:popupOpened",LOGOUT_START:"msal:logoutStart",LOGOUT_SUCCESS:"msal:logoutSuccess",LOGOUT_FAILURE:"msal:logoutFailure",LOGOUT_END:"msal:logoutEnd",RESTORE_FROM_BFCACHE:"msal:restoreFromBFCache"};/*! @azure/msal-browser v3.28.1 2025-01-14 */class AD{constructor(e){this.eventCallbacks=new Map,this.logger=e||new qr({})}addEventCallback(e,t,n){if(typeof window<"u"){const i=n||nD();return this.eventCallbacks.has(i)?(this.logger.error(`Event callback with id: ${i} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(i,[e,t||[]]),this.logger.verbose(`Event callback registered with id: ${i}`),i)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,t,n,i){if(typeof window<"u"){const s={eventType:e,interactionType:t||null,payload:n||null,error:i||null,timestamp:Date.now()};this.eventCallbacks.forEach(([l,d],f)=>{(d.length===0||d.includes(e))&&(this.logger.verbose(`Emitting event to callback ${f}: ${e}`),l.apply(null,[s]))})}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class nw{constructor(e,t,n,i,s,l,d,f,g){this.config=e,this.browserStorage=t,this.browserCrypto=n,this.networkClient=this.config.system.networkClient,this.eventHandler=s,this.navigationClient=l,this.nativeMessageHandler=f,this.correlationId=g||Sr(),this.logger=i.clone(tn.MSAL_SKU,Hc,this.correlationId),this.performanceClient=d}async clearCacheOnLogout(e){if(e){at.accountInfoIsEqual(e,this.browserStorage.getActiveAccount(),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null));try{await this.browserStorage.removeAccount(at.generateAccountCacheKey(e)),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch{this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),await this.browserStorage.clear(),await this.browserCrypto.clearKeystore()}catch{this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const t=e||this.config.auth.redirectUri;return ye.getAbsoluteUrl(t,Cr())}initializeServerTelemetryManager(e,t){this.logger.verbose("initializeServerTelemetryManager called");const n={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:t||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new ga(n,this.browserStorage)}async getDiscoveredAuthority(e){const{account:t}=e,n=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(k.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const i={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},s=e.requestAuthority||this.config.auth.authority,l=n!=null&&n.length?n==="true":this.config.auth.instanceAware,d=t&&l?this.config.auth.authority.replace(ye.getDomainFromUrl(s),t.environment):s,f=St.generateAuthority(d,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),g=await U(dC,k.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(f,this.config.system.networkClient,this.browserStorage,i,this.logger,this.correlationId,this.performanceClient);if(t&&!g.isAlias(t.environment))throw Pe(nC);return g}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const bD=32;async function ID(r,e,t){r.addQueueMeasurement(k.GeneratePkceCodes,t);const n=_o(kD,k.GenerateCodeVerifier,e,r,t)(r,e,t),i=await U(RD,k.GenerateCodeChallengeFromVerifier,e,r,t)(n,r,e,t);return{verifier:n,challenge:i}}function kD(r,e,t){try{const n=new Uint8Array(bD);return _o(Wx,k.GetRandomValues,e,r,t)(n),Fc(n)}catch{throw j(fh)}}async function RD(r,e,t,n){e.addQueueMeasurement(k.GenerateCodeChallengeFromVerifier,n);try{const i=await U(JC,k.Sha256Digest,t,e,n)(r,e,n);return Fc(new Uint8Array(i))}catch{throw j(fh)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function Ah(r,e,t,n){t.addQueueMeasurement(k.InitializeBaseRequest,r.correlationId);const i=r.authority||e.auth.authority,s=[...r&&r.scopes||[]],l={...r,correlationId:r.correlationId,authority:i,scopes:s};if(!l.authenticationScheme)l.authenticationScheme=Oe.BEARER,n.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(l.authenticationScheme===Oe.SSH){if(!r.sshJwk)throw Pe(Mc);if(!r.sshKid)throw Pe(Zy)}n.verbose(`Authentication Scheme set to "${l.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&r.claims&&!Bn.isEmptyObj(r.claims)&&(l.requestedClaimsHash=await QC(r.claims)),l}async function OD(r,e,t,n,i){n.addQueueMeasurement(k.InitializeSilentRequest,r.correlationId);const s=await U(Ah,k.InitializeBaseRequest,i,n,r.correlationId)(r,t,n,i);return{...r,...s,account:e,forceRefresh:r.forceRefresh||!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class yi extends nw{async initializeAuthorizationCodeRequest(e){this.performanceClient.addQueueMeasurement(k.StandardInteractionClientInitializeAuthorizationCodeRequest,this.correlationId);const t=await U(ID,k.GeneratePkceCodes,this.logger,this.performanceClient,this.correlationId)(this.performanceClient,this.logger,this.correlationId),n={...e,redirectUri:e.redirectUri,code:P.EMPTY_STRING,codeVerifier:t.verifier};return e.codeChallenge=t.challenge,e.codeChallengeMethod=P.S256_CODE_CHALLENGE_METHOD,n}initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const t={correlationId:this.correlationId||Sr(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const n=this.getLogoutHintFromIdTokenClaims(e.account);n&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),t.logoutHint=n)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return!e||e.postLogoutRedirectUri!==null?e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",t.correlationId),t.postLogoutRedirectUri=ye.getAbsoluteUrl(e.postLogoutRedirectUri,Cr())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",t.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",t.correlationId),t.postLogoutRedirectUri=ye.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,Cr())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",t.correlationId),t.postLogoutRedirectUri=ye.getAbsoluteUrl(Cr(),Cr())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",t.correlationId),t}getLogoutHintFromIdTokenClaims(e){const t=e.idTokenClaims;if(t){if(t.login_hint)return t.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(k.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const t=await U(this.getClientConfiguration.bind(this),k.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new gC(t,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:t,requestAuthority:n,requestAzureCloudOptions:i,requestExtraQueryParameters:s,account:l}=e;this.performanceClient.addQueueMeasurement(k.StandardInteractionClientGetClientConfiguration,this.correlationId);const d=await U(this.getDiscoveredAuthority.bind(this),k.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:n,requestAzureCloudOptions:i,requestExtraQueryParameters:s,account:l}),f=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:d,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:f.loggerCallback,piiLoggingEnabled:f.piiLoggingEnabled,logLevel:f.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:t,libraryInfo:{sku:tn.MSAL_SKU,version:Hc,cpu:P.EMPTY_STRING,os:P.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,t){this.performanceClient.addQueueMeasurement(k.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const n=this.getRedirectUri(e.redirectUri),i={interactionType:t},s=Un.setRequestState(this.browserCrypto,e&&e.state||P.EMPTY_STRING,i),d={...await U(Ah,k.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:n,state:s,nonce:e.nonce||Sr(),responseMode:this.config.auth.OIDCOptions.serverResponseType};if(e.loginHint||e.sid)return d;const f=e.account||this.browserStorage.getActiveAccount();if(f&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${f.homeAccountId}`,this.correlationId),d.account=f),!d.loginHint&&!f){const g=this.browserStorage.getLegacyLoginHint();g&&(d.loginHint=g)}return d}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const ND="ContentError",rw="user_switch";/*! @azure/msal-browser v3.28.1 2025-01-14 */const PD="USER_INTERACTION_REQUIRED",MD="USER_CANCEL",xD="NO_NETWORK",DD="PERSISTENT_ERROR",LD="DISABLED",BD="ACCOUNT_UNAVAILABLE";/*! @azure/msal-browser v3.28.1 2025-01-14 */const UD=-2147186943,VD={[rw]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class Jn extends He{constructor(e,t,n){super(e,t),Object.setPrototypeOf(this,Jn.prototype),this.name="NativeAuthError",this.ext=n}}function Zo(r){if(r.ext&&r.ext.status&&(r.ext.status===DD||r.ext.status===LD)||r.ext&&r.ext.error&&r.ext.error===UD)return!0;switch(r.errorCode){case ND:return!0;default:return!1}}function Ad(r,e,t){if(t&&t.status)switch(t.status){case BD:return pd(hC);case PD:return new Vn(r,e);case MD:return j(vo);case xD:return j(gc)}return new Jn(r,VD[r]||e,t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class ow extends yi{async acquireToken(e){this.performanceClient.addQueueMeasurement(k.SilentCacheClientAcquireToken,e.correlationId);const t=this.initializeServerTelemetryManager(Le.acquireTokenSilent_silentFlow),n=await U(this.getClientConfiguration.bind(this),k.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),i=new Ex(n,this.performanceClient);this.logger.verbose("Silent auth client created");try{const l=(await U(i.acquireCachedToken.bind(i),k.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),l}catch(s){throw s instanceof Sa&&s.errorCode===ph&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),s}}logout(e){this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(t==null?void 0:t.account)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class li extends nw{constructor(e,t,n,i,s,l,d,f,g,m,v,C){var T;super(e,t,n,i,s,l,f,g,C),this.apiId=d,this.accountId=m,this.nativeMessageHandler=g,this.nativeStorageManager=v,this.silentCacheClient=new ow(e,this.nativeStorageManager,n,i,s,l,f,g,C),this.serverTelemetryManager=this.initializeServerTelemetryManager(this.apiId);const S=this.nativeMessageHandler.getExtensionId()===ai.PREFERRED_EXTENSION_ID?"chrome":(T=this.nativeMessageHandler.getExtensionId())!=null&&T.length?"unknown":void 0;this.skus=ga.makeExtraSkuString({libraryName:tn.MSAL_SKU,libraryVersion:Hc,extensionName:S,extensionVersion:this.nativeMessageHandler.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[ax]:this.skus}}async acquireToken(e){this.performanceClient.addQueueMeasurement(k.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const t=this.performanceClient.startMeasurement(k.NativeInteractionClientAcquireToken,e.correlationId),n=rr();try{const i=await this.initializeNativeRequest(e);try{const g=await this.acquireTokensFromCache(this.accountId,i);return t.end({success:!0,isNativeBroker:!1,fromCache:!0}),g}catch{this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const{...s}=i,l={method:uo.GetToken,request:s},d=await this.nativeMessageHandler.sendMessage(l),f=this.validateNativeResponse(d);return await this.handleNativeResponse(f,i,n).then(g=>(t.end({success:!0,isNativeBroker:!0,requestId:g.requestId}),this.serverTelemetryManager.clearNativeBrokerErrorCode(),g)).catch(g=>{throw t.end({success:!1,errorCode:g.errorCode,subErrorCode:g.subError,isNativeBroker:!0}),g})}catch(i){throw i instanceof Jn&&this.serverTelemetryManager.setNativeBrokerErrorCode(i.errorCode),i}}createSilentCacheRequest(e,t){return{authority:e.authority,correlationId:this.correlationId,scopes:Je.fromString(e.scope).asArray(),account:t,forceRefresh:!1}}async acquireTokensFromCache(e,t){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),B(ud);const n=this.browserStorage.getBaseAccountInfo({nativeAccountId:e});if(!n)throw B(ud);try{const i=this.createSilentCacheRequest(t,n),s=await this.silentCacheClient.acquireToken(i),l={...n,idTokenClaims:s==null?void 0:s.idTokenClaims,idToken:s==null?void 0:s.idToken};return{...s,account:l}}catch(i){throw i}}async acquireTokenRedirect(e,t){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...n}=e;delete n.onRedirectNavigate;const i=await this.initializeNativeRequest(n),s={method:uo.GetToken,request:i};try{const f=await this.nativeMessageHandler.sendMessage(s);this.validateNativeResponse(f)}catch(f){if(f instanceof Jn&&(this.serverTelemetryManager.setNativeBrokerErrorCode(f.errorCode),Zo(f)))throw f}this.browserStorage.setTemporaryCache(ke.NATIVE_REQUEST,JSON.stringify(i),!0);const l={apiId:Le.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);t.end({success:!0}),await this.navigationClient.navigateExternal(d,l)}async handleRedirectPromise(e,t){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const n=this.browserStorage.getCachedNativeRequest();if(!n)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&t&&(e==null||e.addFields({errorCode:"no_cached_request"},t)),null;const{prompt:i,...s}=n;i&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(ke.NATIVE_REQUEST));const l={method:uo.GetToken,request:s},d=rr();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const f=await this.nativeMessageHandler.sendMessage(l);this.validateNativeResponse(f);const g=this.handleNativeResponse(f,s,d);this.browserStorage.setInteractionInProgress(!1);const m=await g;return this.serverTelemetryManager.clearNativeBrokerErrorCode(),m}catch(f){throw this.browserStorage.setInteractionInProgress(!1),f}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,t,n){var m;this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const i=wo(e.id_token,tr),s=this.createHomeAccountIdentifier(e,i),l=(m=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:t.accountId}))==null?void 0:m.homeAccountId;if(s!==l&&e.account.id!==t.accountId)throw Ad(rw);const d=await this.getDiscoveredAuthority({requestAuthority:t.authority}),f=uh(this.browserStorage,d,s,tr,i,e.client_info,void 0,i.tid,void 0,e.account.id,this.logger),g=await this.generateAuthenticationResult(e,t,i,f,d.canonicalAuthority,n);return this.cacheAccount(f),this.cacheNativeTokens(e,t,s,i,e.access_token,g.tenantId,n),g}createHomeAccountIdentifier(e,t){return at.generateHomeAccountId(e.client_info||P.EMPTY_STRING,xn.Default,this.logger,this.browserCrypto,t)}generateScopes(e,t){return e.scope?Je.fromString(e.scope):Je.fromString(t.scope)}async generatePopAccessToken(e,t){if(t.tokenType===Oe.POP&&t.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const n=new gi(this.browserCrypto),i={resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,shrNonce:t.shrNonce};if(!t.keyId)throw B(Yd);return n.signPopToken(e.access_token,t.keyId,i)}else return e.access_token}async generateAuthenticationResult(e,t,n,i,s,l){const d=this.addTelemetryFromNativeResponse(e),f=e.scope?Je.fromString(e.scope):Je.fromString(t.scope),g=e.account.properties||{},m=g.UID||n.oid||n.sub||P.EMPTY_STRING,v=g.TenantId||n.tid||P.EMPTY_STRING,C=oh(i.getAccountInfo(),void 0,n,e.id_token);C.nativeAccountId!==e.account.id&&(C.nativeAccountId=e.account.id);const S=await this.generatePopAccessToken(e,t),T=t.tokenType===Oe.POP?Oe.POP:Oe.BEARER;return{authority:s,uniqueId:m,tenantId:v,scopes:f.asArray(),account:C,idToken:e.id_token,idTokenClaims:n,accessToken:S,fromCache:d?this.isResponseFromCache(d):!1,expiresOn:new Date(Number(l+e.expires_in)*1e3),tokenType:T,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}cacheAccount(e){this.browserStorage.setAccount(e),this.browserStorage.removeAccountContext(e).catch(t=>{this.logger.error(`Error occurred while removing account context from browser storage. ${t}`)})}cacheNativeTokens(e,t,n,i,s,l,d){const f=Nc(n,t.authority,e.id_token||"",t.clientId,i.tid||""),g=t.tokenType===Oe.POP?P.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,m=d+g,v=this.generateScopes(e,t),C=Pc(n,t.authority,s,t.clientId,i.tid||l,v.printScopes(),m,0,tr,void 0,t.tokenType,void 0,t.keyId),S={idToken:f,accessToken:C};this.nativeStorageManager.saveCacheRecord(S,t.storeInCache)}addTelemetryFromNativeResponse(e){const t=this.getMATSFromResponse(e);return t?(this.performanceClient.addFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:t.broker_version,matsAccountJoinOnStart:t.account_join_on_start,matsAccountJoinOnEnd:t.account_join_on_end,matsDeviceJoin:t.device_join,matsPromptBehavior:t.prompt_behavior,matsApiErrorCode:t.api_error_code,matsUiVisible:t.ui_visible,matsSilentCode:t.silent_code,matsSilentBiSubCode:t.silent_bi_sub_code,matsSilentMessage:t.silent_message,matsSilentStatus:t.silent_status,matsHttpStatus:t.http_status,matsHttpEventCount:t.http_event_count},this.correlationId),t):null}validateNativeResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw Ty(Kd,"Response missing expected properties.")}getMATSFromResponse(e){if(e.properties.MATS)try{return JSON.parse(e.properties.MATS)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return typeof e.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const t=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:t,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const n=new ye(t);n.validateAsUri();const{scopes:i,...s}=e,l=new Je(i||[]);l.appendScopes(vi);const d=()=>{switch(this.apiId){case Le.ssoSilent:case Le.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),dt.NONE}if(!e.prompt){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e.prompt){case dt.NONE:case dt.CONSENT:case dt.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e.prompt;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e.prompt} is not compatible with native flow`),j($C)}},f={...s,accountId:this.accountId,clientId:this.config.auth.clientId,authority:n.urlString,scope:l.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:d(),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(f.signPopToken&&e.popKid)throw j(zC);if(this.handleExtraBrokerParams(f),f.extraParameters=f.extraParameters||{},f.extraParameters.telemetry=ai.MATS_TELEMETRY,e.authenticationScheme===Oe.POP){const g={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},m=new gi(this.browserCrypto);let v;if(f.keyId)v=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:f.keyId})),f.signPopToken=!1;else{const C=await U(m.generateCnf.bind(m),k.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(g,this.logger);v=C.reqCnfString,f.keyId=C.kid,f.signPopToken=!0}f.reqCnf=v}return this.addRequestSKUs(f),f}handleExtraBrokerParams(e){var s;const t=e.extraParameters&&e.extraParameters.hasOwnProperty(sh)&&e.extraParameters.hasOwnProperty(md)&&e.extraParameters.hasOwnProperty(mo);if(!e.embeddedClientId&&!t)return;let n="";const i=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,n=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[md],n=e.extraParameters[mo]),e.extraParameters={child_client_id:n,child_redirect_uri:i},(s=this.performanceClient)==null||s.addFields({embeddedClientId:n,embeddedRedirectUri:i},e.correlationId)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Qn{constructor(e,t,n,i){this.logger=e,this.handshakeTimeoutMs=t,this.extensionId=i,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=n,this.handshakeEvent=n.startMeasurement(k.NativeMessageHandlerHandshake)}async sendMessage(e){this.logger.trace("NativeMessageHandler - sendMessage called.");const t={channel:ai.CHANNEL_ID,extensionId:this.extensionId,responseId:Sr(),body:e};return this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii(`NativeMessageHandler - Sending request to browser extension: ${JSON.stringify(t)}`),this.messageChannel.port1.postMessage(t),new Promise((n,i)=>{this.resolvers.set(t.responseId,{resolve:n,reject:i})})}static async createProvider(e,t,n){e.trace("NativeMessageHandler - createProvider called.");try{const i=new Qn(e,t,n,ai.PREFERRED_EXTENSION_ID);return await i.sendHandshakeRequest(),i}catch{const s=new Qn(e,t,n);return await s.sendHandshakeRequest(),s}}async sendHandshakeRequest(){this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:ai.CHANNEL_ID,extensionId:this.extensionId,responseId:Sr(),body:{method:uo.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=t=>{this.onChannelMessage(t)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((t,n)=>{this.handshakeResolvers.set(e.responseId,{resolve:t,reject:n}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),n(j(VC)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source!==window)return;const t=e.data;if(!(!t.channel||t.channel!==ai.CHANNEL_ID)&&!(t.extensionId&&t.extensionId!==this.extensionId)&&t.body.method===uo.HandshakeRequest){const n=this.handshakeResolvers.get(t.responseId);if(!n){this.logger.trace(`NativeMessageHandler.onWindowMessage - resolver can't be found for request ${t.responseId}`);return}this.logger.verbose(t.extensionId?`Extension with id: ${t.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),n.reject(j(FC))}}onChannelMessage(e){this.logger.trace("NativeMessageHandler - onChannelMessage called.");const t=e.data,n=this.resolvers.get(t.responseId),i=this.handshakeResolvers.get(t.responseId);try{const s=t.body.method;if(s===uo.Response){if(!n)return;const l=t.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii(`NativeMessageHandler - Received response from browser extension: ${JSON.stringify(l)}`),l.status!=="Success")n.reject(Ad(l.code,l.description,l.ext));else if(l.result)l.result.code&&l.result.description?n.reject(Ad(l.result.code,l.result.description,l.result.ext)):n.resolve(l.result);else throw Ty(Kd,"Event does not contain result.");this.resolvers.delete(t.responseId)}else if(s===uo.HandshakeResponse){if(!i){this.logger.trace(`NativeMessageHandler.onChannelMessage - resolver can't be found for request ${t.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=t.extensionId,this.extensionVersion=t.body.version,this.logger.verbose(`NativeMessageHandler - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),i.resolve(),this.handshakeResolvers.delete(t.responseId)}}catch(s){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${s}`),this.logger.errorPii(`Unable to parse ${e}`),n?n.reject(s):i&&i.reject(s)}}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}static isNativeAvailable(e,t,n,i){if(t.trace("isNativeAvailable called"),!e.system.allowNativeBroker)return t.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!n)return t.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(i)switch(i){case Oe.BEARER:case Oe.POP:return t.trace("isNativeAvailable: authenticationScheme is supported, returning true"),!0;default:return t.trace("isNativeAvailable: authenticationScheme is not supported, returning false"),!1}return!0}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class bh{constructor(e,t,n,i,s){this.authModule=e,this.browserStorage=t,this.authCodeRequest=n,this.logger=i,this.performanceClient=s}async handleCodeResponse(e,t){this.performanceClient.addQueueMeasurement(k.HandleCodeResponse,t.correlationId);let n;try{n=this.authModule.handleFragmentResponse(e,t.state)}catch(i){throw i instanceof Gr&&i.subError===vo?j(vo):i}return U(this.handleCodeResponseFromServer.bind(this),k.HandleCodeResponseFromServer,this.logger,this.performanceClient,t.correlationId)(n,t)}async handleCodeResponseFromServer(e,t,n=!0){if(this.performanceClient.addQueueMeasurement(k.HandleCodeResponseFromServer,t.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await U(this.authModule.updateAuthority.bind(this.authModule),k.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,t.correlationId)(e.cloud_instance_host_name,t.correlationId),n&&(e.nonce=t.nonce||void 0),e.state=t.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const s=this.createCcsCredentials(t);s&&(this.authCodeRequest.ccsCredential=s)}return await U(this.authModule.acquireToken.bind(this.authModule),k.AuthClientAcquireToken,this.logger,this.performanceClient,t.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:on.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:on.UPN}:null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function iw(r,e,t){const n=dc(r);if(!n)throw oC(r)?(t.error(`A ${e} is present in the iframe but it does not contain known properties. It's likely that the ${e} has been replaced by code running on the redirectUri page.`),t.errorPii(`The ${e} detected is: ${r}`),j(CC)):(t.error(`The request has returned to the redirectUri but a ${e} is not present. It's likely that the ${e} has been removed or the page has been redirected by code running on the redirectUri page.`),j(yC));return n}function FD(r,e,t){if(!r.state)throw j(gh);const n=tw(e,r.state);if(!n)throw j(wC);if(n.interactionType!==t)throw j(_C)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class HD extends yi{constructor(e,t,n,i,s,l,d,f,g,m){super(e,t,n,i,s,l,d,g,m),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=f}acquireToken(e){try{const n={popupName:this.generatePopupName(e.scopes||vi,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window};return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,n)):(this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),n.popup=this.openSizedPopup("about:blank",n),this.acquireTokenPopupAsync(e,n))}catch(t){return Promise.reject(t)}}logout(e){try{this.logger.verbose("logoutPopup called");const t=this.initializeLogoutRequest(e),n={popupName:this.generateLogoutPopupName(t),popupWindowAttributes:(e==null?void 0:e.popupWindowAttributes)||{},popupWindowParent:(e==null?void 0:e.popupWindowParent)??window},i=e&&e.authority,s=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(t,n,i,s)):(this.logger.verbose("asyncPopup set to false, opening popup"),n.popup=this.openSizedPopup("about:blank",n),this.logoutPopupAsync(t,n,i,s))}catch(t){return Promise.reject(t)}}async acquireTokenPopupAsync(e,t){var s;this.logger.verbose("acquireTokenPopupAsync called");const n=this.initializeServerTelemetryManager(Le.acquireTokenPopup),i=await U(this.initializeAuthorizationRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,X.Popup);ew(i.authority);try{const l=await U(this.initializeAuthorizationCodeRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(i),d=await U(this.createAuthCodeClient.bind(this),k.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:i.authority,requestAzureCloudOptions:i.azureCloudOptions,requestExtraQueryParameters:i.extraQueryParameters,account:i.account}),f=Qn.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme);let g;f&&(g=this.performanceClient.startMeasurement(k.FetchAccountIdWithNativeBroker,e.correlationId));const m=await d.getAuthCodeUrl({...i,nativeBroker:f}),v=new bh(d,this.browserStorage,l,this.logger,this.performanceClient),C=this.initiateAuthRequest(m,t);this.eventHandler.emitEvent(ne.POPUP_OPENED,X.Popup,{popupWindow:C},null);const S=await this.monitorPopupForHash(C,t.popupWindowParent),T=_o(iw,k.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(S,this.config.auth.OIDCOptions.serverResponseType,this.logger);if(Yn.removeThrottle(this.browserStorage,this.config.auth.clientId,l),T.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),g&&g.end({success:!0,isNativeBroker:!0}),!this.nativeMessageHandler)throw j(Ea);const O=new li(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Le.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,T.accountId,this.nativeStorage,i.correlationId),{userRequestState:$}=Un.parseRequestState(this.browserCrypto,i.state);return await O.acquireToken({...i,state:$,prompt:void 0})}return await v.handleCodeResponse(T,i)}catch(l){throw(s=t.popup)==null||s.close(),l instanceof He&&(l.setCorrelationId(this.correlationId),n.cacheFailedRequest(l)),l}}async logoutPopupAsync(e,t,n,i){var l,d,f,g;this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(ne.LOGOUT_START,X.Popup,e);const s=this.initializeServerTelemetryManager(Le.logoutPopup);try{await this.clearCacheOnLogout(e.account);const m=await U(this.createAuthCodeClient.bind(this),k.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:s,requestAuthority:n,account:e.account||void 0});try{m.authority.endSessionEndpoint}catch{if((l=e.account)!=null&&l.homeAccountId&&e.postLogoutRedirectUri&&m.authority.protocolMode===Tr.OIDC){if(this.browserStorage.removeAccount((d=e.account)==null?void 0:d.homeAccountId),this.eventHandler.emitEvent(ne.LOGOUT_SUCCESS,X.Popup,e),i){const S={apiId:Le.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},T=ye.getAbsoluteUrl(i,Cr());await this.navigationClient.navigateInternal(T,S)}(f=t.popup)==null||f.close();return}}const v=m.getLogoutUri(e);this.eventHandler.emitEvent(ne.LOGOUT_SUCCESS,X.Popup,e);const C=this.openPopup(v,t);if(this.eventHandler.emitEvent(ne.POPUP_OPENED,X.Popup,{popupWindow:C},null),await this.monitorPopupForHash(C,t.popupWindowParent).catch(()=>{}),i){const S={apiId:Le.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},T=ye.getAbsoluteUrl(i,Cr());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${T}`),await this.navigationClient.navigateInternal(T,S)}else this.logger.verbose("No main window navigation requested")}catch(m){throw(g=t.popup)==null||g.close(),m instanceof He&&(m.setCorrelationId(this.correlationId),s.cacheFailedRequest(m)),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(ne.LOGOUT_FAILURE,X.Popup,null,m),this.eventHandler.emitEvent(ne.LOGOUT_END,X.Popup),m}this.eventHandler.emitEvent(ne.LOGOUT_END,X.Popup)}initiateAuthRequest(e,t){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,t);throw this.logger.error("Navigate url is empty"),j(Bc)}monitorPopupForHash(e,t){return new Promise((n,i)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const s=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(s),i(j(vo));return}let l="";try{l=e.location.href}catch{}if(!l||l==="about:blank")return;clearInterval(s);let d="";const f=this.config.auth.OIDCOptions.serverResponseType;e&&(f===Ta.QUERY?d=e.location.search:d=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),n(d)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,t)})}openPopup(e,t){try{let n;if(t.popup?(n=t.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),n.location.assign(e)):typeof t.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),n=this.openSizedPopup(e,t)),!n)throw j(SC);return n.focus&&n.focus(),this.currentWindow=n,t.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),n}catch(n){throw this.logger.error("error opening popup "+n.message),this.browserStorage.setInteractionInProgress(!1),j(EC)}}openSizedPopup(e,{popupName:t,popupWindowAttributes:n,popupWindowParent:i}){var S,T,I,O;const s=i.screenLeft?i.screenLeft:i.screenX,l=i.screenTop?i.screenTop:i.screenY,d=i.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,f=i.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let g=(S=n.popupSize)==null?void 0:S.width,m=(T=n.popupSize)==null?void 0:T.height,v=(I=n.popupPosition)==null?void 0:I.top,C=(O=n.popupPosition)==null?void 0:O.left;return(!g||g<0||g>d)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),g=tn.POPUP_WIDTH),(!m||m<0||m>f)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),m=tn.POPUP_HEIGHT),(!v||v<0||v>f)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),v=Math.max(0,f/2-tn.POPUP_HEIGHT/2+l)),(!C||C<0||C>d)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),C=Math.max(0,d/2-tn.POPUP_WIDTH/2+s)),i.open(e,t,`width=${g}, height=${m}, top=${v}, left=${C}, scrollbars=yes`)}unloadWindow(e){this.browserStorage.cleanRequestByInteractionType(X.Popup),this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,t){e.close(),t.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)}generatePopupName(e,t){return`${tn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${t}.${this.correlationId}`}generateLogoutPopupName(e){const t=e.account&&e.account.homeAccountId;return`${tn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${t}.${this.correlationId}`}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Tp{constructor(e,t,n,i,s){this.authModule=e,this.browserStorage=t,this.authCodeRequest=n,this.logger=i,this.performanceClient=s}async initiateAuthRequest(e,t){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){t.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache(ke.ORIGIN_URI,t.redirectStartPage,!0)),this.browserStorage.setTemporaryCache(ke.CORRELATION_ID,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest),this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const n={apiId:Le.acquireTokenRedirect,timeout:t.redirectTimeout,noHistory:!1};if(typeof t.onRedirectNavigate=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),t.onRedirectNavigate(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await t.navigationClient.navigateExternal(e,n);return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation");return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),await t.navigationClient.navigateExternal(e,n);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),j(Bc)}async handleCodeResponse(e,t){this.logger.verbose("RedirectHandler.handleCodeResponse called"),this.browserStorage.setInteractionInProgress(!1);const n=this.browserStorage.generateStateKey(t),i=this.browserStorage.getTemporaryCache(n);if(!i)throw B(sc,"Cached State");let s;try{s=this.authModule.handleFragmentResponse(e,i)}catch(g){throw g instanceof Gr&&g.subError===vo?j(vo):g}const l=this.browserStorage.generateNonceKey(i),d=this.browserStorage.getTemporaryCache(l);if(this.authCodeRequest.code=s.code,s.cloud_instance_host_name&&await U(this.authModule.updateAuthority.bind(this.authModule),k.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,this.authCodeRequest.correlationId)(s.cloud_instance_host_name,this.authCodeRequest.correlationId),s.nonce=d||void 0,s.state=i,s.client_info)this.authCodeRequest.clientInfo=s.client_info;else{const g=this.checkCcsCredentials();g&&(this.authCodeRequest.ccsCredential=g)}const f=await this.authModule.acquireToken(this.authCodeRequest,s);return this.browserStorage.cleanRequestByState(t),f}checkCcsCredentials(){const e=this.browserStorage.getTemporaryCache(ke.CCS_CREDENTIAL,!0);if(e)try{return JSON.parse(e)}catch{this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii(`Cache credential could not be parsed: ${e}`)}return null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function $D(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const r=window.performance.getEntriesByType("navigation"),e=r.length?r[0]:void 0;return e==null?void 0:e.type}class KD extends yi{constructor(e,t,n,i,s,l,d,f,g,m){super(e,t,n,i,s,l,d,g,m),this.nativeStorage=f}async acquireToken(e){const t=await U(this.initializeAuthorizationRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,X.Redirect);this.browserStorage.updateCacheEntries(t.state,t.nonce,t.authority,t.loginHint||"",t.account||null);const n=this.initializeServerTelemetryManager(Le.acquireTokenRedirect),i=s=>{s.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.cleanRequestByState(t.state),this.eventHandler.emitEvent(ne.RESTORE_FROM_BFCACHE,X.Redirect))};try{const s=await U(this.initializeAuthorizationCodeRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(t),l=await U(this.createAuthCodeClient.bind(this),k.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),d=new Tp(l,this.browserStorage,s,this.logger,this.performanceClient),f=await l.getAuthCodeUrl({...t,nativeBroker:Qn.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme)}),g=this.getRedirectStartPage(e.redirectStartPage);return this.logger.verbosePii(`Redirect start page: ${g}`),window.addEventListener("pageshow",i),await d.initiateAuthRequest(f,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:g,onRedirectNavigate:e.onRedirectNavigate||this.config.auth.onRedirectNavigate})}catch(s){throw s instanceof He&&(s.setCorrelationId(this.correlationId),n.cacheFailedRequest(s)),window.removeEventListener("pageshow",i),this.browserStorage.cleanRequestByState(t.state),s}}async handleRedirectPromise(e="",t){const n=this.initializeServerTelemetryManager(Le.handleRedirectPromise);try{if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const[i,s]=this.getRedirectResponse(e||"");if(!i)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(X.Redirect),$D()!=="back_forward"?t.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const l=this.browserStorage.getTemporaryCache(ke.ORIGIN_URI,!0)||P.EMPTY_STRING,d=ye.removeHashFromUrl(l),f=ye.removeHashFromUrl(window.location.href);if(d===f&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),l.indexOf("#")>-1&&Jx(l),await this.handleResponse(i,n);if(this.config.auth.navigateToLoginRequestUrl){if(!Th()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(ke.URL_HASH,s,!0);const g={apiId:Le.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let m=!0;if(!l||l==="null"){const v=Xx();this.browserStorage.setTemporaryCache(ke.ORIGIN_URI,v,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),m=await this.navigationClient.navigateInternal(v,g)}else this.logger.verbose(`Navigating to loginRequestUrl: ${l}`),m=await this.navigationClient.navigateInternal(l,g);if(!m)return await this.handleResponse(i,n)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(i,n);return null}catch(i){throw i instanceof He&&(i.setCorrelationId(this.correlationId),n.cacheFailedRequest(i)),this.browserStorage.cleanRequestByInteractionType(X.Redirect),i}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let t=e;t||(this.config.auth.OIDCOptions.serverResponseType===Ta.QUERY?t=window.location.search:t=window.location.hash);let n=dc(t);if(n){try{FD(n,this.browserCrypto,X.Redirect)}catch(s){return s instanceof He&&this.logger.error(`Interaction type validation failed due to ${s.errorCode}: ${s.errorMessage}`),[null,""]}return Yx(window),this.logger.verbose("Hash contains known properties, returning response hash"),[n,t]}const i=this.browserStorage.getTemporaryCache(ke.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(ke.URL_HASH)),i&&(n=dc(i),n)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[n,i]):[null,""]}async handleResponse(e,t){const n=e.state;if(!n)throw j(gh);const i=this.browserStorage.getCachedRequest(n);if(this.logger.verbose("handleResponse called, retrieved cached request"),e.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw j(Ea);const f=new li(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Le.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,e.accountId,this.nativeStorage,i.correlationId),{userRequestState:g}=Un.parseRequestState(this.browserCrypto,n);return f.acquireToken({...i,state:g,prompt:void 0}).finally(()=>{this.browserStorage.cleanRequestByState(n)})}const s=this.browserStorage.getCachedAuthority(n);if(!s)throw j(mh);const l=await U(this.createAuthCodeClient.bind(this),k.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:s});return Yn.removeThrottle(this.browserStorage,this.config.auth.clientId,i),new Tp(l,this.browserStorage,i,this.logger,this.performanceClient).handleCodeResponse(e,n)}async logout(e){var i,s;this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e),n=this.initializeServerTelemetryManager(Le.logout);try{this.eventHandler.emitEvent(ne.LOGOUT_START,X.Redirect,e),await this.clearCacheOnLogout(t.account);const l={apiId:Le.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=await U(this.createAuthCodeClient.bind(this),k.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:e&&e.authority,requestExtraQueryParameters:e==null?void 0:e.extraQueryParameters,account:e&&e.account||void 0});if(d.authority.protocolMode===Tr.OIDC)try{d.authority.endSessionEndpoint}catch{if((i=t.account)!=null&&i.homeAccountId){this.browserStorage.removeAccount((s=t.account)==null?void 0:s.homeAccountId),this.eventHandler.emitEvent(ne.LOGOUT_SUCCESS,X.Redirect,t);return}}const f=d.getLogoutUri(t);if(this.eventHandler.emitEvent(ne.LOGOUT_SUCCESS,X.Redirect,t),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(f)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(f,l);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(f,l);return}}catch(l){throw l instanceof He&&(l.setCorrelationId(this.correlationId),n.cacheFailedRequest(l)),this.eventHandler.emitEvent(ne.LOGOUT_FAILURE,X.Redirect,null,l),this.eventHandler.emitEvent(ne.LOGOUT_END,X.Redirect),l}this.eventHandler.emitEvent(ne.LOGOUT_END,X.Redirect)}getRedirectStartPage(e){const t=e||window.location.href;return ye.getAbsoluteUrl(t,Cr())}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function zD(r,e,t,n,i){if(e.addQueueMeasurement(k.SilentHandlerInitiateAuthRequest,n),!r)throw t.info("Navigate url is empty"),j(Bc);return i?U(qD,k.SilentHandlerLoadFrame,t,e,n)(r,i,e,n):_o(GD,k.SilentHandlerLoadFrameSync,t,e,n)(r)}async function WD(r,e,t,n,i,s,l){return n.addQueueMeasurement(k.SilentHandlerMonitorIframeForHash,s),new Promise((d,f)=>{e<Td&&i.warning(`system.loadFrameTimeout or system.iframeHashTimeout set to lower (${e}ms) than the default (${Td}ms). This may result in timeouts.`);const g=window.setTimeout(()=>{window.clearInterval(m),f(j(AC))},e),m=window.setInterval(()=>{let v="";const C=r.contentWindow;try{v=C?C.location.href:""}catch{}if(!v||v==="about:blank")return;let S="";C&&(l===Ta.QUERY?S=C.location.search:S=C.location.hash),window.clearTimeout(g),window.clearInterval(m),d(S)},t)}).finally(()=>{_o(jD,k.RemoveHiddenIframe,i,n,s)(r)})}function qD(r,e,t,n){return t.addQueueMeasurement(k.SilentHandlerLoadFrame,n),new Promise((i,s)=>{const l=aw();window.setTimeout(()=>{if(!l){s("Unable to load iframe");return}l.src=r,i(l)},e)})}function GD(r){const e=aw();return e.src=r,e}function aw(){const r=document.createElement("iframe");return r.className="msalSilentIframe",r.style.visibility="hidden",r.style.position="absolute",r.style.width=r.style.height="0",r.style.border="0",r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(r),r}function jD(r){document.body===r.parentNode&&document.body.removeChild(r)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class YD extends yi{constructor(e,t,n,i,s,l,d,f,g,m,v){super(e,t,n,i,s,l,f,m,v),this.apiId=d,this.nativeStorage=g}async acquireToken(e){this.performanceClient.addQueueMeasurement(k.SilentIframeClientAcquireToken,e.correlationId),!e.loginHint&&!e.sid&&(!e.account||!e.account.username)&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const t={...e};t.prompt?t.prompt!==dt.NONE&&t.prompt!==dt.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${t.prompt} with ${dt.NONE}`),t.prompt=dt.NONE):t.prompt=dt.NONE;const n=await U(this.initializeAuthorizationRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,X.Silent);ew(n.authority);const i=this.initializeServerTelemetryManager(this.apiId);let s;try{return s=await U(this.createAuthCodeClient.bind(this),k.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:i,requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account}),await U(this.silentTokenHelper.bind(this),k.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(s,n)}catch(l){if(l instanceof He&&(l.setCorrelationId(this.correlationId),i.cacheFailedRequest(l)),!s||!(l instanceof He)||l.errorCode!==tn.INVALID_GRANT_ERROR)throw l;this.performanceClient.addFields({retryError:l.errorCode},this.correlationId);const d=await U(this.initializeAuthorizationRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,X.Silent);return await U(this.silentTokenHelper.bind(this),k.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(s,d)}}logout(){return Promise.reject(j(Uc))}async silentTokenHelper(e,t){const n=t.correlationId;this.performanceClient.addQueueMeasurement(k.SilentIframeClientTokenHelper,n);const i=await U(this.initializeAuthorizationCodeRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,n)(t),s=await U(e.getAuthCodeUrl.bind(e),k.GetAuthCodeUrl,this.logger,this.performanceClient,n)({...t,nativeBroker:Qn.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,t.authenticationScheme)}),l=new bh(e,this.browserStorage,i,this.logger,this.performanceClient),d=await U(zD,k.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,n)(s,this.performanceClient,this.logger,n,this.config.system.navigateFrameWait),f=this.config.auth.OIDCOptions.serverResponseType,g=await U(WD,k.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,n)(d,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,n,f),m=_o(iw,k.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(g,f,this.logger);if(m.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw j(Ea);const v=new li(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,m.accountId,this.browserStorage,n),{userRequestState:C}=Un.parseRequestState(this.browserCrypto,t.state);return U(v.acquireToken.bind(v),k.NativeInteractionClientAcquireToken,this.logger,this.performanceClient,n)({...t,state:C,prompt:t.prompt||dt.NONE})}return U(l.handleCodeResponse.bind(l),k.HandleCodeResponse,this.logger,this.performanceClient,n)(m,t)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class JD extends yi{async acquireToken(e){this.performanceClient.addQueueMeasurement(k.SilentRefreshClientAcquireToken,e.correlationId);const t=await U(Ah,k.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),n={...e,...t};e.redirectUri&&(n.redirectUri=this.getRedirectUri(e.redirectUri));const i=this.initializeServerTelemetryManager(Le.acquireTokenSilent_silentFlow),s=await this.createRefreshTokenClient({serverTelemetryManager:i,authorityUrl:n.authority,azureCloudOptions:n.azureCloudOptions,account:n.account});return U(s.acquireTokenByRefreshToken.bind(s),k.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(n).catch(l=>{throw l.setCorrelationId(this.correlationId),i.cacheFailedRequest(l),l})}logout(){return Promise.reject(j(Uc))}async createRefreshTokenClient(e){const t=await U(this.getClientConfiguration.bind(this),k.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new vd(t,this.performanceClient)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class QD{constructor(e,t,n,i){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=t,this.logger=n,this.cryptoObj=i}loadExternalTokens(e,t,n){if(!this.isBrowserEnvironment)throw j(Vc);const i=t.id_token?wo(t.id_token,tr):void 0,s={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},l=e.authority?new St(St.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,s,this.logger,e.correlationId||Sr()):void 0,d=this.loadAccount(e,n.clientInfo||t.client_info||"",i,l),f=this.loadIdToken(t,d.homeAccountId,d.environment,d.realm),g=this.loadAccessToken(e,t,d.homeAccountId,d.environment,d.realm,n),m=this.loadRefreshToken(t,d.homeAccountId,d.environment);return this.generateAuthenticationResult(e,{account:d,idToken:f,accessToken:g,refreshToken:m},i,l)}loadAccount(e,t,n,i){if(this.logger.verbose("TokenCache - loading account"),e.account){const f=at.createFromAccountInfo(e.account);return this.storage.setAccount(f),f}else if(!i||!t&&!n)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),j(xC);const s=at.generateHomeAccountId(t,i.authorityType,this.logger,this.cryptoObj,n),l=n==null?void 0:n.tid,d=uh(this.storage,i,s,tr,n,t,i.hostnameAndPort,l,void 0,void 0,this.logger);return this.storage.setAccount(d),d}loadIdToken(e,t,n,i){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const s=Nc(t,n,e.id_token,this.config.auth.clientId,i);return this.storage.setIdTokenCredential(s),s}loadAccessToken(e,t,n,i,s,l){if(t.access_token)if(t.expires_in){if(!t.scope&&(!e.scopes||!e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null}else return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;else return this.logger.verbose("TokenCache - no access token found in response"),null;this.logger.verbose("TokenCache - loading access token");const d=t.scope?Je.fromString(t.scope):new Je(e.scopes),f=l.expiresOn||t.expires_in+new Date().getTime()/1e3,g=l.extendedExpiresOn||(t.ext_expires_in||t.expires_in)+new Date().getTime()/1e3,m=Pc(n,i,t.access_token,this.config.auth.clientId,s,d.printScopes(),f,g,tr);return this.storage.setAccessTokenCredential(m),m}loadRefreshToken(e,t,n){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const i=$y(t,n,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return this.storage.setRefreshTokenCredential(i),i}generateAuthenticationResult(e,t,n,i){var m,v,C;let s="",l=[],d=null,f;t!=null&&t.accessToken&&(s=t.accessToken.secret,l=Je.fromString(t.accessToken.target).asArray(),d=new Date(Number(t.accessToken.expiresOn)*1e3),f=new Date(Number(t.accessToken.extendedExpiresOn)*1e3));const g=t.account;return{authority:i?i.canonicalAuthority:"",uniqueId:t.account.localAccountId,tenantId:t.account.realm,scopes:l,account:g.getAccountInfo(),idToken:((m=t.idToken)==null?void 0:m.secret)||"",idTokenClaims:n||{},accessToken:s,fromCache:!0,expiresOn:d,correlationId:e.correlationId||"",requestId:"",extExpiresOn:f,familyId:((v=t.refreshToken)==null?void 0:v.familyId)||"",tokenType:((C=t==null?void 0:t.accessToken)==null?void 0:C.tokenType)||"",state:e.state||"",cloudGraphHostName:g.cloudGraphHostName||"",msGraphHost:g.msGraphHost||"",fromNativeBroker:!1}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class XD extends gC{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class ZD extends yi{constructor(e,t,n,i,s,l,d,f,g,m){super(e,t,n,i,s,l,f,g,m),this.apiId=d}async acquireToken(e){if(!e.code)throw j(DC);const t=await U(this.initializeAuthorizationRequest.bind(this),k.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,X.Silent),n=this.initializeServerTelemetryManager(this.apiId);try{const i={...t,code:e.code},s=await U(this.getClientConfiguration.bind(this),k.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:n,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),l=new XD(s);this.logger.verbose("Auth code client created");const d=new bh(l,this.browserStorage,i,this.logger,this.performanceClient);return await U(d.handleCodeResponseFromServer.bind(d),k.HandleCodeResponseFromServer,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},t,!1)}catch(i){throw i instanceof He&&(i.setCorrelationId(this.correlationId),n.cacheFailedRequest(i)),i}}logout(){return Promise.reject(j(Uc))}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function qn(r){const e=r==null?void 0:r.idTokenClaims;if(e!=null&&e.tfp||e!=null&&e.acr)return"B2C";if(e!=null&&e.tid){if((e==null?void 0:e.tid)==="9188040d-6c67-4c5b-b112-36a304b66dad")return"MSA"}else return;return"AAD"}function Ns(r,e){try{Eh(r)}catch(t){throw e.end({success:!1},t),t}}class $c{constructor(e){this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new mi(this.logger,this.performanceClient):cc,this.eventHandler=new AD(this.logger),this.browserStorage=this.isBrowserEnvironment?new Sd(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,fx(this.config.auth),this.performanceClient):vD(this.config.auth.clientId,this.logger);const t={cacheLocation:Ht.MemoryStorage,temporaryCacheLocation:Ht.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new Sd(this.config.auth.clientId,t,this.browserCrypto,this.logger,void 0,this.performanceClient),this.tokenCache=new QD(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this),this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}static async createController(e,t){const n=new $c(e);return await n.initialize(t),n}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e){if(this.logger.trace("initialize called"),this.initialized){this.logger.info("initialize has already been called, exiting early.");return}if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,this.eventHandler.emitEvent(ne.INITIALIZE_END);return}const t=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),n=this.config.system.allowNativeBroker,i=this.performanceClient.startMeasurement(k.InitializeClientApplication,t);if(this.eventHandler.emitEvent(ne.INITIALIZE_START),n)try{this.nativeExtensionProvider=await Qn.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout,this.performanceClient)}catch(s){this.logger.verbose(s)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),await U(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),k.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,t)(this.performanceClient,t)),this.initialized=!0,this.eventHandler.emitEvent(ne.INITIALIZE_END),i.end({allowNativeBroker:n,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),ZC(this.initialized),this.isBrowserEnvironment){const t=e||"";let n=this.redirectResponse.get(t);return typeof n>"u"?(n=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(t,n),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),n}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){const t=this.getAllAccounts(),n=this.browserStorage.getCachedNativeRequest(),i=n&&Qn.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!e,s=i?n==null?void 0:n.correlationId:this.browserStorage.getTemporaryCache(ke.CORRELATION_ID,!0)||"",l=this.performanceClient.startMeasurement(k.AcquireTokenRedirect,s);this.eventHandler.emitEvent(ne.HANDLE_REDIRECT_START,X.Redirect);let d;if(i&&this.nativeExtensionProvider){this.logger.trace("handleRedirectPromise - acquiring token from native platform");const f=new li(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Le.handleRedirectPromise,this.performanceClient,this.nativeExtensionProvider,n.accountId,this.nativeInternalStorage,n.correlationId);d=U(f.handleRedirectPromise.bind(f),k.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,l.event.correlationId)(this.performanceClient,l.event.correlationId)}else{this.logger.trace("handleRedirectPromise - acquiring token from web flow");const f=this.createRedirectClient(s);d=U(f.handleRedirectPromise.bind(f),k.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,l.event.correlationId)(e,l)}return d.then(f=>(f?(t.length<this.getAllAccounts().length?(this.eventHandler.emitEvent(ne.LOGIN_SUCCESS,X.Redirect,f),this.logger.verbose("handleRedirectResponse returned result, login success")):(this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_SUCCESS,X.Redirect,f),this.logger.verbose("handleRedirectResponse returned result, acquire token success")),l.end({success:!0,accountType:qn(f.account)})):l.event.errorCode?l.end({success:!1}):l.discard(),this.eventHandler.emitEvent(ne.HANDLE_REDIRECT_END,X.Redirect),f)).catch(f=>{const g=f;throw t.length>0?this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_FAILURE,X.Redirect,null,g):this.eventHandler.emitEvent(ne.LOGIN_FAILURE,X.Redirect,null,g),this.eventHandler.emitEvent(ne.HANDLE_REDIRECT_END,X.Redirect),l.end({success:!1},g),f})}async acquireTokenRedirect(e){const t=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",t);const n=this.performanceClient.startMeasurement(k.AcquireTokenPreRedirect,t);n.add({accountType:qn(e.account),scenarioId:e.scenarioId});const i=e.onRedirectNavigate;if(i)e.onRedirectNavigate=l=>{const d=typeof i=="function"?i(l):void 0;return d!==!1?n.end({success:!0}):n.discard(),d};else{const l=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=d=>{const f=typeof l=="function"?l(d):void 0;return f!==!1?n.end({success:!0}):n.discard(),f}}const s=this.getAllAccounts().length>0;try{yp(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),s?this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_START,X.Redirect,e):this.eventHandler.emitEvent(ne.LOGIN_START,X.Redirect,e);let l;return this.nativeExtensionProvider&&this.canUseNative(e)?l=new li(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Le.acquireTokenRedirect,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(e),this.nativeInternalStorage,t).acquireTokenRedirect(e,n).catch(f=>{if(f instanceof Jn&&Zo(f))return this.nativeExtensionProvider=void 0,this.createRedirectClient(t).acquireToken(e);if(f instanceof Vn)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),f}):l=this.createRedirectClient(t).acquireToken(e),await l}catch(l){throw n.end({success:!1},l),s?this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_FAILURE,X.Redirect,null,l):this.eventHandler.emitEvent(ne.LOGIN_FAILURE,X.Redirect,null,l),l}}acquireTokenPopup(e){const t=this.getRequestCorrelationId(e),n=this.performanceClient.startMeasurement(k.AcquireTokenPopup,t);n.add({scenarioId:e.scenarioId,accountType:qn(e.account)});try{this.logger.verbose("acquireTokenPopup called",t),Ns(this.initialized,n),this.browserStorage.setInteractionInProgress(!0)}catch(l){return Promise.reject(l)}const i=this.getAllAccounts();i.length>0?this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_START,X.Popup,e):this.eventHandler.emitEvent(ne.LOGIN_START,X.Popup,e);let s;return this.canUseNative(e)?s=this.acquireTokenNative({...e,correlationId:t},Le.acquireTokenPopup).then(l=>(this.browserStorage.setInteractionInProgress(!1),n.end({success:!0,isNativeBroker:!0,accountType:qn(l.account)}),l)).catch(l=>{if(l instanceof Jn&&Zo(l))return this.nativeExtensionProvider=void 0,this.createPopupClient(t).acquireToken(e);if(l instanceof Vn)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),l}):s=this.createPopupClient(t).acquireToken(e),s.then(l=>(i.length<this.getAllAccounts().length?this.eventHandler.emitEvent(ne.LOGIN_SUCCESS,X.Popup,l):this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_SUCCESS,X.Popup,l),n.end({success:!0,accessTokenSize:l.accessToken.length,idTokenSize:l.idToken.length,accountType:qn(l.account)}),l)).catch(l=>(i.length>0?this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_FAILURE,X.Popup,null,l):this.eventHandler.emitEvent(ne.LOGIN_FAILURE,X.Popup,null,l),n.end({success:!1},l),Promise.reject(l)))}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){var s,l;const t=this.getRequestCorrelationId(e),n={...e,prompt:e.prompt,correlationId:t};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(k.SsoSilent,t),(s=this.ssoSilentMeasurement)==null||s.add({scenarioId:e.scenarioId,accountType:qn(e.account)}),Ns(this.initialized,this.ssoSilentMeasurement),(l=this.ssoSilentMeasurement)==null||l.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",t),this.eventHandler.emitEvent(ne.SSO_SILENT_START,X.Silent,n);let i;return this.canUseNative(n)?i=this.acquireTokenNative(n,Le.ssoSilent).catch(d=>{if(d instanceof Jn&&Zo(d))return this.nativeExtensionProvider=void 0,this.createSilentIframeClient(n.correlationId).acquireToken(n);throw d}):i=this.createSilentIframeClient(n.correlationId).acquireToken(n),i.then(d=>{var f;return this.eventHandler.emitEvent(ne.SSO_SILENT_SUCCESS,X.Silent,d),(f=this.ssoSilentMeasurement)==null||f.end({success:!0,isNativeBroker:d.fromNativeBroker,accessTokenSize:d.accessToken.length,idTokenSize:d.idToken.length,accountType:qn(d.account)}),d}).catch(d=>{var f;throw this.eventHandler.emitEvent(ne.SSO_SILENT_FAILURE,X.Silent,null,d),(f=this.ssoSilentMeasurement)==null||f.end({success:!1},d),d}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const t=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",t);const n=this.performanceClient.startMeasurement(k.AcquireTokenByCode,t);Ns(this.initialized,n),this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_BY_CODE_START,X.Silent,e),n.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw j(BC);if(e.code){const i=e.code;let s=this.hybridAuthCodeResponses.get(i);return s?(this.logger.verbose("Existing acquireTokenByCode request found",t),n.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",t),s=this.acquireTokenByCodeAsync({...e,correlationId:t}).then(l=>(this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_BY_CODE_SUCCESS,X.Silent,l),this.hybridAuthCodeResponses.delete(i),n.end({success:!0,isNativeBroker:l.fromNativeBroker,accessTokenSize:l.accessToken.length,idTokenSize:l.idToken.length,accountType:qn(l.account)}),l)).catch(l=>{throw this.hybridAuthCodeResponses.delete(i),this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_BY_CODE_FAILURE,X.Silent,null,l),n.end({success:!1},l),l}),this.hybridAuthCodeResponses.set(i,s)),await s}else if(e.nativeAccountId)if(this.canUseNative(e,e.nativeAccountId)){const i=await this.acquireTokenNative({...e,correlationId:t},Le.acquireTokenByCode,e.nativeAccountId).catch(s=>{throw s instanceof Jn&&Zo(s)&&(this.nativeExtensionProvider=void 0),s});return n.end({accountType:qn(i.account),success:!0}),i}else throw j(UC);else throw j(LC)}catch(i){throw this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_BY_CODE_FAILURE,X.Silent,null,i),n.end({success:!1},i),i}}async acquireTokenByCodeAsync(e){var i;return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(k.AcquireTokenByCodeAsync,e.correlationId),(i=this.acquireTokenByCodeAsyncMeasurement)==null||i.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(s=>{var l;return(l=this.acquireTokenByCodeAsyncMeasurement)==null||l.end({success:!0,fromCache:s.fromCache,isNativeBroker:s.fromNativeBroker}),s}).catch(s=>{var l;throw(l=this.acquireTokenByCodeAsyncMeasurement)==null||l.end({success:!1},s),s}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,t){switch(this.performanceClient.addQueueMeasurement(k.AcquireTokenFromCache,e.correlationId),t){case Zt.Default:case Zt.AccessToken:case Zt.AccessTokenAndRefreshToken:const n=this.createSilentCacheClient(e.correlationId);return U(n.acquireToken.bind(n),k.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw B(yr)}}async acquireTokenByRefreshToken(e,t){switch(this.performanceClient.addQueueMeasurement(k.AcquireTokenByRefreshToken,e.correlationId),t){case Zt.Default:case Zt.AccessTokenAndRefreshToken:case Zt.RefreshToken:case Zt.RefreshTokenAndNetwork:const n=this.createSilentRefreshClient(e.correlationId);return U(n.acquireToken.bind(n),k.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw B(yr)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(k.AcquireTokenBySilentIframe,e.correlationId);const t=this.createSilentIframeClient(e.correlationId);return U(t.acquireToken.bind(t),k.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const t=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",t),this.logoutRedirect({correlationId:t,...e})}async logoutRedirect(e){const t=this.getRequestCorrelationId(e);return yp(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),this.createRedirectClient(t).logout(e)}logoutPopup(e){try{const t=this.getRequestCorrelationId(e);return Eh(this.initialized),this.browserStorage.setInteractionInProgress(!0),this.createPopupClient(t).logout(e)}catch(t){return Promise.reject(t)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const t=this.getRequestCorrelationId(e);return this.createSilentCacheClient(t).logout(e)}getAllAccounts(e){return yD(this.logger,this.browserStorage,this.isBrowserEnvironment,e)}getAccount(e){return CD(e,this.logger,this.browserStorage)}getAccountByUsername(e){return wD(e,this.logger,this.browserStorage)}getAccountByHomeId(e){return _D(e,this.logger,this.browserStorage)}getAccountByLocalId(e){return TD(e,this.logger,this.browserStorage)}setActiveAccount(e){ED(e,this.browserStorage)}getActiveAccount(){return SD(this.browserStorage)}async hydrateCache(e,t){this.logger.verbose("hydrateCache called");const n=at.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return this.browserStorage.setAccount(n),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,t)):this.browserStorage.hydrateCache(e,t)}async acquireTokenNative(e,t,n){if(this.logger.trace("acquireTokenNative called"),!this.nativeExtensionProvider)throw j(Ea);return new li(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,t,this.performanceClient,this.nativeExtensionProvider,n||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e)}canUseNative(e,t){if(this.logger.trace("canUseNative called"),!Qn.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme))return this.logger.trace("canUseNative: isNativeAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case dt.NONE:case dt.CONSENT:case dt.LOGIN:this.logger.trace("canUseNative: prompt is compatible with native flow");break;default:return this.logger.trace(`canUseNative: prompt = ${e.prompt} is not compatible with native flow, returning false`),!1}return!t&&!this.getNativeAccountId(e)?(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const t=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return t&&t.nativeAccountId||""}createPopupClient(e){return new HD(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createRedirectClient(e){return new KD(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentIframeClient(e){return new YD(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Le.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentCacheClient(e){return new ow(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentRefreshClient(e){return new JD(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentAuthCodeClient(e){return new ZD(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Le.acquireTokenByCode,this.performanceClient,this.nativeExtensionProvider,e)}addEventCallback(e,t){return this.eventHandler.addEventCallback(e,t)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return XC(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?this.logger.verbose("Account storage listener already registered."):(this.logger.verbose("Adding account storage listener."),this.listeningToStorageEvents=!0,window.addEventListener("storage",this.handleAccountCacheChange)))}disableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?(this.logger.verbose("Removing account storage listener."),window.removeEventListener("storage",this.handleAccountCacheChange),this.listeningToStorageEvents=!1):this.logger.verbose("No account storage listener registered."))}handleAccountCacheChange(e){var t;try{(t=e.key)!=null&&t.includes(ct.ACTIVE_ACCOUNT_FILTERS)&&this.eventHandler.emitEvent(ne.ACTIVE_ACCOUNT_CHANGED);const n=e.newValue||e.oldValue;if(!n)return;const i=JSON.parse(n);if(typeof i!="object"||!at.isAccountEntity(i))return;const l=fi.toObject(new at,i).getAccountInfo();!e.oldValue&&e.newValue?(this.logger.info("Account was added to cache in a different window"),this.eventHandler.emitEvent(ne.ACCOUNT_ADDED,void 0,l)):!e.newValue&&e.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.eventHandler.emitEvent(ne.ACCOUNT_REMOVED,void 0,l))}catch{return}}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,t){this.browserStorage.setWrapperMetadata(e,t)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?Sr():P.EMPTY_STRING}async loginRedirect(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",t),this.acquireTokenRedirect({correlationId:t,...e||mp})}loginPopup(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",t),this.acquireTokenPopup({correlationId:t,...e||mp})}async acquireTokenSilent(e){const t=this.getRequestCorrelationId(e),n=this.performanceClient.startMeasurement(k.AcquireTokenSilent,t);n.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),Ns(this.initialized,n),this.logger.verbose("acquireTokenSilent called",t);const i=e.account||this.getActiveAccount();if(!i)throw j(RC);n.add({accountType:qn(i)});const s={clientId:this.config.auth.clientId,authority:e.authority||P.EMPTY_STRING,scopes:e.scopes,homeAccountIdentifier:i.homeAccountId,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,shrOptions:e.shrOptions},l=JSON.stringify(s),d=this.activeSilentTokenRequests.get(l);if(typeof d>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",t);const f=U(this.acquireTokenSilentAsync.bind(this),k.AcquireTokenSilentAsync,this.logger,this.performanceClient,t)({...e,correlationId:t},i).then(g=>(this.activeSilentTokenRequests.delete(l),n.end({success:!0,fromCache:g.fromCache,isNativeBroker:g.fromNativeBroker,cacheLookupPolicy:e.cacheLookupPolicy,accessTokenSize:g.accessToken.length,idTokenSize:g.idToken.length}),g)).catch(g=>{throw this.activeSilentTokenRequests.delete(l),n.end({success:!1},g),g});return this.activeSilentTokenRequests.set(l,f),{...await f,state:e.state}}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",t),n.discard(),{...await d,state:e.state}}async acquireTokenSilentAsync(e,t){const n=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(k.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_START,X.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",n);const i=await U(OD,k.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,t,this.config,this.performanceClient,this.logger),s=e.cacheLookupPolicy||Zt.Default;return this.acquireTokenSilentNoIframe(i,s).catch(async d=>{if(eL(d,s))if(this.activeIframeRequest)if(s!==Zt.Skip){const[g,m]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${m}`,i.correlationId);const v=this.performanceClient.startMeasurement(k.AwaitConcurrentIframe,i.correlationId);v.add({awaitIframeCorrelationId:m});const C=await g;if(v.end({success:C}),C)return this.logger.verbose(`Parallel iframe request with correlationId: ${m} succeeded. Retrying cache and/or RT redemption`,i.correlationId),this.acquireTokenSilentNoIframe(i,s);throw this.logger.info(`Iframe request with correlationId: ${m} failed. Interaction is required.`),d}else return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",i.correlationId),U(this.acquireTokenBySilentIframe.bind(this),k.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i);else{let g;return this.activeIframeRequest=[new Promise(m=>{g=m}),i.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",i.correlationId),U(this.acquireTokenBySilentIframe.bind(this),k.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i).then(m=>(g(!0),m)).catch(m=>{throw g(!1),m}).finally(()=>{this.activeIframeRequest=void 0})}else throw d}).then(d=>(this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_SUCCESS,X.Silent,d),e.correlationId&&this.performanceClient.addFields({fromCache:d.fromCache,isNativeBroker:d.fromNativeBroker},e.correlationId),d)).catch(d=>{throw this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_FAILURE,X.Silent,null,d),d}).finally(()=>{document.removeEventListener("visibilitychange",n)})}async acquireTokenSilentNoIframe(e,t){return Qn.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,Le.acquireTokenSilent_silentFlow).catch(async n=>{throw n instanceof Jn&&Zo(n)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0,B(yr)):n})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),U(this.acquireTokenFromCache.bind(this),k.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,t).catch(n=>{if(t===Zt.AccessToken)throw n;return this.eventHandler.emitEvent(ne.ACQUIRE_TOKEN_NETWORK_START,X.Silent,e),U(this.acquireTokenByRefreshToken.bind(this),k.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,t)}))}}function eL(r,e){const t=!(r instanceof Vn&&r.subError!==Lc),n=r.errorCode===tn.INVALID_GRANT_ERROR||r.errorCode===yr,i=t&&n||r.errorCode===fc||r.errorCode===lh,s=Bx.includes(e);return i&&s}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function tL(r,e){const t=new yo(r);return await t.initialize(),$c.createController(t,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ih{static async createPublicClientApplication(e){const t=await tL(e);return new Ih(e,t)}constructor(e,t){this.controller=t||new $c(new yo(e))}async initialize(e){return this.controller.initialize(e)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,t){return this.controller.addEventCallback(e,t)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,t){return this.controller.initializeWrapperLibrary(e,t)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,t){return this.controller.hydrateCache(e,t)}clearCache(e){return this.controller.clearCache(e)}}const Vu=process.env.JPLAN_WEBAPP__APP_PROXY_TENANT_NAME??"",nL=process.env.JPLAN_WEBAPP__APP_PROXY_CLIENT_ID??"",rL=process.env.JPLAN_WEBAPP__APP_PROXY_USER_FLOW??"",oL=process.env.JPLAN_WEBAPP__URL_AUTH??process.env.JPLAN_WEBAPP__URL_BASE??"",iL={auth:{clientId:nL,authority:`https://${Vu}.b2clogin.com/${Vu}.onmicrosoft.com/${rL}`,knownAuthorities:[`${Vu}.b2clogin.com`],redirectUri:oL},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(r,e)=>{r===xe.Error&&console.error(e)},logLevel:xe.Warning}}},Et=new Ih(iL),Ep=c.ref(null);function sw(){async function r(e){var t;if(e)try{const n=e.idTokenClaims;if(!(n!=null&&n.aud))throw new Error("User audience (aud) is missing in ID token claims");const i=localStorage.getItem(`msal.token.keys.${n.aud}`);if(!i)throw new Error(`Token keys para ${n.aud} não encontrados no localStorage`);const s=JSON.parse(i),l=(t=s==null?void 0:s.idToken)==null?void 0:t[0];if(!l)throw new Error("idToken não encontrado nos token keys");const d=localStorage.getItem(l);if(!d)throw new Error(`Dados do token para ID ${l} não encontrados no localStorage`);const f=JSON.parse(d),g=f==null?void 0:f.secret;if(!g)throw new Error("Secret não encontrado nos dados do token");sessionStorage.setItem("isAuthenticated","true"),Ep.value=g}catch(n){console.error("Erro ao obter token de acesso:",n)}}return{jToken:Ep,setJToken:r}}const aL=()=>process.env.JPLAN_WEBAPP__URL_AUTH||"http://localhost:5173/_/dashboard",pr=c.ref(null),Ps=c.ref(null);function cw(){const{setJToken:r}=sw(),e=c.computed(()=>!!pr.value),t=c.computed(()=>pr.value);async function n(g){if(!e.value)switch(g){case"redirect":await s();break;case"tab":await i();break;default:await s();break}}const i=async()=>new Promise((g,m)=>{try{localStorage.clear();const v=window.open(aL());if(!v){console.error("Failed to open authentication window"),m("Failed to open authentication window");return}const C=Date.now(),S=6e4,T=setInterval(()=>{if(Date.now()-C>S||v.closed){clearInterval(T),console.error("Authentication canceled or timeout reached."),m("Authentication canceled or timeout reached.");return}Object.keys(localStorage).some(O=>O.startsWith("msal.account.keys"))&&(clearInterval(T),l(),v.close(),g())},500)}catch(v){console.error("Error in handleRedirect:",v),m(v)}}),s=async()=>{try{await Et.initialize();const g=Et.getActiveAccount();if(console.log("activeAccount",g),g){pr.value=g;return}if(!await Et.handleRedirectPromise()||Et.getAllAccounts().length===0){await Et.initialize();const v=sL();await Et.loginRedirect(v);return}}catch(g){console.error("handleRedirect failed",g)}},l=async()=>{try{await Et.initialize();const g=Et.getActiveAccount();if(g)pr.value=g;else{const m=await Et.handleRedirectPromise();m?(Et.setActiveAccount(m.account),pr.value=Et.getActiveAccount()):console.error("Falha na autenticação")}}catch(g){console.error("Erro no processo de autenticação:",g)}pr.value&&await r(pr.value)};async function d(){Ps.value="updating";try{const g=await Et.acquireTokenSilent({scopes:["https://graph.microsoft.com/.default","openid","profile"]});Et.setActiveAccount(g.account),await r(pr.value),Ps.value="updated"}catch(g){console.error("Falha ao renovar token, forçando novo login.",g),Ps.value="error",await n()}}const f=async()=>{try{await Et.initialize(),localStorage.clear(),await Et.logoutRedirect({postLogoutRedirectUri:"/"})}catch(g){console.error("Logout error",g)}};return c.watch(pr,async(g,m)=>{var C,S,T;if(((C=g==null?void 0:g.idTokenClaims)==null?void 0:C.exp)===((S=m==null?void 0:m.idTokenClaims)==null?void 0:S.exp))return;const v=(T=g==null?void 0:g.idTokenClaims)==null?void 0:T.exp;if(v){const I=Math.floor(Date.now()/1e3),$=(v-I-120)*1e3;$>0&&setTimeout(async()=>{await d()},$)}},{immediate:!0}),{isAuthenticated:e,authState:Ps,account:t,refreshToken:d,handleRedirect:n,logout:f}}const sL=r=>{let e=window.location.href;return window.location.pathname==="/"&&(e="/_/dashboard/"),{scopes:["https://graph.microsoft.com/.default","openid","profile"],redirectStartPage:e,extraQueryParameters:r}};function lw(r,e){return function(){return r.apply(e,arguments)}}const{toString:cL}=Object.prototype,{getPrototypeOf:kh}=Object,Kc=(r=>e=>{const t=cL.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),$n=r=>(r=r.toLowerCase(),e=>Kc(e)===r),zc=r=>e=>typeof e===r,{isArray:Ci}=Array,pa=zc("undefined");function lL(r){return r!==null&&!pa(r)&&r.constructor!==null&&!pa(r.constructor)&&an(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const uw=$n("ArrayBuffer");function uL(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&uw(r.buffer),e}const dL=zc("string"),an=zc("function"),dw=zc("number"),Wc=r=>r!==null&&typeof r=="object",hL=r=>r===!0||r===!1,js=r=>{if(Kc(r)!=="object")return!1;const e=kh(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},fL=$n("Date"),gL=$n("File"),mL=$n("Blob"),pL=$n("FileList"),vL=r=>Wc(r)&&an(r.pipe),yL=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||an(r.append)&&((e=Kc(r))==="formdata"||e==="object"&&an(r.toString)&&r.toString()==="[object FormData]"))},CL=$n("URLSearchParams"),[wL,_L,TL,EL]=["ReadableStream","Request","Response","Headers"].map($n),SL=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Aa(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,i;if(typeof r!="object"&&(r=[r]),Ci(r))for(n=0,i=r.length;n<i;n++)e.call(null,r[n],n,r);else{const s=t?Object.getOwnPropertyNames(r):Object.keys(r),l=s.length;let d;for(n=0;n<l;n++)d=s[n],e.call(null,r[d],d,r)}}function hw(r,e){e=e.toLowerCase();const t=Object.keys(r);let n=t.length,i;for(;n-- >0;)if(i=t[n],e===i.toLowerCase())return i;return null}const ho=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,fw=r=>!pa(r)&&r!==ho;function bd(){const{caseless:r}=fw(this)&&this||{},e={},t=(n,i)=>{const s=r&&hw(e,i)||i;js(e[s])&&js(n)?e[s]=bd(e[s],n):js(n)?e[s]=bd({},n):Ci(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Aa(arguments[n],t);return e}const AL=(r,e,t,{allOwnKeys:n}={})=>(Aa(e,(i,s)=>{t&&an(i)?r[s]=lw(i,t):r[s]=i},{allOwnKeys:n}),r),bL=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),IL=(r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},kL=(r,e,t,n)=>{let i,s,l;const d={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),s=i.length;s-- >0;)l=i[s],(!n||n(l,r,e))&&!d[l]&&(e[l]=r[l],d[l]=!0);r=t!==!1&&kh(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},RL=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const n=r.indexOf(e,t);return n!==-1&&n===t},OL=r=>{if(!r)return null;if(Ci(r))return r;let e=r.length;if(!dw(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},NL=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&kh(Uint8Array)),PL=(r,e)=>{const n=(r&&r[Symbol.iterator]).call(r);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(r,s[0],s[1])}},ML=(r,e)=>{let t;const n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},xL=$n("HTMLFormElement"),DL=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,i){return n.toUpperCase()+i}),Sp=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),LL=$n("RegExp"),gw=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),n={};Aa(t,(i,s)=>{let l;(l=e(i,s,r))!==!1&&(n[s]=l||i)}),Object.defineProperties(r,n)},BL=r=>{gw(r,(e,t)=>{if(an(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=r[t];if(an(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},UL=(r,e)=>{const t={},n=i=>{i.forEach(s=>{t[s]=!0})};return Ci(r)?n(r):n(String(r).split(e)),t},VL=()=>{},FL=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e,Fu="abcdefghijklmnopqrstuvwxyz",Ap="0123456789",mw={DIGIT:Ap,ALPHA:Fu,ALPHA_DIGIT:Fu+Fu.toUpperCase()+Ap},HL=(r=16,e=mw.ALPHA_DIGIT)=>{let t="";const{length:n}=e;for(;r--;)t+=e[Math.random()*n|0];return t};function $L(r){return!!(r&&an(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}const KL=r=>{const e=new Array(10),t=(n,i)=>{if(Wc(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Ci(n)?[]:{};return Aa(n,(l,d)=>{const f=t(l,i+1);!pa(f)&&(s[d]=f)}),e[i]=void 0,s}}return n};return t(r,0)},zL=$n("AsyncFunction"),WL=r=>r&&(Wc(r)||an(r))&&an(r.then)&&an(r.catch),pw=((r,e)=>r?setImmediate:e?((t,n)=>(ho.addEventListener("message",({source:i,data:s})=>{i===ho&&s===t&&n.length&&n.shift()()},!1),i=>{n.push(i),ho.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",an(ho.postMessage)),qL=typeof queueMicrotask<"u"?queueMicrotask.bind(ho):typeof process<"u"&&process.nextTick||pw,N={isArray:Ci,isArrayBuffer:uw,isBuffer:lL,isFormData:yL,isArrayBufferView:uL,isString:dL,isNumber:dw,isBoolean:hL,isObject:Wc,isPlainObject:js,isReadableStream:wL,isRequest:_L,isResponse:TL,isHeaders:EL,isUndefined:pa,isDate:fL,isFile:gL,isBlob:mL,isRegExp:LL,isFunction:an,isStream:vL,isURLSearchParams:CL,isTypedArray:NL,isFileList:pL,forEach:Aa,merge:bd,extend:AL,trim:SL,stripBOM:bL,inherits:IL,toFlatObject:kL,kindOf:Kc,kindOfTest:$n,endsWith:RL,toArray:OL,forEachEntry:PL,matchAll:ML,isHTMLForm:xL,hasOwnProperty:Sp,hasOwnProp:Sp,reduceDescriptors:gw,freezeMethods:BL,toObjectSet:UL,toCamelCase:DL,noop:VL,toFiniteNumber:FL,findKey:hw,global:ho,isContextDefined:fw,ALPHABET:mw,generateString:HL,isSpecCompliantForm:$L,toJSONObject:KL,isAsyncFn:zL,isThenable:WL,setImmediate:pw,asap:qL};function ue(r,e,t,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}N.inherits(ue,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:N.toJSONObject(this.config),code:this.code,status:this.status}}});const vw=ue.prototype,yw={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{yw[r]={value:r}});Object.defineProperties(ue,yw);Object.defineProperty(vw,"isAxiosError",{value:!0});ue.from=(r,e,t,n,i,s)=>{const l=Object.create(vw);return N.toFlatObject(r,l,function(f){return f!==Error.prototype},d=>d!=="isAxiosError"),ue.call(l,r.message,e,t,n,i),l.cause=r,l.name=r.name,s&&Object.assign(l,s),l};const GL=null;function Id(r){return N.isPlainObject(r)||N.isArray(r)}function Cw(r){return N.endsWith(r,"[]")?r.slice(0,-2):r}function bp(r,e,t){return r?r.concat(e).map(function(i,s){return i=Cw(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function jL(r){return N.isArray(r)&&!r.some(Id)}const YL=N.toFlatObject(N,{},null,function(e){return/^is[A-Z]/.test(e)});function qc(r,e,t){if(!N.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=N.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(I,O){return!N.isUndefined(O[I])});const n=t.metaTokens,i=t.visitor||m,s=t.dots,l=t.indexes,f=(t.Blob||typeof Blob<"u"&&Blob)&&N.isSpecCompliantForm(e);if(!N.isFunction(i))throw new TypeError("visitor must be a function");function g(T){if(T===null)return"";if(N.isDate(T))return T.toISOString();if(!f&&N.isBlob(T))throw new ue("Blob is not supported. Use a Buffer instead.");return N.isArrayBuffer(T)||N.isTypedArray(T)?f&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function m(T,I,O){let $=T;if(T&&!O&&typeof T=="object"){if(N.endsWith(I,"{}"))I=n?I:I.slice(0,-2),T=JSON.stringify(T);else if(N.isArray(T)&&jL(T)||(N.isFileList(T)||N.endsWith(I,"[]"))&&($=N.toArray(T)))return I=Cw(I),$.forEach(function(H,z){!(N.isUndefined(H)||H===null)&&e.append(l===!0?bp([I],z,s):l===null?I:I+"[]",g(H))}),!1}return Id(T)?!0:(e.append(bp(O,I,s),g(T)),!1)}const v=[],C=Object.assign(YL,{defaultVisitor:m,convertValue:g,isVisitable:Id});function S(T,I){if(!N.isUndefined(T)){if(v.indexOf(T)!==-1)throw Error("Circular reference detected in "+I.join("."));v.push(T),N.forEach(T,function($,F){(!(N.isUndefined($)||$===null)&&i.call(e,$,N.isString(F)?F.trim():F,I,C))===!0&&S($,I?I.concat(F):[F])}),v.pop()}}if(!N.isObject(r))throw new TypeError("data must be an object");return S(r),e}function Ip(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function Rh(r,e){this._pairs=[],r&&qc(r,this,e)}const ww=Rh.prototype;ww.append=function(e,t){this._pairs.push([e,t])};ww.toString=function(e){const t=e?function(n){return e.call(this,n,Ip)}:Ip;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function JL(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function _w(r,e,t){if(!e)return r;const n=t&&t.encode||JL;N.isFunction(t)&&(t={serialize:t});const i=t&&t.serialize;let s;if(i?s=i(e,t):s=N.isURLSearchParams(e)?e.toString():new Rh(e,t).toString(n),s){const l=r.indexOf("#");l!==-1&&(r=r.slice(0,l)),r+=(r.indexOf("?")===-1?"?":"&")+s}return r}class kp{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){N.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Tw={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},QL=typeof URLSearchParams<"u"?URLSearchParams:Rh,XL=typeof FormData<"u"?FormData:null,ZL=typeof Blob<"u"?Blob:null,eB={isBrowser:!0,classes:{URLSearchParams:QL,FormData:XL,Blob:ZL},protocols:["http","https","file","blob","url","data"]},Oh=typeof window<"u"&&typeof document<"u",kd=typeof navigator=="object"&&navigator||void 0,tB=Oh&&(!kd||["ReactNative","NativeScript","NS"].indexOf(kd.product)<0),nB=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",rB=Oh&&window.location.href||"http://localhost",oB=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Oh,hasStandardBrowserEnv:tB,hasStandardBrowserWebWorkerEnv:nB,navigator:kd,origin:rB},Symbol.toStringTag,{value:"Module"})),It={...oB,...eB};function iB(r,e){return qc(r,new It.classes.URLSearchParams,Object.assign({visitor:function(t,n,i,s){return It.isNode&&N.isBuffer(t)?(this.append(n,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function aB(r){return N.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function sB(r){const e={},t=Object.keys(r);let n;const i=t.length;let s;for(n=0;n<i;n++)s=t[n],e[s]=r[s];return e}function Ew(r){function e(t,n,i,s){let l=t[s++];if(l==="__proto__")return!0;const d=Number.isFinite(+l),f=s>=t.length;return l=!l&&N.isArray(i)?i.length:l,f?(N.hasOwnProp(i,l)?i[l]=[i[l],n]:i[l]=n,!d):((!i[l]||!N.isObject(i[l]))&&(i[l]=[]),e(t,n,i[l],s)&&N.isArray(i[l])&&(i[l]=sB(i[l])),!d)}if(N.isFormData(r)&&N.isFunction(r.entries)){const t={};return N.forEachEntry(r,(n,i)=>{e(aB(n),i,t,0)}),t}return null}function cB(r,e,t){if(N.isString(r))try{return(e||JSON.parse)(r),N.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}const ba={transitional:Tw,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,s=N.isObject(e);if(s&&N.isHTMLForm(e)&&(e=new FormData(e)),N.isFormData(e))return i?JSON.stringify(Ew(e)):e;if(N.isArrayBuffer(e)||N.isBuffer(e)||N.isStream(e)||N.isFile(e)||N.isBlob(e)||N.isReadableStream(e))return e;if(N.isArrayBufferView(e))return e.buffer;if(N.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let d;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return iB(e,this.formSerializer).toString();if((d=N.isFileList(e))||n.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return qc(d?{"files[]":e}:e,f&&new f,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),cB(e)):e}],transformResponse:[function(e){const t=this.transitional||ba.transitional,n=t&&t.forcedJSONParsing,i=this.responseType==="json";if(N.isResponse(e)||N.isReadableStream(e))return e;if(e&&N.isString(e)&&(n&&!this.responseType||i)){const l=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(d){if(l)throw d.name==="SyntaxError"?ue.from(d,ue.ERR_BAD_RESPONSE,this,null,this.response):d}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:It.classes.FormData,Blob:It.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};N.forEach(["delete","get","head","post","put","patch"],r=>{ba.headers[r]={}});const lB=N.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),uB=r=>{const e={};let t,n,i;return r&&r.split(`
57
57
  `).forEach(function(l){i=l.indexOf(":"),t=l.substring(0,i).trim().toLowerCase(),n=l.substring(i+1).trim(),!(!t||e[t]&&lB[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)}),e},Rp=Symbol("internals");function Gi(r){return r&&String(r).trim().toLowerCase()}function Ys(r){return r===!1||r==null?r:N.isArray(r)?r.map(Ys):String(r)}function dB(r){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=t.exec(r);)e[n[1]]=n[2];return e}const hB=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function Hu(r,e,t,n,i){if(N.isFunction(n))return n.call(this,e,t);if(i&&(e=t),!!N.isString(e)){if(N.isString(n))return e.indexOf(n)!==-1;if(N.isRegExp(n))return n.test(e)}}function fB(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function gB(r,e){const t=N.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(r,n+t,{value:function(i,s,l){return this[n].call(this,e,i,s,l)},configurable:!0})})}class $t{constructor(e){e&&this.set(e)}set(e,t,n){const i=this;function s(d,f,g){const m=Gi(f);if(!m)throw new Error("header name must be a non-empty string");const v=N.findKey(i,m);(!v||i[v]===void 0||g===!0||g===void 0&&i[v]!==!1)&&(i[v||f]=Ys(d))}const l=(d,f)=>N.forEach(d,(g,m)=>s(g,m,f));if(N.isPlainObject(e)||e instanceof this.constructor)l(e,t);else if(N.isString(e)&&(e=e.trim())&&!hB(e))l(uB(e),t);else if(N.isHeaders(e))for(const[d,f]of e.entries())s(f,d,n);else e!=null&&s(t,e,n);return this}get(e,t){if(e=Gi(e),e){const n=N.findKey(this,e);if(n){const i=this[n];if(!t)return i;if(t===!0)return dB(i);if(N.isFunction(t))return t.call(this,i,n);if(N.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Gi(e),e){const n=N.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||Hu(this,this[n],n,t)))}return!1}delete(e,t){const n=this;let i=!1;function s(l){if(l=Gi(l),l){const d=N.findKey(n,l);d&&(!t||Hu(n,n[d],d,t))&&(delete n[d],i=!0)}}return N.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let n=t.length,i=!1;for(;n--;){const s=t[n];(!e||Hu(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,n={};return N.forEach(this,(i,s)=>{const l=N.findKey(n,s);if(l){t[l]=Ys(i),delete t[s];return}const d=e?fB(s):String(s).trim();d!==s&&delete t[s],t[d]=Ys(i),n[d]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return N.forEach(this,(n,i)=>{n!=null&&n!==!1&&(t[i]=e&&N.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
58
58
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[Rp]=this[Rp]={accessors:{}}).accessors,i=this.prototype;function s(l){const d=Gi(l);n[d]||(gB(i,l),n[d]=!0)}return N.isArray(e)?e.forEach(s):s(e),this}}$t.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);N.reduceDescriptors($t.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(n){this[t]=n}}});N.freezeMethods($t);function $u(r,e){const t=this||ba,n=e||t,i=$t.from(n.headers);let s=n.data;return N.forEach(r,function(d){s=d.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function Sw(r){return!!(r&&r.__CANCEL__)}function wi(r,e,t){ue.call(this,r??"canceled",ue.ERR_CANCELED,e,t),this.name="CanceledError"}N.inherits(wi,ue,{__CANCEL__:!0});function Aw(r,e,t){const n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new ue("Request failed with status code "+t.status,[ue.ERR_BAD_REQUEST,ue.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function mB(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function pB(r,e){r=r||10;const t=new Array(r),n=new Array(r);let i=0,s=0,l;return e=e!==void 0?e:1e3,function(f){const g=Date.now(),m=n[s];l||(l=g),t[i]=f,n[i]=g;let v=s,C=0;for(;v!==i;)C+=t[v++],v=v%r;if(i=(i+1)%r,i===s&&(s=(s+1)%r),g-l<e)return;const S=m&&g-m;return S?Math.round(C*1e3/S):void 0}}function vB(r,e){let t=0,n=1e3/e,i,s;const l=(g,m=Date.now())=>{t=m,i=null,s&&(clearTimeout(s),s=null),r.apply(null,g)};return[(...g)=>{const m=Date.now(),v=m-t;v>=n?l(g,m):(i=g,s||(s=setTimeout(()=>{s=null,l(i)},n-v)))},()=>i&&l(i)]}const vc=(r,e,t=3)=>{let n=0;const i=pB(50,250);return vB(s=>{const l=s.loaded,d=s.lengthComputable?s.total:void 0,f=l-n,g=i(f),m=l<=d;n=l;const v={loaded:l,total:d,progress:d?l/d:void 0,bytes:f,rate:g||void 0,estimated:g&&d&&m?(d-l)/g:void 0,event:s,lengthComputable:d!=null,[e?"download":"upload"]:!0};r(v)},t)},Op=(r,e)=>{const t=r!=null;return[n=>e[0]({lengthComputable:t,total:r,loaded:n}),e[1]]},Np=r=>(...e)=>N.asap(()=>r(...e)),yB=It.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,It.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(It.origin),It.navigator&&/(msie|trident)/i.test(It.navigator.userAgent)):()=>!0,CB=It.hasStandardBrowserEnv?{write(r,e,t,n,i,s){const l=[r+"="+encodeURIComponent(e)];N.isNumber(t)&&l.push("expires="+new Date(t).toGMTString()),N.isString(n)&&l.push("path="+n),N.isString(i)&&l.push("domain="+i),s===!0&&l.push("secure"),document.cookie=l.join("; ")},read(r){const e=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function wB(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function _B(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function bw(r,e){return r&&!wB(e)?_B(r,e):e}const Pp=r=>r instanceof $t?{...r}:r;function Co(r,e){e=e||{};const t={};function n(g,m,v,C){return N.isPlainObject(g)&&N.isPlainObject(m)?N.merge.call({caseless:C},g,m):N.isPlainObject(m)?N.merge({},m):N.isArray(m)?m.slice():m}function i(g,m,v,C){if(N.isUndefined(m)){if(!N.isUndefined(g))return n(void 0,g,v,C)}else return n(g,m,v,C)}function s(g,m){if(!N.isUndefined(m))return n(void 0,m)}function l(g,m){if(N.isUndefined(m)){if(!N.isUndefined(g))return n(void 0,g)}else return n(void 0,m)}function d(g,m,v){if(v in e)return n(g,m);if(v in r)return n(void 0,g)}const f={url:s,method:s,data:s,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:d,headers:(g,m,v)=>i(Pp(g),Pp(m),v,!0)};return N.forEach(Object.keys(Object.assign({},r,e)),function(m){const v=f[m]||i,C=v(r[m],e[m],m);N.isUndefined(C)&&v!==d||(t[m]=C)}),t}const Iw=r=>{const e=Co({},r);let{data:t,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:l,auth:d}=e;e.headers=l=$t.from(l),e.url=_w(bw(e.baseURL,e.url),r.params,r.paramsSerializer),d&&l.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):"")));let f;if(N.isFormData(t)){if(It.hasStandardBrowserEnv||It.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if((f=l.getContentType())!==!1){const[g,...m]=f?f.split(";").map(v=>v.trim()).filter(Boolean):[];l.setContentType([g||"multipart/form-data",...m].join("; "))}}if(It.hasStandardBrowserEnv&&(n&&N.isFunction(n)&&(n=n(e)),n||n!==!1&&yB(e.url))){const g=i&&s&&CB.read(s);g&&l.set(i,g)}return e},TB=typeof XMLHttpRequest<"u",EB=TB&&function(r){return new Promise(function(t,n){const i=Iw(r);let s=i.data;const l=$t.from(i.headers).normalize();let{responseType:d,onUploadProgress:f,onDownloadProgress:g}=i,m,v,C,S,T;function I(){S&&S(),T&&T(),i.cancelToken&&i.cancelToken.unsubscribe(m),i.signal&&i.signal.removeEventListener("abort",m)}let O=new XMLHttpRequest;O.open(i.method.toUpperCase(),i.url,!0),O.timeout=i.timeout;function $(){if(!O)return;const H=$t.from("getAllResponseHeaders"in O&&O.getAllResponseHeaders()),Q={data:!d||d==="text"||d==="json"?O.responseText:O.response,status:O.status,statusText:O.statusText,headers:H,config:r,request:O};Aw(function(W){t(W),I()},function(W){n(W),I()},Q),O=null}"onloadend"in O?O.onloadend=$:O.onreadystatechange=function(){!O||O.readyState!==4||O.status===0&&!(O.responseURL&&O.responseURL.indexOf("file:")===0)||setTimeout($)},O.onabort=function(){O&&(n(new ue("Request aborted",ue.ECONNABORTED,r,O)),O=null)},O.onerror=function(){n(new ue("Network Error",ue.ERR_NETWORK,r,O)),O=null},O.ontimeout=function(){let z=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const Q=i.transitional||Tw;i.timeoutErrorMessage&&(z=i.timeoutErrorMessage),n(new ue(z,Q.clarifyTimeoutError?ue.ETIMEDOUT:ue.ECONNABORTED,r,O)),O=null},s===void 0&&l.setContentType(null),"setRequestHeader"in O&&N.forEach(l.toJSON(),function(z,Q){O.setRequestHeader(Q,z)}),N.isUndefined(i.withCredentials)||(O.withCredentials=!!i.withCredentials),d&&d!=="json"&&(O.responseType=i.responseType),g&&([C,T]=vc(g,!0),O.addEventListener("progress",C)),f&&O.upload&&([v,S]=vc(f),O.upload.addEventListener("progress",v),O.upload.addEventListener("loadend",S)),(i.cancelToken||i.signal)&&(m=H=>{O&&(n(!H||H.type?new wi(null,r,O):H),O.abort(),O=null)},i.cancelToken&&i.cancelToken.subscribe(m),i.signal&&(i.signal.aborted?m():i.signal.addEventListener("abort",m)));const F=mB(i.url);if(F&&It.protocols.indexOf(F)===-1){n(new ue("Unsupported protocol "+F+":",ue.ERR_BAD_REQUEST,r));return}O.send(s||null)})},SB=(r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let n=new AbortController,i;const s=function(g){if(!i){i=!0,d();const m=g instanceof Error?g:this.reason;n.abort(m instanceof ue?m:new wi(m instanceof Error?m.message:m))}};let l=e&&setTimeout(()=>{l=null,s(new ue(`timeout ${e} of ms exceeded`,ue.ETIMEDOUT))},e);const d=()=>{r&&(l&&clearTimeout(l),l=null,r.forEach(g=>{g.unsubscribe?g.unsubscribe(s):g.removeEventListener("abort",s)}),r=null)};r.forEach(g=>g.addEventListener("abort",s));const{signal:f}=n;return f.unsubscribe=()=>N.asap(d),f}},AB=function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let n=0,i;for(;n<t;)i=n+e,yield r.slice(n,i),n=i},bB=async function*(r,e){for await(const t of IB(r))yield*AB(t,e)},IB=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},Mp=(r,e,t,n)=>{const i=bB(r,e);let s=0,l,d=f=>{l||(l=!0,n&&n(f))};return new ReadableStream({async pull(f){try{const{done:g,value:m}=await i.next();if(g){d(),f.close();return}let v=m.byteLength;if(t){let C=s+=v;t(C)}f.enqueue(new Uint8Array(m))}catch(g){throw d(g),g}},cancel(f){return d(f),i.return()}},{highWaterMark:2})},Gc=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",kw=Gc&&typeof ReadableStream=="function",kB=Gc&&(typeof TextEncoder=="function"?(r=>e=>r.encode(e))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),Rw=(r,...e)=>{try{return!!r(...e)}catch{return!1}},RB=kw&&Rw(()=>{let r=!1;const e=new Request(It.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!e}),xp=64*1024,Rd=kw&&Rw(()=>N.isReadableStream(new Response("").body)),yc={stream:Rd&&(r=>r.body)};Gc&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!yc[e]&&(yc[e]=N.isFunction(r[e])?t=>t[e]():(t,n)=>{throw new ue(`Response type '${e}' is not supported`,ue.ERR_NOT_SUPPORT,n)})})})(new Response);const OB=async r=>{if(r==null)return 0;if(N.isBlob(r))return r.size;if(N.isSpecCompliantForm(r))return(await new Request(It.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(N.isArrayBufferView(r)||N.isArrayBuffer(r))return r.byteLength;if(N.isURLSearchParams(r)&&(r=r+""),N.isString(r))return(await kB(r)).byteLength},NB=async(r,e)=>{const t=N.toFiniteNumber(r.getContentLength());return t??OB(e)},PB=Gc&&(async r=>{let{url:e,method:t,data:n,signal:i,cancelToken:s,timeout:l,onDownloadProgress:d,onUploadProgress:f,responseType:g,headers:m,withCredentials:v="same-origin",fetchOptions:C}=Iw(r);g=g?(g+"").toLowerCase():"text";let S=SB([i,s&&s.toAbortSignal()],l),T;const I=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let O;try{if(f&&RB&&t!=="get"&&t!=="head"&&(O=await NB(m,n))!==0){let Q=new Request(e,{method:"POST",body:n,duplex:"half"}),we;if(N.isFormData(n)&&(we=Q.headers.get("content-type"))&&m.setContentType(we),Q.body){const[W,tt]=Op(O,vc(Np(f)));n=Mp(Q.body,xp,W,tt)}}N.isString(v)||(v=v?"include":"omit");const $="credentials"in Request.prototype;T=new Request(e,{...C,signal:S,method:t.toUpperCase(),headers:m.normalize().toJSON(),body:n,duplex:"half",credentials:$?v:void 0});let F=await fetch(T);const H=Rd&&(g==="stream"||g==="response");if(Rd&&(d||H&&I)){const Q={};["status","statusText","headers"].forEach(Te=>{Q[Te]=F[Te]});const we=N.toFiniteNumber(F.headers.get("content-length")),[W,tt]=d&&Op(we,vc(Np(d),!0))||[];F=new Response(Mp(F.body,xp,W,()=>{tt&&tt(),I&&I()}),Q)}g=g||"text";let z=await yc[N.findKey(yc,g)||"text"](F,r);return!H&&I&&I(),await new Promise((Q,we)=>{Aw(Q,we,{data:z,headers:$t.from(F.headers),status:F.status,statusText:F.statusText,config:r,request:T})})}catch($){throw I&&I(),$&&$.name==="TypeError"&&/fetch/i.test($.message)?Object.assign(new ue("Network Error",ue.ERR_NETWORK,r,T),{cause:$.cause||$}):ue.from($,$&&$.code,r,T)}}),Od={http:GL,xhr:EB,fetch:PB};N.forEach(Od,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const Dp=r=>`- ${r}`,MB=r=>N.isFunction(r)||r===null||r===!1,Ow={getAdapter:r=>{r=N.isArray(r)?r:[r];const{length:e}=r;let t,n;const i={};for(let s=0;s<e;s++){t=r[s];let l;if(n=t,!MB(t)&&(n=Od[(l=String(t)).toLowerCase()],n===void 0))throw new ue(`Unknown adapter '${l}'`);if(n)break;i[l||"#"+s]=n}if(!n){const s=Object.entries(i).map(([d,f])=>`adapter ${d} `+(f===!1?"is not supported by the environment":"is not available in the build"));let l=e?s.length>1?`since :
59
59
  `+s.map(Dp).join(`
@@ -84,4 +84,4 @@ __p += '`),ve&&(L+=`' +
84
84
  function print() { __p += __j.call(arguments, '') }
85
85
  `:`;
86
86
  `)+L+`return __p
87
- }`;var he=cm(function(){return Se(w,J+"return "+L).apply(t,_)});if(he.source=L,su(he))throw he;return he}function PI(o){return be(o).toLowerCase()}function MI(o){return be(o).toUpperCase()}function xI(o,a,u){if(o=be(o),o&&(u||a===t))return vf(o);if(!o||!(a=qt(a)))return o;var h=kn(o),p=kn(a),w=yf(h,p),_=Cf(h,p)+1;return Mr(h,w,_).join("")}function DI(o,a,u){if(o=be(o),o&&(u||a===t))return o.slice(0,_f(o)+1);if(!o||!(a=qt(a)))return o;var h=kn(o),p=Cf(h,kn(a))+1;return Mr(h,0,p).join("")}function LI(o,a,u){if(o=be(o),o&&(u||a===t))return o.replace(sl,"");if(!o||!(a=qt(a)))return o;var h=kn(o),p=yf(h,kn(a));return Mr(h,p).join("")}function BI(o,a){var u=Y,h=G;if($e(a)){var p="separator"in a?a.separator:p;u="length"in a?de(a.length):u,h="omission"in a?qt(a.omission):h}o=be(o);var w=o.length;if(bo(o)){var _=kn(o);w=_.length}if(u>=w)return o;var E=u-Io(h);if(E<1)return h;var b=_?Mr(_,0,E).join(""):o.slice(0,E);if(p===t)return b+h;if(_&&(E+=b.length-E),cu(p)){if(o.slice(E).search(p)){var x,D=b;for(p.global||(p=Sl(p.source,be(Uh.exec(p))+"g")),p.lastIndex=0;x=p.exec(D);)var L=x.index;b=b.slice(0,L===t?E:L)}}else if(o.indexOf(qt(p),E)!=E){var K=b.lastIndexOf(p);K>-1&&(b=b.slice(0,K))}return b+h}function UI(o){return o=be(o),o&&Yw.test(o)?o.replace(Dh,fT):o}var VI=xo(function(o,a,u){return o+(u?" ":"")+a.toUpperCase()}),du=lg("toUpperCase");function sm(o,a,u){return o=be(o),a=u?t:a,a===t?cT(o)?pT(o):Z_(o):o.match(a)||[]}var cm=fe(function(o,a){try{return zt(o,t,a)}catch(u){return su(u)?u:new se(u)}}),FI=lr(function(o,a){return ln(a,function(u){u=Wn(u),sr(o,u,iu(o[u],o))}),o});function HI(o){var a=o==null?0:o.length,u=Z();return o=a?Ve(o,function(h){if(typeof h[1]!="function")throw new un(l);return[u(h[0]),h[1]]}):[],fe(function(h){for(var p=-1;++p<a;){var w=o[p];if(zt(w[0],this,h))return zt(w[1],this,h)}})}function $I(o){return fE(hn(o,v))}function hu(o){return function(){return o}}function KI(o,a){return o==null||o!==o?a:o}var zI=dg(),WI=dg(!0);function Bt(o){return o}function fu(o){return Hf(typeof o=="function"?o:hn(o,v))}function qI(o){return Kf(hn(o,v))}function GI(o,a){return zf(o,hn(a,v))}var jI=fe(function(o,a){return function(u){return Fi(u,o,a)}}),YI=fe(function(o,a){return function(u){return Fi(o,u,a)}});function gu(o,a,u){var h=st(a),p=Za(a,h);u==null&&!($e(a)&&(p.length||!h.length))&&(u=a,a=o,o=this,p=Za(a,st(a)));var w=!($e(u)&&"chain"in u)||!!u.chain,_=dr(o);return ln(p,function(E){var b=a[E];o[E]=b,_&&(o.prototype[E]=function(){var x=this.__chain__;if(w||x){var D=o(this.__wrapped__),L=D.__actions__=xt(this.__actions__);return L.push({func:b,args:arguments,thisArg:o}),D.__chain__=x,D}return b.apply(o,Ir([this.value()],arguments))})}),o}function JI(){return ht._===this&&(ht._=TT),this}function mu(){}function QI(o){return o=de(o),fe(function(a){return Wf(a,o)})}var XI=ql(Ve),ZI=ql(hf),ek=ql(vl);function lm(o){return Zl(o)?yl(Wn(o)):OE(o)}function tk(o){return function(a){return o==null?t:Zr(o,a)}}var nk=fg(),rk=fg(!0);function pu(){return[]}function vu(){return!1}function ok(){return{}}function ik(){return""}function ak(){return!0}function sk(o,a){if(o=de(o),o<1||o>Qe)return[];var u=Kt,h=wt(o,Kt);a=Z(a),o-=Kt;for(var p=_l(h,a);++u<o;)a(u);return p}function ck(o){return ce(o)?Ve(o,Wn):Gt(o)?[o]:xt(Rg(be(o)))}function lk(o){var a=++wT;return be(o)+a}var uk=is(function(o,a){return o+a},0),dk=Gl("ceil"),hk=is(function(o,a){return o/a},1),fk=Gl("floor");function gk(o){return o&&o.length?Xa(o,Bt,Pl):t}function mk(o,a){return o&&o.length?Xa(o,Z(a,2),Pl):t}function pk(o){return mf(o,Bt)}function vk(o,a){return mf(o,Z(a,2))}function yk(o){return o&&o.length?Xa(o,Bt,Ll):t}function Ck(o,a){return o&&o.length?Xa(o,Z(a,2),Ll):t}var wk=is(function(o,a){return o*a},1),_k=Gl("round"),Tk=is(function(o,a){return o-a},0);function Ek(o){return o&&o.length?wl(o,Bt):0}function Sk(o,a){return o&&o.length?wl(o,Z(a,2)):0}return y.after=qA,y.ary=Fg,y.assign=Mb,y.assignIn=em,y.assignInWith=ys,y.assignWith=xb,y.at=Db,y.before=Hg,y.bind=iu,y.bindAll=FI,y.bindKey=$g,y.castArray=ob,y.chain=Bg,y.chunk=fS,y.compact=gS,y.concat=mS,y.cond=HI,y.conforms=$I,y.constant=hu,y.countBy=EA,y.create=Lb,y.curry=Kg,y.curryRight=zg,y.debounce=Wg,y.defaults=Bb,y.defaultsDeep=Ub,y.defer=GA,y.delay=jA,y.difference=pS,y.differenceBy=vS,y.differenceWith=yS,y.drop=CS,y.dropRight=wS,y.dropRightWhile=_S,y.dropWhile=TS,y.fill=ES,y.filter=AA,y.flatMap=kA,y.flatMapDeep=RA,y.flatMapDepth=OA,y.flatten=Mg,y.flattenDeep=SS,y.flattenDepth=AS,y.flip=YA,y.flow=zI,y.flowRight=WI,y.fromPairs=bS,y.functions=Wb,y.functionsIn=qb,y.groupBy=NA,y.initial=kS,y.intersection=RS,y.intersectionBy=OS,y.intersectionWith=NS,y.invert=jb,y.invertBy=Yb,y.invokeMap=MA,y.iteratee=fu,y.keyBy=xA,y.keys=st,y.keysIn=Lt,y.map=hs,y.mapKeys=Qb,y.mapValues=Xb,y.matches=qI,y.matchesProperty=GI,y.memoize=gs,y.merge=Zb,y.mergeWith=tm,y.method=jI,y.methodOf=YI,y.mixin=gu,y.negate=ms,y.nthArg=QI,y.omit=eI,y.omitBy=tI,y.once=JA,y.orderBy=DA,y.over=XI,y.overArgs=QA,y.overEvery=ZI,y.overSome=ek,y.partial=au,y.partialRight=qg,y.partition=LA,y.pick=nI,y.pickBy=nm,y.property=lm,y.propertyOf=tk,y.pull=DS,y.pullAll=Dg,y.pullAllBy=LS,y.pullAllWith=BS,y.pullAt=US,y.range=nk,y.rangeRight=rk,y.rearg=XA,y.reject=VA,y.remove=VS,y.rest=ZA,y.reverse=ru,y.sampleSize=HA,y.set=oI,y.setWith=iI,y.shuffle=$A,y.slice=FS,y.sortBy=WA,y.sortedUniq=GS,y.sortedUniqBy=jS,y.split=kI,y.spread=eb,y.tail=YS,y.take=JS,y.takeRight=QS,y.takeRightWhile=XS,y.takeWhile=ZS,y.tap=gA,y.throttle=tb,y.thru=ds,y.toArray=Qg,y.toPairs=rm,y.toPairsIn=om,y.toPath=ck,y.toPlainObject=Zg,y.transform=aI,y.unary=nb,y.union=eA,y.unionBy=tA,y.unionWith=nA,y.uniq=rA,y.uniqBy=oA,y.uniqWith=iA,y.unset=sI,y.unzip=ou,y.unzipWith=Lg,y.update=cI,y.updateWith=lI,y.values=Bo,y.valuesIn=uI,y.without=aA,y.words=sm,y.wrap=rb,y.xor=sA,y.xorBy=cA,y.xorWith=lA,y.zip=uA,y.zipObject=dA,y.zipObjectDeep=hA,y.zipWith=fA,y.entries=rm,y.entriesIn=om,y.extend=em,y.extendWith=ys,gu(y,y),y.add=uk,y.attempt=cm,y.camelCase=gI,y.capitalize=im,y.ceil=dk,y.clamp=dI,y.clone=ib,y.cloneDeep=sb,y.cloneDeepWith=cb,y.cloneWith=ab,y.conformsTo=lb,y.deburr=am,y.defaultTo=KI,y.divide=hk,y.endsWith=mI,y.eq=On,y.escape=pI,y.escapeRegExp=vI,y.every=SA,y.find=bA,y.findIndex=Ng,y.findKey=Vb,y.findLast=IA,y.findLastIndex=Pg,y.findLastKey=Fb,y.floor=fk,y.forEach=Ug,y.forEachRight=Vg,y.forIn=Hb,y.forInRight=$b,y.forOwn=Kb,y.forOwnRight=zb,y.get=lu,y.gt=ub,y.gte=db,y.has=Gb,y.hasIn=uu,y.head=xg,y.identity=Bt,y.includes=PA,y.indexOf=IS,y.inRange=hI,y.invoke=Jb,y.isArguments=no,y.isArray=ce,y.isArrayBuffer=hb,y.isArrayLike=Dt,y.isArrayLikeObject=je,y.isBoolean=fb,y.isBuffer=xr,y.isDate=gb,y.isElement=mb,y.isEmpty=pb,y.isEqual=vb,y.isEqualWith=yb,y.isError=su,y.isFinite=Cb,y.isFunction=dr,y.isInteger=Gg,y.isLength=ps,y.isMap=jg,y.isMatch=wb,y.isMatchWith=_b,y.isNaN=Tb,y.isNative=Eb,y.isNil=Ab,y.isNull=Sb,y.isNumber=Yg,y.isObject=$e,y.isObjectLike=ze,y.isPlainObject=qi,y.isRegExp=cu,y.isSafeInteger=bb,y.isSet=Jg,y.isString=vs,y.isSymbol=Gt,y.isTypedArray=Lo,y.isUndefined=Ib,y.isWeakMap=kb,y.isWeakSet=Rb,y.join=PS,y.kebabCase=yI,y.last=gn,y.lastIndexOf=MS,y.lowerCase=CI,y.lowerFirst=wI,y.lt=Ob,y.lte=Nb,y.max=gk,y.maxBy=mk,y.mean=pk,y.meanBy=vk,y.min=yk,y.minBy=Ck,y.stubArray=pu,y.stubFalse=vu,y.stubObject=ok,y.stubString=ik,y.stubTrue=ak,y.multiply=wk,y.nth=xS,y.noConflict=JI,y.noop=mu,y.now=fs,y.pad=_I,y.padEnd=TI,y.padStart=EI,y.parseInt=SI,y.random=fI,y.reduce=BA,y.reduceRight=UA,y.repeat=AI,y.replace=bI,y.result=rI,y.round=_k,y.runInContext=A,y.sample=FA,y.size=KA,y.snakeCase=II,y.some=zA,y.sortedIndex=HS,y.sortedIndexBy=$S,y.sortedIndexOf=KS,y.sortedLastIndex=zS,y.sortedLastIndexBy=WS,y.sortedLastIndexOf=qS,y.startCase=RI,y.startsWith=OI,y.subtract=Tk,y.sum=Ek,y.sumBy=Sk,y.template=NI,y.times=sk,y.toFinite=hr,y.toInteger=de,y.toLength=Xg,y.toLower=PI,y.toNumber=mn,y.toSafeInteger=Pb,y.toString=be,y.toUpper=MI,y.trim=xI,y.trimEnd=DI,y.trimStart=LI,y.truncate=BI,y.unescape=UI,y.uniqueId=lk,y.upperCase=VI,y.upperFirst=du,y.each=Ug,y.eachRight=Vg,y.first=xg,gu(y,function(){var o={};return Kn(y,function(a,u){Ie.call(y.prototype,u)||(o[u]=a)}),o}(),{chain:!1}),y.VERSION=n,ln(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){y[o].placeholder=y}),ln(["drop","take"],function(o,a){pe.prototype[o]=function(u){u=u===t?1:rt(de(u),0);var h=this.__filtered__&&!a?new pe(this):this.clone();return h.__filtered__?h.__takeCount__=wt(u,h.__takeCount__):h.__views__.push({size:wt(u,Kt),type:o+(h.__dir__<0?"Right":"")}),h},pe.prototype[o+"Right"]=function(u){return this.reverse()[o](u).reverse()}}),ln(["filter","map","takeWhile"],function(o,a){var u=a+1,h=u==yt||u==sn;pe.prototype[o]=function(p){var w=this.clone();return w.__iteratees__.push({iteratee:Z(p,3),type:u}),w.__filtered__=w.__filtered__||h,w}}),ln(["head","last"],function(o,a){var u="take"+(a?"Right":"");pe.prototype[o]=function(){return this[u](1).value()[0]}}),ln(["initial","tail"],function(o,a){var u="drop"+(a?"":"Right");pe.prototype[o]=function(){return this.__filtered__?new pe(this):this[u](1)}}),pe.prototype.compact=function(){return this.filter(Bt)},pe.prototype.find=function(o){return this.filter(o).head()},pe.prototype.findLast=function(o){return this.reverse().find(o)},pe.prototype.invokeMap=fe(function(o,a){return typeof o=="function"?new pe(this):this.map(function(u){return Fi(u,o,a)})}),pe.prototype.reject=function(o){return this.filter(ms(Z(o)))},pe.prototype.slice=function(o,a){o=de(o);var u=this;return u.__filtered__&&(o>0||a<0)?new pe(u):(o<0?u=u.takeRight(-o):o&&(u=u.drop(o)),a!==t&&(a=de(a),u=a<0?u.dropRight(-a):u.take(a-o)),u)},pe.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},pe.prototype.toArray=function(){return this.take(Kt)},Kn(pe.prototype,function(o,a){var u=/^(?:filter|find|map|reject)|While$/.test(a),h=/^(?:head|last)$/.test(a),p=y[h?"take"+(a=="last"?"Right":""):a],w=h||/^find/.test(a);p&&(y.prototype[a]=function(){var _=this.__wrapped__,E=h?[1]:arguments,b=_ instanceof pe,x=E[0],D=b||ce(_),L=function(me){var ve=p.apply(y,Ir([me],E));return h&&K?ve[0]:ve};D&&u&&typeof x=="function"&&x.length!=1&&(b=D=!1);var K=this.__chain__,J=!!this.__actions__.length,ee=w&&!K,he=b&&!J;if(!w&&D){_=he?_:new pe(this);var te=o.apply(_,E);return te.__actions__.push({func:ds,args:[L],thisArg:t}),new dn(te,K)}return ee&&he?o.apply(this,E):(te=this.thru(L),ee?h?te.value()[0]:te.value():te)})}),ln(["pop","push","shift","sort","splice","unshift"],function(o){var a=Ba[o],u=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",h=/^(?:pop|shift)$/.test(o);y.prototype[o]=function(){var p=arguments;if(h&&!this.__chain__){var w=this.value();return a.apply(ce(w)?w:[],p)}return this[u](function(_){return a.apply(ce(_)?_:[],p)})}}),Kn(pe.prototype,function(o,a){var u=y[a];if(u){var h=u.name+"";Ie.call(No,h)||(No[h]=[]),No[h].push({name:a,func:u})}}),No[os(t,$).name]=[{name:"wrapper",func:t}],pe.prototype.clone=UT,pe.prototype.reverse=VT,pe.prototype.value=FT,y.prototype.at=mA,y.prototype.chain=pA,y.prototype.commit=vA,y.prototype.next=yA,y.prototype.plant=wA,y.prototype.reverse=_A,y.prototype.toJSON=y.prototype.valueOf=y.prototype.value=TA,y.prototype.first=y.prototype.head,Mi&&(y.prototype[Mi]=CA),y},ko=vT();jr?((jr.exports=ko)._=ko,fl._=ko):ht._=ko}).call(UB)}(Zi,Zi.exports)),Zi.exports}var _i=VB();const Qs=BB(_i),FB={path:"/_/dashboard",component:()=>Promise.resolve().then(()=>require("./AuthRoute-DCvIJ43v.js")),meta:{requiresAuth:!1}},HB={path:"/jplan-auth-fail",component:()=>Promise.resolve().then(()=>require("./AuthFailRoute-BMVnt7ql.js")),meta:{requiresAuth:!1}},{isAuthenticated:Kp,handleRedirect:$B}=cw(),KB=Yc();function zB(r,e){r.addRoute(FB),r.addRoute(HB),r.beforeEach(async(t,n,i)=>{function s(d){return d.matched.some(f=>f.meta.requiresAuth)}if(!s(t))return i();if(!Kp.value){ae.value=!0;try{await $B(e),await KB.__init__()}catch(d){console.error("Fail to authenticate",d),await r.push("/jplan-auth-fail")}ae.value=!1}Kp.value&&i()})}const{scope:zp}=Yc();function WB(){const r=Ph(),e=c.ref({scope_type:"org"});async function t(n){e.value=n}return c.watch(zp,()=>{r.interceptors.request.use(n=>{const i=n.headers,s=i.Authorization;s&&(i.Authorization=s);const l=zp.value;return l&&(l.scope_type&&(i["j-scope-type"]=l.scope_type,l.organization&&(i["j-scope-organization"]=l.organization),l.team&&(i["j-scope-team"]=l.team)),l.environment&&(i["j-scope-environment"]=l.environment)),n})},{immediate:!0}),Object.assign(r,{setScope:t,scope:e})}function Ti(r){const e=WB();e.defaults.baseURL=r;const t=c.ref({scope_type:"org"});async function n(i){t.value=i}return c.watch(t,()=>{e.interceptors.request.use(i=>{const s=t.value;return delete i.headers["j-scope-type"],delete i.headers["j-scope-organization"],delete i.headers["j-scope-team"],s!=null&&s.scope_type&&(i.headers["j-scope-type"]=s.scope_type),s!=null&&s.organization&&(i.headers["j-scope-organization"]=s.organization),s!=null&&s.team&&(i.headers["j-scope-team"]=s.team),i})},{immediate:!0}),Object.assign(e,{setScope:n,scope:t})}function qB(){const r=Ti("https://api.jplan.com.br/management/organization"),{error:e}=Fn();return{async getOrgList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch Organization list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getOrgList:",n),e("Failed to fetch Organization list");return}},async createOrg(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in createOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Organization"),s}},async updateOrg(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error)throw e("Failed to update Organization"),new Error(s.data.error);return s}catch(s){throw console.error("Error in updateOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Organization"),s}},async getOrg(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error)throw e("Failed to fetch Organization"),new Error(s.data.error);return s.data}catch(s){throw console.error("Error in getOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Organization"),s}},async activateOrg(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate Organization"),new Error(s.data.error)}catch(s){throw console.error("Error in activateOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Organization"),s}},async deactivateOrg(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate Organization"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Organization"),s}}}}const Fr=qB();function GB(){const r=Ti("https://api.jplan.com.br/management/branch/"),{error:e}=Fn();return{async getBranchList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error){e("Failed to fetch Branch list");return}return i.data.data}catch(n){console.error("Error in getBranchList:",n),e("Failed to fetch Branch list")}},async createBranch(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){console.error("Error in createBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Branch")}},async updateBranch(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error){e(s.data.error||"Failed to update Branch");return}return s}catch(s){console.error("Error in updateBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Branch")}},async getBranch(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error){e(s.data.error||"Failed to fetch Branch");return}return s.data}catch(s){console.error("Error in getBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Branch")}},async activateBranch(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error){e(s.data.error||"Failed to activate Branch");return}}catch(s){console.error("Error in activateBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Branch")}},async deactivateBranch(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error){e(s.data.error||"Failed to deactivate Branch");return}}catch(s){console.error("Error in deactivateBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Branch")}}}}const Hr=GB();function jB(){const r=Ti("https://api.jplan.com.br/management/team"),{error:e}=Fn();return{async getTeamList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch Team list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getTeamList:",n),e("Failed to fetch Team list");return}},async createTeam(t){var n,i;try{const s=await r.post("/item",t);if(s.data.error)throw e("Failed to create Team"),new Error(s.data.error);return s}catch(s){throw console.error("Error in createTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Team"),s}},async updateTeam(t){var n,i;try{const s=await r.patch("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in updateTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Team"),s}},async getTeam(t){var n,i;try{const s=await r.get(`/item/${t}`);return s.data.error&&e("Failed to fetch Team"),s.data}catch(s){console.error("Error in getTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Team");return}},async activateTeam(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate Team"),new Error(s.data.error)}catch(s){throw console.error("Error in activateTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Team"),s}},async deactivateTeam(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate Team"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Team"),s}},async getTeamUserList(t,n){try{const i=n?`?filter_query=${n}`:"",s=await r.get(`/item/${t}/user/list/${i}`);if(s.data.error)throw e("Failed to fetch Team User list"),new Error(s.data.error);return s.data.data}catch(i){console.error("Error in getTeamUserList:",i),e("Failed to fetch Team User list");return}},async linkManageUser(t,n){try{const i=await r.post(`/item/${t}/user/item/`,n);if(i.data.error)throw e("Failed to link User"),new Error(i.data.error);return i.data}catch(i){console.error("Error in link User:",i),e("Failed to link User");return}},async updateManageUser(t,n){try{const i=await r.patch(`/item/${t}/user/item/`,n);if(i.data.error)throw e("Failed to update User"),new Error(i.data.error);return i.data.data}catch(i){throw console.error("Error in update User:",i),e("Failed to update User"),i}},async getManageUser(t,n,i){try{const s=i?`?filter_query=${i}`:"",l=await r.get(`/item/${t}/user/item/${n}/${s}`);if(l.data.error)throw e("Failed to fetch User"),new Error(l.data.error);return l.data.data}catch(s){console.error("Error in getUser:",s),e("Failed to fetch User");return}},async unlinkManageUser(t,n,i){try{const s=i?`?filter_query=${i}`:"";await r.delete(`/item/${t}/user/item/${n}/${s}`)}catch(s){throw console.error("Error in unlink User:",s),e("Failed to unlink User"),s}}}}const en=jB();async function YB({url:r,method:e,header:t={},body:n,bearerToken:i}){const s=i?{Authorization:`Bearer ${i}`}:{};try{return(await Ke({url:r,method:e,headers:{...t,...s},data:n??{}})).data}catch(l){throw console.error(`Request failed for ${e} ${r}:`,l),l}}function Ei(r,e,t=[]){const n=QB(e);if(!n)return r;const i=n.split(" ");return r.filter(s=>JB(s,i,t))}function JB(r,e,t){return t.some(n=>{const i=Qs.get(r,n);if(Qs.isNil(i))return!1;const s=Qs.toString(i).toLowerCase();return e.every(l=>s.includes(l))})}function QB(r){return Qs.trim(r).toLowerCase().replace(/\s+/g," ")}let xs=!1;const qu=c.ref(!1),pn=c.ref([]),Wp=c.ref([]),We=c.ref(null),Wo=c.ref([]),qo=c.ref([]),Mw=()=>{const r=Fn(),e=async T=>{qu.value=!0;const I=T?`_active eq true and ${T}`:"_active eq true",O=await Fr.getOrgList(I);O&&(pn.value=O,xs=!0),qu.value=!1},t=async T=>{var I;return(I=pn.value)!=null&&I.length||await e(T),pn.value};function n(T){if(!pn.value)throw new Error("Data not stored yet");const I=Ei(pn.value,T,["name","description"]);return T!==""?I:pn.value}const i=T=>{Wp.value=T},s=T=>{We.value=_i.cloneDeep(T)},l=async T=>await Fr.getOrg(T),d=async()=>{if(We.value!=null){const T=await Fr.createOrg(We.value);return T!=null&&T.data.created_at&&(r.success("Organization created."),xs&&pn.value.push(T.data)),T==null?void 0:T.data}},f=async()=>{if(ae.value=!0,We.value&&We.value.__id){const T=await Fr.updateOrg(We.value);if(xs&&(T!=null&&T.data.__id)){const I=pn.value.findIndex(O=>O.__id===T.data.__id);return I!==-1?(pn.value[I]=T.data,r.success("Organization updated.")):r.error("Unable to update item"),ae.value=!1,T.data}}else ae.value=!1,r.error("Unable to update item")},g=async()=>{if(ae.value=!0,We.value&&We.value.created_at){if(await Fr.deactivateOrg(We.value.__id),xs){const T=pn.value.findIndex(I=>{var O;return I.__id===((O=We.value)==null?void 0:O.__id)});if(T!==-1)return pn.value.splice(T,1),We.value;r.error("Unable to deactivate organization")}ae.value=!1}};async function m(T){ae.value=!0;try{if(We.value&&We.value.__id){const I={...T,organization:We.value.__id};if(!await Hr.updateBranch(I)){ae.value=!1;return}if(Wo.value.findIndex(F=>F.__id===T.__id)===-1)return r.success("Branch added successfully."),Wo.value.push(I),I;r.info("Branch already added.")}}catch(I){console.error(I)}finally{ae.value=!1}}async function v(T){if(ae.value=!0,We.value&&We.value.__id){const I={...T,organization:null};if(!await Hr.updateBranch(I)){ae.value=!1;return}const $=Wo.value.findIndex(F=>F.__id===T.__id);if($!==-1)return Wo.value.splice($,1),ae.value=!1,Wo.value;throw new Error("Item not found to remove")}ae.value=!1}async function C(T){ae.value=!0;try{if(We.value&&We.value.__id){const I={...T,organization:We.value.__id};if(!await en.updateTeam(I)){ae.value=!1;return}if(qo.value.findIndex(F=>F.__id===T.__id)===-1)return r.success("Team added successfully."),qo.value.push(I),I;r.info("Team already added.")}}catch(I){console.error(I)}finally{ae.value=!1}}async function S(T){if(ae.value=!0,We.value&&We.value.__id){const I={...T,organization:null};if(!await en.updateTeam(I)){ae.value=!1;return}const $=qo.value.findIndex(F=>F.__id===T.__id);if($!==-1)return qo.value.splice($,1),ae.value=!1,qo.value;throw new Error("Item not found to remove")}ae.value=!1}return{data:pn,loading:qu,columns:Wp,item:We,filterData:n,__init__:e,getData:t,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,orgBranches:Wo,orgTeams:qo,linkBranch:m,unlinkBranch:v,linkTeam:C,unlinkTeam:S}};let Ds=!1;const vn=c.ref([]),qp=c.ref([]),ot=c.ref(null),Gu=c.ref(!1),Go=c.ref([]),xw=()=>{const r=Fn(),e=async C=>{Gu.value=!0;const S=C?`_active eq true and ${C}`:"_active eq true",T=await en.getTeamList(S);T&&(vn.value=T,Ds=!0),Gu.value=!1},t=async C=>(vn.value.length||await e(C),vn.value);function n(C){if(!vn.value)throw new Error("Data not stored yet");const S=Ei(vn.value,C,["name","description"]);return C!==""?S:vn.value}const i=C=>{qp.value=C},s=C=>{ot.value=_i.cloneDeep(C)},l=async C=>await en.getTeam(C),d=async()=>{if(ot.value!=null){const C=await en.createTeam(ot.value);return C!=null&&C.data.created_at&&(r.success("Team created."),Ds&&vn.value.push(C.data)),C==null?void 0:C.data}},f=async()=>{if(ae.value=!0,ot.value&&ot.value.__id){const C=await en.updateTeam(ot.value);if(Ds&&(C!=null&&C.data.__id)){const S=vn.value.findIndex(T=>T.__id===C.data.__id);return S!==-1?(vn.value[S]=C.data,r.success("Team updated.")):r.error("Unable to update item"),C.data}}else r.error("Unable to update item")},g=async()=>{if(ot.value&&ot.value.created_at&&(await en.deactivateTeam(ot.value.__id),Ds)){const C=vn.value.findIndex(S=>{var T;return S.__id===((T=ot.value)==null?void 0:T.__id)});if(C!==-1)return vn.value.splice(C,1),ot.value;r.error("Unable to deactivate organization")}};async function m(C){var S;if(ae.value=!0,(S=ot.value)!=null&&S.__id)if(Go.value.findIndex(I=>I.__id===C.__id)===-1)try{const I=await en.linkManageUser(ot.value.__id,{team:ot.value.__id,user:C.__id,role:"string",joined_at:"string",comments:"string"}),O=await en.getTeamUserList(ot.value.__id);return O&&(Go.value=O),r.success("User added successfully."),I}catch(I){console.error(I),r.error("Unable to add User.")}finally{ae.value=!1}else r.info("User already added.");else console.warn("No item selected or item ID is missing."),r.info("Please select a valid item.");ae.value=!1}async function v(C){if(ae.value=!0,ot.value&&ot.value.__id){const S=Go.value.findIndex(T=>T.__id===C);if(S!==-1)return await en.unlinkManageUser(ot.value.__id,C),Go.value.splice(S,1),ae.value=!1,Go.value;throw new Error("Item not found to remove")}ae.value=!1}return{data:vn,loading:Gu,columns:qp,item:ot,usersTeam:Go,__init__:e,getData:t,filterData:n,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,linkUser:m,unlinkUser:v}},Dw=c.defineComponent({__name:"GlobalScopeFilter",setup(r){var O,$,F;const{openDialog:e}=va("global-scope__J-"),{user:t,domain:n,scope:i,session:s,setScope:l}=Yc(),{getData:d,data:f}=Mw(),{getData:g,data:m}=xw(),v=c.ref(!1);c.onBeforeMount(async()=>{v.value=!0,await d(),await g(),v.value=!1});const C=c.ref({scope_type:(O=i.value)==null?void 0:O.scope_type,organization:(($=i.value)==null?void 0:$.organization)??"org",team:(F=i.value)==null?void 0:F.team});function S(){var H,z,Q;C.value={...i.value,scope_type:(H=i.value)==null?void 0:H.scope_type,organization:((z=i.value)==null?void 0:z.organization)??"",team:(Q=i.value)==null?void 0:Q.team},e()}const T=c.computed(()=>{var H;switch((H=i.value)==null?void 0:H.scope_type){case"user":return P1;case"org":return O1;case"team":return M1;default:return N1}});async function I(){var H;((H=i.value)==null?void 0:H.scope_type)!==""&&l(C.value)}return(H,z)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[c.createVNode(Be.VBtn,{onClick:S,icon:"",class:"text-secondary ms-3",color:"surface",rounded:"sm",size:"small",variant:"flat"},{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(T.value),{size:"20"}))]),_:1}),c.createVNode(c.unref(Ca),{loading:v.value,title:"Scope","dialog-id":"global-scope__J-","on-save":I},{default:c.withCtx(()=>[c.createElementVNode("div",null,[c.createVNode(_e.VRow,null,{default:c.withCtx(()=>[c.createVNode(_e.VCol,{cols:"4",class:"d-flex flex-row align-center"},{default:c.withCtx(()=>[c.createVNode(Vt.VListItem,null,{default:c.withCtx(()=>[c.createVNode(Vt.VListItemTitle,null,{default:c.withCtx(()=>z[3]||(z[3]=[c.createTextVNode(" User")])),_:1}),c.createVNode(Vt.VListItemSubtitle,null,{default:c.withCtx(()=>{var Q;return[c.createTextVNode(c.toDisplayString(((Q=c.unref(t))==null?void 0:Q.name)||"Unknown"),1)]}),_:1})]),_:1})]),_:1}),c.createVNode(_e.VCol,{cols:"4"},{default:c.withCtx(()=>[c.createVNode(Vt.VListItem,null,{default:c.withCtx(()=>[c.createVNode(Vt.VListItemTitle,null,{default:c.withCtx(()=>z[4]||(z[4]=[c.createTextVNode(" Domain")])),_:1}),c.createVNode(Vt.VListItemSubtitle,null,{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(n)),1)]),_:1})]),_:1})]),_:1}),c.createVNode(_e.VCol,{cols:"4"},{default:c.withCtx(()=>[c.createVNode(Vt.VListItem,null,{default:c.withCtx(()=>[c.createVNode(Vt.VListItemTitle,null,{default:c.withCtx(()=>z[5]||(z[5]=[c.createTextVNode(" Environment")])),_:1}),c.createVNode(Vt.VListItemSubtitle,null,{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(s).environment),1)]),_:1})]),_:1})]),_:1})]),_:1}),c.createVNode(Rk.VBtnToggle,{density:"compact",variant:"outlined",modelValue:C.value.scope_type,"onUpdate:modelValue":z[0]||(z[0]=Q=>C.value.scope_type=Q),class:"d-flex justify-center my-4"},{default:c.withCtx(()=>[c.createVNode(Be.VBtn,{value:"org",label:"Organizational",color:"secondary",class:""},{default:c.withCtx(()=>z[6]||(z[6]=[c.createTextVNode("Organizational")])),_:1}),c.createVNode(Be.VBtn,{value:"team",label:"Team",color:"secondary",class:""},{default:c.withCtx(()=>z[7]||(z[7]=[c.createTextVNode("Team")])),_:1}),c.createVNode(Be.VBtn,{value:"user",label:"User",color:"secondary",class:""},{default:c.withCtx(()=>z[8]||(z[8]=[c.createTextVNode("User")])),_:1}),c.createVNode(Be.VBtn,{value:"",label:"None",color:"lightext",class:""},{default:c.withCtx(()=>z[9]||(z[9]=[c.createTextVNode("None")])),_:1})]),_:1},8,["modelValue"]),c.createElementVNode("div",null,[c.createVNode(la.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:c.withCtx(()=>z[10]||(z[10]=[c.createTextVNode("Organization")])),_:1}),c.createVNode(ea.VSelect,{items:c.unref(f),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:"Select a Organization",class:"min-w-50",modelValue:C.value.organization,"onUpdate:modelValue":z[1]||(z[1]=Q=>C.value.organization=Q)},null,8,["items","modelValue"]),c.createVNode(la.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:c.withCtx(()=>z[11]||(z[11]=[c.createTextVNode("Team")])),_:1}),c.createVNode(ea.VSelect,{items:c.unref(m),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:"Select a Team",class:"min-w-50",modelValue:C.value.team,"onUpdate:modelValue":z[2]||(z[2]=Q=>C.value.team=Q)},null,8,["items","modelValue"])])])]),_:1},8,["loading"])],64))}}),XB={},ZB={class:"double-ring-spinner-container"};function eU(r,e){return c.openBlock(),c.createElementBlock("div",ZB,e[0]||(e[0]=[c.createElementVNode("div",{class:"spinner-loading"},[c.createElementVNode("div"),c.createElementVNode("div"),c.createElementVNode("div",null,[c.createElementVNode("div")]),c.createElementVNode("div",null,[c.createElementVNode("div")])],-1)]))}const Lw=pi(XB,[["render",eU],["__scopeId","data-v-00d7a69f"]]),tU={key:0,class:"_jspinner-overlay_jj"},Bw=c.defineComponent({__name:"GlobalSpinner",setup(r){return(e,t)=>c.unref(ae)?(c.openBlock(),c.createElementBlock("div",tU,t[0]||(t[0]=[c.createElementVNode("div",{class:"j-double-ring-spinner-container"},[c.createElementVNode("div",{class:"j-global-spinner-loading"},[c.createElementVNode("div"),c.createElementVNode("div"),c.createElementVNode("div",null,[c.createElementVNode("div")]),c.createElementVNode("div",null,[c.createElementVNode("div")])])],-1)]))):c.createCommentVNode("",!0)}}),nU=Object.freeze(Object.defineProperty({__proto__:null,AvatarPicture:Hv,ColumnSettingsDialog:Fd,ConfirmDialog:Vv,ContextMenu:$v,CopyButton:Cc,DeleteAllBtn:Dd,DotsMenu:Bv,DotsMenuV1:Uv,EditButton:xv,FormHeadless:wy,FormMetadata:kc,GlobalScopeFilter:Dw,GlobalSpinner:Bw,JAvatar:Fv,JBtn:nv,JDialog:Ca,JForm:yy,JIconBtn:tv,JSelect:gy,JTextArea:my,JTextField:fy,ParentCard:Sc,SpinnerLoader:Lw,TabFormHeader:Cy,TableAdvanced:Yv,TableCard:Hd,TableCardsView:dy,TableHeader:Qv,UiTable:Kv},Symbol.toStringTag,{value:"Module"})),rU=oR(),oU={transition:"Vue-Toastification__fade",maxToasts:20,newestOnTop:!0};let ju=!1;const Yu=c.ref(!1),yn=c.ref([]),Gp=c.ref([]),gt=c.ref(null),jo=c.ref([]),iU=()=>{const r=Fn(),e=async C=>{Yu.value=!0;const S=C?`_active eq true and ${C}`:"_active eq true",T=await Hr.getBranchList(S);T&&(yn.value=T,ju=!0),Yu.value=!1},t=async C=>(yn.value.length||await e(C),yn.value);function n(C){if(!yn.value)throw new Error("Data not stored yet");const S=Ei(yn.value,C,["name","description"]);return C!==""?S:yn.value}const i=C=>{Gp.value=C},s=C=>{gt.value=_i.cloneDeep(C)},l=async C=>await Hr.getBranch(C),d=async()=>{if(gt.value!=null){const C=await Hr.createBranch(gt.value);return C!=null&&C.data.created_at&&(r.success("Branch created."),ju&&yn.value.push(C.data)),C==null?void 0:C.data}},f=async()=>{if(gt.value&&gt.value.__id){const C=await Hr.updateBranch(gt.value);if(ju&&C){const S=yn.value.findIndex(T=>T.__id===C.data.__id);return S!==-1?(yn.value[S]=C.data,r.success("Branch updated.")):r.error("Unable to update item"),C}}else r.error("Unable to update item")},g=async()=>{if(gt.value&&gt.value.created_at){await Hr.deactivateBranch(gt.value.__id);const C=yn.value.findIndex(S=>{var T;return S.__id===((T=gt.value)==null?void 0:T.__id)});if(C!==-1)return yn.value.splice(C,1),gt.value;r.error("Unable to deactivate Domain")}};async function m(C){ae.value=!0;try{if(gt.value&&gt.value.__id){const S={...C,branch:gt.value.__id};if(!await en.updateTeam(S)){r.error("Unable to link team");return}if(jo.value.findIndex(O=>O.__id===C.__id)===-1)return r.success("Team added successfully."),jo.value.push(S),S;r.info("Team already added.")}else throw new Error("Item is not defined")}catch(S){console.error(S)}finally{ae.value=!1}}async function v(C){if(ae.value=!0,gt.value&&gt.value.__id){const S={...C,branch:null};if(!await en.updateTeam(S))return;const I=jo.value.findIndex(O=>O.__id===C.__id);if(I!==-1)return jo.value.splice(I,1),ae.value=!1,jo.value;throw new Error("Item not found to remove")}ae.value=!1}return{data:yn,columns:Gp,item:gt,loading:Yu,__init__:e,getData:t,filterData:n,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,branchTeams:jo,linkTeam:m,unlinkTeam:v}};function aU(){const r=Ti("https://api.jplan.com.br/management/division"),{error:e}=Fn();return{async getDivisionList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch Division list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getDivisionList:",n),e("Failed to fetch Division list");return}},async createDivision(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in createDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Division"),s}},async updateDivision(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error)throw e("Failed to update Division"),new Error(s.data.error);return s}catch(s){throw console.error("Error in updateDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Division"),s}},async getDivision(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error)throw e("Failed to fetch Division"),new Error(s.data.error);return s.data}catch(s){throw console.error("Error in getDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Division"),s}},async activateDivision(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate Division"),new Error(s.data.error)}catch(s){throw console.error("Error in activateDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Division"),s}},async deactivateDivision(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate Division"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Division"),s}}}}const ei=aU();let Ju=!1;const Qu=c.ref(!1),Cn=c.ref([]),jp=c.ref([]),mt=c.ref(null),Yo=c.ref([]),sU=()=>{const r=Fn(),e=async C=>{Qu.value=!0;const S=C?`_active eq true and ${C}`:"_active eq true",T=await ei.getDivisionList(S);T&&(Cn.value=T,Ju=!0),Qu.value=!1},t=async C=>(Cn.value.length||await e(C),Cn.value);function n(C){if(!Cn.value)throw new Error("Data not stored yet");const S=Ei(Cn.value,C,["name","description"]);return C!==""?S:Cn.value}const i=C=>{jp.value=C},s=C=>{mt.value=_i.cloneDeep(C)},l=async C=>await ei.getDivision(C),d=async()=>{if(mt.value!=null){const C=await ei.createDivision(mt.value);return C!=null&&C.data.created_at&&(r.success("Division created."),Ju&&Cn.value.push(C.data)),C==null?void 0:C.data}},f=async()=>{if(ae.value=!0,mt.value&&mt.value.__id){const C=await ei.updateDivision(mt.value);if(Ju&&(C!=null&&C.data.__id)){const S=Cn.value.findIndex(T=>T.__id===C.data.__id);return S!==-1?(Cn.value[S]=C.data,r.success("Updated Division.")):r.error("Unable to update item"),ae.value=!1,C}}else ae.value=!1,r.error("Unable to update item")},g=async()=>{if(ae.value=!0,mt.value&&mt.value.created_at){await ei.deactivateDivision(mt.value.__id);const C=Cn.value.findIndex(S=>{var T;return S.__id===((T=mt.value)==null?void 0:T.__id)});if(C!==-1)return Cn.value.splice(C,1),mt.value;r.error("Unable to deactivate Division")}ae.value=!1};async function m(C){ae.value=!0;try{if(mt.value&&mt.value.__id){const S={...C,division:mt.value.__id};return await Fr.updateOrg(S)?(Yo.value.findIndex(O=>O.__id===C.__id)===-1?(r.success("Organization added successfully."),Yo.value.push(S)):r.info("Organization already added."),S):void 0}else throw new Error("Item is not defined")}catch(S){console.error(S)}finally{ae.value=!1}}async function v(C){if(ae.value=!0,mt.value&&mt.value.__id){const S={...C,division:null};if(!await Fr.updateOrg(S))return;const I=Yo.value.findIndex(O=>O.__id===C.__id);if(I!==-1)Yo.value.splice(I,1);else throw new Error("Item não encontrado para remoção")}else throw new Error("Item não está definido");return ae.value=!1,Yo.value}return{data:Cn,columns:jp,item:mt,loading:Qu,__init__:e,filterData:n,getData:t,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,orgs:Yo,linkDivision:m,unlinkDivision:v}};function cU(){const r=Ti("https://api.jplan.com.br/management/user"),{error:e}=Fn();return{async getManageUserList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch User list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getManageUserList:",n),e("Failed to fetch User list");return}},async createManageUser(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in createManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create User"),s}},async updateManageUser(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error)throw e("Failed to update User"),new Error(s.data.error);return s}catch(s){throw console.error("Error in updateManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update User"),s}},async getManageUser(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error)throw e("Failed to fetch User"),new Error(s.data.error);return s.data}catch(s){console.error("Error in getManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch User");return}},async activateManageUser(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate User"),new Error(s.data.error)}catch(s){throw console.error("Error in activateManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate User"),s}},async deactivateManageUser(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate User"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate User"),s}}}}const ti=cU();let Xu=!1,Zu=c.ref(!1);const wn=c.ref([]),Yp=c.ref([]),_n=c.ref(null),lU=c.ref(null),uU=c.ref([]),dU=()=>{const r=Fn(),e=async m=>{Zu.value=!0;const v=m?`_active eq true and ${m}`:"_active eq true",C=await ti.getManageUserList(v);C&&(wn.value=C,Xu=!0),Zu.value=!1},t=async m=>(wn.value.length||await e(m),wn.value);function n(m){if(!wn.value)throw new Error("Data not stored yet");const v=Ei(wn.value,m,["name","description"]);return m!==""?v:wn.value}return{data:wn,loading:Zu,columns:Yp,item:_n,filterData:n,__init__:e,getData:t,setColumns:m=>{Yp.value=m},setItem:m=>{_n.value=_i.cloneDeep(m)},getItem:async m=>await ti.getManageUser(m),createItem:async()=>{if(_n.value!=null){const m=crypto.randomUUID(),v=await ti.createManageUser({..._n.value,__id:m});return v!=null&&v.data.created_at&&(r.success("User created."),Xu&&wn.value.push(v.data)),v==null?void 0:v.data}},updateItem:async()=>{if(ae.value=!0,_n.value&&_n.value.created_at){const m=await ti.updateManageUser(_n.value);if(Xu&&(m!=null&&m.data)){const v=wn.value.findIndex(C=>C.__id===(m==null?void 0:m.data.__id));if(v!==-1)wn.value[v]=m==null?void 0:m.data,r.success("User created.");else throw new Error("Unable to find item after update")}return ae.value=!1,m==null?void 0:m.data}},removeItem:async()=>{if(_n.value&&_n.value.created_at){try{await ti.deactivateManageUser(_n.value.__id)}catch{r.error("Unable to deactivate user");return}const m=wn.value.findIndex(v=>{var C;return v.__id===((C=_n.value)==null?void 0:C.__id)});if(m!==-1)return wn.value.splice(m,1),_n.value}},userOrg:lU,userTeams:uU}},hU=r=>{r.use(rU),r.use(aO,oU),Object.entries(nU).forEach(([e,t])=>{r.component(e,t)}),Object.entries(Nk).forEach(([e,t])=>{r.provide(e,t)})},fU={install:hU};exports.ContextMenu=$v;exports.EventBus=Tc;exports.FormHeadless=wy;exports.HttpCore=YB;exports.SpinnerLoader=Lw;exports.TableCardsView=dy;exports.TableHeader=Qv;exports.__spinner=ae;exports._export_sfc=pi;exports._sfc_main=Kv;exports._sfc_main$1=Yv;exports._sfc_main$10=Dd;exports._sfc_main$11=xv;exports._sfc_main$12=Ca;exports._sfc_main$13=tv;exports._sfc_main$14=gy;exports._sfc_main$15=my;exports._sfc_main$16=fy;exports._sfc_main$17=yy;exports._sfc_main$18=Cy;exports._sfc_main$19=Sc;exports._sfc_main$2=Fd;exports._sfc_main$20=Fv;exports._sfc_main$21=Hv;exports._sfc_main$22=Dw;exports._sfc_main$23=Bw;exports._sfc_main$3=Hd;exports._sfc_main$4=Vv;exports._sfc_main$5=Cc;exports._sfc_main$6=Bv;exports._sfc_main$7=Uv;exports._sfc_main$8=kc;exports._sfc_main$9=nv;exports.branchInstance=Hr;exports.coreClient=Ph;exports.createToastInterface=ha;exports.dateFormat=jv;exports.divisionInstance=ei;exports.filterQuery=Ei;exports.globalEventBus=xd;exports.index=fU;exports.manageUserInstance=ti;exports.msal=Et;exports.orgInstance=Fr;exports.provideToast=iO;exports.scopedClient=Ti;exports.setupAuthGuard=zB;exports.teamInstance=en;exports.toastInjectionKey=Ec;exports.useBranchStore=iU;exports.useCustomizer=lR;exports.useDialog=va;exports.useDivisionStore=sU;exports.useManageUserStore=dU;exports.useOrganizationStore=Mw;exports.useSession=Yc;exports.useTeamStore=xw;exports.useToast=Fn;
87
+ }`;var he=cm(function(){return Se(w,J+"return "+L).apply(t,_)});if(he.source=L,su(he))throw he;return he}function PI(o){return be(o).toLowerCase()}function MI(o){return be(o).toUpperCase()}function xI(o,a,u){if(o=be(o),o&&(u||a===t))return vf(o);if(!o||!(a=qt(a)))return o;var h=kn(o),p=kn(a),w=yf(h,p),_=Cf(h,p)+1;return Mr(h,w,_).join("")}function DI(o,a,u){if(o=be(o),o&&(u||a===t))return o.slice(0,_f(o)+1);if(!o||!(a=qt(a)))return o;var h=kn(o),p=Cf(h,kn(a))+1;return Mr(h,0,p).join("")}function LI(o,a,u){if(o=be(o),o&&(u||a===t))return o.replace(sl,"");if(!o||!(a=qt(a)))return o;var h=kn(o),p=yf(h,kn(a));return Mr(h,p).join("")}function BI(o,a){var u=Y,h=G;if($e(a)){var p="separator"in a?a.separator:p;u="length"in a?de(a.length):u,h="omission"in a?qt(a.omission):h}o=be(o);var w=o.length;if(bo(o)){var _=kn(o);w=_.length}if(u>=w)return o;var E=u-Io(h);if(E<1)return h;var b=_?Mr(_,0,E).join(""):o.slice(0,E);if(p===t)return b+h;if(_&&(E+=b.length-E),cu(p)){if(o.slice(E).search(p)){var x,D=b;for(p.global||(p=Sl(p.source,be(Uh.exec(p))+"g")),p.lastIndex=0;x=p.exec(D);)var L=x.index;b=b.slice(0,L===t?E:L)}}else if(o.indexOf(qt(p),E)!=E){var K=b.lastIndexOf(p);K>-1&&(b=b.slice(0,K))}return b+h}function UI(o){return o=be(o),o&&Yw.test(o)?o.replace(Dh,fT):o}var VI=xo(function(o,a,u){return o+(u?" ":"")+a.toUpperCase()}),du=lg("toUpperCase");function sm(o,a,u){return o=be(o),a=u?t:a,a===t?cT(o)?pT(o):Z_(o):o.match(a)||[]}var cm=fe(function(o,a){try{return zt(o,t,a)}catch(u){return su(u)?u:new se(u)}}),FI=lr(function(o,a){return ln(a,function(u){u=Wn(u),sr(o,u,iu(o[u],o))}),o});function HI(o){var a=o==null?0:o.length,u=Z();return o=a?Ve(o,function(h){if(typeof h[1]!="function")throw new un(l);return[u(h[0]),h[1]]}):[],fe(function(h){for(var p=-1;++p<a;){var w=o[p];if(zt(w[0],this,h))return zt(w[1],this,h)}})}function $I(o){return fE(hn(o,v))}function hu(o){return function(){return o}}function KI(o,a){return o==null||o!==o?a:o}var zI=dg(),WI=dg(!0);function Bt(o){return o}function fu(o){return Hf(typeof o=="function"?o:hn(o,v))}function qI(o){return Kf(hn(o,v))}function GI(o,a){return zf(o,hn(a,v))}var jI=fe(function(o,a){return function(u){return Fi(u,o,a)}}),YI=fe(function(o,a){return function(u){return Fi(o,u,a)}});function gu(o,a,u){var h=st(a),p=Za(a,h);u==null&&!($e(a)&&(p.length||!h.length))&&(u=a,a=o,o=this,p=Za(a,st(a)));var w=!($e(u)&&"chain"in u)||!!u.chain,_=dr(o);return ln(p,function(E){var b=a[E];o[E]=b,_&&(o.prototype[E]=function(){var x=this.__chain__;if(w||x){var D=o(this.__wrapped__),L=D.__actions__=xt(this.__actions__);return L.push({func:b,args:arguments,thisArg:o}),D.__chain__=x,D}return b.apply(o,Ir([this.value()],arguments))})}),o}function JI(){return ht._===this&&(ht._=TT),this}function mu(){}function QI(o){return o=de(o),fe(function(a){return Wf(a,o)})}var XI=ql(Ve),ZI=ql(hf),ek=ql(vl);function lm(o){return Zl(o)?yl(Wn(o)):OE(o)}function tk(o){return function(a){return o==null?t:Zr(o,a)}}var nk=fg(),rk=fg(!0);function pu(){return[]}function vu(){return!1}function ok(){return{}}function ik(){return""}function ak(){return!0}function sk(o,a){if(o=de(o),o<1||o>Qe)return[];var u=Kt,h=wt(o,Kt);a=Z(a),o-=Kt;for(var p=_l(h,a);++u<o;)a(u);return p}function ck(o){return ce(o)?Ve(o,Wn):Gt(o)?[o]:xt(Rg(be(o)))}function lk(o){var a=++wT;return be(o)+a}var uk=is(function(o,a){return o+a},0),dk=Gl("ceil"),hk=is(function(o,a){return o/a},1),fk=Gl("floor");function gk(o){return o&&o.length?Xa(o,Bt,Pl):t}function mk(o,a){return o&&o.length?Xa(o,Z(a,2),Pl):t}function pk(o){return mf(o,Bt)}function vk(o,a){return mf(o,Z(a,2))}function yk(o){return o&&o.length?Xa(o,Bt,Ll):t}function Ck(o,a){return o&&o.length?Xa(o,Z(a,2),Ll):t}var wk=is(function(o,a){return o*a},1),_k=Gl("round"),Tk=is(function(o,a){return o-a},0);function Ek(o){return o&&o.length?wl(o,Bt):0}function Sk(o,a){return o&&o.length?wl(o,Z(a,2)):0}return y.after=qA,y.ary=Fg,y.assign=Mb,y.assignIn=em,y.assignInWith=ys,y.assignWith=xb,y.at=Db,y.before=Hg,y.bind=iu,y.bindAll=FI,y.bindKey=$g,y.castArray=ob,y.chain=Bg,y.chunk=fS,y.compact=gS,y.concat=mS,y.cond=HI,y.conforms=$I,y.constant=hu,y.countBy=EA,y.create=Lb,y.curry=Kg,y.curryRight=zg,y.debounce=Wg,y.defaults=Bb,y.defaultsDeep=Ub,y.defer=GA,y.delay=jA,y.difference=pS,y.differenceBy=vS,y.differenceWith=yS,y.drop=CS,y.dropRight=wS,y.dropRightWhile=_S,y.dropWhile=TS,y.fill=ES,y.filter=AA,y.flatMap=kA,y.flatMapDeep=RA,y.flatMapDepth=OA,y.flatten=Mg,y.flattenDeep=SS,y.flattenDepth=AS,y.flip=YA,y.flow=zI,y.flowRight=WI,y.fromPairs=bS,y.functions=Wb,y.functionsIn=qb,y.groupBy=NA,y.initial=kS,y.intersection=RS,y.intersectionBy=OS,y.intersectionWith=NS,y.invert=jb,y.invertBy=Yb,y.invokeMap=MA,y.iteratee=fu,y.keyBy=xA,y.keys=st,y.keysIn=Lt,y.map=hs,y.mapKeys=Qb,y.mapValues=Xb,y.matches=qI,y.matchesProperty=GI,y.memoize=gs,y.merge=Zb,y.mergeWith=tm,y.method=jI,y.methodOf=YI,y.mixin=gu,y.negate=ms,y.nthArg=QI,y.omit=eI,y.omitBy=tI,y.once=JA,y.orderBy=DA,y.over=XI,y.overArgs=QA,y.overEvery=ZI,y.overSome=ek,y.partial=au,y.partialRight=qg,y.partition=LA,y.pick=nI,y.pickBy=nm,y.property=lm,y.propertyOf=tk,y.pull=DS,y.pullAll=Dg,y.pullAllBy=LS,y.pullAllWith=BS,y.pullAt=US,y.range=nk,y.rangeRight=rk,y.rearg=XA,y.reject=VA,y.remove=VS,y.rest=ZA,y.reverse=ru,y.sampleSize=HA,y.set=oI,y.setWith=iI,y.shuffle=$A,y.slice=FS,y.sortBy=WA,y.sortedUniq=GS,y.sortedUniqBy=jS,y.split=kI,y.spread=eb,y.tail=YS,y.take=JS,y.takeRight=QS,y.takeRightWhile=XS,y.takeWhile=ZS,y.tap=gA,y.throttle=tb,y.thru=ds,y.toArray=Qg,y.toPairs=rm,y.toPairsIn=om,y.toPath=ck,y.toPlainObject=Zg,y.transform=aI,y.unary=nb,y.union=eA,y.unionBy=tA,y.unionWith=nA,y.uniq=rA,y.uniqBy=oA,y.uniqWith=iA,y.unset=sI,y.unzip=ou,y.unzipWith=Lg,y.update=cI,y.updateWith=lI,y.values=Bo,y.valuesIn=uI,y.without=aA,y.words=sm,y.wrap=rb,y.xor=sA,y.xorBy=cA,y.xorWith=lA,y.zip=uA,y.zipObject=dA,y.zipObjectDeep=hA,y.zipWith=fA,y.entries=rm,y.entriesIn=om,y.extend=em,y.extendWith=ys,gu(y,y),y.add=uk,y.attempt=cm,y.camelCase=gI,y.capitalize=im,y.ceil=dk,y.clamp=dI,y.clone=ib,y.cloneDeep=sb,y.cloneDeepWith=cb,y.cloneWith=ab,y.conformsTo=lb,y.deburr=am,y.defaultTo=KI,y.divide=hk,y.endsWith=mI,y.eq=On,y.escape=pI,y.escapeRegExp=vI,y.every=SA,y.find=bA,y.findIndex=Ng,y.findKey=Vb,y.findLast=IA,y.findLastIndex=Pg,y.findLastKey=Fb,y.floor=fk,y.forEach=Ug,y.forEachRight=Vg,y.forIn=Hb,y.forInRight=$b,y.forOwn=Kb,y.forOwnRight=zb,y.get=lu,y.gt=ub,y.gte=db,y.has=Gb,y.hasIn=uu,y.head=xg,y.identity=Bt,y.includes=PA,y.indexOf=IS,y.inRange=hI,y.invoke=Jb,y.isArguments=no,y.isArray=ce,y.isArrayBuffer=hb,y.isArrayLike=Dt,y.isArrayLikeObject=je,y.isBoolean=fb,y.isBuffer=xr,y.isDate=gb,y.isElement=mb,y.isEmpty=pb,y.isEqual=vb,y.isEqualWith=yb,y.isError=su,y.isFinite=Cb,y.isFunction=dr,y.isInteger=Gg,y.isLength=ps,y.isMap=jg,y.isMatch=wb,y.isMatchWith=_b,y.isNaN=Tb,y.isNative=Eb,y.isNil=Ab,y.isNull=Sb,y.isNumber=Yg,y.isObject=$e,y.isObjectLike=ze,y.isPlainObject=qi,y.isRegExp=cu,y.isSafeInteger=bb,y.isSet=Jg,y.isString=vs,y.isSymbol=Gt,y.isTypedArray=Lo,y.isUndefined=Ib,y.isWeakMap=kb,y.isWeakSet=Rb,y.join=PS,y.kebabCase=yI,y.last=gn,y.lastIndexOf=MS,y.lowerCase=CI,y.lowerFirst=wI,y.lt=Ob,y.lte=Nb,y.max=gk,y.maxBy=mk,y.mean=pk,y.meanBy=vk,y.min=yk,y.minBy=Ck,y.stubArray=pu,y.stubFalse=vu,y.stubObject=ok,y.stubString=ik,y.stubTrue=ak,y.multiply=wk,y.nth=xS,y.noConflict=JI,y.noop=mu,y.now=fs,y.pad=_I,y.padEnd=TI,y.padStart=EI,y.parseInt=SI,y.random=fI,y.reduce=BA,y.reduceRight=UA,y.repeat=AI,y.replace=bI,y.result=rI,y.round=_k,y.runInContext=A,y.sample=FA,y.size=KA,y.snakeCase=II,y.some=zA,y.sortedIndex=HS,y.sortedIndexBy=$S,y.sortedIndexOf=KS,y.sortedLastIndex=zS,y.sortedLastIndexBy=WS,y.sortedLastIndexOf=qS,y.startCase=RI,y.startsWith=OI,y.subtract=Tk,y.sum=Ek,y.sumBy=Sk,y.template=NI,y.times=sk,y.toFinite=hr,y.toInteger=de,y.toLength=Xg,y.toLower=PI,y.toNumber=mn,y.toSafeInteger=Pb,y.toString=be,y.toUpper=MI,y.trim=xI,y.trimEnd=DI,y.trimStart=LI,y.truncate=BI,y.unescape=UI,y.uniqueId=lk,y.upperCase=VI,y.upperFirst=du,y.each=Ug,y.eachRight=Vg,y.first=xg,gu(y,function(){var o={};return Kn(y,function(a,u){Ie.call(y.prototype,u)||(o[u]=a)}),o}(),{chain:!1}),y.VERSION=n,ln(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){y[o].placeholder=y}),ln(["drop","take"],function(o,a){pe.prototype[o]=function(u){u=u===t?1:rt(de(u),0);var h=this.__filtered__&&!a?new pe(this):this.clone();return h.__filtered__?h.__takeCount__=wt(u,h.__takeCount__):h.__views__.push({size:wt(u,Kt),type:o+(h.__dir__<0?"Right":"")}),h},pe.prototype[o+"Right"]=function(u){return this.reverse()[o](u).reverse()}}),ln(["filter","map","takeWhile"],function(o,a){var u=a+1,h=u==yt||u==sn;pe.prototype[o]=function(p){var w=this.clone();return w.__iteratees__.push({iteratee:Z(p,3),type:u}),w.__filtered__=w.__filtered__||h,w}}),ln(["head","last"],function(o,a){var u="take"+(a?"Right":"");pe.prototype[o]=function(){return this[u](1).value()[0]}}),ln(["initial","tail"],function(o,a){var u="drop"+(a?"":"Right");pe.prototype[o]=function(){return this.__filtered__?new pe(this):this[u](1)}}),pe.prototype.compact=function(){return this.filter(Bt)},pe.prototype.find=function(o){return this.filter(o).head()},pe.prototype.findLast=function(o){return this.reverse().find(o)},pe.prototype.invokeMap=fe(function(o,a){return typeof o=="function"?new pe(this):this.map(function(u){return Fi(u,o,a)})}),pe.prototype.reject=function(o){return this.filter(ms(Z(o)))},pe.prototype.slice=function(o,a){o=de(o);var u=this;return u.__filtered__&&(o>0||a<0)?new pe(u):(o<0?u=u.takeRight(-o):o&&(u=u.drop(o)),a!==t&&(a=de(a),u=a<0?u.dropRight(-a):u.take(a-o)),u)},pe.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},pe.prototype.toArray=function(){return this.take(Kt)},Kn(pe.prototype,function(o,a){var u=/^(?:filter|find|map|reject)|While$/.test(a),h=/^(?:head|last)$/.test(a),p=y[h?"take"+(a=="last"?"Right":""):a],w=h||/^find/.test(a);p&&(y.prototype[a]=function(){var _=this.__wrapped__,E=h?[1]:arguments,b=_ instanceof pe,x=E[0],D=b||ce(_),L=function(me){var ve=p.apply(y,Ir([me],E));return h&&K?ve[0]:ve};D&&u&&typeof x=="function"&&x.length!=1&&(b=D=!1);var K=this.__chain__,J=!!this.__actions__.length,ee=w&&!K,he=b&&!J;if(!w&&D){_=he?_:new pe(this);var te=o.apply(_,E);return te.__actions__.push({func:ds,args:[L],thisArg:t}),new dn(te,K)}return ee&&he?o.apply(this,E):(te=this.thru(L),ee?h?te.value()[0]:te.value():te)})}),ln(["pop","push","shift","sort","splice","unshift"],function(o){var a=Ba[o],u=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",h=/^(?:pop|shift)$/.test(o);y.prototype[o]=function(){var p=arguments;if(h&&!this.__chain__){var w=this.value();return a.apply(ce(w)?w:[],p)}return this[u](function(_){return a.apply(ce(_)?_:[],p)})}}),Kn(pe.prototype,function(o,a){var u=y[a];if(u){var h=u.name+"";Ie.call(No,h)||(No[h]=[]),No[h].push({name:a,func:u})}}),No[os(t,$).name]=[{name:"wrapper",func:t}],pe.prototype.clone=UT,pe.prototype.reverse=VT,pe.prototype.value=FT,y.prototype.at=mA,y.prototype.chain=pA,y.prototype.commit=vA,y.prototype.next=yA,y.prototype.plant=wA,y.prototype.reverse=_A,y.prototype.toJSON=y.prototype.valueOf=y.prototype.value=TA,y.prototype.first=y.prototype.head,Mi&&(y.prototype[Mi]=CA),y},ko=vT();jr?((jr.exports=ko)._=ko,fl._=ko):ht._=ko}).call(UB)}(Zi,Zi.exports)),Zi.exports}var _i=VB();const Qs=BB(_i),FB={path:"/_/dashboard",component:()=>Promise.resolve().then(()=>require("./AuthRoute-eNfuDlGp.js")),meta:{requiresAuth:!1}},HB={path:"/jplan-auth-fail",component:()=>Promise.resolve().then(()=>require("./AuthFailRoute-BDEuQO-7.js")),meta:{requiresAuth:!1}},{isAuthenticated:Kp,handleRedirect:$B}=cw(),KB=Yc();function zB(r,e){r.addRoute(FB),r.addRoute(HB),r.beforeEach(async(t,n,i)=>{function s(d){return d.matched.some(f=>f.meta.requiresAuth)}if(!s(t))return i();if(!Kp.value){ae.value=!0;try{await $B(e),await KB.__init__()}catch(d){console.error("Fail to authenticate",d),await r.push("/jplan-auth-fail")}ae.value=!1}Kp.value&&i()})}const{scope:zp}=Yc();function WB(){const r=Ph(),e=c.ref({scope_type:"org"});async function t(n){e.value=n}return c.watch(zp,()=>{r.interceptors.request.use(n=>{const i=n.headers,s=i.Authorization;s&&(i.Authorization=s);const l=zp.value;return l&&(l.scope_type&&(i["j-scope-type"]=l.scope_type,l.organization&&(i["j-scope-organization"]=l.organization),l.team&&(i["j-scope-team"]=l.team)),l.environment&&(i["j-scope-environment"]=l.environment)),n})},{immediate:!0}),Object.assign(r,{setScope:t,scope:e})}function Ti(r){const e=WB();e.defaults.baseURL=r;const t=c.ref({scope_type:"org"});async function n(i){t.value=i}return c.watch(t,()=>{e.interceptors.request.use(i=>{const s=t.value;return delete i.headers["j-scope-type"],delete i.headers["j-scope-organization"],delete i.headers["j-scope-team"],s!=null&&s.scope_type&&(i.headers["j-scope-type"]=s.scope_type),s!=null&&s.organization&&(i.headers["j-scope-organization"]=s.organization),s!=null&&s.team&&(i.headers["j-scope-team"]=s.team),i})},{immediate:!0}),Object.assign(e,{setScope:n,scope:t})}function qB(){const r=Ti("https://api.jplan.com.br/management/organization"),{error:e}=Fn();return{async getOrgList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch Organization list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getOrgList:",n),e("Failed to fetch Organization list");return}},async createOrg(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in createOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Organization"),s}},async updateOrg(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error)throw e("Failed to update Organization"),new Error(s.data.error);return s}catch(s){throw console.error("Error in updateOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Organization"),s}},async getOrg(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error)throw e("Failed to fetch Organization"),new Error(s.data.error);return s.data}catch(s){throw console.error("Error in getOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Organization"),s}},async activateOrg(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate Organization"),new Error(s.data.error)}catch(s){throw console.error("Error in activateOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Organization"),s}},async deactivateOrg(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate Organization"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateOrg:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Organization"),s}}}}const Fr=qB();function GB(){const r=Ti("https://api.jplan.com.br/management/branch/"),{error:e}=Fn();return{async getBranchList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error){e("Failed to fetch Branch list");return}return i.data.data}catch(n){console.error("Error in getBranchList:",n),e("Failed to fetch Branch list")}},async createBranch(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){console.error("Error in createBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Branch")}},async updateBranch(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error){e(s.data.error||"Failed to update Branch");return}return s}catch(s){console.error("Error in updateBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Branch")}},async getBranch(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error){e(s.data.error||"Failed to fetch Branch");return}return s.data}catch(s){console.error("Error in getBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Branch")}},async activateBranch(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error){e(s.data.error||"Failed to activate Branch");return}}catch(s){console.error("Error in activateBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Branch")}},async deactivateBranch(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error){e(s.data.error||"Failed to deactivate Branch");return}}catch(s){console.error("Error in deactivateBranch:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Branch")}}}}const Hr=GB();function jB(){const r=Ti("https://api.jplan.com.br/management/team"),{error:e}=Fn();return{async getTeamList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch Team list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getTeamList:",n),e("Failed to fetch Team list");return}},async createTeam(t){var n,i;try{const s=await r.post("/item",t);if(s.data.error)throw e("Failed to create Team"),new Error(s.data.error);return s}catch(s){throw console.error("Error in createTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Team"),s}},async updateTeam(t){var n,i;try{const s=await r.patch("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in updateTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Team"),s}},async getTeam(t){var n,i;try{const s=await r.get(`/item/${t}`);return s.data.error&&e("Failed to fetch Team"),s.data}catch(s){console.error("Error in getTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Team");return}},async activateTeam(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate Team"),new Error(s.data.error)}catch(s){throw console.error("Error in activateTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Team"),s}},async deactivateTeam(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate Team"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateTeam:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Team"),s}},async getTeamUserList(t,n){try{const i=n?`?filter_query=${n}`:"",s=await r.get(`/item/${t}/user/list/${i}`);if(s.data.error)throw e("Failed to fetch Team User list"),new Error(s.data.error);return s.data.data}catch(i){console.error("Error in getTeamUserList:",i),e("Failed to fetch Team User list");return}},async linkManageUser(t,n){try{const i=await r.post(`/item/${t}/user/item/`,n);if(i.data.error)throw e("Failed to link User"),new Error(i.data.error);return i.data}catch(i){console.error("Error in link User:",i),e("Failed to link User");return}},async updateManageUser(t,n){try{const i=await r.patch(`/item/${t}/user/item/`,n);if(i.data.error)throw e("Failed to update User"),new Error(i.data.error);return i.data.data}catch(i){throw console.error("Error in update User:",i),e("Failed to update User"),i}},async getManageUser(t,n,i){try{const s=i?`?filter_query=${i}`:"",l=await r.get(`/item/${t}/user/item/${n}/${s}`);if(l.data.error)throw e("Failed to fetch User"),new Error(l.data.error);return l.data.data}catch(s){console.error("Error in getUser:",s),e("Failed to fetch User");return}},async unlinkManageUser(t,n,i){try{const s=i?`?filter_query=${i}`:"";await r.delete(`/item/${t}/user/item/${n}/${s}`)}catch(s){throw console.error("Error in unlink User:",s),e("Failed to unlink User"),s}}}}const en=jB();async function YB({url:r,method:e,header:t={},body:n,bearerToken:i}){const s=i?{Authorization:`Bearer ${i}`}:{};try{return(await Ke({url:r,method:e,headers:{...t,...s},data:n??{}})).data}catch(l){throw console.error(`Request failed for ${e} ${r}:`,l),l}}function Ei(r,e,t=[]){const n=QB(e);if(!n)return r;const i=n.split(" ");return r.filter(s=>JB(s,i,t))}function JB(r,e,t){return t.some(n=>{const i=Qs.get(r,n);if(Qs.isNil(i))return!1;const s=Qs.toString(i).toLowerCase();return e.every(l=>s.includes(l))})}function QB(r){return Qs.trim(r).toLowerCase().replace(/\s+/g," ")}let xs=!1;const qu=c.ref(!1),pn=c.ref([]),Wp=c.ref([]),We=c.ref(null),Wo=c.ref([]),qo=c.ref([]),Mw=()=>{const r=Fn(),e=async T=>{qu.value=!0;const I=T?`_active eq true and ${T}`:"_active eq true",O=await Fr.getOrgList(I);O&&(pn.value=O,xs=!0),qu.value=!1},t=async T=>{var I;return(I=pn.value)!=null&&I.length||await e(T),pn.value};function n(T){if(!pn.value)throw new Error("Data not stored yet");const I=Ei(pn.value,T,["name","description"]);return T!==""?I:pn.value}const i=T=>{Wp.value=T},s=T=>{We.value=_i.cloneDeep(T)},l=async T=>await Fr.getOrg(T),d=async()=>{if(We.value!=null){const T=await Fr.createOrg(We.value);return T!=null&&T.data.created_at&&(r.success("Organization created."),xs&&pn.value.push(T.data)),T==null?void 0:T.data}},f=async()=>{if(ae.value=!0,We.value&&We.value.__id){const T=await Fr.updateOrg(We.value);if(xs&&(T!=null&&T.data.__id)){const I=pn.value.findIndex(O=>O.__id===T.data.__id);return I!==-1?(pn.value[I]=T.data,r.success("Organization updated.")):r.error("Unable to update item"),ae.value=!1,T.data}}else ae.value=!1,r.error("Unable to update item")},g=async()=>{if(ae.value=!0,We.value&&We.value.created_at){if(await Fr.deactivateOrg(We.value.__id),xs){const T=pn.value.findIndex(I=>{var O;return I.__id===((O=We.value)==null?void 0:O.__id)});if(T!==-1)return pn.value.splice(T,1),We.value;r.error("Unable to deactivate organization")}ae.value=!1}};async function m(T){ae.value=!0;try{if(We.value&&We.value.__id){const I={...T,organization:We.value.__id};if(!await Hr.updateBranch(I)){ae.value=!1;return}if(Wo.value.findIndex(F=>F.__id===T.__id)===-1)return r.success("Branch added successfully."),Wo.value.push(I),I;r.info("Branch already added.")}}catch(I){console.error(I)}finally{ae.value=!1}}async function v(T){if(ae.value=!0,We.value&&We.value.__id){const I={...T,organization:null};if(!await Hr.updateBranch(I)){ae.value=!1;return}const $=Wo.value.findIndex(F=>F.__id===T.__id);if($!==-1)return Wo.value.splice($,1),ae.value=!1,Wo.value;throw new Error("Item not found to remove")}ae.value=!1}async function C(T){ae.value=!0;try{if(We.value&&We.value.__id){const I={...T,organization:We.value.__id};if(!await en.updateTeam(I)){ae.value=!1;return}if(qo.value.findIndex(F=>F.__id===T.__id)===-1)return r.success("Team added successfully."),qo.value.push(I),I;r.info("Team already added.")}}catch(I){console.error(I)}finally{ae.value=!1}}async function S(T){if(ae.value=!0,We.value&&We.value.__id){const I={...T,organization:null};if(!await en.updateTeam(I)){ae.value=!1;return}const $=qo.value.findIndex(F=>F.__id===T.__id);if($!==-1)return qo.value.splice($,1),ae.value=!1,qo.value;throw new Error("Item not found to remove")}ae.value=!1}return{data:pn,loading:qu,columns:Wp,item:We,filterData:n,__init__:e,getData:t,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,orgBranches:Wo,orgTeams:qo,linkBranch:m,unlinkBranch:v,linkTeam:C,unlinkTeam:S}};let Ds=!1;const vn=c.ref([]),qp=c.ref([]),ot=c.ref(null),Gu=c.ref(!1),Go=c.ref([]),xw=()=>{const r=Fn(),e=async C=>{Gu.value=!0;const S=C?`_active eq true and ${C}`:"_active eq true",T=await en.getTeamList(S);T&&(vn.value=T,Ds=!0),Gu.value=!1},t=async C=>(vn.value.length||await e(C),vn.value);function n(C){if(!vn.value)throw new Error("Data not stored yet");const S=Ei(vn.value,C,["name","description"]);return C!==""?S:vn.value}const i=C=>{qp.value=C},s=C=>{ot.value=_i.cloneDeep(C)},l=async C=>await en.getTeam(C),d=async()=>{if(ot.value!=null){const C=await en.createTeam(ot.value);return C!=null&&C.data.created_at&&(r.success("Team created."),Ds&&vn.value.push(C.data)),C==null?void 0:C.data}},f=async()=>{if(ae.value=!0,ot.value&&ot.value.__id){const C=await en.updateTeam(ot.value);if(Ds&&(C!=null&&C.data.__id)){const S=vn.value.findIndex(T=>T.__id===C.data.__id);return S!==-1?(vn.value[S]=C.data,r.success("Team updated.")):r.error("Unable to update item"),C.data}}else r.error("Unable to update item")},g=async()=>{if(ot.value&&ot.value.created_at&&(await en.deactivateTeam(ot.value.__id),Ds)){const C=vn.value.findIndex(S=>{var T;return S.__id===((T=ot.value)==null?void 0:T.__id)});if(C!==-1)return vn.value.splice(C,1),ot.value;r.error("Unable to deactivate organization")}};async function m(C){var S;if(ae.value=!0,(S=ot.value)!=null&&S.__id)if(Go.value.findIndex(I=>I.__id===C.__id)===-1)try{const I=await en.linkManageUser(ot.value.__id,{team:ot.value.__id,user:C.__id,role:"string",joined_at:"string",comments:"string"}),O=await en.getTeamUserList(ot.value.__id);return O&&(Go.value=O),r.success("User added successfully."),I}catch(I){console.error(I),r.error("Unable to add User.")}finally{ae.value=!1}else r.info("User already added.");else console.warn("No item selected or item ID is missing."),r.info("Please select a valid item.");ae.value=!1}async function v(C){if(ae.value=!0,ot.value&&ot.value.__id){const S=Go.value.findIndex(T=>T.__id===C);if(S!==-1)return await en.unlinkManageUser(ot.value.__id,C),Go.value.splice(S,1),ae.value=!1,Go.value;throw new Error("Item not found to remove")}ae.value=!1}return{data:vn,loading:Gu,columns:qp,item:ot,usersTeam:Go,__init__:e,getData:t,filterData:n,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,linkUser:m,unlinkUser:v}},Dw=c.defineComponent({__name:"GlobalScopeFilter",setup(r){var O,$,F;const{openDialog:e}=va("global-scope__J-"),{user:t,domain:n,scope:i,session:s,setScope:l}=Yc(),{getData:d,data:f}=Mw(),{getData:g,data:m}=xw(),v=c.ref(!1);c.onBeforeMount(async()=>{v.value=!0,await d(),await g(),v.value=!1});const C=c.ref({scope_type:(O=i.value)==null?void 0:O.scope_type,organization:(($=i.value)==null?void 0:$.organization)??"org",team:(F=i.value)==null?void 0:F.team});function S(){var H,z,Q;C.value={...i.value,scope_type:(H=i.value)==null?void 0:H.scope_type,organization:((z=i.value)==null?void 0:z.organization)??"",team:(Q=i.value)==null?void 0:Q.team},e()}const T=c.computed(()=>{var H;switch((H=i.value)==null?void 0:H.scope_type){case"user":return P1;case"org":return O1;case"team":return M1;default:return N1}});async function I(){var H;((H=i.value)==null?void 0:H.scope_type)!==""&&l(C.value)}return(H,z)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[c.createVNode(Be.VBtn,{onClick:S,icon:"",class:"text-secondary ms-3",color:"surface",rounded:"sm",size:"small",variant:"flat"},{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(T.value),{size:"20"}))]),_:1}),c.createVNode(c.unref(Ca),{loading:v.value,title:"Scope","dialog-id":"global-scope__J-","on-save":I},{default:c.withCtx(()=>[c.createElementVNode("div",null,[c.createVNode(_e.VRow,null,{default:c.withCtx(()=>[c.createVNode(_e.VCol,{cols:"4",class:"d-flex flex-row align-center"},{default:c.withCtx(()=>[c.createVNode(Vt.VListItem,null,{default:c.withCtx(()=>[c.createVNode(Vt.VListItemTitle,null,{default:c.withCtx(()=>z[3]||(z[3]=[c.createTextVNode(" User")])),_:1}),c.createVNode(Vt.VListItemSubtitle,null,{default:c.withCtx(()=>{var Q;return[c.createTextVNode(c.toDisplayString(((Q=c.unref(t))==null?void 0:Q.name)||"Unknown"),1)]}),_:1})]),_:1})]),_:1}),c.createVNode(_e.VCol,{cols:"4"},{default:c.withCtx(()=>[c.createVNode(Vt.VListItem,null,{default:c.withCtx(()=>[c.createVNode(Vt.VListItemTitle,null,{default:c.withCtx(()=>z[4]||(z[4]=[c.createTextVNode(" Domain")])),_:1}),c.createVNode(Vt.VListItemSubtitle,null,{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(n)),1)]),_:1})]),_:1})]),_:1}),c.createVNode(_e.VCol,{cols:"4"},{default:c.withCtx(()=>[c.createVNode(Vt.VListItem,null,{default:c.withCtx(()=>[c.createVNode(Vt.VListItemTitle,null,{default:c.withCtx(()=>z[5]||(z[5]=[c.createTextVNode(" Environment")])),_:1}),c.createVNode(Vt.VListItemSubtitle,null,{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(s).environment),1)]),_:1})]),_:1})]),_:1})]),_:1}),c.createVNode(Rk.VBtnToggle,{density:"compact",variant:"outlined",modelValue:C.value.scope_type,"onUpdate:modelValue":z[0]||(z[0]=Q=>C.value.scope_type=Q),class:"d-flex justify-center my-4"},{default:c.withCtx(()=>[c.createVNode(Be.VBtn,{value:"org",label:"Organizational",color:"secondary",class:""},{default:c.withCtx(()=>z[6]||(z[6]=[c.createTextVNode("Organizational")])),_:1}),c.createVNode(Be.VBtn,{value:"team",label:"Team",color:"secondary",class:""},{default:c.withCtx(()=>z[7]||(z[7]=[c.createTextVNode("Team")])),_:1}),c.createVNode(Be.VBtn,{value:"user",label:"User",color:"secondary",class:""},{default:c.withCtx(()=>z[8]||(z[8]=[c.createTextVNode("User")])),_:1}),c.createVNode(Be.VBtn,{value:"",label:"None",color:"lightext",class:""},{default:c.withCtx(()=>z[9]||(z[9]=[c.createTextVNode("None")])),_:1})]),_:1},8,["modelValue"]),c.createElementVNode("div",null,[c.createVNode(la.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:c.withCtx(()=>z[10]||(z[10]=[c.createTextVNode("Organization")])),_:1}),c.createVNode(ea.VSelect,{items:c.unref(f),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:"Select a Organization",class:"min-w-50",modelValue:C.value.organization,"onUpdate:modelValue":z[1]||(z[1]=Q=>C.value.organization=Q)},null,8,["items","modelValue"]),c.createVNode(la.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:c.withCtx(()=>z[11]||(z[11]=[c.createTextVNode("Team")])),_:1}),c.createVNode(ea.VSelect,{items:c.unref(m),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:"Select a Team",class:"min-w-50",modelValue:C.value.team,"onUpdate:modelValue":z[2]||(z[2]=Q=>C.value.team=Q)},null,8,["items","modelValue"])])])]),_:1},8,["loading"])],64))}}),XB={},ZB={class:"double-ring-spinner-container"};function eU(r,e){return c.openBlock(),c.createElementBlock("div",ZB,e[0]||(e[0]=[c.createElementVNode("div",{class:"spinner-loading"},[c.createElementVNode("div"),c.createElementVNode("div"),c.createElementVNode("div",null,[c.createElementVNode("div")]),c.createElementVNode("div",null,[c.createElementVNode("div")])],-1)]))}const Lw=pi(XB,[["render",eU],["__scopeId","data-v-00d7a69f"]]),tU={key:0,class:"_jspinner-overlay_jj"},Bw=c.defineComponent({__name:"GlobalSpinner",setup(r){return(e,t)=>c.unref(ae)?(c.openBlock(),c.createElementBlock("div",tU,t[0]||(t[0]=[c.createElementVNode("div",{class:"j-double-ring-spinner-container"},[c.createElementVNode("div",{class:"j-global-spinner-loading"},[c.createElementVNode("div"),c.createElementVNode("div"),c.createElementVNode("div",null,[c.createElementVNode("div")]),c.createElementVNode("div",null,[c.createElementVNode("div")])])],-1)]))):c.createCommentVNode("",!0)}}),nU=Object.freeze(Object.defineProperty({__proto__:null,AvatarPicture:Hv,ColumnSettingsDialog:Fd,ConfirmDialog:Vv,ContextMenu:$v,CopyButton:Cc,DeleteAllBtn:Dd,DotsMenu:Bv,DotsMenuV1:Uv,EditButton:xv,FormHeadless:wy,FormMetadata:kc,GlobalScopeFilter:Dw,GlobalSpinner:Bw,JAvatar:Fv,JBtn:nv,JDialog:Ca,JForm:yy,JIconBtn:tv,JSelect:gy,JTextArea:my,JTextField:fy,ParentCard:Sc,SpinnerLoader:Lw,TabFormHeader:Cy,TableAdvanced:Yv,TableCard:Hd,TableCardsView:dy,TableHeader:Qv,UiTable:Kv},Symbol.toStringTag,{value:"Module"})),rU=oR(),oU={transition:"Vue-Toastification__fade",maxToasts:20,newestOnTop:!0};let ju=!1;const Yu=c.ref(!1),yn=c.ref([]),Gp=c.ref([]),gt=c.ref(null),jo=c.ref([]),iU=()=>{const r=Fn(),e=async C=>{Yu.value=!0;const S=C?`_active eq true and ${C}`:"_active eq true",T=await Hr.getBranchList(S);T&&(yn.value=T,ju=!0),Yu.value=!1},t=async C=>(yn.value.length||await e(C),yn.value);function n(C){if(!yn.value)throw new Error("Data not stored yet");const S=Ei(yn.value,C,["name","description"]);return C!==""?S:yn.value}const i=C=>{Gp.value=C},s=C=>{gt.value=_i.cloneDeep(C)},l=async C=>await Hr.getBranch(C),d=async()=>{if(gt.value!=null){const C=await Hr.createBranch(gt.value);return C!=null&&C.data.created_at&&(r.success("Branch created."),ju&&yn.value.push(C.data)),C==null?void 0:C.data}},f=async()=>{if(gt.value&&gt.value.__id){const C=await Hr.updateBranch(gt.value);if(ju&&C){const S=yn.value.findIndex(T=>T.__id===C.data.__id);return S!==-1?(yn.value[S]=C.data,r.success("Branch updated.")):r.error("Unable to update item"),C}}else r.error("Unable to update item")},g=async()=>{if(gt.value&&gt.value.created_at){await Hr.deactivateBranch(gt.value.__id);const C=yn.value.findIndex(S=>{var T;return S.__id===((T=gt.value)==null?void 0:T.__id)});if(C!==-1)return yn.value.splice(C,1),gt.value;r.error("Unable to deactivate Domain")}};async function m(C){ae.value=!0;try{if(gt.value&&gt.value.__id){const S={...C,branch:gt.value.__id};if(!await en.updateTeam(S)){r.error("Unable to link team");return}if(jo.value.findIndex(O=>O.__id===C.__id)===-1)return r.success("Team added successfully."),jo.value.push(S),S;r.info("Team already added.")}else throw new Error("Item is not defined")}catch(S){console.error(S)}finally{ae.value=!1}}async function v(C){if(ae.value=!0,gt.value&&gt.value.__id){const S={...C,branch:null};if(!await en.updateTeam(S))return;const I=jo.value.findIndex(O=>O.__id===C.__id);if(I!==-1)return jo.value.splice(I,1),ae.value=!1,jo.value;throw new Error("Item not found to remove")}ae.value=!1}return{data:yn,columns:Gp,item:gt,loading:Yu,__init__:e,getData:t,filterData:n,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,branchTeams:jo,linkTeam:m,unlinkTeam:v}};function aU(){const r=Ti("https://api.jplan.com.br/management/division"),{error:e}=Fn();return{async getDivisionList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch Division list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getDivisionList:",n),e("Failed to fetch Division list");return}},async createDivision(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in createDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create Division"),s}},async updateDivision(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error)throw e("Failed to update Division"),new Error(s.data.error);return s}catch(s){throw console.error("Error in updateDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update Division"),s}},async getDivision(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error)throw e("Failed to fetch Division"),new Error(s.data.error);return s.data}catch(s){throw console.error("Error in getDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch Division"),s}},async activateDivision(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate Division"),new Error(s.data.error)}catch(s){throw console.error("Error in activateDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate Division"),s}},async deactivateDivision(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate Division"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateDivision:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate Division"),s}}}}const ei=aU();let Ju=!1;const Qu=c.ref(!1),Cn=c.ref([]),jp=c.ref([]),mt=c.ref(null),Yo=c.ref([]),sU=()=>{const r=Fn(),e=async C=>{Qu.value=!0;const S=C?`_active eq true and ${C}`:"_active eq true",T=await ei.getDivisionList(S);T&&(Cn.value=T,Ju=!0),Qu.value=!1},t=async C=>(Cn.value.length||await e(C),Cn.value);function n(C){if(!Cn.value)throw new Error("Data not stored yet");const S=Ei(Cn.value,C,["name","description"]);return C!==""?S:Cn.value}const i=C=>{jp.value=C},s=C=>{mt.value=_i.cloneDeep(C)},l=async C=>await ei.getDivision(C),d=async()=>{if(mt.value!=null){const C=await ei.createDivision(mt.value);return C!=null&&C.data.created_at&&(r.success("Division created."),Ju&&Cn.value.push(C.data)),C==null?void 0:C.data}},f=async()=>{if(ae.value=!0,mt.value&&mt.value.__id){const C=await ei.updateDivision(mt.value);if(Ju&&(C!=null&&C.data.__id)){const S=Cn.value.findIndex(T=>T.__id===C.data.__id);return S!==-1?(Cn.value[S]=C.data,r.success("Updated Division.")):r.error("Unable to update item"),ae.value=!1,C}}else ae.value=!1,r.error("Unable to update item")},g=async()=>{if(ae.value=!0,mt.value&&mt.value.created_at){await ei.deactivateDivision(mt.value.__id);const C=Cn.value.findIndex(S=>{var T;return S.__id===((T=mt.value)==null?void 0:T.__id)});if(C!==-1)return Cn.value.splice(C,1),mt.value;r.error("Unable to deactivate Division")}ae.value=!1};async function m(C){ae.value=!0;try{if(mt.value&&mt.value.__id){const S={...C,division:mt.value.__id};return await Fr.updateOrg(S)?(Yo.value.findIndex(O=>O.__id===C.__id)===-1?(r.success("Organization added successfully."),Yo.value.push(S)):r.info("Organization already added."),S):void 0}else throw new Error("Item is not defined")}catch(S){console.error(S)}finally{ae.value=!1}}async function v(C){if(ae.value=!0,mt.value&&mt.value.__id){const S={...C,division:null};if(!await Fr.updateOrg(S))return;const I=Yo.value.findIndex(O=>O.__id===C.__id);if(I!==-1)Yo.value.splice(I,1);else throw new Error("Item não encontrado para remoção")}else throw new Error("Item não está definido");return ae.value=!1,Yo.value}return{data:Cn,columns:jp,item:mt,loading:Qu,__init__:e,filterData:n,getData:t,setColumns:i,setItem:s,getItem:l,createItem:d,updateItem:f,removeItem:g,orgs:Yo,linkDivision:m,unlinkDivision:v}};function cU(){const r=Ti("https://api.jplan.com.br/management/user"),{error:e}=Fn();return{async getManageUserList(t){try{const n=t?`?filter_query=${t}`:"",i=await r.get(`/list/${n}`);if(i.data.error)throw e("Failed to fetch User list"),new Error(i.data.error);return i.data.data}catch(n){console.error("Error in getManageUserList:",n),e("Failed to fetch User list");return}},async createManageUser(t){var n,i;try{const s=await r.post("/item",t);return s.status>=200&&s.status<300?s:void 0}catch(s){throw console.error("Error in createManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to create User"),s}},async updateManageUser(t){var n,i;try{const s=await r.patch("/item",t);if(s.data.error)throw e("Failed to update User"),new Error(s.data.error);return s}catch(s){throw console.error("Error in updateManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to update User"),s}},async getManageUser(t){var n,i;try{const s=await r.get(`/item/${t}`);if(s.data.error)throw e("Failed to fetch User"),new Error(s.data.error);return s.data}catch(s){console.error("Error in getManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to fetch User");return}},async activateManageUser(t){var n,i;try{const s=await r.post(`/item/${t}/activate`);if(s.data.error)throw e("Failed to activate User"),new Error(s.data.error)}catch(s){throw console.error("Error in activateManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to activate User"),s}},async deactivateManageUser(t){var n,i;try{const s=await r.post(`/item/${t}/deactivate`);if(s.data.error)throw e("Failed to deactivate User"),new Error(s.data.error)}catch(s){throw console.error("Error in deactivateManageUser:",s),e(((i=(n=s.response)==null?void 0:n.data)==null?void 0:i.message)||"Failed to deactivate User"),s}}}}const ti=cU();let Xu=!1,Zu=c.ref(!1);const wn=c.ref([]),Yp=c.ref([]),_n=c.ref(null),lU=c.ref(null),uU=c.ref([]),dU=()=>{const r=Fn(),e=async m=>{Zu.value=!0;const v=m?`_active eq true and ${m}`:"_active eq true",C=await ti.getManageUserList(v);C&&(wn.value=C,Xu=!0),Zu.value=!1},t=async m=>(wn.value.length||await e(m),wn.value);function n(m){if(!wn.value)throw new Error("Data not stored yet");const v=Ei(wn.value,m,["name","description"]);return m!==""?v:wn.value}return{data:wn,loading:Zu,columns:Yp,item:_n,filterData:n,__init__:e,getData:t,setColumns:m=>{Yp.value=m},setItem:m=>{_n.value=_i.cloneDeep(m)},getItem:async m=>await ti.getManageUser(m),createItem:async()=>{if(_n.value!=null){const m=crypto.randomUUID(),v=await ti.createManageUser({..._n.value,__id:m});return v!=null&&v.data.created_at&&(r.success("User created."),Xu&&wn.value.push(v.data)),v==null?void 0:v.data}},updateItem:async()=>{if(ae.value=!0,_n.value&&_n.value.created_at){const m=await ti.updateManageUser(_n.value);if(Xu&&(m!=null&&m.data)){const v=wn.value.findIndex(C=>C.__id===(m==null?void 0:m.data.__id));if(v!==-1)wn.value[v]=m==null?void 0:m.data,r.success("User created.");else throw new Error("Unable to find item after update")}return ae.value=!1,m==null?void 0:m.data}},removeItem:async()=>{if(_n.value&&_n.value.created_at){try{await ti.deactivateManageUser(_n.value.__id)}catch{r.error("Unable to deactivate user");return}const m=wn.value.findIndex(v=>{var C;return v.__id===((C=_n.value)==null?void 0:C.__id)});if(m!==-1)return wn.value.splice(m,1),_n.value}},userOrg:lU,userTeams:uU}},hU=r=>{r.use(rU),r.use(aO,oU),Object.entries(nU).forEach(([e,t])=>{r.component(e,t)}),Object.entries(Nk).forEach(([e,t])=>{r.provide(e,t)})},fU={install:hU};exports.ContextMenu=$v;exports.EventBus=Tc;exports.FormHeadless=wy;exports.HttpCore=YB;exports.SpinnerLoader=Lw;exports.TableCardsView=dy;exports.TableHeader=Qv;exports.__spinner=ae;exports._export_sfc=pi;exports._sfc_main=Kv;exports._sfc_main$1=Yv;exports._sfc_main$10=Dd;exports._sfc_main$11=xv;exports._sfc_main$12=Ca;exports._sfc_main$13=tv;exports._sfc_main$14=gy;exports._sfc_main$15=my;exports._sfc_main$16=fy;exports._sfc_main$17=yy;exports._sfc_main$18=Cy;exports._sfc_main$19=Sc;exports._sfc_main$2=Fd;exports._sfc_main$20=Fv;exports._sfc_main$21=Hv;exports._sfc_main$22=Dw;exports._sfc_main$23=Bw;exports._sfc_main$3=Hd;exports._sfc_main$4=Vv;exports._sfc_main$5=Cc;exports._sfc_main$6=Bv;exports._sfc_main$7=Uv;exports._sfc_main$8=kc;exports._sfc_main$9=nv;exports.branchInstance=Hr;exports.coreClient=Ph;exports.createToastInterface=ha;exports.dateFormat=jv;exports.divisionInstance=ei;exports.filterQuery=Ei;exports.globalEventBus=xd;exports.index=fU;exports.manageUserInstance=ti;exports.msal=Et;exports.orgInstance=Fr;exports.provideToast=iO;exports.scopedClient=Ti;exports.setupAuthGuard=zB;exports.teamInstance=en;exports.toastInjectionKey=Ec;exports.useBranchStore=iU;exports.useCustomizer=lR;exports.useDialog=va;exports.useDivisionStore=sU;exports.useManageUserStore=dU;exports.useOrganizationStore=Mw;exports.useSession=Yc;exports.useTeamStore=xw;exports.useToast=Fn;