UNPKG

single-spa

Version:

The router for easy microfrontends

4 lines (3 loc) 21.5 kB
/* single-spa@6.0.3 - UMD ES5 - prod */ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).singleSpa={})}(this,(function(t){"use strict";var n=Object.freeze({__proto__:null,get start(){return kt},get ensureJQuerySupport(){return dt},get setBootstrapMaxTime(){return V},get setMountMaxTime(){return q},get setUnmountMaxTime(){return z},get setUnloadMaxTime(){return X},get registerApplication(){return _t},get unregisterApplication(){return Dt},get getMountedApps(){return bt},get getAppStatus(){return Nt},get unloadApplication(){return Mt},get checkActivityFunctions(){return Ut},get getAppNames(){return At},get pathToActiveWhen(){return Rt},get navigateToUrl(){return it},get patchHistoryApi(){return pt},get triggerAppChange(){return Bt},get addErrorHandler(){return c},get removeErrorHandler(){return s},get mountRootParcel(){return k},get NOT_LOADED(){return p},get LOADING_SOURCE_CODE(){return h},get NOT_BOOTSTRAPPED(){return m},get BOOTSTRAPPING(){return d},get NOT_MOUNTED(){return v},get MOUNTING(){return w},get UPDATING(){return y},get LOAD_ERROR(){return T},get MOUNTED(){return g},get UNLOADING(){return O},get UNMOUNTING(){return E},get SKIP_BECAUSE_BROKEN(){return P}});function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}var o=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).CustomEvent,i=function(){try{var t=new o("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?o:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,n){var e=document.createEvent("CustomEvent");return n?e.initCustomEvent(t,n.bubbles,n.cancelable,n.detail):e.initCustomEvent(t,!1,!1,void 0),e}:function(t,n){var e=document.createEventObject();return e.type=t,n?(e.bubbles=Boolean(n.bubbles),e.cancelable=Boolean(n.cancelable),e.detail=n.detail):(e.bubbles=!1,e.cancelable=!1,e.detail=void 0),e},u=[];function a(t,n,e){var r=l(t,n,e);u.length?u.forEach((function(t){return t(r)})):setTimeout((function(){throw r}))}function c(t){if("function"!=typeof t)throw Error(f(28,!1));u.push(t)}function s(t){if("function"!=typeof t)throw Error(f(29,!1));var n=!1;return u=u.filter((function(e){var r=e===t;return n=n||r,!r})),n}function f(t,n){for(var e=arguments.length,r=new Array(e>2?e-2:0),o=2;o<e;o++)r[o-2]=arguments[o];return"single-spa minified message #".concat(t,": ").concat(n?n+" ":"","See https://single-spa.js.org/error/?code=").concat(t).concat(r.length?"&arg=".concat(r.join("&arg=")):"")}function l(t,n,e){var r,o="".concat(_(n)," '").concat(N(n),"' died in status ").concat(n.status,": ");if(t instanceof Error){try{t.message=o+t.message}catch(t){}r=t}else{console.warn(f(30,!1,n.status,N(n)));try{r=Error(o+JSON.stringify(t))}catch(n){r=t}}return r.appOrParcelName=N(n),n.status=e,r}var p="NOT_LOADED",h="LOADING_SOURCE_CODE",m="NOT_BOOTSTRAPPED",d="BOOTSTRAPPING",v="NOT_MOUNTED",w="MOUNTING",g="MOUNTED",y="UPDATING",E="UNMOUNTING",O="UNLOADING",T="LOAD_ERROR",P="SKIP_BECAUSE_BROKEN";function b(t){return t.status===g}function A(t){try{return t.activeWhen(window.location)}catch(n){return a(n,t,P),!1}}function N(t){return t.name}function S(t){return Boolean(t.unmountThisParcel)}function _(t){return S(t)?"parcel":"application"}function U(){for(var t=arguments.length-1;t>0;t--)for(var n in arguments[t])"__proto__"!==n&&(arguments[t-1][n]=arguments[t][n]);return arguments[0]}function D(t,n){for(var e=0;e<t.length;e++)if(n(t[e]))return t[e];return null}function M(t){return t&&("function"==typeof t||(n=t,Array.isArray(n)&&!D(n,(function(t){return"function"!=typeof t}))));var n}function j(t,n){var e=t[n]||[];0===(e=Array.isArray(e)?e:[e]).length&&(e=[function(){return Promise.resolve()}]);var r=_(t),o=N(t);return function(t){return e.reduce((function(e,i,u){return e.then((function(){var e=i(t);return L(e)?e:Promise.reject(f(15,!1,r,o,n,u))}))}),Promise.resolve())}}function L(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}var R=[];function I(t,n){return Promise.resolve().then((function(){return t.status!==m?t:(t.status=d,t.bootstrap?Y(t,"bootstrap").then(e).catch((function(e){if(n)throw l(e,t,P);return a(e,t,P),t})):Promise.resolve().then(e))}));function e(){return t.status=v,t}}function x(t,n){return Promise.resolve().then((function(){if(t.status!==g)return t;t.status=E;var e=Object.keys(t.parcels).map((function(n){return t.parcels[n].unmountThisParcel()}));return Promise.all(e).then(r,(function(e){return r().then((function(){var r=Error(e.message);if(n)throw l(r,t,P);a(r,t,P)}))})).then((function(){return t}));function r(){return Y(t,"unmount").then((function(){t.status=v}),(function(e){if(n)throw l(e,t,P);a(e,t,P)}))}}))}var G=!1,B=!1;function C(t,n){return Promise.resolve().then((function(){return t.status!==v?t:(G||(window.dispatchEvent(new i("single-spa:before-first-mount")),G=!0),t.status=w,Y(t,"mount").then((function(){return t.status=g,B||(window.dispatchEvent(new i("single-spa:first-mount")),B=!0),t})).catch((function(e){return t.status=g,x(t,!0).then(r,r);function r(){if(n)throw l(e,t,P);return a(e,t,P),t}})))}))}var W=0,$={parcels:{}};function k(){return H.apply($,arguments)}function H(t,n){var r=this;if(!t||"object"!==e(t)&&"function"!=typeof t)throw Error(f(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(f(3,!1,e(t.name)));var o=W++,i=t.name||"parcel-".concat(o);if("object"!==e(n))throw Error(f(4,!1,i,e(n)));if(!n.domElement)throw Error(f(5,!1,i));var u,a="function"==typeof t,c=a?t:function(){return Promise.resolve(t)},s={id:o,parcels:{},status:a?h:m,customProps:n,parentName:N(r),unmountThisParcel:function(){return O.then((function(){if(s.status!==g)throw Error(f(6,!1,i,s.status));return x(s,!0)})).then((function(t){return s.parentName&&delete r.parcels[s.id],t})).then((function(t){return d(t),t})).catch((function(t){throw s.status=P,w(t),t}))}};r.parcels[o]=s;var p=c();if(!p||"function"!=typeof p.then)throw Error(f(7,!1));var d,w,E=(p=p.then((function(t){if(!t)throw Error(f(8,!1));if(i=t.name||"parcel-".concat(o),Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!M(t.bootstrap))throw Error(f(9,!1,i));if(!M(t.mount))throw Error(f(10,!1,i));if(!M(t.unmount))throw Error(f(11,!1,i));if(t.update&&!M(t.update))throw Error(f(12,!1,i));var n=j(t,"bootstrap"),e=j(t,"mount"),r=j(t,"unmount");s.status=m,s.name=i,s.bootstrap=n,s.mount=e,s.unmount=r,s.timeouts=Z(t.timeouts),t.update&&(s.update=j(t,"update"),u.update=function(t){return s.customProps=t,K((n=s,Promise.resolve().then((function(){if(n.status!==g)throw Error(f(32,!1,N(n)));return n.status=y,Y(n,"update").then((function(){return n.status=g,n})).catch((function(t){throw l(t,n,P)}))}))));var n})}))).then((function(){return I(s,!0)})),O=E.then((function(){return C(s,!0)})),T=new Promise((function(t,n){d=t,w=n}));return u={mount:function(){return K(Promise.resolve().then((function(){if(s.status!==v)throw Error(f(13,!1,i,s.status));return r.parcels[o]=s,C(s)})))},unmount:function(){return K(s.unmountThisParcel())},getStatus:function(){return s.status},loadPromise:K(p),bootstrapPromise:K(E),mountPromise:K(O),unmountPromise:K(T)}}function K(t){return t.then((function(){return null}))}function F(t){var r=N(t),o="function"==typeof t.customProps?t.customProps(r,window.location):t.customProps;("object"!==e(o)||null===o||Array.isArray(o))&&(o={},console.warn(f(40,!1),r,o));var i=U({},o,{name:r,mountParcel:H.bind(t),singleSpa:n});return S(t)&&(i.unmountSelf=t.unmountThisParcel),i}var J=1e3,Q={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:J},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:J},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:J},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:J},update:{millis:3e3,dieOnTimeout:!1,warningMillis:J}};function V(t,n,e){if("number"!=typeof t||t<=0)throw Error(f(16,!1));Q.bootstrap={millis:t,dieOnTimeout:n,warningMillis:e||J}}function q(t,n,e){if("number"!=typeof t||t<=0)throw Error(f(17,!1));Q.mount={millis:t,dieOnTimeout:n,warningMillis:e||J}}function z(t,n,e){if("number"!=typeof t||t<=0)throw Error(f(18,!1));Q.unmount={millis:t,dieOnTimeout:n,warningMillis:e||J}}function X(t,n,e){if("number"!=typeof t||t<=0)throw Error(f(19,!1));Q.unload={millis:t,dieOnTimeout:n,warningMillis:e||J}}function Y(t,n){var e=t.timeouts[n],r=e.warningMillis,o=_(t);return new Promise((function(i,u){var a=!1,c=!1;t[n](F(t)).then((function(t){a=!0,i(t)})).catch((function(t){a=!0,u(t)})),setTimeout((function(){return l(1)}),r),setTimeout((function(){return l(!0)}),e.millis);var s=f(31,!1,n,o,N(t),e.millis);function l(t){if(!a)if(!0===t)c=!0,e.dieOnTimeout?u(Error(s)):console.error(s);else if(!c){var n=t,o=n*r;console.warn(s),o+r<e.millis&&setTimeout((function(){return l(n+1)}),r)}}}))}function Z(t){var n={};for(var e in Q)n[e]=U({},Q[e],t&&t[e]||{});return n}function tt(t){return Promise.resolve().then((function(){return t.loadPromise?t.loadPromise:t.status!==p&&t.status!==T?t:(t.status=h,t.loadPromise=Promise.resolve().then((function(){var o=t.loadApp(F(t));if(!L(o))throw r=!0,Error(f(33,!1,N(t)));return o.then((function(r){var o;t.loadErrorTime=null,"object"!==e(n=r)&&(o=34),Object.prototype.hasOwnProperty.call(n,"bootstrap")&&!M(n.bootstrap)&&(o=35),M(n.mount)||(o=36),M(n.unmount)||(o=37);var i=_(n);if(o){var u;try{u=JSON.stringify(n)}catch(t){}return console.error(f(o,!1,i,N(t),u),n),a(void 0,t,P),t}return n.devtools&&n.devtools.overlays&&(t.devtools.overlays=U({},t.devtools.overlays,n.devtools.overlays)),t.status=m,t.bootstrap=j(n,"bootstrap"),t.mount=j(n,"mount"),t.unmount=j(n,"unmount"),t.unload=j(n,"unload"),t.timeouts=Z(n.timeouts),delete t.loadPromise,t}))})).catch((function(n){var e;return delete t.loadPromise,r?e=P:(e=T,t.loadErrorTime=(new Date).getTime()),a(n,t,e),t})));var n,r}))}var nt,et="undefined"!=typeof window,rt={hashchange:[],popstate:[]},ot=["hashchange","popstate"];function it(t){var n;if("string"==typeof t)n=t;else if(this&&this.href)n=this.href;else{if(!(t&&t.currentTarget&&t.currentTarget.href&&t.preventDefault))throw Error(f(14,!1));n=t.currentTarget.href,t.preventDefault()}var e=ht(window.location.href),r=ht(n);0===n.indexOf("#")?window.location.hash=r.hash:e.host!==r.host&&r.host?window.location.href=n:r.pathname===e.pathname&&r.search===e.search?window.location.hash=r.hash:window.history.pushState(null,null,n)}function ut(t){var n=this;if(t){var e=t[0].type;ot.indexOf(e)>=0&&rt[e].forEach((function(e){try{e.apply(n,t)}catch(t){setTimeout((function(){throw t}))}}))}}function at(){Ct([],arguments)}function ct(t,n){return function(){var e=window.location.href,r=t.apply(this,arguments),o=window.location.href;return nt&&e===o||window.dispatchEvent(st(window.history.state,n)),r}}function st(t,n){var e;try{e=new PopStateEvent("popstate",{state:t})}catch(n){(e=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,t)}return e.singleSpa=!0,e.singleSpaTrigger=n,e}var ft=null,lt=!1;function pt(t){if(lt)throw Error(f(43,!1));nt=!t||!t.hasOwnProperty("urlRerouteOnly")||t.urlRerouteOnly,lt=!0,ft=window.history.replaceState,window.addEventListener("hashchange",at),window.addEventListener("popstate",at);var n=window.addEventListener,e=window.removeEventListener;window.addEventListener=function(t,e){if(!("function"==typeof e&&ot.indexOf(t)>=0)||D(rt[t],(function(t){return t===e})))return n.apply(this,arguments);rt[t].push(e)},window.removeEventListener=function(t,n){return"function"==typeof n&&ot.indexOf(t)>=0&&(rt[t]=rt[t].filter((function(t){return t!==n}))),e.apply(this,arguments)},window.history.pushState=ct(window.history.pushState,"pushState"),window.history.replaceState=ct(ft,"replaceState")}function ht(t){var n=document.createElement("a");return n.href=t,n}et&&(window.singleSpaNavigate?console.warn(f(41,!1)):window.singleSpaNavigate=it);var mt=!1;function dt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.jQuery;if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!mt){var n=t.fn.on,e=t.fn.off;t.fn.on=function(t,e){return vt.call(this,n,window.addEventListener,t,e,arguments)},t.fn.off=function(t,n){return vt.call(this,e,window.removeEventListener,t,n,arguments)},mt=!0}}function vt(t,n,e,r,o){return"string"!=typeof e?t.apply(this,o):(e.split(/\s+/).forEach((function(t){ot.indexOf(t)>=0&&(n(t,r),e=e.replace(t,""))})),""===e.trim()?this:t.apply(this,o))}var wt={};function gt(t){return Promise.resolve().then((function(){var n=wt[N(t)];if(!n)return t;if(t.status===p)return yt(t,n),t;if(t.status===O)return n.promise.then((function(){return t}));if(t.status!==v&&t.status!==T)return t;var e=t.status===T?Promise.resolve():Y(t,"unload");return t.status=O,e.then((function(){return yt(t,n),t})).catch((function(e){return function(t,n,e){delete wt[N(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,a(e,t,P),n.reject(e)}(t,n,e),t}))}))}function yt(t,n){delete wt[N(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=p,n.resolve()}function Et(t,n,e,r){wt[N(t)]={app:t,resolve:e,reject:r},Object.defineProperty(wt[N(t)],"promise",{get:n})}function Ot(t){return wt[t]}var Tt=[];function Pt(){var t=[],n=[],e=[],r=[],o=(new Date).getTime();return Tt.forEach((function(i){var u=i.status!==P&&A(i);switch(i.status){case T:u&&o-i.loadErrorTime>=200&&e.push(i);break;case p:case h:u&&e.push(i);break;case m:case v:!u&&Ot(N(i))?t.push(i):u&&r.push(i);break;case g:u||n.push(i)}})),{appsToUnload:t,appsToUnmount:n,appsToLoad:e,appsToMount:r}}function bt(){return Tt.filter(b).map(N)}function At(){return Tt.map(N)}function Nt(t){var n=D(Tt,(function(n){return N(n)===t}));return n?n.status:null}var St=!1;function _t(t,n,r,o){var i=function(t,n,r,o){var i,u={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"===e(t)?(function(t){if(Array.isArray(t)||null===t)throw Error(f(39,!1));var n=["name","app","activeWhen","customProps"],r=Object.keys(t).reduce((function(t,e){return n.indexOf(e)>=0?t:t.concat(e)}),[]);if(0!==r.length)throw Error(f(38,!1,n.join(", "),r.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(f(20,!1));if("object"!==e(t.app)&&"function"!=typeof t.app)throw Error(f(20,!1));var o=function(t){return"string"==typeof t||"function"==typeof t};if(!(o(t.activeWhen)||Array.isArray(t.activeWhen)&&t.activeWhen.every(o)))throw Error(f(24,!1));if(!Lt(t.customProps))throw Error(f(22,!1))}(t),u.name=t.name,u.loadApp=t.app,u.activeWhen=t.activeWhen,u.customProps=t.customProps):(function(t,n,e,r){if("string"!=typeof t||0===t.length)throw Error(f(20,!1));if(!n)throw Error(f(23,!1));if("function"!=typeof e)throw Error(f(24,!1));if(!Lt(r))throw Error(f(22,!1))}(t,n,r,o),u.name=t,u.loadApp=n,u.activeWhen=r,u.customProps=o),u.loadApp="function"!=typeof(i=u.loadApp)?function(){return Promise.resolve(i)}:i,u.customProps=function(t){return t||{}}(u.customProps),u.activeWhen=function(t){var n=Array.isArray(t)?t:[t];return n=n.map((function(t){return"function"==typeof t?t:Rt(t)})),function(t){return n.some((function(n){return n(t)}))}}(u.activeWhen),u}(t,n,r,o);if(Ht()||St||(St=!0,setTimeout((function(){Ht()||console.warn(f(1,!1))}),5e3)),-1!==At().indexOf(i.name))throw Error(f(21,!1,i.name));Tt.push(U({loadErrorTime:null,status:p,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},i)),et&&(dt(),Ct())}function Ut(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location;return Tt.filter((function(n){return n.activeWhen(t)})).map(N)}function Dt(t){if(0===Tt.filter((function(n){return N(n)===t})).length)throw Error(f(25,!1,t));return(et?Mt(t,{waitForUnmount:!1}):Promise.resolve()).then((function(){var n=Tt.map(N).indexOf(t);Tt.splice(n,1)}))}function Mt(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{waitForUnmount:!1};if("string"!=typeof t)throw Error(f(26,!1));var e=D(Tt,(function(n){return N(n)===t}));if(!e)throw Error(f(27,!1,t));var r,o=Ot(N(e));if(n&&n.waitForUnmount){if(o)return o.promise;var i=new Promise((function(t,n){Et(e,(function(){return i}),t,n)}));return i}return o?(r=o.promise,jt(e,o.resolve,o.reject)):r=new Promise((function(t,n){Et(e,(function(){return r}),t,n),jt(e,t,n)})),r}function jt(t,n,e){Promise.resolve().then((function(){if(D(Ut(),(function(n){return n===N(t)})))return Bt()})).then((function(){return x(t).then(gt).then((function(){n(),setTimeout((function(){Ct()}))}))})).catch(e)}function Lt(t){return!t||"function"==typeof t||"object"===e(t)&&null!==t&&!Array.isArray(t)}function Rt(t,n){var e=function(t,n){var e=0,r=!1,o="^";"/"!==t[0]&&(t="/"+t);for(var i=0;i<t.length;i++){var u=t[i];(!r&&":"===u||r&&"/"===u)&&a(i)}return a(t.length),new RegExp(o,"i");function a(i){var u=t.slice(e,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=r?"[^/]+/?":u,i===t.length)if(r)n&&(o+="$");else{var a=n?"":".*";o="/"===o.charAt(o.length-1)?"".concat(o).concat(a,"$"):"".concat(o,"(/").concat(a,")?(#.*)?$")}r=!r,e=i}}(t,n);return function(t){var n=t.origin;n||(n="".concat(t.protocol,"//").concat(t.host));var r=t.href.replace(n,"").replace(t.search,"").split("?")[0];return e.test(r)}}var It=!1,xt=[],Gt=et&&window.location.href;function Bt(){return Ct()}function Ct(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,e=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(It)return new Promise((function(t,e){xt.push({resolve:t,reject:e,eventArguments:n})}));var o,u=Pt(),a=u.appsToUnload,c=u.appsToUnmount,s=u.appsToLoad,l=u.appsToMount,h=[],m=Gt,d=Gt=window.location.href;return Ht()?(It=!0,o=a.concat(s,c,l),E()):(o=s,y());function w(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n="function"==typeof(null==t?void 0:t.then)?t:Promise.resolve(t);h.push(n.catch((function(t){return console.warn(Error(f(42,!1))),console.warn(t),!1})))}function y(){return Promise.resolve().then((function(){var t=s.map(tt);return Promise.all(t).then(T).then((function(){return[]})).catch((function(t){throw T(),t})).finally((function(){}))}))}function E(){return Promise.resolve().then((function(){return A(0===o.length?"before-no-app-change":"before-app-change",b(!0)),A("before-routing-event",b(!0,{cancelNavigation:w})),Promise.all(h).then((function(e){if(e.some((function(t){return t})))return ft.call(window.history,history.state,"",m.substring(location.origin.length)),Gt=location.href,It=!1,Ct(t,n,!0);var r=a.map(gt),o=c.map(x).map((function(t){return t.then(gt)})).concat(r),i=Promise.all(o);i.then((function(){A("before-mount-routing-event",b(!0))}),(function(t){throw t}));var u=s.map((function(t){return tt(t).then((function(t){return Wt(t,i)}))})),f=l.filter((function(t){return s.indexOf(t)<0})).map((function(t){return Wt(t,i)}));return i.catch((function(t){throw T(),t})).then((function(){return T(),Promise.all(u.concat(f)).catch((function(n){throw t.forEach((function(t){return t.reject(n)})),n})).then(O).then((function(){}),(function(t){throw t}))}))}))}))}function O(){var n=bt();t.forEach((function(t){return t.resolve(n)}));try{A(0===o.length?"no-app-change":"app-change",b()),A("routing-event",b())}catch(t){setTimeout((function(){throw t}))}if(It=!1,xt.length>0){var e=xt;xt=[],Ct(e)}return n}function T(){e||(t.forEach((function(t){ut(t.eventArguments)})),ut(n))}function b(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1?arguments[1]:void 0,u={},f=(r(t={},g,[]),r(t,v,[]),r(t,p,[]),r(t,P,[]),t);e?(s.concat(l).forEach((function(t,n){w(t,g)})),a.forEach((function(t){w(t,p)})),c.forEach((function(t){w(t,v)}))):o.forEach((function(t){w(t)}));var h={detail:{newAppStatuses:u,appsByNewStatus:f,totalAppChanges:o.length,originalEvent:null==n?void 0:n[0],oldUrl:m,newUrl:d}};return i&&U(h.detail,i),h;function w(t,n){var e=N(t);n=n||Nt(e),u[e]=n,(f[n]=f[n]||[]).push(e)}}function A(t,n){e||window.dispatchEvent(new i("single-spa:".concat(t),n))}}function Wt(t,n){return A(t)?I(t).then((function(t){return n.then((function(){return A(t)?C(t):t}))})):n.then((function(){return t}))}var $t=!1;function kt(t){$t=!0,et&&(pt(t),Ct())}function Ht(){return $t}var Kt={getRawAppData:function(){return[].concat(Tt)},reroute:Ct,NOT_LOADED:p,toLoadPromise:tt,toBootstrapPromise:I,unregisterApplication:Dt,getProfilerData:function(){return R}};et&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=Kt),t.BOOTSTRAPPING=d,t.LOADING_SOURCE_CODE=h,t.LOAD_ERROR=T,t.MOUNTED=g,t.MOUNTING=w,t.NOT_BOOTSTRAPPED=m,t.NOT_LOADED=p,t.NOT_MOUNTED=v,t.SKIP_BECAUSE_BROKEN=P,t.UNLOADING=O,t.UNMOUNTING=E,t.UPDATING=y,t.addErrorHandler=c,t.checkActivityFunctions=Ut,t.ensureJQuerySupport=dt,t.getAppNames=At,t.getAppStatus=Nt,t.getMountedApps=bt,t.mountRootParcel=k,t.navigateToUrl=it,t.patchHistoryApi=pt,t.pathToActiveWhen=Rt,t.registerApplication=_t,t.removeErrorHandler=s,t.setBootstrapMaxTime=V,t.setMountMaxTime=q,t.setUnloadMaxTime=X,t.setUnmountMaxTime=z,t.start=kt,t.triggerAppChange=Bt,t.unloadApplication=Mt,t.unregisterApplication=Dt,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=single-spa.min.cjs.map