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AM,6BAE9B,IAAI,EAAS,IAAI,EAAI,OAMrB,OAJA,EAAO,KAAK,EAAI,SAAS,UACzB,EAAO,OAAO,EAAM,MACpB,EAAO,SAAS,EAAM,OAEf,EAAO,SACf,EAeA,EAAI,kBAAoB,SAAS,GAChC,IAAK,EAAQ,MAAM,IAAI,MAAM,4BAE7B,IAAI,EAAS,IAAI,EAAI,OAAO,GAG5B,GADW,EAAO,SACL,EAAI,SAAS,SACzB,MAAM,IAAI,MAAM,gCAGjB,MAAO,CACN,KAAM,EAAO,SACb,MAAO,EAAO,WAEhB,EAiCA,EAAI,MAAQ,SAAS,EAAM,GAC1B,IAAK,EAAQ,MAAM,IAAI,MAAM,4BAE7B,IAAI,EAAO,KAEX,GAjkBD,SAAuB,GACtB,IAAI,EAAO,IAAI,WAAW,EAAK,MAAM,EAAG,IACxC,OAAuB,IAAhB,EAAK,QAA4B,KAAZ,EAAK,IAA2B,MAAZ,EAAK,EACtD,CA8jBM,CAAc,GAEZ,GAAK,EAGL,CAGN,IAAI,EAEH,EADG,EAAK,OACC,EACmB,oBAAX,OACR,IAAI,OAAO,GAIX,IAAI,WAAW,GAGzB,EAAK,OAAO,GAAQ,SAAS,EAAO,GAC/B,EACH,EAAS,EAAO,MAEhB,EAAS,KAAM,EAAK,kBAAkB,GAExC,GACD,MAvBC,EAAS,IAAI,MAAM,uDACJ,WAHf,EAAS,KAAM,EAAK,kBAAkB,GA0BxC,CACA,GAAE,MAAyB,oBAAZ,QAA0B,QAAW,OAAO,IAAM,CAAC","file":"/npm/nbt@0.8.1/nbt.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/nbt@0.8.1/nbt.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*\n\tNBT.js - a JavaScript parser for NBT archives\n\tby Sijmen Mulder\n\n\tI, the copyright holder of this work, hereby release it into the public\n\tdomain. This applies worldwide.\n\n\tIn case this is not legally possible: I grant anyone the right to use this\n\twork for any purpose, without any conditions, unless such conditions are\n\trequired by law.\n*/\n\n(function() {\n\t'use strict';\n\n\tif (typeof ArrayBuffer === 'undefined') {\n\t\tthrow new Error('Missing required type ArrayBuffer');\n\t}\n\tif (typeof DataView === 'undefined') {\n\t\tthrow new Error('Missing required type DataView');\n\t}\n\tif (typeof Uint8Array === 'undefined') {\n\t\tthrow new Error('Missing required type Uint8Array');\n\t}\n\n\t/** @exports nbt */\n\n\tvar nbt = this;\n\tvar zlib = typeof require !== 'undefined' ? require('zlib') : window.zlib;\n\n\t/**\n\t * A mapping from type names to NBT type numbers.\n\t * {@link module:nbt.Writer} and {@link module:nbt.Reader}\n\t * have correspoding methods (e.g. {@link module:nbt.Writer#int})\n\t * for every type.\n\t *\n\t * @type Object<string, number>\n\t * @see module:nbt.tagTypeNames */\n\tnbt.tagTypes = {\n\t\t'end': 0,\n\t\t'byte': 1,\n\t\t'short': 2,\n\t\t'int': 3,\n\t\t'long': 4,\n\t\t'float': 5,\n\t\t'double': 6,\n\t\t'byteArray': 7,\n\t\t'string': 8,\n\t\t'list': 9,\n\t\t'compound': 10,\n\t\t'intArray': 11,\n\t\t'longArray': 12\n\t};\n\n\t/**\n\t * A mapping from NBT type numbers to type names.\n\t *\n\t * @type Object<number, string>\n\t * @see module:nbt.tagTypes */\n\tnbt.tagTypeNames = {};\n\t(function() {\n\t\tfor (var typeName in nbt.tagTypes) {\n\t\t\tif (nbt.tagTypes.hasOwnProperty(typeName)) {\n\t\t\t\tnbt.tagTypeNames[nbt.tagTypes[typeName]] = typeName;\n\t\t\t}\n\t\t}\n\t})();\n\n\tfunction hasGzipHeader(data) {\n\t\tvar head = new Uint8Array(data.slice(0, 2));\n\t\treturn head.length === 2 && head[0] === 0x1f && head[1] === 0x8b;\n\t}\n\n\tfunction encodeUTF8(str) {\n\t\tvar array = [], i, c;\n\t\tfor (i = 0; i < str.length; i++) {\n\t\t\tc = str.charCodeAt(i);\n\t\t\tif (c < 0x80) {\n\t\t\t\tarray.push(c);\n\t\t\t} else if (c < 0x800) {\n\t\t\t\tarray.push(0xC0 | c >> 6);\n\t\t\t\tarray.push(0x80 | c         & 0x3F);\n\t\t\t} else if (c < 0x10000) {\n\t\t\t\tarray.push(0xE0 |  c >> 12);\n\t\t\t\tarray.push(0x80 | (c >>  6) & 0x3F);\n\t\t\t\tarray.push(0x80 |  c        & 0x3F);\n\t\t\t} else {\n\t\t\t\tarray.push(0xF0 | (c >> 18) & 0x07);\n\t\t\t\tarray.push(0x80 | (c >> 12) & 0x3F);\n\t\t\t\tarray.push(0x80 | (c >>  6) & 0x3F);\n\t\t\t\tarray.push(0x80 |  c        & 0x3F);\n\t\t\t}\n\t\t}\n\t\treturn array;\n\t}\n\n\tfunction decodeUTF8(array) {\n\t\tvar codepoints = [], i;\n\t\tfor (i = 0; i < array.length; i++) {\n\t\t\tif ((array[i] & 0x80) === 0) {\n\t\t\t\tcodepoints.push(array[i] & 0x7F);\n\t\t\t} else if (i+1 < array.length &&\n\t\t\t\t\t\t(array[i]   & 0xE0) === 0xC0 &&\n\t\t\t\t\t\t(array[i+1] & 0xC0) === 0x80) {\n\t\t\t\tcodepoints.push(\n\t\t\t\t\t((array[i]   & 0x1F) << 6) |\n\t\t\t\t\t( array[i+1] & 0x3F));\n\t\t\t} else if (i+2 < array.length &&\n\t\t\t\t\t\t(array[i]   & 0xF0) === 0xE0 &&\n\t\t\t\t\t\t(array[i+1] & 0xC0) === 0x80 &&\n\t\t\t\t\t\t(array[i+2] & 0xC0) === 0x80) {\n\t\t\t\tcodepoints.push(\n\t\t\t\t\t((array[i]   & 0x0F) << 12) |\n\t\t\t\t\t((array[i+1] & 0x3F) <<  6) |\n\t\t\t\t\t( array[i+2] & 0x3F));\n\t\t\t} else if (i+3 < array.length &&\n\t\t\t\t\t\t(array[i]   & 0xF8) === 0xF0 &&\n\t\t\t\t\t\t(array[i+1] & 0xC0) === 0x80 &&\n\t\t\t\t\t\t(array[i+2] & 0xC0) === 0x80 &&\n\t\t\t\t\t\t(array[i+3] & 0xC0) === 0x80) {\n\t\t\t\tcodepoints.push(\n\t\t\t\t\t((array[i]   & 0x07) << 18) |\n\t\t\t\t\t((array[i+1] & 0x3F) << 12) |\n\t\t\t\t\t((array[i+2] & 0x3F) <<  6) |\n\t\t\t\t\t( array[i+3] & 0x3F));\n\t\t\t}\n\t\t}\n\t\treturn String.fromCharCode.apply(null, codepoints);\n\t}\n\n\t/* Not all environments, in particular PhantomJS, supply\n\t   Uint8Array.slice() */\n\tfunction sliceUint8Array(array, begin, end) {\n\t\tif ('slice' in array) {\n\t\t\treturn array.slice(begin, end);\n\t\t} else {\n\t\t\treturn new Uint8Array([].slice.call(array, begin, end));\n\t\t}\n\t}\n\n\t/**\n\t * In addition to the named writing methods documented below,\n\t * the same methods are indexed by the NBT type number as well,\n\t * as shown in the example below.\n\t *\n\t * @constructor\n\t * @see module:nbt.Reader\n\t *\n\t * @example\n\t * var writer = new nbt.Writer();\n\t *\n\t * // all equivalent\n\t * writer.int(42);\n\t * writer[3](42);\n\t * writer(nbt.tagTypes.int)(42);\n\t *\n\t * // overwrite the second int\n\t * writer.offset = 0;\n\t * writer.int(999);\n\t *\n\t * return writer.buffer; */\n\tnbt.Writer = function() {\n\t\tvar self = this;\n\n\t\t/* Will be resized (x2) on write if necessary. */\n\t\tvar buffer = new ArrayBuffer(1024);\n\n\t\t/* These are recreated when the buffer is */\n\t\tvar dataView = new DataView(buffer);\n\t\tvar arrayView = new Uint8Array(buffer);\n\n\t\t/**\n\t\t * The location in the buffer where bytes are written or read.\n\t\t * This increases after every write, but can be freely changed.\n\t\t * The buffer will be resized when necessary.\n\t\t *\n\t\t * @type number */\n\t\tthis.offset = 0;\n\n\t\t// Ensures that the buffer is large enough to write `size` bytes\n\t\t// at the current `self.offset`.\n\t\tfunction accommodate(size) {\n\t\t\tvar requiredLength = self.offset + size;\n\t\t\tif (buffer.byteLength >= requiredLength) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar newLength = buffer.byteLength;\n\t\t\twhile (newLength < requiredLength) {\n\t\t\t\tnewLength *= 2;\n\t\t\t}\n\n\t\t\tvar newBuffer = new ArrayBuffer(newLength);\n\t\t\tvar newArrayView = new Uint8Array(newBuffer);\n\t\t\tnewArrayView.set(arrayView);\n\n\t\t\t// If there's a gap between the end of the old buffer\n\t\t\t// and the start of the new one, we need to zero it out\n\t\t\tif (self.offset > buffer.byteLength) {\n\t\t\t\tnewArrayView.fill(0, buffer.byteLength, self.offset);\n\t\t\t}\n\n\t\t\tbuffer = newBuffer;\n\t\t\tdataView = new DataView(newBuffer);\n\t\t\tarrayView = newArrayView;\n\t\t}\n\n\t\tfunction write(dataType, size, value) {\n\t\t\taccommodate(size);\n\t\t\tdataView['set' + dataType](self.offset, value);\n\t\t\tself.offset += size;\n\t\t\treturn self;\n\t\t}\n\n\t\t/**\n\t\t * Returns the writen data as a slice from the internal buffer,\n\t\t * cutting off any padding at the end.\n\t\t *\n\t\t * @returns {ArrayBuffer} a [0, offset] slice of the interal buffer */\n\t\tthis.getData = function() {\n\t\t\taccommodate(0);  /* make sure the offset is inside the buffer */\n\t\t\treturn buffer.slice(0, self.offset);\n\t\t};\n\n\t\t/**\n\t\t * @method module:nbt.Writer#byte\n\t\t * @param {number} value - a signed byte\n\t\t * @returns {module:nbt.Writer} itself */\n\t\tthis[nbt.tagTypes.byte] = write.bind(this, 'Int8', 1);\n\n\t\t/**\n\t\t * @method module:nbt.Writer#ubyte\n\t\t * @param {number} value - an unsigned byte\n\t\t * @returns {module:nbt.Writer} itself */\n\t\tthis.ubyte = write.bind(this, 'Uint8', 1);\n\n\t\t/**\n\t\t * @method module:nbt.Writer#short\n\t\t * @param {number} value - a signed 16-bit integer\n\t\t * @returns {module:nbt.Writer} itself */\n\t\tthis[nbt.tagTypes.short] = write.bind(this, 'Int16', 2);\n\n\t\t/**\n\t\t * @method module:nbt.Writer#int\n\t\t * @param {number} value - a signed 32-bit integer\n\t\t * @returns {module:nbt.Writer} itself */\n\t\tthis[nbt.tagTypes.int] = write.bind(this, 'Int32', 4);\n\n\t\t/**\n\t\t * @method module:nbt.Writer#float\n\t\t * @param {number} value - a signed 32-bit float\n\t\t * @returns {module:nbt.Writer} itself */\n\t\tthis[nbt.tagTypes.float] = write.bind(this, 'Float32', 4);\n\n\t\t/**\n\t\t * @method module:nbt.Writer#float\n\t\t * @param {number} value - a signed 64-bit float\n\t\t * @returns {module:nbt.Writer} itself */\n\t\tthis[nbt.tagTypes.double] = write.bind(this, 'Float64', 8);\n\n\t\t/**\n\t\t * As JavaScript does not support 64-bit integers natively, this\n\t\t * method takes an array of two 32-bit integers that make up the\n\t\t * upper and lower halves of the long.\n\t\t *\n\t\t * @method module:nbt.Writer#long\n\t\t * @param {Array.<number>} value - [upper, lower]\n\t\t * @returns {module:nbt.Writer} itself */\n\t\tthis[nbt.tagTypes.long] = function(value) {\n\t\t\tself.int(value[0]);\n\t\t\tself.int(value[1]);\n\t\t\treturn self;\n\t\t};\n\n\t\t/**\n\t\t * @method module:nbt.Writer#byteArray\n\t\t * @param {Array.<number>|Uint8Array|Buffer} value\n\t\t * @returns {module:nbt.Writer} itself */\n\t\tthis[nbt.tagTypes.byteArray] = function(value) {\n\t\t\tthis.int(value.length);\n\t\t\taccommodate(value.length);\n\t\t\tarrayView.set(value, this.offset);\n\t\t\tthis.offset += value.length;\n\t\t\treturn this;\n\t\t};\n\n\t\t/**\n\t\t * @method module:nbt.Writer#intArray\n\t\t * @param {Array.<number>} value\n\t\t * @returns {module:nbt.Writer} itself */\n\t\tthis[nbt.tagTypes.intArray] = function(value) {\n\t\t\tthis.int(value.length);\n\t\t\tvar i;\n\t\t\tfor (i = 0; i < value.length; i++) {\n\t\t\t\tthis.int(value[i]);\n\t\t\t}\n\t\t\treturn this;\n\t\t};\n\n\t\t/**\n\t\t * @method module:nbt.Writer#longArray\n\t\t * @param {Array.<number>} value\n\t\t * @returns {module:nbt.Writer} itself */\n\t\tthis[nbt.tagTypes.longArray] = function(value) {\n\t\t\tthis.int(value.length);\n\t\t\tvar i;\n\t\t\tfor (i = 0; i < value.length; i++) {\n\t\t\t\tthis.long(value[i]);\n\t\t\t}\n\t\t\treturn this;\n\t\t};\n\n\t\t/**\n\t\t * @method module:nbt.Writer#string\n\t\t * @param {string} value\n\t\t * @returns {module:nbt.Writer} itself */\n\t\tthis[nbt.tagTypes.string] = function(value) {\n\t\t\tvar bytes = encodeUTF8(value);\n\t\t\tthis.short(bytes.length);\n\t\t\taccommodate(bytes.length);\n\t\t\tarrayView.set(bytes, this.offset);\n\t\t\tthis.offset += bytes.length;\n\t\t\treturn this;\n\t\t};\n\n\t\t/**\n\t\t * @method module:nbt.Writer#list\n\t\t * @param {Object} value\n\t\t * @param {number} value.type - the NBT type number\n\t\t * @param {Array} value.value - an array of values\n\t\t * @returns {module:nbt.Writer} itself */\n\t\tthis[nbt.tagTypes.list] = function(value) {\n\t\t\tthis.byte(nbt.tagTypes[value.type]);\n\t\t\tthis.int(value.value.length);\n\t\t\tvar i;\n\t\t\tfor (i = 0; i < value.value.length; i++) {\n\t\t\t\tthis[value.type](value.value[i]);\n\t\t\t}\n\t\t\treturn this;\n\t\t};\n\n\t\t/**\n\t\t * @method module:nbt.Writer#compound\n\t\t * @param {Object} value - a key/value map\n\t\t * @param {Object} value.KEY\n\t\t * @param {string} value.KEY.type - the NBT type number\n\t\t * @param {Object} value.KEY.value - a value matching the type\n\t\t * @returns {module:nbt.Writer} itself\n\t\t *\n\t\t * @example\n\t\t * writer.compound({\n\t\t *     foo: { type: 'int', value: 12 },\n\t\t *     bar: { type: 'string', value: 'Hello, World!' }\n\t\t * }); */\n\t\tthis[nbt.tagTypes.compound] = function(value) {\n\t\t\tvar self = this;\n\t\t\tObject.keys(value).map(function (key) {\n\t\t\t\tself.byte(nbt.tagTypes[value[key].type]);\n\t\t\t\tself.string(key);\n\t\t\t\tself[value[key].type](value[key].value);\n\t\t\t});\n\t\t\tthis.byte(nbt.tagTypes.end);\n\t\t\treturn this;\n\t\t};\n\n\t\tvar typeName;\n\t\tfor (typeName in nbt.tagTypes) {\n\t\t\tif (nbt.tagTypes.hasOwnProperty(typeName)) {\n\t\t\t\tthis[typeName] = this[nbt.tagTypes[typeName]];\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * In addition to the named writing methods documented below,\n\t * the same methods are indexed by the NBT type number as well,\n\t * as shown in the example below.\n\t *\n\t * @constructor\n\t * @see module:nbt.Writer\n\t *\n\t * @example\n\t * var reader = new nbt.Reader(buf);\n\t * int x = reader.int();\n\t * int y = reader[3]();\n\t * int z = reader[nbt.tagTypes.int](); */\n\tnbt.Reader = function(buffer) {\n\t\tif (!buffer) { throw new Error('Argument \"buffer\" is falsy'); }\n\n\t\tvar self = this;\n\n\t\t/**\n\t\t * The current location in the buffer. Can be freely changed\n\t\t * within the bounds of the buffer.\n\t\t *\n\t\t * @type number */\n\t\tthis.offset = 0;\n\n\t\tvar arrayView = new Uint8Array(buffer);\n\t\tvar dataView = new DataView(arrayView.buffer);\n\n\t\tfunction read(dataType, size) {\n\t\t\tvar val = dataView['get' + dataType](self.offset);\n\t\t\tself.offset += size;\n\t\t\treturn val;\n\t\t}\n\n\t\t/**\n\t\t * @method module:nbt.Reader#byte\n\t\t * @returns {number} the read byte */\n\t\tthis[nbt.tagTypes.byte] = read.bind(this, 'Int8', 1);\n\n\t\t/**\n\t\t * @method module:nbt.Reader#byte\n\t\t * @returns {number} the read unsigned byte */\n\t\tthis.ubyte = read.bind(this, 'Uint8', 1);\n\n\t\t/**\n\t\t * @method module:nbt.Reader#short\n\t\t * @returns {number} the read signed 16-bit short  */\n\t\tthis[nbt.tagTypes.short] = read.bind(this, 'Int16', 2);\n\n\t\t/**\n\t\t * @method module:nbt.Reader#int\n\t\t * @returns {number} the read signed 32-bit integer */\n\t\tthis[nbt.tagTypes.int] = read.bind(this, 'Int32', 4);\n\n\t\t/**\n\t\t * @method module:nbt.Reader#float\n\t\t * @returns {number} the read signed 32-bit float */\n\t\tthis[nbt.tagTypes.float] = read.bind(this, 'Float32', 4);\n\n\t\t/**\n\t\t * @method module:nbt.Reader#double\n\t\t * @returns {number} the read signed 64-bit float */\n\t\tthis[nbt.tagTypes.double] = read.bind(this, 'Float64', 8);\n\n\t\t/**\n\t\t * As JavaScript does not not natively support 64-bit\n\t\t * integers, the value is returned as an array of two\n\t\t * 32-bit integers, the upper and the lower.\n\t\t *\n\t\t * @method module:nbt.Reader#long\n\t\t * @returns {Array.<number>} [upper, lower] */\n\t\tthis[nbt.tagTypes.long] = function() {\n\t\t\treturn [this.int(), this.int()];\n\t\t};\n\n\t\t/**\n\t\t * @method module:nbt.Reader#byteArray\n\t\t * @returns {Array.<number>} the read array */\n\t\tthis[nbt.tagTypes.byteArray] = function() {\n\t\t\tvar length = this.int();\n\t\t\tvar bytes = [];\n\t\t\tvar i;\n\t\t\tfor (i = 0; i < length; i++) {\n\t\t\t\tbytes.push(this.byte());\n\t\t\t}\n\t\t\treturn bytes;\n\t\t};\n\n\t\t/**\n\t\t * @method module:nbt.Reader#intArray\n\t\t * @returns {Array.<number>} the read array of 32-bit ints */\n\t\tthis[nbt.tagTypes.intArray] = function() {\n\t\t\tvar length = this.int();\n\t\t\tvar ints = [];\n\t\t\tvar i;\n\t\t\tfor (i = 0; i < length; i++) {\n\t\t\t\tints.push(this.int());\n\t\t\t}\n\t\t\treturn ints;\n\t\t};\n\n\t\t/**\n\t\t * As JavaScript does not not natively support 64-bit\n\t\t * integers, the value is returned as an array of arrays of two\n\t\t * 32-bit integers, the upper and the lower.\n\t\t *\n\t\t * @method module:nbt.Reader#longArray\n\t\t * @returns {Array.<number>} the read array of 64-bit ints\n\t\t *     split into [upper, lower] */\n\t\tthis[nbt.tagTypes.longArray] = function() {\n\t\t\tvar length = this.int();\n\t\t\tvar longs = [];\n\t\t\tvar i;\n\t\t\tfor (i = 0; i < length; i++) {\n\t\t\t\tlongs.push(this.long());\n\t\t\t}\n\t\t\treturn longs;\n\t\t};\n\n\t\t/**\n\t\t * @method module:nbt.Reader#string\n\t\t * @returns {string} the read string */\n\t\tthis[nbt.tagTypes.string] = function() {\n\t\t\tvar length = this.short();\n\t\t\tvar slice = sliceUint8Array(arrayView, this.offset,\n\t\t\t\tthis.offset + length);\n\t\t\tthis.offset += length;\n\t\t\treturn decodeUTF8(slice);\n\t\t};\n\n\t\t/**\n\t\t * @method module:nbt.Reader#list\n\t\t * @returns {{type: string, value: Array}}\n\t\t *\n\t\t * @example\n\t\t * reader.list();\n\t\t * // -> { type: 'string', values: ['foo', 'bar'] } */\n\t\tthis[nbt.tagTypes.list] = function() {\n\t\t\tvar type = this.byte();\n\t\t\tvar length = this.int();\n\t\t\tvar values = [];\n\t\t\tvar i;\n\t\t\tfor (i = 0; i < length; i++) {\n\t\t\t\tvalues.push(this[type]());\n\t\t\t}\n\t\t\treturn { type: nbt.tagTypeNames[type], value: values };\n\t\t};\n\n\t\t/**\n\t\t * @method module:nbt.Reader#compound\n\t\t * @returns {Object.<string, { type: string, value }>}\n\t\t *\n\t\t * @example\n\t\t * reader.compound();\n\t\t * // -> { foo: { type: int, value: 42 },\n\t\t * //      bar: { type: string, value: 'Hello! }} */\n\t\tthis[nbt.tagTypes.compound] = function() {\n\t\t\tvar values = {};\n\t\t\twhile (true) {\n\t\t\t\tvar type = this.byte();\n\t\t\t\tif (type === nbt.tagTypes.end) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tvar name = this.string();\n\t\t\t\tvar value = this[type]();\n\t\t\t\tvalues[name] = { type: nbt.tagTypeNames[type], value: value };\n\t\t\t}\n\t\t\treturn values;\n\t\t};\n\n\t\tvar typeName;\n\t\tfor (typeName in nbt.tagTypes) {\n\t\t\tif (nbt.tagTypes.hasOwnProperty(typeName)) {\n\t\t\t\tthis[typeName] = this[nbt.tagTypes[typeName]];\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * @param {Object} value - a named compound\n\t * @param {string} value.name - the top-level name\n\t * @param {Object} value.value - a compound\n\t * @returns {ArrayBuffer}\n\t *\n\t * @see module:nbt.parseUncompressed\n\t * @see module:nbt.Writer#compound\n\t *\n\t * @example\n\t * nbt.writeUncompressed({\n\t *     name: 'My Level',\n\t *     value: {\n\t *         foo: { type: int, value: 42 },\n\t *         bar: { type: string, value: 'Hi!' }\n\t *     }\n\t * }); */\n\tnbt.writeUncompressed = function(value) {\n\t\tif (!value) { throw new Error('Argument \"value\" is falsy'); }\n\n\t\tvar writer = new nbt.Writer();\n\n\t\twriter.byte(nbt.tagTypes.compound);\n\t\twriter.string(value.name);\n\t\twriter.compound(value.value);\n\n\t\treturn writer.getData();\n\t};\n\n\t/**\n\t * @param {ArrayBuffer|Buffer} data - an uncompressed NBT archive\n\t * @returns {{name: string, value: Object.<string, Object>}}\n\t *     a named compound\n\t *\n\t * @see module:nbt.parse\n\t * @see module:nbt.writeUncompressed\n\t *\n\t * @example\n\t * nbt.readUncompressed(buf);\n\t * // -> { name: 'My Level',\n\t * //      value: { foo: { type: int, value: 42 },\n\t * //               bar: { type: string, value: 'Hi!' }}} */\n\tnbt.parseUncompressed = function(data) {\n\t\tif (!data) { throw new Error('Argument \"data\" is falsy'); }\n\n\t\tvar reader = new nbt.Reader(data);\n\n\t\tvar type = reader.byte();\n\t\tif (type !== nbt.tagTypes.compound) {\n\t\t\tthrow new Error('Top tag should be a compound');\n\t\t}\n\n\t\treturn {\n\t\t\tname: reader.string(),\n\t\t\tvalue: reader.compound()\n\t\t};\n\t};\n\n\t/**\n\t * @callback parseCallback\n\t * @param {Object} error\n\t * @param {Object} result - a named compound\n\t * @param {string} result.name - the top-level name\n\t * @param {Object} result.value - the top-level compound */\n\n\t/**\n\t * This accepts both gzipped and uncompressd NBT archives.\n\t * If the archive is uncompressed, the callback will be\n\t * called directly from this method. For gzipped files, the\n\t * callback is async.\n\t *\n\t * For use in the browser, window.zlib must be defined to decode\n\t * compressed archives. It will be passed a Buffer if the type is\n\t * available, or an Uint8Array otherwise.\n\t *\n\t * @param {ArrayBuffer|Buffer} data - gzipped or uncompressed data\n\t * @param {parseCallback} callback\n\t *\n\t * @see module:nbt.parseUncompressed\n\t * @see module:nbt.Reader#compound\n\t *\n\t * @example\n\t * nbt.parse(buf, function(error, results) {\n\t *     if (error) {\n\t *         throw error;\n\t *     }\n\t *     console.log(result.name);\n\t *     console.log(result.value.foo);\n\t * }); */\n\tnbt.parse = function(data, callback) {\n\t\tif (!data) { throw new Error('Argument \"data\" is falsy'); }\n\n\t\tvar self = this;\n\n\t\tif (!hasGzipHeader(data)) {\n\t\t\tcallback(null, self.parseUncompressed(data));\n\t\t} else if (!zlib) {\n\t\t\tcallback(new Error('NBT archive is compressed but zlib is not ' +\n\t\t\t\t'available'), null);\n\t\t} else {\n\t\t\t/* zlib.gunzip take a Buffer, at least in Node, so try to convert\n\t\t\t   if possible. */\n\t\t\tvar buffer;\n\t\t\tif (data.length) {\n\t\t\t\tbuffer = data;\n\t\t\t} else if (typeof Buffer !== 'undefined') {\n\t\t\t\tbuffer = new Buffer(data);\n\t\t\t} else {\n\t\t\t\t/* In the browser? Unknown zlib library. Let's settle for\n\t\t\t\t   Uint8Array and see what happens. */\n\t\t\t\tbuffer = new Uint8Array(data);\n\t\t\t}\n\n\t\t\tzlib.gunzip(buffer, function(error, uncompressed) {\n\t\t\t\tif (error) {\n\t\t\t\t\tcallback(error, null);\n\t\t\t\t} else {\n\t\t\t\t\tcallback(null, self.parseUncompressed(uncompressed));\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n}).apply(typeof exports !== 'undefined' ? exports : (window.nbt = {}));\n"]}