319 lines
677 KiB
JavaScript
319 lines
677 KiB
JavaScript
|
"use strict";var e=require("obsidian"),n=require("crypto"),t=require("path"),a=require("tty"),i=require("util"),o=require("fs"),r=require("net"),s=require("events"),c=require("stream"),p=require("zlib"),l=require("buffer"),u=require("string_decoder"),d=require("querystring"),f=require("url"),m=require("http");function v(e){var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var h=v(e);const x={port:8080,hostname:"0.0.0.0",defaultFile:"",startOnLoad:!1,useRibbonButons:!0,indexHtml:'<html>\n<head>\n <meta charset="utf-8">\n <meta name="viewport"\n content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">\n <title>#VAR{HTML_TITLE}</title>\n <link rel="shortcut icon" href="#VAR{FAVICON_URL}">\n <link href="#VAR{CSS_FILE_URL}" type="text/css" rel="stylesheet">\n <base href="/">\n</head>\n<body\n class="#VAR{THEME_MODE} mod-windows is-frameless is-maximized is-hidden-frameless obsidian-app show-inline-title show-view-header"\n style="--zoom-factor:1; --font-text-size:16px;">\n <div class="app-container">\n <div class="horizontal-main-container">\n <div class="workspace">\n <div class="workspace-split mod-vertical mod-root">\n <div class="workspace-tabs mod-top mod-top-left-space mod-top-right-space">\n <div class="workspace-tab-container">\n <div class="workspace-leaf">\n <div class="workspace-leaf-content" data-type="markdown" data-mode="preview">\n <div class="view-content">\n <div class="markdown-reading-view" style="width: 100%; height: 100%;">\n <div\n class="markdown-preview-view markdown-rendered node-insert-event is-readable-line-width allow-fold-headings show-indentation-guide allow-fold-lists"\n tabindex="-1" style="tab-size: 4;">\n <div class="markdown-preview-sizer markdown-preview-section" style="padding-bottom: 369px; min-height: 1158px;">\n <div class="markdown-preview-pusher" style="width: 1px; height: 0.1px; margin-bottom: 0px;"></div>\n <div class="mod-header">\n <div class="inline-title" contenteditable="true" spellcheck="false" tabindex="-1" enterkeyhint="done">#VAR{RENDERED_CONTENT_FILE_NAME}\n </div>\n #VAR{RENDERED_CONTENT}\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</body>\n</html>',htmlReplaceableVariables:[{varName:"HTML_TITLE",varValue:"Obsidian Html Server"},{varName:"FAVICON_URL",varValue:"//obsidian.md/favicon.ico"},{varName:"CSS_FILE_URL",varValue:"/.obsidian/plugins/obsidian-http-server/app.css"}],showAdvancedOptions:!1,useSimpleAuth:!1,simpleAuthUsername:"obsidian",simpleAuthPassword:n.randomBytes(8).toString("hex")};var g="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function b(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var y={exports:{}},w={exports:{}},k=t.relative,j=function(e){if(!e)throw new TypeError("argument namespace is required");var n=C(I()[1])[0];function t(e){A.call(t,e)}return t._file=n,t._ignored=function(e){if(process.noDeprecation)return!0;return S(process.env.NO_DEPRECATION||"",e)}(e),t._namespace=e,t._traced=function(e){if(process.traceDeprecation)return!0;return S(process.env.TRACE_DEPRECATION||"",e)}(e),t._warned=Object.create(null),t.function=R,t.property=D,t},E=process.cwd();function S(e,n){for(var t=e.split(/[ ,]+/),a=String(n).
|
|||
|
/*!
|
|||
|
* bytes
|
|||
|
* Copyright(c) 2012-2014 TJ Holowaychuk
|
|||
|
* Copyright(c) 2015 Jed Watson
|
|||
|
* MIT Licensed
|
|||
|
*/function M(){if(N)return L.exports;N=1,L.exports=function(e,n){if("string"==typeof e)return o(e);if("number"==typeof e)return i(e,n);return null},L.exports.format=i,L.exports.parse=o;var e=/\B(?=(\d{3})+(?!\d))/g,n=/(?:\.0*|(\.[^0]+)0+)$/,t={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},a=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function i(a,i){if(!Number.isFinite(a))return null;var o=Math.abs(a),r=i&&i.thousandsSeparator||"",s=i&&i.unitSeparator||"",c=i&&void 0!==i.decimalPlaces?i.decimalPlaces:2,p=Boolean(i&&i.fixedDecimals),l=i&&i.unit||"";l&&t[l.toLowerCase()]||(l=o>=t.pb?"PB":o>=t.tb?"TB":o>=t.gb?"GB":o>=t.mb?"MB":o>=t.kb?"KB":"B");var u=(a/t[l.toLowerCase()]).toFixed(c);return p||(u=u.replace(n,"$1")),r&&(u=u.split(".").map((function(n,t){return 0===t?n.replace(e,r):n})).join(".")),u+s+l}function o(e){if("number"==typeof e&&!isNaN(e))return e;if("string"!=typeof e)return null;var n,i=a.exec(e),o="b";return i?(n=parseFloat(i[1]),o=i[4].toLowerCase()):(n=parseInt(e,10),o="b"),isNaN(n)?null:Math.floor(t[o]*n)}return L.exports}var U={},F=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,H=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,$=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,W=/([\\"])/g,G=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|||
|
/*!
|
|||
|
* content-type
|
|||
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function Z(e){var n=String(e);if($.test(n))return n;if(n.length>0&&!H.test(n))throw new TypeError("invalid parameter value");return'"'+n.replace(W,"\\$1")+'"'}function J(e){this.parameters=Object.create(null),this.type=e}U.format=function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var n=e.parameters,t=e.type;if(!t||!G.test(t))throw new TypeError("invalid type");var a=t;if(n&&"object"==typeof n)for(var i,o=Object.keys(n).sort(),r=0;r<o.length;r++){if(i=o[r],!$.test(i))throw new TypeError("invalid parameter name");a+="; "+i+"="+Z(n[i])}return a},U.parse=function(e){if(!e)throw new TypeError("argument string is required");var n="object"==typeof e?function(e){var n;"function"==typeof e.getHeader?n=e.getHeader("content-type"):"object"==typeof e.headers&&(n=e.headers&&e.headers["content-type"]);if("string"!=typeof n)throw new TypeError("content-type header is missing from object");return n}(e):e;if("string"!=typeof n)throw new TypeError("argument string is required to be a string");var t=n.indexOf(";"),a=-1!==t?n.slice(0,t).trim():n.trim();if(!G.test(a))throw new TypeError("invalid media type");var i=new J(a.toLowerCase());if(-1!==t){var o,r,s;for(F.lastIndex=t;r=F.exec(n);){if(r.index!==t)throw new TypeError("invalid parameter format");t+=r[0].length,o=r[1].toLowerCase(),34===(s=r[2]).charCodeAt(0)&&-1!==(s=s.slice(1,-1)).indexOf("\\")&&(s=s.replace(V,"$1")),i.parameters[o]=s}if(t!==n.length)throw new TypeError("invalid parameter format")}return i};var Y={exports:{}},X=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,n){return e.__proto__=n,e}:function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(e,t)||(e[t]=n[t]);return e});var Q={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},K=ne;
|
|||
|
/*!
|
|||
|
* statuses
|
|||
|
* Copyright(c) 2014 Jonathan Ong
|
|||
|
* Copyright(c) 2016 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function ee(e){if(!Object.prototype.hasOwnProperty.call(ne.message,e))throw new Error("invalid status code: "+e);return ne.message[e]}function ne(e){if("number"==typeof e)return ee(e);if("string"!=typeof e)throw new TypeError("code must be a number or string");var n=parseInt(e,10);return isNaN(n)?function(e){var n=e.toLowerCase();if(!Object.prototype.hasOwnProperty.call(ne.code,n))throw new Error('invalid status message: "'+e+'"');return ne.code[n]}(e):ee(n)}ne.message=Q,ne.code=function(e){var n={};return Object.keys(e).forEach((function(t){var a=e[t],i=Number(t);n[a.toLowerCase()]=i})),n}(Q),ne.codes=function(e){return Object.keys(e).map((function(e){return Number(e)}))}(Q),ne.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0},ne.empty={204:!0,205:!0,304:!0},ne.retry={502:!0,503:!0,504:!0};var te,ae={exports:{}},ie={exports:{}};try{var oe=require("util");if("function"!=typeof oe.inherits)throw"";ae.exports=oe.inherits}catch(e){ae.exports=(te||(te=1,"function"==typeof Object.create?ie.exports=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ie.exports=function(e,n){if(n){e.super_=n;var t=function(){};t.prototype=n.prototype,e.prototype=new t,e.prototype.constructor=e}}),ie.exports)}var re=ae.exports,se=function(e){return e.split(" ").map((function(e){return e.slice(0,1).toUpperCase()+e.slice(1)})).join("").replace(/[^ _0-9a-z]/gi,"")}
|
|||
|
/*!
|
|||
|
* http-errors
|
|||
|
* Copyright(c) 2014 Jonathan Ong
|
|||
|
* Copyright(c) 2016 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/;
|
|||
|
/*!
|
|||
|
* toidentifier
|
|||
|
* Copyright(c) 2016 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/!function(e){var n,t=j("http-errors"),a=X,i=K,o=re,r=se;function s(e){return Number(String(e).charAt(0)+"00")}function c(e,n){var t=Object.getOwnPropertyDescriptor(e,"name");t&&t.configurable&&(t.value=n,Object.defineProperty(e,"name",t))}function p(e){return"Error"!==e.substr(-5)?e+"Error":e}e.exports=function e(){for(var n,a,o=500,r={},c=0;c<arguments.length;c++){var p=arguments[c],l=typeof p;if("object"===l&&p instanceof Error)o=(n=p).status||n.statusCode||o;else if("number"===l&&0===c)o=p;else if("string"===l)a=p;else{if("object"!==l)throw new TypeError("argument #"+(c+1)+" unsupported type "+l);r=p}}"number"==typeof o&&(o<400||o>=600)&&t("non-error status code; use only 4xx or 5xx status codes");("number"!=typeof o||!i.message[o]&&(o<400||o>=600))&&(o=500);var u=e[o]||e[s(o)];n||(n=u?new u(a):new Error(a||i.message[o]),Error.captureStackTrace(n,e));u&&n instanceof u&&n.status===o||(n.expose=o<500,n.status=n.statusCode=o);for(var d in r)"status"!==d&&"statusCode"!==d&&(n[d]=r[d]);return n},e.exports.HttpError=function(){function e(){throw new TypeError("cannot construct abstract class")}return o(e,Error),e}(),e.exports.isHttpError=(n=e.exports.HttpError,function(e){return!(!e||"object"!=typeof e)&&(e instanceof n||e instanceof Error&&"boolean"==typeof e.expose&&"number"==typeof e.statusCode&&e.status===e.statusCode)}),function(e,n,t){n.forEach((function(n){var l,u=r(i.message[n]);switch(s(n)){case 400:l=function(e,n,t){var r=p(n);function s(e){var n=null!=e?e:i.message[t],o=new Error(n);return Error.captureStackTrace(o,s),a(o,s.prototype),Object.defineProperty(o,"message",{enumerable:!0,configurable:!0,value:n,writable:!0}),Object.defineProperty(o,"name",{enumerable:!1,configurable:!0,value:r,writable:!0}),o}return o(s,e),c(s,r),s.prototype.status=t,s.prototype.statusCode=t,s.prototype.expose=!0,s}(t,u,n);break;case 500:l=function(e,n,t){var r=p(n);function s(e){var n=null!=e?e:i.message[t],o=new Error(n);return Error.captureStackTrace(o,s),a(o,s.prototype),Object.defineProperty(o,"message",{enumerable:!0,configurable:!0,value:n,writable:!0}),Object.defineProperty(o,"name",{enumerable:!1,configurable:!0,value:r,writable:!0}),o}return o(s,e),c(s,r),s.prototype.status=t,s.prototype.statusCode=t,s.prototype.expose=!1,s}(t,u,n)}l&&(e[n]=l,e[u]=l)}))}(e.exports,i.codes,e.exports.HttpError)}(Y);var ce,pe,le,ue,de=Y.exports,fe={exports:{}},me={exports:{}},ve={exports:{}};function he(){if(pe)return ce;pe=1;var e=1e3,n=60*e,t=60*n,a=24*t,i=365.25*a;function o(e,n,t){if(!(e<n))return e<1.5*n?Math.floor(e/n)+" "+t:Math.ceil(e/n)+" "+t+"s"}return ce=function(r,s){s=s||{};var c=typeof r;if("string"===c&&r.length>0)return function(o){if((o=String(o)).length>100)return;var r=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(o);if(!r)return;var s=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return s*i;case"days":case"day":case"d":return s*a;case"hours":case"hour":case"hrs":case"hr":case"h":return s*t;case"minutes":case"minute":case"mins":case"min":case"m":return s*n;case"seconds":case"second":case"secs":case"sec":case"s":return s*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(r);if("number"===c&&!1===isNaN(r))return s.long?function(i){return o(i,a,"day")||o(i,t,"hour")||o(i,n,"minute")||o(i,e,"second")||i+" ms"}(r):function(i){if(i>=a)return Math.round(i/a)+"d";if(i>=t)return Math.round(i/t)+"h";if(i>=n)return Math.round(i/n)+"m";if(i>=e)return Math.round(i/e)+"s";return i+"ms"}(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))},ce}function xe(){return le||(le=1,function(e,n){var t;function a(e){function a(){if(a.enabled){var e=a,i=+new Date,o=i-(t||i);e.diff=o,e.prev=t,e.curr=i,t=i;for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];r[0]=n.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");var c=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,(function(t,a){if("%%"===t)return t;c++;var i=n.form
|
|||
|
/*!
|
|||
|
* destroy
|
|||
|
* Copyright(c) 2014 Jonathan Ong
|
|||
|
* Copyright(c) 2015-2022 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/var ke=s.EventEmitter,je=o.ReadStream,Ee=c,Se=p,Oe=function(e,n){!function(e){return e instanceof je}(e)?function(e){return e instanceof Se.Gzip||e instanceof Se.Gunzip||e instanceof Se.Deflate||e instanceof Se.DeflateRaw||e instanceof Se.Inflate||e instanceof Se.InflateRaw||e instanceof Se.Unzip}(e)?function(e){"function"==typeof e.destroy?e._binding?(e.destroy(),e._processing?(e._needDrain=!0,e.once("drain",Ce)):e._binding.clear()):e._destroy&&e._destroy!==Ee.Transform.prototype._destroy?e.destroy():e._destroy&&"function"==typeof e.close?(e.destroyed=!0,e.close()):e.destroy():"function"==typeof e.close&&function(e){if(!0===e._hadError){var n=null===e._binding?"_binding":"_handle";e[n]={close:function(){this[n]=null}}}e.close()}(e)}(e):function(e){return e instanceof Ee&&"function"==typeof e.destroy}(e)&&e.destroy():function(e){e.destroy(),"function"==typeof e.close&&e.on("open",_e)}(e);t=e,t instanceof ke&&n&&(e.removeAllListeners("error"),e.addListener("error",Ae));var t;return e};function Ae(){}function Ce(){this._binding.clear()}function _e(){"number"==typeof this.fd&&this.close()}var Te,qe,ze={exports:{}};function Ie(){if(qe)return Te;qe=1;var e,n=l,t=n.Buffer,a={};for(e in n)n.hasOwnProperty(e)&&"SlowBuffer"!==e&&"Buffer"!==e&&(a[e]=n[e]);var i=a.Buffer={};for(e in t)t.hasOwnProperty(e)&&"allocUnsafe"!==e&&"allocUnsafeSlow"!==e&&(i[e]=t[e]);if(a.Buffer.prototype=t.prototype,i.from&&i.from!==Uint8Array.from||(i.from=function(e,n,a){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return t(e,n,a)}),i.alloc||(i.alloc=function(e,n,a){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var i=t(e);return n&&0!==n.length?"string"==typeof a?i.fill(n,a):i.fill(n):i.fill(0),i}),!a.kStringMaxLength)try{a.kStringMaxLength=process.binding("buffer").kStringMaxLength}catch(e){}return a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),Te=a}var Pe,Re={};function De(){if(Pe)return Re;Pe=1;function e(e,n){this.encoder=e,this.addBOM=!0}function n(e,n){this.decoder=e,this.pass=!1,this.options=n||{}}return Re.PrependBOM=e,e.prototype.write=function(e){return this.addBOM&&(e="\ufeff"+e,this.addBOM=!1),this.encoder.write(e)},e.prototype.end=function(){return this.encoder.end()},Re.StripBOM=n,n.prototype.write=function(e){var n=this.decoder.write(e);return this.pass||!n||("\ufeff"===n[0]&&(n=n.slice(1),"function"==typeof this.options.stripBOM&&this.options.stripBOM()),this.pass=!0),n},n.prototype.end=function(){return this.decoder.end()},Re}var Be,Ne,Le={};function Me(){if(Ne)return Be;Ne=1;var e=Ie().Buffer;function n(n,t){this.enc=n.encodingName,this.bomAware=n.bomAware,"base64"===this.enc?this.encoder=o:"cesu8"===this.enc&&(this.enc="utf8",this.encoder=r,"💩"!==e.from("eda0bdedb2a9","hex").toString()&&(this.decoder=s,this.defaultCharUnicode=t.defaultCharUnicode))}Be={utf8:{type:"_internal",bomAware:!0},cesu8:{type:"_internal",bomAware:!0},unicode11utf8:"utf8",ucs2:{type:"_internal",bomAware:!0},utf16le:"ucs2",binary:{type:"_internal"},base64:{type:"_internal"},hex:{type:"_internal"},_internal:n},n.prototype.encoder=i,n.prototype.decoder=a;var t=u.StringDecoder;function a(e,n){t.call(this,n.enc)}function i(e,n){this.enc=n.enc}function o(e,n){this.prevStr=""}function r(e,n){}function s(e,n){this.acc=0,this.contBytes=0,this.accBytes=0,this.defaultCharUnicode=n.defaultCharUnicode}return t.prototype.end||(t.prototype.end=function(){}),a.prototype=t.prototype,i.prototype.write=function(n){return e.from(n,this.enc)},i.prototype.end=function(){},o.prototype.write=function(n){var t=(n=this.prevStr+n).length-n.length%4;return this.prevStr=n.slice(t),n=n.slice(0,t),e.from(n,"base64")},o
|
|||
|
/*!
|
|||
|
* unpipe
|
|||
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/var wn,kn,jn=function(e){if(!e)throw new TypeError("argument stream is required");if("function"==typeof e.unpipe)return void e.unpipe();if(!function(e){for(var n=e.listeners("data"),t=0;t<n.length;t++)if("ondata"===n[t].name)return!0;return!1}(e))return;for(var n,t=e.listeners("close"),a=0;a<t.length;a++)"cleanup"!==(n=t[a]).name&&"onclose"!==n.name||n.call(e)}
|
|||
|
/*!
|
|||
|
* raw-body
|
|||
|
* Copyright(c) 2013-2014 Jonathan Ong
|
|||
|
* Copyright(c) 2014-2022 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/;function En(){if(kn)return wn;kn=1;var e=function(){try{return require("async_hooks")}catch(e){return{}}}(),n=M(),t=de,a=yn(),i=jn;wn=function(t,a,i){var o=i,s=a||{};!0!==a&&"string"!=typeof a||(s={encoding:a});"function"==typeof a&&(o=a,s={});if(void 0!==o&&"function"!=typeof o)throw new TypeError("argument callback must be a function");if(!o&&!g.Promise)throw new TypeError("argument callback is required");var c=!0!==s.encoding?s.encoding:"utf-8",p=n.parse(s.limit),l=null==s.length||isNaN(s.length)?null:parseInt(s.length,10);if(o)return r(t,c,l,p,function(n){var t;e.AsyncResource&&(t=new e.AsyncResource(n.name||"bound-anonymous-fn"));if(!t||!t.runInAsyncScope)return n;return t.runInAsyncScope.bind(t,n,null)}(o));return new Promise((function(e,n){r(t,c,l,p,(function(t,a){if(t)return n(t);e(a)}))}))};var o=/^Encoding not recognized: /;function r(e,n,r,s,c){var p=!1,l=!0;if(null!==s&&null!==r&&r>s)return v(t(413,"request entity too large",{expected:r,length:r,limit:s,type:"entity.too.large"}));var u=e._readableState;if(e._decoder||u&&(u.encoding||u.decoder))return v(t(500,"stream encoding should not be set",{type:"stream.encoding.set"}));if(void 0!==e.readable&&!e.readable)return v(t(500,"stream is not readable",{type:"stream.not.readable"}));var d,f=0;try{d=function(e){if(!e)return null;try{return a.getDecoder(e)}catch(n){if(!o.test(n.message))throw n;throw t(415,"specified encoding unsupported",{encoding:e,type:"encoding.unsupported"})}}(n)}catch(e){return v(e)}var m=d?"":[];function v(){for(var n=new Array(arguments.length),t=0;t<n.length;t++)n[t]=arguments[t];function a(){b(),n[0]&&function(e){i(e),"function"==typeof e.pause&&e.pause()}(e),c.apply(null,n)}p=!0,l?process.nextTick(a):a()}function h(){p||v(t(400,"request aborted",{code:"ECONNABORTED",expected:r,length:r,received:f,type:"request.aborted"}))}function x(e){p||(f+=e.length,null!==s&&f>s?v(t(413,"request entity too large",{limit:s,received:f,type:"entity.too.large"})):d?m+=d.write(e):m.push(e))}function g(e){if(!p){if(e)return v(e);if(null!==r&&f!==r)v(t(400,"request size did not match content length",{expected:r,length:r,received:f,type:"request.size.invalid"}));else v(null,d?m+(d.end()||""):Buffer.concat(m))}}function b(){m=null,e.removeListener("aborted",h),e.removeListener("data",x),e.removeListener("end",g),e.removeListener("error",g),e.removeListener("close",b)}e.on("aborted",h),e.on("close",b),e.on("data",x),e.on("end",g),e.on("error",g),l=!1}return wn}var Sn={exports:{}},On=function(e,n){if(!Array.isArray(e))throw new TypeError("arg must be an array of [ee, events...] arrays");for(var t=[],a=0;a<e.length;a++){var i=e[a];if(!Array.isArray(i)||i.length<2)throw new TypeError("each array member must be [ee, events...]");for(var o=i[0],r=1;r<i.length;r++){var s=i[r],c=An(s,p);o.on(s,c),t.push({ee:o,event:s,fn:c})}}function p(){l(),n.apply(null,arguments)}function l(){for(var e,n=0;n<t.length;n++)(e=t[n]).ee.removeListener(e.event,e.fn)}function u(e){n=e}return u.cancel=l,u};
|
|||
|
/*!
|
|||
|
* ee-first
|
|||
|
* Copyright(c) 2014 Jonathan Ong
|
|||
|
* MIT Licensed
|
|||
|
*/function An(e,n){return function(t){for(var a=new Array(arguments.length),i="error"===e?t:null,o=0;o<a.length;o++)a[o]=arguments[o];n(i,this,e,a)}}
|
|||
|
/*!
|
|||
|
* on-finished
|
|||
|
* Copyright(c) 2013 Jonathan Ong
|
|||
|
* Copyright(c) 2014 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/Sn.exports=function(e,n){if(!1!==qn(e))return Tn(n,null,e),e;return function(e,n){var t=e.__onFinished;t&&t.queue||(t=e.__onFinished=function(e){function n(t){if(e.__onFinished===n&&(e.__onFinished=null),n.queue){var a=n.queue;n.queue=null;for(var i=0;i<a.length;i++)a[i](t,e)}}return n.queue=[],n}(e),function(e,n){var t,a,i=!1;function o(e){t.cancel(),a.cancel(),i=!0,n(e)}function r(n){e.removeListener("socket",r),i||t===a&&(a=_n([[n,"error","close"]],o))}if(t=a=_n([[e,"end","finish"]],o),e.socket)return void r(e.socket);e.on("socket",r),void 0===e.socket&&function(e,n){var t=e.assignSocket;if("function"!=typeof t)return;e.assignSocket=function(e){t.call(this,e),n(e)}}(e,r)}(e,t));t.queue.push(n)}(e,function(e){var n;Cn.AsyncResource&&(n=new Cn.AsyncResource(e.name||"bound-anonymous-fn"));if(!n||!n.runInAsyncScope)return e;return n.runInAsyncScope.bind(n,e,null)}(n)),e},Sn.exports.isFinished=qn;var Cn=function(){try{return require("async_hooks")}catch(e){return{}}}(),_n=On,Tn="function"==typeof setImmediate?setImmediate:function(e){process.nextTick(e.bind.apply(e,arguments))};function qn(e){var n=e.socket;return"boolean"==typeof e.finished?Boolean(e.finished||n&&!n.writable):"boolean"==typeof e.complete?Boolean(e.upgrade||!n||!n.readable||e.complete&&!e.readable):void 0}var zn,In,Pn=Sn.exports;
|
|||
|
/*!
|
|||
|
* body-parser
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function Rn(){if(In)return zn;In=1;var e=de,n=Oe,t=En(),a=yn(),i=Pn,o=jn,r=p;return zn=function(s,c,p,l,u,d){var f,m,v=d;s._body=!0;var h=null!==v.encoding?v.encoding:null,x=v.verify;try{m=function(n,t,a){var i,o=(n.headers["content-encoding"]||"identity").toLowerCase(),s=n.headers["content-length"];if(t('content-encoding "%s"',o),!1===a&&"identity"!==o)throw e(415,"content encoding unsupported",{encoding:o,type:"encoding.unsupported"});switch(o){case"deflate":i=r.createInflate(),t("inflate body"),n.pipe(i);break;case"gzip":i=r.createGunzip(),t("gunzip body"),n.pipe(i);break;case"identity":(i=n).length=s;break;default:throw e(415,'unsupported content encoding "'+o+'"',{encoding:o,type:"encoding.unsupported"})}return i}(s,u,v.inflate),f=m.length,m.length=void 0}catch(e){return p(e)}if(v.length=f,v.encoding=x?null:h,null===v.encoding&&null!==h&&!a.encodingExists(h))return p(e(415,'unsupported charset "'+h.toUpperCase()+'"',{charset:h.toLowerCase(),type:"charset.unsupported"}));u("read body"),t(m,v,(function(t,r){var d;if(t)return d="encoding.unsupported"===t.type?e(415,'unsupported charset "'+h.toUpperCase()+'"',{charset:h.toLowerCase(),type:"charset.unsupported"}):e(400,t),m!==s&&(o(s),n(m,!0)),void function(e,n){i.isFinished(e)?n(null):(i(e,n),e.resume())}(s,(function(){p(e(400,d))}));if(x)try{u("verify body"),x(s,c,r,h)}catch(n){return void p(e(403,n,{body:r,type:n.type||"entity.verify.failed"}))}var f=r;try{u("parse body"),f="string"!=typeof r&&null!==h?a.decode(r,h):r,s.body=l(f)}catch(n){return void p(e(400,n,{body:f,type:n.type||"entity.parse.failed"}))}p()}))},zn}var Dn={exports:{}},Bn={},Nn=/; *([!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) *= *("(?:[ !\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u0020-\u007e])*"|[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) */g,Ln=/^[\u0020-\u007e\u0080-\u00ff]+$/,Mn=/^[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+$/,Un=/\\([\u0000-\u007f])/g,Fn=/([\\"])/g,Hn=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.-]{0,126}$/,$n=/^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}$/,Vn=/^ *([A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126})\/([A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}) *$/;function Wn(e){var n=String(e);if(Mn.test(n))return n;if(n.length>0&&!Ln.test(n))throw new TypeError("invalid parameter value");return'"'+n.replace(Fn,"\\$1")+'"'}Bn.format=function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var n=e.parameters,t=e.subtype,a=e.suffix,i=e.type;if(!i||!$n.test(i))throw new TypeError("invalid type");if(!t||!Hn.test(t))throw new TypeError("invalid subtype");var o=i+"/"+t;if(a){if(!$n.test(a))throw new TypeError("invalid suffix");o+="+"+a}if(n&&"object"==typeof n)for(var r,s=Object.keys(n).sort(),c=0;c<s.length;c++){if(r=s[c],!Mn.test(r))throw new TypeError("invalid parameter name");o+="; "+r+"="+Wn(n[r])}return o},Bn.parse=function(e){if(!e)throw new TypeError("argument string is required");"object"==typeof e&&(e=function(e){if("function"==typeof e.getHeader)return e.getHeader("content-type");if("object"==typeof e.headers)return e.headers&&e.headers["content-type"]}(e));if("string"!=typeof e)throw new TypeError("argument string is required to be a string");var n,t,a,i=e.indexOf(";"),o=function(e){var n=Vn.exec(e.toLowerCase());if(!n)throw new TypeError("invalid media type");var t,a=n[1],i=n[2],o=i.lastIndexOf("+");-1!==o&&(t=i.substr(o+1),i=i.substr(0,o));var r={type:a,subtype:i,suffix:t};return r}(-1!==i?e.substr(0,i):e),r={};Nn.lastIndex=i;for(;t=Nn.exec(e);){if(t.index!==i)throw new TypeError("invalid parameter format");i+=t[0].length,n=t[1].toLowerCase(),'"'===(a=t[2])[0]&&(a=a.substr(1,a.length-2).replace(Un,"$1")),r[n]=a}if(-1!==i&&i!==e.length)throw new TypeError("invalid parameter format");return o.parameters=r,o};var Gn={},Zn={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"ia
|
|||
|
/*!
|
|||
|
* mime-types
|
|||
|
* Copyright(c) 2014 Jonathan Ong
|
|||
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/
|
|||
|
!function(e){var n,a,i,o=Zn,r=t.extname,s=/^\s*([^;\s]*)(?:;|\s|$)/,c=/^text\//i;function p(e){if(!e||"string"!=typeof e)return!1;var n=s.exec(e),t=n&&o[n[1].toLowerCase()];return t&&t.charset?t.charset:!(!n||!c.test(n[1]))&&"UTF-8"}e.charset=p,e.charsets={lookup:p},e.contentType=function(n){if(!n||"string"!=typeof n)return!1;var t=-1===n.indexOf("/")?e.lookup(n):n;if(!t)return!1;if(-1===t.indexOf("charset")){var a=e.charset(t);a&&(t+="; charset="+a.toLowerCase())}return t},e.extension=function(n){if(!n||"string"!=typeof n)return!1;var t=s.exec(n),a=t&&e.extensions[t[1].toLowerCase()];if(!a||!a.length)return!1;return a[0]},e.extensions=Object.create(null),e.lookup=function(n){if(!n||"string"!=typeof n)return!1;var t=r("x."+n).toLowerCase().substr(1);if(!t)return!1;return e.types[t]||!1},e.types=Object.create(null),n=e.extensions,a=e.types,i=["nginx","apache",void 0,"iana"],Object.keys(o).forEach((function(e){var t=o[e],r=t.extensions;if(r&&r.length){n[e]=r;for(var s=0;s<r.length;s++){var c=r[s];if(a[c]){var p=i.indexOf(o[a[c]].source),l=i.indexOf(t.source);if("application/octet-stream"!==a[c]&&(p>l||p===l&&"application/"===a[c].substr(0,12)))continue}a[c]=e}}}))}(Gn);var Jn=b(Gn),Yn=Bn,Xn=Gn;
|
|||
|
/*!
|
|||
|
* type-is
|
|||
|
* Copyright(c) 2014 Jonathan Ong
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function Qn(e,n){var t,a,i=n,o=function(e){if(!e)return null;try{return function(e){var n=Yn.parse(e);return n.parameters=void 0,Yn.format(n)}(e)}catch(e){return null}}(e);if(!o)return!1;if(i&&!Array.isArray(i))for(i=new Array(arguments.length-1),t=0;t<i.length;t++)i[t]=arguments[t+1];if(!i||!i.length)return o;for(t=0;t<i.length;t++)if(nt(et(a=i[t]),o))return"+"===a[0]||-1!==a.indexOf("*")?o:a;return!1}function Kn(e){return void 0!==e.headers["transfer-encoding"]||!isNaN(e.headers["content-length"])}function et(e){if("string"!=typeof e)return!1;switch(e){case"urlencoded":return"application/x-www-form-urlencoded";case"multipart":return"multipart/*"}return"+"===e[0]?"*/*"+e:-1===e.indexOf("/")?Xn.lookup(e):e}function nt(e,n){if(!1===e)return!1;var t=n.split("/"),a=e.split("/");return 2===t.length&&2===a.length&&(("*"===a[0]||a[0]===t[0])&&("*+"===a[1].substr(0,2)?a[1].length<=t[1].length+1&&a[1].substr(1)===t[1].substr(1-a[1].length):"*"===a[1]||a[1]===t[1]))}Dn.exports=function(e,n){var t=n;if(!Kn(e))return null;if(arguments.length>2){t=new Array(arguments.length-1);for(var a=0;a<t.length;a++)t[a]=arguments[a+1]}var i=e.headers["content-type"];return Qn(i,t)},Dn.exports.is=Qn,Dn.exports.hasBody=Kn,Dn.exports.normalize=et,Dn.exports.match=nt;var tt,at,it,ot,rt,st,ct,pt,lt,ut,dt,ft,mt,vt,ht,xt,gt,bt,yt,wt,kt=Dn.exports;
|
|||
|
/*!
|
|||
|
* body-parser
|
|||
|
* Copyright(c) 2014 Jonathan Ong
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function jt(){if(at)return tt;at=1;var e=M(),n=U,t=de,a=we()("body-parser:json"),i=Rn(),o=kt;tt=function(c){var p=c||{},l="number"!=typeof p.limit?e.parse(p.limit||"100kb"):p.limit,u=!1!==p.inflate,d=p.reviver,f=!1!==p.strict,m=p.type||"application/json",v=p.verify||!1;if(!1!==v&&"function"!=typeof v)throw new TypeError("option verify must be function");var h="function"!=typeof m?function(e){return function(n){return Boolean(o(n,e))}}(m):m;function x(e){if(0===e.length)return{};if(f){var n=(t=e,(i=r.exec(t))?i[1]:void 0);if("{"!==n&&"["!==n)throw a("strict violation"),function(e,n){var t=e.indexOf(n),a=-1!==t?e.substring(0,t)+"#":"";try{throw JSON.parse(a),new SyntaxError("strict violation")}catch(e){return s(e,{message:e.message.replace("#",n),stack:e.stack})}}(e,n)}var t,i;try{return a("parse json"),JSON.parse(e,d)}catch(e){throw s(e,{message:e.message,stack:e.stack})}}return function(e,r,s){if(e._body)return a("body already parsed"),void s();if(e.body=e.body||{},!o.hasBody(e))return a("skip empty body"),void s();if(a("content-type %j",e.headers["content-type"]),!h(e))return a("skip parsing"),void s();var c=function(e){try{return(n.parse(e).parameters.charset||"").toLowerCase()}catch(e){return}}(e)||"utf-8";if("utf-"!==c.slice(0,4))return a("invalid charset"),void s(t(415,'unsupported charset "'+c.toUpperCase()+'"',{charset:c,type:"charset.unsupported"}));i(e,r,s,x,a,{encoding:c,inflate:u,limit:l,verify:v})}};var r=/^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/;function s(e,n){for(var t=Object.getOwnPropertyNames(e),a=0;a<t.length;a++){var i=t[a];"stack"!==i&&"message"!==i&&delete e[i]}return e.stack=n.stack.replace(e.message,n.message),e.message=n.message,e}return tt}
|
|||
|
/*!
|
|||
|
* body-parser
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function Et(){if(ot)return it;ot=1;var e=M(),n=we()("body-parser:raw"),t=Rn(),a=kt;return it=function(i){var o=i||{},r=!1!==o.inflate,s="number"!=typeof o.limit?e.parse(o.limit||"100kb"):o.limit,c=o.type||"application/octet-stream",p=o.verify||!1;if(!1!==p&&"function"!=typeof p)throw new TypeError("option verify must be function");var l="function"!=typeof c?function(e){return function(n){return Boolean(a(n,e))}}(c):c;function u(e){return e}return function(e,i,o){return e._body?(n("body already parsed"),void o()):(e.body=e.body||{},a.hasBody(e)?(n("content-type %j",e.headers["content-type"]),l(e)?void t(e,i,o,u,n,{encoding:null,inflate:r,limit:s,verify:p}):(n("skip parsing"),void o())):(n("skip empty body"),void o()))}},it}
|
|||
|
/*!
|
|||
|
* body-parser
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function St(){if(st)return rt;st=1;var e=M(),n=U,t=we()("body-parser:text"),a=Rn(),i=kt;return rt=function(o){var r=o||{},s=r.defaultCharset||"utf-8",c=!1!==r.inflate,p="number"!=typeof r.limit?e.parse(r.limit||"100kb"):r.limit,l=r.type||"text/plain",u=r.verify||!1;if(!1!==u&&"function"!=typeof u)throw new TypeError("option verify must be function");var d="function"!=typeof l?function(e){return function(n){return Boolean(i(n,e))}}(l):l;function f(e){return e}return function(e,o,r){if(e._body)return t("body already parsed"),void r();if(e.body=e.body||{},!i.hasBody(e))return t("skip empty body"),void r();if(t("content-type %j",e.headers["content-type"]),!d(e))return t("skip parsing"),void r();var l=function(e){try{return(n.parse(e).parameters.charset||"").toLowerCase()}catch(e){return}}(e)||s;a(e,o,r,f,t,{encoding:l,inflate:c,limit:p,verify:u})}},rt}function Ot(){if(ut)return lt;ut=1;var e="undefined"!=typeof Symbol&&Symbol,n=pt?ct:(pt=1,ct=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},n=Symbol("test"),t=Object(n);if("string"==typeof n)return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;for(n in e[n]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var a=Object.getOwnPropertySymbols(e);if(1!==a.length||a[0]!==n)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,n);if(42!==i.value||!0!==i.enumerable)return!1}return!0});return lt=function(){return"function"==typeof e&&("function"==typeof Symbol&&("symbol"==typeof e("foo")&&("symbol"==typeof Symbol("bar")&&n())))}}function At(){if(ft)return dt;ft=1;var e={foo:{}},n=Object;return dt=function(){return{__proto__:e}.foo===e.foo&&!({__proto__:null}instanceof n)}}function Ct(){if(vt)return mt;vt=1;var e=Array.prototype.slice,n=Object.prototype.toString;return mt=function(t){var a=this;if("function"!=typeof a||"[object Function]"!==n.call(a))throw new TypeError("Function.prototype.bind called on incompatible "+a);for(var i,o=e.call(arguments,1),r=Math.max(0,a.length-o.length),s=[],c=0;c<r;c++)s.push("$"+c);if(i=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof i){var n=a.apply(this,o.concat(e.call(arguments)));return Object(n)===n?n:this}return a.apply(t,o.concat(e.call(arguments)))})),a.prototype){var p=function(){};p.prototype=a.prototype,i.prototype=new p,p.prototype=null}return i},mt}function _t(){if(xt)return ht;xt=1;var e=Ct();return ht=Function.prototype.bind||e}function Tt(){if(wt)return yt;var e;wt=1;var n=SyntaxError,t=Function,a=TypeError,i=function(e){try{return t('"use strict"; return ('+e+").constructor;")()}catch(e){}},o=Object.getOwnPropertyDescriptor;if(o)try{o({},"")}catch(e){o=null}var r=function(){throw new a},s=o?function(){try{return r}catch(e){try{return o(arguments,"callee").get}catch(e){return r}}}():r,c=Ot()(),p=At()(),l=Object.getPrototypeOf||(p?function(e){return e.__proto__}:null),u={},d="undefined"!=typeof Uint8Array&&l?l(Uint8Array):e,f={"%AggregateError%":"undefined"==typeof AggregateError?e:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?e:ArrayBuffer,"%ArrayIteratorPrototype%":c&&l?l([][Symbol.iterator]()):e,"%AsyncFromSyncIteratorPrototype%":e,"%AsyncFunction%":u,"%AsyncGenerator%":u,"%AsyncGeneratorFunction%":u,"%AsyncIteratorPrototype%":u,"%Atomics%":"undefined"==typeof Atomics?e:Atomics,"%BigInt%":"undefined"==typeof BigInt?e:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?e:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":
|
|||
|
/*!
|
|||
|
* body-parser
|
|||
|
* Copyright(c) 2014 Jonathan Ong
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function ca(){if(Xt)return Yt;Xt=1;var e=M(),n=U,t=de,a=we()("body-parser:urlencoded"),i=j("body-parser"),o=Rn(),r=kt;Yt=function(s){var l=s||{};void 0===l.extended&&i("undefined extended: provide extended option");var u=!1!==l.extended,d=!1!==l.inflate,f="number"!=typeof l.limit?e.parse(l.limit||"100kb"):l.limit,m=l.type||"application/x-www-form-urlencoded",v=l.verify||!1;if(!1!==v&&"function"!=typeof v)throw new TypeError("option verify must be function");var h=u?function(e){var n=void 0!==e.parameterLimit?e.parameterLimit:1e3,i=p("qs");if(isNaN(n)||n<1)throw new TypeError("option parameterLimit must be a positive number");isFinite(n)&&(n|=0);return function(e){var o=c(e,n);if(void 0===o)throw a("too many parameters"),t(413,"too many parameters",{type:"parameters.too.many"});var r=Math.max(100,o);return a("parse extended urlencoding"),i(e,{allowPrototypes:!0,arrayLimit:r,depth:1/0,parameterLimit:n})}}(l):function(e){var n=void 0!==e.parameterLimit?e.parameterLimit:1e3,i=p("querystring");if(isNaN(n)||n<1)throw new TypeError("option parameterLimit must be a positive number");isFinite(n)&&(n|=0);return function(e){if(void 0===c(e,n))throw a("too many parameters"),t(413,"too many parameters",{type:"parameters.too.many"});return a("parse urlencoding"),i(e,void 0,void 0,{maxKeys:n})}}(l),x="function"!=typeof m?function(e){return function(n){return Boolean(r(n,e))}}(m):m;function g(e){return e.length?h(e):{}}return function(e,i,s){if(e._body)return a("body already parsed"),void s();if(e.body=e.body||{},!r.hasBody(e))return a("skip empty body"),void s();if(a("content-type %j",e.headers["content-type"]),!x(e))return a("skip parsing"),void s();var c=function(e){try{return(n.parse(e).parameters.charset||"").toLowerCase()}catch(e){return}}(e)||"utf-8";if("utf-8"!==c)return a("invalid charset"),void s(t(415,'unsupported charset "'+c.toUpperCase()+'"',{charset:c,type:"charset.unsupported"}));o(e,i,s,g,a,{debug:a,encoding:c,inflate:d,limit:f,verify:v})}};var s=Object.create(null);function c(e,n){for(var t=0,a=0;-1!==(a=e.indexOf("&",a));)if(a++,++t===n)return;return t}function p(e){var n=s[e];if(void 0!==n)return n.parse;switch(e){case"qs":n=sa();break;case"querystring":n=d}return s[e]=n,n.parse}return Yt}
|
|||
|
/*!
|
|||
|
* body-parser
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/!function(e,n){var t=j("body-parser"),a=Object.create(null);function i(e){return function(){return function(e){var n=a[e];if(void 0!==n)return n;switch(e){case"json":n=jt();break;case"raw":n=Et();break;case"text":n=St();break;case"urlencoded":n=ca()}return a[e]=n}(e)}}n=e.exports=t.function((function(e){var t=Object.create(e||null,{type:{configurable:!0,enumerable:!0,value:void 0,writable:!0}}),a=n.urlencoded(t),i=n.json(t);return function(e,n,t){i(e,n,(function(i){if(i)return t(i);a(e,n,t)}))}}),"bodyParser: use individual json/urlencoded middlewares"),Object.defineProperty(n,"json",{configurable:!0,enumerable:!0,get:i("json")}),Object.defineProperty(n,"raw",{configurable:!0,enumerable:!0,get:i("raw")}),Object.defineProperty(n,"text",{configurable:!0,enumerable:!0,get:i("text")}),Object.defineProperty(n,"urlencoded",{configurable:!0,enumerable:!0,get:i("urlencoded")})}(w,w.exports);var pa=w.exports,la=function(e,n,t){if(!e)throw new TypeError("argument dest is required");if(!n)throw new TypeError("argument src is required");void 0===t&&(t=!0);return Object.getOwnPropertyNames(n).forEach((function(a){if(t||!ua.call(e,a)){var i=Object.getOwnPropertyDescriptor(n,a);Object.defineProperty(e,a,i)}})),e},ua=Object.prototype.hasOwnProperty;
|
|||
|
/*!
|
|||
|
* merge-descriptors
|
|||
|
* Copyright(c) 2014 Jonathan Ong
|
|||
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/var da,fa,ma,va,ha={exports:{}},xa={exports:{}},ga={exports:{}},ba={exports:{}};function ya(){if(fa)return da;fa=1;var e=1e3,n=60*e,t=60*n,a=24*t,i=365.25*a;function o(e,n,t){if(!(e<n))return e<1.5*n?Math.floor(e/n)+" "+t:Math.ceil(e/n)+" "+t+"s"}return da=function(r,s){s=s||{};var c=typeof r;if("string"===c&&r.length>0)return function(o){if((o=String(o)).length>100)return;var r=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(o);if(!r)return;var s=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return s*i;case"days":case"day":case"d":return s*a;case"hours":case"hour":case"hrs":case"hr":case"h":return s*t;case"minutes":case"minute":case"mins":case"min":case"m":return s*n;case"seconds":case"second":case"secs":case"sec":case"s":return s*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(r);if("number"===c&&!1===isNaN(r))return s.long?function(i){return o(i,a,"day")||o(i,t,"hour")||o(i,n,"minute")||o(i,e,"second")||i+" ms"}(r):function(i){if(i>=a)return Math.round(i/a)+"d";if(i>=t)return Math.round(i/t)+"h";if(i>=n)return Math.round(i/n)+"m";if(i>=e)return Math.round(i/e)+"s";return i+"ms"}(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))},da}function wa(){return ma||(ma=1,function(e,n){var t;function a(e){function a(){if(a.enabled){var e=a,i=+new Date,o=i-(t||i);e.diff=o,e.prev=t,e.curr=i,t=i;for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];r[0]=n.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");var c=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,(function(t,a){if("%%"===t)return t;c++;var i=n.formatters[a];if("function"==typeof i){var o=r[c];t=i.call(e,o),r.splice(c,1),c--}return t})),n.formatArgs.call(e,r),(a.log||n.log||console.log.bind(console)).apply(e,r)}}return a.namespace=e,a.enabled=n.enabled(e),a.useColors=n.useColors(),a.color=function(e){var t,a=0;for(t in e)a=(a<<5)-a+e.charCodeAt(t),a|=0;return n.colors[Math.abs(a)%n.colors.length]}(e),"function"==typeof n.init&&n.init(a),a}(n=e.exports=a.debug=a.default=a).coerce=function(e){return e instanceof Error?e.stack||e.message:e},n.disable=function(){n.enable("")},n.enable=function(e){n.save(e),n.names=[],n.skips=[];for(var t=("string"==typeof e?e:"").split(/[\s,]+/),a=t.length,i=0;i<a;i++)t[i]&&("-"===(e=t[i].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))},n.enabled=function(e){var t,a;for(t=0,a=n.skips.length;t<a;t++)if(n.skips[t].test(e))return!1;for(t=0,a=n.names.length;t<a;t++)if(n.names[t].test(e))return!0;return!1},n.humanize=ya(),n.names=[],n.skips=[],n.formatters={}}(ba,ba.exports)),ba.exports}var ka,ja={exports:{}};"undefined"!=typeof process&&"renderer"===process.type?xa.exports=(va||(va=1,function(e,n){function t(){var e;try{e=n.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(n=ga.exports=wa()).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},n.formatArgs=function(e){var t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),t){var a="color: "+this.color;e.splice(1,0,a,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))})),e.splice(o,0,a)}},n.save=function(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(e){}},n.load=t,n.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$
|
|||
|
/*!
|
|||
|
* escape-html
|
|||
|
* Copyright(c) 2012-2013 TJ Holowaychuk
|
|||
|
* Copyright(c) 2015 Andreas Lubbe
|
|||
|
* Copyright(c) 2015 Tiancheng "Timothy" Gu
|
|||
|
* MIT Licensed
|
|||
|
*/,Oa=/(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g,Aa=/(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g,Ca="$1<>$2";
|
|||
|
/*!
|
|||
|
* encodeurl
|
|||
|
* Copyright(c) 2016 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/var _a=/["'&<>]/,Ta=function(e){var n,t=""+e,a=_a.exec(t);if(!a)return t;var i="",o=0,r=0;for(o=a.index;o<t.length;o++){switch(t.charCodeAt(o)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}r!==o&&(i+=t.substring(r,o)),r=o+1,i+=n}return r!==o?i+t.substring(r,o):i};var qa={exports:{}},za=f,Ia=za.parse,Pa=za.Url;
|
|||
|
/*!
|
|||
|
* parseurl
|
|||
|
* Copyright(c) 2014 Jonathan Ong
|
|||
|
* Copyright(c) 2014-2017 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function Ra(e){var n=e.url;if(void 0!==n){var t=e._parsedUrl;return Ba(n,t)?t:((t=Da(n))._raw=n,e._parsedUrl=t)}}function Da(e){if("string"!=typeof e||47!==e.charCodeAt(0))return Ia(e);for(var n=e,t=null,a=null,i=1;i<e.length;i++)switch(e.charCodeAt(i)){case 63:null===a&&(n=e.substring(0,i),t=e.substring(i+1),a=e.substring(i));break;case 9:case 10:case 12:case 13:case 32:case 35:case 160:case 65279:return Ia(e)}var o=void 0!==Pa?new Pa:{};return o.path=e,o.href=e,o.pathname=n,null!==a&&(o.query=t,o.search=a),o}function Ba(e,n){return"object"==typeof n&&null!==n&&(void 0===Pa||n instanceof Pa)&&n._raw===e}qa.exports=Ra,qa.exports.original=function(e){var n=e.originalUrl;if("string"!=typeof n)return Ra(e);var t=e._parsedOriginalUrl;if(Ba(n,t))return t;return t=Da(n),t._raw=n,e._parsedOriginalUrl=t};var Na=qa.exports,La=Ea("finalhandler"),Ma=Sa,Ua=Ta,Fa=Pn,Ha=Na,$a=K,Va=jn,Wa=/\x20{2}/g,Ga=/\n/g,Za="function"==typeof setImmediate?setImmediate:function(e){process.nextTick(e.bind.apply(e,arguments))},Ja=Fa.isFinished;
|
|||
|
/*!
|
|||
|
* finalhandler
|
|||
|
* Copyright(c) 2014-2022 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/var Ya=function(e,n,t){var a=t||{},i=a.env||process.env.NODE_ENV||"development",o=a.onerror;return function(t){var a,r,s;if(t||!Xa(n)){if(t?(s=function(e){if("number"==typeof e.status&&e.status>=400&&e.status<600)return e.status;if("number"==typeof e.statusCode&&e.statusCode>=400&&e.statusCode<600)return e.statusCode;return}(t),void 0===s?s=function(e){var n=e.statusCode;("number"!=typeof n||n<400||n>599)&&(n=500);return n}(n):a=function(e){if(!e.headers||"object"!=typeof e.headers)return;for(var n=Object.create(null),t=Object.keys(e.headers),a=0;a<t.length;a++){var i=t[a];n[i]=e.headers[i]}return n}(t),r=function(e,n,t){var a;"production"!==t&&((a=e.stack)||"function"!=typeof e.toString||(a=e.toString()));return a||$a.message[n]}(t,s,i)):(s=404,r="Cannot "+e.method+" "+Ma(function(e){try{return Ha.original(e).pathname}catch(e){return"resource"}}(e))),La("default %s",s),t&&o&&Za(o,t,e,n),Xa(n))return La("cannot %d after headers sent",s),void e.socket.destroy();!function(e,n,t,a,i){function o(){var o=function(e){return'<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>Error</title>\n</head>\n<body>\n<pre>'+Ua(e).replace(Ga,"<br>").replace(Wa," ")+"</pre>\n</body>\n</html>\n"}(i);n.statusCode=t,n.statusMessage=$a.message[t],n.removeHeader("Content-Encoding"),n.removeHeader("Content-Language"),n.removeHeader("Content-Range"),function(e,n){if(!n)return;for(var t=Object.keys(n),a=0;a<t.length;a++){var i=t[a];e.setHeader(i,n[i])}}(n,a),n.setHeader("Content-Security-Policy","default-src 'none'"),n.setHeader("X-Content-Type-Options","nosniff"),n.setHeader("Content-Type","text/html; charset=utf-8"),n.setHeader("Content-Length",Buffer.byteLength(o,"utf8")),"HEAD"!==e.method?n.end(o,"utf8"):n.end()}if(Ja(e))return void o();Va(e),Fa(e,o),e.resume()}(e,n,s,a,r)}else La("cannot 404 after headers sent")}};function Xa(e){return"boolean"!=typeof e.headersSent?Boolean(e._header):e.headersSent}var Qa,Ka,ei,ni,ti={exports:{}},ai={exports:{}},ii={exports:{}},oi={exports:{}};function ri(){if(Ka)return Qa;Ka=1;var e=1e3,n=60*e,t=60*n,a=24*t,i=365.25*a;function o(e,n,t){if(!(e<n))return e<1.5*n?Math.floor(e/n)+" "+t:Math.ceil(e/n)+" "+t+"s"}return Qa=function(r,s){s=s||{};var c=typeof r;if("string"===c&&r.length>0)return function(o){if((o=String(o)).length>100)return;var r=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(o);if(!r)return;var s=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return s*i;case"days":case"day":case"d":return s*a;case"hours":case"hour":case"hrs":case"hr":case"h":return s*t;case"minutes":case"minute":case"mins":case"min":case"m":return s*n;case"seconds":case"second":case"secs":case"sec":case"s":return s*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(r);if("number"===c&&!1===isNaN(r))return s.long?function(i){return o(i,a,"day")||o(i,t,"hour")||o(i,n,"minute")||o(i,e,"second")||i+" ms"}(r):function(i){if(i>=a)return Math.round(i/a)+"d";if(i>=t)return Math.round(i/t)+"h";if(i>=n)return Math.round(i/n)+"m";if(i>=e)return Math.round(i/e)+"s";return i+"ms"}(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))},Qa}function si(){return ei||(ei=1,function(e,n){var t;function a(e){function a(){if(a.enabled){var e=a,i=+new Date,o=i-(t||i);e.diff=o,e.prev=t,e.curr=i,t=i;for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];r[0]=n.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");var c=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,(function(t,a){if("%%"===t)return t;c++;var i=n.formatters[a];if("function"==typeof i){var o=r[c];t=i.call(e,o),r.splice(c,1),c--}return t})),n.formatArgs.call(e,r),(a.log||n.log||console.log.bind(console)).apply(e,r)}}return a.namespace=e,a.enabled=n.enabled(e),a.useColors=n.useColors(),a.color=function(e){var t,a=0;for(t in e)a=(a<<5)-a+e.charCodeAt(t),a|=0;return n.colors[Math.abs(a)%n.colors.length]}(e),"function"==typeof n.init&&n.init(
|
|||
|
/*!
|
|||
|
* express
|
|||
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|||
|
* Copyright(c) 2013 Roman Shtylman
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/,vi=/\((?!\?)/g;var hi=mi,xi=li("express:router:layer"),gi=Object.prototype.hasOwnProperty,bi=yi;function yi(e,n,t){if(!(this instanceof yi))return new yi(e,n,t);xi("new %o",e);var a=n||{};this.handle=t,this.name=t.name||"<anonymous>",this.params=void 0,this.path=void 0,this.regexp=hi(e,this.keys=[],a),this.regexp.fast_star="*"===e,this.regexp.fast_slash="/"===e&&!1===a.end}function wi(e){if("string"!=typeof e||0===e.length)return e;try{return decodeURIComponent(e)}catch(n){throw n instanceof URIError&&(n.message="Failed to decode param '"+e+"'",n.status=n.statusCode=400),n}}
|
|||
|
/*!
|
|||
|
* methods
|
|||
|
* Copyright(c) 2013-2014 TJ Holowaychuk
|
|||
|
* Copyright(c) 2015-2016 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/yi.prototype.handle_error=function(e,n,t,a){var i=this.handle;if(4!==i.length)return a(e);try{i(e,n,t,a)}catch(e){a(e)}},yi.prototype.handle_request=function(e,n,t){var a=this.handle;if(a.length>3)return t();try{a(e,n,t)}catch(e){t(e)}},yi.prototype.match=function(e){var n;if(null!=e){if(this.regexp.fast_slash)return this.params={},this.path="",!0;if(this.regexp.fast_star)return this.params={0:wi(e)},this.path=e,!0;n=this.regexp.exec(e)}if(!n)return this.params=void 0,this.path=void 0,!1;this.params={},this.path=n[0];for(var t=this.keys,a=this.params,i=1;i<n.length;i++){var o=t[i-1].name,r=wi(n[i]);void 0===r&&gi.call(a,o)||(a[o]=r)}return!0};var ki=m,ji=ki.METHODS&&ki.METHODS.map((function(e){return e.toLowerCase()}))||["get","post","put","head","delete","options","trace","copy","lock","mkcol","move","purge","propfind","proppatch","unlock","report","mkactivity","checkout","merge","m-search","notify","subscribe","unsubscribe","patch","search","connect"];
|
|||
|
/*!
|
|||
|
* express
|
|||
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|||
|
* Copyright(c) 2013 Roman Shtylman
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/
|
|||
|
var Ei=li("express:router:route"),Si=ui,Oi=bi,Ai=ji,Ci=Array.prototype.slice,_i=Object.prototype.toString,Ti=qi;function qi(e){this.path=e,this.stack=[],Ei("new %o",e),this.methods={}}qi.prototype._handles_method=function(e){if(this.methods._all)return!0;var n=e.toLowerCase();return"head"!==n||this.methods.head||(n="get"),Boolean(this.methods[n])},qi.prototype._options=function(){var e=Object.keys(this.methods);this.methods.get&&!this.methods.head&&e.push("head");for(var n=0;n<e.length;n++)e[n]=e[n].toUpperCase();return e},qi.prototype.dispatch=function(e,n,t){var a=0,i=this.stack,o=0;if(0===i.length)return t();var r=e.method.toLowerCase();"head"!==r||this.methods.head||(r="get"),e.route=this,function s(c){if(c&&"route"===c)return t();if(c&&"router"===c)return t(c);if(++o>100)return setImmediate(s,c);var p=i[a++];if(!p)return t(c);p.method&&p.method!==r?s(c):c?p.handle_error(c,e,n,s):p.handle_request(e,n,s);o=0}()},qi.prototype.all=function(){for(var e=Si(Ci.call(arguments)),n=0;n<e.length;n++){var t=e[n];if("function"!=typeof t){var a=_i.call(t);throw new TypeError("Route.all() requires a callback function but got a "+a)}var i=Oi("/",{},t);i.method=void 0,this.methods._all=!0,this.stack.push(i)}return this},Ai.forEach((function(e){qi.prototype[e]=function(){for(var n=Si(Ci.call(arguments)),t=0;t<n.length;t++){var a=n[t];if("function"!=typeof a){var i=_i.call(a);throw new Error("Route."+e+"() requires a callback function but got a "+i)}Ei("%s %o",e,this.path);var o=Oi("/",{},a);o.method=e,this.methods[e]=!0,this.stack.push(o)}return this}}));var zi={exports:{}},Ii=zi.exports=function(e,n){if(e&&n)for(var t in n)e[t]=n[t];return e},Pi=Ti,Ri=bi,Di=ji,Bi=Ii,Ni=li("express:router"),Li=j("express"),Mi=ui,Ui=Na,Fi=X,Hi=/^\[object (\S+)\]$/,$i=Array.prototype.slice,Vi=Object.prototype.toString,Wi=ti.exports=function(e){var n=e||{};function t(e,n,a){t.handle(e,n,a)}return Fi(t,Wi),t.params={},t._params=[],t.caseSensitive=n.caseSensitive,t.mergeParams=n.mergeParams,t.strict=n.strict,t.stack=[],t};function Gi(e,n){for(var t=0;t<n.length;t++){var a=n[t];-1===e.indexOf(a)&&e.push(a)}}function Zi(e){var n=typeof e;return"object"!==n?n:Vi.call(e).replace(Hi,"$1")}function Ji(e,n){try{return e.match(n)}catch(e){return e}}Wi.param=function(e,n){if("function"==typeof e)return Li("router.param(fn): Refactor to use path params"),void this._params.push(e);var t,a=this._params,i=a.length;":"===e[0]&&(Li("router.param("+JSON.stringify(e)+", fn): Use router.param("+JSON.stringify(e.slice(1))+", fn) instead"),e=e.slice(1));for(var o=0;o<i;++o)(t=a[o](e,n))&&(n=t);if("function"!=typeof n)throw new Error("invalid param() call for "+e+", got "+n);return(this.params[e]=this.params[e]||[]).push(n),this},Wi.handle=function(e,n,t){var a=this;Ni("dispatching %s %s",e.method,e.url);var i,o,r=0,s=function(e){if("string"!=typeof e||0===e.length||"/"===e[0])return;var n=e.indexOf("?"),t=-1!==n?n:e.length,a=e.slice(0,t).indexOf("://");return-1!==a?e.substring(0,e.indexOf("/",3+a)):void 0}(e.url)||"",c="",p=!1,l=0,u={},d=[],f=a.stack,m=e.params,v=e.baseUrl||"",h=function(e,n){for(var t=new Array(arguments.length-2),a=new Array(arguments.length-2),i=0;i<t.length;i++)t[i]=arguments[i+2],a[i]=n[t[i]];return function(){for(var i=0;i<t.length;i++)n[t[i]]=a[i];return e.apply(this,arguments)}}(t,e,"baseUrl","next","params");function x(t){var i="route"===t?null:t;if(p&&(e.url=e.url.slice(1),p=!1),0!==c.length&&(e.baseUrl=v,e.url=s+c+e.url.slice(s.length),c=""),"router"!==i)if(r>=f.length)setImmediate(h,i);else{if(++l>100)return setImmediate(x,t);var o,g,b,y=function(e){try{return Ui(e).pathname}catch(e){return}}(e);if(null==y)return h(i);for(;!0!==g&&r<f.length;)if(g=Ji(o=f[r++],y),b=o.route,"boolean"!=typeof g&&(i=i||g),!0===g&&b)if(i)g=!1;else{var w=e.method,k=b._handles_method(w);k||"OPTIONS"!==w||Gi(d,b._options()),k||"HEAD"===w||(g=!1)}if(!0!==g)return h(i);b&&(e.route=b),e.params=a.mergeParams?function(e,n){if("object"!=typeof n||!n)return e;var t=Bi({},n);if(!(0 in e)||!(0 in n))return Bi(t,e);var a=0,i=0;for(;a in e;)a++;for(;i in n;)i++;for(a--;a>=0;a--)e[
|
|||
|
/*!
|
|||
|
* express
|
|||
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|||
|
* Copyright(c) 2013 Roman Shtylman
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/
|
|||
|
var to=li("express:view"),ao=t,io=o,oo=ao.dirname,ro=ao.basename,so=ao.extname,co=ao.join,po=ao.resolve,lo=uo;function uo(e,n){var t=n||{};if(this.defaultEngine=t.defaultEngine,this.ext=so(e),this.name=e,this.root=t.root,!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");var a=e;if(this.ext||(this.ext="."!==this.defaultEngine[0]?"."+this.defaultEngine:this.defaultEngine,a+=this.ext),!t.engines[this.ext]){var i=this.ext.slice(1);to('require "%s"',i);var o=function(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}(i).__express;if("function"!=typeof o)throw new Error('Module "'+i+'" does not provide a view engine.');t.engines[this.ext]=o}this.engine=t.engines[this.ext],this.path=this.lookup(a)}function fo(e){to('stat "%s"',e);try{return io.statSync(e)}catch(e){return}}uo.prototype.lookup=function(e){var n,t=[].concat(this.root);to('lookup "%s"',e);for(var a=0;a<t.length&&!n;a++){var i=t[a],o=po(i,e),r=oo(o),s=ro(o);n=this.resolve(r,s)}return n},uo.prototype.render=function(e,n){to('render "%s"',this.path),this.engine(this.path,e,n)},uo.prototype.resolve=function(e,n){var t=this.ext,a=co(e,n),i=fo(a);return i&&i.isFile()||(i=fo(a=co(e,ro(n,t),"index"+t)))&&i.isFile()?a:void 0};var mo={},vo={exports:{}};
|
|||
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|||
|
!function(e,n){var t=l,a=t.Buffer;function i(e,n){for(var t in e)n[t]=e[t]}function o(e,n,t){return a(e,n,t)}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?e.exports=t:(i(t,n),n.Buffer=o),o.prototype=Object.create(a.prototype),i(a,o),o.from=function(e,n,t){if("number"==typeof e)throw new TypeError("Argument must not be a number");return a(e,n,t)},o.alloc=function(e,n,t){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=a(e);return void 0!==n?"string"==typeof t?i.fill(n,t):i.fill(n):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return t.SlowBuffer(e)}}(vo,vo.exports);var ho=vo.exports,xo={exports:{}};
|
|||
|
/*!
|
|||
|
* content-disposition
|
|||
|
* Copyright(c) 2014-2017 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/
|
|||
|
xo.exports=function(e,n){var t=n||{},a=t.type||"attachment",i=function(e,n){if(void 0===e)return;var t={};if("string"!=typeof e)throw new TypeError("filename must be a string");void 0===n&&(n=!0);if("string"!=typeof n&&"boolean"!=typeof n)throw new TypeError("fallback must be a string or boolean");if("string"==typeof n&&jo.test(n))throw new TypeError("fallback must be ISO-8859-1 string");var a=go(e),i=Ao.test(a),o="string"!=typeof n?n&&zo(a):go(n),r="string"==typeof o&&o!==a;(r||!i||wo.test(a))&&(t["filename*"]=a);(i||r)&&(t.filename=r?o:a);return t}(e,t.fallback);return function(e){var n=e.parameters,t=e.type;if(!t||"string"!=typeof t||!Co.test(t))throw new TypeError("invalid type");var a=String(t).toLowerCase();if(n&&"object"==typeof n)for(var i,o=Object.keys(n).sort(),r=0;r<o.length;r++){var s="*"===(i=o[r]).substr(-1)?Do(n[i]):Ro(n[i]);a+="; "+i+"="+s}return a}(new Bo(a,i))},xo.exports.parse=function(e){if(!e||"string"!=typeof e)throw new TypeError("argument string is required");var n=To.exec(e);if(!n)throw new TypeError("invalid type format");var t,a,i=n[0].length,o=n[1].toLowerCase(),r=[],s={};i=Oo.lastIndex=";"===n[0].substr(-1)?i-1:i;for(;n=Oo.exec(e);){if(n.index!==i)throw new TypeError("invalid parameter format");if(i+=n[0].length,t=n[1].toLowerCase(),a=n[2],-1!==r.indexOf(t))throw new TypeError("invalid duplicate parameter");r.push(t),t.indexOf("*")+1!==t.length?"string"!=typeof s[t]&&('"'===a[0]&&(a=a.substr(1,a.length-2).replace(Eo,"$1")),s[t]=a):(t=t.slice(0,-1),a=qo(a),s[t]=a)}if(-1!==i&&i!==e.length)throw new TypeError("invalid parameter format");return new Bo(o,s)};var go=t.basename,bo=ho.Buffer,yo=/[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g,wo=/%[0-9A-Fa-f]{2}/,ko=/%([0-9A-Fa-f]{2})/g,jo=/[^\x20-\x7e\xa0-\xff]/g,Eo=/\\([\u0000-\u007f])/g,So=/([\\"])/g,Oo=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,Ao=/^[\x20-\x7e\x80-\xff]+$/,Co=/^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/,_o=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,To=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/;function qo(e){var n=_o.exec(e);if(!n)throw new TypeError("invalid extended field value");var t,a=n[1].toLowerCase(),i=n[2].replace(ko,Io);switch(a){case"iso-8859-1":t=zo(i);break;case"utf-8":t=bo.from(i,"binary").toString("utf8");break;default:throw new TypeError("unsupported charset in extended field")}return t}function zo(e){return String(e).replace(jo,"?")}function Io(e,n){return String.fromCharCode(parseInt(n,16))}function Po(e){return"%"+String(e).charCodeAt(0).toString(16).toUpperCase()}function Ro(e){return'"'+String(e).replace(So,"\\$1")+'"'}function Do(e){var n=String(e);return"UTF-8''"+encodeURIComponent(n).replace(yo,Po)}function Bo(e,n){this.type=e,this.parameters=n}var No,Lo,Mo,Uo,Fo=xo.exports,Ho={exports:{}},$o={exports:{}},Vo={exports:{}},Wo={exports:{}};function Go(){if(Lo)return No;Lo=1;var e=1e3,n=60*e,t=60*n,a=24*t,i=365.25*a;function o(e,n,t){if(!(e<n))return e<1.5*n?Math.floor(e/n)+" "+t:Math.ceil(e/n)+" "+t+"s"}return No=function(r,s){s=s||{};var c=typeof r;if("string"===c&&r.length>0)return function(o){if((o=String(o)).length>100)return;var r=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(o);if(!r)return;var s=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return s*i;case"days":case"day":case"d":return s*a;case"hours":case"hour":case"hrs":case"hr":case"h":return s*t;case"minutes":case"minute":case"mins":case"min":case"m":return s*n;case"seconds":case"second":case"secs":case"sec":case"s":return s*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(r);if("number"===c&&!1===isNaN(r))return s.long?function(i){return o(i,a,"day")||o(i,t,"hour")||o(i,n,"minute")||o(i,e,"second")||i+" ms"}(r):function(i){if(i>=a)return Math.round(i/a)+"d";if(i>=t)return
|
|||
|
/*!
|
|||
|
* fresh
|
|||
|
* Copyright(c) 2012 TJ Holowaychuk
|
|||
|
* Copyright(c) 2016-2017 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/return a?"W/"+i:i},Ko=n,er=o.Stats,nr=Object.prototype.toString;
|
|||
|
/*!
|
|||
|
* etag
|
|||
|
* Copyright(c) 2014-2016 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/var tr=/(?:^|,)\s*?no-cache\s*?(?:,|$)/,ar=function(e,n){var t=e["if-modified-since"],a=e["if-none-match"];if(!t&&!a)return!1;var i=e["cache-control"];if(i&&tr.test(i))return!1;if(a&&"*"!==a){var o=n.etag;if(!o)return!1;for(var r=!0,s=function(e){for(var n=0,t=[],a=0,i=0,o=e.length;i<o;i++)switch(e.charCodeAt(i)){case 32:a===n&&(a=n=i+1);break;case 44:t.push(e.substring(a,n)),a=n=i+1;break;default:n=i+1}return t.push(e.substring(a,n)),t}(a),c=0;c<s.length;c++){var p=s[c];if(p===o||p==="W/"+o||"W/"+p===o){r=!1;break}}if(r)return!1}if(t){var l=n["last-modified"];if(!(l&&ir(l)<=ir(t)))return!1}return!0};function ir(e){var n=e&&Date.parse(e);return"number"==typeof n?n:NaN}var or=o;function rr(){this.types=Object.create(null),this.extensions=Object.create(null)}rr.prototype.define=function(e){for(var n in e){for(var t=e[n],a=0;a<t.length;a++)process.env.DEBUG_MIME&&this.types[t[a]]&&console.warn((this._loading||"define()").replace(/.*\//,""),'changes "'+t[a]+'" extension type from '+this.types[t[a]]+" to "+n),this.types[t[a]]=n;this.extensions[n]||(this.extensions[n]=t[0])}},rr.prototype.load=function(e){this._loading=e;var n={};or.readFileSync(e,"ascii").split(/[\r\n]+/).forEach((function(e){var t=e.replace(/\s*#.*|^\s*|\s*$/g,"").split(/\s+/);n[t.shift()]=t})),this.define(n),this._loading=null},rr.prototype.lookup=function(e,n){var t=e.replace(/^.*[\.\/\\]/,"").toLowerCase();return this.types[t]||n||this.default_type},rr.prototype.extension=function(e){var n=e.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase();return this.extensions[n]};var sr=new rr;sr.define({"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomsvc+xml":["atomsvc"],"application/bdoc":["bdoc"],"application/ccxml+xml":["ccxml"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/font-tdpfr":["pfr"],"application/font-woff":[],"application/font-woff2":[],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"appl
|
|||
|
/*!
|
|||
|
* range-parser
|
|||
|
* Copyright(c) 2012-2014 TJ Holowaychuk
|
|||
|
* Copyright(c) 2015-2016 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/var hr=function(e,n,t){if("string"!=typeof n)throw new TypeError("argument str must be a string");var a=n.indexOf("=");if(-1===a)return-2;var i=n.slice(a+1).split(","),o=[];o.type=n.slice(0,a);for(var r=0;r<i.length;r++){var s=i[r].split("-"),c=parseInt(s[0],10),p=parseInt(s[1],10);isNaN(c)?(c=e-p,p=e-1):isNaN(p)&&(p=e-1),p>e-1&&(p=e-1),isNaN(c)||isNaN(p)||c>p||c<0||o.push({start:c,end:p})}if(o.length<1)return-1;return t&&t.combine?function(e){for(var n=e.map(xr).sort(yr),t=0,a=1;a<n.length;a++){var i=n[a],o=n[t];i.start>o.end+1?n[++t]=i:i.end>o.end&&(o.end=i.end,o.index=Math.min(o.index,i.index))}n.length=t+1;var r=n.sort(br).map(gr);return r.type=e.type,r}(o):o};function xr(e,n){return{start:e.start,end:e.end,index:n}}function gr(e){return{start:e.start,end:e.end}}function br(e,n){return e.index-n.index}function yr(e,n){return e.start-n.start}
|
|||
|
/*!
|
|||
|
* send
|
|||
|
* Copyright(c) 2012 TJ Holowaychuk
|
|||
|
* Copyright(c) 2014-2022 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/var wr=de,kr=Xo("send"),jr=j("send"),Er=Oe,Sr=Sa,Or=Ta,Ar=Qo,Cr=ar,_r=o,Tr=cr,qr=function(e,n){n=n||{};var t=typeof e;if("string"===t&&e.length>0)return function(e){if((e=String(e)).length>100)return;var n=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!n)return;var t=parseFloat(n[1]);switch((n[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return t*mr;case"weeks":case"week":case"w":return t*fr;case"days":case"day":case"d":return t*dr;case"hours":case"hour":case"hrs":case"hr":case"h":return t*ur;case"minutes":case"minute":case"mins":case"min":case"m":return t*lr;case"seconds":case"second":case"secs":case"sec":case"s":return t*pr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}(e);if("number"===t&&isFinite(e))return n.long?function(e){var n=Math.abs(e);if(n>=dr)return vr(e,n,dr,"day");if(n>=ur)return vr(e,n,ur,"hour");if(n>=lr)return vr(e,n,lr,"minute");if(n>=pr)return vr(e,n,pr,"second");return e+" ms"}(e):function(e){var n=Math.abs(e);if(n>=dr)return Math.round(e/dr)+"d";if(n>=ur)return Math.round(e/ur)+"h";if(n>=lr)return Math.round(e/lr)+"m";if(n>=pr)return Math.round(e/pr)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))},zr=Pn,Ir=hr,Pr=t,Rr=K,Dr=c,Br=i,Nr=Pr.extname,Lr=Pr.join,Mr=Pr.normalize,Ur=Pr.resolve,Fr=Pr.sep,Hr=/^ *bytes=/,$r=31536e6,Vr=/(?:^|[\\/])\.\.(?:[\\/]|$)/;function Wr(e,n,t){Dr.call(this);var a=t||{};if(this.options=a,this.path=n,this.req=e,this._acceptRanges=void 0===a.acceptRanges||Boolean(a.acceptRanges),this._cacheControl=void 0===a.cacheControl||Boolean(a.cacheControl),this._etag=void 0===a.etag||Boolean(a.etag),this._dotfiles=void 0!==a.dotfiles?a.dotfiles:"ignore","ignore"!==this._dotfiles&&"allow"!==this._dotfiles&&"deny"!==this._dotfiles)throw new TypeError('dotfiles option must be "allow", "deny", or "ignore"');this._hidden=Boolean(a.hidden),void 0!==a.hidden&&jr("hidden: use dotfiles: '"+(this._hidden?"allow":"ignore")+"' instead"),void 0===a.dotfiles&&(this._dotfiles=void 0),this._extensions=void 0!==a.extensions?Yr(a.extensions,"extensions option"):[],this._immutable=void 0!==a.immutable&&Boolean(a.immutable),this._index=void 0!==a.index?Yr(a.index,"index option"):["index.html"],this._lastModified=void 0===a.lastModified||Boolean(a.lastModified),this._maxage=a.maxAge||a.maxage,this._maxage="string"==typeof this._maxage?qr(this._maxage):Number(this._maxage),this._maxage=isNaN(this._maxage)?0:Math.min(Math.max(0,this._maxage),$r),this._root=a.root?Ur(a.root):null,!this._root&&a.from&&this.from(a.from)}function Gr(e,n,t){return e+" "+(t?t.start+"-"+t.end:"*")+"/"+n}function Zr(e,n){return'<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>'+e+"</title>\n</head>\n<body>\n<pre>"+n+"</pre>\n</body>\n</html>\n"}function Jr(e,n){return("function"!=typeof e.listenerCount?e.listeners(n).length:e.listenerCount(n))>0}function Yr(e,n){for(var t=[].concat(e||[]),a=0;a<t.length;a++)if("string"!=typeof t[a])throw new TypeError(n+" must be array of strings or false");return t}function Xr(e){var n=e&&Date.parse(e);return"number"==typeof n?n:NaN}Ho.exports=function(e,n,t){return new Wr(e,n,t)},Ho.exports.mime=Tr,Br.inherits(Wr,Dr),Wr.prototype.etag=jr.function((function(e){return this._etag=Boolean(e),kr("etag %s",this._etag),this}),"send.etag: pass etag as option"),Wr.prototype.hidden=jr.function((function(e){return this._hidden=Boolean(e),this._dotfiles=void 0,kr("hidden %s",this._hidden),this}),"send.hidden: use dotfiles option"),Wr.prototype.index=jr.function((function(e){var n=e?Yr(e,"paths argument"):[];return kr("index %o",e),this._index=n,this}),"send.index: pass index as option"),Wr.prototype.root=function(e){return this._root=Ur(String(e)),kr("root %s",this._root),this},Wr.prototype.from=jr.function(Wr.prototype.root,"send.from: pass root as option"),Wr.prototype.root=jr.function(Wr.prototype.root,"send.root: pass root as option"),Wr.protot
|
|||
|
/*!
|
|||
|
* proxy-addr
|
|||
|
* Copyright(c) 2014-2016 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/Kr.exports=function(e,n){if(!e)throw new TypeError("req argument is required");if(!n)throw new TypeError("trust argument is required");var t=ps(e,n);return t[t.length-1]},Kr.exports.all=ps,Kr.exports.compile=ls;var as=es,is=ts,os=/^[0-9]+$/,rs=is.isValid,ss=is.parse,cs={linklocal:["169.254.0.0/16","fe80::/10"],loopback:["127.0.0.1/8","::1/128"],uniquelocal:["10.0.0.0/8","172.16.0.0/12","192.168.0.0/16","fc00::/7"]};function ps(e,n){var t=as(e);if(!n)return t;"function"!=typeof n&&(n=ls(n));for(var a=0;a<t.length-1;a++)n(t[a],a)||(t.length=a+1);return t}function ls(e){if(!e)throw new TypeError("argument is required");var n,t,a,i,o,r,s,c,p;if("string"==typeof e)n=[e];else{if(!Array.isArray(e))throw new TypeError("unsupported trust argument");n=e.slice()}for(var l=0;l<n.length;l++)e=n[l],Object.prototype.hasOwnProperty.call(cs,e)&&(e=cs[e],n.splice.apply(n,[l,1].concat(e)),l+=e.length-1);return t=function(e){for(var n=new Array(e.length),t=0;t<e.length;t++)n[t]=us(e[t]);return n}(n),0===(a=t.length)?ds:1===a?(o=t[0],r=o[0],s=r.kind(),c="ipv4"===s,p=o[1],function(e){if(!rs(e))return!1;var n=ss(e);if(n.kind()!==s){if(c&&!n.isIPv4MappedAddress())return!1;n=c?n.toIPv4Address():n.toIPv4MappedAddress()}return n.match(r,p)}):(i=t,function(e){if(!rs(e))return!1;for(var n,t=ss(e),a=t.kind(),o=0;o<i.length;o++){var r=i[o],s=r[0],c=s.kind(),p=r[1],l=t;if(a!==c){if("ipv4"===c&&!t.isIPv4MappedAddress())continue;n||(n="ipv4"===c?t.toIPv4Address():t.toIPv4MappedAddress()),l=n}if(l.match(s,p))return!0}return!1})}function us(e){var n=e.lastIndexOf("/"),t=-1!==n?e.substring(0,n):e;if(!rs(t))throw new TypeError("invalid IP address: "+t);var a=ss(t);-1===n&&"ipv6"===a.kind()&&a.isIPv4MappedAddress()&&(a=a.toIPv4Address());var i="ipv6"===a.kind()?128:32,o=-1!==n?e.substring(n+1,e.length):null;if((o=null===o?i:os.test(o)?parseInt(o,10):"ipv4"===a.kind()&&rs(o)?function(e){var n=ss(e),t=n.kind();return"ipv4"===t?n.prefixLengthFromSubnetMask():null}(o):null)<=0||o>i)throw new TypeError("invalid range on address: "+e);return[a,o]}function ds(){return!1}var fs=Kr.exports;
|
|||
|
/*!
|
|||
|
* express
|
|||
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/!function(e){var n=ho.Buffer,t=Fo,a=U,i=j("express"),o=ui,r=Qr.mime,s=Qo,c=fs,p=sa(),l=d;function u(e){return function(t,a){var i=n.isBuffer(t)?t:n.from(t,a);return s(i,e)}}function f(e){return p.parse(e,{allowPrototypes:!0})}function m(){return{}}e.etag=u({weak:!1}),e.wetag=u({weak:!0}),e.isAbsolute=function(e){return"/"===e[0]||(":"===e[1]&&("\\"===e[2]||"/"===e[2])||("\\\\"===e.substring(0,2)||void 0))},e.flatten=i.function(o,"utils.flatten: use array-flatten npm module instead"),e.normalizeType=function(e){return~e.indexOf("/")?function(e,n){for(var t=e.split(/ *; */),a={value:t[0],quality:1,params:{},originalIndex:n},i=1;i<t.length;++i){var o=t[i].split(/ *= */);"q"===o[0]?a.quality=parseFloat(o[1]):a.params[o[0]]=o[1]}return a}(e):{value:r.lookup(e),params:{}}},e.normalizeTypes=function(n){for(var t=[],a=0;a<n.length;++a)t.push(e.normalizeType(n[a]));return t},e.contentDisposition=i.function(t,"utils.contentDisposition: use content-disposition npm module instead"),e.compileETag=function(n){var t;if("function"==typeof n)return n;switch(n){case!0:case"weak":t=e.wetag;break;case!1:break;case"strong":t=e.etag;break;default:throw new TypeError("unknown value for etag function: "+n)}return t},e.compileQueryParser=function(e){var n;if("function"==typeof e)return e;switch(e){case!0:case"simple":n=l.parse;break;case!1:n=m;break;case"extended":n=f;break;default:throw new TypeError("unknown value for query parser function: "+e)}return n},e.compileTrust=function(e){return"function"==typeof e?e:!0===e?function(){return!0}:"number"==typeof e?function(n,t){return t<e}:("string"==typeof e&&(e=e.split(",").map((function(e){return e.trim()}))),c.compile(e||[]))},e.setCharset=function(e,n){if(!e||!n)return e;var t=a.parse(e);return t.parameters.charset=n,a.format(t)}}(mo),
|
|||
|
/*!
|
|||
|
* express
|
|||
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|||
|
* Copyright(c) 2013 Roman Shtylman
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/
|
|||
|
function(e,n){var a=Ya,i=Qi,o=ji,r=Ki,s=no(),c=li("express:application"),p=lo,l=m,u=mo.compileETag,d=mo.compileQueryParser,f=mo.compileTrust,v=j("express"),h=ui,x=Ii,g=t.resolve,b=X,y=Object.prototype.hasOwnProperty,w=Array.prototype.slice,k=e.exports={},E="@@symbol:trust_proxy_default";function S(e){"test"!==this.get("env")&&console.error(e.stack||e.toString())}k.init=function(){this.cache={},this.engines={},this.settings={},this.defaultConfiguration()},k.defaultConfiguration=function(){var e=process.env.NODE_ENV||"development";this.enable("x-powered-by"),this.set("etag","weak"),this.set("env",e),this.set("query parser","extended"),this.set("subdomain offset",2),this.set("trust proxy",!1),Object.defineProperty(this.settings,E,{configurable:!0,value:!0}),c("booting in %s mode",e),this.on("mount",(function(e){!0===this.settings[E]&&"function"==typeof e.settings["trust proxy fn"]&&(delete this.settings["trust proxy"],delete this.settings["trust proxy fn"]),b(this.request,e.request),b(this.response,e.response),b(this.engines,e.engines),b(this.settings,e.settings)})),this.locals=Object.create(null),this.mountpath="/",this.locals.settings=this.settings,this.set("view",p),this.set("views",g("views")),this.set("jsonp callback name","callback"),"production"===e&&this.enable("view cache"),Object.defineProperty(this,"router",{get:function(){throw new Error("'app.router' is deprecated!\nPlease see the 3.x to 4.x migration guide for details on how to update your app.")}})},k.lazyrouter=function(){this._router||(this._router=new i({caseSensitive:this.enabled("case sensitive routing"),strict:this.enabled("strict routing")}),this._router.use(s(this.get("query parser fn"))),this._router.use(r.init(this)))},k.handle=function(e,n,t){var i=this._router,o=t||a(e,n,{env:this.get("env"),onerror:S.bind(this)});if(!i)return c("no routes defined on app"),void o();i.handle(e,n,o)},k.use=function(e){var n=0,t="/";if("function"!=typeof e){for(var a=e;Array.isArray(a)&&0!==a.length;)a=a[0];"function"!=typeof a&&(n=1,t=e)}var i=h(w.call(arguments,n));if(0===i.length)throw new TypeError("app.use() requires a middleware function");this.lazyrouter();var o=this._router;return i.forEach((function(e){if(!e||!e.handle||!e.set)return o.use(t,e);c(".use app under %s",t),e.mountpath=t,e.parent=this,o.use(t,(function(n,t,a){var i=n.app;e.handle(n,t,(function(e){b(n,i.request),b(t,i.response),a(e)}))})),e.emit("mount",this)}),this),this},k.route=function(e){return this.lazyrouter(),this._router.route(e)},k.engine=function(e,n){if("function"!=typeof n)throw new Error("callback function required");var t="."!==e[0]?"."+e:e;return this.engines[t]=n,this},k.param=function(e,n){if(this.lazyrouter(),Array.isArray(e)){for(var t=0;t<e.length;t++)this.param(e[t],n);return this}return this._router.param(e,n),this},k.set=function(e,n){if(1!==arguments.length){switch(c('set "%s" to %o',e,n),this.settings[e]=n,e){case"etag":this.set("etag fn",u(n));break;case"query parser":this.set("query parser fn",d(n));break;case"trust proxy":this.set("trust proxy fn",f(n)),Object.defineProperty(this.settings,E,{configurable:!0,value:!1})}return this}for(var t=this.settings;t&&t!==Object.prototype;){if(y.call(t,e))return t[e];t=Object.getPrototypeOf(t)}},k.path=function(){return this.parent?this.parent.path()+this.mountpath:""},k.enabled=function(e){return Boolean(this.set(e))},k.disabled=function(e){return!this.set(e)},k.enable=function(e){return this.set(e,!0)},k.disable=function(e){return this.set(e,!1)},o.forEach((function(e){k[e]=function(n){if("get"===e&&1===arguments.length)return this.set(n);this.lazyrouter();var t=this._router.route(n);return t[e].apply(t,w.call(arguments,1)),this}})),k.all=function(e){this.lazyrouter();for(var n=this._router.route(e),t=w.call(arguments,1),a=0;a<o.length;a++)n[o[a]].apply(n,t);return this},k.del=v.function(k.delete,"app.del: Use app.delete instead"),k.render=function(e,n,t){var a,i=this.cache,o=t,r=this.engines,s=n,c={};if("function"==typeof n&&(o=n,s={}),x(c,this.locals),s._locals&&x(c,s._locals),x(c,s),null==c.cache&&(c.cache=this.enabled("view
|
|||
|
/*!
|
|||
|
* negotiator
|
|||
|
* Copyright(c) 2012 Federico Romero
|
|||
|
* Copyright(c) 2012-2014 Isaac Z. Schlueter
|
|||
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function oc(e){if(!(this instanceof oc))return new oc(e);this.request=e}vs.exports=oc,vs.exports.Negotiator=oc,oc.prototype.charset=function(e){var n=this.charsets(e);return n&&n[0]},oc.prototype.charsets=function(e){return nc(this.request.headers["accept-charset"],e)},oc.prototype.encoding=function(e){var n=this.encodings(e);return n&&n[0]},oc.prototype.encodings=function(e){return tc(this.request.headers["accept-encoding"],e)},oc.prototype.language=function(e){var n=this.languages(e);return n&&n[0]},oc.prototype.languages=function(e){return ac(this.request.headers["accept-language"],e)},oc.prototype.mediaType=function(e){var n=this.mediaTypes(e);return n&&n[0]},oc.prototype.mediaTypes=function(e){return ic(this.request.headers.accept,e)},oc.prototype.preferredCharset=oc.prototype.charset,oc.prototype.preferredCharsets=oc.prototype.charsets,oc.prototype.preferredEncoding=oc.prototype.encoding,oc.prototype.preferredEncodings=oc.prototype.encodings,oc.prototype.preferredLanguage=oc.prototype.language,oc.prototype.preferredLanguages=oc.prototype.languages,oc.prototype.preferredMediaType=oc.prototype.mediaType,oc.prototype.preferredMediaTypes=oc.prototype.mediaTypes;var rc=vs.exports,sc=Gn,cc=pc;
|
|||
|
/*!
|
|||
|
* accepts
|
|||
|
* Copyright(c) 2014 Jonathan Ong
|
|||
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function pc(e){if(!(this instanceof pc))return new pc(e);this.headers=e.headers,this.negotiator=new rc(e)}function lc(e){return-1===e.indexOf("/")?sc.lookup(e):e}function uc(e){return"string"==typeof e}
|
|||
|
/*!
|
|||
|
* express
|
|||
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|||
|
* Copyright(c) 2013 Roman Shtylman
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/pc.prototype.type=pc.prototype.types=function(e){var n=e;if(n&&!Array.isArray(n)){n=new Array(arguments.length);for(var t=0;t<n.length;t++)n[t]=arguments[t]}if(!n||0===n.length)return this.negotiator.mediaTypes();if(!this.headers.accept)return n[0];var a=n.map(lc),i=this.negotiator.mediaTypes(a.filter(uc))[0];return!!i&&n[a.indexOf(i)]},pc.prototype.encoding=pc.prototype.encodings=function(e){var n=e;if(n&&!Array.isArray(n)){n=new Array(arguments.length);for(var t=0;t<n.length;t++)n[t]=arguments[t]}return n&&0!==n.length?this.negotiator.encodings(n)[0]||!1:this.negotiator.encodings()},pc.prototype.charset=pc.prototype.charsets=function(e){var n=e;if(n&&!Array.isArray(n)){n=new Array(arguments.length);for(var t=0;t<n.length;t++)n[t]=arguments[t]}return n&&0!==n.length?this.negotiator.charsets(n)[0]||!1:this.negotiator.charsets()},pc.prototype.lang=pc.prototype.langs=pc.prototype.language=pc.prototype.languages=function(e){var n=e;if(n&&!Array.isArray(n)){n=new Array(arguments.length);for(var t=0;t<n.length;t++)n[t]=arguments[t]}return n&&0!==n.length?this.negotiator.languages(n)[0]||!1:this.negotiator.languages()};var dc=cc,fc=j("express"),mc=r.isIP,vc=kt,hc=m,xc=ar,gc=hr,bc=Na,yc=fs,wc=Object.create(hc.IncomingMessage.prototype),kc=wc;function jc(e,n,t){Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get:t})}wc.get=wc.header=function(e){if(!e)throw new TypeError("name argument is required to req.get");if("string"!=typeof e)throw new TypeError("name must be a string to req.get");var n=e.toLowerCase();switch(n){case"referer":case"referrer":return this.headers.referrer||this.headers.referer;default:return this.headers[n]}},wc.accepts=function(){var e=dc(this);return e.types.apply(e,arguments)},wc.acceptsEncodings=function(){var e=dc(this);return e.encodings.apply(e,arguments)},wc.acceptsEncoding=fc.function(wc.acceptsEncodings,"req.acceptsEncoding: Use acceptsEncodings instead"),wc.acceptsCharsets=function(){var e=dc(this);return e.charsets.apply(e,arguments)},wc.acceptsCharset=fc.function(wc.acceptsCharsets,"req.acceptsCharset: Use acceptsCharsets instead"),wc.acceptsLanguages=function(){var e=dc(this);return e.languages.apply(e,arguments)},wc.acceptsLanguage=fc.function(wc.acceptsLanguages,"req.acceptsLanguage: Use acceptsLanguages instead"),wc.range=function(e,n){var t=this.get("Range");if(t)return gc(e,t,n)},wc.param=function(e,n){var t=this.params||{},a=this.body||{},i=this.query||{};return fc("req.param("+(1===arguments.length?"name":"name, default")+"): Use req.params, req.body, or req.query instead"),null!=t[e]&&t.hasOwnProperty(e)?t[e]:null!=a[e]?a[e]:null!=i[e]?i[e]:n},wc.is=function(e){var n=e;if(!Array.isArray(e)){n=new Array(arguments.length);for(var t=0;t<n.length;t++)n[t]=arguments[t]}return vc(this,n)},jc(wc,"protocol",(function(){var e=this.connection.encrypted?"https":"http";if(!this.app.get("trust proxy fn")(this.connection.remoteAddress,0))return e;var n=this.get("X-Forwarded-Proto")||e,t=n.indexOf(",");return-1!==t?n.substring(0,t).trim():n.trim()})),jc(wc,"secure",(function(){return"https"===this.protocol})),jc(wc,"ip",(function(){var e=this.app.get("trust proxy fn");return yc(this,e)})),jc(wc,"ips",(function(){var e=this.app.get("trust proxy fn"),n=yc.all(this,e);return n.reverse().pop(),n})),jc(wc,"subdomains",(function(){var e=this.hostname;if(!e)return[];var n=this.app.get("subdomain offset"),t=mc(e)?[e]:e.split(".").reverse();return t.slice(n)})),jc(wc,"path",(function(){return bc(this).pathname})),jc(wc,"hostname",(function(){var e=this.app.get("trust proxy fn"),n=this.get("X-Forwarded-Host");if(n&&e(this.connection.remoteAddress,0)?-1!==n.indexOf(",")&&(n=n.substring(0,n.indexOf(",")).trimRight()):n=this.get("Host"),n){var t="["===n[0]?n.indexOf("]")+1:0,a=n.indexOf(":",t);return-1!==a?n.substring(0,a):n}})),jc(wc,"host",fc.function((function(){return this.hostname}),"req.host: Use req.hostname instead")),jc(wc,"fresh",(function(){var e=this.method,n=this.res,t=n.statusCode;return("GET"===e||"HEAD"===e)&&((t>=200&&t<300||304===t)&&xc(this.headers,{etag:n.get("ETag"),"last-modified":
|
|||
|
/*!
|
|||
|
* cookie
|
|||
|
* Copyright(c) 2012-2014 Roman Shtylman
|
|||
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/
|
|||
|
parse:function(e,n){if("string"!=typeof e)throw new TypeError("argument str must be a string");var t={},a=(n||{}).decode||Cc,i=0;for(;i<e.length;){var o=e.indexOf("=",i);if(-1===o)break;var r=e.indexOf(";",i);if(-1===r)r=e.length;else if(r<o){i=e.lastIndexOf(";",o-1)+1;continue}var s=e.slice(i,o).trim();if(void 0===t[s]){var c=e.slice(o+1,r).trim();34===c.charCodeAt(0)&&(c=c.slice(1,-1)),t[s]=Tc(c,a)}i=r+1}return t},serialize:function(e,n,t){var a=t||{},i=a.encode||_c;if("function"!=typeof i)throw new TypeError("option encode is invalid");if(!Ac.test(e))throw new TypeError("argument name is invalid");var o=i(n);if(o&&!Ac.test(o))throw new TypeError("argument val is invalid");var r=e+"="+o;if(null!=a.maxAge){var s=a.maxAge-0;if(isNaN(s)||!isFinite(s))throw new TypeError("option maxAge is invalid");r+="; Max-Age="+Math.floor(s)}if(a.domain){if(!Ac.test(a.domain))throw new TypeError("option domain is invalid");r+="; Domain="+a.domain}if(a.path){if(!Ac.test(a.path))throw new TypeError("option path is invalid");r+="; Path="+a.path}if(a.expires){var c=a.expires;if(!function(e){return"[object Date]"===Oc.call(e)||e instanceof Date}(c)||isNaN(c.valueOf()))throw new TypeError("option expires is invalid");r+="; Expires="+c.toUTCString()}a.httpOnly&&(r+="; HttpOnly");a.secure&&(r+="; Secure");if(a.priority){switch("string"==typeof a.priority?a.priority.toLowerCase():a.priority){case"low":r+="; Priority=Low";break;case"medium":r+="; Priority=Medium";break;case"high":r+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(a.sameSite){switch("string"==typeof a.sameSite?a.sameSite.toLowerCase():a.sameSite){case!0:r+="; SameSite=Strict";break;case"lax":r+="; SameSite=Lax";break;case"strict":r+="; SameSite=Strict";break;case"none":r+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return r}},Oc=Object.prototype.toString,Ac=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function Cc(e){return-1!==e.indexOf("%")?decodeURIComponent(e):e}function _c(e){return encodeURIComponent(e)}function Tc(e,n){try{return n(e)}catch(n){return e}}var qc={exports:{}};
|
|||
|
/*!
|
|||
|
* vary
|
|||
|
* Copyright(c) 2014-2017 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/qc.exports=function(e,n){if(!e||!e.getHeader||!e.setHeader)throw new TypeError("res argument is required");var t=e.getHeader("Vary")||"",a=Array.isArray(t)?t.join(", "):String(t);(t=Ic(a,n))&&e.setHeader("Vary",t)},qc.exports.append=Ic;var zc=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function Ic(e,n){if("string"!=typeof e)throw new TypeError("header argument is required");if(!n)throw new TypeError("field argument is required");for(var t=Array.isArray(n)?n:Pc(String(n)),a=0;a<t.length;a++)if(!zc.test(t[a]))throw new TypeError("field argument contains an invalid header name");if("*"===e)return e;var i=e,o=Pc(e.toLowerCase());if(-1!==t.indexOf("*")||-1!==o.indexOf("*"))return"*";for(var r=0;r<t.length;r++){var s=t[r].toLowerCase();-1===o.indexOf(s)&&(o.push(s),i=i?i+", "+t[r]:t[r])}return i}function Pc(e){for(var n=0,t=[],a=0,i=0,o=e.length;i<o;i++)switch(e.charCodeAt(i)){case 32:a===n&&(a=n=i+1);break;case 44:t.push(e.substring(a,n)),a=n=i+1;break;default:n=i+1}return t.push(e.substring(a,n)),t}var Rc=qc.exports,Dc=ho.Buffer,Bc=Fo,Nc=de,Lc=j("express"),Mc=Sa,Uc=Ta,Fc=m,Hc=mo.isAbsolute,$c=Pn,Vc=t,Wc=K,Gc=Ii,Zc=Ec.sign,Jc=mo.normalizeType,Yc=mo.normalizeTypes,Xc=mo.setCharset,Qc=Sc,Kc=Qr,ep=Vc.extname,np=Kc.mime,tp=Vc.resolve,ap=Rc,ip=Object.create(Fc.ServerResponse.prototype),op=ip,rp=/;\s*charset\s*=/;
|
|||
|
/*!
|
|||
|
* express
|
|||
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function sp(e,n,t,a){var i,o=!1;function r(){if(!o){o=!0;var e=new Error("Request aborted");e.code="ECONNABORTED",a(e)}}function s(e){o||(o=!0,a(e))}n.on("directory",(function(){if(!o){o=!0;var e=new Error("EISDIR, read");e.code="EISDIR",a(e)}})),n.on("end",(function(){o||(o=!0,a())})),n.on("error",s),n.on("file",(function(){i=!1})),n.on("stream",(function(){i=!0})),$c(e,(function(e){return e&&"ECONNRESET"===e.code?r():e?s(e):void(o||setImmediate((function(){!1===i||o?o||(o=!0,a()):r()})))})),t.headers&&n.on("headers",(function(e){for(var n=t.headers,a=Object.keys(n),i=0;i<a.length;i++){var o=a[i];e.setHeader(o,n[o])}})),n.pipe(e)}function cp(e,n,t,a){var i=n||t?JSON.stringify(e,n,t):JSON.stringify(e);return a&&"string"==typeof i&&(i=i.replace(/[<>&]/g,(function(e){switch(e.charCodeAt(0)){case 60:return"\\u003c";case 62:return"\\u003e";case 38:return"\\u0026";default:return e}}))),i}ip.status=function(e){return("string"==typeof e||Math.floor(e)!==e)&&e>99&&e<1e3&&Lc("res.status("+JSON.stringify(e)+"): use res.status("+Math.floor(e)+") instead"),this.statusCode=e,this},ip.links=function(e){var n=this.get("Link")||"";return n&&(n+=", "),this.set("Link",n+Object.keys(e).map((function(n){return"<"+e[n]+'>; rel="'+n+'"'})).join(", "))},ip.send=function(e){var n,t,a=e,i=this.req,o=this.app;switch(2===arguments.length&&("number"!=typeof arguments[0]&&"number"==typeof arguments[1]?(Lc("res.send(body, status): Use res.status(status).send(body) instead"),this.statusCode=arguments[1]):(Lc("res.send(status, body): Use res.status(status).send(body) instead"),this.statusCode=arguments[0],a=arguments[1])),"number"==typeof a&&1===arguments.length&&(this.get("Content-Type")||this.type("txt"),Lc("res.send(status): Use res.sendStatus(status) instead"),this.statusCode=a,a=Wc.message[a]),typeof a){case"string":this.get("Content-Type")||this.type("html");break;case"boolean":case"number":case"object":if(null===a)a="";else{if(!Dc.isBuffer(a))return this.json(a);this.get("Content-Type")||this.type("bin")}}"string"==typeof a&&(n="utf8","string"==typeof(t=this.get("Content-Type"))&&this.set("Content-Type",Xc(t,"utf-8")));var r,s,c=o.get("etag fn"),p=!this.get("ETag")&&"function"==typeof c;return void 0!==a&&(Dc.isBuffer(a)?r=a.length:!p&&a.length<1e3?r=Dc.byteLength(a,n):(a=Dc.from(a,n),n=void 0,r=a.length),this.set("Content-Length",r)),p&&void 0!==r&&(s=c(a,n))&&this.set("ETag",s),i.fresh&&(this.statusCode=304),204!==this.statusCode&&304!==this.statusCode||(this.removeHeader("Content-Type"),this.removeHeader("Content-Length"),this.removeHeader("Transfer-Encoding"),a=""),205===this.statusCode&&(this.set("Content-Length","0"),this.removeHeader("Transfer-Encoding"),a=""),"HEAD"===i.method?this.end():this.end(a,n),this},ip.json=function(e){var n=e;2===arguments.length&&("number"==typeof arguments[1]?(Lc("res.json(obj, status): Use res.status(status).json(obj) instead"),this.statusCode=arguments[1]):(Lc("res.json(status, obj): Use res.status(status).json(obj) instead"),this.statusCode=arguments[0],n=arguments[1]));var t=this.app,a=t.get("json escape"),i=cp(n,t.get("json replacer"),t.get("json spaces"),a);return this.get("Content-Type")||this.set("Content-Type","application/json"),this.send(i)},ip.jsonp=function(e){var n=e;2===arguments.length&&("number"==typeof arguments[1]?(Lc("res.jsonp(obj, status): Use res.status(status).jsonp(obj) instead"),this.statusCode=arguments[1]):(Lc("res.jsonp(status, obj): Use res.status(status).jsonp(obj) instead"),this.statusCode=arguments[0],n=arguments[1]));var t=this.app,a=t.get("json escape"),i=cp(n,t.get("json replacer"),t.get("json spaces"),a),o=this.req.query[t.get("jsonp callback name")];return this.get("Content-Type")||(this.set("X-Content-Type-Options","nosniff"),this.set("Content-Type","application/json")),Array.isArray(o)&&(o=o[0]),"string"==typeof o&&0!==o.length&&(this.set("X-Content-Type-Options","nosniff"),this.set("Content-Type","text/javascript"),o=o.replace(/[^\[\]\w$.]/g,""),void 0===i?i="":"string"==typeof i&&(i=i.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")),i="/**/ typeof "+o+" =
|
|||
|
/*!
|
|||
|
* serve-static
|
|||
|
* Copyright(c) 2010 Sencha Inc.
|
|||
|
* Copyright(c) 2011 TJ Holowaychuk
|
|||
|
* Copyright(c) 2014-2016 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function up(){if(pp)return lp.exports;pp=1;var e=Sa,n=Ta,a=Na,i=t.resolve,o=Qr,r=f;return lp.exports=function(t,s){if(!t)throw new TypeError("root path required");if("string"!=typeof t)throw new TypeError("root path must be a string");var c=Object.create(s||null),p=!1!==c.fallthrough,l=!1!==c.redirect,u=c.setHeaders;if(u&&"function"!=typeof u)throw new TypeError("option setHeaders must be function");c.maxage=c.maxage||c.maxAge||0,c.root=i(t);var d=l?function(t){if(this.hasTrailingSlash())this.error(404);else{var i=a.original(this.req);i.path=null,i.pathname=function(e){for(var n=0;n<e.length&&47===e.charCodeAt(n);n++);return n>1?"/"+e.substr(n):e}(i.pathname+"/");var o,s,c=e(r.format(i)),p=(o="Redirecting",s='Redirecting to <a href="'+n(c)+'">'+n(c)+"</a>",'<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>'+o+"</title>\n</head>\n<body>\n<pre>"+s+"</pre>\n</body>\n</html>\n");t.statusCode=301,t.setHeader("Content-Type","text/html; charset=UTF-8"),t.setHeader("Content-Length",Buffer.byteLength(p)),t.setHeader("Content-Security-Policy","default-src 'none'"),t.setHeader("X-Content-Type-Options","nosniff"),t.setHeader("Location",c),t.end(p)}}:function(){this.error(404)};return function(e,n,t){if("GET"!==e.method&&"HEAD"!==e.method)return p?t():(n.statusCode=405,n.setHeader("Allow","GET, HEAD"),n.setHeader("Content-Length","0"),void n.end());var i=!p,r=a.original(e),s=a(e).pathname;"/"===s&&"/"!==r.pathname.substr(-1)&&(s="");var l=o(e,s,c);l.on("directory",d),u&&l.on("headers",u),p&&l.on("file",(function(){i=!0})),l.on("error",(function(e){!i&&e.statusCode<500?t():t(e)})),l.pipe(n)}},lp.exports.mime=o.mime,lp.exports}
|
|||
|
/*!
|
|||
|
* express
|
|||
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|||
|
* Copyright(c) 2013 Roman Shtylman
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/!function(e,n){var t=pa,a=s.EventEmitter,i=la,o=ms,r=Ti,c=Qi,p=kc,l=op;(n=e.exports=function(){var e=function(n,t,a){e.handle(n,t,a)};return i(e,a.prototype,!1),i(e,o,!1),e.request=Object.create(p,{app:{configurable:!0,enumerable:!0,writable:!0,value:e}}),e.response=Object.create(l,{app:{configurable:!0,enumerable:!0,writable:!0,value:e}}),e.init(),e}).application=o,n.request=p,n.response=l,n.Route=r,n.Router=c,n.json=t.json,n.query=no(),n.raw=t.raw,n.static=up(),n.text=t.text,n.urlencoded=t.urlencoded;["bodyParser","compress","cookieSession","session","logger","cookieParser","favicon","responseTime","errorHandler","timeout","methodOverride","vhost","csrf","directory","limit","multipart","staticCache"].forEach((function(e){Object.defineProperty(n,e,{get:function(){throw new Error("Most middleware (like "+e+") is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.")},configurable:!0})}))}(y,y.exports);var dp=b(y.exports),fp={exports:{}},mp={
|
|||
|
/*!
|
|||
|
* cookie
|
|||
|
* Copyright(c) 2012-2014 Roman Shtylman
|
|||
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/
|
|||
|
parse:function(e,n){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var t={},a=n||{},i=e.split(";"),o=a.decode||vp,r=0;r<i.length;r++){var s=i[r],c=s.indexOf("=");if(!(c<0)){var p=s.substring(0,c).trim();if(null==t[p]){var l=s.substring(c+1,s.length).trim();'"'===l[0]&&(l=l.slice(1,-1)),t[p]=gp(l,o)}}}return t},serialize:function(e,n,t){var a=t||{},i=a.encode||hp;if("function"!=typeof i)throw new TypeError("option encode is invalid");if(!xp.test(e))throw new TypeError("argument name is invalid");var o=i(n);if(o&&!xp.test(o))throw new TypeError("argument val is invalid");var r=e+"="+o;if(null!=a.maxAge){var s=a.maxAge-0;if(isNaN(s)||!isFinite(s))throw new TypeError("option maxAge is invalid");r+="; Max-Age="+Math.floor(s)}if(a.domain){if(!xp.test(a.domain))throw new TypeError("option domain is invalid");r+="; Domain="+a.domain}if(a.path){if(!xp.test(a.path))throw new TypeError("option path is invalid");r+="; Path="+a.path}if(a.expires){if("function"!=typeof a.expires.toUTCString)throw new TypeError("option expires is invalid");r+="; Expires="+a.expires.toUTCString()}a.httpOnly&&(r+="; HttpOnly");a.secure&&(r+="; Secure");if(a.sameSite){switch("string"==typeof a.sameSite?a.sameSite.toLowerCase():a.sameSite){case!0:r+="; SameSite=Strict";break;case"lax":r+="; SameSite=Lax";break;case"strict":r+="; SameSite=Strict";break;case"none":r+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return r}},vp=decodeURIComponent,hp=encodeURIComponent,xp=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|||
|
/*!
|
|||
|
* express
|
|||
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|||
|
* Copyright(c) 2013 Roman Shtylman
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function gp(e,n){try{return n(e)}catch(n){return e}}var bp,yp,wp,kp,jp={exports:{}},Ep={exports:{}},Sp={exports:{}};function Op(){if(yp)return bp;yp=1;var e=1e3,n=60*e,t=60*n,a=24*t,i=365.25*a;function o(e,n,t){if(!(e<n))return e<1.5*n?Math.floor(e/n)+" "+t:Math.ceil(e/n)+" "+t+"s"}return bp=function(r,s){s=s||{};var c=typeof r;if("string"===c&&r.length>0)return function(o){if((o=String(o)).length>100)return;var r=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(o);if(!r)return;var s=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return s*i;case"days":case"day":case"d":return s*a;case"hours":case"hour":case"hrs":case"hr":case"h":return s*t;case"minutes":case"minute":case"mins":case"min":case"m":return s*n;case"seconds":case"second":case"secs":case"sec":case"s":return s*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(r);if("number"===c&&!1===isNaN(r))return s.long?function(i){return o(i,a,"day")||o(i,t,"hour")||o(i,n,"minute")||o(i,e,"second")||i+" ms"}(r):function(i){if(i>=a)return Math.round(i/a)+"d";if(i>=t)return Math.round(i/t)+"h";if(i>=n)return Math.round(i/n)+"m";if(i>=e)return Math.round(i/e)+"s";return i+"ms"}(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))}}function Ap(){return wp||(wp=1,function(e,n){var t;function a(e){function a(){if(a.enabled){var e=a,i=+new Date,o=i-(t||i);e.diff=o,e.prev=t,e.curr=i,t=i;for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];r[0]=n.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");var c=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,(function(t,a){if("%%"===t)return t;c++;var i=n.formatters[a];if("function"==typeof i){var o=r[c];t=i.call(e,o),r.splice(c,1),c--}return t})),n.formatArgs.call(e,r),(a.log||n.log||console.log.bind(console)).apply(e,r)}}return a.namespace=e,a.enabled=n.enabled(e),a.useColors=n.useColors(),a.color=function(e){var t,a=0;for(t in e)a=(a<<5)-a+e.charCodeAt(t),a|=0;return n.colors[Math.abs(a)%n.colors.length]}(e),"function"==typeof n.init&&n.init(a),a}(n=e.exports=a.debug=a.default=a).coerce=function(e){return e instanceof Error?e.stack||e.message:e},n.disable=function(){n.enable("")},n.enable=function(e){n.save(e),n.names=[],n.skips=[];for(var t=("string"==typeof e?e:"").split(/[\s,]+/),a=t.length,i=0;i<a;i++)t[i]&&("-"===(e=t[i].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))},n.enabled=function(e){var t,a;for(t=0,a=n.skips.length;t<a;t++)if(n.skips[t].test(e))return!1;for(t=0,a=n.names.length;t<a;t++)if(n.names[t].test(e))return!0;return!1},n.humanize=Op(),n.names=[],n.skips=[],n.formatters={}}(Sp,Sp.exports)),Sp.exports}var Cp,_p={exports:{}};"undefined"!=typeof process&&"renderer"===process.type?jp.exports=(kp||(kp=1,function(e,n){function t(){var e;try{e=n.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(n=Ep.exports=Ap()).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},n.formatArgs=function(e){var t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),t){var a="color: "+this.color;e.splice(1,0,a,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))})),e.splice(o,0,a)}},n.save=function(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(e){}},n.load=t,n.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/fi
|
|||
|
/*!
|
|||
|
* on-headers
|
|||
|
* Copyright(c) 2014 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function zp(e){var n=arguments.length,t=n>1&&"string"==typeof arguments[1]?2:1,a=n>=t+1?arguments[t]:void 0;this.statusCode=e,Array.isArray(a)?function(e,n){for(var t=0;t<n.length;t++)e.setHeader(n[t][0],n[t][1])}(this,a):a&&function(e,n){for(var t=Object.keys(n),a=0;a<t.length;a++){var i=t[a];i&&e.setHeader(i,n[i])}}(this,a);for(var i=new Array(Math.min(n,t)),o=0;o<i.length;o++)i[o]=arguments[o];return i}var Ip={exports:{}},Pp={exports:{}},Rp=n,Dp=Rp.randomBytes===Rp.pseudoRandomBytes?1:3;function Bp(e,n,t){Rp.randomBytes(e,(function(a,i){return a?--n?void setTimeout(Bp.bind(null,e,n,t),10):t(a):t(null,i)}))}Pp.exports=function(e,n){if(void 0!==n&&"function"!=typeof n)throw new TypeError("argument callback must be a function");if(!n&&!g.Promise)throw new TypeError("argument callback is required");if(n)return Bp(e,Dp,n);return new Promise((function(n,t){Bp(e,Dp,(function(e,a){if(e)return t(e);n(a)}))}))},Pp.exports.sync=function(e){for(var n=null,t=0;t<Dp;t++)try{return Rp.randomBytes(e)}catch(e){n=e}throw n};var Np=Pp.exports,Lp=/=+$/,Mp=/\+/g,Up=/\//g;
|
|||
|
/*!
|
|||
|
* uid-safe
|
|||
|
* Copyright(c) 2014 Jonathan Ong
|
|||
|
* Copyright(c) 2015-2017 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/function Fp(e,n){Np(e,(function(e,t){if(e)return n(e);n(null,Hp(t))}))}function Hp(e){return e.toString("base64").replace(Lp,"").replace(Mp,"-").replace(Up,"_")}Ip.exports=function(e,n){if(void 0!==n&&"function"!=typeof n)throw new TypeError("argument callback must be a function");if(!n&&!g.Promise)throw new TypeError("argument callback is required");if(n)return Fp(e,n);return new Promise((function(n,t){Fp(e,(function(e,a){if(e)return t(e);n(a)}))}))},Ip.exports.sync=function(e){return Hp(Np.sync(e))};var $p=Ip.exports,Vp={exports:{}},Wp=mp,Gp=j("express-session");
|
|||
|
/*!
|
|||
|
* Prototype.
|
|||
|
*/
|
|||
|
(Vp.exports=function(e){if(this.path="/",this.maxAge=null,this.httpOnly=!0,e){if("object"!=typeof e)throw new TypeError("argument options must be a object");for(var n in e)"data"!==n&&(this[n]=e[n])}void 0!==this.originalMaxAge&&null!==this.originalMaxAge||(this.originalMaxAge=this.maxAge)}).prototype={set expires(e){this._expires=e,this.originalMaxAge=this.maxAge},get expires(){return this._expires},set maxAge(e){if(e&&"number"!=typeof e&&!(e instanceof Date))throw new TypeError("maxAge must be a number or Date");e instanceof Date&&Gp("maxAge as Date; pass number of milliseconds instead"),this.expires="number"==typeof e?new Date(Date.now()+e):e},get maxAge(){return this.expires instanceof Date?this.expires.valueOf()-Date.now():this.expires},get data(){return{originalMaxAge:this.originalMaxAge,expires:this._expires,secure:this.secure,httpOnly:this.httpOnly,domain:this.domain,path:this.path,sameSite:this.sameSite}},serialize:function(e,n){return Wp.serialize(e,n,this.data)},toJSON:function(){return this.data}};var Zp=Vp.exports,Jp=Yp;
|
|||
|
/*!
|
|||
|
* Connect - session - Session
|
|||
|
* Copyright(c) 2010 Sencha Inc.
|
|||
|
* Copyright(c) 2011 TJ Holowaychuk
|
|||
|
* MIT Licensed
|
|||
|
*/function Yp(e,n){if(Object.defineProperty(this,"req",{value:e}),Object.defineProperty(this,"id",{value:e.sessionID}),"object"==typeof n&&null!==n)for(var t in n)t in this||(this[t]=n[t])}function Xp(e,n,t){Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value:t,writable:!0})}
|
|||
|
/*!
|
|||
|
* Connect - session - Store
|
|||
|
* Copyright(c) 2010 Sencha Inc.
|
|||
|
* Copyright(c) 2011 TJ Holowaychuk
|
|||
|
* MIT Licensed
|
|||
|
*/Xp(Yp.prototype,"touch",(function(){return this.resetMaxAge()})),Xp(Yp.prototype,"resetMaxAge",(function(){return this.cookie.maxAge=this.cookie.originalMaxAge,this})),Xp(Yp.prototype,"save",(function(e){return this.req.sessionStore.set(this.id,this,e||function(){}),this})),Xp(Yp.prototype,"reload",(function(e){var n=this.req,t=this.req.sessionStore;return t.get(this.id,(function(a,i){return a?e(a):i?(t.createSession(n,i),void e()):e(new Error("failed to load session"))})),this})),Xp(Yp.prototype,"destroy",(function(e){return delete this.req.session,this.req.sessionStore.destroy(this.id,e),this})),Xp(Yp.prototype,"regenerate",(function(e){return this.req.sessionStore.regenerate(this.req,e),this}));var Qp=Zp,Kp=s.EventEmitter,el=Jp,nl=tl;function tl(){Kp.call(this)}i.inherits(tl,Kp),tl.prototype.regenerate=function(e,n){var t=this;this.destroy(e.sessionID,(function(a){t.generate(e),n(a)}))},tl.prototype.load=function(e,n){var t=this;this.get(e,(function(a,i){if(a)return n(a);if(!i)return n();var o={sessionID:e,sessionStore:t};n(null,t.createSession(o,i))}))},tl.prototype.createSession=function(e,n){var t=n.cookie.expires,a=n.cookie.originalMaxAge;return n.cookie=new Qp(n.cookie),"string"==typeof t&&(n.cookie.expires=new Date(t)),n.cookie.originalMaxAge=a,e.session=new el(e,n),e.session};
|
|||
|
/*!
|
|||
|
* express-session
|
|||
|
* Copyright(c) 2010 Sencha Inc.
|
|||
|
* Copyright(c) 2011 TJ Holowaychuk
|
|||
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/
|
|||
|
var al=nl,il="function"==typeof setImmediate?setImmediate:function(e){process.nextTick(e.bind.apply(e,arguments))},ol=rl;function rl(){al.call(this),this.sessions=Object.create(null)}function sl(e){var n=this.sessions[e];if(n){if((n=JSON.parse(n)).cookie){var t="string"==typeof n.cookie.expires?new Date(n.cookie.expires):n.cookie.expires;if(t&&t<=Date.now())return void delete this.sessions[e]}return n}}
|
|||
|
/*!
|
|||
|
* express-session
|
|||
|
* Copyright(c) 2010 Sencha Inc.
|
|||
|
* Copyright(c) 2011 TJ Holowaychuk
|
|||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|||
|
* MIT Licensed
|
|||
|
*/i.inherits(rl,al),rl.prototype.all=function(e){for(var n=Object.keys(this.sessions),t=Object.create(null),a=0;a<n.length;a++){var i=n[a],o=sl.call(this,i);o&&(t[i]=o)}e&&il(e,null,t)},rl.prototype.clear=function(e){this.sessions=Object.create(null),e&&il(e)},rl.prototype.destroy=function(e,n){delete this.sessions[e],n&&il(n)},rl.prototype.get=function(e,n){il(n,null,sl.call(this,e))},rl.prototype.set=function(e,n,t){this.sessions[e]=JSON.stringify(n),t&&il(t)},rl.prototype.length=function(e){this.all((function(n,t){if(n)return e(n);e(null,Object.keys(t).length)}))},rl.prototype.touch=function(e,n,t){var a=sl.call(this,e);a&&(a.cookie=n.cookie,this.sessions[e]=JSON.stringify(a)),t&&il(t)},function(e,t){var a=ho.Buffer,i=mp,o=n,r=Tp("express-session"),s=j("express-session"),c=qp,p=Na,l=Ec,u=$p.sync,d=Zp,f=ol,m=Jp,v=nl,h=process.env.NODE_ENV;t=e.exports=function(e){var n=e||{},t=n.cookie||{},o=n.genid||b,u=n.name||n.key||"connect.sid",v=n.store||new f,j=n.proxy,E=n.resave,S=Boolean(n.rolling),O=n.saveUninitialized,A=n.secret;if("function"!=typeof o)throw new TypeError("genid option must be a function");void 0===E&&(s("undefined resave option; provide resave option"),E=!0);void 0===O&&(s("undefined saveUninitialized option; provide saveUninitialized option"),O=!0);if(n.unset&&"destroy"!==n.unset&&"keep"!==n.unset)throw new TypeError('unset option must be "destroy" or "keep"');var C="destroy"===n.unset;if(Array.isArray(A)&&0===A.length)throw new TypeError("secret option array must contain one or more strings");A&&!Array.isArray(A)&&(A=[A]);A||s("req.secret; provide secret option");"production"===h&&v instanceof f&&console.warn(x);v.generate=function(e){e.sessionID=o(e),e.session=new m(e),e.session.cookie=new d(t),"auto"===t.secure&&(e.session.cookie.secure=w(e,j))};var _="function"==typeof v.touch,T=!0;return v.on("disconnect",(function(){T=!1})),v.on("connect",(function(){T=!0})),function(e,n,o){if(e.session)o();else{if(!T)return r("store is disconnected"),void o();if(0!==(p.original(e).pathname||"/").indexOf(t.path||"/"))return o();if(A||e.secret){var d,f,m,h=A||[e.secret],x=!1;e.sessionStore=v;var b=e.sessionID=function(e,n,t){var a,o,c=e.headers.cookie;if(c){(a=i.parse(c)[n])&&("s:"===a.substr(0,2)?!1===(o=k(a.slice(2),t))&&(r("cookie signature invalid"),o=void 0):r("cookie unsigned"))}!o&&e.signedCookies&&(o=e.signedCookies[n])&&s("cookie should be available in req.headers.cookie");!o&&e.cookies&&(a=e.cookies[n])&&("s:"===a.substr(0,2)?((o=k(a.slice(2),t))&&s("cookie should be available in req.headers.cookie"),!1===o&&(r("cookie signature invalid"),o=void 0)):r("cookie unsigned"));return o}(e,u,h);c(n,(function(){e.session?function(e){if("string"!=typeof e.sessionID)return!1;return b!==e.sessionID?O||D(e.session):S||null!=e.session.cookie.expires&&D(e.session)}(e)&&(!e.session.cookie.secure||w(e,j)?(x||(e.session.touch(),x=!0),function(e,n,t,a,o){var s="s:"+l.sign(t,a),c=i.serialize(n,s,o);r("set-cookie %s",c);var p=e.getHeader("Set-Cookie")||[],u=Array.isArray(p)?p.concat(c):[p,c];e.setHeader("Set-Cookie",u)}(n,u,e.sessionID,h[0],e.session.cookie.data)):r("not secured")):r("no session")}));var q=n.end,z=n.write,I=!1;if(n.end=function(t,i){if(I)return!1;var s;I=!0;var c=!0;function p(){if(c)return s=q.call(n,t,i),void(c=!1);q.call(n)}function l(){if(!c)return s;if(n._header||n._implicitHeader(),null==t)return s=!0;var e=Number(n.getHeader("Content-Length"));return!isNaN(e)&&e>0&&(t=a.isBuffer(t)?t:a.from(t,i),i=void 0,0!==t.length)?(r("split response"),s=z.call(n,t.slice(0,t.length-1)),t=t.slice(t.length-1,t.length),s):(s=z.call(n,t,i),c=!1,s)}return function(e){return e.sessionID&&C&&null==e.session}(e)?(r("destroying"),v.destroy(e.sessionID,(function(e){e&&g(o,e),r("destroyed"),p()})),l()):e.session?(x||(e.session.touch(),x=!0),B(e)?(e.session.save((function(e){e&&g(o,e),p()})),l()):_&&function(e){if("string"!=typeof e.sessionID)return r("session ignored because of bogus req.sessionID %o",e.sessionID),!1;return b===e.sessionID&&!B(e)}(e)?(r("touching"),v.touch(e.sessionID,e.session,(function(e){e&&g(o,e),r("touched
|