/*! Built with http://stenciljs.com */
const{h:t}=window.webcomponents;import{a as s,b as e,c as i}from"./chunk-b173bbde.js";var n=function(t,s,e,i){return new(e||(e=Promise))(function(n,a){function o(t){try{c(i.next(t))}catch(t){a(t)}}function h(t){try{c(i.throw(t))}catch(t){a(t)}}function c(t){t.done?n(t.value):new e(function(s){s(t.value)}).then(o,h)}c((i=i.apply(t,s||[])).next())})};const a=Symbol(),o=Symbol();class h{constructor(t){if(this.baseUrl="",this.loading=!0,this.authenticated=!1,this.errorMessage="",t!==o)throw new Error("Cannot construct singleton");this._type="AppService",this.config=s.instance,this.config.setDefaults(e)}init(t){return n(this,void 0,void 0,function*(){return yield this.config.fetch(this.baseUrl+"/assets/config.json"),this.baseUrl=t,this.data={},this.data.manifest=yield this.fetchJson(this.baseUrl+"/assets/collection-manifest.json"),this.data.mockData=yield this.fetchJson(this.baseUrl+"/assets/data/mock-data.json"),this.data.dwpData=yield this.fetchJson(this.baseUrl+"/assets/data/mock-dwp.json"),this.data.swaggerData=yield this.fetchJson(this.baseUrl+"/assets/data/uaasApiSwagger.json"),this.collectionManifest=this.data.manifest,this.parseComponents(),this.initHistory(),document.location.hostname.match("localhost")&&this.config.set("dev",!0),this.data})}initHistory(){"undefined"!=typeof window&&window.history}parseComponents(){let t=[];i.copy(this.data.manifest.components).map(s=>{let e=s.tag,i=!1;this.config.get("componentsIgnorePatterns").forEach(t=>{e.match(t)&&(i=!0)}),i||t.push(s)}),this.components=t}fetchJson(t){return n(this,void 0,void 0,function*(){return yield(yield fetch(t)).json()})}showFlashMessage(t,s,e=2e3){document.querySelector("ema-flash-message").show(t,s,e)}static get instance(){return this[a]||(this[a]=new h(o)),this[a]}get type(){return this._type}set type(t){this._type=t}}export{h as a};