securityos/node_modules/next/dist/compiled/compression/index.js

51 lines
158 KiB
JavaScript
Raw Normal View History

2024-09-06 15:32:35 +00:00
(()=>{var e={909:(e,a,i)=>{"use strict";
/*!
* accepts
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/var n=i(995);var s=i(230);e.exports=Accepts;function Accepts(e){if(!(this instanceof Accepts)){return new Accepts(e)}this.headers=e.headers;this.negotiator=new n(e)}Accepts.prototype.type=Accepts.prototype.types=function(e){var a=e;if(a&&!Array.isArray(a)){a=new Array(arguments.length);for(var i=0;i<a.length;i++){a[i]=arguments[i]}}if(!a||a.length===0){return this.negotiator.mediaTypes()}if(!this.headers.accept){return a[0]}var n=a.map(extToMime);var s=this.negotiator.mediaTypes(n.filter(validMime));var o=s[0];return o?a[n.indexOf(o)]:false};Accepts.prototype.encoding=Accepts.prototype.encodings=function(e){var a=e;if(a&&!Array.isArray(a)){a=new Array(arguments.length);for(var i=0;i<a.length;i++){a[i]=arguments[i]}}if(!a||a.length===0){return this.negotiator.encodings()}return this.negotiator.encodings(a)[0]||false};Accepts.prototype.charset=Accepts.prototype.charsets=function(e){var a=e;if(a&&!Array.isArray(a)){a=new Array(arguments.length);for(var i=0;i<a.length;i++){a[i]=arguments[i]}}if(!a||a.length===0){return this.negotiator.charsets()}return this.negotiator.charsets(a)[0]||false};Accepts.prototype.lang=Accepts.prototype.langs=Accepts.prototype.language=Accepts.prototype.languages=function(e){var a=e;if(a&&!Array.isArray(a)){a=new Array(arguments.length);for(var i=0;i<a.length;i++){a[i]=arguments[i]}}if(!a||a.length===0){return this.negotiator.languages()}return this.negotiator.languages(a)[0]||false};function extToMime(e){return e.indexOf("/")===-1?s.lookup(e):e}function validMime(e){return typeof e==="string"}},876:(e,a,i)=>{"use strict";
/*!
* compressible
* Copyright(c) 2013 Jonathan Ong
* Copyright(c) 2014 Jeremiah Senkpiel
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/var n=i(183);var s=/^text\/|\+(?:json|text|xml)$/i;var o=/^\s*([^;\s]*)(?:;|\s|$)/;e.exports=compressible;function compressible(e){if(!e||typeof e!=="string"){return false}var a=o.exec(e);var i=a&&a[1].toLowerCase();var c=n[i];if(c&&c.compressible!==undefined){return c.compressible}return s.test(i)||undefined}},756:(e,a,i)=>{"use strict";
/*!
* compression
* Copyright(c) 2010 Sencha Inc.
* Copyright(c) 2011 TJ Holowaychuk
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/var n=i(909);var s=i(291).Buffer;var o=i(666);var c=i(876);var t=i(937)("compression");var p=i(849);var r=i(850);var l=i(796);e.exports=compression;e.exports.filter=shouldCompress;var u=/(?:^|,)\s*?no-transform\s*?(?:,|$)/;function compression(e){var a=e||{};var i=a.filter||shouldCompress;var s=o.parse(a.threshold);if(s==null){s=1024}return function compression(e,o,c){var u=false;var m;var d=[];var x;var v=o.end;var f=o.on;var b=o.write;o.flush=function flush(){if(x){x.flush()}};o.write=function write(e,a){if(u){return false}if(!this._header){this._implicitHeader()}return x?x.write(toBuffer(e,a)):b.call(this,e,a)};o.end=function end(e,a){if(u){return false}if(!this._header){if(!this.getHeader("Content-Length")){m=chunkLength(e,a)}this._implicitHeader()}if(!x){return v.call(this,e,a)}u=true;return e?x.end(toBuffer(e,a)):x.end()};o.on=function on(e,a){if(!d||e!=="drain"){return f.call(this,e,a)}if(x){return x.on(e,a)}d.push([e,a]);return this};function nocompress(e){t("no compression: %s",e);addListeners(o,f,d);d=null}p(o,(function onResponseHeaders(){if(!i(e,o)){nocompress("filtered");return}if(!shouldTransform(e,o)){nocompress("no transform");return}r(o,"Accept-Encoding");if(Number(o.getHeader("Content-Length"))<s||m<s){nocompress("size below threshold");return}var c=o.getHeader("Content-Encoding")||"identity";if(c!=="identity"){nocompress("already encoded");return}if(e.method==="HEAD"){nocompress("HEAD request");return}var p=n(e);var u=p.encoding(["gzip","deflate","identity"]);if(u==="deflate"&&p.encoding(["gzip"])){u=p.encoding(["gzip","identity"])}if(!u||u==="identity"){nocompress("not acceptable");return}t("%s compression",u);x=u==="gzip"?l.createGzip(a):l.createDeflate(a);addListeners(x,x.on,d);o.setHeader("Content-Encoding",u);o.removeHeader("Content-Length");x.on("data",(function onStreamData(e){if(b.call(o,e)===false){x.pause()}}));x.on("end",(function onStreamEnd(){v.call(o)}));f.call(o,"drain",(function onResponseDrain(){x.resume()}))}));c()}}function addListeners(e,a,i){for(var n=0;n<i.length;n++){a.apply(e,i[n])}}function chunkLength(e,a){if(!e){return 0}return!s.isBuffer(e)?s.byteLength(e,a):e.length}function shouldCompress(e,a){var i=a.getHeader("Content-Type");if(i===undefined||!c(i)){t("%s not compressible",i);return false}return true}function shouldTransform(e,a){var i=a.getHeader("Cache-Control");return!i||!u.test(i)}function toBuffer(e,a){return!s.isBuffer(e)?s.from(e,a):e}},183:(e,a,i)=>{
/*!
* mime-db
* Copyright(c) 2014 Jonathan Ong
* MIT Licensed
*/
e.exports=i(282)},230:(e,a,i)=>{"use strict";
/*!
* mime-types
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/var n=i(183);var s=i(17).extname;var o=/^\s*([^;\s]*)(?:;|\s|$)/;var c=/^text\//i;a.charset=charset;a.charsets={lookup:charset};a.contentType=contentType;a.extension=extension;a.extensions=Object.create(null);a.lookup=lookup;a.types=Object.create(null);populateMaps(a.extensions,a.types);function charset(e){if(!e||typeof e!=="string"){return false}var a=o.exec(e);var i=a&&n[a[1].toLowerCase()];if(i&&i.charset){return i.charset}if(a&&c.test(a[1])){return"UTF-8"}return false}function contentType(e){if(!e||typeof e!=="string"){return false}var i=e.indexOf("/")===-1?a.lookup(e):e;if(!i){return false}if(i.indexOf("charset")===-1){var n=a.charset(i);if(n)i+="; charset="+n.toLowerCase()}return i}function extension(e){if(!e||typeof e!=="string"){return false}var i=o.exec(e);var n=i&&a.extensions[i[1].toLowerCase()];if(!n||!n.length){return false}return n[0]}function lookup(e){if(!e||typeof e!=="string"){return false}var i=s("x."+e).toLowerCase().substr(1);if(!i){return false}return a.types[i]||false}function populateMaps(e,a){var i=["nginx","apache",undefined,"iana"];Object.keys(n).forEach((function forEachMimeType(s){var o=n[s];var c=o.extensions;if(!c||!c.length){return}e[s]=c;for(var t=0;t<c.length;t++){var p=c[t];if(a[p]){var r=i.indexOf(n[a[p]].source);var l=i.indexOf(o.source);if(a[p]!=="application/octet-stream"&&(r>l||r===l&&a[p].substr(0,12)==="application/")){continue}}a[p]=s}}))}},995:(e,a,i)=>{"use strict";
/*!
* negotiator
* Copyright(c) 2012 Federico Romero
* Copyright(c) 2012-2014 Isaac Z. Schlueter
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/var n=Object.create(null);e.exports=Negotiator;e.exports.Negotiator=Negotiator;function Negotiator(e){if(!(this instanceof Negotiator)){return new Negotiator(e)}this.request=e}Negotiator.prototype.charset=function charset(e){var a=this.charsets(e);return a&&a[0]};Negotiator.prototype.charsets=function charsets(e){var a=loadModule("charset").preferredCharsets;return a(this.request.headers["accept-charset"],e)};Negotiator.prototype.encoding=function encoding(e){var a=this.encodings(e);return a&&a[0]};Negotiator.prototype.encodings=function encodings(e){var a=loadModule("encoding").preferredEncodings;return a(this.request.headers["accept-encoding"],e)};Negotiator.prototype.language=function language(e){var a=this.languages(e);return a&&a[0]};Negotiator.prototype.languages=function languages(e){var a=loadModule("language").preferredLanguages;return a(this.request.headers["accept-language"],e)};Negotiator.prototype.mediaType=function mediaType(e){var a=this.mediaTypes(e);return a&&a[0]};Negotiator.prototype.mediaTypes=function mediaTypes(e){var a=loadModule("mediaType").preferredMediaTypes;return a(this.request.headers.accept,e)};Negotiator.prototype.preferredCharset=Negotiator.prototype.charset;Negotiator.prototype.preferredCharsets=Negotiator.prototype.charsets;Negotiator.prototype.preferredEncoding=Negotiator.prototype.encoding;Negotiator.prototype.preferredEncodings=Negotiator.prototype.encodings;Negotiator.prototype.preferredLanguage=Negotiator.prototype.language;Negotiator.prototype.preferredLanguages=Negotiator.prototype.languages;Negotiator.prototype.preferredMediaType=Negotiator.prototype.mediaType;Negotiator.prototype.preferredMediaTypes=Negotiator.prototype.mediaTypes;function loadModule(e){var a=n[e];if(a!==undefined){return a}switch(e){case"charset":a=i(324);break;case"encoding":a=i(27);break;case"language":a=i(532);break;case"mediaType":a=i(980);break;default:throw new Error("Cannot find module '"+e+"'")}n[e]=a;return a}},324:e=>{"use strict";e.exports=preferredCharsets;e.exports.preferredCharsets=preferredCharsets;var a=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptCharset(e){var a=e.split(",");for(var i=0,n=0;i<a.length;i++){var s=parseCharset(a[i].trim(),i);if(s){a[n++]=s}}a.length=n;return a}function parseCharset(e,i){var n=a.exec(e);if(!n)return null;var s=n[1];var o=1;if(n[2]){var c=n[2].split(";");for(var t=0;t<c.length;t++){var p=c[t].trim().split("=");if(p[0]==="q"){o=parseFloat(p[1]);break}}}return{charset:s,q:o,i:i}}function getCharsetPriority(e,a,i){var n={o:-1,q:0,s:0};for(var s=0;s<a.length;s++){var o=specify(e,a[s],i);if(o&&(n.s-o.s||n.q-o.q||n.o-o.o)<0){n=o}}return n}function specify(e,a,i){var n=0;if(a.charset.toLowerCase()===e.toLowerCase()){n|=1}else if(a.charset!=="*"){return null}return{i:i,o:a.i,q:a.q,s:n}}function preferredCharsets(e,a){var i=parseAcceptCharset(e===undefined?"*":e||"");if(!a){return i.filter(isQuality).sort(compareSpecs).map(getFullCharset)}var n=a.map((function getPriority(e,a){return getCharsetPriority(e,i,a)}));return n.filter(isQuality).sort(compareSpecs).map((function getCharset(e){return a[n.indexOf(e)]}))}function compareSpecs(e,a){return a.q-e.q||a.s-e.s||e.o-a.o||e.i-a.i||0}function getFullCharset(e){return e.charset}function isQuality(e){return e.q>0}},27:e=>{"use strict";e.exports=preferredEncodings;e.exports.preferredEncodings=preferredEncodings;var a=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptEncoding(e){var a=e.split(",");var i=false;var n=1;for(var s=0,o=0;s<a.length;s++){var c=parseEncoding(a[s].trim(),s);if(c){a[o++]=c;i=i||specify("identity",c);n=Math.min(n,c.q||1)}}if(!i){a[o++]={encoding:"identity",q:n,i:s}}a.length=o;return a}function parseEncoding(e,i){var n=a.exec(e);if(!n)return null;var s=n[1];var o=1;if(n[2]){var c=n[2].split(";");for(var t=0;t<c.length;t++){var p=c[t].trim().split("=");if(p[0]==="q"){o=parseFloat(p[1]);break}}}return{encoding:s,q:o,i:i}}function getEncodingPriority(e,a,i){var n={o:-1,q:0,s:0};for(var s=0;s<a.length;s++){var o=specify(e,a[s],i);if(o&&(n.s-o.s||n.q-o.q||n.o-o.o)<0){n=o}}return n}function specify(e,a,
/*!
* on-headers
* Copyright(c) 2014 Douglas Christopher Wilson
* MIT Licensed
*/e.exports=onHeaders;function createWriteHead(e,a){var i=false;return function writeHead(n){var s=setWriteHeadHeaders.apply(this,arguments);if(!i){i=true;a.call(this);if(typeof s[0]==="number"&&this.statusCode!==s[0]){s[0]=this.statusCode;s.length=1}}return e.apply(this,s)}}function onHeaders(e,a){if(!e){throw new TypeError("argument res is required")}if(typeof a!=="function"){throw new TypeError("argument listener must be a function")}e.writeHead=createWriteHead(e.writeHead,a)}function setHeadersFromArray(e,a){for(var i=0;i<a.length;i++){e.setHeader(a[i][0],a[i][1])}}function setHeadersFromObject(e,a){var i=Object.keys(a);for(var n=0;n<i.length;n++){var s=i[n];if(s)e.setHeader(s,a[s])}}function setWriteHeadHeaders(e){var a=arguments.length;var i=a>1&&typeof arguments[1]==="string"?2:1;var n=a>=i+1?arguments[i]:undefined;this.statusCode=e;if(Array.isArray(n)){setHeadersFromArray(this,n)}else if(n){setHeadersFromObject(this,n)}var s=new Array(Math.min(a,i));for(var o=0;o<s.length;o++){s[o]=arguments[o]}return s}},291:(e,a,i)=>{var n=i(300);var s=n.Buffer;function copyProps(e,a){for(var i in e){a[i]=e[i]}}if(s.from&&s.alloc&&s.allocUnsafe&&s.allocUnsafeSlow){e.exports=n}else{copyProps(n,a);a.Buffer=SafeBuffer}function SafeBuffer(e,a,i){return s(e,a,i)}copyProps(s,SafeBuffer);SafeBuffer.from=function(e,a,i){if(typeof e==="number"){throw new TypeError("Argument must not be a number")}return s(e,a,i)};SafeBuffer.alloc=function(e,a,i){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}var n=s(e);if(a!==undefined){if(typeof i==="string"){n.fill(a,i)}else{n.fill(a)}}else{n.fill(0)}return n};SafeBuffer.allocUnsafe=function(e){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}return s(e)};SafeBuffer.allocUnsafeSlow=function(e){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}return n.SlowBuffer(e)}},850:e=>{"use strict";
/*!
* vary
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*/e.exports=vary;e.exports.append=append;var a=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function append(e,i){if(typeof e!=="string"){throw new TypeError("header argument is required")}if(!i){throw new TypeError("field argument is required")}var n=!Array.isArray(i)?parse(String(i)):i;for(var s=0;s<n.length;s++){if(!a.test(n[s])){throw new TypeError("field argument contains an invalid header name")}}if(e==="*"){return e}var o=e;var c=parse(e.toLowerCase());if(n.indexOf("*")!==-1||c.indexOf("*")!==-1){return"*"}for(var t=0;t<n.length;t++){var p=n[t].toLowerCase();if(c.indexOf(p)===-1){c.push(p);o=o?o+", "+n[t]:n[t]}}return o}function parse(e){var a=0;var i=[];var n=0;for(var s=0,o=e.length;s<o;s++){switch(e.charCodeAt(s)){case 32:if(n===a){n=a=s+1}break;case 44:i.push(e.substring(n,a));n=a=s+1;break;default:a=s+1;break}}i.push(e.substring(n,a));return i}function vary(e,a){if(!e||!e.getHeader||!e.setHeader){throw new TypeError("res argument is required")}var i=e.getHeader("Vary")||"";var n=Array.isArray(i)?i.join(", "):String(i);if(i=append(n,a)){e.setHeader("Vary",i)}}},300:e=>{"use strict";e.exports=require("buffer")},666:e=>{"use strict";e.exports=require("next/dist/compiled/bytes")},937:e=>{"use strict";e.exports=require("next/dist/compiled/debug")},17:e=>{"use strict";e.exports=require("path")},796:e=>{"use strict";e.exports=require("zlib")},282:e=>{"use strict";e.exports=JSON.parse('{"application/1d-interleaved-parityfec":{"source":"iana"},"application/3gpdash-qoe-report+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/3gpp-ims+xml":{"source":"iana","compressible":true},"application/a2l":{"source":"iana"},"application/activemessage":{"source":"iana"},"application/activity+json":{"source":"iana","compressible":true},"application/alto-costmap+json":{"source":"iana","compressible":true},"application/alto-costmapfilter+json":{"source":"iana","compressible":true},"application/alto-directory+json":{"source":"iana","compressible":true},"application/alto-endpointcost+json":{"source":"iana","compressible":true},"application/alto-endpointcostparams+json":{"source":"iana","compressible":true},"application/alto-endpointprop+json":{"source":"iana","compressible":true},"application/alto-endpointpropparams+json":{"source":"iana","compressible":true},"application/alto-error+json":{"source":"iana","compressible":true},"application/alto-networkmap+json":{"source":"iana","compressible":true},"application/alto-networkmapfilter+json":{"source":"iana","compressible":true},"application/alto-updatestreamcontrol+json":{"source":"iana","compressible":true},"application/alto-updatestreamparams+json":{"source":"iana","compressible":true},"application/aml":{"source":"iana"},"application/andrew-inset":{"source":"iana","extensions":["ez"]},"application/applefile":{"source":"iana"},"application/applixware":{"source":"apache","extensions":["aw"]},"application/atf":{"source":"iana"},"application/atfx":{"source":"iana"},"application/atom+xml":{"source":"iana","compressible":true,"extensions":["atom"]},"application/atomcat+xml":{"source":"iana","compressible":true,"extensions":["atomcat"]},"application/atomdeleted+xml":{"source":"iana","compressible":true,"extensions":["atomdeleted"]},"application/atomicmail":{"source":"iana"},"application/atomsvc+xml":{"source":"iana","compressible":true,"extensions":["atomsvc"]},"application/atsc-dwd+xml":{"source":"iana","compressible":true,"extensions":["dwd"]},"application/atsc-dynamic-event-message":{"source":"iana"},"application/atsc-held+xml":{"source":"iana","compressible":true,"extensions":["held"]},"application/atsc-rdt+json":{"source":"iana","compressible":true},"application/atsc-rsat+xml":{"source":"iana","compressible":true,"extensions":["rsat"]},"application/atxml":{"source":"iana"},"application/auth-policy+xml":{"source":"iana","compressible":true},"application/bacnet-xdd+zip":{"source":"iana","compressible":false},"application/batch-smtp":{"source":"iana"},"application/bdoc":{"compressible":false,"extensions":["bdoc"]},"application/beep+xml":{"source":"iana","charset":"UTF-8","compress