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AO,IAAI,GACP,EACA,MAAM,EACV,OAAO,CACX,EAEA,QAAQ,OAAS,SAAU,EAAO,EAAI,GAClC,OAAO,KAAK,QAAQ,EAAO,EAAI,OAAQ,EAC3C,EAEA,QAAQ,OAAS,SAAU,EAAO,EAAM,GACpC,OAAO,KAAK,QAAQ,EAAO,OAAQ,EAAM,GAAS,UACtD,EAEA,QAAQ,iBAAiB,aAAa,WAClC,OAAO,KAAK,SAChB,IAEA,QAAQ,aAAe,WAGnB,IAFA,IAAI,EAAY,QAAQ,UACpB,EAAM,CAAC,EAAG,EAAM,SACX,EAAI,EAAG,EAAM,EAAU,OAAQ,EAAI,IAAO,EAAG,CAClD,IAAI,EAAM,EAAU,GAChB,EAAM,EAAI,QAAQ,EAAK,IAAI,cAC/B,EAAI,GAAO,KAAK,aAAa,EACjC,CACA,OAAO,SAAU,GACb,OAAO,EAAI,EAAS,QAAQ,EAAK,IAAI,cACzC,CACH,CAXsB,GAavB,QAAQ,SAAW,aACnB,QAAQ,OAAS","file":"/npm/codes@0.2.5/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/codes@0.2.5/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var bind = require('./build/Release/iconv'),\n    stream = require('stream'),\n    util = require('util');\n\nfunction create(to, from, options) {\n    var from = from || 'utf8',\n        to = to.split('//'),\n        size = options && options.size || 8192,\n        iconv;\n    from = exports.canonicalize(from);\n    to[0] = exports.canonicalize(to[0]);\n    to = to.join('//');\n    iconv = new bind.Iconv(to, from);\n    return {from: from, to: to, size: size, iconv: iconv};\n}\n\nfunction CodesStream(to, from, options) {\n    var h = create(to, from, options);\n    this._iconv = h.iconv;\n    this._input = new Buffer(h.size);\n    this._input.start = 0;\n    this._output = new Buffer(h.size);\n    this._buffer = new Buffer(0);\n    this.fromCode = h.from;\n    this.toCode = h.to;\n    this.size = h.size;\n    this.readable = true;\n    this.writable = true;\n}\n\nutil.inherits(CodesStream, stream.Stream);\n\nCodesStream.prototype.setEncoding = function (encoding) {\n    this._encoding = encoding;\n}\n\nCodesStream.prototype.pause = function () {\n    this._paused = true;\n}\n\nCodesStream.prototype.resume = function () {\n    if (this._paused) {\n        this._paused = false;\n        if (this.write(this._buffer)) {\n            this._buffer = new Buffer(0);\n            this.emit('drain')\n        }\n    }\n}\n\nCodesStream.prototype.write = function (data) {\n    if (!this.writable) {\n        this.readable = false;\n        this.emit('error', new Error('stream not writable'))\n        return false;\n    }\n    if (!Buffer.isBuffer(data)) {\n        var encoding = 'utf8';\n        if (typeof(arguments[1]) == 'string') encoding = arguments[1];\n        data = new Buffer('' + data, encoding);\n    }\n    if (this._paused) {\n        var buffer = new Buffer(this._buffer.length + data.length);\n        this._buffer.copy(buffer);\n        data.copy(buffer, this._buffer.length);\n        this._buffer = buffer;\n        return false;\n    }\n    var input = this._input;\n    var output = this._output;\n    var start = 0;\n    var end = data.length;\n    while (start < end) {\n        var offset = Math.min(end - start, input.length - input.start);\n        data.copy(input, input.start, start, start + offset);\n        var chunk = input.slice(0, input.start + offset);\n        this._write(chunk);\n        start += offset;\n    }\n    return true;\n}\n\nCodesStream.prototype.end = function (data) {\n    if (data)\n        this.write.apply(this, arguments);\n    if (this.writable) {\n        if (this.error) {\n            this.readable = false;\n            this.emit('error', this.error);\n        }\n        this.readable = false;\n        this.writable = false;\n        this.emit('end');\n    }\n}\n\nCodesStream.prototype._write = function (chunk) {\n    var input = this._input;\n    chunk.end = false;\n    while (chunk.length > 0 && !chunk.end)\n        chunk = this._convert(chunk);\n    if (chunk.length > 0) {\n        chunk.copy(input);\n        input.start = chunk.length;\n    } else {\n        input.start = 0;\n    }\n}\n\nCodesStream.prototype._convert = function (input) {\n    var iconv = this._iconv,\n        output = this._output,\n        r = iconv.convert(input, output),\n        offsetIn = r.offsetIn,\n        input = input.slice(offsetIn),\n        output = output.slice(0, r.offsetOut);\n    input.end = true;\n    if (output.length) {\n        if (this._encoding)\n            this.emit('data', output.toString(this._encoding));\n        else\n            this.emit('data', output);\n    }\n    delete this.error;\n    if (r.code == -1) {\n        switch (r.errno) {\n        case 'E2BIG':\n            input.end = false;\n            break;\n        case 'EILSEQ':\n            var error = new Error(r.error);\n            error.code = r.errno;\n            input = input.slice(offsetIn + 1);\n            this.readable = false;\n            this.emit('error', error);\n            return input.slice(0, 0);\n            break;\n        case 'EINVAL':\n            var error = new Error(r.error);\n            error.code = r.errno;\n            this.error = error;\n            break;\n        }\n    }\n    return input;\n}\n\nfunction Codes(to, from, options) {\n    var h = create(to, from, options);\n    this.toCode = h.to;\n    this.fromCode = h.from;\n    this.size = h.size;\n    this._iconv = h.iconv;\n}\n\nCodes.prototype.convert = function (input) {\n    var output = new Buffer(input.length * 4),\n            r = this._iconv.convert(input, output);\n    if (r.code == -1)\n        throw new Error(r.error);\n    return output.slice(0, r.offsetOut);\n}\n\nexports.CodesStream = CodesStream;\n\nexports.Codes = Codes;\n\nexports.createStream = function (to, from, options) {\n    return new CodesStream(to, from, options);\n}\n\nexports.create = function (to, from, options) {\n    return new Codes(to, from, options);\n}\n\nexports.convert = function (input, to, from, options) {\n    options = options || {};\n    options.size = Math.ceil(input.length * 4 / 8192) * 8192;\n    var stream = new CodesStream(to, from, options),\n            error, output;\n    stream.on('error', function (err) {\n        error = err;\n    });\n    stream.on('data', function (data) {\n        output = data;\n    });\n    stream.end(input);\n    if (error)\n        throw error;\n    return output;\n}\n\nexports.encode = function (input, to, options) {\n    return this.convert(input, to, 'utf8', options);\n}\n\nexports.decode = function (input, from, options) {\n    return this.convert(input, 'utf8', from, options).toString();\n}\n\nexports.__defineGetter__('encodings', function () {\n    return bind.encodings;\n});\n\nexports.canonicalize = (function () {\n    var encodings = exports.encodings;\n    var map = {}, reg = /[_.:-]/;\n    for (var i = 0, len = encodings.length; i < len; ++i) {\n        var enc = encodings[i];\n        var key = enc.replace(reg, '').toLowerCase();\n        map[key] = bind.canonicalize(enc);\n    }\n    return function (encoding) {\n        return map[encoding.replace(reg, '').toLowerCase()];\n    }\n})();\n\nexports.TRANSLIT = '//TRANSLIT';\nexports.IGNORE = '//IGNORE';\n"]}