{"version":3,"file":"single-spa.min.js","sources":["../../node_modules/custom-event/index.js","../../src/applications/app-errors.js","../../src/applications/app.helpers.js","../../src/utils/assign.js","../../src/utils/find.js","../../src/lifecycles/lifecycle.helpers.js","../../src/lifecycles/bootstrap.js","../../src/lifecycles/unmount.js","../../src/lifecycles/mount.js","../../src/parcels/mount-parcel.js","../../src/lifecycles/update.js","../../src/lifecycles/prop.helpers.js","../../src/applications/timeouts.js","../../src/lifecycles/load.js","../../src/utils/runtime-environment.js","../../src/navigation/navigation-events.js","../../src/jquery-support.js","../../src/lifecycles/unload.js","../../src/applications/apps.js","../../src/navigation/reroute.js","../../src/start.js","../../src/devtools/devtools.js","../../src/single-spa.js"],"sourcesContent":["\nvar NativeCustomEvent = global.CustomEvent;\n\nfunction useNative () {\n try {\n var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } });\n return 'cat' === p.type && 'bar' === p.detail.foo;\n } catch (e) {\n }\n return false;\n}\n\n/**\n * Cross-browser `CustomEvent` constructor.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent\n *\n * @public\n */\n\nmodule.exports = useNative() ? NativeCustomEvent :\n\n// IE >= 9\n'undefined' !== typeof document && 'function' === typeof document.createEvent ? function CustomEvent (type, params) {\n var e = document.createEvent('CustomEvent');\n if (params) {\n e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail);\n } else {\n e.initCustomEvent(type, false, false, void 0);\n }\n return e;\n} :\n\n// IE <= 8\nfunction CustomEvent (type, params) {\n var e = document.createEventObject();\n e.type = type;\n if (params) {\n e.bubbles = Boolean(params.bubbles);\n e.cancelable = Boolean(params.cancelable);\n e.detail = params.detail;\n } else {\n e.bubbles = false;\n e.cancelable = false;\n e.detail = void 0;\n }\n return e;\n}\n","import { objectType, toName } from \"./app.helpers\";\n\nlet errorHandlers = [];\n\nexport function handleAppError(err, app, newStatus) {\n const transformedErr = transformErr(err, app, newStatus);\n\n if (errorHandlers.length) {\n errorHandlers.forEach((handler) => handler(transformedErr));\n } else {\n setTimeout(() => {\n throw transformedErr;\n });\n }\n}\n\nexport function addErrorHandler(handler) {\n if (typeof handler !== \"function\") {\n throw Error(\n formatErrorMessage(\n 28,\n __DEV__ && \"a single-spa error handler must be a function\"\n )\n );\n }\n\n errorHandlers.push(handler);\n}\n\nexport function removeErrorHandler(handler) {\n if (typeof handler !== \"function\") {\n throw Error(\n formatErrorMessage(\n 29,\n __DEV__ && \"a single-spa error handler must be a function\"\n )\n );\n }\n\n let removedSomething = false;\n errorHandlers = errorHandlers.filter((h) => {\n const isHandler = h === handler;\n removedSomething = removedSomething || isHandler;\n return !isHandler;\n });\n\n return removedSomething;\n}\n\nexport function formatErrorMessage(code, msg, ...args) {\n return `single-spa minified message #${code}: ${\n msg ? msg + \" \" : \"\"\n }See https://single-spa.js.org/error/?code=${code}${\n args.length ? `&arg=${args.join(\"&arg=\")}` : \"\"\n }`;\n}\n\nexport function transformErr(ogErr, appOrParcel, newStatus) {\n const errPrefix = `${objectType(appOrParcel)} '${toName(\n appOrParcel\n )}' died in status ${appOrParcel.status}: `;\n\n let result;\n\n if (ogErr instanceof Error) {\n try {\n ogErr.message = errPrefix + ogErr.message;\n } catch (err) {\n /* Some errors have read-only message properties, in which case there is nothing\n * that we can do.\n */\n }\n result = ogErr;\n } else {\n console.warn(\n formatErrorMessage(\n 30,\n __DEV__ &&\n `While ${appOrParcel.status}, '${toName(\n appOrParcel\n )}' rejected its lifecycle function promise with a non-Error. This will cause stack traces to not be accurate.`,\n appOrParcel.status,\n toName(appOrParcel)\n )\n );\n try {\n result = Error(errPrefix + JSON.stringify(ogErr));\n } catch (err) {\n // If it's not an Error and you can't stringify it, then what else can you even do to it?\n result = ogErr;\n }\n }\n\n result.appOrParcelName = toName(appOrParcel);\n\n // We set the status after transforming the error so that the error message\n // references the state the application was in before the status change.\n appOrParcel.status = newStatus;\n\n return result;\n}\n","import { handleAppError } from \"./app-errors.js\";\n\n// App statuses\nexport const NOT_LOADED = \"NOT_LOADED\";\nexport const LOADING_SOURCE_CODE = \"LOADING_SOURCE_CODE\";\nexport const NOT_BOOTSTRAPPED = \"NOT_BOOTSTRAPPED\";\nexport const BOOTSTRAPPING = \"BOOTSTRAPPING\";\nexport const NOT_MOUNTED = \"NOT_MOUNTED\";\nexport const MOUNTING = \"MOUNTING\";\nexport const MOUNTED = \"MOUNTED\";\nexport const UPDATING = \"UPDATING\";\nexport const UNMOUNTING = \"UNMOUNTING\";\nexport const UNLOADING = \"UNLOADING\";\nexport const LOAD_ERROR = \"LOAD_ERROR\";\nexport const SKIP_BECAUSE_BROKEN = \"SKIP_BECAUSE_BROKEN\";\n\nexport function isActive(app) {\n return app.status === MOUNTED;\n}\n\nexport function shouldBeActive(app) {\n try {\n return app.activeWhen(window.location);\n } catch (err) {\n handleAppError(err, app, SKIP_BECAUSE_BROKEN);\n return false;\n }\n}\n\nexport function toName(app) {\n return app.name;\n}\n\nexport function isParcel(appOrParcel) {\n return Boolean(appOrParcel.unmountThisParcel);\n}\n\nexport function objectType(appOrParcel) {\n return isParcel(appOrParcel) ? \"parcel\" : \"application\";\n}\n","// Object.assign() is not available in IE11. And the babel compiled output for object spread\n// syntax checks a bunch of Symbol stuff and is almost a kb. So this function is the smaller replacement.\nexport function assign() {\n for (let i = arguments.length - 1; i > 0; i--) {\n for (let key in arguments[i]) {\n if (key === \"__proto__\") {\n continue;\n }\n arguments[i - 1][key] = arguments[i][key];\n }\n }\n\n return arguments[0];\n}\n","/* the array.prototype.find polyfill on npmjs.com is ~20kb (not worth it)\n * and lodash is ~200kb (not worth it)\n */\n\nexport function find(arr, func) {\n for (let i = 0; i < arr.length; i++) {\n if (func(arr[i])) {\n return arr[i];\n }\n }\n\n return null;\n}\n","import { find } from \"../utils/find.js\";\nimport { objectType, toName } from \"../applications/app.helpers.js\";\nimport { formatErrorMessage } from \"../applications/app-errors.js\";\n\nexport function validLifecycleFn(fn) {\n return fn && (typeof fn === \"function\" || isArrayOfFns(fn));\n\n function isArrayOfFns(arr) {\n return (\n Array.isArray(arr) && !find(arr, (item) => typeof item !== \"function\")\n );\n }\n}\n\nexport function flattenFnArray(appOrParcel, lifecycle) {\n let fns = appOrParcel[lifecycle] || [];\n fns = Array.isArray(fns) ? fns : [fns];\n if (fns.length === 0) {\n fns = [() => Promise.resolve()];\n }\n\n const type = objectType(appOrParcel);\n const name = toName(appOrParcel);\n\n return function (props) {\n return fns.reduce((resultPromise, fn, index) => {\n return resultPromise.then(() => {\n const thisPromise = fn(props);\n return smellsLikeAPromise(thisPromise)\n ? thisPromise\n : Promise.reject(\n formatErrorMessage(\n 15,\n __DEV__ &&\n `Within ${type} ${name}, the lifecycle function ${lifecycle} at array index ${index} did not return a promise`,\n type,\n name,\n lifecycle,\n index\n )\n );\n });\n }, Promise.resolve());\n };\n}\n\nexport function smellsLikeAPromise(promise) {\n return (\n promise &&\n typeof promise.then === \"function\" &&\n typeof promise.catch === \"function\"\n );\n}\n","import {\n NOT_BOOTSTRAPPED,\n BOOTSTRAPPING,\n NOT_MOUNTED,\n SKIP_BECAUSE_BROKEN,\n} from \"../applications/app.helpers.js\";\nimport { reasonableTime } from \"../applications/timeouts.js\";\nimport { handleAppError, transformErr } from \"../applications/app-errors.js\";\n\nexport function toBootstrapPromise(appOrParcel, hardFail) {\n return Promise.resolve().then(() => {\n if (appOrParcel.status !== NOT_BOOTSTRAPPED) {\n return appOrParcel;\n }\n\n appOrParcel.status = BOOTSTRAPPING;\n\n return reasonableTime(appOrParcel, \"bootstrap\")\n .then(() => {\n appOrParcel.status = NOT_MOUNTED;\n return appOrParcel;\n })\n .catch((err) => {\n if (hardFail) {\n throw transformErr(err, appOrParcel, SKIP_BECAUSE_BROKEN);\n } else {\n handleAppError(err, appOrParcel, SKIP_BECAUSE_BROKEN);\n return appOrParcel;\n }\n });\n });\n}\n","import {\n UNMOUNTING,\n NOT_MOUNTED,\n MOUNTED,\n SKIP_BECAUSE_BROKEN,\n} from \"../applications/app.helpers.js\";\nimport { handleAppError, transformErr } from \"../applications/app-errors.js\";\nimport { reasonableTime } from \"../applications/timeouts.js\";\n\nexport function toUnmountPromise(appOrParcel, hardFail) {\n return Promise.resolve().then(() => {\n if (appOrParcel.status !== MOUNTED) {\n return appOrParcel;\n }\n appOrParcel.status = UNMOUNTING;\n\n const unmountChildrenParcels = Object.keys(\n appOrParcel.parcels\n ).map((parcelId) => appOrParcel.parcels[parcelId].unmountThisParcel());\n\n let parcelError;\n\n return Promise.all(unmountChildrenParcels)\n .then(unmountAppOrParcel, (parcelError) => {\n // There is a parcel unmount error\n return unmountAppOrParcel().then(() => {\n // Unmounting the app/parcel succeeded, but unmounting its children parcels did not\n const parentError = Error(parcelError.message);\n if (hardFail) {\n throw transformErr(parentError, appOrParcel, SKIP_BECAUSE_BROKEN);\n } else {\n handleAppError(parentError, appOrParcel, SKIP_BECAUSE_BROKEN);\n }\n });\n })\n .then(() => appOrParcel);\n\n function unmountAppOrParcel() {\n // We always try to unmount the appOrParcel, even if the children parcels failed to unmount.\n return reasonableTime(appOrParcel, \"unmount\")\n .then(() => {\n // The appOrParcel needs to stay in a broken status if its children parcels fail to unmount\n if (!parcelError) {\n appOrParcel.status = NOT_MOUNTED;\n }\n })\n .catch((err) => {\n if (hardFail) {\n throw transformErr(err, appOrParcel, SKIP_BECAUSE_BROKEN);\n } else {\n handleAppError(err, appOrParcel, SKIP_BECAUSE_BROKEN);\n }\n });\n }\n });\n}\n","import {\n NOT_MOUNTED,\n MOUNTED,\n SKIP_BECAUSE_BROKEN,\n} from \"../applications/app.helpers.js\";\nimport { handleAppError, transformErr } from \"../applications/app-errors.js\";\nimport { reasonableTime } from \"../applications/timeouts.js\";\nimport CustomEvent from \"custom-event\";\nimport { toUnmountPromise } from \"./unmount.js\";\n\nlet beforeFirstMountFired = false;\nlet firstMountFired = false;\n\nexport function toMountPromise(appOrParcel, hardFail) {\n return Promise.resolve().then(() => {\n if (appOrParcel.status !== NOT_MOUNTED) {\n return appOrParcel;\n }\n\n if (!beforeFirstMountFired) {\n window.dispatchEvent(new CustomEvent(\"single-spa:before-first-mount\"));\n beforeFirstMountFired = true;\n }\n\n return reasonableTime(appOrParcel, \"mount\")\n .then(() => {\n appOrParcel.status = MOUNTED;\n\n if (!firstMountFired) {\n window.dispatchEvent(new CustomEvent(\"single-spa:first-mount\"));\n firstMountFired = true;\n }\n\n return appOrParcel;\n })\n .catch((err) => {\n // If we fail to mount the appOrParcel, we should attempt to unmount it before putting in SKIP_BECAUSE_BROKEN\n // We temporarily put the appOrParcel into MOUNTED status so that toUnmountPromise actually attempts to unmount it\n // instead of just doing a no-op.\n appOrParcel.status = MOUNTED;\n return toUnmountPromise(appOrParcel, true).then(\n setSkipBecauseBroken,\n setSkipBecauseBroken\n );\n\n function setSkipBecauseBroken() {\n if (!hardFail) {\n handleAppError(err, appOrParcel, SKIP_BECAUSE_BROKEN);\n return appOrParcel;\n } else {\n throw transformErr(err, appOrParcel, SKIP_BECAUSE_BROKEN);\n }\n }\n });\n });\n}\n","import {\n validLifecycleFn,\n flattenFnArray,\n} from \"../lifecycles/lifecycle.helpers.js\";\nimport {\n NOT_BOOTSTRAPPED,\n NOT_MOUNTED,\n MOUNTED,\n LOADING_SOURCE_CODE,\n SKIP_BECAUSE_BROKEN,\n toName,\n} from \"../applications/app.helpers.js\";\nimport { toBootstrapPromise } from \"../lifecycles/bootstrap.js\";\nimport { toMountPromise } from \"../lifecycles/mount.js\";\nimport { toUpdatePromise } from \"../lifecycles/update.js\";\nimport { toUnmountPromise } from \"../lifecycles/unmount.js\";\nimport { ensureValidAppTimeouts } from \"../applications/timeouts.js\";\nimport { formatErrorMessage } from \"../applications/app-errors.js\";\n\nlet parcelCount = 0;\nconst rootParcels = { parcels: {} };\n\n// This is a public api, exported to users of single-spa\nexport function mountRootParcel() {\n return mountParcel.apply(rootParcels, arguments);\n}\n\nexport function mountParcel(config, customProps) {\n const owningAppOrParcel = this;\n\n // Validate inputs\n if (!config || (typeof config !== \"object\" && typeof config !== \"function\")) {\n throw Error(\n formatErrorMessage(\n 2,\n __DEV__ &&\n \"Cannot mount parcel without a config object or config loading function\"\n )\n );\n }\n\n if (config.name && typeof config.name !== \"string\") {\n throw Error(\n formatErrorMessage(\n 3,\n __DEV__ &&\n `Parcel name must be a string, if provided. Was given ${typeof config.name}`,\n typeof config.name\n )\n );\n }\n\n if (typeof customProps !== \"object\") {\n throw Error(\n formatErrorMessage(\n 4,\n __DEV__ &&\n `Parcel ${name} has invalid customProps -- must be an object but was given ${typeof customProps}`,\n name,\n typeof customProps\n )\n );\n }\n\n if (!customProps.domElement) {\n throw Error(\n formatErrorMessage(\n 5,\n __DEV__ &&\n `Parcel ${name} cannot be mounted without a domElement provided as a prop`,\n name\n )\n );\n }\n\n const id = parcelCount++;\n\n const passedConfigLoadingFunction = typeof config === \"function\";\n const configLoadingFunction = passedConfigLoadingFunction\n ? config\n : () => Promise.resolve(config);\n\n // Internal representation\n const parcel = {\n id,\n parcels: {},\n status: passedConfigLoadingFunction\n ? LOADING_SOURCE_CODE\n : NOT_BOOTSTRAPPED,\n customProps,\n parentName: toName(owningAppOrParcel),\n unmountThisParcel() {\n if (parcel.status !== MOUNTED) {\n throw Error(\n formatErrorMessage(\n 6,\n __DEV__ &&\n `Cannot unmount parcel '${name}' -- it is in a ${parcel.status} status`,\n name,\n parcel.status\n )\n );\n }\n\n return toUnmountPromise(parcel, true)\n .then((value) => {\n if (parcel.parentName) {\n delete owningAppOrParcel.parcels[parcel.id];\n }\n\n return value;\n })\n .then((value) => {\n resolveUnmount(value);\n return value;\n })\n .catch((err) => {\n parcel.status = SKIP_BECAUSE_BROKEN;\n rejectUnmount(err);\n throw err;\n });\n },\n };\n\n // We return an external representation\n let externalRepresentation;\n\n // Add to owning app or parcel\n owningAppOrParcel.parcels[id] = parcel;\n\n let loadPromise = configLoadingFunction();\n\n if (!loadPromise || typeof loadPromise.then !== \"function\") {\n throw Error(\n formatErrorMessage(\n 7,\n __DEV__ &&\n `When mounting a parcel, the config loading function must return a promise that resolves with the parcel config`\n )\n );\n }\n\n loadPromise = loadPromise.then((config) => {\n if (!config) {\n throw Error(\n formatErrorMessage(\n 8,\n __DEV__ &&\n `When mounting a parcel, the config loading function returned a promise that did not resolve with a parcel config`\n )\n );\n }\n\n const name = config.name || `parcel-${id}`;\n\n if (!validLifecycleFn(config.bootstrap)) {\n throw Error(\n formatErrorMessage(\n 9,\n __DEV__ && `Parcel ${name} must have a valid bootstrap function`,\n name\n )\n );\n }\n\n if (!validLifecycleFn(config.mount)) {\n throw Error(\n formatErrorMessage(\n 10,\n __DEV__ && `Parcel ${name} must have a valid mount function`,\n name\n )\n );\n }\n\n if (!validLifecycleFn(config.unmount)) {\n throw Error(\n formatErrorMessage(\n 11,\n __DEV__ && `Parcel ${name} must have a valid unmount function`,\n name\n )\n );\n }\n\n if (config.update && !validLifecycleFn(config.update)) {\n throw Error(\n formatErrorMessage(\n 12,\n __DEV__ && `Parcel ${name} provided an invalid update function`,\n name\n )\n );\n }\n\n const bootstrap = flattenFnArray(config, \"bootstrap\");\n const mount = flattenFnArray(config, \"mount\");\n const unmount = flattenFnArray(config, \"unmount\");\n\n parcel.status = NOT_BOOTSTRAPPED;\n parcel.name = name;\n parcel.bootstrap = bootstrap;\n parcel.mount = mount;\n parcel.unmount = unmount;\n parcel.timeouts = ensureValidAppTimeouts(config.timeouts);\n\n if (config.update) {\n parcel.update = flattenFnArray(config, \"update\");\n externalRepresentation.update = function (customProps) {\n parcel.customProps = customProps;\n\n return promiseWithoutReturnValue(toUpdatePromise(parcel));\n };\n }\n });\n\n // Start bootstrapping and mounting\n // The .then() causes the work to be put on the event loop instead of happening immediately\n const bootstrapPromise = loadPromise.then(() =>\n toBootstrapPromise(parcel, true)\n );\n const mountPromise = bootstrapPromise.then(() =>\n toMountPromise(parcel, true)\n );\n\n let resolveUnmount, rejectUnmount;\n\n const unmountPromise = new Promise((resolve, reject) => {\n resolveUnmount = resolve;\n rejectUnmount = reject;\n });\n\n externalRepresentation = {\n mount() {\n return promiseWithoutReturnValue(\n Promise.resolve().then(() => {\n if (parcel.status !== NOT_MOUNTED) {\n throw Error(\n formatErrorMessage(\n 13,\n __DEV__ &&\n `Cannot mount parcel '${name}' -- it is in a ${parcel.status} status`,\n name,\n parcel.status\n )\n );\n }\n\n // Add to owning app or parcel\n owningAppOrParcel.parcels[id] = parcel;\n\n return toMountPromise(parcel);\n })\n );\n },\n unmount() {\n return promiseWithoutReturnValue(parcel.unmountThisParcel());\n },\n getStatus() {\n return parcel.status;\n },\n loadPromise: promiseWithoutReturnValue(loadPromise),\n bootstrapPromise: promiseWithoutReturnValue(bootstrapPromise),\n mountPromise: promiseWithoutReturnValue(mountPromise),\n unmountPromise: promiseWithoutReturnValue(unmountPromise),\n };\n\n return externalRepresentation;\n}\n\nfunction promiseWithoutReturnValue(promise) {\n return promise.then(() => null);\n}\n","import {\n UPDATING,\n MOUNTED,\n SKIP_BECAUSE_BROKEN,\n toName,\n} from \"../applications/app.helpers.js\";\nimport {\n transformErr,\n formatErrorMessage,\n} from \"../applications/app-errors.js\";\nimport { reasonableTime } from \"../applications/timeouts.js\";\n\nexport function toUpdatePromise(parcel) {\n return Promise.resolve().then(() => {\n if (parcel.status !== MOUNTED) {\n throw Error(\n formatErrorMessage(\n 32,\n __DEV__ &&\n `Cannot update parcel '${toName(\n parcel\n )}' because it is not mounted`,\n toName(parcel)\n )\n );\n }\n\n parcel.status = UPDATING;\n\n return reasonableTime(parcel, \"update\")\n .then(() => {\n parcel.status = MOUNTED;\n return parcel;\n })\n .catch((err) => {\n throw transformErr(err, parcel, SKIP_BECAUSE_BROKEN);\n });\n });\n}\n","import * as singleSpa from \"../single-spa.js\";\nimport { mountParcel } from \"../parcels/mount-parcel.js\";\nimport { assign } from \"../utils/assign.js\";\nimport { isParcel, toName } from \"../applications/app.helpers.js\";\nimport { formatErrorMessage } from \"../applications/app-errors.js\";\n\nexport function getProps(appOrParcel) {\n const name = toName(appOrParcel);\n let customProps =\n typeof appOrParcel.customProps === \"function\"\n ? appOrParcel.customProps(name, window.location)\n : appOrParcel.customProps;\n if (\n typeof customProps !== \"object\" ||\n customProps === null ||\n Array.isArray(customProps)\n ) {\n customProps = {};\n console.warn(\n formatErrorMessage(\n 40,\n __DEV__ &&\n `single-spa: ${name}'s customProps function must return an object. Received ${customProps}`\n ),\n name,\n customProps\n );\n }\n const result = assign({}, customProps, {\n name,\n mountParcel: mountParcel.bind(appOrParcel),\n singleSpa,\n });\n\n if (isParcel(appOrParcel)) {\n result.unmountSelf = appOrParcel.unmountThisParcel;\n }\n\n return result;\n}\n","import { assign } from \"../utils/assign\";\nimport { getProps } from \"../lifecycles/prop.helpers\";\nimport { objectType, toName } from \"./app.helpers\";\nimport { formatErrorMessage } from \"./app-errors\";\n\nconst defaultWarningMillis = 1000;\n\nconst globalTimeoutConfig = {\n bootstrap: {\n millis: 4000,\n dieOnTimeout: false,\n warningMillis: defaultWarningMillis,\n },\n mount: {\n millis: 3000,\n dieOnTimeout: false,\n warningMillis: defaultWarningMillis,\n },\n unmount: {\n millis: 3000,\n dieOnTimeout: false,\n warningMillis: defaultWarningMillis,\n },\n unload: {\n millis: 3000,\n dieOnTimeout: false,\n warningMillis: defaultWarningMillis,\n },\n update: {\n millis: 3000,\n dieOnTimeout: false,\n warningMillis: defaultWarningMillis,\n },\n};\n\nexport function setBootstrapMaxTime(time, dieOnTimeout, warningMillis) {\n if (typeof time !== \"number\" || time <= 0) {\n throw Error(\n formatErrorMessage(\n 16,\n __DEV__ &&\n `bootstrap max time must be a positive integer number of milliseconds`\n )\n );\n }\n\n globalTimeoutConfig.bootstrap = {\n millis: time,\n dieOnTimeout,\n warningMillis: warningMillis || defaultWarningMillis,\n };\n}\n\nexport function setMountMaxTime(time, dieOnTimeout, warningMillis) {\n if (typeof time !== \"number\" || time <= 0) {\n throw Error(\n formatErrorMessage(\n 17,\n __DEV__ &&\n `mount max time must be a positive integer number of milliseconds`\n )\n );\n }\n\n globalTimeoutConfig.mount = {\n millis: time,\n dieOnTimeout,\n warningMillis: warningMillis || defaultWarningMillis,\n };\n}\n\nexport function setUnmountMaxTime(time, dieOnTimeout, warningMillis) {\n if (typeof time !== \"number\" || time <= 0) {\n throw Error(\n formatErrorMessage(\n 18,\n __DEV__ &&\n `unmount max time must be a positive integer number of milliseconds`\n )\n );\n }\n\n globalTimeoutConfig.unmount = {\n millis: time,\n dieOnTimeout,\n warningMillis: warningMillis || defaultWarningMillis,\n };\n}\n\nexport function setUnloadMaxTime(time, dieOnTimeout, warningMillis) {\n if (typeof time !== \"number\" || time <= 0) {\n throw Error(\n formatErrorMessage(\n 19,\n __DEV__ &&\n `unload max time must be a positive integer number of milliseconds`\n )\n );\n }\n\n globalTimeoutConfig.unload = {\n millis: time,\n dieOnTimeout,\n warningMillis: warningMillis || defaultWarningMillis,\n };\n}\n\nexport function reasonableTime(appOrParcel, lifecycle) {\n const timeoutConfig = appOrParcel.timeouts[lifecycle];\n const warningPeriod = timeoutConfig.warningMillis;\n const type = objectType(appOrParcel);\n\n return new Promise((resolve, reject) => {\n let finished = false;\n let errored = false;\n\n appOrParcel[lifecycle](getProps(appOrParcel))\n .then((val) => {\n finished = true;\n resolve(val);\n })\n .catch((val) => {\n finished = true;\n reject(val);\n });\n\n setTimeout(() => maybeTimingOut(1), warningPeriod);\n setTimeout(() => maybeTimingOut(true), timeoutConfig.millis);\n\n const errMsg = formatErrorMessage(\n 31,\n __DEV__ &&\n `Lifecycle function ${lifecycle} for ${type} ${toName(\n appOrParcel\n )} lifecycle did not resolve or reject for ${timeoutConfig.millis} ms.`,\n lifecycle,\n type,\n toName(appOrParcel),\n timeoutConfig.millis\n );\n\n function maybeTimingOut(shouldError) {\n if (!finished) {\n if (shouldError === true) {\n errored = true;\n if (timeoutConfig.dieOnTimeout) {\n reject(Error(errMsg));\n } else {\n console.error(errMsg);\n //don't resolve or reject, we're waiting this one out\n }\n } else if (!errored) {\n const numWarnings = shouldError;\n const numMillis = numWarnings * warningPeriod;\n console.warn(errMsg);\n if (numMillis + warningPeriod < timeoutConfig.millis) {\n setTimeout(() => maybeTimingOut(numWarnings + 1), warningPeriod);\n }\n }\n }\n }\n });\n}\n\nexport function ensureValidAppTimeouts(timeouts) {\n const result = {};\n\n for (let key in globalTimeoutConfig) {\n result[key] = assign(\n {},\n globalTimeoutConfig[key],\n (timeouts && timeouts[key]) || {}\n );\n }\n\n return result;\n}\n","import {\n LOAD_ERROR,\n NOT_BOOTSTRAPPED,\n LOADING_SOURCE_CODE,\n SKIP_BECAUSE_BROKEN,\n NOT_LOADED,\n objectType,\n toName,\n} from \"../applications/app.helpers.js\";\nimport { ensureValidAppTimeouts } from \"../applications/timeouts.js\";\nimport {\n handleAppError,\n formatErrorMessage,\n} from \"../applications/app-errors.js\";\nimport {\n flattenFnArray,\n smellsLikeAPromise,\n validLifecycleFn,\n} from \"./lifecycle.helpers.js\";\nimport { getProps } from \"./prop.helpers.js\";\nimport { assign } from \"../utils/assign.js\";\n\nexport function toLoadPromise(app) {\n return Promise.resolve().then(() => {\n if (app.loadPromise) {\n return app.loadPromise;\n }\n\n if (app.status !== NOT_LOADED && app.status !== LOAD_ERROR) {\n return app;\n }\n\n app.status = LOADING_SOURCE_CODE;\n\n let appOpts, isUserErr;\n\n return (app.loadPromise = Promise.resolve()\n .then(() => {\n const loadPromise = app.loadApp(getProps(app));\n if (!smellsLikeAPromise(loadPromise)) {\n // The name of the app will be prepended to this error message inside of the handleAppError function\n isUserErr = true;\n throw Error(\n formatErrorMessage(\n 33,\n __DEV__ &&\n `single-spa loading function did not return a promise. Check the second argument to registerApplication('${toName(\n app\n )}', loadingFunction, activityFunction)`,\n toName(app)\n )\n );\n }\n return loadPromise.then((val) => {\n app.loadErrorTime = null;\n\n appOpts = val;\n\n let validationErrMessage, validationErrCode;\n\n if (typeof appOpts !== \"object\") {\n validationErrCode = 34;\n if (__DEV__) {\n validationErrMessage = `does not export anything`;\n }\n }\n\n if (!validLifecycleFn(appOpts.bootstrap)) {\n validationErrCode = 35;\n if (__DEV__) {\n validationErrMessage = `does not export a bootstrap function or array of functions`;\n }\n }\n\n if (!validLifecycleFn(appOpts.mount)) {\n validationErrCode = 36;\n if (__DEV__) {\n validationErrMessage = `does not export a bootstrap function or array of functions`;\n }\n }\n\n if (!validLifecycleFn(appOpts.unmount)) {\n validationErrCode = 37;\n if (__DEV__) {\n validationErrMessage = `does not export a bootstrap function or array of functions`;\n }\n }\n\n const type = objectType(appOpts);\n\n if (validationErrCode) {\n let appOptsStr;\n try {\n appOptsStr = JSON.stringify(appOpts);\n } catch {}\n console.error(\n formatErrorMessage(\n validationErrCode,\n __DEV__ &&\n `The loading function for single-spa ${type} '${toName(\n app\n )}' resolved with the following, which does not have bootstrap, mount, and unmount functions`,\n type,\n toName(app),\n appOptsStr\n ),\n appOpts\n );\n handleAppError(validationErrMessage, app, SKIP_BECAUSE_BROKEN);\n return app;\n }\n\n if (appOpts.devtools && appOpts.devtools.overlays) {\n app.devtools.overlays = assign(\n {},\n app.devtools.overlays,\n appOpts.devtools.overlays\n );\n }\n\n app.status = NOT_BOOTSTRAPPED;\n app.bootstrap = flattenFnArray(appOpts, \"bootstrap\");\n app.mount = flattenFnArray(appOpts, \"mount\");\n app.unmount = flattenFnArray(appOpts, \"unmount\");\n app.unload = flattenFnArray(appOpts, \"unload\");\n app.timeouts = ensureValidAppTimeouts(appOpts.timeouts);\n\n delete app.loadPromise;\n\n return app;\n });\n })\n .catch((err) => {\n delete app.loadPromise;\n\n let newStatus;\n if (isUserErr) {\n newStatus = SKIP_BECAUSE_BROKEN;\n } else {\n newStatus = LOAD_ERROR;\n app.loadErrorTime = new Date().getTime();\n }\n handleAppError(err, app, newStatus);\n\n return app;\n }));\n });\n}\n","export const isInBrowser = typeof window !== \"undefined\";\n","import { reroute } from \"./reroute.js\";\nimport { find } from \"../utils/find.js\";\nimport { formatErrorMessage } from \"../applications/app-errors.js\";\nimport { isInBrowser } from \"../utils/runtime-environment.js\";\n\n/* We capture navigation event listeners so that we can make sure\n * that application navigation listeners are not called until\n * single-spa has ensured that the correct applications are\n * unmounted and mounted.\n */\nconst capturedEventListeners = {\n hashchange: [],\n popstate: [],\n};\n\nexport const routingEventsListeningTo = [\"hashchange\", \"popstate\"];\n\nexport function navigateToUrl(obj) {\n let url;\n if (typeof obj === \"string\") {\n url = obj;\n } else if (this && this.href) {\n url = this.href;\n } else if (\n obj &&\n obj.currentTarget &&\n obj.currentTarget.href &&\n obj.preventDefault\n ) {\n url = obj.currentTarget.href;\n obj.preventDefault();\n } else {\n throw Error(\n formatErrorMessage(\n 14,\n __DEV__ &&\n `singleSpaNavigate/navigateToUrl must be either called with a string url, with an tag as its context, or with an event whose currentTarget is an tag`\n )\n );\n }\n\n const current = parseUri(window.location.href);\n const destination = parseUri(url);\n\n if (url.indexOf(\"#\") === 0) {\n window.location.hash = destination.hash;\n } else if (current.host !== destination.host && destination.host) {\n if (process.env.BABEL_ENV === \"test\") {\n return { wouldHaveReloadedThePage: true };\n } else {\n window.location.href = url;\n }\n } else if (\n destination.pathname === current.pathname &&\n destination.search === current.search\n ) {\n window.location.hash = destination.hash;\n } else {\n // different path, host, or query params\n window.history.pushState(null, null, url);\n }\n}\n\nexport function callCapturedEventListeners(eventArguments) {\n if (eventArguments) {\n const eventType = eventArguments[0].type;\n if (routingEventsListeningTo.indexOf(eventType) >= 0) {\n capturedEventListeners[eventType].forEach((listener) => {\n try {\n // The error thrown by application event listener should not break single-spa down.\n // Just like https://github.com/single-spa/single-spa/blob/85f5042dff960e40936f3a5069d56fc9477fac04/src/navigation/reroute.js#L140-L146 did\n listener.apply(this, eventArguments);\n } catch (e) {\n setTimeout(() => {\n throw e;\n });\n }\n });\n }\n }\n}\n\nlet urlRerouteOnly;\n\nexport function setUrlRerouteOnly(val) {\n urlRerouteOnly = val;\n}\n\nfunction urlReroute() {\n reroute([], arguments);\n}\n\nfunction patchedUpdateState(updateState, methodName) {\n return function () {\n const urlBefore = window.location.href;\n const result = updateState.apply(this, arguments);\n const urlAfter = window.location.href;\n\n if (!urlRerouteOnly || urlBefore !== urlAfter) {\n urlReroute(createPopStateEvent(window.history.state, methodName));\n }\n\n return result;\n };\n}\n\nfunction createPopStateEvent(state, originalMethodName) {\n // https://github.com/single-spa/single-spa/issues/224 and https://github.com/single-spa/single-spa-angular/issues/49\n // We need a popstate event even though the browser doesn't do one by default when you call replaceState, so that\n // all the applications can reroute. We explicitly identify this extraneous event by setting singleSpa=true and\n // singleSpaTrigger= on the event instance.\n let evt;\n try {\n evt = new PopStateEvent(\"popstate\", { state });\n } catch (err) {\n // IE 11 compatibility https://github.com/single-spa/single-spa/issues/299\n // https://docs.microsoft.com/en-us/openspecs/ie_standards/ms-html5e/bd560f47-b349-4d2c-baa8-f1560fb489dd\n evt = document.createEvent(\"PopStateEvent\");\n evt.initPopStateEvent(\"popstate\", false, false, state);\n }\n evt.singleSpa = true;\n evt.singleSpaTrigger = originalMethodName;\n return evt;\n}\n\nif (isInBrowser) {\n // We will trigger an app change for any routing events.\n window.addEventListener(\"hashchange\", urlReroute);\n window.addEventListener(\"popstate\", urlReroute);\n\n // Monkeypatch addEventListener so that we can ensure correct timing\n const originalAddEventListener = window.addEventListener;\n const originalRemoveEventListener = window.removeEventListener;\n window.addEventListener = function (eventName, fn) {\n if (typeof fn === \"function\") {\n if (\n routingEventsListeningTo.indexOf(eventName) >= 0 &&\n !find(capturedEventListeners[eventName], (listener) => listener === fn)\n ) {\n capturedEventListeners[eventName].push(fn);\n return;\n }\n }\n\n return originalAddEventListener.apply(this, arguments);\n };\n\n window.removeEventListener = function (eventName, listenerFn) {\n if (typeof listenerFn === \"function\") {\n if (routingEventsListeningTo.indexOf(eventName) >= 0) {\n capturedEventListeners[eventName] = capturedEventListeners[\n eventName\n ].filter((fn) => fn !== listenerFn);\n return;\n }\n }\n\n return originalRemoveEventListener.apply(this, arguments);\n };\n\n window.history.pushState = patchedUpdateState(\n window.history.pushState,\n \"pushState\"\n );\n window.history.replaceState = patchedUpdateState(\n window.history.replaceState,\n \"replaceState\"\n );\n\n if (window.singleSpaNavigate) {\n console.warn(\n formatErrorMessage(\n 41,\n __DEV__ &&\n \"single-spa has been loaded twice on the page. This can result in unexpected behavior.\"\n )\n );\n } else {\n /* For convenience in `onclick` attributes, we expose a global function for navigating to\n * whatever an tag's href is.\n */\n window.singleSpaNavigate = navigateToUrl;\n }\n}\n\nfunction parseUri(str) {\n const anchor = document.createElement(\"a\");\n anchor.href = str;\n return anchor;\n}\n","import { routingEventsListeningTo } from \"./navigation/navigation-events.js\";\n\nlet hasInitialized = false;\n\nexport function ensureJQuerySupport(jQuery = window.jQuery) {\n if (!jQuery) {\n if (window.$ && window.$.fn && window.$.fn.jquery) {\n jQuery = window.$;\n }\n }\n\n if (jQuery && !hasInitialized) {\n const originalJQueryOn = jQuery.fn.on;\n const originalJQueryOff = jQuery.fn.off;\n\n jQuery.fn.on = function (eventString, fn) {\n return captureRoutingEvents.call(\n this,\n originalJQueryOn,\n window.addEventListener,\n eventString,\n fn,\n arguments\n );\n };\n\n jQuery.fn.off = function (eventString, fn) {\n return captureRoutingEvents.call(\n this,\n originalJQueryOff,\n window.removeEventListener,\n eventString,\n fn,\n arguments\n );\n };\n\n hasInitialized = true;\n }\n}\n\nfunction captureRoutingEvents(\n originalJQueryFunction,\n nativeFunctionToCall,\n eventString,\n fn,\n originalArgs\n) {\n if (typeof eventString !== \"string\") {\n return originalJQueryFunction.apply(this, originalArgs);\n }\n\n const eventNames = eventString.split(/\\s+/);\n eventNames.forEach((eventName) => {\n if (routingEventsListeningTo.indexOf(eventName) >= 0) {\n nativeFunctionToCall(eventName, fn);\n eventString = eventString.replace(eventName, \"\");\n }\n });\n\n if (eventString.trim() === \"\") {\n return this;\n } else {\n return originalJQueryFunction.apply(this, originalArgs);\n }\n}\n","import {\n NOT_MOUNTED,\n UNLOADING,\n NOT_LOADED,\n SKIP_BECAUSE_BROKEN,\n toName,\n} from \"../applications/app.helpers.js\";\nimport { handleAppError } from \"../applications/app-errors.js\";\nimport { reasonableTime } from \"../applications/timeouts.js\";\n\nconst appsToUnload = {};\n\nexport function toUnloadPromise(app) {\n return Promise.resolve().then(() => {\n const unloadInfo = appsToUnload[toName(app)];\n\n if (!unloadInfo) {\n /* No one has called unloadApplication for this app,\n */\n return app;\n }\n\n if (app.status === NOT_LOADED) {\n /* This app is already unloaded. We just need to clean up\n * anything that still thinks we need to unload the app.\n */\n finishUnloadingApp(app, unloadInfo);\n return app;\n }\n\n if (app.status === UNLOADING) {\n /* Both unloadApplication and reroute want to unload this app.\n * It only needs to be done once, though.\n */\n return unloadInfo.promise.then(() => app);\n }\n\n if (app.status !== NOT_MOUNTED) {\n /* The app cannot be unloaded until it is unmounted.\n */\n return app;\n }\n\n app.status = UNLOADING;\n return reasonableTime(app, \"unload\")\n .then(() => {\n finishUnloadingApp(app, unloadInfo);\n return app;\n })\n .catch((err) => {\n errorUnloadingApp(app, unloadInfo, err);\n return app;\n });\n });\n}\n\nfunction finishUnloadingApp(app, unloadInfo) {\n delete appsToUnload[toName(app)];\n\n // Unloaded apps don't have lifecycles\n delete app.bootstrap;\n delete app.mount;\n delete app.unmount;\n delete app.unload;\n\n app.status = NOT_LOADED;\n\n /* resolve the promise of whoever called unloadApplication.\n * This should be done after all other cleanup/bookkeeping\n */\n unloadInfo.resolve();\n}\n\nfunction errorUnloadingApp(app, unloadInfo, err) {\n delete appsToUnload[toName(app)];\n\n // Unloaded apps don't have lifecycles\n delete app.bootstrap;\n delete app.mount;\n delete app.unmount;\n delete app.unload;\n\n handleAppError(err, app, SKIP_BECAUSE_BROKEN);\n unloadInfo.reject(err);\n}\n\nexport function addAppToUnload(app, promiseGetter, resolve, reject) {\n appsToUnload[toName(app)] = { app, resolve, reject };\n Object.defineProperty(appsToUnload[toName(app)], \"promise\", {\n get: promiseGetter,\n });\n}\n\nexport function getAppUnloadInfo(appName) {\n return appsToUnload[appName];\n}\n","import { ensureJQuerySupport } from \"../jquery-support.js\";\nimport {\n isActive,\n toName,\n NOT_LOADED,\n NOT_BOOTSTRAPPED,\n NOT_MOUNTED,\n MOUNTED,\n LOAD_ERROR,\n SKIP_BECAUSE_BROKEN,\n LOADING_SOURCE_CODE,\n shouldBeActive,\n} from \"./app.helpers.js\";\nimport { reroute } from \"../navigation/reroute.js\";\nimport { find } from \"../utils/find.js\";\nimport { toUnmountPromise } from \"../lifecycles/unmount.js\";\nimport {\n toUnloadPromise,\n getAppUnloadInfo,\n addAppToUnload,\n} from \"../lifecycles/unload.js\";\nimport { formatErrorMessage } from \"./app-errors.js\";\nimport { isInBrowser } from \"../utils/runtime-environment.js\";\nimport { assign } from \"../utils/assign\";\n\nconst apps = [];\n\nexport function getAppChanges() {\n const appsToUnload = [],\n appsToUnmount = [],\n appsToLoad = [],\n appsToMount = [];\n\n // We re-attempt to download applications in LOAD_ERROR after a timeout of 200 milliseconds\n const currentTime = new Date().getTime();\n\n apps.forEach((app) => {\n const appShouldBeActive =\n app.status !== SKIP_BECAUSE_BROKEN && shouldBeActive(app);\n\n switch (app.status) {\n case LOAD_ERROR:\n if (currentTime - app.loadErrorTime >= 200) {\n appsToLoad.push(app);\n }\n break;\n case NOT_LOADED:\n case LOADING_SOURCE_CODE:\n if (appShouldBeActive) {\n appsToLoad.push(app);\n }\n break;\n case NOT_BOOTSTRAPPED:\n case NOT_MOUNTED:\n if (!appShouldBeActive && getAppUnloadInfo(toName(app))) {\n appsToUnload.push(app);\n } else if (appShouldBeActive) {\n appsToMount.push(app);\n }\n break;\n case MOUNTED:\n if (!appShouldBeActive) {\n appsToUnmount.push(app);\n }\n break;\n // all other statuses are ignored\n }\n });\n\n return { appsToUnload, appsToUnmount, appsToLoad, appsToMount };\n}\n\nexport function getMountedApps() {\n return apps.filter(isActive).map(toName);\n}\n\nexport function getAppNames() {\n return apps.map(toName);\n}\n\n// used in devtools, not (currently) exposed as a single-spa API\nexport function getRawAppData() {\n return [...apps];\n}\n\nexport function getAppStatus(appName) {\n const app = find(apps, (app) => toName(app) === appName);\n return app ? app.status : null;\n}\n\nexport function registerApplication(\n appNameOrConfig,\n appOrLoadApp,\n activeWhen,\n customProps\n) {\n const registration = sanitizeArguments(\n appNameOrConfig,\n appOrLoadApp,\n activeWhen,\n customProps\n );\n\n if (getAppNames().indexOf(registration.name) !== -1)\n throw Error(\n formatErrorMessage(\n 21,\n __DEV__ &&\n `There is already an app registered with name ${registration.name}`,\n registration.name\n )\n );\n\n apps.push(\n assign(\n {\n loadErrorTime: null,\n status: NOT_LOADED,\n parcels: {},\n devtools: {\n overlays: {\n options: {},\n selectors: [],\n },\n },\n },\n registration\n )\n );\n\n if (isInBrowser) {\n ensureJQuerySupport();\n reroute();\n }\n}\n\nexport function checkActivityFunctions(location = window.location) {\n return apps.filter((app) => app.activeWhen(location)).map(toName);\n}\n\nexport function unregisterApplication(appName) {\n if (apps.filter((app) => toName(app) === appName).length === 0) {\n throw Error(\n formatErrorMessage(\n 25,\n __DEV__ &&\n `Cannot unregister application '${appName}' because no such application has been registered`,\n appName\n )\n );\n }\n\n return unloadApplication(appName).then(() => {\n const appIndex = apps.map(toName).indexOf(appName);\n apps.splice(appIndex, 1);\n });\n}\n\nexport function unloadApplication(appName, opts = { waitForUnmount: false }) {\n if (typeof appName !== \"string\") {\n throw Error(\n formatErrorMessage(\n 26,\n __DEV__ && `unloadApplication requires a string 'appName'`\n )\n );\n }\n const app = find(apps, (App) => toName(App) === appName);\n if (!app) {\n throw Error(\n formatErrorMessage(\n 27,\n __DEV__ &&\n `Could not unload application '${appName}' because no such application has been registered`,\n appName\n )\n );\n }\n\n const appUnloadInfo = getAppUnloadInfo(toName(app));\n if (opts && opts.waitForUnmount) {\n // We need to wait for unmount before unloading the app\n\n if (appUnloadInfo) {\n // Someone else is already waiting for this, too\n return appUnloadInfo.promise;\n } else {\n // We're the first ones wanting the app to be resolved.\n const promise = new Promise((resolve, reject) => {\n addAppToUnload(app, () => promise, resolve, reject);\n });\n return promise;\n }\n } else {\n /* We should unmount the app, unload it, and remount it immediately.\n */\n\n let resultPromise;\n\n if (appUnloadInfo) {\n // Someone else is already waiting for this app to unload\n resultPromise = appUnloadInfo.promise;\n immediatelyUnloadApp(app, appUnloadInfo.resolve, appUnloadInfo.reject);\n } else {\n // We're the first ones wanting the app to be resolved.\n resultPromise = new Promise((resolve, reject) => {\n addAppToUnload(app, () => resultPromise, resolve, reject);\n immediatelyUnloadApp(app, resolve, reject);\n });\n }\n\n return resultPromise;\n }\n}\n\nfunction immediatelyUnloadApp(app, resolve, reject) {\n toUnmountPromise(app)\n .then(toUnloadPromise)\n .then(() => {\n resolve();\n setTimeout(() => {\n // reroute, but the unload promise is done\n reroute();\n });\n })\n .catch(reject);\n}\n\nfunction validateRegisterWithArguments(\n name,\n appOrLoadApp,\n activeWhen,\n customProps\n) {\n if (typeof name !== \"string\" || name.length === 0)\n throw Error(\n formatErrorMessage(\n 20,\n __DEV__ &&\n `The 1st argument to registerApplication must be a non-empty string 'appName'`\n )\n );\n\n if (!appOrLoadApp)\n throw Error(\n formatErrorMessage(\n 23,\n __DEV__ &&\n \"The 2nd argument to registerApplication must be an application or loading application function\"\n )\n );\n\n if (typeof activeWhen !== \"function\")\n throw Error(\n formatErrorMessage(\n 24,\n __DEV__ &&\n \"The 3rd argument to registerApplication must be an activeWhen function\"\n )\n );\n\n if (!validCustomProps(customProps))\n throw Error(\n formatErrorMessage(\n 22,\n __DEV__ &&\n \"The optional 4th argument is a customProps and must be an object\"\n )\n );\n}\n\nexport function validateRegisterWithConfig(config) {\n if (Array.isArray(config) || config === null)\n throw Error(\n formatErrorMessage(\n 39,\n __DEV__ && \"Configuration object can't be an Array or null!\"\n )\n );\n const validKeys = [\"name\", \"app\", \"activeWhen\", \"customProps\"];\n const invalidKeys = Object.keys(config).reduce(\n (invalidKeys, prop) =>\n validKeys.indexOf(prop) >= 0 ? invalidKeys : invalidKeys.concat(prop),\n []\n );\n if (invalidKeys.length !== 0)\n throw Error(\n formatErrorMessage(\n 38,\n __DEV__ &&\n `The configuration object accepts only: ${validKeys.join(\n \", \"\n )}. Invalid keys: ${invalidKeys.join(\", \")}.`,\n validKeys.join(\", \"),\n invalidKeys.join(\", \")\n )\n );\n if (typeof config.name !== \"string\" || config.name.length === 0)\n throw Error(\n formatErrorMessage(\n 20,\n __DEV__ &&\n \"The config.name on registerApplication must be a non-empty string\"\n )\n );\n if (typeof config.app !== \"object\" && typeof config.app !== \"function\")\n throw Error(\n formatErrorMessage(\n 20,\n __DEV__ &&\n \"The config.app on registerApplication must be an application or a loading function\"\n )\n );\n const allowsStringAndFunction = (activeWhen) =>\n typeof activeWhen === \"string\" || typeof activeWhen === \"function\";\n if (\n !allowsStringAndFunction(config.activeWhen) &&\n !(\n Array.isArray(config.activeWhen) &&\n config.activeWhen.every(allowsStringAndFunction)\n )\n )\n throw Error(\n formatErrorMessage(\n 24,\n __DEV__ &&\n \"The config.activeWhen on registerApplication must be a string, function or an array with both\"\n )\n );\n if (!validCustomProps(config.customProps))\n throw Error(\n formatErrorMessage(\n 22,\n __DEV__ && \"The optional config.customProps must be an object\"\n )\n );\n}\n\nfunction validCustomProps(customProps) {\n return (\n !customProps ||\n typeof customProps === \"function\" ||\n (typeof customProps === \"object\" &&\n customProps !== null &&\n !Array.isArray(customProps))\n );\n}\n\nfunction sanitizeArguments(\n appNameOrConfig,\n appOrLoadApp,\n activeWhen,\n customProps\n) {\n const usingObjectAPI = typeof appNameOrConfig === \"object\";\n\n const registration = {\n name: null,\n loadApp: null,\n activeWhen: null,\n customProps: null,\n };\n\n if (usingObjectAPI) {\n validateRegisterWithConfig(appNameOrConfig);\n registration.name = appNameOrConfig.name;\n registration.loadApp = appNameOrConfig.app;\n registration.activeWhen = appNameOrConfig.activeWhen;\n registration.customProps = appNameOrConfig.customProps;\n } else {\n validateRegisterWithArguments(\n appNameOrConfig,\n appOrLoadApp,\n activeWhen,\n customProps\n );\n registration.name = appNameOrConfig;\n registration.loadApp = appOrLoadApp;\n registration.activeWhen = activeWhen;\n registration.customProps = customProps;\n }\n\n registration.loadApp = sanitizeLoadApp(registration.loadApp);\n registration.customProps = sanitizeCustomProps(registration.customProps);\n registration.activeWhen = sanitizeActiveWhen(registration.activeWhen);\n\n return registration;\n}\n\nfunction sanitizeLoadApp(loadApp) {\n if (typeof loadApp !== \"function\") {\n return () => Promise.resolve(loadApp);\n }\n\n return loadApp;\n}\n\nfunction sanitizeCustomProps(customProps) {\n return customProps ? customProps : {};\n}\n\nfunction sanitizeActiveWhen(activeWhen) {\n let activeWhenArray = Array.isArray(activeWhen) ? activeWhen : [activeWhen];\n activeWhenArray = activeWhenArray.map((activeWhenOrPath) =>\n typeof activeWhenOrPath === \"function\"\n ? activeWhenOrPath\n : pathToActiveWhen(activeWhenOrPath)\n );\n\n return (location) =>\n activeWhenArray.some((activeWhen) => activeWhen(location));\n}\n\nexport function pathToActiveWhen(path) {\n const regex = toDynamicPathValidatorRegex(path);\n\n return (location) => {\n const route = location.href\n .replace(location.origin, \"\")\n .replace(location.search, \"\")\n .split(\"?\")[0];\n return regex.test(route);\n };\n}\n\nexport function toDynamicPathValidatorRegex(path) {\n let lastIndex = 0,\n inDynamic = false,\n regexStr = \"^\";\n\n if (path[0] !== \"/\") {\n path = \"/\" + path;\n }\n\n for (let charIndex = 0; charIndex < path.length; charIndex++) {\n const char = path[charIndex];\n const startOfDynamic = !inDynamic && char === \":\";\n const endOfDynamic = inDynamic && char === \"/\";\n if (startOfDynamic || endOfDynamic) {\n appendToRegex(charIndex);\n }\n }\n\n appendToRegex(path.length);\n return new RegExp(regexStr, \"i\");\n\n function appendToRegex(index) {\n const anyCharMaybeTrailingSlashRegex = \"[^/]+/?\";\n const commonStringSubPath = escapeStrRegex(path.slice(lastIndex, index));\n\n regexStr += inDynamic\n ? anyCharMaybeTrailingSlashRegex\n : commonStringSubPath;\n\n if (index === path.length && !inDynamic) {\n regexStr =\n // use charAt instead as we could not use es6 method endsWith\n regexStr.charAt(regexStr.length - 1) === \"/\"\n ? `${regexStr}.*$`\n : `${regexStr}([/#].*)?$`;\n }\n\n inDynamic = !inDynamic;\n lastIndex = index;\n }\n\n function escapeStrRegex(str) {\n // borrowed from https://github.com/sindresorhus/escape-string-regexp/blob/master/index.js\n return str.replace(/[|\\\\{}()[\\]^$+*?.]/g, \"\\\\$&\");\n }\n}\n","import CustomEvent from \"custom-event\";\nimport { isStarted } from \"../start.js\";\nimport { toLoadPromise } from \"../lifecycles/load.js\";\nimport { toBootstrapPromise } from \"../lifecycles/bootstrap.js\";\nimport { toMountPromise } from \"../lifecycles/mount.js\";\nimport { toUnmountPromise } from \"../lifecycles/unmount.js\";\nimport {\n getAppStatus,\n getAppChanges,\n getMountedApps,\n} from \"../applications/apps.js\";\nimport { callCapturedEventListeners } from \"./navigation-events.js\";\nimport { toUnloadPromise } from \"../lifecycles/unload.js\";\nimport {\n toName,\n shouldBeActive,\n NOT_MOUNTED,\n MOUNTED,\n NOT_LOADED,\n SKIP_BECAUSE_BROKEN,\n} from \"../applications/app.helpers.js\";\n\nlet appChangeUnderway = false,\n peopleWaitingOnAppChange = [];\n\nexport function triggerAppChange() {\n // Call reroute with no arguments, intentionally\n return reroute();\n}\n\nexport function reroute(pendingPromises = [], eventArguments) {\n if (appChangeUnderway) {\n return new Promise((resolve, reject) => {\n peopleWaitingOnAppChange.push({\n resolve,\n reject,\n eventArguments,\n });\n });\n }\n\n const {\n appsToUnload,\n appsToUnmount,\n appsToLoad,\n appsToMount,\n } = getAppChanges();\n let appsThatChanged;\n\n if (isStarted()) {\n appChangeUnderway = true;\n appsThatChanged = appsToUnload.concat(\n appsToLoad,\n appsToUnmount,\n appsToMount\n );\n return performAppChanges();\n } else {\n appsThatChanged = appsToLoad;\n return loadApps();\n }\n\n function loadApps() {\n return Promise.resolve().then(() => {\n const loadPromises = appsToLoad.map(toLoadPromise);\n\n return (\n Promise.all(loadPromises)\n .then(callAllEventListeners)\n // there are no mounted apps, before start() is called, so we always return []\n .then(() => [])\n .catch((err) => {\n callAllEventListeners();\n throw err;\n })\n );\n });\n }\n\n function performAppChanges() {\n return Promise.resolve().then(() => {\n // https://github.com/single-spa/single-spa/issues/545\n window.dispatchEvent(\n new CustomEvent(\n appsThatChanged.length === 0\n ? \"single-spa:before-no-app-change\"\n : \"single-spa:before-app-change\",\n getCustomEventDetail(true)\n )\n );\n\n window.dispatchEvent(\n new CustomEvent(\n \"single-spa:before-routing-event\",\n getCustomEventDetail(true)\n )\n );\n const unloadPromises = appsToUnload.map(toUnloadPromise);\n\n const unmountUnloadPromises = appsToUnmount\n .map(toUnmountPromise)\n .map((unmountPromise) => unmountPromise.then(toUnloadPromise));\n\n const allUnmountPromises = unmountUnloadPromises.concat(unloadPromises);\n\n const unmountAllPromise = Promise.all(allUnmountPromises);\n\n unmountAllPromise.then(() => {\n window.dispatchEvent(\n new CustomEvent(\n \"single-spa:before-mount-routing-event\",\n getCustomEventDetail(true)\n )\n );\n });\n\n /* We load and bootstrap apps while other apps are unmounting, but we\n * wait to mount the app until all apps are finishing unmounting\n */\n const loadThenMountPromises = appsToLoad.map((app) => {\n return toLoadPromise(app).then((app) =>\n tryToBootstrapAndMount(app, unmountAllPromise)\n );\n });\n\n /* These are the apps that are already bootstrapped and just need\n * to be mounted. They each wait for all unmounting apps to finish up\n * before they mount.\n */\n const mountPromises = appsToMount\n .filter((appToMount) => appsToLoad.indexOf(appToMount) < 0)\n .map((appToMount) => {\n return tryToBootstrapAndMount(appToMount, unmountAllPromise);\n });\n return unmountAllPromise\n .catch((err) => {\n callAllEventListeners();\n throw err;\n })\n .then(() => {\n /* Now that the apps that needed to be unmounted are unmounted, their DOM navigation\n * events (like hashchange or popstate) should have been cleaned up. So it's safe\n * to let the remaining captured event listeners to handle about the DOM event.\n */\n callAllEventListeners();\n\n return Promise.all(loadThenMountPromises.concat(mountPromises))\n .catch((err) => {\n pendingPromises.forEach((promise) => promise.reject(err));\n throw err;\n })\n .then(finishUpAndReturn);\n });\n });\n }\n\n function finishUpAndReturn() {\n const returnValue = getMountedApps();\n pendingPromises.forEach((promise) => promise.resolve(returnValue));\n\n try {\n const appChangeEventName =\n appsThatChanged.length === 0\n ? \"single-spa:no-app-change\"\n : \"single-spa:app-change\";\n window.dispatchEvent(\n new CustomEvent(appChangeEventName, getCustomEventDetail())\n );\n window.dispatchEvent(\n new CustomEvent(\"single-spa:routing-event\", getCustomEventDetail())\n );\n } catch (err) {\n /* We use a setTimeout because if someone else's event handler throws an error, single-spa\n * needs to carry on. If a listener to the event throws an error, it's their own fault, not\n * single-spa's.\n */\n setTimeout(() => {\n throw err;\n });\n }\n\n /* Setting this allows for subsequent calls to reroute() to actually perform\n * a reroute instead of just getting queued behind the current reroute call.\n * We want to do this after the mounting/unmounting is done but before we\n * resolve the promise for the `reroute` function.\n */\n appChangeUnderway = false;\n\n if (peopleWaitingOnAppChange.length > 0) {\n /* While we were rerouting, someone else triggered another reroute that got queued.\n * So we need reroute again.\n */\n const nextPendingPromises = peopleWaitingOnAppChange;\n peopleWaitingOnAppChange = [];\n reroute(nextPendingPromises);\n }\n\n return returnValue;\n }\n\n /* We need to call all event listeners that have been delayed because they were\n * waiting on single-spa. This includes haschange and popstate events for both\n * the current run of performAppChanges(), but also all of the queued event listeners.\n * We want to call the listeners in the same order as if they had not been delayed by\n * single-spa, which means queued ones first and then the most recent one.\n */\n function callAllEventListeners() {\n pendingPromises.forEach((pendingPromise) => {\n callCapturedEventListeners(pendingPromise.eventArguments);\n });\n\n callCapturedEventListeners(eventArguments);\n }\n\n function getCustomEventDetail(isBeforeChanges = false) {\n const newAppStatuses = {};\n const appsByNewStatus = {\n // for apps that were mounted\n [MOUNTED]: [],\n // for apps that were unmounted\n [NOT_MOUNTED]: [],\n // apps that were forcibly unloaded\n [NOT_LOADED]: [],\n // apps that attempted to do something but are broken now\n [SKIP_BECAUSE_BROKEN]: [],\n };\n\n if (isBeforeChanges) {\n appsToLoad.concat(appsToMount).forEach((app, index) => {\n addApp(app, MOUNTED);\n });\n appsToUnload.forEach((app) => {\n addApp(app, NOT_LOADED);\n });\n appsToUnmount.forEach((app) => {\n addApp(app, NOT_MOUNTED);\n });\n } else {\n appsThatChanged.forEach((app) => {\n addApp(app);\n });\n }\n\n return {\n detail: {\n newAppStatuses,\n appsByNewStatus,\n totalAppChanges: appsThatChanged.length,\n originalEvent: eventArguments?.[0],\n },\n };\n\n function addApp(app, status) {\n const appName = toName(app);\n status = status || getAppStatus(appName);\n newAppStatuses[appName] = status;\n const statusArr = (appsByNewStatus[status] =\n appsByNewStatus[status] || []);\n statusArr.push(appName);\n }\n }\n}\n\n/**\n * Let's imagine that some kind of delay occurred during application loading.\n * The user without waiting for the application to load switched to another route,\n * this means that we shouldn't bootstrap and mount that application, thus we check\n * twice if that application should be active before bootstrapping and mounting.\n * https://github.com/single-spa/single-spa/issues/524\n */\nfunction tryToBootstrapAndMount(app, unmountAllPromise) {\n if (shouldBeActive(app)) {\n return toBootstrapPromise(app).then((app) =>\n unmountAllPromise.then(() =>\n shouldBeActive(app) ? toMountPromise(app) : app\n )\n );\n } else {\n return unmountAllPromise.then(() => app);\n }\n}\n","import { reroute } from \"./navigation/reroute.js\";\nimport { formatErrorMessage } from \"./applications/app-errors.js\";\nimport { setUrlRerouteOnly } from \"./navigation/navigation-events.js\";\nimport { isInBrowser } from \"./utils/runtime-environment.js\";\n\nlet started = false;\n\nexport function start(opts) {\n started = true;\n if (opts && opts.urlRerouteOnly) {\n setUrlRerouteOnly(opts.urlRerouteOnly);\n }\n if (isInBrowser) {\n reroute();\n }\n}\n\nexport function isStarted() {\n return started;\n}\n\nif (isInBrowser) {\n setTimeout(() => {\n if (!started) {\n console.warn(\n formatErrorMessage(\n 1,\n __DEV__ &&\n `singleSpa.start() has not been called, 5000ms after single-spa was loaded. Before start() is called, apps can be declared and loaded, but not bootstrapped or mounted.`\n )\n );\n }\n }, 5000);\n}\n","import { getRawAppData, unregisterApplication } from \"../applications/apps\";\nimport { reroute } from \"../navigation/reroute\";\nimport { NOT_LOADED } from \"../applications/app.helpers\";\nimport { toLoadPromise } from \"../lifecycles/load\";\nimport { toBootstrapPromise } from \"../lifecycles/bootstrap\";\n\nexport default {\n getRawAppData,\n reroute,\n NOT_LOADED,\n toLoadPromise,\n toBootstrapPromise,\n unregisterApplication,\n};\n","export { start } from \"./start.js\";\nexport { ensureJQuerySupport } from \"./jquery-support.js\";\nexport {\n setBootstrapMaxTime,\n setMountMaxTime,\n setUnmountMaxTime,\n setUnloadMaxTime,\n} from \"./applications/timeouts.js\";\nexport {\n registerApplication,\n getMountedApps,\n getAppStatus,\n unloadApplication,\n checkActivityFunctions,\n getAppNames,\n pathToActiveWhen,\n} from \"./applications/apps.js\";\nexport { navigateToUrl } from \"./navigation/navigation-events.js\";\nexport { triggerAppChange } from \"./navigation/reroute.js\";\nexport {\n addErrorHandler,\n removeErrorHandler,\n} from \"./applications/app-errors.js\";\nexport { mountRootParcel } from \"./parcels/mount-parcel.js\";\n\nexport {\n NOT_LOADED,\n LOADING_SOURCE_CODE,\n NOT_BOOTSTRAPPED,\n BOOTSTRAPPING,\n NOT_MOUNTED,\n MOUNTING,\n UPDATING,\n LOAD_ERROR,\n MOUNTED,\n UNMOUNTING,\n SKIP_BECAUSE_BROKEN,\n} from \"./applications/app.helpers.js\";\n\nimport devtools from \"./devtools/devtools\";\nimport { isInBrowser } from \"./utils/runtime-environment.js\";\n\nif (isInBrowser && window.__SINGLE_SPA_DEVTOOLS__) {\n window.__SINGLE_SPA_DEVTOOLS__.exposedMethods = devtools;\n}\n"],"names":["NativeCustomEvent","CustomEvent","p","detail","foo","type","e","useNative","document","createEvent","params","initCustomEvent","bubbles","cancelable","createEventObject","Boolean","errorHandlers","handleAppError","err","app","newStatus","transformedErr","transformErr","length","forEach","handler","setTimeout","addErrorHandler","Error","formatErrorMessage","push","removeErrorHandler","removedSomething","filter","h","isHandler","code","msg","args","join","ogErr","appOrParcel","result","errPrefix","objectType","toName","status","message","console","warn","JSON","stringify","appOrParcelName","NOT_LOADED","LOADING_SOURCE_CODE","NOT_BOOTSTRAPPED","BOOTSTRAPPING","NOT_MOUNTED","MOUNTING","MOUNTED","UPDATING","UNMOUNTING","LOAD_ERROR","SKIP_BECAUSE_BROKEN","isActive","shouldBeActive","activeWhen","window","location","name","isParcel","unmountThisParcel","assign","i","arguments","key","find","arr","func","validLifecycleFn","fn","Array","isArray","item","flattenFnArray","lifecycle","fns","Promise","resolve","props","reduce","resultPromise","index","then","thisPromise","smellsLikeAPromise","reject","promise","catch","toBootstrapPromise","hardFail","reasonableTime","toUnmountPromise","unmountChildrenParcels","Object","keys","parcels","map","parcelId","all","unmountAppOrParcel","parcelError","parentError","beforeFirstMountFired","firstMountFired","toMountPromise","dispatchEvent","setSkipBecauseBroken","parcelCount","rootParcels","mountRootParcel","mountParcel","apply","config","customProps","owningAppOrParcel","this","_typeof","domElement","externalRepresentation","id","passedConfigLoadingFunction","configLoadingFunction","parcel","parentName","value","resolveUnmount","rejectUnmount","loadPromise","bootstrapPromise","bootstrap","mount","unmount","update","timeouts","ensureValidAppTimeouts","promiseWithoutReturnValue","toUpdatePromise","mountPromise","unmountPromise","getStatus","getProps","bind","singleSpa","unmountSelf","globalTimeoutConfig","millis","dieOnTimeout","warningMillis","unload","setBootstrapMaxTime","time","setMountMaxTime","setUnmountMaxTime","setUnloadMaxTime","timeoutConfig","warningPeriod","finished","errored","val","maybeTimingOut","errMsg","shouldError","error","numWarnings","numMillis","toLoadPromise","loadApp","isUserErr","validationErrCode","loadErrorTime","appOpts","appOptsStr","validationErrMessage","devtools","overlays","Date","getTime","urlRerouteOnly","isInBrowser","capturedEventListeners","hashchange","popstate","routingEventsListeningTo","navigateToUrl","obj","url","href","currentTarget","preventDefault","current","parseUri","destination","indexOf","hash","host","pathname","search","history","pushState","callCapturedEventListeners","eventArguments","eventType","listener","_this","urlReroute","reroute","patchedUpdateState","updateState","methodName","urlBefore","urlAfter","createPopStateEvent","state","originalMethodName","evt","PopStateEvent","initPopStateEvent","singleSpaTrigger","addEventListener","originalAddEventListener","originalRemoveEventListener","removeEventListener","eventName","listenerFn","replaceState","singleSpaNavigate","str","anchor","createElement","hasInitialized","ensureJQuerySupport","jQuery","$","jquery","originalJQueryOn","on","originalJQueryOff","off","eventString","captureRoutingEvents","call","originalJQueryFunction","nativeFunctionToCall","originalArgs","split","replace","trim","appsToUnload","toUnloadPromise","unloadInfo","finishUnloadingApp","errorUnloadingApp","addAppToUnload","promiseGetter","defineProperty","get","getAppUnloadInfo","appName","apps","getAppChanges","appsToUnmount","appsToLoad","appsToMount","currentTime","appShouldBeActive","getMountedApps","getAppNames","getAppStatus","registerApplication","appNameOrConfig","appOrLoadApp","registration","validKeys","invalidKeys","prop","concat","allowsStringAndFunction","every","validCustomProps","validateRegisterWithConfig","validateRegisterWithArguments","sanitizeCustomProps","activeWhenArray","activeWhenOrPath","pathToActiveWhen","some","sanitizeActiveWhen","sanitizeArguments","options","selectors","checkActivityFunctions","unloadApplication","opts","waitForUnmount","App","appUnloadInfo","immediatelyUnloadApp","path","regex","lastIndex","inDynamic","regexStr","charIndex","char","appendToRegex","RegExp","commonStringSubPath","slice","charAt","toDynamicPathValidatorRegex","route","origin","test","appChangeUnderway","peopleWaitingOnAppChange","triggerAppChange","pendingPromises","appsThatChanged","isStarted","performAppChanges","loadApps","loadPromises","callAllEventListeners","getCustomEventDetail","unloadPromises","allUnmountPromises","unmountAllPromise","loadThenMountPromises","tryToBootstrapAndMount","mountPromises","appToMount","finishUpAndReturn","returnValue","appChangeEventName","nextPendingPromises","pendingPromise","isBeforeChanges","newAppStatuses","appsByNewStatus","addApp","totalAppChanges","originalEvent","started","start","getRawAppData","unregisterApplication","appIndex","splice","__SINGLE_SPA_DEVTOOLS__","exposedMethods"],"mappings":";g+CACIA,mJAA2BC,cAE/B,WACE,IACE,IAAIC,EAAI,IAAIF,EAAkB,MAAO,CAAEG,OAAQ,CAAEC,IAAK,SACtD,MAAQ,QAAUF,EAAEG,MAAQ,QAAUH,EAAEC,OAAOC,IAC/C,MAAOE,IAET,OAAO,EAWQC,GAAcP,EAG/B,oBAAuBQ,UAAY,mBAAsBA,SAASC,YAAc,SAAsBJ,EA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