single-spa
Advanced tools
Comparing version 6.0.0-beta.1 to 6.0.0-beta.2
@@ -1,2 +0,2 @@ | ||
/* single-spa@6.0.0-beta.1 - ES2015 - dev */ | ||
/* single-spa@6.0.0-beta.2 - ES2015 - dev */ | ||
var singleSpa = /*#__PURE__*/Object.freeze({ | ||
@@ -328,2 +328,3 @@ __proto__: null, | ||
appOrParcel.status = MOUNTING; | ||
return reasonableTime(appOrParcel, "mount").then(() => { | ||
@@ -330,0 +331,0 @@ appOrParcel.status = MOUNTED; |
@@ -1,3 +0,3 @@ | ||
/* single-spa@6.0.0-beta.1 - ES2015 - prod */ | ||
var t=Object.freeze({__proto__:null,get start(){return Rt},get ensureJQuerySupport(){return ct},get setBootstrapMaxTime(){return k},get setMountMaxTime(){return K},get setUnmountMaxTime(){return F},get setUnloadMaxTime(){return H},get registerApplication(){return Pt},get unregisterApplication(){return Tt},get getMountedApps(){return gt},get getAppStatus(){return Et},get unloadApplication(){return bt},get checkActivityFunctions(){return Ot},get getAppNames(){return yt},get pathToActiveWhen(){return St},get navigateToUrl(){return Y},get patchHistoryApi(){return st},get triggerAppChange(){return Mt},get addErrorHandler(){return i},get removeErrorHandler(){return s},get mountRootParcel(){return I},get NOT_LOADED(){return c},get LOADING_SOURCE_CODE(){return l},get NOT_BOOTSTRAPPED(){return f},get BOOTSTRAPPING(){return p},get NOT_MOUNTED(){return h},get MOUNTING(){return m},get UPDATING(){return w},get LOAD_ERROR(){return y},get MOUNTED(){return d},get UNMOUNTING(){return g},get SKIP_BECAUSE_BROKEN(){return E}}),e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).CustomEvent,n=function(){try{var t=new e("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?e:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,e){var n=document.createEvent("CustomEvent");return e?n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail):n.initCustomEvent(t,!1,!1,void 0),n}:function(t,e){var n=document.createEventObject();return n.type=t,e?(n.bubbles=Boolean(e.bubbles),n.cancelable=Boolean(e.cancelable),n.detail=e.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n};let r=[];function o(t,e,n){const o=a(t,e,n);r.length?r.forEach((t=>t(o))):setTimeout((()=>{throw o}))}function i(t){if("function"!=typeof t)throw Error(u(28,!1));r.push(t)}function s(t){if("function"!=typeof t)throw Error(u(29,!1));let e=!1;return r=r.filter((n=>{const r=n===t;return e=e||r,!r})),e}function u(t,e,...n){return`single-spa minified message #${t}: ${e?e+" ":""}See https://single-spa.js.org/error/?code=${t}${n.length?`&arg=${n.join("&arg=")}`:""}`}function a(t,e,n){const r=`${b(e)} '${O(e)}' died in status ${e.status}: `;let o;if(t instanceof Error){try{t.message=r+t.message}catch(t){}o=t}else{console.warn(u(30,!1,e.status,O(e)));try{o=Error(r+JSON.stringify(t))}catch(e){o=t}}return o.appOrParcelName=O(e),e.status=n,o}const c="NOT_LOADED",l="LOADING_SOURCE_CODE",f="NOT_BOOTSTRAPPED",p="BOOTSTRAPPING",h="NOT_MOUNTED",m="MOUNTING",d="MOUNTED",w="UPDATING",g="UNMOUNTING",y="LOAD_ERROR",E="SKIP_BECAUSE_BROKEN";function v(t){return t.status===d}function P(t){try{return t.activeWhen(window.location)}catch(e){return o(e,t,E),!1}}function O(t){return t.name}function T(t){return Boolean(t.unmountThisParcel)}function b(t){return T(t)?"parcel":"application"}function A(){for(let t=arguments.length-1;t>0;t--)for(let e in arguments[t])"__proto__"!==e&&(arguments[t-1][e]=arguments[t][e]);return arguments[0]}function N(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return t[n];return null}function S(t){return t&&("function"==typeof t||(e=t,Array.isArray(e)&&!N(e,(t=>"function"!=typeof t))));var e}function _(t,e){let n=t[e]||[];n=Array.isArray(n)?n:[n],0===n.length&&(n=[()=>Promise.resolve()]);const r=b(t),o=O(t);return function(t){return n.reduce(((n,i,s)=>n.then((()=>{const n=i(t);return D(n)?n:Promise.reject(u(15,!1,r,o,e,s))}))),Promise.resolve())}}function D(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function U(t,e){return Promise.resolve().then((()=>t.status!==f?t:(t.status=p,t.bootstrap?J(t,"bootstrap").then(n).catch((n=>{if(e)throw a(n,t,E);return o(n,t,E),t})):Promise.resolve().then(n))));function n(){return t.status=h,t}}function M(t,e){return Promise.resolve().then((()=>{if(t.status!==d)return t;t.status=g;const n=Object.keys(t.parcels).map((e=>t.parcels[e].unmountThisParcel()));return Promise.all(n).then(r,(n=>r().then((()=>{const r=Error(n.message);if(e)throw a(r,t,E);o(r,t,E)})))).then((()=>t));function r(){return J(t,"unmount").then((()=>{t.status=h})).catch((n=>{if(e)throw a(n,t,E);o(n,t,E)}))}}))}let j=!1,$=!1;function L(t,e){return Promise.resolve().then((()=>t.status!==h?t:(j||(window.dispatchEvent(new n("single-spa:before-first-mount")),j=!0),J(t,"mount").then((()=>(t.status=d,$||(window.dispatchEvent(new n("single-spa:first-mount")),$=!0),t))).catch((n=>{return t.status=d,M(t,!0).then(r,r);function r(){if(e)throw a(n,t,E);return o(n,t,E),t}})))))}let R=0;const x={parcels:{}};function I(){return B.apply(x,arguments)}function B(t,e){const n=this;if(!t||"object"!=typeof t&&"function"!=typeof t)throw Error(u(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(u(3,!1,typeof t.name));const r=R++;let o=t.name||`parcel-${r}`;if("object"!=typeof e)throw Error(u(4,!1,o,typeof e));if(!e.domElement)throw Error(u(5,!1,o));const i="function"==typeof t,s=i?t:()=>Promise.resolve(t),c={id:r,parcels:{},status:i?l:f,customProps:e,parentName:O(n),unmountThisParcel:()=>y.then((()=>{if(c.status!==d)throw Error(u(6,!1,o,c.status));return M(c,!0)})).then((t=>(c.parentName&&delete n.parcels[c.id],t))).then((t=>(v(t),t))).catch((t=>{throw c.status=E,P(t),t}))};let p;n.parcels[r]=c;let m=s();if(!m||"function"!=typeof m.then)throw Error(u(7,!1));m=m.then((t=>{if(!t)throw Error(u(8,!1));if(o=t.name||`parcel-${r}`,Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!S(t.bootstrap))throw Error(u(9,!1,o));if(!S(t.mount))throw Error(u(10,!1,o));if(!S(t.unmount))throw Error(u(11,!1,o));if(t.update&&!S(t.update))throw Error(u(12,!1,o));const e=_(t,"bootstrap"),n=_(t,"mount"),i=_(t,"unmount");c.status=f,c.name=o,c.bootstrap=e,c.mount=n,c.unmount=i,c.timeouts=Q(t.timeouts),t.update&&(c.update=_(t,"update"),p.update=function(t){return c.customProps=t,G(function(t){return Promise.resolve().then((()=>{if(t.status!==d)throw Error(u(32,!1,O(t)));return t.status=w,J(t,"update").then((()=>(t.status=d,t))).catch((e=>{throw a(e,t,E)}))}))}(c))})}));const g=m.then((()=>U(c,!0))),y=g.then((()=>L(c,!0)));let v,P;const T=new Promise(((t,e)=>{v=t,P=e}));return p={mount:()=>G(Promise.resolve().then((()=>{if(c.status!==h)throw Error(u(13,!1,o,c.status));return n.parcels[r]=c,L(c)}))),unmount:()=>G(c.unmountThisParcel()),getStatus:()=>c.status,loadPromise:G(m),bootstrapPromise:G(g),mountPromise:G(y),unmountPromise:G(T)},p}function G(t){return t.then((()=>null))}function W(e){const n=O(e);let r="function"==typeof e.customProps?e.customProps(n,window.location):e.customProps;("object"!=typeof r||null===r||Array.isArray(r))&&(r={},console.warn(u(40,!1),n,r));const o=A({},r,{name:n,mountParcel:B.bind(e),singleSpa:t});return T(e)&&(o.unmountSelf=e.unmountThisParcel),o}const C={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:1e3},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},update:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3}};function k(t,e,n){if("number"!=typeof t||t<=0)throw Error(u(16,!1));C.bootstrap={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function K(t,e,n){if("number"!=typeof t||t<=0)throw Error(u(17,!1));C.mount={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function F(t,e,n){if("number"!=typeof t||t<=0)throw Error(u(18,!1));C.unmount={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function H(t,e,n){if("number"!=typeof t||t<=0)throw Error(u(19,!1));C.unload={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function J(t,e){const n=t.timeouts[e],r=n.warningMillis,o=b(t);return new Promise(((i,s)=>{let a=!1,c=!1;t[e](W(t)).then((t=>{a=!0,i(t)})).catch((t=>{a=!0,s(t)})),setTimeout((()=>f(1)),r),setTimeout((()=>f(!0)),n.millis);const l=u(31,!1,e,o,O(t),n.millis);function f(t){if(!a)if(!0===t)c=!0,n.dieOnTimeout?s(Error(l)):console.error(l);else if(!c){const e=t,o=e*r;console.warn(l),o+r<n.millis&&setTimeout((()=>f(e+1)),r)}}}))}function Q(t){const e={};for(let n in C)e[n]=A({},C[n],t&&t[n]||{});return e}function V(t){return Promise.resolve().then((()=>{if(t.loadPromise)return t.loadPromise;if(t.status!==c&&t.status!==y)return t;let e,n;return t.status=l,t.loadPromise=Promise.resolve().then((()=>{const r=t.loadApp(W(t));if(!D(r))throw n=!0,Error(u(33,!1,O(t)));return r.then((n=>{let r;t.loadErrorTime=null,e=n,"object"!=typeof e&&(r=34),Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!S(e.bootstrap)&&(r=35),S(e.mount)||(r=36),S(e.unmount)||(r=37);const i=b(e);if(r){let n;try{n=JSON.stringify(e)}catch(t){}return console.error(u(r,!1,i,O(t),n),e),o(void 0,t,E),t}return e.devtools&&e.devtools.overlays&&(t.devtools.overlays=A({},t.devtools.overlays,e.devtools.overlays)),t.status=f,t.bootstrap=_(e,"bootstrap"),t.mount=_(e,"mount"),t.unmount=_(e,"unmount"),t.unload=_(e,"unload"),t.timeouts=Q(e.timeouts),delete t.loadPromise,t}))})).catch((e=>{let r;return delete t.loadPromise,n?r=E:(r=y,t.loadErrorTime=(new Date).getTime()),o(e,t,r),t}))}))}const q="undefined"!=typeof window,z={hashchange:[],popstate:[]},X=["hashchange","popstate"];function Y(t){let e;if("string"==typeof t)e=t;else if(this&&this.href)e=this.href;else{if(!(t&&t.currentTarget&&t.currentTarget.href&&t.preventDefault))throw Error(u(14,!1));e=t.currentTarget.href,t.preventDefault()}const n=ut(window.location.href),r=ut(e);0===e.indexOf("#")?window.location.hash=r.hash:n.host!==r.host&&r.host?window.location.href=e:r.pathname===n.pathname&&r.search===n.search?window.location.hash=r.hash:window.history.pushState(null,null,e)}function Z(t){if(t){const e=t[0].type;X.indexOf(e)>=0&&z[e].forEach((e=>{try{e.apply(this,t)}catch(t){setTimeout((()=>{throw t}))}}))}}let tt;function et(){jt([],arguments)}function nt(t,e){return function(){const n=window.location.href,r=t.apply(this,arguments),o=window.location.href;return tt&&n===o||window.dispatchEvent(rt(window.history.state,e)),r}}function rt(t,e){let n;try{n=new PopStateEvent("popstate",{state:t})}catch(e){n=document.createEvent("PopStateEvent"),n.initPopStateEvent("popstate",!1,!1,t)}return n.singleSpa=!0,n.singleSpaTrigger=e,n}let ot=null,it=!1;function st(t){if(it)throw Error(u(43,!1));tt=!t||!t.hasOwnProperty("urlRerouteOnly")||t.urlRerouteOnly,it=!0,ot=window.history.replaceState,window.addEventListener("hashchange",et),window.addEventListener("popstate",et);const e=window.addEventListener,n=window.removeEventListener;window.addEventListener=function(t,n){if(!("function"==typeof n&&X.indexOf(t)>=0)||N(z[t],(t=>t===n)))return e.apply(this,arguments);z[t].push(n)},window.removeEventListener=function(t,e){if(!("function"==typeof e&&X.indexOf(t)>=0))return n.apply(this,arguments);z[t]=z[t].filter((t=>t!==e))},window.history.pushState=nt(window.history.pushState,"pushState"),window.history.replaceState=nt(ot,"replaceState")}function ut(t){const e=document.createElement("a");return e.href=t,e}q&&(window.singleSpaNavigate?console.warn(u(41,!1)):window.singleSpaNavigate=Y);let at=!1;function ct(t=window.jQuery){if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!at){const e=t.fn.on,n=t.fn.off;t.fn.on=function(t,n){return lt.call(this,e,window.addEventListener,t,n,arguments)},t.fn.off=function(t,e){return lt.call(this,n,window.removeEventListener,t,e,arguments)},at=!0}}function lt(t,e,n,r,o){return"string"!=typeof n?t.apply(this,o):(n.split(/\s+/).forEach((t=>{X.indexOf(t)>=0&&(e(t,r),n=n.replace(t,""))})),""===n.trim()?this:t.apply(this,o))}const ft={};function pt(t){return Promise.resolve().then((()=>{const e=ft[O(t)];if(!e)return t;if(t.status===c)return ht(t,e),t;if("UNLOADING"===t.status)return e.promise.then((()=>t));if(t.status!==h&&t.status!==y)return t;const n=t.status===y?Promise.resolve():J(t,"unload");return t.status="UNLOADING",n.then((()=>(ht(t,e),t))).catch((n=>(function(t,e,n){delete ft[O(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,o(n,t,E),e.reject(n)}(t,e,n),t)))}))}function ht(t,e){delete ft[O(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=c,e.resolve()}function mt(t,e,n,r){ft[O(t)]={app:t,resolve:n,reject:r},Object.defineProperty(ft[O(t)],"promise",{get:e})}function dt(t){return ft[t]}const wt=[];function gt(){return wt.filter(v).map(O)}function yt(){return wt.map(O)}function Et(t){const e=N(wt,(e=>O(e)===t));return e?e.status:null}let vt=!1;function Pt(t,e,n,r){const o=function(t,e,n,r){const o={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"==typeof t?(function(t){if(Array.isArray(t)||null===t)throw Error(u(39,!1));const e=["name","app","activeWhen","customProps"],n=Object.keys(t).reduce(((t,n)=>e.indexOf(n)>=0?t:t.concat(n)),[]);if(0!==n.length)throw Error(u(38,!1,e.join(", "),n.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(u(20,!1));if("object"!=typeof t.app&&"function"!=typeof t.app)throw Error(u(20,!1));const r=t=>"string"==typeof t||"function"==typeof t;if(!(r(t.activeWhen)||Array.isArray(t.activeWhen)&&t.activeWhen.every(r)))throw Error(u(24,!1));if(!Nt(t.customProps))throw Error(u(22,!1))}(t),o.name=t.name,o.loadApp=t.app,o.activeWhen=t.activeWhen,o.customProps=t.customProps):(function(t,e,n,r){if("string"!=typeof t||0===t.length)throw Error(u(20,!1));if(!e)throw Error(u(23,!1));if("function"!=typeof n)throw Error(u(24,!1));if(!Nt(r))throw Error(u(22,!1))}(t,e,n,r),o.name=t,o.loadApp=e,o.activeWhen=n,o.customProps=r),o.loadApp="function"!=typeof(i=o.loadApp)?()=>Promise.resolve(i):i,o.customProps=function(t){return t||{}}(o.customProps),o.activeWhen=function(t){let e=Array.isArray(t)?t:[t];return e=e.map((t=>"function"==typeof t?t:St(t))),t=>e.some((e=>e(t)))}(o.activeWhen),o;var i}(t,e,n,r);if(xt()||vt||(vt=!0,setTimeout((()=>{xt()||console.warn(u(1,!1))}),5e3)),-1!==yt().indexOf(o.name))throw Error(u(21,!1,o.name));wt.push(A({loadErrorTime:null,status:c,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},o)),q&&(ct(),jt())}function Ot(t=window.location){return wt.filter((e=>e.activeWhen(t))).map(O)}function Tt(t){if(0===wt.filter((e=>O(e)===t)).length)throw Error(u(25,!1,t));return bt(t).then((()=>{const e=wt.map(O).indexOf(t);wt.splice(e,1)}))}function bt(t,e={waitForUnmount:!1}){if("string"!=typeof t)throw Error(u(26,!1));const n=N(wt,(e=>O(e)===t));if(!n)throw Error(u(27,!1,t));const r=dt(O(n));if(e&&e.waitForUnmount){if(r)return r.promise;{const t=new Promise(((e,r)=>{mt(n,(()=>t),e,r)}));return t}}{let t;return r?(t=r.promise,At(n,r.resolve,r.reject)):t=new Promise(((e,r)=>{mt(n,(()=>t),e,r),At(n,e,r)})),t}}function At(t,e,n){M(t).then(pt).then((()=>{e(),setTimeout((()=>{jt()}))})).catch(n)}function Nt(t){return!t||"function"==typeof t||"object"==typeof t&&null!==t&&!Array.isArray(t)}function St(t,e){const n=function(t,e){let n=0,r=!1,o="^";"/"!==t[0]&&(t="/"+t);for(let e=0;e<t.length;e++){const n=t[e],o=r&&"/"===n;(!r&&":"===n||o)&&i(e)}return i(t.length),new RegExp(o,"i");function i(i){const s=t.slice(n,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=r?"[^/]+/?":s,i===t.length)if(r)e&&(o+="$");else{const t=e?"":".*";o="/"===o.charAt(o.length-1)?`${o}${t}$`:`${o}(/${t})?(#.*)?$`}r=!r,n=i}}(t,e);return t=>{let e=t.origin;e||(e=`${t.protocol}//${t.host}`);const r=t.href.replace(e,"").replace(t.search,"").split("?")[0];return n.test(r)}}let _t=!1,Dt=[],Ut=q&&window.location.href;function Mt(){return jt()}function jt(t=[],e,r=!1){if(_t)return new Promise(((t,n)=>{Dt.push({resolve:t,reject:n,eventArguments:e})}));const{appsToUnload:o,appsToUnmount:i,appsToLoad:s,appsToMount:a}=function(){const t=[],e=[],n=[],r=[],o=(new Date).getTime();return wt.forEach((i=>{const s=i.status!==E&&P(i);switch(i.status){case y:s&&o-i.loadErrorTime>=200&&n.push(i);break;case c:case l:s&&n.push(i);break;case f:case h:!s&&dt(O(i))?t.push(i):s&&r.push(i);break;case d:s||e.push(i)}})),{appsToUnload:t,appsToUnmount:e,appsToLoad:n,appsToMount:r}}();let p,m=[],w=Ut,g=Ut=window.location.href;return xt()?(_t=!0,p=o.concat(s,i,a),Promise.resolve().then((()=>(S(0===p.length?"before-no-app-change":"before-app-change",N(!0)),S("before-routing-event",N(!0,{cancelNavigation:v})),Promise.all(m).then((n=>{if(n.some((t=>t)))return ot.call(window.history,history.state,"",w.substring(location.origin.length)),Ut=location.href,_t=!1,jt(t,e,!0);const r=o.map(pt),u=i.map(M).map((t=>t.then(pt))).concat(r),c=Promise.all(u);c.then((()=>{S("before-mount-routing-event",N(!0))}));const l=s.map((t=>V(t).then((t=>$t(t,c))))),f=a.filter((t=>s.indexOf(t)<0)).map((t=>$t(t,c)));return c.catch((t=>{throw b(),t})).then((()=>(b(),Promise.all(l.concat(f)).catch((e=>{throw t.forEach((t=>t.reject(e))),e})).then(T))))})))))):(p=s,Promise.resolve().then((()=>{const t=s.map(V);return Promise.all(t).then(b).then((()=>[])).catch((t=>{throw b(),t}))})));function v(t=!0){const e="function"==typeof(null==t?void 0:t.then)?t:Promise.resolve(t);m.push(e.catch((t=>(console.warn(Error(u(42,!1))),console.warn(t),!1))))}function T(){const e=gt();t.forEach((t=>t.resolve(e)));try{S(0===p.length?"no-app-change":"app-change",N()),S("routing-event",N())}catch(t){setTimeout((()=>{throw t}))}if(_t=!1,Dt.length>0){const t=Dt;Dt=[],jt(t)}return e}function b(){r||(t.forEach((t=>{Z(t.eventArguments)})),Z(e))}function N(t=!1,n){const r={},u={[d]:[],[h]:[],[c]:[],[E]:[]};t?(s.concat(a).forEach(((t,e)=>{f(t,d)})),o.forEach((t=>{f(t,c)})),i.forEach((t=>{f(t,h)}))):p.forEach((t=>{f(t)}));const l={detail:{newAppStatuses:r,appsByNewStatus:u,totalAppChanges:p.length,originalEvent:null==e?void 0:e[0],oldUrl:w,newUrl:g}};return n&&A(l.detail,n),l;function f(t,e){const n=O(t);e=e||Et(n),r[n]=e,(u[e]=u[e]||[]).push(n)}}function S(t,e){r||window.dispatchEvent(new n(`single-spa:${t}`,e))}}function $t(t,e){return P(t)?U(t).then((t=>e.then((()=>P(t)?L(t):t)))):e.then((()=>t))}let Lt=!1;function Rt(t){Lt=!0,q&&(st(t),jt())}function xt(){return Lt}var It={getRawAppData:function(){return[...wt]},reroute:jt,NOT_LOADED:c,toLoadPromise:V,toBootstrapPromise:U,unregisterApplication:Tt};q&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=It);export{p as BOOTSTRAPPING,l as LOADING_SOURCE_CODE,y as LOAD_ERROR,d as MOUNTED,m as MOUNTING,f as NOT_BOOTSTRAPPED,c as NOT_LOADED,h as NOT_MOUNTED,E as SKIP_BECAUSE_BROKEN,g as UNMOUNTING,w as UPDATING,i as addErrorHandler,Ot as checkActivityFunctions,ct as ensureJQuerySupport,yt as getAppNames,Et as getAppStatus,gt as getMountedApps,I as mountRootParcel,Y as navigateToUrl,st as patchHistoryApi,St as pathToActiveWhen,Pt as registerApplication,s as removeErrorHandler,k as setBootstrapMaxTime,K as setMountMaxTime,H as setUnloadMaxTime,F as setUnmountMaxTime,Rt as start,Mt as triggerAppChange,bt as unloadApplication,Tt as unregisterApplication}; | ||
/* single-spa@6.0.0-beta.2 - ES2015 - prod */ | ||
var t=Object.freeze({__proto__:null,get start(){return Rt},get ensureJQuerySupport(){return ct},get setBootstrapMaxTime(){return k},get setMountMaxTime(){return K},get setUnmountMaxTime(){return F},get setUnloadMaxTime(){return H},get registerApplication(){return Pt},get unregisterApplication(){return Tt},get getMountedApps(){return gt},get getAppStatus(){return Et},get unloadApplication(){return bt},get checkActivityFunctions(){return Ot},get getAppNames(){return yt},get pathToActiveWhen(){return St},get navigateToUrl(){return Y},get patchHistoryApi(){return st},get triggerAppChange(){return Mt},get addErrorHandler(){return i},get removeErrorHandler(){return s},get mountRootParcel(){return I},get NOT_LOADED(){return c},get LOADING_SOURCE_CODE(){return l},get NOT_BOOTSTRAPPED(){return f},get BOOTSTRAPPING(){return p},get NOT_MOUNTED(){return h},get MOUNTING(){return m},get UPDATING(){return w},get LOAD_ERROR(){return y},get MOUNTED(){return d},get UNMOUNTING(){return g},get SKIP_BECAUSE_BROKEN(){return E}}),e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).CustomEvent,n=function(){try{var t=new e("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?e:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,e){var n=document.createEvent("CustomEvent");return e?n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail):n.initCustomEvent(t,!1,!1,void 0),n}:function(t,e){var n=document.createEventObject();return n.type=t,e?(n.bubbles=Boolean(e.bubbles),n.cancelable=Boolean(e.cancelable),n.detail=e.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n};let r=[];function o(t,e,n){const o=a(t,e,n);r.length?r.forEach((t=>t(o))):setTimeout((()=>{throw o}))}function i(t){if("function"!=typeof t)throw Error(u(28,!1));r.push(t)}function s(t){if("function"!=typeof t)throw Error(u(29,!1));let e=!1;return r=r.filter((n=>{const r=n===t;return e=e||r,!r})),e}function u(t,e,...n){return`single-spa minified message #${t}: ${e?e+" ":""}See https://single-spa.js.org/error/?code=${t}${n.length?`&arg=${n.join("&arg=")}`:""}`}function a(t,e,n){const r=`${b(e)} '${O(e)}' died in status ${e.status}: `;let o;if(t instanceof Error){try{t.message=r+t.message}catch(t){}o=t}else{console.warn(u(30,!1,e.status,O(e)));try{o=Error(r+JSON.stringify(t))}catch(e){o=t}}return o.appOrParcelName=O(e),e.status=n,o}const c="NOT_LOADED",l="LOADING_SOURCE_CODE",f="NOT_BOOTSTRAPPED",p="BOOTSTRAPPING",h="NOT_MOUNTED",m="MOUNTING",d="MOUNTED",w="UPDATING",g="UNMOUNTING",y="LOAD_ERROR",E="SKIP_BECAUSE_BROKEN";function v(t){return t.status===d}function P(t){try{return t.activeWhen(window.location)}catch(e){return o(e,t,E),!1}}function O(t){return t.name}function T(t){return Boolean(t.unmountThisParcel)}function b(t){return T(t)?"parcel":"application"}function A(){for(let t=arguments.length-1;t>0;t--)for(let e in arguments[t])"__proto__"!==e&&(arguments[t-1][e]=arguments[t][e]);return arguments[0]}function N(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return t[n];return null}function S(t){return t&&("function"==typeof t||(e=t,Array.isArray(e)&&!N(e,(t=>"function"!=typeof t))));var e}function _(t,e){let n=t[e]||[];n=Array.isArray(n)?n:[n],0===n.length&&(n=[()=>Promise.resolve()]);const r=b(t),o=O(t);return function(t){return n.reduce(((n,i,s)=>n.then((()=>{const n=i(t);return D(n)?n:Promise.reject(u(15,!1,r,o,e,s))}))),Promise.resolve())}}function D(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function U(t,e){return Promise.resolve().then((()=>t.status!==f?t:(t.status=p,t.bootstrap?J(t,"bootstrap").then(n).catch((n=>{if(e)throw a(n,t,E);return o(n,t,E),t})):Promise.resolve().then(n))));function n(){return t.status=h,t}}function M(t,e){return Promise.resolve().then((()=>{if(t.status!==d)return t;t.status=g;const n=Object.keys(t.parcels).map((e=>t.parcels[e].unmountThisParcel()));return Promise.all(n).then(r,(n=>r().then((()=>{const r=Error(n.message);if(e)throw a(r,t,E);o(r,t,E)})))).then((()=>t));function r(){return J(t,"unmount").then((()=>{t.status=h})).catch((n=>{if(e)throw a(n,t,E);o(n,t,E)}))}}))}let j=!1,$=!1;function L(t,e){return Promise.resolve().then((()=>t.status!==h?t:(j||(window.dispatchEvent(new n("single-spa:before-first-mount")),j=!0),t.status=m,J(t,"mount").then((()=>(t.status=d,$||(window.dispatchEvent(new n("single-spa:first-mount")),$=!0),t))).catch((n=>{return t.status=d,M(t,!0).then(r,r);function r(){if(e)throw a(n,t,E);return o(n,t,E),t}})))))}let R=0;const x={parcels:{}};function I(){return B.apply(x,arguments)}function B(t,e){const n=this;if(!t||"object"!=typeof t&&"function"!=typeof t)throw Error(u(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(u(3,!1,typeof t.name));const r=R++;let o=t.name||`parcel-${r}`;if("object"!=typeof e)throw Error(u(4,!1,o,typeof e));if(!e.domElement)throw Error(u(5,!1,o));const i="function"==typeof t,s=i?t:()=>Promise.resolve(t),c={id:r,parcels:{},status:i?l:f,customProps:e,parentName:O(n),unmountThisParcel:()=>y.then((()=>{if(c.status!==d)throw Error(u(6,!1,o,c.status));return M(c,!0)})).then((t=>(c.parentName&&delete n.parcels[c.id],t))).then((t=>(v(t),t))).catch((t=>{throw c.status=E,P(t),t}))};let p;n.parcels[r]=c;let m=s();if(!m||"function"!=typeof m.then)throw Error(u(7,!1));m=m.then((t=>{if(!t)throw Error(u(8,!1));if(o=t.name||`parcel-${r}`,Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!S(t.bootstrap))throw Error(u(9,!1,o));if(!S(t.mount))throw Error(u(10,!1,o));if(!S(t.unmount))throw Error(u(11,!1,o));if(t.update&&!S(t.update))throw Error(u(12,!1,o));const e=_(t,"bootstrap"),n=_(t,"mount"),i=_(t,"unmount");c.status=f,c.name=o,c.bootstrap=e,c.mount=n,c.unmount=i,c.timeouts=Q(t.timeouts),t.update&&(c.update=_(t,"update"),p.update=function(t){return c.customProps=t,G(function(t){return Promise.resolve().then((()=>{if(t.status!==d)throw Error(u(32,!1,O(t)));return t.status=w,J(t,"update").then((()=>(t.status=d,t))).catch((e=>{throw a(e,t,E)}))}))}(c))})}));const g=m.then((()=>U(c,!0))),y=g.then((()=>L(c,!0)));let v,P;const T=new Promise(((t,e)=>{v=t,P=e}));return p={mount:()=>G(Promise.resolve().then((()=>{if(c.status!==h)throw Error(u(13,!1,o,c.status));return n.parcels[r]=c,L(c)}))),unmount:()=>G(c.unmountThisParcel()),getStatus:()=>c.status,loadPromise:G(m),bootstrapPromise:G(g),mountPromise:G(y),unmountPromise:G(T)},p}function G(t){return t.then((()=>null))}function W(e){const n=O(e);let r="function"==typeof e.customProps?e.customProps(n,window.location):e.customProps;("object"!=typeof r||null===r||Array.isArray(r))&&(r={},console.warn(u(40,!1),n,r));const o=A({},r,{name:n,mountParcel:B.bind(e),singleSpa:t});return T(e)&&(o.unmountSelf=e.unmountThisParcel),o}const C={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:1e3},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},update:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3}};function k(t,e,n){if("number"!=typeof t||t<=0)throw Error(u(16,!1));C.bootstrap={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function K(t,e,n){if("number"!=typeof t||t<=0)throw Error(u(17,!1));C.mount={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function F(t,e,n){if("number"!=typeof t||t<=0)throw Error(u(18,!1));C.unmount={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function H(t,e,n){if("number"!=typeof t||t<=0)throw Error(u(19,!1));C.unload={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function J(t,e){const n=t.timeouts[e],r=n.warningMillis,o=b(t);return new Promise(((i,s)=>{let a=!1,c=!1;t[e](W(t)).then((t=>{a=!0,i(t)})).catch((t=>{a=!0,s(t)})),setTimeout((()=>f(1)),r),setTimeout((()=>f(!0)),n.millis);const l=u(31,!1,e,o,O(t),n.millis);function f(t){if(!a)if(!0===t)c=!0,n.dieOnTimeout?s(Error(l)):console.error(l);else if(!c){const e=t,o=e*r;console.warn(l),o+r<n.millis&&setTimeout((()=>f(e+1)),r)}}}))}function Q(t){const e={};for(let n in C)e[n]=A({},C[n],t&&t[n]||{});return e}function V(t){return Promise.resolve().then((()=>{if(t.loadPromise)return t.loadPromise;if(t.status!==c&&t.status!==y)return t;let e,n;return t.status=l,t.loadPromise=Promise.resolve().then((()=>{const r=t.loadApp(W(t));if(!D(r))throw n=!0,Error(u(33,!1,O(t)));return r.then((n=>{let r;t.loadErrorTime=null,e=n,"object"!=typeof e&&(r=34),Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!S(e.bootstrap)&&(r=35),S(e.mount)||(r=36),S(e.unmount)||(r=37);const i=b(e);if(r){let n;try{n=JSON.stringify(e)}catch(t){}return console.error(u(r,!1,i,O(t),n),e),o(void 0,t,E),t}return e.devtools&&e.devtools.overlays&&(t.devtools.overlays=A({},t.devtools.overlays,e.devtools.overlays)),t.status=f,t.bootstrap=_(e,"bootstrap"),t.mount=_(e,"mount"),t.unmount=_(e,"unmount"),t.unload=_(e,"unload"),t.timeouts=Q(e.timeouts),delete t.loadPromise,t}))})).catch((e=>{let r;return delete t.loadPromise,n?r=E:(r=y,t.loadErrorTime=(new Date).getTime()),o(e,t,r),t}))}))}const q="undefined"!=typeof window,z={hashchange:[],popstate:[]},X=["hashchange","popstate"];function Y(t){let e;if("string"==typeof t)e=t;else if(this&&this.href)e=this.href;else{if(!(t&&t.currentTarget&&t.currentTarget.href&&t.preventDefault))throw Error(u(14,!1));e=t.currentTarget.href,t.preventDefault()}const n=ut(window.location.href),r=ut(e);0===e.indexOf("#")?window.location.hash=r.hash:n.host!==r.host&&r.host?window.location.href=e:r.pathname===n.pathname&&r.search===n.search?window.location.hash=r.hash:window.history.pushState(null,null,e)}function Z(t){if(t){const e=t[0].type;X.indexOf(e)>=0&&z[e].forEach((e=>{try{e.apply(this,t)}catch(t){setTimeout((()=>{throw t}))}}))}}let tt;function et(){jt([],arguments)}function nt(t,e){return function(){const n=window.location.href,r=t.apply(this,arguments),o=window.location.href;return tt&&n===o||window.dispatchEvent(rt(window.history.state,e)),r}}function rt(t,e){let n;try{n=new PopStateEvent("popstate",{state:t})}catch(e){n=document.createEvent("PopStateEvent"),n.initPopStateEvent("popstate",!1,!1,t)}return n.singleSpa=!0,n.singleSpaTrigger=e,n}let ot=null,it=!1;function st(t){if(it)throw Error(u(43,!1));tt=!t||!t.hasOwnProperty("urlRerouteOnly")||t.urlRerouteOnly,it=!0,ot=window.history.replaceState,window.addEventListener("hashchange",et),window.addEventListener("popstate",et);const e=window.addEventListener,n=window.removeEventListener;window.addEventListener=function(t,n){if(!("function"==typeof n&&X.indexOf(t)>=0)||N(z[t],(t=>t===n)))return e.apply(this,arguments);z[t].push(n)},window.removeEventListener=function(t,e){if(!("function"==typeof e&&X.indexOf(t)>=0))return n.apply(this,arguments);z[t]=z[t].filter((t=>t!==e))},window.history.pushState=nt(window.history.pushState,"pushState"),window.history.replaceState=nt(ot,"replaceState")}function ut(t){const e=document.createElement("a");return e.href=t,e}q&&(window.singleSpaNavigate?console.warn(u(41,!1)):window.singleSpaNavigate=Y);let at=!1;function ct(t=window.jQuery){if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!at){const e=t.fn.on,n=t.fn.off;t.fn.on=function(t,n){return lt.call(this,e,window.addEventListener,t,n,arguments)},t.fn.off=function(t,e){return lt.call(this,n,window.removeEventListener,t,e,arguments)},at=!0}}function lt(t,e,n,r,o){return"string"!=typeof n?t.apply(this,o):(n.split(/\s+/).forEach((t=>{X.indexOf(t)>=0&&(e(t,r),n=n.replace(t,""))})),""===n.trim()?this:t.apply(this,o))}const ft={};function pt(t){return Promise.resolve().then((()=>{const e=ft[O(t)];if(!e)return t;if(t.status===c)return ht(t,e),t;if("UNLOADING"===t.status)return e.promise.then((()=>t));if(t.status!==h&&t.status!==y)return t;const n=t.status===y?Promise.resolve():J(t,"unload");return t.status="UNLOADING",n.then((()=>(ht(t,e),t))).catch((n=>(function(t,e,n){delete ft[O(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,o(n,t,E),e.reject(n)}(t,e,n),t)))}))}function ht(t,e){delete ft[O(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=c,e.resolve()}function mt(t,e,n,r){ft[O(t)]={app:t,resolve:n,reject:r},Object.defineProperty(ft[O(t)],"promise",{get:e})}function dt(t){return ft[t]}const wt=[];function gt(){return wt.filter(v).map(O)}function yt(){return wt.map(O)}function Et(t){const e=N(wt,(e=>O(e)===t));return e?e.status:null}let vt=!1;function Pt(t,e,n,r){const o=function(t,e,n,r){const o={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"==typeof t?(function(t){if(Array.isArray(t)||null===t)throw Error(u(39,!1));const e=["name","app","activeWhen","customProps"],n=Object.keys(t).reduce(((t,n)=>e.indexOf(n)>=0?t:t.concat(n)),[]);if(0!==n.length)throw Error(u(38,!1,e.join(", "),n.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(u(20,!1));if("object"!=typeof t.app&&"function"!=typeof t.app)throw Error(u(20,!1));const r=t=>"string"==typeof t||"function"==typeof t;if(!(r(t.activeWhen)||Array.isArray(t.activeWhen)&&t.activeWhen.every(r)))throw Error(u(24,!1));if(!Nt(t.customProps))throw Error(u(22,!1))}(t),o.name=t.name,o.loadApp=t.app,o.activeWhen=t.activeWhen,o.customProps=t.customProps):(function(t,e,n,r){if("string"!=typeof t||0===t.length)throw Error(u(20,!1));if(!e)throw Error(u(23,!1));if("function"!=typeof n)throw Error(u(24,!1));if(!Nt(r))throw Error(u(22,!1))}(t,e,n,r),o.name=t,o.loadApp=e,o.activeWhen=n,o.customProps=r),o.loadApp="function"!=typeof(i=o.loadApp)?()=>Promise.resolve(i):i,o.customProps=function(t){return t||{}}(o.customProps),o.activeWhen=function(t){let e=Array.isArray(t)?t:[t];return e=e.map((t=>"function"==typeof t?t:St(t))),t=>e.some((e=>e(t)))}(o.activeWhen),o;var i}(t,e,n,r);if(xt()||vt||(vt=!0,setTimeout((()=>{xt()||console.warn(u(1,!1))}),5e3)),-1!==yt().indexOf(o.name))throw Error(u(21,!1,o.name));wt.push(A({loadErrorTime:null,status:c,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},o)),q&&(ct(),jt())}function Ot(t=window.location){return wt.filter((e=>e.activeWhen(t))).map(O)}function Tt(t){if(0===wt.filter((e=>O(e)===t)).length)throw Error(u(25,!1,t));return bt(t).then((()=>{const e=wt.map(O).indexOf(t);wt.splice(e,1)}))}function bt(t,e={waitForUnmount:!1}){if("string"!=typeof t)throw Error(u(26,!1));const n=N(wt,(e=>O(e)===t));if(!n)throw Error(u(27,!1,t));const r=dt(O(n));if(e&&e.waitForUnmount){if(r)return r.promise;{const t=new Promise(((e,r)=>{mt(n,(()=>t),e,r)}));return t}}{let t;return r?(t=r.promise,At(n,r.resolve,r.reject)):t=new Promise(((e,r)=>{mt(n,(()=>t),e,r),At(n,e,r)})),t}}function At(t,e,n){M(t).then(pt).then((()=>{e(),setTimeout((()=>{jt()}))})).catch(n)}function Nt(t){return!t||"function"==typeof t||"object"==typeof t&&null!==t&&!Array.isArray(t)}function St(t,e){const n=function(t,e){let n=0,r=!1,o="^";"/"!==t[0]&&(t="/"+t);for(let e=0;e<t.length;e++){const n=t[e],o=r&&"/"===n;(!r&&":"===n||o)&&i(e)}return i(t.length),new RegExp(o,"i");function i(i){const s=t.slice(n,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=r?"[^/]+/?":s,i===t.length)if(r)e&&(o+="$");else{const t=e?"":".*";o="/"===o.charAt(o.length-1)?`${o}${t}$`:`${o}(/${t})?(#.*)?$`}r=!r,n=i}}(t,e);return t=>{let e=t.origin;e||(e=`${t.protocol}//${t.host}`);const r=t.href.replace(e,"").replace(t.search,"").split("?")[0];return n.test(r)}}let _t=!1,Dt=[],Ut=q&&window.location.href;function Mt(){return jt()}function jt(t=[],e,r=!1){if(_t)return new Promise(((t,n)=>{Dt.push({resolve:t,reject:n,eventArguments:e})}));const{appsToUnload:o,appsToUnmount:i,appsToLoad:s,appsToMount:a}=function(){const t=[],e=[],n=[],r=[],o=(new Date).getTime();return wt.forEach((i=>{const s=i.status!==E&&P(i);switch(i.status){case y:s&&o-i.loadErrorTime>=200&&n.push(i);break;case c:case l:s&&n.push(i);break;case f:case h:!s&&dt(O(i))?t.push(i):s&&r.push(i);break;case d:s||e.push(i)}})),{appsToUnload:t,appsToUnmount:e,appsToLoad:n,appsToMount:r}}();let p,m=[],w=Ut,g=Ut=window.location.href;return xt()?(_t=!0,p=o.concat(s,i,a),Promise.resolve().then((()=>(S(0===p.length?"before-no-app-change":"before-app-change",N(!0)),S("before-routing-event",N(!0,{cancelNavigation:v})),Promise.all(m).then((n=>{if(n.some((t=>t)))return ot.call(window.history,history.state,"",w.substring(location.origin.length)),Ut=location.href,_t=!1,jt(t,e,!0);const r=o.map(pt),u=i.map(M).map((t=>t.then(pt))).concat(r),c=Promise.all(u);c.then((()=>{S("before-mount-routing-event",N(!0))}));const l=s.map((t=>V(t).then((t=>$t(t,c))))),f=a.filter((t=>s.indexOf(t)<0)).map((t=>$t(t,c)));return c.catch((t=>{throw b(),t})).then((()=>(b(),Promise.all(l.concat(f)).catch((e=>{throw t.forEach((t=>t.reject(e))),e})).then(T))))})))))):(p=s,Promise.resolve().then((()=>{const t=s.map(V);return Promise.all(t).then(b).then((()=>[])).catch((t=>{throw b(),t}))})));function v(t=!0){const e="function"==typeof(null==t?void 0:t.then)?t:Promise.resolve(t);m.push(e.catch((t=>(console.warn(Error(u(42,!1))),console.warn(t),!1))))}function T(){const e=gt();t.forEach((t=>t.resolve(e)));try{S(0===p.length?"no-app-change":"app-change",N()),S("routing-event",N())}catch(t){setTimeout((()=>{throw t}))}if(_t=!1,Dt.length>0){const t=Dt;Dt=[],jt(t)}return e}function b(){r||(t.forEach((t=>{Z(t.eventArguments)})),Z(e))}function N(t=!1,n){const r={},u={[d]:[],[h]:[],[c]:[],[E]:[]};t?(s.concat(a).forEach(((t,e)=>{f(t,d)})),o.forEach((t=>{f(t,c)})),i.forEach((t=>{f(t,h)}))):p.forEach((t=>{f(t)}));const l={detail:{newAppStatuses:r,appsByNewStatus:u,totalAppChanges:p.length,originalEvent:null==e?void 0:e[0],oldUrl:w,newUrl:g}};return n&&A(l.detail,n),l;function f(t,e){const n=O(t);e=e||Et(n),r[n]=e,(u[e]=u[e]||[]).push(n)}}function S(t,e){r||window.dispatchEvent(new n(`single-spa:${t}`,e))}}function $t(t,e){return P(t)?U(t).then((t=>e.then((()=>P(t)?L(t):t)))):e.then((()=>t))}let Lt=!1;function Rt(t){Lt=!0,q&&(st(t),jt())}function xt(){return Lt}var It={getRawAppData:function(){return[...wt]},reroute:jt,NOT_LOADED:c,toLoadPromise:V,toBootstrapPromise:U,unregisterApplication:Tt};q&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=It);export{p as BOOTSTRAPPING,l as LOADING_SOURCE_CODE,y as LOAD_ERROR,d as MOUNTED,m as MOUNTING,f as NOT_BOOTSTRAPPED,c as NOT_LOADED,h as NOT_MOUNTED,E as SKIP_BECAUSE_BROKEN,g as UNMOUNTING,w as UPDATING,i as addErrorHandler,Ot as checkActivityFunctions,ct as ensureJQuerySupport,yt as getAppNames,Et as getAppStatus,gt as getMountedApps,I as mountRootParcel,Y as navigateToUrl,st as patchHistoryApi,St as pathToActiveWhen,Pt as registerApplication,s as removeErrorHandler,k as setBootstrapMaxTime,K as setMountMaxTime,H as setUnloadMaxTime,F as setUnmountMaxTime,Rt as start,Mt as triggerAppChange,bt as unloadApplication,Tt as unregisterApplication}; | ||
//# sourceMappingURL=single-spa.min.js.map |
@@ -1,2 +0,2 @@ | ||
/* single-spa@6.0.0-beta.1 - SystemJS ES2015 - dev */ | ||
/* single-spa@6.0.0-beta.2 - SystemJS ES2015 - dev */ | ||
System.register([], function (exports) { | ||
@@ -356,2 +356,3 @@ 'use strict'; | ||
appOrParcel.status = MOUNTING; | ||
return reasonableTime(appOrParcel, "mount").then(() => { | ||
@@ -358,0 +359,0 @@ appOrParcel.status = MOUNTED; |
@@ -1,3 +0,3 @@ | ||
/* single-spa@6.0.0-beta.1 - SystemJS ES2015 - prod */ | ||
System.register([],(function(t){return{execute:function(){t({addErrorHandler:s,checkActivityFunctions:bt,ensureJQuerySupport:pt,getAppNames:Ot,getAppStatus:Tt,getMountedApps:vt,mountRootParcel:G,navigateToUrl:et,patchHistoryApi:ct,pathToActiveWhen:Dt,registerApplication:At,removeErrorHandler:u,setBootstrapMaxTime:F,setMountMaxTime:J,setUnloadMaxTime:V,setUnmountMaxTime:Q,start:Bt,triggerAppChange:Lt,unloadApplication:St,unregisterApplication:Nt});var e=Object.freeze({__proto__:null,get start(){return Bt},get ensureJQuerySupport(){return pt},get setBootstrapMaxTime(){return F},get setMountMaxTime(){return J},get setUnmountMaxTime(){return Q},get setUnloadMaxTime(){return V},get registerApplication(){return At},get unregisterApplication(){return Nt},get getMountedApps(){return vt},get getAppStatus(){return Tt},get unloadApplication(){return St},get checkActivityFunctions(){return bt},get getAppNames(){return Ot},get pathToActiveWhen(){return Dt},get navigateToUrl(){return et},get patchHistoryApi(){return ct},get triggerAppChange(){return Lt},get addErrorHandler(){return s},get removeErrorHandler(){return u},get mountRootParcel(){return G},get NOT_LOADED(){return l},get LOADING_SOURCE_CODE(){return f},get NOT_BOOTSTRAPPED(){return p},get BOOTSTRAPPING(){return h},get NOT_MOUNTED(){return m},get MOUNTING(){return d},get UPDATING(){return g},get LOAD_ERROR(){return v},get MOUNTED(){return w},get UNMOUNTING(){return E},get SKIP_BECAUSE_BROKEN(){return O}}),n=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).CustomEvent,r=function(){try{var t=new n("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?n:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,e){var n=document.createEvent("CustomEvent");return e?n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail):n.initCustomEvent(t,!1,!1,void 0),n}:function(t,e){var n=document.createEventObject();return n.type=t,e?(n.bubbles=Boolean(e.bubbles),n.cancelable=Boolean(e.cancelable),n.detail=e.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n};let o=[];function i(t,e,n){const r=c(t,e,n);o.length?o.forEach((t=>t(r))):setTimeout((()=>{throw r}))}function s(t){if("function"!=typeof t)throw Error(a(28,!1));o.push(t)}function u(t){if("function"!=typeof t)throw Error(a(29,!1));let e=!1;return o=o.filter((n=>{const r=n===t;return e=e||r,!r})),e}function a(t,e,...n){return`single-spa minified message #${t}: ${e?e+" ":""}See https://single-spa.js.org/error/?code=${t}${n.length?`&arg=${n.join("&arg=")}`:""}`}function c(t,e,n){const r=`${N(e)} '${A(e)}' died in status ${e.status}: `;let o;if(t instanceof Error){try{t.message=r+t.message}catch(t){}o=t}else{console.warn(a(30,!1,e.status,A(e)));try{o=Error(r+JSON.stringify(t))}catch(e){o=t}}return o.appOrParcelName=A(e),e.status=n,o}const l=t("NOT_LOADED","NOT_LOADED"),f=t("LOADING_SOURCE_CODE","LOADING_SOURCE_CODE"),p=t("NOT_BOOTSTRAPPED","NOT_BOOTSTRAPPED"),h=t("BOOTSTRAPPING","BOOTSTRAPPING"),m=t("NOT_MOUNTED","NOT_MOUNTED"),d=t("MOUNTING","MOUNTING"),w=t("MOUNTED","MOUNTED"),g=t("UPDATING","UPDATING"),E=t("UNMOUNTING","UNMOUNTING"),y="UNLOADING",v=t("LOAD_ERROR","LOAD_ERROR"),O=t("SKIP_BECAUSE_BROKEN","SKIP_BECAUSE_BROKEN");function T(t){return t.status===w}function P(t){try{return t.activeWhen(window.location)}catch(e){return i(e,t,O),!1}}function A(t){return t.name}function b(t){return Boolean(t.unmountThisParcel)}function N(t){return b(t)?"parcel":"application"}function S(){for(let t=arguments.length-1;t>0;t--)for(let e in arguments[t])"__proto__"!==e&&(arguments[t-1][e]=arguments[t][e]);return arguments[0]}function _(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return t[n];return null}function U(t){return t&&("function"==typeof t||(e=t,Array.isArray(e)&&!_(e,(t=>"function"!=typeof t))));var e}function D(t,e){let n=t[e]||[];n=Array.isArray(n)?n:[n],0===n.length&&(n=[()=>Promise.resolve()]);const r=N(t),o=A(t);return function(t){return n.reduce(((n,i,s)=>n.then((()=>{const n=i(t);return M(n)?n:Promise.reject(a(15,!1,r,o,e,s))}))),Promise.resolve())}}function M(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function R(t,e){return Promise.resolve().then((()=>t.status!==p?t:(t.status=h,t.bootstrap?q(t,"bootstrap").then(n).catch((n=>{if(e)throw c(n,t,O);return i(n,t,O),t})):Promise.resolve().then(n))));function n(){return t.status=m,t}}function j(t,e){return Promise.resolve().then((()=>{if(t.status!==w)return t;t.status=E;const n=Object.keys(t.parcels).map((e=>t.parcels[e].unmountThisParcel()));return Promise.all(n).then(r,(n=>r().then((()=>{const r=Error(n.message);if(e)throw c(r,t,O);i(r,t,O)})))).then((()=>t));function r(){return q(t,"unmount").then((()=>{t.status=m})).catch((n=>{if(e)throw c(n,t,O);i(n,t,O)}))}}))}let L=!1,$=!1;function I(t,e){return Promise.resolve().then((()=>t.status!==m?t:(L||(window.dispatchEvent(new r("single-spa:before-first-mount")),L=!0),q(t,"mount").then((()=>(t.status=w,$||(window.dispatchEvent(new r("single-spa:first-mount")),$=!0),t))).catch((n=>{return t.status=w,j(t,!0).then(r,r);function r(){if(e)throw c(n,t,O);return i(n,t,O),t}})))))}let x=0;const B={parcels:{}};function G(){return C.apply(B,arguments)}function C(t,e){const n=this;if(!t||"object"!=typeof t&&"function"!=typeof t)throw Error(a(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(a(3,!1,typeof t.name));const r=x++;let o=t.name||`parcel-${r}`;if("object"!=typeof e)throw Error(a(4,!1,o,typeof e));if(!e.domElement)throw Error(a(5,!1,o));const i="function"==typeof t,s=i?t:()=>Promise.resolve(t),u={id:r,parcels:{},status:i?f:p,customProps:e,parentName:A(n),unmountThisParcel:()=>E.then((()=>{if(u.status!==w)throw Error(a(6,!1,o,u.status));return j(u,!0)})).then((t=>(u.parentName&&delete n.parcels[u.id],t))).then((t=>(y(t),t))).catch((t=>{throw u.status=O,v(t),t}))};let l;n.parcels[r]=u;let h=s();if(!h||"function"!=typeof h.then)throw Error(a(7,!1));h=h.then((t=>{if(!t)throw Error(a(8,!1));if(o=t.name||`parcel-${r}`,Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!U(t.bootstrap))throw Error(a(9,!1,o));if(!U(t.mount))throw Error(a(10,!1,o));if(!U(t.unmount))throw Error(a(11,!1,o));if(t.update&&!U(t.update))throw Error(a(12,!1,o));const e=D(t,"bootstrap"),n=D(t,"mount"),i=D(t,"unmount");u.status=p,u.name=o,u.bootstrap=e,u.mount=n,u.unmount=i,u.timeouts=z(t.timeouts),t.update&&(u.update=D(t,"update"),l.update=function(t){return u.customProps=t,W(function(t){return Promise.resolve().then((()=>{if(t.status!==w)throw Error(a(32,!1,A(t)));return t.status=g,q(t,"update").then((()=>(t.status=w,t))).catch((e=>{throw c(e,t,O)}))}))}(u))})}));const d=h.then((()=>R(u,!0))),E=d.then((()=>I(u,!0)));let y,v;const T=new Promise(((t,e)=>{y=t,v=e}));return l={mount:()=>W(Promise.resolve().then((()=>{if(u.status!==m)throw Error(a(13,!1,o,u.status));return n.parcels[r]=u,I(u)}))),unmount:()=>W(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:W(h),bootstrapPromise:W(d),mountPromise:W(E),unmountPromise:W(T)},l}function W(t){return t.then((()=>null))}function k(t){const n=A(t);let r="function"==typeof t.customProps?t.customProps(n,window.location):t.customProps;("object"!=typeof r||null===r||Array.isArray(r))&&(r={},console.warn(a(40,!1),n,r));const o=S({},r,{name:n,mountParcel:C.bind(t),singleSpa:e});return b(t)&&(o.unmountSelf=t.unmountThisParcel),o}const H=1e3,K={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:H},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:H},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:H},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:H},update:{millis:3e3,dieOnTimeout:!1,warningMillis:H}};function F(t,e,n){if("number"!=typeof t||t<=0)throw Error(a(16,!1));K.bootstrap={millis:t,dieOnTimeout:e,warningMillis:n||H}}function J(t,e,n){if("number"!=typeof t||t<=0)throw Error(a(17,!1));K.mount={millis:t,dieOnTimeout:e,warningMillis:n||H}}function Q(t,e,n){if("number"!=typeof t||t<=0)throw Error(a(18,!1));K.unmount={millis:t,dieOnTimeout:e,warningMillis:n||H}}function V(t,e,n){if("number"!=typeof t||t<=0)throw Error(a(19,!1));K.unload={millis:t,dieOnTimeout:e,warningMillis:n||H}}function q(t,e){const n=t.timeouts[e],r=n.warningMillis,o=N(t);return new Promise(((i,s)=>{let u=!1,c=!1;t[e](k(t)).then((t=>{u=!0,i(t)})).catch((t=>{u=!0,s(t)})),setTimeout((()=>f(1)),r),setTimeout((()=>f(!0)),n.millis);const l=a(31,!1,e,o,A(t),n.millis);function f(t){if(!u)if(!0===t)c=!0,n.dieOnTimeout?s(Error(l)):console.error(l);else if(!c){const e=t,o=e*r;console.warn(l),o+r<n.millis&&setTimeout((()=>f(e+1)),r)}}}))}function z(t){const e={};for(let n in K)e[n]=S({},K[n],t&&t[n]||{});return e}function X(t){return Promise.resolve().then((()=>{if(t.loadPromise)return t.loadPromise;if(t.status!==l&&t.status!==v)return t;let e,n;return t.status=f,t.loadPromise=Promise.resolve().then((()=>{const r=t.loadApp(k(t));if(!M(r))throw n=!0,Error(a(33,!1,A(t)));return r.then((n=>{let r;t.loadErrorTime=null,e=n,"object"!=typeof e&&(r=34),Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!U(e.bootstrap)&&(r=35),U(e.mount)||(r=36),U(e.unmount)||(r=37);const o=N(e);if(r){let n;try{n=JSON.stringify(e)}catch(t){}return console.error(a(r,!1,o,A(t),n),e),i(void 0,t,O),t}return e.devtools&&e.devtools.overlays&&(t.devtools.overlays=S({},t.devtools.overlays,e.devtools.overlays)),t.status=p,t.bootstrap=D(e,"bootstrap"),t.mount=D(e,"mount"),t.unmount=D(e,"unmount"),t.unload=D(e,"unload"),t.timeouts=z(e.timeouts),delete t.loadPromise,t}))})).catch((e=>{let r;return delete t.loadPromise,n?r=O:(r=v,t.loadErrorTime=(new Date).getTime()),i(e,t,r),t}))}))}const Y="undefined"!=typeof window,Z={hashchange:[],popstate:[]},tt=["hashchange","popstate"];function et(t){let e;if("string"==typeof t)e=t;else if(this&&this.href)e=this.href;else{if(!(t&&t.currentTarget&&t.currentTarget.href&&t.preventDefault))throw Error(a(14,!1));e=t.currentTarget.href,t.preventDefault()}const n=lt(window.location.href),r=lt(e);0===e.indexOf("#")?window.location.hash=r.hash:n.host!==r.host&&r.host?window.location.href=e:r.pathname===n.pathname&&r.search===n.search?window.location.hash=r.hash:window.history.pushState(null,null,e)}function nt(t){if(t){const e=t[0].type;tt.indexOf(e)>=0&&Z[e].forEach((e=>{try{e.apply(this,t)}catch(t){setTimeout((()=>{throw t}))}}))}}let rt;function ot(){$t([],arguments)}function it(t,e){return function(){const n=window.location.href,r=t.apply(this,arguments),o=window.location.href;return rt&&n===o||window.dispatchEvent(st(window.history.state,e)),r}}function st(t,e){let n;try{n=new PopStateEvent("popstate",{state:t})}catch(e){n=document.createEvent("PopStateEvent"),n.initPopStateEvent("popstate",!1,!1,t)}return n.singleSpa=!0,n.singleSpaTrigger=e,n}let ut=null,at=!1;function ct(t){if(at)throw Error(a(43,!1));rt=!t||!t.hasOwnProperty("urlRerouteOnly")||t.urlRerouteOnly,at=!0,ut=window.history.replaceState,window.addEventListener("hashchange",ot),window.addEventListener("popstate",ot);const e=window.addEventListener,n=window.removeEventListener;window.addEventListener=function(t,n){if(!("function"==typeof n&&tt.indexOf(t)>=0)||_(Z[t],(t=>t===n)))return e.apply(this,arguments);Z[t].push(n)},window.removeEventListener=function(t,e){if(!("function"==typeof e&&tt.indexOf(t)>=0))return n.apply(this,arguments);Z[t]=Z[t].filter((t=>t!==e))},window.history.pushState=it(window.history.pushState,"pushState"),window.history.replaceState=it(ut,"replaceState")}function lt(t){const e=document.createElement("a");return e.href=t,e}Y&&(window.singleSpaNavigate?console.warn(a(41,!1)):window.singleSpaNavigate=et);let ft=!1;function pt(t=window.jQuery){if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!ft){const e=t.fn.on,n=t.fn.off;t.fn.on=function(t,n){return ht.call(this,e,window.addEventListener,t,n,arguments)},t.fn.off=function(t,e){return ht.call(this,n,window.removeEventListener,t,e,arguments)},ft=!0}}function ht(t,e,n,r,o){return"string"!=typeof n?t.apply(this,o):(n.split(/\s+/).forEach((t=>{tt.indexOf(t)>=0&&(e(t,r),n=n.replace(t,""))})),""===n.trim()?this:t.apply(this,o))}const mt={};function dt(t){return Promise.resolve().then((()=>{const e=mt[A(t)];if(!e)return t;if(t.status===l)return wt(t,e),t;if(t.status===y)return e.promise.then((()=>t));if(t.status!==m&&t.status!==v)return t;const n=t.status===v?Promise.resolve():q(t,"unload");return t.status=y,n.then((()=>(wt(t,e),t))).catch((n=>(function(t,e,n){delete mt[A(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,i(n,t,O),e.reject(n)}(t,e,n),t)))}))}function wt(t,e){delete mt[A(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=l,e.resolve()}function gt(t,e,n,r){mt[A(t)]={app:t,resolve:n,reject:r},Object.defineProperty(mt[A(t)],"promise",{get:e})}function Et(t){return mt[t]}const yt=[];function vt(){return yt.filter(T).map(A)}function Ot(){return yt.map(A)}function Tt(t){const e=_(yt,(e=>A(e)===t));return e?e.status:null}let Pt=!1;function At(t,e,n,r){const o=function(t,e,n,r){const o={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"==typeof t?(function(t){if(Array.isArray(t)||null===t)throw Error(a(39,!1));const e=["name","app","activeWhen","customProps"],n=Object.keys(t).reduce(((t,n)=>e.indexOf(n)>=0?t:t.concat(n)),[]);if(0!==n.length)throw Error(a(38,!1,e.join(", "),n.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(a(20,!1));if("object"!=typeof t.app&&"function"!=typeof t.app)throw Error(a(20,!1));const r=t=>"string"==typeof t||"function"==typeof t;if(!(r(t.activeWhen)||Array.isArray(t.activeWhen)&&t.activeWhen.every(r)))throw Error(a(24,!1));if(!Ut(t.customProps))throw Error(a(22,!1))}(t),o.name=t.name,o.loadApp=t.app,o.activeWhen=t.activeWhen,o.customProps=t.customProps):(function(t,e,n,r){if("string"!=typeof t||0===t.length)throw Error(a(20,!1));if(!e)throw Error(a(23,!1));if("function"!=typeof n)throw Error(a(24,!1));if(!Ut(r))throw Error(a(22,!1))}(t,e,n,r),o.name=t,o.loadApp=e,o.activeWhen=n,o.customProps=r),o.loadApp="function"!=typeof(i=o.loadApp)?()=>Promise.resolve(i):i,o.customProps=function(t){return t||{}}(o.customProps),o.activeWhen=function(t){let e=Array.isArray(t)?t:[t];return e=e.map((t=>"function"==typeof t?t:Dt(t))),t=>e.some((e=>e(t)))}(o.activeWhen),o;var i}(t,e,n,r);if(Gt()||Pt||(Pt=!0,setTimeout((()=>{Gt()||console.warn(a(1,!1))}),5e3)),-1!==Ot().indexOf(o.name))throw Error(a(21,!1,o.name));yt.push(S({loadErrorTime:null,status:l,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},o)),Y&&(pt(),$t())}function bt(t=window.location){return yt.filter((e=>e.activeWhen(t))).map(A)}function Nt(t){if(0===yt.filter((e=>A(e)===t)).length)throw Error(a(25,!1,t));return St(t).then((()=>{const e=yt.map(A).indexOf(t);yt.splice(e,1)}))}function St(t,e={waitForUnmount:!1}){if("string"!=typeof t)throw Error(a(26,!1));const n=_(yt,(e=>A(e)===t));if(!n)throw Error(a(27,!1,t));const r=Et(A(n));if(e&&e.waitForUnmount){if(r)return r.promise;{const t=new Promise(((e,r)=>{gt(n,(()=>t),e,r)}));return t}}{let t;return r?(t=r.promise,_t(n,r.resolve,r.reject)):t=new Promise(((e,r)=>{gt(n,(()=>t),e,r),_t(n,e,r)})),t}}function _t(t,e,n){j(t).then(dt).then((()=>{e(),setTimeout((()=>{$t()}))})).catch(n)}function Ut(t){return!t||"function"==typeof t||"object"==typeof t&&null!==t&&!Array.isArray(t)}function Dt(t,e){const n=function(t,e){let n=0,r=!1,o="^";"/"!==t[0]&&(t="/"+t);for(let e=0;e<t.length;e++){const n=t[e],o=r&&"/"===n;(!r&&":"===n||o)&&i(e)}return i(t.length),new RegExp(o,"i");function i(i){const s=t.slice(n,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=r?"[^/]+/?":s,i===t.length)if(r)e&&(o+="$");else{const t=e?"":".*";o="/"===o.charAt(o.length-1)?`${o}${t}$`:`${o}(/${t})?(#.*)?$`}r=!r,n=i}}(t,e);return t=>{let e=t.origin;e||(e=`${t.protocol}//${t.host}`);const r=t.href.replace(e,"").replace(t.search,"").split("?")[0];return n.test(r)}}let Mt=!1,Rt=[],jt=Y&&window.location.href;function Lt(){return $t()}function $t(t=[],e,n=!1){if(Mt)return new Promise(((t,n)=>{Rt.push({resolve:t,reject:n,eventArguments:e})}));const{appsToUnload:o,appsToUnmount:i,appsToLoad:s,appsToMount:u}=function(){const t=[],e=[],n=[],r=[],o=(new Date).getTime();return yt.forEach((i=>{const s=i.status!==O&&P(i);switch(i.status){case v:s&&o-i.loadErrorTime>=200&&n.push(i);break;case l:case f:s&&n.push(i);break;case p:case m:!s&&Et(A(i))?t.push(i):s&&r.push(i);break;case w:s||e.push(i)}})),{appsToUnload:t,appsToUnmount:e,appsToLoad:n,appsToMount:r}}();let c,h=[],d=jt,g=jt=window.location.href;return Gt()?(Mt=!0,c=o.concat(s,i,u),Promise.resolve().then((()=>(N(0===c.length?"before-no-app-change":"before-app-change",b(!0)),N("before-routing-event",b(!0,{cancelNavigation:E})),Promise.all(h).then((n=>{if(n.some((t=>t)))return ut.call(window.history,history.state,"",d.substring(location.origin.length)),jt=location.href,Mt=!1,$t(t,e,!0);const r=o.map(dt),a=i.map(j).map((t=>t.then(dt))).concat(r),c=Promise.all(a);c.then((()=>{N("before-mount-routing-event",b(!0))}));const l=s.map((t=>X(t).then((t=>It(t,c))))),f=u.filter((t=>s.indexOf(t)<0)).map((t=>It(t,c)));return c.catch((t=>{throw T(),t})).then((()=>(T(),Promise.all(l.concat(f)).catch((e=>{throw t.forEach((t=>t.reject(e))),e})).then(y))))})))))):(c=s,Promise.resolve().then((()=>{const t=s.map(X);return Promise.all(t).then(T).then((()=>[])).catch((t=>{throw T(),t}))})));function E(t=!0){const e="function"==typeof(null==t?void 0:t.then)?t:Promise.resolve(t);h.push(e.catch((t=>(console.warn(Error(a(42,!1))),console.warn(t),!1))))}function y(){const e=vt();t.forEach((t=>t.resolve(e)));try{N(0===c.length?"no-app-change":"app-change",b()),N("routing-event",b())}catch(t){setTimeout((()=>{throw t}))}if(Mt=!1,Rt.length>0){const t=Rt;Rt=[],$t(t)}return e}function T(){n||(t.forEach((t=>{nt(t.eventArguments)})),nt(e))}function b(t=!1,n){const r={},a={[w]:[],[m]:[],[l]:[],[O]:[]};t?(s.concat(u).forEach(((t,e)=>{p(t,w)})),o.forEach((t=>{p(t,l)})),i.forEach((t=>{p(t,m)}))):c.forEach((t=>{p(t)}));const f={detail:{newAppStatuses:r,appsByNewStatus:a,totalAppChanges:c.length,originalEvent:null==e?void 0:e[0],oldUrl:d,newUrl:g}};return n&&S(f.detail,n),f;function p(t,e){const n=A(t);e=e||Tt(n),r[n]=e,(a[e]=a[e]||[]).push(n)}}function N(t,e){n||window.dispatchEvent(new r(`single-spa:${t}`,e))}}function It(t,e){return P(t)?R(t).then((t=>e.then((()=>P(t)?I(t):t)))):e.then((()=>t))}let xt=!1;function Bt(t){xt=!0,Y&&(ct(t),$t())}function Gt(){return xt}var Ct={getRawAppData:function(){return[...yt]},reroute:$t,NOT_LOADED:l,toLoadPromise:X,toBootstrapPromise:R,unregisterApplication:Nt};Y&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=Ct)}}})); | ||
/* single-spa@6.0.0-beta.2 - SystemJS ES2015 - prod */ | ||
System.register([],(function(t){return{execute:function(){t({addErrorHandler:s,checkActivityFunctions:bt,ensureJQuerySupport:pt,getAppNames:Ot,getAppStatus:Tt,getMountedApps:vt,mountRootParcel:G,navigateToUrl:et,patchHistoryApi:ct,pathToActiveWhen:Dt,registerApplication:At,removeErrorHandler:u,setBootstrapMaxTime:F,setMountMaxTime:J,setUnloadMaxTime:V,setUnmountMaxTime:Q,start:Bt,triggerAppChange:Lt,unloadApplication:St,unregisterApplication:Nt});var e=Object.freeze({__proto__:null,get start(){return Bt},get ensureJQuerySupport(){return pt},get setBootstrapMaxTime(){return F},get setMountMaxTime(){return J},get setUnmountMaxTime(){return Q},get setUnloadMaxTime(){return V},get registerApplication(){return At},get unregisterApplication(){return Nt},get getMountedApps(){return vt},get getAppStatus(){return Tt},get unloadApplication(){return St},get checkActivityFunctions(){return bt},get getAppNames(){return Ot},get pathToActiveWhen(){return Dt},get navigateToUrl(){return et},get patchHistoryApi(){return ct},get triggerAppChange(){return Lt},get addErrorHandler(){return s},get removeErrorHandler(){return u},get mountRootParcel(){return G},get NOT_LOADED(){return l},get LOADING_SOURCE_CODE(){return f},get NOT_BOOTSTRAPPED(){return p},get BOOTSTRAPPING(){return h},get NOT_MOUNTED(){return m},get MOUNTING(){return d},get UPDATING(){return g},get LOAD_ERROR(){return v},get MOUNTED(){return w},get UNMOUNTING(){return E},get SKIP_BECAUSE_BROKEN(){return O}}),n=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).CustomEvent,r=function(){try{var t=new n("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?n:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,e){var n=document.createEvent("CustomEvent");return e?n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail):n.initCustomEvent(t,!1,!1,void 0),n}:function(t,e){var n=document.createEventObject();return n.type=t,e?(n.bubbles=Boolean(e.bubbles),n.cancelable=Boolean(e.cancelable),n.detail=e.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n};let o=[];function i(t,e,n){const r=c(t,e,n);o.length?o.forEach((t=>t(r))):setTimeout((()=>{throw r}))}function s(t){if("function"!=typeof t)throw Error(a(28,!1));o.push(t)}function u(t){if("function"!=typeof t)throw Error(a(29,!1));let e=!1;return o=o.filter((n=>{const r=n===t;return e=e||r,!r})),e}function a(t,e,...n){return`single-spa minified message #${t}: ${e?e+" ":""}See https://single-spa.js.org/error/?code=${t}${n.length?`&arg=${n.join("&arg=")}`:""}`}function c(t,e,n){const r=`${N(e)} '${A(e)}' died in status ${e.status}: `;let o;if(t instanceof Error){try{t.message=r+t.message}catch(t){}o=t}else{console.warn(a(30,!1,e.status,A(e)));try{o=Error(r+JSON.stringify(t))}catch(e){o=t}}return o.appOrParcelName=A(e),e.status=n,o}const l=t("NOT_LOADED","NOT_LOADED"),f=t("LOADING_SOURCE_CODE","LOADING_SOURCE_CODE"),p=t("NOT_BOOTSTRAPPED","NOT_BOOTSTRAPPED"),h=t("BOOTSTRAPPING","BOOTSTRAPPING"),m=t("NOT_MOUNTED","NOT_MOUNTED"),d=t("MOUNTING","MOUNTING"),w=t("MOUNTED","MOUNTED"),g=t("UPDATING","UPDATING"),E=t("UNMOUNTING","UNMOUNTING"),y="UNLOADING",v=t("LOAD_ERROR","LOAD_ERROR"),O=t("SKIP_BECAUSE_BROKEN","SKIP_BECAUSE_BROKEN");function T(t){return t.status===w}function P(t){try{return t.activeWhen(window.location)}catch(e){return i(e,t,O),!1}}function A(t){return t.name}function b(t){return Boolean(t.unmountThisParcel)}function N(t){return b(t)?"parcel":"application"}function S(){for(let t=arguments.length-1;t>0;t--)for(let e in arguments[t])"__proto__"!==e&&(arguments[t-1][e]=arguments[t][e]);return arguments[0]}function _(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return t[n];return null}function U(t){return t&&("function"==typeof t||(e=t,Array.isArray(e)&&!_(e,(t=>"function"!=typeof t))));var e}function D(t,e){let n=t[e]||[];n=Array.isArray(n)?n:[n],0===n.length&&(n=[()=>Promise.resolve()]);const r=N(t),o=A(t);return function(t){return n.reduce(((n,i,s)=>n.then((()=>{const n=i(t);return M(n)?n:Promise.reject(a(15,!1,r,o,e,s))}))),Promise.resolve())}}function M(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function R(t,e){return Promise.resolve().then((()=>t.status!==p?t:(t.status=h,t.bootstrap?q(t,"bootstrap").then(n).catch((n=>{if(e)throw c(n,t,O);return i(n,t,O),t})):Promise.resolve().then(n))));function n(){return t.status=m,t}}function j(t,e){return Promise.resolve().then((()=>{if(t.status!==w)return t;t.status=E;const n=Object.keys(t.parcels).map((e=>t.parcels[e].unmountThisParcel()));return Promise.all(n).then(r,(n=>r().then((()=>{const r=Error(n.message);if(e)throw c(r,t,O);i(r,t,O)})))).then((()=>t));function r(){return q(t,"unmount").then((()=>{t.status=m})).catch((n=>{if(e)throw c(n,t,O);i(n,t,O)}))}}))}let L=!1,$=!1;function I(t,e){return Promise.resolve().then((()=>t.status!==m?t:(L||(window.dispatchEvent(new r("single-spa:before-first-mount")),L=!0),t.status=d,q(t,"mount").then((()=>(t.status=w,$||(window.dispatchEvent(new r("single-spa:first-mount")),$=!0),t))).catch((n=>{return t.status=w,j(t,!0).then(r,r);function r(){if(e)throw c(n,t,O);return i(n,t,O),t}})))))}let x=0;const B={parcels:{}};function G(){return C.apply(B,arguments)}function C(t,e){const n=this;if(!t||"object"!=typeof t&&"function"!=typeof t)throw Error(a(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(a(3,!1,typeof t.name));const r=x++;let o=t.name||`parcel-${r}`;if("object"!=typeof e)throw Error(a(4,!1,o,typeof e));if(!e.domElement)throw Error(a(5,!1,o));const i="function"==typeof t,s=i?t:()=>Promise.resolve(t),u={id:r,parcels:{},status:i?f:p,customProps:e,parentName:A(n),unmountThisParcel:()=>E.then((()=>{if(u.status!==w)throw Error(a(6,!1,o,u.status));return j(u,!0)})).then((t=>(u.parentName&&delete n.parcels[u.id],t))).then((t=>(y(t),t))).catch((t=>{throw u.status=O,v(t),t}))};let l;n.parcels[r]=u;let h=s();if(!h||"function"!=typeof h.then)throw Error(a(7,!1));h=h.then((t=>{if(!t)throw Error(a(8,!1));if(o=t.name||`parcel-${r}`,Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!U(t.bootstrap))throw Error(a(9,!1,o));if(!U(t.mount))throw Error(a(10,!1,o));if(!U(t.unmount))throw Error(a(11,!1,o));if(t.update&&!U(t.update))throw Error(a(12,!1,o));const e=D(t,"bootstrap"),n=D(t,"mount"),i=D(t,"unmount");u.status=p,u.name=o,u.bootstrap=e,u.mount=n,u.unmount=i,u.timeouts=z(t.timeouts),t.update&&(u.update=D(t,"update"),l.update=function(t){return u.customProps=t,W(function(t){return Promise.resolve().then((()=>{if(t.status!==w)throw Error(a(32,!1,A(t)));return t.status=g,q(t,"update").then((()=>(t.status=w,t))).catch((e=>{throw c(e,t,O)}))}))}(u))})}));const d=h.then((()=>R(u,!0))),E=d.then((()=>I(u,!0)));let y,v;const T=new Promise(((t,e)=>{y=t,v=e}));return l={mount:()=>W(Promise.resolve().then((()=>{if(u.status!==m)throw Error(a(13,!1,o,u.status));return n.parcels[r]=u,I(u)}))),unmount:()=>W(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:W(h),bootstrapPromise:W(d),mountPromise:W(E),unmountPromise:W(T)},l}function W(t){return t.then((()=>null))}function k(t){const n=A(t);let r="function"==typeof t.customProps?t.customProps(n,window.location):t.customProps;("object"!=typeof r||null===r||Array.isArray(r))&&(r={},console.warn(a(40,!1),n,r));const o=S({},r,{name:n,mountParcel:C.bind(t),singleSpa:e});return b(t)&&(o.unmountSelf=t.unmountThisParcel),o}const H=1e3,K={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:H},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:H},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:H},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:H},update:{millis:3e3,dieOnTimeout:!1,warningMillis:H}};function F(t,e,n){if("number"!=typeof t||t<=0)throw Error(a(16,!1));K.bootstrap={millis:t,dieOnTimeout:e,warningMillis:n||H}}function J(t,e,n){if("number"!=typeof t||t<=0)throw Error(a(17,!1));K.mount={millis:t,dieOnTimeout:e,warningMillis:n||H}}function Q(t,e,n){if("number"!=typeof t||t<=0)throw Error(a(18,!1));K.unmount={millis:t,dieOnTimeout:e,warningMillis:n||H}}function V(t,e,n){if("number"!=typeof t||t<=0)throw Error(a(19,!1));K.unload={millis:t,dieOnTimeout:e,warningMillis:n||H}}function q(t,e){const n=t.timeouts[e],r=n.warningMillis,o=N(t);return new Promise(((i,s)=>{let u=!1,c=!1;t[e](k(t)).then((t=>{u=!0,i(t)})).catch((t=>{u=!0,s(t)})),setTimeout((()=>f(1)),r),setTimeout((()=>f(!0)),n.millis);const l=a(31,!1,e,o,A(t),n.millis);function f(t){if(!u)if(!0===t)c=!0,n.dieOnTimeout?s(Error(l)):console.error(l);else if(!c){const e=t,o=e*r;console.warn(l),o+r<n.millis&&setTimeout((()=>f(e+1)),r)}}}))}function z(t){const e={};for(let n in K)e[n]=S({},K[n],t&&t[n]||{});return e}function X(t){return Promise.resolve().then((()=>{if(t.loadPromise)return t.loadPromise;if(t.status!==l&&t.status!==v)return t;let e,n;return t.status=f,t.loadPromise=Promise.resolve().then((()=>{const r=t.loadApp(k(t));if(!M(r))throw n=!0,Error(a(33,!1,A(t)));return r.then((n=>{let r;t.loadErrorTime=null,e=n,"object"!=typeof e&&(r=34),Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!U(e.bootstrap)&&(r=35),U(e.mount)||(r=36),U(e.unmount)||(r=37);const o=N(e);if(r){let n;try{n=JSON.stringify(e)}catch(t){}return console.error(a(r,!1,o,A(t),n),e),i(void 0,t,O),t}return e.devtools&&e.devtools.overlays&&(t.devtools.overlays=S({},t.devtools.overlays,e.devtools.overlays)),t.status=p,t.bootstrap=D(e,"bootstrap"),t.mount=D(e,"mount"),t.unmount=D(e,"unmount"),t.unload=D(e,"unload"),t.timeouts=z(e.timeouts),delete t.loadPromise,t}))})).catch((e=>{let r;return delete t.loadPromise,n?r=O:(r=v,t.loadErrorTime=(new Date).getTime()),i(e,t,r),t}))}))}const Y="undefined"!=typeof window,Z={hashchange:[],popstate:[]},tt=["hashchange","popstate"];function et(t){let e;if("string"==typeof t)e=t;else if(this&&this.href)e=this.href;else{if(!(t&&t.currentTarget&&t.currentTarget.href&&t.preventDefault))throw Error(a(14,!1));e=t.currentTarget.href,t.preventDefault()}const n=lt(window.location.href),r=lt(e);0===e.indexOf("#")?window.location.hash=r.hash:n.host!==r.host&&r.host?window.location.href=e:r.pathname===n.pathname&&r.search===n.search?window.location.hash=r.hash:window.history.pushState(null,null,e)}function nt(t){if(t){const e=t[0].type;tt.indexOf(e)>=0&&Z[e].forEach((e=>{try{e.apply(this,t)}catch(t){setTimeout((()=>{throw t}))}}))}}let rt;function ot(){$t([],arguments)}function it(t,e){return function(){const n=window.location.href,r=t.apply(this,arguments),o=window.location.href;return rt&&n===o||window.dispatchEvent(st(window.history.state,e)),r}}function st(t,e){let n;try{n=new PopStateEvent("popstate",{state:t})}catch(e){n=document.createEvent("PopStateEvent"),n.initPopStateEvent("popstate",!1,!1,t)}return n.singleSpa=!0,n.singleSpaTrigger=e,n}let ut=null,at=!1;function ct(t){if(at)throw Error(a(43,!1));rt=!t||!t.hasOwnProperty("urlRerouteOnly")||t.urlRerouteOnly,at=!0,ut=window.history.replaceState,window.addEventListener("hashchange",ot),window.addEventListener("popstate",ot);const e=window.addEventListener,n=window.removeEventListener;window.addEventListener=function(t,n){if(!("function"==typeof n&&tt.indexOf(t)>=0)||_(Z[t],(t=>t===n)))return e.apply(this,arguments);Z[t].push(n)},window.removeEventListener=function(t,e){if(!("function"==typeof e&&tt.indexOf(t)>=0))return n.apply(this,arguments);Z[t]=Z[t].filter((t=>t!==e))},window.history.pushState=it(window.history.pushState,"pushState"),window.history.replaceState=it(ut,"replaceState")}function lt(t){const e=document.createElement("a");return e.href=t,e}Y&&(window.singleSpaNavigate?console.warn(a(41,!1)):window.singleSpaNavigate=et);let ft=!1;function pt(t=window.jQuery){if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!ft){const e=t.fn.on,n=t.fn.off;t.fn.on=function(t,n){return ht.call(this,e,window.addEventListener,t,n,arguments)},t.fn.off=function(t,e){return ht.call(this,n,window.removeEventListener,t,e,arguments)},ft=!0}}function ht(t,e,n,r,o){return"string"!=typeof n?t.apply(this,o):(n.split(/\s+/).forEach((t=>{tt.indexOf(t)>=0&&(e(t,r),n=n.replace(t,""))})),""===n.trim()?this:t.apply(this,o))}const mt={};function dt(t){return Promise.resolve().then((()=>{const e=mt[A(t)];if(!e)return t;if(t.status===l)return wt(t,e),t;if(t.status===y)return e.promise.then((()=>t));if(t.status!==m&&t.status!==v)return t;const n=t.status===v?Promise.resolve():q(t,"unload");return t.status=y,n.then((()=>(wt(t,e),t))).catch((n=>(function(t,e,n){delete mt[A(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,i(n,t,O),e.reject(n)}(t,e,n),t)))}))}function wt(t,e){delete mt[A(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=l,e.resolve()}function gt(t,e,n,r){mt[A(t)]={app:t,resolve:n,reject:r},Object.defineProperty(mt[A(t)],"promise",{get:e})}function Et(t){return mt[t]}const yt=[];function vt(){return yt.filter(T).map(A)}function Ot(){return yt.map(A)}function Tt(t){const e=_(yt,(e=>A(e)===t));return e?e.status:null}let Pt=!1;function At(t,e,n,r){const o=function(t,e,n,r){const o={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"==typeof t?(function(t){if(Array.isArray(t)||null===t)throw Error(a(39,!1));const e=["name","app","activeWhen","customProps"],n=Object.keys(t).reduce(((t,n)=>e.indexOf(n)>=0?t:t.concat(n)),[]);if(0!==n.length)throw Error(a(38,!1,e.join(", "),n.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(a(20,!1));if("object"!=typeof t.app&&"function"!=typeof t.app)throw Error(a(20,!1));const r=t=>"string"==typeof t||"function"==typeof t;if(!(r(t.activeWhen)||Array.isArray(t.activeWhen)&&t.activeWhen.every(r)))throw Error(a(24,!1));if(!Ut(t.customProps))throw Error(a(22,!1))}(t),o.name=t.name,o.loadApp=t.app,o.activeWhen=t.activeWhen,o.customProps=t.customProps):(function(t,e,n,r){if("string"!=typeof t||0===t.length)throw Error(a(20,!1));if(!e)throw Error(a(23,!1));if("function"!=typeof n)throw Error(a(24,!1));if(!Ut(r))throw Error(a(22,!1))}(t,e,n,r),o.name=t,o.loadApp=e,o.activeWhen=n,o.customProps=r),o.loadApp="function"!=typeof(i=o.loadApp)?()=>Promise.resolve(i):i,o.customProps=function(t){return t||{}}(o.customProps),o.activeWhen=function(t){let e=Array.isArray(t)?t:[t];return e=e.map((t=>"function"==typeof t?t:Dt(t))),t=>e.some((e=>e(t)))}(o.activeWhen),o;var i}(t,e,n,r);if(Gt()||Pt||(Pt=!0,setTimeout((()=>{Gt()||console.warn(a(1,!1))}),5e3)),-1!==Ot().indexOf(o.name))throw Error(a(21,!1,o.name));yt.push(S({loadErrorTime:null,status:l,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},o)),Y&&(pt(),$t())}function bt(t=window.location){return yt.filter((e=>e.activeWhen(t))).map(A)}function Nt(t){if(0===yt.filter((e=>A(e)===t)).length)throw Error(a(25,!1,t));return St(t).then((()=>{const e=yt.map(A).indexOf(t);yt.splice(e,1)}))}function St(t,e={waitForUnmount:!1}){if("string"!=typeof t)throw Error(a(26,!1));const n=_(yt,(e=>A(e)===t));if(!n)throw Error(a(27,!1,t));const r=Et(A(n));if(e&&e.waitForUnmount){if(r)return r.promise;{const t=new Promise(((e,r)=>{gt(n,(()=>t),e,r)}));return t}}{let t;return r?(t=r.promise,_t(n,r.resolve,r.reject)):t=new Promise(((e,r)=>{gt(n,(()=>t),e,r),_t(n,e,r)})),t}}function _t(t,e,n){j(t).then(dt).then((()=>{e(),setTimeout((()=>{$t()}))})).catch(n)}function Ut(t){return!t||"function"==typeof t||"object"==typeof t&&null!==t&&!Array.isArray(t)}function Dt(t,e){const n=function(t,e){let n=0,r=!1,o="^";"/"!==t[0]&&(t="/"+t);for(let e=0;e<t.length;e++){const n=t[e],o=r&&"/"===n;(!r&&":"===n||o)&&i(e)}return i(t.length),new RegExp(o,"i");function i(i){const s=t.slice(n,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=r?"[^/]+/?":s,i===t.length)if(r)e&&(o+="$");else{const t=e?"":".*";o="/"===o.charAt(o.length-1)?`${o}${t}$`:`${o}(/${t})?(#.*)?$`}r=!r,n=i}}(t,e);return t=>{let e=t.origin;e||(e=`${t.protocol}//${t.host}`);const r=t.href.replace(e,"").replace(t.search,"").split("?")[0];return n.test(r)}}let Mt=!1,Rt=[],jt=Y&&window.location.href;function Lt(){return $t()}function $t(t=[],e,n=!1){if(Mt)return new Promise(((t,n)=>{Rt.push({resolve:t,reject:n,eventArguments:e})}));const{appsToUnload:o,appsToUnmount:i,appsToLoad:s,appsToMount:u}=function(){const t=[],e=[],n=[],r=[],o=(new Date).getTime();return yt.forEach((i=>{const s=i.status!==O&&P(i);switch(i.status){case v:s&&o-i.loadErrorTime>=200&&n.push(i);break;case l:case f:s&&n.push(i);break;case p:case m:!s&&Et(A(i))?t.push(i):s&&r.push(i);break;case w:s||e.push(i)}})),{appsToUnload:t,appsToUnmount:e,appsToLoad:n,appsToMount:r}}();let c,h=[],d=jt,g=jt=window.location.href;return Gt()?(Mt=!0,c=o.concat(s,i,u),Promise.resolve().then((()=>(N(0===c.length?"before-no-app-change":"before-app-change",b(!0)),N("before-routing-event",b(!0,{cancelNavigation:E})),Promise.all(h).then((n=>{if(n.some((t=>t)))return ut.call(window.history,history.state,"",d.substring(location.origin.length)),jt=location.href,Mt=!1,$t(t,e,!0);const r=o.map(dt),a=i.map(j).map((t=>t.then(dt))).concat(r),c=Promise.all(a);c.then((()=>{N("before-mount-routing-event",b(!0))}));const l=s.map((t=>X(t).then((t=>It(t,c))))),f=u.filter((t=>s.indexOf(t)<0)).map((t=>It(t,c)));return c.catch((t=>{throw T(),t})).then((()=>(T(),Promise.all(l.concat(f)).catch((e=>{throw t.forEach((t=>t.reject(e))),e})).then(y))))})))))):(c=s,Promise.resolve().then((()=>{const t=s.map(X);return Promise.all(t).then(T).then((()=>[])).catch((t=>{throw T(),t}))})));function E(t=!0){const e="function"==typeof(null==t?void 0:t.then)?t:Promise.resolve(t);h.push(e.catch((t=>(console.warn(Error(a(42,!1))),console.warn(t),!1))))}function y(){const e=vt();t.forEach((t=>t.resolve(e)));try{N(0===c.length?"no-app-change":"app-change",b()),N("routing-event",b())}catch(t){setTimeout((()=>{throw t}))}if(Mt=!1,Rt.length>0){const t=Rt;Rt=[],$t(t)}return e}function T(){n||(t.forEach((t=>{nt(t.eventArguments)})),nt(e))}function b(t=!1,n){const r={},a={[w]:[],[m]:[],[l]:[],[O]:[]};t?(s.concat(u).forEach(((t,e)=>{p(t,w)})),o.forEach((t=>{p(t,l)})),i.forEach((t=>{p(t,m)}))):c.forEach((t=>{p(t)}));const f={detail:{newAppStatuses:r,appsByNewStatus:a,totalAppChanges:c.length,originalEvent:null==e?void 0:e[0],oldUrl:d,newUrl:g}};return n&&S(f.detail,n),f;function p(t,e){const n=A(t);e=e||Tt(n),r[n]=e,(a[e]=a[e]||[]).push(n)}}function N(t,e){n||window.dispatchEvent(new r(`single-spa:${t}`,e))}}function It(t,e){return P(t)?R(t).then((t=>e.then((()=>P(t)?I(t):t)))):e.then((()=>t))}let xt=!1;function Bt(t){xt=!0,Y&&(ct(t),$t())}function Gt(){return xt}var Ct={getRawAppData:function(){return[...yt]},reroute:$t,NOT_LOADED:l,toLoadPromise:X,toBootstrapPromise:R,unregisterApplication:Nt};Y&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=Ct)}}})); | ||
//# sourceMappingURL=single-spa.min.js.map |
@@ -1,2 +0,2 @@ | ||
/* single-spa@6.0.0-beta.1 - ESM ES5 - dev */ | ||
/* single-spa@6.0.0-beta.2 - ESM ES5 - dev */ | ||
var singleSpa = /*#__PURE__*/Object.freeze({ | ||
@@ -373,2 +373,3 @@ __proto__: null, | ||
appOrParcel.status = MOUNTING; | ||
return reasonableTime(appOrParcel, "mount").then(function () { | ||
@@ -375,0 +376,0 @@ appOrParcel.status = MOUNTED; |
@@ -1,3 +0,3 @@ | ||
/* single-spa@6.0.0-beta.1 - ESM ES5 - prod */ | ||
var t=Object.freeze({__proto__:null,get start(){return Gt},get ensureJQuerySupport(){return lt},get setBootstrapMaxTime(){return F},get setMountMaxTime(){return H},get setUnmountMaxTime(){return J},get setUnloadMaxTime(){return Q},get registerApplication(){return Tt},get unregisterApplication(){return Nt},get getMountedApps(){return Et},get getAppStatus(){return Ot},get unloadApplication(){return St},get checkActivityFunctions(){return At},get getAppNames(){return Pt},get pathToActiveWhen(){return Ut},get navigateToUrl(){return nt},get patchHistoryApi(){return ct},get triggerAppChange(){return Rt},get addErrorHandler(){return a},get removeErrorHandler(){return c},get mountRootParcel(){return W},get NOT_LOADED(){return l},get LOADING_SOURCE_CODE(){return p},get NOT_BOOTSTRAPPED(){return h},get BOOTSTRAPPING(){return m},get NOT_MOUNTED(){return v},get MOUNTING(){return d},get UPDATING(){return g},get LOAD_ERROR(){return E},get MOUNTED(){return w},get UNMOUNTING(){return y},get SKIP_BECAUSE_BROKEN(){return P}});function n(t){return(n="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,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).CustomEvent,o=function(){try{var t=new e("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?e:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,n){var r=document.createEvent("CustomEvent");return n?r.initCustomEvent(t,n.bubbles,n.cancelable,n.detail):r.initCustomEvent(t,!1,!1,void 0),r}:function(t,n){var r=document.createEventObject();return r.type=t,n?(r.bubbles=Boolean(n.bubbles),r.cancelable=Boolean(n.cancelable),r.detail=n.detail):(r.bubbles=!1,r.cancelable=!1,r.detail=void 0),r},i=[];function u(t,n,r){var e=f(t,n,r);i.length?i.forEach((function(t){return t(e)})):setTimeout((function(){throw e}))}function a(t){if("function"!=typeof t)throw Error(s(28,!1));i.push(t)}function c(t){if("function"!=typeof t)throw Error(s(29,!1));var n=!1;return i=i.filter((function(r){var e=r===t;return n=n||e,!e})),n}function s(t,n){for(var r=arguments.length,e=new Array(r>2?r-2:0),o=2;o<r;o++)e[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(e.length?"&arg=".concat(e.join("&arg=")):"")}function f(t,n,r){var e,o="".concat(N(n)," '").concat(T(n),"' died in status ").concat(n.status,": ");if(t instanceof Error){try{t.message=o+t.message}catch(t){}e=t}else{console.warn(s(30,!1,n.status,T(n)));try{e=Error(o+JSON.stringify(t))}catch(n){e=t}}return e.appOrParcelName=T(n),n.status=r,e}var l="NOT_LOADED",p="LOADING_SOURCE_CODE",h="NOT_BOOTSTRAPPED",m="BOOTSTRAPPING",v="NOT_MOUNTED",d="MOUNTING",w="MOUNTED",g="UPDATING",y="UNMOUNTING",E="LOAD_ERROR",P="SKIP_BECAUSE_BROKEN";function O(t){return t.status===w}function b(t){try{return t.activeWhen(window.location)}catch(n){return u(n,t,P),!1}}function T(t){return t.name}function A(t){return Boolean(t.unmountThisParcel)}function N(t){return A(t)?"parcel":"application"}function S(){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 _(t,n){for(var r=0;r<t.length;r++)if(n(t[r]))return t[r];return null}function D(t){return t&&("function"==typeof t||(n=t,Array.isArray(n)&&!_(n,(function(t){return"function"!=typeof t}))));var n}function U(t,n){var r=t[n]||[];0===(r=Array.isArray(r)?r:[r]).length&&(r=[function(){return Promise.resolve()}]);var e=N(t),o=T(t);return function(t){return r.reduce((function(r,i,u){return r.then((function(){var r=i(t);return j(r)?r:Promise.reject(s(15,!1,e,o,n,u))}))}),Promise.resolve())}}function j(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function M(t,n){return Promise.resolve().then((function(){return t.status!==h?t:(t.status=m,t.bootstrap?V(t,"bootstrap").then(r).catch((function(r){if(n)throw f(r,t,P);return u(r,t,P),t})):Promise.resolve().then(r))}));function r(){return t.status=v,t}}function L(t,n){return Promise.resolve().then((function(){if(t.status!==w)return t;t.status=y;var r=Object.keys(t.parcels).map((function(n){return t.parcels[n].unmountThisParcel()}));return Promise.all(r).then(e,(function(r){return e().then((function(){var e=Error(r.message);if(n)throw f(e,t,P);u(e,t,P)}))})).then((function(){return t}));function e(){return V(t,"unmount").then((function(){t.status=v})).catch((function(r){if(n)throw f(r,t,P);u(r,t,P)}))}}))}var R=!1,x=!1;function I(t,n){return Promise.resolve().then((function(){return t.status!==v?t:(R||(window.dispatchEvent(new o("single-spa:before-first-mount")),R=!0),V(t,"mount").then((function(){return t.status=w,x||(window.dispatchEvent(new o("single-spa:first-mount")),x=!0),t})).catch((function(r){return t.status=w,L(t,!0).then(e,e);function e(){if(n)throw f(r,t,P);return u(r,t,P),t}})))}))}var B=0,G={parcels:{}};function W(){return C.apply(G,arguments)}function C(t,r){var e=this;if(!t||"object"!==n(t)&&"function"!=typeof t)throw Error(s(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(s(3,!1,n(t.name)));var o=B++,i=t.name||"parcel-".concat(o);if("object"!==n(r))throw Error(s(4,!1,i,n(r)));if(!r.domElement)throw Error(s(5,!1,i));var u,a="function"==typeof t,c=a?t:function(){return Promise.resolve(t)},l={id:o,parcels:{},status:a?p:h,customProps:r,parentName:T(e),unmountThisParcel:function(){return O.then((function(){if(l.status!==w)throw Error(s(6,!1,i,l.status));return L(l,!0)})).then((function(t){return l.parentName&&delete e.parcels[l.id],t})).then((function(t){return d(t),t})).catch((function(t){throw l.status=P,y(t),t}))}};e.parcels[o]=l;var m=c();if(!m||"function"!=typeof m.then)throw Error(s(7,!1));var d,y,E=(m=m.then((function(t){if(!t)throw Error(s(8,!1));if(i=t.name||"parcel-".concat(o),Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!D(t.bootstrap))throw Error(s(9,!1,i));if(!D(t.mount))throw Error(s(10,!1,i));if(!D(t.unmount))throw Error(s(11,!1,i));if(t.update&&!D(t.update))throw Error(s(12,!1,i));var n=U(t,"bootstrap"),r=U(t,"mount"),e=U(t,"unmount");l.status=h,l.name=i,l.bootstrap=n,l.mount=r,l.unmount=e,l.timeouts=q(t.timeouts),t.update&&(l.update=U(t,"update"),u.update=function(t){return l.customProps=t,$(function(t){return Promise.resolve().then((function(){if(t.status!==w)throw Error(s(32,!1,T(t)));return t.status=g,V(t,"update").then((function(){return t.status=w,t})).catch((function(n){throw f(n,t,P)}))}))}(l))})}))).then((function(){return M(l,!0)})),O=E.then((function(){return I(l,!0)})),b=new Promise((function(t,n){d=t,y=n}));return u={mount:function(){return $(Promise.resolve().then((function(){if(l.status!==v)throw Error(s(13,!1,i,l.status));return e.parcels[o]=l,I(l)})))},unmount:function(){return $(l.unmountThisParcel())},getStatus:function(){return l.status},loadPromise:$(m),bootstrapPromise:$(E),mountPromise:$(O),unmountPromise:$(b)}}function $(t){return t.then((function(){return null}))}function k(r){var e=T(r),o="function"==typeof r.customProps?r.customProps(e,window.location):r.customProps;("object"!==n(o)||null===o||Array.isArray(o))&&(o={},console.warn(s(40,!1),e,o));var i=S({},o,{name:e,mountParcel:C.bind(r),singleSpa:t});return A(r)&&(i.unmountSelf=r.unmountThisParcel),i}var K={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:1e3},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},update:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3}};function F(t,n,r){if("number"!=typeof t||t<=0)throw Error(s(16,!1));K.bootstrap={millis:t,dieOnTimeout:n,warningMillis:r||1e3}}function H(t,n,r){if("number"!=typeof t||t<=0)throw Error(s(17,!1));K.mount={millis:t,dieOnTimeout:n,warningMillis:r||1e3}}function J(t,n,r){if("number"!=typeof t||t<=0)throw Error(s(18,!1));K.unmount={millis:t,dieOnTimeout:n,warningMillis:r||1e3}}function Q(t,n,r){if("number"!=typeof t||t<=0)throw Error(s(19,!1));K.unload={millis:t,dieOnTimeout:n,warningMillis:r||1e3}}function V(t,n){var r=t.timeouts[n],e=r.warningMillis,o=N(t);return new Promise((function(i,u){var a=!1,c=!1;t[n](k(t)).then((function(t){a=!0,i(t)})).catch((function(t){a=!0,u(t)})),setTimeout((function(){return l(1)}),e),setTimeout((function(){return l(!0)}),r.millis);var f=s(31,!1,n,o,T(t),r.millis);function l(t){if(!a)if(!0===t)c=!0,r.dieOnTimeout?u(Error(f)):console.error(f);else if(!c){var n=t,o=n*e;console.warn(f),o+e<r.millis&&setTimeout((function(){return l(n+1)}),e)}}}))}function q(t){var n={};for(var r in K)n[r]=S({},K[r],t&&t[r]||{});return n}function z(t){return Promise.resolve().then((function(){return t.loadPromise?t.loadPromise:t.status!==l&&t.status!==E?t:(t.status=p,t.loadPromise=Promise.resolve().then((function(){var o=t.loadApp(k(t));if(!j(o))throw e=!0,Error(s(33,!1,T(t)));return o.then((function(e){var o;t.loadErrorTime=null,"object"!==n(r=e)&&(o=34),Object.prototype.hasOwnProperty.call(r,"bootstrap")&&!D(r.bootstrap)&&(o=35),D(r.mount)||(o=36),D(r.unmount)||(o=37);var i=N(r);if(o){var a;try{a=JSON.stringify(r)}catch(t){}return console.error(s(o,!1,i,T(t),a),r),u(void 0,t,P),t}return r.devtools&&r.devtools.overlays&&(t.devtools.overlays=S({},t.devtools.overlays,r.devtools.overlays)),t.status=h,t.bootstrap=U(r,"bootstrap"),t.mount=U(r,"mount"),t.unmount=U(r,"unmount"),t.unload=U(r,"unload"),t.timeouts=q(r.timeouts),delete t.loadPromise,t}))})).catch((function(n){var r;return delete t.loadPromise,e?r=P:(r=E,t.loadErrorTime=(new Date).getTime()),u(n,t,r),t})));var r,e}))}var X,Y="undefined"!=typeof window,Z={hashchange:[],popstate:[]},tt=["hashchange","popstate"];function nt(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(s(14,!1));n=t.currentTarget.href,t.preventDefault()}var r=st(window.location.href),e=st(n);0===n.indexOf("#")?window.location.hash=e.hash:r.host!==e.host&&e.host?window.location.href=n:e.pathname===r.pathname&&e.search===r.search?window.location.hash=e.hash:window.history.pushState(null,null,n)}function rt(t){var n=this;if(t){var r=t[0].type;tt.indexOf(r)>=0&&Z[r].forEach((function(r){try{r.apply(n,t)}catch(t){setTimeout((function(){throw t}))}}))}}function et(){xt([],arguments)}function ot(t,n){return function(){var r=window.location.href,e=t.apply(this,arguments),o=window.location.href;return X&&r===o||window.dispatchEvent(it(window.history.state,n)),e}}function it(t,n){var r;try{r=new PopStateEvent("popstate",{state:t})}catch(n){(r=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,t)}return r.singleSpa=!0,r.singleSpaTrigger=n,r}var ut=null,at=!1;function ct(t){if(at)throw Error(s(43,!1));X=!t||!t.hasOwnProperty("urlRerouteOnly")||t.urlRerouteOnly,at=!0,ut=window.history.replaceState,window.addEventListener("hashchange",et),window.addEventListener("popstate",et);var n=window.addEventListener,r=window.removeEventListener;window.addEventListener=function(t,r){if(!("function"==typeof r&&tt.indexOf(t)>=0)||_(Z[t],(function(t){return t===r})))return n.apply(this,arguments);Z[t].push(r)},window.removeEventListener=function(t,n){if(!("function"==typeof n&&tt.indexOf(t)>=0))return r.apply(this,arguments);Z[t]=Z[t].filter((function(t){return t!==n}))},window.history.pushState=ot(window.history.pushState,"pushState"),window.history.replaceState=ot(ut,"replaceState")}function st(t){var n=document.createElement("a");return n.href=t,n}Y&&(window.singleSpaNavigate?console.warn(s(41,!1)):window.singleSpaNavigate=nt);var ft=!1;function lt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.jQuery;if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!ft){var n=t.fn.on,r=t.fn.off;t.fn.on=function(t,r){return pt.call(this,n,window.addEventListener,t,r,arguments)},t.fn.off=function(t,n){return pt.call(this,r,window.removeEventListener,t,n,arguments)},ft=!0}}function pt(t,n,r,e,o){return"string"!=typeof r?t.apply(this,o):(r.split(/\s+/).forEach((function(t){tt.indexOf(t)>=0&&(n(t,e),r=r.replace(t,""))})),""===r.trim()?this:t.apply(this,o))}var ht={};function mt(t){return Promise.resolve().then((function(){var n=ht[T(t)];if(!n)return t;if(t.status===l)return vt(t,n),t;if("UNLOADING"===t.status)return n.promise.then((function(){return t}));if(t.status!==v&&t.status!==E)return t;var r=t.status===E?Promise.resolve():V(t,"unload");return t.status="UNLOADING",r.then((function(){return vt(t,n),t})).catch((function(r){return function(t,n,r){delete ht[T(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,u(r,t,P),n.reject(r)}(t,n,r),t}))}))}function vt(t,n){delete ht[T(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=l,n.resolve()}function dt(t,n,r,e){ht[T(t)]={app:t,resolve:r,reject:e},Object.defineProperty(ht[T(t)],"promise",{get:n})}function wt(t){return ht[t]}var gt=[];function yt(){var t=[],n=[],r=[],e=[],o=(new Date).getTime();return gt.forEach((function(i){var u=i.status!==P&&b(i);switch(i.status){case E:u&&o-i.loadErrorTime>=200&&r.push(i);break;case l:case p:u&&r.push(i);break;case h:case v:!u&&wt(T(i))?t.push(i):u&&e.push(i);break;case w:u||n.push(i)}})),{appsToUnload:t,appsToUnmount:n,appsToLoad:r,appsToMount:e}}function Et(){return gt.filter(O).map(T)}function Pt(){return gt.map(T)}function Ot(t){var n=_(gt,(function(n){return T(n)===t}));return n?n.status:null}var bt=!1;function Tt(t,r,e,o){var i=function(t,r,e,o){var i,u={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"===n(t)?(function(t){if(Array.isArray(t)||null===t)throw Error(s(39,!1));var r=["name","app","activeWhen","customProps"],e=Object.keys(t).reduce((function(t,n){return r.indexOf(n)>=0?t:t.concat(n)}),[]);if(0!==e.length)throw Error(s(38,!1,r.join(", "),e.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(s(20,!1));if("object"!==n(t.app)&&"function"!=typeof t.app)throw Error(s(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(s(24,!1));if(!Dt(t.customProps))throw Error(s(22,!1))}(t),u.name=t.name,u.loadApp=t.app,u.activeWhen=t.activeWhen,u.customProps=t.customProps):(function(t,n,r,e){if("string"!=typeof t||0===t.length)throw Error(s(20,!1));if(!n)throw Error(s(23,!1));if("function"!=typeof r)throw Error(s(24,!1));if(!Dt(e))throw Error(s(22,!1))}(t,r,e,o),u.name=t,u.loadApp=r,u.activeWhen=e,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:Ut(t)})),function(t){return n.some((function(n){return n(t)}))}}(u.activeWhen),u}(t,r,e,o);if(Wt()||bt||(bt=!0,setTimeout((function(){Wt()||console.warn(s(1,!1))}),5e3)),-1!==Pt().indexOf(i.name))throw Error(s(21,!1,i.name));gt.push(S({loadErrorTime:null,status:l,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},i)),Y&&(lt(),xt())}function At(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location;return gt.filter((function(n){return n.activeWhen(t)})).map(T)}function Nt(t){if(0===gt.filter((function(n){return T(n)===t})).length)throw Error(s(25,!1,t));return St(t).then((function(){var n=gt.map(T).indexOf(t);gt.splice(n,1)}))}function St(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{waitForUnmount:!1};if("string"!=typeof t)throw Error(s(26,!1));var r=_(gt,(function(n){return T(n)===t}));if(!r)throw Error(s(27,!1,t));var e,o=wt(T(r));if(n&&n.waitForUnmount){if(o)return o.promise;var i=new Promise((function(t,n){dt(r,(function(){return i}),t,n)}));return i}return o?(e=o.promise,_t(r,o.resolve,o.reject)):e=new Promise((function(t,n){dt(r,(function(){return e}),t,n),_t(r,t,n)})),e}function _t(t,n,r){L(t).then(mt).then((function(){n(),setTimeout((function(){xt()}))})).catch(r)}function Dt(t){return!t||"function"==typeof t||"object"===n(t)&&null!==t&&!Array.isArray(t)}function Ut(t,n){var r=function(t,n){var r=0,e=!1,o="^";"/"!==t[0]&&(t="/"+t);for(var i=0;i<t.length;i++){var u=t[i];(!e&&":"===u||e&&"/"===u)&&a(i)}return a(t.length),new RegExp(o,"i");function a(i){var u=t.slice(r,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=e?"[^/]+/?":u,i===t.length)if(e)n&&(o+="$");else{var a=n?"":".*";o="/"===o.charAt(o.length-1)?"".concat(o).concat(a,"$"):"".concat(o,"(/").concat(a,")?(#.*)?$")}e=!e,r=i}}(t,n);return function(t){var n=t.origin;n||(n="".concat(t.protocol,"//").concat(t.host));var e=t.href.replace(n,"").replace(t.search,"").split("?")[0];return r.test(e)}}var jt=!1,Mt=[],Lt=Y&&window.location.href;function Rt(){return xt()}function xt(){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(jt)return new Promise((function(t,r){Mt.push({resolve:t,reject:r,eventArguments:n})}));var i,u=yt(),a=u.appsToUnload,c=u.appsToUnmount,f=u.appsToLoad,p=u.appsToMount,h=[],m=Lt,d=Lt=window.location.href;return Wt()?(jt=!0,i=a.concat(f,c,p),E()):(i=f,y());function g(){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(s(42,!1))),console.warn(t),!1})))}function y(){return Promise.resolve().then((function(){var t=f.map(z);return Promise.all(t).then(b).then((function(){return[]})).catch((function(t){throw b(),t}))}))}function E(){return Promise.resolve().then((function(){return N(0===i.length?"before-no-app-change":"before-app-change",A(!0)),N("before-routing-event",A(!0,{cancelNavigation:g})),Promise.all(h).then((function(r){if(r.some((function(t){return t})))return ut.call(window.history,history.state,"",m.substring(location.origin.length)),Lt=location.href,jt=!1,xt(t,n,!0);var e=a.map(mt),o=c.map(L).map((function(t){return t.then(mt)})).concat(e),i=Promise.all(o);i.then((function(){N("before-mount-routing-event",A(!0))}));var u=f.map((function(t){return z(t).then((function(t){return It(t,i)}))})),s=p.filter((function(t){return f.indexOf(t)<0})).map((function(t){return It(t,i)}));return i.catch((function(t){throw b(),t})).then((function(){return b(),Promise.all(u.concat(s)).catch((function(n){throw t.forEach((function(t){return t.reject(n)})),n})).then(O)}))}))}))}function O(){var n=Et();t.forEach((function(t){return t.resolve(n)}));try{N(0===i.length?"no-app-change":"app-change",A()),N("routing-event",A())}catch(t){setTimeout((function(){throw t}))}if(jt=!1,Mt.length>0){var r=Mt;Mt=[],xt(r)}return n}function b(){e||(t.forEach((function(t){rt(t.eventArguments)})),rt(n))}function A(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1?arguments[1]:void 0,u={},s=(r(t={},w,[]),r(t,v,[]),r(t,l,[]),r(t,P,[]),t);e?(f.concat(p).forEach((function(t,n){g(t,w)})),a.forEach((function(t){g(t,l)})),c.forEach((function(t){g(t,v)}))):i.forEach((function(t){g(t)}));var h={detail:{newAppStatuses:u,appsByNewStatus:s,totalAppChanges:i.length,originalEvent:null==n?void 0:n[0],oldUrl:m,newUrl:d}};return o&&S(h.detail,o),h;function g(t,n){var r=T(t);n=n||Ot(r),u[r]=n,(s[n]=s[n]||[]).push(r)}}function N(t,n){e||window.dispatchEvent(new o("single-spa:".concat(t),n))}}function It(t,n){return b(t)?M(t).then((function(t){return n.then((function(){return b(t)?I(t):t}))})):n.then((function(){return t}))}var Bt=!1;function Gt(t){Bt=!0,Y&&(ct(t),xt())}function Wt(){return Bt}var Ct={getRawAppData:function(){return[].concat(gt)},reroute:xt,NOT_LOADED:l,toLoadPromise:z,toBootstrapPromise:M,unregisterApplication:Nt};Y&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=Ct);export{m as BOOTSTRAPPING,p as LOADING_SOURCE_CODE,E as LOAD_ERROR,w as MOUNTED,d as MOUNTING,h as NOT_BOOTSTRAPPED,l as NOT_LOADED,v as NOT_MOUNTED,P as SKIP_BECAUSE_BROKEN,y as UNMOUNTING,g as UPDATING,a as addErrorHandler,At as checkActivityFunctions,lt as ensureJQuerySupport,Pt as getAppNames,Ot as getAppStatus,Et as getMountedApps,W as mountRootParcel,nt as navigateToUrl,ct as patchHistoryApi,Ut as pathToActiveWhen,Tt as registerApplication,c as removeErrorHandler,F as setBootstrapMaxTime,H as setMountMaxTime,Q as setUnloadMaxTime,J as setUnmountMaxTime,Gt as start,Rt as triggerAppChange,St as unloadApplication,Nt as unregisterApplication}; | ||
/* single-spa@6.0.0-beta.2 - ESM ES5 - prod */ | ||
var t=Object.freeze({__proto__:null,get start(){return Gt},get ensureJQuerySupport(){return lt},get setBootstrapMaxTime(){return F},get setMountMaxTime(){return H},get setUnmountMaxTime(){return J},get setUnloadMaxTime(){return Q},get registerApplication(){return Tt},get unregisterApplication(){return Nt},get getMountedApps(){return Et},get getAppStatus(){return Ot},get unloadApplication(){return St},get checkActivityFunctions(){return At},get getAppNames(){return Pt},get pathToActiveWhen(){return Ut},get navigateToUrl(){return nt},get patchHistoryApi(){return ct},get triggerAppChange(){return Rt},get addErrorHandler(){return a},get removeErrorHandler(){return c},get mountRootParcel(){return W},get NOT_LOADED(){return l},get LOADING_SOURCE_CODE(){return p},get NOT_BOOTSTRAPPED(){return h},get BOOTSTRAPPING(){return m},get NOT_MOUNTED(){return v},get MOUNTING(){return d},get UPDATING(){return g},get LOAD_ERROR(){return E},get MOUNTED(){return w},get UNMOUNTING(){return y},get SKIP_BECAUSE_BROKEN(){return P}});function n(t){return(n="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,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).CustomEvent,o=function(){try{var t=new e("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?e:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,n){var r=document.createEvent("CustomEvent");return n?r.initCustomEvent(t,n.bubbles,n.cancelable,n.detail):r.initCustomEvent(t,!1,!1,void 0),r}:function(t,n){var r=document.createEventObject();return r.type=t,n?(r.bubbles=Boolean(n.bubbles),r.cancelable=Boolean(n.cancelable),r.detail=n.detail):(r.bubbles=!1,r.cancelable=!1,r.detail=void 0),r},i=[];function u(t,n,r){var e=f(t,n,r);i.length?i.forEach((function(t){return t(e)})):setTimeout((function(){throw e}))}function a(t){if("function"!=typeof t)throw Error(s(28,!1));i.push(t)}function c(t){if("function"!=typeof t)throw Error(s(29,!1));var n=!1;return i=i.filter((function(r){var e=r===t;return n=n||e,!e})),n}function s(t,n){for(var r=arguments.length,e=new Array(r>2?r-2:0),o=2;o<r;o++)e[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(e.length?"&arg=".concat(e.join("&arg=")):"")}function f(t,n,r){var e,o="".concat(N(n)," '").concat(T(n),"' died in status ").concat(n.status,": ");if(t instanceof Error){try{t.message=o+t.message}catch(t){}e=t}else{console.warn(s(30,!1,n.status,T(n)));try{e=Error(o+JSON.stringify(t))}catch(n){e=t}}return e.appOrParcelName=T(n),n.status=r,e}var l="NOT_LOADED",p="LOADING_SOURCE_CODE",h="NOT_BOOTSTRAPPED",m="BOOTSTRAPPING",v="NOT_MOUNTED",d="MOUNTING",w="MOUNTED",g="UPDATING",y="UNMOUNTING",E="LOAD_ERROR",P="SKIP_BECAUSE_BROKEN";function O(t){return t.status===w}function b(t){try{return t.activeWhen(window.location)}catch(n){return u(n,t,P),!1}}function T(t){return t.name}function A(t){return Boolean(t.unmountThisParcel)}function N(t){return A(t)?"parcel":"application"}function S(){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 _(t,n){for(var r=0;r<t.length;r++)if(n(t[r]))return t[r];return null}function D(t){return t&&("function"==typeof t||(n=t,Array.isArray(n)&&!_(n,(function(t){return"function"!=typeof t}))));var n}function U(t,n){var r=t[n]||[];0===(r=Array.isArray(r)?r:[r]).length&&(r=[function(){return Promise.resolve()}]);var e=N(t),o=T(t);return function(t){return r.reduce((function(r,i,u){return r.then((function(){var r=i(t);return j(r)?r:Promise.reject(s(15,!1,e,o,n,u))}))}),Promise.resolve())}}function j(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function M(t,n){return Promise.resolve().then((function(){return t.status!==h?t:(t.status=m,t.bootstrap?V(t,"bootstrap").then(r).catch((function(r){if(n)throw f(r,t,P);return u(r,t,P),t})):Promise.resolve().then(r))}));function r(){return t.status=v,t}}function L(t,n){return Promise.resolve().then((function(){if(t.status!==w)return t;t.status=y;var r=Object.keys(t.parcels).map((function(n){return t.parcels[n].unmountThisParcel()}));return Promise.all(r).then(e,(function(r){return e().then((function(){var e=Error(r.message);if(n)throw f(e,t,P);u(e,t,P)}))})).then((function(){return t}));function e(){return V(t,"unmount").then((function(){t.status=v})).catch((function(r){if(n)throw f(r,t,P);u(r,t,P)}))}}))}var R=!1,x=!1;function I(t,n){return Promise.resolve().then((function(){return t.status!==v?t:(R||(window.dispatchEvent(new o("single-spa:before-first-mount")),R=!0),t.status=d,V(t,"mount").then((function(){return t.status=w,x||(window.dispatchEvent(new o("single-spa:first-mount")),x=!0),t})).catch((function(r){return t.status=w,L(t,!0).then(e,e);function e(){if(n)throw f(r,t,P);return u(r,t,P),t}})))}))}var B=0,G={parcels:{}};function W(){return C.apply(G,arguments)}function C(t,r){var e=this;if(!t||"object"!==n(t)&&"function"!=typeof t)throw Error(s(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(s(3,!1,n(t.name)));var o=B++,i=t.name||"parcel-".concat(o);if("object"!==n(r))throw Error(s(4,!1,i,n(r)));if(!r.domElement)throw Error(s(5,!1,i));var u,a="function"==typeof t,c=a?t:function(){return Promise.resolve(t)},l={id:o,parcels:{},status:a?p:h,customProps:r,parentName:T(e),unmountThisParcel:function(){return O.then((function(){if(l.status!==w)throw Error(s(6,!1,i,l.status));return L(l,!0)})).then((function(t){return l.parentName&&delete e.parcels[l.id],t})).then((function(t){return d(t),t})).catch((function(t){throw l.status=P,y(t),t}))}};e.parcels[o]=l;var m=c();if(!m||"function"!=typeof m.then)throw Error(s(7,!1));var d,y,E=(m=m.then((function(t){if(!t)throw Error(s(8,!1));if(i=t.name||"parcel-".concat(o),Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!D(t.bootstrap))throw Error(s(9,!1,i));if(!D(t.mount))throw Error(s(10,!1,i));if(!D(t.unmount))throw Error(s(11,!1,i));if(t.update&&!D(t.update))throw Error(s(12,!1,i));var n=U(t,"bootstrap"),r=U(t,"mount"),e=U(t,"unmount");l.status=h,l.name=i,l.bootstrap=n,l.mount=r,l.unmount=e,l.timeouts=q(t.timeouts),t.update&&(l.update=U(t,"update"),u.update=function(t){return l.customProps=t,$(function(t){return Promise.resolve().then((function(){if(t.status!==w)throw Error(s(32,!1,T(t)));return t.status=g,V(t,"update").then((function(){return t.status=w,t})).catch((function(n){throw f(n,t,P)}))}))}(l))})}))).then((function(){return M(l,!0)})),O=E.then((function(){return I(l,!0)})),b=new Promise((function(t,n){d=t,y=n}));return u={mount:function(){return $(Promise.resolve().then((function(){if(l.status!==v)throw Error(s(13,!1,i,l.status));return e.parcels[o]=l,I(l)})))},unmount:function(){return $(l.unmountThisParcel())},getStatus:function(){return l.status},loadPromise:$(m),bootstrapPromise:$(E),mountPromise:$(O),unmountPromise:$(b)}}function $(t){return t.then((function(){return null}))}function k(r){var e=T(r),o="function"==typeof r.customProps?r.customProps(e,window.location):r.customProps;("object"!==n(o)||null===o||Array.isArray(o))&&(o={},console.warn(s(40,!1),e,o));var i=S({},o,{name:e,mountParcel:C.bind(r),singleSpa:t});return A(r)&&(i.unmountSelf=r.unmountThisParcel),i}var K={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:1e3},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},update:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3}};function F(t,n,r){if("number"!=typeof t||t<=0)throw Error(s(16,!1));K.bootstrap={millis:t,dieOnTimeout:n,warningMillis:r||1e3}}function H(t,n,r){if("number"!=typeof t||t<=0)throw Error(s(17,!1));K.mount={millis:t,dieOnTimeout:n,warningMillis:r||1e3}}function J(t,n,r){if("number"!=typeof t||t<=0)throw Error(s(18,!1));K.unmount={millis:t,dieOnTimeout:n,warningMillis:r||1e3}}function Q(t,n,r){if("number"!=typeof t||t<=0)throw Error(s(19,!1));K.unload={millis:t,dieOnTimeout:n,warningMillis:r||1e3}}function V(t,n){var r=t.timeouts[n],e=r.warningMillis,o=N(t);return new Promise((function(i,u){var a=!1,c=!1;t[n](k(t)).then((function(t){a=!0,i(t)})).catch((function(t){a=!0,u(t)})),setTimeout((function(){return l(1)}),e),setTimeout((function(){return l(!0)}),r.millis);var f=s(31,!1,n,o,T(t),r.millis);function l(t){if(!a)if(!0===t)c=!0,r.dieOnTimeout?u(Error(f)):console.error(f);else if(!c){var n=t,o=n*e;console.warn(f),o+e<r.millis&&setTimeout((function(){return l(n+1)}),e)}}}))}function q(t){var n={};for(var r in K)n[r]=S({},K[r],t&&t[r]||{});return n}function z(t){return Promise.resolve().then((function(){return t.loadPromise?t.loadPromise:t.status!==l&&t.status!==E?t:(t.status=p,t.loadPromise=Promise.resolve().then((function(){var o=t.loadApp(k(t));if(!j(o))throw e=!0,Error(s(33,!1,T(t)));return o.then((function(e){var o;t.loadErrorTime=null,"object"!==n(r=e)&&(o=34),Object.prototype.hasOwnProperty.call(r,"bootstrap")&&!D(r.bootstrap)&&(o=35),D(r.mount)||(o=36),D(r.unmount)||(o=37);var i=N(r);if(o){var a;try{a=JSON.stringify(r)}catch(t){}return console.error(s(o,!1,i,T(t),a),r),u(void 0,t,P),t}return r.devtools&&r.devtools.overlays&&(t.devtools.overlays=S({},t.devtools.overlays,r.devtools.overlays)),t.status=h,t.bootstrap=U(r,"bootstrap"),t.mount=U(r,"mount"),t.unmount=U(r,"unmount"),t.unload=U(r,"unload"),t.timeouts=q(r.timeouts),delete t.loadPromise,t}))})).catch((function(n){var r;return delete t.loadPromise,e?r=P:(r=E,t.loadErrorTime=(new Date).getTime()),u(n,t,r),t})));var r,e}))}var X,Y="undefined"!=typeof window,Z={hashchange:[],popstate:[]},tt=["hashchange","popstate"];function nt(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(s(14,!1));n=t.currentTarget.href,t.preventDefault()}var r=st(window.location.href),e=st(n);0===n.indexOf("#")?window.location.hash=e.hash:r.host!==e.host&&e.host?window.location.href=n:e.pathname===r.pathname&&e.search===r.search?window.location.hash=e.hash:window.history.pushState(null,null,n)}function rt(t){var n=this;if(t){var r=t[0].type;tt.indexOf(r)>=0&&Z[r].forEach((function(r){try{r.apply(n,t)}catch(t){setTimeout((function(){throw t}))}}))}}function et(){xt([],arguments)}function ot(t,n){return function(){var r=window.location.href,e=t.apply(this,arguments),o=window.location.href;return X&&r===o||window.dispatchEvent(it(window.history.state,n)),e}}function it(t,n){var r;try{r=new PopStateEvent("popstate",{state:t})}catch(n){(r=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,t)}return r.singleSpa=!0,r.singleSpaTrigger=n,r}var ut=null,at=!1;function ct(t){if(at)throw Error(s(43,!1));X=!t||!t.hasOwnProperty("urlRerouteOnly")||t.urlRerouteOnly,at=!0,ut=window.history.replaceState,window.addEventListener("hashchange",et),window.addEventListener("popstate",et);var n=window.addEventListener,r=window.removeEventListener;window.addEventListener=function(t,r){if(!("function"==typeof r&&tt.indexOf(t)>=0)||_(Z[t],(function(t){return t===r})))return n.apply(this,arguments);Z[t].push(r)},window.removeEventListener=function(t,n){if(!("function"==typeof n&&tt.indexOf(t)>=0))return r.apply(this,arguments);Z[t]=Z[t].filter((function(t){return t!==n}))},window.history.pushState=ot(window.history.pushState,"pushState"),window.history.replaceState=ot(ut,"replaceState")}function st(t){var n=document.createElement("a");return n.href=t,n}Y&&(window.singleSpaNavigate?console.warn(s(41,!1)):window.singleSpaNavigate=nt);var ft=!1;function lt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.jQuery;if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!ft){var n=t.fn.on,r=t.fn.off;t.fn.on=function(t,r){return pt.call(this,n,window.addEventListener,t,r,arguments)},t.fn.off=function(t,n){return pt.call(this,r,window.removeEventListener,t,n,arguments)},ft=!0}}function pt(t,n,r,e,o){return"string"!=typeof r?t.apply(this,o):(r.split(/\s+/).forEach((function(t){tt.indexOf(t)>=0&&(n(t,e),r=r.replace(t,""))})),""===r.trim()?this:t.apply(this,o))}var ht={};function mt(t){return Promise.resolve().then((function(){var n=ht[T(t)];if(!n)return t;if(t.status===l)return vt(t,n),t;if("UNLOADING"===t.status)return n.promise.then((function(){return t}));if(t.status!==v&&t.status!==E)return t;var r=t.status===E?Promise.resolve():V(t,"unload");return t.status="UNLOADING",r.then((function(){return vt(t,n),t})).catch((function(r){return function(t,n,r){delete ht[T(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,u(r,t,P),n.reject(r)}(t,n,r),t}))}))}function vt(t,n){delete ht[T(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=l,n.resolve()}function dt(t,n,r,e){ht[T(t)]={app:t,resolve:r,reject:e},Object.defineProperty(ht[T(t)],"promise",{get:n})}function wt(t){return ht[t]}var gt=[];function yt(){var t=[],n=[],r=[],e=[],o=(new Date).getTime();return gt.forEach((function(i){var u=i.status!==P&&b(i);switch(i.status){case E:u&&o-i.loadErrorTime>=200&&r.push(i);break;case l:case p:u&&r.push(i);break;case h:case v:!u&&wt(T(i))?t.push(i):u&&e.push(i);break;case w:u||n.push(i)}})),{appsToUnload:t,appsToUnmount:n,appsToLoad:r,appsToMount:e}}function Et(){return gt.filter(O).map(T)}function Pt(){return gt.map(T)}function Ot(t){var n=_(gt,(function(n){return T(n)===t}));return n?n.status:null}var bt=!1;function Tt(t,r,e,o){var i=function(t,r,e,o){var i,u={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"===n(t)?(function(t){if(Array.isArray(t)||null===t)throw Error(s(39,!1));var r=["name","app","activeWhen","customProps"],e=Object.keys(t).reduce((function(t,n){return r.indexOf(n)>=0?t:t.concat(n)}),[]);if(0!==e.length)throw Error(s(38,!1,r.join(", "),e.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(s(20,!1));if("object"!==n(t.app)&&"function"!=typeof t.app)throw Error(s(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(s(24,!1));if(!Dt(t.customProps))throw Error(s(22,!1))}(t),u.name=t.name,u.loadApp=t.app,u.activeWhen=t.activeWhen,u.customProps=t.customProps):(function(t,n,r,e){if("string"!=typeof t||0===t.length)throw Error(s(20,!1));if(!n)throw Error(s(23,!1));if("function"!=typeof r)throw Error(s(24,!1));if(!Dt(e))throw Error(s(22,!1))}(t,r,e,o),u.name=t,u.loadApp=r,u.activeWhen=e,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:Ut(t)})),function(t){return n.some((function(n){return n(t)}))}}(u.activeWhen),u}(t,r,e,o);if(Wt()||bt||(bt=!0,setTimeout((function(){Wt()||console.warn(s(1,!1))}),5e3)),-1!==Pt().indexOf(i.name))throw Error(s(21,!1,i.name));gt.push(S({loadErrorTime:null,status:l,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},i)),Y&&(lt(),xt())}function At(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location;return gt.filter((function(n){return n.activeWhen(t)})).map(T)}function Nt(t){if(0===gt.filter((function(n){return T(n)===t})).length)throw Error(s(25,!1,t));return St(t).then((function(){var n=gt.map(T).indexOf(t);gt.splice(n,1)}))}function St(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{waitForUnmount:!1};if("string"!=typeof t)throw Error(s(26,!1));var r=_(gt,(function(n){return T(n)===t}));if(!r)throw Error(s(27,!1,t));var e,o=wt(T(r));if(n&&n.waitForUnmount){if(o)return o.promise;var i=new Promise((function(t,n){dt(r,(function(){return i}),t,n)}));return i}return o?(e=o.promise,_t(r,o.resolve,o.reject)):e=new Promise((function(t,n){dt(r,(function(){return e}),t,n),_t(r,t,n)})),e}function _t(t,n,r){L(t).then(mt).then((function(){n(),setTimeout((function(){xt()}))})).catch(r)}function Dt(t){return!t||"function"==typeof t||"object"===n(t)&&null!==t&&!Array.isArray(t)}function Ut(t,n){var r=function(t,n){var r=0,e=!1,o="^";"/"!==t[0]&&(t="/"+t);for(var i=0;i<t.length;i++){var u=t[i];(!e&&":"===u||e&&"/"===u)&&a(i)}return a(t.length),new RegExp(o,"i");function a(i){var u=t.slice(r,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=e?"[^/]+/?":u,i===t.length)if(e)n&&(o+="$");else{var a=n?"":".*";o="/"===o.charAt(o.length-1)?"".concat(o).concat(a,"$"):"".concat(o,"(/").concat(a,")?(#.*)?$")}e=!e,r=i}}(t,n);return function(t){var n=t.origin;n||(n="".concat(t.protocol,"//").concat(t.host));var e=t.href.replace(n,"").replace(t.search,"").split("?")[0];return r.test(e)}}var jt=!1,Mt=[],Lt=Y&&window.location.href;function Rt(){return xt()}function xt(){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(jt)return new Promise((function(t,r){Mt.push({resolve:t,reject:r,eventArguments:n})}));var i,u=yt(),a=u.appsToUnload,c=u.appsToUnmount,f=u.appsToLoad,p=u.appsToMount,h=[],m=Lt,d=Lt=window.location.href;return Wt()?(jt=!0,i=a.concat(f,c,p),E()):(i=f,y());function g(){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(s(42,!1))),console.warn(t),!1})))}function y(){return Promise.resolve().then((function(){var t=f.map(z);return Promise.all(t).then(b).then((function(){return[]})).catch((function(t){throw b(),t}))}))}function E(){return Promise.resolve().then((function(){return N(0===i.length?"before-no-app-change":"before-app-change",A(!0)),N("before-routing-event",A(!0,{cancelNavigation:g})),Promise.all(h).then((function(r){if(r.some((function(t){return t})))return ut.call(window.history,history.state,"",m.substring(location.origin.length)),Lt=location.href,jt=!1,xt(t,n,!0);var e=a.map(mt),o=c.map(L).map((function(t){return t.then(mt)})).concat(e),i=Promise.all(o);i.then((function(){N("before-mount-routing-event",A(!0))}));var u=f.map((function(t){return z(t).then((function(t){return It(t,i)}))})),s=p.filter((function(t){return f.indexOf(t)<0})).map((function(t){return It(t,i)}));return i.catch((function(t){throw b(),t})).then((function(){return b(),Promise.all(u.concat(s)).catch((function(n){throw t.forEach((function(t){return t.reject(n)})),n})).then(O)}))}))}))}function O(){var n=Et();t.forEach((function(t){return t.resolve(n)}));try{N(0===i.length?"no-app-change":"app-change",A()),N("routing-event",A())}catch(t){setTimeout((function(){throw t}))}if(jt=!1,Mt.length>0){var r=Mt;Mt=[],xt(r)}return n}function b(){e||(t.forEach((function(t){rt(t.eventArguments)})),rt(n))}function A(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1?arguments[1]:void 0,u={},s=(r(t={},w,[]),r(t,v,[]),r(t,l,[]),r(t,P,[]),t);e?(f.concat(p).forEach((function(t,n){g(t,w)})),a.forEach((function(t){g(t,l)})),c.forEach((function(t){g(t,v)}))):i.forEach((function(t){g(t)}));var h={detail:{newAppStatuses:u,appsByNewStatus:s,totalAppChanges:i.length,originalEvent:null==n?void 0:n[0],oldUrl:m,newUrl:d}};return o&&S(h.detail,o),h;function g(t,n){var r=T(t);n=n||Ot(r),u[r]=n,(s[n]=s[n]||[]).push(r)}}function N(t,n){e||window.dispatchEvent(new o("single-spa:".concat(t),n))}}function It(t,n){return b(t)?M(t).then((function(t){return n.then((function(){return b(t)?I(t):t}))})):n.then((function(){return t}))}var Bt=!1;function Gt(t){Bt=!0,Y&&(ct(t),xt())}function Wt(){return Bt}var Ct={getRawAppData:function(){return[].concat(gt)},reroute:xt,NOT_LOADED:l,toLoadPromise:z,toBootstrapPromise:M,unregisterApplication:Nt};Y&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=Ct);export{m as BOOTSTRAPPING,p as LOADING_SOURCE_CODE,E as LOAD_ERROR,w as MOUNTED,d as MOUNTING,h as NOT_BOOTSTRAPPED,l as NOT_LOADED,v as NOT_MOUNTED,P as SKIP_BECAUSE_BROKEN,y as UNMOUNTING,g as UPDATING,a as addErrorHandler,At as checkActivityFunctions,lt as ensureJQuerySupport,Pt as getAppNames,Ot as getAppStatus,Et as getMountedApps,W as mountRootParcel,nt as navigateToUrl,ct as patchHistoryApi,Ut as pathToActiveWhen,Tt as registerApplication,c as removeErrorHandler,F as setBootstrapMaxTime,H as setMountMaxTime,Q as setUnloadMaxTime,J as setUnmountMaxTime,Gt as start,Rt as triggerAppChange,St as unloadApplication,Nt as unregisterApplication}; | ||
//# sourceMappingURL=single-spa.min.js.map |
@@ -1,3 +0,3 @@ | ||
/* single-spa@6.0.0-beta.1 - SystemJS ES5 - prod */ | ||
System.register([],(function(t){"use strict";return{execute:function(){t({addErrorHandler:c,checkActivityFunctions:_t,ensureJQuerySupport:mt,getAppNames:bt,getAppStatus:At,getMountedApps:Pt,mountRootParcel:$,navigateToUrl:ot,patchHistoryApi:lt,pathToActiveWhen:Rt,registerApplication:St,removeErrorHandler:s,setBootstrapMaxTime:Q,setMountMaxTime:V,setUnloadMaxTime:z,setUnmountMaxTime:q,start:$t,triggerAppChange:Bt,unloadApplication:Dt,unregisterApplication:Ut});var n=Object.freeze({__proto__:null,get start(){return $t},get ensureJQuerySupport(){return mt},get setBootstrapMaxTime(){return Q},get setMountMaxTime(){return V},get setUnmountMaxTime(){return q},get setUnloadMaxTime(){return z},get registerApplication(){return St},get unregisterApplication(){return Ut},get getMountedApps(){return Pt},get getAppStatus(){return At},get unloadApplication(){return Dt},get checkActivityFunctions(){return _t},get getAppNames(){return bt},get pathToActiveWhen(){return Rt},get navigateToUrl(){return ot},get patchHistoryApi(){return lt},get triggerAppChange(){return Bt},get addErrorHandler(){return c},get removeErrorHandler(){return s},get mountRootParcel(){return $},get NOT_LOADED(){return p},get LOADING_SOURCE_CODE(){return h},get NOT_BOOTSTRAPPED(){return m},get BOOTSTRAPPING(){return v},get NOT_MOUNTED(){return d},get MOUNTING(){return w},get UPDATING(){return E},get LOAD_ERROR(){return T},get MOUNTED(){return g},get UNMOUNTING(){return y},get SKIP_BECAUSE_BROKEN(){return P}});function r(t){return(r="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 e(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,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 r=document.createEvent("CustomEvent");return n?r.initCustomEvent(t,n.bubbles,n.cancelable,n.detail):r.initCustomEvent(t,!1,!1,void 0),r}:function(t,n){var r=document.createEventObject();return r.type=t,n?(r.bubbles=Boolean(n.bubbles),r.cancelable=Boolean(n.cancelable),r.detail=n.detail):(r.bubbles=!1,r.cancelable=!1,r.detail=void 0),r},u=[];function a(t,n,r){var e=l(t,n,r);u.length?u.forEach((function(t){return t(e)})):setTimeout((function(){throw e}))}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(r){var e=r===t;return n=n||e,!e})),n}function f(t,n){for(var r=arguments.length,e=new Array(r>2?r-2:0),o=2;o<r;o++)e[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(e.length?"&arg=".concat(e.join("&arg=")):"")}function l(t,n,r){var e,o="".concat(_(n)," '").concat(N(n),"' died in status ").concat(n.status,": ");if(t instanceof Error){try{t.message=o+t.message}catch(t){}e=t}else{console.warn(f(30,!1,n.status,N(n)));try{e=Error(o+JSON.stringify(t))}catch(n){e=t}}return e.appOrParcelName=N(n),n.status=r,e}var p=t("NOT_LOADED","NOT_LOADED"),h=t("LOADING_SOURCE_CODE","LOADING_SOURCE_CODE"),m=t("NOT_BOOTSTRAPPED","NOT_BOOTSTRAPPED"),v=t("BOOTSTRAPPING","BOOTSTRAPPING"),d=t("NOT_MOUNTED","NOT_MOUNTED"),w=t("MOUNTING","MOUNTING"),g=t("MOUNTED","MOUNTED"),E=t("UPDATING","UPDATING"),y=t("UNMOUNTING","UNMOUNTING"),O="UNLOADING",T=t("LOAD_ERROR","LOAD_ERROR"),P=t("SKIP_BECAUSE_BROKEN","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 r=0;r<t.length;r++)if(n(t[r]))return t[r];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 r=t[n]||[];0===(r=Array.isArray(r)?r:[r]).length&&(r=[function(){return Promise.resolve()}]);var e=_(t),o=N(t);return function(t){return r.reduce((function(r,i,u){return r.then((function(){var r=i(t);return R(r)?r:Promise.reject(f(15,!1,e,o,n,u))}))}),Promise.resolve())}}function R(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function L(t,n){return Promise.resolve().then((function(){return t.status!==m?t:(t.status=v,t.bootstrap?X(t,"bootstrap").then(r).catch((function(r){if(n)throw l(r,t,P);return a(r,t,P),t})):Promise.resolve().then(r))}));function r(){return t.status=d,t}}function I(t,n){return Promise.resolve().then((function(){if(t.status!==g)return t;t.status=y;var r=Object.keys(t.parcels).map((function(n){return t.parcels[n].unmountThisParcel()}));return Promise.all(r).then(e,(function(r){return e().then((function(){var e=Error(r.message);if(n)throw l(e,t,P);a(e,t,P)}))})).then((function(){return t}));function e(){return X(t,"unmount").then((function(){t.status=d})).catch((function(r){if(n)throw l(r,t,P);a(r,t,P)}))}}))}var x=!1,B=!1;function G(t,n){return Promise.resolve().then((function(){return t.status!==d?t:(x||(window.dispatchEvent(new i("single-spa:before-first-mount")),x=!0),X(t,"mount").then((function(){return t.status=g,B||(window.dispatchEvent(new i("single-spa:first-mount")),B=!0),t})).catch((function(r){return t.status=g,I(t,!0).then(e,e);function e(){if(n)throw l(r,t,P);return a(r,t,P),t}})))}))}var C=0,W={parcels:{}};function $(){return k.apply(W,arguments)}function k(t,n){var e=this;if(!t||"object"!==r(t)&&"function"!=typeof t)throw Error(f(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(f(3,!1,r(t.name)));var o=C++,i=t.name||"parcel-".concat(o);if("object"!==r(n))throw Error(f(4,!1,i,r(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(e),unmountThisParcel:function(){return O.then((function(){if(s.status!==g)throw Error(f(6,!1,i,s.status));return I(s,!0)})).then((function(t){return s.parentName&&delete e.parcels[s.id],t})).then((function(t){return v(t),t})).catch((function(t){throw s.status=P,w(t),t}))}};e.parcels[o]=s;var p=c();if(!p||"function"!=typeof p.then)throw Error(f(7,!1));var v,w,y=(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"),r=j(t,"mount"),e=j(t,"unmount");s.status=m,s.name=i,s.bootstrap=n,s.mount=r,s.unmount=e,s.timeouts=Y(t.timeouts),t.update&&(s.update=j(t,"update"),u.update=function(t){return s.customProps=t,H(function(t){return Promise.resolve().then((function(){if(t.status!==g)throw Error(f(32,!1,N(t)));return t.status=E,X(t,"update").then((function(){return t.status=g,t})).catch((function(n){throw l(n,t,P)}))}))}(s))})}))).then((function(){return L(s,!0)})),O=y.then((function(){return G(s,!0)})),T=new Promise((function(t,n){v=t,w=n}));return u={mount:function(){return H(Promise.resolve().then((function(){if(s.status!==d)throw Error(f(13,!1,i,s.status));return e.parcels[o]=s,G(s)})))},unmount:function(){return H(s.unmountThisParcel())},getStatus:function(){return s.status},loadPromise:H(p),bootstrapPromise:H(y),mountPromise:H(O),unmountPromise:H(T)}}function H(t){return t.then((function(){return null}))}function K(t){var e=N(t),o="function"==typeof t.customProps?t.customProps(e,window.location):t.customProps;("object"!==r(o)||null===o||Array.isArray(o))&&(o={},console.warn(f(40,!1),e,o));var i=U({},o,{name:e,mountParcel:k.bind(t),singleSpa:n});return S(t)&&(i.unmountSelf=t.unmountThisParcel),i}var F=1e3,J={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:F},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:F},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:F},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:F},update:{millis:3e3,dieOnTimeout:!1,warningMillis:F}};function Q(t,n,r){if("number"!=typeof t||t<=0)throw Error(f(16,!1));J.bootstrap={millis:t,dieOnTimeout:n,warningMillis:r||F}}function V(t,n,r){if("number"!=typeof t||t<=0)throw Error(f(17,!1));J.mount={millis:t,dieOnTimeout:n,warningMillis:r||F}}function q(t,n,r){if("number"!=typeof t||t<=0)throw Error(f(18,!1));J.unmount={millis:t,dieOnTimeout:n,warningMillis:r||F}}function z(t,n,r){if("number"!=typeof t||t<=0)throw Error(f(19,!1));J.unload={millis:t,dieOnTimeout:n,warningMillis:r||F}}function X(t,n){var r=t.timeouts[n],e=r.warningMillis,o=_(t);return new Promise((function(i,u){var a=!1,c=!1;t[n](K(t)).then((function(t){a=!0,i(t)})).catch((function(t){a=!0,u(t)})),setTimeout((function(){return l(1)}),e),setTimeout((function(){return l(!0)}),r.millis);var s=f(31,!1,n,o,N(t),r.millis);function l(t){if(!a)if(!0===t)c=!0,r.dieOnTimeout?u(Error(s)):console.error(s);else if(!c){var n=t,o=n*e;console.warn(s),o+e<r.millis&&setTimeout((function(){return l(n+1)}),e)}}}))}function Y(t){var n={};for(var r in J)n[r]=U({},J[r],t&&t[r]||{});return n}function Z(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(K(t));if(!R(o))throw e=!0,Error(f(33,!1,N(t)));return o.then((function(e){var o;t.loadErrorTime=null,"object"!==r(n=e)&&(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=Y(n.timeouts),delete t.loadPromise,t}))})).catch((function(n){var r;return delete t.loadPromise,e?r=P:(r=T,t.loadErrorTime=(new Date).getTime()),a(n,t,r),t})));var n,e}))}var tt,nt="undefined"!=typeof window,rt={hashchange:[],popstate:[]},et=["hashchange","popstate"];function ot(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 r=pt(window.location.href),e=pt(n);0===n.indexOf("#")?window.location.hash=e.hash:r.host!==e.host&&e.host?window.location.href=n:e.pathname===r.pathname&&e.search===r.search?window.location.hash=e.hash:window.history.pushState(null,null,n)}function it(t){var n=this;if(t){var r=t[0].type;et.indexOf(r)>=0&&rt[r].forEach((function(r){try{r.apply(n,t)}catch(t){setTimeout((function(){throw t}))}}))}}function ut(){Gt([],arguments)}function at(t,n){return function(){var r=window.location.href,e=t.apply(this,arguments),o=window.location.href;return tt&&r===o||window.dispatchEvent(ct(window.history.state,n)),e}}function ct(t,n){var r;try{r=new PopStateEvent("popstate",{state:t})}catch(n){(r=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,t)}return r.singleSpa=!0,r.singleSpaTrigger=n,r}var st=null,ft=!1;function lt(t){if(ft)throw Error(f(43,!1));tt=!t||!t.hasOwnProperty("urlRerouteOnly")||t.urlRerouteOnly,ft=!0,st=window.history.replaceState,window.addEventListener("hashchange",ut),window.addEventListener("popstate",ut);var n=window.addEventListener,r=window.removeEventListener;window.addEventListener=function(t,r){if(!("function"==typeof r&&et.indexOf(t)>=0)||D(rt[t],(function(t){return t===r})))return n.apply(this,arguments);rt[t].push(r)},window.removeEventListener=function(t,n){if(!("function"==typeof n&&et.indexOf(t)>=0))return r.apply(this,arguments);rt[t]=rt[t].filter((function(t){return t!==n}))},window.history.pushState=at(window.history.pushState,"pushState"),window.history.replaceState=at(st,"replaceState")}function pt(t){var n=document.createElement("a");return n.href=t,n}nt&&(window.singleSpaNavigate?console.warn(f(41,!1)):window.singleSpaNavigate=ot);var ht=!1;function mt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.jQuery;if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!ht){var n=t.fn.on,r=t.fn.off;t.fn.on=function(t,r){return vt.call(this,n,window.addEventListener,t,r,arguments)},t.fn.off=function(t,n){return vt.call(this,r,window.removeEventListener,t,n,arguments)},ht=!0}}function vt(t,n,r,e,o){return"string"!=typeof r?t.apply(this,o):(r.split(/\s+/).forEach((function(t){et.indexOf(t)>=0&&(n(t,e),r=r.replace(t,""))})),""===r.trim()?this:t.apply(this,o))}var dt={};function wt(t){return Promise.resolve().then((function(){var n=dt[N(t)];if(!n)return t;if(t.status===p)return gt(t,n),t;if(t.status===O)return n.promise.then((function(){return t}));if(t.status!==d&&t.status!==T)return t;var r=t.status===T?Promise.resolve():X(t,"unload");return t.status=O,r.then((function(){return gt(t,n),t})).catch((function(r){return function(t,n,r){delete dt[N(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,a(r,t,P),n.reject(r)}(t,n,r),t}))}))}function gt(t,n){delete dt[N(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=p,n.resolve()}function Et(t,n,r,e){dt[N(t)]={app:t,resolve:r,reject:e},Object.defineProperty(dt[N(t)],"promise",{get:n})}function yt(t){return dt[t]}var Ot=[];function Tt(){var t=[],n=[],r=[],e=[],o=(new Date).getTime();return Ot.forEach((function(i){var u=i.status!==P&&A(i);switch(i.status){case T:u&&o-i.loadErrorTime>=200&&r.push(i);break;case p:case h:u&&r.push(i);break;case m:case d:!u&&yt(N(i))?t.push(i):u&&e.push(i);break;case g:u||n.push(i)}})),{appsToUnload:t,appsToUnmount:n,appsToLoad:r,appsToMount:e}}function Pt(){return Ot.filter(b).map(N)}function bt(){return Ot.map(N)}function At(t){var n=D(Ot,(function(n){return N(n)===t}));return n?n.status:null}var Nt=!1;function St(t,n,e,o){var i=function(t,n,e,o){var i,u={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"===r(t)?(function(t){if(Array.isArray(t)||null===t)throw Error(f(39,!1));var n=["name","app","activeWhen","customProps"],e=Object.keys(t).reduce((function(t,r){return n.indexOf(r)>=0?t:t.concat(r)}),[]);if(0!==e.length)throw Error(f(38,!1,n.join(", "),e.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(f(20,!1));if("object"!==r(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(!jt(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,r,e){if("string"!=typeof t||0===t.length)throw Error(f(20,!1));if(!n)throw Error(f(23,!1));if("function"!=typeof r)throw Error(f(24,!1));if(!jt(e))throw Error(f(22,!1))}(t,n,e,o),u.name=t,u.loadApp=n,u.activeWhen=e,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,e,o);if(kt()||Nt||(Nt=!0,setTimeout((function(){kt()||console.warn(f(1,!1))}),5e3)),-1!==bt().indexOf(i.name))throw Error(f(21,!1,i.name));Ot.push(U({loadErrorTime:null,status:p,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},i)),nt&&(mt(),Gt())}function _t(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location;return Ot.filter((function(n){return n.activeWhen(t)})).map(N)}function Ut(t){if(0===Ot.filter((function(n){return N(n)===t})).length)throw Error(f(25,!1,t));return Dt(t).then((function(){var n=Ot.map(N).indexOf(t);Ot.splice(n,1)}))}function Dt(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{waitForUnmount:!1};if("string"!=typeof t)throw Error(f(26,!1));var r=D(Ot,(function(n){return N(n)===t}));if(!r)throw Error(f(27,!1,t));var e,o=yt(N(r));if(n&&n.waitForUnmount){if(o)return o.promise;var i=new Promise((function(t,n){Et(r,(function(){return i}),t,n)}));return i}return o?(e=o.promise,Mt(r,o.resolve,o.reject)):e=new Promise((function(t,n){Et(r,(function(){return e}),t,n),Mt(r,t,n)})),e}function Mt(t,n,r){I(t).then(wt).then((function(){n(),setTimeout((function(){Gt()}))})).catch(r)}function jt(t){return!t||"function"==typeof t||"object"===r(t)&&null!==t&&!Array.isArray(t)}function Rt(t,n){var r=function(t,n){var r=0,e=!1,o="^";"/"!==t[0]&&(t="/"+t);for(var i=0;i<t.length;i++){var u=t[i];(!e&&":"===u||e&&"/"===u)&&a(i)}return a(t.length),new RegExp(o,"i");function a(i){var u=t.slice(r,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=e?"[^/]+/?":u,i===t.length)if(e)n&&(o+="$");else{var a=n?"":".*";o="/"===o.charAt(o.length-1)?"".concat(o).concat(a,"$"):"".concat(o,"(/").concat(a,")?(#.*)?$")}e=!e,r=i}}(t,n);return function(t){var n=t.origin;n||(n="".concat(t.protocol,"//").concat(t.host));var e=t.href.replace(n,"").replace(t.search,"").split("?")[0];return r.test(e)}}var Lt=!1,It=[],xt=nt&&window.location.href;function Bt(){return Gt()}function Gt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Lt)return new Promise((function(t,r){It.push({resolve:t,reject:r,eventArguments:n})}));var o,u=Tt(),a=u.appsToUnload,c=u.appsToUnmount,s=u.appsToLoad,l=u.appsToMount,h=[],m=xt,v=xt=window.location.href;return kt()?(Lt=!0,o=a.concat(s,c,l),y()):(o=s,E());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 E(){return Promise.resolve().then((function(){var t=s.map(Z);return Promise.all(t).then(T).then((function(){return[]})).catch((function(t){throw T(),t}))}))}function y(){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(r){if(r.some((function(t){return t})))return st.call(window.history,history.state,"",m.substring(location.origin.length)),xt=location.href,Lt=!1,Gt(t,n,!0);var e=a.map(wt),o=c.map(I).map((function(t){return t.then(wt)})).concat(e),i=Promise.all(o);i.then((function(){A("before-mount-routing-event",b(!0))}));var u=s.map((function(t){return Z(t).then((function(t){return Ct(t,i)}))})),f=l.filter((function(t){return s.indexOf(t)<0})).map((function(t){return Ct(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)}))}))}))}function O(){var n=Pt();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(Lt=!1,It.length>0){var r=It;It=[],Gt(r)}return n}function T(){r||(t.forEach((function(t){it(t.eventArguments)})),it(n))}function b(){var t,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1?arguments[1]:void 0,u={},f=(e(t={},g,[]),e(t,d,[]),e(t,p,[]),e(t,P,[]),t);r?(s.concat(l).forEach((function(t,n){w(t,g)})),a.forEach((function(t){w(t,p)})),c.forEach((function(t){w(t,d)}))):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:v}};return i&&U(h.detail,i),h;function w(t,n){var r=N(t);n=n||At(r),u[r]=n,(f[n]=f[n]||[]).push(r)}}function A(t,n){r||window.dispatchEvent(new i("single-spa:".concat(t),n))}}function Ct(t,n){return A(t)?L(t).then((function(t){return n.then((function(){return A(t)?G(t):t}))})):n.then((function(){return t}))}var Wt=!1;function $t(t){Wt=!0,nt&&(lt(t),Gt())}function kt(){return Wt}var Ht={getRawAppData:function(){return[].concat(Ot)},reroute:Gt,NOT_LOADED:p,toLoadPromise:Z,toBootstrapPromise:L,unregisterApplication:Ut};nt&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=Ht)}}})); | ||
/* single-spa@6.0.0-beta.2 - SystemJS ES5 - prod */ | ||
System.register([],(function(t){"use strict";return{execute:function(){t({addErrorHandler:c,checkActivityFunctions:_t,ensureJQuerySupport:mt,getAppNames:bt,getAppStatus:At,getMountedApps:Pt,mountRootParcel:$,navigateToUrl:ot,patchHistoryApi:lt,pathToActiveWhen:Rt,registerApplication:St,removeErrorHandler:s,setBootstrapMaxTime:Q,setMountMaxTime:V,setUnloadMaxTime:z,setUnmountMaxTime:q,start:$t,triggerAppChange:Bt,unloadApplication:Dt,unregisterApplication:Ut});var n=Object.freeze({__proto__:null,get start(){return $t},get ensureJQuerySupport(){return mt},get setBootstrapMaxTime(){return Q},get setMountMaxTime(){return V},get setUnmountMaxTime(){return q},get setUnloadMaxTime(){return z},get registerApplication(){return St},get unregisterApplication(){return Ut},get getMountedApps(){return Pt},get getAppStatus(){return At},get unloadApplication(){return Dt},get checkActivityFunctions(){return _t},get getAppNames(){return bt},get pathToActiveWhen(){return Rt},get navigateToUrl(){return ot},get patchHistoryApi(){return lt},get triggerAppChange(){return Bt},get addErrorHandler(){return c},get removeErrorHandler(){return s},get mountRootParcel(){return $},get NOT_LOADED(){return p},get LOADING_SOURCE_CODE(){return h},get NOT_BOOTSTRAPPED(){return m},get BOOTSTRAPPING(){return v},get NOT_MOUNTED(){return d},get MOUNTING(){return w},get UPDATING(){return E},get LOAD_ERROR(){return T},get MOUNTED(){return g},get UNMOUNTING(){return y},get SKIP_BECAUSE_BROKEN(){return P}});function r(t){return(r="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 e(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,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 r=document.createEvent("CustomEvent");return n?r.initCustomEvent(t,n.bubbles,n.cancelable,n.detail):r.initCustomEvent(t,!1,!1,void 0),r}:function(t,n){var r=document.createEventObject();return r.type=t,n?(r.bubbles=Boolean(n.bubbles),r.cancelable=Boolean(n.cancelable),r.detail=n.detail):(r.bubbles=!1,r.cancelable=!1,r.detail=void 0),r},u=[];function a(t,n,r){var e=l(t,n,r);u.length?u.forEach((function(t){return t(e)})):setTimeout((function(){throw e}))}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(r){var e=r===t;return n=n||e,!e})),n}function f(t,n){for(var r=arguments.length,e=new Array(r>2?r-2:0),o=2;o<r;o++)e[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(e.length?"&arg=".concat(e.join("&arg=")):"")}function l(t,n,r){var e,o="".concat(_(n)," '").concat(N(n),"' died in status ").concat(n.status,": ");if(t instanceof Error){try{t.message=o+t.message}catch(t){}e=t}else{console.warn(f(30,!1,n.status,N(n)));try{e=Error(o+JSON.stringify(t))}catch(n){e=t}}return e.appOrParcelName=N(n),n.status=r,e}var p=t("NOT_LOADED","NOT_LOADED"),h=t("LOADING_SOURCE_CODE","LOADING_SOURCE_CODE"),m=t("NOT_BOOTSTRAPPED","NOT_BOOTSTRAPPED"),v=t("BOOTSTRAPPING","BOOTSTRAPPING"),d=t("NOT_MOUNTED","NOT_MOUNTED"),w=t("MOUNTING","MOUNTING"),g=t("MOUNTED","MOUNTED"),E=t("UPDATING","UPDATING"),y=t("UNMOUNTING","UNMOUNTING"),O="UNLOADING",T=t("LOAD_ERROR","LOAD_ERROR"),P=t("SKIP_BECAUSE_BROKEN","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 r=0;r<t.length;r++)if(n(t[r]))return t[r];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 r=t[n]||[];0===(r=Array.isArray(r)?r:[r]).length&&(r=[function(){return Promise.resolve()}]);var e=_(t),o=N(t);return function(t){return r.reduce((function(r,i,u){return r.then((function(){var r=i(t);return R(r)?r:Promise.reject(f(15,!1,e,o,n,u))}))}),Promise.resolve())}}function R(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function L(t,n){return Promise.resolve().then((function(){return t.status!==m?t:(t.status=v,t.bootstrap?X(t,"bootstrap").then(r).catch((function(r){if(n)throw l(r,t,P);return a(r,t,P),t})):Promise.resolve().then(r))}));function r(){return t.status=d,t}}function I(t,n){return Promise.resolve().then((function(){if(t.status!==g)return t;t.status=y;var r=Object.keys(t.parcels).map((function(n){return t.parcels[n].unmountThisParcel()}));return Promise.all(r).then(e,(function(r){return e().then((function(){var e=Error(r.message);if(n)throw l(e,t,P);a(e,t,P)}))})).then((function(){return t}));function e(){return X(t,"unmount").then((function(){t.status=d})).catch((function(r){if(n)throw l(r,t,P);a(r,t,P)}))}}))}var x=!1,B=!1;function G(t,n){return Promise.resolve().then((function(){return t.status!==d?t:(x||(window.dispatchEvent(new i("single-spa:before-first-mount")),x=!0),t.status=w,X(t,"mount").then((function(){return t.status=g,B||(window.dispatchEvent(new i("single-spa:first-mount")),B=!0),t})).catch((function(r){return t.status=g,I(t,!0).then(e,e);function e(){if(n)throw l(r,t,P);return a(r,t,P),t}})))}))}var C=0,W={parcels:{}};function $(){return k.apply(W,arguments)}function k(t,n){var e=this;if(!t||"object"!==r(t)&&"function"!=typeof t)throw Error(f(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(f(3,!1,r(t.name)));var o=C++,i=t.name||"parcel-".concat(o);if("object"!==r(n))throw Error(f(4,!1,i,r(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(e),unmountThisParcel:function(){return O.then((function(){if(s.status!==g)throw Error(f(6,!1,i,s.status));return I(s,!0)})).then((function(t){return s.parentName&&delete e.parcels[s.id],t})).then((function(t){return v(t),t})).catch((function(t){throw s.status=P,w(t),t}))}};e.parcels[o]=s;var p=c();if(!p||"function"!=typeof p.then)throw Error(f(7,!1));var v,w,y=(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"),r=j(t,"mount"),e=j(t,"unmount");s.status=m,s.name=i,s.bootstrap=n,s.mount=r,s.unmount=e,s.timeouts=Y(t.timeouts),t.update&&(s.update=j(t,"update"),u.update=function(t){return s.customProps=t,H(function(t){return Promise.resolve().then((function(){if(t.status!==g)throw Error(f(32,!1,N(t)));return t.status=E,X(t,"update").then((function(){return t.status=g,t})).catch((function(n){throw l(n,t,P)}))}))}(s))})}))).then((function(){return L(s,!0)})),O=y.then((function(){return G(s,!0)})),T=new Promise((function(t,n){v=t,w=n}));return u={mount:function(){return H(Promise.resolve().then((function(){if(s.status!==d)throw Error(f(13,!1,i,s.status));return e.parcels[o]=s,G(s)})))},unmount:function(){return H(s.unmountThisParcel())},getStatus:function(){return s.status},loadPromise:H(p),bootstrapPromise:H(y),mountPromise:H(O),unmountPromise:H(T)}}function H(t){return t.then((function(){return null}))}function K(t){var e=N(t),o="function"==typeof t.customProps?t.customProps(e,window.location):t.customProps;("object"!==r(o)||null===o||Array.isArray(o))&&(o={},console.warn(f(40,!1),e,o));var i=U({},o,{name:e,mountParcel:k.bind(t),singleSpa:n});return S(t)&&(i.unmountSelf=t.unmountThisParcel),i}var F=1e3,J={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:F},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:F},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:F},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:F},update:{millis:3e3,dieOnTimeout:!1,warningMillis:F}};function Q(t,n,r){if("number"!=typeof t||t<=0)throw Error(f(16,!1));J.bootstrap={millis:t,dieOnTimeout:n,warningMillis:r||F}}function V(t,n,r){if("number"!=typeof t||t<=0)throw Error(f(17,!1));J.mount={millis:t,dieOnTimeout:n,warningMillis:r||F}}function q(t,n,r){if("number"!=typeof t||t<=0)throw Error(f(18,!1));J.unmount={millis:t,dieOnTimeout:n,warningMillis:r||F}}function z(t,n,r){if("number"!=typeof t||t<=0)throw Error(f(19,!1));J.unload={millis:t,dieOnTimeout:n,warningMillis:r||F}}function X(t,n){var r=t.timeouts[n],e=r.warningMillis,o=_(t);return new Promise((function(i,u){var a=!1,c=!1;t[n](K(t)).then((function(t){a=!0,i(t)})).catch((function(t){a=!0,u(t)})),setTimeout((function(){return l(1)}),e),setTimeout((function(){return l(!0)}),r.millis);var s=f(31,!1,n,o,N(t),r.millis);function l(t){if(!a)if(!0===t)c=!0,r.dieOnTimeout?u(Error(s)):console.error(s);else if(!c){var n=t,o=n*e;console.warn(s),o+e<r.millis&&setTimeout((function(){return l(n+1)}),e)}}}))}function Y(t){var n={};for(var r in J)n[r]=U({},J[r],t&&t[r]||{});return n}function Z(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(K(t));if(!R(o))throw e=!0,Error(f(33,!1,N(t)));return o.then((function(e){var o;t.loadErrorTime=null,"object"!==r(n=e)&&(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=Y(n.timeouts),delete t.loadPromise,t}))})).catch((function(n){var r;return delete t.loadPromise,e?r=P:(r=T,t.loadErrorTime=(new Date).getTime()),a(n,t,r),t})));var n,e}))}var tt,nt="undefined"!=typeof window,rt={hashchange:[],popstate:[]},et=["hashchange","popstate"];function ot(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 r=pt(window.location.href),e=pt(n);0===n.indexOf("#")?window.location.hash=e.hash:r.host!==e.host&&e.host?window.location.href=n:e.pathname===r.pathname&&e.search===r.search?window.location.hash=e.hash:window.history.pushState(null,null,n)}function it(t){var n=this;if(t){var r=t[0].type;et.indexOf(r)>=0&&rt[r].forEach((function(r){try{r.apply(n,t)}catch(t){setTimeout((function(){throw t}))}}))}}function ut(){Gt([],arguments)}function at(t,n){return function(){var r=window.location.href,e=t.apply(this,arguments),o=window.location.href;return tt&&r===o||window.dispatchEvent(ct(window.history.state,n)),e}}function ct(t,n){var r;try{r=new PopStateEvent("popstate",{state:t})}catch(n){(r=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,t)}return r.singleSpa=!0,r.singleSpaTrigger=n,r}var st=null,ft=!1;function lt(t){if(ft)throw Error(f(43,!1));tt=!t||!t.hasOwnProperty("urlRerouteOnly")||t.urlRerouteOnly,ft=!0,st=window.history.replaceState,window.addEventListener("hashchange",ut),window.addEventListener("popstate",ut);var n=window.addEventListener,r=window.removeEventListener;window.addEventListener=function(t,r){if(!("function"==typeof r&&et.indexOf(t)>=0)||D(rt[t],(function(t){return t===r})))return n.apply(this,arguments);rt[t].push(r)},window.removeEventListener=function(t,n){if(!("function"==typeof n&&et.indexOf(t)>=0))return r.apply(this,arguments);rt[t]=rt[t].filter((function(t){return t!==n}))},window.history.pushState=at(window.history.pushState,"pushState"),window.history.replaceState=at(st,"replaceState")}function pt(t){var n=document.createElement("a");return n.href=t,n}nt&&(window.singleSpaNavigate?console.warn(f(41,!1)):window.singleSpaNavigate=ot);var ht=!1;function mt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.jQuery;if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!ht){var n=t.fn.on,r=t.fn.off;t.fn.on=function(t,r){return vt.call(this,n,window.addEventListener,t,r,arguments)},t.fn.off=function(t,n){return vt.call(this,r,window.removeEventListener,t,n,arguments)},ht=!0}}function vt(t,n,r,e,o){return"string"!=typeof r?t.apply(this,o):(r.split(/\s+/).forEach((function(t){et.indexOf(t)>=0&&(n(t,e),r=r.replace(t,""))})),""===r.trim()?this:t.apply(this,o))}var dt={};function wt(t){return Promise.resolve().then((function(){var n=dt[N(t)];if(!n)return t;if(t.status===p)return gt(t,n),t;if(t.status===O)return n.promise.then((function(){return t}));if(t.status!==d&&t.status!==T)return t;var r=t.status===T?Promise.resolve():X(t,"unload");return t.status=O,r.then((function(){return gt(t,n),t})).catch((function(r){return function(t,n,r){delete dt[N(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,a(r,t,P),n.reject(r)}(t,n,r),t}))}))}function gt(t,n){delete dt[N(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=p,n.resolve()}function Et(t,n,r,e){dt[N(t)]={app:t,resolve:r,reject:e},Object.defineProperty(dt[N(t)],"promise",{get:n})}function yt(t){return dt[t]}var Ot=[];function Tt(){var t=[],n=[],r=[],e=[],o=(new Date).getTime();return Ot.forEach((function(i){var u=i.status!==P&&A(i);switch(i.status){case T:u&&o-i.loadErrorTime>=200&&r.push(i);break;case p:case h:u&&r.push(i);break;case m:case d:!u&&yt(N(i))?t.push(i):u&&e.push(i);break;case g:u||n.push(i)}})),{appsToUnload:t,appsToUnmount:n,appsToLoad:r,appsToMount:e}}function Pt(){return Ot.filter(b).map(N)}function bt(){return Ot.map(N)}function At(t){var n=D(Ot,(function(n){return N(n)===t}));return n?n.status:null}var Nt=!1;function St(t,n,e,o){var i=function(t,n,e,o){var i,u={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"===r(t)?(function(t){if(Array.isArray(t)||null===t)throw Error(f(39,!1));var n=["name","app","activeWhen","customProps"],e=Object.keys(t).reduce((function(t,r){return n.indexOf(r)>=0?t:t.concat(r)}),[]);if(0!==e.length)throw Error(f(38,!1,n.join(", "),e.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(f(20,!1));if("object"!==r(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(!jt(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,r,e){if("string"!=typeof t||0===t.length)throw Error(f(20,!1));if(!n)throw Error(f(23,!1));if("function"!=typeof r)throw Error(f(24,!1));if(!jt(e))throw Error(f(22,!1))}(t,n,e,o),u.name=t,u.loadApp=n,u.activeWhen=e,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,e,o);if(kt()||Nt||(Nt=!0,setTimeout((function(){kt()||console.warn(f(1,!1))}),5e3)),-1!==bt().indexOf(i.name))throw Error(f(21,!1,i.name));Ot.push(U({loadErrorTime:null,status:p,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},i)),nt&&(mt(),Gt())}function _t(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location;return Ot.filter((function(n){return n.activeWhen(t)})).map(N)}function Ut(t){if(0===Ot.filter((function(n){return N(n)===t})).length)throw Error(f(25,!1,t));return Dt(t).then((function(){var n=Ot.map(N).indexOf(t);Ot.splice(n,1)}))}function Dt(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{waitForUnmount:!1};if("string"!=typeof t)throw Error(f(26,!1));var r=D(Ot,(function(n){return N(n)===t}));if(!r)throw Error(f(27,!1,t));var e,o=yt(N(r));if(n&&n.waitForUnmount){if(o)return o.promise;var i=new Promise((function(t,n){Et(r,(function(){return i}),t,n)}));return i}return o?(e=o.promise,Mt(r,o.resolve,o.reject)):e=new Promise((function(t,n){Et(r,(function(){return e}),t,n),Mt(r,t,n)})),e}function Mt(t,n,r){I(t).then(wt).then((function(){n(),setTimeout((function(){Gt()}))})).catch(r)}function jt(t){return!t||"function"==typeof t||"object"===r(t)&&null!==t&&!Array.isArray(t)}function Rt(t,n){var r=function(t,n){var r=0,e=!1,o="^";"/"!==t[0]&&(t="/"+t);for(var i=0;i<t.length;i++){var u=t[i];(!e&&":"===u||e&&"/"===u)&&a(i)}return a(t.length),new RegExp(o,"i");function a(i){var u=t.slice(r,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=e?"[^/]+/?":u,i===t.length)if(e)n&&(o+="$");else{var a=n?"":".*";o="/"===o.charAt(o.length-1)?"".concat(o).concat(a,"$"):"".concat(o,"(/").concat(a,")?(#.*)?$")}e=!e,r=i}}(t,n);return function(t){var n=t.origin;n||(n="".concat(t.protocol,"//").concat(t.host));var e=t.href.replace(n,"").replace(t.search,"").split("?")[0];return r.test(e)}}var Lt=!1,It=[],xt=nt&&window.location.href;function Bt(){return Gt()}function Gt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Lt)return new Promise((function(t,r){It.push({resolve:t,reject:r,eventArguments:n})}));var o,u=Tt(),a=u.appsToUnload,c=u.appsToUnmount,s=u.appsToLoad,l=u.appsToMount,h=[],m=xt,v=xt=window.location.href;return kt()?(Lt=!0,o=a.concat(s,c,l),y()):(o=s,E());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 E(){return Promise.resolve().then((function(){var t=s.map(Z);return Promise.all(t).then(T).then((function(){return[]})).catch((function(t){throw T(),t}))}))}function y(){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(r){if(r.some((function(t){return t})))return st.call(window.history,history.state,"",m.substring(location.origin.length)),xt=location.href,Lt=!1,Gt(t,n,!0);var e=a.map(wt),o=c.map(I).map((function(t){return t.then(wt)})).concat(e),i=Promise.all(o);i.then((function(){A("before-mount-routing-event",b(!0))}));var u=s.map((function(t){return Z(t).then((function(t){return Ct(t,i)}))})),f=l.filter((function(t){return s.indexOf(t)<0})).map((function(t){return Ct(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)}))}))}))}function O(){var n=Pt();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(Lt=!1,It.length>0){var r=It;It=[],Gt(r)}return n}function T(){r||(t.forEach((function(t){it(t.eventArguments)})),it(n))}function b(){var t,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1?arguments[1]:void 0,u={},f=(e(t={},g,[]),e(t,d,[]),e(t,p,[]),e(t,P,[]),t);r?(s.concat(l).forEach((function(t,n){w(t,g)})),a.forEach((function(t){w(t,p)})),c.forEach((function(t){w(t,d)}))):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:v}};return i&&U(h.detail,i),h;function w(t,n){var r=N(t);n=n||At(r),u[r]=n,(f[n]=f[n]||[]).push(r)}}function A(t,n){r||window.dispatchEvent(new i("single-spa:".concat(t),n))}}function Ct(t,n){return A(t)?L(t).then((function(t){return n.then((function(){return A(t)?G(t):t}))})):n.then((function(){return t}))}var Wt=!1;function $t(t){Wt=!0,nt&&(lt(t),Gt())}function kt(){return Wt}var Ht={getRawAppData:function(){return[].concat(Ot)},reroute:Gt,NOT_LOADED:p,toLoadPromise:Z,toBootstrapPromise:L,unregisterApplication:Ut};nt&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=Ht)}}})); | ||
//# sourceMappingURL=single-spa.min.js.map |
230
package.json
{ | ||
"name": "single-spa", | ||
"version": "6.0.0-beta.1", | ||
"description": "The router for easy microfrontends", | ||
"main": "lib/es2015/umd/single-spa.min.cjs", | ||
"types": "typings/single-spa.d.ts", | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"development": { | ||
"import": "./lib/es2015/esm/single-spa.dev.js", | ||
"require": "./lib/es2015/umd/single-spa.dev.cjs" | ||
}, | ||
"production": { | ||
"import": "./lib/es2015/esm/single-spa.min.js", | ||
"require": "./lib/es2015/umd/single-spa.min.cjs" | ||
}, | ||
"default": { | ||
"import": "./lib/es2015/esm/single-spa.min.js", | ||
"require": "./lib/es2015/umd/single-spa.min.cjs" | ||
} | ||
}, | ||
"./package.json": "./package.json", | ||
"./lib/*": "./lib/*" | ||
}, | ||
"module": "lib/es2015/esm/single-spa.min.js", | ||
"tsd": { | ||
"testDir": "spec/typings", | ||
"compilerOptions": { | ||
"lib": [ | ||
"dom" | ||
] | ||
} | ||
}, | ||
"files": [ | ||
"lib", | ||
"typings/single-spa.d.ts" | ||
], | ||
"homepage": "https://single-spa.js.org", | ||
"repository": "https://github.com/single-spa/single-spa", | ||
"bugs": "https://github.com/single-spa/single-spa/issues", | ||
"keywords": [ | ||
"microfrontends", | ||
"single", | ||
"page", | ||
"application", | ||
"framework", | ||
"react", | ||
"angular", | ||
"vue", | ||
"router", | ||
"microservices", | ||
"frontend" | ||
], | ||
"author": "Joel Denning", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@babel/core": "^7.9.0", | ||
"@babel/eslint-parser": "^7.14.7", | ||
"@babel/plugin-syntax-dynamic-import": "^7.8.3", | ||
"@babel/preset-env": "^7.9.0", | ||
"@babel/runtime": "^7.14.6", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-commonjs": "^19.0.0", | ||
"@rollup/plugin-node-resolve": "^13.0.0", | ||
"@rollup/plugin-replace": "^2.3.1", | ||
"@types/jest": "^26.0.23", | ||
"babel-jest": "^27.0.6", | ||
"babel-plugin-dynamic-import-node": "^2.3.0", | ||
"concurrently": "^6.2.0", | ||
"cross-env": "^7.0.2", | ||
"custom-event": "^1.0.1", | ||
"eslint": "7.30.0", | ||
"eslint-config-important-stuff": "^1.1.0", | ||
"eslint-plugin-es5": "^1.5.0", | ||
"husky": "^7.0.0", | ||
"jest": "^27.0.6", | ||
"js-correct-lockfile": "^1.0.0", | ||
"pinst": "^2.1.6", | ||
"prettier": "^2.0.2", | ||
"pretty-quick": "^3.1.1", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.2.0", | ||
"rollup-plugin-analyzer": "^4.0.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"tsd": "^0.17.0" | ||
}, | ||
"browserslist": [ | ||
"ie >= 11", | ||
"last 4 Safari major versions", | ||
"last 10 Chrome major versions", | ||
"last 10 Firefox major versions", | ||
"last 4 Edge major versions" | ||
], | ||
"ignore": [ | ||
"examples", | ||
"docs" | ||
], | ||
"scripts": { | ||
"build": "pnpm run clean && concurrently pnpm:build:dev pnpm:build:prod", | ||
"build:prod": "rollup -c --environment NODE_ENV:'production'", | ||
"build:dev": "rollup -c", | ||
"build:analyze": "rollup -c --environment ANALYZER:'analyzer'", | ||
"watch": "rollup -c -w", | ||
"clean": "rimraf lib", | ||
"test": "concurrently -n w: 'pnpm:test:*'", | ||
"test:browser": "cross-env BABEL_ENV=test jest --config jest-browser.config.js", | ||
"test:node": "cross-env BABEL_ENV=test jest --config jest-node.config.js", | ||
"test:types": "tsd", | ||
"test:lockfile": "js-correct-lockfile pnpm", | ||
"format": "prettier --write .", | ||
"check-format": "prettier --check .", | ||
"lint": "eslint src", | ||
"_postinstall": "husky install" | ||
} | ||
} | ||
"name": "single-spa", | ||
"version": "6.0.0-beta.2", | ||
"description": "The router for easy microfrontends", | ||
"main": "lib/es2015/umd/single-spa.min.cjs", | ||
"types": "typings/single-spa.d.ts", | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"development": { | ||
"import": "./lib/es2015/esm/single-spa.dev.js", | ||
"require": "./lib/es2015/umd/single-spa.dev.cjs" | ||
}, | ||
"production": { | ||
"import": "./lib/es2015/esm/single-spa.min.js", | ||
"require": "./lib/es2015/umd/single-spa.min.cjs" | ||
}, | ||
"default": { | ||
"import": "./lib/es2015/esm/single-spa.min.js", | ||
"require": "./lib/es2015/umd/single-spa.min.cjs" | ||
} | ||
}, | ||
"./package.json": "./package.json", | ||
"./lib/*": "./lib/*" | ||
}, | ||
"module": "lib/es2015/esm/single-spa.min.js", | ||
"tsd": { | ||
"testDir": "spec/typings", | ||
"compilerOptions": { | ||
"lib": [ | ||
"dom" | ||
] | ||
} | ||
}, | ||
"files": [ | ||
"lib", | ||
"typings/single-spa.d.ts" | ||
], | ||
"homepage": "https://single-spa.js.org", | ||
"repository": "https://github.com/single-spa/single-spa", | ||
"bugs": "https://github.com/single-spa/single-spa/issues", | ||
"keywords": [ | ||
"microfrontends", | ||
"single", | ||
"page", | ||
"application", | ||
"framework", | ||
"react", | ||
"angular", | ||
"vue", | ||
"router", | ||
"microservices", | ||
"frontend" | ||
], | ||
"author": "Joel Denning", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@babel/core": "^7.9.0", | ||
"@babel/eslint-parser": "^7.14.7", | ||
"@babel/plugin-syntax-dynamic-import": "^7.8.3", | ||
"@babel/preset-env": "^7.9.0", | ||
"@babel/runtime": "^7.14.6", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-commonjs": "^19.0.0", | ||
"@rollup/plugin-node-resolve": "^13.0.0", | ||
"@rollup/plugin-replace": "^2.3.1", | ||
"@types/jest": "^26.0.23", | ||
"babel-jest": "^27.0.6", | ||
"babel-plugin-dynamic-import-node": "^2.3.0", | ||
"concurrently": "^6.2.0", | ||
"cross-env": "^7.0.2", | ||
"custom-event": "^1.0.1", | ||
"eslint": "7.30.0", | ||
"eslint-config-important-stuff": "^1.1.0", | ||
"eslint-plugin-es5": "^1.5.0", | ||
"husky": "^7.0.0", | ||
"jest": "^27.0.6", | ||
"js-correct-lockfile": "^1.0.0", | ||
"pinst": "^2.1.6", | ||
"prettier": "^2.0.2", | ||
"pretty-quick": "^3.1.1", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.2.0", | ||
"rollup-plugin-analyzer": "^4.0.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"tsd": "^0.17.0" | ||
}, | ||
"browserslist": [ | ||
"ie >= 11", | ||
"last 4 Safari major versions", | ||
"last 10 Chrome major versions", | ||
"last 10 Firefox major versions", | ||
"last 4 Edge major versions" | ||
], | ||
"ignore": [ | ||
"examples", | ||
"docs" | ||
], | ||
"scripts": { | ||
"build": "pnpm run clean && concurrently pnpm:build:dev pnpm:build:prod", | ||
"build:prod": "rollup -c --environment NODE_ENV:'production'", | ||
"build:dev": "rollup -c", | ||
"build:analyze": "rollup -c --environment ANALYZER:'analyzer'", | ||
"watch": "rollup -c -w", | ||
"clean": "rimraf lib", | ||
"test": "concurrently -n w: 'pnpm:test:*'", | ||
"test:browser": "cross-env BABEL_ENV=test jest --config jest-browser.config.js", | ||
"test:node": "cross-env BABEL_ENV=test jest --config jest-node.config.js", | ||
"test:types": "tsd", | ||
"test:lockfile": "js-correct-lockfile pnpm", | ||
"format": "prettier --write .", | ||
"check-format": "prettier --check .", | ||
"lint": "eslint src", | ||
"_postinstall": "husky install" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1860012
9701
28