System.register(["@angular/core","single-spa-angular/internals","@angular/common"],function(t){"use strict";var e,n,o,r,i,a;return{setters:[function(t){e=t,t.Injectable,n=t.Inject},function(t){o=t.getContainerElementAndSetTemplate},function(t){r=t["\u0275BrowserPlatformLocation"],i=t.DOCUMENT,a=t.PlatformLocation}],execute:function(){t({enableProdMode:function(){try{e.enableProdMode()}catch{}},getSingleSpaExtraProviders:function(){return[{provide:s,deps:[[new n(i)]]},{provide:a,useExisting:s}]},singleSpaAngular:function(t){if(u&&"object"!=typeof t)throw Error("single-spa-angular requires a configuration object");const e={...p,...t};if(u&&"function"!=typeof e.bootstrapFunction)throw Error("single-spa-angular must be passed an options.bootstrapFunction");if(u&&"string"!=typeof e.template)throw Error("single-spa-angular must be passed options.template string");if(u&&!e.NgZone)throw Error("single-spa-angular must be passed the NgZone option");u&&e.Router&&!e.NavigationStart&&console.warn("single-spa-angular must be passed the NavigationStart option");return{bootstrap:l.bind(null,e),mount:c.bind(null,e),unmount:g.bind(null,e),update:e.updateFunction}}});class s extends r{constructor(){super(...arguments),this.skipNextPopState=!1,this.source="Window.addEventListener:popstate"}pushState(t,e,n){this.skipNextPopState=!0,super.pushState(t,e,n)}replaceState(t,e,n){this.skipNextPopState=!0,super.replaceState(t,e,n)}onPopState(t){const e=Zone.current;t=e.wrap(t,this.source);return super.onPopState(e=>{const n=!!e.singleSpa;this.skipNextPopState&&n?this.skipNextPopState=!1:t(e)})}}s.\u0275fac=function(){let t;return function(n){return(t||(t=e.\u0275\u0275getInheritedFactory(s)))(n||s)}}(),s.\u0275prov=e.\u0275\u0275defineInjectable({token:s,factory:s.\u0275fac});const p={NgZone:null,bootstrapFunction:null,template:null,Router:void 0,domElementGetter:void 0,updateFunction:()=>Promise.resolve(),bootstrappedNgModuleRefOrAppRef:null},u=!1;async function l(t,e){"noop"!==t.NgZone&&(t.zoneIdentifier=`single-spa-angular:${e.name||e.appName}`,t.NgZone.isInAngularZone=()=>!0===window.Zone.current._properties[t.zoneIdentifier],t.routingEventListener=()=>{t.bootstrappedNgZone.run(()=>{})})}async function c(t,e){o(t,e);const n=t.bootstrapFunction(e);if(u&&!(n instanceof Promise))throw Error(`single-spa-angular: the options.bootstrapFunction must return a promise, but instead returned a '${typeof n}' that is not a Promise`);const r=await n;if(u&&(!r||"function"!=typeof r.destroy))throw Error("single-spa-angular: the options.bootstrapFunction returned a promise that did not resolve with a valid Angular module or ApplicationRef. Did you call platformBrowserDynamic().bootstrapModule() correctly?");const i=r.injector.get(s,null),a="noop"!==t.NgZone;if(u&&a&&t.Router&&null===i)throw new Error("\n      single-spa-angular: could not retrieve extra providers from the platform injector. Did you call platformBrowserDynamic(getSingleSpaExtraProviders()).bootstrapModule()?\n    ");const p=t;if(a){const e=r.injector.get(t.NgZone),n=p.zoneIdentifier;null!==i&&function(t,e){if(!e.NavigationStart)return;const n=t.injector.get(e.Router),o=n.events.subscribe(t=>{if(t instanceof e.NavigationStart){const t=n.getCurrentNavigation();"imperative"!==t.trigger&&(t.extras.skipLocationChange=!0,t.extras.replaceUrl=!1)}});t.onDestroy(()=>{o.unsubscribe()})}(r,t),p.bootstrappedNgZone=e,p.bootstrappedNgZone._inner._properties[n]=!0,window.addEventListener("single-spa:routing-event",p.routingEventListener)}return p.bootstrappedNgModuleRefOrAppRef=r,r}function g(t){return Promise.resolve().then(()=>{t.routingEventListener&&window.removeEventListener("single-spa:routing-event",t.routingEventListener),t.bootstrappedNgModuleRefOrAppRef.destroy(),t.bootstrappedNgModuleRefOrAppRef=null})}}}});
