(function(n){"use strict" function e(n,e,r){return e<=n&&n<=r}"undefined"!=typeof module&&module.exports&&!n["encoding-indexes"]&&(n["encoding-indexes"]=require("./encoding-indexes-50f27403be5972eae4831f5b69db1f80.js")["encoding-indexes"]) var r=Math.floor function i(n){if(void 0===n)return{} if(n===Object(n))return n throw TypeError("Could not convert argument to dictionary")}function t(n){return 0<=n&&n<=127}var o=t,s=-1 function a(n){this.tokens=[].slice.call(n),this.tokens.reverse()}a.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():s},prepend:function(n){if(Array.isArray(n))for(var e=n;e.length;)this.tokens.push(e.pop()) else this.tokens.push(n)},push:function(n){if(Array.isArray(n))for(var e=n;e.length;)this.tokens.unshift(e.shift()) else this.tokens.unshift(n)}} var u=-1 function l(n,e){if(n)throw TypeError("Decoder error") return e||65533}function f(n){throw TypeError("The code point "+n+" could not be encoded.")}function c(n){return n=String(n).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(h,n)?h[n]:null}var d=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"UTF-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"IBM866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"ISO-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"ISO-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"ISO-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"ISO-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"ISO-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"ISO-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"ISO-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"ISO-8859-8-I"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"ISO-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"ISO-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"ISO-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"ISO-8859-15"},{labels:["iso-8859-16"],name:"ISO-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"KOI8-R"},{labels:["koi8-ru","koi8-u"],name:"KOI8-U"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"GBK"},{labels:["gb18030"],name:"gb18030"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"Big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"EUC-JP"},{labels:["csiso2022jp","iso-2022-jp"],name:"ISO-2022-JP"},{labels:["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"Shift_JIS"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"EUC-KR"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],name:"replacement"},{labels:["utf-16be"],name:"UTF-16BE"},{labels:["utf-16","utf-16le"],name:"UTF-16LE"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],h={} d.forEach((function(n){n.encodings.forEach((function(n){n.labels.forEach((function(e){h[e]=n}))}))})) var g,p,b={},_={} function w(n,e){return e&&e[n]||null}function m(n,e){var r=e.indexOf(n) return-1===r?null:r}function v(e){if(!("encoding-indexes"in n))throw Error("Indexes missing. Did you forget to include encoding-indexes-50f27403be5972eae4831f5b69db1f80.js first?") return n["encoding-indexes"][e]}var y="utf-8" function x(n,e){if(!(this instanceof x))throw TypeError("Called as a function. Did you forget 'new'?") n=void 0!==n?String(n):y,e=i(e),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1 var r=c(n) if(null===r||"replacement"===r.name)throw RangeError("Unknown encoding: "+n) if(!_[r.name])throw Error("Decoder not present. Did you forget to include encoding-indexes-50f27403be5972eae4831f5b69db1f80.js first?") var t=this return t._encoding=r,Boolean(e.fatal)&&(t._error_mode="fatal"),Boolean(e.ignoreBOM)&&(t._ignoreBOM=!0),Object.defineProperty||(this.encoding=t._encoding.name.toLowerCase(),this.fatal="fatal"===t._error_mode,this.ignoreBOM=t._ignoreBOM),t}function O(e,r){if(!(this instanceof O))throw TypeError("Called as a function. Did you forget 'new'?") r=i(r),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=Boolean(r.fatal)?"fatal":"replacement" var t=this if(Boolean(r.NONSTANDARD_allowLegacyEncoding)){var o=c(e=void 0!==e?String(e):y) if(null===o||"replacement"===o.name)throw RangeError("Unknown encoding: "+e) if(!b[o.name])throw Error("Encoder not present. Did you forget to include encoding-indexes-50f27403be5972eae4831f5b69db1f80.js first?") t._encoding=o}else t._encoding=c("utf-8"),void 0!==e&&"console"in n&&console.warn("TextEncoder constructor called with encoding label, which is ignored.") return Object.defineProperty||(this.encoding=t._encoding.name.toLowerCase()),t}function k(n){var r=n.fatal,i=0,t=0,o=0,a=128,f=191 this.handler=function(n,c){if(c===s&&0!==o)return o=0,l(r) if(c===s)return u if(0===o){if(e(c,0,127))return c if(e(c,194,223))o=1,i=31&c else if(e(c,224,239))224===c&&(a=160),237===c&&(f=159),o=2,i=15&c else{if(!e(c,240,244))return l(r) 240===c&&(a=144),244===c&&(f=143),o=3,i=7&c}return null}if(!e(c,a,f))return i=o=t=0,a=128,f=191,n.prepend(c),l(r) if(a=128,f=191,i=i<<6|63&c,(t+=1)!==o)return null var d=i return i=o=t=0,d}}function E(n){n.fatal this.handler=function(n,r){if(r===s)return u if(o(r))return r var i,t e(r,128,2047)?(i=1,t=192):e(r,2048,65535)?(i=2,t=224):e(r,65536,1114111)&&(i=3,t=240) for(var a=[(r>>6*i)+t];i>0;){var l=r>>6*(i-1) a.push(128|63&l),i-=1}return a}}function j(n,e){var r=e.fatal this.handler=function(e,i){if(i===s)return u if(t(i))return i var o=n[i-128] return null===o?l(r):o}}function B(n,e){e.fatal this.handler=function(e,r){if(r===s)return u if(o(r))return r var i=m(r,n) return null===i&&f(r),i+128}}function S(n){var r=n.fatal,i=0,o=0,a=0 this.handler=function(n,f){if(f===s&&0===i&&0===o&&0===a)return u var c if(f!==s||0===i&&0===o&&0===a||(i=0,o=0,a=0,l(r)),0!==a){c=null,e(f,48,57)&&(c=function(n){if(n>39419&&n<189e3||n>1237575)return null if(7457===n)return 59335 var e,r=0,i=0,t=v("gb18030-ranges") for(e=0;e>8,i=255&n return e?[r,i]:[i,r]}function R(n,r){var i=r.fatal,t=null,o=null this.handler=function(r,a){if(a===s&&(null!==t||null!==o))return l(i) if(a===s&&null===t&&null===o)return u if(null===t)return t=a,null var f if(f=n?(t<<8)+a:(a<<8)+t,t=null,null!==o){var c=o return o=null,e(f,56320,57343)?65536+1024*(c-55296)+(f-56320):(r.prepend(K(f,n)),l(i))}return e(f,55296,56319)?(o=f,null):e(f,56320,57343)?l(i):f}}function G(n,r){r.fatal this.handler=function(r,i){if(i===s)return u if(e(i,0,65535))return K(i,n) var t=K(55296+(i-65536>>10),n),o=K(56320+(i-65536&1023),n) return t.concat(o)}}function N(n){n.fatal this.handler=function(n,e){return e===s?u:t(e)?e:63360+e-128}}function q(n){n.fatal this.handler=function(n,r){return r===s?u:o(r)?r:e(r,63360,63487)?r-63360+128:f(r)}}Object.defineProperty&&(Object.defineProperty(x.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(x.prototype,"fatal",{get:function(){return"fatal"===this._error_mode}}),Object.defineProperty(x.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}})),x.prototype.decode=function(n,e){var r r="object"==typeof n&&n instanceof ArrayBuffer?new Uint8Array(n):"object"==typeof n&&"buffer"in n&&n.buffer instanceof ArrayBuffer?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(0),e=i(e),this._do_not_flush||(this._decoder=_[this._encoding.name]({fatal:"fatal"===this._error_mode}),this._BOMseen=!1),this._do_not_flush=Boolean(e.stream) for(var t,o=new a(r),l=[];;){var f=o.read() if(f===s)break if((t=this._decoder.handler(o,f))===u)break null!==t&&(Array.isArray(t)?l.push.apply(l,t):l.push(t))}if(!this._do_not_flush){do{if((t=this._decoder.handler(o,o.read()))===u)break null!==t&&(Array.isArray(t)?l.push.apply(l,t):l.push(t))}while(!o.endOfStream()) this._decoder=null}return function(n){var e,r return e=["UTF-8","UTF-16LE","UTF-16BE"],r=this._encoding.name,-1===e.indexOf(r)||this._ignoreBOM||this._BOMseen||(n.length>0&&65279===n[0]?(this._BOMseen=!0,n.shift()):n.length>0&&(this._BOMseen=!0)),function(n){for(var e="",r=0;r>10),56320+(1023&i)))}return e}(n)}.call(this,l)},Object.defineProperty&&Object.defineProperty(O.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),O.prototype.encode=function(n,e){n=void 0===n?"":String(n),e=i(e),this._do_not_flush||(this._encoder=b[this._encoding.name]({fatal:"fatal"===this._fatal})),this._do_not_flush=Boolean(e.stream) for(var r,t=new a(function(n){for(var e=String(n),r=e.length,i=0,t=[];i57343)t.push(o) else if(56320<=o&&o<=57343)t.push(65533) else if(55296<=o&&o<=56319)if(i===r-1)t.push(65533) else{var s=e.charCodeAt(i+1) if(56320<=s&&s<=57343){var a=1023&o,u=1023&s t.push(65536+(a<<10)+u),i+=1}else t.push(65533)}i+=1}return t}(n)),o=[];;){var l=t.read() if(l===s)break if((r=this._encoder.handler(t,l))===u)break Array.isArray(r)?o.push.apply(o,r):o.push(r)}if(!this._do_not_flush){for(;(r=this._encoder.handler(t,t.read()))!==u;)Array.isArray(r)?o.push.apply(o,r):o.push(r) this._encoder=null}return new Uint8Array(o)},b["UTF-8"]=function(n){return new E(n)},_["UTF-8"]=function(n){return new k(n)},"encoding-indexes"in n&&d.forEach((function(n){"Legacy single-byte encodings"===n.heading&&n.encodings.forEach((function(n){var e=n.name,r=v(e.toLowerCase()) _[e]=function(n){return new j(r,n)},b[e]=function(n){return new B(r,n)}}))})),_.GBK=function(n){return new S(n)},b.GBK=function(n){return new T(n,!0)},b.gb18030=function(n){return new T(n)},_.gb18030=function(n){return new S(n)},b.Big5=function(n){return new U(n)},_.Big5=function(n){return new I(n)},b["EUC-JP"]=function(n){return new A(n)},_["EUC-JP"]=function(n){return new C(n)},b["ISO-2022-JP"]=function(n){return new M(n)},_["ISO-2022-JP"]=function(n){return new L(n)},b.Shift_JIS=function(n){return new D(n)},_.Shift_JIS=function(n){return new P(n)},b["EUC-KR"]=function(n){return new J(n)},_["EUC-KR"]=function(n){return new F(n)},b["UTF-16BE"]=function(n){return new G(!0,n)},_["UTF-16BE"]=function(n){return new R(!0,n)},b["UTF-16LE"]=function(n){return new G(!1,n)},_["UTF-16LE"]=function(n){return new R(!1,n)},b["x-user-defined"]=function(n){return new q(n)},_["x-user-defined"]=function(n){return new N(n)},n.TextEncoder||(n.TextEncoder=O),n.TextDecoder||(n.TextDecoder=x),"undefined"!=typeof module&&module.exports&&(module.exports={TextEncoder:n.TextEncoder,TextDecoder:n.TextDecoder,EncodingIndexes:n["encoding-indexes"]})})(this||{})