Files
WrenchBoardIonic2023/.angular/cache/14.2.0/babel-webpack/d08697bbef3cefce1eb13265cee45db9.json
T
CHIEFSOFT\ameye cea49e295a first commit
2023-05-12 22:30:08 -04:00

1 line
87 KiB
JSON

{"ast":null,"code":"import _asyncToGenerator from \"D:/MobileDev/WRB/WrenchBoard2023a/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\n\n/*!\n * (C) Ionic http://ionicframework.com - MIT License\n */\nimport { r as registerInstance, e as createEvent, i as getElement, h, H as Host } from './index-1a99aeb7.js';\nimport { c as componentOnReady, q as debounce } from './helpers-4d272360.js';\nimport { b as getIonMode } from './ionic-global-04e268e7.js';\nimport { o as openURL, c as createColorClasses } from './theme-7670341c.js';\nconst Route = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n this.ionRouteDataChanged = createEvent(this, \"ionRouteDataChanged\", 7);\n /**\n * Relative path that needs to match in order for this route to apply.\n *\n * Accepts paths similar to expressjs so that you can define parameters\n * in the url /foo/:bar where bar would be available in incoming props.\n */\n\n this.url = '';\n }\n\n onUpdate(newValue) {\n this.ionRouteDataChanged.emit(newValue);\n }\n\n onComponentProps(newValue, oldValue) {\n if (newValue === oldValue) {\n return;\n }\n\n const keys1 = newValue ? Object.keys(newValue) : [];\n const keys2 = oldValue ? Object.keys(oldValue) : [];\n\n if (keys1.length !== keys2.length) {\n this.onUpdate(newValue);\n return;\n }\n\n for (const key of keys1) {\n if (newValue[key] !== oldValue[key]) {\n this.onUpdate(newValue);\n return;\n }\n }\n }\n\n connectedCallback() {\n this.ionRouteDataChanged.emit();\n }\n\n static get watchers() {\n return {\n \"url\": [\"onUpdate\"],\n \"component\": [\"onUpdate\"],\n \"componentProps\": [\"onComponentProps\"]\n };\n }\n\n};\nconst RouteRedirect = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n this.ionRouteRedirectChanged = createEvent(this, \"ionRouteRedirectChanged\", 7);\n }\n\n propDidChange() {\n this.ionRouteRedirectChanged.emit();\n }\n\n connectedCallback() {\n this.ionRouteRedirectChanged.emit();\n }\n\n static get watchers() {\n return {\n \"from\": [\"propDidChange\"],\n \"to\": [\"propDidChange\"]\n };\n }\n\n};\nconst ROUTER_INTENT_NONE = 'root';\nconst ROUTER_INTENT_FORWARD = 'forward';\nconst ROUTER_INTENT_BACK = 'back';\n/** Join the non empty segments with \"/\". */\n\nconst generatePath = segments => {\n const path = segments.filter(s => s.length > 0).join('/');\n return '/' + path;\n};\n\nconst generateUrl = (segments, useHash, queryString) => {\n let url = generatePath(segments);\n\n if (useHash) {\n url = '#' + url;\n }\n\n if (queryString !== undefined) {\n url += '?' + queryString;\n }\n\n return url;\n};\n\nconst writeSegments = (history, root, useHash, segments, direction, state, queryString) => {\n const url = generateUrl([...parsePath(root).segments, ...segments], useHash, queryString);\n\n if (direction === ROUTER_INTENT_FORWARD) {\n history.pushState(state, '', url);\n } else {\n history.replaceState(state, '', url);\n }\n};\n/**\n * Transforms a chain to a list of segments.\n *\n * Notes:\n * - parameter segments of the form :param are replaced with their value,\n * - null is returned when a value is missing for any parameter segment.\n */\n\n\nconst chainToSegments = chain => {\n const segments = [];\n\n for (const route of chain) {\n for (const segment of route.segments) {\n if (segment[0] === ':') {\n const param = route.params && route.params[segment.slice(1)];\n\n if (!param) {\n return null;\n }\n\n segments.push(param);\n } else if (segment !== '') {\n segments.push(segment);\n }\n }\n }\n\n return segments;\n};\n/**\n * Removes the prefix segments from the path segments.\n *\n * Return:\n * - null when the path segments do not start with the passed prefix,\n * - the path segments after the prefix otherwise.\n */\n\n\nconst removePrefix = (prefix, segments) => {\n if (prefix.length > segments.length) {\n return null;\n }\n\n if (prefix.length <= 1 && prefix[0] === '') {\n return segments;\n }\n\n for (let i = 0; i < prefix.length; i++) {\n if (prefix[i] !== segments[i]) {\n return null;\n }\n }\n\n if (segments.length === prefix.length) {\n return [''];\n }\n\n return segments.slice(prefix.length);\n};\n\nconst readSegments = (loc, root, useHash) => {\n const prefix = parsePath(root).segments;\n const pathname = useHash ? loc.hash.slice(1) : loc.pathname;\n const segments = parsePath(pathname).segments;\n return removePrefix(prefix, segments);\n};\n/**\n * Parses the path to:\n * - segments an array of '/' separated parts,\n * - queryString (undefined when no query string).\n */\n\n\nconst parsePath = path => {\n let segments = [''];\n let queryString;\n\n if (path != null) {\n const qsStart = path.indexOf('?');\n\n if (qsStart > -1) {\n queryString = path.substring(qsStart + 1);\n path = path.substring(0, qsStart);\n }\n\n segments = path.split('/').map(s => s.trim()).filter(s => s.length > 0);\n\n if (segments.length === 0) {\n segments = [''];\n }\n }\n\n return {\n segments,\n queryString\n };\n};\n\nconst printRoutes = routes => {\n console.group(`[ion-core] ROUTES[${routes.length}]`);\n\n for (const chain of routes) {\n const segments = [];\n chain.forEach(r => segments.push(...r.segments));\n const ids = chain.map(r => r.id);\n console.debug(`%c ${generatePath(segments)}`, 'font-weight: bold; padding-left: 20px', '=>\\t', `(${ids.join(', ')})`);\n }\n\n console.groupEnd();\n};\n\nconst printRedirects = redirects => {\n console.group(`[ion-core] REDIRECTS[${redirects.length}]`);\n\n for (const redirect of redirects) {\n if (redirect.to) {\n console.debug('FROM: ', `$c ${generatePath(redirect.from)}`, 'font-weight: bold', ' TO: ', `$c ${generatePath(redirect.to.segments)}`, 'font-weight: bold');\n }\n }\n\n console.groupEnd();\n};\n/**\n * Activates the passed route chain.\n *\n * There must be exactly one outlet per route entry in the chain.\n *\n * The methods calls setRouteId on each of the outlet with the corresponding route entry in the chain.\n * setRouteId will create or select the view in the outlet.\n */\n\n\nconst writeNavState = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(function* (root, chain, direction, index, changed = false, animation) {\n try {\n // find next navigation outlet in the DOM\n const outlet = searchNavNode(root); // make sure we can continue interacting the DOM, otherwise abort\n\n if (index >= chain.length || !outlet) {\n return changed;\n }\n\n yield new Promise(resolve => componentOnReady(outlet, resolve));\n const route = chain[index];\n const result = yield outlet.setRouteId(route.id, route.params, direction, animation); // if the outlet changed the page, reset navigation to neutral (no direction)\n // this means nested outlets will not animate\n\n if (result.changed) {\n direction = ROUTER_INTENT_NONE;\n changed = true;\n } // recursively set nested outlets\n\n\n changed = yield writeNavState(result.element, chain, direction, index + 1, changed, animation); // once all nested outlets are visible let's make the parent visible too,\n // using markVisible prevents flickering\n\n if (result.markVisible) {\n yield result.markVisible();\n }\n\n return changed;\n } catch (e) {\n console.error(e);\n return false;\n }\n });\n\n return function writeNavState(_x, _x2, _x3, _x4) {\n return _ref.apply(this, arguments);\n };\n}();\n/**\n * Recursively walks the outlet in the DOM.\n *\n * The function returns a list of RouteID corresponding to each of the outlet and the last outlet without a RouteID.\n */\n\n\nconst readNavState = /*#__PURE__*/function () {\n var _ref2 = _asyncToGenerator(function* (root) {\n const ids = [];\n let outlet;\n let node = root; // eslint-disable-next-line no-cond-assign\n\n while (outlet = searchNavNode(node)) {\n const id = yield outlet.getRouteId();\n\n if (id) {\n node = id.element;\n id.element = undefined;\n ids.push(id);\n } else {\n break;\n }\n }\n\n return {\n ids,\n outlet\n };\n });\n\n return function readNavState(_x5) {\n return _ref2.apply(this, arguments);\n };\n}();\n\nconst waitUntilNavNode = () => {\n if (searchNavNode(document.body)) {\n return Promise.resolve();\n }\n\n return new Promise(resolve => {\n window.addEventListener('ionNavWillLoad', () => resolve(), {\n once: true\n });\n });\n};\n/** Selector for all the outlets supported by the router. */\n\n\nconst OUTLET_SELECTOR = ':not([no-router]) ion-nav, :not([no-router]) ion-tabs, :not([no-router]) ion-router-outlet';\n\nconst searchNavNode = root => {\n if (!root) {\n return undefined;\n }\n\n if (root.matches(OUTLET_SELECTOR)) {\n return root;\n }\n\n const outlet = root.querySelector(OUTLET_SELECTOR);\n return outlet !== null && outlet !== void 0 ? outlet : undefined;\n};\n/**\n * Returns whether the given redirect matches the given path segments.\n *\n * A redirect matches when the segments of the path and redirect.from are equal.\n * Note that segments are only checked until redirect.from contains a '*' which matches any path segment.\n * The path ['some', 'path', 'to', 'page'] matches both ['some', 'path', 'to', 'page'] and ['some', 'path', '*'].\n */\n\n\nconst matchesRedirect = (segments, redirect) => {\n const {\n from,\n to\n } = redirect;\n\n if (to === undefined) {\n return false;\n }\n\n if (from.length > segments.length) {\n return false;\n }\n\n for (let i = 0; i < from.length; i++) {\n const expected = from[i];\n\n if (expected === '*') {\n return true;\n }\n\n if (expected !== segments[i]) {\n return false;\n }\n }\n\n return from.length === segments.length;\n};\n/** Returns the first redirect matching the path segments or undefined when no match found. */\n\n\nconst findRouteRedirect = (segments, redirects) => {\n return redirects.find(redirect => matchesRedirect(segments, redirect));\n};\n\nconst matchesIDs = (ids, chain) => {\n const len = Math.min(ids.length, chain.length);\n let score = 0;\n\n for (let i = 0; i < len; i++) {\n const routeId = ids[i];\n const routeChain = chain[i]; // Skip results where the route id does not match the chain at the same index\n\n if (routeId.id.toLowerCase() !== routeChain.id) {\n break;\n }\n\n if (routeId.params) {\n const routeIdParams = Object.keys(routeId.params); // Only compare routes with the chain that have the same number of parameters.\n\n if (routeIdParams.length === routeChain.segments.length) {\n // Maps the route's params into a path based on the path variable names,\n // to compare against the route chain format.\n //\n // Before:\n // ```ts\n // {\n // params: {\n // s1: 'a',\n // s2: 'b'\n // }\n // }\n // ```\n //\n // After:\n // ```ts\n // [':s1',':s2']\n // ```\n //\n const pathWithParams = routeIdParams.map(key => `:${key}`);\n\n for (let j = 0; j < pathWithParams.length; j++) {\n // Skip results where the path variable is not a match\n if (pathWithParams[j].toLowerCase() !== routeChain.segments[j]) {\n break;\n } // Weight path matches for the same index higher.\n\n\n score++;\n }\n }\n } // Weight id matches\n\n\n score++;\n }\n\n return score;\n};\n/**\n * Matches the segments against the chain.\n *\n * Returns:\n * - null when there is no match,\n * - a chain with the params properties updated with the parameter segments on match.\n */\n\n\nconst matchesSegments = (segments, chain) => {\n const inputSegments = new RouterSegments(segments);\n let matchesDefault = false;\n let allparams;\n\n for (let i = 0; i < chain.length; i++) {\n const chainSegments = chain[i].segments;\n\n if (chainSegments[0] === '') {\n matchesDefault = true;\n } else {\n for (const segment of chainSegments) {\n const data = inputSegments.next(); // data param\n\n if (segment[0] === ':') {\n if (data === '') {\n return null;\n }\n\n allparams = allparams || [];\n const params = allparams[i] || (allparams[i] = {});\n params[segment.slice(1)] = data;\n } else if (data !== segment) {\n return null;\n }\n }\n\n matchesDefault = false;\n }\n }\n\n const matches = matchesDefault ? matchesDefault === (inputSegments.next() === '') : true;\n\n if (!matches) {\n return null;\n }\n\n if (allparams) {\n return chain.map((route, i) => ({\n id: route.id,\n segments: route.segments,\n params: mergeParams(route.params, allparams[i]),\n beforeEnter: route.beforeEnter,\n beforeLeave: route.beforeLeave\n }));\n }\n\n return chain;\n};\n/**\n * Merges the route parameter objects.\n * Returns undefined when both parameters are undefined.\n */\n\n\nconst mergeParams = (a, b) => {\n return a || b ? Object.assign(Object.assign({}, a), b) : undefined;\n};\n/**\n * Finds the best match for the ids in the chains.\n *\n * Returns the best match or null when no match is found.\n * When a chain is returned the parameters are updated from the RouteIDs.\n * That is they contain both the componentProps of the <ion-route> and the parameter segment.\n */\n\n\nconst findChainForIDs = (ids, chains) => {\n let match = null;\n let maxMatches = 0;\n\n for (const chain of chains) {\n const score = matchesIDs(ids, chain);\n\n if (score > maxMatches) {\n match = chain;\n maxMatches = score;\n }\n }\n\n if (match) {\n return match.map((route, i) => {\n var _a;\n\n return {\n id: route.id,\n segments: route.segments,\n params: mergeParams(route.params, (_a = ids[i]) === null || _a === void 0 ? void 0 : _a.params)\n };\n });\n }\n\n return null;\n};\n/**\n * Finds the best match for the segments in the chains.\n *\n * Returns the best match or null when no match is found.\n * When a chain is returned the parameters are updated from the segments.\n * That is they contain both the componentProps of the <ion-route> and the parameter segments.\n */\n\n\nconst findChainForSegments = (segments, chains) => {\n let match = null;\n let bestScore = 0;\n\n for (const chain of chains) {\n const matchedChain = matchesSegments(segments, chain);\n\n if (matchedChain !== null) {\n const score = computePriority(matchedChain);\n\n if (score > bestScore) {\n bestScore = score;\n match = matchedChain;\n }\n }\n }\n\n return match;\n};\n/**\n * Computes the priority of a chain.\n *\n * Parameter segments are given a lower priority over fixed segments.\n *\n * Considering the following 2 chains matching the path /path/to/page:\n * - /path/to/:where\n * - /path/to/page\n *\n * The second one will be given a higher priority because \"page\" is a fixed segment (vs \":where\", a parameter segment).\n */\n\n\nconst computePriority = chain => {\n let score = 1;\n let level = 1;\n\n for (const route of chain) {\n for (const segment of route.segments) {\n if (segment[0] === ':') {\n score += Math.pow(1, level);\n } else if (segment !== '') {\n score += Math.pow(2, level);\n }\n\n level++;\n }\n }\n\n return score;\n};\n\nclass RouterSegments {\n constructor(segments) {\n this.segments = segments.slice();\n }\n\n next() {\n if (this.segments.length > 0) {\n return this.segments.shift();\n }\n\n return '';\n }\n\n}\n\nconst readProp = (el, prop) => {\n if (prop in el) {\n return el[prop];\n }\n\n if (el.hasAttribute(prop)) {\n return el.getAttribute(prop);\n }\n\n return null;\n};\n/**\n * Extracts the redirects (that is <ion-route-redirect> elements inside the root).\n *\n * The redirects are returned as a list of RouteRedirect.\n */\n\n\nconst readRedirects = root => {\n return Array.from(root.children).filter(el => el.tagName === 'ION-ROUTE-REDIRECT').map(el => {\n const to = readProp(el, 'to');\n return {\n from: parsePath(readProp(el, 'from')).segments,\n to: to == null ? undefined : parsePath(to)\n };\n });\n};\n/**\n * Extracts all the routes (that is <ion-route> elements inside the root).\n *\n * The routes are returned as a list of chains - the flattened tree.\n */\n\n\nconst readRoutes = root => {\n return flattenRouterTree(readRouteNodes(root));\n};\n/**\n * Reads the route nodes as a tree modeled after the DOM tree of <ion-route> elements.\n *\n * Note: routes without a component are ignored together with their children.\n */\n\n\nconst readRouteNodes = node => {\n return Array.from(node.children).filter(el => el.tagName === 'ION-ROUTE' && el.component).map(el => {\n const component = readProp(el, 'component');\n return {\n segments: parsePath(readProp(el, 'url')).segments,\n id: component.toLowerCase(),\n params: el.componentProps,\n beforeLeave: el.beforeLeave,\n beforeEnter: el.beforeEnter,\n children: readRouteNodes(el)\n };\n });\n};\n/**\n * Flattens a RouterTree in a list of chains.\n *\n * Each chain represents a path from the root node to a terminal node.\n */\n\n\nconst flattenRouterTree = nodes => {\n const chains = [];\n\n for (const node of nodes) {\n flattenNode([], chains, node);\n }\n\n return chains;\n};\n/** Flattens a route node recursively and push each branch to the chains list. */\n\n\nconst flattenNode = (chain, chains, node) => {\n chain = [...chain, {\n id: node.id,\n segments: node.segments,\n params: node.params,\n beforeLeave: node.beforeLeave,\n beforeEnter: node.beforeEnter\n }];\n\n if (node.children.length === 0) {\n chains.push(chain);\n return;\n }\n\n for (const child of node.children) {\n flattenNode(chain, chains, child);\n }\n};\n\nconst Router = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n this.ionRouteWillChange = createEvent(this, \"ionRouteWillChange\", 7);\n this.ionRouteDidChange = createEvent(this, \"ionRouteDidChange\", 7);\n this.previousPath = null;\n this.busy = false;\n this.state = 0;\n this.lastState = 0;\n /**\n * The root path to use when matching URLs. By default, this is set to \"/\", but you can specify\n * an alternate prefix for all URL paths.\n */\n\n this.root = '/';\n /**\n * The router can work in two \"modes\":\n * - With hash: `/index.html#/path/to/page`\n * - Without hash: `/path/to/page`\n *\n * Using one or another might depend in the requirements of your app and/or where it's deployed.\n *\n * Usually \"hash-less\" navigation works better for SEO and it's more user friendly too, but it might\n * requires additional server-side configuration in order to properly work.\n *\n * On the other side hash-navigation is much easier to deploy, it even works over the file protocol.\n *\n * By default, this property is `true`, change to `false` to allow hash-less URLs.\n */\n\n this.useHash = true;\n }\n\n componentWillLoad() {\n var _this = this;\n\n return _asyncToGenerator(function* () {\n yield waitUntilNavNode();\n const canProceed = yield _this.runGuards(_this.getSegments());\n\n if (canProceed !== true) {\n if (typeof canProceed === 'object') {\n const {\n redirect\n } = canProceed;\n const path = parsePath(redirect);\n\n _this.setSegments(path.segments, ROUTER_INTENT_NONE, path.queryString);\n\n yield _this.writeNavStateRoot(path.segments, ROUTER_INTENT_NONE);\n }\n } else {\n yield _this.onRoutesChanged();\n }\n })();\n }\n\n componentDidLoad() {\n window.addEventListener('ionRouteRedirectChanged', debounce(this.onRedirectChanged.bind(this), 10));\n window.addEventListener('ionRouteDataChanged', debounce(this.onRoutesChanged.bind(this), 100));\n }\n\n onPopState() {\n var _this2 = this;\n\n return _asyncToGenerator(function* () {\n const direction = _this2.historyDirection();\n\n let segments = _this2.getSegments();\n\n const canProceed = yield _this2.runGuards(segments);\n\n if (canProceed !== true) {\n if (typeof canProceed === 'object') {\n segments = parsePath(canProceed.redirect).segments;\n } else {\n return false;\n }\n }\n\n return _this2.writeNavStateRoot(segments, direction);\n })();\n }\n\n onBackButton(ev) {\n ev.detail.register(0, processNextHandler => {\n this.back();\n processNextHandler();\n });\n }\n /** @internal */\n\n\n canTransition() {\n var _this3 = this;\n\n return _asyncToGenerator(function* () {\n const canProceed = yield _this3.runGuards();\n\n if (canProceed !== true) {\n if (typeof canProceed === 'object') {\n return canProceed.redirect;\n } else {\n return false;\n }\n }\n\n return true;\n })();\n }\n /**\n * Navigate to the specified path.\n *\n * @param path The path to navigate to.\n * @param direction The direction of the animation. Defaults to `\"forward\"`.\n */\n\n\n push(path, direction = 'forward', animation) {\n var _this4 = this;\n\n return _asyncToGenerator(function* () {\n var _a;\n\n if (path.startsWith('.')) {\n const currentPath = (_a = _this4.previousPath) !== null && _a !== void 0 ? _a : '/'; // Convert currentPath to an URL by pre-pending a protocol and a host to resolve the relative path.\n\n const url = new URL(path, `https://host/${currentPath}`);\n path = url.pathname + url.search;\n }\n\n let parsedPath = parsePath(path);\n const canProceed = yield _this4.runGuards(parsedPath.segments);\n\n if (canProceed !== true) {\n if (typeof canProceed === 'object') {\n parsedPath = parsePath(canProceed.redirect);\n } else {\n return false;\n }\n }\n\n _this4.setSegments(parsedPath.segments, direction, parsedPath.queryString);\n\n return _this4.writeNavStateRoot(parsedPath.segments, direction, animation);\n })();\n }\n /** Go back to previous page in the window.history. */\n\n\n back() {\n window.history.back();\n return Promise.resolve(this.waitPromise);\n }\n /** @internal */\n\n\n printDebug() {\n var _this5 = this;\n\n return _asyncToGenerator(function* () {\n printRoutes(readRoutes(_this5.el));\n printRedirects(readRedirects(_this5.el));\n })();\n }\n /** @internal */\n\n\n navChanged(direction) {\n var _this6 = this;\n\n return _asyncToGenerator(function* () {\n if (_this6.busy) {\n console.warn('[ion-router] router is busy, navChanged was cancelled');\n return false;\n }\n\n const {\n ids,\n outlet\n } = yield readNavState(window.document.body);\n const routes = readRoutes(_this6.el);\n const chain = findChainForIDs(ids, routes);\n\n if (!chain) {\n console.warn('[ion-router] no matching URL for ', ids.map(i => i.id));\n return false;\n }\n\n const segments = chainToSegments(chain);\n\n if (!segments) {\n console.warn('[ion-router] router could not match path because some required param is missing');\n return false;\n }\n\n _this6.setSegments(segments, direction);\n\n yield _this6.safeWriteNavState(outlet, chain, ROUTER_INTENT_NONE, segments, null, ids.length);\n return true;\n })();\n }\n /** This handler gets called when a `ion-route-redirect` component is added to the DOM or if the from or to property of such node changes. */\n\n\n onRedirectChanged() {\n const segments = this.getSegments();\n\n if (segments && findRouteRedirect(segments, readRedirects(this.el))) {\n this.writeNavStateRoot(segments, ROUTER_INTENT_NONE);\n }\n }\n /** This handler gets called when a `ion-route` component is added to the DOM or if the from or to property of such node changes. */\n\n\n onRoutesChanged() {\n return this.writeNavStateRoot(this.getSegments(), ROUTER_INTENT_NONE);\n }\n\n historyDirection() {\n var _a;\n\n const win = window;\n\n if (win.history.state === null) {\n this.state++;\n win.history.replaceState(this.state, win.document.title, (_a = win.document.location) === null || _a === void 0 ? void 0 : _a.href);\n }\n\n const state = win.history.state;\n const lastState = this.lastState;\n this.lastState = state;\n\n if (state > lastState || state >= lastState && lastState > 0) {\n return ROUTER_INTENT_FORWARD;\n }\n\n if (state < lastState) {\n return ROUTER_INTENT_BACK;\n }\n\n return ROUTER_INTENT_NONE;\n }\n\n writeNavStateRoot(segments, direction, animation) {\n var _this7 = this;\n\n return _asyncToGenerator(function* () {\n if (!segments) {\n console.error('[ion-router] URL is not part of the routing set');\n return false;\n } // lookup redirect rule\n\n\n const redirects = readRedirects(_this7.el);\n const redirect = findRouteRedirect(segments, redirects);\n let redirectFrom = null;\n\n if (redirect) {\n const {\n segments: toSegments,\n queryString\n } = redirect.to;\n\n _this7.setSegments(toSegments, direction, queryString);\n\n redirectFrom = redirect.from;\n segments = toSegments;\n } // lookup route chain\n\n\n const routes = readRoutes(_this7.el);\n const chain = findChainForSegments(segments, routes);\n\n if (!chain) {\n console.error('[ion-router] the path does not match any route');\n return false;\n } // write DOM give\n\n\n return _this7.safeWriteNavState(document.body, chain, direction, segments, redirectFrom, 0, animation);\n })();\n }\n\n safeWriteNavState(node, chain, direction, segments, redirectFrom, index = 0, animation) {\n var _this8 = this;\n\n return _asyncToGenerator(function* () {\n const unlock = yield _this8.lock();\n let changed = false;\n\n try {\n changed = yield _this8.writeNavState(node, chain, direction, segments, redirectFrom, index, animation);\n } catch (e) {\n console.error(e);\n }\n\n unlock();\n return changed;\n })();\n }\n\n lock() {\n var _this9 = this;\n\n return _asyncToGenerator(function* () {\n const p = _this9.waitPromise;\n let resolve;\n _this9.waitPromise = new Promise(r => resolve = r);\n\n if (p !== undefined) {\n yield p;\n }\n\n return resolve;\n })();\n }\n /**\n * Executes the beforeLeave hook of the source route and the beforeEnter hook of the target route if they exist.\n *\n * When the beforeLeave hook does not return true (to allow navigating) then that value is returned early and the beforeEnter is executed.\n * Otherwise the beforeEnterHook hook of the target route is executed.\n */\n\n\n runGuards(to = this.getSegments(), from) {\n var _this10 = this;\n\n return _asyncToGenerator(function* () {\n if (from === undefined) {\n from = parsePath(_this10.previousPath).segments;\n }\n\n if (!to || !from) {\n return true;\n }\n\n const routes = readRoutes(_this10.el);\n const fromChain = findChainForSegments(from, routes);\n const beforeLeaveHook = fromChain && fromChain[fromChain.length - 1].beforeLeave;\n const canLeave = beforeLeaveHook ? yield beforeLeaveHook() : true;\n\n if (canLeave === false || typeof canLeave === 'object') {\n return canLeave;\n }\n\n const toChain = findChainForSegments(to, routes);\n const beforeEnterHook = toChain && toChain[toChain.length - 1].beforeEnter;\n return beforeEnterHook ? beforeEnterHook() : true;\n })();\n }\n\n writeNavState(node, chain, direction, segments, redirectFrom, index = 0, animation) {\n var _this11 = this;\n\n return _asyncToGenerator(function* () {\n if (_this11.busy) {\n console.warn('[ion-router] router is busy, transition was cancelled');\n return false;\n }\n\n _this11.busy = true; // generate route event and emit will change\n\n const routeEvent = _this11.routeChangeEvent(segments, redirectFrom);\n\n if (routeEvent) {\n _this11.ionRouteWillChange.emit(routeEvent);\n }\n\n const changed = yield writeNavState(node, chain, direction, index, false, animation);\n _this11.busy = false; // emit did change\n\n if (routeEvent) {\n _this11.ionRouteDidChange.emit(routeEvent);\n }\n\n return changed;\n })();\n }\n\n setSegments(segments, direction, queryString) {\n this.state++;\n writeSegments(window.history, this.root, this.useHash, segments, direction, this.state, queryString);\n }\n\n getSegments() {\n return readSegments(window.location, this.root, this.useHash);\n }\n\n routeChangeEvent(toSegments, redirectFromSegments) {\n const from = this.previousPath;\n const to = generatePath(toSegments);\n this.previousPath = to;\n\n if (to === from) {\n return null;\n }\n\n const redirectedFrom = redirectFromSegments ? generatePath(redirectFromSegments) : null;\n return {\n from,\n redirectedFrom,\n to\n };\n }\n\n get el() {\n return getElement(this);\n }\n\n};\nconst routerLinkCss = \":host{--background:transparent;--color:var(--ion-color-primary, #3880ff);background:var(--background);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}a{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit}\";\nconst RouterLink = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n /**\n * When using a router, it specifies the transition direction when navigating to\n * another page using `href`.\n */\n\n this.routerDirection = 'forward';\n\n this.onClick = ev => {\n openURL(this.href, ev, this.routerDirection, this.routerAnimation);\n };\n }\n\n render() {\n const mode = getIonMode(this);\n const attrs = {\n href: this.href,\n rel: this.rel,\n target: this.target\n };\n return h(Host, {\n onClick: this.onClick,\n class: createColorClasses(this.color, {\n [mode]: true,\n 'ion-activatable': true\n })\n }, h(\"a\", Object.assign({}, attrs), h(\"slot\", null)));\n }\n\n};\nRouterLink.style = routerLinkCss;\nexport { Route as ion_route, RouteRedirect as ion_route_redirect, Router as ion_router, RouterLink as ion_router_link };","map":{"version":3,"names":["r","registerInstance","e","createEvent","i","getElement","h","H","Host","c","componentOnReady","q","debounce","b","getIonMode","o","openURL","createColorClasses","Route","constructor","hostRef","ionRouteDataChanged","url","onUpdate","newValue","emit","onComponentProps","oldValue","keys1","Object","keys","keys2","length","key","connectedCallback","watchers","RouteRedirect","ionRouteRedirectChanged","propDidChange","ROUTER_INTENT_NONE","ROUTER_INTENT_FORWARD","ROUTER_INTENT_BACK","generatePath","segments","path","filter","s","join","generateUrl","useHash","queryString","undefined","writeSegments","history","root","direction","state","parsePath","pushState","replaceState","chainToSegments","chain","route","segment","param","params","slice","push","removePrefix","prefix","readSegments","loc","pathname","hash","qsStart","indexOf","substring","split","map","trim","printRoutes","routes","console","group","forEach","ids","id","debug","groupEnd","printRedirects","redirects","redirect","to","from","writeNavState","index","changed","animation","outlet","searchNavNode","Promise","resolve","result","setRouteId","element","markVisible","error","readNavState","node","getRouteId","waitUntilNavNode","document","body","window","addEventListener","once","OUTLET_SELECTOR","matches","querySelector","matchesRedirect","expected","findRouteRedirect","find","matchesIDs","len","Math","min","score","routeId","routeChain","toLowerCase","routeIdParams","pathWithParams","j","matchesSegments","inputSegments","RouterSegments","matchesDefault","allparams","chainSegments","data","next","mergeParams","beforeEnter","beforeLeave","a","assign","findChainForIDs","chains","match","maxMatches","_a","findChainForSegments","bestScore","matchedChain","computePriority","level","pow","shift","readProp","el","prop","hasAttribute","getAttribute","readRedirects","Array","children","tagName","readRoutes","flattenRouterTree","readRouteNodes","component","componentProps","nodes","flattenNode","child","Router","ionRouteWillChange","ionRouteDidChange","previousPath","busy","lastState","componentWillLoad","canProceed","runGuards","getSegments","setSegments","writeNavStateRoot","onRoutesChanged","componentDidLoad","onRedirectChanged","bind","onPopState","historyDirection","onBackButton","ev","detail","register","processNextHandler","back","canTransition","startsWith","currentPath","URL","search","parsedPath","waitPromise","printDebug","navChanged","warn","safeWriteNavState","win","title","location","href","redirectFrom","toSegments","unlock","lock","p","fromChain","beforeLeaveHook","canLeave","toChain","beforeEnterHook","routeEvent","routeChangeEvent","redirectFromSegments","redirectedFrom","routerLinkCss","RouterLink","routerDirection","onClick","routerAnimation","render","mode","attrs","rel","target","class","color","style","ion_route","ion_route_redirect","ion_router","ion_router_link"],"sources":["D:/MobileDev/WRB/WrenchBoard2023a/node_modules/@ionic/core/dist/esm/ion-route_4.entry.js"],"sourcesContent":["/*!\n * (C) Ionic http://ionicframework.com - MIT License\n */\nimport { r as registerInstance, e as createEvent, i as getElement, h, H as Host } from './index-1a99aeb7.js';\nimport { c as componentOnReady, q as debounce } from './helpers-4d272360.js';\nimport { b as getIonMode } from './ionic-global-04e268e7.js';\nimport { o as openURL, c as createColorClasses } from './theme-7670341c.js';\n\nconst Route = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n this.ionRouteDataChanged = createEvent(this, \"ionRouteDataChanged\", 7);\n /**\n * Relative path that needs to match in order for this route to apply.\n *\n * Accepts paths similar to expressjs so that you can define parameters\n * in the url /foo/:bar where bar would be available in incoming props.\n */\n this.url = '';\n }\n onUpdate(newValue) {\n this.ionRouteDataChanged.emit(newValue);\n }\n onComponentProps(newValue, oldValue) {\n if (newValue === oldValue) {\n return;\n }\n const keys1 = newValue ? Object.keys(newValue) : [];\n const keys2 = oldValue ? Object.keys(oldValue) : [];\n if (keys1.length !== keys2.length) {\n this.onUpdate(newValue);\n return;\n }\n for (const key of keys1) {\n if (newValue[key] !== oldValue[key]) {\n this.onUpdate(newValue);\n return;\n }\n }\n }\n connectedCallback() {\n this.ionRouteDataChanged.emit();\n }\n static get watchers() { return {\n \"url\": [\"onUpdate\"],\n \"component\": [\"onUpdate\"],\n \"componentProps\": [\"onComponentProps\"]\n }; }\n};\n\nconst RouteRedirect = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n this.ionRouteRedirectChanged = createEvent(this, \"ionRouteRedirectChanged\", 7);\n }\n propDidChange() {\n this.ionRouteRedirectChanged.emit();\n }\n connectedCallback() {\n this.ionRouteRedirectChanged.emit();\n }\n static get watchers() { return {\n \"from\": [\"propDidChange\"],\n \"to\": [\"propDidChange\"]\n }; }\n};\n\nconst ROUTER_INTENT_NONE = 'root';\nconst ROUTER_INTENT_FORWARD = 'forward';\nconst ROUTER_INTENT_BACK = 'back';\n\n/** Join the non empty segments with \"/\". */\nconst generatePath = (segments) => {\n const path = segments.filter((s) => s.length > 0).join('/');\n return '/' + path;\n};\nconst generateUrl = (segments, useHash, queryString) => {\n let url = generatePath(segments);\n if (useHash) {\n url = '#' + url;\n }\n if (queryString !== undefined) {\n url += '?' + queryString;\n }\n return url;\n};\nconst writeSegments = (history, root, useHash, segments, direction, state, queryString) => {\n const url = generateUrl([...parsePath(root).segments, ...segments], useHash, queryString);\n if (direction === ROUTER_INTENT_FORWARD) {\n history.pushState(state, '', url);\n }\n else {\n history.replaceState(state, '', url);\n }\n};\n/**\n * Transforms a chain to a list of segments.\n *\n * Notes:\n * - parameter segments of the form :param are replaced with their value,\n * - null is returned when a value is missing for any parameter segment.\n */\nconst chainToSegments = (chain) => {\n const segments = [];\n for (const route of chain) {\n for (const segment of route.segments) {\n if (segment[0] === ':') {\n const param = route.params && route.params[segment.slice(1)];\n if (!param) {\n return null;\n }\n segments.push(param);\n }\n else if (segment !== '') {\n segments.push(segment);\n }\n }\n }\n return segments;\n};\n/**\n * Removes the prefix segments from the path segments.\n *\n * Return:\n * - null when the path segments do not start with the passed prefix,\n * - the path segments after the prefix otherwise.\n */\nconst removePrefix = (prefix, segments) => {\n if (prefix.length > segments.length) {\n return null;\n }\n if (prefix.length <= 1 && prefix[0] === '') {\n return segments;\n }\n for (let i = 0; i < prefix.length; i++) {\n if (prefix[i] !== segments[i]) {\n return null;\n }\n }\n if (segments.length === prefix.length) {\n return [''];\n }\n return segments.slice(prefix.length);\n};\nconst readSegments = (loc, root, useHash) => {\n const prefix = parsePath(root).segments;\n const pathname = useHash ? loc.hash.slice(1) : loc.pathname;\n const segments = parsePath(pathname).segments;\n return removePrefix(prefix, segments);\n};\n/**\n * Parses the path to:\n * - segments an array of '/' separated parts,\n * - queryString (undefined when no query string).\n */\nconst parsePath = (path) => {\n let segments = [''];\n let queryString;\n if (path != null) {\n const qsStart = path.indexOf('?');\n if (qsStart > -1) {\n queryString = path.substring(qsStart + 1);\n path = path.substring(0, qsStart);\n }\n segments = path\n .split('/')\n .map((s) => s.trim())\n .filter((s) => s.length > 0);\n if (segments.length === 0) {\n segments = [''];\n }\n }\n return { segments, queryString };\n};\n\nconst printRoutes = (routes) => {\n console.group(`[ion-core] ROUTES[${routes.length}]`);\n for (const chain of routes) {\n const segments = [];\n chain.forEach((r) => segments.push(...r.segments));\n const ids = chain.map((r) => r.id);\n console.debug(`%c ${generatePath(segments)}`, 'font-weight: bold; padding-left: 20px', '=>\\t', `(${ids.join(', ')})`);\n }\n console.groupEnd();\n};\nconst printRedirects = (redirects) => {\n console.group(`[ion-core] REDIRECTS[${redirects.length}]`);\n for (const redirect of redirects) {\n if (redirect.to) {\n console.debug('FROM: ', `$c ${generatePath(redirect.from)}`, 'font-weight: bold', ' TO: ', `$c ${generatePath(redirect.to.segments)}`, 'font-weight: bold');\n }\n }\n console.groupEnd();\n};\n\n/**\n * Activates the passed route chain.\n *\n * There must be exactly one outlet per route entry in the chain.\n *\n * The methods calls setRouteId on each of the outlet with the corresponding route entry in the chain.\n * setRouteId will create or select the view in the outlet.\n */\nconst writeNavState = async (root, chain, direction, index, changed = false, animation) => {\n try {\n // find next navigation outlet in the DOM\n const outlet = searchNavNode(root);\n // make sure we can continue interacting the DOM, otherwise abort\n if (index >= chain.length || !outlet) {\n return changed;\n }\n await new Promise((resolve) => componentOnReady(outlet, resolve));\n const route = chain[index];\n const result = await outlet.setRouteId(route.id, route.params, direction, animation);\n // if the outlet changed the page, reset navigation to neutral (no direction)\n // this means nested outlets will not animate\n if (result.changed) {\n direction = ROUTER_INTENT_NONE;\n changed = true;\n }\n // recursively set nested outlets\n changed = await writeNavState(result.element, chain, direction, index + 1, changed, animation);\n // once all nested outlets are visible let's make the parent visible too,\n // using markVisible prevents flickering\n if (result.markVisible) {\n await result.markVisible();\n }\n return changed;\n }\n catch (e) {\n console.error(e);\n return false;\n }\n};\n/**\n * Recursively walks the outlet in the DOM.\n *\n * The function returns a list of RouteID corresponding to each of the outlet and the last outlet without a RouteID.\n */\nconst readNavState = async (root) => {\n const ids = [];\n let outlet;\n let node = root;\n // eslint-disable-next-line no-cond-assign\n while ((outlet = searchNavNode(node))) {\n const id = await outlet.getRouteId();\n if (id) {\n node = id.element;\n id.element = undefined;\n ids.push(id);\n }\n else {\n break;\n }\n }\n return { ids, outlet };\n};\nconst waitUntilNavNode = () => {\n if (searchNavNode(document.body)) {\n return Promise.resolve();\n }\n return new Promise((resolve) => {\n window.addEventListener('ionNavWillLoad', () => resolve(), { once: true });\n });\n};\n/** Selector for all the outlets supported by the router. */\nconst OUTLET_SELECTOR = ':not([no-router]) ion-nav, :not([no-router]) ion-tabs, :not([no-router]) ion-router-outlet';\nconst searchNavNode = (root) => {\n if (!root) {\n return undefined;\n }\n if (root.matches(OUTLET_SELECTOR)) {\n return root;\n }\n const outlet = root.querySelector(OUTLET_SELECTOR);\n return outlet !== null && outlet !== void 0 ? outlet : undefined;\n};\n\n/**\n * Returns whether the given redirect matches the given path segments.\n *\n * A redirect matches when the segments of the path and redirect.from are equal.\n * Note that segments are only checked until redirect.from contains a '*' which matches any path segment.\n * The path ['some', 'path', 'to', 'page'] matches both ['some', 'path', 'to', 'page'] and ['some', 'path', '*'].\n */\nconst matchesRedirect = (segments, redirect) => {\n const { from, to } = redirect;\n if (to === undefined) {\n return false;\n }\n if (from.length > segments.length) {\n return false;\n }\n for (let i = 0; i < from.length; i++) {\n const expected = from[i];\n if (expected === '*') {\n return true;\n }\n if (expected !== segments[i]) {\n return false;\n }\n }\n return from.length === segments.length;\n};\n/** Returns the first redirect matching the path segments or undefined when no match found. */\nconst findRouteRedirect = (segments, redirects) => {\n return redirects.find((redirect) => matchesRedirect(segments, redirect));\n};\nconst matchesIDs = (ids, chain) => {\n const len = Math.min(ids.length, chain.length);\n let score = 0;\n for (let i = 0; i < len; i++) {\n const routeId = ids[i];\n const routeChain = chain[i];\n // Skip results where the route id does not match the chain at the same index\n if (routeId.id.toLowerCase() !== routeChain.id) {\n break;\n }\n if (routeId.params) {\n const routeIdParams = Object.keys(routeId.params);\n // Only compare routes with the chain that have the same number of parameters.\n if (routeIdParams.length === routeChain.segments.length) {\n // Maps the route's params into a path based on the path variable names,\n // to compare against the route chain format.\n //\n // Before:\n // ```ts\n // {\n // params: {\n // s1: 'a',\n // s2: 'b'\n // }\n // }\n // ```\n //\n // After:\n // ```ts\n // [':s1',':s2']\n // ```\n //\n const pathWithParams = routeIdParams.map((key) => `:${key}`);\n for (let j = 0; j < pathWithParams.length; j++) {\n // Skip results where the path variable is not a match\n if (pathWithParams[j].toLowerCase() !== routeChain.segments[j]) {\n break;\n }\n // Weight path matches for the same index higher.\n score++;\n }\n }\n }\n // Weight id matches\n score++;\n }\n return score;\n};\n/**\n * Matches the segments against the chain.\n *\n * Returns:\n * - null when there is no match,\n * - a chain with the params properties updated with the parameter segments on match.\n */\nconst matchesSegments = (segments, chain) => {\n const inputSegments = new RouterSegments(segments);\n let matchesDefault = false;\n let allparams;\n for (let i = 0; i < chain.length; i++) {\n const chainSegments = chain[i].segments;\n if (chainSegments[0] === '') {\n matchesDefault = true;\n }\n else {\n for (const segment of chainSegments) {\n const data = inputSegments.next();\n // data param\n if (segment[0] === ':') {\n if (data === '') {\n return null;\n }\n allparams = allparams || [];\n const params = allparams[i] || (allparams[i] = {});\n params[segment.slice(1)] = data;\n }\n else if (data !== segment) {\n return null;\n }\n }\n matchesDefault = false;\n }\n }\n const matches = matchesDefault ? matchesDefault === (inputSegments.next() === '') : true;\n if (!matches) {\n return null;\n }\n if (allparams) {\n return chain.map((route, i) => ({\n id: route.id,\n segments: route.segments,\n params: mergeParams(route.params, allparams[i]),\n beforeEnter: route.beforeEnter,\n beforeLeave: route.beforeLeave,\n }));\n }\n return chain;\n};\n/**\n * Merges the route parameter objects.\n * Returns undefined when both parameters are undefined.\n */\nconst mergeParams = (a, b) => {\n return a || b ? Object.assign(Object.assign({}, a), b) : undefined;\n};\n/**\n * Finds the best match for the ids in the chains.\n *\n * Returns the best match or null when no match is found.\n * When a chain is returned the parameters are updated from the RouteIDs.\n * That is they contain both the componentProps of the <ion-route> and the parameter segment.\n */\nconst findChainForIDs = (ids, chains) => {\n let match = null;\n let maxMatches = 0;\n for (const chain of chains) {\n const score = matchesIDs(ids, chain);\n if (score > maxMatches) {\n match = chain;\n maxMatches = score;\n }\n }\n if (match) {\n return match.map((route, i) => {\n var _a;\n return ({\n id: route.id,\n segments: route.segments,\n params: mergeParams(route.params, (_a = ids[i]) === null || _a === void 0 ? void 0 : _a.params),\n });\n });\n }\n return null;\n};\n/**\n * Finds the best match for the segments in the chains.\n *\n * Returns the best match or null when no match is found.\n * When a chain is returned the parameters are updated from the segments.\n * That is they contain both the componentProps of the <ion-route> and the parameter segments.\n */\nconst findChainForSegments = (segments, chains) => {\n let match = null;\n let bestScore = 0;\n for (const chain of chains) {\n const matchedChain = matchesSegments(segments, chain);\n if (matchedChain !== null) {\n const score = computePriority(matchedChain);\n if (score > bestScore) {\n bestScore = score;\n match = matchedChain;\n }\n }\n }\n return match;\n};\n/**\n * Computes the priority of a chain.\n *\n * Parameter segments are given a lower priority over fixed segments.\n *\n * Considering the following 2 chains matching the path /path/to/page:\n * - /path/to/:where\n * - /path/to/page\n *\n * The second one will be given a higher priority because \"page\" is a fixed segment (vs \":where\", a parameter segment).\n */\nconst computePriority = (chain) => {\n let score = 1;\n let level = 1;\n for (const route of chain) {\n for (const segment of route.segments) {\n if (segment[0] === ':') {\n score += Math.pow(1, level);\n }\n else if (segment !== '') {\n score += Math.pow(2, level);\n }\n level++;\n }\n }\n return score;\n};\nclass RouterSegments {\n constructor(segments) {\n this.segments = segments.slice();\n }\n next() {\n if (this.segments.length > 0) {\n return this.segments.shift();\n }\n return '';\n }\n}\n\nconst readProp = (el, prop) => {\n if (prop in el) {\n return el[prop];\n }\n if (el.hasAttribute(prop)) {\n return el.getAttribute(prop);\n }\n return null;\n};\n/**\n * Extracts the redirects (that is <ion-route-redirect> elements inside the root).\n *\n * The redirects are returned as a list of RouteRedirect.\n */\nconst readRedirects = (root) => {\n return Array.from(root.children)\n .filter((el) => el.tagName === 'ION-ROUTE-REDIRECT')\n .map((el) => {\n const to = readProp(el, 'to');\n return {\n from: parsePath(readProp(el, 'from')).segments,\n to: to == null ? undefined : parsePath(to),\n };\n });\n};\n/**\n * Extracts all the routes (that is <ion-route> elements inside the root).\n *\n * The routes are returned as a list of chains - the flattened tree.\n */\nconst readRoutes = (root) => {\n return flattenRouterTree(readRouteNodes(root));\n};\n/**\n * Reads the route nodes as a tree modeled after the DOM tree of <ion-route> elements.\n *\n * Note: routes without a component are ignored together with their children.\n */\nconst readRouteNodes = (node) => {\n return Array.from(node.children)\n .filter((el) => el.tagName === 'ION-ROUTE' && el.component)\n .map((el) => {\n const component = readProp(el, 'component');\n return {\n segments: parsePath(readProp(el, 'url')).segments,\n id: component.toLowerCase(),\n params: el.componentProps,\n beforeLeave: el.beforeLeave,\n beforeEnter: el.beforeEnter,\n children: readRouteNodes(el),\n };\n });\n};\n/**\n * Flattens a RouterTree in a list of chains.\n *\n * Each chain represents a path from the root node to a terminal node.\n */\nconst flattenRouterTree = (nodes) => {\n const chains = [];\n for (const node of nodes) {\n flattenNode([], chains, node);\n }\n return chains;\n};\n/** Flattens a route node recursively and push each branch to the chains list. */\nconst flattenNode = (chain, chains, node) => {\n chain = [\n ...chain,\n {\n id: node.id,\n segments: node.segments,\n params: node.params,\n beforeLeave: node.beforeLeave,\n beforeEnter: node.beforeEnter,\n },\n ];\n if (node.children.length === 0) {\n chains.push(chain);\n return;\n }\n for (const child of node.children) {\n flattenNode(chain, chains, child);\n }\n};\n\nconst Router = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n this.ionRouteWillChange = createEvent(this, \"ionRouteWillChange\", 7);\n this.ionRouteDidChange = createEvent(this, \"ionRouteDidChange\", 7);\n this.previousPath = null;\n this.busy = false;\n this.state = 0;\n this.lastState = 0;\n /**\n * The root path to use when matching URLs. By default, this is set to \"/\", but you can specify\n * an alternate prefix for all URL paths.\n */\n this.root = '/';\n /**\n * The router can work in two \"modes\":\n * - With hash: `/index.html#/path/to/page`\n * - Without hash: `/path/to/page`\n *\n * Using one or another might depend in the requirements of your app and/or where it's deployed.\n *\n * Usually \"hash-less\" navigation works better for SEO and it's more user friendly too, but it might\n * requires additional server-side configuration in order to properly work.\n *\n * On the other side hash-navigation is much easier to deploy, it even works over the file protocol.\n *\n * By default, this property is `true`, change to `false` to allow hash-less URLs.\n */\n this.useHash = true;\n }\n async componentWillLoad() {\n await waitUntilNavNode();\n const canProceed = await this.runGuards(this.getSegments());\n if (canProceed !== true) {\n if (typeof canProceed === 'object') {\n const { redirect } = canProceed;\n const path = parsePath(redirect);\n this.setSegments(path.segments, ROUTER_INTENT_NONE, path.queryString);\n await this.writeNavStateRoot(path.segments, ROUTER_INTENT_NONE);\n }\n }\n else {\n await this.onRoutesChanged();\n }\n }\n componentDidLoad() {\n window.addEventListener('ionRouteRedirectChanged', debounce(this.onRedirectChanged.bind(this), 10));\n window.addEventListener('ionRouteDataChanged', debounce(this.onRoutesChanged.bind(this), 100));\n }\n async onPopState() {\n const direction = this.historyDirection();\n let segments = this.getSegments();\n const canProceed = await this.runGuards(segments);\n if (canProceed !== true) {\n if (typeof canProceed === 'object') {\n segments = parsePath(canProceed.redirect).segments;\n }\n else {\n return false;\n }\n }\n return this.writeNavStateRoot(segments, direction);\n }\n onBackButton(ev) {\n ev.detail.register(0, (processNextHandler) => {\n this.back();\n processNextHandler();\n });\n }\n /** @internal */\n async canTransition() {\n const canProceed = await this.runGuards();\n if (canProceed !== true) {\n if (typeof canProceed === 'object') {\n return canProceed.redirect;\n }\n else {\n return false;\n }\n }\n return true;\n }\n /**\n * Navigate to the specified path.\n *\n * @param path The path to navigate to.\n * @param direction The direction of the animation. Defaults to `\"forward\"`.\n */\n async push(path, direction = 'forward', animation) {\n var _a;\n if (path.startsWith('.')) {\n const currentPath = (_a = this.previousPath) !== null && _a !== void 0 ? _a : '/';\n // Convert currentPath to an URL by pre-pending a protocol and a host to resolve the relative path.\n const url = new URL(path, `https://host/${currentPath}`);\n path = url.pathname + url.search;\n }\n let parsedPath = parsePath(path);\n const canProceed = await this.runGuards(parsedPath.segments);\n if (canProceed !== true) {\n if (typeof canProceed === 'object') {\n parsedPath = parsePath(canProceed.redirect);\n }\n else {\n return false;\n }\n }\n this.setSegments(parsedPath.segments, direction, parsedPath.queryString);\n return this.writeNavStateRoot(parsedPath.segments, direction, animation);\n }\n /** Go back to previous page in the window.history. */\n back() {\n window.history.back();\n return Promise.resolve(this.waitPromise);\n }\n /** @internal */\n async printDebug() {\n printRoutes(readRoutes(this.el));\n printRedirects(readRedirects(this.el));\n }\n /** @internal */\n async navChanged(direction) {\n if (this.busy) {\n console.warn('[ion-router] router is busy, navChanged was cancelled');\n return false;\n }\n const { ids, outlet } = await readNavState(window.document.body);\n const routes = readRoutes(this.el);\n const chain = findChainForIDs(ids, routes);\n if (!chain) {\n console.warn('[ion-router] no matching URL for ', ids.map((i) => i.id));\n return false;\n }\n const segments = chainToSegments(chain);\n if (!segments) {\n console.warn('[ion-router] router could not match path because some required param is missing');\n return false;\n }\n this.setSegments(segments, direction);\n await this.safeWriteNavState(outlet, chain, ROUTER_INTENT_NONE, segments, null, ids.length);\n return true;\n }\n /** This handler gets called when a `ion-route-redirect` component is added to the DOM or if the from or to property of such node changes. */\n onRedirectChanged() {\n const segments = this.getSegments();\n if (segments && findRouteRedirect(segments, readRedirects(this.el))) {\n this.writeNavStateRoot(segments, ROUTER_INTENT_NONE);\n }\n }\n /** This handler gets called when a `ion-route` component is added to the DOM or if the from or to property of such node changes. */\n onRoutesChanged() {\n return this.writeNavStateRoot(this.getSegments(), ROUTER_INTENT_NONE);\n }\n historyDirection() {\n var _a;\n const win = window;\n if (win.history.state === null) {\n this.state++;\n win.history.replaceState(this.state, win.document.title, (_a = win.document.location) === null || _a === void 0 ? void 0 : _a.href);\n }\n const state = win.history.state;\n const lastState = this.lastState;\n this.lastState = state;\n if (state > lastState || (state >= lastState && lastState > 0)) {\n return ROUTER_INTENT_FORWARD;\n }\n if (state < lastState) {\n return ROUTER_INTENT_BACK;\n }\n return ROUTER_INTENT_NONE;\n }\n async writeNavStateRoot(segments, direction, animation) {\n if (!segments) {\n console.error('[ion-router] URL is not part of the routing set');\n return false;\n }\n // lookup redirect rule\n const redirects = readRedirects(this.el);\n const redirect = findRouteRedirect(segments, redirects);\n let redirectFrom = null;\n if (redirect) {\n const { segments: toSegments, queryString } = redirect.to;\n this.setSegments(toSegments, direction, queryString);\n redirectFrom = redirect.from;\n segments = toSegments;\n }\n // lookup route chain\n const routes = readRoutes(this.el);\n const chain = findChainForSegments(segments, routes);\n if (!chain) {\n console.error('[ion-router] the path does not match any route');\n return false;\n }\n // write DOM give\n return this.safeWriteNavState(document.body, chain, direction, segments, redirectFrom, 0, animation);\n }\n async safeWriteNavState(node, chain, direction, segments, redirectFrom, index = 0, animation) {\n const unlock = await this.lock();\n let changed = false;\n try {\n changed = await this.writeNavState(node, chain, direction, segments, redirectFrom, index, animation);\n }\n catch (e) {\n console.error(e);\n }\n unlock();\n return changed;\n }\n async lock() {\n const p = this.waitPromise;\n let resolve;\n this.waitPromise = new Promise((r) => (resolve = r));\n if (p !== undefined) {\n await p;\n }\n return resolve;\n }\n /**\n * Executes the beforeLeave hook of the source route and the beforeEnter hook of the target route if they exist.\n *\n * When the beforeLeave hook does not return true (to allow navigating) then that value is returned early and the beforeEnter is executed.\n * Otherwise the beforeEnterHook hook of the target route is executed.\n */\n async runGuards(to = this.getSegments(), from) {\n if (from === undefined) {\n from = parsePath(this.previousPath).segments;\n }\n if (!to || !from) {\n return true;\n }\n const routes = readRoutes(this.el);\n const fromChain = findChainForSegments(from, routes);\n const beforeLeaveHook = fromChain && fromChain[fromChain.length - 1].beforeLeave;\n const canLeave = beforeLeaveHook ? await beforeLeaveHook() : true;\n if (canLeave === false || typeof canLeave === 'object') {\n return canLeave;\n }\n const toChain = findChainForSegments(to, routes);\n const beforeEnterHook = toChain && toChain[toChain.length - 1].beforeEnter;\n return beforeEnterHook ? beforeEnterHook() : true;\n }\n async writeNavState(node, chain, direction, segments, redirectFrom, index = 0, animation) {\n if (this.busy) {\n console.warn('[ion-router] router is busy, transition was cancelled');\n return false;\n }\n this.busy = true;\n // generate route event and emit will change\n const routeEvent = this.routeChangeEvent(segments, redirectFrom);\n if (routeEvent) {\n this.ionRouteWillChange.emit(routeEvent);\n }\n const changed = await writeNavState(node, chain, direction, index, false, animation);\n this.busy = false;\n // emit did change\n if (routeEvent) {\n this.ionRouteDidChange.emit(routeEvent);\n }\n return changed;\n }\n setSegments(segments, direction, queryString) {\n this.state++;\n writeSegments(window.history, this.root, this.useHash, segments, direction, this.state, queryString);\n }\n getSegments() {\n return readSegments(window.location, this.root, this.useHash);\n }\n routeChangeEvent(toSegments, redirectFromSegments) {\n const from = this.previousPath;\n const to = generatePath(toSegments);\n this.previousPath = to;\n if (to === from) {\n return null;\n }\n const redirectedFrom = redirectFromSegments ? generatePath(redirectFromSegments) : null;\n return {\n from,\n redirectedFrom,\n to,\n };\n }\n get el() { return getElement(this); }\n};\n\nconst routerLinkCss = \":host{--background:transparent;--color:var(--ion-color-primary, #3880ff);background:var(--background);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}a{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit}\";\n\nconst RouterLink = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n /**\n * When using a router, it specifies the transition direction when navigating to\n * another page using `href`.\n */\n this.routerDirection = 'forward';\n this.onClick = (ev) => {\n openURL(this.href, ev, this.routerDirection, this.routerAnimation);\n };\n }\n render() {\n const mode = getIonMode(this);\n const attrs = {\n href: this.href,\n rel: this.rel,\n target: this.target,\n };\n return (h(Host, { onClick: this.onClick, class: createColorClasses(this.color, {\n [mode]: true,\n 'ion-activatable': true,\n }) }, h(\"a\", Object.assign({}, attrs), h(\"slot\", null))));\n }\n};\nRouterLink.style = routerLinkCss;\n\nexport { Route as ion_route, RouteRedirect as ion_route_redirect, Router as ion_router, RouterLink as ion_router_link };\n"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,CAAC,IAAIC,gBAAd,EAAgCC,CAAC,IAAIC,WAArC,EAAkDC,CAAC,IAAIC,UAAvD,EAAmEC,CAAnE,EAAsEC,CAAC,IAAIC,IAA3E,QAAuF,qBAAvF;AACA,SAASC,CAAC,IAAIC,gBAAd,EAAgCC,CAAC,IAAIC,QAArC,QAAqD,uBAArD;AACA,SAASC,CAAC,IAAIC,UAAd,QAAgC,4BAAhC;AACA,SAASC,CAAC,IAAIC,OAAd,EAAuBP,CAAC,IAAIQ,kBAA5B,QAAsD,qBAAtD;AAEA,MAAMC,KAAK,GAAG,MAAM;EAClBC,WAAW,CAACC,OAAD,EAAU;IACnBnB,gBAAgB,CAAC,IAAD,EAAOmB,OAAP,CAAhB;IACA,KAAKC,mBAAL,GAA2BlB,WAAW,CAAC,IAAD,EAAO,qBAAP,EAA8B,CAA9B,CAAtC;IACA;AACJ;AACA;AACA;AACA;AACA;;IACI,KAAKmB,GAAL,GAAW,EAAX;EACD;;EACDC,QAAQ,CAACC,QAAD,EAAW;IACjB,KAAKH,mBAAL,CAAyBI,IAAzB,CAA8BD,QAA9B;EACD;;EACDE,gBAAgB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