mirror of
https://gitlab.silvrtree.co.uk/martind2000/frontexpress.git
synced 2025-01-10 21:45:08 +00:00
1 line
34 KiB
Plaintext
1 line
34 KiB
Plaintext
{"version":3,"file":"frontexpress.min.js","sources":["lib/router.js","lib/settings.js","lib/application.js","lib/methods.js","lib/middleware.js","lib/requester.js","lib/frontexpress.js"],"sourcesContent":["/**\n * Module dependencies.\n * @private\n */\n\nimport HTTP_METHODS from './methods';\nimport {toParameters} from './application';\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) {\n const baseUri = this.router.baseUri.trim();\n if (this.uriPart) {\n return ( baseUri + this.uriPart.trim()).replace(/\\/{2,}/, '/');\n }\n return baseUri;\n }\n\n return this.uriPart;\n }\n}\n\n\n/**\n * Router object.\n * @public\n */\n\nconst error_middleware_message = 'method takes at least a middleware';\nexport default class Router {\n\n\n /**\n * Initialize the router.\n *\n * @private\n */\n\n constructor(uri) {\n this._baseUri = uri;\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 (typeof this._baseUri !== typeof uri) {\n throw new TypeError('router cannot mix regexp and uri');\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(application, request) {\n request.params = request.params || {};\n const isRouteMatch = application.get('route matcher');\n return this._routes.filter((route) => {\n return isRouteMatch(request, route);\n });\n }\n\n\n /**\n * Gather visited routes from routers.\n *\n * @private\n */\n\n visited() {\n return this._routes.filter(route => route.visited);\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(error_middleware_message);\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 const {middleware} = toParameters(args);\n if (!middleware) {\n throw new TypeError(error_middleware_message);\n }\n\n HTTP_METHODS.forEach((method) => {\n this[method.toLowerCase()](...args);\n });\n return this;\n }\n}\n\nHTTP_METHODS.forEach((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 * 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 const {baseUri, middleware} = toParameters(args);\n if (!middleware) {\n throw new TypeError(error_middleware_message);\n }\n\n if (baseUri && this._baseUri && this._baseUri instanceof RegExp) {\n throw new TypeError('router cannot mix uri/regexp');\n }\n\n this._add(new Route(this, baseUri, method, middleware));\n\n return this;\n };\n});\n\nexport function routeMatcher(request, route) {\n // check if http method are equals\n if (route.method && route.method !== request.method) {\n return false;\n }\n\n\n // route and uri not defined always match\n if (!route.uri || !request.uri) {\n return true;\n }\n\n //remove query string and anchor from uri to test\n const match = /^(.*)\\?.*#.*|(.*)(?=\\?|#)|(.*[^\\?#])$/.exec(request.uri);\n const baseUriToCheck = match[1] || match[2] || match[3];\n\n // if route is a regexp path\n if (route.uri instanceof RegExp) {\n return baseUriToCheck.match(route.uri) !== null;\n }\n\n // if route is parameterized path\n if (route.uri.indexOf(':') !== -1) {\n\n const decodeParmeterValue = (v) => {\n return !isNaN(parseFloat(v)) && isFinite(v) ? (Number.isInteger(v) ? Number.parseInt(v, 10) : Number.parseFloat(v)) : v;\n };\n\n // figure out key names\n const keys = [];\n const keysRE = /:([^\\/\\?]+)\\??/g;\n let keysMatch = keysRE.exec(route.uri);\n while (keysMatch != null) {\n keys.push(keysMatch[1]);\n keysMatch = keysRE.exec(route.uri);\n }\n\n // change parameterized path to regexp\n const regExpUri = route.uri\n // :parameter?\n .replace(/\\/:[^\\/]+\\?/g, '(?:\\/([^\\/]+))?')\n // :parameter\n .replace(/:[^\\/]+/g, '([^\\/]+)')\n // escape all /\n .replace('/', '\\\\/');\n\n // checks if uri match\n const routeMatch = baseUriToCheck.match(new RegExp(`^${regExpUri}$`));\n if (!routeMatch) {\n return false;\n }\n\n // update params in request with keys\n request.params = Object.assign(request.params, keys.reduce((acc, key, index) => {\n let value = routeMatch[index + 1];\n if (value) {\n value = value.indexOf(',') !== -1 ? value.split(',').map(v => decodeParmeterValue(v)) : value = decodeParmeterValue(value);\n }\n acc[key] = value;\n return acc;\n }, {}));\n return true;\n }\n\n // if route is a simple path\n return route.uri === baseUriToCheck;\n}\n","/**\n * Module dependencies.\n * @private\n */\nimport {routeMatcher} from './router';\nimport Requester, {httpGetTransformer} from './requester';\n\n\nfunction errorIfNotFunction(toTest, message) {\n if(typeof toTest !== 'function') {\n throw new TypeError(message);\n }\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 'http GET transformer': httpGetTransformer,\n // 'http POST transformer': httpPostTransformer,\n 'route matcher': routeMatcher\n };\n\n this.rules = {\n 'http requester': (requester) => {\n errorIfNotFunction(requester.fetch , 'setting http requester has no fetch function');\n },\n 'http GET transformer': (transformer) => {\n if (!transformer || (!transformer.uri && !transformer.headers && !transformer.data)) {\n throw new TypeError('setting http transformer one of functions: uri, headers, data is missing');\n }\n },\n 'route matcher': (routeMatcher) => {\n errorIfNotFunction(routeMatcher, 'setting route matcher is not a function');\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","/**\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.settings = new Settings();\n this.plugins = [];\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 return this.settings.get([args]);\n }\n\n // set behaviour\n this.settings.set(...args);\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 const request = {method: 'GET', uri: window.location.pathname + window.location.search};\n const response = {status: 200, statusText: 'OK'};\n const currentRoutes = this._routes(request);\n\n this._callMiddlewareMethod('entered', currentRoutes, request);\n\n // manage history\n window.onpopstate = (event) => {\n if (event.state) {\n const {request, response} = event.state;\n [\n 'exited',\n 'entered',\n 'updated'\n ].forEach(middlewareMethod => this._callMiddlewareMethod(middlewareMethod, this._routes(request), request, response));\n }\n };\n\n // manage page loading/refreshing\n window.onbeforeunload = () => {\n this._callMiddlewareMethod('exited');\n };\n\n const whenPageIsInteractiveFn = () => {\n this.plugins.forEach(pluginObject => pluginObject.plugin(this));\n this._callMiddlewareMethod('updated', currentRoutes, request, response);\n if (callback) {\n callback(request, response);\n }\n };\n\n document.onreadystatechange = () => {\n // DOM ready state\n if (document.readyState === 'interactive') {\n whenPageIsInteractiveFn();\n }\n };\n\n if (['interactive', 'complete'].indexOf(document.readyState) !== -1) {\n whenPageIsInteractiveFn();\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 * Or use the given plugin\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 * // use a plugin\n * app.use({\n * name: 'My plugin name',\n * plugin(application) {\n * // here plugin implementation\n * }\n * });\n *\n * @param {String} uri\n * @param {Middleware|Function|plugin} middleware object, middleware function, plugin\n * @return {app} for chaining\n *\n * @public\n */\n\n use(...args) {\n let {baseUri, router, middleware, plugin} = toParameters(args);\n if (plugin) {\n this.plugins.push(plugin);\n } else {\n if (router) {\n router.baseUri = baseUri;\n } else if (middleware) {\n router = new Router(baseUri);\n HTTP_METHODS.forEach((method) => {\n router[method.toLowerCase()](middleware);\n });\n } else {\n throw new TypeError('method takes at least a middleware or a router');\n }\n this.routers.push(router);\n }\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(request) {\n return this.routers.reduce((acc, router) => {\n acc.push(...router.routes(this, request));\n return acc;\n }, []);\n }\n\n\n /**\n * Call `Middleware` method or middleware function on _currentRoutes_.\n *\n * @private\n */\n\n _callMiddlewareMethod(meth, currentRoutes, request, response) {\n if (meth === 'exited') {\n // currentRoutes, request, response params not needed\n this.routers.forEach((router) => {\n router.visited().forEach((route) => {\n if (route.middleware.exited) {\n route.middleware.exited(route.visited);\n route.visited = null;\n }\n });\n });\n return;\n }\n\n currentRoutes.some((route) => {\n if (meth === 'updated') {\n route.visited = request;\n }\n\n if (route.middleware[meth]) {\n route.middleware[meth](request, response);\n if (route.middleware.next && !route.middleware.next()) {\n return true;\n }\n } else if (meth !== 'entered') {\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 return true;\n }\n }\n\n return false;\n });\n }\n\n\n /**\n * Make an ajax request. Manage History#pushState if history object set.\n *\n * @private\n */\n\n _fetch(req, resolve, reject) {\n let {method, uri, headers, data, history} = req;\n\n const httpMethodTransformer = this.get(`http ${method} transformer`);\n if (httpMethodTransformer) {\n const {uri: _uriFn, headers: _headersFn, data: _dataFn } = httpMethodTransformer;\n req.uri = _uriFn ? _uriFn({uri, headers, data}) : uri;\n req.headers = _headersFn ? _headersFn({uri, headers, data}) : headers;\n req.data = _dataFn ? _dataFn({uri, headers, data}) : data;\n }\n\n // calls middleware exited method\n this._callMiddlewareMethod('exited');\n\n // gathers all routes impacted by the uri\n const currentRoutes = this._routes(req);\n\n // calls middleware entered method\n this._callMiddlewareMethod('entered', currentRoutes, req);\n\n // invokes http request\n this.settings.get('http requester').fetch(req,\n (request, response) => {\n if (history) {\n window.history.pushState({request, response}, history.title, history.uri);\n }\n this._callMiddlewareMethod('updated', currentRoutes, request, response);\n if (resolve) {\n resolve(request, response);\n }\n },\n (request, response) => {\n this._callMiddlewareMethod('failed', currentRoutes, request, response);\n if (reject) {\n reject(request, response);\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 let {baseUri, middleware, which} = toParameters(args);\n if (middlewareMethodName === 'get' && typeof which === 'string') {\n return this.settings.get(which);\n }\n if (!middleware) {\n throw new TypeError(`method takes a middleware ${middlewareMethodName === 'get' ? 'or a string' : ''}`);\n }\n const router = new Router();\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\n\nexport function toParameters(args) {\n let baseUri, middleware, router, plugin, which;\n\n args.length === 1 ? [which,] = args : [baseUri, which,] = args;\n\n if (which instanceof Router) {\n router = which;\n } else if (which instanceof Middleware || typeof which === 'function') {\n middleware = which;\n } else if(which && which.plugin && typeof which.plugin === 'function') {\n plugin = which;\n }\n\n return {baseUri, middleware, router, plugin, which};\n}\n","/**\n * HTTP method list\n * @private\n */\n\n export default ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];\n // not supported yet\n // HEAD', 'CONNECT', 'OPTIONS', 'TRACE';\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\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 {\n status: 200,\n statusText: 'OK',\n responseText\n }\n );\n };\n\n const fail = ({status, statusText, errorThrown}) => {\n reject(\n request,\n {\n status,\n statusText,\n errorThrown,\n errors: `HTTP ${status} ${statusText?statusText:''}`\n }\n );\n };\n\n const xmlhttp = new XMLHttpRequest();\n xmlhttp.onreadystatechange = () => {\n if (xmlhttp.readyState === 4) { //XMLHttpRequest.DONE\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 Object.keys(headers).forEach((header) => {\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\nexport const httpGetTransformer = {\n uri({uri, headers, data}) {\n if (!data) {\n return uri;\n }\n let [uriWithoutAnchor, anchor] = [uri, ''];\n const match = /^(.*)(#.*)$/.exec(uri);\n if (match) {\n [,uriWithoutAnchor, anchor] = /^(.*)(#.*)$/.exec(uri);\n }\n uriWithoutAnchor = Object.keys(data).reduce((gUri, d, index) => {\n gUri += `${(index === 0 && gUri.indexOf('?') === -1)?'?':'&'}${d}=${data[d]}`;\n return gUri;\n }, uriWithoutAnchor);\n return uriWithoutAnchor + anchor;\n }\n};\n\n// export const httpPostTransformer = {\n// headers({uri, headers, data}) {\n// if (!data) {\n// return headers;\n// }\n// const updatedHeaders = headers || {};\n// if (!updatedHeaders['Content-Type']) {\n// updatedHeaders['Content-Type'] = 'application/x-www-form-urlencoded';\n// }\n// return updatedHeaders;\n// }\n// };\n","/**\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 = Middleware;\n\nexport default frontexpress;\n"],"names":["routeMatcher","request","route","method","uri","match","exec","baseUriToCheck","RegExp","indexOf","decodeParmeterValue","v","isNaN","parseFloat","isFinite","Number","isInteger","parseInt","keys","keysRE","keysMatch","push","regExpUri","replace","routeMatch","params","Object","assign","reduce","acc","key","index","value","split","map","errorIfNotFunction","toTest","message","TypeError","toParameters","args","baseUri","middleware","router","plugin","which","length","Router","Middleware","name","response","Route","uriPart","visited","this","trim","_baseUri","_routes","application","isRouteMatch","get","filter","_add","undefined","forEach","toLowerCase","babelHelpers.typeof","methodName","prototype","Requester","resolve","reject","headers","data","success","responseText","fail","status","statusText","errorThrown","xmlhttp","XMLHttpRequest","onreadystatechange","readyState","open","header","setRequestHeader","send","httpGetTransformer","uriWithoutAnchor","anchor","gUri","d","Settings","settings","rules","requester","fetch","transformer","checkRules","Application","routers","plugins","set","callback","window","location","pathname","search","currentRoutes","_callMiddlewareMethod","onpopstate","event","state","_this","middlewareMethod","onbeforeunload","whenPageIsInteractiveFn","pluginObject","document","routes","meth","exited","some","next","breakMiddlewareLoop","req","history","httpMethodTransformer","_uriFn","_headersFn","_dataFn","pushState","title","reqProto","middlewareMethodName","charAt","toUpperCase","slice","_fetch","frontexpress"],"mappings":"wCA+PA,SAAgBA,GAAaC,EAASC,MAE9BA,EAAMC,QAAUD,EAAMC,SAAWF,EAAQE,cAClC,MAKND,EAAME,MAAQH,EAAQG,WAChB,KAILC,GAAQ,wCAAwCC,KAAKL,EAAQG,KAC7DG,EAAiBF,EAAM,IAAMA,EAAM,IAAMA,EAAM,MAGjDH,EAAME,cAAeI,cACsB,QAApCD,EAAeF,MAAMH,EAAME,SAIN,IAA5BF,EAAME,IAAIK,QAAQ,KAAa,QAEzBC,GAAsB,SAACC,UACjBC,MAAMC,WAAWF,KAAOG,SAASH,GAAMI,OAAOC,UAAUL,GAAKI,OAAOE,SAASN,EAAG,IAAMI,OAAOF,WAAWF,GAAMA,GAIpHO,KACAC,EAAS,kBACXC,EAAYD,EAAOb,KAAKJ,EAAME,KACd,MAAbgB,KACEC,KAAKD,EAAU,MACRD,EAAOb,KAAKJ,EAAME,QAI5BkB,GAAYpB,EAAME,IAEHmB,QAAQ,eAAgB,iBAExBA,QAAQ,WAAY,WAEpBA,QAAQ,IAAK,OAG5BC,EAAajB,EAAeF,MAAM,GAAIG,YAAWc,gBAClDE,MAKGC,OAASC,OAAOC,OAAO1B,EAAQwB,OAAQP,EAAKU,OAAO,SAACC,EAAKC,EAAKC,MAC9DC,GAAQR,EAAWO,EAAQ,SAC3BC,QACgC,IAAxBA,EAAMvB,QAAQ,KAAcuB,EAAMC,MAAM,KAAKC,IAAI,kBAAKxB,GAAoBC,KAAMqB,EAAQtB,EAAoBsB,MAEpHF,GAAOE,EACJH,SAEJ,SAIJ3B,GAAME,MAAQG,EC5TzB,QAIS4B,GAAmBC,EAAQC,MACX,kBAAXD,QACA,IAAIE,WAAUD,GC+W5B,QAAgBE,GAAaC,eACrBC,SAASC,SAAYC,SAAQC,SAAQC,eAEzB,OAAXC,UAA0BN,WAAVK,WAAqCL,WAAnBC,OAASI,QAE5CA,YA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