1 line
578 KiB
JavaScript
1 line
578 KiB
JavaScript
|
(()=>{"use strict";var e={699:(e,p,a)=>{var d=a(592);e.exports.O=convert;function convert(e,p,a){a=checkEncoding(a||"UTF-8");p=checkEncoding(p||"UTF-8");e=e||"";var d;if(a!=="UTF-8"&&typeof e==="string"){e=Buffer.from(e,"binary")}if(a===p){if(typeof e==="string"){d=Buffer.from(e)}else{d=e}}else{try{d=convertIconvLite(e,p,a)}catch(p){console.error(p);d=e}}if(typeof d==="string"){d=Buffer.from(d,"utf-8")}return d}function convertIconvLite(e,p,a){if(p==="UTF-8"){return d.decode(e,a)}else if(a==="UTF-8"){return d.encode(e,p)}else{return d.encode(d.decode(e,a),p)}}function checkEncoding(e){return(e||"").toString().trim().replace(/^latin[\-_]?(\d+)$/i,"ISO-8859-$1").replace(/^win(?:dows)?[\-_]?(\d+)$/i,"WINDOWS-$1").replace(/^utf[\-_]?(\d+)$/i,"UTF-$1").replace(/^ks_c_5601\-1987$/i,"CP949").replace(/^us[\-_]?ascii$/i,"ASCII").toUpperCase()}},732:(e,p,a)=>{var d=a(983).Buffer;p._dbcs=DBCSCodec;var i=-1,m=-2,l=-10,t=-1e3,s=new Array(256),r=-1;for(var o=0;o<256;o++)s[o]=i;function DBCSCodec(e,p){this.encodingName=e.encodingName;if(!e)throw new Error("DBCS codec is called without the data.");if(!e.table)throw new Error("Encoding '"+this.encodingName+"' has no data.");var a=e.table();this.decodeTables=[];this.decodeTables[0]=s.slice(0);this.decodeTableSeq=[];for(var d=0;d<a.length;d++)this._addDecodeChunk(a[d]);if(typeof e.gb18030==="function"){this.gb18030=e.gb18030();var l=this.decodeTables.length;this.decodeTables.push(s.slice(0));var r=this.decodeTables.length;this.decodeTables.push(s.slice(0));var o=this.decodeTables[0];for(var d=129;d<=254;d++){var n=this.decodeTables[t-o[d]];for(var c=48;c<=57;c++){if(n[c]===i){n[c]=t-l}else if(n[c]>t){throw new Error("gb18030 decode tables conflict at byte 2")}var u=this.decodeTables[t-n[c]];for(var v=129;v<=254;v++){if(u[v]===i){u[v]=t-r}else if(u[v]===t-r){continue}else if(u[v]>t){throw new Error("gb18030 decode tables conflict at byte 3")}var f=this.decodeTables[t-u[v]];for(var h=48;h<=57;h++){if(f[h]===i)f[h]=m}}}}}this.defaultCharUnicode=p.defaultCharUnicode;this.encodeTable=[];this.encodeTableSeq=[];var w={};if(e.encodeSkipVals)for(var d=0;d<e.encodeSkipVals.length;d++){var b=e.encodeSkipVals[d];if(typeof b==="number")w[b]=true;else for(var c=b.from;c<=b.to;c++)w[c]=true}this._fillEncodeTable(0,0,w);if(e.encodeAdd){for(var _ in e.encodeAdd)if(Object.prototype.hasOwnProperty.call(e.encodeAdd,_))this._setEncodeChar(_.charCodeAt(0),e.encodeAdd[_])}this.defCharSB=this.encodeTable[0][p.defaultCharSingleByte.charCodeAt(0)];if(this.defCharSB===i)this.defCharSB=this.encodeTable[0]["?"];if(this.defCharSB===i)this.defCharSB="?".charCodeAt(0)}DBCSCodec.prototype.encoder=DBCSEncoder;DBCSCodec.prototype.decoder=DBCSDecoder;DBCSCodec.prototype._getDecodeTrieNode=function(e){var p=[];for(;e>0;e>>>=8)p.push(e&255);if(p.length==0)p.push(0);var a=this.decodeTables[0];for(var d=p.length-1;d>0;d--){var m=a[p[d]];if(m==i){a[p[d]]=t-this.decodeTables.length;this.decodeTables.push(a=s.slice(0))}else if(m<=t){a=this.decodeTables[t-m]}else throw new Error("Overwrite byte in "+this.encodingName+", addr: "+e.toString(16))}return a};DBCSCodec.prototype._addDecodeChunk=function(e){var p=parseInt(e[0],16);var a=this._getDecodeTrieNode(p);p=p&255;for(var d=1;d<e.length;d++){var i=e[d];if(typeof i==="string"){for(var m=0;m<i.length;){var t=i.charCodeAt(m++);if(55296<=t&&t<56320){var s=i.charCodeAt(m++);if(56320<=s&&s<57344)a[p++]=65536+(t-55296)*1024+(s-56320);else throw new Error("Incorrect surrogate pair in "+this.encodingName+" at chunk "+e[0])}else if(4080<t&&t<=4095){var r=4095-t+2;var o=[];for(var n=0;n<r;n++)o.push(i.charCodeAt(m++));a[p++]=l-this.decodeTableSeq.length;this.decodeTableSeq.push(o)}else a[p++]=t}}else if(typeof i==="number"){var c=a[p-1]+1;for(var m=0;m<i;m++)a[p++]=c++}else throw new Error("Incorrect type '"+typeof i+"' given in "+this.encodingName+" at chunk "+e[0])}if(p>255)throw new Error("Incorrect chunk in "+this.encodingName+" at addr "+e[0]+": too long"+p)};DBCSCodec.prototype._getEncodeBucket=function(e){var p=e>>8;if(this.encodeTable[p]===undefined)this.encodeTable[p]=s.slice(0);retu
|