openc3-tool-base 5.8.1 → 5.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"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 if (!appOrParcel.bootstrap) {\n // Default implementation of bootstrap\n return Promise.resolve().then(successfulBootstrap);\n }\n\n return reasonableTime(appOrParcel, \"bootstrap\")\n .then(successfulBootstrap)\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 function successfulBootstrap() {\n appOrParcel.status = NOT_MOUNTED;\n return appOrParcel;\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 return mountPromise\n .then(() => {\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 return toUnmountPromise(parcel, true);\n })\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 (\n // ES Module objects don't have the object prototype\n Object.prototype.hasOwnProperty.call(config, \"bootstrap\") &&\n !validLifecycleFn(config.bootstrap)\n ) {\n throw Error(\n formatErrorMessage(\n 9,\n __DEV__ && `Parcel ${name} provided an invalid 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 (\n // ES Modules don't have the Object prototype\n Object.prototype.hasOwnProperty.call(appOpts, \"bootstrap\") &&\n !validLifecycleFn(appOpts.bootstrap)\n ) {\n validationErrCode = 35;\n if (__DEV__) {\n validationErrMessage = `does not export a valid 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 mount 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 unmount 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\";\nimport { isStarted } from \"../start.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 <a> tag as its context, or with an event whose currentTarget is an <a> 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 if (isStarted()) {\n // fire an artificial popstate event once single-spa is started,\n // so that single-spa applications know about routing that\n // occurs in a different application\n window.dispatchEvent(\n createPopStateEvent(window.history.state, methodName)\n );\n } else {\n // do not fire an artificial popstate event before single-spa is started,\n // since no single-spa applications need to know about routing events\n // outside of their own router.\n reroute([]);\n }\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=<pushState|replaceState> 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 <a> 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 LOAD_ERROR,\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 && app.status !== LOAD_ERROR) {\n /* The app cannot be unloaded until it is unmounted.\n */\n return app;\n }\n\n const unloadPromise =\n app.status === LOAD_ERROR\n ? Promise.resolve()\n : reasonableTime(app, \"unload\");\n\n app.status = UNLOADING;\n\n return unloadPromise\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 (appShouldBeActive && 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, exactMatch) {\n const regex = toDynamicPathValidatorRegex(path, exactMatch);\n\n return (location) => {\n // compatible with IE10\n let origin = location.origin;\n if (!origin) {\n origin = `${location.protocol}//${location.host}`;\n }\n const route = location.href\n .replace(origin, \"\")\n .replace(location.search, \"\")\n .split(\"?\")[0];\n return regex.test(route);\n };\n}\n\nfunction toDynamicPathValidatorRegex(path, exactMatch) {\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) {\n if (inDynamic) {\n if (exactMatch) {\n // Ensure exact match paths that end in a dynamic portion don't match\n // urls with characters after a slash after the dynamic portion.\n regexStr += \"$\";\n }\n } else {\n // For exact matches, expect no more characters. Otherwise, allow\n // any characters.\n const suffix = exactMatch ? \"\" : \".*\";\n\n regexStr =\n // use charAt instead as we could not use es6 method endsWith\n regexStr.charAt(regexStr.length - 1) === \"/\"\n ? `${regexStr}${suffix}$`\n : `${regexStr}(/${suffix})?(#.*)?$`;\n }\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 {\n callCapturedEventListeners,\n navigateToUrl,\n} 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\";\nimport { assign } from \"../utils/assign.js\";\nimport { isInBrowser } from \"../utils/runtime-environment.js\";\n\nlet appChangeUnderway = false,\n peopleWaitingOnAppChange = [],\n currentUrl = isInBrowser && window.location.href;\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 navigationIsCanceled = false,\n oldUrl = currentUrl,\n newUrl = (currentUrl = window.location.href);\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 cancelNavigation() {\n navigationIsCanceled = true;\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, { cancelNavigation })\n )\n );\n\n if (navigationIsCanceled) {\n window.dispatchEvent(\n new CustomEvent(\n \"single-spa:before-mount-routing-event\",\n getCustomEventDetail(true)\n )\n );\n finishUpAndReturn();\n navigateToUrl(oldUrl);\n return;\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, extraProperties) {\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 const result = {\n detail: {\n newAppStatuses,\n appsByNewStatus,\n totalAppChanges: appsThatChanged.length,\n originalEvent: eventArguments?.[0],\n oldUrl,\n newUrl,\n navigationIsCanceled,\n },\n };\n\n if (extraProperties) {\n assign(result.detail, extraProperties);\n }\n\n return result;\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 unregisterApplication,\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","bootstrap","reasonableTime","successfulBootstrap","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","mountPromise","value","resolveUnmount","rejectUnmount","loadPromise","bootstrapPromise","prototype","hasOwnProperty","call","mount","unmount","update","timeouts","ensureValidAppTimeouts","promiseWithoutReturnValue","toUpdatePromise","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","isStarted","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","originalJQueryFunction","nativeFunctionToCall","originalArgs","split","replace","trim","appsToUnload","toUnloadPromise","unloadInfo","finishUnloadingApp","unloadPromise","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","unregisterApplication","unloadApplication","appIndex","splice","opts","waitForUnmount","App","appUnloadInfo","immediatelyUnloadApp","path","exactMatch","regex","lastIndex","inDynamic","regexStr","charIndex","char","appendToRegex","RegExp","commonStringSubPath","slice","suffix","charAt","toDynamicPathValidatorRegex","origin","protocol","route","test","appChangeUnderway","peopleWaitingOnAppChange","currentUrl","triggerAppChange","pendingPromises","appsThatChanged","navigationIsCanceled","oldUrl","newUrl","performAppChanges","loadApps","cancelNavigation","loadPromises","callAllEventListeners","getCustomEventDetail","finishUpAndReturn","unloadPromises","allUnmountPromises","unmountAllPromise","loadThenMountPromises","tryToBootstrapAndMount","mountPromises","appToMount","returnValue","appChangeEventName","nextPendingPromises","pendingPromise","isBeforeChanges","extraProperties","newAppStatuses","appsByNewStatus","addApp","totalAppChanges","originalEvent","started","start","getRawAppData","__SINGLE_SPA_DEVTOOLS__","exposedMethods"],"mappings":";6vDACIA,mJAA2BC,cAE/B,WACE,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ACrB2V,EAAO3V,EAAKsC,OAGd2R,EAAgB5T,SAAQ,SAACL,GACvB2V,EAAO3V,UAILuB,EAAS,CACbvC,OAAQ,CACNyW,eAAAA,EACAC,gBAAAA,EACAE,gBAAiB3B,EAAgB7T,OACjCyV,cAAezJ,MAAAA,SAAAA,EAAiB,GAChC+H,OAAAA,EACAC,OAAAA,EACAF,qBAAAA,WAIAsB,GACFnS,EAAO9B,EAAOvC,OAAQwW,GAGjBjU,WAEEoU,EAAO3V,EAAK2B,OACbmO,EAAUpO,EAAO1B,GACvB2B,EAASA,GAAU6O,GAAaV,GAChC2F,EAAe3F,GAAWnO,GACP+T,EAAgB/T,GACjC+T,EAAgB/T,IAAW,IACnBhB,KAAKmP,KAYrB,SAASkF,GAAuBhV,EAAK8U,UAC/BhS,EAAe9C,GACVgF,EAAmBhF,GAAK0E,MAAK,SAAC1E,UACnC8U,EAAkBpQ,MAAK,kBACrB5B,EAAe9C,GAAOkG,EAAelG,GAAOA,QAIzC8U,EAAkBpQ,MAAK,kBAAM1E,KCpTxC,IAAI8V,IAAU,EAEP,SAASC,GAAM3D,GL8Ef,IAA2B1I,EK7EhCoM,IAAU,EACN1D,GAAQA,EAAKvH,iBL4EenB,EK3EZ0I,EAAKvH,eL4EzBA,EAAiBnB,GK1EboB,GACF2B,KAIG,SAASM,YACP+I,GAGLhL,GACFvK,YAAW,WACJuV,IACHjU,QAAQC,KACNpB,EACE,GACA,MAKL,YC1BU,CACbsV,cH0EK,2BACMjG,KG1EXtD,QAAAA,GACAvK,WAAAA,EACA+H,cAAAA,EACAjF,mBAAAA,EACAgN,sBAAAA,IC+BElH,GAAe9H,OAAOiT,0BACxBjT,OAAOiT,wBAAwBC,eAAiBzL"}
1
+ {"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 if (!appOrParcel.bootstrap) {\n // Default implementation of bootstrap\n return Promise.resolve().then(successfulBootstrap);\n }\n\n return reasonableTime(appOrParcel, \"bootstrap\")\n .then(successfulBootstrap)\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 function successfulBootstrap() {\n appOrParcel.status = NOT_MOUNTED;\n return appOrParcel;\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 return mountPromise\n .then(() => {\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 return toUnmountPromise(parcel, true);\n })\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 (\n // ES Module objects don't have the object prototype\n Object.prototype.hasOwnProperty.call(config, \"bootstrap\") &&\n !validLifecycleFn(config.bootstrap)\n ) {\n throw Error(\n formatErrorMessage(\n 9,\n __DEV__ && `Parcel ${name} provided an invalid 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 (\n // ES Modules don't have the Object prototype\n Object.prototype.hasOwnProperty.call(appOpts, \"bootstrap\") &&\n !validLifecycleFn(appOpts.bootstrap)\n ) {\n validationErrCode = 35;\n if (__DEV__) {\n validationErrMessage = `does not export a valid 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 mount 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 unmount 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\";\nimport { isStarted } from \"../start.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 <a> tag as its context, or with an event whose currentTarget is an <a> 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 if (isStarted()) {\n // fire an artificial popstate event once single-spa is started,\n // so that single-spa applications know about routing that\n // occurs in a different application\n window.dispatchEvent(\n createPopStateEvent(window.history.state, methodName)\n );\n } else {\n // do not fire an artificial popstate event before single-spa is started,\n // since no single-spa applications need to know about routing events\n // outside of their own router.\n reroute([]);\n }\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=<pushState|replaceState> 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 <a> 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 LOAD_ERROR,\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 && app.status !== LOAD_ERROR) {\n /* The app cannot be unloaded until it is unmounted.\n */\n return app;\n }\n\n const unloadPromise =\n app.status === LOAD_ERROR\n ? Promise.resolve()\n : reasonableTime(app, \"unload\");\n\n app.status = UNLOADING;\n\n return unloadPromise\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 (appShouldBeActive && 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, exactMatch) {\n const regex = toDynamicPathValidatorRegex(path, exactMatch);\n\n return (location) => {\n // compatible with IE10\n let origin = location.origin;\n if (!origin) {\n origin = `${location.protocol}//${location.host}`;\n }\n const route = location.href\n .replace(origin, \"\")\n .replace(location.search, \"\")\n .split(\"?\")[0];\n return regex.test(route);\n };\n}\n\nfunction toDynamicPathValidatorRegex(path, exactMatch) {\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) {\n if (inDynamic) {\n if (exactMatch) {\n // Ensure exact match paths that end in a dynamic portion don't match\n // urls with characters after a slash after the dynamic portion.\n regexStr += \"$\";\n }\n } else {\n // For exact matches, expect no more characters. Otherwise, allow\n // any characters.\n const suffix = exactMatch ? \"\" : \".*\";\n\n regexStr =\n // use charAt instead as we could not use es6 method endsWith\n regexStr.charAt(regexStr.length - 1) === \"/\"\n ? `${regexStr}${suffix}$`\n : `${regexStr}(/${suffix})?(#.*)?$`;\n }\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 {\n callCapturedEventListeners,\n navigateToUrl,\n} 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\";\nimport { assign } from \"../utils/assign.js\";\nimport { isInBrowser } from \"../utils/runtime-environment.js\";\n\nlet appChangeUnderway = false,\n peopleWaitingOnAppChange = [],\n currentUrl = isInBrowser && window.location.href;\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 navigationIsCanceled = false,\n oldUrl = currentUrl,\n newUrl = (currentUrl = window.location.href);\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 cancelNavigation() {\n navigationIsCanceled = true;\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, { cancelNavigation })\n )\n );\n\n if (navigationIsCanceled) {\n window.dispatchEvent(\n new CustomEvent(\n \"single-spa:before-mount-routing-event\",\n getCustomEventDetail(true)\n )\n );\n finishUpAndReturn();\n navigateToUrl(oldUrl);\n return;\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, extraProperties) {\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 const result = {\n detail: {\n newAppStatuses,\n appsByNewStatus,\n totalAppChanges: appsThatChanged.length,\n originalEvent: eventArguments?.[0],\n oldUrl,\n newUrl,\n navigationIsCanceled,\n },\n };\n\n if (extraProperties) {\n assign(result.detail, extraProperties);\n }\n\n return result;\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 unregisterApplication,\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 UNLOADING,\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","UNLOADING","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","bootstrap","reasonableTime","successfulBootstrap","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","mountPromise","value","resolveUnmount","rejectUnmount","loadPromise","bootstrapPromise","prototype","hasOwnProperty","call","mount","unmount","update","timeouts","ensureValidAppTimeouts","promiseWithoutReturnValue","toUpdatePromise","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","isStarted","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","originalJQueryFunction","nativeFunctionToCall","originalArgs","split","replace","trim","appsToUnload","toUnloadPromise","unloadInfo","finishUnloadingApp","unloadPromise","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","unregisterApplication","unloadApplication","appIndex","splice","opts","waitForUnmount","App","appUnloadInfo","immediatelyUnloadApp","path","exactMatch","regex","lastIndex","inDynamic","regexStr","charIndex","char","appendToRegex","RegExp","commonStringSubPath","slice","suffix","charAt","toDynamicPathValidatorRegex","origin","protocol","route","test","appChangeUnderway","peopleWaitingOnAppChange","currentUrl","triggerAppChange","pendingPromises","appsThatChanged","navigationIsCanceled","oldUrl","newUrl","performAppChanges","loadApps","cancelNavigation","loadPromises","callAllEventListeners","getCustomEventDetail","finishUpAndReturn","unloadPromises","allUnmountPromises","unmountAllPromise","loadThenMountPromises","tryToBootstrapAndMount","mountPromises","appToMount","returnValue","appChangeEventName","nextPendingPromises","pendingPromise","isBeforeChanges","extraProperties","newAppStatuses","appsByNewStatus","addApp","totalAppChanges","originalEvent","started","start","getRawAppData","__SINGLE_SPA_DEVTOOLS__","exposedMethods"],"mappings":";uxDACIA,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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