{"version":3,"file":null,"sources":["lib/methods.js","lib/requester.js","lib/settings.js","lib/middleware.js","lib/router.js","lib/application.js","lib/frontexpress.js"],"sourcesContent":["/**\n * HTTP method list\n * @private\n */\n\n export default ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'];","/**\n * Module dependencies.\n * @private\n */\n\nexport default class Requester {\n\n /**\n * Make an ajax request.\n *\n * @param {Object} request\n * @param {Function} success callback\n * @param {Function} failure callback\n * @private\n */\n\n fetch(request, resolve, reject) {\n const {method, uri, headers, data} = request;\n\n const success = (responseText) => {\n resolve(\n request,\n {status: 200, statusText: 'OK', responseText}\n );\n };\n\n const fail = ({status, statusText, errorThrown}) => {\n const errors = this._analyzeErrors({status, statusText, errorThrown});\n reject(\n request,\n {status, statusText, errorThrown, errors}\n );\n };\n\n const xmlhttp = new XMLHttpRequest();\n xmlhttp.onreadystatechange = () => {\n if (xmlhttp.readyState === 4) {\n if (xmlhttp.status === 200) {\n success(xmlhttp.responseText);\n } else {\n fail({status: xmlhttp.status, statusText: xmlhttp.statusText});\n }\n }\n };\n try {\n xmlhttp.open(method, uri, true);\n if (headers) {\n for (const header of Object.keys(headers)) {\n xmlhttp.setRequestHeader(header, headers[header]);\n }\n }\n if (data) {\n xmlhttp.send(data);\n } else {\n xmlhttp.send();\n }\n } catch (errorThrown) {\n fail({errorThrown});\n }\n }\n\n\n /**\n * Analyse response errors.\n *\n * @private\n */\n\n _analyzeErrors(response) {\n // manage exceptions\n if (response.errorThrown) {\n if (response.errorThrown.name === 'SyntaxError') {\n return 'Problem during data decoding [JSON]';\n }\n if (response.errorThrown.name === 'TimeoutError') {\n return 'Server is taking too long to reply';\n }\n if (response.errorThrown.name === 'AbortError') {\n return 'Request cancelled on server';\n }\n if (response.errorThrown.name === 'NetworkError') {\n return 'A network error occurred';\n }\n throw response.errorThrown;\n }\n\n // manage status\n if (response.status === 0) {\n return 'Server access problem. Check your network connection';\n }\n if (response.status === 401) {\n return 'Your session has expired, Please reconnect. [code: 401]';\n }\n if (response.status === 404) {\n return 'Page not found on server. [code: 404]';\n }\n if (response.status === 500) {\n return 'Internal server error. [code: 500]';\n }\n return `Unknown error. ${response.statusText?response.statusText:''}`;\n }\n}","/**\n * Module dependencies.\n * @private\n */\n\nimport Requester from './requester';\n\n\n/**\n * Settings object.\n * @private\n */\n\nexport default class Settings {\n\n\n /**\n * Initialize the settings.\n *\n * - setup default configuration\n *\n * @private\n */\n\n constructor() {\n // default settings\n this.settings = {\n 'http requester': new Requester(),\n\n 'http GET transformer': {\n uri({uri, headers, data}) {\n if (!data) {\n return uri;\n }\n\n let anchor = '';\n let uriWithoutAnchor = uri;\n const hashIndex = uri.indexOf('#');\n if (hashIndex >=1) {\n uriWithoutAnchor = uri.slice(0, hashIndex);\n anchor = uri.slice(hashIndex, uri.length);\n }\n\n uriWithoutAnchor = Object.keys(data).reduce((gUri, d, index) => {\n if (index === 0 && gUri.indexOf('?') === -1) {\n gUri += '?';\n } else {\n gUri += '&';\n }\n gUri += `${d}=${data[d]}`;\n return gUri;\n }, uriWithoutAnchor);\n\n return uriWithoutAnchor + anchor;\n },\n data({uri, headers, data}) {\n return undefined;\n }\n }\n };\n\n this.rules = {\n 'http requester': (requester) => {\n if(typeof requester.fetch !== 'function') {\n throw new TypeError('setting http requester has no fetch method');\n }\n }\n };\n }\n\n\n /**\n * Assign `setting` to `val`\n *\n * @param {String} setting\n * @param {*} [val]\n * @private\n */\n\n set(name, value) {\n const checkRules = this.rules[name];\n if (checkRules) {\n checkRules(value);\n }\n this.settings[name] = value;\n }\n\n\n /**\n * Return `setting`'s value.\n *\n * @param {String} setting\n * @private\n */\n\n get(name) {\n return this.settings[name];\n }\n};","/**\n * Middleware object.\n * @public\n */\n\nexport default class Middleware {\n\n\n /**\n * Middleware initialization\n *\n * @param {String} middleware name\n */\n\n constructor(name='') {\n this.name = name;\n }\n\n /**\n * Invoked by the app before an ajax request is sent or\n * during the DOM loading (document.readyState === 'loading').\n * See Application#_callMiddlewareEntered documentation for details.\n *\n * Override this method to add your custom behaviour\n *\n * @param {Object} request\n * @public\n */\n\n entered(request) { }\n\n\n /**\n * Invoked by the app before a new ajax request is sent or before the DOM is unloaded.\n * See Application#_callMiddlewareExited documentation for details.\n *\n * Override this method to add your custom behaviour\n *\n * @param {Object} request\n * @public\n */\n\n exited(request) { }\n\n\n /**\n * Invoked by the app after an ajax request has responded or on DOM ready\n * (document.readyState === 'interactive').\n * See Application#_callMiddlewareUpdated documentation for details.\n *\n * Override this method to add your custom behaviour\n *\n * @param {Object} request\n * @param {Object} response\n * @public\n */\n\n updated(request, response) { }\n\n\n /**\n * Invoked by the app when an ajax request has failed.\n *\n * Override this method to add your custom behaviour\n *\n * @param {Object} request\n * @param {Object} response\n * @public\n */\n failed(request, response) { }\n\n\n /**\n * Allow the hand over to the next middleware object or function.\n *\n * Override this method and return `false` to break execution of\n * middleware chain.\n *\n * @return {Boolean} `true` by default\n *\n * @public\n */\n\n next() {\n return true;\n }\n}\n","/**\n * Module dependencies.\n * @private\n */\n\nimport HTTP_METHODS from './methods';\nimport Middleware from './middleware';\n\n\n/**\n * Route object.\n * @private\n */\n\nexport class Route {\n\n\n /**\n * Initialize the route.\n *\n * @private\n */\n\n constructor(router, uriPart, method, middleware) {\n this.router = router;\n this.uriPart = uriPart;\n this.method = method;\n this.middleware = middleware;\n this.visited = false;\n }\n\n\n /**\n * Return route's uri.\n *\n * @private\n */\n\n get uri() {\n if (!this.uriPart && !this.method) {\n return undefined;\n }\n\n if (this.uriPart instanceof RegExp) {\n return this.uriPart;\n }\n\n if (this.router.baseUri instanceof RegExp) {\n return this.router.baseUri;\n }\n\n if (this.router.baseUri && this.uriPart) {\n return (this.router.baseUri.trim() + this.uriPart.trim()).replace(/\\/{2,}/, '/');\n }\n\n if (this.router.baseUri) {\n return this.router.baseUri.trim();\n }\n\n return this.uriPart;\n }\n}\n\n\n/**\n * Router object.\n * @public\n */\n\nexport default class Router {\n\n\n /**\n * Initialize the router.\n *\n * @private\n */\n\n constructor(uri) {\n if (uri) {\n this._baseUri = uri;\n }\n this._routes = [];\n }\n\n\n /**\n * Do some checks and set _baseUri.\n *\n * @private\n */\n\n set baseUri(uri) {\n if (!uri) {\n return;\n }\n\n if (!this._baseUri) {\n this._baseUri = uri;\n return;\n }\n\n if (this._baseUri instanceof RegExp) {\n throw new TypeError(`the router already contains a regexp uri ${this._baseUri.toString()} It cannot be mixed with ${uri.toString()}`);\n }\n\n if (uri instanceof RegExp) {\n throw new TypeError(`the router already contains an uri ${this._baseUri.toString()} It cannot be mixed with regexp ${uri.toString()}`);\n }\n }\n\n\n /**\n * Return router's _baseUri.\n *\n * @private\n */\n\n get baseUri() {\n return this._baseUri;\n }\n\n\n /**\n * Add a route to the router.\n *\n * @private\n */\n\n _add(route) {\n this._routes.push(route);\n return this;\n }\n\n\n /**\n * Gather routes from routers filtered by _uri_ and HTTP _method_.\n *\n * @private\n */\n\n routes(uri, method) {\n return this._routes.filter((route) => {\n if (!route.uri && !route.method) {\n return true;\n }\n if (route.method !== method) {\n return false;\n }\n\n if (!route.uri) {\n return true;\n }\n\n let uriToCheck = uri;\n\n //remove query string from uri to test\n const questionMarkIndex = uriToCheck.indexOf('?');\n if (questionMarkIndex >= 0) {\n uriToCheck = uriToCheck.slice(0, questionMarkIndex);\n }\n\n //remove anchor from uri to test\n const hashIndex = uriToCheck.indexOf('#');\n if (hashIndex >= 0) {\n uriToCheck = uriToCheck.slice(0, hashIndex);\n }\n\n if (route.uri instanceof RegExp) {\n return uriToCheck.match(route.uri);\n }\n\n return route.uri === uriToCheck;\n });\n }\n\n\n /**\n * Gather visited routes from routers.\n *\n * @private\n */\n\n visited() {\n return this._routes.filter((route) => {\n return route.visited;\n });\n }\n\n\n /**\n * Use the given middleware function or object on this router.\n *\n * // middleware function\n * router.use((req, res, next) => {console.log('Hello')});\n *\n * // middleware object\n * router.use(new Middleware());\n *\n * @param {Middleware|Function} middleware object or function\n * @return {Router} for chaining\n *\n * @public\n */\n\n use(middleware) {\n if (!(middleware instanceof Middleware) && (typeof middleware !== 'function') ) {\n throw new TypeError('use method takes at least a middleware');\n }\n\n this._add(new Route(this, undefined, undefined, middleware));\n\n return this;\n }\n\n\n /**\n * Use the given middleware function or object on this router for\n * all HTTP methods.\n *\n * // middleware function\n * router.all((req, res, next) => {console.log('Hello')});\n *\n * // middleware object\n * router.all(new Middleware());\n *\n * @param {Middleware|Function} middleware object or function\n * @return {Router} for chaining\n *\n * @public\n */\n\n all(...args) {\n if (args.length === 0) {\n throw new TypeError('use all method takes at least a middleware');\n }\n let middleware;\n\n if (args.length === 1) {\n [middleware,] = args;\n } else {\n [, middleware,] = args;\n }\n\n if (!(middleware instanceof Middleware) && (typeof middleware !== 'function') ) {\n throw new TypeError('use all method takes at least a middleware');\n }\n\n for (const method of HTTP_METHODS) {\n this[method.toLowerCase()](...args);\n }\n return this;\n }\n}\n\nfor (const method of HTTP_METHODS) {\n\n\n /**\n * Use the given middleware function or object, with optional _uri_ on\n * HTTP methods: get, post, put, delete...\n * Default _uri_ is \"/\".\n *\n * // middleware function will be applied on path \"/\"\n * router.get((req, res, next) => {console.log('Hello')});\n *\n * // middleware object will be applied on path \"/\" and\n * router.get(new Middleware());\n *\n * // middleware function will be applied on path \"/user\"\n * router.post('/user', (req, res, next) => {console.log('Hello')});\n *\n * // middleware object will be applied on path \"/user\" and\n * router.post('/user', new Middleware());\n *\n * @param {String} uri\n * @param {Middleware|Function} middleware object or function\n * @return {Router} for chaining\n * @public\n */\n\n const methodName = method.toLowerCase();\n Router.prototype[methodName] = function(...args) {\n if (args.length === 0) {\n throw new TypeError(`use ${methodName} method takes at least a middleware`);\n }\n let uri, middleware;\n\n if (args.length === 1) {\n [middleware,] = args;\n } else {\n [uri, middleware,] = args;\n }\n\n if (!(middleware instanceof Middleware) && (typeof middleware !== 'function') ) {\n throw new TypeError(`use ${methodName} method takes at least a middleware`);\n }\n\n if (uri && this._baseUri && this._baseUri instanceof RegExp) {\n throw new TypeError('router contains a regexp cannot mix with route uri/regexp');\n }\n\n this._add(new Route(this, uri, method, middleware));\n\n return this;\n };\n}\n","/**\n * Module dependencies.\n * @private\n */\n\nimport HTTP_METHODS from './methods';\nimport Settings from './settings';\nimport Router, {Route} from './router';\nimport Middleware from './middleware';\n\n\n/**\n * Application class.\n */\n\nexport default class Application {\n\n\n /**\n * Initialize the application.\n *\n * - setup default configuration\n *\n * @private\n */\n\n constructor() {\n this.routers = [];\n this.isDOMLoaded = false;\n this.isDOMReady = false;\n this.settings = new Settings();\n }\n\n\n /**\n * Assign `setting` to `val`, or return `setting`'s value.\n *\n * app.set('foo', 'bar');\n * app.set('foo');\n * // => \"bar\"\n *\n * @param {String} setting\n * @param {*} [val]\n * @return {app} for chaining\n * @public\n */\n\n set(...args) {\n // get behaviour\n if (args.length === 1) {\n const name = [args];\n return this.settings.get(name);\n }\n\n // set behaviour\n const [name, value] = args;\n this.settings.set(name, value);\n\n return this;\n }\n\n\n /**\n * Listen for DOM initialization and history state changes.\n *\n * The callback function is called once the DOM has\n * the `document.readyState` equals to 'interactive'.\n *\n * app.listen(()=> {\n * console.log('App is listening requests');\n * console.log('DOM is ready!');\n * });\n *\n *\n * @param {Function} callback\n * @public\n */\n\n listen(callback) {\n window.onbeforeunload = () => {\n this._callMiddlewareExited();\n };\n\n window.onpopstate = (event) => {\n if (event.state) {\n const {request, response} = event.state;\n const currentRoutes = this._routes(request.uri, request.method);\n\n this._callMiddlewareEntered(currentRoutes, request);\n this._callMiddlewareUpdated(currentRoutes, request, response);\n }\n };\n\n document.onreadystatechange = () => {\n const request = {method: 'GET', uri: window.location.pathname + window.location.search};\n const response = {status: 200, statusText: 'OK'};\n const currentRoutes = this._routes();\n // DOM state\n if (document.readyState === 'loading' && !this.isDOMLoaded) {\n this.isDOMLoaded = true;\n this._callMiddlewareEntered(currentRoutes, request);\n } else if (document.readyState === 'interactive' && !this.isDOMReady) {\n if (!this.isDOMLoaded) {\n this.isDOMLoaded = true;\n this._callMiddlewareEntered(currentRoutes, request);\n }\n this.isDOMReady = true;\n this._callMiddlewareUpdated(currentRoutes, request, response);\n if (callback) {\n callback(request, response);\n }\n }\n };\n }\n\n\n /**\n * Returns a new `Router` instance for the _uri_.\n * See the Router api docs for details.\n *\n * app.route('/');\n * // => new Router instance\n *\n * @param {String} uri\n * @return {Router} for chaining\n *\n * @public\n */\n\n route(uri) {\n const router = new Router(uri);\n this.routers.push(router);\n return router;\n }\n\n\n /**\n * Use the given middleware function or object, with optional _uri_.\n * Default _uri_ is \"/\".\n *\n * // middleware function will be applied on path \"/\"\n * app.use((req, res, next) => {console.log('Hello')});\n *\n * // middleware object will be applied on path \"/\"\n * app.use(new Middleware());\n *\n * @param {String} uri\n * @param {Middleware|Function} middleware object or function\n * @return {app} for chaining\n *\n * @public\n */\n\n use(...args) {\n if (args.length === 0) {\n throw new TypeError('use method takes at least a middleware or a router');\n }\n\n let baseUri, middleware, router, which;\n\n if (args.length === 1) {\n [which,] = args;\n } else {\n [baseUri, which,] = args;\n }\n\n if (!(which instanceof Middleware) && (typeof which !== 'function') && !(which instanceof Router)) {\n throw new TypeError('use method takes at least a middleware or a router');\n }\n\n if (which instanceof Router) {\n router = which;\n router.baseUri = baseUri;\n } else {\n middleware = which;\n router = new Router(baseUri);\n for (const method of HTTP_METHODS) {\n router[method.toLowerCase()](middleware);\n }\n }\n this.routers.push(router);\n\n return this;\n }\n\n\n /**\n * Gather routes from all routers filtered by _uri_ and HTTP _method_.\n * See Router#routes() documentation for details.\n *\n * @private\n */\n\n _routes(uri=window.location.pathname + window.location.search, method='GET') {\n const currentRoutes = [];\n for (const router of this.routers) {\n const routes = router.routes(uri, method);\n currentRoutes.push(...routes);\n }\n\n return currentRoutes;\n }\n\n\n /**\n * Call `Middleware#entered` on _currentRoutes_.\n * Invoked before sending ajax request or when DOM\n * is loading (document.readyState === 'loading').\n *\n * @private\n */\n\n _callMiddlewareEntered(currentRoutes, request) {\n for (const route of currentRoutes) {\n if (route.middleware.entered) {\n route.middleware.entered(request);\n }\n if (route.middleware.next && !route.middleware.next()) {\n break;\n }\n }\n }\n\n\n /**\n * Call `Middleware#updated` or middleware function on _currentRoutes_.\n * Invoked on ajax request responding or on DOM ready\n * (document.readyState === 'interactive').\n *\n * @private\n */\n\n _callMiddlewareUpdated(currentRoutes, request, response) {\n for (const route of currentRoutes) {\n route.visited = request;\n // calls middleware updated method\n if (route.middleware.updated) {\n route.middleware.updated(request, response);\n if (route.middleware.next && !route.middleware.next()) {\n break;\n }\n } else {\n // calls middleware method\n let breakMiddlewareLoop = true;\n const next = () => {\n breakMiddlewareLoop = false;\n };\n route.middleware(request, response, next);\n if (breakMiddlewareLoop) {\n break;\n }\n }\n }\n }\n\n\n /**\n * Call `Middleware#exited` on _currentRoutes_.\n * Invoked before sending a new ajax request or before DOM unloading.\n *\n * @private\n */\n\n _callMiddlewareExited() {\n // calls middleware exited method\n for (const router of this.routers) {\n const routes = router.visited();\n for (const route of routes) {\n if (route.middleware.exited) {\n route.middleware.exited(route.visited);\n route.visited = null;\n }\n }\n }\n }\n\n\n /**\n * Call `Middleware#failed` or middleware function on _currentRoutes_.\n * Invoked when ajax request fails.\n *\n * @private\n */\n\n _callMiddlewareFailed(currentRoutes, request, response) {\n for (const route of currentRoutes) {\n // calls middleware failed method\n if (route.middleware.failed) {\n route.middleware.failed(request, response);\n if (route.middleware.next && !route.middleware.next()) {\n break;\n }\n } else {\n // calls middleware method\n let breakMiddlewareLoop = true;\n const next = () => {\n breakMiddlewareLoop = false;\n };\n route.middleware(request, response, next);\n if (breakMiddlewareLoop) {\n break;\n }\n }\n }\n }\n\n\n /**\n * Make an ajax request. Manage History#pushState if history object set.\n *\n * @private\n */\n\n _fetch(request, resolve, reject) {\n let {method, uri, headers, data, history} = request;\n\n const httpMethodTransformer = this.get(`http ${method} transformer`);\n if (httpMethodTransformer) {\n uri = httpMethodTransformer.uri ? httpMethodTransformer.uri({uri, headers, data}) : uri;\n headers = httpMethodTransformer.headers ? httpMethodTransformer.headers({uri, headers, data}) : headers;\n data = httpMethodTransformer.data ? httpMethodTransformer.data({uri, headers, data}) : data;\n }\n\n // calls middleware exited method\n this._callMiddlewareExited();\n\n // gathers all routes impacted by the uri\n const currentRoutes = this._routes(uri, method);\n\n // calls middleware entered method\n this._callMiddlewareEntered(currentRoutes, request);\n\n // invokes http request\n this.settings.get('http requester').fetch(request,\n (req, res) => {\n if (history) {\n window.history.pushState({request: req, response: res}, history.title, history.uri);\n }\n this._callMiddlewareUpdated(currentRoutes, req, res);\n if (resolve) {\n resolve(req, res);\n }\n },\n (req, res) => {\n this._callMiddlewareFailed(currentRoutes, req, res);\n if (reject) {\n reject(req, res);\n }\n });\n }\n}\n\nHTTP_METHODS.reduce((reqProto, method) => {\n\n\n /**\n * Use the given middleware function or object, with optional _uri_ on\n * HTTP methods: get, post, put, delete...\n * Default _uri_ is \"/\".\n *\n * // middleware function will be applied on path \"/\"\n * app.get((req, res, next) => {console.log('Hello')});\n *\n * // middleware object will be applied on path \"/\" and\n * app.get(new Middleware());\n *\n * // get a setting value\n * app.set('foo', 'bar');\n * app.get('foo');\n * // => \"bar\"\n *\n * @param {String} uri or setting\n * @param {Middleware|Function} middleware object or function\n * @return {app} for chaining\n * @public\n */\n\n const middlewareMethodName = method.toLowerCase();\n reqProto[middlewareMethodName] = function(...args) {\n if (middlewareMethodName === 'get') {\n if (args.length === 0) {\n throw new TypeError(`${middlewareMethodName} method takes at least a string or a middleware`);\n } else if (args.length === 1) {\n const [name] = args;\n if (typeof name === 'string') {\n return this.settings.get(name);\n }\n }\n } else if (args.length === 0) {\n throw new TypeError(`${middlewareMethodName} method takes at least a middleware`);\n }\n\n let baseUri, middleware, which;\n\n if (args.length === 1) {\n [which,] = args;\n } else {\n [baseUri, which,] = args;\n }\n\n if (!(which instanceof Middleware) && (typeof which !== 'function')) {\n throw new TypeError(`${middlewareMethodName} method takes at least a middleware`);\n }\n\n const router = new Router();\n middleware = which;\n router[middlewareMethodName](baseUri, middleware);\n\n this.routers.push(router);\n\n return this;\n };\n\n /**\n * Ajax request (get, post, put, delete...).\n *\n * // HTTP GET method\n * httpGet('/route1');\n *\n * // HTTP GET method\n * httpGet({uri: '/route1', data: {'p1': 'val1'});\n * // uri invoked => /route1?p1=val1\n *\n * // HTTP GET method with browser history management\n * httpGet({uri: '/api/users', history: {state: {foo: \"bar\"}, title: 'users page', uri: '/view/users'});\n *\n * Samples above can be applied on other HTTP methods.\n *\n * @param {String|Object} uri or object containing uri, http headers, data, history\n * @param {Function} success callback\n * @param {Function} failure callback\n * @public\n */\n const httpMethodName = 'http'+method.charAt(0).toUpperCase() + method.slice(1).toLowerCase();\n reqProto[httpMethodName] = function(request, resolve, reject) {\n let {uri, headers, data, history} = request;\n if (!uri) {\n uri = request;\n }\n return this._fetch({\n uri,\n method,\n headers,\n data,\n history\n }, resolve, reject);\n };\n\n return reqProto;\n}, Application.prototype);","/**\n * Module dependencies.\n */\n\nimport Application from './application';\nimport Router from './router';\nimport Middleware from './middleware';\n\n\n/**\n * Create a frontexpress application.\n *\n * @return {Function}\n * @api public\n */\n\nconst frontexpress = () => new Application();\n\n/**\n * Expose Router, Middleware constructors.\n */\nfrontexpress.Router = (baseUri) => new Router(baseUri);\nfrontexpress.Middleware = (name) => new Middleware(name);\n\nexport default frontexpress;\n"],"names":["Requester","request","resolve","reject","method","uri","headers","data","success","responseText","status","statusText","fail","errorThrown","errors","_this","_analyzeErrors","xmlhttp","XMLHttpRequest","onreadystatechange","readyState","open","Object","keys","header","setRequestHeader","send","response","name","Settings","settings","anchor","uriWithoutAnchor","hashIndex","indexOf","slice","length","reduce","gUri","d","index","rules","requester","fetch","TypeError","value","checkRules","this","Middleware","Route","router","uriPart","middleware","visited","RegExp","baseUri","trim","replace","Router","_baseUri","_routes","route","push","filter","uriToCheck","questionMarkIndex","match","_add","undefined","args","HTTP_METHODS","toLowerCase","toString","methodName","prototype","Application","routers","isDOMLoaded","isDOMReady","get","set","callback","onbeforeunload","_callMiddlewareExited","onpopstate","event","state","currentRoutes","_callMiddlewareEntered","_callMiddlewareUpdated","window","location","pathname","search","document","which","routes","entered","next","updated","breakMiddlewareLoop","exited","failed","history","httpMethodTransformer","req","res","pushState","title","_callMiddlewareFailed","reqProto","middlewareMethodName","httpMethodName","charAt","toUpperCase","_fetch","frontexpress"],"mappings":"uLAKC,QAAgB,MAAO,OAAQ,OAAQ,MAAO,SAAU,UAAW,UAAW,QAAS,sdCAnEA,4EAWXC,EAASC,EAASC,cACbC,EAA8BH,EAA9BG,OAAQC,EAAsBJ,EAAtBI,IAAKC,EAAiBL,EAAjBK,QAASC,EAAQN,EAARM,KAEvBC,EAAU,SAACC,KAETR,GACCS,OAAQ,IAAKC,WAAY,KAAMF,kBAIlCG,EAAO,eAAEF,KAAAA,OAAQC,IAAAA,WAAYE,IAAAA,YACzBC,EAASC,EAAKC,gBAAgBN,SAAQC,aAAYE,kBAEpDZ,GACCS,SAAQC,aAAYE,cAAaC,YAIpCG,EAAU,GAAIC,kBACZC,mBAAqB,WACE,IAAvBF,EAAQG,aACe,MAAnBH,EAAQP,SACAO,EAAQR,iBAEVC,OAAQO,EAAQP,OAAQC,WAAYM,EAAQN,wBAKlDU,KAAKjB,EAAQC,GAAK,GACtBC,EAAS,wCACYgB,OAAOC,KAAKjB,kDAAU,IAAhCkB,aACCC,iBAAiBD,EAAQlB,EAAQkB,mFAG7CjB,IACQmB,KAAKnB,KAELmB,OAEd,MAAOb,MACCA,wDAWCc,MAEPA,EAASd,YAAa,IACY,gBAA9Bc,EAASd,YAAYe,WACd,yCAEuB,iBAA9BD,EAASd,YAAYe,WACd,wCAEuB,eAA9BD,EAASd,YAAYe,WACd,iCAEuB,iBAA9BD,EAASd,YAAYe,WACd,gCAELD,GAASd,kBAIK,KAApBc,EAASjB,OACF,uDAEa,MAApBiB,EAASjB,OACF,0DAEa,MAApBiB,EAASjB,OACF,wCAEa,MAApBiB,EAASjB,OACF,wDAEciB,EAAShB,WAAWgB,EAAShB,WA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