diff --git a/lib/es/index.js b/lib/es/index.js index 98c187f3..0cc62896 100644 --- a/lib/es/index.js +++ b/lib/es/index.js @@ -1,3 +1,5 @@ +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + import { pushStateAvailable, matchRoute, parseQuery, extractGETParameters, isFunction, isString, clean, parseNavigateOptions, windowAvailable, getCurrentEnvURL, accumulateHooks } from "./utils"; import Q from "./Q"; import setLocationPath from "./middlewares/setLocationPath"; @@ -86,7 +88,7 @@ export default function Navigo(appRoute, resolveOptions) { instance: self, currentLocationPath: to ? clean(root) + "/" + clean(to) : undefined, navigateOptions: {}, - resolveOptions: options || DEFAULT_RESOLVE_OPTIONS + resolveOptions: _extends({}, DEFAULT_RESOLVE_OPTIONS, options) }; Q([setLocationPath, matchPathToRegisteredRoutes, Q["if"](function (_ref) { var matches = _ref.matches; diff --git a/lib/navigo.amd.js b/lib/navigo.amd.js index ae5942b3..04c17b47 100644 --- a/lib/navigo.amd.js +++ b/lib/navigo.amd.js @@ -98,6 +98,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _middlewares_updateBrowserURL__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./middlewares/updateBrowserURL */ "./src/middlewares/updateBrowserURL.ts"); /* harmony import */ var _middlewares_processMatches__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./middlewares/processMatches */ "./src/middlewares/processMatches.ts"); /* harmony import */ var _lifecycles__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./lifecycles */ "./src/lifecycles.ts"); +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + @@ -186,7 +188,7 @@ function Navigo(appRoute, resolveOptions) { instance: self, currentLocationPath: to ? (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clean)(root) + "/" + (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clean)(to) : undefined, navigateOptions: {}, - resolveOptions: options || DEFAULT_RESOLVE_OPTIONS + resolveOptions: _extends({}, DEFAULT_RESOLVE_OPTIONS, options) }; (0,_Q__WEBPACK_IMPORTED_MODULE_1__.default)([_middlewares_setLocationPath__WEBPACK_IMPORTED_MODULE_2__.default, _middlewares_matchPathToRegisteredRoutes__WEBPACK_IMPORTED_MODULE_3__.default, _Q__WEBPACK_IMPORTED_MODULE_1__.default.if(function (_ref) { var matches = _ref.matches; diff --git a/lib/navigo.amd.js.map b/lib/navigo.amd.js.map index c872d478..244876dd 100644 --- a/lib/navigo.amd.js.map +++ b/lib/navigo.amd.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://Navigo.amd/./src/Q.ts","webpack://Navigo.amd/./src/constants.ts","webpack://Navigo.amd/./src/index.ts","webpack://Navigo.amd/./src/lifecycles.ts","webpack://Navigo.amd/./src/middlewares/callHandler.ts","webpack://Navigo.amd/./src/middlewares/checkForAfterHook.ts","webpack://Navigo.amd/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo.amd/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo.amd/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo.amd/./src/middlewares/checkForForceOp.ts","webpack://Navigo.amd/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo.amd/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo.amd/./src/middlewares/errorOut.ts","webpack://Navigo.amd/./src/middlewares/flushCurrent.ts","webpack://Navigo.amd/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo.amd/./src/middlewares/processMatches.ts","webpack://Navigo.amd/./src/middlewares/setLocationPath.ts","webpack://Navigo.amd/./src/middlewares/updateBrowserURL.ts","webpack://Navigo.amd/./src/middlewares/updateState.ts","webpack://Navigo.amd/./src/utils.ts","webpack://Navigo.amd/webpack/bootstrap","webpack://Navigo.amd/webpack/runtime/define property getters","webpack://Navigo.amd/webpack/runtime/hasOwnProperty shorthand","webpack://Navigo.amd/webpack/runtime/make namespace object","webpack://Navigo.amd/webpack/startup"],"names":["Q","funcs","c","done","context","idx","next","Array","isArray","splice","moveForward","if","condition","one","two","PARAMETER_REGEXP","REPLACE_VARIABLE_REGEXP","WILDCARD_REGEXP","REPLACE_WILDCARD","NOT_SURE_REGEXP","REPLACE_NOT_SURE","START_BY_SLASH_REGEXP","MATCH_REGEXP_FLAGS","Navigo","appRoute","resolveOptions","DEFAULT_RESOLVE_OPTIONS","strategy","hash","noMatchWarning","self","root","current","routes","destroyed","genericHooks","isPushStateAvailable","pushStateAvailable","isWindowAvailable","windowAvailable","console","warn","clean","_checkForAHash","url","indexOf","split","composePathWithRoot","path","createRoute","handler","hooks","name","isString","String","accumulateHooks","on","RegExp","Object","keys","forEach","p","uses","as","push","resolve","to","options","instance","currentLocationPath","undefined","navigateOptions","setLocationPath","matchPathToRegisteredRoutes","matches","length","processMatches","notFoundLifeCycle","navigate","checkForDeprecationMethods","checkForForceOp","updateBrowserURL","navigateByName","data","generate","off","what","filter","r","isFunction","listen","__popstateListener","window","addEventListener","destroy","removeEventListener","notFound","_notFoundRoute","updatePageLinks","findLinks","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","location","match","URL","u","pathname","search","err","parseNavigateOptions","preventDefault","stopPropagation","slice","call","document","querySelectorAll","setGenericHooks","lastResolved","route","find","result","key","replace","getLinkPath","pathToMatchObject","extractGETParameters","queryString","params","parseQuery","getCurrentLocation","getCurrentEnvURL","directMatchWithRegisteredRoutes","directMatchWithLocation","currentLocation","matchRoute","addHook","type","func","getRoute","f","nameOrHandler","matchLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_pathToMatchObject","_clean","_setCurrent","foundLifecycle","checkForAlreadyHook","checkForBeforeHook","callHandler","checkForAfterHook","checkForLeaveHook","checkForNotFoundHandler","notFoundHandled","errorOut","flushCurrent","undefinedOrTrue","_checkForAfterHook","after","already","before","map","beforeHookInternal","_","d","concat","force","oldMatch","leaveLoopDone","leave","runHook","newLocationVSOldMatch","someOfTheLastOnesMatch","notFoundRoute","notFoundMatch","i","nextMatch","updateState","end","_setLocationPath","value","isItUsingHash","history","historyAPIMethod","stateObj","title","setTimeout","tmp","href","fallback","s","regExpResultToParams","names","reduce","index","decodeURIComponent","join","query","pairs","pair","currentPath","GETParams","paramNames","pattern","full","dots","regexp","pushState","obj","source","str","temp","v","h"],"mappings":";;;;;;;;;;;;;;AAKe,SAASA,CAAT,CACbC,KADa,EAEbC,CAFa,EAGbC,IAHa,EAIb;AACA,MAAMC,OAAO,GAAGF,CAAC,IAAI,EAArB;AACA,MAAIG,GAAG,GAAG,CAAV;;AAEA,GAAC,SAASC,IAAT,GAAgB;AACf,QAAI,CAACL,KAAK,CAACI,GAAD,CAAV,EAAiB;AACf,UAAIF,IAAJ,EAAU;AACRA,YAAI,CAACC,OAAD,CAAJ;AACD;;AACD;AACD;;AACD,QAAIG,KAAK,CAACC,OAAN,CAAcP,KAAK,CAACI,GAAD,CAAnB,CAAJ,EAA+B;AAC7BJ,WAAK,CAACQ,MAAN,OAAAR,KAAK,GACHI,GADG,EAEH,CAFG,SAGCJ,KAAK,CAACI,GAAD,CAAL,CAAW,CAAX,EAAcD,OAAd,IAAyBH,KAAK,CAACI,GAAD,CAAL,CAAW,CAAX,CAAzB,GAAyCJ,KAAK,CAACI,GAAD,CAAL,CAAW,CAAX,CAH1C,EAAL;AAKAC,UAAI;AACL,KAPD,MAOO;AACL;AACA;AACCL,WAAK,CAACI,GAAD,CAAN,CAAyBD,OAAzB,EAAkC,UAACM,WAAD,EAAiB;AACjD,YAAI,OAAOA,WAAP,KAAuB,WAAvB,IAAsCA,WAAW,KAAK,IAA1D,EAAgE;AAC9DL,aAAG,IAAI,CAAP;AAC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AoB,SAApB,EAA+B,OAA/B,EAAwCrK,OAAxC,CAAgD,UAACoF,IAAD,EAAU;AACxD,UAAIiF,CAAC,CAACjF,IAAD,CAAL,EAAa;AACX,YAAI,CAAChB,MAAM,CAACgB,IAAD,CAAX,EAAmBhB,MAAM,CAACgB,IAAD,CAAN,GAAe,EAAf;AACnBhB,cAAM,CAACgB,IAAD,CAAN,CAAahF,IAAb,CAAkBiK,CAAC,CAACjF,IAAD,CAAnB;AACD;AACF,KALD;AAMD,GATH;AAUA,SAAOhB,MAAP;AACD,C;;;;;;UC5KD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA;WACA,wCAAwC,yCAAyC;WACjF;WACA;WACA,E;;;;;WCPA,sF;;;;;WCAA;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;UCNA;UACA;UACA;UACA","file":"navigo.amd.js","sourcesContent":["type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: to ? `${clean(root)}/${clean(to)}` : undefined,\n navigateOptions: {},\n resolveOptions: options || DEFAULT_RESOLVE_OPTIONS,\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path as string,\n context.currentLocationPath\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n d,\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n // console.log(current, regexp);\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/index.ts\");\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://Navigo.amd/./src/Q.ts","webpack://Navigo.amd/./src/constants.ts","webpack://Navigo.amd/./src/index.ts","webpack://Navigo.amd/./src/lifecycles.ts","webpack://Navigo.amd/./src/middlewares/callHandler.ts","webpack://Navigo.amd/./src/middlewares/checkForAfterHook.ts","webpack://Navigo.amd/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo.amd/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo.amd/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo.amd/./src/middlewares/checkForForceOp.ts","webpack://Navigo.amd/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo.amd/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo.amd/./src/middlewares/errorOut.ts","webpack://Navigo.amd/./src/middlewares/flushCurrent.ts","webpack://Navigo.amd/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo.amd/./src/middlewares/processMatches.ts","webpack://Navigo.amd/./src/middlewares/setLocationPath.ts","webpack://Navigo.amd/./src/middlewares/updateBrowserURL.ts","webpack://Navigo.amd/./src/middlewares/updateState.ts","webpack://Navigo.amd/./src/utils.ts","webpack://Navigo.amd/webpack/bootstrap","webpack://Navigo.amd/webpack/runtime/define property getters","webpack://Navigo.amd/webpack/runtime/hasOwnProperty shorthand","webpack://Navigo.amd/webpack/runtime/make namespace object","webpack://Navigo.amd/webpack/startup"],"names":["Q","funcs","c","done","context","idx","next","Array","isArray","splice","moveForward","if","condition","one","two","PARAMETER_REGEXP","REPLACE_VARIABLE_REGEXP","WILDCARD_REGEXP","REPLACE_WILDCARD","NOT_SURE_REGEXP","REPLACE_NOT_SURE","START_BY_SLASH_REGEXP","MATCH_REGEXP_FLAGS","Navigo","appRoute","resolveOptions","DEFAULT_RESOLVE_OPTIONS","strategy","hash","noMatchWarning","self","root","current","routes","destroyed","genericHooks","isPushStateAvailable","pushStateAvailable","isWindowAvailable","windowAvailable","console","warn","clean","_checkForAHash","url","indexOf","split","composePathWithRoot","path","createRoute","handler","hooks","name","isString","String","accumulateHooks","on","RegExp","Object","keys","forEach","p","uses","as","push","resolve","to","options","instance","currentLocationPath","undefined","navigateOptions","setLocationPath","matchPathToRegisteredRoutes","matches","length","processMatches","notFoundLifeCycle","navigate","checkForDeprecationMethods","checkForForceOp","updateBrowserURL","navigateByName","data","generate","off","what","filter","r","isFunction","listen","__popstateListener","window","addEventListener","destroy","removeEventListener","notFound","_notFoundRoute","updatePageLinks","findLinks","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","location","match","URL","u","pathname","search","err","parseNavigateOptions","preventDefault","stopPropagation","slice","call","document","querySelectorAll","setGenericHooks","lastResolved","route","find","result","key","replace","getLinkPath","pathToMatchObject","extractGETParameters","queryString","params","parseQuery","getCurrentLocation","getCurrentEnvURL","directMatchWithRegisteredRoutes","directMatchWithLocation","currentLocation","matchRoute","addHook","type","func","getRoute","f","nameOrHandler","matchLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_pathToMatchObject","_clean","_setCurrent","foundLifecycle","checkForAlreadyHook","checkForBeforeHook","callHandler","checkForAfterHook","checkForLeaveHook","checkForNotFoundHandler","notFoundHandled","errorOut","flushCurrent","undefinedOrTrue","_checkForAfterHook","after","already","before","map","beforeHookInternal","_","d","concat","force","oldMatch","leaveLoopDone","leave","runHook","newLocationVSOldMatch","someOfTheLastOnesMatch","notFoundRoute","notFoundMatch","i","nextMatch","updateState","end","_setLocationPath","value","isItUsingHash","history","historyAPIMethod","stateObj","title","setTimeout","tmp","href","fallback","s","regExpResultToParams","names","reduce","index","decodeURIComponent","join","query","pairs","pair","currentPath","GETParams","paramNames","pattern","full","dots","regexp","pushState","obj","source","str","temp","v","h"],"mappings":";;;;;;;;;;;;;;AAKe,SAASA,CAAT,CACbC,KADa,EAEbC,CAFa,EAGbC,IAHa,EAIb;AACA,MAAMC,OAAO,GAAGF,CAAC,IAAI,EAArB;AACA,MAAIG,GAAG,GAAG,CAAV;;AAEA,GAAC,SAASC,IAAT,GAAgB;AACf,QAAI,CAACL,KAAK,CAACI,GAAD,CAAV,EAAiB;AACf,UAAIF,IAAJ,EAAU;AACRA,YAAI,CAACC,OAAD,CAAJ;AACD;;AACD;AACD;;AACD,QAAIG,KAAK,CAACC,OAAN,CAAcP,KAAK,CAACI,GAAD,CAAnB,CAAJ,EAA+B;AAC7BJ,WAAK,CAACQ,MAAN,OAAAR,KAAK,GACHI,GADG,EAEH,CAFG,SAGCJ,KAAK,CAACI,GAAD,CAAL,CAAW,CAAX,EAAcD,OAAd,IAAyBH,KAAK,CAACI,GAAD,CAAL,CAAW,CAAX,CAAzB,GAAyCJ,KAAK,CAACI,GAAD,CAAL,CAAW,CAAX,CAH1C,EAAL;AAKAC,UAAI;AACL,KAPD,MAOO;AACL;AACA;AACCL,WAAK,CAACI,GAAD,CAAN,CAAyBD,OAAzB,EAAkC,UAACM,WAAD,EAAiB;AACjD,YAAI,OAAOA,WAAP,KAAuB,WAAvB,IAAsCA,WAAW,KAAK,IAA1D,EAAgE;AAC9DL,aAAG,IAAI,CAAP;AACAC,cAAI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EAAoB,SAApB,EAA+B,OAA/B,EAAwCrK,OAAxC,CAAgD,UAACoF,IAAD,EAAU;AACxD,UAAIiF,CAAC,CAACjF,IAAD,CAAL,EAAa;AACX,YAAI,CAAChB,MAAM,CAACgB,IAAD,CAAX,EAAmBhB,MAAM,CAACgB,IAAD,CAAN,GAAe,EAAf;AACnBhB,cAAM,CAACgB,IAAD,CAAN,CAAahF,IAAb,CAAkBiK,CAAC,CAACjF,IAAD,CAAnB;AACD;AACF,KALD;AAMD,GATH;AAUA,SAAOhB,MAAP;AACD,C;;;;;;UC5KD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA;WACA,wCAAwC,yCAAyC;WACjF;WACA;WACA,E;;;;;WCPA,sF;;;;;WCAA;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;UCNA;UACA;UACA;UACA","file":"navigo.amd.js","sourcesContent":["type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: to ? `${clean(root)}/${clean(to)}` : undefined,\n navigateOptions: {},\n resolveOptions: { ...DEFAULT_RESOLVE_OPTIONS, ...options },\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path as string,\n context.currentLocationPath\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n d,\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n // console.log(current, regexp);\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/index.ts\");\n"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/navigo.amd.min.js b/lib/navigo.amd.min.js index 381a4655..fcb2ee75 100644 --- a/lib/navigo.amd.min.js +++ b/lib/navigo.amd.min.js @@ -1,2 +1,2 @@ -define("Navigo.amd",[],(()=>(()=>{"use strict";var t={783:(t,n,e)=>{e.d(n,{default:()=>H});var o=/([:*])(\w+)/g,r=/\*/g,a=/\/\?/g;function i(t){return void 0===t&&(t="/"),d()?location.pathname+location.search+location.hash:t}function s(t){return t.replace(/\/+$/,"").replace(/^\/+/,"")}function c(t){return"string"==typeof t}function u(t){var n=s(t).split(/\?(.*)?$/);return[s(n[0]),n.slice(1).join("")]}function h(t){for(var n={},e=t.split("&"),o=0;o0?1===t.matches.length?t.matches[0]:t.matches:void 0)}})).concat([function(){return o()}])):o()}else o()}})),{},(function(){return n()})):n()}var A=[function(t,n){var e=t.instance.lastResolved();if(e&&e[0]&&e[0].route===t.match.route&&e[0].url===t.match.url&&e[0].queryString===t.match.queryString)return e.forEach((function(n){n.route.hooks&&n.route.hooks.already&&p(t.navigateOptions,"callHooks")&&n.route.hooks.already.forEach((function(n){return n(t.match)}))})),void n(!1);n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.before&&p(t.navigateOptions,"callHooks")?g(t.match.route.hooks.before.map((function(n){return function(e,o){return n(o,t.match)}})).concat([function(){return n()}])):n()},function(t,n){p(t.navigateOptions,"callHandler")&&t.match.route.handler(t.match),t.instance.updatePageLinks(),n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.after&&p(t.navigateOptions,"callHooks")&&t.match.route.hooks.after.forEach((function(n){return n(t.match)})),n()}],_=[P,function(t,n){var e=t.instance._notFoundRoute;if(e){t.notFoundHandled=!0;var o=u(t.currentLocationPath),r=o[0],a=o[1];e.path=s(r);var i={url:e.path,queryString:a,data:null,route:e,params:""!==a?h(a):null};t.matches=[i],t.match=i}n()},g.if((function(t){return t.notFoundHandled}),A,[function(t,n){t.resolveOptions&&!1!==t.resolveOptions.noMatchWarning&&void 0!==t.resolveOptions.noMatchWarning||console.warn('Navigo: "'+t.currentLocationPath+"\" didn't match any of the registered routes."),n()}]),function(t,n){t.instance._setCurrent(null),n()}];function R(){return(R=Object.assign||function(t){for(var n=1;n=0&&(t=!0===o.hash?t.split("#")[1]||"/":t.split("#")[0]),t}function H(t){return s(a+"/"+s(t))}function S(t,n,e,o){return t=c(t)?H(t):t,{name:o||s(String(t)),path:t,handler:n,hooks:v(e)}}function j(t,n){var e={instance:r,currentLocationPath:t?s(a)+"/"+s(t):void 0,navigateOptions:{},resolveOptions:n||o};return g([m,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,_)],e),!!e.matches&&e.matches}function x(t,n){t=s(a)+"/"+s(t);var e={instance:r,to:t,navigateOptions:n||{},resolveOptions:n&&n.resolveOptions?n.resolveOptions:o,currentLocationPath:R(t)};g([O,k,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,_),b],e)}function C(){if(A)return(A?[].slice.call(document.querySelectorAll("[data-navigo]")):[]).forEach((function(t){"false"!==t.getAttribute("data-navigo")&&"_blank"!==t.getAttribute("target")?t.hasListenerAttached||(t.hasListenerAttached=!0,t.navigoHandler=function(n){if((n.ctrlKey||n.metaKey)&&"a"===n.target.tagName.toLowerCase())return!1;var e=t.getAttribute("href");if(null==e)return!1;if(e.match(/^(http|https)/)&&"undefined"!=typeof URL)try{var o=new URL(e);e=o.pathname+o.search}catch(t){}var a=function(t){if(!t)return{};var n,e=t.split(","),o={};return e.forEach((function(t){var e=t.split(":").map((function(t){return t.replace(/(^ +| +$)/g,"")}));switch(e[0]){case"historyAPIMethod":o.historyAPIMethod=e[1];break;case"resolveOptionsStrategy":n||(n={}),n.strategy=e[1];break;case"resolveOptionsHash":n||(n={}),n.hash="true"===e[1];break;case"updateBrowserURL":case"callHandler":case"updateState":case"force":o[e[0]]="true"===e[1]}})),n&&(o.resolveOptions=n),o}(t.getAttribute("data-navigo-options"));w||(n.preventDefault(),n.stopPropagation(),r.navigate(s(e),a))},t.addEventListener("click",t.navigoHandler)):t.hasListenerAttached&&t.removeEventListener("click",t.navigoHandler)})),r}function N(t,n){var e=L.find((function(n){return n.name===t}));if(e){var o=e.path;if(n)for(var r in n)o=o.replace(":"+r,n[r]);return o.match(/^\//)?o:"/"+o}return null}function U(t){var n=u(s(t)),o=n[0],r=n[1],a=""===r?null:h(r);return{url:o,queryString:r,route:S(o,(function(){}),[e],o),data:null,params:a}}function q(t,n,e){return"string"==typeof n&&(n=F(n)),n?(n.hooks[t]||(n.hooks[t]=[]),n.hooks[t].push(e),function(){n.hooks[t]=n.hooks[t].filter((function(t){return t!==e}))}):(console.warn("Route doesn't exists: "+n),function(){})}function F(t){return"string"==typeof t?L.find((function(n){return n.name===H(t)})):L.find((function(n){return n.handler===t}))}t?a=s(t):console.warn('Navigo requires a root path in its constructor. If not provided will use "/" as default.'),this.root=a,this.routes=L,this.destroyed=w,this.current=p,this.on=function(t,n,o){var r=this;return"object"!=typeof t||t instanceof RegExp?("function"==typeof t&&(o=n,n=t,t=a),L.push(S(t,n,[e,o])),this):(Object.keys(t).forEach((function(n){if("function"==typeof t[n])r.on(n,t[n]);else{var o=t[n],a=o.uses,i=o.as,s=o.hooks;L.push(S(n,a,[e,s],i))}})),this)},this.off=function(t){return this.routes=L=L.filter((function(n){return c(t)?s(n.path)!==s(t):"function"==typeof t?t!==n.handler:String(n.path)!==String(t)})),this},this.resolve=j,this.navigate=x,this.navigateByName=function(t,n,e){var o=N(t,n);return null!==o&&(x(o,e),!0)},this.destroy=function(){this.routes=L=[],P&&window.removeEventListener("popstate",this.__popstateListener),this.destroyed=w=!0},this.notFound=function(t,n){return r._notFoundRoute=S("*",t,[e,n],"__NOT_FOUND__"),this},this.updatePageLinks=C,this.link=function(t){return"/"+a+"/"+s(t)},this.hooks=function(t){return e=t,this},this.extractGETParameters=function(t){return u(R(t))},this.lastResolved=function(){return p},this.generate=N,this.getLinkPath=function(t){return t.getAttribute("href")},this.match=function(t){var n={instance:r,currentLocationPath:t,navigateOptions:{},resolveOptions:o};return y(n,(function(){})),!!n.matches&&n.matches},this.matchLocation=function(t,n){var e={instance:r,currentLocationPath:n};return m(e,(function(){})),t=s(t),f(e.currentLocationPath,{name:t,path:t,handler:function(){},hooks:{}})||!1},this.getCurrentLocation=function(){return U(s(i(a)).replace(new RegExp("^"+a),""))},this.addBeforeHook=q.bind(this,"before"),this.addAfterHook=q.bind(this,"after"),this.addAlreadyHook=q.bind(this,"already"),this.addLeaveHook=q.bind(this,"leave"),this.getRoute=F,this._pathToMatchObject=U,this._clean=s,this._checkForAHash=R,this._setCurrent=function(t){return p=r.current=t},function(){P&&(this.__popstateListener=function(){j()},window.addEventListener("popstate",this.__popstateListener))}.call(this),C.call(this)}}},n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{}};return t[o](r,r.exports,e),r.exports}return e.d=(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e(783)})().default)); +define("Navigo.amd",[],(()=>(()=>{"use strict";var t={783:(t,n,e)=>{e.d(n,{default:()=>S});var o=/([:*])(\w+)/g,r=/\*/g,a=/\/\?/g;function i(t){return void 0===t&&(t="/"),d()?location.pathname+location.search+location.hash:t}function s(t){return t.replace(/\/+$/,"").replace(/^\/+/,"")}function c(t){return"string"==typeof t}function u(t){var n=s(t).split(/\?(.*)?$/);return[s(n[0]),n.slice(1).join("")]}function h(t){for(var n={},e=t.split("&"),o=0;o0?1===t.matches.length?t.matches[0]:t.matches:void 0)}})).concat([function(){return o()}])):o()}else o()}})),{},(function(){return n()})):n()}var A=[function(t,n){var e=t.instance.lastResolved();if(e&&e[0]&&e[0].route===t.match.route&&e[0].url===t.match.url&&e[0].queryString===t.match.queryString)return e.forEach((function(n){n.route.hooks&&n.route.hooks.already&&p(t.navigateOptions,"callHooks")&&n.route.hooks.already.forEach((function(n){return n(t.match)}))})),void n(!1);n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.before&&p(t.navigateOptions,"callHooks")?g(t.match.route.hooks.before.map((function(n){return function(e,o){return n(o,t.match)}})).concat([function(){return n()}])):n()},function(t,n){p(t.navigateOptions,"callHandler")&&t.match.route.handler(t.match),t.instance.updatePageLinks(),n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.after&&p(t.navigateOptions,"callHooks")&&t.match.route.hooks.after.forEach((function(n){return n(t.match)})),n()}],_=[P,function(t,n){var e=t.instance._notFoundRoute;if(e){t.notFoundHandled=!0;var o=u(t.currentLocationPath),r=o[0],a=o[1];e.path=s(r);var i={url:e.path,queryString:a,data:null,route:e,params:""!==a?h(a):null};t.matches=[i],t.match=i}n()},g.if((function(t){return t.notFoundHandled}),A,[function(t,n){t.resolveOptions&&!1!==t.resolveOptions.noMatchWarning&&void 0!==t.resolveOptions.noMatchWarning||console.warn('Navigo: "'+t.currentLocationPath+"\" didn't match any of the registered routes."),n()}]),function(t,n){t.instance._setCurrent(null),n()}];function R(){return(R=Object.assign||function(t){for(var n=1;n=0&&(t=!0===o.hash?t.split("#")[1]||"/":t.split("#")[0]),t}function S(t){return s(a+"/"+s(t))}function j(t,n,e,o){return t=c(t)?S(t):t,{name:o||s(String(t)),path:t,handler:n,hooks:v(e)}}function x(t,n){var e={instance:r,currentLocationPath:t?s(a)+"/"+s(t):void 0,navigateOptions:{},resolveOptions:H({},o,n)};return g([m,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,_)],e),!!e.matches&&e.matches}function C(t,n){t=s(a)+"/"+s(t);var e={instance:r,to:t,navigateOptions:n||{},resolveOptions:n&&n.resolveOptions?n.resolveOptions:o,currentLocationPath:R(t)};g([O,k,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,_),b],e)}function N(){if(A)return(A?[].slice.call(document.querySelectorAll("[data-navigo]")):[]).forEach((function(t){"false"!==t.getAttribute("data-navigo")&&"_blank"!==t.getAttribute("target")?t.hasListenerAttached||(t.hasListenerAttached=!0,t.navigoHandler=function(n){if((n.ctrlKey||n.metaKey)&&"a"===n.target.tagName.toLowerCase())return!1;var e=t.getAttribute("href");if(null==e)return!1;if(e.match(/^(http|https)/)&&"undefined"!=typeof URL)try{var o=new URL(e);e=o.pathname+o.search}catch(t){}var a=function(t){if(!t)return{};var n,e=t.split(","),o={};return e.forEach((function(t){var e=t.split(":").map((function(t){return t.replace(/(^ +| +$)/g,"")}));switch(e[0]){case"historyAPIMethod":o.historyAPIMethod=e[1];break;case"resolveOptionsStrategy":n||(n={}),n.strategy=e[1];break;case"resolveOptionsHash":n||(n={}),n.hash="true"===e[1];break;case"updateBrowserURL":case"callHandler":case"updateState":case"force":o[e[0]]="true"===e[1]}})),n&&(o.resolveOptions=n),o}(t.getAttribute("data-navigo-options"));w||(n.preventDefault(),n.stopPropagation(),r.navigate(s(e),a))},t.addEventListener("click",t.navigoHandler)):t.hasListenerAttached&&t.removeEventListener("click",t.navigoHandler)})),r}function U(t,n){var e=L.find((function(n){return n.name===t}));if(e){var o=e.path;if(n)for(var r in n)o=o.replace(":"+r,n[r]);return o.match(/^\//)?o:"/"+o}return null}function q(t){var n=u(s(t)),o=n[0],r=n[1],a=""===r?null:h(r);return{url:o,queryString:r,route:j(o,(function(){}),[e],o),data:null,params:a}}function F(t,n,e){return"string"==typeof n&&(n=I(n)),n?(n.hooks[t]||(n.hooks[t]=[]),n.hooks[t].push(e),function(){n.hooks[t]=n.hooks[t].filter((function(t){return t!==e}))}):(console.warn("Route doesn't exists: "+n),function(){})}function I(t){return"string"==typeof t?L.find((function(n){return n.name===S(t)})):L.find((function(n){return n.handler===t}))}t?a=s(t):console.warn('Navigo requires a root path in its constructor. If not provided will use "/" as default.'),this.root=a,this.routes=L,this.destroyed=w,this.current=p,this.on=function(t,n,o){var r=this;return"object"!=typeof t||t instanceof RegExp?("function"==typeof t&&(o=n,n=t,t=a),L.push(j(t,n,[e,o])),this):(Object.keys(t).forEach((function(n){if("function"==typeof t[n])r.on(n,t[n]);else{var o=t[n],a=o.uses,i=o.as,s=o.hooks;L.push(j(n,a,[e,s],i))}})),this)},this.off=function(t){return this.routes=L=L.filter((function(n){return c(t)?s(n.path)!==s(t):"function"==typeof t?t!==n.handler:String(n.path)!==String(t)})),this},this.resolve=x,this.navigate=C,this.navigateByName=function(t,n,e){var o=U(t,n);return null!==o&&(C(o,e),!0)},this.destroy=function(){this.routes=L=[],P&&window.removeEventListener("popstate",this.__popstateListener),this.destroyed=w=!0},this.notFound=function(t,n){return r._notFoundRoute=j("*",t,[e,n],"__NOT_FOUND__"),this},this.updatePageLinks=N,this.link=function(t){return"/"+a+"/"+s(t)},this.hooks=function(t){return e=t,this},this.extractGETParameters=function(t){return u(R(t))},this.lastResolved=function(){return p},this.generate=U,this.getLinkPath=function(t){return t.getAttribute("href")},this.match=function(t){var n={instance:r,currentLocationPath:t,navigateOptions:{},resolveOptions:o};return y(n,(function(){})),!!n.matches&&n.matches},this.matchLocation=function(t,n){var e={instance:r,currentLocationPath:n};return m(e,(function(){})),t=s(t),f(e.currentLocationPath,{name:t,path:t,handler:function(){},hooks:{}})||!1},this.getCurrentLocation=function(){return q(s(i(a)).replace(new RegExp("^"+a),""))},this.addBeforeHook=F.bind(this,"before"),this.addAfterHook=F.bind(this,"after"),this.addAlreadyHook=F.bind(this,"already"),this.addLeaveHook=F.bind(this,"leave"),this.getRoute=I,this._pathToMatchObject=q,this._clean=s,this._checkForAHash=R,this._setCurrent=function(t){return p=r.current=t},function(){P&&(this.__popstateListener=function(){x()},window.addEventListener("popstate",this.__popstateListener))}.call(this),N.call(this)}}},n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{}};return t[o](r,r.exports,e),r.exports}return e.d=(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e(783)})().default)); //# sourceMappingURL=navigo.amd.min.js.map \ No newline at end of file diff --git a/lib/navigo.amd.min.js.map b/lib/navigo.amd.min.js.map index 5635f07b..a458aa51 100644 --- a/lib/navigo.amd.min.js.map +++ b/lib/navigo.amd.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://Navigo.amd/./src/constants.ts","webpack://Navigo.amd/./src/utils.ts","webpack://Navigo.amd/./src/Q.ts","webpack://Navigo.amd/./src/middlewares/setLocationPath.ts","webpack://Navigo.amd/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo.amd/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo.amd/./src/middlewares/checkForForceOp.ts","webpack://Navigo.amd/./src/middlewares/updateBrowserURL.ts","webpack://Navigo.amd/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo.amd/./src/lifecycles.ts","webpack://Navigo.amd/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo.amd/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo.amd/./src/middlewares/callHandler.ts","webpack://Navigo.amd/./src/middlewares/checkForAfterHook.ts","webpack://Navigo.amd/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo.amd/./src/middlewares/errorOut.ts","webpack://Navigo.amd/./src/middlewares/flushCurrent.ts","webpack://Navigo.amd/./src/middlewares/processMatches.ts","webpack://Navigo.amd/./src/middlewares/updateState.ts","webpack://Navigo.amd/./src/index.ts","webpack://Navigo.amd/webpack/bootstrap","webpack://Navigo.amd/webpack/startup","webpack://Navigo.amd/webpack/runtime/define property getters","webpack://Navigo.amd/webpack/runtime/hasOwnProperty shorthand"],"names":["PARAMETER_REGEXP","WILDCARD_REGEXP","NOT_SURE_REGEXP","getCurrentEnvURL","fallback","windowAvailable","location","pathname","search","hash","clean","s","replace","isString","extractGETParameters","url","tmp","split","slice","join","parseQuery","queryString","query","pairs","i","length","pair","key","decodeURIComponent","Array","isArray","push","matchRoute","currentPath","route","pattern","current","GETParams","params","paramNames","path","full","dots","name","data","regexp","RegExp","match","names","reduce","value","index","regExpResultToParams","pushStateAvailable","window","history","pushState","undefinedOrTrue","obj","accumulateHooks","hooks","result","filter","h","forEach","type","Q","funcs","c","done","context","idx","next","splice","moveForward","_setLocationPath","currentLocationPath","instance","root","_checkForAHash","matchPathToRegisteredRoutes","routes","matches","resolveOptions","strategy","checkForDeprecationMethods","navigateOptions","console","warn","checkForForceOp","force","_setCurrent","_pathToMatchObject","to","if","condition","one","two","isWindowAvailable","isPushStateAvailable","updateBrowserURL","isItUsingHash","historyAPIMethod","stateObj","title","setTimeout","href","checkForLeaveHook","lastResolved","map","oldMatch","_","leaveLoopDone","leave","runHook","newLocationVSOldMatch","matchLocation","find","f","d","undefined","concat","foundLifecycle","already","before","handler","updatePageLinks","after","notFoundLifeCycle","notFoundRoute","_notFoundRoute","notFoundHandled","notFoundMatch","noMatchWarning","processMatches","nextMatch","updateState","Navigo","appRoute","genericHooks","DEFAULT_RESOLVE_OPTIONS","self","this","destroyed","indexOf","composePathWithRoot","createRoute","String","resolve","options","setLocationPath","navigate","call","document","querySelectorAll","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","URL","u","err","source","str","temp","v","parseNavigateOptions","preventDefault","stopPropagation","addEventListener","removeEventListener","generate","r","pathToMatchObject","addHook","func","getRoute","nameOrHandler","on","Object","keys","p","uses","as","off","what","navigateByName","destroy","__popstateListener","notFound","getLinkPath","currentLocation","getCurrentLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_clean","__webpack_module_cache__","__webpack_require__","moduleId","exports","module","__webpack_modules__","definition","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty"],"mappings":"2FAAO,IAAMA,EAAmB,eAEnBC,EAAkB,MAElBC,EAAkB,QCexB,SAASC,EAAiBC,GAC/B,YADuD,IAAxBA,MAAW,KACtCC,IACKC,SAASC,SAAWD,SAASE,OAASF,SAASG,KAEjDL,EAEF,SAASM,EAAMC,GACpB,OAAOA,EAAEC,QAAQ,OAAQ,IAAIA,QAAQ,OAAQ,IAExC,SAASC,EAASF,GACvB,MAAoB,iBAANA,EAcT,SAASG,EAAqBC,GACnC,IAAMC,EAAMN,EAAMK,GAAKE,MAAM,YAC7B,MAAO,CAACP,EAAMM,EAAI,IAAKA,EAAIE,MAAM,GAAGC,KAAK,KAEpC,SAASC,EAAWC,GAGzB,IAFA,IAAIC,EAAQ,GACRC,EAAQF,EAAYJ,MAAM,KACrBO,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CACrC,IAAIE,EAAOH,EAAMC,GAAGP,MAAM,KAC1B,GAAgB,KAAZS,EAAK,GAAW,CAClB,IAAIC,EAAMC,mBAAmBF,EAAK,IAC7BJ,EAAMK,IAGJE,MAAMC,QAAQR,EAAMK,MAAOL,EAAMK,GAAO,CAACL,EAAMK,KACpDL,EAAMK,GAAKI,KAAKH,mBAAmBF,EAAK,IAAM,MAH9CJ,EAAMK,GAAOC,mBAAmBF,EAAK,IAAM,KAOjD,OAAOJ,EAEF,SAASU,EAAWC,EAAqBC,GAA6B,IAIvEC,EAJuE,EAC9CrB,EAAqBJ,EAAMuB,IAAjDG,EADoE,KAC3DC,EAD2D,KAErEC,E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,KAAM,SACvCA,KAAK4D,eAAiBtB,EAAQoB,KAAK1D,KAAM,WACzCA,KAAK6D,aAAevB,EAAQoB,KAAK1D,KAAM,SACvCA,KAAKwC,SAAWA,EAChBxC,KAAKlD,mBAAqBuF,EAC1BrC,KAAK8D,OAASlM,EACdoI,KAAK/D,eAAiBA,EACtB+D,KAAKnD,YAAc,SAACvB,GAAD,OAAQhC,EAAUyG,EAAKzG,QAAUgC,GA/MpD,WACM+B,IACF2C,KAAKoD,mBAAqB,WACxB9C,KAEF9F,OAAOyH,iBAAiB,WAAYjC,KAAKoD,sBA4MtC1C,KAAKV,MACZhB,EAAgB0B,KAAKV,SC1YnB+D,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUC,QAG3C,IAAIC,EAASJ,EAAyBE,GAAY,CAGjDC,QAAS,IAOV,OAHAE,EAAoBH,GAAUE,EAAQA,EAAOD,QAASF,GAG/CG,EAAOD,QCjBf,OCFAF,EAAoBvF,EAAI,CAACyF,EAASG,KACjC,IAAI,IAAIxL,KAAOwL,EACXL,EAAoBM,EAAED,EAAYxL,KAASmL,EAAoBM,EAAEJ,EAASrL,IAC5E8J,OAAO4B,eAAeL,EAASrL,EAAK,CAAE2L,YAAY,EAAMC,IAAKJ,EAAWxL,MCJ3EmL,EAAoBM,EAAI,CAAC1J,EAAK8J,IAAS/B,OAAOgC,UAAUC,eAAelE,KAAK9F,EAAK8J,GFG1EV,EAAoB,M","file":"navigo.amd.min.js","sourcesContent":["export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n // console.log(current, regexp);\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path as string,\n context.currentLocationPath\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n d,\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: to ? `${clean(root)}/${clean(to)}` : undefined,\n navigateOptions: {},\n resolveOptions: options || DEFAULT_RESOLVE_OPTIONS,\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(783);\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://Navigo.amd/./src/constants.ts","webpack://Navigo.amd/./src/utils.ts","webpack://Navigo.amd/./src/Q.ts","webpack://Navigo.amd/./src/middlewares/setLocationPath.ts","webpack://Navigo.amd/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo.amd/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo.amd/./src/middlewares/checkForForceOp.ts","webpack://Navigo.amd/./src/middlewares/updateBrowserURL.ts","webpack://Navigo.amd/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo.amd/./src/lifecycles.ts","webpack://Navigo.amd/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo.amd/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo.amd/./src/middlewares/callHandler.ts","webpack://Navigo.amd/./src/middlewares/checkForAfterHook.ts","webpack://Navigo.amd/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo.amd/./src/middlewares/errorOut.ts","webpack://Navigo.amd/./src/middlewares/flushCurrent.ts","webpack://Navigo.amd/./src/middlewares/processMatches.ts","webpack://Navigo.amd/./src/middlewares/updateState.ts","webpack://Navigo.amd/./src/index.ts","webpack://Navigo.amd/webpack/bootstrap","webpack://Navigo.amd/webpack/startup","webpack://Navigo.amd/webpack/runtime/define property getters","webpack://Navigo.amd/webpack/runtime/hasOwnProperty shorthand"],"names":["PARAMETER_REGEXP","WILDCARD_REGEXP","NOT_SURE_REGEXP","getCurrentEnvURL","fallback","windowAvailable","location","pathname","search","hash","clean","s","replace","isString","extractGETParameters","url","tmp","split","slice","join","parseQuery","queryString","query","pairs","i","length","pair","key","decodeURIComponent","Array","isArray","push","matchRoute","currentPath","route","pattern","current","GETParams","params","paramNames","path","full","dots","name","data","regexp","RegExp","match","names","reduce","value","index","regExpResultToParams","pushStateAvailable","window","history","pushState","undefinedOrTrue","obj","accumulateHooks","hooks","result","filter","h","forEach","type","Q","funcs","c","done","context","idx","next","splice","moveForward","_setLocationPath","currentLocationPath","instance","root","_checkForAHash","matchPathToRegisteredRoutes","routes","matches","resolveOptions","strategy","checkForDeprecationMethods","navigateOptions","console","warn","checkForForceOp","force","_setCurrent","_pathToMatchObject","to","if","condition","one","two","isWindowAvailable","isPushStateAvailable","updateBrowserURL","isItUsingHash","historyAPIMethod","stateObj","title","setTimeout","href","checkForLeaveHook","lastResolved","map","oldMatch","_","leaveLoopDone","leave","runHook","newLocationVSOldMatch","matchLocation","find","f","d","undefined","concat","foundLifecycle","already","before","handler","updatePageLinks","after","notFoundLifeCycle","notFoundRoute","_notFoundRoute","notFoundHandled","notFoundMatch","noMatchWarning","processMatches","nextMatch","updateState","Navigo","appRoute","genericHooks","DEFAULT_RESOLVE_OPTIONS","self","this","destroyed","indexOf","composePathWithRoot","createRoute","String","resolve","options","setLocationPath","navigate","call","document","querySelectorAll","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","URL","u","err","source","str","temp","v","parseNavigateOptions","preventDefault","stopPropagation","addEventListener","removeEventListener","generate","r","pathToMatchObject","addHook","func","getRoute","nameOrHandler","on","Object","keys","p","uses","as","off","what","navigateByName","destroy","__popstateListener","notFound","getLinkPath","currentLocation","getCurrentLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_clean","__webpack_module_cache__","__webpack_require__","moduleId","exports","module","__webpack_modules__","definition","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty"],"mappings":"2FAAO,IAAMA,EAAmB,eAEnBC,EAAkB,MAElBC,EAAkB,QCexB,SAASC,EAAiBC,GAC/B,YADuD,IAAxBA,MAAW,KACtCC,IACKC,SAASC,SAAWD,SAASE,OAASF,SAASG,KAEjDL,EAEF,SAASM,EAAMC,GACpB,OAAOA,EAAEC,QAAQ,OAAQ,IAAIA,QAAQ,OAAQ,IAExC,SAASC,EAASF,GACvB,MAAoB,iBAANA,EAcT,SAASG,EAAqBC,GACnC,IAAMC,EAAMN,EAAMK,GAAKE,MAAM,YAC7B,MAAO,CAACP,EAAMM,EAAI,IAAKA,EAAIE,MAAM,GAAGC,KAAK,KAEpC,SAASC,EAAWC,GAGzB,IAFA,IAAIC,EAAQ,GACRC,EAAQF,EAAYJ,MAAM,KACrBO,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CACrC,IAAIE,EAAOH,EAAMC,GAAGP,MAAM,KAC1B,GAAgB,KAAZS,EAAK,GAAW,CAClB,IAAIC,EAAMC,mBAAmBF,EAAK,IAC7BJ,EAAMK,IAGJE,MAAMC,QAAQR,EAAMK,MAAOL,EAAMK,GAAO,CAACL,EAAMK,KACpDL,EAAMK,GAAKI,KAAKH,mBAAmBF,EAAK,IAAM,MAH9CJ,EAAMK,GAAOC,mBAAmBF,EAAK,IAAM,KAOjD,OAAOJ,EAEF,SAASU,EAAWC,EAAqBC,GAA6B,IAIvEC,EAJuE,EAC9CrB,EAAqBJ,EAAMuB,IAAjDG,EADoE,KAC3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AK2D,aAAerB,EAAQoB,KAAK1D,KAAM,SACvCA,KAAK4D,eAAiBtB,EAAQoB,KAAK1D,KAAM,WACzCA,KAAK6D,aAAevB,EAAQoB,KAAK1D,KAAM,SACvCA,KAAKwC,SAAWA,EAChBxC,KAAKlD,mBAAqBuF,EAC1BrC,KAAK8D,OAASlM,EACdoI,KAAK/D,eAAiBA,EACtB+D,KAAKnD,YAAc,SAACvB,GAAD,OAAQhC,EAAUyG,EAAKzG,QAAUgC,GA/MpD,WACM+B,IACF2C,KAAKoD,mBAAqB,WACxB9C,KAEF9F,OAAOyH,iBAAiB,WAAYjC,KAAKoD,sBA4MtC1C,KAAKV,MACZhB,EAAgB0B,KAAKV,SC1YnB+D,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUC,QAG3C,IAAIC,EAASJ,EAAyBE,GAAY,CAGjDC,QAAS,IAOV,OAHAE,EAAoBH,GAAUE,EAAQA,EAAOD,QAASF,GAG/CG,EAAOD,QCjBf,OCFAF,EAAoBvF,EAAI,CAACyF,EAASG,KACjC,IAAI,IAAIxL,KAAOwL,EACXL,EAAoBM,EAAED,EAAYxL,KAASmL,EAAoBM,EAAEJ,EAASrL,IAC5E8J,OAAO4B,eAAeL,EAASrL,EAAK,CAAE2L,YAAY,EAAMC,IAAKJ,EAAWxL,MCJ3EmL,EAAoBM,EAAI,CAAC1J,EAAK8J,IAAS/B,OAAOgC,UAAUC,eAAelE,KAAK9F,EAAK8J,GFG1EV,EAAoB,M","file":"navigo.amd.min.js","sourcesContent":["export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n // console.log(current, regexp);\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path as string,\n context.currentLocationPath\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n d,\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: to ? `${clean(root)}/${clean(to)}` : undefined,\n navigateOptions: {},\n resolveOptions: { ...DEFAULT_RESOLVE_OPTIONS, ...options },\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(783);\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/navigo.js b/lib/navigo.js index dec09aaa..3da5dfed 100644 --- a/lib/navigo.js +++ b/lib/navigo.js @@ -108,6 +108,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _middlewares_updateBrowserURL__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./middlewares/updateBrowserURL */ "./src/middlewares/updateBrowserURL.ts"); /* harmony import */ var _middlewares_processMatches__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./middlewares/processMatches */ "./src/middlewares/processMatches.ts"); /* harmony import */ var _lifecycles__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./lifecycles */ "./src/lifecycles.ts"); +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + @@ -196,7 +198,7 @@ function Navigo(appRoute, resolveOptions) { instance: self, currentLocationPath: to ? (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clean)(root) + "/" + (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clean)(to) : undefined, navigateOptions: {}, - resolveOptions: options || DEFAULT_RESOLVE_OPTIONS + resolveOptions: _extends({}, DEFAULT_RESOLVE_OPTIONS, options) }; (0,_Q__WEBPACK_IMPORTED_MODULE_1__.default)([_middlewares_setLocationPath__WEBPACK_IMPORTED_MODULE_2__.default, _middlewares_matchPathToRegisteredRoutes__WEBPACK_IMPORTED_MODULE_3__.default, _Q__WEBPACK_IMPORTED_MODULE_1__.default.if(function (_ref) { var matches = _ref.matches; diff --git a/lib/navigo.js.map b/lib/navigo.js.map index 9da40e97..ba5d3317 100644 --- a/lib/navigo.js.map +++ b/lib/navigo.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://Navigo/webpack/universalModuleDefinition","webpack://Navigo/./src/Q.ts","webpack://Navigo/./src/constants.ts","webpack://Navigo/./src/index.ts","webpack://Navigo/./src/lifecycles.ts","webpack://Navigo/./src/middlewares/callHandler.ts","webpack://Navigo/./src/middlewares/checkForAfterHook.ts","webpack://Navigo/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo/./src/middlewares/checkForForceOp.ts","webpack://Navigo/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo/./src/middlewares/errorOut.ts","webpack://Navigo/./src/middlewares/flushCurrent.ts","webpack://Navigo/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo/./src/middlewares/processMatches.ts","webpack://Navigo/./src/middlewares/setLocationPath.ts","webpack://Navigo/./src/middlewares/updateBrowserURL.ts","webpack://Navigo/./src/middlewares/updateState.ts","webpack://Navigo/./src/utils.ts","webpack://Navigo/webpack/bootstrap","webpack://Navigo/webpack/runtime/define property getters","webpack://Navigo/webpack/runtime/hasOwnProperty shorthand","webpack://Navigo/webpack/runtime/make namespace object","webpack://Navigo/webpack/startup"],"names":["Q","funcs","c","done","context","idx","next","Array","isArray","splice","moveForward","if","condition","one","two","PARAMETER_REGEXP","REPLACE_VARIABLE_REGEXP","WILDCARD_REGEXP","REPLACE_WILDCARD","NOT_SURE_REGEXP","REPLACE_NOT_SURE","START_BY_SLASH_REGEXP","MATCH_REGEXP_FLAGS","Navigo","appRoute","resolveOptions","DEFAULT_RESOLVE_OPTIONS","strategy","hash","noMatchWarning","self","root","current","routes","destroyed","genericHooks","isPushStateAvailable","pushStateAvailable","isWindowAvailable","windowAvailable","console","warn","clean","_checkForAHash","url","indexOf","split","composePathWithRoot","path","createRoute","handler","hooks","name","isString","String","accumulateHooks","on","RegExp","Object","keys","forEach","p","uses","as","push","resolve","to","options","instance","currentLocationPath","undefined","navigateOptions","setLocationPath","matchPathToRegisteredRoutes","matches","length","processMatches","notFoundLifeCycle","navigate","checkForDeprecationMethods","checkForForceOp","updateBrowserURL","navigateByName","data","generate","off","what","filter","r","isFunction","listen","__popstateListener","window","addEventListener","destroy","removeEventListener","notFound","_notFoundRoute","updatePageLinks","findLinks","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","location","match","URL","u","pathname","search","err","parseNavigateOptions","preventDefault","stopPropagation","slice","call","document","querySelectorAll","setGenericHooks","lastResolved","route","find","result","key","replace","getLinkPath","pathToMatchObject","extractGETParameters","queryString","params","parseQuery","getCurrentLocation","getCurrentEnvURL","directMatchWithRegisteredRoutes","directMatchWithLocation","currentLocation","matchRoute","addHook","type","func","getRoute","f","nameOrHandler","matchLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_pathToMatchObject","_clean","_setCurrent","foundLifecycle","checkForAlreadyHook","checkForBeforeHook","callHandler","checkForAfterHook","checkForLeaveHook","checkForNotFoundHandler","notFoundHandled","errorOut","flushCurrent","undefinedOrTrue","_checkForAfterHook","after","already","before","map","beforeHookInternal","_","d","concat","force","oldMatch","leaveLoopDone","leave","runHook","newLocationVSOldMatch","someOfTheLastOnesMatch","notFoundRoute","notFoundMatch","i","nextMatch","updateState","end","_setLocationPath","value","isItUsingHash","history","historyAPIMethod","stateObj","title","setTimeout","tmp","href","fallback","s","regExpResultToParams","names","reduce","index","decodeURIComponent","join","query","pairs","pair","currentPath","GETParams","paramNames","pattern","full","dots","regexp","pushState","obj","source","str","temp","v","h"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;ACLe,SAASA,CAAT,CACbC,KADa,EAEbC,CAFa,EAGbC,IAHa,EAIb;AACA,MAAMC,OAAO,GAAGF,CAAC,IAAI,EAArB;AACA,MAAIG,GAAG,GAAG,CAAV;;AAEA,GAAC,SAASC,IAAT,GAAgB;AACf,QAAI,CAACL,KAAK,CAACI,GAAD,CAAV,EAAiB;AACf,UAAIF,IAAJ,EAAU;AACRA,YAAI,CAACC,OAAD,CAAJ;AACD;;AACD;AACD;;AACD,QAAIG,KAAK,CAACC,OAAN,CAAcP,KAAK,CAACI,GAAD,CAAnB,CAAJ,EAA+B;AAC7BJ,WAAK,CAACQ,MAAN,OAAAR,KAAK,GACHI,GADG,EAEH,CAFG,SAGCJ,KAAK,CAACI,GAAD,CAAL,CAAW,CAAX,EAAcD,OAAd,IAAyBH,KAAK,CAACI,GAAD,CAAL,CAAW,CAAX,CAAzB,GAAyCJ,KAAK,CAACI,GAAD,CAAL,CAAW,CAAX,CAH1C,EAAL;AAKAC,UAAI;AACL,KAPD,MAOO;AACL;AACA;AACCL,WAAK,CAACI,GAAD,CAAN,CAAyBD,OAAzB,EAAkC,UAACM,WAAD,EAAiB;AACjD,YAAI,OAAOA,WAAP,KAAuB,WAAvB,IAAsCA,WAAW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UAACqK,CAAD,EAAO;AACd,KAAC,QAAD,EAAW,OAAX,EAAoB,SAApB,EAA+B,OAA/B,EAAwCrK,OAAxC,CAAgD,UAACoF,IAAD,EAAU;AACxD,UAAIiF,CAAC,CAACjF,IAAD,CAAL,EAAa;AACX,YAAI,CAAChB,MAAM,CAACgB,IAAD,CAAX,EAAmBhB,MAAM,CAACgB,IAAD,CAAN,GAAe,EAAf;AACnBhB,cAAM,CAACgB,IAAD,CAAN,CAAahF,IAAb,CAAkBiK,CAAC,CAACjF,IAAD,CAAnB;AACD;AACF,KALD;AAMD,GATH;AAUA,SAAOhB,MAAP;AACD,C;;;;;;UC5KD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA;WACA,wCAAwC,yCAAyC;WACjF;WACA;WACA,E;;;;;WCPA,sF;;;;;WCAA;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;UCNA;UACA;UACA;UACA","file":"navigo.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Navigo\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Navigo\"] = factory();\n\telse\n\t\troot[\"Navigo\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: to ? `${clean(root)}/${clean(to)}` : undefined,\n navigateOptions: {},\n resolveOptions: options || DEFAULT_RESOLVE_OPTIONS,\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path as string,\n context.currentLocationPath\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n d,\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n // console.log(current, regexp);\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/index.ts\");\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://Navigo/webpack/universalModuleDefinition","webpack://Navigo/./src/Q.ts","webpack://Navigo/./src/constants.ts","webpack://Navigo/./src/index.ts","webpack://Navigo/./src/lifecycles.ts","webpack://Navigo/./src/middlewares/callHandler.ts","webpack://Navigo/./src/middlewares/checkForAfterHook.ts","webpack://Navigo/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo/./src/middlewares/checkForForceOp.ts","webpack://Navigo/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo/./src/middlewares/errorOut.ts","webpack://Navigo/./src/middlewares/flushCurrent.ts","webpack://Navigo/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo/./src/middlewares/processMatches.ts","webpack://Navigo/./src/middlewares/setLocationPath.ts","webpack://Navigo/./src/middlewares/updateBrowserURL.ts","webpack://Navigo/./src/middlewares/updateState.ts","webpack://Navigo/./src/utils.ts","webpack://Navigo/webpack/bootstrap","webpack://Navigo/webpack/runtime/define property getters","webpack://Navigo/webpack/runtime/hasOwnProperty shorthand","webpack://Navigo/webpack/runtime/make namespace object","webpack://Navigo/webpack/startup"],"names":["Q","funcs","c","done","context","idx","next","Array","isArray","splice","moveForward","if","condition","one","two","PARAMETER_REGEXP","REPLACE_VARIABLE_REGEXP","WILDCARD_REGEXP","REPLACE_WILDCARD","NOT_SURE_REGEXP","REPLACE_NOT_SURE","START_BY_SLASH_REGEXP","MATCH_REGEXP_FLAGS","Navigo","appRoute","resolveOptions","DEFAULT_RESOLVE_OPTIONS","strategy","hash","noMatchWarning","self","root","current","routes","destroyed","genericHooks","isPushStateAvailable","pushStateAvailable","isWindowAvailable","windowAvailable","console","warn","clean","_checkForAHash","url","indexOf","split","composePathWithRoot","path","createRoute","handler","hooks","name","isString","String","accumulateHooks","on","RegExp","Object","keys","forEach","p","uses","as","push","resolve","to","options","instance","currentLocationPath","undefined","navigateOptions","setLocationPath","matchPathToRegisteredRoutes","matches","length","processMatches","notFoundLifeCycle","navigate","checkForDeprecationMethods","checkForForceOp","updateBrowserURL","navigateByName","data","generate","off","what","filter","r","isFunction","listen","__popstateListener","window","addEventListener","destroy","removeEventListener","notFound","_notFoundRoute","updatePageLinks","findLinks","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","location","match","URL","u","pathname","search","err","parseNavigateOptions","preventDefault","stopPropagation","slice","call","document","querySelectorAll","setGenericHooks","lastResolved","route","find","result","key","replace","getLinkPath","pathToMatchObject","extractGETParameters","queryString","params","parseQuery","getCurrentLocation","getCurrentEnvURL","directMatchWithRegisteredRoutes","directMatchWithLocation","currentLocation","matchRoute","addHook","type","func","getRoute","f","nameOrHandler","matchLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_pathToMatchObject","_clean","_setCurrent","foundLifecycle","checkForAlreadyHook","checkForBeforeHook","callHandler","checkForAfterHook","checkForLeaveHook","checkForNotFoundHandler","notFoundHandled","errorOut","flushCurrent","undefinedOrTrue","_checkForAfterHook","after","already","before","map","beforeHookInternal","_","d","concat","force","oldMatch","leaveLoopDone","leave","runHook","newLocationVSOldMatch","someOfTheLastOnesMatch","notFoundRoute","notFoundMatch","i","nextMatch","updateState","end","_setLocationPath","value","isItUsingHash","history","historyAPIMethod","stateObj","title","setTimeout","tmp","href","fallback","s","regExpResultToParams","names","reduce","index","decodeURIComponent","join","query","pairs","pair","currentPath","GETParams","paramNames","pattern","full","dots","regexp","pushState","obj","source","str","temp","v","h"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;ACLe,SAASA,CAAT,CACbC,KADa,EAEbC,CAFa,EAGbC,IAHa,EAIb;AACA,MAAMC,OAAO,GAAGF,CAAC,IAAI,EAArB;AACA,MAAIG,GAAG,GAAG,CAAV;;AAEA,GAAC,SAASC,IAAT,GAAgB;AACf,QAAI,CAACL,KAAK,CAACI,GAAD,CAAV,EAAiB;AACf,UAAIF,IAAJ,EAAU;AACRA,YAAI,CAACC,OAAD,CAAJ;AACD;;AACD;AACD;;AACD,QAAIG,KAAK,CAACC,OAAN,CAAcP,KAAK,CAACI,GAAD,CAAnB,CAAJ,EAA+B;AAC7BJ,WAAK,CAACQ,MAAN,OAAAR,KAAK,GACHI,GADG,EAEH,CAFG,SAGCJ,KAAK,CAACI,GAAD,CAAL,CAAW,CAAX,EAAcD,OAAd,IAAyBH,KAAK,CAACI,GAAD,CAAL,CAAW,C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rC,eAAT,CACLJ,KADK,EAEL6E,MAFK,EAGc;AAAA,MAFnB7E,KAEmB;AAFnBA,SAEmB,GAFX,EAEW;AAAA;;AAAA,MADnB6E,MACmB;AADnBA,UACmB,GADS,EACT;AAAA;;AACnB7E,OAAK,CACFoC,MADH,CACU,UAAC0I,CAAD;AAAA,WAAOA,CAAP;AAAA,GADV,EAEGrK,OAFH,CAEW,UAACqK,CAAD,EAAO;AACd,KAAC,QAAD,EAAW,OAAX,EAAoB,SAApB,EAA+B,OAA/B,EAAwCrK,OAAxC,CAAgD,UAACoF,IAAD,EAAU;AACxD,UAAIiF,CAAC,CAACjF,IAAD,CAAL,EAAa;AACX,YAAI,CAAChB,MAAM,CAACgB,IAAD,CAAX,EAAmBhB,MAAM,CAACgB,IAAD,CAAN,GAAe,EAAf;AACnBhB,cAAM,CAACgB,IAAD,CAAN,CAAahF,IAAb,CAAkBiK,CAAC,CAACjF,IAAD,CAAnB;AACD;AACF,KALD;AAMD,GATH;AAUA,SAAOhB,MAAP;AACD,C;;;;;;UC5KD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA;WACA,wCAAwC,yCAAyC;WACjF;WACA;WACA,E;;;;;WCPA,sF;;;;;WCAA;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;UCNA;UACA;UACA;UACA","file":"navigo.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Navigo\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Navigo\"] = factory();\n\telse\n\t\troot[\"Navigo\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: to ? `${clean(root)}/${clean(to)}` : undefined,\n navigateOptions: {},\n resolveOptions: { ...DEFAULT_RESOLVE_OPTIONS, ...options },\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path as string,\n context.currentLocationPath\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n d,\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n // console.log(current, regexp);\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/index.ts\");\n"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/navigo.min.js b/lib/navigo.min.js index 355dae60..17274406 100644 --- a/lib/navigo.min.js +++ b/lib/navigo.min.js @@ -1,2 +1,2 @@ -!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("Navigo",[],n):"object"==typeof exports?exports.Navigo=n():t.Navigo=n()}("undefined"!=typeof self?self:this,(function(){return(()=>{"use strict";var t={783:(t,n,e)=>{e.d(n,{default:()=>H});var o=/([:*])(\w+)/g,r=/\*/g,a=/\/\?/g;function i(t){return void 0===t&&(t="/"),d()?location.pathname+location.search+location.hash:t}function s(t){return t.replace(/\/+$/,"").replace(/^\/+/,"")}function c(t){return"string"==typeof t}function u(t){var n=s(t).split(/\?(.*)?$/);return[s(n[0]),n.slice(1).join("")]}function h(t){for(var n={},e=t.split("&"),o=0;o0?1===t.matches.length?t.matches[0]:t.matches:void 0)}})).concat([function(){return o()}])):o()}else o()}})),{},(function(){return n()})):n()}var A=[function(t,n){var e=t.instance.lastResolved();if(e&&e[0]&&e[0].route===t.match.route&&e[0].url===t.match.url&&e[0].queryString===t.match.queryString)return e.forEach((function(n){n.route.hooks&&n.route.hooks.already&&p(t.navigateOptions,"callHooks")&&n.route.hooks.already.forEach((function(n){return n(t.match)}))})),void n(!1);n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.before&&p(t.navigateOptions,"callHooks")?g(t.match.route.hooks.before.map((function(n){return function(e,o){return n(o,t.match)}})).concat([function(){return n()}])):n()},function(t,n){p(t.navigateOptions,"callHandler")&&t.match.route.handler(t.match),t.instance.updatePageLinks(),n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.after&&p(t.navigateOptions,"callHooks")&&t.match.route.hooks.after.forEach((function(n){return n(t.match)})),n()}],_=[P,function(t,n){var e=t.instance._notFoundRoute;if(e){t.notFoundHandled=!0;var o=u(t.currentLocationPath),r=o[0],a=o[1];e.path=s(r);var i={url:e.path,queryString:a,data:null,route:e,params:""!==a?h(a):null};t.matches=[i],t.match=i}n()},g.if((function(t){return t.notFoundHandled}),A,[function(t,n){t.resolveOptions&&!1!==t.resolveOptions.noMatchWarning&&void 0!==t.resolveOptions.noMatchWarning||console.warn('Navigo: "'+t.currentLocationPath+"\" didn't match any of the registered routes."),n()}]),function(t,n){t.instance._setCurrent(null),n()}];function R(){return(R=Object.assign||function(t){for(var n=1;n=0&&(t=!0===o.hash?t.split("#")[1]||"/":t.split("#")[0]),t}function H(t){return s(a+"/"+s(t))}function S(t,n,e,o){return t=c(t)?H(t):t,{name:o||s(String(t)),path:t,handler:n,hooks:v(e)}}function x(t,n){var e={instance:r,currentLocationPath:t?s(a)+"/"+s(t):void 0,navigateOptions:{},resolveOptions:n||o};return g([m,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,_)],e),!!e.matches&&e.matches}function j(t,n){t=s(a)+"/"+s(t);var e={instance:r,to:t,navigateOptions:n||{},resolveOptions:n&&n.resolveOptions?n.resolveOptions:o,currentLocationPath:R(t)};g([O,k,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,_),w],e)}function N(){if(A)return(A?[].slice.call(document.querySelectorAll("[data-navigo]")):[]).forEach((function(t){"false"!==t.getAttribute("data-navigo")&&"_blank"!==t.getAttribute("target")?t.hasListenerAttached||(t.hasListenerAttached=!0,t.navigoHandler=function(n){if((n.ctrlKey||n.metaKey)&&"a"===n.target.tagName.toLowerCase())return!1;var e=t.getAttribute("href");if(null==e)return!1;if(e.match(/^(http|https)/)&&"undefined"!=typeof URL)try{var o=new URL(e);e=o.pathname+o.search}catch(t){}var a=function(t){if(!t)return{};var n,e=t.split(","),o={};return e.forEach((function(t){var e=t.split(":").map((function(t){return t.replace(/(^ +| +$)/g,"")}));switch(e[0]){case"historyAPIMethod":o.historyAPIMethod=e[1];break;case"resolveOptionsStrategy":n||(n={}),n.strategy=e[1];break;case"resolveOptionsHash":n||(n={}),n.hash="true"===e[1];break;case"updateBrowserURL":case"callHandler":case"updateState":case"force":o[e[0]]="true"===e[1]}})),n&&(o.resolveOptions=n),o}(t.getAttribute("data-navigo-options"));b||(n.preventDefault(),n.stopPropagation(),r.navigate(s(e),a))},t.addEventListener("click",t.navigoHandler)):t.hasListenerAttached&&t.removeEventListener("click",t.navigoHandler)})),r}function C(t,n){var e=L.find((function(n){return n.name===t}));if(e){var o=e.path;if(n)for(var r in n)o=o.replace(":"+r,n[r]);return o.match(/^\//)?o:"/"+o}return null}function U(t){var n=u(s(t)),o=n[0],r=n[1],a=""===r?null:h(r);return{url:o,queryString:r,route:S(o,(function(){}),[e],o),data:null,params:a}}function q(t,n,e){return"string"==typeof n&&(n=F(n)),n?(n.hooks[t]||(n.hooks[t]=[]),n.hooks[t].push(e),function(){n.hooks[t]=n.hooks[t].filter((function(t){return t!==e}))}):(console.warn("Route doesn't exists: "+n),function(){})}function F(t){return"string"==typeof t?L.find((function(n){return n.name===H(t)})):L.find((function(n){return n.handler===t}))}t?a=s(t):console.warn('Navigo requires a root path in its constructor. If not provided will use "/" as default.'),this.root=a,this.routes=L,this.destroyed=b,this.current=p,this.on=function(t,n,o){var r=this;return"object"!=typeof t||t instanceof RegExp?("function"==typeof t&&(o=n,n=t,t=a),L.push(S(t,n,[e,o])),this):(Object.keys(t).forEach((function(n){if("function"==typeof t[n])r.on(n,t[n]);else{var o=t[n],a=o.uses,i=o.as,s=o.hooks;L.push(S(n,a,[e,s],i))}})),this)},this.off=function(t){return this.routes=L=L.filter((function(n){return c(t)?s(n.path)!==s(t):"function"==typeof t?t!==n.handler:String(n.path)!==String(t)})),this},this.resolve=x,this.navigate=j,this.navigateByName=function(t,n,e){var o=C(t,n);return null!==o&&(j(o,e),!0)},this.destroy=function(){this.routes=L=[],P&&window.removeEventListener("popstate",this.__popstateListener),this.destroyed=b=!0},this.notFound=function(t,n){return r._notFoundRoute=S("*",t,[e,n],"__NOT_FOUND__"),this},this.updatePageLinks=N,this.link=function(t){return"/"+a+"/"+s(t)},this.hooks=function(t){return e=t,this},this.extractGETParameters=function(t){return u(R(t))},this.lastResolved=function(){return p},this.generate=C,this.getLinkPath=function(t){return t.getAttribute("href")},this.match=function(t){var n={instance:r,currentLocationPath:t,navigateOptions:{},resolveOptions:o};return y(n,(function(){})),!!n.matches&&n.matches},this.matchLocation=function(t,n){var e={instance:r,currentLocationPath:n};return m(e,(function(){})),t=s(t),f(e.currentLocationPath,{name:t,path:t,handler:function(){},hooks:{}})||!1},this.getCurrentLocation=function(){return U(s(i(a)).replace(new RegExp("^"+a),""))},this.addBeforeHook=q.bind(this,"before"),this.addAfterHook=q.bind(this,"after"),this.addAlreadyHook=q.bind(this,"already"),this.addLeaveHook=q.bind(this,"leave"),this.getRoute=F,this._pathToMatchObject=U,this._clean=s,this._checkForAHash=R,this._setCurrent=function(t){return p=r.current=t},function(){P&&(this.__popstateListener=function(){x()},window.addEventListener("popstate",this.__popstateListener))}.call(this),N.call(this)}}},n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{}};return t[o](r,r.exports,e),r.exports}return e.d=(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e(783)})().default})); +!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("Navigo",[],n):"object"==typeof exports?exports.Navigo=n():t.Navigo=n()}("undefined"!=typeof self?self:this,(function(){return(()=>{"use strict";var t={783:(t,n,e)=>{e.d(n,{default:()=>j});var o=/([:*])(\w+)/g,r=/\*/g,a=/\/\?/g;function i(t){return void 0===t&&(t="/"),d()?location.pathname+location.search+location.hash:t}function s(t){return t.replace(/\/+$/,"").replace(/^\/+/,"")}function c(t){return"string"==typeof t}function u(t){var n=s(t).split(/\?(.*)?$/);return[s(n[0]),n.slice(1).join("")]}function h(t){for(var n={},e=t.split("&"),o=0;o0?1===t.matches.length?t.matches[0]:t.matches:void 0)}})).concat([function(){return o()}])):o()}else o()}})),{},(function(){return n()})):n()}var A=[function(t,n){var e=t.instance.lastResolved();if(e&&e[0]&&e[0].route===t.match.route&&e[0].url===t.match.url&&e[0].queryString===t.match.queryString)return e.forEach((function(n){n.route.hooks&&n.route.hooks.already&&p(t.navigateOptions,"callHooks")&&n.route.hooks.already.forEach((function(n){return n(t.match)}))})),void n(!1);n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.before&&p(t.navigateOptions,"callHooks")?g(t.match.route.hooks.before.map((function(n){return function(e,o){return n(o,t.match)}})).concat([function(){return n()}])):n()},function(t,n){p(t.navigateOptions,"callHandler")&&t.match.route.handler(t.match),t.instance.updatePageLinks(),n()},function(t,n){t.match.route.hooks&&t.match.route.hooks.after&&p(t.navigateOptions,"callHooks")&&t.match.route.hooks.after.forEach((function(n){return n(t.match)})),n()}],_=[P,function(t,n){var e=t.instance._notFoundRoute;if(e){t.notFoundHandled=!0;var o=u(t.currentLocationPath),r=o[0],a=o[1];e.path=s(r);var i={url:e.path,queryString:a,data:null,route:e,params:""!==a?h(a):null};t.matches=[i],t.match=i}n()},g.if((function(t){return t.notFoundHandled}),A,[function(t,n){t.resolveOptions&&!1!==t.resolveOptions.noMatchWarning&&void 0!==t.resolveOptions.noMatchWarning||console.warn('Navigo: "'+t.currentLocationPath+"\" didn't match any of the registered routes."),n()}]),function(t,n){t.instance._setCurrent(null),n()}];function R(){return(R=Object.assign||function(t){for(var n=1;n=0&&(t=!0===o.hash?t.split("#")[1]||"/":t.split("#")[0]),t}function j(t){return s(a+"/"+s(t))}function S(t,n,e,o){return t=c(t)?j(t):t,{name:o||s(String(t)),path:t,handler:n,hooks:v(e)}}function x(t,n){var e={instance:r,currentLocationPath:t?s(a)+"/"+s(t):void 0,navigateOptions:{},resolveOptions:H({},o,n)};return g([m,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,_)],e),!!e.matches&&e.matches}function N(t,n){t=s(a)+"/"+s(t);var e={instance:r,to:t,navigateOptions:n||{},resolveOptions:n&&n.resolveOptions?n.resolveOptions:o,currentLocationPath:R(t)};g([O,k,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,_),w],e)}function C(){if(A)return(A?[].slice.call(document.querySelectorAll("[data-navigo]")):[]).forEach((function(t){"false"!==t.getAttribute("data-navigo")&&"_blank"!==t.getAttribute("target")?t.hasListenerAttached||(t.hasListenerAttached=!0,t.navigoHandler=function(n){if((n.ctrlKey||n.metaKey)&&"a"===n.target.tagName.toLowerCase())return!1;var e=t.getAttribute("href");if(null==e)return!1;if(e.match(/^(http|https)/)&&"undefined"!=typeof URL)try{var o=new URL(e);e=o.pathname+o.search}catch(t){}var a=function(t){if(!t)return{};var n,e=t.split(","),o={};return e.forEach((function(t){var e=t.split(":").map((function(t){return t.replace(/(^ +| +$)/g,"")}));switch(e[0]){case"historyAPIMethod":o.historyAPIMethod=e[1];break;case"resolveOptionsStrategy":n||(n={}),n.strategy=e[1];break;case"resolveOptionsHash":n||(n={}),n.hash="true"===e[1];break;case"updateBrowserURL":case"callHandler":case"updateState":case"force":o[e[0]]="true"===e[1]}})),n&&(o.resolveOptions=n),o}(t.getAttribute("data-navigo-options"));b||(n.preventDefault(),n.stopPropagation(),r.navigate(s(e),a))},t.addEventListener("click",t.navigoHandler)):t.hasListenerAttached&&t.removeEventListener("click",t.navigoHandler)})),r}function U(t,n){var e=L.find((function(n){return n.name===t}));if(e){var o=e.path;if(n)for(var r in n)o=o.replace(":"+r,n[r]);return o.match(/^\//)?o:"/"+o}return null}function q(t){var n=u(s(t)),o=n[0],r=n[1],a=""===r?null:h(r);return{url:o,queryString:r,route:S(o,(function(){}),[e],o),data:null,params:a}}function F(t,n,e){return"string"==typeof n&&(n=I(n)),n?(n.hooks[t]||(n.hooks[t]=[]),n.hooks[t].push(e),function(){n.hooks[t]=n.hooks[t].filter((function(t){return t!==e}))}):(console.warn("Route doesn't exists: "+n),function(){})}function I(t){return"string"==typeof t?L.find((function(n){return n.name===j(t)})):L.find((function(n){return n.handler===t}))}t?a=s(t):console.warn('Navigo requires a root path in its constructor. If not provided will use "/" as default.'),this.root=a,this.routes=L,this.destroyed=b,this.current=p,this.on=function(t,n,o){var r=this;return"object"!=typeof t||t instanceof RegExp?("function"==typeof t&&(o=n,n=t,t=a),L.push(S(t,n,[e,o])),this):(Object.keys(t).forEach((function(n){if("function"==typeof t[n])r.on(n,t[n]);else{var o=t[n],a=o.uses,i=o.as,s=o.hooks;L.push(S(n,a,[e,s],i))}})),this)},this.off=function(t){return this.routes=L=L.filter((function(n){return c(t)?s(n.path)!==s(t):"function"==typeof t?t!==n.handler:String(n.path)!==String(t)})),this},this.resolve=x,this.navigate=N,this.navigateByName=function(t,n,e){var o=U(t,n);return null!==o&&(N(o,e),!0)},this.destroy=function(){this.routes=L=[],P&&window.removeEventListener("popstate",this.__popstateListener),this.destroyed=b=!0},this.notFound=function(t,n){return r._notFoundRoute=S("*",t,[e,n],"__NOT_FOUND__"),this},this.updatePageLinks=C,this.link=function(t){return"/"+a+"/"+s(t)},this.hooks=function(t){return e=t,this},this.extractGETParameters=function(t){return u(R(t))},this.lastResolved=function(){return p},this.generate=U,this.getLinkPath=function(t){return t.getAttribute("href")},this.match=function(t){var n={instance:r,currentLocationPath:t,navigateOptions:{},resolveOptions:o};return y(n,(function(){})),!!n.matches&&n.matches},this.matchLocation=function(t,n){var e={instance:r,currentLocationPath:n};return m(e,(function(){})),t=s(t),f(e.currentLocationPath,{name:t,path:t,handler:function(){},hooks:{}})||!1},this.getCurrentLocation=function(){return q(s(i(a)).replace(new RegExp("^"+a),""))},this.addBeforeHook=F.bind(this,"before"),this.addAfterHook=F.bind(this,"after"),this.addAlreadyHook=F.bind(this,"already"),this.addLeaveHook=F.bind(this,"leave"),this.getRoute=I,this._pathToMatchObject=q,this._clean=s,this._checkForAHash=R,this._setCurrent=function(t){return p=r.current=t},function(){P&&(this.__popstateListener=function(){x()},window.addEventListener("popstate",this.__popstateListener))}.call(this),C.call(this)}}},n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{}};return t[o](r,r.exports,e),r.exports}return e.d=(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e(783)})().default})); //# sourceMappingURL=navigo.min.js.map \ No newline at end of file diff --git a/lib/navigo.min.js.map b/lib/navigo.min.js.map index 4fd02278..421e984f 100644 --- a/lib/navigo.min.js.map +++ b/lib/navigo.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://Navigo/webpack/universalModuleDefinition","webpack://Navigo/./src/constants.ts","webpack://Navigo/./src/utils.ts","webpack://Navigo/./src/Q.ts","webpack://Navigo/./src/middlewares/setLocationPath.ts","webpack://Navigo/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo/./src/middlewares/checkForForceOp.ts","webpack://Navigo/./src/middlewares/updateBrowserURL.ts","webpack://Navigo/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo/./src/lifecycles.ts","webpack://Navigo/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo/./src/middlewares/callHandler.ts","webpack://Navigo/./src/middlewares/checkForAfterHook.ts","webpack://Navigo/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo/./src/middlewares/errorOut.ts","webpack://Navigo/./src/middlewares/flushCurrent.ts","webpack://Navigo/./src/middlewares/processMatches.ts","webpack://Navigo/./src/middlewares/updateState.ts","webpack://Navigo/./src/index.ts","webpack://Navigo/webpack/bootstrap","webpack://Navigo/webpack/startup","webpack://Navigo/webpack/runtime/define property getters","webpack://Navigo/webpack/runtime/hasOwnProperty shorthand"],"names":["root","factory","exports","module","define","amd","self","this","PARAMETER_REGEXP","WILDCARD_REGEXP","NOT_SURE_REGEXP","getCurrentEnvURL","fallback","windowAvailable","location","pathname","search","hash","clean","s","replace","isString","extractGETParameters","url","tmp","split","slice","join","parseQuery","queryString","query","pairs","i","length","pair","key","decodeURIComponent","Array","isArray","push","matchRoute","currentPath","route","pattern","current","GETParams","params","paramNames","path","full","dots","name","data","regexp","RegExp","match","names","reduce","value","index","regExpResultToParams","pushStateAvailable","window","history","pushState","undefinedOrTrue","obj","accumulateHooks","hooks","result","filter","h","forEach","type","Q","funcs","c","done","context","idx","next","splice","moveForward","_setLocationPath","currentLocationPath","instance","_checkForAHash","matchPathToRegisteredRoutes","routes","matches","resolveOptions","strategy","checkForDeprecationMethods","navigateOptions","console","warn","checkForForceOp","force","_setCurrent","_pathToMatchObject","to","if","condition","one","two","isWindowAvailable","isPushStateAvailable","updateBrowserURL","isItUsingHash","historyAPIMethod","stateObj","title","setTimeout","href","checkForLeaveHook","lastResolved","map","oldMatch","_","leaveLoopDone","leave","runHook","newLocationVSOldMatch","matchLocation","find","f","d","undefined","concat","foundLifecycle","already","before","handler","updatePageLinks","after","notFoundLifeCycle","notFoundRoute","_notFoundRoute","notFoundHandled","notFoundMatch","noMatchWarning","processMatches","nextMatch","updateState","Navigo","appRoute","genericHooks","DEFAULT_RESOLVE_OPTIONS","destroyed","indexOf","composePathWithRoot","createRoute","String","resolve","options","setLocationPath","navigate","call","document","querySelectorAll","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","URL","u","err","source","str","temp","v","parseNavigateOptions","preventDefault","stopPropagation","addEventListener","removeEventListener","generate","r","pathToMatchObject","addHook","func","getRoute","nameOrHandler","on","Object","keys","p","uses","as","off","what","navigateByName","destroy","__popstateListener","notFound","getLinkPath","currentLocation","getCurrentLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_clean","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__","definition","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,SAAU,GAAIH,GACK,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,IARnB,CASmB,oBAATK,KAAuBA,KAAOC,MAAM,WAC9C,M,+DCVO,IAAMC,EAA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AAOsH,iBAAiB,WAAY7K,KAAKgM,sBA4MtC1C,KAAKtJ,MACZ8H,EAAgBwB,KAAKtJ,SC1YnB2M,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUlN,QAG3C,IAAIC,EAAS+M,EAAyBE,GAAY,CAGjDlN,QAAS,IAOV,OAHAmN,EAAoBD,GAAUjN,EAAQA,EAAOD,QAASiN,GAG/ChN,EAAOD,QCjBf,OCFAiN,EAAoBrF,EAAI,CAAC5H,EAASoN,KACjC,IAAI,IAAInL,KAAOmL,EACXH,EAAoBI,EAAED,EAAYnL,KAASgL,EAAoBI,EAAErN,EAASiC,IAC5E2J,OAAO0B,eAAetN,EAASiC,EAAK,CAAEsL,YAAY,EAAMC,IAAKJ,EAAWnL,MCJ3EgL,EAAoBI,EAAI,CAACrJ,EAAKyJ,IAAS7B,OAAO8B,UAAUC,eAAehE,KAAK3F,EAAKyJ,GFG1ER,EAAoB,M","file":"navigo.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Navigo\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Navigo\"] = factory();\n\telse\n\t\troot[\"Navigo\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n // console.log(current, regexp);\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path as string,\n context.currentLocationPath\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n d,\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: to ? `${clean(root)}/${clean(to)}` : undefined,\n navigateOptions: {},\n resolveOptions: options || DEFAULT_RESOLVE_OPTIONS,\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(783);\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://Navigo/webpack/universalModuleDefinition","webpack://Navigo/./src/constants.ts","webpack://Navigo/./src/utils.ts","webpack://Navigo/./src/Q.ts","webpack://Navigo/./src/middlewares/setLocationPath.ts","webpack://Navigo/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo/./src/middlewares/checkForForceOp.ts","webpack://Navigo/./src/middlewares/updateBrowserURL.ts","webpack://Navigo/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo/./src/lifecycles.ts","webpack://Navigo/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo/./src/middlewares/callHandler.ts","webpack://Navigo/./src/middlewares/checkForAfterHook.ts","webpack://Navigo/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo/./src/middlewares/errorOut.ts","webpack://Navigo/./src/middlewares/flushCurrent.ts","webpack://Navigo/./src/middlewares/processMatches.ts","webpack://Navigo/./src/middlewares/updateState.ts","webpack://Navigo/./src/index.ts","webpack://Navigo/webpack/bootstrap","webpack://Navigo/webpack/startup","webpack://Navigo/webpack/runtime/define property getters","webpack://Navigo/webpack/runtime/hasOwnProperty shorthand"],"names":["root","factory","exports","module","define","amd","self","this","PARAMETER_REGEXP","WILDCARD_REGEXP","NOT_SURE_REGEXP","getCurrentEnvURL","fallback","windowAvailable","location","pathname","search","hash","clean","s","replace","isString","extractGETParameters","url","tmp","split","slice","join","parseQuery","queryString","query","pairs","i","length","pair","key","decodeURIComponent","Array","isArray","push","matchRoute","currentPath","route","pattern","current","GETParams","params","paramNames","path","full","dots","name","data","regexp","RegExp","match","names","reduce","value","index","regExpResultToParams","pushStateAvailable","window","history","pushState","undefinedOrTrue","obj","accumulateHooks","hooks","result","filter","h","forEach","type","Q","funcs","c","done","context","idx","next","splice","moveForward","_setLocationPath","currentLocationPath","instance","_checkForAHash","matchPathToRegisteredRoutes","routes","matches","resolveOptions","strategy","checkForDeprecationMethods","navigateOptions","console","warn","checkForForceOp","force","_setCurrent","_pathToMatchObject","to","if","condition","one","two","isWindowAvailable","isPushStateAvailable","updateBrowserURL","isItUsingHash","historyAPIMethod","stateObj","title","setTimeout","href","checkForLeaveHook","lastResolved","map","oldMatch","_","leaveLoopDone","leave","runHook","newLocationVSOldMatch","matchLocation","find","f","d","undefined","concat","foundLifecycle","already","before","handler","updatePageLinks","after","notFoundLifeCycle","notFoundRoute","_notFoundRoute","notFoundHandled","notFoundMatch","noMatchWarning","processMatches","nextMatch","updateState","Navigo","appRoute","genericHooks","DEFAULT_RESOLVE_OPTIONS","destroyed","indexOf","composePathWithRoot","createRoute","String","resolve","options","setLocationPath","navigate","call","document","querySelectorAll","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","URL","u","err","source","str","temp","v","parseNavigateOptions","preventDefault","stopPropagation","addEventListener","removeEventListener","generate","r","pathToMatchObject","addHook","func","getRoute","nameOrHandler","on","Object","keys","p","uses","as","off","what","navigateByName","destroy","__popstateListener","notFound","getLinkPath","currentLocation","getCurrentLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_clean","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__","definition","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,SAAU,GAAIH,GACK,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,IARnB,CASmB,oBAATK,KAAuBA,KAAOC,MAAM,WAC9C,M,+DCVO,IAAMC,EAAmB,eAEnBC,EAAkB,MAElBC,EAAkB,QCexB,SAASC,EAAiBC,GAC/B,YADuD,IAAxBA,MAAW,KACtCC,IACKC,SAASC,SAAWD,SAASE,OAASF,SAASG,KAEjDL,EAEF,SAASM,EAAMC,GACpB,OAAOA,EAAEC,QAAQ,OAAQ,IAAIA,QAAQ,OAAQ,IAExC,SAASC,EAASF,GACvB,MAAoB,iBAANA,EAcT,SAASG,EAAqBC,GACnC,IAAMC,EAAMN,EAAMK,GAAKE,MAAM,YAC7B,MAAO,CAACP,EAAMM,EAAI,IAAKA,EAAIE,MAAM,GAAGC,KAAK,KAEpC,SAASC,EAAWC,GAGzB,IAFA,IAAIC,EAAQ,GACRC,EAAQF,EAAYJ,MAAM,KACrBO,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CACrC,IAAIE,EAAOH,EAAMC,GAAGP,MAAM,KAC1B,GAAgB,KAAZS,EAAK,GAAW,CAClB,IAAIC,EAAMC,mBAAmBF,EAAK,IAC7BJ,EAAMK,IAGJE,MAAMC,QAAQR,EAAMK,MAAOL,EAAMK,GAAO,CAACL,EAAMK,KACpDL,EAAMK,GAAKI,KAAKH,mBAAmBF,EAAK,IAAM,MAH9CJ,EAAMK,GAAOC,mBAAmBF,EAA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BX,IAAOoB,QAAQ,IAAIkC,OAAJ,IAAetD,GAAS,MAkFlEO,KAAKqM,cAAgBnB,EAAQoB,KAAKtM,KAAM,UACxCA,KAAKuM,aAAerB,EAAQoB,KAAKtM,KAAM,SACvCA,KAAKwM,eAAiBtB,EAAQoB,KAAKtM,KAAM,WACzCA,KAAKyM,aAAevB,EAAQoB,KAAKtM,KAAM,SACvCA,KAAKoL,SAAWA,EAChBpL,KAAK4F,mBAAqBqF,EAC1BjL,KAAK0M,OAAS/L,EACdX,KAAK+E,eAAiBA,EACtB/E,KAAK2F,YAAc,SAACtB,GAAD,OAAQhC,EAAUtC,EAAKsC,QAAUgC,GA/MpD,WACM8B,IACFnG,KAAKgM,mBAAqB,WACxB9C,KAEF3F,OAAOsH,iBAAiB,WAAY7K,KAAKgM,sBA4MtC1C,KAAKtJ,MACZ8H,EAAgBwB,KAAKtJ,SC1YnB2M,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUlN,QAG3C,IAAIC,EAAS+M,EAAyBE,GAAY,CAGjDlN,QAAS,IAOV,OAHAmN,EAAoBD,GAAUjN,EAAQA,EAAOD,QAASiN,GAG/ChN,EAAOD,QCjBf,OCFAiN,EAAoBrF,EAAI,CAAC5H,EAASoN,KACjC,IAAI,IAAInL,KAAOmL,EACXH,EAAoBI,EAAED,EAAYnL,KAASgL,EAAoBI,EAAErN,EAASiC,IAC5E2J,OAAO0B,eAAetN,EAASiC,EAAK,CAAEsL,YAAY,EAAMC,IAAKJ,EAAWnL,MCJ3EgL,EAAoBI,EAAI,CAACrJ,EAAKyJ,IAAS7B,OAAO8B,UAAUC,eAAehE,KAAK3F,EAAKyJ,GFG1ER,EAAoB,M","file":"navigo.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Navigo\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Navigo\"] = factory();\n\telse\n\t\troot[\"Navigo\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"?(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n // console.log(current, regexp);\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n let runHook = false;\n const newLocationVSOldMatch = context.instance.matchLocation(\n oldMatch.route.path as string,\n context.currentLocationPath\n );\n if (oldMatch.route.path !== \"*\") {\n runHook = !newLocationVSOldMatch;\n } else {\n const someOfTheLastOnesMatch = context.matches\n ? context.matches.find((match) => {\n return oldMatch.route.path === match.route.path;\n })\n : false;\n runHook = !someOfTheLastOnesMatch;\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\") && runHook) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) =>\n f(\n d,\n context.matches && context.matches.length > 0\n ? context.matches.length === 1\n ? context.matches[0]\n : context.matches\n : undefined\n );\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n {},\n () => done()\n );\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForLeaveHook,\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n if (undefinedOrTrue(context.navigateOptions, \"callHooks\")) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.before &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (\n context.match.route.hooks &&\n context.match.route.hooks.after &&\n undefinedOrTrue(context.navigateOptions, \"callHooks\")\n ) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\nimport updateState from \"./updateState\";\nimport checkForLeaveHook from \"./checkForLeaveHook\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n function nextMatch() {\n if (idx === context.matches.length) {\n updateState(context, done);\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n }\n checkForLeaveHook(context, nextMatch);\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n done();\n}\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(to?: string, options?: ResolveOptions): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: to ? `${clean(root)}/${clean(to)}` : undefined,\n navigateOptions: {},\n resolveOptions: { ...DEFAULT_RESOLVE_OPTIONS, ...options },\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function navigateByName(\n name: string,\n data?: Object,\n options?: NavigateOptions\n ): boolean {\n const url = generate(name, data);\n if (url !== null) {\n navigate(url, options);\n return true;\n }\n return false;\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const route = routes.find((r) => r.name === name);\n if (route) {\n let result = route.path as string;\n if (data) {\n for (let key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n return null;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.navigateByName = navigateByName;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(783);\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)"],"sourceRoot":""} \ No newline at end of file diff --git a/package.json b/package.json index 535e16ad..1d8b5c50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "navigo", - "version": "8.7.1", + "version": "8.7.2", "description": "A simple vanilla JavaScript router", "main": "lib/navigo.js", "browser": "lib/navigo.min.js", diff --git a/src/__tests__/basic.spec.ts b/src/__tests__/basic.spec.ts index 7aee615e..a90b8a8f 100644 --- a/src/__tests__/basic.spec.ts +++ b/src/__tests__/basic.spec.ts @@ -216,6 +216,21 @@ describe("Given the Navigo library", () => { expect(warn).not.toBeCalled(); warn.mockRestore(); }); + describe("and we set noMatchWarning=true in the navigo constructor", () => { + it("should not print a warning if there is no matching route", () => { + const warn = jest.spyOn(console, "warn"); + warn.mockImplementationOnce(() => {}); + const r: NavigoRouter = new Navigo("/", { + hash: true, + noMatchWarning: true, + }); + const res = r.resolve("/", {}); + + expect(res).toEqual(false); + expect(warn).not.toBeCalled(); + warn.mockRestore(); + }); + }); }); it("should still update the browser URL", () => { const warn = jest.spyOn(console, "warn"); diff --git a/src/index.ts b/src/index.ts index 10c3657a..eebcccc6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -116,7 +116,7 @@ export default function Navigo( instance: self, currentLocationPath: to ? `${clean(root)}/${clean(to)}` : undefined, navigateOptions: {}, - resolveOptions: options || DEFAULT_RESOLVE_OPTIONS, + resolveOptions: { ...DEFAULT_RESOLVE_OPTIONS, ...options }, }; Q( [