@veecode-platform/plugin-veecode-homepage-dynamic 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/VeeCodeHomePage.esm.js +0 -2
- package/dist/components/VeeCodeHomePage.esm.js.map +1 -1
- package/dist-scalprum/plugin-manifest.json +3 -3
- package/dist-scalprum/static/{1213.412457e8.chunk.js → 1213.aff960fc.chunk.js} +3 -3
- package/dist-scalprum/static/1213.aff960fc.chunk.js.map +1 -0
- package/dist-scalprum/static/2211.f5266f49.chunk.js +29 -0
- package/dist-scalprum/static/2211.f5266f49.chunk.js.map +1 -0
- package/dist-scalprum/static/3837.e9b60659.chunk.js +2 -0
- package/dist-scalprum/static/3837.e9b60659.chunk.js.map +1 -0
- package/dist-scalprum/static/41.53c70bd6.chunk.js +2 -0
- package/dist-scalprum/static/41.53c70bd6.chunk.js.map +1 -0
- package/dist-scalprum/static/{4197.8a8b877f.chunk.js → 4197.0e023080.chunk.js} +2 -2
- package/dist-scalprum/static/{4197.8a8b877f.chunk.js.map → 4197.0e023080.chunk.js.map} +1 -1
- package/dist-scalprum/static/{4864.0a352dc6.chunk.js → 4864.3cede332.chunk.js} +2 -2
- package/dist-scalprum/static/{4864.0a352dc6.chunk.js.map → 4864.3cede332.chunk.js.map} +1 -1
- package/dist-scalprum/static/{5255.21365d93.chunk.js → 5255.31f4471a.chunk.js} +2 -2
- package/dist-scalprum/static/{5255.21365d93.chunk.js.map → 5255.31f4471a.chunk.js.map} +1 -1
- package/dist-scalprum/static/5749.9f83e5fe.chunk.js +179 -0
- package/dist-scalprum/static/5749.9f83e5fe.chunk.js.map +1 -0
- package/dist-scalprum/static/{5888.d5ff87d6.chunk.js → 5888.39088266.chunk.js} +1 -1
- package/dist-scalprum/static/{5888.d5ff87d6.chunk.js.map → 5888.39088266.chunk.js.map} +1 -1
- package/dist-scalprum/static/6123.b8f54e25.chunk.js +2 -0
- package/dist-scalprum/static/6123.b8f54e25.chunk.js.map +1 -0
- package/dist-scalprum/static/{6356.0690b575.chunk.js → 6356.a59d5e2e.chunk.js} +2 -2
- package/dist-scalprum/static/{6356.0690b575.chunk.js.map → 6356.a59d5e2e.chunk.js.map} +1 -1
- package/dist-scalprum/static/{6700.f2dbf122.chunk.js → 6700.8ab31ec1.chunk.js} +1 -1
- package/dist-scalprum/static/{6700.f2dbf122.chunk.js.map → 6700.8ab31ec1.chunk.js.map} +1 -1
- package/dist-scalprum/static/8692.8ab75fef.chunk.js +2 -0
- package/dist-scalprum/static/8692.8ab75fef.chunk.js.map +1 -0
- package/dist-scalprum/static/9541.dde4bd87.chunk.js +3 -0
- package/dist-scalprum/static/9541.dde4bd87.chunk.js.map +1 -0
- package/dist-scalprum/static/{9633.d7b4641e.chunk.js → 9633.47d13d21.chunk.js} +2 -2
- package/dist-scalprum/static/{9633.d7b4641e.chunk.js.map → 9633.47d13d21.chunk.js.map} +1 -1
- package/dist-scalprum/static/{exposed-PluginRoot.bf5e0b03.chunk.js → exposed-PluginRoot.221d8f69.chunk.js} +2 -2
- package/dist-scalprum/static/{exposed-PluginRoot.bf5e0b03.chunk.js.map → exposed-PluginRoot.221d8f69.chunk.js.map} +1 -1
- package/dist-scalprum/{veecode-platform.plugin-veecode-homepage.52a7b0ce89460aa40ee1.js → veecode-platform.plugin-veecode-homepage.ea406b87d3dc1c912550.js} +2 -2
- package/dist-scalprum/veecode-platform.plugin-veecode-homepage.ea406b87d3dc1c912550.js.map +1 -0
- package/package.json +1 -1
- package/dist/components/headerComponent/HeaderComponent.esm.js +0 -67
- package/dist/components/headerComponent/HeaderComponent.esm.js.map +0 -1
- package/dist/components/headerComponent/iconButtonComponent/IconButtonComponent.esm.js +0 -35
- package/dist/components/headerComponent/iconButtonComponent/IconButtonComponent.esm.js.map +0 -1
- package/dist/components/headerComponent/logout/Logout.esm.js +0 -30
- package/dist/components/headerComponent/logout/Logout.esm.js.map +0 -1
- package/dist/components/headerComponent/menuItems/MenuItems.esm.js +0 -134
- package/dist/components/headerComponent/menuItems/MenuItems.esm.js.map +0 -1
- package/dist/components/headerComponent/notifications/Notifications.esm.js +0 -72
- package/dist/components/headerComponent/notifications/Notifications.esm.js.map +0 -1
- package/dist/components/headerComponent/profile/Profle.esm.js +0 -19
- package/dist/components/headerComponent/profile/Profle.esm.js.map +0 -1
- package/dist/components/headerComponent/searchComponent/SearchBar.esm.js +0 -113
- package/dist/components/headerComponent/searchComponent/SearchBar.esm.js.map +0 -1
- package/dist/components/headerComponent/searchComponent/SearchComponent.esm.js +0 -13
- package/dist/components/headerComponent/searchComponent/SearchComponent.esm.js.map +0 -1
- package/dist/components/headerComponent/searchComponent/SearchInput.esm.js +0 -32
- package/dist/components/headerComponent/searchComponent/SearchInput.esm.js.map +0 -1
- package/dist/components/headerComponent/searchComponent/SearchOption.esm.js +0 -50
- package/dist/components/headerComponent/searchComponent/SearchOption.esm.js.map +0 -1
- package/dist/components/headerComponent/searchComponent/SearchResultItem.esm.js +0 -44
- package/dist/components/headerComponent/searchComponent/SearchResultItem.esm.js.map +0 -1
- package/dist/components/headerComponent/toggleTheme/ToggleTheme.esm.js +0 -37
- package/dist/components/headerComponent/toggleTheme/ToggleTheme.esm.js.map +0 -1
- package/dist/hooks/useDebouncedCallback.esm.js +0 -26
- package/dist/hooks/useDebouncedCallback.esm.js.map +0 -1
- package/dist/utils/stringUtils.esm.js +0 -35
- package/dist/utils/stringUtils.esm.js.map +0 -1
- package/dist-scalprum/static/1213.412457e8.chunk.js.map +0 -1
- package/dist-scalprum/static/1853.9c4997f9.chunk.js +0 -2
- package/dist-scalprum/static/1853.9c4997f9.chunk.js.map +0 -1
- package/dist-scalprum/static/41.a129355f.chunk.js +0 -2
- package/dist-scalprum/static/41.a129355f.chunk.js.map +0 -1
- package/dist-scalprum/static/5211.b1dc9542.chunk.js +0 -3
- package/dist-scalprum/static/5211.b1dc9542.chunk.js.map +0 -1
- package/dist-scalprum/static/5571.73942ff6.chunk.js +0 -206
- package/dist-scalprum/static/5571.73942ff6.chunk.js.map +0 -1
- package/dist-scalprum/static/6123.94c2f019.chunk.js +0 -2
- package/dist-scalprum/static/6123.94c2f019.chunk.js.map +0 -1
- package/dist-scalprum/static/6460.86145f5a.chunk.js +0 -2
- package/dist-scalprum/static/6460.86145f5a.chunk.js.map +0 -1
- package/dist-scalprum/static/6921.efadb98d.chunk.js +0 -2
- package/dist-scalprum/static/6921.efadb98d.chunk.js.map +0 -1
- package/dist-scalprum/veecode-platform.plugin-veecode-homepage.52a7b0ce89460aa40ee1.js.map +0 -1
- /package/dist-scalprum/static/{1213.412457e8.chunk.js.LICENSE.txt → 1213.aff960fc.chunk.js.LICENSE.txt} +0 -0
- /package/dist-scalprum/static/{5571.73942ff6.chunk.js.LICENSE.txt → 5749.9f83e5fe.chunk.js.LICENSE.txt} +0 -0
- /package/dist-scalprum/static/{5211.b1dc9542.chunk.js.LICENSE.txt → 9541.dde4bd87.chunk.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(self.webpackChunkveecode_platform_plugin_veecode_homepage=self.webpackChunkveecode_platform_plugin_veecode_homepage||[]).push([[4864],{14864:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AlertApiForwarder:()=>ue,ApiFactoryRegistry:()=>f,ApiProvider:()=>l,ApiResolver:()=>p,AppRouter:()=>Ge,AppThemeSelector:()=>fe,AtlassianAuth:()=>oe,BitbucketAuth:()=>ee,BitbucketServerAuth:()=>re,ConfigReader:()=>Ae,ErrorAlerter:()=>Re,ErrorApiForwarder:()=>je,FeatureFlagged:()=>tt,FetchMiddlewares:()=>Fe,FlatRoutes:()=>Wr,FrontendHostDiscovery:()=>Oe,GithubAuth:()=>I,GitlabAuth:()=>L,GoogleAuth:()=>F,LocalStorageFeatureFlags:()=>Ie,MicrosoftAuth:()=>J,MultipleAnalyticsApi:()=>le,NoOpAnalyticsApi:()=>pe,OAuth2:()=>E,OAuthRequestManager:()=>De,OktaAuth:()=>M,OneLoginAuth:()=>Q,OpenShiftAuth:()=>ce,SamlAuth:()=>z,UnhandledErrorForwarder:()=>Ee,UrlPatternDiscovery:()=>ke,VMwareCloudAuth:()=>ie,WebStorage:()=>Me,createFetchApi:()=>Ce,createSpecializedApp:()=>Gr,defaultConfigLoader:()=>Rt,openLoginPopup:()=>g});var n=r(31085),o=r(95478),s=r(39067),i=r.n(s);class a{holders;constructor(...e){this.holders=e}get(e){for(const t of this.holders){const r=t.get(e);if(r)return r}}}var c=r(64218);const u=(0,c.createVersionedContext)("api-context"),l=e=>{const{apis:t,children:r}=e,s=(0,o.useContext)(u)?.atVersion(1),i=s?new a(t,s):t;return(0,n.jsx)(u.Provider,{value:(0,c.createVersionedValueMap)({1:i}),children:r})};l.propTypes={apis:i().shape({get:i().func.isRequired}).isRequired,children:i().node};class p{constructor(e){this.factories=e}static validateFactories(e,t){for(const r of t){const t=[r],n=new Set;for(;t.length;){const o=t.shift(),s=e.get(o);if(s)for(const e of Object.values(s.deps)){if(e.id===r.id)throw new Error(`Circular dependency of api factory for ${r}`);n.has(e)||(n.add(e),t.push(e))}}}}apis=new Map;get(e){return this.load(e)}load(e,t=[]){const r=this.apis.get(e.id);if(r)return r;const n=this.factories.get(e);if(!n)return;if(t.includes(n.api))throw new Error(`Circular dependency of api factory for ${n.api}`);const o=this.loadDeps(e,n.deps,[...t,n.api]),s=n.factory(o);return this.apis.set(e.id,s),s}loadDeps(e,t,r){const n={};for(const o in t)if(t.hasOwnProperty(o)){const s=t[o],i=this.load(s,r);if(!i)throw new Error(`No API factory available for dependency ${s} of dependent ${e}`);n[o]=i}return n}}var h=(e=>(e[e.default=10]="default",e[e.app=50]="app",e[e.static=100]="static",e))(h||{});class f{factories=new Map;register(e,t){const r=h[e],n=this.factories.get(t.api.id);return!(n&&n.priority>=r||(this.factories.set(t.api.id,{priority:r,factory:t}),0))}get(e){const t=this.factories.get(e.id);if(t)return t.factory}getAllApis(){const e=new Set;for(const{factory:t}of this.factories.values())e.add(t.api);return e}}function g(e){return new Promise((t,r)=>{const n=e.width||500,o=e.height||700,s=window.screen.width/2-n/2,i=window.screen.height/2-o/2,a=new URL(e.url).origin,c=window.open(e.url,e.name,`menubar=no,location=no,resizable=no,scrollbars=no,status=no,width=${n},height=${o},top=${i},left=${s}`);let u="";if(!c||void 0===c.closed||c.closed){const e=new Error("Failed to open auth popup.");return e.name="PopupRejectedError",void r(e)}const l=e=>{if(e.source!==c)return;if(e.origin!==a)return;const{data:n}=e;if("config_info"===n.type)return void(u=n.targetOrigin);if("authorization_response"!==n.type)return;const o=n;if("error"in o){const e=new Error(o.error.message);e.name=o.error.name,r(e)}else t(o.response);h()},p=setInterval(()=>{if(c.closed){const e="Login failed, "+(u&&u!==window.location.origin?`Incorrect app origin, expected ${u}`:"popup was closed"),t=new Error(e);t.name="PopupClosedError",r(t),h()}},100);function h(){window.removeEventListener("message",l),clearInterval(p)}window.addEventListener("message",l)})}let d=!1;function v(e){return[...e].join(" ")}class y{discoveryApi;environment;provider;joinScopesFunc;authRequester;sessionTransform;enableExperimentalRedirectFlow;popupOptions;constructor(e){const{configApi:t,discoveryApi:r,environment:n,provider:o,joinScopes:s=v,oauthRequestApi:i,sessionTransform:a=e=>e,popupOptions:c}=e;d||t||(console.warn("DEPRECATION WARNING: Authentication providers require a configApi instance to configure the authentication flow. Please provide one to the authentication provider constructor."),d=!0),this.enableExperimentalRedirectFlow=!!t&&(t.getOptionalBoolean("enableExperimentalRedirectFlow")??!1),this.authRequester=i.createAuthRequester({provider:o,onAuthRequest:async e=>this.enableExperimentalRedirectFlow?this.executeRedirect(e):this.showPopup(e)}),this.discoveryApi=r,this.environment=n,this.provider=o,this.joinScopesFunc=s,this.sessionTransform=a,this.popupOptions=c}async createSession(e){return e.instantPopup?this.enableExperimentalRedirectFlow?this.executeRedirect(e.scopes):this.showPopup(e.scopes):this.authRequester(e.scopes)}async refreshSession(e){const t=await fetch(await this.buildUrl("/refresh",{optional:!0,...e&&{scope:this.joinScopesFunc(e.scopes)}}),{headers:{"x-requested-with":"XMLHttpRequest"},credentials:"include"}).catch(e=>{throw new Error(`Auth refresh request failed, ${e}`)});if(!t.ok){const e=new Error(`Auth refresh request failed, ${t.statusText}`);throw e.status=t.status,e}const r=await t.json();if(r.error){const e=new Error(r.error.message);throw r.error.name&&(e.name=r.error.name),e}return await this.sessionTransform(r)}async removeSession(){const e=await fetch(await this.buildUrl("/logout"),{method:"POST",headers:{"x-requested-with":"XMLHttpRequest"},credentials:"include"}).catch(e=>{throw new Error(`Logout request failed, ${e}`)});if(!e.ok){const t=new Error(`Logout request failed, ${e.statusText}`);throw t.status=e.status,t}}async showPopup(e){const t=this.joinScopesFunc(e),r=await this.buildUrl("/start",{scope:t,origin:window.location.origin,flow:"popup"}),n=this.popupOptions?.size?.fullscreen?window.screen.width:this.popupOptions?.size?.width||450,o=this.popupOptions?.size?.fullscreen?window.screen.height:this.popupOptions?.size?.height||730,s=await g({url:r,name:`${this.provider.title} Login`,width:n,height:o});return await this.sessionTransform(s)}async executeRedirect(e){const t=this.joinScopesFunc(e);return window.location.href=await this.buildUrl("/start",{scope:t,origin:window.location.origin,redirectUrl:window.location.href,flow:"redirect"}),new Promise(()=>{})}async buildUrl(e,t){const r=await this.discoveryApi.getBaseUrl("auth"),n=this.buildQueryString({...t,env:this.environment});return`${r}/${this.provider.id}${e}${n}`}buildQueryString(e){if(!e)return"";const t=Object.entries(e).map(([e,t])=>"string"==typeof t?`${encodeURIComponent(e)}=${encodeURIComponent(t)}`:t?encodeURIComponent(e):void 0).filter(Boolean).join("&");return t?`?${t}`:""}}function m(e,t){for(const r of t)if(!e.has(r))return!1;return!0}class w{constructor(e){this.options=e}sessionExistsAndHasScope(e,t){return!!e&&(!t||(void 0===this.options.sessionScopes||m(this.options.sessionScopes(e),t)))}getExtendedScope(e,t){const r=new Set(this.options.defaultScopes);if(e&&void 0!==this.options.sessionScopes){const t=this.options.sessionScopes(e);for(const e of t)r.add(e)}if(t)for(const e of t)r.add(e);return r}}var b=r(96403),S=r.n(b);class A{isClosed=!1;terminatingError;observable=new(S())(e=>this.isClosed?(this.terminatingError?e.error(this.terminatingError):e.complete(),()=>{}):(this.subscribers.add(e),()=>{this.subscribers.delete(e)}));subscribers=new Set;[Symbol.observable](){return this}get closed(){return this.isClosed}next(e){if(this.isClosed)throw new Error("PublishSubject is closed");this.subscribers.forEach(t=>t.next(e))}error(e){if(this.isClosed)throw new Error("PublishSubject is closed");this.isClosed=!0,this.terminatingError=e,this.subscribers.forEach(t=>t.error(e))}complete(){if(this.isClosed)throw new Error("PublishSubject is closed");this.isClosed=!0,this.subscribers.forEach(e=>e.complete())}subscribe(e,t,r){const n="function"==typeof e?{next:e,error:t,complete:r}:e;return this.observable.subscribe(n)}}class x{isClosed;currentValue;terminatingError;observable;constructor(e){this.isClosed=!1,this.currentValue=e,this.terminatingError=void 0,this.observable=new(S())(e=>this.isClosed?(this.terminatingError?e.error(this.terminatingError):e.complete(),()=>{}):(e.next(this.currentValue),this.subscribers.add(e),()=>{this.subscribers.delete(e)}))}subscribers=new Set;[Symbol.observable](){return this}get closed(){return this.isClosed}next(e){if(this.isClosed)throw new Error("BehaviorSubject is closed");this.currentValue=e,this.subscribers.forEach(t=>t.next(e))}error(e){if(this.isClosed)throw new Error("BehaviorSubject is closed");this.isClosed=!0,this.terminatingError=e,this.subscribers.forEach(t=>t.error(e))}complete(){if(this.isClosed)throw new Error("BehaviorSubject is closed");this.isClosed=!0,this.subscribers.forEach(e=>e.complete())}subscribe(e,t,r){const n="function"==typeof e?{next:e,error:t,complete:r}:e;return this.observable.subscribe(n)}}var k=r(9490);class O{subject=new x(k.SessionState.SignedOut);signedIn=!1;setIsSignedIn(e){this.signedIn!==e&&(this.signedIn=e,this.subject.next(this.signedIn?k.SessionState.SignedIn:k.SessionState.SignedOut))}sessionState$(){return this.subject}}class R{connector;helper;sessionScopesFunc;sessionShouldRefreshFunc;stateTracker=new O;refreshPromise;currentSession;constructor(e){const{connector:t,defaultScopes:r=new Set,sessionScopes:n,sessionShouldRefresh:o}=e;this.connector=t,this.sessionScopesFunc=n,this.sessionShouldRefreshFunc=o,this.helper=new w({sessionScopes:n,defaultScopes:r})}async getSession(e){let t=!1;if(this.helper.sessionExistsAndHasScope(this.currentSession,e.scopes)){if(!this.sessionShouldRefreshFunc(this.currentSession))return this.currentSession;t=!0;try{const t=await this.collapsedSessionRefresh(e.scopes),r=this.sessionScopesFunc(this.currentSession);return m(this.sessionScopesFunc(t),r)&&(this.currentSession=t),t}catch(t){if(this.removeLocalSession(),e.optional)return}}if(!t)try{const t=await this.collapsedSessionRefresh(e.scopes);return this.currentSession=t,this.getSession(e)}catch{this.removeLocalSession()}if(!e.optional)return this.currentSession=await this.connector.createSession({...e,scopes:this.helper.getExtendedScope(this.currentSession,e.scopes)}),this.stateTracker.setIsSignedIn(!0),this.currentSession}removeLocalSession(){this.currentSession=void 0,this.stateTracker.setIsSignedIn(!1)}async removeSession(){this.currentSession=void 0,await this.connector.removeSession(),this.stateTracker.setIsSignedIn(!1)}sessionState$(){return this.stateTracker.sessionState$()}async collapsedSessionRefresh(e){if(this.refreshPromise)return this.refreshPromise;this.refreshPromise=this.connector.refreshSession({scopes:this.helper.getExtendedScope(this.currentSession,e)});try{const t=await this.refreshPromise;if(!this.helper.sessionExistsAndHasScope(t,e))throw new Error("Refreshed session did not receive the required scopes");return this.stateTracker.setIsSignedIn(!0),t}finally{delete this.refreshPromise}}}const j={id:"oauth2",title:"Your Identity Provider",icon:()=>null};class E{static createAuthConnector(e){if("authConnector"in e)return e.authConnector;const{scopeTransform:t=e=>e,configApi:r,discoveryApi:n,environment:o="development",provider:s=j,oauthRequestApi:i,popupOptions:a}=e;return new y({configApi:r,discoveryApi:n,environment:o,provider:s,oauthRequestApi:i,sessionTransform({backstageIdentity:e,...r}){const n={...r,providerInfo:{idToken:r.providerInfo.idToken,accessToken:r.providerInfo.accessToken,scopes:E.normalizeScopes(r.providerInfo.scope,{scopeTransform:t}),expiresAt:r.providerInfo.expiresInSeconds?new Date(Date.now()+1e3*r.providerInfo.expiresInSeconds):void 0}};return e&&(n.backstageIdentity={token:e.token,identity:e.identity,expiresAt:e.expiresInSeconds?new Date(Date.now()+1e3*e.expiresInSeconds):void 0}),n},popupOptions:a})}static create(e){const{defaultScopes:t=[],scopeTransform:r=e=>e}=e,n=E.createAuthConnector(e),o=new R({connector:n,defaultScopes:new Set(t),sessionScopes:e=>e.providerInfo.scopes,sessionShouldRefresh:e=>{let t=1/0;return e.providerInfo?.expiresAt&&(t=Math.min(t,(e.providerInfo.expiresAt.getTime()-Date.now())/1e3)),e.backstageIdentity?.expiresAt&&(t=Math.min(t,(e.backstageIdentity.expiresAt.getTime()-Date.now())/1e3)),t<180}});return new E({sessionManager:o,scopeTransform:r})}sessionManager;scopeTransform;constructor(e){this.sessionManager=e.sessionManager,this.scopeTransform=e.scopeTransform}async signIn(){await this.getAccessToken()}async signOut(){await this.sessionManager.removeSession()}sessionState$(){return this.sessionManager.sessionState$()}async getAccessToken(e,t){const r=E.normalizeScopes(e,{scopeTransform:this.scopeTransform}),n=await this.sessionManager.getSession({...t,scopes:r});return n?.providerInfo.accessToken??""}async getIdToken(e={}){const t=await this.sessionManager.getSession({...e,scopes:new Set(["openid"])});return t?.providerInfo.idToken??""}async getBackstageIdentity(e={}){const t=await this.sessionManager.getSession(e);return t?.backstageIdentity}async getProfile(e={}){const t=await this.sessionManager.getSession(e);return t?.profile}static normalizeScopes(e,t){if(!e)return new Set;const r=Array.isArray(e)?e:e.split(/[\s|,]/).filter(Boolean),n=t?t.scopeTransform(r):r;return new Set(n)}}const P={id:"github",title:"GitHub",icon:()=>null};class I{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=P,oauthRequestApi:s,defaultScopes:i=["read:user"]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n,defaultScopes:i})}}const C={id:"gitlab",title:"GitLab",icon:()=>null};class L{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=C,oauthRequestApi:s,defaultScopes:i=["read_user"]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n,defaultScopes:i})}}const $={id:"google",title:"Google",icon:()=>null},T="https://www.googleapis.com/auth/";class F{static create(e){const{configApi:t,discoveryApi:r,oauthRequestApi:n,environment:o="development",provider:s=$,defaultScopes:i=["openid",`${T}userinfo.email`,`${T}userinfo.profile`]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:n,provider:s,environment:o,defaultScopes:i,scopeTransform:e=>e.map(e=>"openid"===e?e:"profile"===e||"email"===e?`${T}userinfo.${e}`:e.startsWith(T)?e:`${T}${e}`)})}}const N={id:"okta",title:"Okta",icon:()=>null},D=new Set(["openid","profile","email","phone","address","groups","offline_access"]),U="okta.";class M{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=N,oauthRequestApi:s,defaultScopes:i=["openid","email","profile","offline_access"]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n,defaultScopes:i,scopeTransform:e=>e.map(e=>D.has(e)||e.startsWith(U)?e:`${U}${e}`)})}}class q{discoveryApi;environment;provider;constructor(e){const{discoveryApi:t,environment:r,provider:n}=e;this.discoveryApi=t,this.environment=r,this.provider=n}async createSession(){const e=await this.buildUrl("/start"),t=await g({url:e,name:`${this.provider.title} Login`,width:450,height:730});return{...t,id:t.profile.email}}async refreshSession(){}async removeSession(){const e=await fetch(await this.buildUrl("/logout"),{method:"POST",headers:{"x-requested-with":"XMLHttpRequest"},credentials:"include"}).catch(e=>{throw new Error(`Logout request failed, ${e}`)});if(!e.ok){const t=new Error(`Logout request failed, ${e.statusText}`);throw t.status=e.status,t}}async buildUrl(e){return`${await this.discoveryApi.getBaseUrl("auth")}/${this.provider.id}${e}?env=${this.environment}`}}class _{connector;helper;stateTracker=new O;currentSession;constructor(e){const{connector:t,defaultScopes:r=new Set,sessionScopes:n}=e;this.connector=t,this.helper=new w({sessionScopes:n,defaultScopes:r})}setSession(e){this.currentSession=e,this.stateTracker.setIsSignedIn(Boolean(e))}async getSession(e){return this.helper.sessionExistsAndHasScope(this.currentSession,e.scopes)?this.currentSession:e.optional?void 0:(this.currentSession=await this.connector.createSession({...e,scopes:this.helper.getExtendedScope(this.currentSession,e.scopes)}),this.stateTracker.setIsSignedIn(!0),this.currentSession)}async removeSession(){this.currentSession=void 0,this.stateTracker.setIsSignedIn(!1)}sessionState$(){return this.stateTracker.sessionState$()}}class B{manager;storageKey;schema;sessionShouldRefreshFunc;helper;constructor(e){const{manager:t,storageKey:r,schema:n,sessionScopes:o,sessionShouldRefresh:s=()=>!1}=e;this.manager=t,this.storageKey=r,this.schema=n,this.sessionShouldRefreshFunc=s,this.helper=new w({sessionScopes:o,defaultScopes:new Set})}setSession(e){this.manager.setSession(e),this.saveSession(e)}async getSession(e){const{scopes:t}=e,r=this.loadSession();if(this.helper.sessionExistsAndHasScope(r,t)&&!this.sessionShouldRefreshFunc(r))return this.manager.setSession(r),r;const n=await this.manager.getSession(e);return this.saveSession(n),n}async removeSession(){localStorage.removeItem(this.storageKey),await this.manager.removeSession()}sessionState$(){return this.manager.sessionState$()}loadSession(){try{const e=localStorage.getItem(this.storageKey);if(e){const t=JSON.parse(e,(e,t)=>"Set"===t?.__type?new Set(t.__value):t);try{return this.schema.parse(t)}catch(e){throw console.log(`Failed to load session from local storage because it did not conform to the expected schema, ${e}`),e}}return}catch(e){return void localStorage.removeItem(this.storageKey)}}saveSession(e){if(void 0!==e){try{this.schema.parse(e)}catch(e){return void console.warn(`Failed to save session to local storage because it did not conform to the expected schema, ${e}`)}localStorage.setItem(this.storageKey,JSON.stringify(e,(e,t)=>t instanceof Set?{__type:"Set",__value:Array.from(t)}:t))}else localStorage.removeItem(this.storageKey)}}var V=r(53215);const K=V.Ik({profile:V.Ik({email:V.Yj().optional(),displayName:V.Yj().optional(),picture:V.Yj().optional()}),backstageIdentity:V.Ik({token:V.Yj(),identity:V.Ik({type:V.eu("user"),userEntityRef:V.Yj(),ownershipEntityRefs:V.YO(V.Yj())})})}),H={id:"saml",title:"SAML",icon:()=>null};class z{constructor(e){this.sessionManager=e}static create(e){const{discoveryApi:t,environment:r="development",provider:n=H}=e,o=new q({discoveryApi:t,environment:r,provider:n}),s=new _({connector:o}),i=new B({manager:s,storageKey:`${n.id}Session`,schema:K});return new z(i)}sessionState$(){return this.sessionManager.sessionState$()}async signIn(){await this.getBackstageIdentity({})}async signOut(){await this.sessionManager.removeSession()}async getBackstageIdentity(e={}){const t=await this.sessionManager.getSession(e);return t?.backstageIdentity}async getProfile(e={}){const t=await this.sessionManager.getSession(e);return t?.profile}}const G={id:"microsoft",title:"Microsoft",icon:()=>null};class J{oauth2;configApi;environment;provider;oauthRequestApi;discoveryApi;scopeTransform;static MicrosoftGraphID="00000003-0000-0000-c000-000000000000";static create(e){return new J(e)}constructor(e){const{configApi:t,environment:r="development",provider:n=G,oauthRequestApi:o,discoveryApi:s,defaultScopes:i=["openid","offline_access","profile","email","User.Read"],scopeTransform:a=e=>e.concat("offline_access")}=e;this.configApi=t,this.environment=r,this.provider=n,this.oauthRequestApi=o,this.discoveryApi=s,this.scopeTransform=a,this.oauth2={[J.MicrosoftGraphID]:E.create({configApi:this.configApi,discoveryApi:this.discoveryApi,oauthRequestApi:this.oauthRequestApi,provider:this.provider,environment:this.environment,scopeTransform:this.scopeTransform,defaultScopes:i})}}microsoftGraph(){return this.oauth2[J.MicrosoftGraphID]}static resourceForScopes(e){const t=[...new Set(e.split(" ").map(J.resourceForScope).filter(e=>"openid"!==e))];if(t.length>1)return Promise.reject(new Error(`Requested access token with scopes from multiple Azure resources: ${t.join(", ")}. Access tokens can only have a single audience.`));const r=t[0]??J.MicrosoftGraphID;return Promise.resolve(r)}static resourceForScope(e){const t=e.match(/^(?<resourceURI>.*)\/(?<scp>[^\/]*)$/)?.groups;if(t){const{resourceURI:e}=t;return e.replace(/^api:\/\//,"")}switch(e){case"email":case"openid":case"offline_access":case"profile":return"openid";default:return J.MicrosoftGraphID}}async getAccessToken(e,t){const r=void 0===e?J.MicrosoftGraphID:await J.resourceForScopes(Array.isArray(e)?e.join(" "):e);return r in this.oauth2||(this.oauth2[r]=E.create({configApi:this.configApi,discoveryApi:this.discoveryApi,oauthRequestApi:this.oauthRequestApi,provider:this.provider,environment:this.environment,scopeTransform:this.scopeTransform})),this.oauth2[r].getAccessToken(e,t)}getIdToken(e){return this.microsoftGraph().getIdToken(e)}getProfile(e){return this.microsoftGraph().getProfile(e)}getBackstageIdentity(e){return this.microsoftGraph().getBackstageIdentity(e)}signIn(){return this.microsoftGraph().signIn()}signOut(){return this.microsoftGraph().signOut()}sessionState$(){return this.microsoftGraph().sessionState$()}}const W={id:"onelogin",title:"onelogin",icon:()=>null},Y=new Set(["openid","profile","email","phone","address","groups","offline_access"]),X="onelogin.";class Q{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=W,oauthRequestApi:s}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n,defaultScopes:["openid","email","profile","offline_access"],scopeTransform:e=>e.map(e=>Y.has(e)||e.startsWith(X)?e:`${X}${e}`)})}}const Z={id:"bitbucket",title:"Bitbucket",icon:()=>null};class ee{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=Z,oauthRequestApi:s,defaultScopes:i=["account"]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n,defaultScopes:i})}}const te={id:"bitbucketServer",title:"Bitbucket Server",icon:()=>null};class re{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=te,oauthRequestApi:s,defaultScopes:i=["PROJECT_ADMIN"]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n,defaultScopes:i})}}const ne={id:"atlassian",title:"Atlassian",icon:()=>null};class oe{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=ne,oauthRequestApi:s}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n})}}const se={id:"vmwareCloudServices",title:"VMware Cloud",icon:()=>null};class ie{static create(e){const{configApi:t,discoveryApi:r,oauthRequestApi:n,environment:o="development",provider:s=se,defaultScopes:i=["openid"]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:n,provider:s,environment:o,defaultScopes:i})}}const ae={id:"openshift",title:"OpenShift",icon:()=>null};class ce{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=ae,oauthRequestApi:s,defaultScopes:i=["user:info"]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n,defaultScopes:i})}}class ue{subject=new A;post(e){this.subject.next(e)}alert$(){return this.subject}}class le{constructor(e){this.actualApis=e}static fromApis(e){return new le(e)}captureEvent(e){this.actualApis.forEach(t=>{try{t.captureEvent(e)}catch{}})}}class pe{captureEvent(e){}}const he="theme";class fe{constructor(e){this.themes=e}static createWithStorage(e){const t=new fe(e);if(!window.localStorage)return t;const r=window.localStorage.getItem(he)??void 0;return t.setActiveThemeId(r),t.activeThemeId$().subscribe(e=>{e?window.localStorage.setItem(he,e):window.localStorage.removeItem(he)}),window.addEventListener("storage",e=>{if(e.key===he){const e=localStorage.getItem(he)??void 0;t.setActiveThemeId(e)}}),t}activeThemeId;subject=new x(void 0);getInstalledThemes(){return this.themes.slice()}activeThemeId$(){return this.subject}getActiveThemeId(){return this.activeThemeId}setActiveThemeId(e){this.activeThemeId=e,this.subject.next(e)}}const ge=/^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$/i;function de(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function ve(e){return"object"!=typeof e||null===e?e:Array.isArray(e)?e.map(ve):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,ve(t)]))}function ye(e,t){if(null===e)return;if(void 0===e)return void 0===t?void 0:ye(t);if("object"!=typeof e||Array.isArray(e))return e;const r=de(t)?t:{},n={};for(const t of new Set([...Object.keys(e),...Object.keys(r)])){const o=ye(e[t],r[t]);void 0!==o&&(n[t]=o)}return n}function me(e){if(null===e)return"null";if(Array.isArray(e))return"array";const t=typeof e;return"number"===t&&isNaN(e)?"nan":"string"===t&&""===e?"empty-string":t}const we=(e,t,r,n)=>`Invalid type in config for key '${e}' in '${t}', got ${r}, wanted ${n}`,be=(e,t)=>`Missing required config value at '${e}' in '${t}'`,Se=(e,t,r)=>`Unable to convert config value for key '${e}' in '${t}' to a ${r}`;class Ae{constructor(e,t="mock-config",r,n=""){this.data=e,this.context=t,this.fallback=r,this.prefix=n}filteredKeys;notifiedFilteredKeys=new Set;static fromConfigs(e){return 0===e.length?new Ae(void 0):e.reduce((e,{data:t,context:r,filteredKeys:n,deprecatedKeys:o})=>{const s=new Ae(t,r,e);if(s.filteredKeys=n,o)for(const{key:e,description:t}of o)console.warn(`The configuration key '${e}' of ${r} is deprecated and may be removed soon. ${t||""}`);return s},void 0)}has(e){const t=this.readValue(e);return null!==t&&(void 0!==t||(this.fallback?.has(e)??!1))}keys(){const e=this.data?Object.keys(this.data):[],t=this.fallback?.keys()??[];return[...new Set([...e,...t])].filter(e=>null!==this.data?.[e])}get(e){const t=this.getOptional(e);if(void 0===t)throw new Error(be(this.fullKey(e??""),this.context));return t}getOptional(e){const t=ve(this.readValue(e)),r=this.fallback?.getOptional(e);if(null!==t)return void 0===t?ye(r):void 0===r?ye(t):ye(t,r)}getConfig(e){const t=this.getOptionalConfig(e);if(void 0===t)throw new Error(be(this.fullKey(e),this.context));return t}getOptionalConfig(e){const t=this.readValue(e),r=this.fallback?.getOptionalConfig(e);if(de(t))return this.copy(t,e,r);if(null!==t){if(void 0!==t)throw new TypeError(we(this.fullKey(e),this.context,me(t),"object"));return r}}getConfigArray(e){const t=this.getOptionalConfigArray(e);if(void 0===t)throw new Error(be(this.fullKey(e),this.context));return t}getOptionalConfigArray(e){const t=this.readConfigValue(e,t=>{if(!Array.isArray(t))return{expected:"object-array"};for(const[r,n]of t.entries())if(!de(n))return{expected:"object-array",value:n,key:`${e}[${r}]`};return!0});if(t)return t.map((t,r)=>this.copy(t,`${e}[${r}]`))}getNumber(e){const t=this.getOptionalNumber(e);if(void 0===t)throw new Error(be(this.fullKey(e),this.context));return t}getOptionalNumber(e){const t=this.readConfigValue(e,e=>"number"==typeof e||"string"==typeof e||{expected:"number"});if("number"==typeof t||void 0===t)return t;const r=Number(t);if(!Number.isFinite(r))throw new Error(Se(this.fullKey(e),this.context,"number"));return r}getBoolean(e){const t=this.getOptionalBoolean(e);if(void 0===t)throw new Error(be(this.fullKey(e),this.context));return t}getOptionalBoolean(e){const t=this.readConfigValue(e,e=>"boolean"==typeof e||"number"==typeof e||"string"==typeof e||{expected:"boolean"});if("boolean"==typeof t||void 0===t)return t;const r=String(t).trim();if(/^(?:y|yes|true|1|on)$/i.test(r))return!0;if(/^(?:n|no|false|0|off)$/i.test(r))return!1;throw new Error(Se(this.fullKey(e),this.context,"boolean"))}getString(e){const t=this.getOptionalString(e);if(void 0===t)throw new Error(be(this.fullKey(e),this.context));return t}getOptionalString(e){return this.readConfigValue(e,e=>"string"==typeof e&&""!==e||{expected:"string"})}getStringArray(e){const t=this.getOptionalStringArray(e);if(void 0===t)throw new Error(be(this.fullKey(e),this.context));return t}getOptionalStringArray(e){return this.readConfigValue(e,t=>{if(!Array.isArray(t))return{expected:"string-array"};for(const[r,n]of t.entries())if("string"!=typeof n||""===n)return{expected:"string-array",value:n,key:`${e}[${r}]`};return!0})}fullKey(e){return`${this.prefix}${this.prefix?".":""}${e}`}copy(e,t,r){const n=new Ae(e,this.context,r,this.fullKey(t));return n.filteredKeys=this.filteredKeys,n}readConfigValue(e,t){const r=this.readValue(e);if(void 0===r)return this.fallback?.readConfigValue(e,t);if(null===r)return;const n=t(r);if(!0!==n){const{key:t=e,value:o=r,expected:s}=n;throw new TypeError(we(this.fullKey(t),this.context,me(o),s))}return r}readValue(e){const t=e?e.split("."):[];for(const r of t)if(!ge.test(r))throw new TypeError(`Invalid config key '${e}'`);if(void 0===this.data)return;let r=this.data;for(const[e,n]of t.entries())if(de(r))r=r[n];else if(null!=r){const n=this.fullKey(t.slice(0,e).join("."));throw new TypeError(we(n,this.context,me(r),"object"))}return r}}const xe="Invalid discovery URL pattern,";class ke{constructor(e){this.parts=e}static compile(e){const t=e.split(/\{\{\s*pluginId\s*\}\}/),r=t.join("pluginId");let n;try{n=new URL(r)}catch{throw new Error(`${xe} URL '${r}' is invalid`)}if(n.hash)throw new Error(`${xe} URL must not have a hash`);if(n.search)throw new Error(`${xe} URL must not have a query`);if(r.endsWith("/"))throw new Error(`${xe} URL must not end with a slash`);return new ke(t)}async getBaseUrl(e){return this.parts.join(encodeURIComponent(e))}}class Oe{constructor(e,t){this.endpoints=e,this.defaultEndpoint=t}static fromConfig(e,t){const r=t?.pathPattern??"/api/{{ pluginId }}",n=e.getString("backend.baseUrl"),o=e.getOptionalConfigArray("discovery.endpoints")?.flatMap(e=>{const t="object"==typeof e.get("target")?e.getOptionalString("target.external"):e.getString("target");if(!t)return[];const r=ke.compile(t);return e.getStringArray("plugins").map(e=>[e,r])});return new Oe(new Map(o),ke.compile(`${n}${r}`))}async getBaseUrl(e){const t=this.endpoints.get(e);return t?t.getBaseUrl(e):this.defaultEndpoint.getBaseUrl(e)}}class Re{constructor(e,t){this.alertApi=e,this.errorApi=t}post(e,t){return t?.hidden||this.alertApi.post({message:e.message,severity:"error"}),this.errorApi.post(e,t)}error$(){return this.errorApi.error$()}}class je{subject=new A;post(e,t){this.subject.next({error:e,context:t})}error$(){return this.subject}}class Ee{static forward(e,t){window.addEventListener("unhandledrejection",r=>{e.post(r.reason,t)})}}function Pe(e){if(e.length<3)throw new Error(`The '${e}' feature flag must have a minimum length of three characters.`);if(e.length>150)throw new Error(`The '${e}' feature flag must not exceed 150 characters.`);if(!e.match(/^[a-z]+[a-z0-9-]+$/))throw new Error(`The '${e}' feature flag must start with a lowercase letter and only contain lowercase letters, numbers and hyphens. Examples: feature-flag-one, alpha, release-2020`)}class Ie{registeredFeatureFlags=[];flags;registerFlag(e){Pe(e.name),this.registeredFeatureFlags.push(e)}getRegisteredFlags(){return this.registeredFeatureFlags.slice()}isActive(e){return this.flags||(this.flags=this.load()),this.flags.get(e)===k.FeatureFlagState.Active}save(e){this.flags||(this.flags=this.load()),e.merge||this.flags.clear();for(const[t,r]of Object.entries(e.states))this.flags.set(t,r);const t=Array.from(this.flags.entries()).filter(([,e])=>e===k.FeatureFlagState.Active);window.localStorage.setItem("featureFlags",JSON.stringify(Object.fromEntries(t)))}load(){try{const e=window.localStorage.getItem("featureFlags");if(!e)return new Map;const t=JSON.parse(e);if("object"!=typeof t||null===t||Array.isArray(t))return new Map;const r=Object.entries(t).filter(([e,t])=>(Pe(e),t===k.FeatureFlagState.Active));return new Map(r)}catch{return new Map}}}function Ce(e){let t=e.baseImplementation||r.g.fetch;const n=[e.middleware??[]].flat().reverse();for(const e of n)t=e.apply(t);return{fetch:t}}class Le{constructor(e,t,r,n){this.identityApi=e,this.allowUrl=t,this.headerName=r,this.headerValue=n}static create(e){const t=function(e){return e.allowUrl?e.allowUrl:e.urlPrefixAllowlist?$e(e.urlPrefixAllowlist):e.config?$e([e.config.getString("backend.baseUrl"),...Le.getDiscoveryUrlPrefixes(e.config)]):()=>!1}(e),r=e.header?.name||"authorization",n=e.header?.value||(e=>`Bearer ${e}`);return new Le(e.identityApi,t,r,n)}static getDiscoveryUrlPrefixes(e){return(e.getOptionalConfigArray("discovery.endpoints")||[]).flatMap(e=>{const t="object"==typeof e.get("target")?e.getString("target.external"):e.getString("target");return e.getStringArray("plugins").map(e=>t.replace(/\{\{\s*pluginId\s*\}\}/g,e))})}apply(e){return async(t,r)=>{const n=new Request(t,r),{token:o}=await this.identityApi.getCredentials();return!n.headers.get(this.headerName)&&"string"==typeof o&&o&&this.allowUrl(n.url)?(n.headers.set(this.headerName,this.headerValue(o)),e(n)):e(t,r)}}}function $e(e){const t=e.map(e=>e.replace(/\/$/,""));return e=>t.some(t=>e===t||e.startsWith(`${t}/`))}class Te{constructor(e){this.discoveryApi=e}apply(e){return async(t,r)=>{const n=new Request(t,r);if(!n.url.startsWith("plugin://"))return e(t,r);const{hostname:o,pathname:s,search:i,hash:a,username:c,password:u}=new URL(`http://${n.url.substring(9)}`);let l=await this.discoveryApi.getBaseUrl(o);if(c||u){const e=new URL(l),t=`${c}${u?`:${u}`:""}@`;l=`${e.protocol}//${t}${e.host}${e.pathname}`}const p=`${h=l,f=s,f&&"/"!==f?`${h.replace(/\/$/,"")}/${f.replace(/^\//,"")}`:h}${i}${a}`;var h,f,g;return e(p,"string"==typeof t||"object"==typeof(g=t)&&g?.constructor===URL?r:t)}}}class Fe{static resolvePluginProtocol(e){return new Te(e.discoveryApi)}static injectIdentityAuth(e){return Le.create(e)}constructor(){}}class Ne{requests=[];subject=new x(this.getCurrentPending());request(e){return new Promise((t,r)=>{this.requests.push({scopes:e,resolve:t,reject:r}),this.subject.next(this.getCurrentPending())})}resolve(e,t){this.requests=this.requests.filter(r=>!function(e,t){for(const r of t)if(!e.has(r))return!1;return!0}(e,r.scopes)||(r.resolve(t),!1)),this.subject.next(this.getCurrentPending())}reject(e){this.requests.forEach(t=>t.reject(e)),this.requests=[],this.subject.next(this.getCurrentPending())}pending(){return this.subject}getCurrentPending(){const e=0===this.requests.length?void 0:this.requests.slice(1).reduce((e,t)=>function(e,...t){const r=new Set(e);for(const e of t)for(const t of e)r.add(t);return r}(e,t.scopes),this.requests[0].scopes);return{scopes:e,resolve:t=>{e&&this.resolve(e,t)},reject:t=>{e&&this.reject(t)}}}}class De{subject=new A;currentRequests=[];handlerCount=0;createAuthRequester(e){const t=new Ne,r=this.handlerCount;return this.handlerCount++,t.pending().subscribe({next:t=>{const n=this.currentRequests.slice(),o=this.makeAuthRequest(t,e);o?n[r]=o:delete n[r],this.currentRequests=n,this.subject.next(n.filter(Boolean))}}),e=>t.request(e)}makeAuthRequest(e,t){const{scopes:r}=e;if(r)return{provider:t.provider,trigger:async()=>{const n=await t.onAuthRequest(r);e.resolve(n)},reject:()=>{const t=new Error("Login failed, rejected by user");t.name="RejectedError",e.reject(t)}}}authRequest$(){return this.subject}}const Ue=new Map;class Me{constructor(e,t){this.namespace=e,this.errorApi=t}static hasSubscribed=!1;static create(e){return new Me(e.namespace??"",e.errorApi)}static addStorageEventListener(){window.addEventListener("storage",e=>{for(const[t,r]of Ue.entries())e.key?.startsWith(t)&&r.handleStorageChange(e.key)})}get(e){return this.snapshot(e).value}snapshot(e){let t,r="absent";try{const n=localStorage.getItem(this.getKeyName(e));n&&(t=JSON.parse(n,(e,t)=>("object"==typeof t&&null!==t&&Object.freeze(t),t)),r="present")}catch(t){this.errorApi.post(new Error(`Error when parsing JSON config from storage for: ${e}`))}return{key:e,value:t,presence:r}}forBucket(e){const t=`${this.namespace}/${e}`;return Ue.has(t)||Ue.set(t,new Me(t,this.errorApi)),Ue.get(t)}async set(e,t){localStorage.setItem(this.getKeyName(e),JSON.stringify(t)),this.notifyChanges(e)}async remove(e){localStorage.removeItem(this.getKeyName(e)),this.notifyChanges(e)}observe$(e){return Me.hasSubscribed||(Me.addStorageEventListener(),Me.hasSubscribed=!0),this.observable.filter(({key:t})=>t===e)}handleStorageChange(e){if(!e?.startsWith(this.namespace))return;const t=e?.slice(`${this.namespace}/`.length);t.includes("/")||this.notifyChanges(decodeURIComponent(t))}getKeyName(e){return`${this.namespace}/${encodeURIComponent(e)}`}notifyChanges(e){const t=this.snapshot(e);for(const e of this.subscribers)e.next(t)}subscribers=new Set;observable=new(S())(e=>(this.subscribers.add(e),()=>{this.subscribers.delete(e)}))}const qe=(0,o.createContext)(void 0);var _e=r(42469);function Be(){const[e]=(0,_e.createRoutesFromChildren)((0,n.jsx)(_e.Route,{index:!0,element:(0,n.jsx)("div",{})}));return!e.index}const Ve=({pathname:e,search:t,hash:r,attributes:n})=>{const s=(0,k.useAnalytics)();return(0,o.useEffect)(()=>{s.captureEvent("navigate",`${e}${t}${r}`,{attributes:n})},[s,e,t,r,n]),null},Ke=({routeObjects:e})=>{const{pathname:t,search:r,hash:o}=(0,_e.useLocation)(),{params:s,...i}=((e,t)=>{try{const r=(0,_e.matchRoutes)(t,{pathname:e}),n=r?.filter(e=>e?.route.routeRefs?.size>0).pop(),o=n?.route;if(!o)return;if(""===o.path&&"/"!==e)return;let s,i;1===o.routeRefs.size&&(s=o.routeRefs.values().next().value),1===o.plugins.size&&(i=o.plugins.values().next().value);const a=Object.entries(n?.params||{}).reduce((e,[t,r])=>(void 0!==r&&"*"!==t&&(e[t]=r),e),{});return{extension:"App",pluginId:i?.getId()||"root",...s?{routeRef:s.id}:{},_routeNodeType:o.element,params:a}}catch{return}})(t,e)||{params:{}};return(0,n.jsx)(k.AnalyticsContext,{attributes:i,children:(0,n.jsx)(Ve,{pathname:t,search:r,hash:o,attributes:s})})};function He(e){let{pathname:t}=new URL(e.getOptionalString("app.baseUrl")??"/","http://sample.dev");return t=t.replace(/\/*$/,""),t}function ze({component:e,appIdentityProxy:t,children:r}){const[s,i]=(0,o.useState)(),a=He((0,k.useApi)(k.configApiRef));return s?(t.setTarget(s,{signOutTargetUrl:a||"/"}),(0,n.jsx)(n.Fragment,{children:r})):(0,n.jsx)(e,{onSignInSuccess:i})}function Ge(e){const{Router:t,SignInPage:r}=(0,k.useApp)().getComponents(),s=He((0,k.useApi)(k.configApiRef)),i=`${s}/*`,a=(0,o.useContext)(qe);if(!a)throw new Error("AppRouter must be rendered within the AppProvider");const{routeObjects:c,appIdentityProxy:u}=a;return r?Be()?(0,n.jsxs)(t,{children:[(0,n.jsx)(Ke,{routeObjects:c}),(0,n.jsx)(ze,{component:r,appIdentityProxy:u,children:(0,n.jsx)(_e.Routes,{children:(0,n.jsx)(_e.Route,{path:i,element:(0,n.jsx)(n.Fragment,{children:e.children})})})})]}):(0,n.jsxs)(t,{basename:s,children:[(0,n.jsx)(Ke,{routeObjects:c}),(0,n.jsx)(ze,{component:r,appIdentityProxy:u,children:e.children})]}):(u.setTarget({getUserId:()=>"guest",getIdToken:async()=>{},getProfile:()=>({email:"guest@example.com",displayName:"Guest"}),getProfileInfo:async()=>({email:"guest@example.com",displayName:"Guest"}),getBackstageIdentity:async()=>({type:"user",userEntityRef:"user:default/guest",ownershipEntityRefs:["user:default/guest"]}),getCredentials:async()=>({}),signOut:async()=>{}},{signOutTargetUrl:s||"/"}),Be()?(0,n.jsxs)(t,{children:[(0,n.jsx)(Ke,{routeObjects:c}),(0,n.jsx)(_e.Routes,{children:(0,n.jsx)(_e.Route,{path:i,element:(0,n.jsx)(n.Fragment,{children:e.children})})})]}):(0,n.jsxs)(t,{basename:s,children:[(0,n.jsx)(Ke,{routeObjects:c}),e.children]}))}(0,k.attachComponentData)(Ge,"core.type","AppRouter");var Je=r(35015);const We=(0,k.createApiRef)({id:"core.applanguage"});var Ye=r(87350);function Xe(e,t){return()=>({accumulator:e(),visit:t})}function Qe(e){return e.props?.children}function Ze(e){if(e.props?.path&&e.props?.element)return e.props?.element}const et=Xe(()=>new Set,(e,t)=>{const r=(0,k.getComponentData)(t,"core.plugin");r&&e.add(r)}),tt=e=>{const{children:t}=e,r=(0,k.useApi)(k.featureFlagsApiRef),o="with"in e?r.isActive(e.with):!r.isActive(e.without);return(0,n.jsx)(n.Fragment,{children:o?t:null})};(0,k.attachComponentData)(tt,"core.featureFlagged",!0);const rt={caseSensitive:!1,path:"*",element:"match-all",routeRefs:new Set,plugins:new Set};function nt(e){const t=e;return t?.type?t.type.displayName??t.type.name??String(t.type):String(t)}const ot=e=>{const t=new Set;return e&&t.add(e),t};function st(e,t=new Array){return o.Children.forEach(e,e=>{if(!(0,o.isValidElement)(e))return;const r=(0,k.getComponentData)(e,"core.mountPoint");if(r){const n=(0,k.getComponentData)(e,"core.plugin");t.push({routeRef:r,plugin:n})}st(e.props.children,t)}),t}const it=Xe(()=>({paths:new Map,parents:new Map,objects:new Array}),(e,t,r,n)=>{if(n?.isElementAncestor)return n;if(r?.props.element===t)return{...n,isElementAncestor:!0};const o=t.props?.path,s=(0,k.getComponentData)(t,"core.mountPoint");if(s&&o)throw new Error(`Path property may not be set directly on a routable extension "${nt(t)}"`);const i=n?.obj?.children??e.objects;if(void 0!==o){if("string"!=typeof o)throw new Error(`Element path must be a string at "${nt(t)}"`);const r=o.startsWith("/")?o.slice(1):o,s=t.props.element;if((0,k.getComponentData)(t,"core.gatherMountPoints")){if(s)throw new Error(`Mount point gatherers may not have an element prop "${nt(t)}"`);const e={path:r,element:"gathered",routeRefs:new Set,caseSensitive:Boolean(t.props?.caseSensitive),children:[rt],plugins:new Set};return i.push(e),{obj:e,gatherPath:r,routeRef:n?.routeRef,gatherRouteRef:n?.routeRef}}if(s){const[a,...c]=st(s);if(c.length>0)throw new Error(`Route element with path "${o}" may not contain multiple routable extensions`);if(!a)return n;const{routeRef:u,plugin:l}=a,p={path:r,element:"mounted",routeRefs:new Set([u]),caseSensitive:Boolean(t.props?.caseSensitive),children:[rt],plugins:ot(l)};return i.push(p),e.paths.set(u,r),e.parents.set(u,n?.routeRef),{obj:p,routeRef:u??n?.routeRef,gatherPath:r,gatherRouteRef:n?.gatherRouteRef}}}if(s){if(void 0===n?.gatherPath)throw new Error(`Routable extension "${nt(t)}" with mount point "${s}" must be assigned a path`);n?.obj?.routeRefs.add(s);const r=(0,k.getComponentData)(t,"core.plugin");return r&&n?.obj?.plugins.add(r),e.paths.set(s,n.gatherPath),e.parents.set(s,n?.gatherRouteRef),{...n,routeRef:s}}return n}),at=Xe(()=>({paths:new Map,parents:new Map,objects:new Array}),(e,t,r,n)=>{if(r?.props.element===t)return n;let s=n?.obj,i=n?.routeRef,a=n?.sticky;const c=t.props?.path,u=s?.children??e.objects,l=Boolean(t.props?.caseSensitive);let p=n?.path;if((0,k.getComponentData)(t,"core.gatherMountPoints")){if(!c)throw new Error("Mount point gatherer must have a path");p=c}const h=t.props?.element;let f=(0,k.getComponentData)(t,"core.mountPoint");if(!f&&(0,o.isValidElement)(h)&&(f=(0,k.getComponentData)(h,"core.mountPoint")),f){let r=c;if(p&&(r?p=void 0:r=p),!r)throw new Error("Mounted routable extension must have a path");e.paths.set(f,r),i&&a?(e.parents.set(f,i),c&&(i=f,a=!1)):(e.parents.set(f,i),i=f),c?(s={caseSensitive:l,path:c,element:"mounted",routeRefs:new Set([f]),children:[rt],plugins:ot((0,k.getComponentData)(t.props.element,"core.plugin"))},u.push(s)):s?.routeRefs.add(f)}if((0,k.getComponentData)(t,"core.gatherMountPoints")&&(a=!0),(0,k.getComponentData)(t,"core.gatherMountPoints")){if(!c)throw new Error("Mount point gatherer must have a path");f||(s={caseSensitive:l,path:c,element:"gathered",routeRefs:new Set,children:[rt],plugins:n?.obj?.plugins||new Set},u.push(s))}return{obj:s,path:p,routeRef:i,sticky:a}}),ct=Xe(()=>new Set,(e,t)=>{if(t.type===tt){const r=t.props;e.add("with"in r?r.with:r.without)}}),ut=(0,c.getOrCreateGlobalSingleton)("route-ref-type",()=>Symbol("route-ref-type"));function lt(e){return"absolute"===e[ut]}function pt(e){return"sub"===e[ut]}function ht(...e){const t=e.join("/").replace(/\/\/+/g,"/");return"/"!==t&&t.endsWith("/")?t.slice(0,-1):t}var ft=r(46155),gt=r.n(ft);class dt{constructor(e,t,r,n,o){this.routePaths=e,this.routeParents=t,this.routeObjects=r,this.routeBindings=n,this.appBasePath=o}resolve(e,t){const[r,n]=function(e,t,r){let n,o="";if(lt(e))n=e;else if(pt(e))n=e.parent,o=e.path;else{if("external"!==e[ut])throw e[ut]?new Error(`Unknown or invalid route ref type, ${e[ut]}`):new Error(`Unknown object passed to useRouteRef, got ${e}`);{const t=r.get(e);if(!t)return[void 0,""];if(lt(t))n=t;else{if(!pt(t))throw new Error(`ExternalRouteRef was bound to invalid target, ${t}`);n=t.parent,o=t.path}}}if(!n)return[void 0,""];const s=t.get(n);return void 0===s?[void 0,""]:[n,ht(s,o)]}(e,this.routePaths,this.routeBindings);if(!r)return;let o;o="string"==typeof t?this.trimPath(t):t.pathname?{...t,pathname:this.trimPath(t.pathname)}:t;const s=this.appBasePath+function(e,t,r,n,o){const s=(0,_e.matchRoutes)(o,t)??[],i=Array();let a=-1;for(let t=e;t&&(a=s.findIndex(e=>e.route.routeRefs.has(t)),-1===a);t=n.get(t))i.unshift(t);return 0===i.length&&(a-=1),`${ht(-1===a?"":s[a].pathname,...i.slice(0,-1).map(t=>{const n=r.get(t);if(void 0===n)throw new Error(`No path for ${t}`);if(n.includes(":"))throw new Error(`Cannot route to ${e} with parent ${t} as it has parameters`);return n}))}/`}(r,o,this.routePaths,this.routeParents,this.routeObjects);return(...[e])=>{const t=e&>()(e,e=>"string"==typeof e?e.replaceAll(/[&?#;\/]/g,e=>encodeURIComponent(e)):e);return ht(s,(0,_e.generatePath)(n,t))}}trimPath(e){return e&&e.startsWith(this.appBasePath)?e.slice(this.appBasePath.length):e}}const vt=(0,c.createVersionedContext)("routing-context"),yt=({routePaths:e,routeParents:t,routeObjects:r,routeBindings:o,basePath:s="",children:i})=>{const a=new dt(e,t,r,o,s),u=(0,c.createVersionedValueMap)({1:a});return(0,n.jsx)(vt.Provider,{value:u,children:i})},mt=(0,c.createVersionedContext)("app-context"),wt=({appContext:e,children:t})=>{const r=(0,c.createVersionedValueMap)({1:e});return(0,n.jsx)(mt.Provider,{value:r,children:t})};function bt(e){return new Error(`Tried to access IdentityApi ${e} before app was loaded`)}function St(e){console.warn(`WARNING: Call to ${e} is deprecated and will break in the future`)}class At{target;waitForTarget;resolveTarget=()=>{};signOutTargetUrl="/";#e;constructor(){this.waitForTarget=new Promise(e=>{this.resolveTarget=e})}setTarget(e,t){this.target=e,this.signOutTargetUrl=t.signOutTargetUrl,this.resolveTarget(e)}getUserId(){if(!this.target)throw bt("getUserId");if(!this.target.getUserId)throw new Error("IdentityApi does not implement getUserId");return St("getUserId"),this.target.getUserId()}getProfile(){if(!this.target)throw bt("getProfile");if(!this.target.getProfile)throw new Error("IdentityApi does not implement getProfile");return St("getProfile"),this.target.getProfile()}async getProfileInfo(){return this.waitForTarget.then(e=>e.getProfileInfo())}async getBackstageIdentity(){const e=await this.waitForTarget.then(e=>e.getBackstageIdentity());return e.userEntityRef.match(/^.*:.*\/.*$/)||console.warn(`WARNING: The App IdentityApi provided an invalid userEntityRef, '${e.userEntityRef}'. It must be a full Entity Reference of the form '<kind>:<namespace>/<name>'.`),e}async getCredentials(){return this.waitForTarget.then(e=>e.getCredentials())}async getIdToken(){return this.waitForTarget.then(e=>{if(!e.getIdToken)throw new Error("IdentityApi does not implement getIdToken");return St("getIdToken"),e.getIdToken()})}async signOut(){await this.waitForTarget.then(e=>e.signOut()),await(this.#e?.()),window.location.href=this.signOutTargetUrl}enableCookieAuth(e){if(this.#e)return;const t=function({discoveryApi:e,fetchApi:t,errorApi:r}){let n,o=!1,s=!0,i=5e3;const a="BroadcastChannel"in window?new BroadcastChannel("app-auth-cookie-expires-at"):void 0,c=e=>{const t=6e4*(1+3*Math.random());return Math.max(e-Date.now(),3e5)-t},u=async()=>{try{const r=`${await e.getBaseUrl("app")}/.backstage/auth/v1/cookie`,n=await t.fetch(r,{credentials:"include"});if(!n.ok)throw new Error(`Request failed with status ${n.status} ${n.statusText}, see request towards ${r} for more details`);const o=await n.json();if(!o.expiresAt)throw new Error("No expiration date in response");const i=Date.parse(o.expiresAt);if(Number.isNaN(i))throw new Error("Invalid expiration date in response");s=!0,a?.postMessage({action:"COOKIE_REFRESH_SUCCESS",payload:{expiresAt:new Date(i).toISOString()}}),p(c(i))}catch(e){s?(s=!1,i=5e3):(i=Math.min(3e5,2*i),console.error("Session cookie refresh failed",e),r.post(new Error("Session refresh failed, see developer console for details"))),p(i)}},l=e=>{const{data:t}=e;if(null!==t&&"object"==typeof t&&"action"in t&&"COOKIE_REFRESH_SUCCESS"===t.action){const e=Date.parse(t.payload.expiresAt);if(Number.isNaN(e))return void console.warn("Received invalid expiration from session refresh channel");p(c(e))}};function p(e){o||(n&&clearTimeout(n),n=setTimeout(u,e))}return a?.addEventListener("message",l),u(),()=>{o=!0,n&&clearTimeout(n),a?.removeEventListener("message",l),a?.close()}}(e);this.#e=async()=>{t();const r=await e.discoveryApi.getBaseUrl("app");try{await fetch(`${r}/.backstage/auth/v1/cookie`,{method:"DELETE",credentials:"include"})}catch{}}}}var xt=r(1394);function kt({children:e}){const t=(0,k.useApi)(k.appThemeApiRef),r=function(e,t,r){if(void 0!==e){const t=r.find(t=>t.id===e);if(t)return t}if(t){const e=r.find(e=>"dark"===e.variant);if(e)return e}return r.find(e=>"light"===e.variant)||r[0]}((0,xt.A)(t.activeThemeId$(),t.getActiveThemeId()),!!Boolean(window.matchMedia)&&(()=>{const e=(0,o.useMemo)(()=>window.matchMedia("(prefers-color-scheme: dark)"),[]),[t,r]=(0,o.useState)(e.matches);return(0,o.useEffect)(()=>{const t=e=>{r(e.matches)};return e.addListener(t),()=>{e.removeListener(t)}},[e]),t})(),t.getInstalledThemes());if(!r)throw new Error("App has no themes");return(0,n.jsx)(r.Provider,{children:e})}var Ot=r(39907);const Rt=async()=>function(e="__APP_INJECTED_RUNTIME_CONFIG__"){const t=new Array,r=Ot.env.APP_CONFIG;if(r){if(!Array.isArray(r))throw new Error("Static configuration has invalid format");t.push(...r)}const n=document.querySelectorAll('script[type="backstage.io/config"]');if(n.length>0)for(const e of n)try{const r=e.textContent;if(!r)throw new Error("tag is empty");let n;try{n=JSON.parse(r)}catch(e){throw new Error(`failed to parse config; ${e}`)}if(!Array.isArray(n))throw new Error("data is not an array");t.push(...n)}catch(e){throw new Error(`Failed to load config from script tag, ${e.message}`)}else if(e!=="__app_injected_runtime_config__".toLocaleUpperCase("en-US"))try{const r=JSON.parse(e);Array.isArray(r)?t.push(...r):t.push({data:r,context:"env"})}catch(e){throw new Error(`Failed to load runtime configuration, ${e}`)}const o=window.__APP_CONFIG__;return o&&t.push({context:"window",data:o}),t}();class jt{apis=[];add(e,t){return this.apis.push([e.id,t]),t}build(){return new Et(new Map(this.apis))}}class Et{constructor(e){this.apis=e}static builder(){return new jt}static from(e){return new Et(new Map(e.map(([e,t])=>[e.id,t])))}static with(e,t){return new Et(new Map([[e.id,t]]))}with(e,t){return new Et(new Map([...this.apis,[e.id,t]]))}get(e){return this.apis.get(e.id)}}function Pt(e){return!1===e||!("string"!=typeof e||!e)}const It="language",Ct="en";class Lt{static create(e){const t=e?.availableLanguages??[Ct];if(t.length!==new Set(t).size)throw new Error(`Supported languages may not contain duplicates, got '${t.join("', '")}'`);const r=e?.defaultLanguage??Ct;if(!t.includes(r))throw new Error(`Initial language must be one of the supported languages, got '${r}'`);return new Lt(t,r)}static createWithStorage(e){const t=Lt.create(e);if(!window.localStorage)return t;const r=window.localStorage.getItem(It),{languages:n}=t.getAvailableLanguages();return r&&n.includes(r)&&t.setLanguage(r),t.language$().subscribe(({language:e})=>{e!==window.localStorage.getItem(It)&&window.localStorage.setItem(It,e)}),window.addEventListener("storage",e=>{if(e.key===It){const e=localStorage.getItem(It)??void 0;e&&t.setLanguage(e)}}),t}#t;#r;#n;constructor(e,t){this.#t=e,this.#r=t,this.#n=new x({language:this.#r})}getAvailableLanguages(){return{languages:this.#t.slice()}}setLanguage(e){const t=e??Ct;if(t!==this.#r){if(t&&!this.#t.includes(t))throw new Error(`Failed to change language to '${t}', available languages are '${this.#t.join("', '")}'`);this.#r=t,this.#n.next({language:t})}}getLanguage(){return{language:this.#r}}language$(){return this.#n}}var $t=r(17545),Tt=r(55152),Ft=r(30414),Nt=r(2474),Dt=r(29296),Ut=r(95309),Mt=r(72715),qt=r(24586),_t=r(37756);function Bt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Vt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Bt(Object(r),!0).forEach(function(t){(0,qt.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Kt={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},Ht=new(function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,Tt.A)(this,e),this.init(t,r)}return(0,Ft.A)(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Kt,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,r,n){return n&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(r).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,Vt(Vt({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}()),zt=function(){function e(){(0,Tt.A)(this,e),this.observers={}}return(0,Ft.A)(e,[{key:"on",value:function(e,t){var r=this;return e.split(" ").forEach(function(e){r.observers[e]=r.observers[e]||[],r.observers[e].push(t)}),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter(function(e){return e!==t}):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.observers[e]&&[].concat(this.observers[e]).forEach(function(e){e.apply(void 0,r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(function(t){t.apply(t,[e].concat(r))})}}]),e}();function Gt(){var e,t,r=new Promise(function(r,n){e=r,t=n});return r.resolve=e,r.reject=t,r}function Jt(e){return null==e?"":""+e}function Wt(e,t,r){function n(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function o(){return!e||"string"==typeof e}for(var s="string"!=typeof t?[].concat(t):t.split(".");s.length>1;){if(o())return{};var i=n(s.shift());!e[i]&&r&&(e[i]=new r),e=Object.prototype.hasOwnProperty.call(e,i)?e[i]:{}}return o()?{}:{obj:e,k:n(s.shift())}}function Yt(e,t,r){var n=Wt(e,t,Object);n.obj[n.k]=r}function Xt(e,t){var r=Wt(e,t),n=r.obj,o=r.k;if(n)return n[o]}function Qt(e,t,r){for(var n in t)"__proto__"!==n&&"constructor"!==n&&(n in e?"string"==typeof e[n]||e[n]instanceof String||"string"==typeof t[n]||t[n]instanceof String?r&&(e[n]=t[n]):Qt(e[n],t[n],r):e[n]=t[n]);return e}function Zt(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var er={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function tr(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,function(e){return er[e]}):e}var rr="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,nr=[" ",",","?","!",";"];function or(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var n=t.split(r),o=e,s=0;s<n.length;++s){if(!o)return;if("string"==typeof o[n[s]]&&s+1<n.length)return;if(void 0===o[n[s]]){for(var i=2,a=n.slice(s,s+i).join(r),c=o[a];void 0===c&&n.length>s+i;)i++,c=o[a=n.slice(s,s+i).join(r)];if(void 0===c)return;if(null===c)return null;if(t.endsWith(a)){if("string"==typeof c)return c;if(a&&"string"==typeof c[a])return c[a]}var u=n.slice(s+i).join(r);return u?or(c,u,r):void 0}o=o[n[s]]}return o}}function sr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ir(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sr(Object(r),!0).forEach(function(t){(0,qt.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sr(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var ar=function(e){(0,Dt.A)(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=(0,Mt.A)(t);if(r){var o=(0,Mt.A)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,Ut.A)(this,e)});function o(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return(0,Tt.A)(this,o),t=n.call(this),rr&&zt.call((0,Nt.A)(t)),t.data=e||{},t.options=r,void 0===t.options.keySeparator&&(t.options.keySeparator="."),void 0===t.options.ignoreJSONStructure&&(t.options.ignoreJSONStructure=!0),t}return(0,Ft.A)(o,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,s=void 0!==n.ignoreJSONStructure?n.ignoreJSONStructure:this.options.ignoreJSONStructure,i=[e,t];r&&"string"!=typeof r&&(i=i.concat(r)),r&&"string"==typeof r&&(i=i.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(i=e.split("."));var a=Xt(this.data,i);return a||!s||"string"!=typeof r?a:or(this.data&&this.data[e]&&this.data[e][t],r,o)}},{key:"addResource",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},s=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,i=[e,t];r&&(i=i.concat(s?r.split(s):r)),e.indexOf(".")>-1&&(n=t,t=(i=e.split("."))[1]),this.addNamespaces(t),Yt(this.data,i,n),o.silent||this.emit("added",e,t,r,n)}},{key:"addResources",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var o in r)"string"!=typeof r[o]&&"[object Array]"!==Object.prototype.toString.apply(r[o])||this.addResource(e,t,o,r[o],{silent:!0});n.silent||this.emit("added",e,t,r)}},{key:"addResourceBundle",value:function(e,t,r,n,o){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},i=[e,t];e.indexOf(".")>-1&&(n=r,r=t,t=(i=e.split("."))[1]),this.addNamespaces(t);var a=Xt(this.data,i)||{};n?Qt(a,r,o):a=ir(ir({},a),r),Yt(this.data,i,a),s.silent||this.emit("added",e,t,r)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?ir(ir({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(function(e){return t[e]&&Object.keys(t[e]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),o}(zt),cr={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,n,o){var s=this;return e.forEach(function(e){s.processors[e]&&(t=s.processors[e].process(t,r,n,o))}),t}};function ur(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function lr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ur(Object(r),!0).forEach(function(t){(0,qt.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ur(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var pr={},hr=function(e){(0,Dt.A)(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=(0,Mt.A)(t);if(r){var o=(0,Mt.A)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,Ut.A)(this,e)});function o(e){var t,r,s,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,Tt.A)(this,o),t=n.call(this),rr&&zt.call((0,Nt.A)(t)),r=e,s=(0,Nt.A)(t),["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach(function(e){r[e]&&(s[e]=r[e])}),t.options=i,void 0===t.options.keySeparator&&(t.options.keySeparator="."),t.logger=Ht.create("translator"),t}return(0,Ft.A)(o,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var r=this.resolve(e,t);return r&&void 0!==r.res}},{key:"extractFromKey",value:function(e,t){var r=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===r&&(r=":");var n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,o=t.ns||this.options.defaultNS||[],s=r&&e.indexOf(r)>-1,i=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,r){t=t||"",r=r||"";var n=nr.filter(function(e){return t.indexOf(e)<0&&r.indexOf(e)<0});if(0===n.length)return!0;var o=new RegExp("(".concat(n.map(function(e){return"?"===e?"\\?":e}).join("|"),")")),s=!o.test(e);if(!s){var i=e.indexOf(r);i>0&&!o.test(e.substring(0,i))&&(s=!0)}return s}(e,r,n));if(s&&!i){var a=e.match(this.interpolator.nestingRegexp);if(a&&a.length>0)return{key:e,namespaces:o};var c=e.split(r);(r!==n||r===n&&this.options.ns.indexOf(c[0])>-1)&&(o=c.shift()),e=c.join(n)}return"string"==typeof o&&(o=[o]),{key:e,namespaces:o}}},{key:"translate",value:function(e,t,r){var n=this;if("object"!==(0,$t.A)(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"===(0,$t.A)(t)&&(t=lr({},t)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var s=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,i=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],t),c=a.key,u=a.namespaces,l=u[u.length-1],p=t.lng||this.language,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p&&"cimode"===p.toLowerCase()){if(h){var f=t.nsSeparator||this.options.nsSeparator;return s?{res:"".concat(l).concat(f).concat(c),usedKey:c,exactUsedKey:c,usedLng:p,usedNS:l}:"".concat(l).concat(f).concat(c)}return s?{res:c,usedKey:c,exactUsedKey:c,usedLng:p,usedNS:l}:c}var g=this.resolve(e,t),d=g&&g.res,v=g&&g.usedKey||c,y=g&&g.exactUsedKey||c,m=Object.prototype.toString.apply(d),w=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject;if(b&&d&&"string"!=typeof d&&"boolean"!=typeof d&&"number"!=typeof d&&["[object Number]","[object Function]","[object RegExp]"].indexOf(m)<0&&("string"!=typeof w||"[object Array]"!==m)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var S=this.options.returnedObjectHandler?this.options.returnedObjectHandler(v,d,lr(lr({},t),{},{ns:u})):"key '".concat(c," (").concat(this.language,")' returned an object instead of string.");return s?(g.res=S,g):S}if(i){var A="[object Array]"===m,x=A?[]:{},k=A?y:v;for(var O in d)if(Object.prototype.hasOwnProperty.call(d,O)){var R="".concat(k).concat(i).concat(O);x[O]=this.translate(R,lr(lr({},t),{joinArrays:!1,ns:u})),x[O]===R&&(x[O]=d[O])}d=x}}else if(b&&"string"==typeof w&&"[object Array]"===m)(d=d.join(w))&&(d=this.extendTranslation(d,e,t,r));else{var j=!1,E=!1,P=void 0!==t.count&&"string"!=typeof t.count,I=o.hasDefaultValue(t),C=P?this.pluralResolver.getSuffix(p,t.count,t):"",L=t["defaultValue".concat(C)]||t.defaultValue;!this.isValidLookup(d)&&I&&(j=!0,d=L),this.isValidLookup(d)||(E=!0,d=c);var $=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&E?void 0:d,T=I&&L!==d&&this.options.updateMissing;if(E||j||T){if(this.logger.log(T?"updateKey":"missingKey",p,l,c,T?L:d),i){var F=this.resolve(c,lr(lr({},t),{},{keySeparator:!1}));F&&F.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var N=[],D=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&D&&D[0])for(var U=0;U<D.length;U++)N.push(D[U]);else"all"===this.options.saveMissingTo?N=this.languageUtils.toResolveHierarchy(t.lng||this.language):N.push(t.lng||this.language);var M=function(e,r,o){var s=I&&o!==d?o:$;n.options.missingKeyHandler?n.options.missingKeyHandler(e,l,r,s,T,t):n.backendConnector&&n.backendConnector.saveMissing&&n.backendConnector.saveMissing(e,l,r,s,T,t),n.emit("missingKey",e,l,r,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?N.forEach(function(e){n.pluralResolver.getSuffixes(e,t).forEach(function(r){M([e],c+r,t["defaultValue".concat(r)]||L)})}):M(N,c,L))}d=this.extendTranslation(d,e,t,g,r),E&&d===c&&this.options.appendNamespaceToMissingKey&&(d="".concat(l,":").concat(c)),(E||j)&&this.options.parseMissingKeyHandler&&(d="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(l,":").concat(c):c,j?d:void 0):this.options.parseMissingKeyHandler(d))}return s?(g.res=d,g):d}},{key:"extendTranslation",value:function(e,t,r,n,o){var s=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,lr(lr({},this.options.interpolation.defaultVariables),r),n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init(lr(lr({},r),{interpolation:lr(lr({},this.options.interpolation),r.interpolation)}));var i,a="string"==typeof e&&(r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(a){var c=e.match(this.interpolator.nestingRegexp);i=c&&c.length}var u=r.replace&&"string"!=typeof r.replace?r.replace:r;if(this.options.interpolation.defaultVariables&&(u=lr(lr({},this.options.interpolation.defaultVariables),u)),e=this.interpolator.interpolate(e,u,r.lng||this.language,r),a){var l=e.match(this.interpolator.nestingRegexp);i<(l&&l.length)&&(r.nest=!1)}!r.lng&&"v1"!==this.options.compatibilityAPI&&n&&n.res&&(r.lng=n.usedLng),!1!==r.nest&&(e=this.interpolator.nest(e,function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return o&&o[0]===n[0]&&!r.context?(s.logger.warn("It seems you are nesting recursively key: ".concat(n[0]," in key: ").concat(t[0])),null):s.translate.apply(s,n.concat([t]))},r)),r.interpolation&&this.interpolator.reset()}var p=r.postProcess||this.options.postProcess,h="string"==typeof p?[p]:p;return null!=e&&h&&h.length&&!1!==r.applyPostProcessor&&(e=cr.handle(h,e,t,this.options&&this.options.postProcessPassResolved?lr({i18nResolved:n},r):r,this)),e}},{key:"resolve",value:function(e){var t,r,n,o,s,i=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach(function(e){if(!i.isValidLookup(t)){var c=i.extractFromKey(e,a),u=c.key;r=u;var l=c.namespaces;i.options.fallbackNS&&(l=l.concat(i.options.fallbackNS));var p=void 0!==a.count&&"string"!=typeof a.count,h=p&&!a.ordinal&&0===a.count&&i.pluralResolver.shouldUseIntlApi(),f=void 0!==a.context&&("string"==typeof a.context||"number"==typeof a.context)&&""!==a.context,g=a.lngs?a.lngs:i.languageUtils.toResolveHierarchy(a.lng||i.language,a.fallbackLng);l.forEach(function(e){i.isValidLookup(t)||(s=e,!pr["".concat(g[0],"-").concat(e)]&&i.utils&&i.utils.hasLoadedNamespace&&!i.utils.hasLoadedNamespace(s)&&(pr["".concat(g[0],"-").concat(e)]=!0,i.logger.warn('key "'.concat(r,'" for languages "').concat(g.join(", "),'" won\'t get resolved as namespace "').concat(s,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(function(r){if(!i.isValidLookup(t)){o=r;var s,c=[u];if(i.i18nFormat&&i.i18nFormat.addLookupKeys)i.i18nFormat.addLookupKeys(c,u,r,e,a);else{var l;p&&(l=i.pluralResolver.getSuffix(r,a.count,a));var g="".concat(i.options.pluralSeparator,"zero");if(p&&(c.push(u+l),h&&c.push(u+g)),f){var d="".concat(u).concat(i.options.contextSeparator).concat(a.context);c.push(d),p&&(c.push(d+l),h&&c.push(d+g))}}for(;s=c.pop();)i.isValidLookup(t)||(n=s,t=i.getResource(r,e,s,a))}}))})}}),{res:t,usedKey:r,exactUsedKey:n,usedLng:o,usedNS:s}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,r,n):this.resourceStore.getResource(e,t,r,n)}}],[{key:"hasDefaultValue",value:function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&"defaultValue"===t.substring(0,12)&&void 0!==e[t])return!0;return!1}}]),o}(zt);function fr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var gr=function(){function e(t){(0,Tt.A)(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ht.create("languageUtils")}return(0,Ft.A)(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],r=e.split("-");return this.options.lowerCaseLng?r=r.map(function(e){return e.toLowerCase()}):2===r.length?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=fr(r[1].toLowerCase()))):3===r.length&&(r[0]=r[0].toLowerCase(),2===r[1].length&&(r[1]=r[1].toUpperCase()),"sgn"!==r[0]&&2===r[2].length&&(r[2]=r[2].toUpperCase()),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=fr(r[1].toLowerCase())),t.indexOf(r[2].toLowerCase())>-1&&(r[2]=fr(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,r=this;return e?(e.forEach(function(e){if(!t){var n=r.formatLanguageCode(e);r.options.supportedLngs&&!r.isSupportedCode(n)||(t=n)}}),!t&&this.options.supportedLngs&&e.forEach(function(e){if(!t){var n=r.getLanguagePartFromCode(e);if(r.isSupportedCode(n))return t=n;t=r.options.supportedLngs.find(function(e){return e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:0===e.indexOf(n)?e:void 0})}}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}},{key:"toResolveHierarchy",value:function(e,t){var r=this,n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),o=[],s=function(e){e&&(r.isSupportedCode(e)?o.push(e):r.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&s(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&s(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&s(this.getLanguagePartFromCode(e))):"string"==typeof e&&s(this.formatLanguageCode(e)),n.forEach(function(e){o.indexOf(e)<0&&s(r.formatLanguageCode(e))}),o}}]),e}(),dr=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],vr={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},yr=["v1","v2","v3"],mr={zero:0,one:1,two:2,few:3,many:4,other:5},wr=function(){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,Tt.A)(this,e),this.languageUtils=t,this.options=n,this.logger=Ht.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(r={},dr.forEach(function(e){e.lngs.forEach(function(t){r[t]={numbers:e.nr,plurals:vr[e.fc]}})}),r)}return(0,Ft.A)(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,t);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,r).map(function(e){return"".concat(t).concat(e)})}},{key:"getSuffixes",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,r);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort(function(e,t){return mr[e]-mr[t]}).map(function(e){return"".concat(t.options.prepend).concat(e)}):n.numbers.map(function(n){return t.getSuffix(e,n,r)}):[]}},{key:"getSuffix",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.getRule(e,r);return n?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(n.select(t)):this.getSuffixRetroCompatible(n,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var r=this,n=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),o=e.numbers[n];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===o?o="plural":1===o&&(o=""));var s=function(){return r.options.prepend&&o.toString()?r.options.prepend+o.toString():o.toString()};return"v1"===this.options.compatibilityJSON?1===o?"":"number"==typeof o?"_plural_".concat(o.toString()):s():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?s():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}},{key:"shouldUseIntlApi",value:function(){return!yr.includes(this.options.compatibilityJSON)}}]),e}();function br(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Sr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?br(Object(r),!0).forEach(function(t){(0,qt.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):br(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ar(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=function(e,t,r){var n=Xt(e,r);return void 0!==n?n:Xt(t,r)}(e,t,r);return!s&&o&&"string"==typeof r&&void 0===(s=or(e,r,n))&&(s=or(t,r,n)),s}var xr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,Tt.A)(this,e),this.logger=Ht.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return(0,Ft.A)(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:tr,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?Zt(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?Zt(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?Zt(t.nestingPrefix):t.nestingPrefixEscaped||Zt("$t("),this.nestingSuffix=t.nestingSuffix?Zt(t.nestingSuffix):t.nestingSuffixEscaped||Zt(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var r="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(r,"g")}},{key:"interpolate",value:function(e,t,r,n){var o,s,i,a=this,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var l=function(e){if(e.indexOf(a.formatSeparator)<0){var o=Ar(t,c,e,a.options.keySeparator,a.options.ignoreJSONStructure);return a.alwaysFormat?a.format(o,void 0,r,Sr(Sr(Sr({},n),t),{},{interpolationkey:e})):o}var s=e.split(a.formatSeparator),i=s.shift().trim(),u=s.join(a.formatSeparator).trim();return a.format(Ar(t,c,i,a.options.keySeparator,a.options.ignoreJSONStructure),u,r,Sr(Sr(Sr({},n),t),{},{interpolationkey:i}))};this.resetRegExp();var p=n&&n.missingInterpolationHandler||this.options.missingInterpolationHandler,h=n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return u(e)}},{regex:this.regexp,safeValue:function(e){return a.escapeValue?u(a.escape(e)):u(e)}}].forEach(function(t){for(i=0;o=t.regex.exec(e);){var r=o[1].trim();if(void 0===(s=l(r)))if("function"==typeof p){var c=p(e,o,n);s="string"==typeof c?c:""}else if(n&&Object.prototype.hasOwnProperty.call(n,r))s="";else{if(h){s=o[0];continue}a.logger.warn("missed to pass in variable ".concat(r," for interpolating ").concat(e)),s=""}else"string"==typeof s||a.useRawValueToEscape||(s=Jt(s));var u=t.safeValue(s);if(e=e.replace(o[0],u),h?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,++i>=a.maxReplaces)break}}),e}},{key:"nest",value:function(e,t){var r,n,o,s=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function a(e,t){var r=this.nestingOptionsSeparator;if(e.indexOf(r)<0)return e;var n=e.split(new RegExp("".concat(r,"[ ]*{"))),s="{".concat(n[1]);e=n[0];var i=(s=this.interpolate(s,o)).match(/'/g),a=s.match(/"/g);(i&&i.length%2==0&&!a||a.length%2!=0)&&(s=s.replace(/'/g,'"'));try{o=JSON.parse(s),t&&(o=Sr(Sr({},t),o))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(r).concat(s)}return delete o.defaultValue,e}for(;r=this.nestingRegexp.exec(e);){var c=[];(o=(o=Sr({},i)).replace&&"string"!=typeof o.replace?o.replace:o).applyPostProcessor=!1,delete o.defaultValue;var u=!1;if(-1!==r[0].indexOf(this.formatSeparator)&&!/{.*}/.test(r[1])){var l=r[1].split(this.formatSeparator).map(function(e){return e.trim()});r[1]=l.shift(),c=l,u=!0}if((n=t(a.call(this,r[1].trim(),o),o))&&r[0]===e&&"string"!=typeof n)return n;"string"!=typeof n&&(n=Jt(n)),n||(this.logger.warn("missed to resolve ".concat(r[1]," for nesting ").concat(e)),n=""),u&&(n=c.reduce(function(e,t){return s.format(e,t,i.lng,Sr(Sr({},i),{},{interpolationkey:r[1].trim()}))},n.trim())),e=e.replace(r[0],n),this.regexp.lastIndex=0}return e}}]),e}();function kr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Or(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?kr(Object(r),!0).forEach(function(t){(0,qt.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kr(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Rr(e){var t={};return function(r,n,o){var s=n+JSON.stringify(o),i=t[s];return i||(i=e(n,o),t[s]=i),i(r)}}var jr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,Tt.A)(this,e),this.logger=Ht.create("formatter"),this.options=t,this.formats={number:Rr(function(e,t){var r=new Intl.NumberFormat(e,Or({},t));return function(e){return r.format(e)}}),currency:Rr(function(e,t){var r=new Intl.NumberFormat(e,Or(Or({},t),{},{style:"currency"}));return function(e){return r.format(e)}}),datetime:Rr(function(e,t){var r=new Intl.DateTimeFormat(e,Or({},t));return function(e){return r.format(e)}}),relativetime:Rr(function(e,t){var r=new Intl.RelativeTimeFormat(e,Or({},t));return function(e){return r.format(e,t.range||"day")}}),list:Rr(function(e,t){var r=new Intl.ListFormat(e,Or({},t));return function(e){return r.format(e)}})},this.init(t)}return(0,Ft.A)(e,[{key:"init",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=Rr(t)}},{key:"format",value:function(e,t,r){var n=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return t.split(this.formatSeparator).reduce(function(e,t){var s=function(e){var t=e.toLowerCase().trim(),r={};if(e.indexOf("(")>-1){var n=e.split("(");t=n[0].toLowerCase().trim();var o=n[1].substring(0,n[1].length-1);"currency"===t&&o.indexOf(":")<0?r.currency||(r.currency=o.trim()):"relativetime"===t&&o.indexOf(":")<0?r.range||(r.range=o.trim()):o.split(";").forEach(function(e){if(e){var t=e.split(":"),n=(0,_t.A)(t),o=n[0],s=n.slice(1).join(":").trim().replace(/^'+|'+$/g,"");r[o.trim()]||(r[o.trim()]=s),"false"===s&&(r[o.trim()]=!1),"true"===s&&(r[o.trim()]=!0),isNaN(s)||(r[o.trim()]=parseInt(s,10))}})}return{formatName:t,formatOptions:r}}(t),i=s.formatName,a=s.formatOptions;if(n.formats[i]){var c=e;try{var u=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},l=u.locale||u.lng||o.locale||o.lng||r;c=n.formats[i](e,l,Or(Or(Or({},a),o),u))}catch(e){n.logger.warn(e)}return c}return n.logger.warn("there was no format function for ".concat(i)),e},e)}}]),e}();function Er(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Pr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Er(Object(r),!0).forEach(function(t){(0,qt.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Er(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Ir=function(e){(0,Dt.A)(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=(0,Mt.A)(t);if(r){var o=(0,Mt.A)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,Ut.A)(this,e)});function o(e,t,r){var s,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,Tt.A)(this,o),s=n.call(this),rr&&zt.call((0,Nt.A)(s)),s.backend=e,s.store=t,s.services=r,s.languageUtils=r.languageUtils,s.options=i,s.logger=Ht.create("backendConnector"),s.waitingReads=[],s.maxParallelReads=i.maxParallelReads||10,s.readingCalls=0,s.maxRetries=i.maxRetries>=0?i.maxRetries:5,s.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(r,i.backend,i),s}return(0,Ft.A)(o,[{key:"queueLoad",value:function(e,t,r,n){var o=this,s={},i={},a={},c={};return e.forEach(function(e){var n=!0;t.forEach(function(t){var a="".concat(e,"|").concat(t);!r.reload&&o.store.hasResourceBundle(e,t)?o.state[a]=2:o.state[a]<0||(1===o.state[a]?void 0===i[a]&&(i[a]=!0):(o.state[a]=1,n=!1,void 0===i[a]&&(i[a]=!0),void 0===s[a]&&(s[a]=!0),void 0===c[t]&&(c[t]=!0)))}),n||(a[e]=!0)}),(Object.keys(s).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(s),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(c)}}},{key:"loaded",value:function(e,t,r){var n=e.split("|"),o=n[0],s=n[1];t&&this.emit("failedLoading",o,s,t),r&&this.store.addResourceBundle(o,s,r),this.state[e]=t?-1:2;var i={};this.queue.forEach(function(r){var n,a,c,u,l;n=r.loaded,a=s,(u=(c=Wt(n,[o],Object)).obj)[l=c.k]=u[l]||[],u[l].push(a),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(r,e),t&&r.errors.push(t),0!==r.pendingCount||r.done||(Object.keys(r.loaded).forEach(function(e){i[e]||(i[e]={});var t=r.loaded[e];t.length&&t.forEach(function(t){void 0===i[e][t]&&(i[e][t]=!0)})}),r.done=!0,r.errors.length?r.callback(r.errors):r.callback())}),this.emit("loaded",i),this.queue=this.queue.filter(function(e){return!e.done})}},{key:"read",value:function(e,t,r){var n=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:r,tried:o,wait:s,callback:i});else{this.readingCalls++;var a=function(a,c){if(n.readingCalls--,n.waitingReads.length>0){var u=n.waitingReads.shift();n.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.callback)}a&&c&&o<n.maxRetries?setTimeout(function(){n.read.call(n,e,t,r,o+1,2*s,i)},s):i(a,c)},c=this.backend[r].bind(this.backend);if(2!==c.length)return c(e,t,a);try{var u=c(e,t);u&&"function"==typeof u.then?u.then(function(e){return a(null,e)}).catch(a):a(null,u)}catch(e){a(e)}}}},{key:"prepareLoading",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var s=this.queueLoad(e,t,n,o);if(!s.toLoad.length)return s.pending.length||o(),null;s.toLoad.forEach(function(e){r.loadOne(e)})}},{key:"load",value:function(e,t,r){this.prepareLoading(e,t,{},r)}},{key:"reload",value:function(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}},{key:"loadOne",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=e.split("|"),o=n[0],s=n[1];this.read(o,s,"read",void 0,void 0,function(n,i){n&&t.logger.warn("".concat(r,"loading namespace ").concat(s," for language ").concat(o," failed"),n),!n&&i&&t.logger.log("".concat(r,"loaded namespace ").concat(s," for language ").concat(o),i),t.loaded(e,n,i)})}},{key:"saveMissing",value:function(e,t,r,n,o){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},i=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(r,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=r&&""!==r){if(this.backend&&this.backend.create){var a=Pr(Pr({},s),{},{isUpdate:o}),c=this.backend.create.bind(this.backend);if(c.length<6)try{var u;(u=5===c.length?c(e,t,r,n,a):c(e,t,r,n))&&"function"==typeof u.then?u.then(function(e){return i(null,e)}).catch(i):i(null,u)}catch(e){i(e)}else c(e,t,r,n,i,a)}e&&e[0]&&this.store.addResource(e[0],t,r,n)}}}]),o}(zt);function Cr(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===(0,$t.A)(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===(0,$t.A)(e[2])||"object"===(0,$t.A)(e[3])){var r=e[3]||e[2];Object.keys(r).forEach(function(e){t[e]=r[e]})}return t},interpolation:{escapeValue:!0,format:function(e,t,r,n){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Lr(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function $r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Tr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$r(Object(r),!0).forEach(function(t){(0,qt.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$r(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Fr(){}var Nr=function(e){(0,Dt.A)(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=(0,Mt.A)(t);if(r){var o=(0,Mt.A)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,Ut.A)(this,e)});function o(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if((0,Tt.A)(this,o),e=n.call(this),rr&&zt.call((0,Nt.A)(e)),e.options=Lr(r),e.services={},e.logger=Ht,e.modules={external:[]},t=(0,Nt.A)(e),Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(function(e){"function"==typeof t[e]&&(t[e]=t[e].bind(t))}),s&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,s),(0,Ut.A)(e,(0,Nt.A)(e));setTimeout(function(){e.init(r,s)},0)}return e}return(0,Ft.A)(o,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(r=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var n=Cr();function o(e){return e?"function"==typeof e?new e:e:null}if(this.options=Tr(Tr(Tr({},n),this.options),Lr(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=Tr(Tr({},n.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var s;this.modules.logger?Ht.init(o(this.modules.logger),this.options):Ht.init(null,this.options),this.modules.formatter?s=this.modules.formatter:"undefined"!=typeof Intl&&(s=jr);var i=new gr(this.options);this.store=new ar(this.options.resources,this.options);var a=this.services;a.logger=Ht,a.resourceStore=this.store,a.languageUtils=i,a.pluralResolver=new wr(i,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!s||this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format||(a.formatter=o(s),a.formatter.init(a,this.options),this.options.interpolation.format=a.formatter.format.bind(a.formatter)),a.interpolator=new xr(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new Ir(o(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];e.emit.apply(e,[t].concat(n))}),this.modules.languageDetector&&(a.languageDetector=o(this.modules.languageDetector),a.languageDetector.init&&a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=o(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new hr(this.services,this.options),this.translator.on("*",function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];e.emit.apply(e,[t].concat(n))}),this.modules.external.forEach(function(t){t.init&&t.init(e)})}if(this.format=this.options.interpolation.format,r||(r=Fr),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&"dev"!==c[0]&&(this.options.lng=c[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(function(t){e[t]=function(){var r;return(r=e.store)[t].apply(r,arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(function(t){e[t]=function(){var r;return(r=e.store)[t].apply(r,arguments),e}});var u=Gt(),l=function(){var t=function(t,n){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),u.resolve(n),r(t,n)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?l():setTimeout(l,0),u}},{key:"loadResources",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fr,n="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase())return r();var o=[],s=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach(function(e){o.indexOf(e)<0&&o.push(e)})};n?s(n):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(function(e){return s(e)}),this.options.preload&&this.options.preload.forEach(function(e){return s(e)}),this.services.backendConnector.load(o,this.options.ns,function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),r(e)})}else r(null)}},{key:"reloadResources",value:function(e,t,r){var n=Gt();return e||(e=this.languages),t||(t=this.options.ns),r||(r=Fr),this.services.backendConnector.reload(e,t,function(e){n.resolve(),r(e)}),n}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&cr.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var r=this.languages[t];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}},{key:"changeLanguage",value:function(e,t){var r=this;this.isLanguageChangingTo=e;var n=Gt();this.emit("languageChanging",e);var o=function(e){r.language=e,r.languages=r.services.languageUtils.toResolveHierarchy(e),r.resolvedLanguage=void 0,r.setResolvedLanguage(e)},s=function(s){e||s||!r.services.languageDetector||(s=[]);var i="string"==typeof s?s:r.services.languageUtils.getBestMatchFromCodes(s);i&&(r.language||o(i),r.translator.language||r.translator.changeLanguage(i),r.services.languageDetector&&r.services.languageDetector.cacheUserLanguage&&r.services.languageDetector.cacheUserLanguage(i)),r.loadResources(i,function(e){!function(e,s){s?(o(s),r.translator.changeLanguage(s),r.isLanguageChangingTo=void 0,r.emit("languageChanged",s),r.logger.log("languageChanged",s)):r.isLanguageChangingTo=void 0,n.resolve(function(){return r.t.apply(r,arguments)}),t&&t(e,function(){return r.t.apply(r,arguments)})}(e,i)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e):s(this.services.languageDetector.detect()),n}},{key:"getFixedT",value:function(e,t,r){var n=this,o=function e(t,o){var s;if("object"!==(0,$t.A)(o)){for(var i=arguments.length,a=new Array(i>2?i-2:0),c=2;c<i;c++)a[c-2]=arguments[c];s=n.options.overloadTranslationOptionHandler([t,o].concat(a))}else s=Tr({},o);s.lng=s.lng||e.lng,s.lngs=s.lngs||e.lngs,s.ns=s.ns||e.ns,s.keyPrefix=s.keyPrefix||r||e.keyPrefix;var u,l=n.options.keySeparator||".";return u=s.keyPrefix&&Array.isArray(t)?t.map(function(e){return"".concat(s.keyPrefix).concat(l).concat(e)}):s.keyPrefix?"".concat(s.keyPrefix).concat(l).concat(t):t,n.t(u,s)};return"string"==typeof e?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=r,o}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var n=r.lng||this.resolvedLanguage||this.languages[0],o=!!this.options&&this.options.fallbackLng,s=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;var i=function(e,r){var n=t.services.backendConnector.state["".concat(e,"|").concat(r)];return-1===n||2===n};if(r.precheck){var a=r.precheck(this,i);if(void 0!==a)return a}return!(!this.hasResourceBundle(n,e)&&this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages)&&(!i(n,e)||o&&!i(s,e)))}},{key:"loadNamespaces",value:function(e,t){var r=this,n=Gt();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach(function(e){r.options.ns.indexOf(e)<0&&r.options.ns.push(e)}),this.loadResources(function(e){n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var r=Gt();"string"==typeof e&&(e=[e]);var n=this.options.preload||[],o=e.filter(function(e){return n.indexOf(e)<0});return o.length?(this.options.preload=n.concat(o),this.loadResources(function(e){r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";var t=this.services&&this.services.languageUtils||new gr(Cr());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fr,n=Tr(Tr(Tr({},this.options),t),{isClone:!0}),s=new o(n);return void 0===t.debug&&void 0===t.prefix||(s.logger=s.logger.clone(t)),["store","services","language"].forEach(function(t){s[t]=e[t]}),s.services=Tr({},this.services),s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s.translator=new hr(s.services,s.options),s.translator.on("*",function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];s.emit.apply(s,[e].concat(r))}),s.init(n,r),s.translator.options=s.options,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),o}(zt);(0,qt.A)(Nr,"createInstance",function(){return new Nr(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)});var Dr=Nr.createInstance();Dr.createInstance=Nr.createInstance;var Ur=Dr.createInstance;function Mr(e){const t=e;if("@backstage/TranslationRef"!==t.$$type)throw new Error(`Invalid translation ref, bad type '${t.$$type}'`);if("v1"!==t.version)throw new Error(`Invalid translation ref, bad version '${t.version}'`);return t}function qr(e){return Object.fromEntries(Object.entries(e).filter(e=>null!==e[1]))}Dr.dir,Dr.init,Dr.loadResources,Dr.reloadResources,Dr.use,Dr.changeLanguage,Dr.getFixedT,Dr.t,Dr.exists,Dr.setDefaultNamespace,Dr.hasLoadedNamespace,Dr.loadNamespaces,Dr.loadLanguages;class _r{constructor(e){this.onLoad=e}#o=new Set;#s=new Map;#i=new Map;addTranslationResource(e){const t=function(e){const t=e;if("@backstage/TranslationResource"!==t.$$type)throw new Error(`Invalid translation resource, bad type '${t.$$type}'`);if("v1"!==t.version)throw new Error(`Invalid translation resource, bad version '${t.version}'`);return t}(e);for(const e of t.resources){const r=this.#a(e.language,t.id);this.#i.has(r)||this.#i.set(r,e.loader)}}#a(e,t){return`${e}/${t}`}needsLoading(e,t){const r=this.#a(e,t);return!!this.#i.get(r)&&!this.#o.has(r)}async load(e,t){const r=this.#a(e,t),n=this.#i.get(r);if(!n)return;if(this.#o.has(r))return;const o=this.#s.get(r);if(o)return void await o;const s=n().then(n=>{this.onLoad({language:e,namespace:t,messages:n.messages}),this.#o.add(r)},e=>{throw this.#o.add(r),e});this.#s.set(r,s),await s}}class Br{#c;#u;#l;static fromI18n(e){const t=e.services.interpolator,r=t.format;let n;return t.format=(e,t,o,s)=>t?r(e,t,o,s):n?.(e,t,o,s)??e,new Br(Math.random().toString(36).substring(2,8),e=>{n=e})}constructor(e,t){this.#c=t,this.#u=e,this.#l=new RegExp(`\\$${e}\\(([^)]+)\\)`)}wrapT(e){return(t,r)=>{let n;this.#c(e=>{if((0,o.isValidElement)(e)){n||(n=new Map);const t=n.size.toString();return n.set(t,e),`$${this.#u}(${t})`}return e});const s=e(t,r);if(!n)return s;const i=s.split(this.#l);return(0,o.createElement)(o.Fragment,null,...i.map((e,t)=>t%2==0?e:n?.get(e)).filter(Boolean))}}}class Vr{static create(e){const{languages:t}=e.languageApi.getAvailableLanguages(),r=Ur({fallbackLng:Ct,supportedLngs:t,interpolation:{escapeValue:!1,alwaysFormat:!0},ns:[],defaultNS:!1,fallbackNS:!1,initImmediate:!1});if(r.init(),!r.isInitialized)throw new Error("i18next was unexpectedly not initialized");const n=Br.fromI18n(r),{language:o}=e.languageApi.getLanguage();o!==Ct&&r.changeLanguage(o);const s=new _r(e=>{r.addResourceBundle(e.language,e.namespace,qr(e.messages),!1,!0)}),i=e?.resources||[];for(let e=i.length-1;e>=0;e--){const t=i[e];"@backstage/TranslationResource"===t.$$type?s.addTranslationResource(t):"@backstage/TranslationMessages"===t.$$type&&r.addResourceBundle(Ct,t.id,qr(t.messages),!0,!1)}const a=new Vr(r,s,e.languageApi.getLanguage().language,n);return e.languageApi.language$().subscribe(({language:e})=>{a.#p(e)}),a}#h;#f;#r;#g;#d=new Set;#v=new Set;constructor(e,t,r,n){this.#h=e,this.#f=t,this.#r=r,this.#g=n}getTranslation(e){const t=Mr(e);return this.#y(t),this.#m(t)}translation$(e){const t=Mr(e);return this.#y(t),new(S())(e=>{let r={};const n=()=>{r={};const n=r;this.#f.load(this.#r,t.id).then(()=>{if(n===r){const r=this.#m(t);r.ready&&e.next(r)}},t=>{n===r&&e.error(Array.isArray(t)?t[0]:t)})},o=()=>{const r=this.#m(t);r.ready?e.next(r):n()};return this.#f.needsLoading(this.#r,t.id)&&n(),this.#v.add(o),()=>{this.#v.delete(o)}})}#p(e){this.#r!==e&&(this.#r=e,this.#h.changeLanguage(e),this.#v.forEach(e=>e()))}#m(e){if(this.#f.needsLoading(this.#r,e.id))return{ready:!1};const t=this.#h.getFixedT(null,e.id);return{ready:!0,t:this.#g.wrapT(t)}}#y(e){if(this.#d.has(e.id))return;this.#d.add(e.id);const t=e.getDefaultMessages();this.#h.addResourceBundle(Ct,e.id,t,!0,!1);const r=e.getDefaultResource();r&&this.#f.addTranslationResource(r)}}function Kr(e){const t=new URL(e);return t.protocol=document.location.protocol,t.hostname=document.location.hostname,t.port=document.location.port,t.toString().replace(/\/$/,"")}class Hr{constructor(e){this.app=e}getPlugins(){return this.app.getPlugins()}getSystemIcon(e){return this.app.getSystemIcon(e)}getSystemIcons(){return this.app.getSystemIcons()}getComponents(){return this.app.getComponents()}}class zr{apiHolder;configApi;apis;icons;plugins;featureFlags;components;themes;configLoader;defaultApis;bindRoutes;appLanguageApi;translationResources;appIdentityProxy=new At;apiFactoryRegistry;constructor(e){this.apis=e.apis??[],this.icons=e.icons,this.plugins=new Set(e.plugins??[]),this.featureFlags=e.featureFlags??[],this.components=e.components,this.themes=e.themes,this.configLoader=e.configLoader??Rt,this.defaultApis=e.defaultApis??[],this.bindRoutes=e.bindRoutes,this.apiFactoryRegistry=new f,this.appLanguageApi=Lt.createWithStorage({defaultLanguage:e.__experimentalTranslations?.defaultLanguage,availableLanguages:e.__experimentalTranslations?.availableLanguages}),this.translationResources=e.__experimentalTranslations?.resources??[]}getPlugins(){return Array.from(this.plugins)}getSystemIcon(e){return this.icons[e]}getSystemIcons(){return this.icons}getComponents(){return this.components}createRoot(e){const t=this.getProvider();return()=>(0,n.jsx)(t,{children:e})}#w=!1;getProvider(){if(this.#w)throw new Error("app.getProvider() or app.createRoot() has already been called, and can only be called once");this.#w=!0;const e=new Hr(this);let t,r;return({children:s})=>{const i=(0,o.useRef)(!0),a=(0,o.useMemo)(()=>fe.createWithStorage(this.themes),[]),{routing:c,featureFlags:u}=(0,o.useMemo)(()=>{const e=Be();e&&console.warn("\nDEPRECATION WARNING: React Router Beta is deprecated and support for it will be removed in a future release.\n Please migrate to use React Router v6 stable.\n See https://backstage.io/docs/tutorials/react-router-stable-migration\n");const t=function(e){const t={};for(const r in e.collectors)e.collectors.hasOwnProperty(r)&&(t[r]=e.collectors[r]());const r=[{node:o.Children.toArray(e.root),parent:void 0,contexts:{}}];for(;0!==r.length;){const{node:n,parent:s,contexts:i}=r.shift();o.Children.forEach(n,n=>{if(!(0,o.isValidElement)(n))return;const a={};for(const e in t)if(t.hasOwnProperty(e)){const r=t[e];a[e]=r.visit(r.accumulator,n,s,i[e])}for(const t of e.discoverers){const e=t(n);e&&r.push({node:e,parent:n,contexts:a})}})}return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,t.accumulator]))}({root:s,discoverers:[Qe,Ze],collectors:{routing:e?at:it,collectedPlugins:et,featureFlags:ct}});return t.collectedPlugins.forEach(e=>this.plugins.add(e)),this.verifyPlugins(this.plugins),this.getApiHolder(),t},[s]),p=function(e,t,r){const o=Boolean(e),s=(0,Je.A)(e||(()=>Promise.resolve([])));let i;if(o&&s.loading){const{Progress:e}=t;i=(0,n.jsx)(e,{})}else if(s.error){const{BootErrorPage:e}=t;i=(0,n.jsx)(e,{step:"load-config",error:s.error})}const{ThemeProvider:a=kt}=t;return i?{node:(0,n.jsx)(l,{apis:Et.with(k.appThemeApiRef,r),children:(0,n.jsx)(a,{children:i})})}:{api:Ae.fromConfigs(s.value?.length?function(e){const t=Ae.fromConfigs(e),r=t.getOptionalString("app.baseUrl"),n=t.getOptionalString("backend.baseUrl");let o,s,i=e;if(r&&n&&new URL(r).origin===new URL(n).origin){const e=Kr(n);n!==e&&(o=e)}if(r){const e=Kr(r);r!==e&&(s=e)}return(s||o)&&(i=i.concat({data:{app:s&&{baseUrl:s},backend:o&&{baseUrl:o}},context:"relative-resolver"})),i}(s.value):[])}}(this.configLoader,this.components,a),h="api"in p;if(h){const{api:e}=p;this.configApi=e}if("node"in p)return p.node;if(r)throw r;if(!t)try{t=function(e,t,r){const n=function(e){const t=new Map,r=new Map;for(const n of e){for(const[e,r]of Object.entries(n.routes??{})){const o=`${n.getId()}.${e}`;if(t.has(o))throw new Error(`Unexpected duplicate route '${o}'`);t.set(o,r)}for(const[e,t]of Object.entries(n.externalRoutes??{})){const o=`${n.getId()}.${e}`;if(r.has(o))throw new Error(`Unexpected duplicate external route '${o}'`);r.set(o,t)}}return{routes:t,externalRoutes:r}}(r),o=new Map,s=new Set;e&&e({bind:(e,t)=>{for(const[r,n]of Object.entries(t)){const t=e[r];if(!t)throw new Error(`Key ${r} is not an existing external route`);if(!n&&!t.optional)throw new Error(`External route ${r} is required but was ${!1===n?"disabled":"not provided"}`);n?o.set(t,n):!1===n&&s.add(t)}}});const i=t.getOptionalConfig("app.routes.bindings")?.get();if(i)for(const[e,t]of Object.entries(i)){if(!Pt(t))throw new Error(`Invalid config at app.routes.bindings['${e}'], value must be a non-empty string or false`);const r=n.externalRoutes.get(e);if(!r)throw new Error(`Invalid config at app.routes.bindings, '${e}' is not a valid external route`);if(!o.has(r)&&!s.has(r))if(!1===t)s.add(r);else{const s=n.routes.get(t);if(!s)throw new Error(`Invalid config at app.routes.bindings['${e}'], '${t}' is not a valid route`);o.set(r,s)}}for(const e of n.externalRoutes.values())if(!o.has(e)&&!s.has(e)){const t="getDefaultTarget"in e?e.getDefaultTarget():void 0;if(t){const r=n.routes.get(t);r&&o.set(e,r)}}return o}(this.bindRoutes,p.api,this.plugins),function(e,t){const r=new Set(t.values());r.delete(void 0);for(const n of t.keys()){if(r.has(n))continue;let o=n,s="";for(;o;){const r=e.get(o);if(void 0===r)throw new Error(`No path for ${o}`);s=ht(r,s),o=t.get(o)}const i=s.match(/:(\w+)/g);if(i)for(let e=0;e<i.length;e++)for(let t=e+1;t<i.length;t++)if(i[t]===i[e])throw new Error(`Parameter ${i[t]} is duplicated in path ${s}`)}}(c.paths,c.parents),function(e,t){for(const r of t)if(r.externalRoutes)for(const[t,n]of Object.entries(r.externalRoutes))if(!n.optional&&!e.has(n))throw new Error(`External route '${t}' of the '${r.getId()}' plugin must be bound to a target route. See https://backstage.io/link?bind-routes for details.`)}(t,this.plugins)}catch(e){throw r=e,e}if(h&&i.current){i.current=!1;const e=this.getApiHolder().get(k.featureFlagsApiRef);if(e){for(const t of this.featureFlags)e.registerFlag({...t,pluginId:""});for(const t of this.plugins.values())if("getFeatureFlags"in t)for(const r of t.getFeatureFlags())e.registerFlag({name:r.name,pluginId:t.getId()});else for(const r of t.output())"feature-flag"===r.type&&e.registerFlag({name:r.name,pluginId:t.getId()});const t=e.getRegisteredFlags(),r=new Set(t.map(e=>e.name));for(const t of u)r.has(t)||e.registerFlag({name:t,pluginId:""})}}const{ThemeProvider:f=kt,Progress:g}=this.components,d=this.getApiHolder();if(function(){const e=document.querySelector('meta[name="backstage-app-mode"]');return"protected"===(e?.getAttribute("content")??"public")}()){const e=d.get(k.errorApiRef),t=d.get(k.fetchApiRef),r=d.get(k.discoveryApiRef);if(!e||!t||!r)throw new Error("App is running in protected mode but missing required APIs");this.appIdentityProxy.enableCookieAuth({errorApi:e,fetchApi:t,discoveryApi:r})}return(0,n.jsx)(l,{apis:d,children:(0,n.jsx)(wt,{appContext:e,children:(0,n.jsx)(f,{children:(0,n.jsx)(yt,{routePaths:c.paths,routeParents:c.parents,routeObjects:c.objects,routeBindings:t,basePath:(v=p.api,Be()?He(v):""),children:(0,n.jsx)(qe.Provider,{value:{routeObjects:c.objects,appIdentityProxy:this.appIdentityProxy},children:(0,n.jsx)(o.Suspense,{fallback:(0,n.jsx)(g,{}),children:s})})})})})});var v}}getRouter(){return Ge}getApiHolder(){if(this.apiHolder){for(const e of this.plugins)for(const t of e.getApis())this.apiFactoryRegistry.get(t.api)||this.apiFactoryRegistry.register("default",t);return p.validateFactories(this.apiFactoryRegistry,this.apiFactoryRegistry.getAllApis()),this.apiHolder}this.apiFactoryRegistry.register("static",{api:k.appThemeApiRef,deps:{},factory:()=>fe.createWithStorage(this.themes)}),this.apiFactoryRegistry.register("static",{api:k.configApiRef,deps:{},factory:()=>{if(!this.configApi)throw new Error("Tried to access config API before config was loaded");return this.configApi}}),this.apiFactoryRegistry.register("static",{api:k.identityApiRef,deps:{},factory:()=>this.appIdentityProxy}),this.apiFactoryRegistry.register("static",{api:We,deps:{},factory:()=>this.appLanguageApi}),this.apiFactoryRegistry.register("default",{api:Ye.J,deps:{languageApi:We},factory:({languageApi:e})=>Vr.create({languageApi:e,resources:this.translationResources})}),this.apiFactoryRegistry.register("default",{api:k.featureFlagsApiRef,deps:{},factory:()=>new Ie});for(const e of this.defaultApis)this.apiFactoryRegistry.register("default",e);for(const e of this.plugins)for(const t of e.getApis())if(!this.apiFactoryRegistry.register("default",t))throw new Error(`Plugin ${e.getId()} tried to register duplicate or forbidden API factory for ${t.api}`);for(const e of this.apis)if(!this.apiFactoryRegistry.register("app",e))throw new Error(`Duplicate or forbidden API factory for ${e.api} in app`);return p.validateFactories(this.apiFactoryRegistry,this.apiFactoryRegistry.getAllApis()),this.apiHolder=new p(this.apiFactoryRegistry),this.apiHolder}verifyPlugins(e){const t=new Set;for(const r of e){const e=r.getId();if(t.has(e))throw new Error(`Duplicate plugin found '${e}'`);t.add(e)}}}function Gr(e){return new zr(e)}let Jr=!1;const Wr=e=>{const t=(0,k.useApp)(),{NotFoundErrorPage:r}=t.getComponents(),s=(0,o.useMemo)(()=>Be(),[]),i=[...(0,k.useElementFilter)(e.children,e=>e.getElements().flatMap(e=>{let t=e.props.path;if(""===t)return[];t=t?.replace(/\/\*$/,"")??"/";let r=s?e:e.props.element;return s||r||(r=e,Jr||(console.warn("DEPRECATION WARNING: All elements within <FlatRoutes> must be of type <Route> with an element prop. Existing usages of <Navigate key=[path] to=[to] /> should be replaced with <Route path=[path] element={<Navigate to=[to] />} />."),Jr=!0)),[{path:t,element:r,children:e.props.children?[{path:"/"===t?"/":"*",element:e.props.children}]:void 0}]}).sort((e,t)=>t.path.localeCompare(e.path)).map(e=>({...e,path:"/"===e.path?"/":`${e.path}/*`}))),{path:"*",element:(0,n.jsx)(r,{})}];return(0,_e.useRoutes)(i)};(0,k.attachComponentData)(Wr,"core.type","FlatRoutes")},46155:(e,t,r)=>{var n=r(57073),o=r(47170),s=r(3334);e.exports=function(e,t){var r={};return t=s(t,3),o(e,function(e,o,s){n(r,o,t(e,o,s))}),r}},39907:e=>{var t,r,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var a,c=[],u=!1,l=-1;function p(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&h())}function h(){if(!u){var e=i(p);u=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function g(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new f(e,t)),1!==c.length||u||i(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},96403:(e,t,r)=>{e.exports=r(84834).Observable},84834:(e,t)=>{"use strict";t.Observable=void 0;const r=e=>Boolean(Symbol[e]),n=e=>r(e)?Symbol[e]:"@@"+e,o=n("iterator"),s=n("observable"),i=n("species");function a(e,t){let r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function c(e){let t=e.constructor;return void 0!==t&&(t=t[i],null===t&&(t=void 0)),void 0!==t?t:v}function u(e){u.log?u.log(e):setTimeout(()=>{throw e})}function l(e){Promise.resolve().then(()=>{try{e()}catch(e){u(e)}})}function p(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=a(t,"unsubscribe");e&&e.call(t)}}catch(e){u(e)}}function h(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function f(e,t,r){e._state="running";let n=e._observer;try{let o=a(n,t);switch(t){case"next":o&&o.call(n,r);break;case"error":if(h(e),!o)throw r;o.call(n,r);break;case"complete":h(e),o&&o.call(n)}}catch(e){u(e)}"closed"===e._state?p(e):"running"===e._state&&(e._state="ready")}function g(e,t,r){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:r}],void l(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let r=0;r<t.length&&(f(e,t[r].type,t[r].value),"closed"!==e._state);++r);}}(e))):void f(e,t,r);e._queue.push({type:t,value:r})}}class d{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let r=this,n={get closed(){return"closed"===r._state},next(e){g(r,"next",e)},error(e){g(r,"error",e)},complete(){g(r,"complete")}};try{this._cleanup=t.call(void 0,n)}catch(e){n.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(h(this),p(this))}}class v{constructor(e){if(!(this instanceof v))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new d(e,this._subscriber)}forEach(e){return new Promise((t,r)=>{if("function"!=typeof e)return void r(new TypeError(e+" is not a function"));function n(){o.unsubscribe(),t()}let o=this.subscribe({next(t){try{e(t,n)}catch(e){r(e),o.unsubscribe()}},error:r,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(c(this))(t=>this.subscribe({next(r){try{r=e(r)}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(c(this))(t=>this.subscribe({next(r){try{if(!e(r))return}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=c(this),r=arguments.length>1,n=!1,o=arguments[1];return new t(t=>this.subscribe({next(s){let i=!n;if(n=!0,!i||r)try{o=e(o,s)}catch(e){return t.error(e)}else o=s},error(e){t.error(e)},complete(){if(!n&&!r)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(o),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=c(this);return new t(r=>{let n,o=0;return function s(i){n=i.subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){o===e.length?(n=void 0,r.complete()):s(t.from(e[o++]))}})}(this),()=>{n&&(n.unsubscribe(),n=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=c(this);return new t(r=>{let n=[],o=this.subscribe({next(o){if(e)try{o=e(o)}catch(e){return r.error(e)}let i=t.from(o).subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){let e=n.indexOf(i);e>=0&&n.splice(e,1),s()}});n.push(i)},error(e){r.error(e)},complete(){s()}});function s(){o.closed&&0===n.length&&r.complete()}return()=>{n.forEach(e=>e.unsubscribe()),o.unsubscribe()}})}[s](){return this}static from(e){let t="function"==typeof this?this:v;if(null==e)throw new TypeError(e+" is not an object");let n=a(e,s);if(n){let r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return function(e){return e instanceof v}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(r("iterator")&&(n=a(e,o),n))return new t(t=>{l(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{l(()=>{if(!t.closed){for(let r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:v)(t=>{l(()=>{if(!t.closed){for(let r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})})}static get[i](){return this}}t.Observable=v,Object.defineProperty(v,Symbol("extensions"),{value:{symbol:s,hostReportError:u},configurable:!0})}}]);
|
|
2
|
-
//# sourceMappingURL=4864.
|
|
1
|
+
(self.webpackChunkveecode_platform_plugin_veecode_homepage=self.webpackChunkveecode_platform_plugin_veecode_homepage||[]).push([[4864],{14864:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AlertApiForwarder:()=>ue,ApiFactoryRegistry:()=>f,ApiProvider:()=>l,ApiResolver:()=>p,AppRouter:()=>Ge,AppThemeSelector:()=>fe,AtlassianAuth:()=>oe,BitbucketAuth:()=>ee,BitbucketServerAuth:()=>re,ConfigReader:()=>Ae,ErrorAlerter:()=>Re,ErrorApiForwarder:()=>je,FeatureFlagged:()=>tt,FetchMiddlewares:()=>Fe,FlatRoutes:()=>Wr,FrontendHostDiscovery:()=>Oe,GithubAuth:()=>I,GitlabAuth:()=>L,GoogleAuth:()=>F,LocalStorageFeatureFlags:()=>Ie,MicrosoftAuth:()=>J,MultipleAnalyticsApi:()=>le,NoOpAnalyticsApi:()=>pe,OAuth2:()=>E,OAuthRequestManager:()=>De,OktaAuth:()=>M,OneLoginAuth:()=>Q,OpenShiftAuth:()=>ce,SamlAuth:()=>z,UnhandledErrorForwarder:()=>Ee,UrlPatternDiscovery:()=>ke,VMwareCloudAuth:()=>ie,WebStorage:()=>Me,createFetchApi:()=>Ce,createSpecializedApp:()=>Gr,defaultConfigLoader:()=>Rt,openLoginPopup:()=>g});var n=r(31085),o=r(95478),s=r(39067),i=r.n(s);class a{holders;constructor(...e){this.holders=e}get(e){for(const t of this.holders){const r=t.get(e);if(r)return r}}}var c=r(64218);const u=(0,c.createVersionedContext)("api-context"),l=e=>{const{apis:t,children:r}=e,s=(0,o.useContext)(u)?.atVersion(1),i=s?new a(t,s):t;return(0,n.jsx)(u.Provider,{value:(0,c.createVersionedValueMap)({1:i}),children:r})};l.propTypes={apis:i().shape({get:i().func.isRequired}).isRequired,children:i().node};class p{constructor(e){this.factories=e}static validateFactories(e,t){for(const r of t){const t=[r],n=new Set;for(;t.length;){const o=t.shift(),s=e.get(o);if(s)for(const e of Object.values(s.deps)){if(e.id===r.id)throw new Error(`Circular dependency of api factory for ${r}`);n.has(e)||(n.add(e),t.push(e))}}}}apis=new Map;get(e){return this.load(e)}load(e,t=[]){const r=this.apis.get(e.id);if(r)return r;const n=this.factories.get(e);if(!n)return;if(t.includes(n.api))throw new Error(`Circular dependency of api factory for ${n.api}`);const o=this.loadDeps(e,n.deps,[...t,n.api]),s=n.factory(o);return this.apis.set(e.id,s),s}loadDeps(e,t,r){const n={};for(const o in t)if(t.hasOwnProperty(o)){const s=t[o],i=this.load(s,r);if(!i)throw new Error(`No API factory available for dependency ${s} of dependent ${e}`);n[o]=i}return n}}var h=(e=>(e[e.default=10]="default",e[e.app=50]="app",e[e.static=100]="static",e))(h||{});class f{factories=new Map;register(e,t){const r=h[e],n=this.factories.get(t.api.id);return!(n&&n.priority>=r||(this.factories.set(t.api.id,{priority:r,factory:t}),0))}get(e){const t=this.factories.get(e.id);if(t)return t.factory}getAllApis(){const e=new Set;for(const{factory:t}of this.factories.values())e.add(t.api);return e}}function g(e){return new Promise((t,r)=>{const n=e.width||500,o=e.height||700,s=window.screen.width/2-n/2,i=window.screen.height/2-o/2,a=new URL(e.url).origin,c=window.open(e.url,e.name,`menubar=no,location=no,resizable=no,scrollbars=no,status=no,width=${n},height=${o},top=${i},left=${s}`);let u="";if(!c||void 0===c.closed||c.closed){const e=new Error("Failed to open auth popup.");return e.name="PopupRejectedError",void r(e)}const l=e=>{if(e.source!==c)return;if(e.origin!==a)return;const{data:n}=e;if("config_info"===n.type)return void(u=n.targetOrigin);if("authorization_response"!==n.type)return;const o=n;if("error"in o){const e=new Error(o.error.message);e.name=o.error.name,r(e)}else t(o.response);h()},p=setInterval(()=>{if(c.closed){const e="Login failed, "+(u&&u!==window.location.origin?`Incorrect app origin, expected ${u}`:"popup was closed"),t=new Error(e);t.name="PopupClosedError",r(t),h()}},100);function h(){window.removeEventListener("message",l),clearInterval(p)}window.addEventListener("message",l)})}let d=!1;function v(e){return[...e].join(" ")}class y{discoveryApi;environment;provider;joinScopesFunc;authRequester;sessionTransform;enableExperimentalRedirectFlow;popupOptions;constructor(e){const{configApi:t,discoveryApi:r,environment:n,provider:o,joinScopes:s=v,oauthRequestApi:i,sessionTransform:a=e=>e,popupOptions:c}=e;d||t||(console.warn("DEPRECATION WARNING: Authentication providers require a configApi instance to configure the authentication flow. Please provide one to the authentication provider constructor."),d=!0),this.enableExperimentalRedirectFlow=!!t&&(t.getOptionalBoolean("enableExperimentalRedirectFlow")??!1),this.authRequester=i.createAuthRequester({provider:o,onAuthRequest:async e=>this.enableExperimentalRedirectFlow?this.executeRedirect(e):this.showPopup(e)}),this.discoveryApi=r,this.environment=n,this.provider=o,this.joinScopesFunc=s,this.sessionTransform=a,this.popupOptions=c}async createSession(e){return e.instantPopup?this.enableExperimentalRedirectFlow?this.executeRedirect(e.scopes):this.showPopup(e.scopes):this.authRequester(e.scopes)}async refreshSession(e){const t=await fetch(await this.buildUrl("/refresh",{optional:!0,...e&&{scope:this.joinScopesFunc(e.scopes)}}),{headers:{"x-requested-with":"XMLHttpRequest"},credentials:"include"}).catch(e=>{throw new Error(`Auth refresh request failed, ${e}`)});if(!t.ok){const e=new Error(`Auth refresh request failed, ${t.statusText}`);throw e.status=t.status,e}const r=await t.json();if(r.error){const e=new Error(r.error.message);throw r.error.name&&(e.name=r.error.name),e}return await this.sessionTransform(r)}async removeSession(){const e=await fetch(await this.buildUrl("/logout"),{method:"POST",headers:{"x-requested-with":"XMLHttpRequest"},credentials:"include"}).catch(e=>{throw new Error(`Logout request failed, ${e}`)});if(!e.ok){const t=new Error(`Logout request failed, ${e.statusText}`);throw t.status=e.status,t}}async showPopup(e){const t=this.joinScopesFunc(e),r=await this.buildUrl("/start",{scope:t,origin:window.location.origin,flow:"popup"}),n=this.popupOptions?.size?.fullscreen?window.screen.width:this.popupOptions?.size?.width||450,o=this.popupOptions?.size?.fullscreen?window.screen.height:this.popupOptions?.size?.height||730,s=await g({url:r,name:`${this.provider.title} Login`,width:n,height:o});return await this.sessionTransform(s)}async executeRedirect(e){const t=this.joinScopesFunc(e);return window.location.href=await this.buildUrl("/start",{scope:t,origin:window.location.origin,redirectUrl:window.location.href,flow:"redirect"}),new Promise(()=>{})}async buildUrl(e,t){const r=await this.discoveryApi.getBaseUrl("auth"),n=this.buildQueryString({...t,env:this.environment});return`${r}/${this.provider.id}${e}${n}`}buildQueryString(e){if(!e)return"";const t=Object.entries(e).map(([e,t])=>"string"==typeof t?`${encodeURIComponent(e)}=${encodeURIComponent(t)}`:t?encodeURIComponent(e):void 0).filter(Boolean).join("&");return t?`?${t}`:""}}function m(e,t){for(const r of t)if(!e.has(r))return!1;return!0}class w{constructor(e){this.options=e}sessionExistsAndHasScope(e,t){return!!e&&(!t||(void 0===this.options.sessionScopes||m(this.options.sessionScopes(e),t)))}getExtendedScope(e,t){const r=new Set(this.options.defaultScopes);if(e&&void 0!==this.options.sessionScopes){const t=this.options.sessionScopes(e);for(const e of t)r.add(e)}if(t)for(const e of t)r.add(e);return r}}var b=r(96403),S=r.n(b);class A{isClosed=!1;terminatingError;observable=new(S())(e=>this.isClosed?(this.terminatingError?e.error(this.terminatingError):e.complete(),()=>{}):(this.subscribers.add(e),()=>{this.subscribers.delete(e)}));subscribers=new Set;[Symbol.observable](){return this}get closed(){return this.isClosed}next(e){if(this.isClosed)throw new Error("PublishSubject is closed");this.subscribers.forEach(t=>t.next(e))}error(e){if(this.isClosed)throw new Error("PublishSubject is closed");this.isClosed=!0,this.terminatingError=e,this.subscribers.forEach(t=>t.error(e))}complete(){if(this.isClosed)throw new Error("PublishSubject is closed");this.isClosed=!0,this.subscribers.forEach(e=>e.complete())}subscribe(e,t,r){const n="function"==typeof e?{next:e,error:t,complete:r}:e;return this.observable.subscribe(n)}}class x{isClosed;currentValue;terminatingError;observable;constructor(e){this.isClosed=!1,this.currentValue=e,this.terminatingError=void 0,this.observable=new(S())(e=>this.isClosed?(this.terminatingError?e.error(this.terminatingError):e.complete(),()=>{}):(e.next(this.currentValue),this.subscribers.add(e),()=>{this.subscribers.delete(e)}))}subscribers=new Set;[Symbol.observable](){return this}get closed(){return this.isClosed}next(e){if(this.isClosed)throw new Error("BehaviorSubject is closed");this.currentValue=e,this.subscribers.forEach(t=>t.next(e))}error(e){if(this.isClosed)throw new Error("BehaviorSubject is closed");this.isClosed=!0,this.terminatingError=e,this.subscribers.forEach(t=>t.error(e))}complete(){if(this.isClosed)throw new Error("BehaviorSubject is closed");this.isClosed=!0,this.subscribers.forEach(e=>e.complete())}subscribe(e,t,r){const n="function"==typeof e?{next:e,error:t,complete:r}:e;return this.observable.subscribe(n)}}var k=r(9490);class O{subject=new x(k.SessionState.SignedOut);signedIn=!1;setIsSignedIn(e){this.signedIn!==e&&(this.signedIn=e,this.subject.next(this.signedIn?k.SessionState.SignedIn:k.SessionState.SignedOut))}sessionState$(){return this.subject}}class R{connector;helper;sessionScopesFunc;sessionShouldRefreshFunc;stateTracker=new O;refreshPromise;currentSession;constructor(e){const{connector:t,defaultScopes:r=new Set,sessionScopes:n,sessionShouldRefresh:o}=e;this.connector=t,this.sessionScopesFunc=n,this.sessionShouldRefreshFunc=o,this.helper=new w({sessionScopes:n,defaultScopes:r})}async getSession(e){let t=!1;if(this.helper.sessionExistsAndHasScope(this.currentSession,e.scopes)){if(!this.sessionShouldRefreshFunc(this.currentSession))return this.currentSession;t=!0;try{const t=await this.collapsedSessionRefresh(e.scopes),r=this.sessionScopesFunc(this.currentSession);return m(this.sessionScopesFunc(t),r)&&(this.currentSession=t),t}catch(t){if(this.removeLocalSession(),e.optional)return}}if(!t)try{const t=await this.collapsedSessionRefresh(e.scopes);return this.currentSession=t,this.getSession(e)}catch{this.removeLocalSession()}if(!e.optional)return this.currentSession=await this.connector.createSession({...e,scopes:this.helper.getExtendedScope(this.currentSession,e.scopes)}),this.stateTracker.setIsSignedIn(!0),this.currentSession}removeLocalSession(){this.currentSession=void 0,this.stateTracker.setIsSignedIn(!1)}async removeSession(){this.currentSession=void 0,await this.connector.removeSession(),this.stateTracker.setIsSignedIn(!1)}sessionState$(){return this.stateTracker.sessionState$()}async collapsedSessionRefresh(e){if(this.refreshPromise)return this.refreshPromise;this.refreshPromise=this.connector.refreshSession({scopes:this.helper.getExtendedScope(this.currentSession,e)});try{const t=await this.refreshPromise;if(!this.helper.sessionExistsAndHasScope(t,e))throw new Error("Refreshed session did not receive the required scopes");return this.stateTracker.setIsSignedIn(!0),t}finally{delete this.refreshPromise}}}const j={id:"oauth2",title:"Your Identity Provider",icon:()=>null};class E{static createAuthConnector(e){if("authConnector"in e)return e.authConnector;const{scopeTransform:t=e=>e,configApi:r,discoveryApi:n,environment:o="development",provider:s=j,oauthRequestApi:i,popupOptions:a}=e;return new y({configApi:r,discoveryApi:n,environment:o,provider:s,oauthRequestApi:i,sessionTransform({backstageIdentity:e,...r}){const n={...r,providerInfo:{idToken:r.providerInfo.idToken,accessToken:r.providerInfo.accessToken,scopes:E.normalizeScopes(r.providerInfo.scope,{scopeTransform:t}),expiresAt:r.providerInfo.expiresInSeconds?new Date(Date.now()+1e3*r.providerInfo.expiresInSeconds):void 0}};return e&&(n.backstageIdentity={token:e.token,identity:e.identity,expiresAt:e.expiresInSeconds?new Date(Date.now()+1e3*e.expiresInSeconds):void 0}),n},popupOptions:a})}static create(e){const{defaultScopes:t=[],scopeTransform:r=e=>e}=e,n=E.createAuthConnector(e),o=new R({connector:n,defaultScopes:new Set(t),sessionScopes:e=>e.providerInfo.scopes,sessionShouldRefresh:e=>{let t=1/0;return e.providerInfo?.expiresAt&&(t=Math.min(t,(e.providerInfo.expiresAt.getTime()-Date.now())/1e3)),e.backstageIdentity?.expiresAt&&(t=Math.min(t,(e.backstageIdentity.expiresAt.getTime()-Date.now())/1e3)),t<180}});return new E({sessionManager:o,scopeTransform:r})}sessionManager;scopeTransform;constructor(e){this.sessionManager=e.sessionManager,this.scopeTransform=e.scopeTransform}async signIn(){await this.getAccessToken()}async signOut(){await this.sessionManager.removeSession()}sessionState$(){return this.sessionManager.sessionState$()}async getAccessToken(e,t){const r=E.normalizeScopes(e,{scopeTransform:this.scopeTransform}),n=await this.sessionManager.getSession({...t,scopes:r});return n?.providerInfo.accessToken??""}async getIdToken(e={}){const t=await this.sessionManager.getSession({...e,scopes:new Set(["openid"])});return t?.providerInfo.idToken??""}async getBackstageIdentity(e={}){const t=await this.sessionManager.getSession(e);return t?.backstageIdentity}async getProfile(e={}){const t=await this.sessionManager.getSession(e);return t?.profile}static normalizeScopes(e,t){if(!e)return new Set;const r=Array.isArray(e)?e:e.split(/[\s|,]/).filter(Boolean),n=t?t.scopeTransform(r):r;return new Set(n)}}const P={id:"github",title:"GitHub",icon:()=>null};class I{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=P,oauthRequestApi:s,defaultScopes:i=["read:user"]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n,defaultScopes:i})}}const C={id:"gitlab",title:"GitLab",icon:()=>null};class L{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=C,oauthRequestApi:s,defaultScopes:i=["read_user"]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n,defaultScopes:i})}}const $={id:"google",title:"Google",icon:()=>null},T="https://www.googleapis.com/auth/";class F{static create(e){const{configApi:t,discoveryApi:r,oauthRequestApi:n,environment:o="development",provider:s=$,defaultScopes:i=["openid",`${T}userinfo.email`,`${T}userinfo.profile`]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:n,provider:s,environment:o,defaultScopes:i,scopeTransform:e=>e.map(e=>"openid"===e?e:"profile"===e||"email"===e?`${T}userinfo.${e}`:e.startsWith(T)?e:`${T}${e}`)})}}const N={id:"okta",title:"Okta",icon:()=>null},D=new Set(["openid","profile","email","phone","address","groups","offline_access"]),U="okta.";class M{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=N,oauthRequestApi:s,defaultScopes:i=["openid","email","profile","offline_access"]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n,defaultScopes:i,scopeTransform:e=>e.map(e=>D.has(e)||e.startsWith(U)?e:`${U}${e}`)})}}class q{discoveryApi;environment;provider;constructor(e){const{discoveryApi:t,environment:r,provider:n}=e;this.discoveryApi=t,this.environment=r,this.provider=n}async createSession(){const e=await this.buildUrl("/start"),t=await g({url:e,name:`${this.provider.title} Login`,width:450,height:730});return{...t,id:t.profile.email}}async refreshSession(){}async removeSession(){const e=await fetch(await this.buildUrl("/logout"),{method:"POST",headers:{"x-requested-with":"XMLHttpRequest"},credentials:"include"}).catch(e=>{throw new Error(`Logout request failed, ${e}`)});if(!e.ok){const t=new Error(`Logout request failed, ${e.statusText}`);throw t.status=e.status,t}}async buildUrl(e){return`${await this.discoveryApi.getBaseUrl("auth")}/${this.provider.id}${e}?env=${this.environment}`}}class _{connector;helper;stateTracker=new O;currentSession;constructor(e){const{connector:t,defaultScopes:r=new Set,sessionScopes:n}=e;this.connector=t,this.helper=new w({sessionScopes:n,defaultScopes:r})}setSession(e){this.currentSession=e,this.stateTracker.setIsSignedIn(Boolean(e))}async getSession(e){return this.helper.sessionExistsAndHasScope(this.currentSession,e.scopes)?this.currentSession:e.optional?void 0:(this.currentSession=await this.connector.createSession({...e,scopes:this.helper.getExtendedScope(this.currentSession,e.scopes)}),this.stateTracker.setIsSignedIn(!0),this.currentSession)}async removeSession(){this.currentSession=void 0,this.stateTracker.setIsSignedIn(!1)}sessionState$(){return this.stateTracker.sessionState$()}}class B{manager;storageKey;schema;sessionShouldRefreshFunc;helper;constructor(e){const{manager:t,storageKey:r,schema:n,sessionScopes:o,sessionShouldRefresh:s=()=>!1}=e;this.manager=t,this.storageKey=r,this.schema=n,this.sessionShouldRefreshFunc=s,this.helper=new w({sessionScopes:o,defaultScopes:new Set})}setSession(e){this.manager.setSession(e),this.saveSession(e)}async getSession(e){const{scopes:t}=e,r=this.loadSession();if(this.helper.sessionExistsAndHasScope(r,t)&&!this.sessionShouldRefreshFunc(r))return this.manager.setSession(r),r;const n=await this.manager.getSession(e);return this.saveSession(n),n}async removeSession(){localStorage.removeItem(this.storageKey),await this.manager.removeSession()}sessionState$(){return this.manager.sessionState$()}loadSession(){try{const e=localStorage.getItem(this.storageKey);if(e){const t=JSON.parse(e,(e,t)=>"Set"===t?.__type?new Set(t.__value):t);try{return this.schema.parse(t)}catch(e){throw console.log(`Failed to load session from local storage because it did not conform to the expected schema, ${e}`),e}}return}catch(e){return void localStorage.removeItem(this.storageKey)}}saveSession(e){if(void 0!==e){try{this.schema.parse(e)}catch(e){return void console.warn(`Failed to save session to local storage because it did not conform to the expected schema, ${e}`)}localStorage.setItem(this.storageKey,JSON.stringify(e,(e,t)=>t instanceof Set?{__type:"Set",__value:Array.from(t)}:t))}else localStorage.removeItem(this.storageKey)}}var V=r(53215);const K=V.Ik({profile:V.Ik({email:V.Yj().optional(),displayName:V.Yj().optional(),picture:V.Yj().optional()}),backstageIdentity:V.Ik({token:V.Yj(),identity:V.Ik({type:V.eu("user"),userEntityRef:V.Yj(),ownershipEntityRefs:V.YO(V.Yj())})})}),H={id:"saml",title:"SAML",icon:()=>null};class z{constructor(e){this.sessionManager=e}static create(e){const{discoveryApi:t,environment:r="development",provider:n=H}=e,o=new q({discoveryApi:t,environment:r,provider:n}),s=new _({connector:o}),i=new B({manager:s,storageKey:`${n.id}Session`,schema:K});return new z(i)}sessionState$(){return this.sessionManager.sessionState$()}async signIn(){await this.getBackstageIdentity({})}async signOut(){await this.sessionManager.removeSession()}async getBackstageIdentity(e={}){const t=await this.sessionManager.getSession(e);return t?.backstageIdentity}async getProfile(e={}){const t=await this.sessionManager.getSession(e);return t?.profile}}const G={id:"microsoft",title:"Microsoft",icon:()=>null};class J{oauth2;configApi;environment;provider;oauthRequestApi;discoveryApi;scopeTransform;static MicrosoftGraphID="00000003-0000-0000-c000-000000000000";static create(e){return new J(e)}constructor(e){const{configApi:t,environment:r="development",provider:n=G,oauthRequestApi:o,discoveryApi:s,defaultScopes:i=["openid","offline_access","profile","email","User.Read"],scopeTransform:a=e=>e.concat("offline_access")}=e;this.configApi=t,this.environment=r,this.provider=n,this.oauthRequestApi=o,this.discoveryApi=s,this.scopeTransform=a,this.oauth2={[J.MicrosoftGraphID]:E.create({configApi:this.configApi,discoveryApi:this.discoveryApi,oauthRequestApi:this.oauthRequestApi,provider:this.provider,environment:this.environment,scopeTransform:this.scopeTransform,defaultScopes:i})}}microsoftGraph(){return this.oauth2[J.MicrosoftGraphID]}static resourceForScopes(e){const t=[...new Set(e.split(" ").map(J.resourceForScope).filter(e=>"openid"!==e))];if(t.length>1)return Promise.reject(new Error(`Requested access token with scopes from multiple Azure resources: ${t.join(", ")}. Access tokens can only have a single audience.`));const r=t[0]??J.MicrosoftGraphID;return Promise.resolve(r)}static resourceForScope(e){const t=e.match(/^(?<resourceURI>.*)\/(?<scp>[^\/]*)$/)?.groups;if(t){const{resourceURI:e}=t;return e.replace(/^api:\/\//,"")}switch(e){case"email":case"openid":case"offline_access":case"profile":return"openid";default:return J.MicrosoftGraphID}}async getAccessToken(e,t){const r=void 0===e?J.MicrosoftGraphID:await J.resourceForScopes(Array.isArray(e)?e.join(" "):e);return r in this.oauth2||(this.oauth2[r]=E.create({configApi:this.configApi,discoveryApi:this.discoveryApi,oauthRequestApi:this.oauthRequestApi,provider:this.provider,environment:this.environment,scopeTransform:this.scopeTransform})),this.oauth2[r].getAccessToken(e,t)}getIdToken(e){return this.microsoftGraph().getIdToken(e)}getProfile(e){return this.microsoftGraph().getProfile(e)}getBackstageIdentity(e){return this.microsoftGraph().getBackstageIdentity(e)}signIn(){return this.microsoftGraph().signIn()}signOut(){return this.microsoftGraph().signOut()}sessionState$(){return this.microsoftGraph().sessionState$()}}const W={id:"onelogin",title:"onelogin",icon:()=>null},Y=new Set(["openid","profile","email","phone","address","groups","offline_access"]),X="onelogin.";class Q{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=W,oauthRequestApi:s}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n,defaultScopes:["openid","email","profile","offline_access"],scopeTransform:e=>e.map(e=>Y.has(e)||e.startsWith(X)?e:`${X}${e}`)})}}const Z={id:"bitbucket",title:"Bitbucket",icon:()=>null};class ee{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=Z,oauthRequestApi:s,defaultScopes:i=["account"]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n,defaultScopes:i})}}const te={id:"bitbucketServer",title:"Bitbucket Server",icon:()=>null};class re{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=te,oauthRequestApi:s,defaultScopes:i=["PROJECT_ADMIN"]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n,defaultScopes:i})}}const ne={id:"atlassian",title:"Atlassian",icon:()=>null};class oe{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=ne,oauthRequestApi:s}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n})}}const se={id:"vmwareCloudServices",title:"VMware Cloud",icon:()=>null};class ie{static create(e){const{configApi:t,discoveryApi:r,oauthRequestApi:n,environment:o="development",provider:s=se,defaultScopes:i=["openid"]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:n,provider:s,environment:o,defaultScopes:i})}}const ae={id:"openshift",title:"OpenShift",icon:()=>null};class ce{static create(e){const{configApi:t,discoveryApi:r,environment:n="development",provider:o=ae,oauthRequestApi:s,defaultScopes:i=["user:info"]}=e;return E.create({configApi:t,discoveryApi:r,oauthRequestApi:s,provider:o,environment:n,defaultScopes:i})}}class ue{subject=new A;post(e){this.subject.next(e)}alert$(){return this.subject}}class le{constructor(e){this.actualApis=e}static fromApis(e){return new le(e)}captureEvent(e){this.actualApis.forEach(t=>{try{t.captureEvent(e)}catch{}})}}class pe{captureEvent(e){}}const he="theme";class fe{constructor(e){this.themes=e}static createWithStorage(e){const t=new fe(e);if(!window.localStorage)return t;const r=window.localStorage.getItem(he)??void 0;return t.setActiveThemeId(r),t.activeThemeId$().subscribe(e=>{e?window.localStorage.setItem(he,e):window.localStorage.removeItem(he)}),window.addEventListener("storage",e=>{if(e.key===he){const e=localStorage.getItem(he)??void 0;t.setActiveThemeId(e)}}),t}activeThemeId;subject=new x(void 0);getInstalledThemes(){return this.themes.slice()}activeThemeId$(){return this.subject}getActiveThemeId(){return this.activeThemeId}setActiveThemeId(e){this.activeThemeId=e,this.subject.next(e)}}const ge=/^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$/i;function de(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function ve(e){return"object"!=typeof e||null===e?e:Array.isArray(e)?e.map(ve):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,ve(t)]))}function ye(e,t){if(null===e)return;if(void 0===e)return void 0===t?void 0:ye(t);if("object"!=typeof e||Array.isArray(e))return e;const r=de(t)?t:{},n={};for(const t of new Set([...Object.keys(e),...Object.keys(r)])){const o=ye(e[t],r[t]);void 0!==o&&(n[t]=o)}return n}function me(e){if(null===e)return"null";if(Array.isArray(e))return"array";const t=typeof e;return"number"===t&&isNaN(e)?"nan":"string"===t&&""===e?"empty-string":t}const we=(e,t,r,n)=>`Invalid type in config for key '${e}' in '${t}', got ${r}, wanted ${n}`,be=(e,t)=>`Missing required config value at '${e}' in '${t}'`,Se=(e,t,r)=>`Unable to convert config value for key '${e}' in '${t}' to a ${r}`;class Ae{constructor(e,t="mock-config",r,n=""){this.data=e,this.context=t,this.fallback=r,this.prefix=n}filteredKeys;notifiedFilteredKeys=new Set;static fromConfigs(e){return 0===e.length?new Ae(void 0):e.reduce((e,{data:t,context:r,filteredKeys:n,deprecatedKeys:o})=>{const s=new Ae(t,r,e);if(s.filteredKeys=n,o)for(const{key:e,description:t}of o)console.warn(`The configuration key '${e}' of ${r} is deprecated and may be removed soon. ${t||""}`);return s},void 0)}has(e){const t=this.readValue(e);return null!==t&&(void 0!==t||(this.fallback?.has(e)??!1))}keys(){const e=this.data?Object.keys(this.data):[],t=this.fallback?.keys()??[];return[...new Set([...e,...t])].filter(e=>null!==this.data?.[e])}get(e){const t=this.getOptional(e);if(void 0===t)throw new Error(be(this.fullKey(e??""),this.context));return t}getOptional(e){const t=ve(this.readValue(e)),r=this.fallback?.getOptional(e);if(null!==t)return void 0===t?ye(r):void 0===r?ye(t):ye(t,r)}getConfig(e){const t=this.getOptionalConfig(e);if(void 0===t)throw new Error(be(this.fullKey(e),this.context));return t}getOptionalConfig(e){const t=this.readValue(e),r=this.fallback?.getOptionalConfig(e);if(de(t))return this.copy(t,e,r);if(null!==t){if(void 0!==t)throw new TypeError(we(this.fullKey(e),this.context,me(t),"object"));return r}}getConfigArray(e){const t=this.getOptionalConfigArray(e);if(void 0===t)throw new Error(be(this.fullKey(e),this.context));return t}getOptionalConfigArray(e){const t=this.readConfigValue(e,t=>{if(!Array.isArray(t))return{expected:"object-array"};for(const[r,n]of t.entries())if(!de(n))return{expected:"object-array",value:n,key:`${e}[${r}]`};return!0});if(t)return t.map((t,r)=>this.copy(t,`${e}[${r}]`))}getNumber(e){const t=this.getOptionalNumber(e);if(void 0===t)throw new Error(be(this.fullKey(e),this.context));return t}getOptionalNumber(e){const t=this.readConfigValue(e,e=>"number"==typeof e||"string"==typeof e||{expected:"number"});if("number"==typeof t||void 0===t)return t;const r=Number(t);if(!Number.isFinite(r))throw new Error(Se(this.fullKey(e),this.context,"number"));return r}getBoolean(e){const t=this.getOptionalBoolean(e);if(void 0===t)throw new Error(be(this.fullKey(e),this.context));return t}getOptionalBoolean(e){const t=this.readConfigValue(e,e=>"boolean"==typeof e||"number"==typeof e||"string"==typeof e||{expected:"boolean"});if("boolean"==typeof t||void 0===t)return t;const r=String(t).trim();if(/^(?:y|yes|true|1|on)$/i.test(r))return!0;if(/^(?:n|no|false|0|off)$/i.test(r))return!1;throw new Error(Se(this.fullKey(e),this.context,"boolean"))}getString(e){const t=this.getOptionalString(e);if(void 0===t)throw new Error(be(this.fullKey(e),this.context));return t}getOptionalString(e){return this.readConfigValue(e,e=>"string"==typeof e&&""!==e||{expected:"string"})}getStringArray(e){const t=this.getOptionalStringArray(e);if(void 0===t)throw new Error(be(this.fullKey(e),this.context));return t}getOptionalStringArray(e){return this.readConfigValue(e,t=>{if(!Array.isArray(t))return{expected:"string-array"};for(const[r,n]of t.entries())if("string"!=typeof n||""===n)return{expected:"string-array",value:n,key:`${e}[${r}]`};return!0})}fullKey(e){return`${this.prefix}${this.prefix?".":""}${e}`}copy(e,t,r){const n=new Ae(e,this.context,r,this.fullKey(t));return n.filteredKeys=this.filteredKeys,n}readConfigValue(e,t){const r=this.readValue(e);if(void 0===r)return this.fallback?.readConfigValue(e,t);if(null===r)return;const n=t(r);if(!0!==n){const{key:t=e,value:o=r,expected:s}=n;throw new TypeError(we(this.fullKey(t),this.context,me(o),s))}return r}readValue(e){const t=e?e.split("."):[];for(const r of t)if(!ge.test(r))throw new TypeError(`Invalid config key '${e}'`);if(void 0===this.data)return;let r=this.data;for(const[e,n]of t.entries())if(de(r))r=r[n];else if(null!=r){const n=this.fullKey(t.slice(0,e).join("."));throw new TypeError(we(n,this.context,me(r),"object"))}return r}}const xe="Invalid discovery URL pattern,";class ke{constructor(e){this.parts=e}static compile(e){const t=e.split(/\{\{\s*pluginId\s*\}\}/),r=t.join("pluginId");let n;try{n=new URL(r)}catch{throw new Error(`${xe} URL '${r}' is invalid`)}if(n.hash)throw new Error(`${xe} URL must not have a hash`);if(n.search)throw new Error(`${xe} URL must not have a query`);if(r.endsWith("/"))throw new Error(`${xe} URL must not end with a slash`);return new ke(t)}async getBaseUrl(e){return this.parts.join(encodeURIComponent(e))}}class Oe{constructor(e,t){this.endpoints=e,this.defaultEndpoint=t}static fromConfig(e,t){const r=t?.pathPattern??"/api/{{ pluginId }}",n=e.getString("backend.baseUrl"),o=e.getOptionalConfigArray("discovery.endpoints")?.flatMap(e=>{const t="object"==typeof e.get("target")?e.getOptionalString("target.external"):e.getString("target");if(!t)return[];const r=ke.compile(t);return e.getStringArray("plugins").map(e=>[e,r])});return new Oe(new Map(o),ke.compile(`${n}${r}`))}async getBaseUrl(e){const t=this.endpoints.get(e);return t?t.getBaseUrl(e):this.defaultEndpoint.getBaseUrl(e)}}class Re{constructor(e,t){this.alertApi=e,this.errorApi=t}post(e,t){return t?.hidden||this.alertApi.post({message:e.message,severity:"error"}),this.errorApi.post(e,t)}error$(){return this.errorApi.error$()}}class je{subject=new A;post(e,t){this.subject.next({error:e,context:t})}error$(){return this.subject}}class Ee{static forward(e,t){window.addEventListener("unhandledrejection",r=>{e.post(r.reason,t)})}}function Pe(e){if(e.length<3)throw new Error(`The '${e}' feature flag must have a minimum length of three characters.`);if(e.length>150)throw new Error(`The '${e}' feature flag must not exceed 150 characters.`);if(!e.match(/^[a-z]+[a-z0-9-]+$/))throw new Error(`The '${e}' feature flag must start with a lowercase letter and only contain lowercase letters, numbers and hyphens. Examples: feature-flag-one, alpha, release-2020`)}class Ie{registeredFeatureFlags=[];flags;registerFlag(e){Pe(e.name),this.registeredFeatureFlags.push(e)}getRegisteredFlags(){return this.registeredFeatureFlags.slice()}isActive(e){return this.flags||(this.flags=this.load()),this.flags.get(e)===k.FeatureFlagState.Active}save(e){this.flags||(this.flags=this.load()),e.merge||this.flags.clear();for(const[t,r]of Object.entries(e.states))this.flags.set(t,r);const t=Array.from(this.flags.entries()).filter(([,e])=>e===k.FeatureFlagState.Active);window.localStorage.setItem("featureFlags",JSON.stringify(Object.fromEntries(t)))}load(){try{const e=window.localStorage.getItem("featureFlags");if(!e)return new Map;const t=JSON.parse(e);if("object"!=typeof t||null===t||Array.isArray(t))return new Map;const r=Object.entries(t).filter(([e,t])=>(Pe(e),t===k.FeatureFlagState.Active));return new Map(r)}catch{return new Map}}}function Ce(e){let t=e.baseImplementation||r.g.fetch;const n=[e.middleware??[]].flat().reverse();for(const e of n)t=e.apply(t);return{fetch:t}}class Le{constructor(e,t,r,n){this.identityApi=e,this.allowUrl=t,this.headerName=r,this.headerValue=n}static create(e){const t=function(e){return e.allowUrl?e.allowUrl:e.urlPrefixAllowlist?$e(e.urlPrefixAllowlist):e.config?$e([e.config.getString("backend.baseUrl"),...Le.getDiscoveryUrlPrefixes(e.config)]):()=>!1}(e),r=e.header?.name||"authorization",n=e.header?.value||(e=>`Bearer ${e}`);return new Le(e.identityApi,t,r,n)}static getDiscoveryUrlPrefixes(e){return(e.getOptionalConfigArray("discovery.endpoints")||[]).flatMap(e=>{const t="object"==typeof e.get("target")?e.getString("target.external"):e.getString("target");return e.getStringArray("plugins").map(e=>t.replace(/\{\{\s*pluginId\s*\}\}/g,e))})}apply(e){return async(t,r)=>{const n=new Request(t,r),{token:o}=await this.identityApi.getCredentials();return!n.headers.get(this.headerName)&&"string"==typeof o&&o&&this.allowUrl(n.url)?(n.headers.set(this.headerName,this.headerValue(o)),e(n)):e(t,r)}}}function $e(e){const t=e.map(e=>e.replace(/\/$/,""));return e=>t.some(t=>e===t||e.startsWith(`${t}/`))}class Te{constructor(e){this.discoveryApi=e}apply(e){return async(t,r)=>{const n=new Request(t,r);if(!n.url.startsWith("plugin://"))return e(t,r);const{hostname:o,pathname:s,search:i,hash:a,username:c,password:u}=new URL(`http://${n.url.substring(9)}`);let l=await this.discoveryApi.getBaseUrl(o);if(c||u){const e=new URL(l),t=`${c}${u?`:${u}`:""}@`;l=`${e.protocol}//${t}${e.host}${e.pathname}`}const p=`${h=l,f=s,f&&"/"!==f?`${h.replace(/\/$/,"")}/${f.replace(/^\//,"")}`:h}${i}${a}`;var h,f,g;return e(p,"string"==typeof t||"object"==typeof(g=t)&&g?.constructor===URL?r:t)}}}class Fe{static resolvePluginProtocol(e){return new Te(e.discoveryApi)}static injectIdentityAuth(e){return Le.create(e)}constructor(){}}class Ne{requests=[];subject=new x(this.getCurrentPending());request(e){return new Promise((t,r)=>{this.requests.push({scopes:e,resolve:t,reject:r}),this.subject.next(this.getCurrentPending())})}resolve(e,t){this.requests=this.requests.filter(r=>!function(e,t){for(const r of t)if(!e.has(r))return!1;return!0}(e,r.scopes)||(r.resolve(t),!1)),this.subject.next(this.getCurrentPending())}reject(e){this.requests.forEach(t=>t.reject(e)),this.requests=[],this.subject.next(this.getCurrentPending())}pending(){return this.subject}getCurrentPending(){const e=0===this.requests.length?void 0:this.requests.slice(1).reduce((e,t)=>function(e,...t){const r=new Set(e);for(const e of t)for(const t of e)r.add(t);return r}(e,t.scopes),this.requests[0].scopes);return{scopes:e,resolve:t=>{e&&this.resolve(e,t)},reject:t=>{e&&this.reject(t)}}}}class De{subject=new A;currentRequests=[];handlerCount=0;createAuthRequester(e){const t=new Ne,r=this.handlerCount;return this.handlerCount++,t.pending().subscribe({next:t=>{const n=this.currentRequests.slice(),o=this.makeAuthRequest(t,e);o?n[r]=o:delete n[r],this.currentRequests=n,this.subject.next(n.filter(Boolean))}}),e=>t.request(e)}makeAuthRequest(e,t){const{scopes:r}=e;if(r)return{provider:t.provider,trigger:async()=>{const n=await t.onAuthRequest(r);e.resolve(n)},reject:()=>{const t=new Error("Login failed, rejected by user");t.name="RejectedError",e.reject(t)}}}authRequest$(){return this.subject}}const Ue=new Map;class Me{constructor(e,t){this.namespace=e,this.errorApi=t}static hasSubscribed=!1;static create(e){return new Me(e.namespace??"",e.errorApi)}static addStorageEventListener(){window.addEventListener("storage",e=>{for(const[t,r]of Ue.entries())e.key?.startsWith(t)&&r.handleStorageChange(e.key)})}get(e){return this.snapshot(e).value}snapshot(e){let t,r="absent";try{const n=localStorage.getItem(this.getKeyName(e));n&&(t=JSON.parse(n,(e,t)=>("object"==typeof t&&null!==t&&Object.freeze(t),t)),r="present")}catch(t){this.errorApi.post(new Error(`Error when parsing JSON config from storage for: ${e}`))}return{key:e,value:t,presence:r}}forBucket(e){const t=`${this.namespace}/${e}`;return Ue.has(t)||Ue.set(t,new Me(t,this.errorApi)),Ue.get(t)}async set(e,t){localStorage.setItem(this.getKeyName(e),JSON.stringify(t)),this.notifyChanges(e)}async remove(e){localStorage.removeItem(this.getKeyName(e)),this.notifyChanges(e)}observe$(e){return Me.hasSubscribed||(Me.addStorageEventListener(),Me.hasSubscribed=!0),this.observable.filter(({key:t})=>t===e)}handleStorageChange(e){if(!e?.startsWith(this.namespace))return;const t=e?.slice(`${this.namespace}/`.length);t.includes("/")||this.notifyChanges(decodeURIComponent(t))}getKeyName(e){return`${this.namespace}/${encodeURIComponent(e)}`}notifyChanges(e){const t=this.snapshot(e);for(const e of this.subscribers)e.next(t)}subscribers=new Set;observable=new(S())(e=>(this.subscribers.add(e),()=>{this.subscribers.delete(e)}))}const qe=(0,o.createContext)(void 0);var _e=r(42469);function Be(){const[e]=(0,_e.createRoutesFromChildren)((0,n.jsx)(_e.Route,{index:!0,element:(0,n.jsx)("div",{})}));return!e.index}const Ve=({pathname:e,search:t,hash:r,attributes:n})=>{const s=(0,k.useAnalytics)();return(0,o.useEffect)(()=>{s.captureEvent("navigate",`${e}${t}${r}`,{attributes:n})},[s,e,t,r,n]),null},Ke=({routeObjects:e})=>{const{pathname:t,search:r,hash:o}=(0,_e.useLocation)(),{params:s,...i}=((e,t)=>{try{const r=(0,_e.matchRoutes)(t,{pathname:e}),n=r?.filter(e=>e?.route.routeRefs?.size>0).pop(),o=n?.route;if(!o)return;if(""===o.path&&"/"!==e)return;let s,i;1===o.routeRefs.size&&(s=o.routeRefs.values().next().value),1===o.plugins.size&&(i=o.plugins.values().next().value);const a=Object.entries(n?.params||{}).reduce((e,[t,r])=>(void 0!==r&&"*"!==t&&(e[t]=r),e),{});return{extension:"App",pluginId:i?.getId()||"root",...s?{routeRef:s.id}:{},_routeNodeType:o.element,params:a}}catch{return}})(t,e)||{params:{}};return(0,n.jsx)(k.AnalyticsContext,{attributes:i,children:(0,n.jsx)(Ve,{pathname:t,search:r,hash:o,attributes:s})})};function He(e){let{pathname:t}=new URL(e.getOptionalString("app.baseUrl")??"/","http://sample.dev");return t=t.replace(/\/*$/,""),t}function ze({component:e,appIdentityProxy:t,children:r}){const[s,i]=(0,o.useState)(),a=He((0,k.useApi)(k.configApiRef));return s?(t.setTarget(s,{signOutTargetUrl:a||"/"}),(0,n.jsx)(n.Fragment,{children:r})):(0,n.jsx)(e,{onSignInSuccess:i})}function Ge(e){const{Router:t,SignInPage:r}=(0,k.useApp)().getComponents(),s=He((0,k.useApi)(k.configApiRef)),i=`${s}/*`,a=(0,o.useContext)(qe);if(!a)throw new Error("AppRouter must be rendered within the AppProvider");const{routeObjects:c,appIdentityProxy:u}=a;return r?Be()?(0,n.jsxs)(t,{children:[(0,n.jsx)(Ke,{routeObjects:c}),(0,n.jsx)(ze,{component:r,appIdentityProxy:u,children:(0,n.jsx)(_e.Routes,{children:(0,n.jsx)(_e.Route,{path:i,element:(0,n.jsx)(n.Fragment,{children:e.children})})})})]}):(0,n.jsxs)(t,{basename:s,children:[(0,n.jsx)(Ke,{routeObjects:c}),(0,n.jsx)(ze,{component:r,appIdentityProxy:u,children:e.children})]}):(u.setTarget({getUserId:()=>"guest",getIdToken:async()=>{},getProfile:()=>({email:"guest@example.com",displayName:"Guest"}),getProfileInfo:async()=>({email:"guest@example.com",displayName:"Guest"}),getBackstageIdentity:async()=>({type:"user",userEntityRef:"user:default/guest",ownershipEntityRefs:["user:default/guest"]}),getCredentials:async()=>({}),signOut:async()=>{}},{signOutTargetUrl:s||"/"}),Be()?(0,n.jsxs)(t,{children:[(0,n.jsx)(Ke,{routeObjects:c}),(0,n.jsx)(_e.Routes,{children:(0,n.jsx)(_e.Route,{path:i,element:(0,n.jsx)(n.Fragment,{children:e.children})})})]}):(0,n.jsxs)(t,{basename:s,children:[(0,n.jsx)(Ke,{routeObjects:c}),e.children]}))}(0,k.attachComponentData)(Ge,"core.type","AppRouter");var Je=r(45274);const We=(0,k.createApiRef)({id:"core.applanguage"});var Ye=r(87350);function Xe(e,t){return()=>({accumulator:e(),visit:t})}function Qe(e){return e.props?.children}function Ze(e){if(e.props?.path&&e.props?.element)return e.props?.element}const et=Xe(()=>new Set,(e,t)=>{const r=(0,k.getComponentData)(t,"core.plugin");r&&e.add(r)}),tt=e=>{const{children:t}=e,r=(0,k.useApi)(k.featureFlagsApiRef),o="with"in e?r.isActive(e.with):!r.isActive(e.without);return(0,n.jsx)(n.Fragment,{children:o?t:null})};(0,k.attachComponentData)(tt,"core.featureFlagged",!0);const rt={caseSensitive:!1,path:"*",element:"match-all",routeRefs:new Set,plugins:new Set};function nt(e){const t=e;return t?.type?t.type.displayName??t.type.name??String(t.type):String(t)}const ot=e=>{const t=new Set;return e&&t.add(e),t};function st(e,t=new Array){return o.Children.forEach(e,e=>{if(!(0,o.isValidElement)(e))return;const r=(0,k.getComponentData)(e,"core.mountPoint");if(r){const n=(0,k.getComponentData)(e,"core.plugin");t.push({routeRef:r,plugin:n})}st(e.props.children,t)}),t}const it=Xe(()=>({paths:new Map,parents:new Map,objects:new Array}),(e,t,r,n)=>{if(n?.isElementAncestor)return n;if(r?.props.element===t)return{...n,isElementAncestor:!0};const o=t.props?.path,s=(0,k.getComponentData)(t,"core.mountPoint");if(s&&o)throw new Error(`Path property may not be set directly on a routable extension "${nt(t)}"`);const i=n?.obj?.children??e.objects;if(void 0!==o){if("string"!=typeof o)throw new Error(`Element path must be a string at "${nt(t)}"`);const r=o.startsWith("/")?o.slice(1):o,s=t.props.element;if((0,k.getComponentData)(t,"core.gatherMountPoints")){if(s)throw new Error(`Mount point gatherers may not have an element prop "${nt(t)}"`);const e={path:r,element:"gathered",routeRefs:new Set,caseSensitive:Boolean(t.props?.caseSensitive),children:[rt],plugins:new Set};return i.push(e),{obj:e,gatherPath:r,routeRef:n?.routeRef,gatherRouteRef:n?.routeRef}}if(s){const[a,...c]=st(s);if(c.length>0)throw new Error(`Route element with path "${o}" may not contain multiple routable extensions`);if(!a)return n;const{routeRef:u,plugin:l}=a,p={path:r,element:"mounted",routeRefs:new Set([u]),caseSensitive:Boolean(t.props?.caseSensitive),children:[rt],plugins:ot(l)};return i.push(p),e.paths.set(u,r),e.parents.set(u,n?.routeRef),{obj:p,routeRef:u??n?.routeRef,gatherPath:r,gatherRouteRef:n?.gatherRouteRef}}}if(s){if(void 0===n?.gatherPath)throw new Error(`Routable extension "${nt(t)}" with mount point "${s}" must be assigned a path`);n?.obj?.routeRefs.add(s);const r=(0,k.getComponentData)(t,"core.plugin");return r&&n?.obj?.plugins.add(r),e.paths.set(s,n.gatherPath),e.parents.set(s,n?.gatherRouteRef),{...n,routeRef:s}}return n}),at=Xe(()=>({paths:new Map,parents:new Map,objects:new Array}),(e,t,r,n)=>{if(r?.props.element===t)return n;let s=n?.obj,i=n?.routeRef,a=n?.sticky;const c=t.props?.path,u=s?.children??e.objects,l=Boolean(t.props?.caseSensitive);let p=n?.path;if((0,k.getComponentData)(t,"core.gatherMountPoints")){if(!c)throw new Error("Mount point gatherer must have a path");p=c}const h=t.props?.element;let f=(0,k.getComponentData)(t,"core.mountPoint");if(!f&&(0,o.isValidElement)(h)&&(f=(0,k.getComponentData)(h,"core.mountPoint")),f){let r=c;if(p&&(r?p=void 0:r=p),!r)throw new Error("Mounted routable extension must have a path");e.paths.set(f,r),i&&a?(e.parents.set(f,i),c&&(i=f,a=!1)):(e.parents.set(f,i),i=f),c?(s={caseSensitive:l,path:c,element:"mounted",routeRefs:new Set([f]),children:[rt],plugins:ot((0,k.getComponentData)(t.props.element,"core.plugin"))},u.push(s)):s?.routeRefs.add(f)}if((0,k.getComponentData)(t,"core.gatherMountPoints")&&(a=!0),(0,k.getComponentData)(t,"core.gatherMountPoints")){if(!c)throw new Error("Mount point gatherer must have a path");f||(s={caseSensitive:l,path:c,element:"gathered",routeRefs:new Set,children:[rt],plugins:n?.obj?.plugins||new Set},u.push(s))}return{obj:s,path:p,routeRef:i,sticky:a}}),ct=Xe(()=>new Set,(e,t)=>{if(t.type===tt){const r=t.props;e.add("with"in r?r.with:r.without)}}),ut=(0,c.getOrCreateGlobalSingleton)("route-ref-type",()=>Symbol("route-ref-type"));function lt(e){return"absolute"===e[ut]}function pt(e){return"sub"===e[ut]}function ht(...e){const t=e.join("/").replace(/\/\/+/g,"/");return"/"!==t&&t.endsWith("/")?t.slice(0,-1):t}var ft=r(46155),gt=r.n(ft);class dt{constructor(e,t,r,n,o){this.routePaths=e,this.routeParents=t,this.routeObjects=r,this.routeBindings=n,this.appBasePath=o}resolve(e,t){const[r,n]=function(e,t,r){let n,o="";if(lt(e))n=e;else if(pt(e))n=e.parent,o=e.path;else{if("external"!==e[ut])throw e[ut]?new Error(`Unknown or invalid route ref type, ${e[ut]}`):new Error(`Unknown object passed to useRouteRef, got ${e}`);{const t=r.get(e);if(!t)return[void 0,""];if(lt(t))n=t;else{if(!pt(t))throw new Error(`ExternalRouteRef was bound to invalid target, ${t}`);n=t.parent,o=t.path}}}if(!n)return[void 0,""];const s=t.get(n);return void 0===s?[void 0,""]:[n,ht(s,o)]}(e,this.routePaths,this.routeBindings);if(!r)return;let o;o="string"==typeof t?this.trimPath(t):t.pathname?{...t,pathname:this.trimPath(t.pathname)}:t;const s=this.appBasePath+function(e,t,r,n,o){const s=(0,_e.matchRoutes)(o,t)??[],i=Array();let a=-1;for(let t=e;t&&(a=s.findIndex(e=>e.route.routeRefs.has(t)),-1===a);t=n.get(t))i.unshift(t);return 0===i.length&&(a-=1),`${ht(-1===a?"":s[a].pathname,...i.slice(0,-1).map(t=>{const n=r.get(t);if(void 0===n)throw new Error(`No path for ${t}`);if(n.includes(":"))throw new Error(`Cannot route to ${e} with parent ${t} as it has parameters`);return n}))}/`}(r,o,this.routePaths,this.routeParents,this.routeObjects);return(...[e])=>{const t=e&>()(e,e=>"string"==typeof e?e.replaceAll(/[&?#;\/]/g,e=>encodeURIComponent(e)):e);return ht(s,(0,_e.generatePath)(n,t))}}trimPath(e){return e&&e.startsWith(this.appBasePath)?e.slice(this.appBasePath.length):e}}const vt=(0,c.createVersionedContext)("routing-context"),yt=({routePaths:e,routeParents:t,routeObjects:r,routeBindings:o,basePath:s="",children:i})=>{const a=new dt(e,t,r,o,s),u=(0,c.createVersionedValueMap)({1:a});return(0,n.jsx)(vt.Provider,{value:u,children:i})},mt=(0,c.createVersionedContext)("app-context"),wt=({appContext:e,children:t})=>{const r=(0,c.createVersionedValueMap)({1:e});return(0,n.jsx)(mt.Provider,{value:r,children:t})};function bt(e){return new Error(`Tried to access IdentityApi ${e} before app was loaded`)}function St(e){console.warn(`WARNING: Call to ${e} is deprecated and will break in the future`)}class At{target;waitForTarget;resolveTarget=()=>{};signOutTargetUrl="/";#e;constructor(){this.waitForTarget=new Promise(e=>{this.resolveTarget=e})}setTarget(e,t){this.target=e,this.signOutTargetUrl=t.signOutTargetUrl,this.resolveTarget(e)}getUserId(){if(!this.target)throw bt("getUserId");if(!this.target.getUserId)throw new Error("IdentityApi does not implement getUserId");return St("getUserId"),this.target.getUserId()}getProfile(){if(!this.target)throw bt("getProfile");if(!this.target.getProfile)throw new Error("IdentityApi does not implement getProfile");return St("getProfile"),this.target.getProfile()}async getProfileInfo(){return this.waitForTarget.then(e=>e.getProfileInfo())}async getBackstageIdentity(){const e=await this.waitForTarget.then(e=>e.getBackstageIdentity());return e.userEntityRef.match(/^.*:.*\/.*$/)||console.warn(`WARNING: The App IdentityApi provided an invalid userEntityRef, '${e.userEntityRef}'. It must be a full Entity Reference of the form '<kind>:<namespace>/<name>'.`),e}async getCredentials(){return this.waitForTarget.then(e=>e.getCredentials())}async getIdToken(){return this.waitForTarget.then(e=>{if(!e.getIdToken)throw new Error("IdentityApi does not implement getIdToken");return St("getIdToken"),e.getIdToken()})}async signOut(){await this.waitForTarget.then(e=>e.signOut()),await(this.#e?.()),window.location.href=this.signOutTargetUrl}enableCookieAuth(e){if(this.#e)return;const t=function({discoveryApi:e,fetchApi:t,errorApi:r}){let n,o=!1,s=!0,i=5e3;const a="BroadcastChannel"in window?new BroadcastChannel("app-auth-cookie-expires-at"):void 0,c=e=>{const t=6e4*(1+3*Math.random());return Math.max(e-Date.now(),3e5)-t},u=async()=>{try{const r=`${await e.getBaseUrl("app")}/.backstage/auth/v1/cookie`,n=await t.fetch(r,{credentials:"include"});if(!n.ok)throw new Error(`Request failed with status ${n.status} ${n.statusText}, see request towards ${r} for more details`);const o=await n.json();if(!o.expiresAt)throw new Error("No expiration date in response");const i=Date.parse(o.expiresAt);if(Number.isNaN(i))throw new Error("Invalid expiration date in response");s=!0,a?.postMessage({action:"COOKIE_REFRESH_SUCCESS",payload:{expiresAt:new Date(i).toISOString()}}),p(c(i))}catch(e){s?(s=!1,i=5e3):(i=Math.min(3e5,2*i),console.error("Session cookie refresh failed",e),r.post(new Error("Session refresh failed, see developer console for details"))),p(i)}},l=e=>{const{data:t}=e;if(null!==t&&"object"==typeof t&&"action"in t&&"COOKIE_REFRESH_SUCCESS"===t.action){const e=Date.parse(t.payload.expiresAt);if(Number.isNaN(e))return void console.warn("Received invalid expiration from session refresh channel");p(c(e))}};function p(e){o||(n&&clearTimeout(n),n=setTimeout(u,e))}return a?.addEventListener("message",l),u(),()=>{o=!0,n&&clearTimeout(n),a?.removeEventListener("message",l),a?.close()}}(e);this.#e=async()=>{t();const r=await e.discoveryApi.getBaseUrl("app");try{await fetch(`${r}/.backstage/auth/v1/cookie`,{method:"DELETE",credentials:"include"})}catch{}}}}var xt=r(1394);function kt({children:e}){const t=(0,k.useApi)(k.appThemeApiRef),r=function(e,t,r){if(void 0!==e){const t=r.find(t=>t.id===e);if(t)return t}if(t){const e=r.find(e=>"dark"===e.variant);if(e)return e}return r.find(e=>"light"===e.variant)||r[0]}((0,xt.A)(t.activeThemeId$(),t.getActiveThemeId()),!!Boolean(window.matchMedia)&&(()=>{const e=(0,o.useMemo)(()=>window.matchMedia("(prefers-color-scheme: dark)"),[]),[t,r]=(0,o.useState)(e.matches);return(0,o.useEffect)(()=>{const t=e=>{r(e.matches)};return e.addListener(t),()=>{e.removeListener(t)}},[e]),t})(),t.getInstalledThemes());if(!r)throw new Error("App has no themes");return(0,n.jsx)(r.Provider,{children:e})}var Ot=r(39907);const Rt=async()=>function(e="__APP_INJECTED_RUNTIME_CONFIG__"){const t=new Array,r=Ot.env.APP_CONFIG;if(r){if(!Array.isArray(r))throw new Error("Static configuration has invalid format");t.push(...r)}const n=document.querySelectorAll('script[type="backstage.io/config"]');if(n.length>0)for(const e of n)try{const r=e.textContent;if(!r)throw new Error("tag is empty");let n;try{n=JSON.parse(r)}catch(e){throw new Error(`failed to parse config; ${e}`)}if(!Array.isArray(n))throw new Error("data is not an array");t.push(...n)}catch(e){throw new Error(`Failed to load config from script tag, ${e.message}`)}else if(e!=="__app_injected_runtime_config__".toLocaleUpperCase("en-US"))try{const r=JSON.parse(e);Array.isArray(r)?t.push(...r):t.push({data:r,context:"env"})}catch(e){throw new Error(`Failed to load runtime configuration, ${e}`)}const o=window.__APP_CONFIG__;return o&&t.push({context:"window",data:o}),t}();class jt{apis=[];add(e,t){return this.apis.push([e.id,t]),t}build(){return new Et(new Map(this.apis))}}class Et{constructor(e){this.apis=e}static builder(){return new jt}static from(e){return new Et(new Map(e.map(([e,t])=>[e.id,t])))}static with(e,t){return new Et(new Map([[e.id,t]]))}with(e,t){return new Et(new Map([...this.apis,[e.id,t]]))}get(e){return this.apis.get(e.id)}}function Pt(e){return!1===e||!("string"!=typeof e||!e)}const It="language",Ct="en";class Lt{static create(e){const t=e?.availableLanguages??[Ct];if(t.length!==new Set(t).size)throw new Error(`Supported languages may not contain duplicates, got '${t.join("', '")}'`);const r=e?.defaultLanguage??Ct;if(!t.includes(r))throw new Error(`Initial language must be one of the supported languages, got '${r}'`);return new Lt(t,r)}static createWithStorage(e){const t=Lt.create(e);if(!window.localStorage)return t;const r=window.localStorage.getItem(It),{languages:n}=t.getAvailableLanguages();return r&&n.includes(r)&&t.setLanguage(r),t.language$().subscribe(({language:e})=>{e!==window.localStorage.getItem(It)&&window.localStorage.setItem(It,e)}),window.addEventListener("storage",e=>{if(e.key===It){const e=localStorage.getItem(It)??void 0;e&&t.setLanguage(e)}}),t}#t;#r;#n;constructor(e,t){this.#t=e,this.#r=t,this.#n=new x({language:this.#r})}getAvailableLanguages(){return{languages:this.#t.slice()}}setLanguage(e){const t=e??Ct;if(t!==this.#r){if(t&&!this.#t.includes(t))throw new Error(`Failed to change language to '${t}', available languages are '${this.#t.join("', '")}'`);this.#r=t,this.#n.next({language:t})}}getLanguage(){return{language:this.#r}}language$(){return this.#n}}var $t=r(17545),Tt=r(55152),Ft=r(30414),Nt=r(2474),Dt=r(29296),Ut=r(95309),Mt=r(72715),qt=r(24586),_t=r(37756);function Bt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Vt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Bt(Object(r),!0).forEach(function(t){(0,qt.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Kt={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},Ht=new(function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,Tt.A)(this,e),this.init(t,r)}return(0,Ft.A)(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Kt,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,r,n){return n&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(r).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,Vt(Vt({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}()),zt=function(){function e(){(0,Tt.A)(this,e),this.observers={}}return(0,Ft.A)(e,[{key:"on",value:function(e,t){var r=this;return e.split(" ").forEach(function(e){r.observers[e]=r.observers[e]||[],r.observers[e].push(t)}),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter(function(e){return e!==t}):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.observers[e]&&[].concat(this.observers[e]).forEach(function(e){e.apply(void 0,r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(function(t){t.apply(t,[e].concat(r))})}}]),e}();function Gt(){var e,t,r=new Promise(function(r,n){e=r,t=n});return r.resolve=e,r.reject=t,r}function Jt(e){return null==e?"":""+e}function Wt(e,t,r){function n(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function o(){return!e||"string"==typeof e}for(var s="string"!=typeof t?[].concat(t):t.split(".");s.length>1;){if(o())return{};var i=n(s.shift());!e[i]&&r&&(e[i]=new r),e=Object.prototype.hasOwnProperty.call(e,i)?e[i]:{}}return o()?{}:{obj:e,k:n(s.shift())}}function Yt(e,t,r){var n=Wt(e,t,Object);n.obj[n.k]=r}function Xt(e,t){var r=Wt(e,t),n=r.obj,o=r.k;if(n)return n[o]}function Qt(e,t,r){for(var n in t)"__proto__"!==n&&"constructor"!==n&&(n in e?"string"==typeof e[n]||e[n]instanceof String||"string"==typeof t[n]||t[n]instanceof String?r&&(e[n]=t[n]):Qt(e[n],t[n],r):e[n]=t[n]);return e}function Zt(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var er={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function tr(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,function(e){return er[e]}):e}var rr="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,nr=[" ",",","?","!",";"];function or(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var n=t.split(r),o=e,s=0;s<n.length;++s){if(!o)return;if("string"==typeof o[n[s]]&&s+1<n.length)return;if(void 0===o[n[s]]){for(var i=2,a=n.slice(s,s+i).join(r),c=o[a];void 0===c&&n.length>s+i;)i++,c=o[a=n.slice(s,s+i).join(r)];if(void 0===c)return;if(null===c)return null;if(t.endsWith(a)){if("string"==typeof c)return c;if(a&&"string"==typeof c[a])return c[a]}var u=n.slice(s+i).join(r);return u?or(c,u,r):void 0}o=o[n[s]]}return o}}function sr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ir(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sr(Object(r),!0).forEach(function(t){(0,qt.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sr(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var ar=function(e){(0,Dt.A)(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=(0,Mt.A)(t);if(r){var o=(0,Mt.A)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,Ut.A)(this,e)});function o(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return(0,Tt.A)(this,o),t=n.call(this),rr&&zt.call((0,Nt.A)(t)),t.data=e||{},t.options=r,void 0===t.options.keySeparator&&(t.options.keySeparator="."),void 0===t.options.ignoreJSONStructure&&(t.options.ignoreJSONStructure=!0),t}return(0,Ft.A)(o,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,s=void 0!==n.ignoreJSONStructure?n.ignoreJSONStructure:this.options.ignoreJSONStructure,i=[e,t];r&&"string"!=typeof r&&(i=i.concat(r)),r&&"string"==typeof r&&(i=i.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(i=e.split("."));var a=Xt(this.data,i);return a||!s||"string"!=typeof r?a:or(this.data&&this.data[e]&&this.data[e][t],r,o)}},{key:"addResource",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},s=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,i=[e,t];r&&(i=i.concat(s?r.split(s):r)),e.indexOf(".")>-1&&(n=t,t=(i=e.split("."))[1]),this.addNamespaces(t),Yt(this.data,i,n),o.silent||this.emit("added",e,t,r,n)}},{key:"addResources",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var o in r)"string"!=typeof r[o]&&"[object Array]"!==Object.prototype.toString.apply(r[o])||this.addResource(e,t,o,r[o],{silent:!0});n.silent||this.emit("added",e,t,r)}},{key:"addResourceBundle",value:function(e,t,r,n,o){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},i=[e,t];e.indexOf(".")>-1&&(n=r,r=t,t=(i=e.split("."))[1]),this.addNamespaces(t);var a=Xt(this.data,i)||{};n?Qt(a,r,o):a=ir(ir({},a),r),Yt(this.data,i,a),s.silent||this.emit("added",e,t,r)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?ir(ir({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(function(e){return t[e]&&Object.keys(t[e]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),o}(zt),cr={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,n,o){var s=this;return e.forEach(function(e){s.processors[e]&&(t=s.processors[e].process(t,r,n,o))}),t}};function ur(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function lr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ur(Object(r),!0).forEach(function(t){(0,qt.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ur(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var pr={},hr=function(e){(0,Dt.A)(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=(0,Mt.A)(t);if(r){var o=(0,Mt.A)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,Ut.A)(this,e)});function o(e){var t,r,s,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,Tt.A)(this,o),t=n.call(this),rr&&zt.call((0,Nt.A)(t)),r=e,s=(0,Nt.A)(t),["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach(function(e){r[e]&&(s[e]=r[e])}),t.options=i,void 0===t.options.keySeparator&&(t.options.keySeparator="."),t.logger=Ht.create("translator"),t}return(0,Ft.A)(o,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var r=this.resolve(e,t);return r&&void 0!==r.res}},{key:"extractFromKey",value:function(e,t){var r=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===r&&(r=":");var n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,o=t.ns||this.options.defaultNS||[],s=r&&e.indexOf(r)>-1,i=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,r){t=t||"",r=r||"";var n=nr.filter(function(e){return t.indexOf(e)<0&&r.indexOf(e)<0});if(0===n.length)return!0;var o=new RegExp("(".concat(n.map(function(e){return"?"===e?"\\?":e}).join("|"),")")),s=!o.test(e);if(!s){var i=e.indexOf(r);i>0&&!o.test(e.substring(0,i))&&(s=!0)}return s}(e,r,n));if(s&&!i){var a=e.match(this.interpolator.nestingRegexp);if(a&&a.length>0)return{key:e,namespaces:o};var c=e.split(r);(r!==n||r===n&&this.options.ns.indexOf(c[0])>-1)&&(o=c.shift()),e=c.join(n)}return"string"==typeof o&&(o=[o]),{key:e,namespaces:o}}},{key:"translate",value:function(e,t,r){var n=this;if("object"!==(0,$t.A)(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"===(0,$t.A)(t)&&(t=lr({},t)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var s=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,i=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],t),c=a.key,u=a.namespaces,l=u[u.length-1],p=t.lng||this.language,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p&&"cimode"===p.toLowerCase()){if(h){var f=t.nsSeparator||this.options.nsSeparator;return s?{res:"".concat(l).concat(f).concat(c),usedKey:c,exactUsedKey:c,usedLng:p,usedNS:l}:"".concat(l).concat(f).concat(c)}return s?{res:c,usedKey:c,exactUsedKey:c,usedLng:p,usedNS:l}:c}var g=this.resolve(e,t),d=g&&g.res,v=g&&g.usedKey||c,y=g&&g.exactUsedKey||c,m=Object.prototype.toString.apply(d),w=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject;if(b&&d&&"string"!=typeof d&&"boolean"!=typeof d&&"number"!=typeof d&&["[object Number]","[object Function]","[object RegExp]"].indexOf(m)<0&&("string"!=typeof w||"[object Array]"!==m)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var S=this.options.returnedObjectHandler?this.options.returnedObjectHandler(v,d,lr(lr({},t),{},{ns:u})):"key '".concat(c," (").concat(this.language,")' returned an object instead of string.");return s?(g.res=S,g):S}if(i){var A="[object Array]"===m,x=A?[]:{},k=A?y:v;for(var O in d)if(Object.prototype.hasOwnProperty.call(d,O)){var R="".concat(k).concat(i).concat(O);x[O]=this.translate(R,lr(lr({},t),{joinArrays:!1,ns:u})),x[O]===R&&(x[O]=d[O])}d=x}}else if(b&&"string"==typeof w&&"[object Array]"===m)(d=d.join(w))&&(d=this.extendTranslation(d,e,t,r));else{var j=!1,E=!1,P=void 0!==t.count&&"string"!=typeof t.count,I=o.hasDefaultValue(t),C=P?this.pluralResolver.getSuffix(p,t.count,t):"",L=t["defaultValue".concat(C)]||t.defaultValue;!this.isValidLookup(d)&&I&&(j=!0,d=L),this.isValidLookup(d)||(E=!0,d=c);var $=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&E?void 0:d,T=I&&L!==d&&this.options.updateMissing;if(E||j||T){if(this.logger.log(T?"updateKey":"missingKey",p,l,c,T?L:d),i){var F=this.resolve(c,lr(lr({},t),{},{keySeparator:!1}));F&&F.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var N=[],D=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&D&&D[0])for(var U=0;U<D.length;U++)N.push(D[U]);else"all"===this.options.saveMissingTo?N=this.languageUtils.toResolveHierarchy(t.lng||this.language):N.push(t.lng||this.language);var M=function(e,r,o){var s=I&&o!==d?o:$;n.options.missingKeyHandler?n.options.missingKeyHandler(e,l,r,s,T,t):n.backendConnector&&n.backendConnector.saveMissing&&n.backendConnector.saveMissing(e,l,r,s,T,t),n.emit("missingKey",e,l,r,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?N.forEach(function(e){n.pluralResolver.getSuffixes(e,t).forEach(function(r){M([e],c+r,t["defaultValue".concat(r)]||L)})}):M(N,c,L))}d=this.extendTranslation(d,e,t,g,r),E&&d===c&&this.options.appendNamespaceToMissingKey&&(d="".concat(l,":").concat(c)),(E||j)&&this.options.parseMissingKeyHandler&&(d="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(l,":").concat(c):c,j?d:void 0):this.options.parseMissingKeyHandler(d))}return s?(g.res=d,g):d}},{key:"extendTranslation",value:function(e,t,r,n,o){var s=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,lr(lr({},this.options.interpolation.defaultVariables),r),n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init(lr(lr({},r),{interpolation:lr(lr({},this.options.interpolation),r.interpolation)}));var i,a="string"==typeof e&&(r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(a){var c=e.match(this.interpolator.nestingRegexp);i=c&&c.length}var u=r.replace&&"string"!=typeof r.replace?r.replace:r;if(this.options.interpolation.defaultVariables&&(u=lr(lr({},this.options.interpolation.defaultVariables),u)),e=this.interpolator.interpolate(e,u,r.lng||this.language,r),a){var l=e.match(this.interpolator.nestingRegexp);i<(l&&l.length)&&(r.nest=!1)}!r.lng&&"v1"!==this.options.compatibilityAPI&&n&&n.res&&(r.lng=n.usedLng),!1!==r.nest&&(e=this.interpolator.nest(e,function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return o&&o[0]===n[0]&&!r.context?(s.logger.warn("It seems you are nesting recursively key: ".concat(n[0]," in key: ").concat(t[0])),null):s.translate.apply(s,n.concat([t]))},r)),r.interpolation&&this.interpolator.reset()}var p=r.postProcess||this.options.postProcess,h="string"==typeof p?[p]:p;return null!=e&&h&&h.length&&!1!==r.applyPostProcessor&&(e=cr.handle(h,e,t,this.options&&this.options.postProcessPassResolved?lr({i18nResolved:n},r):r,this)),e}},{key:"resolve",value:function(e){var t,r,n,o,s,i=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach(function(e){if(!i.isValidLookup(t)){var c=i.extractFromKey(e,a),u=c.key;r=u;var l=c.namespaces;i.options.fallbackNS&&(l=l.concat(i.options.fallbackNS));var p=void 0!==a.count&&"string"!=typeof a.count,h=p&&!a.ordinal&&0===a.count&&i.pluralResolver.shouldUseIntlApi(),f=void 0!==a.context&&("string"==typeof a.context||"number"==typeof a.context)&&""!==a.context,g=a.lngs?a.lngs:i.languageUtils.toResolveHierarchy(a.lng||i.language,a.fallbackLng);l.forEach(function(e){i.isValidLookup(t)||(s=e,!pr["".concat(g[0],"-").concat(e)]&&i.utils&&i.utils.hasLoadedNamespace&&!i.utils.hasLoadedNamespace(s)&&(pr["".concat(g[0],"-").concat(e)]=!0,i.logger.warn('key "'.concat(r,'" for languages "').concat(g.join(", "),'" won\'t get resolved as namespace "').concat(s,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(function(r){if(!i.isValidLookup(t)){o=r;var s,c=[u];if(i.i18nFormat&&i.i18nFormat.addLookupKeys)i.i18nFormat.addLookupKeys(c,u,r,e,a);else{var l;p&&(l=i.pluralResolver.getSuffix(r,a.count,a));var g="".concat(i.options.pluralSeparator,"zero");if(p&&(c.push(u+l),h&&c.push(u+g)),f){var d="".concat(u).concat(i.options.contextSeparator).concat(a.context);c.push(d),p&&(c.push(d+l),h&&c.push(d+g))}}for(;s=c.pop();)i.isValidLookup(t)||(n=s,t=i.getResource(r,e,s,a))}}))})}}),{res:t,usedKey:r,exactUsedKey:n,usedLng:o,usedNS:s}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,r,n):this.resourceStore.getResource(e,t,r,n)}}],[{key:"hasDefaultValue",value:function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&"defaultValue"===t.substring(0,12)&&void 0!==e[t])return!0;return!1}}]),o}(zt);function fr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var gr=function(){function e(t){(0,Tt.A)(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ht.create("languageUtils")}return(0,Ft.A)(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],r=e.split("-");return this.options.lowerCaseLng?r=r.map(function(e){return e.toLowerCase()}):2===r.length?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=fr(r[1].toLowerCase()))):3===r.length&&(r[0]=r[0].toLowerCase(),2===r[1].length&&(r[1]=r[1].toUpperCase()),"sgn"!==r[0]&&2===r[2].length&&(r[2]=r[2].toUpperCase()),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=fr(r[1].toLowerCase())),t.indexOf(r[2].toLowerCase())>-1&&(r[2]=fr(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,r=this;return e?(e.forEach(function(e){if(!t){var n=r.formatLanguageCode(e);r.options.supportedLngs&&!r.isSupportedCode(n)||(t=n)}}),!t&&this.options.supportedLngs&&e.forEach(function(e){if(!t){var n=r.getLanguagePartFromCode(e);if(r.isSupportedCode(n))return t=n;t=r.options.supportedLngs.find(function(e){return e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:0===e.indexOf(n)?e:void 0})}}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}},{key:"toResolveHierarchy",value:function(e,t){var r=this,n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),o=[],s=function(e){e&&(r.isSupportedCode(e)?o.push(e):r.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&s(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&s(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&s(this.getLanguagePartFromCode(e))):"string"==typeof e&&s(this.formatLanguageCode(e)),n.forEach(function(e){o.indexOf(e)<0&&s(r.formatLanguageCode(e))}),o}}]),e}(),dr=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],vr={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},yr=["v1","v2","v3"],mr={zero:0,one:1,two:2,few:3,many:4,other:5},wr=function(){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,Tt.A)(this,e),this.languageUtils=t,this.options=n,this.logger=Ht.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(r={},dr.forEach(function(e){e.lngs.forEach(function(t){r[t]={numbers:e.nr,plurals:vr[e.fc]}})}),r)}return(0,Ft.A)(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,t);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,r).map(function(e){return"".concat(t).concat(e)})}},{key:"getSuffixes",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,r);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort(function(e,t){return mr[e]-mr[t]}).map(function(e){return"".concat(t.options.prepend).concat(e)}):n.numbers.map(function(n){return t.getSuffix(e,n,r)}):[]}},{key:"getSuffix",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.getRule(e,r);return n?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(n.select(t)):this.getSuffixRetroCompatible(n,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var r=this,n=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),o=e.numbers[n];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===o?o="plural":1===o&&(o=""));var s=function(){return r.options.prepend&&o.toString()?r.options.prepend+o.toString():o.toString()};return"v1"===this.options.compatibilityJSON?1===o?"":"number"==typeof o?"_plural_".concat(o.toString()):s():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?s():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}},{key:"shouldUseIntlApi",value:function(){return!yr.includes(this.options.compatibilityJSON)}}]),e}();function br(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Sr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?br(Object(r),!0).forEach(function(t){(0,qt.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):br(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ar(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=function(e,t,r){var n=Xt(e,r);return void 0!==n?n:Xt(t,r)}(e,t,r);return!s&&o&&"string"==typeof r&&void 0===(s=or(e,r,n))&&(s=or(t,r,n)),s}var xr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,Tt.A)(this,e),this.logger=Ht.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return(0,Ft.A)(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:tr,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?Zt(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?Zt(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?Zt(t.nestingPrefix):t.nestingPrefixEscaped||Zt("$t("),this.nestingSuffix=t.nestingSuffix?Zt(t.nestingSuffix):t.nestingSuffixEscaped||Zt(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var r="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(r,"g")}},{key:"interpolate",value:function(e,t,r,n){var o,s,i,a=this,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var l=function(e){if(e.indexOf(a.formatSeparator)<0){var o=Ar(t,c,e,a.options.keySeparator,a.options.ignoreJSONStructure);return a.alwaysFormat?a.format(o,void 0,r,Sr(Sr(Sr({},n),t),{},{interpolationkey:e})):o}var s=e.split(a.formatSeparator),i=s.shift().trim(),u=s.join(a.formatSeparator).trim();return a.format(Ar(t,c,i,a.options.keySeparator,a.options.ignoreJSONStructure),u,r,Sr(Sr(Sr({},n),t),{},{interpolationkey:i}))};this.resetRegExp();var p=n&&n.missingInterpolationHandler||this.options.missingInterpolationHandler,h=n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return u(e)}},{regex:this.regexp,safeValue:function(e){return a.escapeValue?u(a.escape(e)):u(e)}}].forEach(function(t){for(i=0;o=t.regex.exec(e);){var r=o[1].trim();if(void 0===(s=l(r)))if("function"==typeof p){var c=p(e,o,n);s="string"==typeof c?c:""}else if(n&&Object.prototype.hasOwnProperty.call(n,r))s="";else{if(h){s=o[0];continue}a.logger.warn("missed to pass in variable ".concat(r," for interpolating ").concat(e)),s=""}else"string"==typeof s||a.useRawValueToEscape||(s=Jt(s));var u=t.safeValue(s);if(e=e.replace(o[0],u),h?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,++i>=a.maxReplaces)break}}),e}},{key:"nest",value:function(e,t){var r,n,o,s=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function a(e,t){var r=this.nestingOptionsSeparator;if(e.indexOf(r)<0)return e;var n=e.split(new RegExp("".concat(r,"[ ]*{"))),s="{".concat(n[1]);e=n[0];var i=(s=this.interpolate(s,o)).match(/'/g),a=s.match(/"/g);(i&&i.length%2==0&&!a||a.length%2!=0)&&(s=s.replace(/'/g,'"'));try{o=JSON.parse(s),t&&(o=Sr(Sr({},t),o))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(r).concat(s)}return delete o.defaultValue,e}for(;r=this.nestingRegexp.exec(e);){var c=[];(o=(o=Sr({},i)).replace&&"string"!=typeof o.replace?o.replace:o).applyPostProcessor=!1,delete o.defaultValue;var u=!1;if(-1!==r[0].indexOf(this.formatSeparator)&&!/{.*}/.test(r[1])){var l=r[1].split(this.formatSeparator).map(function(e){return e.trim()});r[1]=l.shift(),c=l,u=!0}if((n=t(a.call(this,r[1].trim(),o),o))&&r[0]===e&&"string"!=typeof n)return n;"string"!=typeof n&&(n=Jt(n)),n||(this.logger.warn("missed to resolve ".concat(r[1]," for nesting ").concat(e)),n=""),u&&(n=c.reduce(function(e,t){return s.format(e,t,i.lng,Sr(Sr({},i),{},{interpolationkey:r[1].trim()}))},n.trim())),e=e.replace(r[0],n),this.regexp.lastIndex=0}return e}}]),e}();function kr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Or(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?kr(Object(r),!0).forEach(function(t){(0,qt.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kr(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Rr(e){var t={};return function(r,n,o){var s=n+JSON.stringify(o),i=t[s];return i||(i=e(n,o),t[s]=i),i(r)}}var jr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,Tt.A)(this,e),this.logger=Ht.create("formatter"),this.options=t,this.formats={number:Rr(function(e,t){var r=new Intl.NumberFormat(e,Or({},t));return function(e){return r.format(e)}}),currency:Rr(function(e,t){var r=new Intl.NumberFormat(e,Or(Or({},t),{},{style:"currency"}));return function(e){return r.format(e)}}),datetime:Rr(function(e,t){var r=new Intl.DateTimeFormat(e,Or({},t));return function(e){return r.format(e)}}),relativetime:Rr(function(e,t){var r=new Intl.RelativeTimeFormat(e,Or({},t));return function(e){return r.format(e,t.range||"day")}}),list:Rr(function(e,t){var r=new Intl.ListFormat(e,Or({},t));return function(e){return r.format(e)}})},this.init(t)}return(0,Ft.A)(e,[{key:"init",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=Rr(t)}},{key:"format",value:function(e,t,r){var n=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return t.split(this.formatSeparator).reduce(function(e,t){var s=function(e){var t=e.toLowerCase().trim(),r={};if(e.indexOf("(")>-1){var n=e.split("(");t=n[0].toLowerCase().trim();var o=n[1].substring(0,n[1].length-1);"currency"===t&&o.indexOf(":")<0?r.currency||(r.currency=o.trim()):"relativetime"===t&&o.indexOf(":")<0?r.range||(r.range=o.trim()):o.split(";").forEach(function(e){if(e){var t=e.split(":"),n=(0,_t.A)(t),o=n[0],s=n.slice(1).join(":").trim().replace(/^'+|'+$/g,"");r[o.trim()]||(r[o.trim()]=s),"false"===s&&(r[o.trim()]=!1),"true"===s&&(r[o.trim()]=!0),isNaN(s)||(r[o.trim()]=parseInt(s,10))}})}return{formatName:t,formatOptions:r}}(t),i=s.formatName,a=s.formatOptions;if(n.formats[i]){var c=e;try{var u=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},l=u.locale||u.lng||o.locale||o.lng||r;c=n.formats[i](e,l,Or(Or(Or({},a),o),u))}catch(e){n.logger.warn(e)}return c}return n.logger.warn("there was no format function for ".concat(i)),e},e)}}]),e}();function Er(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Pr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Er(Object(r),!0).forEach(function(t){(0,qt.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Er(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Ir=function(e){(0,Dt.A)(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=(0,Mt.A)(t);if(r){var o=(0,Mt.A)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,Ut.A)(this,e)});function o(e,t,r){var s,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,Tt.A)(this,o),s=n.call(this),rr&&zt.call((0,Nt.A)(s)),s.backend=e,s.store=t,s.services=r,s.languageUtils=r.languageUtils,s.options=i,s.logger=Ht.create("backendConnector"),s.waitingReads=[],s.maxParallelReads=i.maxParallelReads||10,s.readingCalls=0,s.maxRetries=i.maxRetries>=0?i.maxRetries:5,s.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(r,i.backend,i),s}return(0,Ft.A)(o,[{key:"queueLoad",value:function(e,t,r,n){var o=this,s={},i={},a={},c={};return e.forEach(function(e){var n=!0;t.forEach(function(t){var a="".concat(e,"|").concat(t);!r.reload&&o.store.hasResourceBundle(e,t)?o.state[a]=2:o.state[a]<0||(1===o.state[a]?void 0===i[a]&&(i[a]=!0):(o.state[a]=1,n=!1,void 0===i[a]&&(i[a]=!0),void 0===s[a]&&(s[a]=!0),void 0===c[t]&&(c[t]=!0)))}),n||(a[e]=!0)}),(Object.keys(s).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(s),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(c)}}},{key:"loaded",value:function(e,t,r){var n=e.split("|"),o=n[0],s=n[1];t&&this.emit("failedLoading",o,s,t),r&&this.store.addResourceBundle(o,s,r),this.state[e]=t?-1:2;var i={};this.queue.forEach(function(r){var n,a,c,u,l;n=r.loaded,a=s,(u=(c=Wt(n,[o],Object)).obj)[l=c.k]=u[l]||[],u[l].push(a),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(r,e),t&&r.errors.push(t),0!==r.pendingCount||r.done||(Object.keys(r.loaded).forEach(function(e){i[e]||(i[e]={});var t=r.loaded[e];t.length&&t.forEach(function(t){void 0===i[e][t]&&(i[e][t]=!0)})}),r.done=!0,r.errors.length?r.callback(r.errors):r.callback())}),this.emit("loaded",i),this.queue=this.queue.filter(function(e){return!e.done})}},{key:"read",value:function(e,t,r){var n=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:r,tried:o,wait:s,callback:i});else{this.readingCalls++;var a=function(a,c){if(n.readingCalls--,n.waitingReads.length>0){var u=n.waitingReads.shift();n.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.callback)}a&&c&&o<n.maxRetries?setTimeout(function(){n.read.call(n,e,t,r,o+1,2*s,i)},s):i(a,c)},c=this.backend[r].bind(this.backend);if(2!==c.length)return c(e,t,a);try{var u=c(e,t);u&&"function"==typeof u.then?u.then(function(e){return a(null,e)}).catch(a):a(null,u)}catch(e){a(e)}}}},{key:"prepareLoading",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var s=this.queueLoad(e,t,n,o);if(!s.toLoad.length)return s.pending.length||o(),null;s.toLoad.forEach(function(e){r.loadOne(e)})}},{key:"load",value:function(e,t,r){this.prepareLoading(e,t,{},r)}},{key:"reload",value:function(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}},{key:"loadOne",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=e.split("|"),o=n[0],s=n[1];this.read(o,s,"read",void 0,void 0,function(n,i){n&&t.logger.warn("".concat(r,"loading namespace ").concat(s," for language ").concat(o," failed"),n),!n&&i&&t.logger.log("".concat(r,"loaded namespace ").concat(s," for language ").concat(o),i),t.loaded(e,n,i)})}},{key:"saveMissing",value:function(e,t,r,n,o){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},i=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(r,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=r&&""!==r){if(this.backend&&this.backend.create){var a=Pr(Pr({},s),{},{isUpdate:o}),c=this.backend.create.bind(this.backend);if(c.length<6)try{var u;(u=5===c.length?c(e,t,r,n,a):c(e,t,r,n))&&"function"==typeof u.then?u.then(function(e){return i(null,e)}).catch(i):i(null,u)}catch(e){i(e)}else c(e,t,r,n,i,a)}e&&e[0]&&this.store.addResource(e[0],t,r,n)}}}]),o}(zt);function Cr(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===(0,$t.A)(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===(0,$t.A)(e[2])||"object"===(0,$t.A)(e[3])){var r=e[3]||e[2];Object.keys(r).forEach(function(e){t[e]=r[e]})}return t},interpolation:{escapeValue:!0,format:function(e,t,r,n){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Lr(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function $r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Tr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$r(Object(r),!0).forEach(function(t){(0,qt.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$r(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Fr(){}var Nr=function(e){(0,Dt.A)(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=(0,Mt.A)(t);if(r){var o=(0,Mt.A)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,Ut.A)(this,e)});function o(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if((0,Tt.A)(this,o),e=n.call(this),rr&&zt.call((0,Nt.A)(e)),e.options=Lr(r),e.services={},e.logger=Ht,e.modules={external:[]},t=(0,Nt.A)(e),Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(function(e){"function"==typeof t[e]&&(t[e]=t[e].bind(t))}),s&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,s),(0,Ut.A)(e,(0,Nt.A)(e));setTimeout(function(){e.init(r,s)},0)}return e}return(0,Ft.A)(o,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(r=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var n=Cr();function o(e){return e?"function"==typeof e?new e:e:null}if(this.options=Tr(Tr(Tr({},n),this.options),Lr(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=Tr(Tr({},n.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var s;this.modules.logger?Ht.init(o(this.modules.logger),this.options):Ht.init(null,this.options),this.modules.formatter?s=this.modules.formatter:"undefined"!=typeof Intl&&(s=jr);var i=new gr(this.options);this.store=new ar(this.options.resources,this.options);var a=this.services;a.logger=Ht,a.resourceStore=this.store,a.languageUtils=i,a.pluralResolver=new wr(i,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!s||this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format||(a.formatter=o(s),a.formatter.init(a,this.options),this.options.interpolation.format=a.formatter.format.bind(a.formatter)),a.interpolator=new xr(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new Ir(o(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];e.emit.apply(e,[t].concat(n))}),this.modules.languageDetector&&(a.languageDetector=o(this.modules.languageDetector),a.languageDetector.init&&a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=o(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new hr(this.services,this.options),this.translator.on("*",function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];e.emit.apply(e,[t].concat(n))}),this.modules.external.forEach(function(t){t.init&&t.init(e)})}if(this.format=this.options.interpolation.format,r||(r=Fr),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&"dev"!==c[0]&&(this.options.lng=c[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(function(t){e[t]=function(){var r;return(r=e.store)[t].apply(r,arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(function(t){e[t]=function(){var r;return(r=e.store)[t].apply(r,arguments),e}});var u=Gt(),l=function(){var t=function(t,n){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),u.resolve(n),r(t,n)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?l():setTimeout(l,0),u}},{key:"loadResources",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fr,n="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase())return r();var o=[],s=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach(function(e){o.indexOf(e)<0&&o.push(e)})};n?s(n):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(function(e){return s(e)}),this.options.preload&&this.options.preload.forEach(function(e){return s(e)}),this.services.backendConnector.load(o,this.options.ns,function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),r(e)})}else r(null)}},{key:"reloadResources",value:function(e,t,r){var n=Gt();return e||(e=this.languages),t||(t=this.options.ns),r||(r=Fr),this.services.backendConnector.reload(e,t,function(e){n.resolve(),r(e)}),n}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&cr.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var r=this.languages[t];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}},{key:"changeLanguage",value:function(e,t){var r=this;this.isLanguageChangingTo=e;var n=Gt();this.emit("languageChanging",e);var o=function(e){r.language=e,r.languages=r.services.languageUtils.toResolveHierarchy(e),r.resolvedLanguage=void 0,r.setResolvedLanguage(e)},s=function(s){e||s||!r.services.languageDetector||(s=[]);var i="string"==typeof s?s:r.services.languageUtils.getBestMatchFromCodes(s);i&&(r.language||o(i),r.translator.language||r.translator.changeLanguage(i),r.services.languageDetector&&r.services.languageDetector.cacheUserLanguage&&r.services.languageDetector.cacheUserLanguage(i)),r.loadResources(i,function(e){!function(e,s){s?(o(s),r.translator.changeLanguage(s),r.isLanguageChangingTo=void 0,r.emit("languageChanged",s),r.logger.log("languageChanged",s)):r.isLanguageChangingTo=void 0,n.resolve(function(){return r.t.apply(r,arguments)}),t&&t(e,function(){return r.t.apply(r,arguments)})}(e,i)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e):s(this.services.languageDetector.detect()),n}},{key:"getFixedT",value:function(e,t,r){var n=this,o=function e(t,o){var s;if("object"!==(0,$t.A)(o)){for(var i=arguments.length,a=new Array(i>2?i-2:0),c=2;c<i;c++)a[c-2]=arguments[c];s=n.options.overloadTranslationOptionHandler([t,o].concat(a))}else s=Tr({},o);s.lng=s.lng||e.lng,s.lngs=s.lngs||e.lngs,s.ns=s.ns||e.ns,s.keyPrefix=s.keyPrefix||r||e.keyPrefix;var u,l=n.options.keySeparator||".";return u=s.keyPrefix&&Array.isArray(t)?t.map(function(e){return"".concat(s.keyPrefix).concat(l).concat(e)}):s.keyPrefix?"".concat(s.keyPrefix).concat(l).concat(t):t,n.t(u,s)};return"string"==typeof e?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=r,o}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var n=r.lng||this.resolvedLanguage||this.languages[0],o=!!this.options&&this.options.fallbackLng,s=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;var i=function(e,r){var n=t.services.backendConnector.state["".concat(e,"|").concat(r)];return-1===n||2===n};if(r.precheck){var a=r.precheck(this,i);if(void 0!==a)return a}return!(!this.hasResourceBundle(n,e)&&this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages)&&(!i(n,e)||o&&!i(s,e)))}},{key:"loadNamespaces",value:function(e,t){var r=this,n=Gt();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach(function(e){r.options.ns.indexOf(e)<0&&r.options.ns.push(e)}),this.loadResources(function(e){n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var r=Gt();"string"==typeof e&&(e=[e]);var n=this.options.preload||[],o=e.filter(function(e){return n.indexOf(e)<0});return o.length?(this.options.preload=n.concat(o),this.loadResources(function(e){r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";var t=this.services&&this.services.languageUtils||new gr(Cr());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fr,n=Tr(Tr(Tr({},this.options),t),{isClone:!0}),s=new o(n);return void 0===t.debug&&void 0===t.prefix||(s.logger=s.logger.clone(t)),["store","services","language"].forEach(function(t){s[t]=e[t]}),s.services=Tr({},this.services),s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s.translator=new hr(s.services,s.options),s.translator.on("*",function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];s.emit.apply(s,[e].concat(r))}),s.init(n,r),s.translator.options=s.options,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),o}(zt);(0,qt.A)(Nr,"createInstance",function(){return new Nr(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)});var Dr=Nr.createInstance();Dr.createInstance=Nr.createInstance;var Ur=Dr.createInstance;function Mr(e){const t=e;if("@backstage/TranslationRef"!==t.$$type)throw new Error(`Invalid translation ref, bad type '${t.$$type}'`);if("v1"!==t.version)throw new Error(`Invalid translation ref, bad version '${t.version}'`);return t}function qr(e){return Object.fromEntries(Object.entries(e).filter(e=>null!==e[1]))}Dr.dir,Dr.init,Dr.loadResources,Dr.reloadResources,Dr.use,Dr.changeLanguage,Dr.getFixedT,Dr.t,Dr.exists,Dr.setDefaultNamespace,Dr.hasLoadedNamespace,Dr.loadNamespaces,Dr.loadLanguages;class _r{constructor(e){this.onLoad=e}#o=new Set;#s=new Map;#i=new Map;addTranslationResource(e){const t=function(e){const t=e;if("@backstage/TranslationResource"!==t.$$type)throw new Error(`Invalid translation resource, bad type '${t.$$type}'`);if("v1"!==t.version)throw new Error(`Invalid translation resource, bad version '${t.version}'`);return t}(e);for(const e of t.resources){const r=this.#a(e.language,t.id);this.#i.has(r)||this.#i.set(r,e.loader)}}#a(e,t){return`${e}/${t}`}needsLoading(e,t){const r=this.#a(e,t);return!!this.#i.get(r)&&!this.#o.has(r)}async load(e,t){const r=this.#a(e,t),n=this.#i.get(r);if(!n)return;if(this.#o.has(r))return;const o=this.#s.get(r);if(o)return void await o;const s=n().then(n=>{this.onLoad({language:e,namespace:t,messages:n.messages}),this.#o.add(r)},e=>{throw this.#o.add(r),e});this.#s.set(r,s),await s}}class Br{#c;#u;#l;static fromI18n(e){const t=e.services.interpolator,r=t.format;let n;return t.format=(e,t,o,s)=>t?r(e,t,o,s):n?.(e,t,o,s)??e,new Br(Math.random().toString(36).substring(2,8),e=>{n=e})}constructor(e,t){this.#c=t,this.#u=e,this.#l=new RegExp(`\\$${e}\\(([^)]+)\\)`)}wrapT(e){return(t,r)=>{let n;this.#c(e=>{if((0,o.isValidElement)(e)){n||(n=new Map);const t=n.size.toString();return n.set(t,e),`$${this.#u}(${t})`}return e});const s=e(t,r);if(!n)return s;const i=s.split(this.#l);return(0,o.createElement)(o.Fragment,null,...i.map((e,t)=>t%2==0?e:n?.get(e)).filter(Boolean))}}}class Vr{static create(e){const{languages:t}=e.languageApi.getAvailableLanguages(),r=Ur({fallbackLng:Ct,supportedLngs:t,interpolation:{escapeValue:!1,alwaysFormat:!0},ns:[],defaultNS:!1,fallbackNS:!1,initImmediate:!1});if(r.init(),!r.isInitialized)throw new Error("i18next was unexpectedly not initialized");const n=Br.fromI18n(r),{language:o}=e.languageApi.getLanguage();o!==Ct&&r.changeLanguage(o);const s=new _r(e=>{r.addResourceBundle(e.language,e.namespace,qr(e.messages),!1,!0)}),i=e?.resources||[];for(let e=i.length-1;e>=0;e--){const t=i[e];"@backstage/TranslationResource"===t.$$type?s.addTranslationResource(t):"@backstage/TranslationMessages"===t.$$type&&r.addResourceBundle(Ct,t.id,qr(t.messages),!0,!1)}const a=new Vr(r,s,e.languageApi.getLanguage().language,n);return e.languageApi.language$().subscribe(({language:e})=>{a.#p(e)}),a}#h;#f;#r;#g;#d=new Set;#v=new Set;constructor(e,t,r,n){this.#h=e,this.#f=t,this.#r=r,this.#g=n}getTranslation(e){const t=Mr(e);return this.#y(t),this.#m(t)}translation$(e){const t=Mr(e);return this.#y(t),new(S())(e=>{let r={};const n=()=>{r={};const n=r;this.#f.load(this.#r,t.id).then(()=>{if(n===r){const r=this.#m(t);r.ready&&e.next(r)}},t=>{n===r&&e.error(Array.isArray(t)?t[0]:t)})},o=()=>{const r=this.#m(t);r.ready?e.next(r):n()};return this.#f.needsLoading(this.#r,t.id)&&n(),this.#v.add(o),()=>{this.#v.delete(o)}})}#p(e){this.#r!==e&&(this.#r=e,this.#h.changeLanguage(e),this.#v.forEach(e=>e()))}#m(e){if(this.#f.needsLoading(this.#r,e.id))return{ready:!1};const t=this.#h.getFixedT(null,e.id);return{ready:!0,t:this.#g.wrapT(t)}}#y(e){if(this.#d.has(e.id))return;this.#d.add(e.id);const t=e.getDefaultMessages();this.#h.addResourceBundle(Ct,e.id,t,!0,!1);const r=e.getDefaultResource();r&&this.#f.addTranslationResource(r)}}function Kr(e){const t=new URL(e);return t.protocol=document.location.protocol,t.hostname=document.location.hostname,t.port=document.location.port,t.toString().replace(/\/$/,"")}class Hr{constructor(e){this.app=e}getPlugins(){return this.app.getPlugins()}getSystemIcon(e){return this.app.getSystemIcon(e)}getSystemIcons(){return this.app.getSystemIcons()}getComponents(){return this.app.getComponents()}}class zr{apiHolder;configApi;apis;icons;plugins;featureFlags;components;themes;configLoader;defaultApis;bindRoutes;appLanguageApi;translationResources;appIdentityProxy=new At;apiFactoryRegistry;constructor(e){this.apis=e.apis??[],this.icons=e.icons,this.plugins=new Set(e.plugins??[]),this.featureFlags=e.featureFlags??[],this.components=e.components,this.themes=e.themes,this.configLoader=e.configLoader??Rt,this.defaultApis=e.defaultApis??[],this.bindRoutes=e.bindRoutes,this.apiFactoryRegistry=new f,this.appLanguageApi=Lt.createWithStorage({defaultLanguage:e.__experimentalTranslations?.defaultLanguage,availableLanguages:e.__experimentalTranslations?.availableLanguages}),this.translationResources=e.__experimentalTranslations?.resources??[]}getPlugins(){return Array.from(this.plugins)}getSystemIcon(e){return this.icons[e]}getSystemIcons(){return this.icons}getComponents(){return this.components}createRoot(e){const t=this.getProvider();return()=>(0,n.jsx)(t,{children:e})}#w=!1;getProvider(){if(this.#w)throw new Error("app.getProvider() or app.createRoot() has already been called, and can only be called once");this.#w=!0;const e=new Hr(this);let t,r;return({children:s})=>{const i=(0,o.useRef)(!0),a=(0,o.useMemo)(()=>fe.createWithStorage(this.themes),[]),{routing:c,featureFlags:u}=(0,o.useMemo)(()=>{const e=Be();e&&console.warn("\nDEPRECATION WARNING: React Router Beta is deprecated and support for it will be removed in a future release.\n Please migrate to use React Router v6 stable.\n See https://backstage.io/docs/tutorials/react-router-stable-migration\n");const t=function(e){const t={};for(const r in e.collectors)e.collectors.hasOwnProperty(r)&&(t[r]=e.collectors[r]());const r=[{node:o.Children.toArray(e.root),parent:void 0,contexts:{}}];for(;0!==r.length;){const{node:n,parent:s,contexts:i}=r.shift();o.Children.forEach(n,n=>{if(!(0,o.isValidElement)(n))return;const a={};for(const e in t)if(t.hasOwnProperty(e)){const r=t[e];a[e]=r.visit(r.accumulator,n,s,i[e])}for(const t of e.discoverers){const e=t(n);e&&r.push({node:e,parent:n,contexts:a})}})}return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,t.accumulator]))}({root:s,discoverers:[Qe,Ze],collectors:{routing:e?at:it,collectedPlugins:et,featureFlags:ct}});return t.collectedPlugins.forEach(e=>this.plugins.add(e)),this.verifyPlugins(this.plugins),this.getApiHolder(),t},[s]),p=function(e,t,r){const o=Boolean(e),s=(0,Je.A)(e||(()=>Promise.resolve([])));let i;if(o&&s.loading){const{Progress:e}=t;i=(0,n.jsx)(e,{})}else if(s.error){const{BootErrorPage:e}=t;i=(0,n.jsx)(e,{step:"load-config",error:s.error})}const{ThemeProvider:a=kt}=t;return i?{node:(0,n.jsx)(l,{apis:Et.with(k.appThemeApiRef,r),children:(0,n.jsx)(a,{children:i})})}:{api:Ae.fromConfigs(s.value?.length?function(e){const t=Ae.fromConfigs(e),r=t.getOptionalString("app.baseUrl"),n=t.getOptionalString("backend.baseUrl");let o,s,i=e;if(r&&n&&new URL(r).origin===new URL(n).origin){const e=Kr(n);n!==e&&(o=e)}if(r){const e=Kr(r);r!==e&&(s=e)}return(s||o)&&(i=i.concat({data:{app:s&&{baseUrl:s},backend:o&&{baseUrl:o}},context:"relative-resolver"})),i}(s.value):[])}}(this.configLoader,this.components,a),h="api"in p;if(h){const{api:e}=p;this.configApi=e}if("node"in p)return p.node;if(r)throw r;if(!t)try{t=function(e,t,r){const n=function(e){const t=new Map,r=new Map;for(const n of e){for(const[e,r]of Object.entries(n.routes??{})){const o=`${n.getId()}.${e}`;if(t.has(o))throw new Error(`Unexpected duplicate route '${o}'`);t.set(o,r)}for(const[e,t]of Object.entries(n.externalRoutes??{})){const o=`${n.getId()}.${e}`;if(r.has(o))throw new Error(`Unexpected duplicate external route '${o}'`);r.set(o,t)}}return{routes:t,externalRoutes:r}}(r),o=new Map,s=new Set;e&&e({bind:(e,t)=>{for(const[r,n]of Object.entries(t)){const t=e[r];if(!t)throw new Error(`Key ${r} is not an existing external route`);if(!n&&!t.optional)throw new Error(`External route ${r} is required but was ${!1===n?"disabled":"not provided"}`);n?o.set(t,n):!1===n&&s.add(t)}}});const i=t.getOptionalConfig("app.routes.bindings")?.get();if(i)for(const[e,t]of Object.entries(i)){if(!Pt(t))throw new Error(`Invalid config at app.routes.bindings['${e}'], value must be a non-empty string or false`);const r=n.externalRoutes.get(e);if(!r)throw new Error(`Invalid config at app.routes.bindings, '${e}' is not a valid external route`);if(!o.has(r)&&!s.has(r))if(!1===t)s.add(r);else{const s=n.routes.get(t);if(!s)throw new Error(`Invalid config at app.routes.bindings['${e}'], '${t}' is not a valid route`);o.set(r,s)}}for(const e of n.externalRoutes.values())if(!o.has(e)&&!s.has(e)){const t="getDefaultTarget"in e?e.getDefaultTarget():void 0;if(t){const r=n.routes.get(t);r&&o.set(e,r)}}return o}(this.bindRoutes,p.api,this.plugins),function(e,t){const r=new Set(t.values());r.delete(void 0);for(const n of t.keys()){if(r.has(n))continue;let o=n,s="";for(;o;){const r=e.get(o);if(void 0===r)throw new Error(`No path for ${o}`);s=ht(r,s),o=t.get(o)}const i=s.match(/:(\w+)/g);if(i)for(let e=0;e<i.length;e++)for(let t=e+1;t<i.length;t++)if(i[t]===i[e])throw new Error(`Parameter ${i[t]} is duplicated in path ${s}`)}}(c.paths,c.parents),function(e,t){for(const r of t)if(r.externalRoutes)for(const[t,n]of Object.entries(r.externalRoutes))if(!n.optional&&!e.has(n))throw new Error(`External route '${t}' of the '${r.getId()}' plugin must be bound to a target route. See https://backstage.io/link?bind-routes for details.`)}(t,this.plugins)}catch(e){throw r=e,e}if(h&&i.current){i.current=!1;const e=this.getApiHolder().get(k.featureFlagsApiRef);if(e){for(const t of this.featureFlags)e.registerFlag({...t,pluginId:""});for(const t of this.plugins.values())if("getFeatureFlags"in t)for(const r of t.getFeatureFlags())e.registerFlag({name:r.name,pluginId:t.getId()});else for(const r of t.output())"feature-flag"===r.type&&e.registerFlag({name:r.name,pluginId:t.getId()});const t=e.getRegisteredFlags(),r=new Set(t.map(e=>e.name));for(const t of u)r.has(t)||e.registerFlag({name:t,pluginId:""})}}const{ThemeProvider:f=kt,Progress:g}=this.components,d=this.getApiHolder();if(function(){const e=document.querySelector('meta[name="backstage-app-mode"]');return"protected"===(e?.getAttribute("content")??"public")}()){const e=d.get(k.errorApiRef),t=d.get(k.fetchApiRef),r=d.get(k.discoveryApiRef);if(!e||!t||!r)throw new Error("App is running in protected mode but missing required APIs");this.appIdentityProxy.enableCookieAuth({errorApi:e,fetchApi:t,discoveryApi:r})}return(0,n.jsx)(l,{apis:d,children:(0,n.jsx)(wt,{appContext:e,children:(0,n.jsx)(f,{children:(0,n.jsx)(yt,{routePaths:c.paths,routeParents:c.parents,routeObjects:c.objects,routeBindings:t,basePath:(v=p.api,Be()?He(v):""),children:(0,n.jsx)(qe.Provider,{value:{routeObjects:c.objects,appIdentityProxy:this.appIdentityProxy},children:(0,n.jsx)(o.Suspense,{fallback:(0,n.jsx)(g,{}),children:s})})})})})});var v}}getRouter(){return Ge}getApiHolder(){if(this.apiHolder){for(const e of this.plugins)for(const t of e.getApis())this.apiFactoryRegistry.get(t.api)||this.apiFactoryRegistry.register("default",t);return p.validateFactories(this.apiFactoryRegistry,this.apiFactoryRegistry.getAllApis()),this.apiHolder}this.apiFactoryRegistry.register("static",{api:k.appThemeApiRef,deps:{},factory:()=>fe.createWithStorage(this.themes)}),this.apiFactoryRegistry.register("static",{api:k.configApiRef,deps:{},factory:()=>{if(!this.configApi)throw new Error("Tried to access config API before config was loaded");return this.configApi}}),this.apiFactoryRegistry.register("static",{api:k.identityApiRef,deps:{},factory:()=>this.appIdentityProxy}),this.apiFactoryRegistry.register("static",{api:We,deps:{},factory:()=>this.appLanguageApi}),this.apiFactoryRegistry.register("default",{api:Ye.J,deps:{languageApi:We},factory:({languageApi:e})=>Vr.create({languageApi:e,resources:this.translationResources})}),this.apiFactoryRegistry.register("default",{api:k.featureFlagsApiRef,deps:{},factory:()=>new Ie});for(const e of this.defaultApis)this.apiFactoryRegistry.register("default",e);for(const e of this.plugins)for(const t of e.getApis())if(!this.apiFactoryRegistry.register("default",t))throw new Error(`Plugin ${e.getId()} tried to register duplicate or forbidden API factory for ${t.api}`);for(const e of this.apis)if(!this.apiFactoryRegistry.register("app",e))throw new Error(`Duplicate or forbidden API factory for ${e.api} in app`);return p.validateFactories(this.apiFactoryRegistry,this.apiFactoryRegistry.getAllApis()),this.apiHolder=new p(this.apiFactoryRegistry),this.apiHolder}verifyPlugins(e){const t=new Set;for(const r of e){const e=r.getId();if(t.has(e))throw new Error(`Duplicate plugin found '${e}'`);t.add(e)}}}function Gr(e){return new zr(e)}let Jr=!1;const Wr=e=>{const t=(0,k.useApp)(),{NotFoundErrorPage:r}=t.getComponents(),s=(0,o.useMemo)(()=>Be(),[]),i=[...(0,k.useElementFilter)(e.children,e=>e.getElements().flatMap(e=>{let t=e.props.path;if(""===t)return[];t=t?.replace(/\/\*$/,"")??"/";let r=s?e:e.props.element;return s||r||(r=e,Jr||(console.warn("DEPRECATION WARNING: All elements within <FlatRoutes> must be of type <Route> with an element prop. Existing usages of <Navigate key=[path] to=[to] /> should be replaced with <Route path=[path] element={<Navigate to=[to] />} />."),Jr=!0)),[{path:t,element:r,children:e.props.children?[{path:"/"===t?"/":"*",element:e.props.children}]:void 0}]}).sort((e,t)=>t.path.localeCompare(e.path)).map(e=>({...e,path:"/"===e.path?"/":`${e.path}/*`}))),{path:"*",element:(0,n.jsx)(r,{})}];return(0,_e.useRoutes)(i)};(0,k.attachComponentData)(Wr,"core.type","FlatRoutes")},46155:(e,t,r)=>{var n=r(57073),o=r(47170),s=r(3334);e.exports=function(e,t){var r={};return t=s(t,3),o(e,function(e,o,s){n(r,o,t(e,o,s))}),r}},39907:e=>{var t,r,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var a,c=[],u=!1,l=-1;function p(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&h())}function h(){if(!u){var e=i(p);u=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function g(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new f(e,t)),1!==c.length||u||i(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},96403:(e,t,r)=>{e.exports=r(84834).Observable},84834:(e,t)=>{"use strict";t.Observable=void 0;const r=e=>Boolean(Symbol[e]),n=e=>r(e)?Symbol[e]:"@@"+e,o=n("iterator"),s=n("observable"),i=n("species");function a(e,t){let r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function c(e){let t=e.constructor;return void 0!==t&&(t=t[i],null===t&&(t=void 0)),void 0!==t?t:v}function u(e){u.log?u.log(e):setTimeout(()=>{throw e})}function l(e){Promise.resolve().then(()=>{try{e()}catch(e){u(e)}})}function p(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=a(t,"unsubscribe");e&&e.call(t)}}catch(e){u(e)}}function h(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function f(e,t,r){e._state="running";let n=e._observer;try{let o=a(n,t);switch(t){case"next":o&&o.call(n,r);break;case"error":if(h(e),!o)throw r;o.call(n,r);break;case"complete":h(e),o&&o.call(n)}}catch(e){u(e)}"closed"===e._state?p(e):"running"===e._state&&(e._state="ready")}function g(e,t,r){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:r}],void l(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let r=0;r<t.length&&(f(e,t[r].type,t[r].value),"closed"!==e._state);++r);}}(e))):void f(e,t,r);e._queue.push({type:t,value:r})}}class d{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let r=this,n={get closed(){return"closed"===r._state},next(e){g(r,"next",e)},error(e){g(r,"error",e)},complete(){g(r,"complete")}};try{this._cleanup=t.call(void 0,n)}catch(e){n.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(h(this),p(this))}}class v{constructor(e){if(!(this instanceof v))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new d(e,this._subscriber)}forEach(e){return new Promise((t,r)=>{if("function"!=typeof e)return void r(new TypeError(e+" is not a function"));function n(){o.unsubscribe(),t()}let o=this.subscribe({next(t){try{e(t,n)}catch(e){r(e),o.unsubscribe()}},error:r,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(c(this))(t=>this.subscribe({next(r){try{r=e(r)}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(c(this))(t=>this.subscribe({next(r){try{if(!e(r))return}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=c(this),r=arguments.length>1,n=!1,o=arguments[1];return new t(t=>this.subscribe({next(s){let i=!n;if(n=!0,!i||r)try{o=e(o,s)}catch(e){return t.error(e)}else o=s},error(e){t.error(e)},complete(){if(!n&&!r)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(o),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=c(this);return new t(r=>{let n,o=0;return function s(i){n=i.subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){o===e.length?(n=void 0,r.complete()):s(t.from(e[o++]))}})}(this),()=>{n&&(n.unsubscribe(),n=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=c(this);return new t(r=>{let n=[],o=this.subscribe({next(o){if(e)try{o=e(o)}catch(e){return r.error(e)}let i=t.from(o).subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){let e=n.indexOf(i);e>=0&&n.splice(e,1),s()}});n.push(i)},error(e){r.error(e)},complete(){s()}});function s(){o.closed&&0===n.length&&r.complete()}return()=>{n.forEach(e=>e.unsubscribe()),o.unsubscribe()}})}[s](){return this}static from(e){let t="function"==typeof this?this:v;if(null==e)throw new TypeError(e+" is not an object");let n=a(e,s);if(n){let r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return function(e){return e instanceof v}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(r("iterator")&&(n=a(e,o),n))return new t(t=>{l(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{l(()=>{if(!t.closed){for(let r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:v)(t=>{l(()=>{if(!t.closed){for(let r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})})}static get[i](){return this}}t.Observable=v,Object.defineProperty(v,Symbol("extensions"),{value:{symbol:s,hostReportError:u},configurable:!0})}}]);
|
|
2
|
+
//# sourceMappingURL=4864.3cede332.chunk.js.map
|